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."); /** go back to login if password is invalid */ metaRefresh('conflogin.php'); exit; } $_SESSION['conf_isAuthenticated'] = $conf->getName(); // check if user canceled editing if (isset($_POST['cancelSettings'])) { metaRefresh("../login.php"); exit; } $errorsToDisplay = array(); // 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'])) { $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; } } } // index for tab order $tabindex = 1; echo $_SESSION['header']; echo ("" . _("LDAP Account Manager Configuration") . "\n"); // include all CSS files $cssDirName = dirname(__FILE__) . '/../../style'; $cssDir = dir($cssDirName); while ($cssEntry = $cssDir->read()) { if (substr($cssEntry, strlen($cssEntry) - 4, 4) != '.css') continue; echo "\n"; } echo "\n"; echo ("\n"); echo ("\n"); // include all JavaScript files $jsDirName = dirname(__FILE__) . '/../lib'; $jsDir = dir($jsDirName); $jsFiles = array(); while ($jsEntry = $jsDir->read()) { if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue; $jsFiles[] = $jsEntry; } sort($jsFiles); foreach ($jsFiles as $jsEntry) { echo "\n"; } ?>
 LDAP Account Manager  LDAP Account Manager

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 "
"; } // display error messages if (sizeof($errorsToDisplay) > 0) { for ($i = 0; $i < sizeof($errorsToDisplay); $i++) { call_user_func_array('StatusMessage', $errorsToDisplay[$i]); } echo "
"; } // display formular echo ("
\n"); $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'); // hidden submit buttons which are clicked by tabs echo "
\n"; echo ""; echo ""; echo ""; echo ""; echo "
\n"; // tabs echo '
'; echo ''; ?>
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); // tree suffix $serverSettingsContent->addElement(new htmlTableExtendedInputField(_("Tree suffix"), 'sufftree', $conf->get_Suffix('tree'), '203'), true); // LDAP search limit $searchLimitOptions = array( '-' => 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); // access level is only visible in Pro version if (isLAMProVersion()) { $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); } $serverSettings = new htmlFieldset($serverSettingsContent, _("Server settings"), '../../graphics/profiles.png'); $container->addElement($serverSettings, true); $container->addElement(new htmlSpacer(null, '10px'), true); // language $languageSettingsContent = new htmlTable(); // read available languages $languagefile = "../../config/language"; if(is_file($languagefile)) { $file = fopen($languagefile, "r"); while(!feof($file)) { $line = fgets($file, 1024); if($line == "\n" || $line[0] == "#" || $line == "") continue; // ignore comment and empty lines $line = chop($line); $entry = explode(":", $line); $languages[$entry[2]] = $line; } fclose($file); $languageSelect = new htmlTableExtendedSelect('lang', $languages, array($conf->get_defaultLanguage()), _("Default language"), '209'); $languageSelect->setHasDescriptiveElements(true); $languageSettingsContent->addElement($languageSelect, true); } else { $languageSettingsContent->addElement(new htmlStatusMessage('ERROR', "Unable to load available languages. Setting English as default language.")); } $languageSettings = new htmlFieldset($languageSettingsContent, _("Language settings"), '../../graphics/language.png'); $container->addElement($languageSettings, true); $container->addElement(new htmlSpacer(null, '10px'), true); // lamdaemon settings $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"))); $chmod = $conf->get_scriptRights(); $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'); // 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 ("
\n"); } // security setings echo ("
\"security.png\" " . _("Security settings") . "
\n"); echo ("\n"); // login method echo ("". "\n"); $tabindex++; echo "\n"; // admin list $adminText = implode("\n", explode(";", $conf->get_Adminstring())); echo "". "\n"; echo "\n"; $tabindex++; // login search suffix echo "". "\n"; echo "\n"; $tabindex++; // login search filter echo "". "\n"; echo "\n"; $tabindex++; echo ("\n"); // new password echo ("". "\n"); $tabindex++; echo "\n"; // reenter password echo ("". "\n"); $tabindex++; echo ("
". _("Login method") . " "; printHelpLink(getHelp('', '220'), '220'); echo "
\n"; echo _("List of valid users") . " * "; printHelpLink(getHelp('', '207'), '207'); echo "
\n"; echo _("LDAP suffix") . " * getLoginSearchSuffix() . "\" size=50>"; printHelpLink(getHelp('', '221'), '221'); echo "
\n"; echo _("LDAP filter") . " * getLoginSearchFilter() . "\" size=50>"; printHelpLink(getHelp('', '221'), '221'); echo "
 
". _("New password") . " "; printHelpLink(getHelp('', '212'), '212'); echo "
". _("Reenter password") . "
\n"); echo ("
\n"); echo ("

* = ". _("required") . "

"); echo ("
\n"); echo ("\n"); echo ("\n"); /** * Checks user input and saves the entered settings. * * @return array list of errors */ function checkInput() { $conf = &$_SESSION['conf_config']; $types = $conf->get_ActiveTypes(); // 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'])) { $errors[] = array("ERROR", _("Server address is invalid!")); } $conf->setUseTLS($_POST['useTLS']); /* if (!$conf->set_cacheTimeout($_POST['cachetimeout'])) { $errors[] = array("ERROR", _("Cache timeout is invalid!")); }*/ $conf->set_searchLimit($_POST['searchLimit']); if (isLAMProVersion()) { $conf->setAccessLevel($_POST['accessLevel']); 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']); } $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]); } $conf->setLoginMethod($_POST['loginMethod']); $conf->setLoginSearchFilter($_POST['loginSearchFilter']); $conf->setLoginSearchSuffix($_POST['loginSearchSuffix']); 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!")); } if (!$conf->set_scriptservers($_POST['scriptservers'])) { $errors[] = array("ERROR", _("Script server is invalid!")); } $chmodOwner = 0; $chmodGroup = 0; $chmodOther = 0; 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; $chmod = $chmodOwner . $chmodGroup . $chmodOther; if (!$conf->set_scriptrights($chmod)) { $errors[] = array("ERROR", _("Script rights are 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']); } } return $errors; } ?>