LDAPAccountManager/lam/templates/config/confmain.php

557 lines
21 KiB
PHP
Raw Normal View History

<?php
2003-02-25 21:28:17 +00:00
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
2004-02-01 12:33:21 +00:00
Copyright (C) 2003-04 Roland Gruber
2003-02-25 21:28:17 +00:00
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.
2003-05-09 16:22:46 +00:00
2003-02-25 21:28:17 +00:00
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.
2003-05-09 16:22:46 +00:00
2003-02-25 21:28:17 +00:00
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
2004-06-02 12:48:54 +00:00
*/
2003-05-09 16:22:46 +00:00
2004-06-02 12:48:54 +00:00
/**
* Main page of configuration
*
* @package configuration
* @author Roland Gruber
2003-02-25 21:28:17 +00:00
*/
2004-06-02 12:48:54 +00:00
/** Access to config functions */
include_once ("../../lib/config.inc");
/** access to module settings */
include_once ("../../lib/modules.inc");
2003-03-23 18:38:47 +00:00
// start session
2003-04-23 19:13:55 +00:00
session_save_path("../../sess");
2003-06-24 15:50:38 +00:00
@session_start();
2003-07-06 17:54:11 +00:00
setlanguage();
2003-05-09 16:22:46 +00:00
// check if button was pressed and if we have to save the setting or go back to login
2004-09-19 08:30:42 +00:00
if (isset($_POST['back']) || isset($_POST['submitconf']) || isset($_POST['editmodules'])){
2003-05-09 16:22:46 +00:00
// save settings
2004-02-01 12:33:21 +00:00
if ($_POST['submitconf'] || $_POST['editmodules']){
2003-05-09 16:22:46 +00:00
// save HTTP-POST variables in session
$_SESSION['conf_passwd'] = $_POST['passwd'];
$_SESSION['conf_passwd1'] = $_POST['passwd1'];
$_SESSION['conf_passwd2'] = $_POST['passwd2'];
$_SESSION['conf_serverurl'] = $_POST['serverurl'];
$_SESSION['conf_cachetimeout'] = $_POST['cachetimeout'];
$_SESSION['conf_admins'] = $_POST['admins'];
$_SESSION['conf_suffusers'] = $_POST['suffusers'];
$_SESSION['conf_suffgroups'] = $_POST['suffgroups'];
$_SESSION['conf_suffhosts'] = $_POST['suffhosts'];
$_SESSION['conf_suffdomains'] = $_POST['suffdomains'];
$_SESSION['conf_usrlstattr'] = $_POST['usrlstattr'];
$_SESSION['conf_grplstattr'] = $_POST['grplstattr'];
$_SESSION['conf_hstlstattr'] = $_POST['hstlstattr'];
$_SESSION['conf_maxlistentries'] = $_POST['maxlistentries'];
$_SESSION['conf_lang'] = $_POST['lang'];
$_SESSION['conf_scriptpath'] = $_POST['scriptpath'];
$_SESSION['conf_scriptserver'] = $_POST['scriptserver'];
2004-02-01 12:33:21 +00:00
$_SESSION['conf_usermodules'] = explode(",", $_POST['usermodules']);
$_SESSION['conf_groupmodules'] = explode(",", $_POST['groupmodules']);
$_SESSION['conf_hostmodules'] = explode(",", $_POST['hostmodules']);
$_SESSION['conf_filename'] = $_POST['filename'];
$modSettings = array_keys($_SESSION['config_types']);
for ($i = 0; $i < sizeof($modSettings); $i++) $_SESSION['config_moduleSettings'][$modSettings[$i]] = $_POST[$modSettings[$i]];
2004-02-01 12:33:21 +00:00
}
// go to final page
if ($_POST['submitconf']){
2003-08-28 12:41:47 +00:00
metaRefresh("confsave.php");
2003-05-09 16:22:46 +00:00
}
2004-02-01 12:33:21 +00:00
// go to modules page
elseif ($_POST['editmodules']){
metaRefresh("confmodules.php");
}
2003-05-09 16:22:46 +00:00
// back to login
else if ($_POST['back']){
2003-08-28 12:41:47 +00:00
metaRefresh("../login.php");
}
2003-05-09 16:22:46 +00:00
exit;
}
2003-05-02 16:52:19 +00:00
// get password if register_globals is off
2004-09-19 08:30:42 +00:00
if (isset($_POST['passwd'])) $passwd = $_POST['passwd'];
2004-09-25 13:24:30 +00:00
if (isset($_GET["modulesback"])) $passwd = $_SESSION['conf_passwd'];
2003-05-02 16:52:19 +00:00
2003-02-25 21:28:17 +00:00
// check if password was entered
2003-03-08 10:10:19 +00:00
// if not: load login page
2003-02-25 21:28:17 +00:00
if (! $passwd) {
2003-06-21 10:25:29 +00:00
$message = _("No password was entered!");
2004-06-02 12:48:54 +00:00
/** go back to login if password is empty */
2003-02-25 21:28:17 +00:00
require('conflogin.php');
exit;
}
2004-02-01 12:33:21 +00:00
$filename = $_POST['filename'];
2004-09-25 13:24:30 +00:00
if (isset($_GET["modulesback"])) $filename = $_SESSION['conf_filename'];
2004-02-01 12:33:21 +00:00
$conf = new Config($filename);
2003-02-25 21:28:17 +00:00
// check if password is valid
2003-03-08 10:10:19 +00:00
// if not: load login page
2003-02-25 21:28:17 +00:00
if (!(($conf->get_Passwd()) == $passwd)) {
2003-06-21 10:25:29 +00:00
$message = _("The password is invalid! Please try again.");
2004-06-02 12:48:54 +00:00
/** go back to login if password is invalid */
2003-02-25 21:28:17 +00:00
require('conflogin.php');
exit;
}
2004-02-01 12:33:21 +00:00
// check if user comes from modules page
2004-09-25 13:24:30 +00:00
if (isset($_GET["modulesback"])) {
2004-02-01 12:33:21 +00:00
// load config values from session
$conf->set_ServerURL($_SESSION['conf_serverurl']);
$conf->set_cacheTimeout($_SESSION['conf_cachetimeout']);
$conf->set_Adminstring($_SESSION['conf_admins']);
$conf->set_UserSuffix($_SESSION['conf_suffusers']);
$conf->set_GroupSuffix($_SESSION['conf_suffgroups']);
$conf->set_HostSuffix($_SESSION['conf_suffhosts']);
$conf->set_DomainSuffix($_SESSION['conf_suffdomains']);
$conf->set_userlistAttributes($_SESSION['conf_usrlstattr']);
$conf->set_grouplistAttributes($_SESSION['conf_grplstattr']);
$conf->set_hostlistAttributes($_SESSION['conf_hstlstattr']);
$conf->set_MaxListEntries($_SESSION['conf_maxlistentries']);
$conf->set_defaultLanguage($_SESSION['conf_lang']);
$conf->set_scriptpath($_SESSION['conf_scriptpath']);
$conf->set_scriptserver($_SESSION['conf_scriptserver']);
// check if modules were edited
if ($_GET["moduleschanged"] == "true") {
$conf->set_UserModules($_SESSION['conf_usermodules']);
$conf->set_GroupModules($_SESSION['conf_groupmodules']);
$conf->set_HostModules($_SESSION['conf_hostmodules']);
}
}
2004-08-14 13:21:40 +00:00
// index for tab order
$tabindex = 1;
2003-07-29 11:52:26 +00:00
echo $_SESSION['header'];
2003-05-28 21:44:41 +00:00
2003-02-25 21:28:17 +00:00
echo ("<title>" . _("LDAP Account Manager Configuration") . "</title>\n");
2003-06-24 15:50:38 +00:00
echo ("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n");
2003-02-25 21:28:17 +00:00
echo ("</head>\n");
echo ("<body>\n");
2003-05-09 16:22:46 +00:00
echo ("<p align=\"center\"><a href=\"http://lam.sf.net\" target=\"new_window\">".
2003-06-09 10:59:30 +00:00
"<img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p>\n<hr>\n<p></p>\n");
2003-05-09 16:22:46 +00:00
// display formular
echo ("<form action=\"confmain.php\" method=\"post\">\n");
echo ("<fieldset><legend><b>" . _("Server settings") . "</b></legend>");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>");
2003-05-09 16:22:46 +00:00
// serverURL
2003-08-02 09:05:47 +00:00
echo ("<tr><td align=\"right\"><b>" . _("Server address") . " *: </b></td>".
2003-05-28 21:44:41 +00:00
"<td align=\"left\">".
2004-08-14 13:21:40 +00:00
"<input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"serverurl\" value=\"" . $conf->get_ServerURL() . "\">".
2003-05-09 16:22:46 +00:00
"</td>\n");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=201\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-05-09 16:22:46 +00:00
// new line
2003-05-31 23:16:04 +00:00
echo ("<tr><td colspan=3>&nbsp</td></tr>");
2003-05-09 16:22:46 +00:00
// user suffix
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("UserSuffix") . " *: </b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffusers\" value=\"" . $conf->get_UserSuffix() . "\"></td>\n");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-05-09 16:22:46 +00:00
// group suffix
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("GroupSuffix") . " *: </b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffgroups\" value=\"" . $conf->get_GroupSuffix() . "\"></td>\n");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-05-09 16:22:46 +00:00
// host suffix
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2004-01-27 18:05:35 +00:00
_("HostSuffix") . " **: </b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffhosts\" value=\"" . $conf->get_HostSuffix() . "\"></td>\n");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-07-25 15:41:51 +00:00
// domain suffix
echo ("<tr><td align=\"right\"><b>".
2004-01-27 18:05:35 +00:00
_("DomainSuffix") . " ***: </b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffdomains\" value=\"" . $conf->get_DomainSuffix() . "\"></td>\n");
2003-10-04 12:34:19 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-10-04 12:34:19 +00:00
// new line
echo ("<tr><td colspan=3>&nbsp</td></tr>");
2003-08-18 15:21:27 +00:00
// LDAP cache timeout
echo ("<tr><td align=\"right\"><b>".
_("Cache timeout") . ": </b></td>".
2004-08-14 13:21:40 +00:00
"<td><select tabindex=\"$tabindex\" name=\"cachetimeout\">\n<option selected>".$conf->get_cacheTimeout()."</option>\n");
2003-08-18 15:21:27 +00:00
if ($conf->get_cacheTimeout() != 0) echo("<option>0</option>\n");
if ($conf->get_cacheTimeout() != 1) echo("<option>1</option>\n");
if ($conf->get_cacheTimeout() != 2) echo("<option>2</option>\n");
if ($conf->get_cacheTimeout() != 5) echo("<option>5</option>\n");
if ($conf->get_cacheTimeout() != 10) echo("<option>10</option>\n");
if ($conf->get_cacheTimeout() != 15) echo("<option>15</option>\n");
echo ("</select></td>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-08-18 15:21:27 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=214\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
2003-06-19 19:01:00 +00:00
echo ("</table>");
echo ("</fieldset>");
2004-02-01 12:33:21 +00:00
echo ("<p></p>");
echo ("<fieldset><legend><b>" . _("Account modules") . "</b></legend>");
echo ("<table border=0>");
// Account modules
echo "<tr><td><b>" . _("User modules") . ": </b>" . implode(", ", $conf->get_UserModules()) . "</td></tr>\n";
echo "<tr><td><b>" . _("Group modules") . ": </b>" . implode(", ", $conf->get_GroupModules()) . "</td></tr>\n";
echo "<tr><td><b>" . _("Host modules") . ": </b>" . implode(", ", $conf->get_HostModules()) . "</td></tr>\n";
echo "<tr><td>&nbsp;</td></tr>\n";
2004-08-14 13:21:40 +00:00
echo "<tr><td><input tabindex=\"$tabindex\" type=\"submit\" name=\"editmodules\" value=\"" . _("Edit modules") . "\">&nbsp;&nbsp;" .
2004-02-01 12:33:21 +00:00
"<a href=\"../help.php?HelpNumber=217\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n";
2004-08-14 13:21:40 +00:00
$tabindex++;
2004-02-01 12:33:21 +00:00
echo ("</table>");
echo ("</fieldset>");
2003-06-19 19:01:00 +00:00
echo ("<p></p>");
// module settings
// get list of scopes of modules
$scopes = array();
$mods = $conf->get_UserModules();
for ($i = 0; $i < sizeof($mods); $i++) $scopes[$mods[$i]][] = 'user';
$mods = $conf->get_GroupModules();
for ($i = 0; $i < sizeof($mods); $i++) $scopes[$mods[$i]][] = 'group';
$mods = $conf->get_HostModules();
for ($i = 0; $i < sizeof($mods); $i++) $scopes[$mods[$i]][] = 'host';
// get module options
$options = getConfigOptions($scopes);
// get current setting
$old_options = $conf->get_moduleSettings();
// get module descriptions
$moduleDescriptions = getConfigDescriptions();
// save scopes
$_SESSION['config_scopes'] = $scopes;
// display module boxes
$modules = array_keys($options);
for ($m = 0; $m < sizeof($modules); $m++) {
// ignore empty values
if (!is_array($options[$modules[$m]]) || (sizeof($options[$modules[$m]]) < 1)) continue;
echo "<fieldset>\n";
echo "<legend><b>" . $moduleDescriptions['legend'][$modules[$m]] . "</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";
if (isset($options[$modules[$m]][$l][$o]['align'])) echo " align=\"" . $options[$modules[$m]][$l][$o]['align'] . "\"";
if (isset($options[$modules[$m]][$l][$o]['colspan'])) echo " colspan=\"" . $options[$modules[$m]][$l][$o]['colspan'] . "\"";
if (isset($options[$modules[$m]][$l][$o]['rowspan'])) echo " rowspan=\"" . $options[$modules[$m]][$l][$o]['rowspan'] . "\"";
echo ">";
print_option($options[$modules[$m]][$l][$o], $modules[$m], $old_options, $tabindex);
echo "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
echo "</fieldset>\n";
echo "<br>";
}
2003-06-08 18:30:14 +00:00
echo ("<fieldset><legend><b>" . _("LDAP List settings") . "</b></legend>\n");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-09 16:22:46 +00:00
// user list attributes
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("Attributes in User List") . " *:</b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"usrlstattr\" value=\"" . $conf->get_userlistAttributes() . "\"></td>");
2003-06-08 18:30:14 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
// group list attributes
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("Attributes in Group List") . " *:</b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"grplstattr\" value=\"" . $conf->get_grouplistAttributes() . "\"></td>");
2003-06-08 18:30:14 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
// host list attributes
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2004-01-27 18:05:35 +00:00
_("Attributes in Host List") . " **:</b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"hstlstattr\" value=\"" . $conf->get_hostlistAttributes() . "\"></td>");
2003-06-08 18:30:14 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-05-15 18:21:44 +00:00
2003-06-08 18:30:14 +00:00
echo ("<tr><td colspan=3>&nbsp</td></tr>\n");
2003-05-15 18:21:44 +00:00
2003-05-09 16:22:46 +00:00
// maximum list entries
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2004-01-27 18:05:35 +00:00
_("Maximum list entries") . " : </b></td>".
2004-08-14 13:21:40 +00:00
"<td><select tabindex=\"$tabindex\" name=\"maxlistentries\">\n<option selected>".$conf->get_MaxListEntries()."</option>\n");
2003-06-08 18:30:14 +00:00
if ($conf->get_MaxListEntries() != 10) echo("<option>10</option>\n");
if ($conf->get_MaxListEntries() != 20) echo("<option>20</option>\n");
if ($conf->get_MaxListEntries() != 30) echo("<option>30</option>\n");
if ($conf->get_MaxListEntries() != 50) echo("<option>50</option>\n");
if ($conf->get_MaxListEntries() != 75) echo("<option>75</option>\n");
if ($conf->get_MaxListEntries() != 100) echo("<option>100</option>\n");
echo ("</select></td>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=208\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
echo ("</table>\n");
echo ("</fieldset>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>\n");
2003-05-09 16:22:46 +00:00
echo ("<fieldset><legend><b>" . _("Language settings") . "</b></legend>\n");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-09 16:22:46 +00:00
// language
echo ("<tr>");
2003-08-01 07:44:56 +00:00
echo ("<td><b>" . _("Default language") . ":</b></td><td>\n");
2003-05-09 16:22:46 +00:00
// read available languages
$languagefile = "../../config/language";
2003-05-09 16:22:46 +00:00
if(is_file($languagefile))
{
$file = fopen($languagefile, "r");
$i = 0;
while(!feof($file))
{
$line = fgets($file, 1024);
if($line == "\n" || $line[0] == "#" || $line == "") continue; // ignore comment and empty lines
$languages[$i] = chop($line);
2003-05-09 16:22:46 +00:00
$i++;
}
fclose($file);
// generate language list
2004-08-14 13:21:40 +00:00
echo ("<select tabindex=\"$tabindex\" name=\"lang\">");
2003-05-09 16:22:46 +00:00
for ($i = 0; $i < sizeof($languages); $i++) {
$entry = explode(":", $languages[$i]);
if ($conf->get_defaultLanguage() != $languages[$i]) echo("<option value=\"" . $languages[$i] . "\">" . $entry[2] . "</option>\n");
else echo("<option selected value=\"" . $languages[$i] . "\">" . $entry[2] . "</option>\n");
2003-05-09 16:22:46 +00:00
}
echo ("</select>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-05-09 16:22:46 +00:00
}
else
{
2003-09-07 10:15:35 +00:00
echo _("Unable to load available languages. Setting English as default language. For further instructions please contact the Admin of this site.");
2003-05-09 16:22:46 +00:00
}
2003-05-14 21:01:17 +00:00
echo ("</td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=209\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
echo ("</table>\n");
echo ("</fieldset>\n");
2003-11-15 10:35:58 +00:00
2003-06-09 10:59:30 +00:00
echo ("<p></p>\n");
2003-05-09 16:22:46 +00:00
2003-11-15 10:35:58 +00:00
// script settings
echo ("<fieldset><legend><b>" . _("Script settings") . "</b></legend>\n");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
_("Server of external script") . ": </b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"scriptserver\" value=\"" . $conf->get_scriptServer() . "\"></td>\n");
$tabindex++;
echo ("<td><a href=\"../help.php?HelpNumber=211\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-01-02 13:23:31 +00:00
echo ("<tr><td align=\"right\"><b>".
_("Path to external script") . ": </b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"scriptpath\" value=\"" . $conf->get_scriptPath() . "\"></td>\n");
$tabindex++;
2004-01-02 13:23:31 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=210\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
echo ("</table>\n");
echo ("</fieldset>\n");
2003-11-15 10:35:58 +00:00
echo ("<p></p>\n");
2003-06-24 15:50:38 +00:00
// security setings
echo ("<fieldset><legend><b>" . _("Security settings") . "</b></legend>\n");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-15 18:21:44 +00:00
// admin list
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("List of valid users") . " *: </b></td>".
2004-08-14 13:21:40 +00:00
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"admins\" value=\"" . $conf->get_Adminstring() . "\"></td>\n");
2003-05-15 18:21:44 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=207\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2003-05-15 18:21:44 +00:00
2004-02-01 12:33:21 +00:00
echo ("<tr><td colspan=3>&nbsp;</td></tr>\n");
2003-05-15 18:21:44 +00:00
2003-05-09 16:22:46 +00:00
// new password
2004-02-01 12:33:21 +00:00
echo ("<tr><td align=\"right\"><font color=\"red\"><b>".
_("New Password") . ": </b></font></td>".
2004-08-14 13:21:40 +00:00
"<td align=\"left\"><input tabindex=\"$tabindex\" type=\"password\" name=\"passwd1\"></td>\n");
$tabindex++;
echo ("<td rowspan=2><a href=\"../help.php?HelpNumber=212\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// reenter password
2004-02-01 12:33:21 +00:00
echo ("<tr><td align=\"right\"><font color=\"red\"><b>".
_("Reenter Password") . ": </b></font></td>".
2004-08-14 13:21:40 +00:00
"<td align=\"left\"><input tabindex=\"$tabindex\" type=\"password\" name=\"passwd2\"></td></tr>\n");
$tabindex++;
echo ("</table>\n");
2003-06-08 18:30:14 +00:00
echo ("</fieldset>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>\n");
2003-05-09 16:22:46 +00:00
2003-05-09 16:22:46 +00:00
// buttons
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-09 16:22:46 +00:00
2004-08-14 13:21:40 +00:00
echo "<tr>";
echo "<td align=\"left\"><pre>";
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"submitconf\" value=\"" . _("Submit") . "\">";
$tabindex++;
echo "<input tabindex=\"$tabindex\" type=\"reset\" name=\"resetconf\" value=\"" . _("Reset") . "\">";
$tabindex++;
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"back\" value=\"" . _("Abort") . "\"\n";
$tabindex++;
2003-05-09 16:22:46 +00:00
echo ("></pre></td></tr>\n");
echo ("</table>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>");
2003-07-25 15:41:51 +00:00
echo ("<p>* = ". _("required") . "</p>");
2004-01-27 18:05:35 +00:00
echo ("<p>** = ". _("required for Samba accounts") . "</p>");
echo ("<p>*** = ". _("required for Samba 3 accounts") . "</p>");
2003-07-25 15:41:51 +00:00
2003-05-09 16:22:46 +00:00
// password for configuration
2003-06-09 10:59:30 +00:00
echo ("<p><input type=\"hidden\" name=\"passwd\" value=\"" . $passwd . "\"></p>\n");
2003-05-09 16:22:46 +00:00
2003-07-06 10:24:41 +00:00
// config file
2004-02-01 12:33:21 +00:00
echo ("<p><input type=\"hidden\" name=\"filename\" value=\"" . $filename . "\"></p>\n");
// modules
echo ("<p><input type=\"hidden\" name=\"usermodules\" value=\"" . implode(",", $conf->get_UserModules()) . "\"></p>\n");
echo ("<p><input type=\"hidden\" name=\"groupmodules\" value=\"" . implode(",", $conf->get_GroupModules()) . "\"></p>\n");
echo ("<p><input type=\"hidden\" name=\"hostmodules\" value=\"" . implode(",", $conf->get_HostModules()) . "\"></p>\n");
2003-07-06 10:24:41 +00:00
2003-02-25 21:28:17 +00:00
echo ("</form>\n");
echo ("</body>\n");
echo ("</html>\n");
/**
* prints out the row of a section table including the option name, values and help
*
* @param array $values an array formated as module option
* @param string $module_name the name of the module the options belong to
* @param array $old_options a hash array with the values from the loaded profile
* @param integer $tabindex current value for tabulator order
*/
function print_option($values, $modulename, $old_options, &$tabindex) {
switch ($values['kind']) {
// text value
case 'text':
echo $values['text'] . "\n";
break;
// help link
case 'help':
echo "<a href=../help.php?module=$modulename&amp;HelpNumber=" . $values['value'] . ">" . _('Help') . "</a>\n";
break;
// input field
case 'input':
if (($values['type'] == 'text') || ($values['type'] == 'checkbox')) {
if ($values['type'] == 'text') {
$output = "<input tabindex=\"$tabindex\" type=\"text\" name=\"" . $values['name'] . "\"";
if ($values['size']) $output .= " size=\"" . $values['size'] . "\"";
if ($values['maxlength']) $output .= " maxlength=\"" . $values['maxlength'] . "\"";
if (isset($old_options[$values['name']])) $output .= " value=\"" . $old_options[$values['name']][0] . "\"";
elseif ($values['value']) $output .= " value=\"" . $values['value'] . "\"";
if ($values['disabled']) $output .= " disabled";
$output .= ">\n";
echo $output;
$_SESSION['config_types'][$values['name']] = "text";
}
elseif ($values['type'] == 'checkbox') {
$output = "<input tabindex=\"$tabindex\" type=\"checkbox\" name=\"" . $values['name'] . "\"";
if ($values['size']) $output .= " size=\"" . $values['size'] . "\"";
if ($values['maxlength']) $output .= " maxlength=\"" . $values['maxlength'] . "\"";
if ($values['disabled']) $output .= " disabled";
if (isset($old_options[$values['name']]) && ($old_options[$values['name']][0] == 'true')) $output .= " checked";
elseif ($values['checked']) $output .= " checked";
$output .= ">\n";
echo $output;
$_SESSION['config_types'][$values['name']] = "checkbox";
}
$tabindex++;
}
break;
// select box
case 'select':
if (! is_numeric($values['size'])) $values['size'] = 1;// correct size if needed
if ($values['multiple']) {
echo "<select tabindex=\"$tabindex\" name=\"" . $values['name'] . "[]\" size=\"" . $values['size'] . "\" multiple>\n";
$_SESSION['config_types'][$values['name']] = "multiselect";
}
else {
echo "<select tabindex=\"$tabindex\" name=\"" . $values['name'] . "\" size=\"" . $values['size'] . "\">\n";
$_SESSION['config_types'][$values['name']] = "select";
}
// option values
for ($i = 0; $i < sizeof($values['options']); $i++) {
// use values from old profile if given
if (isset($old_options[$values['name']])) {
if (in_array($values['options'][$i], $old_options[$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 (is_array($values['options_selected']) && 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";
$tabindex++;
break;
// subtable
case 'table':
echo "<table>\n";
for ($l = 0; $l < sizeof($values['value']); $l++) { // option lines
echo "<tr>\n";
for ($o = 0; $o < sizeof($values['value'][$l]); $o++) { // line parts
echo "<td>";
print_option($values['value'][$l][$o], $values['value'], $old_options, $tabindex);
echo "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
break;
// print error message for invalid types
default:
echo _("Unrecognized type") . ": " . $values['kind'] . "\n";
break;
}
}
2003-02-25 21:28:17 +00:00
?>