From 39ce04602a235a2d5d922d0467feb2bf8ac7efdd Mon Sep 17 00:00:00 2001 From: icalshare Date: Wed, 24 Sep 2003 01:27:01 +0000 Subject: Abstracted page logic from display markup (to help ease upcoming transition to templates) --- includes/event.php | 279 ++++++++++++++++++++++++++--------------------------- 1 file changed, 139 insertions(+), 140 deletions(-) (limited to 'includes') diff --git a/includes/event.php b/includes/event.php index 14de99b..c8492f0 100644 --- a/includes/event.php +++ b/includes/event.php @@ -2,182 +2,181 @@ define('BASE', '../'); include (BASE.'functions/init.inc.php'); +// Load vars if (isset($HTTP_GET_VARS['event']) && ($HTTP_GET_VARS['event'] !== '') ) { - $event = $HTTP_GET_VARS['event']; + $event=$HTTP_GET_VARS['event']; } else { - $event = ''; + $event=''; } if (isset($HTTP_GET_VARS['description']) && ($HTTP_GET_VARS['description'] !== '') ) { - $description = $HTTP_GET_VARS['description']; + $description=$HTTP_GET_VARS['description']; } else { - $description = ''; + $description=''; } if (isset($HTTP_GET_VARS['cal']) && ($HTTP_GET_VARS['cal'] !== '') ) { - $calendar_name = $HTTP_GET_VARS['cal']; + $calendar_name=$HTTP_GET_VARS['cal']; } else { - $calendar_name = ''; + $calendar_name=''; } - if (isset($HTTP_GET_VARS['start']) && ($HTTP_GET_VARS['start'] !== '') ) { - $start = $HTTP_GET_VARS['start']; + $start=$HTTP_GET_VARS['start']; } else { - $start = ''; + $start=''; } if (isset($HTTP_GET_VARS['end']) && ($HTTP_GET_VARS['end'] !== '') ) { - $end = $HTTP_GET_VARS['end']; + $end=$HTTP_GET_VARS['end']; } else { - $end = ''; + $end=''; } if (isset($HTTP_GET_VARS['status']) && ($HTTP_GET_VARS['status'] !== '') ) { - $status = $HTTP_GET_VARS['status']; + $status=$HTTP_GET_VARS['status']; } else { - $status = ''; + $status=''; } - if (isset($HTTP_GET_VARS['location']) && ($HTTP_GET_VARS['location'] !== '') ) { - $location = $HTTP_GET_VARS['location']; + $location=$HTTP_GET_VARS['location']; } else { - $location = ''; + $location=''; } - if (isset($HTTP_GET_VARS['organizer']) && ($HTTP_GET_VARS['organizer'] !== '') ) { - $organizer = $HTTP_GET_VARS['organizer']; + $organizer=$HTTP_GET_VARS['organizer']; } else { - $organizer = ''; + $organizer=''; } - if (isset($HTTP_GET_VARS['attendee']) && ($HTTP_GET_VARS['attendee'] !== '') ) { - $attendee = $HTTP_GET_VARS['attendee']; + $attendee=$HTTP_GET_VARS['attendee']; +} else { + $attendee=''; +} + +// Prep vars for HTML display +$event=stripslashes(rawurldecode($event)); +$event=str_replace('\\','',$event); +$description=stripslashes(rawurldecode($description)); +$description=str_replace('\\','',$description); +$organizer=stripslashes(rawurldecode($organizer)); +$organizer=str_replace('\\','',$organizer); +$organizer=unserialize($organizer); +$attendee=str_replace('\\','',$attendee); +$attendee=unserialize ($attendee); +$location=stripslashes(rawurldecode($location)); +$location=str_replace('\\','',$location); +$calendar_name=stripslashes(rawurldecode($calendar_name)); +$calendar_name=str_replace('\\','',$calendar_name); + +// Format calendar title +if ($calendar_name == $ALL_CALENDARS_COMBINED) { + $cal_title=$all_cal_comb_lang; + $cal_title_full=$all_cal_comb_lang; } else { - $attendee = ''; + $cal_title=$calendar_name; + $cal_title_full=$calendar_name . ' ' . $calendar_lang; +} + +// Format event time +if (($start) && ($end)) { + $event_times=' - (' . $start . ' - ' . $end . ')'; +} +if ($start == '' && $end == '' && (isset($start) && isset($end))) { + $event_times=' - (' . $all_day_lang . ')'; } -$event = rawurldecode($event); -$event = stripslashes($event); -$event = str_replace('\\', '', $event); -$description = rawurldecode($description); -$description = stripslashes($description); -$description = str_replace('\\', '', $description); -$organizer = rawurldecode($organizer); -$organizer = stripslashes($organizer); -$organizer = str_replace('\\', '', $organizer); -$organizer = unserialize ($organizer); -$attendee = rawurldecode($attendee); -$attendee = stripslashes($attendee); -$attendee = str_replace('\\', '', $attendee); -$attendee = unserialize ($attendee); -$location = rawurldecode($location); -$location = stripslashes($location); -$location = str_replace('\\', '', $location); -$calendar_name2 = rawurldecode($calendar_name); -$calendar_name2 = stripslashes($calendar_name2); -$calendar_name2 = str_replace('\\', '', $calendar_name2); +// Format optional event fields +if ($description) { + $display.="\n"; + $display.='' . "\n"; + $display.=' ' . "\n"; + $display.='' . "\n"; + $display.=ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'\0',$description); + $display.='' . "\n"; + $display.='' . "\n"; +} +if ($organizer) { + $i=0; + $display.='' . "\n"; + $display.=' ' . "\n"; + $display.=''; + $display.=$organizer_lang . ' - '; + foreach ($organizer as $val) { + $organizers.=$organizer[$i]["name"] . ', '; + $i++; + } + $display.=substr($organizers,0,-2); + $display.='' . "\n"; + $display.='' . "\n"; +} +if ($attendee) { + $i=0; + $display.="\n"; + $display.='' . "\n"; + $display.=' ' . "\n"; + $display.='' . "\n"; + $display.=$attendee_lang . ' - '; + foreach ($attendee as $val) { + $attendees .= $attendee[$i]["name"] . ', '; + $i++; + } + $attendees=substr($attendees,0,-2); + $display.='' . "\n"; + $display.='' . "\n"; +} +if ($status) { + $display.="\n"; + $display.='' . "\n"; + $display.=' ' . "\n"; + $display.='' . "\n"; + $display.=$status_lang . ' - ' . $status. '' . "\n"; + $display.=''; +} +if ($location) { + $display.="\n"; + $display.='' . "\n"; + $display.=' ' . "\n"; + $display.='' . "\n"; + $display.=$location_lang . ' - ' . $location.'' . "\n"; + $display.='' . "\n"; +} ?> - - <?php - if ($calendar_name == $ALL_CALENDARS_COMBINED) { - echo "$all_cal_comb_lang"; - } else { - echo "$calendar_name2"; - }?> + + <?php echo $cal_title; ?> "> -
+ + + +
- - - - - - - - - - - -
 - -
- - ('.$start.' - '.$end.')'; - if ($start == '' && $end == '' && (isset($start) && isset($end))) $event_times = ' - ('.$all_day_lang.')'; - ?> - - - - - - - - - - - - '; - echo ''; - echo ''; - } - - if ($attendee) { - $i = 0; - echo ''; - echo ''; - echo ''; - } - - if ($status) { - echo ''; - echo ''; - echo ''; - echo ''; - } - - if ($location) { - echo ''; - echo ''; - echo ''; - echo ''; - } - - - ?> - -

'; ?>
 - [:space:]]+[[:alnum:]/]", - '\0', $description); ?>
 '; - echo $organizer_lang.' - '; - foreach ($organizer as $val) { - $organizers .= $organizer[$i]["name"].', '; - $i++; - } - $organizers = substr ($organizers, 0, -2); - echo $organizers.'
 '; - echo $attendee_lang.' - '; - foreach ($attendee as $val) { - $attendees .= $attendee[$i]["name"].', '; - $i++; - } - $attendees = substr ($attendees, 0, -2); - echo $attendees.'
 '; - echo $status_lang.' - '.$status.'
 '; - echo $location_lang.' - '.$location.'
-
+ + + + + + + + + + + + + + + + + + + +


+ + + +
- + + + \ No newline at end of file -- cgit v1.2.3