From 46a025425efdd8f196d17465308f108d8f01992f Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Mon, 26 Jan 2009 03:51:52 +0000 Subject: fix multiline descriptions --- calendars/test.ics | 3 +++ functions/ical_parser.php | 5 +++-- includes/event.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/calendars/test.ics b/calendars/test.ics index 30e6720..2cc1e32 100644 --- a/calendars/test.ics +++ b/calendars/test.ics @@ -102,6 +102,9 @@ SEQUENCE:7 UID:starts on 07 DTSTAMP:20020918T224617Z SUMMARY:Earlier overlap +DESCRIPTION:this is a test + multiline + description STATUS:CONFIRMED DURATION:P3D DTSTART;TZID=US/Eastern:20081207 diff --git a/functions/ical_parser.php b/functions/ical_parser.php index 3776e55..ad4ed81 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -125,6 +125,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { $nextline = fgets($ifile, 1024); $nextline = ereg_replace("[\r\n]", "", $nextline); } + $line = str_replace('\n',"\n",$line); $line = trim(stripslashes($line)); switch ($line) { case 'BEGIN:VFREEBUSY': @@ -333,9 +334,9 @@ foreach ($cal_filelist as $cal_key=>$filename) { break; case 'DESCRIPTION': - $data = str_replace("\\n", "
", $data); + $data = str_replace("\n", "
", $data); $data = str_replace("\\t", " ", $data); - $data = str_replace("\\r", "
", $data); + $data = str_replace("\r", "
", $data); $data = str_replace('$', '$', $data); $data = stripslashes($data); $data = htmlentities(urlencode($data)); diff --git a/includes/event.php b/includes/event.php index c250e8d..150a0e4 100644 --- a/includes/event.php +++ b/includes/event.php @@ -108,7 +108,7 @@ $page->replace_tags(array( 'cal' => $event['calname'], 'event_text' => $event['event_text'], 'event_times' => $event_times, - 'description' => nl2br($event['description']), + 'description' => str_replace('\n',"
",$event['description']), 'organizer' => $organizer, 'attendee' => $attendee, 'status' => $event['status'], -- cgit v1.2.3