aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2002-09-13 06:53:38 +0000
committerChad Little <clittle@users.sourceforge.net>2002-09-13 06:53:38 +0000
commit7dde781deeecfa7d63aa714518e03879a32fe10a (patch)
tree363fcb94e57e5448bb6ce068587eeae160d439b9
parent48f1f8f1a5c29031b6e89c0eea4f2b400adea548 (diff)
downloadphpicalendar-7dde781deeecfa7d63aa714518e03879a32fe10a.tar.gz
phpicalendar-7dde781deeecfa7d63aa714518e03879a32fe10a.tar.bz2
phpicalendar-7dde781deeecfa7d63aa714518e03879a32fe10a.zip
New master array, day brought up to date.
-rw-r--r--day.php2
-rw-r--r--ical_parser.php2
2 files changed, 2 insertions, 2 deletions
diff --git a/day.php b/day.php
index 0d1ebf8..5cd0fcf 100644
--- a/day.php
+++ b/day.php
@@ -1 +1 @@
-<? include "ical_parser.php"; if ($getdate == (date("Ymd"))) { $display_date = date ("l, F d"); $tomorrows_date = date( "Ymd", (time() + (24*3600))); $yesterdays_date = date( "Ymd", (time() - (24*3600))); } else { ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; $unix_time = mktime(0,0,0,"$this_month","$this_day","$this_year"); $display_date = date ("l, F d", $unix_time); $tomorrow = $unix_time + (24*3600); $yesterday = $unix_time - (24*3600); $tomorrows_date = date( "Ymd", ($tomorrow)); $yesterdays_date = date( "Ymd", ($yesterday)); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title><? echo "$calendar_name"; ?></title> <link rel="stylesheet" type="text/css" href="styles/default.css"> </head> <body bgcolor="#FFFFFF"> <center> <table width="700" border="0" cellspacing="0" cellpadding="0" class="V12"> <!-- [[tr]] [[td align="left" width="5%"]][[a href="day.php"]]Today[[/a]][[/td]] [[td align="center" width="90%"]][[a href="day.php"]]Day[[/a]] | [[a href="week.php"]]Week[[/a]] | [[a href="month.php"]]Month[[/a]][[/td]] [[td align="right" width="5%"]][[a href="preferences.php"]]Preferences[[/a]][[/td]] [[/tr]] [[tr]] [[td colspan="3"]][[img src="images/spacer.gif" height="24" width="1"]][[/td]] [[/tr]] --> <tr> <td class="V12" align="left" valign="top" width="5%" nowrap><a href="day.php?getdate=<? echo "$yesterdays_date"; ?>">Previous Day</a></td> <td class="H20" align="center" valign="middle" width="90%" nowrap><? echo "$display_date"; ?></td> <td class="V12" align="right" valign="top" width="5%" nowrap><a href="day.php?getdate=<? echo "$tomorrows_date"; ?>">Next Day</a></td> </tr> <tr> <td colspan="3"><img src="images/spacer.gif" height="10" width="1"></td> </tr> </table> <table width="700" border="0" cellspacing="1" cellpadding="2" class="bodyline"> <tr> <td> <table width="700" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="middle"> <table border="0" cellspacing="0" cellpadding="0" bgcolor="#a1a5a9" class="G10B"> <tr> <td align="center" valign="top"> <table border="0" cellspacing="1" cellpadding="0"> <tr> <td colspan="3" bgcolor="white" nowrap> <table width="100%" border="0" cellspacing="4" cellpadding="0"> <tr> <td align="left" valign="middle"><b><font class="V12"><? echo "$calendar_name"; ?> Calendar</font></b></td> <td align="right" valign="middle" class="V12"><a href="<? echo "$fullpath"; ?>">Subscribe</a> | <a href="<? echo "$filename"; ?>">Download</a></td> </tr> </table> </td> </tr> <? // The all day events returned here. $i = 0; if ($master_array[($getdate)]["0001"]["event_text"] != "") { echo "<tr height=\"30\">\n"; echo "<td colspan=\"3\" height=\"30\" valign=\"middle\" align=\"center\" bgcolor=\"#68aaef\">\n"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\">\n"; foreach($master_array[($getdate)]["0001"]["event_text"] as $all_day_text) { if ($i > 0) { echo "<tr>\n"; echo "<td bgcolor=\"#eeeeee\" height=\"1\"></td>\n"; echo "</tr>\n"; } echo "<tr>\n"; echo "<td valign=\"top\" align=\"center\"><span style=\"font-style: italic; color: #ffffff\">$all_day_text</span></td>\n"; echo "</tr>\n"; $i++; } echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; } ?> <tr> <td nowrap bgcolor="#a1a5a9" width="60"><img src="images/spacer.gif" width="60" height="1"></td> <td nowrap bgcolor="#a1a5a9" width="1"><img src="images/spacer.gif" width="1" height="1"></td> <td colspan="3" nowrap bgcolor="#a1a5a9"><img src="images/spacer.gif" width="649" height="1"></td> </tr> <? // $master_array[($getdate)]["$day_time"] $event_length = 0; $k = 0; foreach ($day_array as $key) { // The first <TR> $cal_time = $key; $key = strtotime ("$key"); $key = date ("g:i", $key); if (ereg("^([0-9]{1,2}):00", $key)) { if ($master_array[($getdate)]["$cal_time"] == "") { echo "<tr height=\"30\">\n"; echo "<td rowspan=\"2\" align=\"center\" valign=\"top\" bgcolor=\"#f5f5f5\" width=\"60\">$key</td>\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; if ($event_length > 0) { $event_length--; } else { echo "<td bgcolor=\"#ffffff\"><img src=\"images/spacer.gif\" width=\"1\" height=\"30\"></td>\n"; } echo "</tr>\n"; } elseif ($event_started != TRUE) { $event_started = TRUE; $event_text = $master_array[($getdate)]["$cal_time"]["event_text"]; $event_start = $master_array[($getdate)]["$cal_time"]["event_start"]; $event_end = $master_array[($getdate)]["$cal_time"]["event_end"]; $event_length = $master_array[($getdate)]["$cal_time"]["event_length"]; $event_start = strtotime ("$event_start"); $event_start = strftime ("%I:%M %p", $event_start); $event_start = ereg_replace ("^([0]{1})", "", $event_start); $event_end = strtotime ("$event_end"); $event_end = strftime ("%I:%M %p", $event_end); $event_end = ereg_replace ("^([0]{1})", "", $event_end); echo "<tr height=\"30\">\n"; echo "<td rowspan=\"2\" align=\"center\" valign=\"top\" bgcolor=\"#f5f5f5\" width=\"60\">$key</td>\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; echo "<td rowspan=\"$event_length\" align=\"left\" valign=\"top\" bgcolor=\"#68aaef\">\n"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n"; echo "<tr>\n"; echo "<td class=\"bodyline2\"><font class=\"G10\" style=\"color:#ffffff;\"><b>$event_start</b> - $event_end</font></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>\n"; echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n"; echo "<tr>\n"; echo "<td bgcolor=\"#68aaef\"><font class=\"G10\" style=\"color:#ffffff\">$event_text</font></td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; $event_length--; } else { echo "<tr height=\"30\">\n"; echo "<td rowspan=\"2\" align=\"center\" valign=\"top\" bgcolor=\"#f5f5f5\" width=\"60\">$key</td>\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; if ($event_length > 0) { $event_length--; } else { echo "<td bgcolor=\"#ffffff\"><img src=\"images/spacer.gif\" width=\"1\" height=\"30\"></td>\n"; } echo "</tr>\n"; } } if ($event_length == 0) $event_started = FALSE; // The second <TR> if (ereg("([0-9]{1,2}):30", $key)) { if (($master_array[($getdate)]["$cal_time"]["event_text"] == "") && ($event_started != TRUE)) { echo "<tr height=\"30\">\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; echo "<td bgcolor=\"#ffffff\">&nbsp;</td>\n"; echo "</tr>\n"; } elseif ($event_length > 0) { echo "<tr height=\"30\">\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"</td>\n"; echo "</tr>\n"; $event_length--; } else { $event_started = TRUE; $event_text = $day_time["event_text"]; $event_start = $day_time["event_start"]; $event_length = $day_time["event_length"]; echo "<tr>\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; echo "<td rowspan=\"$event_length\" align=\"left\" valign=\"top\" bgcolor=\"#68aaef\">\n"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n"; echo "<tr>\n"; echo "<td class=\"bodyline2\"><font class=\"G10\" style=\"color:#ffffff; font-weight: bold\">$event_start</font></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>\n"; echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n"; echo "<tr>\n"; echo "<td bgcolor=\"#68aaef\"><font class=\"G10\" style=\"color:#ffffff\">$event_text</font></td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; $event_length--; } } } ?> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <table width="700" border="0" cellspacing="0" cellpadding="0" class="V12"> <tr> <td colspan="3"><img src="images/spacer.gif" height="10" width="1"></td> </tr> <tr> <td class="V12" align="left" valign="middle" width="5%" nowrap><a href="day.php">Previous Day</a></td> <td class="H20" align="center" valign="middle" width="90%" nowrap><? echo "$today"; ?></td> <td class="V12" align="right" valign="middle" width="5%" nowrap><a href="day.php">Next Day</a></td> </tr> <!-- [[tr]] [[td colspan="3"]][[img src="images/spacer.gif" height="24" width="1"]][[/td]] [[/tr]] [[tr]] [[td align="left" width="5%"]][[a href="day.php"]]Today[[/a]][[/td]] [[td align="center" width="90%"]][[a href="day.php"]]Day[[/a]] | [[a href="week.php"]]Week[[/a]] | [[a href="month.php"]]Month[[/a]][[/td]] [[td align="right" width="5%"]][[a href="preferences.php"]]Preferences[[/a]][[/td]] [[/tr]] --> </table> </center> </body> </html> \ No newline at end of file
+<? include "ical_parser.php"; if ($getdate == (date("Ymd"))) { $display_date = date ("l, F d"); $tomorrows_date = date( "Ymd", (time() + (24*3600))); $yesterdays_date = date( "Ymd", (time() - (24*3600))); } else { ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; $unix_time = mktime(0,0,0,"$this_month","$this_day","$this_year"); $display_date = date ("l, F d", $unix_time); $tomorrow = $unix_time + (24*3600); $yesterday = $unix_time - (24*3600); $tomorrows_date = date( "Ymd", ($tomorrow)); $yesterdays_date = date( "Ymd", ($yesterday)); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title><? echo "$calendar_name"; ?></title> <link rel="stylesheet" type="text/css" href="styles/default.css"> </head> <body bgcolor="#FFFFFF"> <center> <table width="700" border="0" cellspacing="0" cellpadding="0" class="V12"> <!-- [[tr]] [[td align="left" width="5%"]][[a href="day.php"]]Today[[/a]][[/td]] [[td align="center" width="90%"]][[a href="day.php"]]Day[[/a]] | [[a href="week.php"]]Week[[/a]] | [[a href="month.php"]]Month[[/a]][[/td]] [[td align="right" width="5%"]][[a href="preferences.php"]]Preferences[[/a]][[/td]] [[/tr]] [[tr]] [[td colspan="3"]][[img src="images/spacer.gif" height="24" width="1"]][[/td]] [[/tr]] --> <tr> <td class="V12" align="left" valign="top" width="5%" nowrap><a href="day.php?getdate=<? echo "$yesterdays_date"; ?>">Previous Day</a></td> <td class="H20" align="center" valign="middle" width="90%" nowrap><? echo "$display_date"; ?></td> <td class="V12" align="right" valign="top" width="5%" nowrap><a href="day.php?getdate=<? echo "$tomorrows_date"; ?>">Next Day</a></td> </tr> <tr> <td colspan="3"><img src="images/spacer.gif" height="10" width="1"></td> </tr> </table> <table width="700" border="0" cellspacing="1" cellpadding="2" class="bodyline"> <tr> <td> <table width="700" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="middle"> <table border="0" cellspacing="0" cellpadding="0" bgcolor="#a1a5a9" class="G10B"> <tr> <td align="center" valign="top"> <table border="0" cellspacing="1" cellpadding="0"> <tr> <td colspan="3" bgcolor="white" nowrap> <table width="100%" border="0" cellspacing="4" cellpadding="0"> <tr> <td align="left" valign="middle"><b><font class="V12"><? echo "$calendar_name"; ?> Calendar</font></b></td> <td align="right" valign="middle" class="V12"><a href="<? echo "$fullpath"; ?>">Subscribe</a> | <a href="<? echo "$filename"; ?>">Download</a></td> </tr> </table> </td> </tr> <? // The all day events returned here. $i = 0; if ($master_array[($getdate)]["0001"]["event_text"] != "") { echo "<tr height=\"30\">\n"; echo "<td colspan=\"3\" height=\"30\" valign=\"middle\" align=\"center\" bgcolor=\"#68aaef\">\n"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\">\n"; foreach($master_array[($getdate)]["0001"]["event_text"] as $all_day_text) { if ($i > 0) { echo "<tr>\n"; echo "<td bgcolor=\"#eeeeee\" height=\"1\"></td>\n"; echo "</tr>\n"; } echo "<tr>\n"; echo "<td valign=\"top\" align=\"center\"><span style=\"font-style: italic; color: #ffffff\">$all_day_text</span></td>\n"; echo "</tr>\n"; $i++; } echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; } ?> <tr> <td nowrap bgcolor="#a1a5a9" width="60"><img src="images/spacer.gif" width="60" height="1"></td> <td nowrap bgcolor="#a1a5a9" width="1"><img src="images/spacer.gif" width="1" height="1"></td> <td colspan="3" nowrap bgcolor="#a1a5a9"><img src="images/spacer.gif" width="649" height="1"></td> </tr> <? // $master_array[($getdate)]["$day_time"] $event_length = 0; foreach ($day_array as $key) { // The first <TR> $k = 0; $cal_time = $key; $key = strtotime ("$key"); $key = date ("g:i", $key); if (ereg("^([0-9]{1,2}):00", $key)) { if ($master_array[($getdate)]["$cal_time"] == "") { echo "<tr height=\"30\">\n"; echo "<td rowspan=\"2\" align=\"center\" valign=\"top\" bgcolor=\"#f5f5f5\" width=\"60\">$key</td>\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; if ($event_length > 0) { $event_length--; } else { echo "<td bgcolor=\"#ffffff\"><img src=\"images/spacer.gif\" width=\"1\" height=\"30\"></td>\n"; } echo "</tr>\n"; } elseif ($event_started != TRUE) { $event_started = TRUE; $event_text = $master_array[($getdate)]["$cal_time"][$k]["event_text"]; $event_start = $master_array[($getdate)]["$cal_time"][$k]["event_start"]; $event_end = $master_array[($getdate)]["$cal_time"][$k]["event_end"]; $event_length = $master_array[($getdate)]["$cal_time"][$k]["event_length"]; $event_start = strtotime ("$event_start"); $event_start = date ("g:i", $event_start); $event_end = strtotime ("$event_end"); $event_end = date ("g:i", $event_end); echo "<tr height=\"30\">\n"; echo "<td rowspan=\"2\" align=\"center\" valign=\"top\" bgcolor=\"#f5f5f5\" width=\"60\">$key</td>\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; echo "<td rowspan=\"$event_length\" align=\"left\" valign=\"top\" bgcolor=\"#68aaef\">\n"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n"; echo "<tr>\n"; echo "<td class=\"bodyline2\"><font class=\"G10\" style=\"color:#ffffff;\"><b>$event_start</b> - $event_end</font></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>\n"; echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n"; echo "<tr>\n"; echo "<td bgcolor=\"#68aaef\"><font class=\"G10\" style=\"color:#ffffff\">$event_text</font></td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; $event_length--; } else { echo "<tr height=\"30\">\n"; echo "<td rowspan=\"2\" align=\"center\" valign=\"top\" bgcolor=\"#f5f5f5\" width=\"60\">$key</td>\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; if ($event_length > 0) { $event_length--; } else { echo "<td bgcolor=\"#ffffff\"><img src=\"images/spacer.gif\" width=\"1\" height=\"30\"></td>\n"; } echo "</tr>\n"; } } if ($event_length == 0) $event_started = FALSE; // The second <TR> if (ereg("([0-9]{1,2}):30", $key)) { if (($master_array[($getdate)]["$cal_time"] == "") && ($event_started != TRUE)) { echo "<tr height=\"30\">\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; echo "<td bgcolor=\"#ffffff\">&nbsp;</td>\n"; echo "</tr>\n"; } elseif ($event_length > 0) { echo "<tr height=\"30\">\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"</td>\n"; echo "</tr>\n"; $event_length--; } else { $event_started = TRUE; $event_text = $master_array[($getdate)]["$cal_time"][$k]["event_text"]; $event_start = $master_array[($getdate)]["$cal_time"][$k]["event_start"]; $event_end = $master_array[($getdate)]["$cal_time"][$k]["event_end"]; $event_length = $master_array[($getdate)]["$cal_time"][$k]["event_length"]; echo "<tr>\n"; echo "<td align=\"center\" valign=\"top\" nowrap bgcolor=\"#a1a5a9\" width=\"1\" height=\"30\"></td>\n"; echo "<td rowspan=\"$event_length\" align=\"left\" valign=\"top\" bgcolor=\"#68aaef\">\n"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n"; echo "<tr>\n"; echo "<td class=\"bodyline2\"><font class=\"G10\" style=\"color:#ffffff; font-weight: bold\">$event_start</font></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>\n"; echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n"; echo "<tr>\n"; echo "<td bgcolor=\"#68aaef\"><font class=\"G10\" style=\"color:#ffffff\">$event_text</font></td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</td>\n"; echo "</tr>\n"; $event_length--; } } } ?> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <table width="700" border="0" cellspacing="0" cellpadding="0" class="V12"> <tr> <td colspan="3"><img src="images/spacer.gif" height="10" width="1"></td> </tr> <tr> <td class="V12" align="left" valign="middle" width="5%" nowrap><a href="day.php">Previous Day</a></td> <td class="H20" align="center" valign="middle" width="90%" nowrap><? echo "$today"; ?></td> <td class="V12" align="right" valign="middle" width="5%" nowrap><a href="day.php">Next Day</a></td> </tr> <!-- [[tr]] [[td colspan="3"]][[img src="images/spacer.gif" height="24" width="1"]][[/td]] [[/tr]] [[tr]] [[td align="left" width="5%"]][[a href="day.php"]]Today[[/a]][[/td]] [[td align="center" width="90%"]][[a href="day.php"]]Day[[/a]] | [[a href="week.php"]]Week[[/a]] | [[a href="month.php"]]Month[[/a]][[/td]] [[td align="right" width="5%"]][[a href="preferences.php"]]Preferences[[/a]][[/td]] [[/tr]] --> </table> </center> </body> </html> \ No newline at end of file
diff --git a/ical_parser.php b/ical_parser.php
index 6f38f70..473018d 100644
--- a/ical_parser.php
+++ b/ical_parser.php
@@ -1 +1 @@
-<? if(phpversion() >= "4.2.0") { extract($HTTP_POST_VARS); extract($HTTP_GET_VARS); } $day_array = array ("0700", "0730", "0800", "0830", "0900", "0930", "1000", "1030", "1100", "1130", "1200", "1230", "1300", "1330", "1400", "1430", "1500", "1530", "1600", "1630", "1700", "1730", "1800", "1830", "1900", "1930", "2000", "2030", "2100", "2130", "2200", "2230", "2300", "2330"); // what iCal file are we using $fullpath = "webcal://chadsdomain.com/ical/Home.ics"; $filename = "calendars/Home.ics"; // what date we want to get data for (for day calendar) if (!$getdate) $getdate = date("Ymd"); ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; // open the iCal file, read it into an array $contents = file($filename); $start_time = ""; $end_time = ""; $summary = ""; $allday_start = ""; $allday_end = ""; $i = 0; foreach($contents as $line) { if (strstr($line, "BEGIN:VEVENT")) { $start_time = ""; $end_time = ""; $summary = ""; $allday_start = ""; $allday_end = ""; $start = ""; $end = ""; $the_duration = ""; $beginning = ""; } elseif (strstr($line, "END:VEVENT")) { if ($start_time != "") { //echo "<b>Start</b> $start_time <b>End</B> $end_time <b>Summary</b> $summary<br>\n"; ereg ("([0-9]{2})([0-9]{2})", $start_time, $time); $hour = $time[1]; $minute = $time[2]; if($minute < 15) $minute = "00"; else if($minute >=15 && $minute < 45) $minute = "30"; else if($minute >= 45) { $hour = sprintf("%.02d", ($hour + 1)); $minute = "00"; } ereg ("([0-9]{2})([0-9]{2})", $end_time, $time2); $length = round((($time2[1]*60+$time2[2]) - ($time[1]*60+$time[2]))/30); $master_array[($start_date)][($hour.$minute)][] = array ( "event_start" => $start_time, "event_text" => $summary, "event_end" => $end_time, "event_length" => $length); } if ($allday_start != "") { $start = strtotime("$allday_start"); $end = strtotime("$allday_end"); do { $start_date = date("Ymd", $start); $master_array[($start_date)][("0001")]["event_text"][] = "$summary"; $i++; $start = ($start + (24*3600)); } while ($start != $end); } } else { $field = ""; $data = ""; sscanf($line, "%[^:]:%[^\n]", &$field, &$data); //echo $line . "<br>"; //echo $field . "<br>"; //echo $data . "<br>"; if(strstr($field, "DTSTART;TZID")) { $data = ereg_replace("T", "", $data); ereg ("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})", $data, $regs); $year = $regs[1]; $month = $regs[2]; $day = $regs[3]; $hour = $regs[4]; $minute = $regs[5]; $start_date = $year . $month . $day; $start_time = $hour . $minute; } elseif (strstr($field, "DTEND;TZID")) { $data = ereg_replace("T", "", $data); ereg ("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})", $data, $regs); $year = $regs[1]; $month = $regs[2]; $day = $regs[3]; $hour = $regs[4]; $minute = $regs[5]; $end_day = $year . $month . $day; $end_time = $hour . $minute; } elseif (strstr($field, "SUMMARY")) { $summary = $data; } elseif (strstr($field, "X-WR-CALNAME")) { $calendar_name = $data; } elseif (strstr($field, "DTSTART;VALUE=DATE")) { $allday_start = $data; } elseif (strstr($field, "DTEND;VALUE=DATE")) { $allday_end = $data; } elseif (strstr($field, "DURATION")) { ereg ("^P([0-9]{1,2})?([W,D]{0,1})?(T)?([0-9]{1,2})?(H)?([0-9]{1,2})?(M)?([0-9]{1,2})?(S)?", $data, $duration); if ($durartion[2] = "W") { $weeks = $durartion[1]; } else { $days = $durartion[1]; } $hours = $duration[4]; $minutes = $duration[6]; $seconds = $duration[8]; $the_duration = ($weeks * 60 * 60 * 24 * 7) + ($days * 60 * 60 * 24) + ($hours * 60 * 60) + ($minutes * 60) + ($seconds); $beginning = (strtotime($start_time) + $the_duration); $end_time = date ("Hi", $beginning); } } } // If you want to see the values in the arrays, uncomment below. print_r($master_array); // print_r($day_array); ?> \ No newline at end of file
+<? if(phpversion() >= "4.2.0") { extract($HTTP_POST_VARS); extract($HTTP_GET_VARS); } $day_array = array ("0700", "0730", "0800", "0830", "0900", "0930", "1000", "1030", "1100", "1130", "1200", "1230", "1300", "1330", "1400", "1430", "1500", "1530", "1600", "1630", "1700", "1730", "1800", "1830", "1900", "1930", "2000", "2030", "2100", "2130", "2200", "2230", "2300", "2330"); // what iCal file are we using $fullpath = "webcal://chadsdomain.com/ical/Home.ics"; $filename = "calendars/Home.ics"; // what date we want to get data for (for day calendar) if (!$getdate) $getdate = date("Ymd"); ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; // open the iCal file, read it into an array $contents = file($filename); $start_time = ""; $end_time = ""; $summary = ""; $allday_start = ""; $allday_end = ""; $i = 0; foreach($contents as $line) { if (strstr($line, "BEGIN:VEVENT")) { $start_time = ""; $end_time = ""; $summary = ""; $allday_start = ""; $allday_end = ""; $start = ""; $end = ""; $the_duration = ""; $beginning = ""; } elseif (strstr($line, "END:VEVENT")) { if ($start_time != "") { //echo "<b>Start</b> $start_time <b>End</B> $end_time <b>Summary</b> $summary<br>\n"; ereg ("([0-9]{2})([0-9]{2})", $start_time, $time); $hour = $time[1]; $minute = $time[2]; if($minute < 15) $minute = "00"; else if($minute >=15 && $minute < 45) $minute = "30"; else if($minute >= 45) { $hour = sprintf("%.02d", ($hour + 1)); $minute = "00"; } ereg ("([0-9]{2})([0-9]{2})", $end_time, $time2); $length = round((($time2[1]*60+$time2[2]) - ($time[1]*60+$time[2]))/30); $master_array[($start_date)][($hour.$minute)][] = array ( "event_start" => $start_time, "event_text" => $summary, "event_end" => $end_time, "event_length" => $length); } if ($allday_start != "") { $start = strtotime("$allday_start"); $end = strtotime("$allday_end"); do { $start_date = date("Ymd", $start); $master_array[($start_date)][("0001")]["event_text"][] = "$summary"; $i++; $start = ($start + (24*3600)); } while ($start != $end); } } else { $field = ""; $data = ""; sscanf($line, "%[^:]:%[^\n]", &$field, &$data); //echo $line . "<br>"; //echo $field . "<br>"; //echo $data . "<br>"; if(strstr($field, "DTSTART;TZID")) { $data = ereg_replace("T", "", $data); ereg ("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})", $data, $regs); $year = $regs[1]; $month = $regs[2]; $day = $regs[3]; $hour = $regs[4]; $minute = $regs[5]; $start_date = $year . $month . $day; $start_time = $hour . $minute; } elseif (strstr($field, "DTEND;TZID")) { $data = ereg_replace("T", "", $data); ereg ("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})", $data, $regs); $year = $regs[1]; $month = $regs[2]; $day = $regs[3]; $hour = $regs[4]; $minute = $regs[5]; $end_day = $year . $month . $day; $end_time = $hour . $minute; } elseif (strstr($field, "SUMMARY")) { $summary = $data; } elseif (strstr($field, "X-WR-CALNAME")) { $calendar_name = $data; } elseif (strstr($field, "DTSTART;VALUE=DATE")) { $allday_start = $data; } elseif (strstr($field, "DTEND;VALUE=DATE")) { $allday_end = $data; } elseif (strstr($field, "DURATION")) { ereg ("^P([0-9]{1,2})?([W,D]{0,1})?(T)?([0-9]{1,2})?(H)?([0-9]{1,2})?(M)?([0-9]{1,2})?(S)?", $data, $duration); if ($durartion[2] = "W") { $weeks = $durartion[1]; } else { $days = $durartion[1]; } $hours = $duration[4]; $minutes = $duration[6]; $seconds = $duration[8]; $the_duration = ($weeks * 60 * 60 * 24 * 7) + ($days * 60 * 60 * 24) + ($hours * 60 * 60) + ($minutes * 60) + ($seconds); $beginning = (strtotime($start_time) + $the_duration); $end_time = date ("Hi", $beginning); } } } // If you want to see the values in the arrays, uncomment below. // print_r($master_array); // print_r($day_array); ?> \ No newline at end of file

© 2014-2024 Faster IT GmbH | imprint | privacy policy