本文整理汇总了PHP中title_trim函数的典型用法代码示例。如果您正苦于以下问题:PHP title_trim函数的具体用法?PHP title_trim怎么用?PHP title_trim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了title_trim函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: if
<td>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td nowrap style='white-space: nowrap;' width="100">
Filter by host:
</td>
<td width="1">
<select name="cbo_graph_id" onChange="window.location=document.form_graph_id.cbo_graph_id.options[document.form_graph_id.cbo_graph_id.selectedIndex].value">
<option value="graphs.php?host_id=-1&filter=<?php print $_REQUEST["filter"];?>"<?php if ($_REQUEST["host_id"] == "-1") {?> selected<?php }?>>Any</option>
<option value="graphs.php?host_id=0&filter=<?php print $_REQUEST["filter"];?>"<?php if ($_REQUEST["host_id"] == "0") {?> selected<?php }?>>None</option>
<?php
$hosts = db_fetch_assoc("select id,".sql_function_concat("description","' ('","hostname","')'")." as name from host order by description,hostname");
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
print "<option value='graphs.php?host_id=" . $host["id"] . "&filter=" . $_REQUEST["filter"] . "&page=1'"; if ($_REQUEST["host_id"] == $host["id"]) { print " selected"; } print ">" . title_trim($host["name"], 40) . "</option>\n";
}
}
?>
</select>
</td>
<td nowrap style='white-space: nowrap;' width="50">
Search:
</td>
<td width="1">
<input type="text" name="filter" size="20" value="<?php print $_REQUEST["filter"];?>">
</td>
<td nowrap style='white-space: nowrap;'>
<input type="image" src="images/button_go.gif" alt="Go" border="0" align="absmiddle">
<input type="image" src="images/button_clear.gif" name="clear" alt="Clear" border="0" align="absmiddle">
</td>
示例2: db_fetch_assoc
"<?php
if ($_REQUEST["host_id"] == "0") {
?>
selected<?php
}
?>
>None</option>
<?php
$hosts = db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname");
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
print "<option value='data_sources.php?host_id=" . $host["id"] . "&page=1'";
if ($_REQUEST["host_id"] == $host["id"]) {
print " selected";
}
print ">" . title_trim($host["name"], 40) . "</option>\n";
}
}
?>
</select>
</td>
<td width="30"></td>
<td width="60">
Search:
</td>
<td width="1">
<input type="text" name="filter" size="20" value="<?php
print $_REQUEST["filter"];
?>
">
示例3: ds
function ds()
{
global $colors, $ds_actions;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("host_id"));
input_validate_input_number(get_request_var_request("page"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column string */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up sort_direction string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_ds_current_page");
kill_session_var("sess_ds_filter");
kill_session_var("sess_ds_sort_column");
kill_session_var("sess_ds_sort_direction");
kill_session_var("sess_ds_host_id");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
unset($_REQUEST["host_id"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_ds_current_page", "1");
load_current_session_value("filter", "sess_ds_filter", "");
load_current_session_value("sort_column", "sess_ds_sort_column", "name_cache");
load_current_session_value("sort_direction", "sess_ds_sort_direction", "ASC");
load_current_session_value("host_id", "sess_ds_host_id", "-1");
$host = db_fetch_row("select hostname from host where id=" . $_REQUEST["host_id"]);
html_start_box("<strong>Data Sources</strong> [host: " . (empty($host["hostname"]) ? "No Host" : $host["hostname"]) . "]", "100%", $colors["header"], "3", "center", "data_sources.php?action=ds_edit&host_id=" . $_REQUEST["host_id"]);
include "./include/html/inc_data_source_filter_table.php";
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen($_REQUEST["filter"])) {
$sql_where = "AND (data_template_data.name_cache like '%%" . $_REQUEST["filter"] . "%%'" . " OR data_template.name like '%%" . $_REQUEST["filter"] . "%%'" . " OR data_input.name like '%%" . $_REQUEST["filter"] . "%%')";
} else {
$sql_where = "";
}
if ($_REQUEST["host_id"] == "-1") {
/* Show all items */
} elseif ($_REQUEST["host_id"] == "0") {
$sql_where .= " AND data_local.host_id=0";
} elseif (!empty($_REQUEST["host_id"])) {
$sql_where .= " AND data_local.host_id=" . $_REQUEST["host_id"];
}
$total_rows = sizeof(db_fetch_assoc("SELECT\n\t\tdata_local.id\n\t\tFROM (data_local,data_template_data)\n\t\tLEFT JOIN data_input\n\t\tON (data_input.id=data_template_data.data_input_id)\n\t\tLEFT JOIN data_template\n\t\tON (data_local.data_template_id=data_template.id)\n\t\tWHERE data_local.id=data_template_data.local_data_id\n\t\t{$sql_where}"));
$poller_intervals = array_rekey(db_fetch_assoc("SELECT data_template_data.local_data_id AS id,\n\t\tMin(data_template_data.rrd_step*rra.steps) AS poller_interval\n\t\tFROM data_template\n\t\tINNER JOIN (data_local\n\t\tINNER JOIN ((data_template_data_rra\n\t\tINNER JOIN data_template_data ON data_template_data_rra.data_template_data_id=data_template_data.id)\n\t\tINNER JOIN rra ON data_template_data_rra.rra_id = rra.id) ON data_local.id = data_template_data.local_data_id) ON data_template.id = data_template_data.data_template_id\n\t\t{$sql_where}\n\t\tGROUP BY data_template_data.local_data_id"), "id", "poller_interval");
$data_sources = db_fetch_assoc("SELECT\n\t\tdata_template_data.local_data_id,\n\t\tdata_template_data.name_cache,\n\t\tdata_template_data.active,\n\t\tdata_input.name as data_input_name,\n\t\tdata_template.name as data_template_name,\n\t\tdata_local.host_id\n\t\tFROM (data_local,data_template_data)\n\t\tLEFT JOIN data_input\n\t\tON (data_input.id=data_template_data.data_input_id)\n\t\tLEFT JOIN data_template\n\t\tON (data_local.data_template_id=data_template.id)\n\t\tWHERE data_local.id=data_template_data.local_data_id\n\t\t{$sql_where}\n\t\tORDER BY " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction'] . " LIMIT " . read_config_option("num_rows_data_source") * ($_REQUEST["page"] - 1) . "," . read_config_option("num_rows_data_source"));
html_start_box("", "100%", $colors["header"], "3", "center", "");
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, read_config_option("num_rows_data_source"), $total_rows, "data_sources.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"]);
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t<td colspan='6'>\n\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\n\t\t\t\t\t\t\t<strong><< ";
if ($_REQUEST["page"] > 1) {
$nav .= "<a class='linkOverDark' href='data_sources.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"] - 1) . "'>";
}
$nav .= "Previous";
if ($_REQUEST["page"] > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\tShowing Rows " . (read_config_option("num_rows_data_source") * ($_REQUEST["page"] - 1) + 1) . " to " . ($total_rows < read_config_option("num_rows_data_source") || $total_rows < read_config_option("num_rows_data_source") * $_REQUEST["page"] ? $total_rows : read_config_option("num_rows_data_source") * $_REQUEST["page"]) . " of {$total_rows} [{$url_page_select}]\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\n\t\t\t\t\t\t\t<strong>";
if ($_REQUEST["page"] * read_config_option("num_rows_data_source") < $total_rows) {
$nav .= "<a class='linkOverDark' href='data_sources.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"] + 1) . "'>";
}
$nav .= "Next";
if ($_REQUEST["page"] * read_config_option("num_rows_data_source") < $total_rows) {
$nav .= "</a>";
}
$nav .= " >></strong>\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n";
print $nav;
$display_text = array("name_cache" => array("Name", "ASC"), "data_input_name" => array("Data Input Method", "ASC"), "nosort" => array("Poller<br>Interval", "ASC"), "active" => array("Active", "ASC"), "data_template_name" => array("Template Name", "ASC"));
html_header_sort_checkbox($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($data_sources) > 0) {
foreach ($data_sources as $data_source) {
$data_template_name = empty($data_source["data_template_name"]) ? "<em>None</em>" : $data_source["data_template_name"];
$data_input_name = empty($data_source["data_input_name"]) ? "<em>External</em>" : $data_source["data_input_name"];
$poller_interval = isset($poller_intervals[$data_source["local_data_id"]]) ? $poller_intervals[$data_source["local_data_id"]] : 0;
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $data_source["local_data_id"]);
$i++;
form_selectable_cell("<a class='linkEditMain' href='data_sources.php?action=ds_edit&id=" . $data_source["local_data_id"] . "'>" . ($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim(htmlentities($data_source["name_cache"]), read_config_option("max_title_data_source"))) : title_trim(htmlentities($data_source["name_cache"]), read_config_option("max_title_data_source"))) . "</a>", $data_source["local_data_id"]);
form_selectable_cell(($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_input_name) : $data_input_name) . "</a>", $data_source["local_data_id"]);
form_selectable_cell(get_poller_interval($poller_interval), $data_source["local_data_id"]);
form_selectable_cell($data_source['active'], $data_source["local_data_id"]);
form_selectable_cell(($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_source['data_template_name']) : $data_source['data_template_name']) . "</a>", $data_source["local_data_id"]);
form_checkbox_cell($data_source["name_cache"], $data_source["local_data_id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
//.........这里部分代码省略.........
示例4: html_create_list
function html_create_list($form_data, $column_display, $column_id, $form_previous_value) {
if (empty($column_display)) {
foreach (array_keys($form_data) as $id) {
print '<option value="' . $id . '"';
if ($form_previous_value == $id) {
print " selected";
}
print ">" . title_trim(null_out_substitutions($form_data[$id]), 75) . "</option>\n";
}
}else{
if (sizeof($form_data) > 0) {
foreach ($form_data as $row) {
print "<option value='$row[$column_id]'";
if ($form_previous_value == $row[$column_id]) {
print " selected";
}
if (isset($row["host_id"])) {
print ">" . title_trim($row[$column_display], 75) . "</option>\n";
}else{
print ">" . title_trim(null_out_substitutions($row[$column_display]), 75) . "</option>\n";
}
}
}
}
}
示例5: syslog_messages
/** function syslog_messages()
* This is the main page display function in Syslog. Displays all the
* syslog messages that are relevant to Syslog.
*/
function syslog_messages($tab = "syslog")
{
global $colors, $sql_where, $hostfilter, $severities;
global $config, $syslog_incoming_config, $reset_multi, $syslog_levels;
include "./include/global_arrays.php";
/* force the initial timespan to be 30 minutes for performance reasons */
if (!isset($_SESSION["sess_syslog_init"])) {
$_SESSION["sess_current_timespan"] = 1;
$_SESSION["sess_syslog_init"] = 1;
}
if (file_exists("./lib/timespan_settings.php")) {
include "./lib/timespan_settings.php";
} else {
include "./include/html/inc_timespan_settings.php";
}
include dirname(__FILE__) . "/config.php";
/* create the custom css and javascript for the page */
generate_syslog_cssjs();
$url_curr_page = get_browser_query_string();
$sql_where = "";
if ($_REQUEST["rows"] == -1) {
$row_limit = read_config_option("num_rows_syslog");
} elseif ($_REQUEST["rows"] == -2) {
$row_limit = 999999;
} else {
$row_limit = $_REQUEST["rows"];
}
$syslog_messages = get_syslog_messages($sql_where, $row_limit, $tab);
$total_rows = syslog_filter($sql_where, $tab);
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, $row_limit, $total_rows, "syslog.php?tab={$tab}");
if ($total_rows > 0) {
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t\t\t<td colspan='13'>\n\t\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\t<strong><< ";
if ($_REQUEST["page"] > 1) {
$nav .= "<a class='linkOverDark' href='syslog.php?tab={$tab}&page=" . ($_REQUEST["page"] - 1) . "'>";
}
$nav .= "Previous";
if ($_REQUEST["page"] > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\tShowing Rows " . ($total_rows == 0 ? "None" : $row_limit * ($_REQUEST["page"] - 1) + 1 . " to " . ($total_rows < $row_limit || $total_rows < $row_limit * $_REQUEST["page"] ? $total_rows : $row_limit * $_REQUEST["page"]) . " of {$total_rows} [{$url_page_select}]") . "\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\t<strong>";
if ($_REQUEST["page"] * $row_limit < $total_rows) {
$nav .= "<a class='linkOverDark' href='syslog.php?tab={$tab}&page=" . ($_REQUEST["page"] + 1) . "'>";
}
$nav .= "Next";
if ($_REQUEST["page"] * $row_limit < $total_rows) {
$nav .= "</a>";
}
$nav .= " >></strong>\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
} else {
$nav = "<tr bgcolor='#" . $colors["header"] . "' class='noprint'>\n\t\t\t\t\t<td colspan='22'>\n\t\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\tNo Rows Found\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
}
print $nav;
if ($tab == "syslog") {
if (api_plugin_user_realm_auth('syslog_alerts.php')) {
$display_text = array("nosortt" => array("Actions", "ASC"), "host_id" => array("Host", "ASC"), "logtime" => array("Date", "ASC"), "message" => array("Message", "ASC"), "facility_id" => array("Facility", "ASC"), "priority_id" => array("Priority", "ASC"));
} else {
$display_text = array("host_id" => array("Host", "ASC"), "logtime" => array("Date", "ASC"), "message" => array("Message", "ASC"), "facility_id" => array("Facility", "ASC"), "priority_id" => array("Priority", "ASC"));
}
html_header_sort($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$hosts = array_rekey(syslog_db_fetch_assoc("SELECT host_id, host FROM `" . $syslogdb_default . "`.`syslog_hosts`"), "host_id", "host");
$facilities = array_rekey(syslog_db_fetch_assoc("SELECT facility_id, facility FROM `" . $syslogdb_default . "`.`syslog_facilities`"), "facility_id", "facility");
$priorities = array_rekey(syslog_db_fetch_assoc("SELECT priority_id, priority FROM `" . $syslogdb_default . "`.`syslog_priorities`"), "priority_id", "priority");
$i = 0;
if (sizeof($syslog_messages) > 0) {
foreach ($syslog_messages as $syslog_message) {
$title = "'" . str_replace("\"", "", str_replace("'", "", $syslog_message["message"])) . "'";
$tip_options = "CLICKCLOSE, 'true', WIDTH, '40', DELAY, '500', FOLLOWMOUSE, 'true', FADEIN, 450, FADEOUT, 450, BGCOLOR, '#F9FDAF', STICKY, 'true', SHADOWCOLOR, '#797C6E', TITLE, 'Message'";
syslog_row_color($colors["alternate"], $colors["light"], $i, $priorities[$syslog_message["priority_id"]], $title);
$i++;
if (api_plugin_user_realm_auth('syslog_alerts.php')) {
print "<td style='whitspace-nowrap;width:1%;'>";
if ($syslog_message['mtype'] == 'main') {
print "<a href='syslog_alerts.php?id=" . $syslog_message[$syslog_incoming_config["id"]] . "&date=" . $syslog_message["logtime"] . "&action=newedit&type=0'><img src='images/green.gif' align='absmiddle' border=0></a>\n\t\t\t\t\t\t<a href='syslog_removal.php?id=" . $syslog_message[$syslog_incoming_config["id"]] . "&date=" . $syslog_message["logtime"] . "&action=newedit&type=new&type=0'><img src='images/red.gif' align='absmiddle' border=0></a>\n";
}
print "</td>\n";
}
print "<td>" . $hosts[$syslog_message["host_id"]] . "</td>\n";
print "<td>" . $syslog_message["logtime"] . "</td>\n";
print "<td>" . (strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim($syslog_message[$syslog_incoming_config["textField"]], get_request_var_request("trimval"))) : title_trim($syslog_message[$syslog_incoming_config["textField"]], get_request_var_request("trimval"))) . "</td>\n";
print "<td>" . ucfirst($facilities[$syslog_message["facility_id"]]) . "</td>\n";
print "<td>" . ucfirst($priorities[$syslog_message["priority_id"]]) . "</td>\n";
}
} else {
print "<tr><td><em>No Messages</em></td></tr>";
}
print $nav;
html_end_box(false);
syslog_syslog_legend();
} else {
$display_text = array("name" => array("Alert Name", "ASC"), "severity" => array("Severity", "ASC"), "count" => array("Count", "ASC"), "logtime" => array("Date", "ASC"), "logmsg" => array("Message", "ASC"), "slhost" => array("Host", "ASC"), "facility" => array("Facility", "ASC"), "priority" => array("Priority", "ASC"));
html_header_sort($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($syslog_messages) > 0) {
foreach ($syslog_messages as $log) {
$title = "'" . str_replace("\"", "", str_replace("'", "", $log["logmsg"])) . "'";
//.........这里部分代码省略.........
示例6: graph
function graph() {
global $colors, $graph_actions;
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_graph_current_page");
kill_session_var("sess_graph_filter");
kill_session_var("sess_graph_host_id");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["host_id"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_graph_current_page", "1");
load_current_session_value("filter", "sess_graph_filter", "");
load_current_session_value("host_id", "sess_graph_host_id", "-1");
html_start_box("<strong>Graph Management</strong>", "98%", $colors["header"], "3", "center", "graphs.php?action=graph_edit&host_id=" . $_REQUEST["host_id"]);
include("./include/html/inc_graph_filter_table.php");
html_end_box();
/* form the 'where' clause for our main sql query */
$sql_where = "and graph_templates_graph.title_cache like '%%" . $_REQUEST["filter"] . "%%'";
if ($_REQUEST["host_id"] == "-1") {
/* Show all items */
}elseif ($_REQUEST["host_id"] == "0") {
$sql_where .= " and graph_local.host_id=0";
}elseif (!empty($_REQUEST["host_id"])) {
$sql_where .= " and graph_local.host_id=" . $_REQUEST["host_id"];
}
html_start_box("", "98%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("select
COUNT(graph_templates_graph.id)
from graph_local,graph_templates_graph
where graph_local.id=graph_templates_graph.local_graph_id
$sql_where");
$graph_list = db_fetch_assoc("select
graph_templates_graph.id,
graph_templates_graph.local_graph_id,
graph_templates_graph.height,
graph_templates_graph.width,
graph_templates_graph.title_cache,
graph_templates.name,
graph_local.host_id
from graph_local,graph_templates_graph
left join graph_templates on graph_local.graph_template_id=graph_templates.id
where graph_local.id=graph_templates_graph.local_graph_id
$sql_where
order by graph_templates_graph.title_cache,graph_local.host_id
limit " . (read_config_option("num_rows_graph")*($_REQUEST["page"]-1)) . "," . read_config_option("num_rows_graph"));
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, read_config_option("num_rows_graph"), $total_rows, "graphs.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"]);
$nav = "<tr bgcolor='#" . $colors["header"] . "'>
<td colspan='4'>
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td align='left' class='textHeaderDark'>
<strong><< "; if ($_REQUEST["page"] > 1) { $nav .= "<a class='linkOverDark' href='graphs.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"]-1) . "'>"; } $nav .= "Previous"; if ($_REQUEST["page"] > 1) { $nav .= "</a>"; } $nav .= "</strong>
</td>\n
<td align='center' class='textHeaderDark'>
Showing Rows " . ((read_config_option("num_rows_graph")*($_REQUEST["page"]-1))+1) . " to " . ((($total_rows < read_config_option("num_rows_graph")) || ($total_rows < (read_config_option("num_rows_graph")*$_REQUEST["page"]))) ? $total_rows : (read_config_option("num_rows_graph")*$_REQUEST["page"])) . " of $total_rows [$url_page_select]
</td>\n
<td align='right' class='textHeaderDark'>
<strong>"; if (($_REQUEST["page"] * read_config_option("num_rows_graph")) < $total_rows) { $nav .= "<a class='linkOverDark' href='graphs.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"]+1) . "'>"; } $nav .= "Next"; if (($_REQUEST["page"] * read_config_option("num_rows_graph")) < $total_rows) { $nav .= "</a>"; } $nav .= " >></strong>
</td>\n
</tr>
</table>
</td>
</tr>\n";
print $nav;
html_header_checkbox(array("Graph Title", "Template Name", "Size"));
$i = 0;
if (sizeof($graph_list) > 0) {
foreach ($graph_list as $graph) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
<td>
<a class="linkEditMain" href="graphs.php?action=graph_edit&id=<?php print $graph["local_graph_id"];?>"><?php print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim($graph["title_cache"], read_config_option("max_title_graph")));?></a>
</td>
<td>
<?php print ((empty($graph["name"])) ? "<em>None</em>" : $graph["name"]); ?>
</td>
<td>
<?php print $graph["height"];?>x<?php print $graph["width"];?>
</td>
<td style="<?php print get_checkbox_style();?>" width="1%" align="right">
<input type='checkbox' style='margin: 0px;' name='chk_<?php print $graph["local_graph_id"];?>' title="<?php print $graph["title_cache"];?>">
//.........这里部分代码省略.........
示例7: sizeof
</td>
<td nowrap style='white-space: nowrap;'>
<input type='image' name='move_left' src='images/move_left.gif' align='middle' alt='Left' title='Shift Left'>
</td>
<td nowrap style='white-space: nowrap;'>
<select name='predefined_timeshift' title='Define Shifting Interval' onChange="applyTimespanFilterChange(document.form_timespan_selector)">
<?php
$start_val = 1;
$end_val = sizeof($graph_timeshifts) + 1;
if (sizeof($graph_timeshifts) > 0) {
for ($shift_value = $start_val; $shift_value < $end_val; $shift_value++) {
print "<option value='{$shift_value}'";
if ($_SESSION["sess_current_timeshift"] == $shift_value) {
print " selected";
}
print ">" . title_trim($graph_timeshifts[$shift_value], 40) . "</option>\n";
}
}
?>
</select>
</td>
<td nowrap style='white-space: nowrap;'>
<input type='image' name='move_right' src='images/move_right.gif' align='middle' alt='Right' title='Shift Right'>
</td>
<td nowrap style='white-space: nowrap;'>
<input type='submit' name='button_refresh_x' value='Refresh' title='Refresh selected time span'>
<input type='submit' name='button_clear_x' value='Clear' title='Return to the default time span'>
</td>
</tr>
</table>
</form>
示例8: mikrotik_timespan_selector
function mikrotik_timespan_selector()
{
global $config, $colors, $graph_timespans, $graph_timeshifts;
?>
<script type='text/javascript'>
<!--
calendar=null;
function showCalendar(id) {
var el = document.getElementById(id);
if (calendar != null) {
calendar.hide();
} else {
var cal = new Calendar(true, null, selected, closeHandler);
cal.weekNumbers = false;
cal.showsTime = true;
cal.time24 = true;
cal.showsOtherMonths = false;
calendar = cal;
cal.setRange(1900, 2070);
cal.create();
}
calendar.setDateFormat('%Y-%m-%d %H:%M');
calendar.parseDate(el.value);
calendar.sel = el;
calendar.showAtElement(el, "Br");
return false;
}
function selected(cal, date) {
cal.sel.value = date;
}
function closeHandler(cal) {
cal.hide();
calendar = null;
}
-->
</script>
<script type="text/javascript">
<!--
function applyTimespanFilterChange(objForm) {
strURL = '?action=graphs&predefined_timespan=' + objForm.predefined_timespan.value;
strURL = strURL + '&predefined_timeshift=' + objForm.predefined_timeshift.value;
document.location = strURL;
}
-->
</script>
<tr bgcolor="#<?php
print $colors["panel"];
?>
" class="noprint">
<td class="noprint">
<form name="form_timespan_selector" method="post" action="mikrotik.php?action=graphs">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td nowrap style='white-space: nowrap;' width='55'>
Presets:
</td>
<td nowrap style='white-space: nowrap;' width='130'>
<select name='predefined_timespan' onChange="applyTimespanFilterChange(document.form_timespan_selector)">
<?php
if ($_SESSION["custom"]) {
$graph_timespans[GT_CUSTOM] = "Custom";
$start_val = 0;
$end_val = sizeof($graph_timespans);
} else {
if (isset($graph_timespans[GT_CUSTOM])) {
asort($graph_timespans);
array_shift($graph_timespans);
}
$start_val = 1;
$end_val = sizeof($graph_timespans) + 1;
}
if (sizeof($graph_timespans) > 0) {
for ($value = $start_val; $value < $end_val; $value++) {
print "<option value='{$value}'";
if ($_SESSION["sess_current_timespan"] == $value) {
print " selected";
}
print ">" . title_trim($graph_timespans[$value], 40) . "</option>\n";
}
}
?>
</select>
</td>
<td nowrap style='white-space: nowrap;' width='30'>
From:
</td>
<td width='155' nowrap style='white-space: nowrap;'>
<input type='text' name='date1' id='date1' title='Graph Begin Timestamp' size='14' value='<?php
print isset($_SESSION["sess_current_date1"]) ? $_SESSION["sess_current_date1"] : "";
?>
'>
<input style='padding-bottom: 4px;' type='image' src='<?php
print $config["url_path"];
?>
images/calendar.gif' alt='Start date selector' title='Start date selector' border='0' align='absmiddle' onclick="return showCalendar('date1');">
</td>
//.........这里部分代码省略.........
示例9: ds
//.........这里部分代码省略.........
function applyDSFilterChange(objForm) {
strURL = '?host_id=' + objForm.host_id.value;
strURL = strURL + '&filter=' + objForm.filter.value;
strURL = strURL + '&ds_rows=' + objForm.ds_rows.value;
strURL = strURL + '&template_id=' + objForm.template_id.value;
strURL = strURL + '&method_id=' + objForm.method_id.value;
document.location = strURL;
}
-->
</script>
<?php
html_start_box("<strong>Data Sources</strong> [host: " . (empty($host["hostname"]) ? "No Host" : $host["hostname"]) . "]", "100%", $colors["header"], "3", "center", "data_sources.php?action=ds_edit&host_id=" . get_request_var_request("host_id"));
?>
<tr bgcolor="<?php print $colors["panel"];?>">
<form name="form_data_sources">
<td>
<table cellpadding="1" cellspacing="0">
<tr>
<td width="50">
Host:
</td>
<td>
<select name="host_id" onChange="applyDSFilterChange(document.form_data_sources)">
<option value="-1"<?php if (get_request_var_request("host_id") == "-1") {?> selected<?php }?>>Any</option>
<option value="0"<?php if (get_request_var_request("host_id") == "0") {?> selected<?php }?>>None</option>
<?php
$hosts = db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname");
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
print "<option value='" . $host["id"] . "'"; if (get_request_var_request("host_id") == $host["id"]) { print " selected"; } print ">" . title_trim($host["name"], 40) . "</option>\n";
}
}
?>
</select>
</td>
<td width="50">
Template:
</td>
<td width="1">
<select name="template_id" onChange="applyDSFilterChange(document.form_data_sources)">
<option value="-1"<?php if (get_request_var_request("template_id") == "-1") {?> selected<?php }?>>Any</option>
<option value="0"<?php if (get_request_var_request("template_id") == "0") {?> selected<?php }?>>None</option>
<?php
$templates = db_fetch_assoc("SELECT DISTINCT data_template.id, data_template.name
FROM data_template
INNER JOIN data_template_data
ON data_template.id=data_template_data.data_template_id
WHERE data_template_data.local_data_id>0
ORDER BY data_template.name");
if (sizeof($templates) > 0) {
foreach ($templates as $template) {
print "<option value='" . $template["id"] . "'"; if (get_request_var_request("template_id") == $template["id"]) { print " selected"; } print ">" . title_trim($template["name"], 40) . "</option>\n";
}
}
?>
</select>
</td>
<td nowrap style='white-space: nowrap;'>
示例10: if
<td width="1">
<select name="method_id" onChange="applyDSFilterChange(document.form_data_sources)">
<option value="-1"<?php if ($_REQUEST["method_id"] == "-1") {?> selected<?php }?>>Any</option>
<option value="0"<?php if ($_REQUEST["method_id"] == "0") {?> selected<?php }?>>None</option>
<?php
$methods = db_fetch_assoc("SELECT DISTINCT data_input.id, data_input.name
FROM data_input
INNER JOIN data_template_data
ON data_input.id=data_template_data.data_input_id
WHERE data_template_data.local_data_id>0
ORDER BY data_input.name");
if (sizeof($methods) > 0) {
foreach ($methods as $method) {
print "<option value='" . $method["id"] . "'"; if ($_REQUEST["method_id"] == $method["id"]) { print " selected"; } print ">" . title_trim($method["name"], 40) . "</option>\n";
}
}
?>
</select>
</td>
<td width="50">
Search:
</td>
<td width="1">
<input type="text" name="filter" size="40" value="<?php print $_REQUEST["filter"];?>">
</td>
</tr>
</table>
</td>
示例11: __
?>
</select>
</td>
<td>
<select id='delay' name='delay' title='<?php
print __('Cycle Rotation Refresh Frequency');
?>
'>
<?php
if (sizeof($page_refresh_interval)) {
foreach ($page_refresh_interval as $key => $value) {
print "<option value='{$key}'";
if (get_request_var('delay') == $key) {
print ' selected';
}
print '>' . title_trim($value, 40) . "</option>\n";
}
}
?>
</select>
</td>
<td>
<select id='graphs' name='graphs' title='<?php
print __('Number of Graphs per Page');
?>
'>
<?php
foreach ($graphs_array as $key => $value) {
print "<option value='{$key}'";
if (get_request_var('graphs') == $key) {
print ' selected';
示例12: sizeof
$end_val = sizeof($graph_timespans);
} else {
if (isset($graph_timespans[GT_CUSTOM])) {
asort($graph_timespans);
array_shift($graph_timespans);
}
$start_val = 1;
$end_val = sizeof($graph_timespans) + 1;
}
if (sizeof($graph_timespans) > 0) {
for ($value = $start_val; $value < $end_val; $value++) {
print "<option value='{$value}'";
if ($_SESSION["sess_current_timespan"] == $value) {
print " selected";
}
print ">" . title_trim($graph_timespans[$value], 40) . "</option>\n";
}
}
?>
</select>
<strong> From: </strong>
<input type='text' name='date1' id='date1' size='14' value='<?php
print isset($_SESSION["sess_current_date1"]) ? $_SESSION["sess_current_date1"] : "";
?>
'>
<input type='image' src='images/calendar.gif' alt='Start date selector' border='0' align='absmiddle' onclick="return showCalendar('date1');">
<strong>To: </strong>
<input type='text' name='date2' id='date2' size='14' value='<?php
print isset($_SESSION["sess_current_date2"]) ? $_SESSION["sess_current_date2"] : "";
示例13: html_create_list
function html_create_list($form_data, $column_display, $column_id, $form_previous_value, $trim_display_length = 0) {
require_once(CACTI_BASE_PATH . "/lib/sys/variable.php");
if (empty($column_display)) {
foreach (array_keys($form_data) as $id) {
if (empty($trim_display_length)) {
$item_text = htmlspecialchars((remove_variables($form_data[$id])), ENT_QUOTES);
}else{
$item_text = htmlspecialchars((title_trim(remove_variables($form_data[$id]), $trim_display_length)), ENT_QUOTES);
}
echo '<option value="' . htmlspecialchars($id, ENT_QUOTES) . '"';
if (strval($form_previous_value) == $id) {
echo " selected";
}
echo ">$item_text</option>\n";
}
}else{
if (sizeof($form_data) > 0) {
foreach ($form_data as $row) {
if (empty($trim_display_length)) {
$item_text = htmlspecialchars((remove_variables($row[$column_display])), ENT_QUOTES);
}else{
$item_text = htmlspecialchars((title_trim(remove_variables($row[$column_display]), $trim_display_length)), ENT_QUOTES);
}
echo "<option value='" . htmlspecialchars($row[$column_id], ENT_QUOTES) . "'";
if (strval($form_previous_value) == $row[$column_id]) {
echo " selected";
}
//if (isset($row["host_id"])) {
// print ">" . htmlspecialchars(title_trim($row[$column_display], 75), ENT_QUOTES) . "</option>\n";
//}else{
echo ">$item_text</option>\n";
//}
}
}
}
}
示例14: hmib_running
//.........这里部分代码省略.........
}
?>
</select>
</td>
<td>
<?php
print __('Entries');
?>
</td>
<td>
<select id='rows' onChange='applyFilter()'>
<option value='-1'<?php
if (get_request_var('rows') == '-1') {
?>
selected<?php
}
?>
><?php
print __('Default');
?>
</option>
<?php
if (sizeof($item_rows)) {
foreach ($item_rows as $key => $name) {
echo "<option value='" . $key . "' " . (get_request_var('rows') == $key ? 'selected' : '') . '>' . $name . '</option>';
}
}
?>
</select>
</td>
</tr>
</table>
</td>
<input type='hidden' id='page' value='<?php
print get_request_var('page');
?>
'>
</form>
</tr>
<?php
html_end_box();
if (get_request_var('rows') == '-1') {
$num_rows = read_config_option('num_rows_table');
} else {
$num_rows = get_request_var('rows');
}
$limit = ' LIMIT ' . $num_rows * (get_request_var('page') - 1) . ',' . $num_rows;
$sql_where = "WHERE hrswr.name!='' AND hrswr.name!='System Idle Process'";
if (get_request_var('template') != '-1') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' host.host_template_id=' . get_request_var('template');
}
if (get_request_var('device') != '-1') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' host.id=' . get_request_var('device');
}
if (get_request_var('type') != '-1') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' hrs.host_type=' . get_request_var('type');
}
if (get_request_var('process') != '-1') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . " hrswr.name='" . get_request_var('process') . "'";
}
if (get_request_var('filter') != '') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . " (host.description LIKE '%" . get_request_var('filter') . "%' OR\n\t\t\thrswr.name LIKE '%" . get_request_var('filter') . "%' OR\n\t\t\thost.hostname LIKE '%" . get_request_var('filter') . "%')";
}
$sql = "SELECT hrswr.*, host.hostname, host.description, host.disabled\n\t\tFROM plugin_hmib_hrSWRun AS hrswr\n\t\tINNER JOIN host\n\t\tON host.id=hrswr.host_id\n\t\tINNER JOIN plugin_hmib_hrSystem AS hrs\n\t\tON hrs.host_id=host.id\n\t\tINNER JOIN plugin_hmib_hrSystemTypes AS hrst\n\t\tON hrst.id=hrs.host_type\n\t\t{$sql_where}\n\t\tORDER BY " . get_request_var('sort_column') . ' ' . get_request_var('sort_direction') . ' ' . $limit;
//echo $sql;
$rows = db_fetch_assoc($sql);
$total_rows = db_fetch_cell("SELECT COUNT(*)\n\t\tFROM plugin_hmib_hrSWRun AS hrswr\n\t\tINNER JOIN host\n\t\tON host.id=hrswr.host_id\n\t\tINNER JOIN plugin_hmib_hrSystem AS hrs\n\t\tON hrs.host_id=host.id\n\t\tINNER JOIN plugin_hmib_hrSystemTypes AS hrst\n\t\tON hrst.id=hrs.host_type\n\t\t{$sql_where}");
$totals = db_fetch_row("SELECT\n\t\tROUND(SUM(perfCPU),2) as cpu,\n\t\tROUND(SUM(perfMemory),2) as memory \n\t\tFROM plugin_hmib_hrSWRun AS hrswr \n\t\tINNER JOIN host ON host.id=hrswr.host_id \n\t\tINNER JOIN plugin_hmib_hrSystem AS hrs \n\t\tON hrs.host_id=host.id \n\t\tINNER JOIN plugin_hmib_hrSystemTypes AS hrst \n\t\tON hrst.id=hrs.host_type\n\t\t{$sql_where}");
$nav = html_nav_bar('hmib.php?action=running', MAX_DISPLAY_PAGES, get_request_var('page'), $num_rows, $total_rows, 16, __('Processes'), 'page', 'main');
print $nav;
html_start_box('', '100%', '', '3', 'center', '');
$display_text = array('description' => array('display' => __('Hostname'), 'sort' => 'ASC', 'align' => 'left'), 'hrswr.name' => array('display' => __('Process'), 'sort' => 'DESC', 'align' => 'left'), 'path' => array('display' => __('Path'), 'sort' => 'ASC', 'align' => 'left'), 'parameters' => array('display' => __('Parameters'), 'sort' => 'ASC', 'align' => 'left'), 'perfCpu' => array('display' => __('CPU (Hrs)'), 'sort' => 'DESC', 'align' => 'right'), 'perfMemory' => array('display' => __('Memory (MB)'), 'sort' => 'DESC', 'align' => 'right'), 'type' => array('display' => __('Type'), 'sort' => 'ASC', 'align' => 'left'), 'status' => array('display' => __('Status'), 'sort' => 'DESC', 'align' => 'right'));
html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false, 'hmib.php?action=running', 'page', 'main');
if (sizeof($rows)) {
foreach ($rows as $row) {
form_alternate_row();
if (api_plugin_user_realm_auth('host.php')) {
$host_url = "<a href='" . htmlspecialchars($config['url_path'] . 'host.php?action=edit&id=' . $row['host_id']) . "' title='" . __('Edit Device') . "'>" . $row['hostname'] . '</a>';
} else {
$host_url = $row['hostname'];
}
echo "<td style='white-space:nowrap;' align='left' width='200'><strong>" . (strlen(get_request_var('filter')) ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", $row['description'] . '</strong> [' . $host_url . ']') : $row['description'] . '</strong> [' . $host_url . ']') . '</td>';
echo "<td style='white-space:nowrap;' align='left' width='100'>" . (strlen(get_request_var('filter')) ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", $row['name']) : $row['name']) . '</td>';
echo "<td style='white-space:nowrap;' align='left' title='" . $row['path'] . "' width='100'>" . (strlen(get_request_var('filter')) ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", title_trim($row['path'], 40)) : title_trim($row['path'], 40)) . '</td>';
echo "<td style='white-space:nowrap;' align='left' title='" . $row['parameters'] . "' width='100'>" . (strlen(get_request_var('filter')) ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", title_trim($row['parameters'], 40)) : title_trim($row['parameters'], 40)) . '</td>';
echo "<td style='white-space:nowrap;' align='right'>" . number_format_i18n($row['perfCPU'] / 3600, 0) . '</td>';
echo "<td style='white-space:nowrap;' align='right'>" . number_format_i18n($row['perfMemory'] / 1024, 2) . '</td>';
echo "<td width='20' style='white-space:nowrap;' align='left'>" . (isset($hmib_hrSWTypes[$row['type']]) ? $hmib_hrSWTypes[$row['type']] : 'Unknown') . '</td>';
echo "<td style='white-space:nowrap;' align='right'>" . $hmib_hrSWRunStatus[$row['status']] . '</td>';
}
echo '</tr>';
} else {
print '<tr><td><em>' . __('No Running Software Found') . '</em></td></tr>';
}
html_end_box(false);
if (sizeof($rows)) {
print $nav;
}
running_legend($totals, $total_rows);
}
示例15: data_source
//.........这里部分代码省略.........
<tr>
<td class="nw50">
<?php print __("Host:");?>
</td>
<td class="w1">
<?php
if (isset($_REQUEST["device_id"])) {
$hostname = db_fetch_cell("SELECT description as name FROM device WHERE id=".$_REQUEST["device_id"]." ORDER BY description,hostname");
} else {
$hostname = "";
}
?>
<input class="ac_field" type="text" id="device" size="30" value="<?php print $hostname; ?>">
<input type="hidden" id="device_id">
</td>
<td class="nw50">
<?php print __("Template:");?>
</td>
<td class="w1">
<select name="template_id" onChange="applyDSFilterChange(document.form_data_sources)">
<option value="-1"<?php if (get_request_var_request("template_id") == "-1") {?> selected<?php }?>><?php print __("Any");?></option>
<option value="0"<?php if (get_request_var_request("template_id") == "0") {?> selected<?php }?>><?php print __("None");?></option>
<?php
$templates = db_fetch_assoc("SELECT DISTINCT data_template.id, data_template.name
FROM data_template
INNER JOIN data_template_data
ON data_template.id=data_template_data.data_template_id
WHERE data_template_data.local_data_id>0
ORDER BY data_template.name");
if (sizeof($templates) > 0) {
foreach ($templates as $template) {
print "<option value='" . $template["id"] . "'"; if (get_request_var_request("template_id") == $template["id"]) { print " selected"; } print ">" . title_trim($template["name"], 40) . "</option>\n";
}
}
?>
</select>
</td>
<td class="nw120">
<input type="submit" value="<?php print __("Go");?>" name="go" align="middle">
<input type="button" value="<?php print __("Clear");?>" name="clear" align="middle" onClick="clearDSFilterChange(document.form_data_sources)">
</td>
</tr>
<tr>
<td class="nw50">
<?php print __("Method:");?>
</td>
<td class="w1">
<select name="method_id" onChange="applyDSFilterChange(document.form_data_sources)">
<option value="-1"<?php if (get_request_var_request("method_id") == "-1") {?> selected<?php }?>><?php print __("Any");?></option>
<option value="0"<?php if (get_request_var_request("method_id") == "0") {?> selected<?php }?>><?php print __("None");?></option>
<?php
$methods = db_fetch_assoc("SELECT DISTINCT data_input.id, data_input.name
FROM data_input
INNER JOIN data_template_data
ON data_input.id=data_template_data.data_input_id
WHERE data_template_data.local_data_id>0
ORDER BY data_input.name");
if (sizeof($methods) > 0) {
foreach ($methods as $method) {
print "<option value='" . $method["id"] . "'"; if (get_request_var_request("method_id") == $method["id"]) { print " selected"; } print ">" . title_trim($method["name"], 40) . "</option>\n";
}
}