Commit r2361: https://sourceforge.net/p/mrbs/code/2361/

------------------------------------------------------------------------
r2361 | cimorrison | 2012-07-26 18:51:13 +0100 (Thu, 26 Jul 2012) | 1 line
Changed paths:
   M /mrbs/trunk/web/import.php

Ignored VALARM comnponents inside VEVENTS as MRBS does not yet do reminders
------------------------------------------------------------------------

Index: mrbs/trunk/web/import.php
===================================================================
--- mrbs/trunk/web/import.php   (revision 2360)
+++ mrbs/trunk/web/import.php   (revision 2361)
@@ -168,11 +168,30 @@
   // for calculating some of the other settings
   $properties = array();
   $problems = array();
-  foreach ($vevent as $line)
+
+  $line = current($vevent);
+  while ($line !== FALSE)
   {
     $property = parse_ical_property($line);
-    $properties[$property['name']] = array('params' => $property['params'],
-                                           'value' => $property['value']);
+    // Ignore any sub-components (eg a VALARM inside a VEVENT) as MRBS does not
+    // yet handle things like reminders.  Skip through to the end of the sub-
+    // component.   Just in case you can have sub-components at a greater depth
+    // than 1 (not sure if you can), make sure we've got to the matching END.
+    if ($property['name'] != 'BEGIN')
+    {
+      $properties[$property['name']] = array('params' => $property['params'],
+                                             'value' => $property['value']);
+    }
+    else
+    {
+      $component = $property['value'];
+      while (!(($property['name'] == 'END') && ($property['value'] == 
$component)) &&
+             ($line = next($vevent)))
+      {
+        $property = parse_ical_property($line);;
+      }
+    }
+    $line = next($vevent);
   }
   // Get the start time because we'll need it later
   if (!isset($properties['DTSTART']))
@@ -438,7 +457,7 @@
             $vevent = array();
             while (($vevent_line = array_shift($lines)) && ($vevent_line != 
"END:VEVENT"))
             {
-                $vevent[] = $vevent_line;
+              $vevent[] = $vevent_line;
             }
             $vevents[] = $vevent;
           }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to