From a4be3297d541560e1bc4291d366808fca517d49e Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sat, 13 May 2006 00:39:40 +0000 Subject: fixed localplay buttons with use_auth disabled and tweaked access control mojo to prevent login in addition to the normal prevention of streaming --- lib/class/user.class.php | 2 ++ lib/preferences.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ lib/ui.lib.php | 45 --------------------------------------------- 3 files changed, 47 insertions(+), 45 deletions(-) (limited to 'lib') 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 @@ -49,51 +49,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 -- cgit