fixed error handling
This commit is contained in:
parent
45490e0cc2
commit
ef43685e7d
|
@ -174,7 +174,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
* @return array list of info/error messages
|
* @return array list of info/error messages
|
||||||
*/
|
*/
|
||||||
function process_attributes(&$post) {
|
function process_attributes(&$post) {
|
||||||
$this->triggered_messages = array();
|
$errors = array();
|
||||||
$this->attributes['mailRoutingAddress'] = array();
|
$this->attributes['mailRoutingAddress'] = array();
|
||||||
$this->attributes['mailLocalAddress'] = array();
|
$this->attributes['mailLocalAddress'] = array();
|
||||||
$this->attributes['mailHost'] = array();
|
$this->attributes['mailHost'] = array();
|
||||||
|
@ -187,7 +187,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['routingAdr'][0];
|
$message = $this->messages['routingAdr'][0];
|
||||||
$message[] = $post['routingAdr'];
|
$message[] = $post['routingAdr'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check mail server
|
// check mail server
|
||||||
|
@ -199,7 +199,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['host'][0];
|
$message = $this->messages['host'][0];
|
||||||
$message[] = $post['host'];
|
$message[] = $post['host'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check old local addresses
|
// check old local addresses
|
||||||
|
@ -211,7 +211,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
if (!get_preg($post['localAdr' . $i], 'mailLocalAddress')) {
|
if (!get_preg($post['localAdr' . $i], 'mailLocalAddress')) {
|
||||||
$message = $this->messages['localAdr'][0];
|
$message = $this->messages['localAdr'][0];
|
||||||
$message[] = $post['localAdr' . $i];
|
$message[] = $post['localAdr' . $i];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
$this->attributes['mailLocalAddress'][] = $post['localAdr' . $i];
|
$this->attributes['mailLocalAddress'][] = $post['localAdr' . $i];
|
||||||
}
|
}
|
||||||
|
@ -226,16 +226,11 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['localAdr'][0];
|
$message = $this->messages['localAdr'][0];
|
||||||
$message[] = $post['localAdr'];
|
$message[] = $post['localAdr'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->attributes['mailLocalAddress'] = array_unique($this->attributes['mailLocalAddress']);
|
$this->attributes['mailLocalAddress'] = array_unique($this->attributes['mailLocalAddress']);
|
||||||
if (sizeof($this->triggered_messages) > 0) {
|
return $errors;
|
||||||
return $this->triggered_messages;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,9 +34,6 @@ $Id$
|
||||||
*/
|
*/
|
||||||
class kolabUser extends baseModule {
|
class kolabUser extends baseModule {
|
||||||
|
|
||||||
/** used for account pages, true if input data is correct */
|
|
||||||
var $inputCorrect = false;
|
|
||||||
|
|
||||||
/** list of invitation policies */
|
/** list of invitation policies */
|
||||||
var $invitationPolicies;
|
var $invitationPolicies;
|
||||||
|
|
||||||
|
@ -412,8 +409,8 @@ class kolabUser extends baseModule {
|
||||||
* @return array list of info/error messages
|
* @return array list of info/error messages
|
||||||
*/
|
*/
|
||||||
function process_attributes(&$post) {
|
function process_attributes(&$post) {
|
||||||
|
$errors = array();
|
||||||
if ($post['form_subpage_kolabUser_deleteUser_open']) return;
|
if ($post['form_subpage_kolabUser_deleteUser_open']) return;
|
||||||
$this->triggered_messages = array();
|
|
||||||
$this->attributes['kolabInvitationPolicy'] = array();
|
$this->attributes['kolabInvitationPolicy'] = array();
|
||||||
// country
|
// country
|
||||||
if (isset($post['country'])) {
|
if (isset($post['country'])) {
|
||||||
|
@ -423,13 +420,13 @@ class kolabUser extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['country'][0];
|
$message = $this->messages['country'][0];
|
||||||
$message[] = $post['country'];
|
$message[] = $post['country'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// mailbox server
|
// mailbox server
|
||||||
if (isset($post['homeServer'])) {
|
if (isset($post['homeServer'])) {
|
||||||
if ($post['homeServer'] == "") {
|
if ($post['homeServer'] == "") {
|
||||||
$this->triggered_messages[] = array($this->messages['homeServer'][2]);
|
$errors[] = array($this->messages['homeServer'][2]);
|
||||||
}
|
}
|
||||||
elseif (get_preg($post['homeServer'], 'DNSname')) {
|
elseif (get_preg($post['homeServer'], 'DNSname')) {
|
||||||
$this->attributes['kolabHomeServer'][0] = $post['homeServer'];
|
$this->attributes['kolabHomeServer'][0] = $post['homeServer'];
|
||||||
|
@ -437,7 +434,7 @@ class kolabUser extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['homeServer'][0];
|
$message = $this->messages['homeServer'][0];
|
||||||
$message[] = $post['homeServer'];
|
$message[] = $post['homeServer'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check old invitation policies
|
// check old invitation policies
|
||||||
|
@ -455,7 +452,7 @@ class kolabUser extends baseModule {
|
||||||
if (!get_preg($post['invPol1' . $i], 'email')) {
|
if (!get_preg($post['invPol1' . $i], 'email')) {
|
||||||
$message = $this->messages['invPol'][0];
|
$message = $this->messages['invPol'][0];
|
||||||
$message[] = $post['invPol1' . $i];
|
$message[] = $post['invPol1' . $i];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['kolabInvitationPolicy'][] = $post['invPol1' . $i] . ':' . $policies[$post['invPol2' . $i]];
|
$this->attributes['kolabInvitationPolicy'][] = $post['invPol1' . $i] . ':' . $policies[$post['invPol2' . $i]];
|
||||||
|
@ -469,7 +466,7 @@ class kolabUser extends baseModule {
|
||||||
if (!get_preg($post['invPol1'], 'email')) {
|
if (!get_preg($post['invPol1'], 'email')) {
|
||||||
$message = $this->messages['invPol'][0];
|
$message = $this->messages['invPol'][0];
|
||||||
$message[] = $post['invPol1'];
|
$message[] = $post['invPol1'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['kolabInvitationPolicy'][] = $post['invPol1'] . ':' . $policies[$post['invPol2']];
|
$this->attributes['kolabInvitationPolicy'][] = $post['invPol1'] . ':' . $policies[$post['invPol2']];
|
||||||
|
@ -492,7 +489,7 @@ class kolabUser extends baseModule {
|
||||||
if (!get_preg($post['alias' . $i], 'email')) {
|
if (!get_preg($post['alias' . $i], 'email')) {
|
||||||
$message = $this->messages['alias'][0];
|
$message = $this->messages['alias'][0];
|
||||||
$message[] = $post['alias' . $i];
|
$message[] = $post['alias' . $i];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
$this->attributes['alias'][] = $post['alias' . $i];
|
$this->attributes['alias'][] = $post['alias' . $i];
|
||||||
}
|
}
|
||||||
|
@ -504,7 +501,7 @@ class kolabUser extends baseModule {
|
||||||
if (!get_preg($post['alias'], 'email')) {
|
if (!get_preg($post['alias'], 'email')) {
|
||||||
$message = $this->messages['alias'][0];
|
$message = $this->messages['alias'][0];
|
||||||
$message[] = $post['alias'];
|
$message[] = $post['alias'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['alias'][] = $post['alias'];
|
$this->attributes['alias'][] = $post['alias'];
|
||||||
|
@ -535,7 +532,7 @@ class kolabUser extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['freeBusy'][0];
|
$message = $this->messages['freeBusy'][0];
|
||||||
$message[] = $post['freeBusy'];
|
$message[] = $post['freeBusy'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cyrus mail quota
|
// Cyrus mail quota
|
||||||
|
@ -546,17 +543,10 @@ class kolabUser extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['quota'][0];
|
$message = $this->messages['quota'][0];
|
||||||
$message[] = $post['quota'];
|
$message[] = $post['quota'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check if all was correct
|
return $errors;
|
||||||
if (sizeof($this->triggered_messages) > 0) {
|
|
||||||
$this->inputCorrect = false;
|
|
||||||
return $this->triggered_messages;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$this->inputCorrect = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -597,12 +587,9 @@ class kolabUser extends baseModule {
|
||||||
if (!$_SESSION[$this->base]->module['inetOrgPerson']->attributes['mail'][0]) return false;
|
if (!$_SESSION[$this->base]->module['inetOrgPerson']->attributes['mail'][0]) return false;
|
||||||
if ($_SESSION[$this->base]->isNewAccount) {
|
if ($_SESSION[$this->base]->isNewAccount) {
|
||||||
if (isset($_SESSION[$this->base]->module['posixAccount']) && !$_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]) return false;
|
if (isset($_SESSION[$this->base]->module['posixAccount']) && !$_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]) return false;
|
||||||
elseif (isset($_SESSION[$this->base]->module['inetOrgPerson']) && !$_SESSION[$this->base]->module['inetOrgPerson']->attributes['userPassword'][0]) return false;
|
if (isset($_SESSION[$this->base]->module['inetOrgPerson']) && !$_SESSION[$this->base]->module['inetOrgPerson']->attributes['userPassword'][0]) return false;
|
||||||
return $this->inputCorrect;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -161,7 +161,7 @@ class nisMailAlias extends baseModule {
|
||||||
* @return array list of info/error messages
|
* @return array list of info/error messages
|
||||||
*/
|
*/
|
||||||
function process_attributes(&$post) {
|
function process_attributes(&$post) {
|
||||||
$this->triggered_messages = array();
|
$errors = array();
|
||||||
$this->attributes['cn'] = array();
|
$this->attributes['cn'] = array();
|
||||||
$this->attributes['rfc822MailMember'] = array();
|
$this->attributes['rfc822MailMember'] = array();
|
||||||
// check alias name
|
// check alias name
|
||||||
|
@ -171,7 +171,7 @@ class nisMailAlias extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['alias'][0];
|
$message = $this->messages['alias'][0];
|
||||||
$message[] = $post['cn'];
|
$message[] = $post['cn'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
// check old recipients
|
// check old recipients
|
||||||
if (isset($post['rec_number'])) {
|
if (isset($post['rec_number'])) {
|
||||||
|
@ -182,7 +182,7 @@ class nisMailAlias extends baseModule {
|
||||||
if (!get_preg($post['rfc822MailMember' . $i], 'nis_recipient')) {
|
if (!get_preg($post['rfc822MailMember' . $i], 'nis_recipient')) {
|
||||||
$message = $this->messages['recipient'][0];
|
$message = $this->messages['recipient'][0];
|
||||||
$message[] = $post['rfc822MailMember' . $i];
|
$message[] = $post['rfc822MailMember' . $i];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
$this->attributes['rfc822MailMember'][] = $post['rfc822MailMember' . $i];
|
$this->attributes['rfc822MailMember'][] = $post['rfc822MailMember' . $i];
|
||||||
}
|
}
|
||||||
|
@ -197,16 +197,11 @@ class nisMailAlias extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['recipient'][0];
|
$message = $this->messages['recipient'][0];
|
||||||
$message[] = $post['rfc822MailMember'];
|
$message[] = $post['rfc822MailMember'];
|
||||||
$this->triggered_messages[] = array($message);
|
$errors[] = array($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->attributes['rfc822MailMember'] = array_unique($this->attributes['rfc822MailMember']);
|
$this->attributes['rfc822MailMember'] = array_unique($this->attributes['rfc822MailMember']);
|
||||||
if (sizeof($this->triggered_messages) > 0) {
|
return $errors;
|
||||||
return $this->triggered_messages;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue