implemented host profiles

This commit is contained in:
Roland Gruber 2003-06-03 20:49:51 +00:00
parent 14b341db4c
commit 58e784d76f
2 changed files with 97 additions and 1 deletions

View File

@ -249,7 +249,28 @@ if ($_GET['type'] == "user") {
// save host profile
elseif ($_GET['type'] == "host") {
$acct = new account();
// check input
if ($_POST['general_group'] && eregi("^[a-z]([a-z0-9_\\-])*$", $_POST['general_group'])) {
$acct->general_group = $_POST['general_group'];
}
else {
StatusMessage("ERROR", "", _("Primary group name is invalid!") . " " . $_POST['general_group']);
echo ("<br><br><a href=\"javascript:history.back()\">" . _("Back to profile editor...") . "</a>");
exit;
}
if ($_POST['smb_domain'] && eregi("^[a-z0-9_\\-]+$", $_POST['smb_domain'])) {
$acct->smb_domain = $_POST['smb_domain'];
}
elseif ($_POST['smb_domain']) {
StatusMessage("ERROR", "", _("Domain name is invalid!") . " " . $_POST['smb_domain']);
echo ("<br><br><a href=\"javascript:history.back()\">" . _("Back to profile editor...") . "</a>");
exit;
}
// save profile
saveHostProfile($acct, $profname);
echo ("<br><br><p align=\"center\"><big><b>" . _("Profile ") . $profname . _(" was saved.") . "</b></big></p>");
echo ("<br><p><a href=\"profilemain.php\">" . _("Back to profile editor") . "</a></p>");
}
// error: no or wrong type

View File

@ -25,6 +25,7 @@ $Id$
include_once("../../lib/profiles.inc");
include_once("../../lib/ldap.inc");
include_once("../../lib/account.inc");
// start session
session_save_path("../../sess");
@ -36,3 +37,77 @@ if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
exit;
}
// print header
echo ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
echo ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
echo ("<html><head>\n<title></title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n</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=370\" 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");
echo ("<td><input type=\"text\" value=\"" . $acct->smb_domain . "\" name=\"smb_domain\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=371\" 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=380\" 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");
?>