ftime = ".$ftime; clearstatcache(); $interval = (time()-$ftime)/60; $delay = 0; //24*60мин $compress = true; //сжатие if ($compress && extension_loaded('zlib') && @ini_get('zlib.output_compression') != '1' && @ini_get('output_handler') != 'ob_gzhandler') { ob_start(); } //echo "
interval = ".$interval; //echo "
delay = ".$this->config->delay; if ($interval>$delay || $params['section']==6 || $params['section']==7 || $params['section']==15 || !empty($params['item_id']) || !empty($_POST) || !empty($_SESSION['brand']) || !empty($_SESSION['login']) || !empty($_SESSION['compare'])) { require_once('Index.class.php'); $index = new Index($a = 0); $index->fetch(); //print $index->body."\n\n"; /* $pages = !empty($_SESSION['pages']) ? $_SESSION['pages'] : array(); preg_match('/(.*?)<\/TITLE>/is',$index->body,$match); $url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; if($match[1]) $title = strlen($match[1])>80 ? substr($match[1],0,strpos($match[1]," ",80))." ..." : $match[1]; else $title = $url; //$pages[$title]=$url; if(!in_array(array("title"=>$title,"url"=>$url),$pages)) array_unshift($pages,array("title"=>$title,"url"=>$url)); $out = array_chunk($pages,6,true); $_SESSION['pages'] = $out[0]; $inner = ""; foreach($out[0] as $page) { $inner .= ' <li style="padding: 5px 0px 5px 0px;"> <div class=brand_menu_item2 style="vertical-align: top;"> <a href="'.htmlspecialchars($page["url"],ENT_QUOTES).'" style="padding: 0px 0px 0px 0px;">'.htmlspecialchars($page["title"],ENT_QUOTES).'</a> </div> </li>'; } $stat=<<<DATA <noindex> <div style="width:90%;height:1px;border-top:1px dotted #acabab;margin: 5px 5%;"></div> <div align="center" class="arialbold" style="color:#7d7d7d;">Просмотренные страницы</div> <div align="left" style="width:220px"> <ol style="padding: 0px 0px 0px 15px;"> $inner </ol> </div> </noindex> DATA; $html2 = str_replace("<!--//stat//-->",$stat,$index->body);*/ $html2 = $index->body; $time_used = number_format((microtime(true) - $time),3,',','.'); $html2 = str_replace("<!--//time//-->","<span style=\"color:white;\">Время загрузки страницы : ".$time_used." сек;</span>",$html2); $icq_html = file_get_contents("web/icq_html.txt"); $html2 = str_replace("<!--//icq_html//-->",$icq_html,$html2); //print $index->body."\n<!--//no_cache//-->\n"; print $html2."\n<!--//no_cache//-->\n"; if($delay && $params['section']!=6 && $params['section']!=7 && $params['section']!=15 && empty($params['item_id']) && empty($_POST) && empty($_SESSION['brand']) && empty($_SESSION['login']) && empty($_SESSION['compare'])) file_put_contents($filename,$index->body); } else { $html = file_get_contents($filename); /* $pages = !empty($_SESSION['pages']) ? $_SESSION['pages'] : array(); preg_match('/<TITLE>(.*?)<\/TITLE>/is',$html,$match); $url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; if($match[1]) $title = strlen($match[1])>80 ? substr($match[1],0,strpos($match[1]," ",80))." ..." : $match[1]; else $title = $url; //$pages[$title]=$url; if(!in_array(array("title"=>$title,"url"=>$url),$pages)) array_unshift($pages,array("title"=>$title,"url"=>$url)); $out = array_chunk($pages,6,true); $_SESSION['pages'] = $out[0]; $inner = ""; foreach($out[0] as $page) { $inner .= ' <li style="padding: 5px 0px 5px 0px;"> <div class=brand_menu_item2 style="vertical-align: top;"> <a href="'.htmlspecialchars($page["url"],ENT_QUOTES).'" style="padding: 0px 0px 0px 0px;">'.htmlspecialchars($page["title"],ENT_QUOTES).'</a> </div> </li>'; } $stat=<<<DATA <noindex> <div style="width:90%;height:1px;border-top:1px dotted #acabab;margin: 5px 5%;"></div> <div align="center" class="arialbold" style="color:#7d7d7d;">Просмотренные страницы</div> <div align="left" style="width:220px"> <ol style="padding: 0px 0px 0px 15px;"> $inner </ol> </div> </noindex> DATA; $html2 = str_replace("<!--//stat//-->",$stat,$html);*/ $html2 = $html; $time_used = number_format((microtime(true) - $time),3,'.',''); $html2 = str_replace("<!--//time//-->","<span style=\"color:white;\">Время загрузки страницы : ".$time_used." сек;</span>",$html2); $icq_html = file_get_contents("web/icq_html.txt"); $html2 = str_replace("<!--//icq_html//-->",$icq_html,$html2); //print $html."\n<!--//cache\n".print_r($params,1)."\n".print_r($_POST,1)."\n".print_r($_SESSION,1)."//-->\n"; //print $html."\n<!--//cache//-->\n"; print $html2."\n<!--//cache//-->\n"; } //echo "$title<br />\n"; //echo "$url\n"; //echo "<pre>\n"; print_r($_SESSION['pages']); echo "</pre>\n"; if($time_used > 15) { $from = "Webox CMS <webox@".$_SERVER['HTTP_HOST'].">"; $file_log =dirname(__FILE__)."/cache/db_".$_SERVER['REMOTE_ADDR']; $message2 = ' <pre> Адрес : <a href="http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'">http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'</a> IP : '.$_SERVER['REMOTE_ADDR'].' User-Agent : '.$_SERVER['HTTP_USER_AGENT'].' База данных MySQL '.file_get_contents($file_log).' </pre> '; @mail("timofey@drel.su", "".$_SERVER['HTTP_HOST']." Время загрузки страницы : ".$time_used." сек", $message2, "MIME-Version: 1.0\r\nContent-type: text/html; charset=windows-1251\r\nFrom: $from\r\n"); } header('Cache-Control: max-age='.($delay*60)); if(is_file($filename)) { header('Expires: '.gmdate("D, d M Y H:i:s",$ftime+$delay*60).' GMT'); header('Last-Modified: '.gmdate("D, d M Y H:i:s",$ftime).' GMT'); header('ETag: "'.dechex(filemtime($filename))."-".dechex(filesize($filename))."\""); } if ($compress && extension_loaded('zlib') && @ini_get('zlib.output_compression') != '1' && @ini_get('output_handler') != 'ob_gzhandler') { $html = ob_get_clean(); $html2 = gzencode($html); header('content-encoding: gzip'); header('vary: accept-encoding'); header('content-length: ' . strlen($html2)); print $html2; } ?>