first changes to support new profile structure

This commit is contained in:
Roland Gruber 2004-03-09 14:29:47 +00:00
parent 0b39457b3e
commit 9c80ebdc8f
5 changed files with 189 additions and 729 deletions

View File

@ -1,158 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2003 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Manages creating/changing of profiles.
*/
include_once("../../lib/profiles.inc");
include_once("../../lib/ldap.inc");
include_once("../../lib/account.inc");
include_once("../../lib/config.inc");
// start session
session_save_path("../../sess");
@session_start();
setlanguage();
// check if user is logged in, if not go to login
if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
metaRefresh("../login.php");
exit;
}
// load quota list
if ($_SESSION['config']->get_scriptPath()) {
$tempacc = new account();
$tempacc->type = "group";
$acct_q = getquotas(array($tempacc));
}
// print header
echo $_SESSION['header'];
echo "<title></title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body><br>\n";
$acct = new Account();
// check if profile should be edited
if ($_GET['edit']) {
$acct = loadGroupProfile($_GET['edit']);
}
// display formular
echo ("<form action=\"profilecreate.php?type=group\" method=\"post\">\n");
if ($_SESSION['config']->is_samba3()) {
// Samba part
echo ("<fieldset><legend><b>" . _("Samba") . "</b></legend>\n");
echo ("<table border=0>\n");
// domain
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Domain") . ": </b></td>\n");
echo "<td><select name=\"smb_domain\">\n";
$doms = $_SESSION['ldap']->search_domains($_SESSION['config']->get_DomainSuffix());
for ($i = 0; $i < sizeof($doms); $i++) {
if (strtolower($acct->smb_domain->name) == strtolower($doms[$i]->name)) {
echo ("<option selected value=\"" . $acct->smb_domain->dn . "\">" . $acct->smb_domain->name . "</option>\n");
}
else {
echo ("<option value=\"" . $doms[$i]->dn . "\">" . $doms[$i]->name . "</option>\n");
}
}
echo "</select></td>\n";
echo ("<td><a href=\"../help.php?HelpNumber=438\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
echo ("</table>\n");
echo ("</fieldset>\n");
}
// Quota settings if script is given
if ($_SESSION['config']->get_scriptPath()) {
echo ("<br>");
echo "<fieldset><legend><b>"._('Quota properties')."</b></legend>\n";
echo "<table border=0>\n";
// description line
echo "<tr>\n";
echo "<td align=\"center\"><b>" . _('Mountpoint') . "</b>&nbsp;&nbsp;</td>\n";
echo "<td align=\"center\"><b>" . _('Soft block limit') . "</b>&nbsp;&nbsp;</td>\n";
echo "<td align=\"center\"><b>" . _('Hard block limit') . "</b>&nbsp;&nbsp;</td>\n";
echo "<td align=\"center\"><b>" . _('Soft inode limit') . "</b>&nbsp;&nbsp;</td>\n";
echo "<td align=\"center\"><b>" . _('Hard inode limit') . "</b>&nbsp;&nbsp;</td>\n";
echo "</tr>\n";
// help line
echo "<tr><td align=\"center\"><a href=\"../help.php?HelpNumber=439\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
"<td align=\"center\"><a href=\"../help.php?HelpNumber=441\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
"<td align=\"center\"><a href=\"../help.php?HelpNumber=442\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
"<td align=\"center\"><a href=\"../help.php?HelpNumber=445\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
"<td align=\"center\"><a href=\"../help.php?HelpNumber=446\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
'</tr>'."\n";
// quota settings
for ($i = 0; $i < (sizeof($acct_q[0]->quota)); $i++) {
// load values from profile
for ($k = 0; $k < sizeof($acct->quota); $k++) {
// check for equal mountpoints
if ($acct->quota[$k][0] == $acct_q[0]->quota[$i][0]) {
$acct_q[0]->quota[$i][2] = $acct->quota[$i][2];
$acct_q[0]->quota[$i][3] = $acct->quota[$i][3];
$acct_q[0]->quota[$i][6] = $acct->quota[$i][6];
$acct_q[0]->quota[$i][7] = $acct->quota[$i][7];
}
}
echo "<tr>\n";
echo '<td>' . $acct_q[0]->quota[$i][0] . "<input type=\"hidden\" name=\"f_quota_" . $i . "_0\" value=\"" . $acct_q[0]->quota[$i][0] . "\"></td>\n"; // mountpoint
echo '<td align="center"><input name="f_quota_' . $i . '_2" type="text" size="12" maxlength="20" value="' . $acct_q[0]->quota[$i][2] . "\"></td>\n"; // blocks soft limit
echo '<td align="center"><input name="f_quota_' . $i . '_3" type="text" size="12" maxlength="20" value="' . $acct_q[0]->quota[$i][3] . "\"></td>\n"; // blocks hard limit
echo '<td align="center"><input name="f_quota_' . $i . '_6" type="text" size="12" maxlength="20" value="' . $acct_q[0]->quota[$i][6] . "\"></td>\n"; // inodes soft limit
echo '<td align="center"><input name="f_quota_' . $i . '_7" type="text" size="12" maxlength="20" value="' . $acct_q[0]->quota[$i][7] . "\"></td>\n"; // inodes hard limit
echo "</tr>\n";
}
echo "</table>\n";
// save number of mountpoints
echo "<input type=\"hidden\" name=\"quotacount\" value=\"" . (sizeof($acct_q[0]->quota)) . "\">\n";
echo "</fieldset>\n";
}
echo ("<br><br>\n");
// profile name and submit/abort buttons
echo ("<table border=0>\n");
echo ("<tr>\n");
echo ("<td><b>" . _("Profile name") . ":</b></td>\n");
echo ("<td><input type=\"text\" name=\"profname\" value=\"" . $_GET['edit'] . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=360\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
echo ("<tr>\n");
echo ("<td colspan=2>&nbsp</td>");
echo ("</tr>\n");
echo ("<tr>\n");
echo ("<td><input type=\"submit\" name=\"submit\" value=\"" . _("Save") . "\"></td>\n");
echo ("<td><input type=\"reset\" name=\"reset\" value=\"" . _("Reset") . "\">\n");
echo ("<input type=\"submit\" name=\"abort\" value=\"" . _("Abort") . "\"></td>\n");
echo ("<td>&nbsp</td>");
echo ("</tr>\n");
echo ("</table>\n");
echo ("</form></body></html>\n");

View File

@ -1,131 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2003 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Manages creating/changing of profiles.
*/
include_once("../../lib/profiles.inc");
include_once("../../lib/ldap.inc");
include_once("../../lib/account.inc");
include_once("../../lib/config.inc");
// start session
session_save_path("../../sess");
@session_start();
setlanguage();
// check if user is logged in, if not go to login
if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
metaRefresh("../login.php");
exit;
}
// print header
echo $_SESSION['header'];
echo "<title></title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body><br>\n";
$acct = new Account();
// check if profile should be edited
if ($_GET['edit']) {
$acct = loadHostProfile($_GET['edit']);
}
// search available groups
$groups = findgroups();
// display formular
echo ("<form action=\"profilecreate.php?type=host\" method=\"post\">\n");
// Unix part
echo ("<fieldset><legend><b>" . _("Host attributes") . "</b></legend>\n");
echo ("<table border=0>\n");
// primary group
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Primary group") . ": </b></td>\n");
echo ("<td><select name=\"general_group\">\n");
for ($i = 0; $i < sizeof($groups); $i++) {
if ($acct->general_group == $groups[$i]) echo ("<option selected>" . $groups[$i] . "</option>\n");
else echo ("<option>" . $groups[$i] . "</option>\n");
}
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=412\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// empty row
echo ("<tr><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td></tr>\n");
// domain
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Domain") . ": </b></td>\n");
if ($_SESSION['config']->is_samba3()) {
echo "<td><select name=\"smb_domain\">\n";
$doms = $_SESSION['ldap']->search_domains($_SESSION['config']->get_DomainSuffix());
for ($i = 0; $i < sizeof($doms); $i++) {
if (strtolower($acct->smb_domain->name) == strtolower($doms[$i]->name)) {
echo ("<option selected value=\"" . $acct->smb_domain->dn . "\">" . $acct->smb_domain->name . "</option>\n");
}
else {
echo ("<option value=\"" . $doms[$i]->dn . "\">" . $doms[$i]->name . "</option>\n");
}
}
echo "</select></td>\n";
}
else {
echo ("<td><input type=\"text\" value=\"" . $acct->smb_domain . "\" name=\"smb_domain\"></td>\n");
}
echo ("<td><a href=\"../help.php?HelpNumber=460\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
echo ("</table>\n");
echo ("</fieldset>\n");
echo ("<br><br>\n");
// profile name and submit/abort buttons
echo ("<table border=0>\n");
echo ("<tr>\n");
echo ("<td><b>" . _("Profile name") . ":</b></td>\n");
echo ("<td><input type=\"text\" name=\"profname\" value=\"" . $_GET['edit'] . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=360\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
echo ("<tr>\n");
echo ("<td colspan=2>&nbsp</td>");
echo ("</tr>\n");
echo ("<tr>\n");
echo ("<td><input type=\"submit\" name=\"submit\" value=\"" . _("Save") . "\"></td>\n");
echo ("<td><input type=\"reset\" name=\"reset\" value=\"" . _("Reset") . "\">\n");
echo ("<input type=\"submit\" name=\"abort\" value=\"" . _("Abort") . "\"></td>\n");
echo ("<td>&nbsp</td>");
echo ("</tr>\n");
echo ("</table>\n");
echo ("</form></body></html>\n");
?>

View File

@ -53,7 +53,7 @@ if ($_POST['forward'] == "yes") {
} }
// edit user profile // edit user profile
elseif($_POST['profile'] == "edituser") { elseif($_POST['profile'] == "edituser") {
metaRefresh("profileuser.php?type=user&amp;edit=" . $_POST['e_user']); metaRefresh("profilepage.php?type=user&amp;edit=" . $_POST['e_user']);
} }
// delete user profile // delete user profile
elseif($_POST['profile'] == "deluser") { elseif($_POST['profile'] == "deluser") {
@ -62,11 +62,11 @@ if ($_POST['forward'] == "yes") {
if ($_SESSION['config']->is_samba3() || $_SESSION['config']->get_scriptPath()) { if ($_SESSION['config']->is_samba3() || $_SESSION['config']->get_scriptPath()) {
// create new group profile // create new group profile
if ($_POST['profile'] == "newgroup") { if ($_POST['profile'] == "newgroup") {
metaRefresh("profilegroup.php"); metaRefresh("profilepage.php?type=group");
} }
// edit group profile // edit group profile
elseif($_POST['profile'] == "editgroup") { elseif($_POST['profile'] == "editgroup") {
metaRefresh("profilegroup.php?edit=" . $_POST['e_group']); metaRefresh("profilepage.php?type=group&amp;edit=" . $_POST['e_group']);
} }
// delete group profile // delete group profile
elseif($_POST['profile'] == "delgroup") { elseif($_POST['profile'] == "delgroup") {
@ -75,11 +75,11 @@ if ($_POST['forward'] == "yes") {
} }
// create new host profile // create new host profile
if ($_POST['profile'] == "newhost") { if ($_POST['profile'] == "newhost") {
metaRefresh("profilehost.php"); metaRefresh("profilepage.php?type=host");
} }
// edit host profile // edit host profile
elseif($_POST['profile'] == "edithost") { elseif($_POST['profile'] == "edithost") {
metaRefresh("profilehost.php?edit=" . $_POST['e_host']); metaRefresh("profilepage.php?type=host&amp;edit=" . $_POST['e_host']);
} }
// delete user profile // delete user profile
elseif($_POST['profile'] == "delhost") { elseif($_POST['profile'] == "delhost") {

View File

@ -0,0 +1,184 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2003 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Manages creating/changing of profiles.
*/
include_once("../../lib/profiles.inc");
include_once("../../lib/ldap.inc");
include_once("../../lib/config.inc");
include_once("../../lib/modules.inc");
// start session
session_save_path("../../sess");
@session_start();
setlanguage();
// check if user is logged in, if not go to login
if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
metaRefresh("../login.php");
exit;
}
// print header
echo $_SESSION['header'];
echo "<title></title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body><br>\n";
// check if account type is valid
$type = $_GET['type'];
if (!(($type == 'user') || ($type == 'group') || ($type == 'host'))) meta_refresh('profilemain.php');
// get module options
$options = getProfileOptions($type);
// load old profile if needed
$old_profile = array();
if ($_GET['edit']) {
if ($type == "user") $old_options = loadUserProfile($_GET['edit']);
else if ($type == "group") $old_options = loadGroupProfile($_GET['edit']);
else if ($type == "host") $old_options = loadHostProfile($_GET['edit']);
}
// display formular
echo ("<form action=\"profilecreate.php?type=$type\" method=\"post\">\n");
// display module options
$modules = array_keys($options);
for ($m = 0; $m < sizeof($modules); $m++) {
// ignore modules without options
if (sizeof($options[$modules[$m]]) < 1) continue;
echo "<fieldset>\n";
echo "<legend><b>" . getModuleAlias($modules[$m], $type) . "</b></legend>\n";
echo "<table>\n";
for ($l = 0; $l < sizeof($options[$modules[$m]]); $l++) { // option lines
echo "<tr>\n";
for ($o = 0; $o < sizeof($options[$modules[$m]][$l]); $o++) { // line parts
echo "<td>";
print_option($options[$modules[$m]][$l][$o], $modules[$m], $old_profile);
echo "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
echo "</fieldset>\n";
}
// profile name and submit/abort buttons
echo "<p>&nbsp;</p>";
echo ("<table border=0>\n");
echo ("<tr>\n");
echo ("<td><b>" . _("Profile name") . ":</b></td>\n");
echo ("<td><input type=\"text\" name=\"profname\" value=\"" . $_GET['edit'] . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=360\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
echo ("<tr>\n");
echo ("<td colspan=2>&nbsp</td>");
echo ("</tr>\n");
echo ("<tr>\n");
echo ("<td><input type=\"submit\" name=\"submit\" value=\"" . _("Save") . "\"></td>\n");
echo ("<td><input type=\"reset\" name=\"reset\" value=\"" . _("Reset") . "\">\n");
echo ("<input type=\"submit\" name=\"abort\" value=\"" . _("Abort") . "\"></td>\n");
echo ("<td>&nbsp</td>");
echo ("</tr>\n");
echo ("</table>\n");
echo ("</form></body></html>\n");
// prints out the row of a table including the option name, values and help
// $values: An array formated as module option
// $module_name: The name of the module the options belong to
// $old_profile: A hash array with the values from the loaded profile
function print_option($values, $modulename, $old_profile) {
echo "<td>";
switch ($values['kind']) {
// text value
case 'text':
echo $values['text'] . "\n";
break;
// help link
case 'help':
echo "<a href=../help.php?module=$modulename&item=" . $values['value'] . ">" . _('Help') . "</a>\n";
break;
// input field
case 'input':
if (($values['type'] == 'text') || ($values['type'] == 'checkbox')) {
if ($values['type'] == 'text') {
$output = "<input type=\"" . $values['type'] . " name=\"" . $values['name'];
if ($values['size']) $output .= " size=\"" . $values['size'] . "\"";
if ($values['maxlength']) $output .= " maxlength=\"" . $values['maxlength'] . "\"";
if (isset($old_profile[$values['name']])) $output .= " value=\"" . $old_profile[$values['name']][0] . "\"";
elseif ($values['value']) $output .= " value=\"" . $values['value'] . "\"";
if ($values['disabled']) $output .= " disabled";
$output .= "></td>\n";
echo $output;
}
elseif ($values['type'] == 'checkbox') {
$output = "<input type=\"" . $values['type'] . " name=\"" . $values['name'];
if ($values['size']) $output .= " size=\"" . $values['size'] . "\"";
if ($values['maxlength']) $output .= " maxlength=\"" . $values['maxlength'] . "\"";
if ($values['value']) $output .= " value=\"" . $values['value'] . "\"";
if ($values['disabled']) $output .= " disabled";
if (isset($old_profile[$values['name']]) && ($old_profile[$values['name']][0] == true)) $output .= " checked";
elseif ($values['checked']) $output .= " checked";
$output .= "></td>\n";
echo $output;
}
}
break;
// select box
case 'select':
echo "<select name=\"" . $values['name'] . "\" size=\"" . $values['size'] . "\"";
if ($values['multiple']) $output .= " multiple";
echo "\">\n";
// option values
for ($i = 0; $i < sizeof($values['options']); $i++) {
// use values from old profile if given
if (isset($old_profile[$values['name']])) {
if (in_array($values['options'][$i], $old_profile[$values['name']])) {
echo "<option selected>" . $values['options'][$i] . "</option>\n";
}
else {
echo "<option>" . $values['options'][$i] . "</option>\n";
}
}
// use default values if not in profile
else {
if (in_array($values['options'][$i], $values['options_selected'])) {
echo "<option selected>" . $values['options'][$i] . "</option>\n";
}
else {
echo "<option>" . $values['options'][$i] . "</option>\n";
}
}
}
echo "</select>\n";
break;
default:
echo "<td>" . _("Unrecognized type") . ": " . $values['kind'] . "</td>\n";
break;
}
echo "</td>";
}
?>

View File

@ -1,435 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2003 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Manages creating/changing of profiles.
*/
include_once("../../lib/profiles.inc");
include_once("../../lib/ldap.inc");
include_once("../../lib/account.inc");
include_once("../../lib/config.inc");
// start session
session_save_path("../../sess");
@session_start();
setlanguage();
// check if user is logged in, if not go to login
if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
metaRefresh("../login.php");
exit;
}
// load quota list
if ($_SESSION['config']->get_scriptPath()) {
$tempacc = new account();
$tempacc->type = "user";
$acct_q = getquotas(array($tempacc));
}
// print header
echo $_SESSION['header'];
echo "<title></title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body><br>\n";
$acct = new Account();
// get list of login shells
$shelllist = file('../../config/shells');
$hells = array();
for ($i = 0; $i < sizeof($shelllist); $i++) {
$shelllist[$i] = chop($shelllist[$i]);
$shelllist[$i] = trim($shelllist[$i]);
if ($shelllist[$i] != "") $shells[sizeof($shells)] = $shelllist[$i];
}
// check if profile should be edited
if ($_GET['edit']) {
$acct = loadUserProfile($_GET['edit']);
}
// search available groups
$groups = findgroups();
// calculate date for unix password expiry
if ($acct->unix_pwdexpire) {
$tstamp = $acct->unix_pwdexpire;
$tdate = date(dmY, $acct->unix_pwdexpire);
$unix_pwdexpire_day = substr($tdate, 0, 2);
$unix_pwdexpire_mon = substr($tdate, 2, 2);
$unix_pwdexpire_yea = substr($tdate, 4, 4);
}
// display formular
echo ("<form action=\"profilecreate.php?type=user\" method=\"post\">\n");
// Unix part
echo ("<fieldset><legend><b>" . _("Unix account") . "</b></legend>\n");
echo ("<table border=0>\n");
// primary group
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Primary group") . ": </b></td>\n");
echo ("<td><select name=\"general_group\">\n");
for ($i = 0; $i < sizeof($groups); $i++) {
if ($acct->general_group == $groups[$i]) echo ("<option selected>" . $groups[$i] . "</option>\n");
else echo ("<option>" . $groups[$i] . "</option>\n");
}
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=406\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// additional groups
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Additional groups") . ": </b></td>\n");
echo ("<td><select name=\"general_groupadd[]\" size=5 multiple>\n");
for ($i = 0; $i < sizeof($groups); $i++) {
if ($acct->general_groupadd && in_array($groups[$i], $acct->general_groupadd)) echo ("<option selected>" . $groups[$i] . "</option>\n");
else echo ("<option>" . $groups[$i] . "</option>\n");
}
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=402\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// empty row
echo ("<tr><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td></tr>\n");
// path to home directory
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Home Directory") . ": </b></td>\n");
echo ("<td><input type=\"text\" value=\"" . $acct->general_homedir . "\" name=\"general_homedir\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=403\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// login shell
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Login shell") . ": </b></td>\n");
echo ("<td><select name=\"general_shell\">\n");
for ($i = 0; $i < sizeof($shells); $i++) {
if ($shells[$i] == $acct->general_shell) echo ("<option selected>" . $shells[$i] . "</option>\n");
else echo ("<option>" . $shells[$i] . "</option>\n");
}
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=405\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// empty row
echo ("<tr><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td></tr>\n");
// no Unix password
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Set Unix Password") . ": </b></td>\n");
echo ("<td><select name=\"unix_password_no\">\n");
if ($acct->unix_password_no == "1") echo ("<option selected value=1>"._("no")."</option><option value=0>"._("yes")."</option>\n");
else echo ("<option selected value=0>"._("yes")."</option><option value=1>"._("no")."</option>\n");
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=426\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// Unix: password expiry warn
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Password warning") . ": </b></td>\n");
echo ("<td><input type=\"text\" name=\"unix_pwdwarn\" value=\"" . $acct->unix_pwdwarn . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=414\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// Unix: password expiry
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Password expiry") . ": </b></td>\n");
echo ("<td><input type=\"text\" name=\"unix_pwdallowlogin\" value=\"" . $acct->unix_pwdallowlogin . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=415\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// maximum password age
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Maximum password age") . ": </b></td>\n");
echo ("<td><input type=\"text\" name=\"unix_pwdmaxage\" value=\"" . $acct->unix_pwdmaxage . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=416\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// minimum password age
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Minimum password age") . ": </b></td>\n");
echo ("<td><input type=\"text\" name=\"unix_pwdminage\" value=\"" . $acct->unix_pwdminage . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=417\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// password expire date
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Account expires on") . ": </b></td>\n");
echo ("<td>\n");
echo ("<select name=\"unix_pwdexpire_day\">\n");
for ( $i=1; $i<=31; $i++ ) {
if ($unix_pwdexpire_day == $i) echo "<option selected>$i</option>\n";
else echo "<option>$i</option>\n";
}
echo ("</select>\n");
echo ("<select name=\"unix_pwdexpire_mon\">\n");
for ( $i=1; $i<=12; $i++ ) {
if ($unix_pwdexpire_mon == $i) echo "<option selected>$i</option>\n";
else echo "<option>$i</option>\n";
}
echo ("</select>\n");
echo ("<select name=\"unix_pwdexpire_yea\">");
for ( $i=2003; $i<=2030; $i++ ) {
if ($unix_pwdexpire_yea == $i) echo "<option selected>$i</option>\n";
else echo "<option>$i</option>\n";
}
echo ("</select></td>");
echo ("<td><a href=\"../help.php?HelpNumber=418\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// empty row
echo ("<tr><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td></tr>\n");
// unix workstations
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Unix workstations") . ": </b></td>\n");
echo ("<td><input type=\"text\" name=\"unix_host\" value=\"" . $acct->unix_host . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=466\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// empty row
echo ("<tr><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td></tr>\n");
// deactivate account
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Account is deactivated") . ": </b></td>\n");
echo ("<td><select name=\"unix_deactivated\">\n");
if ($acct->unix_deactivated == "1") echo ("<option selected value=1>"._("yes")."</option><option value=0>"._("no")."</option>\n");
else echo ("<option selected value=0>"._("no")."</option><option value=1>"._("yes")."</option>\n");
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=427\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
echo ("</table>\n");
echo ("</fieldset>\n");
echo ("<br>");
// Samba part
echo ("<fieldset><legend><b>" . _("Samba account") . "</b></legend>\n");
echo ("<table border=0>\n");
// no Samba password
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Set Samba password") . ": </b></td>\n");
echo ("<td><select name=\"smb_password_no\">\n");
if ($acct->smb_flags['N']) echo ("<option selected value=1>"._("no")."</option><option value=0>"._("yes")."</option>\n");
else echo ("<option selected value=0>"._("yes")."</option><option value=1>"._("no")."</option>\n");
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=426\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// use Unix password as Samba password
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Set Unix password for Samba") . ": </b></td>\n");
echo ("<td><select name=\"smb_useunixpwd\">\n");
if ($acct->smb_useunixpwd == "0") echo ("<option selected value=0>"._("no")."</option><option value=1>"._("yes")."</option>\n");
else echo ("<option selected value=1>"._("yes")."</option><option value=0>"._("no")."</option>\n");
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=301\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// password expires
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Password does not expire") . ": </b></td>\n");
echo ("<td><select name=\"smb_flagsX\">\n");
if ($acct->smb_flags['X'] == "0") echo ("<option selected value=0>"._("no")."</option><option value=1>"._("yes")."</option>\n");
else echo ("<option selected value=1>"._("yes")."</option><option value=0>"._("no")."</option>\n");
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=429\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// account is disabled
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Account is deactivated") . ": </b></td>\n");
echo ("<td><select name=\"smb_flagsD\">\n");
if ($acct->smb_flags['D'] == "0") echo ("<option selected value=0>"._("no")."</option><option value=1>"._("yes")."</option>\n");
else echo ("<option selected value=1>"._("yes")."</option><option value=0>"._("no")."</option>\n");
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=432\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// empty row
echo ("<tr><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td></tr>\n");
// drive letter for home directory
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Home drive") . ": </b></td>\n");
echo ("<td><select name=\"smb_homedrive\">\n");
if ($acct->smb_homedrive == "D:") echo "<option selected>D:</option>"; else echo "<option>D:</option>\n";
if ($acct->smb_homedrive == "E:") echo "<option selected>E:</option>"; else echo "<option>E:</option>\n";
if ($acct->smb_homedrive == "F:") echo "<option selected>F:</option>"; else echo "<option>F:</option>\n";
if ($acct->smb_homedrive == "G:") echo "<option selected>G:</option>"; else echo "<option>G:</option>\n";
if ($acct->smb_homedrive == "H:") echo "<option selected>H:</option>"; else echo "<option>H:</option>\n";
if ($acct->smb_homedrive == "I:") echo "<option selected>I:</option>"; else echo "<option>I:</option>\n";
if ($acct->smb_homedrive == "J:") echo "<option selected>J:</option>"; else echo "<option>J:</option>\n";
if ($acct->smb_homedrive == "K:") echo "<option selected>K:</option>"; else echo "<option>K:</option>\n";
if ($acct->smb_homedrive == "L:") echo "<option selected>L:</option>"; else echo "<option>L:</option>\n";
if ($acct->smb_homedrive == "M:") echo "<option selected>M:</option>"; else echo "<option>M:</option>\n";
if ($acct->smb_homedrive == "N:") echo "<option selected>N:</option>"; else echo "<option>N:</option>\n";
if ($acct->smb_homedrive == "O:") echo "<option selected>O:</option>"; else echo "<option>O:</option>\n";
if ($acct->smb_homedrive == "P:") echo "<option selected>P:</option>"; else echo "<option>P:</option>\n";
if ($acct->smb_homedrive == "Q:") echo "<option selected>Q:</option>"; else echo "<option>Q:</option>\n";
if ($acct->smb_homedrive == "R:") echo "<option selected>R:</option>"; else echo "<option>R:</option>\n";
if ($acct->smb_homedrive == "S:") echo "<option selected>S:</option>"; else echo "<option>S:</option>\n";
if ($acct->smb_homedrive == "T:") echo "<option selected>T:</option>"; else echo "<option>T:</option>\n";
if ($acct->smb_homedrive == "U:") echo "<option selected>U:</option>"; else echo "<option>U:</option>\n";
if ($acct->smb_homedrive == "V:") echo "<option selected>V:</option>"; else echo "<option>V:</option>\n";
if ($acct->smb_homedrive == "W:") echo "<option selected>W:</option>"; else echo "<option>W:</option>\n";
if ($acct->smb_homedrive == "X:") echo "<option selected>X:</option>"; else echo "<option>X:</option>\n";
if ($acct->smb_homedrive == "Y:") echo "<option selected>Y:</option>"; else echo "<option>Y:</option>\n";
if ($acct->smb_homedrive == "Z:") echo "<option selected>Z:</option>"; else echo "<option>Z:</option>\n";
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=433\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// path to home directory
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Home path") . ": </b></td>\n");
echo ("<td><input type=\"text\" value=\"" . $acct->smb_smbhome . "\" name=\"smb_smbhome\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=437\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// path to profile
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Profile path") . ": </b></td>\n");
echo ("<td><input type=\"text\" value=\"" . $acct->smb_profilePath . "\" name=\"smb_profilepath\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=435\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// path to logon scripts
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Script path") . ": </b></td>\n");
echo ("<td><input type=\"text\" value=\"" . $acct->smb_scriptPath . "\" name=\"smb_scriptPath\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=434\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// empty row
echo ("<tr><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td></tr>\n");
// workstations
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Workstations") . ": </b></td>\n");
echo ("<td><input type=\"text\" value=\"" . $acct->smb_smbuserworkstations . "\" name=\"smb_smbuserworkstations\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=436\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
// empty row
echo ("<tr><td>&nbsp</td><td>&nbsp</td><td>&nbsp</td></tr>\n");
// domain
echo ("<tr>\n");
echo ("<td align=\"right\"><b>" . _("Domain") . ": </b></td>\n");
if ($_SESSION['config']->is_samba3()) {
echo "<td><select name=\"smb_domain\">\n";
$doms = $_SESSION['ldap']->search_domains($_SESSION['config']->get_DomainSuffix());
for ($i = 0; $i < sizeof($doms); $i++) {
if (strtolower($acct->smb_domain->name) == strtolower($doms[$i]->name)) {
echo ("<option selected value=\"" . $acct->smb_domain->dn . "\">" . $acct->smb_domain->name . "</option>\n");
}
else {
echo ("<option value=\"" . $doms[$i]->dn . "\">" . $doms[$i]->name . "</option>\n");
}
}
echo "</select></td>\n";
}
else {
echo ("<td><input type=\"text\" value=\"" . $acct->smb_domain . "\" name=\"smb_domain\"></td>\n");
}
echo ("<td><a href=\"../help.php?HelpNumber=438\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
echo ("</table>\n");
echo ("</fieldset>\n");
// Quota settings if script is given
if ($_SESSION['config']->get_scriptPath()) {
echo ("<br>");
echo "<fieldset><legend><b>"._('Quota properties')."</b></legend>\n";
echo "<table border=0>\n";
// description line
echo "<tr>\n";
echo "<td align=\"center\"><b>" . _('Mountpoint') . "</b>&nbsp;&nbsp;</td>\n";
echo "<td align=\"center\"><b>" . _('Soft block limit') . "</b>&nbsp;&nbsp;</td>\n";
echo "<td align=\"center\"><b>" . _('Hard block limit') . "</b>&nbsp;&nbsp;</td>\n";
echo "<td align=\"center\"><b>" . _('Soft inode limit') . "</b>&nbsp;&nbsp;</td>\n";
echo "<td align=\"center\"><b>" . _('Hard inode limit') . "</b>&nbsp;&nbsp;</td>\n";
echo "</tr>\n";
// help line
echo "<tr><td align=\"center\"><a href=\"../help.php?HelpNumber=439\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
"<td align=\"center\"><a href=\"../help.php?HelpNumber=441\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
"<td align=\"center\"><a href=\"../help.php?HelpNumber=442\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
"<td align=\"center\"><a href=\"../help.php?HelpNumber=445\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
"<td align=\"center\"><a href=\"../help.php?HelpNumber=446\" target=\"lamhelp\">"._('Help').'</a></td>'."\n".
'</tr>'."\n";
// quota settings
for ($i = 0; $i < (sizeof($acct_q[0]->quota)); $i++) {
// load values from profile
for ($k = 0; $k < sizeof($acct->quota); $k++) {
// check for equal mountpoints
if ($acct->quota[$k][0] == $acct_q[0]->quota[$i][0]) {
$acct_q[0]->quota[$i][2] = $acct->quota[$i][2];
$acct_q[0]->quota[$i][3] = $acct->quota[$i][3];
$acct_q[0]->quota[$i][6] = $acct->quota[$i][6];
$acct_q[0]->quota[$i][7] = $acct->quota[$i][7];
}
}
echo "<tr>\n";
echo '<td>' . $acct_q[0]->quota[$i][0] . "<input type=\"hidden\" name=\"f_quota_" . $i . "_0\" value=\"" . $acct_q[0]->quota[$i][0] . "\"></td>\n"; // mountpoint
echo '<td align="center"><input name="f_quota_' . $i . '_2" type="text" size="12" maxlength="20" value="' . $acct_q[0]->quota[$i][2] . "\"></td>\n"; // blocks soft limit
echo '<td align="center"><input name="f_quota_' . $i . '_3" type="text" size="12" maxlength="20" value="' . $acct_q[0]->quota[$i][3] . "\"></td>\n"; // blocks hard limit
echo '<td align="center"><input name="f_quota_' . $i . '_6" type="text" size="12" maxlength="20" value="' . $acct_q[0]->quota[$i][6] . "\"></td>\n"; // inodes soft limit
echo '<td align="center"><input name="f_quota_' . $i . '_7" type="text" size="12" maxlength="20" value="' . $acct_q[0]->quota[$i][7] . "\"></td>\n"; // inodes hard limit
echo "</tr>\n";
}
echo "</table>\n";
// save number of mountpoints
echo "<input type=\"hidden\" name=\"quotacount\" value=\"" . (sizeof($acct_q[0]->quota)) . "\">\n";
echo "</fieldset>\n";
}
echo ("<br><br>\n");
// profile name and submit/abort buttons
echo ("<table border=0>\n");
echo ("<tr>\n");
echo ("<td><b>" . _("Profile name") . ":</b></td>\n");
echo ("<td><input type=\"text\" name=\"profname\" value=\"" . $_GET['edit'] . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=360\" target=\"lamhelp\">" . _("Help") . "</a></td>\n");
echo ("</tr>\n");
echo ("<tr>\n");
echo ("<td colspan=2>&nbsp</td>");
echo ("</tr>\n");
echo ("<tr>\n");
echo ("<td><input type=\"submit\" name=\"submit\" value=\"" . _("Save") . "\"></td>\n");
echo ("<td><input type=\"reset\" name=\"reset\" value=\"" . _("Reset") . "\">\n");
echo ("<input type=\"submit\" name=\"abort\" value=\"" . _("Abort") . "\"></td>\n");
echo ("<td>&nbsp</td>");
echo ("</tr>\n");
echo ("</table>\n");
echo ("</form></body></html>\n");