diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-05-13 00:39:40 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-05-13 00:39:40 +0000 |
commit | a4be3297d541560e1bc4291d366808fca517d49e (patch) | |
tree | f2dd6cc96d2e28042845d7b532d19cc3c1295e9e /lib | |
parent | 7049a9976a25e95cb1ee68a84a853211ccc3db8a (diff) | |
download | ampache-a4be3297d541560e1bc4291d366808fca517d49e.tar.gz ampache-a4be3297d541560e1bc4291d366808fca517d49e.tar.bz2 ampache-a4be3297d541560e1bc4291d366808fca517d49e.zip |
fixed localplay buttons with use_auth disabled and tweaked access control mojo to prevent login in addition to the normal prevention of streaming
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/user.class.php | 2 | ||||
-rw-r--r-- | lib/preferences.php | 45 | ||||
-rw-r--r-- | lib/ui.lib.php | 45 |
3 files changed, 47 insertions, 45 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php index 5e28d2b5..09f1c3dc 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -266,6 +266,8 @@ class User { $username = $this->username; } + if (!conf('use_auth')) { $username = '-1'; } + $value = sql_escape($value); $sql = "UPDATE user_preference SET value='$value' WHERE user='$username' AND preference='$preference_id'"; diff --git a/lib/preferences.php b/lib/preferences.php index 66996e40..371c5d92 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -383,4 +383,49 @@ function insert_preference($name,$description,$default,$level,$type,$catagory) { } // insert_preference +/** + * init_preferences + * Third times the charm, why rename a function once when you can do it three times :( + * This grabs the preferences and then loads them into conf it should be run on page load + * to initialize the needed variables + */ +function init_preferences() { + + + /* Get Global Preferences */ + $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user_preference.user='-1' " . + " AND user_preference.preference = preferences.id AND preferences.catagory='system'"; + $db_results = mysql_query($sql, dbh()); + + while ($r = mysql_fetch_assoc($db_results)) { + $name = $r['name']; + $results[$name] = $r['value']; + } // end while sys prefs + + /* Now we need to allow the user to override some stuff that's been set by the above */ + $user_id = '-1'; + if ($GLOBALS['user']->username) { + $user_id = sql_escape($GLOBALS['user']->id); + } + + $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user_preference.user='$user_id' " . + " AND user_preference.preference = preferences.id AND preferences.catagory != 'system'"; + $db_results = mysql_query($sql, dbh()); + + while ($r = mysql_fetch_assoc($db_results)) { + $name = $r['name']; + $results[$name] = $r['value']; + } // end while + + /* Set the Theme mojo */ + if (strlen($results['theme_name']) > 0) { + $results['theme_path'] = '/themes/' . $results['theme_name']; + } + + conf($results,1); + + return true; + +} // init_preferences + ?> diff --git a/lib/ui.lib.php b/lib/ui.lib.php index ec5a1b28..e1f3c663 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -50,51 +50,6 @@ function show_confirmation($title,$text,$next_url,$cancel=0) { } // show_confirmation /** - * init_preferences - * Third times the charm, why rename a function once when you can do it three times :( - * This grabs the preferences and then loads them into conf it should be run on page load - * to initialize the needed variables - */ -function init_preferences() { - - - /* Get Global Preferences */ - $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user_preference.user='-1' " . - " AND user_preference.preference = preferences.id AND preferences.catagory='system'"; - $db_results = mysql_query($sql, dbh()); - - while ($r = mysql_fetch_assoc($db_results)) { - $name = $r['name']; - $results[$name] = $r['value']; - } // end while sys prefs - - /* Now we need to allow the user to override some stuff that's been set by the above */ - $user_id = '-1'; - if ($GLOBALS['user']->username) { - $user_id = sql_escape($GLOBALS['user']->id); - } - - $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user_preference.user='$user_id' " . - " AND user_preference.preference = preferences.id AND preferences.catagory != 'system'"; - $db_results = mysql_query($sql, dbh()); - - while ($r = mysql_fetch_assoc($db_results)) { - $name = $r['name']; - $results[$name] = $r['value']; - } // end while - - /* Set the Theme mojo */ - if (strlen($results['theme_name']) > 0) { - $results['theme_path'] = '/themes/' . $results['theme_name']; - } - - conf($results,1); - - return true; - -} // init_preferences - -/** * flip_class * takes an array of 2 class names * and flips them back and forth and |