initial support for pseudo html.
This commit is contained in:
parent
554a7c1f2a
commit
8a01905ad5
|
@ -443,6 +443,9 @@ class accountContainer {
|
||||||
// display html-code from mdule
|
// display html-code from mdule
|
||||||
$function = '$result = $this->module[$this->order[$this->module[\'main\']->current_page]]->display_html_'.$this->module['main']->subpage.'($post);';
|
$function = '$result = $this->module[$this->order[$this->module[\'main\']->current_page]]->display_html_'.$this->module['main']->subpage.'($post);';
|
||||||
eval ($function);
|
eval ($function);
|
||||||
|
echo "<table>\n";
|
||||||
|
$this->parse_html($this->order[$this->module['main']->current_page], $result);
|
||||||
|
echo "</table>\n";
|
||||||
// Display rest of html-page
|
// Display rest of html-page
|
||||||
echo "</fieldset>\n";
|
echo "</fieldset>\n";
|
||||||
echo "</td></tr></table>\n";
|
echo "</td></tr></table>\n";
|
||||||
|
@ -452,6 +455,89 @@ class accountContainer {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parse_html($module, $input) {
|
||||||
|
if (is_array($input)) {
|
||||||
|
for ($i=0; $i<count($input); $i++) {
|
||||||
|
// Draw column
|
||||||
|
echo "<tr>\n";
|
||||||
|
for ($j=0; $j<count($input[$i]); $j++ ) {
|
||||||
|
// draw raw
|
||||||
|
switch ($input[$i][$j]['kind']) {
|
||||||
|
case 'text':
|
||||||
|
echo "<td";
|
||||||
|
if ($input[$i][$j]['td']['valign']!='') echo ' valign="' . $input[$i][$j]['td']['valign'] .'"';
|
||||||
|
echo ">\n";
|
||||||
|
echo $input[$i][$j]['text'] . "<td>\n";
|
||||||
|
break;
|
||||||
|
case 'input':
|
||||||
|
echo "<td";
|
||||||
|
if ($input[$i][$j]['td']['valign']!='') echo ' valign="' . $input[$i][$j]['td']['valign'] .'"';
|
||||||
|
echo ">\n";
|
||||||
|
$output = "<input";
|
||||||
|
if ($input[$i][$j]['name']!='') $output .= ' name="' . $input[$i][$j]['name'] . '"';
|
||||||
|
if ($input[$i][$j]['type']!='') $output .= ' type="' . $input[$i][$j]['type'] . '"';
|
||||||
|
if ($input[$i][$j]['size']!='') $output .= ' size="' . $input[$i][$j]['size'] . '"';
|
||||||
|
if ($input[$i][$j]['maxlength']!='') $output .= ' maxlength="' . $input[$i][$j]['maxlength'] . '"';
|
||||||
|
if ($input[$i][$j]['value']!='') $output .= ' value="' . $input[$i][$j]['value'] . '"';
|
||||||
|
if (isset($input[$i][$j]['disabled'])) $output .= ' disabled';
|
||||||
|
if (isset($input[$i][$j]['checked'])) $output .= ' checked';
|
||||||
|
$output .= "></td>\n";
|
||||||
|
echo $output;
|
||||||
|
break;
|
||||||
|
case 'fieldset':
|
||||||
|
echo "<td";
|
||||||
|
if ($input[$i][$j]['td']['valign']!='') echo ' valign="' . $input[$i][$j]['td']['valign'] .'"';
|
||||||
|
echo ">\n";
|
||||||
|
echo "<fieldset>\n";
|
||||||
|
if ($input[$i][$j]['legend']!='') echo "<legend>" . $input[$i][$j]['legend'] . "</legend>\n";
|
||||||
|
echo "<table>\n";
|
||||||
|
$this->parse_html($module, $input[$i][$j]['value']);
|
||||||
|
echo "</table>\n";
|
||||||
|
echo "</fieldset>\n";
|
||||||
|
break;
|
||||||
|
case 'select':
|
||||||
|
echo "<td";
|
||||||
|
if ($input[$i][$j]['td']['valign']!='') echo ' valign="' . $input[$i][$j]['td']['valign'] .'"';
|
||||||
|
echo ">\n";
|
||||||
|
echo "<select name=\"" . $input[$i][$j]['name'] . '"';
|
||||||
|
if ($input[$i][$j]['multiple']) echo ' multiple';
|
||||||
|
if ($input[$i][$j]['size']) echo ' size="' . $input[$i][$j]['size'] . '"';
|
||||||
|
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 selected>" . $option . "</option>\n";
|
||||||
|
else echo "<option>" . $option . "</option>\n";
|
||||||
|
}
|
||||||
|
echo "</select></td>\n";
|
||||||
|
break;
|
||||||
|
case 'table':
|
||||||
|
echo "<td";
|
||||||
|
if ($input[$i][$j]['td']['valign']!='') echo ' valign="' . $input[$i][$j]['td']['valign'] .'"';
|
||||||
|
echo ">\n";
|
||||||
|
echo "<table>\n";
|
||||||
|
$this->parse_html($module, $input[$i][$j]['value']);
|
||||||
|
echo "</table>\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
break;
|
||||||
|
case 'help':
|
||||||
|
echo "<td";
|
||||||
|
if ($input[$i][$j]['td']['valign']!='') echo ' valign="' . $input[$i][$j]['td']['valign'] .'"';
|
||||||
|
echo ">\n";
|
||||||
|
echo "<a href=../help.php?module=$module&item=$input[$i][$j]['value']>" . _('Help') . "</a></td>\n";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo "<td>Unrecognized type: " . $input[$i][$j]['kind'] . "</td>\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Add attributes to variable. Syntax is array( attribute = array ( objectClass1 => MUST|MAX, objectClass2 => MUST|MAY ), ... )
|
/* Add attributes to variable. Syntax is array( attribute = array ( objectClass1 => MUST|MAX, objectClass2 => MUST|MAY ), ... )
|
||||||
*/
|
*/
|
||||||
function add_attributes($objectClass) {
|
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
|
/* Return a list of all shells listed in ../config/shells
|
||||||
|
@ -1173,391 +1198,6 @@ function RndInt($Format){
|
||||||
} // END RndInt() FUNCTION
|
} // 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; $i<count($return); $i++)
|
|
||||||
// put string to trasmit together
|
|
||||||
if ($return[$i]->general_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; $i<count($return); $i++) {
|
|
||||||
$all_quota = explode(':', $output_array[$i]);
|
|
||||||
for ($j=0; $j<sizeof($all_quota)-1; $j++) {
|
|
||||||
$single_quota = explode(',', $all_quota[$j]);
|
|
||||||
// unset not existing quotas from account-object
|
|
||||||
// collect all existing mountpoints in array
|
|
||||||
$real_quotas[] = $single_quota[0];
|
|
||||||
for ($k=0; $k<sizeof($single_quota); $k++)
|
|
||||||
$return[$i]->quota[$j][$k] = $single_quota[$k];
|
|
||||||
if ($return[$i]->quota[$j][4]<time()) $return[$i]->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]<time()) $return[$i]->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
|
/* This function maintains the ldap-cache which is used to reduce ldap requests
|
||||||
|
|
|
@ -158,7 +158,7 @@ class account {
|
||||||
|
|
||||||
/* Write variables into object and do some regexp checks
|
/* Write variables into object and do some regexp checks
|
||||||
*/
|
*/
|
||||||
function proccess_attributes($post) {
|
function proccess_attributes($post, $profile=false) {
|
||||||
// Load attributes
|
// Load attributes
|
||||||
$this->attributes['description'][0] = $post['description'];
|
$this->attributes['description'][0] = $post['description'];
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -168,18 +168,16 @@ class account {
|
||||||
* to show a page with all attributes.
|
* to show a page with all attributes.
|
||||||
* It will output a complete html-table
|
* It will output a complete html-table
|
||||||
*/
|
*/
|
||||||
function display_html_attributes($post) {
|
function display_html_attributes($post, $profile=false) {
|
||||||
echo "<table border=0 width=\"100%\">\n<tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ),
|
||||||
echo "<tr>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30',
|
||||||
echo "<td>" . _('Description') . "</td>\n";
|
'maxlength' => '255', 'value' => $this->attributes['description'][0] ),
|
||||||
echo "<td><input name=\"description\" type=\"text\" size=\"30\" maxlength=\"255\" value=\"".$this->attributes['description'][0]."\"></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'description'));
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=description&module=account\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
return $return;
|
||||||
echo "</table>\n";
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_html_delete($post) {
|
function display_html_delete($post, $profile=false) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,18 @@ class inetOrgPerson {
|
||||||
return array('attributes');
|
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
|
/* This function returns all ldap attributes
|
||||||
* which are part of inetOrgPerson and returns
|
* which are part of inetOrgPerson and returns
|
||||||
* also their values.
|
* also their values.
|
||||||
|
@ -152,7 +164,7 @@ class inetOrgPerson {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function proccess_attributes($post) {
|
function proccess_attributes($post, $profile=false) {
|
||||||
// Load attributes
|
// Load attributes
|
||||||
$this->attributes['description'][0] = $post['description'];
|
$this->attributes['description'][0] = $post['description'];
|
||||||
$this->attributes['sn'][0] = $post['sn'];
|
$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
|
// 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 (!$profile) {
|
||||||
if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $this->attributes['sn'][0])) $errors[] = array('ERROR', _('Surname'), _('Surname contains invalid characters'), 'sn');
|
if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $this->attributes['givenName'][0])) $errors[] = array('ERROR', _('Given name'), _('Given name contains invalid characters'), 'givenName');
|
||||||
if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['telephoneNumber'][0])) $errors[] = array('ERROR', _('Telephone number'), _('Please enter a valid telephone number!'), 'telephoneNumber');
|
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['mobileTelephoneNumber'][0])) $errors[] = array('ERROR', _('Mobile number'), _('Please enter a valid mobile number!'), 'mobileTelephoneNumber');
|
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['facsimileTelephoneNumber'][0])) $errors[] = array('ERROR', _('Fax number'), _('Please enter a valid fax number!'), 'facsimileTelephoneNumber');
|
if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['mobileTelephoneNumber'][0])) $errors[] = array('ERROR', _('Mobile number'), _('Please enter a valid mobile number!'), 'mobileTelephoneNumber');
|
||||||
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]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['facsimileTelephoneNumber'][0])) $errors[] = array('ERROR', _('Fax number'), _('Please enter a valid fax number!'), 'facsimileTelephoneNumber');
|
||||||
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]|[.]|[-]|[_])+[@]([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['postalAddress'][0])) $errors[] = array('ERROR', _('Postal address'), _('Please enter a valid postal address!'), 'postalAdress');
|
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['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['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
|
// Return error-messages
|
||||||
if (is_array($errors)) return $errors;
|
if (is_array($errors)) return $errors;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -199,83 +213,71 @@ class inetOrgPerson {
|
||||||
* to show a page with all attributes.
|
* to show a page with all attributes.
|
||||||
* It will output a complete html-table
|
* It will output a complete html-table
|
||||||
*/
|
*/
|
||||||
function display_html_attributes($post) {
|
function display_html_attributes($post, $profile=false) {
|
||||||
echo "<table border=0 width=\"100%\">\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ),
|
||||||
echo "<tr>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30',
|
||||||
echo "<td>" . _('Description') . "</td>\n";
|
'maxlength' => '255', 'value' => $this->attributes['description'][0] ),
|
||||||
echo "<td><input name=\"description\" type=\"text\" size=\"30\" maxlength=\"255\" value=\"".$this->attributes['description'][0]."\"></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'description'));
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=404\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
if (isset($this->attributes['host'])) {
|
if (isset($this->attributes['host'])) {
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Unix workstations') . "</td>\n";
|
|
||||||
echo "<td><input name=\"host\" type=\"text\" size=\"20\" maxlength=\"80\" value=\"";
|
|
||||||
if (is_array($this->attributes['host']))
|
if (is_array($this->attributes['host']))
|
||||||
foreach ($this->attributes['host'] as $host) echo $host." ";
|
foreach ($this->attributes['host'] as $host) $hostvalue .= $host." ";
|
||||||
echo "\"></td>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Unix workstations') ),
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=466\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'host', 'type' => 'text', 'size' => '20',
|
||||||
echo "</tr>\n";
|
'maxlength' => '255', 'value' => $hostvalues ),
|
||||||
|
2 => array ('kind' => 'help', 'value' => 'host'));
|
||||||
}
|
}
|
||||||
echo "<tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Title') ),
|
||||||
echo "<td>" . _('Title') . "</td>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'title', 'type' => 'text', 'size' => '10',
|
||||||
echo "<td><input name=\"title\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"".$this->attributes['title'][0]."\"></td>\n";
|
'maxlength' => '10', 'value' => $this->attributes['title'][0] ),
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=448\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'title'));
|
||||||
echo "</tr>\n";
|
if (!$profile) {
|
||||||
echo "<tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('First name').'*' ),
|
||||||
echo "<td>" . _('First name') . "*</td>\n" ;
|
1 => array ( 'kind' => 'input', 'name' => 'givenName', 'type' => 'text', 'size' => '30',
|
||||||
echo "<td><input name=\"givenName\" type=\"text\" size=\"20\" maxlength=\"20\" value=\"".$this->attributes['givenName'][0]."\"></td>\n";
|
'maxlength' => '255', 'value' => $this->attributes['givenName'][0] ),
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=425\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'givenName'));
|
||||||
echo "</tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Last name').'*' ),
|
||||||
echo "<tr>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'sn', 'type' => 'text', 'size' => '30',
|
||||||
echo "<td>" . _('Last name') . "*</td>\n";
|
'maxlength' => '255', 'value' => $this->attributes['sn'][0] ),
|
||||||
echo "<td><input name=\"sn\" type=\"text\" size=\"20\" maxlength=\"50\" value=\"".$this->attributes['sn'][0]."\"></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'sn'));
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=424\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
}
|
||||||
echo "</tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Employee type') ),
|
||||||
echo "<tr>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'employeeType', 'type' => 'text', 'size' => '30',
|
||||||
echo "<td>" . _('Employee type') . "</td>\n";
|
'maxlength' => '255', 'value' => $this->attributes['employeeType'][0] ),
|
||||||
echo "<td><input name=\"employeeType\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"".$this->attributes['employeeType'][0]."\"></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'employeeType'));
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=449\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
if (!$profile) {
|
||||||
echo "</tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Street') ),
|
||||||
echo "<tr>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'street', 'type' => 'text', 'size' => '30',
|
||||||
echo "<td>" . _('Street') . "</td>\n";
|
'maxlength' => '255', 'value' => $this->attributes['street'][0] ),
|
||||||
echo "<td><input name=\"street\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"".$this->attributes['street'][0]."\"></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'street'));
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=450\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Postal code') ),
|
||||||
echo "</tr>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'postalCode', 'type' => 'text', 'size' => '30',
|
||||||
echo "<tr>\n";
|
'maxlength' => '255', 'value' => $this->attributes['postalCode'][0] ),
|
||||||
echo "<td>" . _('Postal code') . "</td>\n";
|
2 => array ('kind' => 'help', 'value' => 'postalCode'));
|
||||||
echo "<td><input name=\"postalCode\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"".$this->attributes['postalCode'][0]."\"></td>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Postal address') ),
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=451\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'postalAddress', 'type' => 'text', 'size' => '30',
|
||||||
echo "</tr>\n";
|
'maxlength' => '255', 'value' => $this->attributes['postalAddress'][0] ),
|
||||||
echo "<tr>\n";
|
2 => array ('kind' => 'help', 'value' => 'postalAddress'));
|
||||||
echo "<td>" . _('Postal address') . "</td>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Telephone number') ),
|
||||||
echo "<td><input name=\"postalAddress\" type=\"text\" size=\"30\" maxlength=\"80\" value=\"".$this->attributes['postalAddress'][0]."\"></td>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'telephoneNumber', 'type' => 'text', 'size' => '30',
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=452\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
'maxlength' => '255', 'value' => $this->attributes['telephoneNumber'][0] ),
|
||||||
echo "</tr>\n";
|
2 => array ('kind' => 'help', 'value' => 'telephoneNumber'));
|
||||||
echo "<tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Mobile number') ),
|
||||||
echo "<td>" . _('Telephone number') . "</td>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'mobileTelephoneNumber', 'type' => 'text', 'size' => '30',
|
||||||
echo "<td><input name=\"telephoneNumber\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"".$this->attributes['telephoneNumber'][0]."\"></td>\n";
|
'maxlength' => '255', 'value' => $this->attributes['mobileTelephoneNumber'][0] ),
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=453\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'mobileTelephoneNumber'));
|
||||||
echo "</tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Fax number') ),
|
||||||
echo "<tr>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'facsimileTelephoneNumber', 'type' => 'text', 'size' => '30',
|
||||||
echo "<td>" . _('Mobile number') . "</td>\n";
|
'maxlength' => '255', 'value' => $this->attributes['facsimileTelephoneNumber'][0] ),
|
||||||
echo "<td><input name=\"mobileTelephoneNumber\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"".$this->attributes['mobileTelephoneNumber'][0]."\"></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'facsimileTelephoneNumber'));
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=454\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('eMail address') ),
|
||||||
echo "</tr>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'mail', 'type' => 'text', 'size' => '30',
|
||||||
echo "<tr>\n";
|
'maxlength' => '255', 'value' => $this->attributes['mail'][0] ),
|
||||||
echo "<td>" . _('Fax number') . "</td>\n";
|
2 => array ('kind' => 'help', 'value' => 'mail'));
|
||||||
echo "<td><input name=\"facsimileTelephoneNumber\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"".$this->attributes['facsimileTelephoneNumber'][0]."\"></td>\n";
|
}
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=455\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
return $return;
|
||||||
echo "</tr>\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('eMail address') . "</td>\n";
|
|
||||||
echo "<td><input name=\"mail\" type=\"text\" size=\"30\" maxlength=\"80\" value=\"".$this->attributes['mail'][0]."\"></td>\n";
|
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=456\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "</table>\n";
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_html_delete($post) {
|
function display_html_delete($post, $profile=false) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,18 @@ class main {
|
||||||
return array('attributes', 'finish');
|
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
|
// Dummy functions to make module compatible
|
||||||
function get_attributes() {
|
function get_attributes() {
|
||||||
return array();
|
return array();
|
||||||
|
@ -107,7 +119,7 @@ class main {
|
||||||
|
|
||||||
/* Write variables into object and do some regexp checks
|
/* Write variables into object and do some regexp checks
|
||||||
*/
|
*/
|
||||||
function proccess_attributes($post) {
|
function proccess_attributes($post, $profile=false) {
|
||||||
// change dn
|
// change dn
|
||||||
if ($post['suffix']!='') $_SESSION[$this->base]->dn = $post['suffix'];
|
if ($post['suffix']!='') $_SESSION[$this->base]->dn = $post['suffix'];
|
||||||
// load profile
|
// load profile
|
||||||
|
@ -136,7 +148,7 @@ class main {
|
||||||
if ($function) $errors[] = array('INFO', _('Save profile'), _('New profile created.'));
|
if ($function) $errors[] = array('INFO', _('Save profile'), _('New profile created.'));
|
||||||
else $errors[] = array('ERROR', _('Save profile'), _('Wrong profilename given.'));
|
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;
|
else return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -144,7 +156,7 @@ class main {
|
||||||
|
|
||||||
/* Write variables into object and do some regexp checks
|
/* Write variables into object and do some regexp checks
|
||||||
*/
|
*/
|
||||||
function proccess_finish($post) {
|
function proccess_finish($post, $profile=false) {
|
||||||
if ($post['createagain']) {
|
if ($post['createagain']) {
|
||||||
// Reset objects
|
// Reset objects
|
||||||
$modules = array_keys($_SESSION[$this->base]->module);
|
$modules = array_keys($_SESSION[$this->base]->module);
|
||||||
|
@ -175,93 +187,84 @@ class main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_html_attributes($post) {
|
function display_html_attributes($post, $profile=false) {
|
||||||
// Get list of profiles
|
|
||||||
$function = '$profilelist = get'.ucfirst($_SESSION[$this->base]->type).'Profiles();';
|
|
||||||
eval($function);
|
|
||||||
$modules = $_SESSION[$this->base]->check_attributes();
|
$modules = $_SESSION[$this->base]->check_attributes();
|
||||||
if (count($modules)!=0) {
|
if (count($modules)!=0) {
|
||||||
$disabled = 'disabled';
|
$disabled = false;
|
||||||
// Show reason why module is disabled
|
// Show reason why module is disabled
|
||||||
for ($i=0; $i<count($modules); $i++) StatusMessage('ERROR', _('Check module'), sprintf(_('Please set up all required attributes on %s page'), $_SESSION[$this->base]->module[$modules[$i]]->alias));
|
for ($i=0; $i<count($modules); $i++)
|
||||||
|
$return[] = array ( 0 => 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 "<table border=0 width=\"100%\">\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Suffix') . "</td>\n";
|
|
||||||
echo "<td><select name=\"suffix\">";
|
|
||||||
// loop through all suffixes
|
// loop through all suffixes
|
||||||
$function = '$suffix = $_SESSION[$_SESSION[$this->base]->config]->get_'.ucfirst($_SESSION[$this->base]->type).'Suffix();';
|
$function = '$suffix = $_SESSION[$_SESSION[$this->base]->config]->get_'.ucfirst($_SESSION[$this->base]->type).'Suffix();';
|
||||||
eval($function);
|
eval($function);
|
||||||
foreach ($_SESSION[$_SESSION[$this->base]->ldap]->search_units($suffix) as $suffix) {
|
foreach ($_SESSION[$_SESSION[$this->base]->ldap]->search_units($suffix) as $suffix) {
|
||||||
if ($_SESSION[$this->base]->dn) {
|
if ($_SESSION[$this->base]->dn) {
|
||||||
if ($_SESSION[$this->base]->dn == $suffix) echo "<option selected>$suffix</option>\n";
|
if ($_SESSION[$this->base]->dn == $suffix) $option_selected = $suffix;
|
||||||
else echo "<option>$suffix</option>\n";
|
else $suffixes[] = $suffix;
|
||||||
}
|
}
|
||||||
else echo "<option>$suffix</option>\n";
|
else $suffixes[] = $suffix;
|
||||||
}
|
}
|
||||||
echo "</select></td>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Suffix') ),
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=461\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
1 => array ( 'kind' => 'select', 'name' => 'suffix', 'options' => $suffixes,
|
||||||
echo "</tr>\n";
|
'option_selected' => $selected_suffix ),
|
||||||
|
2 => array ('kind' => 'help', 'value' => 'suffix'));
|
||||||
|
|
||||||
// Show fieldset with list of all user profiles
|
if (!$profile) {
|
||||||
if (count($profilelist)!=0) {
|
// Get list of profiles
|
||||||
echo "<tr>\n";
|
$function = '$profilelist = get'.ucfirst($_SESSION[$this->base]->type).'Profiles();';
|
||||||
echo "<td>" . _("Load profile") . "</td>\n";
|
eval($function);
|
||||||
echo "<td><select name=\"selectLoadProfile\">";
|
if (count($profilelist)!=0) {
|
||||||
foreach ($profilelist as $profile) echo "<option>$profile</option>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Load profile") ),
|
||||||
echo "</select>\n";
|
1 => array ( 'kind' => 'select', 'name' => 'selectLoadProfile', 'options' => $profilelist ),
|
||||||
echo "<input name=\"loadProfile\" type=\"submit\" value=\"" . _('Load Profile') . "\"></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'selectLoadProfile'));
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=421\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
}
|
||||||
echo "</tr>\n";
|
$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 "<tr>\n";
|
if ($_SESSION[$this->base]->dn_orig!='') $text = _('Modify Account');
|
||||||
echo "<td>" . _("Save profile") . "</td>\n";
|
else $text = _('Create Account');
|
||||||
echo "<td><input name=\"selectSaveProfile\" type=\"text\" size=\"30\" maxlength=\"50\">\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => $text ),
|
||||||
echo "<input name=\"saveProfile\" type=\"submit\" value=\"" . _('Save profile') . "\" $disabled ></td>\n";
|
1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'create', 'value' => $text ),
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=457\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'create'));
|
||||||
echo "</tr>\n";
|
return $return;
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td><input name=\"create\" type=\"submit\" value=\"";
|
|
||||||
if ($_SESSION[$this->base]->dn_orig!='') echo _('Modify Account');
|
|
||||||
else echo _('Create Account');
|
|
||||||
echo "\" $disabled ></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "</table>\n";
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_html_delete($post) {
|
function display_html_delete($post, $profile=false) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This page will be shown if an account
|
/* This page will be shown if an account
|
||||||
* has been saved
|
* has been saved
|
||||||
*/
|
*/
|
||||||
function display_html_finish($post) {
|
function display_html_finish($post, $profile=false) {
|
||||||
// Show success message
|
// Show success message
|
||||||
if ($_SESSION[$this->base]->dn_orig=='') $kind = _('created');
|
if ($_SESSION[$this->base]->dn_orig=='') $kind = _('created');
|
||||||
else $kind = _('modified');
|
else $kind = _('modified');
|
||||||
$text = sprintf(_('%s has been %s.'), ucfirst($_SESSION[$this->base]->type), $kind);
|
$text = sprintf(_('%s has been %s.'), ucfirst($_SESSION[$this->base]->type), $kind);
|
||||||
StatusMessage('INFO', _('LDAP operation successful.'), $text);
|
|
||||||
|
|
||||||
// Show rest of page
|
if (!$profile) {
|
||||||
echo "<table border=0 width=\"100%\">\n";
|
$return[] = array ( 0 => array ( 'kind' => 'message', 'type' => 'INFO', 'headline' => _('LDAP operation successful.'),
|
||||||
echo "<tr>\n";
|
'text' => $text ));
|
||||||
if ($_SESSION[$this->base]->dn_orig=='') {
|
|
||||||
echo "<td><input name=\"createagain\" type=\"submit\" value=\"";
|
$return[] = array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'createagain',
|
||||||
echo sprintf(_('Create another %s'), $_SESSION[$this->base]->type);
|
'value' => sprintf(_('Create another %s'), $_SESSION[$this->base]->type) ),
|
||||||
echo "\"></td>\n";
|
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 "<td><input name=\"outputpdf\" type=\"submit\" value=\"" . _('Create PDF file') . "\"></td>\n";
|
|
||||||
echo "<td><input name=\"backmain\" type=\"submit\" value=\"";
|
return $return;
|
||||||
echo sprintf (_('Back to %s list'), $_SESSION[$this->base]->type);
|
|
||||||
echo "\"></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "</table>\n";
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -531,111 +531,74 @@ class posixAccount {
|
||||||
* to show a page with all attributes.
|
* to show a page with all attributes.
|
||||||
* It will output a complete html-table
|
* 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
|
$groups = $_SESSION[$_SESSION[$this->base]->cache]->findgroups(); // list of all groupnames
|
||||||
$shelllist = getshells(); // list of all valid shells
|
$shelllist = getshells(); // list of all valid shells
|
||||||
if ($this->attributes['userPassword'][0] != $this->orig['userPassword'][0]) $password=$this->userPassword();
|
if ($this->attributes['userPassword'][0] != $this->orig['userPassword'][0]) $password=$this->userPassword();
|
||||||
else $password='';
|
else $password='';
|
||||||
echo "<table border=0 width=\"100%\">\n";
|
|
||||||
echo "<tr>\n";
|
if (!$profile) {
|
||||||
echo '<td>' . _('Username') . "*</td>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Username").'*' ),
|
||||||
echo "<td><input name=\"uid\" type=\"text\" size=\"20\" maxlength=\"20\" value=\"".$this->attributes['uid'][0]."\"></td>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'uid', 'type' => 'text', 'size' => '20', 'maxlength' => '20', 'value' => $this->attributes['uid'][0]),
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=400\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'uid'));
|
||||||
echo "</tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('UID number').'*' ),
|
||||||
echo "<tr>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'uidNumber', 'type' => 'text', 'size' => '6', 'maxlength' => '6', 'value' => $this->attributes['uidNumber'][0]),
|
||||||
echo "<td>" . _('UID number') ."</td>\n";
|
2 => array ('kind' => 'help', 'value' => 'uidNumber'));
|
||||||
echo "<td><input name=\"uidNumber\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"".$this->attributes['uidNumber'][0]."\"></td>\n";
|
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=401\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Gecos') . "</td>\n";
|
|
||||||
echo "<td><input name=\"gecos\" type=\"text\" size=\"30\" maxlength=\"255\" value=\"".$this->attributes['gecos'][0]."\"></td>\n";
|
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=404\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Primary group') . "*</td>\n";
|
|
||||||
echo "<td><select name=\"gidNumber\">";
|
|
||||||
// loop trough existing groups
|
|
||||||
foreach ($groups as $group)
|
|
||||||
if ($_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'][0]) == $group) echo "<option selected> $group </option>\n";
|
|
||||||
else echo "<option> $group </option>\n";
|
|
||||||
echo "</select></td>\n";
|
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=406\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
if ($_SESSION[$this->base]->type=='user') {
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Additional groups') . "</td>\n";
|
|
||||||
echo "<td><input name=\"addgroup\" type=\"submit\" value=\"" . _('Edit groups') . "\"></td>\n";
|
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=402\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Home directory') . "*</td>\n";
|
|
||||||
echo "<td><input name=\"homeDirectory\" type=\"text\" size=\"30\" maxlength=\"255\" value=\"".$this->attributes['homeDirectory'][0]."\"></td>\n";
|
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=403\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
if ($this->orig['homeDirectory']=='' && isset($_SESSION[$_SESSION[$this->base]->config]->scriptPath)) {
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Create home directory') . "*</td>\n";
|
|
||||||
echo "<td><input name=\"createhomedir\" type=\"checkbox\"";
|
|
||||||
if ($this->createhomedir) echo " checked ";
|
|
||||||
echo "></td>\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
}
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Password') . "</td>\n";
|
|
||||||
echo "<td><input name=\"userPassword\" type=\"password\" size=\"20\" maxlength=\"20\" value=\"$password\"></td>\n";
|
|
||||||
echo "<td><input name=\"genpass\" type=\"submit\" value=\"" . _('Generate password') . "\"></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Repeat password') . "</td>\n";
|
|
||||||
echo "<td><input name=\"userPassword2\" type=\"password\" size=\"20\" maxlength=\"20\" value=\"";
|
|
||||||
if ($post['userPassword2']!='') echo $post['userPassword2'];
|
|
||||||
else echo $password;
|
|
||||||
echo "\"></td>\n";
|
|
||||||
echo "<td></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Use no password') . "</td>\n";
|
|
||||||
echo "<td><input name=\"userPassword_no\" type=\"checkbox\"";
|
|
||||||
if ($this->userPassword_no) echo " checked ";
|
|
||||||
echo "></td>\n";
|
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=426\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Lock password') . "</td>\n";
|
|
||||||
echo "<td><input name=\"userPassword_lock\" type=\"checkbox\"";
|
|
||||||
if ($this->userPassword_lock) echo " checked ";
|
|
||||||
echo "></td>\n";
|
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=426\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
if (count($shelllist)!=0) {
|
|
||||||
echo "<tr>\n";
|
|
||||||
echo "<td>" . _('Login shell') . "*</td>\n";
|
|
||||||
echo "<td><select name=\"loginShell\">";
|
|
||||||
// loop through shells
|
|
||||||
foreach ($shelllist as $shell)
|
|
||||||
if ($this->attributes['loginShell'][0]==trim($shell)) echo "<option selected> $shell </option>\n";
|
|
||||||
else echo "<option> $shell </option>\n";
|
|
||||||
echo "</select></td>\n";
|
|
||||||
echo "<td><a href=\"../help.php?HelpNumber=405\" target=\"lamhelp\">" . _('Help') . "</a></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
echo "</table>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Gecos') ),
|
||||||
return 0;
|
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) {
|
function display_html_delete($post) {
|
||||||
if ($_SESSION[$this->base]->type=='user' && isset($_SESSION[$_SESSION[$this->base]->config]->scriptPath)) {
|
if ($_SESSION[$this->base]->type=='user' && isset($_SESSION[$_SESSION[$this->base]->config]->scriptPath)) {
|
||||||
echo "<tr>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Delete home directory') ),
|
||||||
echo "<td>" . _('Delete home directory') . "</td>\n";
|
1 => array ( 'kind' => 'input', 'name' => 'deletehomedir', 'type' => 'checkbox'),
|
||||||
echo "<td><input name=\"deletehomedir\" type=\"checkbox\"></td>\n";
|
2 => array ('kind' => 'help', 'value' => 'deletehomedir'));
|
||||||
echo "<tr>\n";
|
|
||||||
}
|
}
|
||||||
return 0;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_html_group($post) {
|
function display_html_group($post, $profile=false) {
|
||||||
// load list with all groups
|
// load list with all groups
|
||||||
$dn_groups = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('gidNumber', 'posixGroup', 'group');
|
$dn_groups = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('gidNumber', 'posixGroup', 'group');
|
||||||
$DNs = array_keys($dn_groups);
|
$DNs = array_keys($dn_groups);
|
||||||
|
@ -649,42 +612,21 @@ class posixAccount {
|
||||||
$groups = array_flip($groups);
|
$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'])]);
|
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);
|
$groups = array_flip($groups);
|
||||||
echo "<table border=0 width=\"100%\">\n<tr>\n";
|
|
||||||
echo "<td><fieldset class=\"".$_SESSION[$this->base]->type."edit-bright\">";
|
$return[] = array ( 0 => array ( 'kind' => 'fieldset', 'legend' => _("Additional groups"), 'value' =>
|
||||||
echo "<legend class=\"".$_SESSION[$this->base]->type."edit-bright\"><b>" . _("Additional groups") . "</b></legend>\n";
|
array ( 0 => array ( 0 => array ('kind' => 'fieldset', 'td' => array ('valign' => 'top'), 'legend' => _("Selected groups"), 'value' =>
|
||||||
echo "<table border=0 width=\"100%\">\n<tr>\n";
|
array ( 0 => array ( 0 => array ( 'kind' => 'select', 'name' => 'removegroups[]', 'size' => '15', 'multiple', 'options' => $this->groups)))),
|
||||||
echo "<td valign=\"top\">";
|
1 => array ( 'kind' => 'table', 'value' => array ( 0 => array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'addgroups_button',
|
||||||
echo "<fieldset class=\"".$_SESSION[$this->base]->type."edit-bright\">";
|
'value' => '<=')), 1 => array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'removegroups_button', 'value' => '=>' )),
|
||||||
echo "<legend class=\"".$_SESSION[$this->base]->type."edit-bright\">" . _("Selected groups") . "</legend>\n";
|
2 => array ( 0 => array ( 'kind' => 'help', 'value' => 'addgroup' )))),
|
||||||
// Show all groups the user is additional member of
|
2 => array ('kind' => 'fieldset', 'td' => array ('valign' => 'top'), 'legend' => _("Available groups"), 'value' =>
|
||||||
if (count($this->groups)!=0) {
|
array ( 0 => array ( 0 => array ( 'kind' => 'select', 'name' => 'addgroups[]', 'size' => '15', 'multiple', 'options' => $groups))))
|
||||||
echo "<select name=\"removegroups[]\" class=\"".$_SESSION[$this->base]->type."edit-bright\" size=15 multiple>\n";
|
))));
|
||||||
for ($i=0; $i<count($this->groups); $i++)
|
|
||||||
echo "<option>" . $this->groups[$i] . "</option>\n";
|
$return[] = array ( 0 => array ( 'kind' => 'input', 'type' => 'submit', 'value' => _('Back') ),
|
||||||
echo "</select>\n";
|
1 => array ( 'kind' => 'text'),
|
||||||
}
|
2 => array ('kind' => 'text'));
|
||||||
echo "</fieldset></td>\n";
|
return $return;
|
||||||
echo "<td align=\"center\" width=\"10%\"><input type=\"submit\" name=\"addgroups_button\" value=\"<=\">";
|
|
||||||
echo " ";
|
|
||||||
echo "<input type=\"submit\" name=\"removegroups_button\" value=\"=>\"><br><br>";
|
|
||||||
echo "<a href=\""."../help.php?HelpNumber=402\" target=\"lamhelp\">"._('Help')."</a></td>\n";
|
|
||||||
echo "<td valign=\"top\">\n";
|
|
||||||
echo "<fieldset class=\"".$_SESSION[$this->base]->type."edit-bright\">";
|
|
||||||
echo "<legend class=\"".$_SESSION[$this->base]->type."edit-bright\">" . _('Available groups') . "</legend>\n";
|
|
||||||
// show all groups expect these the user is member of
|
|
||||||
if (count($groups)!=0) {
|
|
||||||
echo "<select name=\"addgroups[]\" size=15 multiple class=\"".$_SESSION[$this->base]->type."edit-bright\">\n";
|
|
||||||
for ($i=0; $i<count($groups); $i++)
|
|
||||||
echo "<option> $groups[$i] </option>\n";
|
|
||||||
echo "</select>\n";
|
|
||||||
}
|
|
||||||
echo "</fieldset></td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
echo "</table>\n";
|
|
||||||
echo "<input name=\"toattributes\" type=\"submit\" value=\""; echo _('Back'); echo "\">\n";
|
|
||||||
echo "</fieldset>\n";
|
|
||||||
echo "</td></tr></table>\n";
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue