removed grouping of error messages

This commit is contained in:
Roland Gruber 2006-08-16 17:42:35 +00:00
parent ec8564aa02
commit 641af2270d
18 changed files with 162 additions and 188 deletions

View File

@ -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

View File

@ -1 +1 @@
1.0.4
1.1.0.RC1

View File

@ -1,9 +1,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Module HowTo - Account pages</title>
<link rel="stylesheet" type="text/css" href="style/layout.css">
</head>
<html><head><title>Module HowTo - Account pages</title>
<link rel="stylesheet" type="text/css" href="style/layout.css"></head>
<body>
<div style="text-align: center;">
<h1>Module HowTo - Account pages<br>
@ -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.<br>
There are two variables in <span style="font-style: italic;">baseModule</span>
which should be used to store the attributes. The <span
style="font-weight: bold;">$attributes</span> variable stores the
current attributes including changes the user made. The <span
style="font-weight: bold;">$orig</span> variable stores the attributes
which should be used to store the attributes. The <span style="font-weight: bold;">$attributes</span> variable stores the
current attributes including changes the user made. The <span style="font-weight: bold;">$orig</span> variable stores the attributes
as they were originally when the account was loaded. This allows you to
see what changes were made.<br>
<br>
The <span style="font-weight: bold;">load_attributes()</span> function
in your module gets the complete attribute list from LDAP.<br>
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
style="font-weight: bold; text-decoration: underline;">
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
<br>
The <span style="font-style: italic;">ieee802Device</span> uses an
object class and the <span style="font-style: italic;">'macAddress'</span>
attribute. Therefore we will save this two values.<br>
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">&nbsp;&nbsp;&nbsp; /**<br>
@ -45,8 +40,7 @@ object.<br>
&nbsp;&nbsp;&nbsp; * @param array $attr an array as it is retured from
ldap_get_attributes<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">load_attributes</span>($attr) {<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">load_attributes</span>($attr) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;attributes['objectClass'] = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
@ -81,15 +75,12 @@ $this-&gt;orig['macAddress'] = $attr['macAddress'];<br>
<br>
<h2>2. Page display</h2>
Now that you have defined your subpages you will need one function for
each page to display it. The function must return <span
style="font-style: italic;">meta HTML code</span> as defined in the <span
style="font-style: italic;">modules specification</span>.<br>
each page to display it. The function must return <span style="font-style: italic;">meta HTML code</span> as defined in the <span style="font-style: italic;">modules specification</span>.<br>
This function is called <span style="font-weight: bold;">display_html_&lt;page
name&gt;()</span> where <span style="font-style: italic;">&lt;page
name&gt;</span> is the name of your subpage.<br>
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
style="font-weight: bold; text-decoration: underline;">
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
<br>
The
<span style="font-style: italic;">ieee802Device</span>
@ -100,8 +91,7 @@ second an input field for new values.<br>
The variable <span style="font-style: italic;">$this-&gt;attributes</span>
contains the LDAP attributes which are useful for this module.<br>
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">&nbsp;&nbsp;&nbsp; /**<br>
@ -110,8 +100,7 @@ show a page with all attributes.<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @param array $post HTTP-POST values<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">display_html_attributes</span>($post) {<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">display_html_attributes</span>($post) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // list current MACs<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for ($i = 0; $i &lt;
@ -163,12 +152,10 @@ This function is called <span style="font-weight: bold;">process_&lt;page
name&gt;()</span> where <span style="font-style: italic;">&lt;page
name&gt;</span> is the name of your subpage.<br>
<br>
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.<br>
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
style="font-weight: bold; text-decoration: underline;">
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
<br>
The
<span style="font-style: italic;">ieee802Device</span>
@ -178,8 +165,7 @@ and therefore only <span style="font-style: italic;">process_attributes()</span>
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.<br>
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">&nbsp;&nbsp;&nbsp; /**<br>
@ -188,8 +174,7 @@ checks<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @param array $post HTTP-POST values<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">process_attributes</span>($post) {<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">process_attributes</span>($post) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $errors = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$this-&gt;attributes['macAddress'] = array();<br>
@ -215,8 +200,7 @@ $this-&gt;messages['mac'][0];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message[] =
$post['macAddress' . $i];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $errors[] =
array($message);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $errors[] = $message;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
@ -244,7 +228,7 @@ $this-&gt;messages['mac'][0];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $message[] = $post['macAddress'];<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $errors[] = array($message);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $errors[] = $message;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
@ -260,13 +244,10 @@ array_unique($this-&gt;attributes['macAddress']);<br>
<br>
<h2>4. Defining that your module is ready for user input and LDAP
add/modify</h2>
In most cases you will not need to implement these functions. The <span
style="font-style: italic;">baseModule</span> will return <span
style="font-style: italic;">true</span> for both functions.<br>
In most cases you will not need to implement these functions. The <span style="font-style: italic;">baseModule</span> will return <span style="font-style: italic;">true</span> for both functions.<br>
<br>
<span style="text-decoration: underline;"><br>
There are two functions which control the module status:</span><br
style="text-decoration: underline;">
There are two functions which control the module status:</span><br style="text-decoration: underline;">
<br>
The <span style="font-weight: bold;">module_ready()</span> function
has to
@ -278,14 +259,12 @@ modules (e.g. you need the user name from posixAccount first).<br>
<br>
The second function is
<span style="font-weight: bold;">module_complete()</span>. The user
cannot do the LDAP operation if one or more modules return <span
style="font-style: italic;">false</span>. This defines if all needed
cannot do the LDAP operation if one or more modules return <span style="font-style: italic;">false</span>. This defines if all needed
input data for your module was entered.<br>
Use this function if you want to check that all required attributes are
set.<br>
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
style="font-weight: bold; text-decoration: underline;">
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
<br>
The <span style="font-style: italic;">sambaSamAccount</span>
module needs the user's <span style="font-style: italic;">uidNumber</span>
@ -293,8 +272,7 @@ and <span style="font-style: italic;">gidNumber</span> before it can
accept input and the account needs a <span style="font-style: italic;">sambaSID</span>
before it can be saved.<br>
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">&nbsp;&nbsp;&nbsp; /**<br>
@ -305,8 +283,7 @@ other modules which was not yet entered.<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @return boolean true, if page can be displayed<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">module_ready</span>() {<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">module_ready</span>() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
($_SESSION[$this-&gt;base]-&gt;module['posixAccount']-&gt;attributes['gidNumber'][0]=='')
return false;<br>
@ -324,8 +301,7 @@ for this module have been made.<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @return boolean true, if settings are complete<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span
style="color: rgb(255, 0, 0);">module_complete</span>() {<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">module_complete</span>() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!$this-&gt;module_ready())
return false;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
@ -341,9 +317,7 @@ return false;<br>
<br>
<h2>5. Saving the LDAP attributes<br>
</h2>
In most cases you will not have to implement this option if you use <span
style="font-weight: bold;">$this-&gt;attributes</span> and <span
style="font-weight: bold;">$this-&gt;orig</span> to manage the LDAP
In most cases you will not have to implement this option if you use <span style="font-weight: bold;">$this-&gt;attributes</span> and <span style="font-weight: bold;">$this-&gt;orig</span> to manage the LDAP
attributes. The <span style="font-style: italic;">baseModule</span>
will generate the save comands for you.<br>
<br>
@ -352,15 +326,13 @@ user clicks on the add/modify button your module will be asked what
changes have to be made.<br>
This is done in the function <span style="font-weight: bold;">save_attributes()</span>.<br>
<br>
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
style="font-weight: bold; text-decoration: underline;">
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
<br>
The <span style="font-style: italic;">kolabUser</span> module uses
this function to make sure that its object class is saved. Other
modules (e.g. quota) use it build the lamdaemon commands.<br>
<br>
<table style="width: 100%; text-align: left;" class="mod-code"
border="0" cellpadding="2" cellspacing="2">
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">&nbsp;&nbsp;&nbsp; /**<br>
@ -402,5 +374,4 @@ $this-&gt;attributes['objectClass'][] = 'kolabInetOrgPerson';<br>
<h2><span style="font-weight: bold;"></span></h2>
</div>
</div>
</body>
</html>
</body></html>

View File

@ -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 "<form enctype=\"multipart/form-data\" action=\"edit.php\" method=\"post\">\n";
// Display error-messages
if (is_array($result)) {
foreach ($result as $result2) {
if (is_array($result2)) {
for ($i=0; $i<sizeof($result2); $i++) {
call_user_func_array("StatusMessage", $result2[$i]);
}
}
for ($i=0; $i<sizeof($result); $i++) {
call_user_func_array("StatusMessage", $result[$i]);
}
if (isset($stopProcessing) && ($stopProcessing == true)) {
echo "</body>\n";
@ -1130,7 +1123,9 @@ class accountContainer {
for ($j=0; $j<count($attributes[$attr_names[$i]]); $j++) {
if (is_array($orig[$attr_names[$i]])) {
if (!in_array($attributes[$attr_names[$i]][$j], $orig[$attr_names[$i]]))
if ($attributes[$attr_names[$i]][$j]!='') $toadd[$attr_names[$i]][] = $attributes[$attr_names[$i]][$j];
if ($attributes[$attr_names[$i]][$j]!='') {
$toadd[$attr_names[$i]][] = $attributes[$attr_names[$i]][$j];
}
}
else if ($attributes[$attr_names[$i]][$j]!='') $toadd[$attr_names[$i]][] = $attributes[$attr_names[$i]][$j];
}

View File

@ -179,8 +179,8 @@ class account extends baseModule {
$modules = $_SESSION['config']->get_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;
}

View File

@ -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']);

View File

@ -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']);

View File

@ -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'];

View File

@ -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;

View File

@ -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']);

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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

View File

@ -487,7 +487,7 @@ class sambaDomain extends baseModule {
}
}
return array($errors);
return $errors;
}
/**

View File

@ -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;
}
}
}

View File

@ -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

View File

@ -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;
}