$sql .= "WHERE contactid='{$contactid}' "; $result = mysql_query($sql); $contact_inv_count = mysql_num_rows($result); while ($items = mysql_fetch_object($result)) { $var = $items->name; if (!empty($items->identifier)) { $var .= " ({$items->identifier})"; } elseif (!empty($items->address)) { $var .= " ({$items->address})"; } $items_array[$items->id] = $var; } // Don't show inventory section if non available for contact if ($contact_inv_count > 0) { echo "<tr><td><label for='inventory'>{$strInventoryItems}:</label><br />"; echo array_drop_down($items_array, 'inventory', '', '', TRUE) . "</td><td></td></tr>"; } // Insert pre-defined per-product questions from the database, these should be required fields // These 'productinfo' questions don't have a GUI as of 27Oct05 $sql = "SELECT * FROM `{$dbProductInfo}` WHERE productid='{$productid}'"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } $numquestions = mysql_num_rows($result); $cellcount = 1; while ($productinforow = mysql_fetch_array($result)) { if ($cellcount & 1) { echo "<tr>"; } echo "<td>";
echo "checked='checked'' "; } echo "/> {$strAboveMustBeCompletedToAllowDeductions}</td></tr>\n"; echo "</tbody>\n"; echo "<tbody id='hidden' style='display:none'>"; echo "<tr><th>{$strReseller}</th><td>"; reseller_drop_down("reseller", 1); echo "</td></tr>\n"; echo "<tr><th>{$strLicenseQuantity}</th><td><input value='0' maxlength='7' name='licence_quantity' size='5' />"; echo " ({$str0MeansUnlimited})</td></tr>\n"; echo "<tr><th>{$strLicenseType}</th><td>"; licence_type_drop_down("licence_type", 0); echo "</td></tr>\n"; echo "<tr><th>{$strIncidentPool}</th>"; $incident_pools = explode(',', "{$strUnlimited},{$CONFIG['incident_pools']}"); echo "<td>" . array_drop_down($incident_pools, 'incident_poolid', $maint['incident_quantity']) . "</td></tr>\n"; echo "<tr><th>{$strProductOnly}</th><td><input name='productonly' type='checkbox' value='yes' /></td></tr></tbody>\n"; echo "</table>\n"; if ($timed) { $timed = 'yes'; } else { $timed = 'no'; } echo "<input type='hidden' id='timed' name='timed' value='{$timed}' />"; echo "<p align='center'><input name='submit' type='submit' value=\"{$strAddContract}\" /></p>"; echo "</form>"; include APPLICATION_INCPATH . 'htmlfooter.inc.php'; clear_form_data('add_contract'); } elseif ($action == "add") { // External Variables $site = cleanvar($_REQUEST['site']);
if (empty($saction->date_type) or $saction->date_type == 'month') { $month = " selected='selected' "; } else { $year = " selected='selected' "; } echo "<select name='frequency'><option value='month' {$month}>{$strMonthly}</option>"; echo "<option value='year' {$year}>{$strYearly}</option></select>"; echo "</td></tr>"; echo "<tr><th>{$strOffset}</th><td><input type='text' id='date_offset' name='date_offset' value='{$saction->date_offset}' size='5' /> ({$strDays})</td></tr>"; echo "<tr><th>{$strTime}</th><td>"; $dates = array(0 => $strMidnight, 1 => "1:00 AM", 2 => "2:00 AM", 3 => "3:00 AM", 4 => "4:00 AM", 5 => "5:00 AM", 6 => "6:00 AM", 7 => "7:00 AM", 8 => "8:00 AM", 9 => "9:00 AM", 10 => "10:00 AM", 11 => "11:00 AM", 12 => "12:00 PM", 13 => "1:00 PM", 14 => "2:00 PM", 15 => "3:00 PM", 16 => "4:00 PM", 17 => "5:00 PM", 18 => "6:00 PM", 19 => "7:00 PM", 20 => "8:00 PM", 21 => "9:00 PM", 22 => "10:00 PM", 23 => "11:00 PM"); $selected = substr($saction->date_time, 0, 2); if ($selected[0] == '0') { $selected = $selected[1]; } echo array_drop_down($dates, 'date_time', $selected, '', TRUE); echo "</td></tr>"; echo "</tbody>"; echo "</table>"; echo "<input type='hidden' name='mode' value='save' />"; echo "<input type='hidden' name='id' value='{$id}' />"; echo "<p><input type='reset' value=\"{$strReset}\" /> <input type='submit' value=\"{$strSave}\" /></p>"; echo "</form>"; echo "<p align='center'><a href='{$_SERVER['PHP_SELF']}'>{$strReturnWithoutSaving}</a></p>"; include APPLICATION_INCPATH . 'htmlfooter.inc.php'; } else { html_redirect($_SERVER['PHP_SELF'], FALSE); } break; case 'save': if (!empty($_REQUEST['startdate'])) {
if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } $row = mysql_fetch_object($result); if ($row->privacy == 'private' and $sit[2] != $row->createdby or $row->privacy == 'adminonly' and !user_permission($sit[2], 22)) { html_redirect('inventory.php', FALSE); exit; } echo "<h2>" . icon('edit', 32) . " {$strEdit}</h2>"; echo "<form action='{$_SERVER['PHP_SELF']}?id={$id}' method='post'>"; echo "<table class='vertical' align='center'>"; echo "<tr><th>{$strName}</th>"; echo "<td><input class='required' name='name' value='{$row->name}' />"; echo "<span class='required'>{$strRequired}</span></td></tr>"; echo "<tr><th>{$strType}</th>"; echo "<td>" . array_drop_down($CONFIG['inventory_types'], 'type', $row->type, '', TRUE) . "</td></tr>"; echo "<tr><th>{$strSite}</th><td>"; echo site_drop_down('site', $row->siteid, TRUE); echo " <span class='required'>{$strRequired}</td>"; echo "<tr><th>{$strOwner}</th><td>"; echo contact_site_drop_down('owner', ''); echo "</td></tr>"; echo "<tr><th>{$strID} " . help_link('InventoryID') . "</th>"; echo "<td><input name='identifier' value='{$row->identifier}' /></td></tr>"; echo "<tr><th>{$strAddress}</th>"; echo "<td><input name='address' value='{$row->address}' /></td></tr>"; if (!is_numeric($id) or ($row->privacy == 'adminonly' and user_permission($sit[2], 22) or $row->privacy == 'private' and $row->createdby == $sit[2] or $row->privacy == 'none')) { echo "<tr><th>{$strUsername}</th>"; echo "<td><input name='username' value='{$row->username}' /></td></tr>"; echo "<tr><th>{$strPassword}</th>"; echo "<td><input name='password' value='{$row->password}' /></td></tr>";
if (!empty($user->i18n)) { $selectedlang = $user->i18n; } else { $selectedlang = $_SESSION['lang']; } echo array_drop_down($available_languages, 'vari18n', $selectedlang, '', TRUE); echo "</td></tr>\n"; if ($user->utc_offset == '') { $user->utc_offset = 0; } echo "<tr><th>{$strUTCOffset}</th><td>"; foreach ($availabletimezones as $offset => $tz) { $tz = $tz . ' (' . ldate('H:i', utc_time($now) + $offset * 60) . ')'; $availtz[$offset] = $tz; } echo array_drop_down($availtz, 'utcoffset', $user->utc_offset, '', TRUE) . "</td></tr>\n"; echo "<tr><th>{$strInterfaceStyle}</th><td>" . interfacestyle_drop_down('style', $user->style) . "</td></tr>\n"; echo "<tr><th>{$strIncidentRefresh}</th>"; echo "<td><input maxlength='10' name='incidentrefresh' size='3' type='text' value=\"{$user->incident_refresh}\" /> {$strSeconds}</td></tr>\n"; echo "<tr><th>{$strIncidentLogOrder}</th><td>"; echo "<select name='updateorder'>"; echo "<option "; if ($user->update_order == "desc") { echo "selected='selected'"; } echo " value='desc'>{$strNewestAtTop}</option>\n"; echo "<option "; if ($user->update_order == "asc") { echo "selected='selected'"; } echo " value='asc'>{$strNewestAtBottom}</option>\n";
$available_languages = i18n_code_to_name($CONFIG['available_i18n']); } else { $available_languages = available_languages(); } $available_languages = array_merge(array('' => $strDefault), $available_languages); if (!empty($user->i18n)) { $selectedlang = $user->i18n; } else { $selectedlang = $_SESSION['lang']; } echo array_drop_down($available_languages, 'vari18n', $selectedlang, '', TRUE); echo "</td></tr>\n"; if ($user->utc_offset == '') { $user->utc_offset = 0; } echo "<tr><th>{$strUTCOffset}</th><td>" . array_drop_down($availabletimezones, 'utcoffset', $user->utc_offset, '', TRUE) . "</td></tr>\n"; echo "<tr><th>{$strInterfaceStyle}</th><td>" . interfacestyle_drop_down('style', $user->style) . "</td></tr>\n"; echo "<tr><th>{$strIncidentRefresh}</th>"; echo "<td><input maxlength='10' name='incidentrefresh' size='3' type='text' value=\"{$user->incident_refresh}\" /> {$strSeconds}</td></tr>\n"; echo "<tr><th>{$strIncidentLogOrder}</th><td>"; echo "<select name='updateorder'>"; echo "<option "; if ($user->update_order == "desc") { echo "selected='selected'"; } echo " value='desc'>{$strNewestAtTop}</option>\n"; echo "<option "; if ($user->update_order == "asc") { echo "selected='selected'"; } echo " value='asc'>{$strNewestAtBottom}</option>\n";
$title = $strNewEscalationPath; if (empty($submit)) { include APPLICATION_INCPATH . 'htmlheader.inc.php'; echo show_form_errors('add_escalation_path'); clear_form_errors('add_escalation_path'); echo "<h2>{$title}</h2>"; echo "<form action='" . $_SERVER['PHP_SELF'] . "' method='post' onsubmit='return confirm_action(\"{$strAreYouSureAdd}\")'>"; echo "<table class='vertical'>"; echo "<tr><th>{$strName}</th><td><input name='name' class='required' "; if ($_SESSION['formdata']['add_escalation_path']['name'] != '') { echo "value='{$_SESSION['formdata']['add_escalation_path']['name']}'"; } echo "/> <span class='required'>{$strRequired}</span></td></tr>"; echo "<tr><th>{$strType}</th><td>"; $type = array('internal' => 'Internal', 'external' => 'External'); echo array_drop_down($type, 'type', $_SESSION['formdata']['add_escalation_path']['type']); echo "</td></tr>"; echo "<tr><th>{$strTrackURL}<br /></th><td><input name='trackurl'"; if ($_SESSION['formdata']['add_escalation_path']['trackurl'] != '') { echo "value='{$_SESSION['formdata']['add_escalation_path']['trackurl']}'"; } echo "/><br />{$strNoteInsertExternalID}</td></tr>"; echo "<tr><th>{$strHomeURL}</th><td><input name='homeurl'"; if ($_SESSION['formdata']['add_escalation_path']['homeurl'] != '') { echo "value='{$_SESSION['formdata']['add_escalation_path']['homeurl']}'"; } echo "/></td></tr>"; echo "<tr><th>{$strTitle}</th><td><input name='title'"; if ($_SESSION['formdata']['add_escalation_path']['title'] != '') { echo "value='{$_SESSION['formdata']['add_escalation_path']['title']}'"; }
} if (count($available_languages) == 1 and array_key_exists($CONFIG['default_i18n'], $available_languages)) { echo "<!-- Language: {$CONFIG['default_i18n']} -->"; } else { $available_languages = array_merge(array('default' => $strDefault), $available_languages); echo "<div style='margin-left: auto; margin-right: auto; width: 380px;"; echo " text-align: center; margin-top: 3em;'>"; echo "<form id='langselectform' action='login.php' method='post'>"; echo icon('language', 16, $strLanguage) . " <label for='lang'>"; echo "{$strLanguage}</label>: "; if (!empty($_SESSION['lang'])) { $setting = $_SESSION['lang']; } else { $setting = 'default'; } echo array_drop_down($available_languages, 'lang', $setting, "onchange='this.form.submit();'", TRUE); echo "</form>"; echo "</div>"; } echo "<div class='windowbox' style='width: 220px;'>\n"; echo "<div class='windowtitle'>{$CONFIG['application_shortname']} - "; echo "{$strLogin}</div>\n"; echo "<div class='window'>\n"; echo "<form id='loginform' action='login.php' method='post'>"; echo "<label for='username'>{$strUsername}:<br /><input id='username' "; echo "name='username' size='28' type='text' /></label><br />"; echo "<label for='password'>{$strPassword}:<br /><input id='password' "; echo "name='password' size='28' type='password' /></label><br />"; echo "<input type='hidden' name='page' value='{$page}' />"; echo "<input type='submit' value='{$strLogIn}' /><br />"; echo "<br /><a href='forgotpwd.php'>{$strForgottenDetails}</a>";
if ($_GET['user'] != '0') { if ($adminuser) { $sql = "SELECT id, realname FROM `{$dbUsers}` WHERE status > 0 "; $sql .= "ORDER BY realname ASC"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $userarr[-1] = $strAll; //$userarr[0] = $CONFIG['application_shortname']; while ($userobj = mysql_fetch_object($result)) { $userarr[$userobj->id] = $userobj->realname; } echo "<form action=''>"; echo "<p>{$strUser}: "; echo array_drop_down($userarr, 'user', $selecteduser, "onchange=\"window.location.href='" . "{$_SERVER['PHP_SELF']}?user='******'center'><tr><th>{$strTrigger}</th>"; echo "<th>{$strActions}</th><th>{$strOperation}</th></tr>\n"; $shade = 'shade1'; foreach ($triggerarray as $trigger => $triggervar) { $perm = TRUE; //echo $trigger; if (isset($triggervar['permission'])) { //$triggervar['permission'] = trigger_replace_specials($trigger, $triggervar['permission'], array()); eval("\$res = {$triggervar['permission']}");
/** * 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 " /></td></tr>\n"; echo "<tr><th></th><td><a href=\"javascript:void(0);\" onclick=\"\$('hidden').toggle();\">{$strAdvanced}</a></td></tr>"; echo "</thead>\n"; echo "<tbody id='hidden' style='display:none'>"; echo "<tr><th>{$strReseller}:</th><td>"; echo reseller_drop_down("reseller", $maint["reseller"]); echo "</td></tr>\n"; echo "<tr><th>{$strLicenseQuantity}:</th>"; echo "<td><input maxlength='7' name='licence_quantity' size='5' value='{$maint['licence_quantity']}' /></td></tr>\n"; echo "<tr><th>{$strLicenseType}:</th><td>"; echo licence_type_drop_down("licence_type", $maint["licence_type"]); echo "</td></tr>\n"; echo "<tr><th>{$strIncidentPool}:</th>"; $incident_pools = explode(',', "Unlimited,{$CONFIG['incident_pools']}"); echo "<td>" . array_drop_down($incident_pools, 'incident_poolid', $maint['incident_quantity'], '', TRUE, FALSE) . "</td></tr>"; echo "<tr><th>{$strProductOnly}:</th>"; echo "<td><input name='productonly' type='checkbox' value='yes' onclick='set_terminated();' "; if ($maint["productonly"] == "yes") { echo " checked"; } echo " /></td></tr>\n"; echo "</tbody>"; echo "</table>\n"; echo "<input name='maintid' type='hidden' value='{$maintid}' />"; echo "<p align='center'><input name='submit' type='submit' value='{$strSave}' /></p>"; echo "</form>\n"; echo "<p align='center'><a href='contract_details.php?id={$maintid}'>{$strReturnWithoutSaving}</a></p>"; mysql_free_result($result); } include APPLICATION_INCPATH . 'htmlfooter.inc.php';