removed grouping of error messages
This commit is contained in:
parent
ec8564aa02
commit
641af2270d
|
@ -1,8 +1,11 @@
|
||||||
??? 1.0.5
|
??? 1.1.0
|
||||||
|
|
||||||
Developers:
|
Developers:
|
||||||
- API changes: removed $post parameters from module functions (delete_attributes(),
|
API changes:
|
||||||
process_...(), display_html_...()). Use $_POST instead.
|
- 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
|
10.08.2006 1.0.4
|
||||||
- added Russian translation
|
- added Russian translation
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1.0.4
|
1.1.0.RC1
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html><head><title>Module HowTo - Account pages</title>
|
||||||
<head>
|
|
||||||
<title>Module HowTo - Account pages</title>
|
<link rel="stylesheet" type="text/css" href="style/layout.css"></head>
|
||||||
<link rel="stylesheet" type="text/css" href="style/layout.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
<body>
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<h1>Module HowTo - Account pages<br>
|
<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
|
the complete LDAP entry of it. Your module then should select the
|
||||||
attributes which are useful for it.<br>
|
attributes which are useful for it.<br>
|
||||||
There are two variables in <span style="font-style: italic;">baseModule</span>
|
There are two variables in <span style="font-style: italic;">baseModule</span>
|
||||||
which should be used to store the attributes. The <span
|
which should be used to store the attributes. The <span style="font-weight: bold;">$attributes</span> variable stores the
|
||||||
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
|
||||||
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
|
as they were originally when the account was loaded. This allows you to
|
||||||
see what changes were made.<br>
|
see what changes were made.<br>
|
||||||
<br>
|
<br>
|
||||||
The <span style="font-weight: bold;">load_attributes()</span> function
|
The <span style="font-weight: bold;">load_attributes()</span> function
|
||||||
in your module gets the complete attribute list from LDAP.<br>
|
in your module gets the complete attribute list from LDAP.<br>
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
|
||||||
style="font-weight: bold; text-decoration: underline;">
|
|
||||||
<br>
|
<br>
|
||||||
The <span style="font-style: italic;">ieee802Device</span> uses an
|
The <span style="font-style: italic;">ieee802Device</span> uses an
|
||||||
object class and the <span style="font-style: italic;">'macAddress'</span>
|
object class and the <span style="font-style: italic;">'macAddress'</span>
|
||||||
attribute. Therefore we will save this two values.<br>
|
attribute. Therefore we will save this two values.<br>
|
||||||
<br>
|
<br>
|
||||||
<table style="width: 100%; text-align: left;" class="mod-code"
|
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
|
||||||
border="0" cellpadding="2" cellspacing="2">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;"> /**<br>
|
<td style="vertical-align: top;"> /**<br>
|
||||||
|
@ -45,8 +40,7 @@ object.<br>
|
||||||
* @param array $attr an array as it is retured from
|
* @param array $attr an array as it is retured from
|
||||||
ldap_get_attributes<br>
|
ldap_get_attributes<br>
|
||||||
*/<br>
|
*/<br>
|
||||||
<span style="font-weight: bold;">function</span> <span
|
<span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">load_attributes</span>($attr) {<br>
|
||||||
style="color: rgb(255, 0, 0);">load_attributes</span>($attr) {<br>
|
|
||||||
|
|
||||||
$this->attributes['objectClass'] = array();<br>
|
$this->attributes['objectClass'] = array();<br>
|
||||||
|
|
||||||
|
@ -81,15 +75,12 @@ $this->orig['macAddress'] = $attr['macAddress'];<br>
|
||||||
<br>
|
<br>
|
||||||
<h2>2. Page display</h2>
|
<h2>2. Page display</h2>
|
||||||
Now that you have defined your subpages you will need one function for
|
Now that you have defined your subpages you will need one function for
|
||||||
each page to display it. The function must return <span
|
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>
|
||||||
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_<page
|
This function is called <span style="font-weight: bold;">display_html_<page
|
||||||
name>()</span> where <span style="font-style: italic;"><page
|
name>()</span> where <span style="font-style: italic;"><page
|
||||||
name></span> is the name of your subpage.<br>
|
name></span> is the name of your subpage.<br>
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
|
||||||
style="font-weight: bold; text-decoration: underline;">
|
|
||||||
<br>
|
<br>
|
||||||
The
|
The
|
||||||
<span style="font-style: italic;">ieee802Device</span>
|
<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->attributes</span>
|
The variable <span style="font-style: italic;">$this->attributes</span>
|
||||||
contains the LDAP attributes which are useful for this module.<br>
|
contains the LDAP attributes which are useful for this module.<br>
|
||||||
<br>
|
<br>
|
||||||
<table style="width: 100%; text-align: left;" class="mod-code"
|
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
|
||||||
border="0" cellpadding="2" cellspacing="2">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;"> /**<br>
|
<td style="vertical-align: top;"> /**<br>
|
||||||
|
@ -110,8 +100,7 @@ show a page with all attributes.<br>
|
||||||
*<br>
|
*<br>
|
||||||
* @param array $post HTTP-POST values<br>
|
* @param array $post HTTP-POST values<br>
|
||||||
*/<br>
|
*/<br>
|
||||||
<span style="font-weight: bold;">function</span> <span
|
<span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">display_html_attributes</span>($post) {<br>
|
||||||
style="color: rgb(255, 0, 0);">display_html_attributes</span>($post) {<br>
|
|
||||||
$return = array();<br>
|
$return = array();<br>
|
||||||
// list current MACs<br>
|
// list current MACs<br>
|
||||||
for ($i = 0; $i <
|
for ($i = 0; $i <
|
||||||
|
@ -163,12 +152,10 @@ This function is called <span style="font-weight: bold;">process_<page
|
||||||
name>()</span> where <span style="font-style: italic;"><page
|
name>()</span> where <span style="font-style: italic;"><page
|
||||||
name></span> is the name of your subpage.<br>
|
name></span> is the name of your subpage.<br>
|
||||||
<br>
|
<br>
|
||||||
If all input data is ok then return "0" or an array containing no error
|
If all input data is ok then return an empty array. If you return one or more error messages then the user will be
|
||||||
message. If you return one or more error messages then the user will be
|
|
||||||
redirected to your page.<br>
|
redirected to your page.<br>
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
|
||||||
style="font-weight: bold; text-decoration: underline;">
|
|
||||||
<br>
|
<br>
|
||||||
The
|
The
|
||||||
<span style="font-style: italic;">ieee802Device</span>
|
<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
|
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>
|
all is ok it will enable the user to move to another module page.<br>
|
||||||
<br>
|
<br>
|
||||||
<table style="width: 100%; text-align: left;" class="mod-code"
|
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
|
||||||
border="0" cellpadding="2" cellspacing="2">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;"> /**<br>
|
<td style="vertical-align: top;"> /**<br>
|
||||||
|
@ -188,8 +174,7 @@ checks<br>
|
||||||
*<br>
|
*<br>
|
||||||
* @param array $post HTTP-POST values<br>
|
* @param array $post HTTP-POST values<br>
|
||||||
*/<br>
|
*/<br>
|
||||||
<span style="font-weight: bold;">function</span> <span
|
<span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">process_attributes</span>($post) {<br>
|
||||||
style="color: rgb(255, 0, 0);">process_attributes</span>($post) {<br>
|
|
||||||
$errors = array();<br>
|
$errors = array();<br>
|
||||||
|
|
||||||
$this->attributes['macAddress'] = array();<br>
|
$this->attributes['macAddress'] = array();<br>
|
||||||
|
@ -215,8 +200,7 @@ $this->messages['mac'][0];<br>
|
||||||
$message[] =
|
$message[] =
|
||||||
$post['macAddress' . $i];<br>
|
$post['macAddress' . $i];<br>
|
||||||
|
|
||||||
$errors[] =
|
$errors[] = $message;<br>
|
||||||
array($message);<br>
|
|
||||||
|
|
||||||
}<br>
|
}<br>
|
||||||
|
|
||||||
|
@ -244,7 +228,7 @@ $this->messages['mac'][0];<br>
|
||||||
|
|
||||||
$message[] = $post['macAddress'];<br>
|
$message[] = $post['macAddress'];<br>
|
||||||
|
|
||||||
$errors[] = array($message);<br>
|
$errors[] = $message;<br>
|
||||||
}<br>
|
}<br>
|
||||||
}<br>
|
}<br>
|
||||||
|
|
||||||
|
@ -260,13 +244,10 @@ array_unique($this->attributes['macAddress']);<br>
|
||||||
<br>
|
<br>
|
||||||
<h2>4. Defining that your module is ready for user input and LDAP
|
<h2>4. Defining that your module is ready for user input and LDAP
|
||||||
add/modify</h2>
|
add/modify</h2>
|
||||||
In most cases you will not need to implement these functions. The <span
|
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>
|
||||||
style="font-style: italic;">baseModule</span> will return <span
|
|
||||||
style="font-style: italic;">true</span> for both functions.<br>
|
|
||||||
<br>
|
<br>
|
||||||
<span style="text-decoration: underline;"><br>
|
<span style="text-decoration: underline;"><br>
|
||||||
There are two functions which control the module status:</span><br
|
There are two functions which control the module status:</span><br style="text-decoration: underline;">
|
||||||
style="text-decoration: underline;">
|
|
||||||
<br>
|
<br>
|
||||||
The <span style="font-weight: bold;">module_ready()</span> function
|
The <span style="font-weight: bold;">module_ready()</span> function
|
||||||
has to
|
has to
|
||||||
|
@ -278,14 +259,12 @@ modules (e.g. you need the user name from posixAccount first).<br>
|
||||||
<br>
|
<br>
|
||||||
The second function is
|
The second function is
|
||||||
<span style="font-weight: bold;">module_complete()</span>. The user
|
<span style="font-weight: bold;">module_complete()</span>. The user
|
||||||
cannot do the LDAP operation if one or more modules return <span
|
cannot do the LDAP operation if one or more modules return <span style="font-style: italic;">false</span>. This defines if all needed
|
||||||
style="font-style: italic;">false</span>. This defines if all needed
|
|
||||||
input data for your module was entered.<br>
|
input data for your module was entered.<br>
|
||||||
Use this function if you want to check that all required attributes are
|
Use this function if you want to check that all required attributes are
|
||||||
set.<br>
|
set.<br>
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
|
||||||
style="font-weight: bold; text-decoration: underline;">
|
|
||||||
<br>
|
<br>
|
||||||
The <span style="font-style: italic;">sambaSamAccount</span>
|
The <span style="font-style: italic;">sambaSamAccount</span>
|
||||||
module needs the user's <span style="font-style: italic;">uidNumber</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>
|
accept input and the account needs a <span style="font-style: italic;">sambaSID</span>
|
||||||
before it can be saved.<br>
|
before it can be saved.<br>
|
||||||
<br>
|
<br>
|
||||||
<table style="width: 100%; text-align: left;" class="mod-code"
|
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
|
||||||
border="0" cellpadding="2" cellspacing="2">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;"> /**<br>
|
<td style="vertical-align: top;"> /**<br>
|
||||||
|
@ -305,8 +283,7 @@ other modules which was not yet entered.<br>
|
||||||
*<br>
|
*<br>
|
||||||
* @return boolean true, if page can be displayed<br>
|
* @return boolean true, if page can be displayed<br>
|
||||||
*/<br>
|
*/<br>
|
||||||
<span style="font-weight: bold;">function</span> <span
|
<span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">module_ready</span>() {<br>
|
||||||
style="color: rgb(255, 0, 0);">module_ready</span>() {<br>
|
|
||||||
if
|
if
|
||||||
($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='')
|
($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='')
|
||||||
return false;<br>
|
return false;<br>
|
||||||
|
@ -324,8 +301,7 @@ for this module have been made.<br>
|
||||||
*<br>
|
*<br>
|
||||||
* @return boolean true, if settings are complete<br>
|
* @return boolean true, if settings are complete<br>
|
||||||
*/<br>
|
*/<br>
|
||||||
<span style="font-weight: bold;">function</span> <span
|
<span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">module_complete</span>() {<br>
|
||||||
style="color: rgb(255, 0, 0);">module_complete</span>() {<br>
|
|
||||||
if (!$this->module_ready())
|
if (!$this->module_ready())
|
||||||
return false;<br>
|
return false;<br>
|
||||||
if
|
if
|
||||||
|
@ -341,9 +317,7 @@ return false;<br>
|
||||||
<br>
|
<br>
|
||||||
<h2>5. Saving the LDAP attributes<br>
|
<h2>5. Saving the LDAP attributes<br>
|
||||||
</h2>
|
</h2>
|
||||||
In most cases you will not have to implement this option if you use <span
|
In most cases you will not have to implement this option if you use <span style="font-weight: bold;">$this->attributes</span> and <span style="font-weight: bold;">$this->orig</span> to manage the LDAP
|
||||||
style="font-weight: bold;">$this->attributes</span> and <span
|
|
||||||
style="font-weight: bold;">$this->orig</span> to manage the LDAP
|
|
||||||
attributes. The <span style="font-style: italic;">baseModule</span>
|
attributes. The <span style="font-style: italic;">baseModule</span>
|
||||||
will generate the save comands for you.<br>
|
will generate the save comands for you.<br>
|
||||||
<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>
|
changes have to be made.<br>
|
||||||
This is done in the function <span style="font-weight: bold;">save_attributes()</span>.<br>
|
This is done in the function <span style="font-weight: bold;">save_attributes()</span>.<br>
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
|
||||||
style="font-weight: bold; text-decoration: underline;">
|
|
||||||
<br>
|
<br>
|
||||||
The <span style="font-style: italic;">kolabUser</span> module uses
|
The <span style="font-style: italic;">kolabUser</span> module uses
|
||||||
this function to make sure that its object class is saved. Other
|
this function to make sure that its object class is saved. Other
|
||||||
modules (e.g. quota) use it build the lamdaemon commands.<br>
|
modules (e.g. quota) use it build the lamdaemon commands.<br>
|
||||||
<br>
|
<br>
|
||||||
<table style="width: 100%; text-align: left;" class="mod-code"
|
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
|
||||||
border="0" cellpadding="2" cellspacing="2">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;"> /**<br>
|
<td style="vertical-align: top;"> /**<br>
|
||||||
|
@ -402,5 +374,4 @@ $this->attributes['objectClass'][] = 'kolabInetOrgPerson';<br>
|
||||||
<h2><span style="font-weight: bold;"></span></h2>
|
<h2><span style="font-weight: bold;"></span></h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body></html>
|
||||||
</html>
|
|
|
@ -877,13 +877,10 @@ class accountContainer {
|
||||||
// change to next page
|
// change to next page
|
||||||
$errorsOccured = false;
|
$errorsOccured = false;
|
||||||
if (is_array($result)) { // messages were returned, check for errors
|
if (is_array($result)) { // messages were returned, check for errors
|
||||||
$errorKeys = array_keys($result);
|
for ($i = 0; $i < sizeof($result); $i++) {
|
||||||
for ($i = 0; $i < sizeof($errorKeys); $i++) {
|
if ($result[$i][0] == 'ERROR') {
|
||||||
for ($m = 0; $m < sizeof($result[$errorKeys[$i]]); $m++) {
|
$errorsOccured = true;
|
||||||
if ($result[$errorKeys[$i]][$m][0] == 'ERROR') {
|
break;
|
||||||
$errorsOccured = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -932,12 +929,8 @@ class accountContainer {
|
||||||
echo "<form enctype=\"multipart/form-data\" action=\"edit.php\" method=\"post\">\n";
|
echo "<form enctype=\"multipart/form-data\" action=\"edit.php\" method=\"post\">\n";
|
||||||
// Display error-messages
|
// Display error-messages
|
||||||
if (is_array($result)) {
|
if (is_array($result)) {
|
||||||
foreach ($result as $result2) {
|
for ($i=0; $i<sizeof($result); $i++) {
|
||||||
if (is_array($result2)) {
|
call_user_func_array("StatusMessage", $result[$i]);
|
||||||
for ($i=0; $i<sizeof($result2); $i++) {
|
|
||||||
call_user_func_array("StatusMessage", $result2[$i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isset($stopProcessing) && ($stopProcessing == true)) {
|
if (isset($stopProcessing) && ($stopProcessing == true)) {
|
||||||
echo "</body>\n";
|
echo "</body>\n";
|
||||||
|
@ -1130,7 +1123,9 @@ class accountContainer {
|
||||||
for ($j=0; $j<count($attributes[$attr_names[$i]]); $j++) {
|
for ($j=0; $j<count($attributes[$attr_names[$i]]); $j++) {
|
||||||
if (is_array($orig[$attr_names[$i]])) {
|
if (is_array($orig[$attr_names[$i]])) {
|
||||||
if (!in_array($attributes[$attr_names[$i]][$j], $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];
|
else if ($attributes[$attr_names[$i]][$j]!='') $toadd[$attr_names[$i]][] = $attributes[$attr_names[$i]][$j];
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,8 +179,8 @@ class account extends baseModule {
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
if (!in_array('posixAccount', $modules)) {
|
if (!in_array('posixAccount', $modules)) {
|
||||||
$this->attributes['uid'][0] = $_POST['uid'];
|
$this->attributes['uid'][0] = $_POST['uid'];
|
||||||
if (!get_preg($this->attributes['uid'][0], '!upper')) $errors['uid'][] = $this->messages['uid'][2];
|
if (!get_preg($this->attributes['uid'][0], '!upper')) $errors[] = $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], 'username')) $errors[] = $this->messages['uid'][3];
|
||||||
}
|
}
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ class ieee802Device extends baseModule {
|
||||||
if (!get_preg($_POST['macAddress' . $i], 'macAddress')) {
|
if (!get_preg($_POST['macAddress' . $i], 'macAddress')) {
|
||||||
$message = $this->messages['mac'][0];
|
$message = $this->messages['mac'][0];
|
||||||
$message[] = $_POST['macAddress' . $i];
|
$message[] = $_POST['macAddress' . $i];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
$this->attributes['macAddress'][] = $_POST['macAddress' . $i];
|
$this->attributes['macAddress'][] = $_POST['macAddress' . $i];
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ class ieee802Device extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['mac'][0];
|
$message = $this->messages['mac'][0];
|
||||||
$message[] = $_POST['macAddress'];
|
$message[] = $_POST['macAddress'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->attributes['macAddress'] = array_unique($this->attributes['macAddress']);
|
$this->attributes['macAddress'] = array_unique($this->attributes['macAddress']);
|
||||||
|
|
|
@ -184,7 +184,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['routingAdr'][0];
|
$message = $this->messages['routingAdr'][0];
|
||||||
$message[] = $_POST['routingAdr'];
|
$message[] = $_POST['routingAdr'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check mail server
|
// check mail server
|
||||||
|
@ -196,7 +196,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['host'][0];
|
$message = $this->messages['host'][0];
|
||||||
$message[] = $_POST['host'];
|
$message[] = $_POST['host'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check old local addresses
|
// check old local addresses
|
||||||
|
@ -208,7 +208,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
if (!get_preg($_POST['localAdr' . $i], 'mailLocalAddress')) {
|
if (!get_preg($_POST['localAdr' . $i], 'mailLocalAddress')) {
|
||||||
$message = $this->messages['localAdr'][0];
|
$message = $this->messages['localAdr'][0];
|
||||||
$message[] = $_POST['localAdr' . $i];
|
$message[] = $_POST['localAdr' . $i];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
$this->attributes['mailLocalAddress'][] = $_POST['localAdr' . $i];
|
$this->attributes['mailLocalAddress'][] = $_POST['localAdr' . $i];
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
for ($i = 0; $i < sizeof($keys); $i++) {
|
for ($i = 0; $i < sizeof($keys); $i++) {
|
||||||
$adrList = $data[$keys[$i]];
|
$adrList = $data[$keys[$i]];
|
||||||
if (in_array_ignore_case($_POST['localAdr'], $adrList)) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ class inetLocalMailRecipient extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['localAdr'][0];
|
$message = $this->messages['localAdr'][0];
|
||||||
$message[] = $_POST['localAdr'];
|
$message[] = $_POST['localAdr'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->attributes['mailLocalAddress'] = array_unique($this->attributes['mailLocalAddress']);
|
$this->attributes['mailLocalAddress'] = array_unique($this->attributes['mailLocalAddress']);
|
||||||
|
|
|
@ -472,7 +472,7 @@ class inetOrgPerson extends baseModule {
|
||||||
if (!in_array('posixAccount', $modules)) {
|
if (!in_array('posixAccount', $modules)) {
|
||||||
// uid
|
// uid
|
||||||
if (!get_preg($_POST['userName'], 'username')) {
|
if (!get_preg($_POST['userName'], 'username')) {
|
||||||
$errors['uid'][] = $this->messages['uid'][0];
|
$errors[] = $this->messages['uid'][0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['uid'][0] = $_POST['userName'];
|
$this->attributes['uid'][0] = $_POST['userName'];
|
||||||
|
@ -490,7 +490,7 @@ class inetOrgPerson extends baseModule {
|
||||||
$this->attributes['cn'][0] = $_POST['cn'];
|
$this->attributes['cn'][0] = $_POST['cn'];
|
||||||
}
|
}
|
||||||
if (!get_preg($this->attributes['cn'][0], '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) {
|
if ($_SESSION['ldap']->supports_unix_hosts) {
|
||||||
$host = $_POST['host'];
|
$host = $_POST['host'];
|
||||||
if (!get_preg($host,'unixhost')) {
|
if (!get_preg($host,'unixhost')) {
|
||||||
$errors['host'][] = $this->messages['host'][0];
|
$errors[] = $this->messages['host'][0];
|
||||||
}
|
}
|
||||||
$hosts = explode(",", $host);
|
$hosts = explode(",", $host);
|
||||||
$this->attributes['host'] = array();
|
$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
|
// 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 (($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['sn'][] = $this->messages['lastname'][0];
|
if ( !get_preg($this->attributes['sn'][0], 'realname')) $errors[] = $this->messages['lastname'][0];
|
||||||
if ( !get_preg($this->attributes['telephoneNumber'][0], 'telephone')) $errors['telephoneNumber'][] = $this->messages['telephoneNumber'][0];
|
if ( !get_preg($this->attributes['telephoneNumber'][0], 'telephone')) $errors[] = $this->messages['telephoneNumber'][0];
|
||||||
if ( !get_preg($this->attributes['mobile'][0], 'telephone')) $errors['mobileTelephoneNumber'][] = $this->messages['mobileTelephone'][0];
|
if ( !get_preg($this->attributes['mobile'][0], 'telephone')) $errors[] = $this->messages['mobileTelephone'][0];
|
||||||
if ( !get_preg($this->attributes['facsimileTelephoneNumber'][0], 'telephone')) $errors['facsimileTelephoneNumber'][] = $this->messages['facsimileNumber'][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['mail'][] = $this->messages['email'][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['street'][] = $this->messages['street'][0];
|
if ( !get_preg($this->attributes['street'][0], 'street')) $errors[] = $this->messages['street'][0];
|
||||||
if ( !get_preg($this->attributes['postalAddress'][0], 'postalAddress')) $errors['postalAdress'][] = $this->messages['postalAddress'][0];
|
if ( !get_preg($this->attributes['postalAddress'][0], 'postalAddress')) $errors[] = $this->messages['postalAddress'][0];
|
||||||
if ( !get_preg($this->attributes['postalCode'][0], 'postalCode')) $errors['personal_postalCode'][] = $this->messages['postalCode'][0];
|
if ( !get_preg($this->attributes['postalCode'][0], 'postalCode')) $errors[] = $this->messages['postalCode'][0];
|
||||||
if ( !get_preg($this->attributes['title'][0], 'title')) $errors['title'][] = $this->messages['title'][0];
|
if ( !get_preg($this->attributes['title'][0], 'title')) $errors[] = $this->messages['title'][0];
|
||||||
if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors['employeeType'][] = $this->messages['employeeType'][0];
|
if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors[] = $this->messages['employeeType'][0];
|
||||||
if ($_POST['userPassword']) {
|
if ($_POST['userPassword']) {
|
||||||
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
||||||
$errors['userPassword'][] = $this->messages['userPassword'][0];
|
$errors[] = $this->messages['userPassword'][0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!get_preg($_POST['userPassword'], 'password')) {
|
if (!get_preg($_POST['userPassword'], 'password')) {
|
||||||
$errors['userPassword'][] = $this->messages['userPassword'][1];
|
$errors[] = $this->messages['userPassword'][1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||||
|
|
|
@ -421,13 +421,13 @@ class kolabUser extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['country'][0];
|
$message = $this->messages['country'][0];
|
||||||
$message[] = $_POST['country'];
|
$message[] = $_POST['country'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// mailbox server
|
// mailbox server
|
||||||
if (isset($_POST['homeServer'])) {
|
if (isset($_POST['homeServer'])) {
|
||||||
if ($_POST['homeServer'] == "") {
|
if ($_POST['homeServer'] == "") {
|
||||||
$errors[] = array($this->messages['homeServer'][2]);
|
$errors[] = $this->messages['homeServer'][2];
|
||||||
}
|
}
|
||||||
elseif (get_preg($_POST['homeServer'], 'DNSname')) {
|
elseif (get_preg($_POST['homeServer'], 'DNSname')) {
|
||||||
$this->attributes['kolabHomeServer'][0] = $_POST['homeServer'];
|
$this->attributes['kolabHomeServer'][0] = $_POST['homeServer'];
|
||||||
|
@ -435,7 +435,7 @@ class kolabUser extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['homeServer'][0];
|
$message = $this->messages['homeServer'][0];
|
||||||
$message[] = $_POST['homeServer'];
|
$message[] = $_POST['homeServer'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check old invitation policies
|
// check old invitation policies
|
||||||
|
@ -453,7 +453,7 @@ class kolabUser extends baseModule {
|
||||||
if (!get_preg($_POST['invPol1' . $i], 'email')) {
|
if (!get_preg($_POST['invPol1' . $i], 'email')) {
|
||||||
$message = $this->messages['invPol'][0];
|
$message = $this->messages['invPol'][0];
|
||||||
$message[] = $_POST['invPol1' . $i];
|
$message[] = $_POST['invPol1' . $i];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1' . $i] . ':' . $policies[$_POST['invPol2' . $i]];
|
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1' . $i] . ':' . $policies[$_POST['invPol2' . $i]];
|
||||||
|
@ -467,7 +467,7 @@ class kolabUser extends baseModule {
|
||||||
if (!get_preg($_POST['invPol1'], 'email')) {
|
if (!get_preg($_POST['invPol1'], 'email')) {
|
||||||
$message = $this->messages['invPol'][0];
|
$message = $this->messages['invPol'][0];
|
||||||
$message[] = $_POST['invPol1'];
|
$message[] = $_POST['invPol1'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1'] . ':' . $policies[$_POST['invPol2']];
|
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1'] . ':' . $policies[$_POST['invPol2']];
|
||||||
|
@ -490,7 +490,7 @@ class kolabUser extends baseModule {
|
||||||
if (!get_preg($_POST['alias' . $i], 'email')) {
|
if (!get_preg($_POST['alias' . $i], 'email')) {
|
||||||
$message = $this->messages['alias'][0];
|
$message = $this->messages['alias'][0];
|
||||||
$message[] = $_POST['alias' . $i];
|
$message[] = $_POST['alias' . $i];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
$this->attributes['alias'][] = $_POST['alias' . $i];
|
$this->attributes['alias'][] = $_POST['alias' . $i];
|
||||||
}
|
}
|
||||||
|
@ -502,7 +502,7 @@ class kolabUser extends baseModule {
|
||||||
if (!get_preg($_POST['alias'], 'email')) {
|
if (!get_preg($_POST['alias'], 'email')) {
|
||||||
$message = $this->messages['alias'][0];
|
$message = $this->messages['alias'][0];
|
||||||
$message[] = $_POST['alias'];
|
$message[] = $_POST['alias'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['alias'][] = $_POST['alias'];
|
$this->attributes['alias'][] = $_POST['alias'];
|
||||||
|
@ -533,7 +533,7 @@ class kolabUser extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['freeBusy'][0];
|
$message = $this->messages['freeBusy'][0];
|
||||||
$message[] = $_POST['freeBusy'];
|
$message[] = $_POST['freeBusy'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cyrus mail quota
|
// Cyrus mail quota
|
||||||
|
@ -544,7 +544,7 @@ class kolabUser extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['quota'][0];
|
$message = $this->messages['quota'][0];
|
||||||
$message[] = $_POST['quota'];
|
$message[] = $_POST['quota'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $errors;
|
return $errors;
|
||||||
|
|
|
@ -168,7 +168,7 @@ class nisMailAlias extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['alias'][0];
|
$message = $this->messages['alias'][0];
|
||||||
$message[] = $_POST['cn'];
|
$message[] = $_POST['cn'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
// check old recipients
|
// check old recipients
|
||||||
if (isset($_POST['rec_number'])) {
|
if (isset($_POST['rec_number'])) {
|
||||||
|
@ -179,7 +179,7 @@ class nisMailAlias extends baseModule {
|
||||||
if (!get_preg($_POST['rfc822MailMember' . $i], 'nis_recipient')) {
|
if (!get_preg($_POST['rfc822MailMember' . $i], 'nis_recipient')) {
|
||||||
$message = $this->messages['recipient'][0];
|
$message = $this->messages['recipient'][0];
|
||||||
$message[] = $_POST['rfc822MailMember' . $i];
|
$message[] = $_POST['rfc822MailMember' . $i];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
$this->attributes['rfc822MailMember'][] = $_POST['rfc822MailMember' . $i];
|
$this->attributes['rfc822MailMember'][] = $_POST['rfc822MailMember' . $i];
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ class nisMailAlias extends baseModule {
|
||||||
else {
|
else {
|
||||||
$message = $this->messages['recipient'][0];
|
$message = $this->messages['recipient'][0];
|
||||||
$message[] = $_POST['rfc822MailMember'];
|
$message[] = $_POST['rfc822MailMember'];
|
||||||
$errors[] = array($message);
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->attributes['rfc822MailMember'] = array_unique($this->attributes['rfc822MailMember']);
|
$this->attributes['rfc822MailMember'] = array_unique($this->attributes['rfc822MailMember']);
|
||||||
|
|
|
@ -581,21 +581,21 @@ class posixAccount extends baseModule {
|
||||||
if (isset($_POST['createhomedir'])) $this->createhomedir = true;
|
if (isset($_POST['createhomedir'])) $this->createhomedir = true;
|
||||||
else $this->createhomedir = false;
|
else $this->createhomedir = false;
|
||||||
if ($this->orig['uid'][0]!='' && $_POST['uid']!=$this->attributes['uid'][0])
|
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]) {
|
if ($this->orig['gidNumber'][0]!='' && $_SESSION['cache']->getgid($_POST['gidNumber'])!=$this->attributes['gidNumber'][0]) {
|
||||||
$errorMessage = $this->messages['gidNumber'][2];
|
$errorMessage = $this->messages['gidNumber'][2];
|
||||||
$errorMessage[] = array($this->orig['gidNumber'][0], $this->orig['uidNumber'][0], $_POST['gidNumber']);
|
$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]) {
|
if ($this->orig['uidNumber'][0]!='' && $_POST['uidNumber']!=$this->attributes['uidNumber'][0]) {
|
||||||
$errorMessage = $this->messages['uidNumber'][5];
|
$errorMessage = $this->messages['uidNumber'][5];
|
||||||
$errorMessage[] = array($this->orig['uidNumber'][0], $_POST['uidNumber']);
|
$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]) {
|
if (isset($_POST['homeDirectory']) && $this->orig['homeDirectory'][0]!='' && $_POST['homeDirectory']!=$this->attributes['homeDirectory'][0]) {
|
||||||
$errorMessage = $this->messages['homeDirectory'][3];
|
$errorMessage = $this->messages['homeDirectory'][3];
|
||||||
$errorMessage[] = array($this->orig['homeDirectory'][0], $_POST['homeDirectory']);
|
$errorMessage[] = array($this->orig['homeDirectory'][0], $_POST['homeDirectory']);
|
||||||
$errors['homeDirectory'][] = $errorMessage;
|
$errors[] = $errorMessage;
|
||||||
}
|
}
|
||||||
$this->attributes['homeDirectory'][0] = $_POST['homeDirectory'];
|
$this->attributes['homeDirectory'][0] = $_POST['homeDirectory'];
|
||||||
// Load attributes
|
// Load attributes
|
||||||
|
@ -621,7 +621,7 @@ class posixAccount extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!get_preg($this->attributes['cn'][0], 'cn')) {
|
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['uidNumber'][0] = $_POST['uidNumber'];
|
||||||
$this->attributes['gidNumber'][0] = $_SESSION['cache']->getgid($_POST['gidNumber']);
|
$this->attributes['gidNumber'][0] = $_SESSION['cache']->getgid($_POST['gidNumber']);
|
||||||
|
@ -650,7 +650,7 @@ class posixAccount extends baseModule {
|
||||||
$this->attributes['uidNumber'][0] = $newUID[0];
|
$this->attributes['uidNumber'][0] = $newUID[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$errors['uidNumber'][] = $this->messages['uidNumber'][3];
|
$errors[] = $this->messages['uidNumber'][3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else $this->attributes['uidNumber'][0] = $this->orig['uidNumber'][0];
|
else $this->attributes['uidNumber'][0] = $this->orig['uidNumber'][0];
|
||||||
|
@ -659,27 +659,27 @@ class posixAccount extends baseModule {
|
||||||
else {
|
else {
|
||||||
// Check manual ID
|
// Check manual ID
|
||||||
// id-number is out of valid range
|
// 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
|
// $uids is allways an array but not if no entries were found
|
||||||
if (is_array($uids)) {
|
if (is_array($uids)) {
|
||||||
// id-number is in use and account is a new account
|
// 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
|
// 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]) ) {
|
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];
|
$this->attributes['uidNumber'][0] = $this->orig['uidNumber'][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($_SESSION[$this->base]->type=='user') {
|
if ($_SESSION[$this->base]->type=='user') {
|
||||||
if (($this->attributes['uid'][0] != $_POST['uid']) && !get_preg($_POST['uid'], '!upper'))
|
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' ))
|
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'])) {
|
if (isset($_POST['userPassword_lock']) && isset($_POST['userPassword_nopassword'])) {
|
||||||
// found invalid password parameter combination
|
// found invalid password parameter combination
|
||||||
$errors['userPassword'][] = $this->messages['userPassword'][3];
|
$errors[] = $this->messages['userPassword'][3];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (isset($_POST['userPassword_nopassword'])) {
|
if (isset($_POST['userPassword_nopassword'])) {
|
||||||
|
@ -695,10 +695,10 @@ class posixAccount extends baseModule {
|
||||||
if (isset($_POST['genpass'])) $this->attributes['userPassword'][0] = genpasswd();
|
if (isset($_POST['genpass'])) $this->attributes['userPassword'][0] = genpasswd();
|
||||||
elseif ($_SESSION[$this->base]->isNewAccount) {
|
elseif ($_SESSION[$this->base]->isNewAccount) {
|
||||||
if ($_POST['userPassword'] != $_POST['userPassword2'])
|
if ($_POST['userPassword'] != $_POST['userPassword2'])
|
||||||
$errors['userPassword'][] = $this->messages['userPassword'][0];
|
$errors[] = $this->messages['userPassword'][0];
|
||||||
else $this->attributes['userPassword'][0] = $_POST['userPassword'];
|
else $this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||||
if (!get_preg($this->attributes['userPassword'][0], 'password'))
|
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;
|
if (isset($_POST['userPassword_lock'])) $this->userPassword_lock=true;
|
||||||
else $this->userPassword_lock=false;
|
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]);
|
$this->attributes['homeDirectory'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]), $this->attributes['homeDirectory'][0]);
|
||||||
if ($this->attributes['uid'][0] != '')
|
if ($this->attributes['uid'][0] != '')
|
||||||
$this->attributes['homeDirectory'][0] = str_replace('$user', $this->attributes['uid'][0], $this->attributes['homeDirectory'][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
|
// Check if Username contains only valid characters
|
||||||
if ( !get_preg($this->attributes['uid'][0], 'username'))
|
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') {
|
if ($_SESSION[$this->base]->type=='host') {
|
||||||
// add "$" to uid if needed
|
// add "$" to uid if needed
|
||||||
|
@ -720,7 +720,7 @@ class posixAccount extends baseModule {
|
||||||
}
|
}
|
||||||
// Check if Hostname contains only valid characters
|
// Check if Hostname contains only valid characters
|
||||||
if ( !get_preg($this->attributes['uid'][0], 'hostname'))
|
if ( !get_preg($this->attributes['uid'][0], 'hostname'))
|
||||||
$errors['uid'][] = $this->messages['uid'][4];
|
$errors[] = $this->messages['uid'][4];
|
||||||
if (!$this->attributes['homeDirectory'][0]) {
|
if (!$this->attributes['homeDirectory'][0]) {
|
||||||
$this->attributes['homeDirectory'][0] = '/dev/null';
|
$this->attributes['homeDirectory'][0] = '/dev/null';
|
||||||
}
|
}
|
||||||
|
@ -769,11 +769,11 @@ class posixAccount extends baseModule {
|
||||||
}
|
}
|
||||||
// Show warning if lam has changed username
|
// Show warning if lam has changed username
|
||||||
if ($this->attributes['uid'][0] != $_POST['uid']) {
|
if ($this->attributes['uid'][0] != $_POST['uid']) {
|
||||||
if ($_SESSION[$this->base]->type=='user') $errors['uid'][] = $this->messages['uid'][5];
|
if ($_SESSION[$this->base]->type=='user') $errors[] = $this->messages['uid'][5];
|
||||||
if ($_SESSION[$this->base]->type=='host') $errors['uid'][] = $this->messages['uid'][6];
|
if ($_SESSION[$this->base]->type=='host') $errors[] = $this->messages['uid'][6];
|
||||||
}
|
}
|
||||||
if ($_SESSION[$this->base]->isNewAccount && !get_preg($this->attributes['userPassword'][0], 'password'))
|
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');
|
$attributeList = array('gecos', 'homeDirectory');
|
||||||
for ($i = 0; $i < sizeof($attributeList); $i++) {
|
for ($i = 0; $i < sizeof($attributeList); $i++) {
|
||||||
|
@ -782,7 +782,7 @@ class posixAccount extends baseModule {
|
||||||
$replacedValue = $this->checkASCII($value);
|
$replacedValue = $this->checkASCII($value);
|
||||||
if ($value != $replacedValue) {
|
if ($value != $replacedValue) {
|
||||||
$this->attributes[$attributeList[$i]][0] = $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
|
elseif (isset($_POST['removegroups']) && isset($_POST['removegroups_button'])) { // remove groups from list
|
||||||
$this->groups = array_delete($_POST['removegroups'], $this->groups);
|
$this->groups = array_delete($_POST['removegroups'], $this->groups);
|
||||||
}
|
}
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -839,13 +840,13 @@ class posixAccount extends baseModule {
|
||||||
*/
|
*/
|
||||||
function process_password() {
|
function process_password() {
|
||||||
if ($_POST['form_subpage_posixAccount_attributes_back']) return array();
|
if ($_POST['form_subpage_posixAccount_attributes_back']) return array();
|
||||||
$messages = array();
|
$errors = array();
|
||||||
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
||||||
$messages['userPassword'][] = $this->messages['userPassword'][0];
|
$errors[] = $this->messages['userPassword'][0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!get_preg($_POST['userPassword'], 'password')) {
|
if (!get_preg($_POST['userPassword'], 'password')) {
|
||||||
$messages['userPassword'][] = $this->messages['userPassword'][1];
|
$errors[] = $this->messages['userPassword'][1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||||
|
@ -853,7 +854,7 @@ class posixAccount extends baseModule {
|
||||||
$this->userPassword_nopassword = false;
|
$this->userPassword_nopassword = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $messages;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function will create the html-page
|
/* This function will create the html-page
|
||||||
|
@ -1567,7 +1568,7 @@ class posixAccount extends baseModule {
|
||||||
sort ($uids, SORT_NUMERIC);
|
sort ($uids, SORT_NUMERIC);
|
||||||
}
|
}
|
||||||
// show warning message
|
// show warning message
|
||||||
$errors['uidNumber'][] = $this->messages['uidNumber'][2];
|
$errors[] = $this->messages['uidNumber'][2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -545,7 +545,7 @@ class posixGroup extends baseModule {
|
||||||
|
|
||||||
if ($_POST['userPassword_lock'] && $_POST['userPassword_nopassword']) {
|
if ($_POST['userPassword_lock'] && $_POST['userPassword_nopassword']) {
|
||||||
// found invalid password parameter combination
|
// found invalid password parameter combination
|
||||||
$errors['userPassword'][] = $this->messages['userPassword'][3];
|
$errors[] = $this->messages['userPassword'][3];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($_POST['userPassword_nopassword']) {
|
if ($_POST['userPassword_nopassword']) {
|
||||||
|
@ -561,10 +561,10 @@ class posixGroup extends baseModule {
|
||||||
if ($_POST['genpass']) $this->attributes['userPassword'][0] = genpasswd();
|
if ($_POST['genpass']) $this->attributes['userPassword'][0] = genpasswd();
|
||||||
elseif ($_SESSION[$this->base]->isNewAccount) {
|
elseif ($_SESSION[$this->base]->isNewAccount) {
|
||||||
if ($_POST['userPassword'] != $_POST['userPassword2'])
|
if ($_POST['userPassword'] != $_POST['userPassword2'])
|
||||||
$errors['userPassword'][] = $this->messages['userPassword'][0];
|
$errors[] = $this->messages['userPassword'][0];
|
||||||
else $this->attributes['userPassword'][0] = $_POST['userPassword'];
|
else $this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||||
if (!get_preg($this->attributes['userPassword'][0], 'password'))
|
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;
|
if ($_POST['userPassword_lock']) $this->userPassword_lock=true;
|
||||||
else $this->userPassword_lock=false;
|
else $this->userPassword_lock=false;
|
||||||
|
@ -592,7 +592,7 @@ class posixGroup extends baseModule {
|
||||||
$this->attributes['gidNumber'][0] = $newGID[0];
|
$this->attributes['gidNumber'][0] = $newGID[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$errors['gidNumber'][] = $this->messages['gidNumber'][3];
|
$errors[] = $this->messages['gidNumber'][3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else $this->attributes['gidNumber'][0] = $this->orig['gidNumber'][0];
|
else $this->attributes['gidNumber'][0] = $this->orig['gidNumber'][0];
|
||||||
|
@ -602,7 +602,7 @@ class posixGroup extends baseModule {
|
||||||
// Check manual ID
|
// Check manual ID
|
||||||
// id-number is out of valid range
|
// id-number is out of valid range
|
||||||
if (($this->attributes['gidNumber'][0] < $minID) || ($this->attributes['gidNumber'][0] > $maxID) || !is_numeric($this->attributes['gidNumber'][0])) {
|
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];
|
if (isset($this->orig['gidNumber'][0])) $this->attributes['gidNumber'][0] = $this->orig['gidNumber'][0];
|
||||||
else unset($this->attributes['gidNumber'][0]);
|
else unset($this->attributes['gidNumber'][0]);
|
||||||
}
|
}
|
||||||
|
@ -610,12 +610,12 @@ class posixGroup extends baseModule {
|
||||||
if (is_array($gids)) {
|
if (is_array($gids)) {
|
||||||
// id-number is in use and account is a new account
|
// id-number is in use and account is a new account
|
||||||
if ((in_array($this->attributes['gidNumber'][0], $gids)) && $this->orig['gidNumber'][0]=='') {
|
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]);
|
unset($this->attributes['gidNumber'][0]);
|
||||||
}
|
}
|
||||||
// id-number is in use, account is existing account and id-number is not used by itself
|
// 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]) ) {
|
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];
|
$this->attributes['gidNumber'][0] = $this->orig['gidNumber'][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,10 +624,10 @@ class posixGroup extends baseModule {
|
||||||
if ($this->attributes['cn'][0]!=$_POST['cn']) {
|
if ($this->attributes['cn'][0]!=$_POST['cn']) {
|
||||||
$this->attributes['cn'][0] = $_POST['cn'];
|
$this->attributes['cn'][0] = $_POST['cn'];
|
||||||
if (($this->attributes['cn'][0] != $_POST['cn']) && ereg('[A-Z]$', $_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
|
// Check if Groupname contains only valid characters
|
||||||
if ( !get_preg($this->attributes['cn'][0],'groupname'))
|
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
|
// Create automatic useraccount with number if original user already exists
|
||||||
// Reset name to original name if new name is in use
|
// Reset name to original name if new name is in use
|
||||||
// Set username back to original name if new username 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
|
// Show warning if lam has changed username
|
||||||
if ($this->attributes['cn'][0] != $_POST['cn']) {
|
if ($this->attributes['cn'][0] != $_POST['cn']) {
|
||||||
$errors['cn'][] = $this->messages['cn'][0];
|
$errors[] = $this->messages['cn'][0];
|
||||||
}
|
}
|
||||||
// show info when gidnumber has changed
|
// 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]) {
|
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
|
// Return error-messages
|
||||||
|
@ -694,6 +694,7 @@ class posixGroup extends baseModule {
|
||||||
elseif (isset($_POST['removeusers']) && isset($_POST['removeusers_button'])) { // remove users from list
|
elseif (isset($_POST['removeusers']) && isset($_POST['removeusers_button'])) { // remove users from list
|
||||||
$this->attributes['memberUid'] = array_delete($_POST['removeusers'], $this->attributes['memberUid']);
|
$this->attributes['memberUid'] = array_delete($_POST['removeusers'], $this->attributes['memberUid']);
|
||||||
}
|
}
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -705,18 +706,18 @@ class posixGroup extends baseModule {
|
||||||
*/
|
*/
|
||||||
function process_password() {
|
function process_password() {
|
||||||
if ($_POST['form_subpage_posixGroup_attributes_back']) return array();
|
if ($_POST['form_subpage_posixGroup_attributes_back']) return array();
|
||||||
$messages = array();
|
$errors = array();
|
||||||
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
if ($_POST['userPassword'] != $_POST['userPassword2']) {
|
||||||
$messages['userPassword'][] = $this->messages['userPassword'][0];
|
$errors[] = $this->messages['userPassword'][0];
|
||||||
if (!get_preg($_POST['userPassword'], 'password'))
|
if (!get_preg($_POST['userPassword'], 'password'))
|
||||||
$messages['userPassword'][] = $this->messages['userPassword'][1];
|
$errors[] = $this->messages['userPassword'][1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
$this->attributes['userPassword'][0] = $_POST['userPassword'];
|
||||||
$this->userPassword_lock = false;
|
$this->userPassword_lock = false;
|
||||||
$this->userPassword_nopassword = false;
|
$this->userPassword_nopassword = false;
|
||||||
}
|
}
|
||||||
return $messages;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -860,7 +861,7 @@ class posixGroup extends baseModule {
|
||||||
sort ($gids, SORT_NUMERIC);
|
sort ($gids, SORT_NUMERIC);
|
||||||
}
|
}
|
||||||
// show warning message
|
// show warning message
|
||||||
$errors['gidNumber'][] = $this->messages['gidNumber'][2];
|
$errors[] = $this->messages['gidNumber'][2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -274,17 +274,17 @@ class quota extends baseModule {
|
||||||
$this->quota[$i][7] = $_POST[$i . '_7'];
|
$this->quota[$i][7] = $_POST[$i . '_7'];
|
||||||
// Check if values are OK and set automatic values. if not error-variable will be set
|
// Check if values are OK and set automatic values. if not error-variable will be set
|
||||||
if (!get_preg($this->quota[$i][2], 'digit'))
|
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'))
|
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'))
|
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'))
|
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]))
|
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]))
|
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++;
|
$i++;
|
||||||
}
|
}
|
||||||
return $errors;
|
return $errors;
|
||||||
|
|
|
@ -540,7 +540,7 @@ class sambaAccount extends baseModule {
|
||||||
// display name
|
// display name
|
||||||
$this->attributes['displayName'][0] = $_POST['displayName'];
|
$this->attributes['displayName'][0] = $_POST['displayName'];
|
||||||
if (!($this->attributes['displayName'][0] == '') && !(get_preg($this->attributes['displayName'][0], 'realname'))) {
|
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
|
// host attributes
|
||||||
|
@ -587,11 +587,11 @@ class sambaAccount extends baseModule {
|
||||||
else $this->useunixpwd = false;
|
else $this->useunixpwd = false;
|
||||||
if (!$this->useunixpwd && isset($_POST['lmPassword']) && ($_POST['lmPassword'] != '')) {
|
if (!$this->useunixpwd && isset($_POST['lmPassword']) && ($_POST['lmPassword'] != '')) {
|
||||||
if ($_POST['lmPassword'] != $_POST['lmPassword2']) {
|
if ($_POST['lmPassword'] != $_POST['lmPassword2']) {
|
||||||
$errors['lmPassword'][] = $this->messages['lmPassword'][0];
|
$errors[] = $this->messages['lmPassword'][0];
|
||||||
unset ($_POST['lmPassword2']);
|
unset ($_POST['lmPassword2']);
|
||||||
}
|
}
|
||||||
else {
|
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 {
|
else {
|
||||||
$this->attributes['lmPassword'][0] = lmPassword($_POST['lmPassword']);
|
$this->attributes['lmPassword'][0] = lmPassword($_POST['lmPassword']);
|
||||||
$this->attributes['ntPassword'][0] = ntPassword($_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('$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]);
|
$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('$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]);
|
$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('$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]);
|
$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')))
|
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')))
|
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')))
|
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
|
// check values for host account
|
||||||
else {
|
else {
|
||||||
|
@ -634,7 +634,7 @@ class sambaAccount extends baseModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!$this->attributes['domain'][0]=='') && !get_preg($this->attributes['domain'][0], 'domainname'))
|
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;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
@ -686,6 +686,7 @@ class sambaAccount extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function will create the html-page
|
/* This function will create the html-page
|
||||||
|
|
|
@ -487,7 +487,7 @@ class sambaDomain extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($errors);
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -433,7 +433,7 @@ class sambaGroupMapping extends baseModule {
|
||||||
if ($_SESSION['cache']->in_cache($SID."-".$this->rids[$rids[$i]], 'sambaSID', 'group')) {
|
if ($_SESSION['cache']->in_cache($SID."-".$this->rids[$rids[$i]], 'sambaSID', 'group')) {
|
||||||
$message = $this->messages['sambaSID'][0];
|
$message = $this->messages['sambaSID'][0];
|
||||||
$message[] = $rids[$i];
|
$message[] = $rids[$i];
|
||||||
$errors['sambaSID'][] = $message;
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -595,7 +595,7 @@ class sambaSamAccount extends baseModule {
|
||||||
// display name
|
// display name
|
||||||
$this->attributes['displayName'][0] = $_POST['displayName'];
|
$this->attributes['displayName'][0] = $_POST['displayName'];
|
||||||
if (!($this->attributes['displayName'][0] == '') && !(get_preg($this->attributes['displayName'][0], 'realname'))) {
|
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
|
// host attributes
|
||||||
|
@ -659,11 +659,11 @@ class sambaSamAccount extends baseModule {
|
||||||
else $this->useunixpwd = false;
|
else $this->useunixpwd = false;
|
||||||
if (!$this->useunixpwd && isset($_POST['sambaLMPassword']) && ($_POST['sambaLMPassword'] != '')) {
|
if (!$this->useunixpwd && isset($_POST['sambaLMPassword']) && ($_POST['sambaLMPassword'] != '')) {
|
||||||
if ($_POST['sambaLMPassword'] != $_POST['sambaLMPassword2']) {
|
if ($_POST['sambaLMPassword'] != $_POST['sambaLMPassword2']) {
|
||||||
$errors['sambaLMPassword'][] = $this->messages['sambaLMPassword'][0];
|
$errors[] = $this->messages['sambaLMPassword'][0];
|
||||||
unset ($_POST['sambaLMPassword2']);
|
unset ($_POST['sambaLMPassword2']);
|
||||||
}
|
}
|
||||||
else {
|
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 {
|
else {
|
||||||
$this->attributes['sambaLMPassword'][0] = lmPassword($_POST['sambaLMPassword']);
|
$this->attributes['sambaLMPassword'][0] = lmPassword($_POST['sambaLMPassword']);
|
||||||
$this->attributes['sambaNTPassword'][0] = ntPassword($_POST['sambaLMPassword']);
|
$this->attributes['sambaNTPassword'][0] = ntPassword($_POST['sambaLMPassword']);
|
||||||
|
@ -687,20 +687,20 @@ class sambaSamAccount extends baseModule {
|
||||||
// Check values
|
// 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('$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]);
|
$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('$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]);
|
$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('$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]);
|
$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')))
|
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')))
|
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] == '') &&
|
if (!($this->attributes['sambaProfilePath'][0] == '') &&
|
||||||
!(get_preg($this->attributes['sambaProfilePath'][0], 'UNC') xor get_preg($this->attributes['sambaProfilePath'][0], 'homeDirectory')))
|
!(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
|
else { // host
|
||||||
if (!$this->attributes['sambaSID'][0]) {
|
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;
|
$logonHoursNew = $logonHoursNew . $hex;
|
||||||
}
|
}
|
||||||
$this->attributes['sambaLogonHours'][0] = $logonHoursNew;
|
$this->attributes['sambaLogonHours'][0] = $logonHoursNew;
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function will create the html-page
|
/* This function will create the html-page
|
||||||
|
|
|
@ -255,11 +255,11 @@ class shadowAccount extends baseModule {
|
||||||
$this->attributes['shadowInactive'][0] = $_POST['shadowInactive'];
|
$this->attributes['shadowInactive'][0] = $_POST['shadowInactive'];
|
||||||
$this->attributes['shadowExpire'][0] = intval(mktime(0, 0, 0, intval($_POST['shadowExpire_mon']), intval($_POST['shadowExpire_day']),
|
$this->attributes['shadowExpire'][0] = intval(mktime(0, 0, 0, intval($_POST['shadowExpire_mon']), intval($_POST['shadowExpire_day']),
|
||||||
intval($_POST['shadowExpire_yea']))/3600/24);
|
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['shadowMin'][0], 'digit')) $errors[] = $this->messages['shadowMin'][0];
|
||||||
if ( !get_preg($this->attributes['shadowMax'][0], 'digit')) $errors['shadowMax'][] = $this->messages['shadowMax'][0];
|
if ( !get_preg($this->attributes['shadowMax'][0], 'digit')) $errors[] = $this->messages['shadowMax'][0];
|
||||||
if ( $this->attributes['shadowMin'][0] > $this->attributes['shadowMax'][0]) $errors['shadowMin'][] = $this->messages['shadow_cmp'][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['shadowInactive'][] = $this->messages['inactive'][0];
|
if ( !get_preg($this->attributes['shadowInactive'][0], 'digit2')) $errors[] = $this->messages['inactive'][0];
|
||||||
if ( !get_preg($this->attributes['shadowWarning'][0], 'digit')) $errors['shadowWarning'][] = $this->messages['shadowWarning'][0];
|
if ( !get_preg($this->attributes['shadowWarning'][0], 'digit')) $errors[] = $this->messages['shadowWarning'][0];
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue