当前位置: 首页>>代码示例>>PHP>>正文


PHP input_validate_input_regex函数代码示例

本文整理汇总了PHP中input_validate_input_regex函数的典型用法代码示例。如果您正苦于以下问题:PHP input_validate_input_regex函数的具体用法?PHP input_validate_input_regex怎么用?PHP input_validate_input_regex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了input_validate_input_regex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()'>&nbsp;<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()'>&nbsp;<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()'>&nbsp;<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()'>&nbsp;<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()'>&nbsp;<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()'>&nbsp;<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()'>&nbsp;<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()'>&nbsp;<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()'>&nbsp;<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})) {
				$current_nav .= (empty($url) ? "" : "<a href='" . htmlspecialchars($url) . "'>") . resolve_navigation_variables($nav{$nav_level_cache{$i}["id"]}["title"]) . (empty($url) ? "" : "</a>") . " -&gt; ";
			}
		}else{
			/* there is no '?' - pull from the above array */
			$current_nav .= (empty($url) ? "" : "<a href='" . htmlspecialchars($url) . "'>") . resolve_navigation_variables($nav{$current_mappings[$i]}["title"]) . (empty($url) ? "" : "</a>") . " -&gt; ";
		}
	}

	$current_nav .= resolve_navigation_variables($current_array["title"]);

	/* keep a cache for each level we encounter */
	$nav_level_cache{$current_array["level"]} = array("id" => $current_page . ":" . $current_action, "url" => get_browser_query_string());
	$_SESSION["sess_nav_level_cache"] = $nav_level_cache;

	print $current_nav;
}
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:functions.php

示例12: form_actions

function form_actions()
{
    global $user_actions, $auth_realms;
    /* ================= 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"])) {
        if (get_request_var_post("drp_action") != "2") {
            $selected_items = sanitize_unserialize_selected_items($_POST['selected_items']);
        }
        if ($selected_items != false) {
            if (get_request_var_post("drp_action") == "1") {
                /* delete */
                for ($i = 0; $i < count($selected_items); $i++) {
                    user_remove($selected_items[$i]);
                    api_plugin_hook_function('user_remove', $selected_items[$i]);
                }
            }
            if (get_request_var_post("drp_action") == "2") {
                /* copy */
                /* ================= input validation ================= */
                input_validate_input_number(get_request_var_post("selected_items"));
                input_validate_input_number(get_request_var_post("new_realm"));
                /* ==================================================== */
                $new_username = get_request_var_post("new_username");
                $new_realm = get_request_var_post("new_realm", 0);
                $template_user = db_fetch_row("SELECT username, realm FROM user_auth WHERE id = " . get_request_var_post("selected_items"));
                $overwrite = array("full_name" => get_request_var_post("new_fullname"));
                if (strlen($new_username)) {
                    if (sizeof(db_fetch_assoc("SELECT username FROM user_auth WHERE username = '" . $new_username . "' AND realm = " . $new_realm))) {
                        raise_message(19);
                    } else {
                        if (user_copy($template_user["username"], $new_username, $template_user["realm"], $new_realm, false, $overwrite) === false) {
                            raise_message(2);
                        } else {
                            raise_message(1);
                        }
                    }
                }
            }
            if (get_request_var_post("drp_action") == "3") {
                /* enable */
                for ($i = 0; $i < count($selected_items); $i++) {
                    user_enable($selected_items[$i]);
                }
            }
            if (get_request_var_post("drp_action") == "4") {
                /* disable */
                for ($i = 0; $i < count($selected_items); $i++) {
                    user_disable($selected_items[$i]);
                }
            }
            if (get_request_var_post("drp_action") == "5") {
                /* batch copy */
                /* ================= input validation ================= */
                input_validate_input_number(get_request_var_post("template_user"));
                /* ==================================================== */
                $copy_error = false;
                $template = db_fetch_row("SELECT username, realm FROM user_auth WHERE id = " . get_request_var_post("template_user"));
                for ($i = 0; $i < count($selected_items); $i++) {
                    $user = db_fetch_row("SELECT username, realm FROM user_auth WHERE id = " . $selected_items[$i]);
                    if (isset($user) && isset($template)) {
                        if (user_copy($template["username"], $user["username"], $template["realm"], $user["realm"], true) === false) {
                            $copy_error = true;
                        }
                    }
                }
                if ($copy_error) {
                    raise_message(2);
                } else {
                    raise_message(1);
                }
            }
        }
        header("Location: user_admin.php");
        exit;
    }
    /* loop through each of the users and process them */
    $user_list = "";
    $user_array = array();
    $i = 0;
    while (list($var, $val) = each($_POST)) {
        if (preg_match("/^chk_([0-9]+)\$/", $var, $matches)) {
            /* ================= input validation ================= */
            input_validate_input_number($matches[1]);
            /* ==================================================== */
            if (get_request_var_post("drp_action") != "2") {
                $user_list .= "<li>" . htmlspecialchars(db_fetch_cell("SELECT username FROM user_auth WHERE id=" . $matches[1])) . "</li>";
            }
            $user_array[$i] = $matches[1];
            $i++;
        }
    }
    /* Check for deleting of Graph Export User */
    if (get_request_var_post("drp_action") == "1" && isset($user_array) && sizeof($user_array)) {
        /* delete */
        $exportuser = read_config_option('export_user_id');
        if (in_array($exportuser, $user_array)) {
            raise_message(22);
//.........这里部分代码省略.........
开发者ID:teddywen,项目名称:cacti,代码行数:101,代码来源:user_admin.php

示例13: form_actions

function form_actions()
{
    global $graph_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;
            }
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
            }
            switch ($_POST['delete_type']) {
                case '2':
                    /* delete all data sources referenced by this graph */
                    $data_sources = array_rekey(db_fetch_assoc('SELECT data_template_data.local_data_id
						FROM (data_template_rrd, data_template_data, graph_templates_item)
						WHERE graph_templates_item.task_item_id=data_template_rrd.id
						AND data_template_rrd.local_data_id=data_template_data.local_data_id
						AND ' . array_to_sql_or($selected_items, 'graph_templates_item.local_graph_id') . '
						AND data_template_data.local_data_id > 0'), 'local_data_id', 'local_data_id');
                    if (sizeof($data_sources)) {
                        api_data_source_remove_multi($data_sources);
                        api_plugin_hook_function('data_source_remove', $data_sources);
                    }
                    break;
            }
            api_graph_remove_multi($selected_items);
            api_plugin_hook_function('graphs_remove', $selected_items);
        } elseif ($_POST['drp_action'] == '2') {
            /* change graph template */
            input_validate_input_number(get_request_var_post('graph_template_id'));
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                change_graph_template($selected_items[$i], $_POST['graph_template_id'], true);
            }
        } elseif ($_POST['drp_action'] == '3') {
            /* duplicate */
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                duplicate_graph($selected_items[$i], 0, $_POST['title_format']);
            }
        } elseif ($_POST['drp_action'] == '4') {
            /* graph -> graph template */
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                graph_to_graph_template($selected_items[$i], $_POST['title_format']);
            }
        } elseif (preg_match('/^tr_([0-9]+)$/', $_POST['drp_action'], $matches)) {
            /* place on tree */
            input_validate_input_number(get_request_var_post('tree_id'));
            input_validate_input_number(get_request_var_post('tree_item_id'));
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                api_tree_item_save(0, $_POST['tree_id'], TREE_ITEM_TYPE_GRAPH, $_POST['tree_item_id'], '', $selected_items[$i], read_graph_config_option('default_rra_id'), 0, 0, 0, false);
            }
        } elseif ($_POST['drp_action'] == '5') {
            /* change host */
            input_validate_input_number(get_request_var_post('host_id'));
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                db_execute_prepared('UPDATE graph_local SET host_id = ? WHERE id = ?', array($_POST['host_id'], $selected_items[$i]));
                update_graph_title_cache($selected_items[$i]);
            }
        } elseif ($_POST['drp_action'] == '6') {
            /* reapply suggested naming */
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                api_reapply_suggested_graph_title($selected_items[$i]);
                update_graph_title_cache($selected_items[$i]);
            }
        } elseif ($_POST['drp_action'] == '7') {
            /* resize graphs */
            input_validate_input_number(get_request_var_post('graph_width'));
            input_validate_input_number(get_request_var_post('graph_height'));
            for ($i = 0; $i < count($selected_items); $i++) {
                /* ================= input validation ================= */
                input_validate_input_number($selected_items[$i]);
                /* ==================================================== */
                api_resize_graphs($selected_items[$i], $_POST['graph_width'], $_POST['graph_height']);
            }
//.........这里部分代码省略.........
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:graphs.php

示例14: file_get_contents

        $message = file_get_contents("./text/forgot_mail.txt") . "http://" . $_SERVER["SERVER_NAME"] . "/index.php?a=f3&u=" . $ldap_dn_search_response["uid"]["0"] . "&h=" . substr($ldap_dn_search_response["description"]["0"], 64);
        $message = str_replace("%USERNAME%", $ldap_dn_search_response["uid"]["0"], $message);
        $errors = send_mail($mailaddr, "", "Resmon reset password", $message);
        if ($errors == "") {
            $caution_msg = "Send mail for reset password. Please read mail.";
            cacti_log("SIGNUP: send mail for reset password", false, "AUTH");
        }
    } else {
        auth_display_custom_error_message("Sorry. can't find your mail address.");
        cacti_log("SIGNUP: can't find your mail address.", false, "AUTH");
    }
}
if ($action == 'f4') {
    /* ================= input validation ================= */
    input_validate_input_regex(get_request_var_request("h"), "^([a-z0-9]{64})\$");
    input_validate_input_regex(get_request_var_request("login_password"), "^([\\w\\=\\+\\-\\*\\/\\%\\^\\~\\!\\?\\&\\|\\@\\#\$\\(\\)\\[\\]\\{\\}\\<\\>\\,\\.\\;\\:]{6,})\$");
    /* ==================================================== */
    $hash2 = get_request_var_request("h");
    $password = get_request_var_request("login_password");
    include_once "./lib/ldap.php";
    $ldap_dn_search_response = cacti_ldap_search_dn("dummy", "", "", "", "", "", "", "", "", "", "description=*{$hash2}", "", "", array("uid"));
    if ($ldap_dn_search_response["error_num"] == "0") {
        $hash1 = hash_hmac('sha256', $ldap_dn_search_response["uid"]["0"] . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"], FALSE);
        $hash2 = hash_hmac("sha256", $ldap_dn_search_response["uid"]["0"] . time() . $password, FALSE);
        $ldap_dn_add_response = cacti_ldap_mod_dn(2, $ldap_dn_search_response["uid"]["0"], array("description" => $hash1 . $hash2, "userPassword" => $password));
        if ($ldap_dn_add_response["error_num"] == "0") {
            $caution_msg = "Reset user password successed.";
            cacti_log("SIGNUP: reset user password successed", false, "AUTH");
            setcookie("stay_login", "", time() - 3600, "/");
        }
    } else {
开发者ID:resmon,项目名称:resmon-cacti,代码行数:31,代码来源:auth_login.php

示例15: get_graph_list_content

function get_graph_list_content() {
	global $graphs_per_page;
	global $colors;
	require_once(CACTI_BASE_PATH . "/include/auth/auth_constants.php");

	/* Make sure nothing is cached */
	header("Cache-Control: must-revalidate");
	header("Cache-Control: post-check=0, pre-check=0", false);
	header("Pragma: no-cache");
	header("Expires: ". gmdate("D, d M Y H:i:s", mktime(date("H"), date("i"), date("s"), date("m")-1, date("d"), date("Y")))." GMT");
	header("Last-Modified: ". gmdate("D, d M Y H:i:s")." GMT");

	$current_user = db_fetch_row("SELECT * FROM user_auth WHERE id=" . $_SESSION["sess_user_id"]);

	define("MAX_DISPLAY_PAGES", 21);

	/* ================= input validation ================= */
	input_validate_input_number(get_request_var_request("device_id"));
	input_validate_input_number(get_request_var_request("graph_template_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 search string */
	if (isset($_REQUEST["filter"])) {
		$_REQUEST["filter"] = sanitize_search_string(get_request_var_request("filter"));
	}

	if ((read_config_option("auth_method") != 0) && (empty($current_user["show_list"]))) {
		print "<strong><font size='+1' color='FF0000'>" . __("YOU DO NOT HAVE RIGHTS FOR LIST VIEW") . "</font></strong>"; exit;
	}

	/* if the user pushed the 'clear' button */
	if (isset($_REQUEST["clear_x"])) {
		kill_session_var("sess_graph_view_list_current_page");
		kill_session_var("sess_graph_view_list_filter");
		kill_session_var("sess_graph_view_list_device");
		kill_session_var("sess_graph_view_list_graph_template");
		kill_session_var("sess_graph_view_list_graphs");
		kill_session_var("sess_graph_view_list_graph_list");
		kill_session_var("sess_graph_view_list_graph_add");
		kill_session_var("sess_graph_view_list_graph_remove");

		unset($_REQUEST["page"]);
		unset($_REQUEST["filter"]);
		unset($_REQUEST["device_id"]);
		unset($_REQUEST["graph_template_id"]);
		unset($_REQUEST["graphs"]);
		unset($_REQUEST["graph_list"]);
		unset($_REQUEST["graph_add"]);
		unset($_REQUEST["graph_remove"]);
	}

	/* save selected graphs into url, for backward compatibility */
	if (!empty($_REQUEST["graph_list"])) {
		foreach (explode(",",get_request_var_request("graph_list")) as $item) {
			$graph_list[$item] = 1;
		}
	}else{
		$graph_list = array();
	}

	load_current_session_value("device_id", "sess_graph_view_list_device", "0");
	load_current_session_value("graph_template_id", "sess_graph_view_list_graph_template", "0");
	load_current_session_value("filter", "sess_graph_view_list_filter", "");
	load_current_session_value("page", "sess_graph_view_list_current_page", "1");
	load_current_session_value("graphs", "sess_graph_view_list_graphs", read_graph_config_option("list_graphs_per_page"));
	load_current_session_value("graph_list", "sess_graph_view_list_graph_list", "");
	load_current_session_value("graph_add", "sess_graph_view_list_graph_add", "");
	load_current_session_value("graph_remove", "sess_graph_view_list_graph_remove", "");

	if (is_array(get_request_var_request("graph_list"))) {
		$graph_list = $_REQUEST["graph_list"];
	}

	if (!empty($_REQUEST["graph_add"])) {
		foreach (explode(",",get_request_var_request("graph_add")) as $item) {
			$graph_list[$item] = 1;
		}
	}
	/* remove items */
	if (!empty($_REQUEST["graph_remove"])) {
		foreach (explode(",",get_request_var_request("graph_remove")) as $item) {
			unset($graph_list[$item]);
		}
	}
	$_SESSION["sess_graph_view_list_graph_list"] = $graph_list;

	/* display graph view filter selector */
	html_start_box("", "100", $colors["header"], "0", "center", "");

	?>

	<tr class='rowGraphFilter noprint'>
		<td>
			<script type="text/javascript">
			<!--
			$().ready(function() {
				$("#device").autocomplete("./lib/ajax/get_devices_brief.php", { max: 12, highlight: false, scroll: true, scrollHeight: 300 });
//.........这里部分代码省略.........
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:graph_view_form.php


注:本文中的input_validate_input_regex函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。