• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_graph_allowed函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了is_graph_allowed函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: rrdtool_function_graph

function rrdtool_function_graph($local_graph_id, $rra_id, $graph_data_array, $rrd_struc = array()) {
	global $config;

	include_once($config["library_path"] . "/cdef.php");
	include_once($config["library_path"] . "/graph_variables.php");
	include($config["include_path"] . "/config_arrays.php");

	/* before we do anything; make sure the user has permission to view this graph,
	if not then get out */
	if ((read_config_option("global_auth") == "on") && (isset($_SESSION["sess_user_id"]))) {
		$access_denied = !(is_graph_allowed($local_graph_id));

		if ($access_denied == true) {
			return "GRAPH ACCESS DENIED";
		}
	}

	/* find the step and how often this graph is updated with new data */
	$ds_step = db_fetch_cell("select
		data_template_data.rrd_step
		from data_template_data,data_template_rrd,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 graph_templates_item.local_graph_id=$local_graph_id
		limit 0,1");
	$ds_step = empty($ds_step) ? 300 : $ds_step;

	/* if no rra was specified, we need to figure out which one RRDTool will choose using
	 * "best-fit" resolution fit algorithm */
	if (empty($rra_id)) {
		if ((empty($graph_data_array["graph_start"])) || (empty($graph_data_array["graph_end"]))) {
			$rra["rows"] = 600;
			$rra["steps"] = 1;
			$rra["timespan"] = 86400;
		}else{
			/* get a list of RRAs related to this graph */
			$rras = get_associated_rras($local_graph_id);

			if (sizeof($rras) > 0) {
				foreach ($rras as $unchosen_rra) {
					/* the timespan specified in the RRA "timespan" field may not be accurate */
					$real_timespan = ($ds_step * $unchosen_rra["steps"] * $unchosen_rra["rows"]);

					/* make sure the current start/end times fit within each RRA's timespan */
					if ( (($graph_data_array["graph_end"] - $graph_data_array["graph_start"]) <= $real_timespan) && ((time() - $graph_data_array["graph_start"]) <= $real_timespan) ) {
						/* is this RRA better than the already chosen one? */
						if ((isset($rra)) && ($unchosen_rra["steps"] < $rra["steps"])) {
							$rra = $unchosen_rra;
						}else if (!isset($rra)) {
							$rra = $unchosen_rra;
						}
					}
				}
			}

			if (!isset($rra)) {
				$rra["rows"] = 600;
				$rra["steps"] = 1;
			}
		}
	}else{
		$rra = db_fetch_row("select timespan,rows,steps from rra where id=$rra_id");
	}

	$seconds_between_graph_updates = ($ds_step * $rra["steps"]);

	$graph = db_fetch_row("select
		graph_local.host_id,
		graph_local.snmp_query_id,
		graph_local.snmp_index,
		graph_templates_graph.title_cache,
		graph_templates_graph.vertical_label,
		graph_templates_graph.auto_scale,
		graph_templates_graph.auto_scale_opts,
		graph_templates_graph.auto_scale_log,
		graph_templates_graph.auto_scale_rigid,
		graph_templates_graph.auto_padding,
		graph_templates_graph.base_value,
		graph_templates_graph.upper_limit,
		graph_templates_graph.lower_limit,
		graph_templates_graph.height,
		graph_templates_graph.width,
		graph_templates_graph.image_format_id,
		graph_templates_graph.unit_value,
		graph_templates_graph.unit_exponent_value,
		graph_templates_graph.export
		from graph_templates_graph,graph_local
		where graph_local.id=graph_templates_graph.local_graph_id
		and graph_templates_graph.local_graph_id=$local_graph_id");

	/* lets make that sql query... */
	$graph_items = db_fetch_assoc("select
		graph_templates_item.id as graph_templates_item_id,
		graph_templates_item.cdef_id,
		graph_templates_item.text_format,
		graph_templates_item.value,
		graph_templates_item.hard_return,
		graph_templates_item.consolidation_function_id,
		graph_templates_item.graph_type_id,
		graph_templates_gprint.gprint_text,
//.........这里部分代码省略.........
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:rrd.php


示例2: rrdtool_function_xport

function rrdtool_function_xport($local_graph_id, $rra_id, $xport_data_array, &$xport_meta, $rrd_struc = array()) {
	global $config, $consolidation_functions;

	include_once($config["library_path"] . "/cdef.php");
	include_once($config["library_path"] . "/graph_variables.php");
	include_once($config["library_path"] . "/xml.php");
	include($config["include_path"] . "/global_arrays.php");

	/* before we do anything; make sure the user has permission to view this graph,
	if not then get out */
	if ((read_config_option("auth_method") != 0) && (isset($_SESSION["sess_user_id"]))) {
		$access_denied = !(is_graph_allowed($local_graph_id));

		if ($access_denied == true) {
			return "GRAPH ACCESS DENIED";
		}
	}

	/* find the step and how often this graph is updated with new data */
	$ds_step = db_fetch_cell("select
		data_template_data.rrd_step
		from (data_template_data,data_template_rrd,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 graph_templates_item.local_graph_id=$local_graph_id
		limit 0,1");
	$ds_step = empty($ds_step) ? 300 : $ds_step;

	/* if no rra was specified, we need to figure out which one RRDTool will choose using
	 * "best-fit" resolution fit algorithm */
	if (empty($rra_id)) {
		if ((empty($xport_data_array["graph_start"])) || (empty($xport_data_array["graph_end"]))) {
			$rra["rows"] = 600;
			$rra["steps"] = 1;
			$rra["timespan"] = 86400;
		}else{
			/* get a list of RRAs related to this graph */
			$rras = get_associated_rras($local_graph_id);

			if (sizeof($rras) > 0) {
				foreach ($rras as $unchosen_rra) {
					/* the timespan specified in the RRA "timespan" field may not be accurate */
					$real_timespan = ($ds_step * $unchosen_rra["steps"] * $unchosen_rra["rows"]);

					/* make sure the current start/end times fit within each RRA's timespan */
					if ( (($xport_data_array["graph_end"] - $xport_data_array["graph_start"]) <= $real_timespan) && ((time() - $xport_data_array["graph_start"]) <= $real_timespan) ) {
						/* is this RRA better than the already chosen one? */
						if ((isset($rra)) && ($unchosen_rra["steps"] < $rra["steps"])) {
							$rra = $unchosen_rra;
						}else if (!isset($rra)) {
							$rra = $unchosen_rra;
						}
					}
				}
			}

			if (!isset($rra)) {
				$rra["rows"] = 600;
				$rra["steps"] = 1;
			}
		}
	}else{
		$rra = db_fetch_row("select timespan,rows,steps from rra where id=$rra_id");
	}

	$seconds_between_graph_updates = ($ds_step * $rra["steps"]);

	/* override: graph start time */
	if ((!isset($graph_data_array["graph_start"])) || ($graph_data_array["graph_start"] == "0")) {
		$graph_start = -($rra["timespan"]);
	}else{
		$graph_start = $graph_data_array["graph_start"];
	}

	/* override: graph end time */
	if ((!isset($graph_data_array["graph_end"])) || ($graph_data_array["graph_end"] == "0")) {
		$graph_end = -($seconds_between_graph_updates);
	}else{
		$graph_end = $graph_data_array["graph_end"];
	}

	$graph = db_fetch_row("select
		graph_local.host_id,
		graph_local.snmp_query_id,
		graph_local.snmp_index,
		graph_templates_graph.title_cache,
		graph_templates_graph.vertical_label,
		graph_templates_graph.slope_mode,
		graph_templates_graph.auto_scale,
		graph_templates_graph.auto_scale_opts,
		graph_templates_graph.auto_scale_log,
		graph_templates_graph.scale_log_units,
		graph_templates_graph.auto_scale_rigid,
		graph_templates_graph.auto_padding,
		graph_templates_graph.base_value,
		graph_templates_graph.upper_limit,
		graph_templates_graph.lower_limit,
		graph_templates_graph.height,
		graph_templates_graph.width,
		graph_templates_graph.image_format_id,
//.........这里部分代码省略.........
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:rrd.php


示例3:

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
give an "access denied" message */
if (read_config_option("auth_method") != 0) {
	$access_denied = !(is_graph_allowed($_GET["local_graph_id"]));

	if ($access_denied == true) {
		print "<strong><font size='+1' color='FF0000'>ACCESS DENIED</font></strong>"; exit;
	}
}

$graph_title = get_graph_title($_GET["local_graph_id"]);

if ($_REQUEST["view_type"] == "tree") {
	print "<table width='100%' style='background-color: #ffffff; border: 1px solid #ffffff;' align='center' cellpadding='3'>";
}else{
	print "<br><table width='100%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellpadding='3'>";
}

$rras = get_associated_rras($_GET["local_graph_id"]);
开发者ID:songchin,项目名称:Cacti,代码行数:30,代码来源:graph.php


示例4: rrdtool_function_graph

function rrdtool_function_graph($local_graph_id, $rra_id, $graph_data_array, $rrdtool_pipe = "", &$xport_meta = array())
{
    global $config, $consolidation_functions;
    include_once $config["library_path"] . "/cdef.php";
    include_once $config["library_path"] . "/graph_variables.php";
    include_once $config['library_path'] . '/boost.php';
    include_once $config['library_path'] . '/xml.php';
    include $config["include_path"] . "/global_arrays.php";
    /* prevent command injection
     * This function prepares an rrdtool graph statement to be executed by the web server.
     * We have to take care, that the attacker does not insert shell code.
     * As some rrdtool parameters accept "Cacti variables", we have to perform the
     * variable substitution prior to vulnerability checks.
     * We will enclose all parameters in quotes and substitute quotation marks within
     * those parameters. 
     */
    /* rrdtool fetches the default font from it's execution environment
     * you won't find that default font on the rrdtool statement itself!
     * set the rrdtool default font via environment variable */
    if (!isset($graph_data_array['export_csv'])) {
        if (read_config_option("path_rrdtool_default_font")) {
            putenv("RRD_DEFAULT_FONT=" . read_config_option("path_rrdtool_default_font"));
        }
    }
    /* before we do anything; make sure the user has permission to view this graph,
    	if not then get out */
    if (!is_graph_allowed($local_graph_id)) {
        return "GRAPH ACCESS DENIED";
    }
    /* check the boost image cache and if we find a live file there return it instead */
    if (!isset($graph_data_array['export_csv']) && !isset($graph_data_array['export_realtime'])) {
        $graph_data = boost_graph_cache_check($local_graph_id, $rra_id, $rrdtool_pipe, $graph_data_array, false);
        if ($graph_data != false) {
            return $graph_data;
        }
    }
    /* find the step and how often this graph is updated with new data */
    $ds_step = db_fetch_cell("SELECT\n\t\tdata_template_data.rrd_step\n\t\tFROM (data_template_data,data_template_rrd,graph_templates_item)\n\t\tWHERE graph_templates_item.task_item_id=data_template_rrd.id\n\t\tAND data_template_rrd.local_data_id=data_template_data.local_data_id\n\t\tAND graph_templates_item.local_graph_id={$local_graph_id}\n\t\tLIMIT 0,1");
    $ds_step = empty($ds_step) ? 300 : $ds_step;
    /* if no rra was specified, we need to figure out which one RRDTool will choose using
     * "best-fit" resolution fit algorithm */
    if (empty($rra_id)) {
        if (empty($graph_data_array["graph_start"]) || empty($graph_data_array["graph_end"])) {
            $rra["rows"] = 600;
            $rra["steps"] = 1;
            $rra["timespan"] = 86400;
        } else {
            /* get a list of RRAs related to this graph */
            $rras = get_associated_rras($local_graph_id);
            if (sizeof($rras) > 0) {
                foreach ($rras as $unchosen_rra) {
                    /* the timespan specified in the RRA "timespan" field may not be accurate */
                    $real_timespan = $ds_step * $unchosen_rra["steps"] * $unchosen_rra["rows"];
                    /* make sure the current start/end times fit within each RRA's timespan */
                    if ($graph_data_array["graph_end"] - $graph_data_array["graph_start"] <= $real_timespan && time() - $graph_data_array["graph_start"] <= $real_timespan) {
                        /* is this RRA better than the already chosen one? */
                        if (isset($rra) && $unchosen_rra["steps"] < $rra["steps"]) {
                            $rra = $unchosen_rra;
                        } else {
                            if (!isset($rra)) {
                                $rra = $unchosen_rra;
                            }
                        }
                    }
                }
            }
            if (!isset($rra)) {
                $rra["rows"] = 600;
                $rra["steps"] = 1;
            }
        }
    } else {
        $rra = db_fetch_row("SELECT timespan,rows,steps FROM rra WHERE id={$rra_id}");
    }
    if (!isset($graph_data_array['export_realtime'])) {
        $seconds_between_graph_updates = $ds_step * $rra["steps"];
    } else {
        $seconds_between_graph_updates = 5;
    }
    $graph = db_fetch_row("SELECT gl.id AS local_graph_id, gl.host_id,\n\t\tgl.snmp_query_id, gl.snmp_index, gtg.title_cache, gtg.vertical_label,\n\t\tgtg.slope_mode, gtg.auto_scale, gtg.auto_scale_opts, gtg.auto_scale_log,\n\t\tgtg.scale_log_units, gtg.auto_scale_rigid, gtg.auto_padding, gtg.base_value,\n\t\tgtg.upper_limit, gtg.lower_limit, gtg.height, gtg.width, gtg.image_format_id,\n\t\tgtg.unit_value, gtg.unit_exponent_value, gtg.export\n\t\tFROM graph_templates_graph AS gtg\n\t\tINNER JOIN graph_local AS gl\n\t\tON gl.id=gtg.local_graph_id\n\t\tWHERE gtg.local_graph_id={$local_graph_id}");
    /* lets make that sql query... */
    $graph_items = db_fetch_assoc("SELECT gti.id AS graph_templates_item_id,\n\t\tgti.cdef_id, gti.text_format, gti.value, gti.hard_return,\n\t\tgti.consolidation_function_id, gti.graph_type_id, gtgp.gprint_text,\n\t\tcolors.hex, gti.alpha, dtr.id AS data_template_rrd_id, dtr.local_data_id,\n\t\tdtr.rrd_minimum, dtr.rrd_maximum, dtr.data_source_name, dtr.local_data_template_rrd_id\n\t\tFROM graph_templates_item AS gti\n\t\tLEFT JOIN data_template_rrd AS dtr\n\t\tON gti.task_item_id=dtr.id\n\t\tLEFT JOIN colors \n\t\tON gti.color_id=colors.id\n\t\tLEFT JOIN graph_templates_gprint AS gtgp\n\t\tON gti.gprint_id=gtgp.id\n\t\tWHERE gti.local_graph_id={$local_graph_id}\n\t\tORDER BY gti.sequence");
    /* variables for use below */
    $graph_defs = "";
    $txt_graph_items = "";
    $text_padding = "";
    $padding_estimate = 0;
    $last_graph_type = "";
    /* override: graph start time */
    if (!isset($graph_data_array["graph_start"]) || $graph_data_array["graph_start"] == "0") {
        $graph_start = -$rra["timespan"];
    } else {
        $graph_start = $graph_data_array["graph_start"];
    }
    /* override: graph end time */
    if (!isset($graph_data_array["graph_end"]) || $graph_data_array["graph_end"] == "0") {
        $graph_end = -$seconds_between_graph_updates;
    } else {
        $graph_end = $graph_data_array["graph_end"];
    }
//.........这里部分代码省略.........
开发者ID:MrWnn,项目名称:cacti,代码行数:101,代码来源:rrd.php


示例5: get_allowed_tree_level

function get_allowed_tree_level($tree_id, $parent_id)
{
    $items = db_fetch_assoc_prepared('SELECT gti.id, gti.title, gti.host_id, 
		gti.local_graph_id, gti.host_grouping_type, h.description AS hostname
		FROM graph_tree_items AS gti
		INNER JOIN graph_tree AS gt
		ON gt.id = gti.graph_tree_id
		LEFT JOIN host AS h
		ON h.id = gti.host_id
		WHERE graph_tree_id = ?
		AND parent = ?
		ORDER BY position ASC', array($tree_id, $parent_id));
    $i = 0;
    if (sizeof($items)) {
        foreach ($items as $item) {
            if ($item['host_id'] > 0) {
                if (!is_device_allowed($item['host_id'])) {
                    unset($items[$i]);
                }
            } elseif ($item['local_graph_id'] > 0) {
                if (!is_graph_allowed($item['local_graph_id'])) {
                    unset($items[$i]);
                }
            }
            $i++;
        }
    }
    return $items;
}
开发者ID:MrWnn,项目名称:cacti,代码行数:29,代码来源:auth.php


示例6: _

require_once CACTI_BASE_PATH . "/lib/sys/html_tree.php";
require_once CACTI_BASE_PATH . "/include/top_graph_header.php";
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 id from graph where id = " . $_GET["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
give an "access denied" message */
if (read_config_option("auth_method") != "0") {
    $access_denied = !is_graph_allowed($_GET["graph_id"]);
    if ($access_denied == true) {
        print "<strong><font size='+1' color='FF0000'>" . _("ACCESS DENIED") . "</font></strong>";
        exit;
    }
}
$graph_title = api_graph_title_get($_GET["graph_id"]);
if ($_REQUEST["view_type"] == "tree") {
    print "<table width='98%' style='background-color: #" . $colors["graph_menu_background"] . "; border: 1px solid #" . $colors["graph_menu_border"] . ";' align='center' cellpadding='3'>";
} else {
    print "<br><table width='98%' style='background-color: #" . $colors["console_menu_background"] . "; border: 1px solid #" . $colors["console_menu_border"] . ";' align='center' cellpadding='3'>";
}
$rras = api_graph_associated_rras_list($_GET["graph_id"]);
switch ($_REQUEST["action"]) {
    case 'view':
        ?>
开发者ID:songchin,项目名称:Cacti,代码行数:31,代码来源:graph.php


示例7: rrdtool_function_graph_rt

function rrdtool_function_graph_rt($local_graph_id, $graph_data_array) {
	global $config;

	include_once($config["library_path"] . "/cdef.php");
	include_once($config["library_path"] . "/graph_variables.php");
	include($config["include_path"] . "/global_arrays.php");

	/* set the rrdtool default font */
	if (read_config_option("path_rrdtool_default_font")) {
		putenv("RRD_DEFAULT_FONT=" . read_config_option("path_rrdtool_default_font"));
	}

	/* before we do anything; make sure the user has permission to view this graph,
	if not then get out */
	if ((read_config_option("auth_method") != 0) && (isset($_SESSION["sess_user_id"]))) {
		$access_denied = !(is_graph_allowed($local_graph_id));

		if ($access_denied == true) {
			return "GRAPH ACCESS DENIED";
		}
	}

	/* find the step and how often this graph is updated with new data
	 * each second */
	$ds_step = @$graph_data_array["ds_step"];
	if ($ds_step == 0) {
		$ds_step = read_config_option("realtime_interval");
	}else if ($ds_step < 1) {
		$ds_step = 1;
	}

	/* if no rra was specified, we need to figure out which one RRDTool will choose using
	 * "best-fit" resolution fit algorithm */
	$rra["rows"] = 600;
	$rra["steps"] = 1;
	$rra["timespan"] = 2400; /* 30 minutes */

	$seconds_between_graph_updates = ($ds_step * $rra["steps"]);

	$graph = db_fetch_row("select
		graph_local.host_id,
		graph_local.snmp_query_id,
		graph_local.snmp_index,
		graph_templates_graph.title_cache,
		graph_templates_graph.vertical_label,
		graph_templates_graph.slope_mode,
		graph_templates_graph.auto_scale,
		graph_templates_graph.auto_scale_opts,
		graph_templates_graph.auto_scale_log,
		graph_templates_graph.scale_log_units,
		graph_templates_graph.auto_scale_rigid,
		graph_templates_graph.auto_padding,
		graph_templates_graph.base_value,
		graph_templates_graph.upper_limit,
		graph_templates_graph.lower_limit,
		graph_templates_graph.height,
		graph_templates_graph.width,
		graph_templates_graph.image_format_id,
		graph_templates_graph.unit_value,
		graph_templates_graph.unit_exponent_value,
		graph_templates_graph.export
		from (graph_templates_graph,graph_local)
		where graph_local.id=graph_templates_graph.local_graph_id
		and graph_templates_graph.local_graph_id=$local_graph_id");

	/* lets make that sql query... */
	$graph_items = db_fetch_assoc("select
		graph_templates_item.id as graph_templates_item_id,
		graph_templates_item.cdef_id,
		graph_templates_item.text_format,
		graph_templates_item.value,
		graph_templates_item.hard_return,
		graph_templates_item.consolidation_function_id,
		graph_templates_item.graph_type_id,
		graph_templates_gprint.gprint_text,
		colors.hex,
		graph_templates_item.alpha,
		data_template_rrd.id as data_template_rrd_id,
		data_template_rrd.local_data_id,
		data_template_rrd.rrd_minimum,
		data_template_rrd.rrd_maximum,
		data_template_rrd.data_source_name,
		data_template_rrd.local_data_template_rrd_id
		from graph_templates_item
		left join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id)
		left join colors on (graph_templates_item.color_id=colors.id)
		left join graph_templates_gprint on (graph_templates_item.gprint_id=graph_templates_gprint.id)
		where graph_templates_item.local_graph_id=$local_graph_id
		order by graph_templates_item.sequence");

	/* +++++++++++++++++++++++ GRAPH OPTIONS +++++++++++++++++++++++ */

	/* define some variables */
	$scale = "";
	$rigid = "";
	$unit_value = "";
	$unit_exponent_value = "";
	$graph_legend = "";
	$graph_defs = "";
	$txt_graph_items = "";
//.........这里部分代码省略.........
开发者ID:avillaverdec,项目名称:cacti,代码行数:101,代码来源:graph_image_rt.php


示例8: display_graphs

function display_graphs()
{
    if ($_REQUEST['filter'] != '') {
        $sql_where = "WHERE (title_cache LIKE '%" . $_REQUEST['filter'] . "%' OR gt.name LIKE '%" . $_REQUEST['filter'] . "%') AND local_graph_id>0";
    } else {
        $sql_where = 'WHERE local_graph_id>0';
    }
    $graphs = db_fetch_assoc("SELECT \n\t\tgtg.local_graph_id AS id, \n\t\tgtg.title_cache AS title,\n\t\tgt.name AS template_name\n\t\tFROM graph_templates_graph AS gtg\n\t\tLEFT JOIN graph_templates AS gt\n\t\tON gt.id=gtg.graph_template_id\n\t\t{$sql_where} \n\t\tORDER BY title_cache \n\t\tLIMIT 20");
    if (sizeof($graphs)) {
        foreach ($graphs as $g) {
            if (is_graph_allowed($g['id'])) {
                echo "<ul><li id='tgraph:" . $g['id'] . "' data-jstree='{ \"type\": \"graph\" }'>" . $g['title'] . '</li></ul>';
            }
        }
    }
}
开发者ID:MrWnn,项目名称:cacti,代码行数:16,代码来源:tree.php


示例9: get_next_graphid

function get_next_graphid($graphpp, $filter, $graph_tree, $leaf_id)
{
    global $id, $graph_id, $graphs, $next_graph_id, $prev_graph_id;
    /* if no default graph list has been specified, default to 0 */
    $type = read_config_option('cycle_custom_graphs_type');
    if ($type == 1 && !strlen(read_config_option('cycle_custom_graphs_list'))) {
        $type = 0;
    }
    switch ($type) {
        case '0':
        case '1':
        case '2':
            $graph_id = $id;
            if ($graph_id <= 0) {
                $graph_id = 0;
            }
            $sql_where = "WHERE gl.id>={$graph_id}";
            if (strlen($filter)) {
                $sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . " gtg.title_cache RLIKE '{$filter}'";
            }
            if ($type == 1) {
                $cases = explode(',', read_config_option('cycle_custom_graphs_list'));
                sort($cases);
                $newcase = '';
                foreach ($cases as $case) {
                    $newcase .= is_numeric($case) ? (strlen($newcase) ? ',' : '') . $case : '';
                }
                if (strlen($newcase)) {
                    $sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . " gl.id IN({$newcase})";
                }
            } elseif ($type == 2) {
                $graph_data = get_tree_graphs($graph_tree, $leaf_id);
                $local_graph_ids = array_keys($graph_data);
                sort($local_graph_ids);
                if (sizeof($local_graph_ids)) {
                    $sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' gl.id IN(' . implode(',', $local_graph_ids) . ')';
                } else {
                    break;
                }
            }
            $done = false;
            $next_found = false;
            $start = 0;
            $next_graph_id = 0;
            $prev_graph_id = 0;
            $title = '';
            $graphs = array();
            $i = 0;
            /* Build a graphs array of the number of graphs requested
             * this graph array will be used for rendering.  In addition
             * when the user hit's next, or the graphs cycle, we need
             * to know the next graph id to display.  Calculate that
             * based upon the offset $graphpp.  If we overflow,  start
             * from the beginning, which is the second section until
             * we either run out of rows, or reach the $graphpp limit.
             *
             * Finally, don't try to grap all graphs at once.  It takes
             * too much memory on big systems.
             */
            /* first pass is moving up in ids */
            while (!$done) {
                $sql = "SELECT\n\t\t\t\tgl.id,\n\t\t\t\tgtg.title_cache\n\t\t\t\tFROM graph_local AS gl\n\t\t\t\tINNER JOIN graph_templates_graph AS gtg\n\t\t\t\tON (gtg.local_graph_id=gl.id)\n\t\t\t\t{$sql_where}\n\t\t\t\tORDER BY gl.id ASC\n\t\t\t\tLIMIT {$start}, {$graphpp}";
                $rows = db_fetch_assoc($sql);
                if ($graph_id > 0) {
                    $curr_found = true;
                } else {
                    $curr_found = false;
                }
                if (sizeof($rows)) {
                    foreach ($rows as $row) {
                        if (is_graph_allowed($row['id'])) {
                            if (!$curr_found) {
                                $graph_id = $row['id'];
                                $title = $row['title_cache'];
                                $curr_found = true;
                                $graphs[$graph_id]['graph_id'] = $graph_id;
                                $i++;
                            } else {
                                if (sizeof($graphs) < $graphpp) {
                                    $graphs[$row['id']]['graph_id'] = $row['id'];
                                    $i++;
                                } else {
                                    $next_graph_id = $row['id'];
                                    $next_found = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if ($next_graph_id > 0) {
                    $done = true;
                } elseif (sizeof($rows) == 0) {
                    $done = true;
                } else {
                    $start += $graphpp;
                }
            }
            /* If we did not find all the graphs requested,
             * move backwards from lowest graph id until the
//.........这里部分代码省略.........
开发者ID:Cacti,项目名称:plugin_cycle,代码行数:101,代码来源:functions.php


示例10: thold_user_auth_threshold

function thold_user_auth_threshold($rra)
{
    $graph = db_fetch_cell_prepared('SELECT gl.id
		FROM data_template_rrd AS dtr
		LEFT JOIN graph_templates_item AS gti
		ON gti.task_item_id=dtr.id
		LEFT JOIN graph_local AS gl
		ON gl.id=gti.local_graph_id
		WHERE dtr.local_data_id = ?', array($rra));
    if (!empty($graph) && is_graph_allowed($graph)) {
        return true;
    }
    return false;
}
开发者ID:Cacti,项目名称:plugin_thold,代码行数:14,代码来源:thold_functions.php


示例11: header

/* ==================================================== */
if (!isset($_REQUEST['rra_id'])) {
    $_REQUEST['rra_id'] = 'all';
}
if ($_REQUEST['rra_id'] == 'all') {
    $sql_where = ' WHERE id IS NOT NULL';
} else {
    $sql_where = ' WHERE id=' . $_REQUEST['rra_id'];
}
/* make sure the graph requested exists (sanity) */
if (!db_fetch_cell_prepared('SELECT local_graph_id FROM graph_templates_graph WHERE local_graph_id = ?', array(get_request_var_request('local_graph_id')))) {
    print "<strong><font class='txtErrorTextBox'>GRAPH DOES NOT EXIST</font></strong>";
    exit;
}
/* take graph permissions into account here */
if (!is_graph_allowed($_REQUEST['local_graph_id'])) {
    header('Location: permission_denied.php');
    exit;
}
$graph_title = get_graph_title($_REQUEST['local_graph_id']);
if ($_REQUEST['view_type'] == 'tree') {
    print "<table width='100%' style='background-color: #ffffff; border: 1px solid #ffffff;' align='center' cellspacing='0' cellpadding='3'>";
} else {
    print "<table width='100%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellspacing='0' cellpadding='3'>";
}
$rras = get_associated_rras($_REQUEST['local_graph_id']);
switch ($_REQUEST['action']) {
    case 'view':
        api_plugin_hook_function('page_buttons', array('lgid' => $_REQUEST['local_graph_id'], 'leafid' => '', 'mode' => 'mrtg', 'rraid' => $_REQUEST['rra_id']));
        ?>
	<tr class='tableHeader'>
开发者ID:MrWnn,项目名称:cacti,代码行数:31,代码来源:graph.php


示例12: rrdtool_function_xport

function rrdtool_function_xport($local_graph_id, $rra_id, $xport_data_array, &$xport_meta, $rrd_struc = array())
{
    global $config;
    include_once $config["library_path"] . "/cdef.php";
    include_once $config["library_path"] . "/graph_variables.php";
    include_once $config["library_path"] . "/xml.php";
    include $config["include_path"] . "/global_arrays.php";
    /* before we do anything; make sure the user has permission to view this graph,
    	if not then get out */
    if (read_config_option("auth_method") != 0 && isset($_SESSION["sess_user_id"])) {
        $access_denied = !is_graph_allowed($local_graph_id);
        if ($access_denied == true) {
            return "GRAPH ACCESS DENIED";
        }
    }
    /* find the step and how often this graph is updated with new data */
    $ds_step = db_fetch_cell("select\n\t\tdata_template_data.rrd_step\n\t\tfrom (data_template_data,data_template_rrd,graph_templates_item)\n\t\twhere graph_templates_item.task_item_id=data_template_rrd.id\n\t\tand data_template_rrd.local_data_id=data_template_data.local_data_id\n\t\tand graph_templates_item.local_graph_id={$local_graph_id}\n\t\tlimit 0,1");
    $ds_step = empty($ds_step) ? 300 : $ds_step;
    /* if no rra was specified, we need to figure out which one RRDTool will choose using
     * "best-fit" resolution fit algorithm */
    if (empty($rra_id)) {
        if (empty($xport_data_array["graph_start"]) || empty($xport_data_array["graph_end"])) {
            $rra["rows"] = 600;
            $rra["steps"] = 1;
            $rra["timespan"] = 86400;
        } else {
            /* get a list of RRAs related to this graph */
            $rras = get_associated_rras($local_graph_id);
            if (sizeof($rras) > 0) {
                foreach ($rras as $unchosen_rra) {
                    /* the timespan specified in the RRA "timespan" field may not be accurate */
                    $real_timespan = $ds_step * $unchosen_rra["steps"] * $unchosen_rra["rows"];
                    /* make sure the current start/end times fit within each RRA's timespan */
                    if ($xport_data_array["graph_end"] - $xport_data_array["graph_start"] <= $real_timespan && time() - $xport_data_array["graph_start"] <= $real_timespan) {
                        /* is this RRA better than the already chosen one? */
                        if (isset($rra) && $unchosen_rra["steps"] < $rra["steps"]) {
                            $rra = $unchosen_rra;
                        } else {
                            if (!isset($rra)) {
                                $rra = $unchosen_rra;
                            }
                        }
                    }
                }
            }
            if (!isset($rra)) {
                $rra["rows"] = 600;
                $rra["steps"] = 1;
            }
        }
    } else {
        $rra = db_fetch_row("select timespan,rows,steps from rra where id={$rra_id}");
    }
    $seconds_between_graph_updates = $ds_step * $rra["steps"];
    /* override: graph start time */
    if (!isset($graph_data_array["graph_start"]) || $graph_data_array["graph_start"] == "0") {
        $graph_start = -$rra["timespan"];
    } else {
        $graph_start = $graph_data_array["graph_start"];
    }
    /* override: graph end time */
    if (!isset($graph_data_array["graph_end"]) || $graph_data_array["graph_end"] == "0") {
        $graph_end = -$seconds_between_graph_updates;
    } else {
        $graph_end = $graph_data_array["graph_end"];
    }
    $graph = db_fetch_row("select\n\t\tgraph_local.host_id,\n\t\tgraph_local.snmp_query_id,\n\t\tgraph_local.snmp_index,\n\t\tgraph_templates_graph.title_cache,\n\t\tgraph_templates_graph.vertical_label,\n\t\tgraph_templates_graph.slope_mode,\n\t\tgraph_templates_graph.auto_scale,\n\t\tgraph_templates_graph.auto_scale_opts,\n\t\tgraph_templates_graph.auto_scale_log,\n\t\tgraph_templates_graph.auto_scale_rigid,\n\t\tgraph_templates_graph.auto_padding,\n\t\tgraph_templates_graph.base_value,\n\t\tgraph_templates_graph.upper_limit,\n\t\tgraph_templates_graph.lower_limit,\n\t\tgraph_templates_graph.height,\n\t\tgraph_templates_graph.width,\n\t\tgraph_templates_graph.image_format_id,\n\t\tgraph_templates_graph.unit_value,\n\t\tgraph_templates_graph.unit_exponent_value,\n\t\tgraph_templates_graph.export\n\t\tfrom (graph_templates_graph,graph_local)\n\t\twhere graph_local.id=graph_templates_graph.local_graph_id\n\t\tand graph_templates_graph.local_graph_id={$local_graph_id}");
    /* lets make that sql query... */
    $xport_items = db_fetch_assoc("select\n\t\tgraph_templates_item.id as graph_templates_item_id,\n\t\tgraph_templates_item.cdef_id,\n\t\tgraph_templates_item.text_format,\n\t\tgraph_templates_item.value,\n\t\tgraph_templates_item.hard_return,\n\t\tgraph_templates_item.consolidation_function_id,\n\t\tgraph_templates_item.graph_type_id,\n\t\tgraph_templates_gprint.gprint_text,\n\t\tcolors.hex,\n\t\tdata_template_rrd.id as data_template_rrd_id,\n\t\tdata_template_rrd.local_data_id,\n\t\tdata_template_rrd.rrd_minimum,\n\t\tdata_template_rrd.rrd_maximum,\n\t\tdata_template_rrd.data_source_name,\n\t\tdata_template_rrd.local_data_template_rrd_id\n\t\tfrom graph_templates_item\n\t\tleft join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id)\n\t\tleft join colors on (graph_templates_item.color_id=colors.id)\n\t\tleft join graph_templates_gprint on (graph_templates_item.gprint_id=graph_templates_gprint.id)\n\t\twhere graph_templates_item.local_graph_id={$local_graph_id}\n\t\torder by graph_templates_item.sequence");
    /* +++++++++++++++++++++++ XPORT OPTIONS +++++++++++++++++++++++ */
    /* override: graph start time */
    if (!isset($xport_data_array["graph_start"]) || $xport_data_array["graph_start"] == "0") {
        $xport_start = -$rra["timespan"];
    } else {
        $xport_start = $xport_data_array["graph_start"];
    }
    /* override: graph end time */
    if (!isset($xport_data_array["graph_end"]) || $xport_data_array["graph_end"] == "0") {
        $xport_end = -$seconds_between_graph_updates;
    } else {
        $xport_end = $xport_data_array["graph_end"];
    }
    /* basic export options */
    $xport_opts = "--start={$xport_start}" . RRD_NL . "--end={$xport_end}" . RRD_NL;
    $xport_defs = "";
    $i = 0;
    $j = 0;
    $nth = 0;
    $sum = 0;
    if (sizeof($xport_items) > 0) {
        foreach ($xport_items as $xport_item) {
            /* mimic the old behavior: LINE[123], AREA, and STACK items use the CF specified in the graph item */
            if ($xport_item["graph_type_id"] == 4 || $xport_item["graph_type_id"] == 5 || $xport_item["graph_type_id"] == 6 || $xport_item["graph_type_id"] == 7 || $xport_item["graph_type_id"] == 8) {
                $xport_cf = $xport_item["consolidation_function_id"];
                /* all other types are based on the AVERAGE CF */
            } else {
                $xport_cf = 1;
            }
            if (!empty($xport_item["local_data_id"]) && !isset($cf_ds_cache[$xport_item["data_template_rrd_id"]][$xport_cf])) {
                /* use a user-specified ds path if one is entered */
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:101,代码来源:rrd.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_guest函数代码示例发布时间:2022-05-15
下一篇:
PHP is_get函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap