Files
cacti/graph_image.php
T
cigamit abdc1e3d55 Merging 0.8.8d Updates with GitHub
Changes include:
- Convert some <br> to </li>
- Update ChangeLog per 0.8.8d release
- Fix Max Values on UCD/SNMP Memory Template
- Change Cacti Group Format to Modern Theme
- Fix Locking on Graphs
- Force Image format to PNG for Legacy Graph Image
- Correct form Logic on Settings to Fix Reverse Proxy's
- Shorten Uptime Display on Device Edit
- Force a Locale Setting for i18n on Graphs
- Fix Resizable Columns to resize only the current column
- Add DropIcon selectmenu Widget to modern theme
- Fix Issue where delete data source multi leaves orphan records
- Correct performance bug in Boost engine
- Optimize array_to_sql_or performance
- Correct and issue where pushing out data query objects to host cache
could leave orphan elements
- Add OID_REWRITE_PATTERN Feature on input
- Add VALUE/REGEXP Feature on output
- Optimize strip_quotes function to be more intellegent
- Escape shell arguments on Script Data Input types
- Allow Special Characters for LDAP passwords
- Correct LDAP class defect for anonymous binding
- Bypass php-snmp for now
- Correct rrdcleaner bytes units
- Fix loadavg_multi.pl to respect i18n
- Remove legacy row counters from snmpagent pages
2015-03-23 17:02:45 -05:00

112 lines
4.1 KiB
PHP

<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2015 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| 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/ |
+-------------------------------------------------------------------------+
*/
/* since we'll have additional headers, tell php when to flush them */
ob_start();
$guest_account = true;
include('./include/auth.php');
include_once('./lib/rrd.php');
api_plugin_hook_function('graph_image');
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('graph_start'));
input_validate_input_number(get_request_var_request('graph_end'));
input_validate_input_number(get_request_var_request('graph_height'));
input_validate_input_number(get_request_var_request('graph_width'));
input_validate_input_number(get_request_var_request('local_graph_id'));
input_validate_input_number(get_request_var_request('rra_id'));
/* ==================================================== */
if (!is_numeric(get_request_var_request('local_graph_id'))) {
die_html_input_error();
}
if (!is_numeric(get_request_var_request('local_graph_id'))) {
die_html_input_error();
}
// Determine the graph type of the output
$type = db_fetch_cell('SELECT image_format_id FROM graph_templates_graph WHERE local_graph_id=' . $_REQUEST['local_graph_id']);
switch($type) {
case '1':
$gtype = 'png';
break;
case '3':
$gtype = 'svg+xml';
break;
}
header('Content-type: image/'. $gtype);
/* flush the headers now */
ob_end_clean();
session_write_close();
$graph_data_array = array();
/* override: graph start time (unix time) */
if (!empty($_REQUEST['graph_start']) && $_REQUEST['graph_start'] < 1600000000) {
$graph_data_array['graph_start'] = $_REQUEST['graph_start'];
}
/* override: graph end time (unix time) */
if (!empty($_REQUEST['graph_end']) && $_REQUEST['graph_end'] < 1600000000) {
$graph_data_array['graph_end'] = $_REQUEST['graph_end'];
}
/* override: graph height (in pixels) */
if (!empty($_REQUEST['graph_height']) && $_REQUEST['graph_height'] < 3000) {
$graph_data_array['graph_height'] = $_REQUEST['graph_height'];
}
/* override: graph width (in pixels) */
if (!empty($_REQUEST['graph_width']) && $_REQUEST['graph_width'] < 3000) {
$graph_data_array['graph_width'] = $_REQUEST['graph_width'];
}
/* override: skip drawing the legend? */
if (!empty($_REQUEST['graph_nolegend'])) {
$graph_data_array['graph_nolegend'] = $_REQUEST['graph_nolegend'];
}
/* print RRDTool graph source? */
if (!empty($_REQUEST['show_source'])) {
$graph_data_array['print_source'] = $_REQUEST['show_source'];
}
/* disable cache check */
if (isset($_REQUEST['disable_cache'])) {
$graph_data_array['disable_cache'] = true;
}
$graph_data_array['image_format'] = 'png';
print @rrdtool_function_graph($_REQUEST['local_graph_id'], (array_key_exists('rra_id', $_REQUEST) ? $_REQUEST['rra_id'] : null), $graph_data_array);