From db47bcb6c018fecae71b8b7120c70d7ef9c7bcf6 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 29 Jul 2007 03:20:00 +0000 Subject: fixed play all artist, play all artist random, and account updating from user preferences --- lib/class/user.class.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'lib/class/user.class.php') 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 @@ -387,6 +387,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 -- cgit