get_Passwd()) {
/** go back to login if password is invalid */
require('conflogin.php');
exit;
}
echo $_SESSION['header'];
echo "
" . _("LDAP Account Manager Configuration") . "\n";
echo "\n";
echo "\n";
echo ("".
"
");
// check new preferences
if (!$conf->set_ServerURL($serverurl)) {
echo ("" . _("Server Address is empty!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_cacheTimeout($cachetimeout)) {
echo ("" . _("Cache timeout is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_Adminstring($admins)) {
echo ("" . _("List of admin users is empty or invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_UserSuffix($suffusers)) {
echo ("" . _("UserSuffix is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_GroupSuffix($suffgroups)) {
echo ("" . _("GroupSuffix is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_HostSuffix($suffhosts)) {
echo ("" . _("HostSuffix is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_DomainSuffix($suffdomains)) {
echo ("" . _("DomainSuffix is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_userlistAttributes($usrlstattr)) {
echo ("" . _("User list attributes are invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_grouplistAttributes($grplstattr)) {
echo ("" . _("Group list attributes are invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_hostlistAttributes($hstlstattr)) {
echo ("" . _("Host list attributes are invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_MaxListEntries($maxlistentries)) {
echo ("" . _("Max list entries is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_defaultLanguage($lang)) {
echo ("" . _("Language is not defined!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_scriptpath($scriptpath)) {
echo ("" . _("Script path is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$conf->set_scriptserver($scriptserver)) {
echo ("" . _("Script server is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (! $conf->set_UserModules($_SESSION['conf_usermodules'])) {
echo ("" . _("Saving user modules failed!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (! $conf->set_GroupModules($_SESSION['conf_groupmodules'])) {
echo ("" . _("Saving group modules failed!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (! $conf->set_HostModules($_SESSION['conf_hostmodules'])) {
echo ("" . _("Saving host modules failed!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
// check module options
// create option array to check and save
$options = array();
$opt_keys = array_keys($_SESSION['config_types']);
foreach ($opt_keys as $element) {
// text fields
if ($_SESSION['config_types'][$element] == "text") {
$options[$element] = array($_SESSION['config_moduleSettings'][$element]);
}
// checkboxes
elseif ($_SESSION['config_types'][$element] == "checkbox") {
if ($_SESSION['config_moduleSettings'][$element] == "on") $options[$element] = array('true');
else $options[$element] = array('false');
}
// dropdownbox
elseif ($_SESSION['config_types'][$element] == "select") {
$options[$element] = array($_SESSION['config_moduleSettings'][$element]);
}
// multiselect
elseif ($_SESSION['config_types'][$element] == "multiselect") {
$options[$element] = $_SESSION['config_moduleSettings'][$element]; // value is already an array
}
}
// remove double slashes if magic quotes are on
if (get_magic_quotes_gpc() == 1) {
foreach ($opt_keys as $element) {
if (is_string($options[$element][0])) $options[$element][0] = stripslashes($options[$element][0]);
}
}
// check options
$errors = checkConfigOptions($_SESSION['config_scopes'], $options);
// print error messages if any
if (sizeof($errors) > 0) {
for ($i = 0; $i < sizeof($errors); $i++) {
if (sizeof($errors[$i]) > 3) { // messages with additional variables
StatusMessage($errors[$i][0], $errors[$i][1], $errors[$i][2], $errors[$i][3]);
}
else {
StatusMessage($errors[$i][0], $errors[$i][1], $errors[$i][2]);
}
}
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
// save module setting
$conf->set_moduleSettings($options);
// check if password was changed
if ($passwd1) {
if ($passwd1 != $passwd2) {
echo ("" . _("Passwords are different!") . "");
exit;
}
// set new password
if ($passwd1 != "") {
$conf->set_Passwd($passwd1);
echo ("" . _("Password changed!") . "
");
}
}
// save settings and display new settings
$conf->save();
echo ("" . _("The following settings were saved to profile:") . " " . $filename . "
");
$conf->printconf();
echo ("
" . _("Back to Login") . "");
echo("