summaryrefslogtreecommitdiffstats
path: root/lib/class/user.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-29 03:20:00 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-29 03:20:00 +0000
commitdb47bcb6c018fecae71b8b7120c70d7ef9c7bcf6 (patch)
treed017e40d77c0d580aa6091dceabec7fd919a83c2 /lib/class/user.class.php
parent20c3dc0fd1993b36a8ff3467fbc8c4f30c59588d (diff)
downloadampache-db47bcb6c018fecae71b8b7120c70d7ef9c7bcf6.tar.gz
ampache-db47bcb6c018fecae71b8b7120c70d7ef9c7bcf6.tar.bz2
ampache-db47bcb6c018fecae71b8b7120c70d7ef9c7bcf6.zip
fixed play all artist, play all artist random, and account updating from user preferences
Diffstat (limited to 'lib/class/user.class.php')
-rw-r--r--lib/class/user.class.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 26eb2c0f..5924eec1 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -388,6 +388,52 @@ class User {
} // add_preference
/**
+ * update
+ * This function is an all encompasing update function that
+ * calls the mini ones does all the error checking and all that
+ * good stuff
+ */
+ public function update($data) {
+
+ if (empty($data['username'])) {
+ Error::add('username',_('Error Username Required'));
+echo "WOO";
+ }
+
+ if ($data['password1'] != $data['password2'] AND !empty($data['password1'])) {
+echo "WOO";
+ Error::add('password',_("Error Passwords don't match"));
+ }
+
+ if (Error::$state) {
+ return false;
+ }
+
+ foreach ($data as $name=>$value) {
+ switch ($name) {
+ case 'password1';
+ $name = 'password';
+ case 'access':
+ case 'email':
+ case 'username':
+ case 'fullname';
+ if ($this->$name != $value) {
+ $function = 'update_' . $name;
+ $this->$function($value);
+ }
+ break;
+ default:
+ // Rien a faire
+ break;
+ } // end switch on field
+
+ } // end foreach
+
+ return true;
+
+ } // update
+
+ /**
* update_username
* updates their username
*/