diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-28 16:57:34 -0500 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-28 16:57:34 -0500 |
commit | 58a3ab692ec3a61c270e5a7b0953b6bb4b48b39c (patch) | |
tree | 5d873a2b6cd93e520fe8ee3e937239a99f1d2709 /lib/init.php | |
parent | c570bb77947c29a78d9a2ac98e09832be0daac66 (diff) | |
download | ampache-58a3ab692ec3a61c270e5a7b0953b6bb4b48b39c.tar.gz ampache-58a3ab692ec3a61c270e5a7b0953b6bb4b48b39c.tar.bz2 ampache-58a3ab692ec3a61c270e5a7b0953b6bb4b48b39c.zip |
Move sessiony things from vauth into Session
Diffstat (limited to 'lib/init.php')
-rw-r--r-- | lib/init.php | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/lib/init.php b/lib/init.php index fae52aef..7a9b3dc1 100644 --- a/lib/init.php +++ b/lib/init.php @@ -28,10 +28,10 @@ $ampache_path = dirname(__FILE__); $prefix = realpath($ampache_path . "/../"); require_once $prefix . '/lib/init-tiny.php'; -// Explicitly load vauth and enable the custom session handler. +// Explicitly load and enable the custom session handler. // Relying on autoload may not always load it before sessiony things are done. -require_once $prefix . '/lib/class/vauth.class.php'; -vauth::_auto_init(); +require_once $prefix . '/lib/class/session.class.php'; +Session::_auto_init(); // Set up for redirection on important error cases $path = preg_replace('#(.*)/(\w+\.php)$#', '$1', $_SERVER['PHP_SELF']); @@ -132,16 +132,22 @@ set_memory_limit($results['memory_limit']); // If we want a session if (!defined('NO_SESSION') && Config::get('use_auth')) { /* Verify their session */ - if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')])) { vauth::logout($_COOKIE[Config::get('session_name')]); exit; } + if (!Session::exists('interface', $_COOKIE[Config::get('session_name')])) { + vauth::logout($_COOKIE[Config::get('session_name')]); + exit; + } // This actually is starting the session - vauth::check_session(); + Session::check(); /* Create the new user */ $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); /* If the user ID doesn't exist deny them */ - if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; } + if (!$GLOBALS['user']->id && !Config::get('demo_mode')) { + vauth::logout(session_id()); + exit; + } /* Load preferences and theme */ $GLOBALS['user']->update_last_seen(); @@ -153,17 +159,17 @@ elseif (!Config::get('use_auth')) { $auth['id'] = -1; $auth['offset_limit'] = 50; $auth['access'] = Config::get('default_auth_level') ? User::access_name_to_level(Config::get('default_auth_level')) : '100'; - if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')])) { - vauth::create_cookie(); - vauth::session_create($auth); - vauth::check_session(); + if (!Session::exists('interface', $_COOKIE[Config::get('session_name')])) { + Session::create_cookie(); + Session::create($auth); + Session::check(); $GLOBALS['user'] = new User($auth['username']); $GLOBALS['user']->username = $auth['username']; $GLOBALS['user']->fullname = $auth['fullname']; $GLOBALS['user']->access = $auth['access']; } else { - vauth::check_session(); + Session::check(); if ($_SESSION['userdata']['username']) { $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); } @@ -174,7 +180,9 @@ elseif (!Config::get('use_auth')) { $GLOBALS['user']->fullname = $auth['fullname']; $GLOBALS['user']->access = $auth['access']; } - if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; } + if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { + vauth::logout(session_id()); exit; + } $GLOBALS['user']->update_last_seen(); } } @@ -196,7 +204,7 @@ else { Preference::init(); if (session_id()) { - vauth::session_extend(session_id()); + Session::extend(session_id()); // We only need to create the tmp playlist if we have a session $GLOBALS['user']->load_playlist(); } |