summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2013-05-11 07:27:24 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2013-06-21 10:05:14 (GMT)
commite466d526d08cc931b8503763269345b0114a4f1c (patch)
tree1b5a56c1145dd0558ab1ad9604f1efec65c96d7e
parent29347e419a8113ad0fe48ce02a12fd57d7463733 (diff)
downloadroundcubemail-plugins-kolab-e466d526d08cc931b8503763269345b0114a4f1c.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;
}
}