2003-03-05 16:05:23 +00:00
|
|
|
<?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/)
|
2011-01-01 19:46:44 +00:00
|
|
|
Copyright (C) 2003 - 2011 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");
|
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
|
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-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'];
|
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'])) {
|
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 */
|
2010-02-06 11:50:26 +00:00
|
|
|
metaRefresh('conflogin.php');
|
2003-02-25 21:28:17 +00:00
|
|
|
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
|
2008-04-24 18:50:02 +00:00
|
|
|
if ((!isset($_SESSION['conf_isAuthenticated']) || !($_SESSION['conf_isAuthenticated'] === $conf->getName())) && !$conf->check_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 */
|
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();
|
2006-01-31 16:57:12 +00:00
|
|
|
|
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
|
2009-10-03 15:44:38 +00:00
|
|
|
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;
|
|
|
|
}
|
2009-10-03 15:44:38 +00:00
|
|
|
// 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");
|
2010-08-28 09:34:00 +00:00
|
|
|
|
|
|
|
// include all CSS files
|
|
|
|
$cssDirName = dirname(__FILE__) . '/../../style';
|
|
|
|
$cssDir = dir($cssDirName);
|
|
|
|
while ($cssEntry = $cssDir->read()) {
|
|
|
|
if (substr($cssEntry, strlen($cssEntry) - 4, 4) != '.css') continue;
|
2010-09-13 20:05:58 +00:00
|
|
|
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/" . $cssEntry . "\">\n";
|
2010-08-28 09:34:00 +00:00
|
|
|
}
|
|
|
|
|
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);
|
2010-08-28 12:27:06 +00:00
|
|
|
$jsFiles = array();
|
2010-01-01 17:39:38 +00:00
|
|
|
while ($jsEntry = $jsDir->read()) {
|
|
|
|
if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue;
|
2010-08-28 12:27:06 +00:00
|
|
|
$jsFiles[] = $jsEntry;
|
|
|
|
}
|
|
|
|
sort($jsFiles);
|
|
|
|
foreach ($jsFiles as $jsEntry) {
|
2010-01-01 17:39:38 +00:00
|
|
|
echo "<script type=\"text/javascript\" src=\"../lib/" . $jsEntry . "\"></script>\n";
|
|
|
|
}
|
2010-07-30 16:08:20 +00:00
|
|
|
?>
|
2010-08-31 18:05:17 +00:00
|
|
|
<table border=0 width="100%" class="lamHeader ui-corner-all">
|
2010-07-30 16:08:20 +00:00
|
|
|
<tr>
|
|
|
|
<td align="left" height="30">
|
|
|
|
<a class="lamHeader" href="http://www.ldap-account-manager.org/" target="new_window"> <img src="../../graphics/logo32.png" width=24 height=24 class="align-middle" alt="LDAP Account Manager"> LDAP Account Manager</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<br>
|
|
|
|
<?php
|
2003-05-09 16:22:46 +00:00
|
|
|
|
2007-10-26 17:51:56 +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>";
|
|
|
|
}
|
|
|
|
|
2006-01-31 16:57:12 +00:00
|
|
|
// 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]);
|
2006-01-31 16:57:12 +00:00
|
|
|
}
|
|
|
|
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
|
|
|
|
2011-01-01 19:46:44 +00:00
|
|
|
$buttonContainer = new htmlTable();
|
|
|
|
$saveButton = new htmlButton('saveSettings', _('Save'));
|
|
|
|
$saveButton->setIconClass('saveButton');
|
|
|
|
$buttonContainer->addElement($saveButton);
|
|
|
|
$cancelButton = new htmlButton('cancelSettings', _('Cancel'));
|
|
|
|
$cancelButton->setIconClass('cancelButton');
|
|
|
|
$buttonContainer->addElement($cancelButton, true);
|
|
|
|
$buttonContainer->addElement(new htmlSpacer(null, '10px'));
|
|
|
|
parseHtml(null, $buttonContainer, array(), false, $tabindex, 'user');
|
2010-08-28 09:34:00 +00:00
|
|
|
|
|
|
|
// hidden submit buttons which are clicked by tabs
|
|
|
|
echo "<div style=\"display: none;\">\n";
|
|
|
|
echo "<input name=\"generalSettingsButton\" type=\"submit\" value=\" \">";
|
|
|
|
echo "<input name=\"edittypes\" type=\"submit\" value=\" \">";
|
|
|
|
echo "<input name=\"editmodules\" type=\"submit\" value=\" \">";
|
|
|
|
echo "<input name=\"moduleSettings\" type=\"submit\" value=\" \">";
|
|
|
|
echo "</div>\n";
|
|
|
|
|
|
|
|
// tabs
|
|
|
|
echo '<div class="ui-tabs ui-widget ui-widget-content ui-corner-all">';
|
|
|
|
|
|
|
|
echo '<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">';
|
|
|
|
echo '<li id="generalSettingsButton" class="ui-state-default ui-corner-top">';
|
|
|
|
echo '<a href="#" onclick="document.getElementsByName(\'generalSettingsButton\')[0].click();"><img src="../../graphics/tools.png" alt=""> ';
|
|
|
|
echo _('General settings') . '</a>';
|
|
|
|
echo '</li>';
|
|
|
|
echo '<li id="edittypes" class="ui-state-default ui-corner-top">';
|
|
|
|
echo '<a href="#" onclick="document.getElementsByName(\'edittypes\')[0].click();"><img src="../../graphics/gear.png" alt=""> ';
|
|
|
|
echo _('Account types') . '</a>';
|
|
|
|
echo '</li>';
|
|
|
|
echo '<li id="editmodules" class="ui-state-default ui-corner-top">';
|
|
|
|
echo '<a href="#" onclick="document.getElementsByName(\'editmodules\')[0].click();"><img src="../../graphics/modules.png" alt=""> ';
|
|
|
|
echo _('Modules') . '</a>';
|
|
|
|
echo '</li>';
|
|
|
|
echo '<li id="moduleSettings" class="ui-state-default ui-corner-top">';
|
|
|
|
echo '<a href="#" onclick="document.getElementsByName(\'moduleSettings\')[0].click();"><img src="../../graphics/modules.png" alt=""> ';
|
|
|
|
echo _('Module settings') . '</a>';
|
|
|
|
echo '</li>';
|
|
|
|
echo '</ul>';
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
jQuery(document).ready(function() {
|
|
|
|
jQuery('#generalSettingsButton').addClass('ui-tabs-selected');
|
|
|
|
jQuery('#generalSettingsButton').addClass('ui-state-active');
|
2010-11-14 20:35:34 +00:00
|
|
|
jQuery('#generalSettingsButton').addClass('userlist-bright');
|
2010-08-28 09:34:00 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2010-11-14 20:35:34 +00:00
|
|
|
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom userlist-bright">
|
2010-08-28 09:34:00 +00:00
|
|
|
<?php
|
|
|
|
|
2011-01-01 19:46:44 +00:00
|
|
|
$container = new htmlTable();
|
2003-05-09 16:22:46 +00:00
|
|
|
|
2011-01-01 19:46:44 +00:00
|
|
|
$serverSettingsContent = new htmlTable();
|
|
|
|
// server URL
|
|
|
|
$urlInput = new htmlTableExtendedInputField(_("Server address"), 'serverurl', $conf->get_ServerURL(), '201');
|
|
|
|
$urlInput->setRequired(true);
|
|
|
|
$serverSettingsContent->addElement($urlInput, true);
|
|
|
|
// use TLS
|
|
|
|
$tlsOptions = array(_("yes") => 'yes', _("no") => 'no');
|
|
|
|
$tlsSelect = new htmlTableExtendedSelect('useTLS', $tlsOptions, array($conf->getUseTLS()), _("Activate TLS"), '201');
|
|
|
|
$tlsSelect->setHasDescriptiveElements(true);
|
|
|
|
$serverSettingsContent->addElement($tlsSelect, true);
|
2005-02-27 12:40:06 +00:00
|
|
|
// tree suffix
|
2011-01-01 19:46:44 +00:00
|
|
|
$serverSettingsContent->addElement(new htmlTableExtendedInputField(_("Tree suffix"), 'sufftree', $conf->get_Suffix('tree'), '203'), true);
|
2010-02-06 18:30:21 +00:00
|
|
|
// LDAP search limit
|
|
|
|
$searchLimitOptions = array(
|
2011-01-01 19:46:44 +00:00
|
|
|
'-' => 0, 100 => 100, 500 => 500,
|
|
|
|
1000 => 1000, 5000 => 5000, 10000 => 10000,
|
|
|
|
50000 => 50000, 100000 => 100000);
|
|
|
|
$limitSelect = new htmlTableExtendedSelect('searchLimit', $searchLimitOptions, array($conf->get_searchLimit()), _("LDAP search limit"), '222');
|
|
|
|
$limitSelect->setHasDescriptiveElements(true);
|
|
|
|
$serverSettingsContent->addElement($limitSelect, true);
|
2007-12-30 12:32:48 +00:00
|
|
|
// access level is only visible in Pro version
|
|
|
|
if (isLAMProVersion()) {
|
2011-01-01 19:46:44 +00:00
|
|
|
$accessOptions = array(
|
|
|
|
_('Write access') => LAMConfig::ACCESS_ALL,
|
|
|
|
_('Change passwords') => LAMConfig::ACCESS_PASSWORD_CHANGE,
|
|
|
|
_('Read only') => LAMConfig::ACCESS_READ_ONLY
|
|
|
|
);
|
|
|
|
$accessSelect = new htmlTableExtendedSelect('accessLevel', $accessOptions, array($conf->getAccessLevel()), _("Access level"), '215');
|
|
|
|
$accessSelect->setHasDescriptiveElements(true);
|
|
|
|
$serverSettingsContent->addElement($accessSelect, true);
|
2007-12-30 12:32:48 +00:00
|
|
|
}
|
2011-01-01 19:46:44 +00:00
|
|
|
$serverSettings = new htmlFieldset($serverSettingsContent, _("Server settings"), '../../graphics/profiles.png');
|
|
|
|
$container->addElement($serverSettings, true);
|
|
|
|
$container->addElement(new htmlSpacer(null, '10px'), true);
|
2003-05-09 16:22:46 +00:00
|
|
|
|
|
|
|
// language
|
2011-01-01 19:46:44 +00:00
|
|
|
$languageSettingsContent = new htmlTable();
|
2003-05-09 16:22:46 +00:00
|
|
|
// read available languages
|
2003-07-15 14:28:41 +00:00
|
|
|
$languagefile = "../../config/language";
|
2011-01-01 19:46:44 +00:00
|
|
|
if(is_file($languagefile)) {
|
2003-05-09 16:22:46 +00:00
|
|
|
$file = fopen($languagefile, "r");
|
2011-01-01 19:46:44 +00:00
|
|
|
while(!feof($file)) {
|
2003-05-09 16:22:46 +00:00
|
|
|
$line = fgets($file, 1024);
|
2003-05-12 17:52:54 +00:00
|
|
|
if($line == "\n" || $line[0] == "#" || $line == "") continue; // ignore comment and empty lines
|
2011-01-01 19:46:44 +00:00
|
|
|
$line = chop($line);
|
|
|
|
$entry = explode(":", $line);
|
|
|
|
$languages[$entry[2]] = $line;
|
2003-05-09 16:22:46 +00:00
|
|
|
}
|
|
|
|
fclose($file);
|
2011-01-01 19:46:44 +00:00
|
|
|
$languageSelect = new htmlTableExtendedSelect('lang', $languages, array($conf->get_defaultLanguage()), _("Default language"), '209');
|
|
|
|
$languageSelect->setHasDescriptiveElements(true);
|
|
|
|
$languageSettingsContent->addElement($languageSelect, true);
|
2003-05-09 16:22:46 +00:00
|
|
|
}
|
2011-01-01 19:46:44 +00:00
|
|
|
else {
|
|
|
|
$languageSettingsContent->addElement(new htmlStatusMessage('ERROR', "Unable to load available languages. Setting English as default language."));
|
2003-05-09 16:22:46 +00:00
|
|
|
}
|
2011-01-01 19:46:44 +00:00
|
|
|
$languageSettings = new htmlFieldset($languageSettingsContent, _("Language settings"), '../../graphics/language.png');
|
|
|
|
$container->addElement($languageSettings, true);
|
|
|
|
$container->addElement(new htmlSpacer(null, '10px'), true);
|
2003-05-09 16:22:46 +00:00
|
|
|
|
2010-02-20 17:26:10 +00:00
|
|
|
// lamdaemon settings
|
2011-01-01 19:46:44 +00:00
|
|
|
$lamdaemonSettingsContent = new htmlTable();
|
|
|
|
$lamdaemonSettingsContent->addElement(new htmlTableExtendedInputField(_("Server list"), 'scriptservers', $conf->get_scriptServers(), '218'), true);
|
|
|
|
$lamdaemonSettingsContent->addElement(new htmlTableExtendedInputField(_("Path to external script"), 'scriptpath', $conf->get_scriptPath(), '210'), true);
|
|
|
|
$lamdaemonSettingsContent->addElement(new htmlSpacer(null, '5px'), true);
|
|
|
|
$lamdaemonSettingsContent->addElement(new htmlOutputText(_("Rights for the home directory")));
|
2007-02-22 17:16:14 +00:00
|
|
|
$chmod = $conf->get_scriptRights();
|
2011-01-01 19:46:44 +00:00
|
|
|
$rightsTable = new htmlTable();
|
|
|
|
$rightsTable->addElement(new htmlOutputText(''));
|
|
|
|
$rightsTable->addElement(new htmlOutputText(_("Read")));
|
|
|
|
$rightsTable->addElement(new htmlOutputText(_("Write")));
|
|
|
|
$rightsTable->addElement(new htmlOutputText(_("Execute")), true);
|
|
|
|
$rightsTable->addElement(new htmlOutputText(_("Owner")));
|
|
|
|
$rightsTable->addElement(new htmlInputCheckbox('chmod_owr', checkChmod("read","owner", $chmod)));
|
|
|
|
$rightsTable->addElement(new htmlInputCheckbox('chmod_oww', checkChmod("write","owner", $chmod)));
|
|
|
|
$rightsTable->addElement(new htmlInputCheckbox('chmod_owe', checkChmod("execute","owner", $chmod)), true);
|
|
|
|
$rightsTable->addElement(new htmlOutputText(_("Group")));
|
|
|
|
$rightsTable->addElement(new htmlInputCheckbox('chmod_grr', checkChmod("read","group", $chmod)));
|
|
|
|
$rightsTable->addElement(new htmlInputCheckbox('chmod_grw', checkChmod("write","group", $chmod)));
|
|
|
|
$rightsTable->addElement(new htmlInputCheckbox('chmod_gre', checkChmod("execute","group", $chmod)), true);
|
|
|
|
$rightsTable->addElement(new htmlOutputText(_("Other")));
|
|
|
|
$rightsTable->addElement(new htmlInputCheckbox('chmod_otr', checkChmod("read","other", $chmod)));
|
|
|
|
$rightsTable->addElement(new htmlInputCheckbox('chmod_otw', checkChmod("write","other", $chmod)));
|
|
|
|
$rightsTable->addElement(new htmlInputCheckbox('chmod_ote', checkChmod("execute","other", $chmod)), true);
|
|
|
|
$lamdaemonSettingsContent->addElement($rightsTable);
|
|
|
|
$lamdaemonSettingsContent->addElement(new htmlHelpLink('219'));
|
|
|
|
$lamdaemonSettings = new htmlFieldset($lamdaemonSettingsContent, _("Lamdaemon settings"), '../../graphics/lamdaemon.png');
|
|
|
|
$container->addElement($lamdaemonSettings, true);
|
|
|
|
$container->addElement(new htmlSpacer(null, '10px'), true);
|
|
|
|
|
|
|
|
|
|
|
|
parseHtml(null, $container, array(), false, $tabindex, 'user');
|
2003-11-15 10:35:58 +00:00
|
|
|
|
2010-08-29 16:02:51 +00:00
|
|
|
// LAM Pro settings
|
|
|
|
if (isLAMProVersion()) {
|
|
|
|
|
|
|
|
$pwdMailContent = new htmlTable();
|
|
|
|
|
|
|
|
$pwdMailFrom = new htmlTableExtendedInputField(_('From address'), 'pwdResetMail_from', $conf->getLamProMailFrom(), '550');
|
|
|
|
$pwdMailContent->addElement($pwdMailFrom, true);
|
|
|
|
|
|
|
|
$pwdMailSubject = new htmlTableExtendedInputField(_('Subject'), 'pwdResetMail_subject', $conf->getLamProMailSubject(), '551');
|
|
|
|
$pwdMailContent->addElement($pwdMailSubject, true);
|
|
|
|
|
|
|
|
$pwdMailBody = new htmlTableExtendedInputTextarea('pwdResetMail_body', $conf->getLamProMailText(), 50, 4, _('Text'), '552');
|
|
|
|
$pwdMailContent->addElement($pwdMailBody, true);
|
|
|
|
|
|
|
|
$pwdMailFieldset = new htmlFieldset($pwdMailContent, _("Password mail settings"), '../../graphics/mailBig.png');
|
|
|
|
parseHtml(null, $pwdMailFieldset, array(), true, $tabindex, 'config');
|
|
|
|
|
|
|
|
echo ("<br>\n");
|
|
|
|
}
|
|
|
|
|
2003-06-24 15:50:38 +00:00
|
|
|
// security setings
|
2010-08-29 16:02:51 +00:00
|
|
|
echo ("<fieldset><legend><img align=\"middle\" src=\"../../graphics/security.png\" alt=\"security.png\"> " . _("Security settings") . "</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
|
2010-08-29 16:02:51 +00:00
|
|
|
echo ("<tr><td align=\"right\">".
|
|
|
|
_("Login method") . " </td>".
|
2009-03-07 16:22:30 +00:00
|
|
|
"<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";
|
2010-08-29 16:02:51 +00:00
|
|
|
echo _("List of valid users") . " * </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";
|
2010-08-29 16:02:51 +00:00
|
|
|
echo _("LDAP suffix") . " * </td>".
|
2009-03-07 16:22:30 +00:00
|
|
|
"<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";
|
2010-08-29 16:02:51 +00:00
|
|
|
echo _("LDAP filter") . " * </td>".
|
2009-03-07 16:22:30 +00:00
|
|
|
"<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> </td></tr>\n");
|
2003-05-15 18:21:44 +00:00
|
|
|
|
2003-05-09 16:22:46 +00:00
|
|
|
// new password
|
2010-08-29 16:02:51 +00:00
|
|
|
echo ("<tr><td align=\"right\"><font color=\"red\">".
|
|
|
|
_("New password") . " </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
|
2010-08-29 16:02:51 +00:00
|
|
|
echo ("<tr><td align=\"right\"><font color=\"red\">".
|
|
|
|
_("Reenter password") . " </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
|
|
|
|
2003-07-25 15:41:51 +00:00
|
|
|
echo ("<p>* = ". _("required") . "</p>");
|
|
|
|
|
2010-08-28 09:34:00 +00:00
|
|
|
echo ("</div></div></form>\n");
|
2003-02-25 21:28:17 +00:00
|
|
|
echo ("</body>\n");
|
|
|
|
echo ("</html>\n");
|
|
|
|
|
2004-07-24 17:14:39 +00:00
|
|
|
|
2006-01-31 16:57:12 +00:00
|
|
|
/**
|
2009-07-12 13:40:32 +00:00
|
|
|
* Checks user input and saves the entered settings.
|
2006-01-31 16:57:12 +00:00
|
|
|
*
|
2009-07-12 13:40:32 +00:00
|
|
|
* @return array list of errors
|
2006-01-31 16:57:12 +00:00
|
|
|
*/
|
2009-07-12 13:40:32 +00:00
|
|
|
function checkInput() {
|
2006-01-31 16:57:12 +00:00
|
|
|
$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
|
|
|
}
|
2009-05-03 18:23:36 +00:00
|
|
|
$conf->setUseTLS($_POST['useTLS']);
|
2010-11-20 19:23:29 +00:00
|
|
|
/* if (!$conf->set_cacheTimeout($_POST['cachetimeout'])) {
|
2006-01-31 16:57:12 +00:00
|
|
|
$errors[] = array("ERROR", _("Cache timeout is invalid!"));
|
2010-11-20 19:23:29 +00:00
|
|
|
}*/
|
2010-02-06 18:30:21 +00:00
|
|
|
$conf->set_searchLimit($_POST['searchLimit']);
|
2007-12-30 12:32:48 +00:00
|
|
|
if (isLAMProVersion()) {
|
|
|
|
$conf->setAccessLevel($_POST['accessLevel']);
|
2010-08-29 16:02:51 +00:00
|
|
|
if (!$conf->setLamProMailFrom($_POST['pwdResetMail_from'])) {
|
|
|
|
$errors[] = array("ERROR", _("From address for password mails is invalid."), $_POST['pwdResetMail_from']);
|
|
|
|
}
|
|
|
|
$conf->setLamProMailSubject($_POST['pwdResetMail_subject']);
|
|
|
|
$conf->setLamProMailText($_POST['pwdResetMail_body']);
|
2007-12-30 12:32:48 +00:00
|
|
|
}
|
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))) {
|
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_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'])) {
|
2006-01-31 16:57:12 +00:00
|
|
|
$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
|
|
|
}
|
2006-01-31 16:57:12 +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;
|
2006-01-31 16:57:12 +00:00
|
|
|
}
|
|
|
|
|
2003-02-25 21:28:17 +00:00
|
|
|
?>
|
|
|
|
|