diff options
| author | Pim van den Berg | 2014-07-25 22:05:44 +0200 |
|---|---|---|
| committer | Pim van den Berg | 2014-07-25 22:05:44 +0200 |
| commit | 9c1afbca92af650a216ea39de1fe75278eeae418 (patch) | |
| tree | 0f91ea6ea13eec990643be2ebcda46e5af21d0bb | |
| parent | jsrrdgraph: Fix get reponseText in FetchBinaryURL (diff) | |
| download | apt-panopticon_cgp-9c1afbca92af650a216ea39de1fe75278eeae418.zip apt-panopticon_cgp-9c1afbca92af650a216ea39de1fe75278eeae418.tar.gz apt-panopticon_cgp-9c1afbca92af650a216ea39de1fe75278eeae418.tar.bz2 apt-panopticon_cgp-9c1afbca92af650a216ea39de1fe75278eeae418.tar.xz | |
support php versions without json support and show a warning message
| -rw-r--r-- | graph.php | 2 | ||||
| -rw-r--r-- | inc/html.inc.php | 13 | ||||
| -rw-r--r-- | layout/style.css | 8 |
3 files changed, 21 insertions, 2 deletions
| @@ -35,7 +35,7 @@ if ($plugin == 'aggregation') { | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | # plugin json | 37 | # plugin json |
| 38 | if (file_exists('plugin/'.$plugin.'.json')) { | 38 | if (function_exists('json_decode') && file_exists('plugin/'.$plugin.'.json')) { |
| 39 | $json = file_get_contents('plugin/'.$plugin.'.json'); | 39 | $json = file_get_contents('plugin/'.$plugin.'.json'); |
| 40 | $plugin_json = json_decode($json, true); | 40 | $plugin_json = json_decode($json, true); |
| 41 | 41 | ||
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 <<<EOT | |||
| 54 | <h1><a href="{$html_weburl}">Collectd Graph Panel</a></h1> | 54 | <h1><a href="{$html_weburl}">Collectd Graph Panel</a></h1> |
| 55 | </div> | 55 | </div> |
| 56 | 56 | ||
| 57 | EOT; | ||
| 58 | |||
| 59 | if(!function_exists('json_decode')) { | ||
| 60 | echo <<<EOT | ||
| 61 | <div id="warnheader"> | ||
| 62 | Your php version doesn't support <a href="http://php.net/json">JSON</a>. Your graphs would have looked more beautiful if it did. | ||
| 63 | </div> | ||
| 64 | |||
| 65 | EOT; | ||
| 66 | |||
| 67 | } | ||
| 68 | |||
| 69 | echo <<<EOT | ||
| 57 | <div id="content"> | 70 | <div id="content"> |
| 58 | 71 | ||
| 59 | EOT; | 72 | 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 { | |||
| 15 | text-decoration: none; | 15 | text-decoration: none; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | #warnheader { | ||
| 19 | background: #ffe583; | ||
| 20 | padding: 8px 8px 8px 18px; | ||
| 21 | border-bottom: 1px solid #d5ad14; | ||
| 22 | } | ||
| 23 | |||
| 18 | #content { | 24 | #content { |
| 19 | padding-left: 20px; | 25 | padding-left: 20px; |
| 20 | } | 26 | } |
| @@ -25,7 +31,7 @@ body { | |||
| 25 | } | 31 | } |
| 26 | 32 | ||
| 27 | h1 { | 33 | h1 { |
| 28 | margin-top: 0; | 34 | margin: 0; |
| 29 | font-size: 1em; | 35 | font-size: 1em; |
| 30 | } | 36 | } |
| 31 | 37 | ||
