if (!empty($cfg['method'])) { $_SESSION['check_TSV'] = time(); } else { $_SESSION['user']['TSV_checked'] = true; } } } $_SESSION['message'] = array_shift($errors); } elseif (!empty($_SESSION['check_TSV']) && !empty($_POST['c'])) { $u = new User(); $cfg = $u->getTSVConfig(); $authenticator = $u->getTSVAuthenticator($cfg['method'], $cfg['sd']); $verificationResult = $authenticator->verifyCode($_POST['c']); if ($verificationResult === true) { unset($_SESSION['check_TSV']); $_SESSION['user']['TSV_checked'] = true; } else { $_SESSION['message'] = is_string($verificationResult) ? htmlspecialchars($verificationResult, ENT_COMPAT) : 'Wrong verification code. Please try again.'; } } $coreUrl = Config::get('core_url'); if (!User::isLoged()) { exit(header('Location: ' . $coreUrl . 'login/')); } if (!empty($_SESSION['redirect']['view'])) { $viewId = $_SESSION['redirect']['view']; unset($_SESSION['redirect']['view']); header('Location: ' . $coreUrl . 'view/' . $viewId . '/'); } else { header('Location: ' . $coreUrl); }
* @package CaseBox * @copyright Copyright (c) 2010, CaseBox **/ namespace CB; require_once dirname(__FILE__) . '/config.php'; if (!(php_sapi_name() == "cli")) { //Starting Session $sessionHandler = new Session(); session_set_save_handler($sessionHandler, true); session_start(); } // check if loged in # simple hack to call init.php from another script without a redirect to login. if (!@$webDAVMode && !(php_sapi_name() == "cli")) { if (!in_array(@$_GET['command'], array('login', 'recover')) && !User::isLoged()) { if (@$_SERVER['SCRIPT_NAME'] !== '/remote/router.php') { header('Location: ' . Config::get('core_url') . 'login/'); exit(0); } } } $sessionPersistence = Config::get('session.persistent', true); if (empty($sessionPersistence)) { // regenerate session id session_regenerate_id(false); } // include languages and define Language constants and translations require_once 'lib/language.php'; L\initTranslations(); /* verify required CaseBox folder existance */