public static function checkUserAccess($type = false, $forceType = false) { if ($GLOBALS['configuration']['webserver_auth']) { $user = EfrontUser::checkWebserverAuthentication(); } else { if (isset($_SESSION['s_login']) && $_SESSION['s_password']) { $user = EfrontUserFactory::factory($_SESSION['s_login'], false, $forceType); } else { throw new EfrontUserException(_RESOURCEREQUESTEDREQUIRESLOGIN, EfrontUserException::USER_NOT_LOGGED_IN); } } if (!$user->isLoggedIn(session_id())) { throw new EfrontUserException(_RESOURCEREQUESTEDREQUIRESLOGIN, EfrontUserException::USER_NOT_LOGGED_IN); } if ($user->user['timezone']) { date_default_timezone_set($user->user['timezone']); } $user->applyRoleOptions($user->user['user_types_ID']); //Initialize user's role options for this lesson if ($type && $user->user['user_type'] != $type) { throw new Exception(_YOUCANNOTACCESSTHISPAGE, EfrontUserException::INVALID_TYPE); } return $user; }
} else { /** Configuration file */ require_once $path . "configuration.php"; } if ($_SESSION['s_login']) { try { $currentUser = EfrontUser::checkUserAccess(false, $_SESSION['s_type']); } catch (Exception $e) { unset($_SESSION['s_login']); eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=login&message=" . urlencode(_YOURSESSIONHASEXPIREDPLEASELOGINAGAIN)); exit; } } if ($GLOBALS['configuration']['webserver_auth']) { eval('$usernameVar=' . $GLOBALS['configuration']['username_variable'] . ';'); $currentUser = EfrontUser::checkWebserverAuthentication(); $currentUser->login($currentUser->user['password'], true); } //@todo:temporary here, should leave $cacheId = null; $message = $message_type = ''; $benchmark = new EfrontBenchmark($debug_TimeStart); $benchmark->set('init'); //Set headers in order to eliminate browser cache (especially IE's) header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("cache-control: no-transform"); //To prevent 3G carriers from compressing the site, which will break all grids //Delete installation directory after install/upgrade