summaryrefslogtreecommitdiffstats
path: root/lib/class/user.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-04-23 20:33:57 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-04-23 20:33:57 +0000
commit13dd43450a56bd72067b6f2350f5d188c5c7e254 (patch)
treeb2bc0d26b1f7f904a15322413a044035aeca0d0f /lib/class/user.class.php
parenta12f1083e30ae16ded9dc7aa464015ad07413632 (diff)
downloadampache-13dd43450a56bd72067b6f2350f5d188c5c7e254.tar.gz
ampache-13dd43450a56bd72067b6f2350f5d188c5c7e254.tar.bz2
ampache-13dd43450a56bd72067b6f2350f5d188c5c7e254.zip
fixed up part of single album view, show songs is all gone, working on replacement browse method
Diffstat (limited to 'lib/class/user.class.php')
-rw-r--r--lib/class/user.class.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index e50b6bb8..d678ad1c 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -111,36 +111,36 @@ class User {
* []['admin'] = t/f value if this is an admin only section
*/
function get_preferences($user_id=0,$type=0) {
-
- if (!$user_id) {
- $user_id = $this->id;
- }
+
+ // Fill out the user id
+ $user_id = $user_id ? Dba::escape($user_id) : Dba::escape($this->id);
- if (!conf('use_auth')) { $user_id = '-1'; }
+ if (!Config::get('use_auth')) { $user_id = '-1'; }
if ($user_id != '-1') {
$user_limit = "AND preferences.catagory != 'system'";
}
-
+
if ($type != '0') {
- $user_limit = "AND preferences.catagory = '" . sql_escape($type) . "'";
+ $user_limit = "AND preferences.catagory = '" . Dba::escape($type) . "'";
}
- $sql = "SELECT preferences.name, preferences.description, preferences.catagory, user_preference.value FROM preferences,user_preference " .
- "WHERE user_preference.user='$user_id' AND user_preference.preference=preferences.id $user_limit ORDER BY id";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT preferences.name, preferences.description, preferences.catagory, user_preference.value " .
+ "FROM preferences RIGHT JOIN user_preference ON user_preference.preference=preferences.id " .
+ "WHERE user_preference.user='$user_id' $user_limit";
+ $db_results = Dba::query($sql);
/* Ok this is crapy, need to clean this up or improve the code FIXME */
- while ($r = mysql_fetch_assoc($db_results)) {
+ while ($r = Dba::fetch_assoc($db_results)) {
$type = $r['catagory'];
$admin = false;
if ($type == 'system') { $admin = true; }
- $type_array[$type][] = array('name'=>$r['name'],'description'=>$r['description'],'value'=>$r['value']);
+ $type_array[$type][$r['name']] = array('name'=>$r['name'],'description'=>$r['description'],'value'=>$r['value']);
+ ksort($type_array[$type]);
$results[$type] = array ('title'=>ucwords($type),'admin'=>$admin,'prefs'=>$type_array[$type]);
} // end while
-
return $results;
} // get_preferences