本文整理汇总了PHP中input_validate_input_regex函数的典型用法代码示例。如果您正苦于以下问题:PHP input_validate_input_regex函数的具体用法?PHP input_validate_input_regex怎么用?PHP input_validate_input_regex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了input_validate_input_regex函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: form_actions
function form_actions()
{
global $gprint_actions;
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_post('drp_action'), '^([a-zA-Z0-9_]+)$');
/* ==================================================== */
/* if we are to save this form, instead of display it */
if (isset($_POST['selected_items'])) {
$selected_items = unserialize(stripslashes($_POST['selected_items']));
if ($_POST['drp_action'] == '1') {
/* delete */
db_execute('DELETE FROM graph_templates_gprint WHERE ' . array_to_sql_or($selected_items, 'id'));
}
header('Location: gprint_presets.php');
exit;
}
/* setup some variables */
$gprint_list = '';
$i = 0;
/* loop through each of the graphs selected on the previous page and get more info about them */
while (list($var, $val) = each($_POST)) {
if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
$gprint_list .= '<li>' . htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM graph_templates_gprint WHERE id = ?', array($matches[1]))) . '</li>';
$gprint_array[$i] = $matches[1];
$i++;
}
}
top_header();
print "<form action='gprint_presets.php' method='post'>\n";
html_start_box('<strong>' . $gprint_actions[$_POST['drp_action']] . '</strong>', '60%', '', '3', 'center', '');
if (isset($gprint_array) && sizeof($gprint_array)) {
if ($_POST['drp_action'] == '1') {
/* delete */
print "\t<tr>\n\t\t\t\t\t<td class='textArea' class='odd'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the folling GPRINT Preset(s) will be deleted.</p>\n\t\t\t\t\t\t<ul>{$gprint_list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete GPRINT Preset(s)'>";
}
} else {
print "<tr><td class='odd'><span class='textError'>You must select at least one GPRINT Preset.</span></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($gprint_array) ? serialize($gprint_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST['drp_action'] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n";
html_end_box();
bottom_footer();
}
开发者ID:MrWnn,项目名称:cacti,代码行数:47,代码来源:gprint_presets.php
示例2: form_actions
function form_actions()
{
global $host_actions;
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_post('drp_action'), '^([a-zA-Z0-9_]+)$');
/* ==================================================== */
/* if we are to save this form, instead of display it */
if (isset($_POST['selected_items'])) {
$selected_items = unserialize(stripslashes($_POST['selected_items']));
if ($_POST['drp_action'] == '1') {
/* delete */
db_execute('DELETE FROM host_template WHERE ' . array_to_sql_or($selected_items, 'id'));
db_execute('DELETE FROM host_template_snmp_query WHERE ' . array_to_sql_or($selected_items, 'host_template_id'));
db_execute('DELETE FROM host_template_graph WHERE ' . array_to_sql_or($selected_items, 'host_template_id'));
/* "undo" any device that is currently using this template */
db_execute('UPDATE host SET host_template_id=0 WHERE ' . array_to_sql_or($selected_items, 'host_template_id'));
} elseif ($_POST['drp_action'] == '2') {
/* duplicate */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
duplicate_host_template($selected_items[$i], $_POST['title_format']);
}
}
header('Location: host_templates.php');
exit;
}
/* setup some variables */
$host_list = '';
$i = 0;
/* loop through each of the host templates selected on the previous page and get more info about them */
while (list($var, $val) = each($_POST)) {
if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
$host_list .= '<li>' . htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM host_template WHERE id = ?'), array($matches[1])) . '<br>';
$host_array[$i] = $matches[1];
$i++;
}
}
top_header();
html_start_box('<strong>' . $host_actions[$_POST['drp_action']] . '</strong>', '60%', '', '3', 'center', '');
print "<form action='host_templates.php' autocomplete='off' method='post'>\n";
if (isset($host_array) && sizeof($host_array)) {
if ($_POST['drp_action'] == '1') {
/* delete */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>Are you sure you want to delete the following Device Template(s)? All Devices currently associated\n\t\t\t\t\t\twith these Device Template(s) will lose that assocation.</p>\n\t\t\t\t\t\t<p><ul>{$host_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Device Template(s)'>";
} elseif ($_POST['drp_action'] == '2') {
/* duplicate */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Device Template(s) will be duplicated. You can\n\t\t\t\t\t\toptionally change the title format for the new Device Template(s).</p>\n\t\t\t\t\t\t<p><ul>{$host_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box('title_format', '<template_title> (1)', '', '255', '30', 'text');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Duplicate Device Template(s)'>";
}
} else {
print "<tr><td class='even'><span class='textError'>You must select at least one host template.</span></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($host_array) ? serialize($host_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST['drp_action'] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t";
html_end_box();
bottom_footer();
}
开发者ID:MrWnn,项目名称:cacti,代码行数:65,代码来源:host_templates.php
示例3: form_actions
function form_actions()
{
global $ds_actions;
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)\$");
/* ==================================================== */
/* if we are to save this form, instead of display it */
if (isset($_POST["selected_items"])) {
$selected_items = sanitize_unserialize_selected_items($_POST['selected_items']);
if ($selected_items != false) {
if ($_POST["drp_action"] == "1") {
/* delete */
$data_template_datas = db_fetch_assoc("select id from data_template_data where " . array_to_sql_or($selected_items, "data_template_id") . " and local_data_id=0");
if (sizeof($data_template_datas) > 0) {
foreach ($data_template_datas as $data_template_data) {
db_execute("delete from data_template_data_rra where data_template_data_id=" . $data_template_data["id"]);
}
}
db_execute("delete from data_template_data where " . array_to_sql_or($selected_items, "data_template_id") . " and local_data_id=0");
db_execute("delete from data_template_rrd where " . array_to_sql_or($selected_items, "data_template_id") . " and local_data_id=0");
db_execute("delete from snmp_query_graph_rrd where " . array_to_sql_or($selected_items, "data_template_id"));
db_execute("delete from snmp_query_graph_rrd_sv where " . array_to_sql_or($selected_items, "data_template_id"));
db_execute("delete from data_template where " . array_to_sql_or($selected_items, "id"));
/* "undo" any graph that is currently using this template */
db_execute("update data_template_data set local_data_template_data_id=0,data_template_id=0 where " . array_to_sql_or($selected_items, "data_template_id"));
db_execute("update data_template_rrd set local_data_template_rrd_id=0,data_template_id=0 where " . array_to_sql_or($selected_items, "data_template_id"));
db_execute("update data_local set data_template_id=0 where " . array_to_sql_or($selected_items, "data_template_id"));
} elseif ($_POST["drp_action"] == "2") {
/* duplicate */
for ($i = 0; $i < count($selected_items); $i++) {
duplicate_data_source(0, $selected_items[$i], $_POST["title_format"]);
}
}
}
header("Location: data_templates.php");
exit;
}
/* setup some variables */
$ds_list = "";
$i = 0;
/* loop through each of the graphs selected on the previous page and get more info about them */
while (list($var, $val) = each($_POST)) {
if (preg_match("/^chk_([0-9]+)\$/", $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
$ds_list .= "<li>" . htmlspecialchars(db_fetch_cell("select name from data_template where id=" . $matches[1])) . "</li>";
$ds_array[$i] = $matches[1];
$i++;
}
}
include_once "./include/top_header.php";
html_start_box("<strong>" . $ds_actions[$_POST["drp_action"]] . "</strong>", "60%", "", "3", "center", "");
print "<form action='data_templates.php' method='post'>\n";
if (isset($ds_array) && sizeof($ds_array)) {
if ($_POST["drp_action"] == "1") {
/* delete */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Template(s) will be deleted. Any data sources attached\n\t\t\t\t\t\tto these templates will become individual Data Source(s) and all Templating benefits will be removed.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Data Template(s)'>";
} elseif ($_POST["drp_action"] == "2") {
/* duplicate */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Template(s) will be duplicated. You can\n\t\t\t\t\t\toptionally change the title format for the new Data Template(s).</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box("title_format", "<template_title> (1)", "", "255", "30", "text");
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Duplicate Data Template(s)'>";
}
} else {
print "<tr><td class='even'><span class='textError'>You must select at least one data template.</span></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($ds_array) ? serialize($ds_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t";
html_end_box();
include_once "./include/bottom_footer.php";
}
开发者ID:teddywen,项目名称:cacti,代码行数:74,代码来源:data_templates.php
示例4: include
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
/* set default action */
if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = "view"; }
if (!isset($_REQUEST["view_type"])) { $_REQUEST["view_type"] = ""; }
$guest_account = true;
include("./include/auth.php");
include("./lib/rrd.php");
include("./lib/html_tree.php");
include("./include/top_graph_header.php");
/* ================= input validation ================= */
input_validate_input_regex(get_request_var("rra_id"), "^([0-9]+|all)$");
input_validate_input_number(get_request_var("local_graph_id"));
/* ==================================================== */
if ($_GET["rra_id"] == "all") {
$sql_where = " where id is not null";
}else{
$sql_where = " where id=" . $_GET["rra_id"];
}
/* make sure the graph requested exists (sanity) */
if (!(db_fetch_cell("select local_graph_id from graph_templates_graph where local_graph_id=" . $_GET["local_graph_id"]))) {
print "<strong><font size='+1' color='FF0000'>GRAPH DOES NOT EXIST</font></strong>"; exit;
}
/* take graph permissions into account here, if the user does not have permission
开发者ID:songchin,项目名称:Cacti,代码行数:31,代码来源:graph.php
示例5: define
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
include "./include/auth.php";
define("MAX_DISPLAY_PAGES", 21);
$actions = array("install" => "Install", "enable" => "Enable", "disable" => "Disable", "uninstall" => "Uninstall");
$status_names = array(-2 => 'Disabled', -1 => 'Active', 0 => 'Not Installed', 1 => 'Active', 2 => 'Awaiting Configuration', 3 => 'Awaiting Upgrade', 4 => 'Installed');
/* get the comprehensive list of plugins */
$pluginslist = retrieve_plugin_list();
/* Check to see if we are installing, etc... */
$modes = array('installold', 'uninstallold', 'install', 'uninstall', 'disable', 'enable', 'check', 'moveup', 'movedown');
if (isset($_GET['mode']) && in_array($_GET['mode'], $modes) && isset($_GET['id'])) {
input_validate_input_regex(get_request_var("id"), "^([a-zA-Z0-9]+)\$");
$mode = $_GET['mode'];
$id = sanitize_search_string($_GET['id']);
switch ($mode) {
case 'installold':
api_plugin_install_old($id);
header("Location: plugins.php");
exit;
break;
case 'uninstallold':
api_plugin_uninstall_old($id);
header("Location: plugins.php");
exit;
break;
case 'install':
api_plugin_install($id);
开发者ID:teddywen,项目名称:cacti,代码行数:31,代码来源:plugins.php
示例6: form_actions
function form_actions()
{
global $dq_actions;
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_post('drp_action'), '^([a-zA-Z0-9_]+)$');
/* ==================================================== */
/* if we are to save this form, instead of display it */
if (isset($_POST['selected_items'])) {
$selected_items = unserialize(stripslashes($_POST['selected_items']));
if ($_POST['drp_action'] == '1') {
/* delete */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
data_query_remove($selected_items[$i]);
}
}
header('Location: data_queries.php');
exit;
}
/* setup some variables */
$dq_list = '';
$i = 0;
/* loop through each of the data queries and process them */
while (list($var, $val) = each($_POST)) {
if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
$dq_list .= '<li>' . htmlspecialchars(db_fetch_cell_prepared('SELECT snmp_query.name FROM snmp_query WHERE id = ?', array($matches[1]))) . '<br>';
$dq_array[$i] = $matches[1];
$i++;
}
}
top_header();
html_start_box('<strong>' . $dq_actions[$_POST['drp_action']] . '</strong>', '60%', '', '3', 'center', '');
print "<form action='data_queries.php' method='post'>\n";
if (isset($dq_array) && sizeof($dq_array)) {
if ($_POST['drp_action'] == '1') {
/* delete */
$graphs = array();
print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea' class='odd'>\n\t\t\t\t\t\t<p>When you click \"Continue\" the following Data Querie(s) will be deleted.</p>\n\t\t\t\t\t\t<p><ul>{$dq_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
}
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Data Querie(s)'>";
} else {
print "<tr><td class='odd'><span class='textError'>You must select at least one data query.</span></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($dq_array) ? serialize($dq_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST['drp_action'] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t";
html_end_box();
bottom_footer();
}
开发者ID:MrWnn,项目名称:cacti,代码行数:53,代码来源:data_queries.php
示例7: input_validate_input_number
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
$guest_account = true;
include "./include/auth.php";
include_once "./lib/html_tree.php";
include_once "./lib/timespan_settings.php";
/* ================= input validation ================= */
input_validate_input_number(get_request_var("branch_id"));
input_validate_input_number(get_request_var("hide"));
input_validate_input_number(get_request_var("tree_id"));
input_validate_input_number(get_request_var("leaf_id"));
input_validate_input_number(get_request_var("rra_id"));
input_validate_input_regex(get_request_var_request('graph_list'), "^([\\,0-9]+)\$");
input_validate_input_regex(get_request_var_request('graph_add'), "^([\\,0-9]+)\$");
input_validate_input_regex(get_request_var_request('graph_remove'), "^([\\,0-9]+)\$");
/* ==================================================== */
/* clean up action string */
if (isset($_REQUEST["action"])) {
$_REQUEST["action"] = sanitize_search_string(get_request_var("action"));
}
/* use cached url if available and applicable */
if (isset($_SESSION["sess_graph_view_url_cache"]) && empty($_REQUEST["action"])) {
if (preg_match("/action=(preview|list)/", $_SESSION["sess_graph_view_url_cache"])) {
header("Location: " . $_SESSION["sess_graph_view_url_cache"]);
exit;
} elseif (preg_match("/action=tree/", $_SESSION["sess_graph_view_url_cache"]) && preg_match("/tree_id=/", $_SESSION["sess_graph_view_url_cache"])) {
header("Location: " . $_SESSION["sess_graph_view_url_cache"]);
exit;
} elseif (isset($_SESSION["sess_graph_view_last_tree"])) {
header("Location: " . $_SESSION["sess_graph_view_last_tree"]);
开发者ID:resmon,项目名称:resmon-cacti,代码行数:31,代码来源:graph_view.php
示例8: form_actions
function form_actions()
{
global $tree_actions;
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_post('drp_action'), '^([a-zA-Z0-9_]+)$');
/* ==================================================== */
/* if we are to save this form, instead of display it */
if (isset($_POST['selected_items'])) {
$selected_items = unserialize(stripslashes($_POST['selected_items']));
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
}
if ($_POST['drp_action'] == '1') {
/* delete */
db_execute('DELETE FROM graph_tree WHERE ' . array_to_sql_or($selected_items, 'id'));
db_execute('DELETE FROM graph_tree_items WHERE ' . array_to_sql_or($selected_items, 'graph_tree_id'));
} elseif ($_POST['drp_action'] == '2') {
/* publish */
db_execute("UPDATE graph_tree \n\t\t\t\tSET enabled='on',\n\t\t\t\tlast_modified=NOW(),\n\t\t\t\tmodified_by=" . $_SESSION['sess_user_id'] . '
WHERE ' . array_to_sql_or($selected_items, 'id'));
} elseif ($_POST['drp_action'] == '3') {
/* un-publish */
db_execute("UPDATE graph_tree \n\t\t\t\tSET enabled='',\n\t\t\t\tlast_modified=NOW(),\n\t\t\t\tmodified_by=" . $_SESSION['sess_user_id'] . '
WHERE ' . array_to_sql_or($selected_items, 'id'));
}
header('Location: tree.php');
exit;
}
/* setup some variables */
$tree_list = '';
$i = 0;
/* loop through each of the selected items */
while (list($var, $val) = each($_POST)) {
if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
$tree_list .= '<li>' . htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM graph_tree WHERE id = ?', array($matches[1]))) . '</li>';
$tree_array[$i] = $matches[1];
$i++;
}
}
top_header();
print "<form action='tree.php' method='post'>\n";
html_start_box('<strong>' . $tree_actions[$_POST['drp_action']] . '</strong>', '60%', '', '3', 'center', '');
if (isset($tree_array) && sizeof($tree_array)) {
if ($_POST['drp_action'] == '1') {
/* delete */
print "\t<tr>\n\t\t\t\t\t<td class='textArea' class='odd'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the folling Tree(s) will be deleted.</p>\n\t\t\t\t\t\t<ul>{$tree_list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Tree(s)'>";
} elseif ($_POST['drp_action'] == '2') {
/* publish */
print "\t<tr>\n\t\t\t\t\t<td class='textArea' class='odd'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Tree(s) will be Published.</p>\n\t\t\t\t\t\t<ul>{$tree_list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Publish Tree(s)'>";
} elseif ($_POST['drp_action'] == '3') {
/* un-publish */
print "\t<tr>\n\t\t\t\t\t<td class='textArea' class='odd'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Tree(s) will be Un-Published.</p>\n\t\t\t\t\t\t<ul>{$tree_list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Un-Publish Tree(s)'>";
}
} else {
print "<tr><td class='odd'><span class='textError'>You must select at least one Tree.</span></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($tree_array) ? serialize($tree_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST['drp_action'] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n";
html_end_box();
bottom_footer();
}
开发者ID:MrWnn,项目名称:cacti,代码行数:69,代码来源:tree.php
示例9: __
'uninstalled' => __('Uninstalled')
);
$ptabs = api_plugin_hook_function ('plugin_management_tabs', $ptabs);
$status_names = array(__('Not Installed'), __('Active'), __('Awaiting Configuration'), __('Awaiting Upgrade'), __('Installed'));
/* set the default settings category */
load_current_session_value('tab', 'sess_plugins_tab', 'all');
$current_tab = $_REQUEST['tab'];
$modes = array('all', 'install', 'uninstall', 'disable', 'enable', 'check');
// Check to see if we are installing, etc...
if (isset($_GET['mode']) && in_array($_GET['mode'], $modes) && isset($_GET['id'])) {
input_validate_input_regex(get_request_var('id'), '/^([a-zA-Z0-9]+)$/');
$mode = $_GET['mode'];
$id = sanitize_search_string($_GET['id']);
switch ($mode) {
case 'install':
api_plugin_install($id);
$plugins = plugins_retrieve_list();
break;
case 'uninstall':
if (!in_array($id, $plugins))
break;
api_plugin_uninstall($id);
Header("Location: plugins.php\n\n");
exit;
开发者ID:songchin,项目名称:Cacti,代码行数:31,代码来源:plugins.php
示例10: form_actions
function form_actions()
{
global $ds_actions;
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_post('drp_action'), '^([a-zA-Z0-9_]+)$');
/* ==================================================== */
/* if we are to save this form, instead of display it */
if (isset($_POST['selected_items'])) {
$selected_items = unserialize(stripslashes($_POST['selected_items']));
if ($_POST['drp_action'] == '1') {
/* delete */
if (!isset($_POST['delete_type'])) {
$_POST['delete_type'] = 1;
}
switch ($_POST['delete_type']) {
case '2':
/* delete all graph items tied to this data source */
$data_template_rrds = array_rekey(db_fetch_assoc('SELECT id FROM data_template_rrd WHERE ' . array_to_sql_or($selected_items, 'local_data_id')), 'id', 'id');
/* loop through each data source item */
if (sizeof($data_template_rrds) > 0) {
db_execute('DELETE FROM graph_templates_item WHERE task_item_id IN (' . implode(',', $data_template_rrds) . ') and local_graph_id > 0');
}
api_plugin_hook_function('graph_items_remove', $data_template_rrds);
break;
case '3':
/* delete all graphs tied to this data source */
$graphs = array_rekey(db_fetch_assoc('SELECT
graph_templates_graph.local_graph_id
FROM (data_template_rrd,graph_templates_item,graph_templates_graph)
WHERE graph_templates_item.task_item_id=data_template_rrd.id
AND graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id
AND ' . array_to_sql_or($selected_items, 'data_template_rrd.local_data_id') . '
AND graph_templates_graph.local_graph_id > 0
GROUP BY graph_templates_graph.local_graph_id'), 'local_graph_id', 'local_graph_id');
if (sizeof($graphs) > 0) {
api_graph_remove_multi($graphs);
}
api_plugin_hook_function('graphs_remove', $graphs);
break;
}
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
}
api_data_source_remove_multi($selected_items);
api_plugin_hook_function('data_source_remove', $selected_items);
} elseif ($_POST['drp_action'] == '2') {
/* change graph template */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
input_validate_input_number(get_request_var_post('data_template_id'));
/* ==================================================== */
change_data_template($selected_items[$i], $_POST['data_template_id']);
}
} elseif ($_POST['drp_action'] == '3') {
/* change host */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
input_validate_input_number(get_request_var_post('host_id'));
/* ==================================================== */
db_execute_prepared('UPDATE data_local SET host_id = ? WHERE id = ?', array($_POST['host_id'], $selected_items[$i]));
push_out_host($_POST['host_id'], $selected_items[$i]);
update_data_source_title_cache($selected_items[$i]);
}
} elseif ($_POST['drp_action'] == '4') {
/* duplicate */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
duplicate_data_source($selected_items[$i], 0, $_POST['title_format']);
}
} elseif ($_POST['drp_action'] == '5') {
/* data source -> data template */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
data_source_to_data_template($selected_items[$i], $_POST['title_format']);
}
} elseif ($_POST['drp_action'] == '6') {
/* data source enable */
for ($i = 0; $i < count($selected_items); $i++) {
api_data_source_enable($selected_items[$i]);
}
} elseif ($_POST['drp_action'] == '7') {
/* data source disable */
for ($i = 0; $i < count($selected_items); $i++) {
api_data_source_disable($selected_items[$i]);
}
} elseif ($_POST['drp_action'] == '8') {
/* reapply suggested data source naming */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
api_reapply_suggested_data_source_title($selected_items[$i]);
//.........这里部分代码省略.........
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:data_sources.php
示例11: draw_navigation_text
//.........这里部分代码省略.........
"pollers.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,pollers.php:", "url" => "", "level" => "2"),
"device_templates.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,device_templates.php:", "url" => "", "level" => "2"),
"device_templates.php:save_dt" => array("title" => __("Actions"), "mapping" => "index.php:,device_templates.php:", "url" => "", "level" => "2"),
"device_templates.php:save_dq" => array("title" => __("Actions"), "mapping" => "index.php:,device_templates.php:", "url" => "", "level" => "2"),
"device_templates.php:" => array("title" => __("Device Templates"), "mapping" => "index.php:", "url" => "device_templates.php", "level" => "1"),
"device_templates.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,device_templates.php:", "url" => "", "level" => "2"),
"index.php:" => array("title" => __("Console"), "mapping" => "", "url" => CACTI_URL_PATH . "index.php", "level" => "0"),
"index.php:login" => array("title" => __("Console"), "mapping" => "", "url" => CACTI_URL_PATH . "index.php", "level" => "0"),
"rra.php:" => array("title" => __("Round Robin Archives"), "mapping" => "index.php:", "url" => "rra.php", "level" => "1"),
"rra.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,rra.php:", "url" => "", "level" => "2"),
"rra.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,rra.php:", "url" => "", "level" => "2"),
"settings.php:" => array("title" => __("Cacti Settings"), "mapping" => "index.php:", "url" => "settings.php", "level" => "1"),
"settings.php:shift" => array("title" => __("Cacti Settings"), "mapping" => "index.php:", "url" => "settings.php", "level" => "1"),
"templates_export.php:" => array("title" => __("Export Templates"), "mapping" => "index.php:", "url" => "templates_export.php", "level" => "1"),
"templates_export.php:create" => array("title" => __("Export Templates"), "mapping" => "index.php:,templates_export.php:", "url" => "templates_export.php", "level" => "2"),
"templates_export.php:save" => array("title" => __("Export Results"), "mapping" => "index.php:,templates_export.php:", "url" => "templates_export.php", "level" => "2"),
"templates_import.php" => array("title" => __("Import Templates"), "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
"templates_import.php:" => array("title" => __("Import Templates"), "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
"templates_import.php:create" => array("title" => __("Import Templates"), "mapping" => "index.php:,templates_import.php", "url" => "templates_import.php", "level" => "1"),
"tree.php:" => array("title" => __("Graph Trees"), "mapping" => "index.php:", "url" => "tree.php", "level" => "1"),
"tree.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,tree.php:", "url" => "", "level" => "2"),
"tree.php:item_edit" => array("title" => __("Graph Tree Items"), "mapping" => "index.php:,tree.php:,tree.php:edit", "url" => "", "level" => "3"),
"tree.php:item_remove" => array("title" => "(Remove Item)", "mapping" => "index.php:,tree.php:,tree.php:edit", "url" => "", "level" => "3"),
"tree.php:remove" => array("title" => __("(Remove)"), "mapping" => "index.php:,tree.php:", "url" => "", "level" => "2"),
"user_admin.php:actions" => array("title" => "(Action)", "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"user_admin.php:" => array("title" => __("User Management"), "mapping" => "index.php:", "url" => "user_admin.php", "level" => "1"),
"user_admin.php:graph_perms_edit" => array("title" => __("Edit (Graph Permissions)"), "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"user_admin.php:graph_settings_edit" => array("title" => __("Edit (Graph Settings)"), "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"user_admin.php:user_edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"user_admin.php:user_realms_edit" => array("title" => __("Edit (Realm Permissions)"), "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"utilities.php:" => array("title" => __("Utilities"), "mapping" => "index.php:", "url" => "utilities.php", "level" => "1"),
"utilities.php:clear_logfile" => array("title" => __("Clear Cacti Log File"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:clear_poller_cache" => array("title" => __("Clear Poller Cache"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:clear_user_log" => array("title" => __("Clear User Log File"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_logfile" => array("title" => __("View Cacti Log File"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_poller_cache" => array("title" => __("View Poller Cache"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_snmp_cache" => array("title" => __("View SNMP Cache"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_tech" => array("title" => __("Technical Support"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_user_log" => array("title" => __("View User Log File"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"vdef.php:" => array("title" => __("VDEF's"), "mapping" => "index.php:", "url" => "vdef.php", "level" => "1"),
"vdef.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,vdef.php:", "url" => "", "level" => "2"),
"vdef.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,vdef.php:", "url" => "", "level" => "2"),
"vdef.php:remove" => array("title" => __("(Remove)"), "mapping" => "index.php:,vdef.php:", "url" => "", "level" => "2"),
"vdef.php:item_edit" => array("title" => __("VDEF Items"), "mapping" => "index.php:,vdef.php:,vdef.php:edit", "url" => "", "level" => "3"),
"xaxis_presets.php:" => array("title" => __("X-Axis Presets"), "mapping" => "index.php:", "url" => "xaxis_presets.php", "level" => "1"),
"xaxis_presets.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,xaxis_presets.php:", "url" => "", "level" => "2"),
"xaxis_presets.php:item_edit" => array("title" => __("X-Axis Items"), "mapping" => "index.php:,xaxis_presets.php:,xaxis_presets.php:edit", "url" => "", "level" => "3"),
"xaxis_presets.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,xaxis_presets.php:", "url" => "", "level" => "2"),
);
$nav = api_plugin_hook_function('draw_navigation_text', $nav);
$current_page = basename($_SERVER["PHP_SELF"]);
input_validate_input_regex(get_request_var_request("action"), "/^([a-zA-Z0-9_-]+)$/");
$current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
/* find the current page in the big array */
$current_array = $nav{$current_page . ":" . $current_action};
$current_mappings = explode(",", $current_array["mapping"]);
$current_nav = "";
/* resolve all mappings to build the navigation string */
for ($i=0; ($i<count($current_mappings)); $i++) {
if (empty($current_mappings[$i])) { continue; }
if ($i == 0) {
/* always use the default for level == 0 */
$url = $nav{$current_mappings[$i]}["url"];
}elseif (!empty($nav_level_cache{$i}["url"])) {
/* found a match in the url cache for this level */
$url = $nav_level_cache{$i}["url"];
}elseif (!empty($current_array["url"])) {
/* found a default url in the above array */
$url = $current_array["url"];
}else{
/* default to no url */
$url = "";
}
if ($current_mappings[$i] == "?") {
/* '?' tells us to pull title from the cache at this level */
if (isset($nav_level_cache{$i})) {
$
|
请发表评论