Пример #1
0
    session_write_close();
}
CSessionHandler::setHandler(CAppUI::conf("session_handler"));
// Start session
CSessionHandler::start();
// Ignore aborted HTTP request, so that PHP finishes the current script
ignore_user_abort(true);
// Register shutdown function to end the session
register_shutdown_function(array("CSessionHandler", "writeClose"));
// Check if the session was made via a temporary token
// and save its expiration date
if (isset($_SESSION["token_expiration"])) {
    CAppUI::$token_expiration = $_SESSION["token_expiration"];
}
// Reset session if it expired
if (CAppUI::isTokenSessionExpired()) {
    CAppUI::$token_expiration = null;
    // Free the session data
    CSessionHandler::end(true);
    // Start it back
    CSessionHandler::start();
}
// Check if session has previously been initialised
if (empty($_SESSION["AppUI"]) || isset($_GET["logout"])) {
    $_SESSION["AppUI"] = CAppUI::init();
}
CAppUI::$instance =& $_SESSION["AppUI"];
CAppUI::$instance->session_name = $session_name;
if (!isset($_SESSION["locked"])) {
    $_SESSION["locked"] = false;
}