fixed gdgraph

This commit is contained in:
daniel 2018-10-19 12:01:22 +02:00
parent a7918a1816
commit 81ebfc755e
1 changed files with 84 additions and 0 deletions

View File

@ -9,6 +9,90 @@
// 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.
// Turn on output buffering.
// The entire buffer will be discarded later so that any accidental output
// does not corrupt images generated by fgraph.
ob_start();
global $config;
if (empty($config['homedir'])) {
require_once ('../../include/config.php');
global $config;
}
include_once($config['homedir'] . '/include/functions.php');
$ttl = get_parameter('ttl', 1);
$graph_type = get_parameter('graph_type', '');
if (!empty($graph_type)) {
include_once($config['homedir'] . '/include/functions_html.php');
include_once($config['homedir'] . '/include/graphs/functions_gd.php');
include_once($config['homedir'] . '/include/graphs/functions_utils.php');
include_once($config['homedir'] . '/include/graphs/functions_d3.php');
include_once($config['homedir'] . '/include/graphs/functions_flot.php');
}
// Clean the output buffer and turn off output buffering
ob_end_clean ();
switch($graph_type) {
case 'histogram':
$width = get_parameter('width');
$height = get_parameter('height');
$data = json_decode(io_safe_output(get_parameter('data')), true);
$max = get_parameter('max');
$title = get_parameter('title');
$mode = get_parameter ('mode', 1);
gd_histogram ($width, $height, $mode, $data, $max, $config['fontpath'], $title);
break;
case 'progressbar':
$width = get_parameter('width');
$height = get_parameter('height');
$progress = get_parameter('progress');
$out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
$out_of_lim_image = get_parameter('out_of_lim_image', false);
$title = get_parameter('title');
$mode = get_parameter('mode', 1);
$fontsize = get_parameter('fontsize', 10);
$value_text = get_parameter('value_text', '');
$colorRGB = get_parameter('colorRGB', '');
gd_progress_bar ($width, $height, $progress, $title, $config['fontpath'],
$out_of_lim_str, $out_of_lim_image, $mode, $fontsize,
$value_text, $colorRGB);
break;
case 'progressbubble':
$width = get_parameter('width');
$height = get_parameter('height');
$progress = get_parameter('progress');
$out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
$out_of_lim_image = get_parameter('out_of_lim_image', false);
$title = get_parameter('title');
$mode = get_parameter('mode', 1);
$fontsize = get_parameter('fontsize', 7);
$value_text = get_parameter('value_text', '');
$colorRGB = get_parameter('colorRGB', '');
gd_progress_bubble ($width, $height, $progress, $title, $config['fontpath'],
$out_of_lim_str, $out_of_lim_image, $mode, $fontsize,
$value_text, $colorRGB);
break;
}
function progressbar($progress, $width, $height, $title, $font,
$mode = 1, $out_of_lim_str = false, $out_of_lim_image = false,
$ttl = 1) {