if ($_SESSION['formdata']['add_user']['password'] != '') { echo "value='{$_SESSION['formdata']['add_user']['password']}'"; } echo "/></td></tr>\n"; echo "<tr><th>{$strGroup}</th>"; if ($_SESSION['formdata']['add_user']['groupid'] != '') { echo "<td>" . group_drop_down('groupid', $_SESSION['formdata']['add_user']['groupid']) . "</td>"; } else { echo "<td>" . group_drop_down('groupid', 0) . "</td>"; } echo "</tr>"; echo "<tr><th>{$strRole}</th>"; if ($_SESSION['formdata']['add_user']['roleid'] != '') { echo "<td>" . role_drop_down('roleid', $_SESSION['formdata']['add_user']['roleid']) . "</td>"; } else { echo "<td>" . role_drop_down('roleid', $CONFIG['default_roleid']) . "</td>"; } echo "</tr>"; echo "<tr><th>{$strJobTitle} <sup class='red'>*</sup></th><td><input maxlength='50' name='jobtitle' size='30'"; if ($_SESSION['formdata']['add_user']['jobtitle'] != '') { echo "value='{$_SESSION['formdata']['add_user']['jobtitle']}'"; } echo "/></td></tr>\n"; echo "<tr id='email'><th>{$strEmail} <sup class='red'>*</sup></th><td><input maxlength='50' name='email' size='30'"; if ($_SESSION['formdata']['add_user']['email'] != '') { echo "value='{$_SESSION['formdata']['add_user']['email']}'"; } echo "/></td></tr>\n"; echo "<tr><th>{$strTelephone}</th><td><input maxlength='50' name='phone' size='30'"; if ($_SESSION['formdata']['add_user']['phone'] != '') { echo "value='{$_SESSION['formdata']['add_user']['phone']}'";
/** * HTML for a config variable input box * @author Ivan Lucas * @param string $setupvar The setup variable key name * @param bool $showvarnames Whether to display the config variable name * @returns string HTML */ function cfgVarInput($setupvar, $showvarnames = FALSE) { global $CONFIG, $CFGVAR; if ($CFGVAR[$setupvar]['type'] == 'languageselect' or $CFGVAR[$setupvar]['type'] == 'languagemultiselect') { $available_languages = available_languages(); } $html .= "<div class='configvar'>"; if ($CFGVAR[$setupvar]['title'] != '') { $title = $CFGVAR[$setupvar]['title']; } else { $title = $setupvar; } $html .= "<h4>{$title}</h4>"; if ($CFGVAR[$setupvar]['help'] != '') { $html .= "<p class='helptip'>{$CFGVAR[$setupvar]['help']}</p>\n"; } $value = ''; if (!$cfg_file_exists or $cfg_file_exists and $cfg_file_writable) { $value = $CONFIG[$setupvar]; if (is_bool($value)) { if ($value == TRUE) { $value = 'TRUE'; } else { $value = 'FALSE'; } } elseif (is_array($value)) { if (is_assoc($value)) { $value = "array(" . implode_assoc('=>', ',', $value) . ")"; } else { $value = "array(" . implode(',', $value) . ")"; } } if ($setupvar == 'db_password' and $_REQUEST['action'] != 'reconfigure') { $value = ''; } } $value = stripslashes($value); switch ($CFGVAR[$setupvar]['type']) { case 'select': $html .= "<select name='{$setupvar}' id='{$setupvar}'>"; if (empty($CFGVAR[$setupvar]['options'])) { $CFGVAR[$setupvar]['options'] = "TRUE|FALSE"; } $options = explode('|', $CFGVAR[$setupvar]['options']); foreach ($options as $option) { $html .= "<option value=\"{$option}\""; if ($option == $value) { $html .= " selected='selected'"; } $html .= ">{$option}</option>\n"; } $html .= "</select>"; break; case 'percent': $html .= "<select name='{$setupvar}' id='{$setupvar}'>"; for ($i = 0; $i <= 100; $i++) { $html .= "<option value=\"{$i}\""; if ($i == $value) { $html .= " selected='selected'"; } $html .= ">{$i}</option>\n"; } $html .= "</select>%"; break; case 'interfacestyleselect': $html .= interfacestyle_drop_down($setupvar, $value); break; case 'languageselect': if (empty($value)) { $value = $_SESSION['lang']; } $html .= array_drop_down($available_languages, $setupvar, $value, '', TRUE); break; case 'languagemultiselect': if (empty($value)) { foreach ($available_languages as $code => $lang) { $value[] = $code; } $checked = TRUE; } else { $checked = FALSE; $replace = array('array(', ')', "'"); $value = str_replace($replace, '', $value); $value = explode(',', $value); } $html .= array_drop_down($available_languages, $setupvar, $value, '', TRUE, TRUE); $attributes = "onchange=\"toggle_multiselect('{$setupvar}[]')\""; $html .= "<label>" . html_checkbox($setupvar . 'checkbox', $checked, ""); $html .= $GLOBALS['strAll'] . "</label>"; break; case 'slaselect': $html .= serviceleveltag_drop_down($setupvar, $value, TRUE); break; case 'userselect': $html .= user_drop_down($setupvar, $value, FALSE, FALSE, '', TRUE); break; case 'siteselect': $html .= site_drop_down($setupvar, $value, FALSE); break; case 'userstatusselect': $html .= userstatus_drop_down($setupvar, $value); break; case 'roleselect': $html .= role_drop_down($setupvar, $value); break; case 'number': $html .= "<input type='text' name='{$setupvar}' id='{$setupvar}' size='7' value=\"{$value}\" />"; break; case '1darray': $replace = array('array(', ')', "'"); $value = str_replace($replace, '', $value); $html .= "<input type='text' name='{$setupvar}' id='{$setupvar}' size='60' value=\"{$value}\" />"; break; case '2darray': $replace = array('array(', ')', "'", '\\r', '\\n'); $value = str_replace($replace, '', $value); $value = str_replace(',', "\n", $value); $html .= "<textarea name='{$setupvar}' id='{$setupvar}' cols='60' rows='10'>{$value}</textarea>"; break; case 'password': $html .= "<input type='password' id='cfg{$setupvar}' name='{$setupvar}' size='16' value=\"{$value}\" /> " . password_reveal_link("cfg{$setupvar}"); break; case 'ldappassword': $html .= "<input type='password' id='cfg{$setupvar}' name='{$setupvar}' size='16' value=\"{$value}\" /> " . password_reveal_link("cfg{$setupvar}"); $html .= " <a href='javascript:void(0);' onclick=\"checkLDAPDetails('status{$setupvar}');\">{$GLOBALS['strCheckLDAPDetails']}</a>"; break; case 'text': default: if (strlen($CONFIG[$setupvar]) < 65) { $html .= "<input type='text' name='{$setupvar}' id='{$setupvar}' size='60' value=\"{$value}\" />"; } else { $html .= "<textarea name='{$setupvar}' id='{$setupvar}' cols='60' rows='10'>{$value}</textarea>"; } } if (!empty($CFGVAR[$setupvar]['unit'])) { $html .= " {$CFGVAR[$setupvar]['unit']}"; } if (!empty($CFGVAR[$setupvar]['helplink'])) { $html .= ' ' . help_link($CFGVAR[$setupvar]['helplink']); } if ($setupvar == 'db_password' and $_REQUEST['action'] != 'reconfigure' and $value != '') { $html .= "<p class='info'>The current password setting is not shown</p>"; } if ($showvarnames) { $html .= "<br />(<var>\$CONFIG['{$setupvar}']</var>)"; } if ($CFGVAR[$setupvar]['statusfield'] == 'TRUE') { $html .= "<div id='status{$setupvar}'></div>"; } $html .= "</div>"; $html .= "<br />\n"; if ($c == 1) { $c == 2; } else { $c = 1; } return $html; }
echo "<form id='edituser' action='{$_SERVER['PHP_SELF']}' method='post'>"; echo "<table align='center' class='vertical'>"; echo "<col width='250'></col><col width='*'></col>"; echo "<tr><th colspan='2'>"; if ($edituserid == $sit[2]) { echo sprintf($strAboutPerson, $strYou); } else { echo sprintf($strAboutPerson, $user->realname); } echo "</th></tr>\n"; echo "<tr><th>{$strUsername}</th><td>{$user->username}</td></tr>"; echo "<tr><th>{$strRole}</th>"; if ($edituserid == $sit[2] or $edituserid == 1) { echo "<td>{$user->rolename}</td>"; } else { echo "<td>" . role_drop_down('roleid', $user->roleid) . "</td>"; } echo "</tr>"; echo "<tr><th>{$strRealName}</th><td>"; if ($_SESSION['user_source'] != 'sit' and !empty($CONFIG['ldap_realname'])) { echo "<input name='realname' type='hidden' value=\"{$user->realname}\" '/>{$user->realname}"; } else { echo "<input class='required' maxlength='50' name='realname' size='30'"; echo " type='text' value=\"{$user->realname}\" />"; echo " <span class='required'>{$strRequired}</span>"; } echo "</td></tr>\n"; echo "<tr><th>{$strSource}</th><td>{$user->source}</td></th>"; echo "<tr><th>{$strJobTitle}</th>"; echo "<td>"; if ($_SESSION['user_source'] != 'sit' and !empty($CONFIG['ldap_jobtitle'])) {
if (empty($submit)) { $title = $strAddRole; include APPLICATION_INCPATH . 'htmlheader.inc.php'; echo show_form_errors('role_add'); clear_form_errors('role_add'); echo "<h2>{$strAddRole}</h2>"; echo "<form method='post' action='{$_SERVER['PHP_SELF']}'>"; echo "<table class='vertical'>"; echo "<tr><th>{$strName}</th>"; echo "<td><input class='required' size='30' name='rolename' /><span class='required'>{$strRequired}</span></td></tr>"; echo "<tr><th>{$strDescription}</th><td><textarea name='description' id='description' rows='5' cols='30'>{$_SESSION['formdata']['role_add']['description']}</textarea></td></tr>"; echo "<tr><th>{$strCopyFrom}</th><td>"; if ($_SESSION['formdata']['role_add']['roleid'] != '') { echo role_drop_down('copyfrom', $_SESSION['formdata']['role_add']['roleid']); } else { echo role_drop_down('copyfrom', 0); } echo "</td></tr>"; echo "</table>"; echo "<p><input name='submit' type='submit' value='{$strAddRole}' /></p>"; echo "</form>"; include APPLICATION_INCPATH . 'htmlfooter.inc.php'; clear_form_data('role_add'); } else { $rolename = cleanvar($_REQUEST['rolename']); $description = cleanvar($_REQUEST['description']); $copyfrom = cleanvar($_REQUEST['copyfrom']); $_SESSION['formdata']['role_add'] = $_REQUEST; if (empty($rolename)) { $errors++; $_SESSION['formerrors']['role_add']['rolename'] = sprintf($strFieldMustNotBeBlank, $strName);