Example #1
0
if ($debug || $session->cronCheck < time() - 3) {
    cron::$crondir = root . 'cron/';
    cron::$maxRuns = 16;
    cron::checkAll();
    $session->cronCheck = time();
}
// url routing
router::$views = root . 'views/';
router::$index = 'index';
router::$error = '404';
$uri = $_SERVER['REQUEST_URI'];
$page = router::path($uri);
// auto-html template
$tpl = new template();
$tpl->url = $_SERVER['REQUEST_URI'];
$css = ['/style/main.css', '/style/' . $session->theme . '.css'];
$js = ['http://code.jquery.com/jquery-1.10.2.min.js'];
$favicon = '/style/favicon.ico';
// translate with vars
language::$dir = root . 'lang/';
$language = new language($session->language);
$language->load($page);
require router::$views . $page . '.php';
$tpl->title = 'CSO - ' . ucwords(str_replace('/', ' ', $page));
$language->translate($tpl);
$tpl->end($css, $js, $favicon);
if ($page != router::$error) {
    $session->lastpage = $_SERVER['REQUEST_URI'];
}
// millisecond counter (view source)
exit('<!--' . round(microtime(true) - start, 5) * 1000 . 'ms-->');