File: //home/temp/yarusvl.ru/index.php
<?php
//var_dump($_SERVER['REQUEST_URI']);
/**
 * hack for resizers
 */
/*var_dump($_SERVER['REQUEST_URI']);
var_dump(preg_match("|/files/(.*)|i",$_SERVER['REQUEST_URI'],$ch));*/
/*if(preg_match("|/files/(.*)/(.*)|i",$_SERVER['REQUEST_URI'],$ch)){
    include "./resizex/resizex.php?object=".$ch[1]."&file=".$ch[2]."&token=".$_SERVER['QUERY_STRING'];
    exit;
}*/
//ini_set("display_errors",1);
$time_start = microtime(true);
if(!empty($_SERVER['HTTP_USER_AGENT'])){
    session_name(md5($_SERVER['HTTP_USER_AGENT']));
}
session_start();
ini_set('session.gc_maxlifetime', 2592000);
ini_set('session.cookie_lifetime', 2592000);
// 2592000
/* паролим */
/*if(isset($_POST['e']) && "6800"===$_POST['e']) { $_SESSION['e'] = true;  header("Location: ".$_SERVER['REQUEST_URI']); exit;}
if(!isset($_SESSION["e"]))die("<form method='post'><input type='password' name='e'><input type='submit' value='ok'></form>");
*/
require_once('view/IndexView.php');
$view = new IndexView();
if(isset($_GET['logout'])) {
    unset($_SESSION['admin']);
    header('location: '.$view->config->root_url);
    exit();
}
if(($res = $view->fetch()) !== false) {
    header("Content-type: text/html; charset=UTF-8");
    print $res;
   // print str_replace(array("\n","\t"),array("",""),$res);
    // Сохраняем последнюю просмотренную страницу в переменной $_SESSION['last_visited_page']
    if (empty($_SESSION['last_visited_page']) || empty($_SESSION['current_page']) || $_SERVER['REQUEST_URI'] !== $_SESSION['current_page']) {
        if(!empty($_SESSION['current_page']) && $_SESSION['last_visited_page'] !== $_SESSION['current_page']) {
            $_SESSION['last_visited_page'] = $_SESSION['current_page'];
        }
        $_SESSION['current_page'] = $_SERVER['REQUEST_URI'];
    }
} else {
    // Иначе страница об ошибке
    header("http/1.0 404 not found");
    // Подменим переменную GET, чтобы вывести страницу 404
    $_GET['page_url'] = '404';
    $_GET['module'] = 'PageView';
    print $view->fetch();
}
// Отладочная информация
print "<!--\r\n";
$time_end = microtime(true);
$exec_time = $time_end-$time_start;
if(function_exists('memory_get_peak_usage')) {
    print "memory peak usage: ".memory_get_peak_usage()." bytes\r\n";
}
print "page generation time: ".$exec_time." seconds\r\n";
print "-->";