\n";
+ echo $input[$i][$j]['text'] . "\n";
+ break;
+ case 'input':
+ echo " \n";
+ $output = " \n";
+ echo "\n";
+ if ($input[$i][$j]['legend']!='') echo "" . $input[$i][$j]['legend'] . " \n";
+ echo "\n";
+ $this->parse_html($module, $input[$i][$j]['value']);
+ echo "
\n";
+ echo " \n";
+ break;
+ case 'select':
+ echo " \n";
+ echo "\n";
+ // merge both option arrays and sort them.
+ $options = array_merge ($input[$i][$j]['options'], $input[$i][$j]['options_selected'] );
+ $options = array_unique($options);
+ sort($options, SORT_STRING);
+ foreach ($options as $option) {
+ if (in_array($option, $input[$i][$j]['options_selected'])) echo "" . $option . " \n";
+ else echo "" . $option . " \n";
+ }
+ echo " \n";
+ break;
+ case 'table':
+ echo "\n";
+ echo "\n";
+ $this->parse_html($module, $input[$i][$j]['value']);
+ echo "
\n";
+ echo " \n";
+ break;
+ case 'help':
+ echo "\n";
+ echo "" . _('Help') . " \n";
+ break;
+ default:
+ echo "Unrecognized type: " . $input[$i][$j]['kind'] . " \n";
+ break;
+ }
+ }
+ echo "\n";
+ }
+ }
+ }
+
/* Add attributes to variable. Syntax is array( attribute = array ( objectClass1 => MUST|MAX, objectClass2 => MUST|MAY ), ... )
*/
function add_attributes($objectClass) {
@@ -1005,67 +1091,6 @@ class accountContainer {
}
}
-/*
-// This class keeps all needed values for any account
-class account {
- // Type : user | group | host
- var $type;
- // General Settings
- var $general_objectClass; // Array, contains old objectclasses of loaded account
- var $general_username; // string Username, Hostname or Groupname
- var $general_uidNumber; // string UIDNumber(user|host) GIDNumber(group) only natural numbers allowed
- var $general_surname; // string Surname (user)
- var $general_givenname; // string Givenname (user)
- var $general_dn; // string DN
- var $general_group; // string Primary group (user|host)
- var $general_groupadd; // array(string) Addititional Groups (user) is member of
- var $general_homedir; // atring Homedirectoy (user) For host it's hardcoded to/dev/null
- var $general_shell; // array(string) list off all valid shells (user) hosts are hard-wired to /bin/false
- var $general_gecos; // string, gecos-field (user|group|host)
- // Unix Password Settings
- var $unix_memberUid; // array Stores all users which are member of group but is not primary group (group)
- var $unix_password; // string for unix-password (user|host)
- var $unix_password_no; // string (0|1) set unix-password to none (user|host)
- var $unix_pwdwarn; // string number of days a user is warned before password expires (user|host) value must be a natural number (user|host)
- var $unix_pwdallowlogin; // string number of days a user can login even his password has expired (user) muste be a natural number or 0 or -1 (user|host)
- var $unix_pwdmaxage; // string Number of days after a user has to change his password again Value must be 0<. (user|host)
- var $unix_pwdminage; // string Number of days a user has to wait until he\'s allowed to change his password again. Value must be 0<. (user|host)
- var $unix_pwdexpire; // string days since 1.1.1970 the account expires (user|host)
- var $unix_deactivated; // string (1|0) account deactivated? (user|host)
- var $unix_shadowLastChange; // string, contains the days since 1.1.1970 the password has been changed last time (user|host)
- var $unix_host; // list of unix hosts the user is allowed to log in
- // Samba Account
- var $smb_password; // string for samba-password (user|host)
- var $smb_useunixpwd; // string (1|0) use unix-password as samba-password (user|host)
- var $smb_pwdcanchange; // string unix-timestamp user/host is able to change password (user|host)
- var $smb_pwdmustchange; // string unix-timestamp user/host has to change password at next login (user|host)
- var $smb_homedrive; // string Homedrive (C:, D:, ...) (user)
- var $smb_scriptPath; // string ScriptPath (\\server\loginscript) (user)
- var $smb_profilePath; // string profilePAth (\\server\profilepath) (user)
- var $smb_smbuserworkstations; // string comma-separated list of workstations (user)
- var $smb_smbhome; // string Home-Share (\\server\home) (user)
- var $smb_domain; // string Domain of (user|host) or samba3domain-Object
- var $smb_flags; // array of acctFlags, ( {'W'] => 0, ['X'] => 1, ......
- var $smb_mapgroup; // decimal ID for groups
- var $smb_displayName; // string, description, similar to gecos-field.
- // Quota Settins
- var $quota; /* array[][] First array is an index for every chare with active quotas
- * second array Contains values for every share:
- * mountpoint, used blocks, soft block limit, hard block limit, grace block period, used inodes,
- * soft inode limit, hard inode limit, grace inode period
- */
-/* // Personal Settings
- var $personal_title; // string title of user
- var $personal_mail; // string mailaddress of user
- var $personal_telephoneNumber; // string telephonenumber of user
- var $personal_mobileTelephoneNumber; // string mobile umber of user
- var $personal_facsimileTelephoneNumber; // strinf fax-number of user
- var $personal_street; // stirng streetname of user
- var $personal_postalCode; // string postal code of user
- var $personal_postalAddress; // string postal Address of user
- var $personal_employeeType; // string employe type of user
- }
-*/
/* Return a list of all shells listed in ../config/shells
@@ -1173,391 +1198,6 @@ function RndInt($Format){
} // END RndInt() FUNCTION
-/* Whis function will return the quotas from the specified user If empty only filesystems with enabled quotas are returned
-* $users = array of account objects., return-value is an array of account objects
-* if $users is account object return values is also an account object
-* An array with all quota-enabled partitions will be returned in this case all returned values are 0 exept mointpoint[x][0]
-*/
-function getquotas($users) {
- // define new object
- if (is_array($users)) $return = $users;
- else $return[0] = $users;
- // get username and password of the current lam-admin
- $ldap_q = $_SESSION['ldap']->decrypt_login();
- /* $towrite has the following syntax:
- * admin-username, admin-password, account with quotas, 'quota', operation='get', type=user|group
- * use escapeshellarg to make exec() shell-safe
- */
- $towrite = escapeshellarg($_SESSION['config']->scriptServer)." ".escapeshellarg($_SESSION['config']->scriptPath)." ".
- escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]);
- /* scriptServer is the IP to remote-host to which lam should connect via ssh
- * scriptPath is Path to lamdaemon.pl on remote system
- */
- if (is_array($return)) {
- for($i=0; $igeneral_username!='') $userstring .= $return[$i]->general_username." quota get ".$return[$i]->type."\n";
- else $userstring .= "+ quota get ".$return[$i]->type."\n";
- }
- if (function_exists(proc_open)) {
- // New Code, requires PHP 4.3
- $descriptorspec = array(
- 0 => array("pipe", "r"), // stdin
- 1 => array("pipe", "w"), // stout
- 2 => array("file", "/dev/null", "a") // sterr
- );
- $process = proc_open(escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite,
- $descriptorspec,
- $pipes);
- if (is_resource($process)) {
- /* perl-script is running
- * $pipes[0] is writeable handle to child stdin
- * $pipes[1] is readable handle to child stdout
- * any error is send to /dev/null
- */
- // Write one output-line for every user
- fwrite($pipes[0], $userstring);
- fclose($pipes[0]);
- while (!feof($pipes[1])) {
- $output = fgets($pipes[1], 1024);
- if ($output!='') $output_array[] = $output;
- }
- fclose($pipes[1]);
- proc_close($process);
- }
- }
- else { // PHP 4.3>
- $command = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite;
- $pipe = popen("echo \"$userstring\"|$command" , 'r');
- while(!feof($pipe)) {
- //$output .= fread($pipe, 1024);
- $output = fgets($pipe, 1024);
- if ($output!='') $output_array[] = $output;
- }
- pclose($pipe);
- }
- /* $vals is a string which contains a two dimensional array.
- * We have to recreate it with explode
- *
- * $return->quota[][] First array is an index for every chare with active quotas
- * second array Contains values for every share:
- * mountpoint, used blocks, soft block limit, hard block limit, grace block period, used inodes,
- * soft inode limit, hard inode limit, grace inode period
- */
- if (is_array($output_array)) {
- for ($i=0; $iquota[$j][$k] = $single_quota[$k];
- if ($return[$i]->quota[$j][4]quota[$j][4] = '';
- else $return[$i]->quota[$j][4] = strval(intval(($return[$i]->quota[$j][4]-time())/3600)) .' '. _('hours');
- if ($return[$i]->quota[$j][8]quota[$j][8] = '';
- else $return[$i]->quota[$j][8] = strval(intval(($return[$i]->quota[$j][8]-time())/3600)) .' '. _('hours');
- }
- $j=0;
- while (isset($return[$i]->quota[$j][0]))
- // remove invalid quotas
- if (!in_array($return[$i]->quota[$j][0], $real_quotas)) unset($return[$i]->quota[$j]);
- else $j++;
- // Beautify array, repair index
- if (is_array($return[$i]->quota)) $return[$i]->quota = array_values($return[$i]->quota);
- }
- if (is_array($users)) return $return;
- else return $return[0];
- }
- else {
- return $users;
- }
- }
-
-/* Whis function will set the quotas from the specified user.
-* $values2 = array of object account with quotas which should be set
-* $values2 can also be an account object
-*/
-function setquotas($values2) {
- // get username and password of the current lam-admin
- $ldap_q = $_SESSION['ldap']->decrypt_login();
- /* $towrite has the following syntax:
- * admin-username, admin-password, account with quotas, 'quota', operation='set', type=user|group
- * use escapeshellarg to make exec() shell-safe
- */
- $towrite = escapeshellarg($_SESSION['config']->scriptServer)." ".escapeshellarg($_SESSION['config']->scriptPath)." ".
- escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]);
-
- /* Check wich quotas have changed
- * Because we can not send an array to lamdaemon.pl we have to put all
- * values in a string. ':' sepraeates the first array, ',' the second
- *
- * $values->quota[][] First array is an index for every chare with active quotas
- * second array Contains values for every share:
- * mountpoint, used blocks, soft block limit, hard block limit, grace block period, used inodes,
- * soft inode limit, hard inode limit, grace inode period
- *
- * run only once if no array is given
- *
- */
- if (is_array($values2)) {
- foreach ($values2 as $values) {
- $i=0;
- while ($values->quota[$i][0]) {
- $quotastring = $quotastring. $values->quota[$i][0] .','.$values->quota[$i][2] .','.$values->quota[$i][3]
- .','.$values->quota[$i][6] .','. $values->quota[$i][7] .':';
- $i++;
- }
- $userstring .= $values->general_username." quota set ".$values->type." ".$quotastring."\n";
- }
- }
- else {
- $i=0;
- while ($values2->quota[$i][0]) {
- $quotastring = $quotastring. $values2->quota[$i][0] .','.$values2->quota[$i][2] .','.$values2->quota[$i][3]
- .','.$values2->quota[$i][6] .','. $values2->quota[$i][7] .':';
- $i++;
- }
- $userstring = $values2->general_username." quota set ".$values2->type." ".$quotastring."\n";
- }
-
- if (function_exists(proc_open)) {
- // New Code, requires PHP 4.3
- $descriptorspec = array(
- 0 => array("pipe", "r"), // stdin
- 1 => array("pipe", "w"), // stout
- 2 => array("file", "/dev/null", "a") // sterr
- );
- $process = proc_open(escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite,
- $descriptorspec,
- $pipes);
- if (is_resource($process)) {
- /* perl-script is running
- * $pipes[0] is writeable handle to child stdin
- * $pipes[1] is readable handle to child stdout
- * any error is send to /dev/null
- */
- // Write to stdin
- fwrite($pipes[0], $userstring);
- }
- fclose($pipes[0]);
- while (!feof($pipes[1])) {
- $output = fgets($pipes[1], 1024);
- if ($output!='') $output_array[] = $output;
- }
- fclose($pipes[1]);
- proc_close($process);
- }
- else { // PHP 4.3>
- $command = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite;
- $pipe = popen("echo \"$userstring\"|$command" , 'r');
- while(!feof($pipe)) {
- //$output .= fread($pipe, 1024);
- $output = fgets($pipe, 1024);
- if ($output!='') $output_array[] = $output;
- }
- pclose($pipe);
- }
- if (is_array($values2)) return $output_array;
- else return $output_array[0];
- }
-
-
-/* Whis function will remove the quotas from the specified user.
-* $users = array of usernames of which quta should be deleted
-* $users can also be a string (single user)
-* $type = user or group
-* Delteing quotas means settings all values to 0 which means no quotas
-*/
-function remquotas($users, $type) {
- // get username and password of the current lam-admin
- $ldap_q = $_SESSION['ldap']->decrypt_login();
- /* $towrite has the following syntax:
- * admin-username, admin-password, account with quotas, 'quota', operation='rem', type=user|group
- * use escapeshellarg to make exec() shell-safe
- */
- $towrite = escapeshellarg($_SESSION['config']->scriptServer)." ".escapeshellarg($_SESSION['config']->scriptPath)." ".
- escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]);
-
- if (is_array($users)) {
- foreach ($users as $user) {
- $userstring .= "$user quota rem $type\n";
- }
- }
- else $userstring = "$users quota rem $type\n";
-
- if (function_exists(proc_open)) {
- // New Code, requires PHP 4.3
- $descriptorspec = array(
- 0 => array("pipe", "r"), // stdin
- 1 => array("pipe", "w"), // stout
- 2 => array("file", "/dev/null", "a") // sterr
- );
- $process = proc_open(escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite,
- $descriptorspec,
- $pipes);
- if (is_resource($process)) {
- /* perl-script is running
- * $pipes[0] is writeable handle to child stdin
- * $pipes[1] is readable handle to child stdout
- * any error is send to /dev/null
- */
- // Write to stdin
- fwrite($pipes[0], $userstring);
- }
- fclose($pipes[0]);
- while (!feof($pipes[1])) {
- $output = fgets($pipes[1], 1024);
- if ($output!='') $output_array[] = $output;
- }
- fclose($pipes[1]);
- proc_close($process);
- }
- else { // PHP 4.3>
- $command = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite;
- $pipe = popen("echo \"$userstring\"|$command" , 'r');
- while(!feof($pipe)) {
- //$output .= fread($pipe, 1024);
- $output = fgets($pipe, 1024);
- if ($output!='') $output_array[] = $output;
- }
- pclose($pipe);
- }
- if (is_array($values2)) return $output_array;
- else return $output_array[0];
- }
-
-
-/* Create Homedirectory
-* lamdaemon.pl uses getpwnam on remote system to get homedir path.
-* Therefore ldap have to be used on remote system for user accounts
-* $users = array of usernames
-* $users can also be a string (single user)
-*/
-function addhomedir($users) {
- // get username and password of the current lam-admin
- $ldap_q = $_SESSION['ldap']->decrypt_login();
- /* $towrite has the following syntax:
- * admin-username, admin-password, owner of homedir, 'home', operation='add'
- * use escapeshellarg to make exec() shell-safe
- */
- $towrite = escapeshellarg($_SESSION['config']->scriptServer)." ".escapeshellarg($_SESSION['config']->scriptPath)." ".
- escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]);
-
- if (is_array($users)) {
- foreach ($users as $user) {
- $userstring .= "$user home add\n";
- }
- }
- else $userstring = "$users home add\n";
-
- if (function_exists(proc_open)) {
- // New Code, requires PHP 4.3
- $descriptorspec = array(
- 0 => array("pipe", "r"), // stdin
- 1 => array("pipe", "w"), // stout
- 2 => array("file", "/dev/null", "a") // sterr
- );
- $process = proc_open(escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite,
- $descriptorspec,
- $pipes);
- if (is_resource($process)) {
- /* perl-script is running
- * $pipes[0] is writeable handle to child stdin
- * $pipes[1] is readable handle to child stdout
- * any error is send to /dev/null
- */
- // Write to stdin
- fwrite($pipes[0], $userstring);
- }
- fclose($pipes[0]);
- while (!feof($pipes[1])) {
- $output = fgets($pipes[1], 1024);
- if ($output!='') $output_array[] = $output;
- }
- fclose($pipes[1]);
- proc_close($process);
- }
- else { // PHP 4.3>
- $command = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite;
- $pipe = popen("echo \"$userstring\"|$command" , 'r');
- while(!feof($pipe)) {
- //$output .= fread($pipe, 1024);
- $output = fgets($pipe, 1024);
- if ($output!='') $output_array[] = $output;
- }
- pclose($pipe);
- }
- if (is_array($values2)) return $output_array;
- else return $output_array[0];
- }
-
-/* Remove Homedirectory
-* lamdaemon.pl uses getpwnam on remote system to get homedir path.
-* Therefore ldap have to be used on remote system for user accounts
-* This also means you have to remove the homedirectory before the
-* account is removed from ldap
-* $users = array of usernames
-* $users can also be a string (single user)
-*/
-function remhomedir($users) {
- // get username and password of the current lam-admin
- $ldap_q = $_SESSION['ldap']->decrypt_login();
- /* $towrite has the following syntax:
- * admin-username, admin-password, owner of homedir, 'home', operation='add'
- * use escapeshellarg to make exec() shell-safe
- */
- $towrite = escapeshellarg($_SESSION['config']->scriptServer)." ".escapeshellarg($_SESSION['config']->scriptPath)." ".
- escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]);
-
- if (is_array($users)) {
- foreach ($users as $user) {
- $userstring .= "$user home rem\n";
- }
- }
- else $userstring = "$users home rem\n";
-
- if (function_exists(proc_open)) {
- // New Code, requires PHP 4.3
- $descriptorspec = array(
- 0 => array("pipe", "r"), // stdin
- 1 => array("pipe", "w"), // stout
- 2 => array("file", "/dev/null", "a") // sterr
- );
- $process = proc_open(escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite,
- $descriptorspec,
- $pipes);
- if (is_resource($process)) {
- /* perl-script is running
- * $pipes[0] is writeable handle to child stdin
- * $pipes[1] is readable handle to child stdout
- * any error is send to /dev/null
- */
- // Write to stdin
- fwrite($pipes[0], $userstring);
- }
- fclose($pipes[0]);
- while (!feof($pipes[1])) {
- $output = fgets($pipes[1], 1024);
- if ($output!='') $output_array[] = $output;
- }
- fclose($pipes[1]);
- proc_close($process);
- }
- else { // PHP 4.3>
- $command = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite;
- $pipe = popen("echo \"$userstring\"|$command" , 'r');
- while(!feof($pipe)) {
- //$output .= fread($pipe, 1024);
- $output = fgets($pipe, 1024);
- if ($output!='') $output_array[] = $output;
- }
- pclose($pipe);
- }
- if (is_array($values2)) return $output_array;
- else return $output_array[0];
- }
/* This function maintains the ldap-cache which is used to reduce ldap requests
diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc
index 7d844335..e9f9124e 100644
--- a/lam/lib/modules/account.inc
+++ b/lam/lib/modules/account.inc
@@ -158,7 +158,7 @@ class account {
/* Write variables into object and do some regexp checks
*/
- function proccess_attributes($post) {
+ function proccess_attributes($post, $profile=false) {
// Load attributes
$this->attributes['description'][0] = $post['description'];
return 0;
@@ -168,18 +168,16 @@ class account {
* to show a page with all attributes.
* It will output a complete html-table
*/
- function display_html_attributes($post) {
- echo "\n";
- return 0;
+ function display_html_attributes($post, $profile=false) {
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['description'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'description'));
+
+ return $return;
}
- function display_html_delete($post) {
+ function display_html_delete($post, $profile=false) {
return 0;
}
diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc
index 40344633..30948989 100644
--- a/lam/lib/modules/inetOrgPerson.inc
+++ b/lam/lib/modules/inetOrgPerson.inc
@@ -90,6 +90,18 @@ class inetOrgPerson {
return array('attributes');
}
+ /*
+ */
+ function get_help($id) {
+ switch ($id) {
+ case "description":
+ return array ("ext" => "FALSE", "Headline" => _("Description"),
+ "Text" => _("Host Description."));
+ break;
+ }
+ return false;
+ }
+
/* This function returns all ldap attributes
* which are part of inetOrgPerson and returns
* also their values.
@@ -152,7 +164,7 @@ class inetOrgPerson {
return 0;
}
- function proccess_attributes($post) {
+ function proccess_attributes($post, $profile=false) {
// Load attributes
$this->attributes['description'][0] = $post['description'];
$this->attributes['sn'][0] = $post['sn'];
@@ -179,17 +191,19 @@ class inetOrgPerson {
}
// Do some regex-checks and return error if attributes are set to wrong values
- if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $this->attributes['givenName'][0])) $errors[] = array('ERROR', _('Given name'), _('Given name contains invalid characters'), 'givenName');
- if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $this->attributes['sn'][0])) $errors[] = array('ERROR', _('Surname'), _('Surname contains invalid characters'), 'sn');
- if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['telephoneNumber'][0])) $errors[] = array('ERROR', _('Telephone number'), _('Please enter a valid telephone number!'), 'telephoneNumber');
- if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['mobileTelephoneNumber'][0])) $errors[] = array('ERROR', _('Mobile number'), _('Please enter a valid mobile number!'), 'mobileTelephoneNumber');
- if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['facsimileTelephoneNumber'][0])) $errors[] = array('ERROR', _('Fax number'), _('Please enter a valid fax number!'), 'facsimileTelephoneNumber');
- if ( !ereg('^(([0-9]|[A-Z]|[a-z]|[.]|[-]|[_])+[@]([0-9]|[A-Z]|[a-z]|[-])+([.]([0-9]|[A-Z]|[a-z]|[-])+)*)*$', $this->attributes['mail'][0])) $errors[] = array('ERROR', _('eMail address'), _('Please enter a valid eMail address!'), 'mail');
- if ( !ereg('^([0-9]|[A-Z]|[a-z]|[-]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['street'][0])) $errors[] = array('ERROR', _('Street'), _('Please enter a valid street name!'), 'street');
- if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['postalAddress'][0])) $errors[] = array('ERROR', _('Postal address'), _('Please enter a valid postal address!'), 'postalAdress');
+ if (!$profile) {
+ if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $this->attributes['givenName'][0])) $errors[] = array('ERROR', _('Given name'), _('Given name contains invalid characters'), 'givenName');
+ if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $this->attributes['sn'][0])) $errors[] = array('ERROR', _('Surname'), _('Surname contains invalid characters'), 'sn');
+ if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['telephoneNumber'][0])) $errors[] = array('ERROR', _('Telephone number'), _('Please enter a valid telephone number!'), 'telephoneNumber');
+ if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['mobileTelephoneNumber'][0])) $errors[] = array('ERROR', _('Mobile number'), _('Please enter a valid mobile number!'), 'mobileTelephoneNumber');
+ if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['facsimileTelephoneNumber'][0])) $errors[] = array('ERROR', _('Fax number'), _('Please enter a valid fax number!'), 'facsimileTelephoneNumber');
+ if ( !ereg('^(([0-9]|[A-Z]|[a-z]|[.]|[-]|[_])+[@]([0-9]|[A-Z]|[a-z]|[-])+([.]([0-9]|[A-Z]|[a-z]|[-])+)*)*$', $this->attributes['mail'][0])) $errors[] = array('ERROR', _('eMail address'), _('Please enter a valid eMail address!'), 'mail');
+ if ( !ereg('^([0-9]|[A-Z]|[a-z]|[-]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['street'][0])) $errors[] = array('ERROR', _('Street'), _('Please enter a valid street name!'), 'street');
+ if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['postalAddress'][0])) $errors[] = array('ERROR', _('Postal address'), _('Please enter a valid postal address!'), 'postalAdress');
+ if ( !ereg('^([0-9]|[A-Z]|[a-z])*$', $this->attributes['personal_postalCode'][0])) $errors[] = array('ERROR', _('Postal code'), _('Please enter a valid postal code!'), 'personal_postalCode');
+ }
if ( !ereg('^([0-9]|[A-Z]|[a-z]|[-]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['title'][0])) $errors[] = array('ERROR', _('Title'), _('Please enter a valid title!'), 'title');
if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['employeeType'][0])) $errors[] = array('ERROR', _('Employee type'), _('Please enter a valid employee type!'), 'employeeType');
- if ( !ereg('^([0-9]|[A-Z]|[a-z])*$', $this->attributes['personal_postalCode'][0])) $errors[] = array('ERROR', _('Postal code'), _('Please enter a valid postal code!'), 'personal_postalCode');
// Return error-messages
if (is_array($errors)) return $errors;
return 0;
@@ -199,83 +213,71 @@ class inetOrgPerson {
* to show a page with all attributes.
* It will output a complete html-table
*/
- function display_html_attributes($post) {
- echo "\n";
- echo "\n";
- echo "" . _('Description') . " \n";
- echo " attributes['description'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
+ function display_html_attributes($post, $profile=false) {
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['description'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'description'));
if (isset($this->attributes['host'])) {
- echo "\n";
- echo "" . _('Unix workstations') . " \n";
- echo " attributes['host']))
- foreach ($this->attributes['host'] as $host) echo $host." ";
- echo "\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
+ foreach ($this->attributes['host'] as $host) $hostvalue .= $host." ";
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Unix workstations') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'host', 'type' => 'text', 'size' => '20',
+ 'maxlength' => '255', 'value' => $hostvalues ),
+ 2 => array ('kind' => 'help', 'value' => 'host'));
}
- echo "\n";
- echo "" . _('Title') . " \n";
- echo " attributes['title'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('First name') . "* \n" ;
- echo " attributes['givenName'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Last name') . "* \n";
- echo " attributes['sn'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Employee type') . " \n";
- echo " attributes['employeeType'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Street') . " \n";
- echo " attributes['street'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Postal code') . " \n";
- echo " attributes['postalCode'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Postal address') . " \n";
- echo " attributes['postalAddress'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Telephone number') . " \n";
- echo " attributes['telephoneNumber'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Mobile number') . " \n";
- echo " attributes['mobileTelephoneNumber'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Fax number') . " \n";
- echo " attributes['facsimileTelephoneNumber'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('eMail address') . " \n";
- echo " attributes['mail'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "
\n";
- return 0;
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Title') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'title', 'type' => 'text', 'size' => '10',
+ 'maxlength' => '10', 'value' => $this->attributes['title'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'title'));
+ if (!$profile) {
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('First name').'*' ),
+ 1 => array ( 'kind' => 'input', 'name' => 'givenName', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['givenName'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'givenName'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Last name').'*' ),
+ 1 => array ( 'kind' => 'input', 'name' => 'sn', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['sn'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'sn'));
+ }
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Employee type') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'employeeType', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['employeeType'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'employeeType'));
+ if (!$profile) {
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Street') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'street', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['street'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'street'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Postal code') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'postalCode', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['postalCode'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'postalCode'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Postal address') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'postalAddress', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['postalAddress'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'postalAddress'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Telephone number') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'telephoneNumber', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['telephoneNumber'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'telephoneNumber'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Mobile number') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'mobileTelephoneNumber', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['mobileTelephoneNumber'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'mobileTelephoneNumber'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Fax number') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'facsimileTelephoneNumber', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['facsimileTelephoneNumber'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'facsimileTelephoneNumber'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('eMail address') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'mail', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', 'value' => $this->attributes['mail'][0] ),
+ 2 => array ('kind' => 'help', 'value' => 'mail'));
+ }
+ return $return;
}
- function display_html_delete($post) {
+ function display_html_delete($post, $profile=false) {
return 0;
}
}
diff --git a/lam/lib/modules/main.inc b/lam/lib/modules/main.inc
index 079551f9..28dbbc05 100644
--- a/lam/lib/modules/main.inc
+++ b/lam/lib/modules/main.inc
@@ -86,6 +86,18 @@ class main {
return array('attributes', 'finish');
}
+ /*
+ */
+ function get_help($id) {
+ switch ($id) {
+ case "description":
+ return array ("ext" => "FALSE", "Headline" => _("Description"),
+ "Text" => _("Host Description."));
+ break;
+ }
+ return false;
+ }
+
// Dummy functions to make module compatible
function get_attributes() {
return array();
@@ -107,7 +119,7 @@ class main {
/* Write variables into object and do some regexp checks
*/
- function proccess_attributes($post) {
+ function proccess_attributes($post, $profile=false) {
// change dn
if ($post['suffix']!='') $_SESSION[$this->base]->dn = $post['suffix'];
// load profile
@@ -136,7 +148,7 @@ class main {
if ($function) $errors[] = array('INFO', _('Save profile'), _('New profile created.'));
else $errors[] = array('ERROR', _('Save profile'), _('Wrong profilename given.'));
}
- if (is_array($errors)) return $errors;
+ if (is_array($errors) && !$profile) return $errors;
else return 0;
}
return 0;
@@ -144,7 +156,7 @@ class main {
/* Write variables into object and do some regexp checks
*/
- function proccess_finish($post) {
+ function proccess_finish($post, $profile=false) {
if ($post['createagain']) {
// Reset objects
$modules = array_keys($_SESSION[$this->base]->module);
@@ -175,93 +187,84 @@ class main {
}
}
- function display_html_attributes($post) {
- // Get list of profiles
- $function = '$profilelist = get'.ucfirst($_SESSION[$this->base]->type).'Profiles();';
- eval($function);
+ function display_html_attributes($post, $profile=false) {
$modules = $_SESSION[$this->base]->check_attributes();
if (count($modules)!=0) {
- $disabled = 'disabled';
+ $disabled = false;
// Show reason why module is disabled
- for ($i=0; $ibase]->module[$modules[$i]]->alias));
+ for ($i=0; $i array ( 'kind' => 'message', 'type' => 'ERROR', 'headline' => _('Check module'),
+ 'text' => sprintf(_('Please set up all required attributes on %s page'), $_SESSION[$this->base]->module[$modules[$i]]->alias) ));
}
- else $disabled = '';
+ else $disabled = true;
- echo "\n";
- echo "\n";
- echo "" . _('Suffix') . " \n";
- echo "";
// loop through all suffixes
$function = '$suffix = $_SESSION[$_SESSION[$this->base]->config]->get_'.ucfirst($_SESSION[$this->base]->type).'Suffix();';
eval($function);
foreach ($_SESSION[$_SESSION[$this->base]->ldap]->search_units($suffix) as $suffix) {
if ($_SESSION[$this->base]->dn) {
- if ($_SESSION[$this->base]->dn == $suffix) echo "$suffix \n";
- else echo "$suffix \n";
+ if ($_SESSION[$this->base]->dn == $suffix) $option_selected = $suffix;
+ else $suffixes[] = $suffix;
}
- else echo "$suffix \n";
+ else $suffixes[] = $suffix;
}
- echo " \n";
- echo "" . _('Help') . " \n";
- echo " \n";
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Suffix') ),
+ 1 => array ( 'kind' => 'select', 'name' => 'suffix', 'options' => $suffixes,
+ 'option_selected' => $selected_suffix ),
+ 2 => array ('kind' => 'help', 'value' => 'suffix'));
- // Show fieldset with list of all user profiles
- if (count($profilelist)!=0) {
- echo "\n";
- echo "" . _("Load profile") . " \n";
- echo "";
- foreach ($profilelist as $profile) echo "$profile \n";
- echo " \n";
- echo " \n";
- echo "" . _('Help') . " \n";
- echo " \n";
+ if (!$profile) {
+ // Get list of profiles
+ $function = '$profilelist = get'.ucfirst($_SESSION[$this->base]->type).'Profiles();';
+ eval($function);
+ if (count($profilelist)!=0) {
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Load profile") ),
+ 1 => array ( 'kind' => 'select', 'name' => 'selectLoadProfile', 'options' => $profilelist ),
+ 2 => array ('kind' => 'help', 'value' => 'selectLoadProfile'));
+ }
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Save profile") ),
+ 1 => array ( 'kind' => 'table', 'value' => array ( 0 => array (
+ 0 => array ( 'kind' => 'input', 'name' => 'selectSaveProfile', 'type' => 'text', 'size' => '30',
+ 'maxlength' => '255', ),
+ 1 => array ('kind' => 'input', 'name' => 'saveProfile', 'type' => 'submit',
+ 'value' => _('Save profile'), 'disabled' => $disabled))) ),
+ 2 => array ('kind' => 'help', 'value' => 'saveProfile'));
}
- echo "\n";
- echo "" . _("Save profile") . " \n";
- echo " \n";
- echo " \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo " base]->dn_orig!='') echo _('Modify Account');
- else echo _('Create Account');
- echo "\" $disabled > \n";
- echo " \n";
- echo "
\n";
- return 0;
+ if ($_SESSION[$this->base]->dn_orig!='') $text = _('Modify Account');
+ else $text = _('Create Account');
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => $text ),
+ 1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'create', 'value' => $text ),
+ 2 => array ('kind' => 'help', 'value' => 'create'));
+ return $return;
}
- function display_html_delete($post) {
+ function display_html_delete($post, $profile=false) {
return 0;
}
/* This page will be shown if an account
* has been saved
*/
- function display_html_finish($post) {
+ function display_html_finish($post, $profile=false) {
// Show success message
if ($_SESSION[$this->base]->dn_orig=='') $kind = _('created');
else $kind = _('modified');
$text = sprintf(_('%s has been %s.'), ucfirst($_SESSION[$this->base]->type), $kind);
- StatusMessage('INFO', _('LDAP operation successful.'), $text);
- // Show rest of page
- echo "\n";
- echo "\n";
- if ($_SESSION[$this->base]->dn_orig=='') {
- echo " base]->type);
- echo "\"> \n";
+ if (!$profile) {
+ $return[] = array ( 0 => array ( 'kind' => 'message', 'type' => 'INFO', 'headline' => _('LDAP operation successful.'),
+ 'text' => $text ));
+
+ $return[] = array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'createagain',
+ 'value' => sprintf(_('Create another %s'), $_SESSION[$this->base]->type) ),
+ 1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'outputpdf',
+ 'value' => _('Create PDF file') ),
+ 2 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'backmain',
+ 'value' => sprintf (_('Back to %s list'), $_SESSION[$this->base]->type) ));
}
- echo " \n";
- echo " base]->type);
- echo "\"> \n";
- echo " \n";
- echo "
\n";
- return 0;
+
+ return $return;
}
}
diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc
index 339b3a11..d0da3e6a 100644
--- a/lam/lib/modules/posixAccount.inc
+++ b/lam/lib/modules/posixAccount.inc
@@ -531,111 +531,74 @@ class posixAccount {
* to show a page with all attributes.
* It will output a complete html-table
*/
- function display_html_attributes($post) {
+ function display_html_attributes($post, $profile=false) {
$groups = $_SESSION[$_SESSION[$this->base]->cache]->findgroups(); // list of all groupnames
$shelllist = getshells(); // list of all valid shells
if ($this->attributes['userPassword'][0] != $this->orig['userPassword'][0]) $password=$this->userPassword();
else $password='';
- echo "\n";
- echo "\n";
- echo '' . _('Username') . "* \n";
- echo " attributes['uid'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('UID number') ." \n";
- echo " attributes['uidNumber'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Gecos') . " \n";
- echo " attributes['gecos'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Primary group') . "* \n";
- echo "";
- // loop trough existing groups
- foreach ($groups as $group)
- if ($_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'][0]) == $group) echo " $group \n";
- else echo " $group \n";
- echo " \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- if ($_SESSION[$this->base]->type=='user') {
- echo "\n";
- echo "" . _('Additional groups') . " \n";
- echo " \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Home directory') . "* \n";
- echo " attributes['homeDirectory'][0]."\"> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- if ($this->orig['homeDirectory']=='' && isset($_SESSION[$_SESSION[$this->base]->config]->scriptPath)) {
- echo "\n";
- echo "" . _('Create home directory') . "* \n";
- echo " createhomedir) echo " checked ";
- echo "> \n";
- echo " \n";
- }
- echo " \n";
- echo "" . _('Password') . " \n";
- echo " \n";
- echo " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Repeat password') . " \n";
- echo " \n";
- echo " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Use no password') . " \n";
- echo " userPassword_no) echo " checked ";
- echo "> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- echo "\n";
- echo "" . _('Lock password') . " \n";
- echo " userPassword_lock) echo " checked ";
- echo "> \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- if (count($shelllist)!=0) {
- echo "\n";
- echo "" . _('Login shell') . "* \n";
- echo "";
- // loop through shells
- foreach ($shelllist as $shell)
- if ($this->attributes['loginShell'][0]==trim($shell)) echo " $shell \n";
- else echo " $shell \n";
- echo " \n";
- echo "" . _('Help') . " \n";
- echo " \n";
- }
+
+ if (!$profile) {
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Username").'*' ),
+ 1 => array ( 'kind' => 'input', 'name' => 'uid', 'type' => 'text', 'size' => '20', 'maxlength' => '20', 'value' => $this->attributes['uid'][0]),
+ 2 => array ('kind' => 'help', 'value' => 'uid'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('UID number').'*' ),
+ 1 => array ( 'kind' => 'input', 'name' => 'uidNumber', 'type' => 'text', 'size' => '6', 'maxlength' => '6', 'value' => $this->attributes['uidNumber'][0]),
+ 2 => array ('kind' => 'help', 'value' => 'uidNumber'));
}
- echo "
\n";
- return 0;
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Gecos') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'gecos', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['gecos'][0]),
+ 2 => array ('kind' => 'help', 'value' => 'gecos'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Primary group').'*' ),
+ 1 => array ( 'kind' => 'select', 'name' => 'gidNumber', 'options' => $groups, 'options_selected' =>
+ array ($_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'][0]))),
+ 2 => array ('kind' => 'help', 'value' => 'gidNumber'));
+
+ if ($_SESSION[$this->base]->type=='user') {
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Additional groups') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'addgroup', 'type' => 'submit', 'value' => _('Edit groups')),
+ 2 => array ('kind' => 'help', 'value' => 'addgroup'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Home directory').'*' ),
+ 1 => array ( 'kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]),
+ 2 => array ('kind' => 'help', 'value' => 'homeDirectory'));
+ if (!$profile) {
+ if ($this->orig['homeDirectory']=='' && isset($_SESSION[$_SESSION[$this->base]->config]->scriptPath)) {
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Create home directory') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'createhomedir', 'type' => 'checkbox', 'checked' => $this->createhomedir),
+ 2 => array ('kind' => 'help', 'value' => 'createhomedir'));
+ }
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Password') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password),
+ 2 => array ( 'kind' => 'input', 'name' => 'genpass', 'type' => 'submit', 'value' => _('Generate password')));
+ if ($post['userPassword2']!='') $password2 = $post['userPassword2'];
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Repeat password') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password2),
+ 2 => array ('kind' => 'help', 'value' => 'userPassword'));
+ }
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Use no password') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'userPassword_no', 'type' => 'checkbox', 'checked' => $this->userPassword_no),
+ 2 => array ('kind' => 'help', 'value' => 'userPassword_no'));
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Lock password') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'userPassword_lock', 'type' => 'checkbox', 'checked' => $this->userPassword_lock),
+ 2 => array ('kind' => 'help', 'value' => 'userPassword_lock'));
+ if (count($shelllist)!=0)
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Login shell').'*' ),
+ 1 => array ( 'kind' => 'select', 'name' => 'loginShell', 'options' => $shelllist, 'options_selected' =>
+ array ($this->attributes['loginShell'][0])),
+ 2 => array ('kind' => 'help', 'value' => 'loginShell'));
+ }
+ return $return;
}
function display_html_delete($post) {
if ($_SESSION[$this->base]->type=='user' && isset($_SESSION[$_SESSION[$this->base]->config]->scriptPath)) {
- echo "\n";
- echo "" . _('Delete home directory') . " \n";
- echo " \n";
- echo " \n";
+ $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Delete home directory') ),
+ 1 => array ( 'kind' => 'input', 'name' => 'deletehomedir', 'type' => 'checkbox'),
+ 2 => array ('kind' => 'help', 'value' => 'deletehomedir'));
}
- return 0;
+ return $return;
}
- function display_html_group($post) {
+ function display_html_group($post, $profile=false) {
// load list with all groups
$dn_groups = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('gidNumber', 'posixGroup', 'group');
$DNs = array_keys($dn_groups);
@@ -649,42 +612,21 @@ class posixAccount {
$groups = array_flip($groups);
if (isset($groups[$_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'])])) unset ($groups[$_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'])]);
$groups = array_flip($groups);
- echo "\n";
- return 0;
+
+ $return[] = array ( 0 => array ( 'kind' => 'fieldset', 'legend' => _("Additional groups"), 'value' =>
+ array ( 0 => array ( 0 => array ('kind' => 'fieldset', 'td' => array ('valign' => 'top'), 'legend' => _("Selected groups"), 'value' =>
+ array ( 0 => array ( 0 => array ( 'kind' => 'select', 'name' => 'removegroups[]', 'size' => '15', 'multiple', 'options' => $this->groups)))),
+ 1 => array ( 'kind' => 'table', 'value' => array ( 0 => array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'addgroups_button',
+ 'value' => '<=')), 1 => array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'removegroups_button', 'value' => '=>' )),
+ 2 => array ( 0 => array ( 'kind' => 'help', 'value' => 'addgroup' )))),
+ 2 => array ('kind' => 'fieldset', 'td' => array ('valign' => 'top'), 'legend' => _("Available groups"), 'value' =>
+ array ( 0 => array ( 0 => array ( 'kind' => 'select', 'name' => 'addgroups[]', 'size' => '15', 'multiple', 'options' => $groups))))
+ ))));
+
+ $return[] = array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'value' => _('Back') ),
+ 1 => array ( 'kind' => 'text'),
+ 2 => array ('kind' => 'text'));
+ return $return;
}