id AND !Config::get('demo_mode')) { vauth::logout(session_id()); 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'] = '100'; $auth['offset_limit'] = 50; if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')])) { vauth::create_cookie(); vauth::session_create($auth); } vauth::check_session(); $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'])) { session_name(Config::get('session_name')); session_id(scrub_in($_REQUEST['sessid'])); session_start(); $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); } else { $GLOBALS['user'] = new User(); } } // If NO_SESSION passed // Load the Preferences from the database Preference::init(); // We need to create the tmp playlist for our user only if we have a session if (session_id()) { $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(); } } // For the XMLRPC stuff $GLOBALS['xmlrpc_internalencoding'] = Config::get('site_charset'); // If debug is on GIMMIE DA ERRORS if (Config::get('debug')) { error_reporting(E_ALL); } ?>