From 9c1afbca92af650a216ea39de1fe75278eeae418 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Fri, 25 Jul 2014 22:05:44 +0200 Subject: support php versions without json support and show a warning message --- graph.php | 2 +- inc/html.inc.php | 13 +++++++++++++ layout/style.css | 8 +++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/graph.php b/graph.php index 2c3f6e6..6206d73 100644 --- a/graph.php +++ b/graph.php @@ -35,7 +35,7 @@ if ($plugin == 'aggregation') { } # plugin json -if (file_exists('plugin/'.$plugin.'.json')) { +if (function_exists('json_decode') && file_exists('plugin/'.$plugin.'.json')) { $json = file_get_contents('plugin/'.$plugin.'.json'); $plugin_json = json_decode($json, true); diff --git a/inc/html.inc.php b/inc/html.inc.php index 9107269..c8cfbaf 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -54,6 +54,19 @@ echo <<Collectd Graph Panel +EOT; + + if(!function_exists('json_decode')) { + echo << + Your php version doesn't support JSON. Your graphs would have looked more beautiful if it did. + + +EOT; + + } + +echo << EOT; diff --git a/layout/style.css b/layout/style.css index 3d5c94b..e344cf7 100644 --- a/layout/style.css +++ b/layout/style.css @@ -15,6 +15,12 @@ body { text-decoration: none; } +#warnheader { + background: #ffe583; + padding: 8px 8px 8px 18px; + border-bottom: 1px solid #d5ad14; +} + #content { padding-left: 20px; } @@ -25,7 +31,7 @@ body { } h1 { - margin-top: 0; + margin: 0; font-size: 1em; } -- cgit v1.1