mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 19:41:55 +02:00
sync from branch
This commit is contained in:
parent
b11c9d823a
commit
2fa487db93
4 changed files with 18 additions and 14 deletions
|
@ -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() {
|
||||
|
||||
// First go ahead and try to load it from the preferences
|
||||
if (self::load_from_session()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$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($user_id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue