From 641af2270d8bef2f214b02a1ca5e71969baaeb84 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 16 Aug 2006 17:42:35 +0000 Subject: [PATCH] removed grouping of error messages --- lam/HISTORY | 9 ++- lam/VERSION | 2 +- lam/docs/devel/mod_accountPages.htm | 89 ++++++++-------------- lam/lib/modules.inc | 23 +++--- lam/lib/modules/account.inc | 4 +- lam/lib/modules/ieee802device.inc | 4 +- lam/lib/modules/inetLocalMailRecipient.inc | 10 +-- lam/lib/modules/inetOrgPerson.inc | 32 ++++---- lam/lib/modules/kolabUser.inc | 18 ++--- lam/lib/modules/nisMailAlias.inc | 6 +- lam/lib/modules/posixAccount.inc | 53 ++++++------- lam/lib/modules/posixGroup.inc | 33 ++++---- lam/lib/modules/quota.inc | 12 +-- lam/lib/modules/sambaAccount.inc | 21 ++--- lam/lib/modules/sambaDomain.inc | 2 +- lam/lib/modules/sambaGroupMapping.inc | 2 +- lam/lib/modules/sambaSamAccount.inc | 20 ++--- lam/lib/modules/shadowAccount.inc | 10 +-- 18 files changed, 162 insertions(+), 188 deletions(-) diff --git a/lam/HISTORY b/lam/HISTORY index 03f45d54..25afcc66 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -1,8 +1,11 @@ -??? 1.0.5 +??? 1.1.0 Developers: - - API changes: removed $post parameters from module functions (delete_attributes(), - process_...(), display_html_...()). Use $_POST instead. + API changes: + - removed $post parameters from module functions (delete_attributes(), + process_...(), display_html_...()). Use $_POST instead. + - process_...() functions: returned messages are no longer grouped + (e.g. return: array(array('INFO', 'headline', 'text')), array('INFO', 'headline2', 'text2'))) 10.08.2006 1.0.4 - added Russian translation diff --git a/lam/VERSION b/lam/VERSION index ee90284c..985a0af5 100644 --- a/lam/VERSION +++ b/lam/VERSION @@ -1 +1 @@ -1.0.4 +1.1.0.RC1 diff --git a/lam/docs/devel/mod_accountPages.htm b/lam/docs/devel/mod_accountPages.htm index 8ee729e3..9e0e2a6d 100644 --- a/lam/docs/devel/mod_accountPages.htm +++ b/lam/docs/devel/mod_accountPages.htm @@ -1,9 +1,8 @@ - - - Module HowTo - Account pages - - +Module HowTo - Account pages + + +

Module HowTo - Account pages
@@ -17,25 +16,21 @@ Every time the user selects an existing account to modify LAM will load the complete LDAP entry of it. Your module then should select the attributes which are useful for it.
There are two variables in baseModule -which should be used to store the attributes. The $attributes variable stores the -current attributes including changes the user made. The $orig variable stores the attributes +which should be used to store the attributes. The $attributes variable stores the +current attributes including changes the user made. The $orig variable stores the attributes as they were originally when the account was loaded. This allows you to see what changes were made.

The load_attributes() function in your module gets the complete attribute list from LDAP.

-Example:
+Example:

The ieee802Device uses an object class and the 'macAddress' attribute. Therefore we will save this two values.

- +
    /**
@@ -45,8 +40,7 @@ object.
    * @param array $attr an array as it is retured from ldap_get_attributes
    */
-    function load_attributes($attr) {
+    function load_attributes($attr) {
        $this->attributes['objectClass'] = array();
        @@ -81,15 +75,12 @@ $this->orig['macAddress'] = $attr['macAddress'];

2. Page display

Now that you have defined your subpages you will need one function for -each page to display it. The function must return meta HTML code as defined in the modules specification.
+each page to display it. The function must return meta HTML code as defined in the modules specification.
This function is called display_html_<page name>() where <page name> is the name of your subpage.

-Example:
+Example:

The ieee802Device @@ -100,8 +91,7 @@ second an input field for new values.
The variable $this->attributes contains the LDAP attributes which are useful for this module.

- +
    /**
@@ -110,8 +100,7 @@ show a page with all attributes.
    *
    * @param array $post HTTP-POST values
    */
-    function display_html_attributes($post) {
+    function display_html_attributes($post) {
        $return = array();
        // list current MACs
        for ($i = 0; $i < @@ -163,12 +152,10 @@ This function is called process_<page name>() where <page name> is the name of your subpage.

-If all input data is ok then return "0" or an array containing no error -message. If you return one or more error messages then the user will be +If all input data is ok then return an empty array. If you return one or more error messages then the user will be redirected to your page.

-Example:
+Example:

The ieee802Device @@ -178,8 +165,7 @@ and therefore only process_attributes() The function checks the input fields and fills the LDAP attributes. If all is ok it will enable the user to move to another module page.

- +
    /**
@@ -188,8 +174,7 @@ checks
    *
    * @param array $post HTTP-POST values
    */
-    function process_attributes($post) {
+    function process_attributes($post) {
        $errors = array();
        $this->attributes['macAddress'] = array();
@@ -215,8 +200,7 @@ $this->messages['mac'][0];
            $message[] = $post['macAddress' . $i];
            -            $errors[] = -array($message);
+            $errors[] = $message;
                    }
            @@ -244,7 +228,7 @@ $this->messages['mac'][0];
                    $message[] = $post['macAddress'];
            -        $errors[] = array($message);
+        $errors[] = $message;
            }
        }
        @@ -260,13 +244,10 @@ array_unique($this->attributes['macAddress']);

4. Defining that your module is ready for user input and LDAP add/modify

-In most cases you will not need to implement these functions. The baseModule will return true for both functions.
+In most cases you will not need to implement these functions. The baseModule will return true for both functions.


-There are two functions which control the module status:

+There are two functions which control the module status:

The module_ready() function has to @@ -278,14 +259,12 @@ modules (e.g. you need the user name from posixAccount first).

The second function is module_complete(). The user -cannot do the LDAP operation if one or more modules return false. This defines if all needed +cannot do the LDAP operation if one or more modules return false. This defines if all needed input data for your module was entered.
Use this function if you want to check that all required attributes are set.

-Example:
+Example:

The sambaSamAccount module needs the user's uidNumber @@ -293,8 +272,7 @@ and gidNumber before it can accept input and the account needs a sambaSID before it can be saved.

- +
    /**
@@ -305,8 +283,7 @@ other modules which was not yet entered.
    *
    * @return boolean true, if page can be displayed
    */
-    function module_ready() {
+    function module_ready() {
        if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
@@ -324,8 +301,7 @@ for this module have been made.
    *
    * @return boolean true, if settings are complete
    */
-    function module_complete() {
+    function module_complete() {
        if (!$this->module_ready()) return false;
        if @@ -341,9 +317,7 @@ return false;

5. Saving the LDAP attributes

-In most cases you will not have to implement this option if you use $this->attributes and $this->orig to manage the LDAP +In most cases you will not have to implement this option if you use $this->attributes and $this->orig to manage the LDAP attributes. The baseModule will generate the save comands for you.

@@ -352,15 +326,13 @@ user clicks on the add/modify button your module will be asked what changes have to be made.
This is done in the function save_attributes().

-Example:
+Example:

The kolabUser module uses this function to make sure that its object class is saved. Other modules (e.g. quota) use it build the lamdaemon commands.

- +
    /**
@@ -402,5 +374,4 @@ $this->attributes['objectClass'][] = 'kolabInetOrgPerson';

- - + \ No newline at end of file diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index bd55cff4..2b9cdf86 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -877,13 +877,10 @@ class accountContainer { // change to next page $errorsOccured = false; if (is_array($result)) { // messages were returned, check for errors - $errorKeys = array_keys($result); - for ($i = 0; $i < sizeof($errorKeys); $i++) { - for ($m = 0; $m < sizeof($result[$errorKeys[$i]]); $m++) { - if ($result[$errorKeys[$i]][$m][0] == 'ERROR') { - $errorsOccured = true; - break; - } + for ($i = 0; $i < sizeof($result); $i++) { + if ($result[$i][0] == 'ERROR') { + $errorsOccured = true; + break; } } } @@ -932,12 +929,8 @@ class accountContainer { echo "
\n"; // Display error-messages if (is_array($result)) { - foreach ($result as $result2) { - if (is_array($result2)) { - for ($i=0; $i\n"; @@ -1130,7 +1123,9 @@ class accountContainer { for ($j=0; $jget_AccountModules($this->get_scope()); if (!in_array('posixAccount', $modules)) { $this->attributes['uid'][0] = $_POST['uid']; - if (!get_preg($this->attributes['uid'][0], '!upper')) $errors['uid'][] = $this->messages['uid'][2]; - if (!get_preg($this->attributes['uid'][0], 'username')) $errors['uid'][] = $this->messages['uid'][3]; + if (!get_preg($this->attributes['uid'][0], '!upper')) $errors[] = $this->messages['uid'][2]; + if (!get_preg($this->attributes['uid'][0], 'username')) $errors[] = $this->messages['uid'][3]; } return $errors; } diff --git a/lam/lib/modules/ieee802device.inc b/lam/lib/modules/ieee802device.inc index ac2c7aa7..178e1688 100644 --- a/lam/lib/modules/ieee802device.inc +++ b/lam/lib/modules/ieee802device.inc @@ -127,7 +127,7 @@ class ieee802Device extends baseModule { if (!get_preg($_POST['macAddress' . $i], 'macAddress')) { $message = $this->messages['mac'][0]; $message[] = $_POST['macAddress' . $i]; - $errors[] = array($message); + $errors[] = $message; } $this->attributes['macAddress'][] = $_POST['macAddress' . $i]; } @@ -142,7 +142,7 @@ class ieee802Device extends baseModule { else { $message = $this->messages['mac'][0]; $message[] = $_POST['macAddress']; - $errors[] = array($message); + $errors[] = $message; } } $this->attributes['macAddress'] = array_unique($this->attributes['macAddress']); diff --git a/lam/lib/modules/inetLocalMailRecipient.inc b/lam/lib/modules/inetLocalMailRecipient.inc index f60f1537..abf38457 100644 --- a/lam/lib/modules/inetLocalMailRecipient.inc +++ b/lam/lib/modules/inetLocalMailRecipient.inc @@ -184,7 +184,7 @@ class inetLocalMailRecipient extends baseModule { else { $message = $this->messages['routingAdr'][0]; $message[] = $_POST['routingAdr']; - $errors[] = array($message); + $errors[] = $message; } } // check mail server @@ -196,7 +196,7 @@ class inetLocalMailRecipient extends baseModule { else { $message = $this->messages['host'][0]; $message[] = $_POST['host']; - $errors[] = array($message); + $errors[] = $message; } } // check old local addresses @@ -208,7 +208,7 @@ class inetLocalMailRecipient extends baseModule { if (!get_preg($_POST['localAdr' . $i], 'mailLocalAddress')) { $message = $this->messages['localAdr'][0]; $message[] = $_POST['localAdr' . $i]; - $errors[] = array($message); + $errors[] = $message; } $this->attributes['mailLocalAddress'][] = $_POST['localAdr' . $i]; } @@ -224,7 +224,7 @@ class inetLocalMailRecipient extends baseModule { for ($i = 0; $i < sizeof($keys); $i++) { $adrList = $data[$keys[$i]]; if (in_array_ignore_case($_POST['localAdr'], $adrList)) { - $errors['localAdr'][] = array('WARN', _('This mail address is already in use:') . " " . $_POST['localAdr'], $keys[$i]); + $errors[] = array('WARN', _('This mail address is already in use:') . " " . $_POST['localAdr'], $keys[$i]); break; } } @@ -233,7 +233,7 @@ class inetLocalMailRecipient extends baseModule { else { $message = $this->messages['localAdr'][0]; $message[] = $_POST['localAdr']; - $errors[] = array($message); + $errors[] = $message; } } $this->attributes['mailLocalAddress'] = array_unique($this->attributes['mailLocalAddress']); diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index ca688d57..209d5427 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -472,7 +472,7 @@ class inetOrgPerson extends baseModule { if (!in_array('posixAccount', $modules)) { // uid if (!get_preg($_POST['userName'], 'username')) { - $errors['uid'][] = $this->messages['uid'][0]; + $errors[] = $this->messages['uid'][0]; } else { $this->attributes['uid'][0] = $_POST['userName']; @@ -490,7 +490,7 @@ class inetOrgPerson extends baseModule { $this->attributes['cn'][0] = $_POST['cn']; } if (!get_preg($this->attributes['cn'][0], 'cn')) { - $errors['cn'][] = $this->messages['cn'][0]; + $errors[] = $this->messages['cn'][0]; } } @@ -498,7 +498,7 @@ class inetOrgPerson extends baseModule { if ($_SESSION['ldap']->supports_unix_hosts) { $host = $_POST['host']; if (!get_preg($host,'unixhost')) { - $errors['host'][] = $this->messages['host'][0]; + $errors[] = $this->messages['host'][0]; } $hosts = explode(",", $host); $this->attributes['host'] = array(); @@ -509,24 +509,24 @@ class inetOrgPerson extends baseModule { } } // Do some regex-checks and return error if attributes are set to wrong values - if (($this->attributes['givenName'][0] != '') && !get_preg($this->attributes['givenName'][0], 'realname')) $errors['givenName'][] = $this->messages['givenName'][0]; - if ( !get_preg($this->attributes['sn'][0], 'realname')) $errors['sn'][] = $this->messages['lastname'][0]; - if ( !get_preg($this->attributes['telephoneNumber'][0], 'telephone')) $errors['telephoneNumber'][] = $this->messages['telephoneNumber'][0]; - if ( !get_preg($this->attributes['mobile'][0], 'telephone')) $errors['mobileTelephoneNumber'][] = $this->messages['mobileTelephone'][0]; - if ( !get_preg($this->attributes['facsimileTelephoneNumber'][0], 'telephone')) $errors['facsimileTelephoneNumber'][] = $this->messages['facsimileNumber'][0]; - if (($this->attributes['mail'][0] != '') && !get_preg($this->attributes['mail'][0], 'email')) $errors['mail'][] = $this->messages['email'][0]; - if ( !get_preg($this->attributes['street'][0], 'street')) $errors['street'][] = $this->messages['street'][0]; - if ( !get_preg($this->attributes['postalAddress'][0], 'postalAddress')) $errors['postalAdress'][] = $this->messages['postalAddress'][0]; - if ( !get_preg($this->attributes['postalCode'][0], 'postalCode')) $errors['personal_postalCode'][] = $this->messages['postalCode'][0]; - if ( !get_preg($this->attributes['title'][0], 'title')) $errors['title'][] = $this->messages['title'][0]; - if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors['employeeType'][] = $this->messages['employeeType'][0]; + if (($this->attributes['givenName'][0] != '') && !get_preg($this->attributes['givenName'][0], 'realname')) $errors[] = $this->messages['givenName'][0]; + if ( !get_preg($this->attributes['sn'][0], 'realname')) $errors[] = $this->messages['lastname'][0]; + if ( !get_preg($this->attributes['telephoneNumber'][0], 'telephone')) $errors[] = $this->messages['telephoneNumber'][0]; + if ( !get_preg($this->attributes['mobile'][0], 'telephone')) $errors[] = $this->messages['mobileTelephone'][0]; + if ( !get_preg($this->attributes['facsimileTelephoneNumber'][0], 'telephone')) $errors[] = $this->messages['facsimileNumber'][0]; + if (($this->attributes['mail'][0] != '') && !get_preg($this->attributes['mail'][0], 'email')) $errors[] = $this->messages['email'][0]; + if ( !get_preg($this->attributes['street'][0], 'street')) $errors[] = $this->messages['street'][0]; + if ( !get_preg($this->attributes['postalAddress'][0], 'postalAddress')) $errors[] = $this->messages['postalAddress'][0]; + if ( !get_preg($this->attributes['postalCode'][0], 'postalCode')) $errors[] = $this->messages['postalCode'][0]; + if ( !get_preg($this->attributes['title'][0], 'title')) $errors[] = $this->messages['title'][0]; + if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors[] = $this->messages['employeeType'][0]; if ($_POST['userPassword']) { if ($_POST['userPassword'] != $_POST['userPassword2']) { - $errors['userPassword'][] = $this->messages['userPassword'][0]; + $errors[] = $this->messages['userPassword'][0]; } else { if (!get_preg($_POST['userPassword'], 'password')) { - $errors['userPassword'][] = $this->messages['userPassword'][1]; + $errors[] = $this->messages['userPassword'][1]; } else { $this->attributes['userPassword'][0] = $_POST['userPassword']; diff --git a/lam/lib/modules/kolabUser.inc b/lam/lib/modules/kolabUser.inc index dcc632c8..1d50f821 100644 --- a/lam/lib/modules/kolabUser.inc +++ b/lam/lib/modules/kolabUser.inc @@ -421,13 +421,13 @@ class kolabUser extends baseModule { else { $message = $this->messages['country'][0]; $message[] = $_POST['country']; - $errors[] = array($message); + $errors[] = $message; } } // mailbox server if (isset($_POST['homeServer'])) { if ($_POST['homeServer'] == "") { - $errors[] = array($this->messages['homeServer'][2]); + $errors[] = $this->messages['homeServer'][2]; } elseif (get_preg($_POST['homeServer'], 'DNSname')) { $this->attributes['kolabHomeServer'][0] = $_POST['homeServer']; @@ -435,7 +435,7 @@ class kolabUser extends baseModule { else { $message = $this->messages['homeServer'][0]; $message[] = $_POST['homeServer']; - $errors[] = array($message); + $errors[] = $message; } } // check old invitation policies @@ -453,7 +453,7 @@ class kolabUser extends baseModule { if (!get_preg($_POST['invPol1' . $i], 'email')) { $message = $this->messages['invPol'][0]; $message[] = $_POST['invPol1' . $i]; - $errors[] = array($message); + $errors[] = $message; } else { $this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1' . $i] . ':' . $policies[$_POST['invPol2' . $i]]; @@ -467,7 +467,7 @@ class kolabUser extends baseModule { if (!get_preg($_POST['invPol1'], 'email')) { $message = $this->messages['invPol'][0]; $message[] = $_POST['invPol1']; - $errors[] = array($message); + $errors[] = $message; } else { $this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1'] . ':' . $policies[$_POST['invPol2']]; @@ -490,7 +490,7 @@ class kolabUser extends baseModule { if (!get_preg($_POST['alias' . $i], 'email')) { $message = $this->messages['alias'][0]; $message[] = $_POST['alias' . $i]; - $errors[] = array($message); + $errors[] = $message; } $this->attributes['alias'][] = $_POST['alias' . $i]; } @@ -502,7 +502,7 @@ class kolabUser extends baseModule { if (!get_preg($_POST['alias'], 'email')) { $message = $this->messages['alias'][0]; $message[] = $_POST['alias']; - $errors[] = array($message); + $errors[] = $message; } else { $this->attributes['alias'][] = $_POST['alias']; @@ -533,7 +533,7 @@ class kolabUser extends baseModule { else { $message = $this->messages['freeBusy'][0]; $message[] = $_POST['freeBusy']; - $errors[] = array($message); + $errors[] = $message; } } // Cyrus mail quota @@ -544,7 +544,7 @@ class kolabUser extends baseModule { else { $message = $this->messages['quota'][0]; $message[] = $_POST['quota']; - $errors[] = array($message); + $errors[] = $message; } } return $errors; diff --git a/lam/lib/modules/nisMailAlias.inc b/lam/lib/modules/nisMailAlias.inc index e60a0f41..25e5ab43 100644 --- a/lam/lib/modules/nisMailAlias.inc +++ b/lam/lib/modules/nisMailAlias.inc @@ -168,7 +168,7 @@ class nisMailAlias extends baseModule { else { $message = $this->messages['alias'][0]; $message[] = $_POST['cn']; - $errors[] = array($message); + $errors[] = $message; } // check old recipients if (isset($_POST['rec_number'])) { @@ -179,7 +179,7 @@ class nisMailAlias extends baseModule { if (!get_preg($_POST['rfc822MailMember' . $i], 'nis_recipient')) { $message = $this->messages['recipient'][0]; $message[] = $_POST['rfc822MailMember' . $i]; - $errors[] = array($message); + $errors[] = $message; } $this->attributes['rfc822MailMember'][] = $_POST['rfc822MailMember' . $i]; } @@ -194,7 +194,7 @@ class nisMailAlias extends baseModule { else { $message = $this->messages['recipient'][0]; $message[] = $_POST['rfc822MailMember']; - $errors[] = array($message); + $errors[] = $message; } } $this->attributes['rfc822MailMember'] = array_unique($this->attributes['rfc822MailMember']); diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 6f7d2159..8b73b6b6 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -581,21 +581,21 @@ class posixAccount extends baseModule { if (isset($_POST['createhomedir'])) $this->createhomedir = true; else $this->createhomedir = false; if ($this->orig['uid'][0]!='' && $_POST['uid']!=$this->attributes['uid'][0]) - $errors['uid'][] = $this->messages['uid'][0]; + $errors[] = $this->messages['uid'][0]; if ($this->orig['gidNumber'][0]!='' && $_SESSION['cache']->getgid($_POST['gidNumber'])!=$this->attributes['gidNumber'][0]) { $errorMessage = $this->messages['gidNumber'][2]; $errorMessage[] = array($this->orig['gidNumber'][0], $this->orig['uidNumber'][0], $_POST['gidNumber']); - $errors['gidNumber'][] = $errorMessage; + $errors[] = $errorMessage; } if ($this->orig['uidNumber'][0]!='' && $_POST['uidNumber']!=$this->attributes['uidNumber'][0]) { $errorMessage = $this->messages['uidNumber'][5]; $errorMessage[] = array($this->orig['uidNumber'][0], $_POST['uidNumber']); - $errors['uidNumber'][] = $errorMessage; + $errors[] = $errorMessage; } if (isset($_POST['homeDirectory']) && $this->orig['homeDirectory'][0]!='' && $_POST['homeDirectory']!=$this->attributes['homeDirectory'][0]) { $errorMessage = $this->messages['homeDirectory'][3]; $errorMessage[] = array($this->orig['homeDirectory'][0], $_POST['homeDirectory']); - $errors['homeDirectory'][] = $errorMessage; + $errors[] = $errorMessage; } $this->attributes['homeDirectory'][0] = $_POST['homeDirectory']; // Load attributes @@ -621,7 +621,7 @@ class posixAccount extends baseModule { } } if (!get_preg($this->attributes['cn'][0], 'cn')) { - $errors['cn'][] = $this->messages['cn'][0]; + $errors[] = $this->messages['cn'][0]; } $this->attributes['uidNumber'][0] = $_POST['uidNumber']; $this->attributes['gidNumber'][0] = $_SESSION['cache']->getgid($_POST['gidNumber']); @@ -650,7 +650,7 @@ class posixAccount extends baseModule { $this->attributes['uidNumber'][0] = $newUID[0]; } else { - $errors['uidNumber'][] = $this->messages['uidNumber'][3]; + $errors[] = $this->messages['uidNumber'][3]; } } else $this->attributes['uidNumber'][0] = $this->orig['uidNumber'][0]; @@ -659,27 +659,27 @@ class posixAccount extends baseModule { else { // Check manual ID // id-number is out of valid range - if (!is_numeric($this->attributes['uidNumber'][0]) || ($this->attributes['uidNumber'][0] < $minID) || ($this->attributes['uidNumber'][0] > $maxID)) $errors['uidNumber'][] = array('ERROR', _('ID-Number'), sprintf(_('Please enter a value between %s and %s!'), $minID, $maxID)); + if (!is_numeric($this->attributes['uidNumber'][0]) || ($this->attributes['uidNumber'][0] < $minID) || ($this->attributes['uidNumber'][0] > $maxID)) $errors[] = array('ERROR', _('ID-Number'), sprintf(_('Please enter a value between %s and %s!'), $minID, $maxID)); // $uids is allways an array but not if no entries were found if (is_array($uids)) { // id-number is in use and account is a new account - if ((in_array($this->attributes['uidNumber'][0], $uids)) && $this->orig['uidNumber'][0]=='') $errors['uidNumber'][] = array('ERROR', _('ID-Number'), _('ID is already in use')); + if ((in_array($this->attributes['uidNumber'][0], $uids)) && $this->orig['uidNumber'][0]=='') $errors[] = array('ERROR', _('ID-Number'), _('ID is already in use')); // id-number is in use, account is existing account and id-number is not used by itself if ((in_array($this->attributes['uidNumber'][0], $uids)) && $this->orig['uidNumber'][0]!='' && ($this->orig['uidNumber'][0] != $this->attributes['uidNumber'][0]) ) { - $errors['uidNumber'][] = $this->messages['uidNumber'][3]; + $errors[] = $this->messages['uidNumber'][3]; $this->attributes['uidNumber'][0] = $this->orig['uidNumber'][0]; } } } if ($_SESSION[$this->base]->type=='user') { if (($this->attributes['uid'][0] != $_POST['uid']) && !get_preg($_POST['uid'], '!upper')) - $errors['uid'][] = $this->messages['uid'][1]; + $errors[] = $this->messages['uid'][1]; if ( !get_preg($this->attributes['homeDirectory'][0], 'homeDirectory' )) - $errors['homeDirecotry'][] = $this->messages['homeDirectory'][0]; + $errors[] = $this->messages['homeDirectory'][0]; } if (isset($_POST['userPassword_lock']) && isset($_POST['userPassword_nopassword'])) { // found invalid password parameter combination - $errors['userPassword'][] = $this->messages['userPassword'][3]; + $errors[] = $this->messages['userPassword'][3]; } else { if (isset($_POST['userPassword_nopassword'])) { @@ -695,10 +695,10 @@ class posixAccount extends baseModule { if (isset($_POST['genpass'])) $this->attributes['userPassword'][0] = genpasswd(); elseif ($_SESSION[$this->base]->isNewAccount) { if ($_POST['userPassword'] != $_POST['userPassword2']) - $errors['userPassword'][] = $this->messages['userPassword'][0]; + $errors[] = $this->messages['userPassword'][0]; else $this->attributes['userPassword'][0] = $_POST['userPassword']; if (!get_preg($this->attributes['userPassword'][0], 'password')) - $errors['userPassword'][] = $this->messages['userPassword'][1]; + $errors[] = $this->messages['userPassword'][1]; } if (isset($_POST['userPassword_lock'])) $this->userPassword_lock=true; else $this->userPassword_lock=false; @@ -707,10 +707,10 @@ class posixAccount extends baseModule { $this->attributes['homeDirectory'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]), $this->attributes['homeDirectory'][0]); if ($this->attributes['uid'][0] != '') $this->attributes['homeDirectory'][0] = str_replace('$user', $this->attributes['uid'][0], $this->attributes['homeDirectory'][0]); - if ($this->attributes['homeDirectory'][0] != $_POST['homeDirectory']) $errors['homeDirecotry'][] = array('INFO', _('Home directory'), _('Replaced $user or $group in homedir.')); + if ($this->attributes['homeDirectory'][0] != $_POST['homeDirectory']) $errors[] = array('INFO', _('Home directory'), _('Replaced $user or $group in homedir.')); // Check if Username contains only valid characters if ( !get_preg($this->attributes['uid'][0], 'username')) - $errors['uid'][] = $this->messages['uid'][2]; + $errors[] = $this->messages['uid'][2]; } if ($_SESSION[$this->base]->type=='host') { // add "$" to uid if needed @@ -720,7 +720,7 @@ class posixAccount extends baseModule { } // Check if Hostname contains only valid characters if ( !get_preg($this->attributes['uid'][0], 'hostname')) - $errors['uid'][] = $this->messages['uid'][4]; + $errors[] = $this->messages['uid'][4]; if (!$this->attributes['homeDirectory'][0]) { $this->attributes['homeDirectory'][0] = '/dev/null'; } @@ -769,11 +769,11 @@ class posixAccount extends baseModule { } // Show warning if lam has changed username if ($this->attributes['uid'][0] != $_POST['uid']) { - if ($_SESSION[$this->base]->type=='user') $errors['uid'][] = $this->messages['uid'][5]; - if ($_SESSION[$this->base]->type=='host') $errors['uid'][] = $this->messages['uid'][6]; + if ($_SESSION[$this->base]->type=='user') $errors[] = $this->messages['uid'][5]; + if ($_SESSION[$this->base]->type=='host') $errors[] = $this->messages['uid'][6]; } if ($_SESSION[$this->base]->isNewAccount && !get_preg($this->attributes['userPassword'][0], 'password')) - $errors['userPassword'][] = $this->messages['userPassword'][1]; + $errors[] = $this->messages['userPassword'][1]; } $attributeList = array('gecos', 'homeDirectory'); for ($i = 0; $i < sizeof($attributeList); $i++) { @@ -782,7 +782,7 @@ class posixAccount extends baseModule { $replacedValue = $this->checkASCII($value); if ($value != $replacedValue) { $this->attributes[$attributeList[$i]][0] = $replacedValue; - $errors['ascii'][] = array('WARN', $attributeList[$i], _('Changed value because only ASCII characters are allowed.')); + $errors[] = array('WARN', $attributeList[$i], _('Changed value because only ASCII characters are allowed.')); } } } @@ -829,6 +829,7 @@ class posixAccount extends baseModule { elseif (isset($_POST['removegroups']) && isset($_POST['removegroups_button'])) { // remove groups from list $this->groups = array_delete($_POST['removegroups'], $this->groups); } + return array(); } /** @@ -839,13 +840,13 @@ class posixAccount extends baseModule { */ function process_password() { if ($_POST['form_subpage_posixAccount_attributes_back']) return array(); - $messages = array(); + $errors = array(); if ($_POST['userPassword'] != $_POST['userPassword2']) { - $messages['userPassword'][] = $this->messages['userPassword'][0]; + $errors[] = $this->messages['userPassword'][0]; } else { if (!get_preg($_POST['userPassword'], 'password')) { - $messages['userPassword'][] = $this->messages['userPassword'][1]; + $errors[] = $this->messages['userPassword'][1]; } else { $this->attributes['userPassword'][0] = $_POST['userPassword']; @@ -853,7 +854,7 @@ class posixAccount extends baseModule { $this->userPassword_nopassword = false; } } - return $messages; + return $errors; } /* This function will create the html-page @@ -1567,7 +1568,7 @@ class posixAccount extends baseModule { sort ($uids, SORT_NUMERIC); } // show warning message - $errors['uidNumber'][] = $this->messages['uidNumber'][2]; + $errors[] = $this->messages['uidNumber'][2]; } } else { diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index 04142bac..35b67330 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -545,7 +545,7 @@ class posixGroup extends baseModule { if ($_POST['userPassword_lock'] && $_POST['userPassword_nopassword']) { // found invalid password parameter combination - $errors['userPassword'][] = $this->messages['userPassword'][3]; + $errors[] = $this->messages['userPassword'][3]; } else { if ($_POST['userPassword_nopassword']) { @@ -561,10 +561,10 @@ class posixGroup extends baseModule { if ($_POST['genpass']) $this->attributes['userPassword'][0] = genpasswd(); elseif ($_SESSION[$this->base]->isNewAccount) { if ($_POST['userPassword'] != $_POST['userPassword2']) - $errors['userPassword'][] = $this->messages['userPassword'][0]; + $errors[] = $this->messages['userPassword'][0]; else $this->attributes['userPassword'][0] = $_POST['userPassword']; if (!get_preg($this->attributes['userPassword'][0], 'password')) - $errors['userPassword'][] = $this->messages['userPassword'][1]; + $errors[] = $this->messages['userPassword'][1]; } if ($_POST['userPassword_lock']) $this->userPassword_lock=true; else $this->userPassword_lock=false; @@ -592,7 +592,7 @@ class posixGroup extends baseModule { $this->attributes['gidNumber'][0] = $newGID[0]; } else { - $errors['gidNumber'][] = $this->messages['gidNumber'][3]; + $errors[] = $this->messages['gidNumber'][3]; } } else $this->attributes['gidNumber'][0] = $this->orig['gidNumber'][0]; @@ -602,7 +602,7 @@ class posixGroup extends baseModule { // Check manual ID // id-number is out of valid range if (($this->attributes['gidNumber'][0] < $minID) || ($this->attributes['gidNumber'][0] > $maxID) || !is_numeric($this->attributes['gidNumber'][0])) { - $errors['gidNumber'][] = array('ERROR', _('ID-Number'), sprintf(_('Please enter a value between %s and %s!'), $minID, $maxID)); + $errors[] = array('ERROR', _('ID-Number'), sprintf(_('Please enter a value between %s and %s!'), $minID, $maxID)); if (isset($this->orig['gidNumber'][0])) $this->attributes['gidNumber'][0] = $this->orig['gidNumber'][0]; else unset($this->attributes['gidNumber'][0]); } @@ -610,12 +610,12 @@ class posixGroup extends baseModule { if (is_array($gids)) { // id-number is in use and account is a new account if ((in_array($this->attributes['gidNumber'][0], $gids)) && $this->orig['gidNumber'][0]=='') { - $errors['gidNumber'][] = array('ERROR', _('ID-Number'), _('ID is already in use')); + $errors[] = array('ERROR', _('ID-Number'), _('ID is already in use')); unset($this->attributes['gidNumber'][0]); } // id-number is in use, account is existing account and id-number is not used by itself if ((in_array($this->attributes['gidNumber'][0], $gids)) && $this->orig['gidNumber'][0]!='' && ($this->orig['gidNumber'][0] != $this->attributes['gidNumber'][0]) ) { - $errors['gidNumber'][] = $this->messages['gidNumber'][4]; + $errors[] = $this->messages['gidNumber'][4]; $this->attributes['gidNumber'][0] = $this->orig['gidNumber'][0]; } } @@ -624,10 +624,10 @@ class posixGroup extends baseModule { if ($this->attributes['cn'][0]!=$_POST['cn']) { $this->attributes['cn'][0] = $_POST['cn']; if (($this->attributes['cn'][0] != $_POST['cn']) && ereg('[A-Z]$', $_POST['cn'])) - $errors['cn'][] = $this->messages['cn'][0]; + $errors[] = $this->messages['cn'][0]; // Check if Groupname contains only valid characters if ( !get_preg($this->attributes['cn'][0],'groupname')) - $errors['cn'][] = $this->messages['cn'][2]; + $errors[] = $this->messages['cn'][2]; // Create automatic useraccount with number if original user already exists // Reset name to original name if new name is in use // Set username back to original name if new username is in use @@ -667,11 +667,11 @@ class posixGroup extends baseModule { } // Show warning if lam has changed username if ($this->attributes['cn'][0] != $_POST['cn']) { - $errors['cn'][] = $this->messages['cn'][0]; + $errors[] = $this->messages['cn'][0]; } // show info when gidnumber has changed if (($this->orig['gidNumber'][0]!=$this->attributes['gidNumber'][0]) && $this->orig['gidNumber'][0]!='' && $_POST['gidNumber']!=$this->attributes['gidNumber'][0]) { - $errors['gidNumber'][] = $this->messages['gidNumber'][0]; + $errors[] = $this->messages['gidNumber'][0]; } } // Return error-messages @@ -694,6 +694,7 @@ class posixGroup extends baseModule { elseif (isset($_POST['removeusers']) && isset($_POST['removeusers_button'])) { // remove users from list $this->attributes['memberUid'] = array_delete($_POST['removeusers'], $this->attributes['memberUid']); } + return array(); } @@ -705,18 +706,18 @@ class posixGroup extends baseModule { */ function process_password() { if ($_POST['form_subpage_posixGroup_attributes_back']) return array(); - $messages = array(); + $errors = array(); if ($_POST['userPassword'] != $_POST['userPassword2']) { - $messages['userPassword'][] = $this->messages['userPassword'][0]; + $errors[] = $this->messages['userPassword'][0]; if (!get_preg($_POST['userPassword'], 'password')) - $messages['userPassword'][] = $this->messages['userPassword'][1]; + $errors[] = $this->messages['userPassword'][1]; } else { $this->attributes['userPassword'][0] = $_POST['userPassword']; $this->userPassword_lock = false; $this->userPassword_nopassword = false; } - return $messages; + return $errors; } /** @@ -860,7 +861,7 @@ class posixGroup extends baseModule { sort ($gids, SORT_NUMERIC); } // show warning message - $errors['gidNumber'][] = $this->messages['gidNumber'][2]; + $errors[] = $this->messages['gidNumber'][2]; } } else { diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index 87edfa8c..4b271b24 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -274,17 +274,17 @@ class quota extends baseModule { $this->quota[$i][7] = $_POST[$i . '_7']; // Check if values are OK and set automatic values. if not error-variable will be set if (!get_preg($this->quota[$i][2], 'digit')) - $errors[$this->quota[$i][2]][] = $this->messages['softblock'][0]; + $errors[] = $this->messages['softblock'][0]; if (!get_preg($this->quota[$i][3], 'digit')) - $errors[$this->quota[$i][3]][] = $this->messages['hardblock'][0]; + $errors[] = $this->messages['hardblock'][0]; if (!get_preg($this->quota[$i][6], 'digit')) - $errors[$this->quota[$i][6]][] = $this->messages['softinode'][0]; + $errors[] = $this->messages['softinode'][0]; if (!get_preg($this->quota[$i][7], 'digit')) - $errors[$this->quota[$i][7]][] = $this->messages['hardinode'][0]; + $errors[] = $this->messages['hardinode'][0]; if (intval($this->quota[$i][2]) > intval($this->quota[$i][3])) - $errors[$this->quota[$i][2]][] = $this->messages['block_cmp'][0]; + $errors[] = $this->messages['block_cmp'][0]; if (intval($this->quota[$i][6]) > intval($this->quota[$i][7])) - $errors[$this->quota[$i][6]][] = $this->messages['inode_cmp'][0]; + $errors[] = $this->messages['inode_cmp'][0]; $i++; } return $errors; diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc index 36ade314..a520f6ca 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -540,7 +540,7 @@ class sambaAccount extends baseModule { // display name $this->attributes['displayName'][0] = $_POST['displayName']; if (!($this->attributes['displayName'][0] == '') && !(get_preg($this->attributes['displayName'][0], 'realname'))) { - $errors['displayName'][] = $this->messages['displayName'][1]; + $errors[] = $this->messages['displayName'][1]; } // host attributes @@ -587,11 +587,11 @@ class sambaAccount extends baseModule { else $this->useunixpwd = false; if (!$this->useunixpwd && isset($_POST['lmPassword']) && ($_POST['lmPassword'] != '')) { if ($_POST['lmPassword'] != $_POST['lmPassword2']) { - $errors['lmPassword'][] = $this->messages['lmPassword'][0]; + $errors[] = $this->messages['lmPassword'][0]; unset ($_POST['lmPassword2']); } else { - if ( !get_preg($_POST['lmPassword'], 'password')) $errors['lmPassword'][] = $this->messages['lmPassword'][1]; + if ( !get_preg($_POST['lmPassword'], 'password')) $errors[] = $this->messages['lmPassword'][1]; else { $this->attributes['lmPassword'][0] = lmPassword($_POST['lmPassword']); $this->attributes['ntPassword'][0] = ntPassword($_POST['lmPassword']); @@ -609,19 +609,19 @@ class sambaAccount extends baseModule { } $this->attributes['smbHome'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['smbHome'][0]); $this->attributes['smbHome'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['smbHome'][0]); - if ($this->attributes['smbHome'][0] != $_POST['smbHome']) $errors['smbHome'][] = $this->messages['homePath'][1]; + if ($this->attributes['smbHome'][0] != $_POST['smbHome']) $errors[] = $this->messages['homePath'][1]; $this->attributes['scriptPath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['scriptPath'][0]); $this->attributes['scriptPath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['scriptPath'][0]); - if ($this->attributes['scriptPath'][0] != $_POST['scriptPath']) $errors['scriptPath'][] = $this->messages['logonScript'][1]; + if ($this->attributes['scriptPath'][0] != $_POST['scriptPath']) $errors[] = $this->messages['logonScript'][1]; $this->attributes['profilePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['profilePath'][0]); $this->attributes['profilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['profilePath'][0]); - if ($this->attributes['profiletPath'][0] != $_POST['profilePath']) $errors['profilePath'][] = $this->messages['profilePath'][1]; + if ($this->attributes['profiletPath'][0] != $_POST['profilePath']) $errors[] = $this->messages['profilePath'][1]; if ( (!$this->attributes['smbHome'][0]=='') && (!get_preg($this->attributes['smbHome'][0], 'UNC'))) - $errors['smbHome'][] = $this->messages['homePath'][0]; + $errors[] = $this->messages['homePath'][0]; if ( (!$this->attributes['scriptPath'][0]=='') && (!get_preg($this->attributes['scriptPath'][0], 'logonscript'))) - $errors['scriptPath'][] = $this->messages['logonScript'][0]; + $errors[] = $this->messages['logonScript'][0]; if ( (!$this->attributes['profilePath'][0]=='') && (!get_preg($this->attributes['profilePath'][0], 'UNC'))) - $errors['profilePath'][] = $this->messages['profilePath'][0]; + $errors[] = $this->messages['profilePath'][0]; } // check values for host account else { @@ -634,7 +634,7 @@ class sambaAccount extends baseModule { } if ((!$this->attributes['domain'][0]=='') && !get_preg($this->attributes['domain'][0], 'domainname')) - $errors['domain'][] = $this->messages['domain'][0]; + $errors[] = $this->messages['domain'][0]; return $errors; } @@ -686,6 +686,7 @@ class sambaAccount extends baseModule { } } } + return array(); } /* This function will create the html-page diff --git a/lam/lib/modules/sambaDomain.inc b/lam/lib/modules/sambaDomain.inc index 754e5466..9a1b4aca 100644 --- a/lam/lib/modules/sambaDomain.inc +++ b/lam/lib/modules/sambaDomain.inc @@ -487,7 +487,7 @@ class sambaDomain extends baseModule { } } - return array($errors); + return $errors; } /** diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index be75b15d..be9dc69a 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -433,7 +433,7 @@ class sambaGroupMapping extends baseModule { if ($_SESSION['cache']->in_cache($SID."-".$this->rids[$rids[$i]], 'sambaSID', 'group')) { $message = $this->messages['sambaSID'][0]; $message[] = $rids[$i]; - $errors['sambaSID'][] = $message; + $errors[] = $message; } } } diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 1866925c..d7e3603c 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -595,7 +595,7 @@ class sambaSamAccount extends baseModule { // display name $this->attributes['displayName'][0] = $_POST['displayName']; if (!($this->attributes['displayName'][0] == '') && !(get_preg($this->attributes['displayName'][0], 'realname'))) { - $errors['displayName'][] = $this->messages['displayName'][1]; + $errors[] = $this->messages['displayName'][1]; } // host attributes @@ -659,11 +659,11 @@ class sambaSamAccount extends baseModule { else $this->useunixpwd = false; if (!$this->useunixpwd && isset($_POST['sambaLMPassword']) && ($_POST['sambaLMPassword'] != '')) { if ($_POST['sambaLMPassword'] != $_POST['sambaLMPassword2']) { - $errors['sambaLMPassword'][] = $this->messages['sambaLMPassword'][0]; + $errors[] = $this->messages['sambaLMPassword'][0]; unset ($_POST['sambaLMPassword2']); } else { - if (!get_preg($_POST['sambaLMPassword'], 'password')) $errors['sambaLMPassword'][] = $this->messages['sambaLMPassword'][1]; + if (!get_preg($_POST['sambaLMPassword'], 'password')) $errors[] = $this->messages['sambaLMPassword'][1]; else { $this->attributes['sambaLMPassword'][0] = lmPassword($_POST['sambaLMPassword']); $this->attributes['sambaNTPassword'][0] = ntPassword($_POST['sambaLMPassword']); @@ -687,20 +687,20 @@ class sambaSamAccount extends baseModule { // Check values $this->attributes['sambaHomePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaHomePath'][0]); $this->attributes['sambaHomePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaHomePath'][0]); - if ($this->attributes['sambaHomePath'][0] != $_POST['sambaHomePath']) $errors['sambaHomePath'][] = $this->messages['homePath'][1]; + if ($this->attributes['sambaHomePath'][0] != $_POST['sambaHomePath']) $errors[] = $this->messages['homePath'][1]; $this->attributes['sambaLogonScript'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaLogonScript'][0]); $this->attributes['sambaLogonScript'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaLogonScript'][0]); - if ($this->attributes['sambaLogonScript'][0] != $_POST['sambaLogonScript']) $errors['sambaLogonScript'][] = $this->messages['logonScript'][1]; + if ($this->attributes['sambaLogonScript'][0] != $_POST['sambaLogonScript']) $errors[] = $this->messages['logonScript'][1]; $this->attributes['sambaProfilePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaProfilePath'][0]); $this->attributes['sambaProfilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaProfilePath'][0]); - if ($this->attributes['sambaProfilePath'][0] != $_POST['sambaProfilePath']) $errors['sambaProfilePath'][] = $this->messages['profilePath'][1]; + if ($this->attributes['sambaProfilePath'][0] != $_POST['sambaProfilePath']) $errors[] = $this->messages['profilePath'][1]; if ( (!$this->attributes['sambaHomePath'][0]=='') && (!get_preg($this->attributes['sambaHomePath'][0], 'UNC'))) - $errors['sambaHomePath'][] = $this->messages['homePath'][0]; + $errors[] = $this->messages['homePath'][0]; if ( (!$this->attributes['sambaLogonScript'][0]=='') && (!get_preg($this->attributes['sambaLogonScript'][0], 'logonscript'))) - $errors['sambaScriptPath'][] = $this->messages['logonScript'][0]; + $errors[] = $this->messages['logonScript'][0]; if (!($this->attributes['sambaProfilePath'][0] == '') && !(get_preg($this->attributes['sambaProfilePath'][0], 'UNC') xor get_preg($this->attributes['sambaProfilePath'][0], 'homeDirectory'))) - $errors['sambaProfilePath'][] = $this->messages['profilePath'][0]; + $errors[] = $this->messages['profilePath'][0]; } else { // host if (!$this->attributes['sambaSID'][0]) { @@ -757,6 +757,7 @@ class sambaSamAccount extends baseModule { } } } + return array(); } /** @@ -783,6 +784,7 @@ class sambaSamAccount extends baseModule { $logonHoursNew = $logonHoursNew . $hex; } $this->attributes['sambaLogonHours'][0] = $logonHoursNew; + return array(); } /* This function will create the html-page diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index a80030de..5a74e07f 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -255,11 +255,11 @@ class shadowAccount extends baseModule { $this->attributes['shadowInactive'][0] = $_POST['shadowInactive']; $this->attributes['shadowExpire'][0] = intval(mktime(0, 0, 0, intval($_POST['shadowExpire_mon']), intval($_POST['shadowExpire_day']), intval($_POST['shadowExpire_yea']))/3600/24); - if ( !get_preg($this->attributes['shadowMin'][0], 'digit')) $errors['shadowMin'][] = $this->messages['shadowMin'][0]; - if ( !get_preg($this->attributes['shadowMax'][0], 'digit')) $errors['shadowMax'][] = $this->messages['shadowMax'][0]; - if ( $this->attributes['shadowMin'][0] > $this->attributes['shadowMax'][0]) $errors['shadowMin'][] = $this->messages['shadow_cmp'][0]; - if ( !get_preg($this->attributes['shadowInactive'][0], 'digit2')) $errors['shadowInactive'][] = $this->messages['inactive'][0]; - if ( !get_preg($this->attributes['shadowWarning'][0], 'digit')) $errors['shadowWarning'][] = $this->messages['shadowWarning'][0]; + if ( !get_preg($this->attributes['shadowMin'][0], 'digit')) $errors[] = $this->messages['shadowMin'][0]; + if ( !get_preg($this->attributes['shadowMax'][0], 'digit')) $errors[] = $this->messages['shadowMax'][0]; + if ( $this->attributes['shadowMin'][0] > $this->attributes['shadowMax'][0]) $errors[] = $this->messages['shadow_cmp'][0]; + if ( !get_preg($this->attributes['shadowInactive'][0], 'digit2')) $errors[] = $this->messages['inactive'][0]; + if ( !get_preg($this->attributes['shadowWarning'][0], 'digit')) $errors[] = $this->messages['shadowWarning'][0]; return $errors; }