id AND !Config::get('demo_mode')) { logout(); exit; } /* Load preferences and theme */ set_theme(); $GLOBALS['user']->update_last_seen(); } elseif (!Config::get('use_auth')) { $auth['success'] = 1; $auth['username'] = '-1'; $auth['fullname'] = "Ampache User"; $auth['id'] = -1; $auth['access'] = "admin"; $auth['offset_limit'] = 50; if (!vauth_check_session()) { vauth_session_create($auth); } $GLOBALS['user'] = new User(-1); $GLOBALS['user']->fullname = 'Ampache User'; $GLOBALS['user']->offset_limit = $auth['offset_limit']; $GLOBALS['user']->username = '-1'; $GLOBALS['user']->access = $auth['access']; $_SESSION['userdata']['username'] = $auth['username']; set_theme(); } // If Auth, but no session is set else { if (isset($_REQUEST['sessid'])) { $sess_results = vauth_get_session($_REQUEST['sessid']); session_id(scrub_in($_REQUEST['sessid'])); session_start(); } $GLOBALS['user'] = User::get_from_username($sess_results['username']); } // Load the Preferences from the database init_preferences(); /* Add in some variables for ajax done here because we need the user */ $ajax_info['ajax_url'] = $results['web_path'] . '/server/ajax.server.php'; $ajax_info['ajax_info'] = '&user_id=' . $GLOBALS['user']->id; Config::set_by_array($ajax_info); unset($ajax_info); // Load gettext mojo load_gettext(); /* Set CHARSET */ header ("Content-Type: text/html; charset=" . Config::get('site_charset')); /* Clean up a bit */ unset($array); unset($results); /* Setup the flip class */ flip_class(array('odd','even')); /* Set the Theme */ $theme = get_theme(Config::get('theme_name')); /* Check to see if we need to perform an update */ if (! preg_match('/update\.php/', $_SERVER['PHP_SELF'])) { if (Update::need_update()) { header("Location: " . Config::get('web_path') . "/update.php"); exit(); } } ?>