made host management optional

This commit is contained in:
Roland Gruber 2004-01-27 18:05:35 +00:00
parent 4645448603
commit bcb60e5dea
3 changed files with 41 additions and 28 deletions

View File

@ -386,7 +386,8 @@ class Config {
// $value: new host suffix
// returns true if $value has correct format
function set_HostSuffix($value) {
if (is_string($value) && (eregi("^(([a-z0-9 \\-])*=([a-z0-9 \\-])*)(,([a-z0-9 \\-])*=([a-z0-9 \\-])*)*$", $value))) {
if (! $value) $this->hostsuffix = "";
elseif (is_string($value) && (eregi("^(([a-z0-9 \\-])*=([a-z0-9 \\-])*)(,([a-z0-9 \\-])*=([a-z0-9 \\-])*)*$", $value))) {
$this->hostsuffix = $value;
}
else return false;
@ -475,7 +476,8 @@ class Config {
// $value: new minimum machine number
// returns true if $value has correct format
function set_minMachine($value) {
if (is_numeric($value)) $this->MinMachine = $value;
if (! $value && ($this->hostsuffix == "")) $this->MinMachine = "";
elseif (is_numeric($value)) $this->MinMachine = $value;
else return false;
return true;
}
@ -489,7 +491,8 @@ class Config {
// $value: new maximum machine number
// returns true if $value has correct format
function set_maxMachine($value) {
if (is_numeric($value)) $this->MaxMachine = $value;
if (! $value && ($this->hostsuffix == "")) $this->MaxMachine = "";
elseif (is_numeric($value)) $this->MaxMachine = $value;
else return false;
return true;
}
@ -535,7 +538,8 @@ class Config {
// $value: new attribute string
// returns true if $value has correct format
function set_hostlistAttributes($value) {
if (is_string($value) && eregi("^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$", $value)) {
if (! $value && ($this->hostsuffix == "")) $this->hostlistAttributes = "";
elseif (is_string($value) && eregi("^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$", $value)) {
$this->hostlistAttributes = $value;
}
else return false;

View File

@ -130,12 +130,12 @@ echo ("<tr><td align=\"right\"><b>".
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
// host suffix
echo ("<tr><td align=\"right\"><b>".
_("HostSuffix") . " *: </b></td>".
_("HostSuffix") . " **: </b></td>".
"<td><input size=50 type=\"text\" name=\"suffhosts\" value=\"" . $conf->get_HostSuffix() . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
// domain suffix
echo ("<tr><td align=\"right\"><b>".
_("DomainSuffix") . " **: </b></td>".
_("DomainSuffix") . " ***: </b></td>".
"<td><input size=50 type=\"text\" name=\"suffdomains\" value=\"" . $conf->get_DomainSuffix() . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
@ -144,7 +144,7 @@ echo ("<tr><td colspan=3>&nbsp</td></tr>");
// LDAP password hash type
echo ("<tr><td align=\"right\"><b>".
_("Password hash type") . " *: </b></td>".
_("Password hash type") . " : </b></td>".
"<td><select name=\"pwdhash\">\n<option selected>" . $conf->get_pwdhash() . "</option>\n");
if ($conf->get_pwdhash() != "CRYPT") echo("<option>CRYPT</option>\n");
if ($conf->get_pwdhash() != "SHA") echo("<option>SHA</option>\n");
@ -160,7 +160,7 @@ echo ("<tr><td colspan=3>&nbsp</td></tr>");
// LDAP cache timeout
echo ("<tr><td align=\"right\"><b>".
_("Cache timeout") . " *: </b></td>".
_("Cache timeout") . " : </b></td>".
"<td><select name=\"cachetimeout\">\n<option selected>".$conf->get_cacheTimeout()."</option>\n");
if ($conf->get_cacheTimeout() != 0) echo("<option>0</option>\n");
if ($conf->get_cacheTimeout() != 1) echo("<option>1</option>\n");
@ -180,8 +180,9 @@ echo ("<table border=0>");
// Samba version
echo ("<tr><td align=\"right\"><b>".
_("Samba 3.x schema") . ": </b></td><td><select name=\"samba3\">\n");
if ($conf->is_samba3()) echo ("<option>yes</option><option>no</option></select></td>");
_("Manage Samba 3 accounts") . ": </b></td><td><select name=\"samba3\">\n");
if ($conf->is_samba3()) echo ("<option value=\"yes\">" . _("yes") . "</option>
<option value=\"no\">" . _("no") . "</option></select></td>");
else echo ("<option>no</option><option>yes</option></select></td>");
echo ("<td><a href=\"../help.php?HelpNumber=213\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
@ -212,10 +213,10 @@ echo ("<td align=\"right\"><b>" . _("Maximum GID number")." *: </b>".
echo ("<td><a href=\"../help.php?HelpNumber=204\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
// minMach
echo ("<tr><td align=\"right\"><b>".
_("Minimum Machine number") . " *: </b>".
_("Minimum Machine number") . " **: </b>".
"<input size=6 type=\"text\" name=\"minMach\" value=\"" . $conf->get_minMachine() . "\"></td>\n");
// maxMach
echo ("<td align=\"right\"><b>" . _("Maximum Machine number") . " *: </b>".
echo ("<td align=\"right\"><b>" . _("Maximum Machine number") . " **: </b>".
"<input size=6 type=\"text\" name=\"maxMach\" value=\"" . $conf->get_maxMachine() . "\"></td>\n");
// Machine text
echo ("<td><a href=\"../help.php?HelpNumber=205\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
@ -239,7 +240,7 @@ echo ("<tr><td align=\"right\"><b>".
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
// host list attributes
echo ("<tr><td align=\"right\"><b>".
_("Attributes in Host List") . " *:</b></td>".
_("Attributes in Host List") . " **:</b></td>".
"<td><input size=50 type=\"text\" name=\"hstlstattr\" value=\"" . $conf->get_hostlistAttributes() . "\"></td>");
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
@ -247,7 +248,7 @@ echo ("<tr><td colspan=3>&nbsp</td></tr>\n");
// maximum list entries
echo ("<tr><td align=\"right\"><b>".
_("Maximum list entries") . " *: </b></td>".
_("Maximum list entries") . " : </b></td>".
"<td><select name=\"maxlistentries\">\n<option selected>".$conf->get_MaxListEntries()."</option>\n");
if ($conf->get_MaxListEntries() != 10) echo("<option>10</option>\n");
if ($conf->get_MaxListEntries() != 20) echo("<option>20</option>\n");
@ -377,7 +378,8 @@ echo ("</table>\n");
echo ("<p></p>");
echo ("<p>* = ". _("required") . "</p>");
echo ("<p>** = ". _("required for Samba 3 schema") . "</p>");
echo ("<p>** = ". _("required for Samba accounts") . "</p>");
echo ("<p>*** = ". _("required for Samba 3 accounts") . "</p>");
// password for configuration
echo ("<p><input type=\"hidden\" name=\"passwd\" value=\"" . $passwd . "\"></p>\n");

View File

@ -31,6 +31,12 @@ session_save_path("../sess");
setlanguage();
echo $_SESSION['header'];
// number of list views (users, groups, ...)
$lists = 2;
if ($_SESSION['config']->is_samba3()) $lists++;
if ($_SESSION['config']->get_Hostsuffix() != "") $lists++;
?>
<title></title>
@ -42,9 +48,7 @@ echo $_SESSION['header'];
<tr>
<td width="100" align="left"><a href="./profedit/profilemain.php" target="mainpart"><?php echo _("Profile Editor"); ?></a></td>
<?php
// Samba 3 has more list views
if ($_SESSION['config']->is_samba3()) echo "<td rowspan=3 colspan=4 align=\"center\">\n";
else echo "<td rowspan=3 colspan=3 align=\"center\">\n";
echo "<td rowspan=3 colspan=$lists align=\"center\">\n";
?>
<a href="http://lam.sf.net" target="new_window"><img src="../graphics/banner.jpg" border=1 alt="LDAP Account Manager"></a>
</td>
@ -59,9 +63,8 @@ echo $_SESSION['header'];
</tr>
<tr>
<?php
// Samba 3 has more list views
if ($_SESSION['config']->is_samba3()) echo "<td colspan=6>&nbsp;</td>\n";
else echo "<td colspan=5>&nbsp;</td>\n";
$temp = $lists + 2;
echo "<td colspan=$temp><font size=1>&nbsp;</font></td>\n";
?>
</tr>
<tr>
@ -69,15 +72,19 @@ echo $_SESSION['header'];
<?php
// Samba 3 has more list views
if ($_SESSION['config']->is_samba3()) {
echo '<td width="120" align="center"><a href="./lists/listdomains.php" target="mainpart">' . _("Domains") . '</a></td>' . "\n";
echo '<td width="120" align="center"><a href="./lists/listusers.php" target="mainpart">' . _("Users") . '</a></td>' . "\n";
echo '<td width="120" align="center"><a href="./lists/listgroups.php" target="mainpart">' . _("Groups") . '</a></td>' . "\n";
echo '<td width="120" align="center"><a href="./lists/listhosts.php" target="mainpart">' . _("Hosts") . '</a></td>' . "\n";
echo '<td width="120" align="center"><a href="./lists/listdomains.php" target="mainpart"><big>' . _("Domains") . '</big></a></td>' . "\n";
echo '<td width="120" align="center"><a href="./lists/listusers.php" target="mainpart"><big>' . _("Users") . '</big></a></td>' . "\n";
echo '<td width="120" align="center"><a href="./lists/listgroups.php" target="mainpart"><big>' . _("Groups") . '</big></a></td>' . "\n";
if ($_SESSION['config']->get_Hostsuffix() != "") {
echo '<td width="120" align="center"><a href="./lists/listhosts.php" target="mainpart"><big>' . _("Hosts") . '</big></a></td>' . "\n";
}
}
else {
echo '<td width="200" align="center"><a href="./lists/listusers.php" target="mainpart">' . _("Users") . '</a></td>' . "\n";
echo '<td width="200" align="center"><a href="./lists/listgroups.php" target="mainpart">' . _("Groups") . '</a></td>' . "\n";
echo '<td width="200" align="center"><a href="./lists/listhosts.php" target="mainpart">' . _("Hosts") . '</a></td>' . "\n";
echo '<td width="200" align="center"><a href="./lists/listusers.php" target="mainpart"><big>' . _("Users") . '</big></a></td>' . "\n";
echo '<td width="200" align="center"><a href="./lists/listgroups.php" target="mainpart"><big>' . _("Groups") . '</big></a></td>' . "\n";
if ($_SESSION['config']->get_Hostsuffix() != "") {
echo '<td width="200" align="center"><a href="./lists/listhosts.php" target="mainpart"><big>' . _("Hosts") . '</big></a></td>' . "\n";
}
}
?>
<td></td>