diff options
| author | Pim van den Berg | 2014-05-24 11:30:46 +0200 |
|---|---|---|
| committer | Pim van den Berg | 2014-05-24 11:34:16 +0200 |
| commit | 216e492f32ab9a23e9b345e2bf424ba15025aec4 (patch) | |
| tree | 0b41bdca550d355478d57722ceb458372ccbeed3 | |
| parent | plugin: fix typo in temperature type (diff) | |
| download | apt-panopticon_cgp-216e492f32ab9a23e9b345e2bf424ba15025aec4.zip apt-panopticon_cgp-216e492f32ab9a23e9b345e2bf424ba15025aec4.tar.gz apt-panopticon_cgp-216e492f32ab9a23e9b345e2bf424ba15025aec4.tar.bz2 apt-panopticon_cgp-216e492f32ab9a23e9b345e2bf424ba15025aec4.tar.xz | |
graph.php: fix undefined index 'type' in $plugin_json[$type]
When type wasn't set in the plugin json, a "PHP Notice: Undefined index"
would pop up. Just default to 'default' when type isn't set.
Closes #76 #77
| -rw-r--r-- | graph.php | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -35,6 +35,9 @@ if (file_exists('plugin/'.$plugin.'.json')) { | |||
| 35 | error_log('CGP Error: invalid json in plugin/'.$plugin.'.json'); | 35 | error_log('CGP Error: invalid json in plugin/'.$plugin.'.json'); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | if (!isset($plugin_json[$type]['type'])) | ||
| 39 | $plugin_json[$type]['type'] = 'default'; | ||
| 40 | |||
| 38 | switch ($plugin_json[$type]['type']) { | 41 | switch ($plugin_json[$type]['type']) { |
| 39 | case 'stacked': | 42 | case 'stacked': |
| 40 | require_once 'type/GenericStacked.class.php'; | 43 | require_once 'type/GenericStacked.class.php'; |
