2003-03-05 16:05:23 +00:00
|
|
|
<?php
|
2003-02-25 21:28:17 +00:00
|
|
|
/*
|
|
|
|
$Id$
|
|
|
|
|
|
|
|
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
|
2006-03-03 17:30:35 +00:00
|
|
|
Copyright (C) 2003 - 2006 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 */
|
2006-03-26 17:51:25 +00:00
|
|
|
include_once("../../lib/config.inc");
|
2003-05-09 17:43:38 +00:00
|
|
|
|
2004-07-24 17:14:39 +00:00
|
|
|
/** access to module settings */
|
2006-03-26 17:51:25 +00:00
|
|
|
include_once("../../lib/modules.inc");
|
2004-07-24 17:14:39 +00:00
|
|
|
|
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-03-17 19:14:22 +00:00
|
|
|
|
2003-07-06 17:54:11 +00:00
|
|
|
setlanguage();
|
|
|
|
|
2006-01-31 16:57:12 +00:00
|
|
|
// get password
|
2004-09-19 08:30:42 +00:00
|
|
|
if (isset($_POST['passwd'])) $passwd = $_POST['passwd'];
|
2006-01-31 16:57:12 +00:00
|
|
|
if (isset($_GET["modulesback"]) || isset($_GET["typesback"])) $passwd = $_SESSION['conf_config']->get_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) {
|
2006-01-31 16:57:12 +00:00
|
|
|
$_SESSION['conf_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;
|
|
|
|
}
|
|
|
|
|
2006-01-31 16:57:12 +00:00
|
|
|
if (!isset($_SESSION['conf_config']) && isset($_POST['filename'])) {
|
2006-09-24 14:19:50 +00:00
|
|
|
$_SESSION['conf_config'] = new LAMConfig($_POST['filename']);
|
2006-01-31 16:57:12 +00:00
|
|
|
}
|
|
|
|
$conf = &$_SESSION['conf_config'];
|
2004-02-01 12:33:21 +00:00
|
|
|
|
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)) {
|
2006-01-31 16:57:12 +00:00
|
|
|
$sessionKeys = array_keys($_SESSION);
|
|
|
|
for ($i = 0; $i < sizeof($sessionKeys); $i++) {
|
|
|
|
if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]);
|
|
|
|
}
|
|
|
|
$_SESSION['conf_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;
|
|
|
|
}
|
|
|
|
|
2006-01-31 16:57:12 +00:00
|
|
|
// check if button was pressed and if we have to save the setting or go back to login
|
|
|
|
if (isset($_POST['back']) || isset($_POST['submitconf']) || isset($_POST['editmodules']) || isset($_POST['edittypes'])){
|
|
|
|
// go to final page
|
|
|
|
if ($_POST['submitconf']){
|
|
|
|
saveSettings();
|
|
|
|
}
|
|
|
|
// go to modules page
|
|
|
|
elseif ($_POST['editmodules']){
|
|
|
|
metaRefresh("confmodules.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
// go to types page
|
|
|
|
elseif ($_POST['edittypes']){
|
|
|
|
metaRefresh("conftypes.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
// back to login
|
|
|
|
else if ($_POST['back']){
|
|
|
|
metaRefresh("../login.php");
|
|
|
|
exit;
|
|
|
|
}
|
2006-01-01 16:30:05 +00:00
|
|
|
}
|
|
|
|
|
2006-01-31 16:57:12 +00:00
|
|
|
|
2006-01-01 16:30:05 +00:00
|
|
|
// check if user comes from types page
|
|
|
|
if (isset($_GET["typesback"])) {
|
|
|
|
// check if a new account type was added
|
|
|
|
if (isset($_GET["typeschanged"])) {
|
|
|
|
metaRefresh("confmodules.php");
|
2006-09-24 14:19:50 +00:00
|
|
|
exit;
|
2004-02-01 12:33:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-01 16:30:05 +00:00
|
|
|
// type information
|
|
|
|
if (!isset($_SESSION['conf_accountTypes'])) $_SESSION['conf_accountTypes'] = $conf->get_ActiveTypes();
|
2006-01-08 17:34:14 +00:00
|
|
|
if (!isset($_SESSION['conf_accountTypesOld'])) $_SESSION['conf_accountTypesOld'] = $conf->get_ActiveTypes();
|
2006-01-01 16:30:05 +00:00
|
|
|
if (!isset($_SESSION['conf_typeSettings'])) $_SESSION['conf_typeSettings'] = $conf->get_typeSettings();
|
|
|
|
|
2004-08-14 13:21:40 +00:00
|
|
|
// index for tab order
|
|
|
|
$tabindex = 1;
|
2005-04-25 17:54:22 +00:00
|
|
|
$tabindexLink = 1000;
|
2004-08-14 13:21:40 +00:00
|
|
|
|
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");
|
2005-12-05 19:09:04 +00:00
|
|
|
echo ("<p align=\"center\"><a href=\"http://lam.sourceforge.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
|
|
|
|
2006-01-31 16:57:12 +00:00
|
|
|
// display error messages
|
|
|
|
if (isset($_SESSION['conf_errors'])) {
|
|
|
|
for ($i = 0; $i < sizeof($_SESSION['conf_errors']); $i++) {
|
|
|
|
call_user_func_array('StatusMessage', $_SESSION['conf_errors'][$i]);
|
|
|
|
}
|
|
|
|
echo "<br>";
|
|
|
|
}
|
|
|
|
|
2003-05-09 16:22:46 +00:00
|
|
|
// display formular
|
|
|
|
echo ("<form action=\"confmain.php\" method=\"post\">\n");
|
2003-05-06 23:52:21 +00:00
|
|
|
|
|
|
|
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");
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<td>";
|
|
|
|
echo "<a href=\"../help.php?HelpNumber=201\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
|
|
|
echo "</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> </td></tr>");
|
2003-05-09 16:22:46 +00:00
|
|
|
|
2005-02-27 12:40:06 +00:00
|
|
|
// tree suffix
|
|
|
|
echo ("<tr><td align=\"right\"><b>".
|
2006-01-01 16:30:05 +00:00
|
|
|
_("Tree suffix") . ": </b></td>".
|
2005-02-27 12:40:06 +00:00
|
|
|
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"sufftree\" value=\"" . $conf->get_Suffix('tree') . "\"></td>\n");
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<td>";
|
|
|
|
echo "<a href=\"../help.php?HelpNumber=203\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
|
|
|
echo "</td></tr>\n";
|
2005-02-27 12:40:06 +00:00
|
|
|
$tabindex++;
|
2003-10-04 12:34:19 +00:00
|
|
|
|
|
|
|
// new line
|
|
|
|
echo ("<tr><td colspan=3> </td></tr>");
|
|
|
|
|
2003-08-18 15:21:27 +00:00
|
|
|
// LDAP cache timeout
|
|
|
|
echo ("<tr><td align=\"right\"><b>".
|
2004-07-24 17:14:39 +00:00
|
|
|
_("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++;
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<td>";
|
|
|
|
echo "<a href=\"../help.php?HelpNumber=214\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
|
|
|
echo "</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>");
|
|
|
|
|
2006-01-01 16:30:05 +00:00
|
|
|
echo ("<fieldset><legend><b>" . _("Account types and modules") . "</b></legend>");
|
2004-02-01 12:33:21 +00:00
|
|
|
|
|
|
|
// Account modules
|
2006-01-31 16:57:12 +00:00
|
|
|
$types = $conf->get_ActiveTypes();
|
2006-01-01 16:30:05 +00:00
|
|
|
for ($i = 0; $i < sizeof($types); $i++) {
|
2006-11-13 17:43:21 +00:00
|
|
|
$moduleNames = $conf->get_AccountModules($types[$i]);
|
|
|
|
for ($m = 0; $m < sizeof($moduleNames); $m++) $moduleNames[$m] = getModuleAlias($moduleNames[$m], $types[$i]);
|
|
|
|
echo "<b>" . getTypeAlias($types[$i]) . ": </b>" . implode(", ", $moduleNames) . "<br>\n";
|
2006-01-01 16:30:05 +00:00
|
|
|
}
|
|
|
|
echo "<br>\n";
|
|
|
|
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"edittypes\" value=\"" . _("Edit account types") . "\"> ";
|
|
|
|
$tabindex++;
|
|
|
|
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"editmodules\" value=\"" . _("Edit modules") . "\"> ";
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<a href=\"../help.php?HelpNumber=217\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
2004-08-14 13:21:40 +00:00
|
|
|
$tabindex++;
|
2004-02-01 12:33:21 +00:00
|
|
|
|
|
|
|
echo ("</fieldset>");
|
|
|
|
|
2003-06-19 19:01:00 +00:00
|
|
|
echo ("<p></p>");
|
|
|
|
|
2004-07-24 17:14:39 +00:00
|
|
|
|
|
|
|
// module settings
|
|
|
|
|
|
|
|
// get list of scopes of modules
|
|
|
|
$scopes = array();
|
2006-01-01 16:30:05 +00:00
|
|
|
for ($m = 0; $m < sizeof($types); $m++) {
|
|
|
|
$mods = $conf->get_AccountModules($types[$m]);
|
|
|
|
for ($i = 0; $i < sizeof($mods); $i++) $scopes[$mods[$i]][] = $types[$m];
|
|
|
|
}
|
2004-07-24 17:14:39 +00:00
|
|
|
|
|
|
|
// get module options
|
|
|
|
$options = getConfigOptions($scopes);
|
|
|
|
// get current setting
|
|
|
|
$old_options = $conf->get_moduleSettings();
|
|
|
|
|
|
|
|
|
|
|
|
// display module boxes
|
|
|
|
$modules = array_keys($options);
|
2006-01-31 16:57:12 +00:00
|
|
|
$_SESSION['conf_types'] = array();
|
2005-04-25 17:54:22 +00:00
|
|
|
for ($i = 0; $i < sizeof($modules); $i++) {
|
|
|
|
if (sizeof($options[$modules[$i]]) < 1) continue;
|
2004-07-24 17:14:39 +00:00
|
|
|
echo "<fieldset>\n";
|
2006-11-13 17:43:21 +00:00
|
|
|
echo "<legend><b>" . getModuleAlias($modules[$i], "none") . "</b></legend>\n";
|
2005-04-25 17:54:22 +00:00
|
|
|
$configTypes = parseHtml($modules[$i], $options[$modules[$i]], $old_options, true, $tabindex, $tabindexLink, 'config');
|
2006-01-31 16:57:12 +00:00
|
|
|
$_SESSION['conf_types'] = array_merge($configTypes, $_SESSION['conf_types']);
|
2004-07-24 17:14:39 +00:00
|
|
|
echo "</fieldset>\n";
|
|
|
|
echo "<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-01 16:30:05 +00:00
|
|
|
echo ("<fieldset><legend><b>" . _("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
|
|
|
|
|
|
|
// 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");
|
2003-05-09 17:43:38 +00:00
|
|
|
echo ("</select></td>\n");
|
2004-08-14 13:21:40 +00:00
|
|
|
$tabindex++;
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<td>";
|
|
|
|
echo "<a href=\"../help.php?HelpNumber=208\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
|
|
|
echo "</td></tr>\n";
|
2003-05-09 16:22:46 +00:00
|
|
|
|
2003-05-12 17:52:54 +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
|
|
|
|
2003-05-12 17:52:54 +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
|
2003-05-12 17:52:54 +00:00
|
|
|
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
|
2003-07-15 14:28:41 +00:00
|
|
|
$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);
|
2003-05-12 17:52:54 +00:00
|
|
|
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]);
|
2003-12-27 10:26:42 +00:00
|
|
|
if ($conf->get_defaultLanguage() != $languages[$i]) echo("<option value=\"" . $languages[$i] . "\">" . $entry[2] . "</option>\n");
|
2003-05-12 17:52:54 +00:00
|
|
|
else echo("<option selected value=\"" . $languages[$i] . "\">" . $entry[2] . "</option>\n");
|
2003-05-09 16:22:46 +00:00
|
|
|
}
|
2003-05-12 17:52:54 +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");
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<td>";
|
|
|
|
echo "<a href=\"../help.php?HelpNumber=209\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
|
|
|
echo "</td></tr>\n";
|
2003-05-09 16:22:46 +00:00
|
|
|
|
2003-05-12 17:52:54 +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
|
2003-05-12 17:52:54 +00:00
|
|
|
echo ("<fieldset><legend><b>" . _("Script settings") . "</b></legend>\n");
|
2003-06-09 10:59:30 +00:00
|
|
|
echo ("<table border=0>\n");
|
2003-05-12 17:52:54 +00:00
|
|
|
|
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++;
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<td>";
|
|
|
|
echo "<a href=\"../help.php?HelpNumber=211\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
|
|
|
echo "</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++;
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<td>";
|
|
|
|
echo "<a href=\"../help.php?HelpNumber=210\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
|
|
|
echo "</td></tr>\n";
|
2003-05-09 16:22:46 +00:00
|
|
|
|
|
|
|
echo ("</table>\n");
|
2003-05-12 17:52:54 +00:00
|
|
|
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
|
2003-05-12 17:52:54 +00:00
|
|
|
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
|
2007-01-04 20:05:12 +00:00
|
|
|
$adminText = implode("\n", explode(";", $conf->get_Adminstring()));
|
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>".
|
2007-01-04 20:05:12 +00:00
|
|
|
"<td><textarea tabindex=\"$tabindex\" size=50 type=\"text\" name=\"admins\" cols=75 rows=5>" . $adminText . "</textarea></td>\n");
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<td>";
|
|
|
|
echo "<a href=\"../help.php?HelpNumber=207\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
|
|
|
echo "</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> </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>".
|
2006-07-29 08:43:07 +00:00
|
|
|
_("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++;
|
2005-04-26 15:50:29 +00:00
|
|
|
echo "<td rowspan=2>";
|
|
|
|
echo "<a href=\"../help.php?HelpNumber=212\" target=\"lamhelp\">";
|
|
|
|
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
|
|
|
|
echo "</a>\n";
|
|
|
|
echo "</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>".
|
2006-07-29 08:43:07 +00:00
|
|
|
_("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++;
|
2003-03-01 12:22:35 +00:00
|
|
|
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-06 23:52:21 +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>";
|
2006-03-04 10:49:55 +00:00
|
|
|
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"submitconf\" value=\"" . _("Ok") . "\">";
|
2004-08-14 13:21:40 +00:00
|
|
|
$tabindex++;
|
2006-04-16 12:43:53 +00:00
|
|
|
echo " ";
|
2006-03-04 10:49:55 +00:00
|
|
|
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"back\" value=\"" . _("Cancel") . "\"\n";
|
2004-08-14 13:21:40 +00:00
|
|
|
$tabindex++;
|
2003-05-09 16:22:46 +00:00
|
|
|
|
|
|
|
echo ("></pre></td></tr>\n");
|
|
|
|
|
2003-03-30 19:51:47 +00:00
|
|
|
echo ("</table>\n");
|
2003-05-06 23:52:21 +00:00
|
|
|
|
2003-06-09 10:59:30 +00:00
|
|
|
echo ("<p></p>");
|
|
|
|
|
2003-07-25 15:41:51 +00:00
|
|
|
echo ("<p>* = ". _("required") . "</p>");
|
2005-02-27 12:40:06 +00:00
|
|
|
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-02-25 21:28:17 +00:00
|
|
|
echo ("</form>\n");
|
|
|
|
echo ("</body>\n");
|
|
|
|
echo ("</html>\n");
|
|
|
|
|
2004-07-24 17:14:39 +00:00
|
|
|
|
2006-01-31 16:57:12 +00:00
|
|
|
/**
|
|
|
|
* Saves the entered settings.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
function saveSettings() {
|
|
|
|
$conf = &$_SESSION['conf_config'];
|
|
|
|
$types = $conf->get_ActiveTypes();
|
2006-09-24 14:19:50 +00:00
|
|
|
|
2006-01-31 16:57:12 +00:00
|
|
|
// remove double slashes if magic quotes are on
|
|
|
|
if (get_magic_quotes_gpc() == 1) {
|
|
|
|
$postKeys = array_keys($_POST);
|
|
|
|
for ($i = 0; $i < sizeof($postKeys); $i++) {
|
|
|
|
if (is_string($_POST[$postKeys[$i]])) $_POST[$postKeys[$i]] = stripslashes($_POST[$postKeys[$i]]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// check new preferences
|
|
|
|
$errors = array();
|
|
|
|
if (!$conf->set_ServerURL($_POST['serverurl'])) {
|
2006-07-10 19:27:54 +00:00
|
|
|
$errors[] = array("ERROR", _("Server address is invalid!"));
|
2006-01-31 16:57:12 +00:00
|
|
|
}
|
|
|
|
if (!$conf->set_cacheTimeout($_POST['cachetimeout'])) {
|
|
|
|
$errors[] = array("ERROR", _("Cache timeout is invalid!"));
|
|
|
|
}
|
2007-01-04 20:05:12 +00:00
|
|
|
$adminText = $_POST['admins'];
|
|
|
|
$adminText = explode("\n", $adminText);
|
|
|
|
$adminTextNew = array();
|
|
|
|
for ($i = 0; $i < sizeof($adminText); $i++) {
|
|
|
|
if (trim($adminText[$i]) == "") continue;
|
|
|
|
$adminTextNew[] = trim($adminText[$i]);
|
|
|
|
}
|
|
|
|
if (!$conf->set_Adminstring(implode(";", $adminTextNew))) {
|
2006-01-31 16:57:12 +00:00
|
|
|
$errors[] = array("ERROR", _("List of admin users is empty or invalid!"));
|
|
|
|
}
|
|
|
|
if (!$conf->set_Suffix("tree", $_POST['sufftree'])) {
|
|
|
|
$errors[] = array("ERROR", _("TreeSuffix is invalid!"));
|
|
|
|
}
|
|
|
|
if (!$conf->set_MaxListEntries($_POST['maxlistentries'])) {
|
|
|
|
$errors[] = array("ERROR", _("Max list entries is invalid!"));
|
|
|
|
}
|
|
|
|
if (!$conf->set_defaultLanguage($_POST['lang'])) {
|
|
|
|
$errors[] = array("ERROR", _("Language is not defined!"));
|
|
|
|
}
|
|
|
|
if (!$conf->set_scriptpath($_POST['scriptpath'])) {
|
|
|
|
$errors[] = array("ERROR", _("Script path is invalid!"));
|
|
|
|
}
|
|
|
|
if (!$conf->set_scriptserver($_POST['scriptserver'])) {
|
|
|
|
$errors[] = array("ERROR", _("Script server is invalid!"));
|
|
|
|
}
|
|
|
|
// check if password was changed
|
|
|
|
if (isset($_POST['passwd1']) && ($_POST['passwd1'] != '')) {
|
|
|
|
if ($_POST['passwd1'] != $_POST['passwd2']) {
|
|
|
|
$errors[] = array("ERROR", _("Passwords are different!"));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// set new password
|
|
|
|
$conf->set_Passwd($_POST['passwd1']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// check module options
|
|
|
|
// create option array to check and save
|
|
|
|
$options = array();
|
|
|
|
$opt_keys = array_keys($_SESSION['conf_types']);
|
|
|
|
for ($i = 0; $i < sizeof($opt_keys); $i++) {
|
|
|
|
$element = $opt_keys[$i];
|
|
|
|
// text fields
|
|
|
|
if ($_SESSION['conf_types'][$element] == "text") {
|
|
|
|
$options[$element] = array($_POST[$element]);
|
|
|
|
}
|
|
|
|
// checkboxes
|
|
|
|
elseif ($_SESSION['conf_types'][$element] == "checkbox") {
|
|
|
|
if ($_POST[$element] == "on") $options[$element] = array('true');
|
|
|
|
else $options[$element] = array('false');
|
|
|
|
}
|
|
|
|
// dropdownbox
|
|
|
|
elseif ($_SESSION['conf_types'][$element] == "select") {
|
|
|
|
$options[$element] = array($_POST[$element]);
|
|
|
|
}
|
|
|
|
// multiselect
|
|
|
|
elseif ($_SESSION['conf_types'][$element] == "multiselect") {
|
|
|
|
$options[$element] = $_POST[$element]; // value is already an array
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// get list of scopes of modules
|
|
|
|
$scopes = array();
|
|
|
|
for ($m = 0; $m < sizeof($types); $m++) {
|
|
|
|
$mods = $conf->get_AccountModules($types[$m]);
|
|
|
|
for ($i = 0; $i < sizeof($mods); $i++) $scopes[$mods[$i]][] = $types[$m];
|
|
|
|
}
|
|
|
|
// check options
|
|
|
|
$errors = array_merge($errors, checkConfigOptions($scopes, $options));
|
|
|
|
// print error messages if any
|
|
|
|
if (sizeof($errors) > 0) {
|
|
|
|
$_SESSION['conf_errors'] = $errors;
|
2006-01-31 17:00:14 +00:00
|
|
|
$conf->set_moduleSettings($options);
|
2006-01-31 16:57:12 +00:00
|
|
|
}
|
|
|
|
// save settings if no errors occured
|
|
|
|
else {
|
|
|
|
// page head
|
|
|
|
echo $_SESSION['header'];
|
|
|
|
echo "<title>" . _("LDAP Account Manager Configuration") . "</title>\n";
|
|
|
|
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
|
|
|
|
echo "</head><body>\n";
|
|
|
|
echo ("<p align=\"center\"><a href=\"http://lam.sourceforge.net\" target=\"new_window\">".
|
|
|
|
"<img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p><hr><br><br>");
|
|
|
|
$conf->set_moduleSettings($options);
|
|
|
|
$conf->save();
|
2006-09-24 14:19:50 +00:00
|
|
|
echo ("<br><br><br><br><br><a href=\"../login.php\" target=\"_top\">" . _("Back to Login") . "</a>");
|
2006-01-31 16:57:12 +00:00
|
|
|
echo("</body></html>");
|
|
|
|
// remove settings from session
|
|
|
|
$sessionKeys = array_keys($_SESSION);
|
|
|
|
for ($i = 0; $i < sizeof($sessionKeys); $i++) {
|
|
|
|
if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]);
|
|
|
|
}
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-25 21:28:17 +00:00
|
|
|
?>
|
|
|
|
|