From fa2ea7e23195bf0791a6695e068980514a3428d4 Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Fri, 26 Dec 2008 09:05:15 +0000 Subject: fix bug 961091 with provided patch --- calendars/test.ics | 15 +++++++++++++++ search.php | 14 +++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/calendars/test.ics b/calendars/test.ics index 1b92d29..ecfe9f3 100644 --- a/calendars/test.ics +++ b/calendars/test.ics @@ -49,5 +49,20 @@ DTSTART;TZID=US/Eastern:20100902T090000 RRULE:FREQ=DAILY;COUNT=10 END:VEVENT +BEGIN:VEVENT +DTSTAMP:20070306T130934Z +ORGANIZER;CN=xxx:MAILTO:xxx localhost localdomain +CREATED:20070212T152028Z +UID:KOrganizer-1162820691.683 +SEQUENCE:2 +LAST-MODIFIED:20070306T130835Z +SUMMARY:Knitting Class +CLASS:PUBLIC +PRIORITY:5 +RRULE:FREQ=WEEKLY;UNTIL=20070326T190000Z;BYDAY=MO +DTSTART:20070219T190000Z +DTEND:20070219T210000Z +TRANSP:OPAQUE +END:VEVENT END:VCALENDAR diff --git a/search.php b/search.php index 288a59a..75a3dd6 100644 --- a/search.php +++ b/search.php @@ -109,12 +109,12 @@ function format_search($search_str) { if ($i != 0 && $and_arr[$i] == 'or') { while ($and_arr[$i] == 'or') { $or_arr[$j][] = $and_arr[$i-1]; - unset($and_arr[$i], $and_arr[$i-1]); - $i += 2; + array_splice($and_arr,$i-1,2); + $i--; } - if (isset($and_arr[$i-1])) { - $or_arr[$j][] = $and_arr[$i-1]; - unset($and_arr[$i-1]); + if (isset($and_arr[$i])) { + $or_arr[$j][] = $and_arr[$i]; + array_splice($and_arr,$i,1); } $or_str_arr[$j] = implode(' OR ', $or_arr[$j]); $j++; @@ -125,10 +125,10 @@ function format_search($search_str) { foreach($and_arr as $key => $val) { if (substr($val,0,1) == '-') { $not_arr[] = substr($val,1); - unset($and_arr[$key]); + array_splice($and_arr,$key,1); } elseif(substr($val,0,1) == '+') { $and_arr[] = substr($val,1); - unset($and_arr[$key]); + array_splice($and_arr,$key,1); } } -- cgit v1.2.3