From b8511e3134bcc8d712973b9b90034c551263c1d8 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 16 Oct 2009 15:02:15 +0200 Subject: [PATCH] Simplify --- kronolith/lib/Kronolith.php | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 718dc0c1a..dc0e48d25 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -730,21 +730,12 @@ class Kronolith $GLOBALS['display_calendars'] = array(); $GLOBALS['display_remote_calendars'] = array(); $GLOBALS['display_external_calendars'] = array(); - $calendarId = $_SESSION['kronolith']['display_cal']; - if (is_array($calendarId)) { - $calendars = $calendarId; - foreach ($calendars as $calendarId) { - if (strncmp($calendarId, 'remote_', 7) === 0) { - $calendarId = substr($calendarId, 7); - $GLOBALS['display_remote_calendars'][] = $calendarId; - } elseif (strncmp($calendarId, 'external_', 9) === 0) { - $calendarId = substr($calendarId, 9); - $GLOBALS['display_external_calendars'][] = $calendarId; - } else { - $GLOBALS['display_calendars'][] = $calendarId; - } - } - } else { + $GLOBALS['display_resource_calendars'] = array(); + $calendars = $_SESSION['kronolith']['display_cal']; + if (!is_array($calendars)) { + $calendars = array($calendars); + } + foreach ($calendars as $calendarId) { if (strncmp($calendarId, 'remote_', 7) === 0) { $calendarId = substr($calendarId, 7); if (!in_array($calendarId, $GLOBALS['display_remote_calendars'])) { @@ -756,7 +747,9 @@ class Kronolith $GLOBALS['display_external_calendars'][] = $calendarId; } } elseif (strncmp($calendarId, 'resource_', 9) === 0) { - $GLOBALS['display_resource_calendars'] = array($calendarId); + if (!in_array($calendarId, $GLOBALS['display_resource_calendars'])) { + $GLOBALS['display_resource_calendars'][] = $calendarId; + } } else { if (!in_array($calendarId, $GLOBALS['display_calendars'])) { $GLOBALS['display_calendars'][] = $calendarId; -- 2.11.0