get_Passwd()) { /** go back to login if password is invalid */ require('conflogin.php'); exit; } // update type settings if (isset($_POST['postAvailable'])) { $postKeys = array_keys($_POST); for ($i = 0; $i < sizeof($postKeys); $i++) { $key = $postKeys[$i]; if (substr($key, 0, 7) == "suffix_") { $_SESSION['conf_typeSettings'][$key] = $_POST[$key]; } elseif (substr($key, 0, 5) == "attr_") { $_SESSION['conf_typeSettings'][$key] = $_POST[$key]; } } } $errors = array(); // user pressed submit/abort button if ($_POST['submit']) { // check settings $allOK = true; $postKeys = array_keys($_POST); for ($i = 0; $i < sizeof($postKeys); $i++) { $key = $postKeys[$i]; if (substr($key, 0, 7) == "suffix_") { $type = substr($postKeys[$i], 7); if (strlen($_POST[$key]) < 1) { $errors[] = array("ERROR", _("LDAP Suffix is invalid!"), getTypeAlias($type)); $allOK = false; } } elseif (substr($key, 0, 5) == "attr_") { $type = substr($postKeys[$i], 5); if (!is_string($_POST[$key]) || !eregi("^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$", $_POST[$key])) { $errors[] = array("ERROR", _("List attributes are invalid!"), getTypeAlias($type)); $allOK = false; } } } //selection ok, back to other settings if ($allOK) { // check if there is a new type $addedType = false; for ($i = 0; $i < sizeof($_SESSION['conf_accountTypes']); $i++) { if (!in_array($_SESSION['conf_accountTypes'][$i], $_SESSION['conf_accountTypesOld'])) { $addedType = true; break; } } $_SESSION['conf_accountTypesOld'] = $_SESSION['conf_accountTypes']; if ($addedType) { metarefresh('confmain.php?typesback=true&typeschanged=true'); } else { metarefresh('confmain.php?typesback=true'); } exit; } } // no changes elseif ($_POST['abort']) { $_SESSION['conf_accountTypes'] = $_SESSION['conf_accountTypesOld']; metarefresh('confmain.php?typesback=true'); exit; } // check if remove button was pressed $postKeys = array_keys($_POST); for ($i = 0; $i < sizeof($postKeys); $i++) { $key = $postKeys[$i]; if (substr($key, 0, 4) == "rem_") { $type = substr($key, 4); $_SESSION['conf_accountTypes'] = array_flip($_SESSION['conf_accountTypes']); unset($_SESSION['conf_accountTypes'][$type]); $_SESSION['conf_accountTypes'] = array_flip($_SESSION['conf_accountTypes']); $_SESSION['conf_accountTypes'] = array_values($_SESSION['conf_accountTypes']); } } // check if add button was pressed $postKeys = array_keys($_POST); for ($i = 0; $i < sizeof($postKeys); $i++) { $key = $postKeys[$i]; if (substr($key, 0, 4) == "add_") { $type = substr($key, 4); $_SESSION['conf_accountTypes'][] = $type; } } // get active and available types $allTypes = getTypes(); $activeTypes = $_SESSION['conf_accountTypes']; $availableTypes = array(); for ($i = 0; $i < sizeof($allTypes); $i++) { if (!in_array($allTypes[$i], $activeTypes)) $availableTypes[] = $allTypes[$i]; } echo $_SESSION['header']; echo "