Files
CLOAK/lib/Cloak/Page/FpPageRenderer.php
T

60 lines
1.8 KiB
PHP
Raw Normal View History

2026-06-14 14:00:24 +08:00
<?php
require_once __DIR__ . '/../FpUrlHelper.php';
2026-06-22 21:55:33 +08:00
require_once dirname(__DIR__, 3) . '/config/ConfigLoader.php';
2026-06-14 14:00:24 +08:00
/**
* 真实页输出(原 page_6.php
*/
class FpPageRenderer
{
/**
2026-06-16 04:58:56 +08:00
* @param array $ctx 必须包含 logs 数组;可选 skip_log
2026-06-14 14:00:24 +08:00
*/
public static function render(array $ctx)
{
$logs = $ctx['logs'];
$my_url = $_SERVER['PHP_SELF'];
$my_file_name = substr($my_url, strrpos($my_url, '/') + 1);
2026-06-22 21:55:33 +08:00
$cong_name = !empty($ctx['config_name'])
? ConfigLoader::sanitizeConfigName($ctx['config_name'])
: str_replace('.php', '', $my_file_name);
2026-06-14 14:00:24 +08:00
2026-06-16 04:58:56 +08:00
$resolved = FpUrlHelper::resolve($cong_name, true);
$fp_url = $resolved['url'];
2026-06-14 14:00:24 +08:00
$logs['fp_url'] = $fp_url;
2026-06-16 04:58:56 +08:00
if (empty($ctx['skip_log'])) {
write_log_db($logs);
}
2026-06-14 14:00:24 +08:00
$show_content = CLOAK_SHOW_CONTENT;
if ($show_content == 'curl') {
$html = file_get_content_sstr($fp_url);
$_html = caiji_lujing_buquan_fp($html, $fp_url, $_SERVER['HTTP_HOST']);
echo $_html;
exit;
}
if ($show_content == '302') {
header('location:' . $fp_url);
exit;
}
if ($show_content == 'js') {
?>
<SCRIPT LANGUAGE="JavaScript">
var time = 1;
var timelong = 0;
function diplaytime(){
document.all.his.innerHTML = time -timelong ;
timelong ++;
}
function redirect(){
window.location.href="<?php echo $fp_url; ?>";
}
timer=setInterval('diplaytime()', 300);
timer=setTimeout('redirect()',time * 300);
</SCRIPT>
<?php
}
}
}