Files
CLOAK/lib/Cloak/Page/FpPageRenderer.php
2026-06-27 23:58:54 +08:00

62 lines
1.9 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require_once __DIR__ . '/../FpUrlHelper.php';
require_once dirname(__DIR__, 3) . '/config/ConfigLoader.php';
/**
* 真实页输出(原 page_6.php
*/
class FpPageRenderer
{
/**
* @param array $ctx 必须包含 logs 数组;可选 skip_log
*/
public static function render(array $ctx)
{
$logs = $ctx['logs'];
$my_url = $_SERVER['PHP_SELF'];
$my_file_name = substr($my_url, strrpos($my_url, '/') + 1);
$cong_name = !empty($ctx['config_name'])
? ConfigLoader::sanitizeConfigName($ctx['config_name'])
: str_replace('.php', '', $my_file_name);
$resolved = FpUrlHelper::resolve($cong_name, true);
$fp_url = $resolved['url'];
$logs['fp_url'] = $fp_url;
if (empty($ctx['skip_log'])) {
write_log_db($logs);
}
$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('Referrer-Policy: origin-when-cross-origin');
header('Location: ' . $fp_url, true, 302);
exit;
}
if ($show_content == 'js') {
$fp_url_js = htmlspecialchars($fp_url, ENT_QUOTES, 'UTF-8');
?>
<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_js; ?>";
}
timer=setInterval('diplaytime()', 300);
timer=setTimeout('redirect()',time * 300);
</SCRIPT>
<?php
}
}
}