diff options
author | icalshare <icalshare> | 2003-09-24 01:27:01 +0000 |
---|---|---|
committer | icalshare <icalshare> | 2003-09-24 01:27:01 +0000 |
commit | 39ce04602a235a2d5d922d0467feb2bf8ac7efdd (patch) | |
tree | 91fc3e43653ad26c04f6b419a448147b84725e7f | |
parent | 32e2918b65b63324c8f12e542b756540a334c792 (diff) | |
download | phpicalendar-39ce04602a235a2d5d922d0467feb2bf8ac7efdd.tar.gz phpicalendar-39ce04602a235a2d5d922d0467feb2bf8ac7efdd.tar.bz2 phpicalendar-39ce04602a235a2d5d922d0467feb2bf8ac7efdd.zip |
Abstracted page logic from display markup (to help ease upcoming transition to templates)
-rw-r--r-- | includes/event.php | 279 |
1 files changed, 139 insertions, 140 deletions
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=' - <font class="V9">(<i>' . $start . ' - ' . $end . '</i>)</font>'; +} +if ($start == '' && $end == '' && (isset($start) && isset($end))) { + $event_times=' - <font class="V9">(<i>' . $all_day_lang . '</i>)</font>'; } -$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.="<!-- Description -->\n"; + $display.='<tr>' . "\n"; + $display.='<td width="1%"><img src="../images/spacer.gif" width="6" height="1" alt=" "></td>' . "\n"; + $display.='<td align="left" colspan="2" class="V12">' . "\n"; + $display.=ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'<a target="_new" href="\0">\0</a>',$description); + $display.='</td>' . "\n"; + $display.='</tr>' . "\n"; +} +if ($organizer) { + $i=0; + $display.='<tr>' . "\n"; + $display.='<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>' . "\n"; + $display.='<td align="left" colspan="2" class="V12">'; + $display.=$organizer_lang . ' - '; + foreach ($organizer as $val) { + $organizers.=$organizer[$i]["name"] . ', '; + $i++; + } + $display.=substr($organizers,0,-2); + $display.='</td>' . "\n"; + $display.='</tr>' . "\n"; +} +if ($attendee) { + $i=0; + $display.="<!-- Attendee -->\n"; + $display.='<tr>' . "\n"; + $display.='<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>' . "\n"; + $display.='<td align="left" colspan="2" class="V12">' . "\n"; + $display.=$attendee_lang . ' - '; + foreach ($attendee as $val) { + $attendees .= $attendee[$i]["name"] . ', '; + $i++; + } + $attendees=substr($attendees,0,-2); + $display.='</td>' . "\n"; + $display.='</tr>' . "\n"; +} +if ($status) { + $display.="<!-- Status -->\n"; + $display.='<tr>' . "\n"; + $display.='<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>' . "\n"; + $display.='<td align="left" colspan="2" class="V12">' . "\n"; + $display.=$status_lang . ' - ' . $status. '</td>' . "\n"; + $display.='</tr>'; +} +if ($location) { + $display.="<!-- Location -->\n"; + $display.='<tr>' . "\n"; + $display.='<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>' . "\n"; + $display.='<td align="left" colspan="2" class="V12">' . "\n"; + $display.=$location_lang . ' - ' . $location.'</td>' . "\n"; + $display.='</tr>' . "\n"; +} ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> <head> - <meta http-equiv="content-type" content="text/html;charset=UTF-8"> - <title><?php - if ($calendar_name == $ALL_CALENDARS_COMBINED) { - echo "$all_cal_comb_lang"; - } else { - echo "$calendar_name2"; - }?></title> + <meta http-equiv="content-type" content="text/html;charset=UTF-8"> + <title><?php echo $cal_title; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo BASE."styles/$style_sheet/default.css"; ?>"> </head> -<body bgcolor="#eeeeee"><center> + +<!-- Start PAGE --> +<body bgcolor="#eeeeee"> +<center> <table border="0" width="430" cellspacing="0" cellpadding="0" class="calborder"> - <tr> - <td align="left" valign="top" width="1%" class="sideback"><img src="../images/spacer.gif" width="1" height="20" alt=" "></td> - <td align="center" width="98%" class="sideback"><font class="G10BOLD"> - <?php - if ($calendar_name == $ALL_CALENDARS_COMBINED) { - echo "$all_cal_comb_lang"; - } else { - echo "$calendar_name2 $calendar_lang"; - } - ?> - </font></td> - <td align="right" valign="top" width="1%" class="sideback"></td> - </tr> - <tr> - <td colspan="3"><img src="../images/spacer.gif" width="1" height="6" alt=" "></td> - </tr> - <tr> - <td colspan="3"> - <table width="430" border="0" cellspacing="0" cellpadding="0"> - <?php - if (($start) && ($end)) $event_times = ' - <font class="V9">(<i>'.$start.' - '.$end.'</i>)</font>'; - if ($start == '' && $end == '' && (isset($start) && isset($end))) $event_times = ' - <font class="V9">(<i>'.$all_day_lang.'</i>)</font>'; - ?> - <tr> - <td width="1%"><img src="../images/spacer.gif" width="6" height="1" alt=" "></td> - <td align="left" colspan="2" class="V12"><?php echo $event.' '.$event_times.'<br><br>'; ?></td> - </tr> - - <?php if ($description) { ?> - <tr> - <td width="1%"><img src="../images/spacer.gif" width="6" height="1" alt=" "></td> - <td align="left" colspan="2" class="V12"> - <?php echo ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", - '<a target="_new" href="\0">\0</a>', $description); ?></td> - </tr> - <?php } ?> - <?php - - if ($organizer) { - $i = 0; - echo '<tr>'; - echo '<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>'; - echo '<td align="left" colspan="2" class="V12">'; - echo $organizer_lang.' - '; - foreach ($organizer as $val) { - $organizers .= $organizer[$i]["name"].', '; - $i++; - } - $organizers = substr ($organizers, 0, -2); - echo $organizers.'</td></tr>'; - } - - if ($attendee) { - $i = 0; - echo '<tr>'; - echo '<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>'; - echo '<td align="left" colspan="2" class="V12">'; - echo $attendee_lang.' - '; - foreach ($attendee as $val) { - $attendees .= $attendee[$i]["name"].', '; - $i++; - } - $attendees = substr ($attendees, 0, -2); - echo $attendees.'</td></tr>'; - } - - if ($status) { - echo '<tr>'; - echo '<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>'; - echo '<td align="left" colspan="2" class="V12">'; - echo $status_lang.' - '.$status.'</td>'; - echo '</tr>'; - } - - if ($location) { - echo '<tr>'; - echo '<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>'; - echo '<td align="left" colspan="2" class="V12">'; - echo $location_lang.' - '.$location.'</td>'; - echo '</tr>'; - } - - - ?> - - </table> - </td> - </tr> -</table> +<!-- Calendar Title --> +<tr> +<td align="left" valign="top" width="1%" class="sideback"><img src="../images/spacer.gif" width="1" height="20" alt=" "></td> +<td align="center" width="98%" class="sideback"><font class="G10BOLD"><?php echo $cal_title_full; ?></font></td> +<td align="right" valign="top" width="1%" class="sideback"></td> +</tr> +<tr> +<td colspan="3"><img src="../images/spacer.gif" width="1" height="6" alt=" "></td> +</tr> + +<!-- Event Info --> +<tr> +<td colspan="3"> +<table width="430" border="0" cellspacing="0" cellpadding="0"> +<tr> +<td width="1%"><img src="../images/spacer.gif" width="6" height="1" alt=" "></td> +<td align="left" colspan="2" class="V12"><?php echo $event . ' ' . $event_times; ?><br><br></td> +</tr> +<?php echo $display; ?> +</table> +</td> +</tr> + +</table> </center> </body> -</html> +<!-- End PAGE --> + +</html>
\ No newline at end of file |