refactoring
This commit is contained in:
parent
2a10013f36
commit
077556a6a9
|
@ -57,9 +57,10 @@ include_once("html.inc");
|
|||
$modulesINC_dirname = substr(__FILE__, 0, strlen(__FILE__) - 12) . "/modules";
|
||||
$modulesINC_dir = dir($modulesINC_dirname);
|
||||
// get module names.
|
||||
while ($entry = $modulesINC_dir->read())
|
||||
if ((substr($entry, strlen($entry) - 4, 4) == '.inc') && is_file($modulesINC_dirname . '/'.$entry)) {
|
||||
while ($entry = $modulesINC_dir->read()) {
|
||||
if ((substr($entry, strlen($entry) - 4, 4) == '.inc') && is_file($modulesINC_dirname . '/'.$entry)) {
|
||||
include_once($modulesINC_dirname . '/'.$entry);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1183,15 +1183,15 @@ class posixAccount extends baseModule implements passwordService {
|
|||
$errors[] = $error;
|
||||
}
|
||||
}
|
||||
if ($this->get_scope()=='user') {
|
||||
if (($this->get_scope() == 'user') && !get_preg($this->attributes['uid'][0], 'username')) {
|
||||
// Check if Username contains only valid characters
|
||||
if (!get_preg($this->attributes['uid'][0], 'username'))
|
||||
$errors[] = $this->messages['uid'][2];
|
||||
}
|
||||
if ($this->get_scope()=='host') {
|
||||
if ($this->get_scope() == 'host') {
|
||||
// Check if Hostname contains only valid characters
|
||||
if (!get_preg($this->attributes['uid'][0], 'hostname'))
|
||||
if (!get_preg($this->attributes['uid'][0], 'hostname')) {
|
||||
$errors[] = $this->messages['uid'][4];
|
||||
}
|
||||
if (!isset($this->attributes[$homedirAttrName][0])) {
|
||||
$this->attributes[$homedirAttrName][0] = '/dev/null';
|
||||
}
|
||||
|
|
|
@ -924,8 +924,9 @@ class posixGroup extends baseModule implements passwordService {
|
|||
$errors[] = $this->messages['cn'][0];
|
||||
}
|
||||
// Check if Groupname contains only valid characters
|
||||
if ( !get_preg($this->attributes['cn'][0],'groupname'))
|
||||
if (!get_preg($this->attributes['cn'][0],'groupname')) {
|
||||
$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 group name is in use
|
||||
|
@ -933,7 +934,8 @@ class posixGroup extends baseModule implements passwordService {
|
|||
$this->attributes['cn'][0] = $this->orig['cn'][0];
|
||||
}
|
||||
// Change gid to a new gid until a free gid is found
|
||||
else while ($this->groupNameExists($this->attributes['cn'][0])) {
|
||||
else {
|
||||
while ($this->groupNameExists($this->attributes['cn'][0])) {
|
||||
// get last character of group name
|
||||
$lastchar = substr($this->attributes['cn'][0], strlen($this->attributes['cn'][0])-1, 1);
|
||||
// Last character is no number
|
||||
|
@ -963,6 +965,7 @@ class posixGroup extends baseModule implements passwordService {
|
|||
$this->attributes['cn'][0] = $firstchars . (intval($lastchars)+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Show warning if lam has changed group name
|
||||
if ($this->attributes['cn'][0] != $_POST['cn']) {
|
||||
$errors[] = $this->messages['cn'][1];
|
||||
|
|
|
@ -42,9 +42,10 @@ include_once("selfService.inc");
|
|||
$typesINC_dirname = substr(__FILE__, 0, strlen(__FILE__) - 10) . "/types";
|
||||
$typesINC_dir = dir($typesINC_dirname);
|
||||
// get module names.
|
||||
while ($entry = $typesINC_dir->read())
|
||||
if ((substr($entry, strlen($entry) - 4, 4) == '.inc') && is_file($typesINC_dirname . '/'.$entry)) {
|
||||
while ($entry = $typesINC_dir->read()) {
|
||||
if ((substr($entry, strlen($entry) - 4, 4) == '.inc') && is_file($typesINC_dirname . '/'.$entry)) {
|
||||
include_once($typesINC_dirname . '/'.$entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue