Beispiel #1
0
/**
 * User: Erdal Gunyar
 * Date: 28/01/2016
 * Time: 11:31
 */
/* Configuration & initialisation */
require_once 'app/config.php';
require_once 'app/init.php';
require_once 'app/libs/functions.php';
/* @var $_SMARTY Smarty */
/* @var $_DATA array */
global $_SMARTY, $_DATA;
/* Authentication */
if (AUTHENTICATION_ENABLED) {
    verifyAuth();
}
/* Actions */
if (isset($_REQUEST['action'])) {
    $action_path = 'actions/' . $_REQUEST['action'] . '.php';
    if (file_exists(ROOT_DIR . $action_path)) {
        include_once "{$action_path}";
        // Clearing cache
        $_SMARTY->setCaching(Smarty::CACHING_LIFETIME_SAVED);
        $_SMARTY->clearCache('layout.tpl');
        $_SMARTY->setCaching(Smarty::CACHING_OFF);
        // Calling action
        call_user_func('action_' . $_REQUEST['action']);
    }
}
/* Page and controllers */
<?php

$isCookieSetFlag = false;
if (isset($_COOKIE['onenumberauth'])) {
    if ($_COOKIE['onenumberauth']['token'] != null && $_COOKIE['onenumberauth']['secret'] != null && $_COOKIE['onenumberauth']['user'] != null && $_COOKIE['onenumberauth']['role'] != null) {
        # do nothing
        echo "verifyAuth = " + verifyAuth();
        $isCookieSetFlag = verifyAuth()->status;
    }
}
if ($isCookieSetFlag == false) {
    #Unset the existing cookies
    unset($_COOKIE['onenumberauth']);
    setCookie("onenumberauth[token]", null, -1);
    setCookie("onenumberauth[secret]", null, -1);
    setCookie("onenumberauth[user]", null, -1);
    setCookie("onenumberauth[role]", null, -1);
    echo '<script type="text/javascript">window.location="' . $BASE_URL . '";</script>';
}