fixed error handling

This commit is contained in:
Roland Gruber 2006-05-16 15:24:53 +00:00
parent 5df6897286
commit 45490e0cc2
1 changed files with 7 additions and 5 deletions

View File

@ -172,23 +172,25 @@ class account extends baseModule {
* @param array $post HTTP-POST values * @param array $post HTTP-POST values
* @return array list of info/error messages * @return array list of info/error messages
*/ */
function process_attributes(&$post) { function process_attributes($post) {
$errors = array();
// Load attributes // Load attributes
$this->attributes['description'][0] = $post['description']; $this->attributes['description'][0] = $post['description'];
// user name if no posixAccount // user name if no posixAccount
$modules = $_SESSION['config']->get_AccountModules($this->get_scope()); $modules = $_SESSION['config']->get_AccountModules($this->get_scope());
if (!in_array('posixAccount', $modules)) { if (!in_array('posixAccount', $modules)) {
$this->attributes['uid'][0] = $post['uid']; $this->attributes['uid'][0] = $post['uid'];
if (!get_preg($this->attributes['uid'][0], '!upper')) $triggered_messages['uid'][] = $this->messages['uid'][2]; if (!get_preg($this->attributes['uid'][0], '!upper')) $errors['uid'][] = $this->messages['uid'][2];
if (!get_preg($this->attributes['uid'][0], 'username')) $triggered_messages['uid'][] = $this->messages['uid'][3]; if (!get_preg($this->attributes['uid'][0], 'username')) $errors['uid'][] = $this->messages['uid'][3];
} }
return $errors;
} }
/* This function will create the html-page /* This function will create the html-page
* to show a page with all attributes. * to show a page with all attributes.
* It will output a complete html-table * It will output a complete html-table
*/ */
function display_html_attributes(&$post) { function display_html_attributes($post) {
// user name if no posixAccount // user name if no posixAccount
$modules = $_SESSION['config']->get_AccountModules($this->get_scope()); $modules = $_SESSION['config']->get_AccountModules($this->get_scope());
if (!in_array('posixAccount', $modules)) { if (!in_array('posixAccount', $modules)) {
@ -247,7 +249,7 @@ class account extends baseModule {
else { else {
$errMsg = $this->messages['uid'][1]; $errMsg = $this->messages['uid'][1];
array_push($errMsg, array($i)); array_push($errMsg, array($i));
$triggered_messages[] = $errMsg; $messages[] = $errMsg;
} }
} }
} }