LDAPAccountManager/lam/templates/config/confmain.php

603 lines
22 KiB
PHP
Raw Normal View History

<?php
2003-02-25 21:28:17 +00:00
/*
$Id$
2009-10-27 18:47:12 +00:00
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
2010-02-06 11:50:26 +00:00
Copyright (C) 2003 - 2010 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
2007-02-22 17:16:14 +00:00
* @author Thomas Manninger
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");
/** access to module settings */
2006-03-26 17:51:25 +00:00
include_once("../../lib/modules.inc");
2003-03-23 18:38:47 +00:00
// start session
2009-07-08 18:03:28 +00:00
if (strtolower(session_module_name()) == 'files') {
session_save_path("../../sess");
}
2003-06-24 15:50:38 +00:00
@session_start();
2003-07-06 17:54:11 +00:00
setlanguage();
// get password
2004-09-19 08:30:42 +00:00
if (isset($_POST['passwd'])) $passwd = $_POST['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
2008-04-24 18:50:02 +00:00
if (!isset($passwd) && !isset($_SESSION['conf_isAuthenticated'])) {
$_SESSION['conf_message'] = _("No password was entered!");
2004-06-02 12:48:54 +00:00
/** go back to login if password is empty */
2010-02-06 11:50:26 +00:00
metaRefresh('conflogin.php');
2003-02-25 21:28:17 +00:00
exit;
}
if (!isset($_SESSION['conf_config']) && isset($_POST['filename'])) {
2006-09-24 14:19:50 +00:00
$_SESSION['conf_config'] = new LAMConfig($_POST['filename']);
}
$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
2008-04-24 18:50:02 +00:00
if ((!isset($_SESSION['conf_isAuthenticated']) || !($_SESSION['conf_isAuthenticated'] === $conf->getName())) && !$conf->check_Passwd($passwd)) {
$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 */
2010-02-06 11:50:26 +00:00
metaRefresh('conflogin.php');
2003-02-25 21:28:17 +00:00
exit;
}
2007-12-29 18:59:09 +00:00
$_SESSION['conf_isAuthenticated'] = $conf->getName();
2003-02-25 21:28:17 +00:00
2009-07-12 13:40:32 +00:00
// check if user canceled editing
if (isset($_POST['cancelSettings'])) {
metaRefresh("../login.php");
exit;
2006-01-01 16:30:05 +00:00
}
2009-07-12 13:40:32 +00:00
$errorsToDisplay = array();
2009-07-12 13:40:32 +00:00
// check if button was pressed and if we have to save the settings or go to another tab
if (isset($_POST['saveSettings']) || isset($_POST['editmodules'])
|| isset($_POST['edittypes']) || isset($_POST['generalSettingsButton'])
|| isset($_POST['moduleSettings'])) {
2009-07-12 13:40:32 +00:00
$errorsToDisplay = checkInput();
if (sizeof($errorsToDisplay) == 0) {
// go to final page
if (isset($_POST['saveSettings'])) {
metaRefresh("confsave.php");
exit;
}
// go to modules page
elseif (isset($_POST['editmodules'])) {
metaRefresh("confmodules.php");
exit;
}
// go to types page
elseif (isset($_POST['edittypes'])) {
metaRefresh("conftypes.php");
exit;
}
// go to module settings page
elseif (isset($_POST['moduleSettings'])) {
metaRefresh("moduleSettings.php");
exit;
}
2004-02-01 12:33:21 +00:00
}
}
2006-01-01 16:30:05 +00:00
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");
2008-01-01 13:06:51 +00:00
echo "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"../../graphics/favicon.ico\">\n";
2003-02-25 21:28:17 +00:00
echo ("</head>\n");
2009-03-07 16:22:30 +00:00
echo ("<body onload=\"configLoginMethodChanged()\">\n");
2010-01-01 17:39:38 +00:00
// include all JavaScript files
$jsDirName = dirname(__FILE__) . '/../lib';
$jsDir = dir($jsDirName);
while ($jsEntry = $jsDir->read()) {
if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue;
echo "<script type=\"text/javascript\" src=\"../lib/" . $jsEntry . "\"></script>\n";
}
2009-08-10 16:13:27 +00:00
echo ("<p align=\"center\"><a href=\"http://www.ldap-account-manager.org/\" target=\"new_window\">".
2007-12-31 12:43:45 +00:00
"<img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p>\n<hr>\n<p>&nbsp;</p>\n");
2003-05-09 16:22:46 +00:00
if (!$conf->isWritable()) {
StatusMessage('WARN', 'The config file is not writable.', 'Your changes cannot be saved until you make the file writable for the webserver user.');
echo "<br>";
}
// display error messages
2009-07-12 13:40:32 +00:00
if (sizeof($errorsToDisplay) > 0) {
for ($i = 0; $i < sizeof($errorsToDisplay); $i++) {
call_user_func_array('StatusMessage', $errorsToDisplay[$i]);
}
echo "<br>";
}
2003-05-09 16:22:46 +00:00
// display formular
echo ("<form action=\"confmain.php\" method=\"post\">\n");
2009-07-08 18:03:28 +00:00
echo "<table border=0 width=\"100%\" style=\"border-collapse: collapse;\">\n";
echo "<tr valign=\"top\"><td style=\"border-bottom: 1px solid;padding:0px;\" colspan=2>";
// show tabs
echo "<table width=\"100%\" border=0 style=\"border-collapse: collapse;\">";
echo "<tr>\n";
2009-09-02 17:51:32 +00:00
$buttonSpace = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
2009-07-08 18:03:28 +00:00
// general settings
2009-11-13 20:12:34 +00:00
echo "<td class=\"settingsTab\">\n";
2009-07-08 18:03:28 +00:00
echo "<table class=\"settingsTab\" width=\"100%\">\n";
echo "<tr><td class=\"settingsActiveTab\" onclick=\"document.getElementsByName('generalSettingsButton')[0].click();\"";
echo " align=\"center\">\n";
2009-09-02 17:51:32 +00:00
$buttonStyle = 'background-image: url(../../graphics/bigTools.png);';
2009-07-08 18:03:28 +00:00
echo "<input style=\"" . $buttonStyle . "\" name=\"generalSettingsButton\" type=\"submit\" value=\"" . $buttonSpace . _('General settings') . "\"";
echo ">\n";
echo "</td></tr></table>\n";
echo '</td>';
// account types
2009-11-13 20:12:34 +00:00
echo "<td class=\"settingsTab\">\n";
2009-07-08 18:03:28 +00:00
echo "<table class=\"settingsTab\" width=\"100%\">\n";
2009-07-10 20:22:59 +00:00
echo "<tr><td onclick=\"document.getElementsByName('edittypes')[0].click();\"";
2009-07-08 18:03:28 +00:00
echo " align=\"center\">\n";
2009-09-02 17:51:32 +00:00
$buttonStyle = 'background-image: url(../../graphics/gear.png);';
2009-07-10 20:22:59 +00:00
echo "<input style=\"" . $buttonStyle . "\" name=\"edittypes\" type=\"submit\" value=\"" . $buttonSpace . _('Account types') . "\"";
2009-07-08 18:03:28 +00:00
echo ">\n";
echo "</td></tr></table>\n";
echo '</td>';
// module selection
2009-11-13 20:12:34 +00:00
echo "<td class=\"settingsTab\">\n";
2009-07-08 18:03:28 +00:00
echo "<table class=\"settingsTab\" width=\"100%\">\n";
2009-07-10 20:22:59 +00:00
echo "<tr><td onclick=\"document.getElementsByName('editmodules')[0].click();\"";
2009-07-08 18:03:28 +00:00
echo " align=\"center\">\n";
2009-09-02 17:51:32 +00:00
$buttonStyle = 'background-image: url(../../graphics/modules.png);';
2009-07-10 20:22:59 +00:00
echo "<input style=\"" . $buttonStyle . "\" name=\"editmodules\" type=\"submit\" value=\"" . $buttonSpace . _('Modules') . "\"";
echo ">\n";
echo "</td></tr></table>\n";
echo '</td>';
// module settings
2009-11-13 20:12:34 +00:00
echo "<td class=\"settingsTab\">\n";
echo "<table class=\"settingsTab\" width=\"100%\">\n";
echo "<tr><td onclick=\"document.getElementsByName('moduleSettings')[0].click();\"";
echo " align=\"center\">\n";
$buttonStyle = 'background-image: url(../../graphics/moduleSettings.png);';
echo "<input style=\"" . $buttonStyle . "\" name=\"moduleSettings\" type=\"submit\" value=\"" . $buttonSpace . _('Module settings') . "\"";
echo ">\n";
echo "</td></tr></table>\n";
echo '</td>';
echo "<td width=\"100%\">&nbsp;</td>";
// spacer
2009-07-10 20:22:59 +00:00
echo "<td width=\"100%\">&nbsp;</td>";
// save button
2009-11-13 20:12:34 +00:00
echo "<td class=\"settingsTab\">\n";
2009-07-10 20:22:59 +00:00
echo "<table class=\"settingsTab\" width=\"100%\">\n";
echo "<tr><td onclick=\"document.getElementsByName('saveSettings')[0].click();\"";
echo " align=\"center\">\n";
2009-09-02 17:51:32 +00:00
$buttonStyle = 'background-image: url(../../graphics/pass.png);';
2009-07-10 20:22:59 +00:00
echo "<input style=\"" . $buttonStyle . "\" name=\"saveSettings\" type=\"submit\" value=\"" . $buttonSpace . _('Save') . "\"";
echo ">\n";
echo "</td></tr></table>\n";
echo '</td>';
// cancel button
2009-11-13 20:12:34 +00:00
echo "<td class=\"settingsTab\">\n";
2009-07-10 20:22:59 +00:00
echo "<table class=\"settingsTab\" width=\"100%\">\n";
echo "<tr><td onclick=\"document.getElementsByName('cancelSettings')[0].click();\"";
echo " align=\"center\">\n";
2009-09-02 17:51:32 +00:00
$buttonStyle = 'background-image: url(../../graphics/fail.png);';
2009-07-10 20:22:59 +00:00
echo "<input style=\"" . $buttonStyle . "\" name=\"cancelSettings\" type=\"submit\" value=\"" . $buttonSpace . _('Cancel') . "\"";
2009-07-08 18:03:28 +00:00
echo ">\n";
echo "</td></tr></table>\n";
echo '</td>';
2009-07-10 20:22:59 +00:00
echo "</tr></table>\n";
2009-07-08 18:03:28 +00:00
// end tabs
echo "</td></tr>\n";
2009-07-08 18:03:28 +00:00
echo "<tr><td><br><br>\n";
2009-05-03 18:23:36 +00:00
echo ("<fieldset><legend><img align=\"middle\" src=\"../../graphics/profiles.png\" alt=\"profiles.png\"> <b>" . _("Server settings") . "</b></legend><br>\n");
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>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '201'), '201');
2005-04-26 15:50:29 +00:00
echo "</td></tr>\n";
2004-08-14 13:21:40 +00:00
$tabindex++;
2009-05-03 18:23:36 +00:00
// use TLS
echo "<tr><td align=\"right\"><b>" . _("Activate TLS") . ": </b></td>\n";
echo "<td align=\"left\">\n";
echo "<select tabindex=\"$tabindex\" size=1 name=\"useTLS\">";
$useTLS = $conf->getUseTLS();
if (isset($useTLS) && ($useTLS == 'yes')) {
echo "<option value=\"yes\" selected>" . _("yes") . "</option>";
echo "<option value=\"no\">" . _("no") . "</option>";
}
else {
echo "<option value=\"yes\">" . _("yes") . "</option>";
echo "<option value=\"no\" selected>" . _("no") . "</option>";
}
echo "</select>\n";
echo "</td>\n";
echo "<td>";
printHelpLink(getHelp('', '201'), '201');
echo "</td></tr>\n";
$tabindex++;
2003-05-09 16:22:46 +00:00
// new line
2007-12-31 12:43:45 +00:00
echo ("<tr><td colspan=3>&nbsp;</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>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '203'), '203');
2005-04-26 15:50:29 +00:00
echo "</td></tr>\n";
2005-02-27 12:40:06 +00:00
$tabindex++;
2003-10-04 12:34:19 +00:00
// new line
2007-12-31 12:43:45 +00:00
echo ("<tr><td colspan=3>&nbsp;</td></tr>");
2003-10-04 12:34:19 +00:00
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++;
2005-04-26 15:50:29 +00:00
echo "<td>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '214'), '214');
2005-04-26 15:50:29 +00:00
echo "</td></tr>\n";
2003-05-09 16:22:46 +00:00
2007-12-30 12:32:48 +00:00
// access level is only visible in Pro version
if (isLAMProVersion()) {
// new line
2007-12-31 12:43:45 +00:00
echo ("<tr><td colspan=3>&nbsp;</td></tr>");
2007-12-30 12:32:48 +00:00
// access level
echo ("<tr><td align=\"right\"><b>".
_("Access level") . ": </b></td>".
"<td><select tabindex=\"$tabindex\" name=\"accessLevel\">\n");
if ($conf->getAccessLevel() == LAMConfig::ACCESS_ALL) {
echo("<option selected value=" . LAMConfig::ACCESS_ALL . ">" . _('Write access') . "</option>\n");
}
else {
echo("<option value=" . LAMConfig::ACCESS_ALL . ">" . _('Write access') . "</option>\n");
}
if ($conf->getAccessLevel() == LAMConfig::ACCESS_PASSWORD_CHANGE) {
echo("<option selected value=" . LAMConfig::ACCESS_PASSWORD_CHANGE . ">" . _('Change passwords') . "</option>\n");
}
else {
echo("<option value=" . LAMConfig::ACCESS_PASSWORD_CHANGE . ">" . _('Change passwords') . "</option>\n");
}
if ($conf->getAccessLevel() == LAMConfig::ACCESS_READ_ONLY) {
echo("<option selected value=" . LAMConfig::ACCESS_READ_ONLY . ">" . _('Read only') . "</option>\n");
}
else {
echo("<option value=" . LAMConfig::ACCESS_READ_ONLY . ">" . _('Read only') . "</option>\n");
}
echo ("</select></td>\n");
$tabindex++;
echo "<td>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '215'), '215');
2007-12-30 12:32:48 +00:00
echo "</td></tr>\n";
}
2003-06-19 19:01:00 +00:00
echo ("</table>");
echo ("</fieldset>");
2004-02-01 12:33:21 +00:00
2007-12-31 12:43:45 +00:00
echo ("<br>");
2004-02-01 12:33:21 +00:00
2009-05-03 18:23:36 +00:00
echo ("<fieldset><legend><img align=\"middle\" src=\"../../graphics/language.png\" alt=\"language.png\"> <b>" . _("Language settings") . "</b></legend><br>\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");
2005-04-26 15:50:29 +00:00
echo "<td>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '209'), '209');
2005-04-26 15:50:29 +00:00
echo "</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
2007-12-31 12:43:45 +00:00
echo ("<br>\n");
2003-05-09 16:22:46 +00:00
2003-11-15 10:35:58 +00:00
// script settings
2009-05-03 18:23:36 +00:00
echo ("<fieldset><legend><img align=\"middle\" src=\"../../graphics/lamdaemon.png\" alt=\"lamdaemon.png\"> <b>" . _("Script settings") . "</b></legend><br>\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>".
2007-02-22 17:16:14 +00:00
_("Server list") . ": </b></td>".
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"scriptservers\" value=\"" . $conf->get_scriptServers(false) . "\"></td>\n");
2004-08-14 13:21:40 +00:00
$tabindex++;
2005-04-26 15:50:29 +00:00
echo "<td>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '218'), '218');
2005-04-26 15:50:29 +00:00
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>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '210'), '210');
2005-04-26 15:50:29 +00:00
echo "</td></tr>\n";
2007-02-22 17:16:14 +00:00
echo "<tr><td align=\"right\"><b>". _("Rights for the home directory") . ": </b></td>\n";
$owr = "";
$oww = "";
$owe = "";
$grr = "";
$grw = "";
$gre = "";
$otr = "";
$otw = "";
$ote = "";
$chmod = $conf->get_scriptRights();
if (checkChmod("read","owner", $chmod)) $owr = 'checked';
if (checkChmod("write","owner", $chmod)) $oww = 'checked';
if (checkChmod("execute","owner", $chmod)) $owe = 'checked';
if (checkChmod("read","group", $chmod)) $grr = 'checked';
if (checkChmod("write","group", $chmod)) $grw = 'checked';
if (checkChmod("execute","group", $chmod)) $gre = 'checked';
if (checkChmod("read","other", $chmod)) $otr = 'checked';
if (checkChmod("write","other", $chmod)) $otw = 'checked';
if (checkChmod("execute","other", $chmod)) $ote = 'checked';
echo "<td align=\"center\">\n";
echo "<table width=\"280\"><tr align=\"center\">\n";
echo "<td width=\"70\"></td><th width=\"70\">" . _("Read") . "</th>\n";
echo "<th width=\"70\">" . _("Write") . "</th>\n";
echo "<th width=\"70\">"._("Execute")."</th></tr>\n";
echo "<tr align=\"center\"><th align=\"left\">"._("Owner")."</th>\n";
echo "<td><input type=\"checkbox\" name=\"chmod_owr\" " . $owr . "></td>\n";
echo "<td><input type=\"checkbox\" name=\"chmod_oww\" " . $oww . "></td>\n";
echo "<td><input type=\"checkbox\" name=\"chmod_owe\" " . $owe . "></td></tr>\n";
echo "<tr align=\"center\"><th align=\"left\">"._("Group")."</th>\n";
echo "<td><input type=\"checkbox\" name=\"chmod_grr\" " . $grr . "></td>\n";
echo "<td><input type=\"checkbox\" name=\"chmod_grw\" " . $grw . "></td>\n";
echo "<td><input type=\"checkbox\" name=\"chmod_gre\" " . $gre . "></td></tr>\n";
echo "<tr align=\"center\"><th align=\"left\">"._("Other")."</th>\n";
echo "<td><input type=\"checkbox\" name=\"chmod_otr\" " . $otr . "></td>\n";
echo "<td><input type=\"checkbox\" name=\"chmod_otw\" " . $otw . "></td>\n";
echo "<td><input type=\"checkbox\" name=\"chmod_ote\" " . $ote . "></td>\n";
echo "</tr></table>";
$tabindex++;
echo "<td>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '219'), '219');
2007-02-22 17:16:14 +00:00
echo "</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
2007-12-31 12:43:45 +00:00
echo ("<br>\n");
2003-11-15 10:35:58 +00:00
2003-06-24 15:50:38 +00:00
// security setings
2009-05-03 18:23:36 +00:00
echo ("<fieldset><legend><img align=\"middle\" src=\"../../graphics/security.png\" alt=\"security.png\"> <b>" . _("Security settings") . "</b></legend><br>\n");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2009-03-07 16:22:30 +00:00
// login method
echo ("<tr><td align=\"right\"><b>".
_("Login method") . ": </b></td>".
"<td><select tabindex=\"$tabindex\" name=\"loginMethod\" onchange=\"configLoginMethodChanged()\">\n");
if ($conf->getLoginMethod() == LAMConfig::LOGIN_LIST) {
echo("<option selected value=" . LAMConfig::LOGIN_LIST . ">" . _('Fixed list') . "</option>\n");
}
else {
echo("<option value=" . LAMConfig::LOGIN_LIST . ">" . _('Fixed list') . "</option>\n");
}
if ($conf->getLoginMethod() == LAMConfig::LOGIN_SEARCH) {
echo("<option selected value=" . LAMConfig::LOGIN_SEARCH . ">" . _('LDAP search') . "</option>\n");
}
else {
echo("<option value=" . LAMConfig::LOGIN_SEARCH . ">" . _('LDAP search') . "</option>\n");
}
echo ("</select></td>\n");
$tabindex++;
echo "<td>";
printHelpLink(getHelp('', '220'), '220');
echo "</td></tr>\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()));
2009-03-07 16:22:30 +00:00
echo "<tr id=\"trAdminList\"><td align=\"right\">\n";
echo "<b>".
2003-07-25 15:41:51 +00:00
_("List of valid users") . " *: </b></td>".
2009-03-07 16:22:30 +00:00
"<td><textarea tabindex=\"$tabindex\" name=\"admins\" cols=75 rows=3>" . $adminText . "</textarea></td>\n";
2005-04-26 15:50:29 +00:00
echo "<td>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '207'), '207');
2005-04-26 15:50:29 +00:00
echo "</td></tr>\n";
2004-08-14 13:21:40 +00:00
$tabindex++;
2009-03-07 16:22:30 +00:00
// login search suffix
echo "<tr id=\"trLoginSearchSuffix\"><td align=\"right\">\n";
echo "<b>".
_("LDAP suffix") . " *: </b></td>".
"<td><input type=\"text\" tabindex=\"$tabindex\" name=\"loginSearchSuffix\" value=\"" . $conf->getLoginSearchSuffix() . "\" size=50></td>\n";
echo "<td>";
printHelpLink(getHelp('', '221'), '221');
echo "</td></tr>\n";
$tabindex++;
// login search filter
echo "<tr id=\"trLoginSearchFilter\"><td align=\"right\">\n";
echo "<b>".
_("LDAP filter") . " *: </b></td>".
"<td><input type=\"text\" tabindex=\"$tabindex\" name=\"loginSearchFilter\" value=\"" . $conf->getLoginSearchFilter() . "\" size=50></td>\n";
echo "<td>";
printHelpLink(getHelp('', '221'), '221');
echo "</td></tr>\n";
$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>".
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>";
2009-02-07 22:28:28 +00:00
printHelpLink(getHelp('', '212'), '212');
2005-04-26 15:50:29 +00:00
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++;
echo ("</table>\n");
2003-06-08 18:30:14 +00:00
echo ("</fieldset>\n");
2003-06-09 10:59:30 +00:00
2003-07-25 15:41:51 +00:00
echo ("<p>* = ". _("required") . "</p>");
2009-07-10 20:22:59 +00:00
echo ("<p>&nbsp;</p>\n");
2003-07-25 15:41:51 +00:00
2009-07-08 18:03:28 +00:00
echo '</td></tr></table>';
2003-02-25 21:28:17 +00:00
echo ("</form>\n");
echo ("</body>\n");
echo ("</html>\n");
/**
2009-07-12 13:40:32 +00:00
* Checks user input and saves the entered settings.
*
2009-07-12 13:40:32 +00:00
* @return array list of errors
*/
2009-07-12 13:40:32 +00:00
function checkInput() {
$conf = &$_SESSION['conf_config'];
$types = $conf->get_ActiveTypes();
2006-09-24 14:19:50 +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!"));
}
2009-05-03 18:23:36 +00:00
$conf->setUseTLS($_POST['useTLS']);
if (!$conf->set_cacheTimeout($_POST['cachetimeout'])) {
$errors[] = array("ERROR", _("Cache timeout is invalid!"));
}
2007-12-30 12:32:48 +00:00
if (isLAMProVersion()) {
$conf->setAccessLevel($_POST['accessLevel']);
}
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]);
}
2009-03-07 16:22:30 +00:00
$conf->setLoginMethod($_POST['loginMethod']);
$conf->setLoginSearchFilter($_POST['loginSearchFilter']);
$conf->setLoginSearchSuffix($_POST['loginSearchSuffix']);
2007-01-04 20:05:12 +00:00
if (!$conf->set_Adminstring(implode(";", $adminTextNew))) {
$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_defaultLanguage($_POST['lang'])) {
$errors[] = array("ERROR", _("Language is not defined!"));
}
if (!$conf->set_scriptpath($_POST['scriptpath'])) {
$errors[] = array("ERROR", _("Script path is invalid!"));
}
2007-02-22 17:16:14 +00:00
if (!$conf->set_scriptservers($_POST['scriptservers'])) {
$errors[] = array("ERROR", _("Script server is invalid!"));
}
2007-02-22 17:16:14 +00:00
$chmodOwner = 0;
$chmodGroup = 0;
$chmodOther = 0;
2007-10-05 18:09:49 +00:00
if (isset($_POST['chmod_owr']) && ($_POST['chmod_owr'] == 'on')) $chmodOwner += 4;
if (isset($_POST['chmod_oww']) && ($_POST['chmod_oww'] == 'on')) $chmodOwner += 2;
if (isset($_POST['chmod_owe']) && ($_POST['chmod_owe'] == 'on')) $chmodOwner += 1;
if (isset($_POST['chmod_grr']) && ($_POST['chmod_grr'] == 'on')) $chmodGroup += 4;
if (isset($_POST['chmod_grw']) && ($_POST['chmod_grw'] == 'on')) $chmodGroup += 2;
if (isset($_POST['chmod_gre']) && ($_POST['chmod_gre'] == 'on')) $chmodGroup += 1;
if (isset($_POST['chmod_otr']) && ($_POST['chmod_otr'] == 'on')) $chmodOther += 4;
if (isset($_POST['chmod_otw']) && ($_POST['chmod_otw'] == 'on')) $chmodOther += 2;
if (isset($_POST['chmod_ote']) && ($_POST['chmod_ote'] == 'on')) $chmodOther += 1;
2007-02-22 17:16:14 +00:00
$chmod = $chmodOwner . $chmodGroup . $chmodOther;
if (!$conf->set_scriptrights($chmod)) {
2007-03-05 17:05:38 +00:00
$errors[] = array("ERROR", _("Script rights are invalid!"));
2007-02-22 17:16:14 +00:00
}
// 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']);
}
}
2009-07-12 13:40:32 +00:00
return $errors;
}
2003-02-25 21:28:17 +00:00
?>