From: Jim Hu <ji...@ta...> - 2005-05-05 21:43:37
|
Well, Chad, for one of the first things you wrote in PHP, phpicalendar is remarkably well done, IMHO. Moreover, I think a lot of people have found it to be incredibly useful, despite whatever minor problems we find. Just Google phpicalendar and look at all the hits - both users and people saddened by the site being down. I'm far from being a proficient programmer and I'm glad that I have been able to help around here. I've also learned a huge amount about php from working with your code...and I hope that any changes I've made in the various updates haven't done too much violence to the original vision (for example, I think that some of the stuff I put into rss.php for my own use really needs to be expunged...I really need to learn more about RSS, XML, and validation of both of these). I look forward to learning about OO programming in php as things move forward! Jim On May 5, 2005, at 2:56 PM, php...@li... wrote: > Send Phpicalendar-devel mailing list submissions to > php...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/phpicalendar-devel > or, via email, send a message with subject or body 'help' to > php...@li... > > You can reach the person managing the list at > php...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Phpicalendar-devel digest..." > > > Today's Topics: > > 1. new developer added (Chad Little) > 2. openevent/event.php cleanup (David Fallon) > > --__--__-- > > Message: 1 > To: Dev List <php...@li...> > From: Chad Little <ch...@ch...> > Date: Thu, 5 May 2005 12:02:41 -0700 > Subject: [PHPiCalendar-DEV] new developer added > Reply-To: php...@li... > > > --Apple-Mail-4--426391869 > Content-Transfer-Encoding: 7bit > Content-Type: text/plain; > charset=US-ASCII; > delsp=yes; > format=flowed > > Hello, > > We've added David Fallon to the list of developers. I'd like to thank > him (and Jim) for their efforts in continuing the project during my > waves of interest. I will be putting the site back up later this > month, which I think many will be thankful for. > > PHP ICalendar was one of the first things I wrote while learning PHP, > and it's age is starting to show. I've overhauled a good bit of the > template, html, and css for 2.0, but its not perfect. I'd love it if > we could focus on getting in the already provided patches in > sourceforge, as well as looking at a few of the bugs that are there. > We'd then be able to get out a new release to go up with the new > site. Once we get the next release out I think that would be the best > time to look at serious restructuring of ical_parser and moving it to > a class, with DB support. > > -chad > --Apple-Mail-4--426391869 > Content-Transfer-Encoding: base64 > Content-Type: application/pkcs7-signature; > name=smime.p7s > Content-Disposition: attachment; > filename=smime.p7s > > MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhTC > CAz4w > ggKnoAMCAQICAw1wWTANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChM > cVGhh > d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZ > yZWVt > YWlsIElzc3VpbmcgQ0EwHhcNMDQxMTE2MjAyNDUzWhcNMDUxMTE2MjAyNDUzWjCBiTEfMB0 > GA1UE > AxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEfMB0GCSqGSIb3DQEJARYQbGl0dGxlQGFwcGx > lLmNv > bTEjMCEGCSqGSIb3DQEJARYUY2hhZEBjaGFkc2RvbWFpbi5jb20xIDAeBgkqhkiG9w0BCQE > WEWNs > aXR0bGVAYXBwbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0nAmPVW > e5qeR > NCgTGkF0RC9wUJ8/iDmtb0zFcwgWUDJUDvdRyQdEntTe2UQYiNwkoB/ > 7hXrxpkvK793Lio3pF7w6 > jE7oEmPh7aH+LcCLW2VobP4Ov1JlrXu4kQpItjDFm0SEHo2fplGFmkPp63tP2oMr0bT1wzH > FVZnD > py6yjrtGPQBajFsEvIBkHX7yYunF0Rr5FD5la5C8d6HWwZ0ZfPbmYIc5CXQ2VRj8/E5/ > I7TLJbKQ > gP4sP/ > PrQ25izwjE3C+AIOeBNm6cq900nvBfBLuEO7S5zPc8Uu9n6uwpBh+f+WY9r+uKgHuw88ph > LdlcMoZqPMjeRiDGWA8A+cIonwIDAQABo1YwVDBEBgNVHREEPTA7gRBsaXR0bGVAYXBwbGU > uY29t > gRRjaGFkQGNoYWRzZG9tYWluLmNvbYERY2xpdHRsZUBhcHBsZS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2d183PtvhOQVW5m2TTicJfuVtmjjV1 > 6cGSFl6RtABYbZmvbcjQiIT3duScl4FrdPRDlqCVvz9FNeeY69Pj2ymnZExOOgV1utFbOxt > /n2lb > ptLDmxXpboIzkSHv6H4R5kz+PZZdPPHQv/nQ7AXc/JiFhbGwGb/uO1ewDNWrdzyXZXk2m/ > Mfm9oe > PFwXnM9++ryw9OmPbEVq7IW/ > ZYgcTTDpXOw61r01ySt77hM2QVzk1p556rPkIPXO6VSGvaM2JiC4 > FeUgKsD0PY/C71veu7A9ax8AAAAAAAA= > > --Apple-Mail-4--426391869-- > > > --__--__-- > > Message: 2 > Date: Thu, 05 May 2005 12:54:04 -0700 > From: David Fallon <da...@d2...> > To: php...@li... > Subject: [PHPiCalendar-DEV] openevent/event.php cleanup > Reply-To: php...@li... > > This is a multi-part message in MIME format. > --------------020305090307080109000700 > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > Content-Transfer-Encoding: 7bit > > Attached is a borderline-2.0 worthy cleanup of openevent/event.php. It > simplifies the function by changing the data-passing to use the > date/time/uid to then lookup the event info in $master_array in > event.php, instead of passing the raw data. It's possibly a precursor > to > even more cleanup of that whole process, by turning the popups into > simple links instead of using the hidden form to pass data around. Note > this assumes that the UIDs are unique across calendars, which seems to > be a valid assumption given how $master_array is structured (if it's a > bogus assumption, then events with the same $uid are going to be > overwriting each other anyways). If this is valid, I should also clean > up how todo.php works (amusingly, in a totally different fashion, using > a base64-encoded get string. lends more validity to "the right way" > being removing the hidden form stuff completely, but it's a big enough > structure change I want to make sure there wasn't some other valid > reason I just don't know about for doing it). > > This patch also fixes an actual bug - the event.php popup should have > had the title be "$calname $lang['l_calendar']" - i.e., "US Holidays > Calendar" - it was using the old translation syntax, and thus was just > showing up as "US Holidays". > > Actually, this is probably worth going into 2.0, as I realized it's a > decently-smaller HTML render, as now all the event info isn't included > in the page for every event (twice). > > called openevent.patch > > look, diffstat says it's good! :) > > davef@rake-l:phpicalendar-working 539 > diffstat openevent.patch > functions/date_functions.php | 38 ++++------- > functions/draw_functions.php | 2 > functions/event.js | 30 ++------ > functions/ical_parser.php | 14 ++-- > functions/template.php | 148 > ++++++++++++++++++------------------------- > includes/event.php | 45 +++++-------- > templates/default/event.tpl | 2 > templates/default/header.tpl | 15 +--- > 8 files changed, 118 insertions(+), 176 deletions(-) > > I'm also working on a post-2.0 enhancement that adds human-readable > recurrence info to event.php. Cool feature, needs a decent amount more > work to support all the various ways recurrence info could exist. I > stuck the function that does this in ical_parser.php, which probably > isn't right. Please let me know if you'd like to see the > work-in-progress. > > dave > > --------------020305090307080109000700 > Content-Type: text/plain; > name="openevent.patch" > Content-Transfer-Encoding: 7bit > Content-Disposition: inline; > filename="openevent.patch" > > Index: functions/date_functions.php > =================================================================== > RCS file: > /cvsroot/phpicalendar/phpicalendar/functions/date_functions.php,v > retrieving revision 1.26 > diff -u -r1.26 date_functions.php > --- functions/date_functions.php 26 Oct 2004 19:12:29 -0000 1.26 > +++ functions/date_functions.php 5 May 2005 19:48:53 -0000 > @@ -162,44 +162,38 @@ > return $offset; > } > > -function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, > $pre_text, $post_text, $link_class, $url) { > +function openevent($event_date, $uid, $arr, $lines = 0, $length = 0, > $link_class = '', $pre_text = '', $post_text = '') { > + > $event_text = stripslashes(urldecode($arr["event_text"])); > if (empty($start)) { > $title = $event_text; > } else { > - $title = $start.' - '.$end.': '.$event_text; > + $title = $arr['event_start'].' - '.$arr['event_end'].': > '.$event_text; > } > # for iCal pseudo tag <http> comptability > - if > (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$matches)) { > - $full_event_text = $matches[1] . $matches[2]; > + if > (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$matches)) { > + $full_event_text = $matches[1] . $matches[2]; > $event_text = $matches[2]; > - } else { > + } else { > $full_event_text = $event_text; > $event_text = strip_tags($event_text, '<b><i><u>'); > } > > - if (isset($arr["organizer"])) $organizer = > addslashes($arr["organizer"]); > - if (isset($arr["attendee"])) $attendee = > addslashes($arr["attendee"]); > - if (isset($arr["location"])) $location = > addslashes($arr["location"]); > - if (isset($arr["status"])) $status = addslashes($arr["status"]); > - if (isset($arr["description"])) $description = > addslashes(stripslashes(urldecode($arr["description"]))); > - if (isset($arr["url"])) $url = > addslashes(stripslashes(urldecode($arr["url"]))); > - > - if (!empty($event_text)) { > + if (!empty($event_text)) { > if ($lines > 0) { > - $event_text = word_wrap($event_text, $wrap, $lines); > + $event_text = word_wrap($event_text, $length, $lines); > } > > - if ((!(ereg("([[:alpha:]]+://[^<>[:space:]]+)", $full_event_text, > $res))) || ($description)) { > - $escaped_event = addslashes($full_event_text); > - $escaped_calendar = addslashes($calendar_name); > - $escaped_start = addslashes($start); > - $escaped_end = addslashes($end); > + if ((!(ereg("([[:alpha:]]+://[^<>[:space:]]+)", $full_event_text, > $res))) || ($arr['description'])) { > + $escaped_date = addslashes($event_date); > + $escaped_time = addslashes($arr['event_start']); > + if (!$escaped_time) $escaped_time = -1; > + $escaped_uid = addslashes($uid); > // fix for URL-length bug in IE: populate and submit a hidden form > on click > static $popup_data_index = 0; > $return = " > <script language=\"Javascript\" type=\"text/javascript\"><!-- > - var eventData = new EventData('$escaped_event', > '$escaped_calendar', '$escaped_start', '$escaped_end', '$description', > '$status', '$location', '$organizer', '$attendee', '$url'); > + var eventData = new EventData('$escaped_date', '$escaped_time', > '$escaped_uid'); > document.popup_data[$popup_data_index] = eventData; > // --></script>"; > > @@ -210,9 +204,7 @@ > } > $return .= $pre_text.$event_text.$post_text.'</a>'."\n"; > } > - > + > return $return; > } > - > - > ?> > Index: functions/draw_functions.php > =================================================================== > RCS file: > /cvsroot/phpicalendar/phpicalendar/functions/draw_functions.php,v > retrieving revision 1.5 > diff -u -r1.5 draw_functions.php > --- functions/draw_functions.php 20 May 2004 06:04:14 -0000 1.5 > +++ functions/draw_functions.php 5 May 2005 19:48:53 -0000 > @@ -46,4 +46,4 @@ > } > return $str; > } > -?> > \ No newline at end of file > +?> > Index: functions/event.js > =================================================================== > RCS file: /cvsroot/phpicalendar/phpicalendar/functions/event.js,v > retrieving revision 1.13 > diff -u -r1.13 event.js > --- functions/event.js 12 Aug 2004 20:32:50 -0000 1.13 > +++ functions/event.js 5 May 2005 19:48:53 -0000 > @@ -4,16 +4,9 @@ > // populate the hidden form > var data = document.popup_data[num]; > var form = document.forms.eventPopupForm; > - form.elements.event.value = data.event; > - form.elements.cal.value = data.cal; > - form.elements.start.value = data.start; > - form.elements.end.value = data.end; > - form.elements.description.value = data.description; > - form.elements.status.value = data.status; > - form.elements.location.value = data.location; > - form.elements.organizer.value = data.organizer; > - form.elements.attendee.value = data.attendee; > - form.elements.url.value = data.url; > + form.elements.date.value = data.date; > + form.elements.time.value = data.time; > + form.elements.uid.value = data.uid; > > // open a new window > var w = window.open('', 'Popup', > 'scrollbars=yes,width=460,height=275'); > @@ -21,17 +14,10 @@ > form.submit(); > } > > -function EventData(event, cal, start, end, description, status, > location, organizer, attendee, url) { > - this.event = event; > - this.cal = cal; > - this.start = start; > - this.end = end; > - this.description = description; > - this.status = status; > - this.location = location; > - this.organizer = organizer; > - this.attendee = attendee; > - this.url = url; > +function EventData(date, time, uid) { > + this.date = date; > + this.time = time; > + this.uid = uid; > } > > function openTodoInfo(vtodo_array) { > @@ -45,4 +31,4 @@ > > document.popup_data = new Array(); > //--> > -</script> > \ No newline at end of file > +</script> > Index: functions/ical_parser.php > =================================================================== > RCS file: > /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v > retrieving revision 1.186 > diff -u -r1.186 ical_parser.php > --- functions/ical_parser.php 9 Nov 2004 20:53:11 -0000 1.186 > +++ functions/ical_parser.php 5 May 2005 19:48:54 -0000 > @@ -462,7 +462,9 @@ > > > $master_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = > $wkst; > break; > case 'END': > - > + > + $recur = > $master_array[($start_date)][($hour.$minute)][$uid]['recur']; > + > // Modify the COUNT based on BYDAY > if ((is_array($byday)) && (isset($count))) { > $blah = sizeof($byday); > @@ -669,7 +671,7 @@ > $end_time2 = strtotime('+'.$diff_allday_days.' days', > $recur_data_time); > while ($start_time2 < $end_time2) { > $start_date2 = date('Ymd', $start_time2); > - $master_array[($start_date2)][('-1')][] = array > ('event_text' => $summary, 'description' => $description, 'location' > => $location, 'organizer' => serialize($organizer), 'attendee' => > serialize($attendee), 'calnumber' => $calnumber, 'calname' => > $actual_calname, 'url' => $url, 'status' => $status, 'class' => $class > ); > + $master_array[($start_date2)][('-1')][$uid] = array > ('event_text' => $summary, 'description' => $description, 'location' > => $location, 'organizer' => serialize($organizer), 'attendee' => > serialize($attendee), 'calnumber' => $calnumber, 'calname' => > $actual_calname, 'url' => $url, 'status' => $status, 'class' => > $class, 'recur' => $recur ); > $start_time2 = strtotime('+1 day', $start_time2); > } > } else { > @@ -699,7 +701,7 @@ > $until_check = $start_date_tmp.$time_tmp.'00'; > if ($abs_until > $until_check) { > $nbrOfOverlaps = checkOverlap($start_date_tmp, > $start_time_tmp, $end_time_tmp, $uid); > - $master_array[$start_date_tmp][$time_tmp][$uid] = > array ('event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, > 'display_end' => $display_end_tmp, 'start_unixtime' => > $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' > => $summary, 'event_length' => $length, 'event_overlap' => > $nbrOfOverlaps, 'description' => $description, 'status' => $status, > 'class' => $class, 'spans_day' => true, 'location' => $location, > 'organizer' => serialize($organizer), 'attendee' => > serialize($attendee), 'calnumber' => $calnumber, 'calname' => > $actual_calname, 'url' => $url) ; > + $master_array[$start_date_tmp][$time_tmp][$uid] = > array ('event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, > 'display_end' => $display_end_tmp, 'start_unixtime' => > $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' > => $summary, 'event_length' => $length, 'event_overlap' => > $nbrOfOverlaps, 'description' => $description, 'status' => $status, > 'class' => $class, 'spans_day' => true, 'location' => $location, > 'organizer' => serialize($organizer), 'attendee' => > serialize($attendee), 'calnumber' => $calnumber, 'calname' => > $actual_calname, 'url' => $url, 'recur' => $recur) ; > } > $start_tmp = strtotime('+1 day',$start_tmp); > } > @@ -715,7 +717,7 @@ > $until_check = $recur_data_date.$hour.$minute.'00'; > if ($abs_until > $until_check) { > $nbrOfOverlaps = checkOverlap($recur_data_date, > $start_time, $end_time_tmp1, $uid); > - > $master_array[($recur_data_date)][($hour.$minute)][$uid] = array > ('event_start' => $start_time, 'event_end' => $end_time_tmp1, > 'display_end' => $display_end_tmp, 'start_unixtime' => > $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' > => $summary, 'event_length' => $length, 'event_overlap' => > $nbrOfOverlaps, 'description' => $description, 'status' => $status, > 'class' => $class, 'spans_day' => false, 'location' => $location, > 'organizer' => serialize($organizer), 'attendee' => > serialize($attendee), 'calnumber' => $calnumber, 'calname' => > $actual_calname, 'url' => $url); > + > $master_array[($recur_data_date)][($hour.$minute)][$uid] = array > ('event_start' => $start_time, 'event_end' => $end_time_tmp1, > 'display_end' => $display_end_tmp, 'start_unixtime' => > $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' > => $summary, 'event_length' => $length, 'event_overlap' => > $nbrOfOverlaps, 'description' => $description, 'status' => $status, > 'class' => $class, 'spans_day' => false, 'location' => $location, > 'organizer' => serialize($organizer), 'attendee' => > serialize($attendee), 'calnumber' => $calnumber, 'calname' => > $actual_calname, 'url' => $url, 'recur' => $recur); > } > } > } > @@ -1176,7 +1178,7 @@ > //print_r($overlap_array); > //print_r($day_array); > //print_r($rrule_array); > -//print_r($recurrence_delete); > +//print_r($recurrence_delete); > //print '</pre>'; > > // Set a calender name for all calenders combined > @@ -1185,5 +1187,5 @@ > } > > $template_started = getmicrotime(); > - > + > ?> > Index: functions/template.php > =================================================================== > RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v > retrieving revision 1.68 > diff -u -r1.68 template.php > --- functions/template.php 5 May 2005 07:07:50 -0000 1.68 > +++ functions/template.php 5 May 2005 19:48:54 -0000 > @@ -264,17 +264,15 @@ > $loop_ad = trim($match1[1]); > $loop_begin = trim($match2[1]); > $loop_end = trim($match3[1]); > - foreach ($weekarray as $key => $get_date) { > + foreach ($weekarray as $get_date) { > $replace = $loop_begin; > $colspan = 'colspan="'.$nbrGridCols[$get_date].'"'; > $replace = str_replace('{COLSPAN}', $colspan, $replace); > if (is_array($master_array[$get_date]['-1'])) { > - foreach ($master_array[$get_date]['-1'] as $allday) { > + foreach ($master_array[$get_date]['-1'] as $uid => $allday) { > $event_calno = $allday['calnumber']; > - $event_calna = $allday['calname']; > - $event_url = $allday['url']; > if ($event_calno > $unique_colors) $event_calno = ($event_calno > - $unique_colors); > - $event = openevent($event_calna, '', '', $allday, 1, 11, '', > '', 'psf', $event_url); > + $event = openevent($get_date, $uid, $allday, 1, 11, 'psf'); > $loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad); > $loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp); > $replace .= $loop_tmp; > @@ -365,7 +363,7 @@ > $thisday = date("Ymd", $thisdate); > $dayborder = 0; > unset($this_time_arr); > - > + > if ($day_start == $cal_time && isset($master_array[$thisday]) && > is_array($master_array[$thisday])) { > foreach($master_array[$thisday] as $time_key => $time_arr) { > if ((int)$time_key <= (int)$cal_time) { > @@ -424,18 +422,17 @@ > } else { > $emptyWidth = $nbrGridCols[$thisday]; > for ($i=0;$i<sizeof($event_length[$thisday]);$i++) { > - > + > $drawWidth = $nbrGridCols[$thisday] / > ($event_length[$thisday][$i]["overlap"] + 1); > $emptyWidth = $emptyWidth - $drawWidth; > switch ($event_length[$thisday][$i]["state"]) { > case "begin": > $event_length[$thisday][$i]["state"] = "started"; > - $event_start = > $this_time_arr[($event_length[$thisday][$i]["key"])]['start_unixtime']; > + $uid = $event_length[$thisday][$i]["key"]; > + $event_start = $this_time_arr[$uid]['start_unixtime']; > $event_start = date ($timeFormat_small, $event_start); > - $event_calno = > $this_time_arr[($event_length[$thisday][$i]['key'])]['calnumber']; > - $event_calna = > $this_time_arr[($event_length[$thisday][$i]['key'])]['calname']; > - $event_url = > $this_time_arr[($event_length[$thisday][$i]['key'])]['url']; > - $event_status = > strtolower($this_time_arr[($event_length[$thisday][$i]['key'])]['status > ']); > + $event_calno = $this_time_arr[$uid]['calnumber']; > + $event_status = strtolower($this_time_arr[$uid]['status']); > if ($event_calno > $unique_colors) $event_calno = > ($event_calno - $unique_colors); > if ($event_status != '') { > $confirmed = '<img src="images/'.$event_status.'.gif" > width="9" height="9" alt="" border="0" hspace="0" vspace="0" > /> '; > @@ -443,13 +440,9 @@ > $colspan_width = round((80 / $nbrGridCols[$thisday]) * > $drawWidth); > $weekdisplay .= '<td width="'.$colspan_width.'" rowspan="' . > $event_length[$thisday][$i]['length'] . '" colspan="' . $drawWidth . > '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n"; > > - $event_end = > $this_time_arr[($event_length[$thisday][$i]["key"])]["end_unixtime"]; > - if > (isset($this_time_arr[($event_length[$thisday][$i]["key"])]['display_en > d'])) $event_end = strtotime > ($this_time_arr[($event_length[$thisday][$i]["key"])]['display_end']); > - $event_end = date ($timeFormat, $event_end); > - > // Start drawing the event > - $event_temp = $loop_event; > - $event = openevent($event_calna, $event_start, $event_end, > $this_time_arr[($event_length[$thisday][$i]["key"])], > $week_events_lines, 25, '', '', 'ps', $event_url); > + $event_temp = $loop_event; > + $event = openevent($thisday, $uid, $this_time_arr[$uid], > $week_events_lines, 25, 'ps'); > $event_temp = str_replace('{EVENT}', $event, $event_temp); > $event_temp = str_replace('{EVENT_START}', $event_start, > $event_temp); > $event_temp = str_replace('{CONFIRMED}', $confirmed, > $event_temp); > @@ -457,7 +450,7 @@ > $weekdisplay .= $event_temp; > $weekdisplay .= '</td>'; > // End event drawing > - > + > break; > case "started": > break; > @@ -482,34 +475,30 @@ > } > $weekdisplay .= "</tr>\n"; > } > - > + > $this->page = preg_replace('!<\!-- loop row on -->(.*)<\!-- loop > event off -->!is', $weekdisplay, $this->page); > - > - > - > + > } > - > + > function draw_day($template_p) { > global $template, $getdate, $cal, $master_array, $unique_colors, > $daysofweek_lang, $week_start_day, $dateFormat_week_list, > $current_view, $day_array, $timeFormat, $gridLength, $day_start; > - > + > // Replaces the allday events > $replace = ''; > if (is_array($master_array[$getdate]['-1'])) { > preg_match("!<\!-- loop allday on -->(.*)<\!-- loop allday off > -->!is", $this->page, $match1); > $loop_ad = trim($match1[1]); > - foreach ($master_array[$getdate]['-1'] as $allday) { > + foreach ($master_array[$getdate]['-1'] as $uid => $allday) { > $event_calno = $allday['calnumber']; > - $event_calna = $allday['calname']; > - $event_url = $allday['url']; > if ($event_calno > $unique_colors) $event_calno = ($event_calno - > $unique_colors); > - $event = openevent($event_calna, '', '', $allday, 0, '', '', > '', '', $event_url); > + $event = openevent($getdate, $uid, $allday); > $loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad); > $loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp); > $replace .= $loop_tmp; > } > } > $this->page = preg_replace('!<\!-- loop allday on -->(.*)<\!-- loop > allday off -->!is', $replace, $this->page); > - > + > // Replaces the daysofweek > preg_match("!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek > off -->!is", $this->page, $match1); > $loop_dof = trim($match1[1]); > @@ -588,12 +577,12 @@ > } > } > } else { > - // add events that overlap the start time > - if (isset($master_array[$getdate][$cal_time]) && > sizeof($master_array[$getdate][$cal_time]) > 0) { > - $this_time_arr = $master_array[$getdate][$cal_time]; > + // add events that overlap the start time > + if (isset($master_array[$getdate][$cal_time]) && > sizeof($master_array[$getdate][$cal_time]) > 0) { > + $this_time_arr = $master_array[$getdate][$cal_time]; > + } > } > - } > - > + > // check for eventstart > if (isset($this_time_arr) && sizeof($this_time_arr) > 0) { > foreach ($this_time_arr as $eventKey => $loopevent) { > @@ -642,14 +631,15 @@ > switch ($event_length[$i]['state']) { > case 'begin': > $event_length[$i]['state'] = 'started'; > - $event_start = strtotime > ($this_time_arr[($event_length[$i]['key'])]['event_start']); > - $event_end = strtotime > ($this_time_arr[($event_length[$i]['key'])]['event_end']); > - if > (isset($this_time_arr[($event_length[$i]['key'])]['display_end'])) > $event_end = strtotime > ($this_time_arr[($event_length[$i]['key'])]['display_end']); > + $uid = $event_length[$i]['key']; > + $event_start = strtotime > ($this_time_arr[$uid]['event_start']); > + $event_end = strtotime ($this_time_arr[$uid]['event_end']); > + if (isset($this_time_arr[$uid]['display_end'])) $event_end = > strtotime ($this_time_arr[$uid]['display_end']); > $event_start = date ($timeFormat, $event_start); > $event_end = date ($timeFormat, $event_end); > - $event_calno = > $this_time_arr[($event_length[$i]['key'])]['calnumber']; > - $event_recur = > $this_time_arr[($event_length[$i]['key'])]['recur']; > - $event_status = > strtolower($this_time_arr[($event_length[$i]['key'])]['status']); > + $event_calno = $this_time_arr[$uid]['calnumber']; > + $event_recur = $this_time_arr[$uid]['recur']; > + $event_status = strtolower($this_time_arr[$uid]['status']); > if ($event_calno > $unique_colors) $event_calno = > ($event_calno - $unique_colors); > if ($event_status != '') { > $confirmed = '<img src="images/'.$event_status.'.gif" > width="9" height="9" alt="" border="0" hspace="0" vspace="0" > /> '; > @@ -661,14 +651,12 @@ > > // Start drawing the event > $event_temp = $loop_event; > - $event_calna = > $this_time_arr[($event_length[$i]['key'])]['calname']; > - $event_url = > $this_time_arr[($event_length[$i]['key'])]['url']; > - $event = openevent($event_calna, $event_start, > $event_end, $this_time_arr[($event_length[$i]['key'])], '', 0, '', '', > 'ps', $event_url); > - $event_temp = str_replace('{EVENT}', $event, $event_temp); > - $event_temp = str_replace('{EVENT_START}', $event_start, > $event_temp); > - $event_temp = str_replace('{EVENT_END}', $event_end, > $event_temp); > - $event_temp = str_replace('{CONFIRMED}', $confirmed, > $event_temp); > - $event_temp = str_replace('{EVENT_CALNO}', $event_calno, > $event_temp); > + $event = openevent($getdate, $uid, $this_time_arr[$uid], > 0, 0, 'ps'); > + $event_temp = str_replace('{EVENT}', $event, $event_temp); > + $event_temp = str_replace('{EVENT_START}', $event_start, > $event_temp); > + $event_temp = str_replace('{EVENT_END}', $event_end, > $event_temp); > + $event_temp = str_replace('{CONFIRMED}', $confirmed, > $event_temp); > + $event_temp = str_replace('{EVENT_CALNO}', $event_calno, > $event_temp); > $daydisplay .= $event_temp; > $daydisplay .= '</td>'; > // End event drawing > @@ -711,40 +699,34 @@ > $loop_t_e = trim($match2[1]); > $return_adtmp = ''; > $return_etmp = ''; > - > + > if (is_array($master_array[$next_day]) && > sizeof($master_array[$next_day]) > 0) { > foreach ($master_array[$next_day] as $event_times) { > - foreach ($event_times as $val) { > + foreach ($event_times as $uid => $val) { > $event_text = stripslashes(urldecode($val["event_text"])); > $event_text = strip_tags($event_text, '<b><i><u>'); > - if ($event_text != "") { > - $event_calna = $val["calname"]; > - $event_url = $val["url"]; > - $event_start = date ($timeFormat, $val["start_unixtime"]); > - $event_end = date ($timeFormat, $val["end_unixtime"]); > - if (!isset($val["event_start"])) { > - $event_start = $lang['l_all_day']; > - $event_end = ''; > - $return_adtmp = openevent($event_calna, $event_start, > $event_end, $val, $tomorrows_events_lines, 21, '', '', 'psf', > $event_url); > - $replace_ad .= str_replace('{T_ALLDAY}', $return_adtmp, > $loop_t_ad); > - } else { > - $return_etmp = openevent($event_calna, $event_start, > $event_end, $val, $tomorrows_events_lines, 21, '', '', 'ps3', > $event_url); > - $replace_e .= str_replace('{T_EVENT}', $return_etmp, > $loop_t_e); > + if ($event_text != "") { > + if (!isset($val["event_start"])) { > + $return_adtmp = openevent($next_day, $uid, $val, > $tomorrows_events_lines, 21, 'psf'); > + $replace_ad .= str_replace('{T_ALLDAY}', $return_adtmp, > $loop_t_ad); > + } else { > + $return_etmp = openevent($next_day, $uid, $val, > $tomorrows_events_lines, 21, 'ps3'); > + $replace_e .= str_replace('{T_EVENT}', $return_etmp, > $loop_t_e); > } > } > } > } > - > + > $this->page = preg_replace('!<\!-- switch t_allday on -->(.*)<\!-- > switch t_allday off -->!is', $replace_ad, $this->page); > $this->page = preg_replace('!<\!-- switch t_event on -->(.*)<\!-- > switch t_event off -->!is', $replace_e, $this->page); > - > + > } else { > - > + > $this->page = preg_replace('!<\!-- switch tomorrows_events on > -->(.*)<\!-- switch tomorrows_events off -->!is', '', $this->page); > - > + > } > } > - > + > function get_vtodo() { > global $template, $getdate, $master_array, $next_day, $timeFormat, > $tomorrows_events_lines, $show_completed, $show_todos; > > @@ -891,28 +873,22 @@ > if ($master_array[$daylink]) { > if ($type != 'small') { > foreach ($master_array[$daylink] as $event_times) { > - foreach ($event_times as $val) { > + foreach ($event_times as $uid => $val) { > $event_calno = $val['calnumber']; > if ($event_calno > $unique_colors) $event_calno = > ($event_calno - $unique_colors); > - $event_calna = $val['calname']; > - $event_url = $val['url']; > if (!isset($val['event_start'])) { > if ($type == 'large') { > $switch['ALLDAY'] .= '<div class="V10"><img > src="templates/'.$template.'/images/monthdot_'.$event_calno.'.gif" > alt="" width="9" height="9" border="0" />'; > - $switch['ALLDAY'] .= openevent($event_calna, '', '', $val, > $month_event_lines, 15, '', '', 'psf', $event_url); > + $switch['ALLDAY'] .= openevent($daylink, $uid, $val, > $month_event_lines, 15, 'psf'); > $switch['ALLDAY'] .= '</div>'; > } else { > $switch['ALLDAY'] .= '<img > src="templates/'.$template.'/images/allday_dot.gif" alt=" " width="11" > height="10" border="0" />'; > } > } else { > - $event_start = $val['start_unixtime']; > - $event_end = (isset($val['display_end'])) ? > $val['display_end'] : $val["event_end"]; > - $event_start = date($timeFormat, $val['start_unixtime']); > $start2 = date($timeFormat_small, $val['start_unixtime']); > - $event_end = date($timeFormat, @strtotime ($event_end)); > if ($type == 'large') { > $switch['EVENT'] .= '<div class="V9"><img > src="templates/'.$template.'/images/monthdot_'.$event_calno.'.gif" > alt="" width="9" height="9" border="0" />'; > - $switch['EVENT'] .= openevent($event_calna, $event_start, > $event_end, $val, $month_event_lines, 10, "$start2 ", '', 'ps3', > $event_url).'<br />'; > + $switch['EVENT'] .= openevent($daylink, $uid, $val, > $month_event_lines, 10, 'ps3', "$start2 ").'<br />'; > $switch['EVENT'] .= '</div>'; > } else { > $switch['EVENT'] = '<img > src="templates/'.$template.'/images/event_dot.gif" alt=" " width="11" > height="10" border="0" />'; > @@ -971,22 +947,22 @@ > foreach ($master_array[$m_start] as $event_times) { > $switch['CAL'] = $cal; > $switch['START_DATE'] = localizeDate ($dateFormat_week_list, > $u_start); > - foreach ($event_times as $val) { > + foreach ($event_times as $uid => $val) { > $switch['CALNAME'] = $val['calname']; > - $switch['URL'] = $val['url']; > if (!isset($val['event_start'])) { > $switch['START_TIME'] = $lang['l_all_day']; > + $switch['EVENT_TEXT'] = openevent($m_start, $uid, $val, > $month_event_lines, 15, 'psf'); > $switch['DESCRIPTION'] = urldecode($val['description']); > - $switch['EVENT_TEXT'] = openevent($switch['CALNAME'], '', '', > $val, $month_event_lines, 15, '', '', 'psf', $switch['URL']); > - } else { > + } else { > $event_start = $val['start_unixtime']; > $event_end = (isset($val['display_end'])) ? > $val['display_end'] : $val["event_end"]; > $event_start = date($timeFormat, $val['start_unixtime']); > $event_end = date($timeFormat, @strtotime ($event_end)); > $switch['START_TIME'] = $event_start . ' - ' . $event_end; > - $switch['EVENT_TEXT'] = openevent($switch['CALNAME'], > $event_start, $event_end, $val, 0, 15, '', '', 'psf', $switch['URL']); > + $switch['EVENT_TEXT'] = openevent($m_start, $uid, $val, 0, > 15, 'psf'); > $switch['DESCRIPTION'] = urldecode($val['description']); > } > + > if ($switch['EVENT_TEXT'] != '') { > $switch['DAYLINK'] = $m_start; > $temp = $loop[$i]; > @@ -1004,11 +980,11 @@ > $check_month = date('m', $u_start); > unset ($switch); > } while ($this_month == $check_month); > - > + > $this->page = preg_replace('!<\!-- loop showbottomevents_odd on > -->(.*)<\!-- loop showbottomevents_even off -->!is', $middle, > $this->page); > - > + > } > - > + > function Page($template = 'std.tpl') { > if (file_exists($template)) > $this->page = join('', file($template)); > Index: includes/event.php > =================================================================== > RCS file: /cvsroot/phpicalendar/phpicalendar/includes/event.php,v > retrieving revision 1.30 > diff -u -r1.30 event.php > --- includes/event.php 2 Sep 2004 18:41:13 -0000 1.30 > +++ includes/event.php 5 May 2005 19:48:54 -0000 > @@ -1,6 +1,8 @@ > <?php > define('BASE', '../'); > +$getdate = $_POST['date']; > include_once(BASE.'functions/init.inc.php'); > +include_once(BASE.'functions/ical_parser.php'); > require_once(BASE.'functions/template.php'); > > function decode_popup ($item) { > @@ -9,29 +11,20 @@ > return $item; > } > > -$event = (isset($_POST['event'])) ? decode_popup($_POST['event']) : > (''); > -$description = (isset($_POST['description'])) ? > decode_popup($_POST['description']) : (''); > -$cal = (isset($_POST['cal'])) ? decode_popup($_POST['cal']) : (''); > -$start = (isset($_POST['start'])) ? decode_popup($_POST['start']) : > (''); > -$end = (isset($_POST['end'])) ? decode_popup($_POST['end']) : (''); > -$status = (isset($_POST['status'])) ? > decode_popup($_POST['status']) : (''); > -$location = (isset($_POST['location'])) ? > decode_popup($_POST['location']) : (''); > -$url = (isset($_POST['url'])) ? decode_popup($_POST['url']) : (''); > -$organizer = (isset($_POST['organizer'])) ? ($_POST['organizer']) : > (''); > -$organizer = unserialize (decode_popup ($organizer)); > -$attendee = (isset($_POST['attendee'])) ? ($_POST['attendee']) : > (''); > -$attendee = unserialize (decode_popup ($attendee)); > -$cal_title_full = $cal.' '.$calendar_lang; > +$event = > $master_array[$_POST['date']][$_POST['time']][decode_popup($_POST['uid' > ])]; > +$organizer = unserialize($event['organizer']); > +$attendee = unserialize($event['attendee']); > > // Format event time > -if (($start) && ($end)) { > - $event_times = $start . ' - ' . $end; > -} > -if ($start == '' && $end == '' && (isset($start) && isset($end))) { > +// All day > +if ($_POST['time'] == -1) { > $event_times = $lang['l_all_day']; > +} else { > + $event_times = date($timeFormat, $event['start_unixtime']) . ' - ' . > date($timeFormat, $event['end_unixtime']); > } > > -if ($description) $description = > ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'<a > target="_new" href="\0">\0</a>',$description); > +if ($event['description']) $event['description'] = > ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'<a > target="_new" href="\0">\0</a>',$event['description']); > + > if (is_array($organizer)) { > $i=0; > $display .= $organizer_lang . ' - '; > @@ -51,8 +44,8 @@ > $attendee = substr($attendees,0,-2); > } > > -if ($location) { > - if ($url != '') $location = '<a href="'.$url.'" > target="_blank">'.$location.'</a>'; > +if ($event['location']) { > + if ($event['url'] != '') $event['location'] = '<a > href="'.$event['url'].'" target="_blank">'.$event['location'].'</a>'; > } > > if (sizeof($attendee) == 0) $attendee = ''; > @@ -61,15 +54,15 @@ > $page = new Page(BASE.'templates/'.$template.'/event.tpl'); > > $page->replace_tags(array( > - 'cal' => $cal, > - 'event' => $event, > + 'cal' => $event['calname'], > + 'event_text' => urldecode($event['event_text']), > 'event_times' => $event_times, > - 'description' => $description, > + 'description' => $event['description'], > 'organizer' => $organizer, > 'attendee' => $attendee, > - 'status' => $status, > - 'location' => $location, > - 'cal_title_full' => $cal_title_full, > + 'status' => $event['status'], > + 'location' => $event['location'], > + 'cal_title_full' => $event['calname'].' '.$lang['l_calendar'], > 'template' => $template, > 'l_organizer' => $lang['l_organizer'], > 'l_attendee' => $lang['l_attendee'], > Index: templates/default/event.tpl > =================================================================== > RCS file: > /cvsroot/phpicalendar/phpicalendar/templates/default/event.tpl,v > retrieving revision 1.8 > diff -u -r1.8 event.tpl > --- templates/default/event.tpl 31 Oct 2004 19:50:15 -0000 1.8 > +++ templates/default/event.tpl 5 May 2005 19:48:54 -0000 > @@ -15,7 +15,7 @@ > <tr> > <td align="left" class="V12"> > <div style="margin-left: 10px; margin-bottom:10px;"> > - <p>{EVENT} - <span class="V9">(<i>{EVENT_TIMES}</i>)</span></p> > + <p>{EVENT_TEXT} - <span > class="V9">(<i>{EVENT_TIMES}</i>)</span></p> > <!-- switch description on --> > <p>{DESCRIPTION}</p> > <!-- switch description off --> > Index: templates/default/header.tpl > =================================================================== > RCS file: > /cvsroot/phpicalendar/phpicalendar/templates/default/header.tpl,v > retrieving revision 1.10 > diff -u -r1.10 header.tpl > --- templates/default/header.tpl 12 Aug 2004 20:32:50 -0000 1.10 > +++ templates/default/header.tpl 5 May 2005 19:48:54 -0000 > @@ -12,14 +12,7 @@ > </head> > <body> > <form name="eventPopupForm" id="eventPopupForm" method="post" > action="includes/event.php" style="display: none;"> > - <input type="hidden" name="event" id="event" value="" /> > - <input type="hidden" name="cal" id="cal" value="" /> > - <input type="hidden" name="start" id="start" value="" /> > - <input type="hidden" name="end" id="end" value="" /> > - <input type="hidden" name="description" id="description" value="" /> > - <input type="hidden" name="status" id="status" value="" /> > - <input type="hidden" name="location" id="location" value="" /> > - <input type="hidden" name="organizer" id="organizer" value="" /> > - <input type="hidden" name="attendee" id="attendee" value="" /> > - <input type="hidden" name="url" id="url" value="" /> > -</form> > \ No newline at end of file > + <input type="hidden" name="date" id="date" value="" /> > + <input type="hidden" name="time" id="time" value="" /> > + <input type="hidden" name="uid" id="uid" value="" /> > +</form> > > --------------020305090307080109000700-- > > > > --__--__-- > > _______________________________________________ > Phpicalendar-devel mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpicalendar-devel > > > End of Phpicalendar-devel Digest |