process_request(); exit(); } $sape_context = new SAPE_context($o); ob_start(array(&$sape_context,'replace_in_page')); Header("HTTP/1.0 200 OK"); if ($url=='/' or $url=='/index.php'){ $vivod = file_get_contents('./index.html'); } $url = str_replace("/?", "/index.html?", $url); $url = str_replace("//", "./", $url); $url = str_replace("=product/", "=product%2F", $url); $url = str_replace("affiliate/", "affiliate%2F", $url); $url = str_replace("information/", "information%2F", $url); $url = str_replace("account/return/", "account%2Freturn%2F", $url); $url = str_replace("account/", "account%2F", $url); $url = str_replace("checkout/", "checkout%2F", $url); $url = str_replace("=common/", "=common%2F", $url); //if (strpos($url, 'connector.php?')!==false){ $urd = explode('connector.php?', $url); $urd[1]=str_replace('/', '%2F', $urd[1]); $url=$urd[0].'connector.php?'.$urd[1]; } //preg_match_all('/href=\"(.*?)\"/', $vivod, $array); // preg_match_all('#

(.+?)

#is', $vivod, $array); //foreach ($array[1] as $item){ file_put_contents('1.txt', $item.'', FILE_APPEND); } //file_put_contents('1.txt', array_unique(file('1.txt'))); //preg_match_all('/src=\"(.*?)\"/', $vivod, $array); // выбираем из переменной $content все src //foreach ($array[1] as $item){ file_put_contents('1.txt', $item, FILE_APPEND); } $type=strpos($url, '.css'); $type2=strpos($url, '.js'); if ($type===false){header('Content-Type:text/html'); if ($type2===false){} else { header('Content-Type:text/javascript'); }} else{header('Content-Type:text/css'); } if (strpos($url, '.jpg')!==false){header('Content-Type:image/jpeg'); } if (strpos($url, '.gif')!==false){header('Content-Type:image/gif'); } if (strpos($url, '.png')!==false){header('Content-Type:image/png'); } if (strpos($url, '.webp')!==false){header('Content-Type:image/webp'); } if (strpos($url, '.svg')!==false){header('Content-Type:image/svg+xml'); } if (strpos($url, '.ico')!==false){header('Content-Type:image/vnd.microsoft.icon'); } if (strpos($url, '.woff2')!==false){header('Content-Type:font/woff2'); } $sim=substr($url, -1); if ($sim=='/'){ $addr = substr($url,1,-1).'.html'; } else {$addr = substr($url,1,0).'.html';} //echo $addr.'
'.$url; header("HTTP/1.0 200 OK"); $vivod=file_get_contents($addr); if ($vivod==''){$vivod=file_get_contents('.'.$url.'.css');} if ($vivod==''){$vivod=file_get_contents('.'.$url.'.html');} if ($vivod==''){$vivod=file_get_contents('.'.$url.'');} if ($vivod==''){$vivod=file_get_contents('.'.$url.'/index.html');} if ($vivod=='' and $type!==false){$url=strstr($url, '?', true); $vivod=file_get_contents('.'.$url.'');} if (strpos($url, '/en/')!==false){ if ($vivod==''){ $newurl = str_replace("/en", "", $url); $urlParts = explode('/', $newurl); $enFolderPath = $_SERVER['DOCUMENT_ROOT'] . "/en/"; if (!file_exists($enFolderPath)) { mkdir($enFolderPath, 0777, true); } $folderPath = $enFolderPath; for ($i = 0; $i < count($urlParts) - 1; $i++) { $folderPath .= $urlParts[$i] . '/'; if (!file_exists($folderPath)) { mkdir($folderPath, 0777); }} $enFilePath = $enFolderPath . $newurl; $urlcode='https://codlife.ru/en/'.$_SERVER['HTTP_HOST'].$newurl.'?12345'; $vivod=file_get_contents($urlcode); if (pathinfo($enFilePath, PATHINFO_EXTENSION) === '') { $enFilePath .= '.html'; } if (strpos($enFilePath, '/.html')!==false){ $enFilePath = str_replace("/.html", "/index.html", $enFilePath); } file_put_contents($enFilePath, $vivod); }} $allHeaders = getallheaders(); $cont=$allHeaders['Accept']; if (strpos($cont, 'text/html')!==false){ $vivod = str_replace("https://www.", "https://", $vivod); $vivod = str_replace("https://www.", "https://", $vivod); $vivod = str_replace("https://", "https://", $vivod); //$vivod = iconv('windows-1251//IGNORE', 'utf-8//IGNORE', $vivod); } if (strpos($url, 'yandex')!==false){ echo file_get_contents('.'.$url.''); exit();} if ($vivod==''){ $urjson=$_SERVER["REQUEST_URI"]; $urjson = str_replace("/", "", $urjson); $urjson = str_replace(".html", "", $urjson); $dir = '1/'.$urjson.'.json'; if (file_exists($dir)) { $filenameWithoutExtension = pathinfo($dir, PATHINFO_FILENAME); $jsonContent = file_get_contents($dir); $jsonData = json_decode($jsonContent, true); $fileData = ['title' => $jsonData['title'], 'header' => $jsonData['name'], 'description' => $jsonData['description'], 'text' => $jsonData['text'], 'filename' => $filenameWithoutExtension, 'time' => filemtime($dir) ]; $vivod=file_get_contents('shabl.html'); $vivod = str_replace("https://www.", "https://", $vivod); $vivod = str_replace("https://www.", "https://", $vivod); $vivod = str_replace("https://", "https://", $vivod); $vivod = str_replace("{title}", $fileData['title'], $vivod); $vivod = str_replace("{description}", $fileData['description'], $vivod); $vivod = str_replace("{header}", $fileData['header'], $vivod); $vivod = str_replace("{body}", $fileData['text'], $vivod); $vivod = str_replace("{url}", $fileData['filename'], $vivod); $vivod = str_replace("{date}", date("d.m.Y, H:i", $fileData['time']-5*60*60), $vivod); }} if (strpos($vivod, '
')!==false){ $dir = '1/'; $files = scandir($dir); $files = array_diff($files, array('..', '.')); $fileData = []; foreach ($files as $file) { $filenameWithoutExtension = pathinfo($file, PATHINFO_FILENAME); $filePath = $dir . $file; $jsonContent = file_get_contents($filePath); $jsonData = json_decode($jsonContent, true); $fileData[] = ['title' => $jsonData['title'], 'filename' => $filenameWithoutExtension, 'enabl' => $jsonData['enabl'], 'time' => filemtime($filePath) ]; } usort($fileData, function($a, $b) { return $b['time'] - $a['time']; }); if (strpos($_SERVER['HTTP_USER_AGENT'], 'cp9adminlol')!==false){ $output='
добавить или редактировать статью

'; } foreach ($fileData as $data) { if ($data['enabl']=='1'){ $output .= '
';}} $vivod = str_replace('
', $output, $vivod); } $vivod = str_replace('', '', $vivod); if (strpos($_SERVER['REQUEST_URI'], '/en/')!==false){$vivod = preg_replace('/