diff options
-rwxr-xr-x | docs/CHANGELOG | 3 | ||||
-rw-r--r-- | lib/class/preference.class.php | 13 | ||||
-rw-r--r-- | lib/init.php | 2 | ||||
-rw-r--r-- | play/index.php | 12 |
4 files changed, 17 insertions, 13 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 0a2fd9fc..98930e77 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,9 @@ -------------------------------------------------------------------------- v.3.6-Alpha1 + - Fix stream user preferences using cached system preferences + rather then their own + - Fixed prevent_multiple_logins preventing all logins (Thx Hugh) - Added additional information to installation process - Fix PHP 5.3 errors (Thx momo-i) - Fix random methods not working for localplay diff --git a/lib/class/preference.class.php b/lib/class/preference.class.php index 6f1db363..338f14b7 100644 --- a/lib/class/preference.class.php +++ b/lib/class/preference.class.php @@ -332,9 +332,9 @@ class Preference { * load_from_session * This loads the preferences from the session rather then creating a connection to the database */ - public static function load_from_session() { + public static function load_from_session($uid=-1) { - if (is_array($_SESSION['userdata']['preferences'])) { + if (is_array($_SESSION['userdata']['preferences']) AND $_SESSION['userdata']['uid'] == $uid) { Config::set_by_array($_SESSION['userdata']['preferences'],1); return true; } @@ -391,13 +391,13 @@ class Preference { */ public static function init() { + $user_id = $GLOBALS['user']->id ? Dba::escape($GLOBALS['user']->id) : '-1'; + // First go ahead and try to load it from the preferences - if (self::load_from_session()) { + if (self::load_from_session($user_id)) { return true; } - - $user_id = $GLOBALS['user']->id ? Dba::escape($GLOBALS['user']->id) : '-1'; - + /* Get Global Preferences */ $sql = "SELECT `preference`.`name`,`user_preference`.`value`,`syspref`.`value` AS `system_value` FROM `preference` " . "LEFT JOIN `user_preference` `syspref` ON `syspref`.`preference`=`preference`.`id` AND `syspref`.`user`='-1' AND `preference`.`catagory`='system' " . @@ -423,6 +423,7 @@ class Preference { Config::set_by_array($results,1); $_SESSION['userdata']['preferences'] = $results; + $_SESSION['userdata']['uid'] = $user_id; } // init diff --git a/lib/init.php b/lib/init.php index 1d319e3e..6df1107e 100644 --- a/lib/init.php +++ b/lib/init.php @@ -246,7 +246,7 @@ elseif (!Config::get('use_auth')) { } // If Auth, but no session is set else { - if (isset($_REQUEST['sessid'])) { + if (isset($_REQUEST['sid'])) { session_name(Config::get('session_name')); session_id(scrub_in($_REQUEST['sessid'])); session_start(); diff --git a/play/index.php b/play/index.php index 99fdfcac..0f2a2efa 100644 --- a/play/index.php +++ b/play/index.php @@ -63,7 +63,7 @@ if (!isset($uid)) { } /* Misc Housework */ -$user = new User($uid); +$GLOBALS['user'] = new User($uid); Preference::init(); /* If the user has been disabled (true value) */ @@ -91,7 +91,7 @@ if (Config::get('require_session')) { /* Update the users last seen information */ -$user->update_last_seen(); +$GLOBALS['user']->update_last_seen(); /* If we are in demo mode.. die here */ if (Config::get('demo_mode') || (!Access::check('interface','25') AND !isset($xml_rpc))) { @@ -274,7 +274,7 @@ if ($_GET['action'] == 'download' AND Config::get('download')) { // Make sure that a good chunk of the song has been played if ($bytesStreamed >= $media->size) { debug_event('Play','Downloaded, Registering stats for ' . $media->title,'5'); - $user->update_stats($media->id); + $GLOBALS['user']->update_stats($media->id); } // if enough bytes are streamed fclose($fp); @@ -291,7 +291,7 @@ set_time_limit(0); /* We're about to start record this persons IP */ if (Config::get('track_user_ip')) { - $user->insert_ip_history(); + $GLOBALS['user']->insert_ip_history(); } // If we've got downsample remote enabled @@ -304,7 +304,7 @@ if (Config::get('downsample_remote')) { // If they are downsampling, or if the song is not a native stream or it's non-local if ((Config::get('transcode') == 'always' || !$media->native_stream() || $not_local) && Config::get('transcode') != 'never') { - debug_event('Downsample','Starting Downsample...','5'); + debug_event('Downsample','Starting Downsample {Transcode:' . Config::get('transcode') . '} {Native Stream:' . $media->native_stream() .'} {Not Local:' . $not_local . '}','5'); $fp = Stream::start_downsample($media,$lastid,$song_name,$start); $song_name = $media->f_artist_full . " - " . $media->title . "." . $media->type; // Note that this is downsampling @@ -379,7 +379,7 @@ if($bytes_streamed < $stream_size AND (connection_status() == 0)) { if ($bytes_streamed > $min_bytes_streamed AND get_class($media) == 'Song') { debug_event('Play','Registering stats for ' . $media->title,'5'); - $user->update_stats($media->id); + $GLOBALS['user']->update_stats($media->id); /* Set the Song as Played if it isn't already */ $media->set_played(); |