server()) { metaRefresh("../login.php"); exit; } // empty list of attribute types $_SESSION['profile_types'] = array(); // print header echo $_SESSION['header']; echo "\n\n"; echo "
\n"; // check if account type is valid $type = $_GET['type']; if (!(($type == 'user') || ($type == 'group') || ($type == 'host'))) meta_refresh('profilemain.php'); // get module options $options = getProfileOptions($type); // load old profile if needed $old_options = array(); if ($_GET['edit']) { if ($type == "user") $old_options = loadUserProfile($_GET['edit']); else if ($type == "group") $old_options = loadGroupProfile($_GET['edit']); else if ($type == "host") $old_options = loadHostProfile($_GET['edit']); } // display formular echo ("
\n"); // suffix box // get root suffix $rootsuffix = call_user_func(array($_SESSION['config'], 'get_' . ucfirst($type) . 'Suffix')); // get subsuffixes $suffixes = array(); foreach ($_SESSION['ldap']->search_units($rootsuffix) as $suffix) { $suffixes[] = $suffix; } if (sizeof($suffixes) > 0) { echo "
\n" . _("LDAP suffix") . "\n"; echo _("LDAP suffix") . ":  "; echo "\n"; echo "  " . _('Help') . "\n"; echo "
\n
\n"; } // display module options $modules = array_keys($options); for ($m = 0; $m < sizeof($modules); $m++) { // ignore modules without options if (sizeof($options[$modules[$m]]) < 1) continue; echo "
\n"; echo "" . getModuleAlias($modules[$m], $type) . "\n"; echo "\n"; for ($l = 0; $l < sizeof($options[$modules[$m]]); $l++) { // option lines echo "\n"; for ($o = 0; $o < sizeof($options[$modules[$m]][$l]); $o++) { // line parts echo ""; print_option($options[$modules[$m]][$l][$o], $modules[$m], $old_options); echo "\n"; } echo "\n"; } echo "
\n"; echo "
\n"; echo "
"; } // profile name and submit/abort buttons echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo (""); echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); echo (""); echo ("\n"); echo ("
" . _("Profile name") . ":" . _("Help") . "
 
\n"); echo (" 
\n"); echo "\n"; echo ("
\n"); /** * prints out the row of a section table including the option name, values and help * * @param array $values an array formated as module option * @param string $module_name the name of the module the options belong to * @param array $old_options a hash array with the values from the loaded profile */ function print_option($values, $modulename, $old_options) { switch ($values['kind']) { // text value case 'text': echo $values['text'] . "\n"; break; // help link case 'help': echo "" . _('Help') . "\n"; break; // input field case 'input': if (($values['type'] == 'text') || ($values['type'] == 'checkbox')) { if ($values['type'] == 'text') { $output = "\n"; $_SESSION['profile_types'][$values['name']] = "multiselect"; } else { echo "\n"; break; // subtable case 'table': echo "\n"; for ($l = 0; $l < sizeof($values['value']); $l++) { // option lines echo "\n"; for ($o = 0; $o < sizeof($values['value'][$l]); $o++) { // line parts echo "\n"; } echo "\n"; } echo "
"; print_option($values['value'][$l][$o], $values['value'], $old_options); echo "
\n"; break; // print error message for invalid types default: echo _("Unrecognized type") . ": " . $values['kind'] . "\n"; break; } } ?>