summaryrefslogtreecommitdiff
path: root/lib/Kolab/CalDAV/Plugin.php
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-02-21 16:31:28 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-02-21 16:31:28 (GMT)
commitf709fb7996677b6659c879ed1fa1623dd76d4bac (patch)
tree7cc87e9b7f093d8806f561610db11bba66e9f943 /lib/Kolab/CalDAV/Plugin.php
parent9f634b4ba27752540469e33bee9e9437ff5829c2 (diff)
downloadiRony-f709fb7996677b6659c879ed1fa1623dd76d4bac.tar.gz
Avoid parsing the same ical block twice. Make the parsed objects from input validation available for later processing
Diffstat (limited to 'lib/Kolab/CalDAV/Plugin.php')
-rw-r--r--lib/Kolab/CalDAV/Plugin.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Kolab/CalDAV/Plugin.php b/lib/Kolab/CalDAV/Plugin.php
index bc6befb..6041de2 100644
--- a/lib/Kolab/CalDAV/Plugin.php
+++ b/lib/Kolab/CalDAV/Plugin.php
@@ -33,6 +33,11 @@ use Sabre\VObject;
*/
class Plugin extends CalDAV\Plugin
{
+ // make already parsed text/calednar blocks available for later use
+ public static $parsed_vcalendar;
+ public static $parsed_vevent;
+
+
/**
* Checks if the submitted iCalendar data is in fact, valid.
*
@@ -55,7 +60,15 @@ class Plugin extends CalDAV\Plugin
try {
// modification: Set options to be more tolerant when parsing extended or invalid properties
$vobj = VObject\Reader::read($data, VObject\Reader::OPTION_FORGIVING | VObject\Reader::OPTION_IGNORE_INVALID_LINES);
- // TODO: keep the parsed object in memory for later processing
+
+ // keep the parsed object in memory for later processing
+ if ($vobj->name == 'VCALENDAR') {
+ self::$parsed_vcalendar = $vobj;
+ foreach ($vobj->getBaseComponents('VEVENT') as $vevent) {
+ self::$parsed_vevent = $vevent;
+ break;
+ }
+ }
}
catch (VObject\ParseException $e) {
throw new DAV\Exception\UnsupportedMediaType('This resource requires valid iCalendar 2.0 data. Parse error: ' . $e->getMessage());