id AND !Config::get('demo_mode')) { logout(); exit; } /* Load preferences and 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']; } // If Auth, but no session is set else { if (isset($_REQUEST['sessid'])) { $sess_results = vauth_get_session($_REQUEST['sessid']); session_name(Config::get('session_name')); 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(); // We need to create the tmp playlist for our user $GLOBALS['user']->load_playlist(); /* Add in some variables for ajax done here because we need the user */ Config::set('ajax_url',Config::get('web_path') . '/server/ajax.server.php',1); // 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')); /* 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(); } } ?>