diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-12 05:45:48 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-12 05:45:48 +0000 |
commit | 1a5d32fbbe96ab2d936693020bb24bed4a1af78e (patch) | |
tree | 49c325ef550b145fa7fc04f85d65d158a7c7df65 /lib/preferences.php | |
parent | 7be9eb4ea1e868fa0725334697057e1b7b994460 (diff) | |
download | ampache-1a5d32fbbe96ab2d936693020bb24bed4a1af78e.tar.gz ampache-1a5d32fbbe96ab2d936693020bb24bed4a1af78e.tar.bz2 ampache-1a5d32fbbe96ab2d936693020bb24bed4a1af78e.zip |
fixed level updating for admin preferences
Diffstat (limited to 'lib/preferences.php')
-rw-r--r-- | lib/preferences.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/preferences.php b/lib/preferences.php index 3b150e00..22555ddd 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -140,6 +140,7 @@ function update_preferences($pref_id=0) { function update_preference($user_id,$name,$pref_id,$value) { $apply_check = "check_" . $name; + $level_check = "level_" . $name; /* First see if they are an administrator and we are applying this to everything */ if ($GLOBALS['user']->has_access(100) AND make_bool($_REQUEST[$apply_check])) { @@ -147,6 +148,11 @@ function update_preference($user_id,$name,$pref_id,$value) { $db_results = Dba::query($sql); return true; } + + /* Check and see if they are an admin and the level def is set */ + if ($GLOBALS['user']->has_access(100) AND make_bool($_REQUEST[$level_check])) { + update_preference_level($pref_id,$_REQUEST[$level_check]); + } /* Else make sure that the current users has the right to do this */ if (has_preference_access($name)) { @@ -493,13 +499,13 @@ function get_preferences() { * This function updates the level field in the preferences table * this has nothing to do with a users actuall preferences */ -function update_preference_level($name,$level) { +function update_preference_level($pref_id,$level) { - $name = sql_escape($name); - $level = sql_escape($level); + $name = Dba::escape($pref_id); + $level = Dba::escape($level); - $sql = "UPDATE preferences SET `level`='$level' WHERE `name`='$name'"; - $db_results = mysql_query($sql,dbh()); + $sql = "UPDATE `preference` SET `level`='$level' WHERE `id`='$pref_id'"; + $db_results = Dba::query($sql); return true; |