File tine20-ical-import.patch of Package tine20

diff -ur t.orig/library/qCal/lib/qCal/Component.php t/library/qCal/lib/qCal/Component.php
--- t.orig/library/qCal/lib/qCal/Component.php	2013-05-23 10:59:03.000000000 +0200
+++ t/library/qCal/lib/qCal/Component.php	2013-05-23 12:54:41.042147743 +0200
@@ -239,6 +239,7 @@
 		$component->setParent($this);
 		// make sure if a timezone is requested that it is available...
 		$timezones = $this->getTimezones(); 
+		$tzids = array_keys($timezones);
 		// we only need to check if tzid exists if we are attaching something other than a timezone...
 		if (!($component instanceof qCal_Component_Vtimezone)) {
 			foreach ($component->getProperties() as $pname => $properties) {
@@ -258,7 +259,7 @@
 						switch ($param) {
 							case "TZID":
 								$tzid = strtoupper($val);
-								if (!array_key_exists($tzid, $timezones)) {
+								if (!in_array($tzid, $tzids)) {
 									throw new qCal_Exception_MissingComponent('TZID "' . $tzid . '" not defined');
 								}
 								break;
@@ -582,4 +583,4 @@
 	
 	}
 
-}
\ Kein Zeilenumbruch am Dateiende.
+}
diff -ur t.orig/library/qCal/lib/qCal/DateTime.php t/library/qCal/lib/qCal/DateTime.php
--- t.orig/library/qCal/lib/qCal/DateTime.php	2013-05-23 10:59:03.000000000 +0200
+++ t/library/qCal/lib/qCal/DateTime.php	2013-05-23 12:54:41.054147970 +0200
@@ -65,7 +65,13 @@
 	 * @todo Should this accept qCal_Date and qCal_DateTime objects?
 	 */
 	public static function factory($datetime, $timezone = null) {
-	
+		if (substr($datetime,0,4)=='TZID') {
+			// Handle DateTime with Timezones
+			$buffer = explode(';', $datetime, 2);
+			$datetime = $buffer[1];
+			$buffer = explode('=', $buffer[0], 2);
+			$timezone = $buffer[1];
+		}	
 		if (is_null($timezone) || !($timezone instanceof qCal_Timezone)) {
 			// @todo Make sure this doesn't cause any issues 
 			// detect if we're working with a UTC string like "19970101T180000Z", where the Z means use UTC time
@@ -249,4 +255,4 @@
 	
 	}
 
-}
\ Kein Zeilenumbruch am Dateiende.
+}
diff -ur t.orig/library/qCal/lib/qCal/Parser/Lexer/iCalendar.php t/library/qCal/lib/qCal/Parser/Lexer/iCalendar.php
--- t.orig/library/qCal/lib/qCal/Parser/Lexer/iCalendar.php	2013-05-23 10:59:03.000000000 +0200
+++ t/library/qCal/lib/qCal/Parser/Lexer/iCalendar.php	2013-05-23 12:54:41.062148124 +0200
@@ -15,11 +15,6 @@
 class qCal_Parser_Lexer_iCalendar extends qCal_Parser_Lexer {
 	
 	/**
-	 * @var string character(s) used to terminate lines
-	 */
-	protected $line_terminator;
-	
-	/**
 	 * Constructor 
 	 * @param string The iCalendar data to be parsed
 	 * @access public
@@ -27,7 +22,6 @@
 	public function __construct($content) {
 	
 		parent::__construct($content);
-		$this->line_terminator = chr(13) . chr(10);
 	
 	}
 	/**
@@ -121,7 +115,9 @@
 	protected function unfold($content) {
 	
 		$return = array();
-		$lines = explode($this->line_terminator, $content);
+		// handle linux AND windows line-breaks!
+		$content = str_replace("\r", "\n", $content);
+		$lines = explode("\n", $content);
 		foreach ($lines as $line) {
 			$checkempty = trim($line);
 			if (empty($checkempty)) continue;
@@ -138,4 +134,4 @@
 	
 	}
 
-}
\ Kein Zeilenumbruch am Dateiende.
+}
openSUSE Build Service is sponsored by