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"); echo ("\n"); echo "\n"; echo ("\n"); echo ("\n"); // 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 "\n"; } echo ("

". "\"LDAP

\n
\n

 

\n"); 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 "
"; } // 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"); echo "\n"; echo "\n"; echo "
"; // show tabs echo ""; echo "\n"; $buttonSpace = '         '; // general settings echo "'; // account types echo "'; // module selection echo "'; // module settings echo "'; echo ""; // spacer echo ""; // save button echo "'; // cancel button echo "'; echo "
\n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/bigTools.png);'; echo "\n"; echo "
\n"; echo '
\n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/gear.png);'; echo "\n"; echo "
\n"; echo '
\n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/modules.png);'; echo "\n"; echo "
\n"; echo '
\n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/moduleSettings.png);'; echo "\n"; echo "
\n"; echo '
  \n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/pass.png);'; echo "\n"; echo "
\n"; echo '
\n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/fail.png);'; echo "\n"; echo "
\n"; echo '
\n"; // end tabs echo "


\n"; echo ("
\"profiles.png\" " . _("Server settings") . "
\n"); echo (""); // serverURL echo ("". "\n"); echo "\n"; $tabindex++; // use TLS echo "\n"; echo "\n"; echo "\n"; $tabindex++; // new line echo (""); // tree suffix echo ("". "\n"); echo "\n"; $tabindex++; // new line echo (""); // LDAP cache timeout echo ("". "\n"); $tabindex++; echo "\n"; // access level is only visible in Pro version if (isLAMProVersion()) { // new line echo (""); // access level echo ("". "\n"); $tabindex++; echo "\n"; } echo ("
" . _("Server address") . " *: ". "get_ServerURL() . "\">". ""; printHelpLink(getHelp('', '201'), '201'); echo "
" . _("Activate TLS") . ": \n"; echo "\n"; echo ""; printHelpLink(getHelp('', '201'), '201'); echo "
 
". _("Tree suffix") . ": get_Suffix('tree') . "\">"; printHelpLink(getHelp('', '203'), '203'); echo "
 
". _("Cache timeout") . ": "; printHelpLink(getHelp('', '214'), '214'); echo "
 
". _("Access level") . ": "; printHelpLink(getHelp('', '215'), '215'); echo "
"); echo ("
"); echo ("
"); echo ("
\"language.png\" " . _("Language settings") . "
\n"); echo ("\n"); // language echo (""); echo ("\n"); echo "\n"; echo ("
" . _("Default language") . ":\n"); // read available languages $languagefile = "../../config/language"; 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); $i++; } fclose($file); // generate language list echo ("\n"); $tabindex++; } else { echo _("Unable to load available languages. Setting English as default language. For further instructions please contact the Admin of this site."); } echo (""; printHelpLink(getHelp('', '209'), '209'); echo "
\n"); echo ("
\n"); echo ("
\n"); // script settings echo ("
\"lamdaemon.png\" " . _("Script settings") . "
\n"); echo ("\n"); echo ("". "\n"); $tabindex++; echo "\n"; echo ("". "\n"); $tabindex++; echo "\n"; echo "\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 "\n"; echo ("
". _("Server list") . ": get_scriptServers(false) . "\">"; printHelpLink(getHelp('', '218'), '218'); echo "
". _("Path to external script") . ": get_scriptPath() . "\">"; printHelpLink(getHelp('', '210'), '210'); echo "
". _("Rights for the home directory") . ": \n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
" . _("Read") . "" . _("Write") . ""._("Execute")."
"._("Owner")."
"._("Group")."
"._("Other")."
"; $tabindex++; echo "
"; printHelpLink(getHelp('', '219'), '219'); echo "
\n"); echo ("
\n"); 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 '
'; 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!")); } if (isLAMProVersion()) { $conf->setAccessLevel($_POST['accessLevel']); } $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; } ?>