Example #1
0
}
$timer = new Timer();
// Starting Slim Framework
$app = new \Slim\Slim($config);
// Session
session_set_save_handler(new RedisSessionHandler(), true);
session_cache_limiter(false);
session_start();
$visitors = new RedisTtlCounter('ttlc:visitors', 300);
$visitors->add(IP::get());
$requests = new RedisTtlCounter('ttlc:requests', 300);
$requests->add(uniqid());
$load = getLoad();
// Check if the user has autologin turned on
if ($load < 20 && !User::isLoggedIn()) {
    User::autoLogin();
}
if ($load >= 20) {
    $uri = @$_SERVER['REQUEST_URI'];
    if ($uri != '') {
        $contents = $redis->get("cache:{$uri}");
        if ($contents !== false) {
            echo $contents;
            exit;
        }
        $_SERVER['requestDttm'] = $mdb->now();
        $qServer = new RedisQueue('queueServer');
        $qServer->push($_SERVER);
    }
}
// Theme
Example #2
0
$db->connect();
$user = new User();
$mo_settings = array();
$mo_request = '';
$mo_plugin = array();
$mo_theme = '';
$mo_theme_floder = '';
$mo_theme_file = '';
mo_load_settings();
$mo_request = mo_analyze();
getPT();
if (count($mo_plugin)) {
    foreach ($mo_plugin as $plugin) {
        require_once $plugin;
    }
}
if ($mo_theme_file) {
    require_once $mo_theme_file;
}
do_action('loadPT');
// Check if logged in or trying to
if ($user->autoLogin()) {
    $user->loadAll($_SESSION['uid']);
    $user->check();
}
do_action('loadBasic');
if (defined('OUTPUT') && OUTPUT == True && $mo_theme_file) {
    call_user_func($mo_theme);
}
do_action('loadDone');
mo_write_note('The page has been processed successfully.');