Ejemplo n.º 1
0
$SESSION = Session::singleton();
$USER = new LiveUser();
if (function_exists('local_init_user')) {
    local_init_user();
}
// try to set the theme, or catch the thrown exception (eg if the name is invalid)
try {
    $THEME = new Theme($USER);
} catch (SystemException $exception) {
    // set the theme to 'default' and put up an error message
    $THEME = new Theme('raw');
    $SESSION->add_error_msg($exception->getMessage());
}
if ($siteclosedforupgrade && $USER->admin) {
    if (get_config('disablelogin')) {
        $USER->logout();
    } else {
        if (!defined('INSTALLER')) {
            redirect('/admin/upgrade.php');
        }
    }
}
// The installer does its own auth_setup checking, because some upgrades may
// break logging in and so need to allow no logins.
// Command-line scripts obviously have no logged-in user.
if (!defined('INSTALLER') && !defined('CLI') && !defined('CRON')) {
    auth_setup();
}
$siteclosed = $siteclosedforupgrade || get_config('siteclosedbyadmin');
if ($siteclosed && !$USER->admin) {
    if ($USER->is_logged_in()) {