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