Esempio n. 1
0
// connect to localhost:3306/root
mysql::$models = root . 'models/';
mysql::connect('adm78', 'csodb');
// check cron but block spam
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) {