summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2013-05-11 07:27:24 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2013-05-11 07:27:24 (GMT)
commit147f9d3ddbec34391c8c35856f8a227e9d81dd73 (patch)
tree757cac32328f4263b692eeb58fbeb3519c2dc3fd
parent468bb146966b9f325680dce3d526082df80f657c (diff)
downloadroundcubemail-plugins-kolab-147f9d3ddbec34391c8c35856f8a227e9d81dd73.tar.gz
Fix PHP warning when saving calendar settings in case all categories are removed from the list
-rw-r--r--plugins/calendar/calendar.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index f8451a1..6537c53 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -507,11 +507,13 @@ class calendar extends rcube_plugin
foreach ($this->driver->list_categories() as $name => $color) {
$old_categories[md5($name)] = $name;
}
- $categories = get_input_value('_categories', RCUBE_INPUT_POST);
- $colors = get_input_value('_colors', RCUBE_INPUT_POST);
+
+ $categories = (array) get_input_value('_categories', RCUBE_INPUT_POST);
+ $colors = (array) get_input_value('_colors', RCUBE_INPUT_POST);
+
foreach ($categories as $key => $name) {
$color = preg_replace('/^#/', '', strval($colors[$key]));
-
+
// rename categories in existing events -> driver's job
if ($oldname = $old_categories[$key]) {
$this->driver->replace_category($oldname, $name, $color);
@@ -519,7 +521,7 @@ class calendar extends rcube_plugin
}
else
$this->driver->add_category($name, $color);
-
+
$new_categories[$name] = $color;
}
@@ -527,7 +529,7 @@ class calendar extends rcube_plugin
foreach ((array)$old_categories[$key] as $key => $name) {
$this->driver->remove_category($name);
}
-
+
$p['prefs']['calendar_categories'] = $new_categories;
}
}