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/preferences.php | |
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/preferences.php')
-rw-r--r-- | lib/preferences.php | 45 |
1 files changed, 45 insertions, 0 deletions
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 + ?> |