get_typeSettings(); // get active and available types $allTypes = getTypes(); $activeTypes = $conf->get_ActiveTypes(); $availableTypes = array(); for ($i = 0; $i < sizeof($allTypes); $i++) { if (!in_array($allTypes[$i], $activeTypes)) $availableTypes[] = $allTypes[$i]; } echo $_SESSION['header']; echo "" . _("LDAP Account Manager Configuration") . "\n"; echo "\n"; echo "\n"; for ($i = 0; $i < sizeof($allTypes); $i++){ echo "\n"; } echo "\n"; echo "\n"; echo ("

". "\"LDAP


\n

 

\n"); // print error messages for ($i = 0; $i < sizeof($errorsToDisplay); $i++) call_user_func_array('StatusMessage', $errorsToDisplay[$i]); echo ("
\n"); echo "\n"; echo "\n"; echo "
"; // show tabs echo ""; echo "\n"; $buttonWidth = 0; $buttonTexts = array(_('General settings'), _('Account types'), _('Modules'), _('Save'), _('Cancel')); for ($b = 0; $b < sizeof($buttonTexts); $b++) { $tempWidth = round(0.8 * strlen(utf8_decode($buttonTexts[$b]))) + 2; if ($buttonWidth < $tempWidth) $buttonWidth = $tempWidth; } $buttonSpace = '       '; // general settings echo "'; // account types echo "'; // module selection echo "'; echo ""; // save button echo "'; // cancel button echo "'; echo "
\n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/bigTools.png);width:' . $buttonWidth . 'em;'; echo "\n"; echo "
\n"; echo '
\n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/gear.png);width:' . $buttonWidth . 'em;'; echo "\n"; echo "
\n"; echo '
\n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/modules.png);width:' . $buttonWidth . 'em;'; echo "\n"; echo "
\n"; echo '
 \n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/pass.png);width:' . $buttonWidth . 'em;'; echo "\n"; echo "
\n"; echo '
\n"; echo "\n"; echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/fail.png);width:' . $buttonWidth . 'em;'; echo "\n"; echo "
\n"; echo '
\n"; // end tabs echo "


\n"; // show available types if (sizeof($availableTypes) > 0) { echo "
" . _("Available account types") . "\n"; echo "\n"; for ($i = 0; $i < sizeof($availableTypes); $i++) { $icon = '' . $availableTypes[$i] . ' '; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "
$icon" . getTypeAlias($availableTypes[$i]) . ": " . getTypeDescription($availableTypes[$i]) . "
\n"; echo "
\n"; echo "



"; } // show active types if (sizeof($activeTypes) > 0) { echo "
" . _("Active account types") . "
\n"; for ($i = 0; $i < sizeof($activeTypes); $i++) { echo "
\n"; $icon = '' . $activeTypes[$i] . ' '; echo "" . $icon . "" . getTypeAlias($activeTypes[$i]) . ": " . getTypeDescription($activeTypes[$i]) . ""; echo "
\n"; echo "\n"; // LDAP suffix echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; // list attributes if (isset($typeSettings['attr_' . $activeTypes[$i]])) { $attributes = $typeSettings['attr_' . $activeTypes[$i]]; } else { $attributes = getDefaultListAttributes($activeTypes[$i]); } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; // remove button echo "\n"; echo "\n"; echo "\n"; echo "
" . _("LDAP suffix") . ""; printHelpLink(getHelp('', '202'), '202'); echo "
" . _("List attributes") . ""; printHelpLink(getHelp('', '206'), '206'); echo "
 
\n"; echo "

\n"; } echo "
\n"; echo "



\n"; } echo "\n"; echo "



\n"; echo '
'; echo "
\n"; echo "\n"; echo "\n"; /** * Checks user input and saves the entered settings. * * @return array list of errors */ function checkInput() { if (!isset($_POST['postAvailable'])) { return array(); } $errors = array(); $conf = &$_SESSION['conf_config']; $typeSettings = $conf->get_typeSettings(); $accountTypes = $conf->get_ActiveTypes(); $postKeys = array_keys($_POST); for ($i = 0; $i < sizeof($postKeys); $i++) { $key = $postKeys[$i]; // check if remove button was pressed if (substr($key, 0, 4) == "rem_") { $type = substr($key, 4); $accountTypes = array_flip($accountTypes); unset($accountTypes[$type]); $accountTypes = array_flip($accountTypes); $accountTypes = array_values($accountTypes); } // check if add button was pressed else if (substr($key, 0, 4) == "add_") { $type = substr($key, 4); $accountTypes[] = $type; } // set suffixes elseif (substr($key, 0, 7) == "suffix_") { $typeSettings[$key] = $_POST[$key]; $type = substr($postKeys[$i], 7); if (strlen($_POST[$key]) < 1) { $errors[] = array("ERROR", _("LDAP Suffix is invalid!"), getTypeAlias($type)); } } elseif (substr($key, 0, 5) == "attr_") { $typeSettings[$key] = $_POST[$key]; $type = substr($postKeys[$i], 5); if (!is_string($_POST[$key]) || !eregi("^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$", $_POST[$key])) { $errors[] = array("ERROR", _("List attributes are invalid!"), getTypeAlias($type)); } } } // save input $conf->set_typeSettings($typeSettings); $conf->set_ActiveTypes($accountTypes); return $errors; } ?>