summaryrefslogtreecommitdiffstats
path: root/lib/class/user.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-08-13 03:36:29 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-08-13 03:36:29 +0000
commit64fb3786bbe81bc72099f154c59c9c7fefcbd2c9 (patch)
treebdbb61c7fcb3917067c5ca13d2267472ec8781df /lib/class/user.class.php
parentf49a78f512b7a8e76d5548f188536f2044c4ec60 (diff)
downloadampache-64fb3786bbe81bc72099f154c59c9c7fefcbd2c9.tar.gz
ampache-64fb3786bbe81bc72099f154c59c9c7fefcbd2c9.tar.bz2
ampache-64fb3786bbe81bc72099f154c59c9c7fefcbd2c9.zip
good number of changes to browse, this breaks more then it fixes...
Diffstat (limited to 'lib/class/user.class.php')
-rw-r--r--lib/class/user.class.php48
1 files changed, 25 insertions, 23 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 00e7e34d..4d4d3956 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -119,7 +119,7 @@ class User extends database_object {
$username = Dba::escape($username);
$sql = "SELECT `id` FROM `user` WHERE `username`='$username'";
- $db_results = Dba::query($sql);
+ $db_results = Dba::read($sql);
$results = Dba::fetch_assoc($db_results);
$user = new User($results['id']);
@@ -129,6 +129,29 @@ class User extends database_object {
} // get_from_username
/**
+ * get_catalogs
+ * This returns the catalogs as an array of ids that this user is allowed to access
+ */
+ public function get_catalogs() {
+
+ if (parent::is_cached('user_catalog',$this->id)) {
+ return parent::get_from_cache('user_catalog',$this->id);
+ }
+
+ $sql = "SELECT * FROM `user_catalog` WHERE `user`='$user_id'";
+ $db_results = Dba::read($sql);
+
+ while ($row = Dba::fetch_assoc($db_results)) {
+ $catalogs[] = $row['catalog'];
+ }
+
+ parent::add_to_cache('user_catalog',$this->id,$catalogs);
+
+ return $catalogs;
+
+ } // get_catalogs
+
+ /**
* get_preferences
* This is a little more complicate now that we've got many types of preferences
* This funtions pulls all of them an arranges them into a spiffy little array
@@ -964,27 +987,6 @@ class User extends database_object {
} // get_recently_played
- /**
- * get_recent
- * This returns users by thier last login date
- */
- function get_recent($count=0) {
-
- if ($count) { $limit_clause = " LIMIT $count"; }
-
- $results = array();
-
- $sql = "SELECT username FROM user ORDER BY last_seen $limit_clause";
- $db_results = mysql_query($sql, dbh());
-
- while ($r = mysql_fetch_assoc($db_results)) {
- $results[] = $r['username'];
- }
-
- return $results;
-
- } // get_recent
-
/**
* get_ip_history
* This returns the ip_history from the
@@ -1024,7 +1026,7 @@ class User extends database_object {
@function activate_user
@activates the user from public_registration
*/
- function activate_user($username) {
+ public function activate_user($username) {
$username = Dba::escape($username);