aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2003-11-19 07:54:09 +0000
committerChad Little <clittle@users.sourceforge.net>2003-11-19 07:54:09 +0000
commit19cac1259321933ee407ed6b077ef3d2aa9e9e58 (patch)
tree0be77a87ce554c71c61e8c61e7e4f27da9580a17 /functions
parentc5dca58b0b5707155d732a9f43894513bfc23b5c (diff)
downloadphpicalendar-19cac1259321933ee407ed6b077ef3d2aa9e9e58.tar.gz
phpicalendar-19cac1259321933ee407ed6b077ef3d2aa9e9e58.tar.bz2
phpicalendar-19cac1259321933ee407ed6b077ef3d2aa9e9e58.zip
Checked in a new popup system. Also added calname to calendar for popup reference.
Diffstat (limited to 'functions')
-rw-r--r--functions/date_functions.php75
-rw-r--r--functions/ical_parser.php26
-rw-r--r--functions/init.inc.php2
3 files changed, 55 insertions, 48 deletions
diff --git a/functions/date_functions.php b/functions/date_functions.php
index f14147b..8745c1a 100644
--- a/functions/date_functions.php
+++ b/functions/date_functions.php
@@ -160,54 +160,63 @@ function chooseOffset($time) {
return $offset;
}
-function openevent($cal, $st, $end, $arr, $lines, $wrap, $clic, $fclic, $class) {
+function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, $pre_text, $post_text, $link_class) {
$event_text = stripslashes(urldecode($arr["event_text"]));
# for iCal pseudo tag <http> comptability
- if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$reg)) {
- $ev = $reg[1] . $reg[2];
- $event_text = $reg[2];
+ if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$matches)) {
+ $full_event_text = $matches[1] . $matches[2];
+ $event_text = $matches[2];
} else {
- $ev = $arr["event_text"];
+ $full_event_text = $event_text;
$event_text = strip_tags($event_text, '<b><i><u>');
}
+
if (isset($arr["organizer"])) {
- $organizer = urlencode(addslashes($arr["organizer"]));
- } else {
- $organizer = '';
+ $organizer = addslashes($arr["organizer"]);
}
+
if (isset($arr["attendee"])) {
- $attendee = urlencode(addslashes($arr["attendee"]));
- } else {
- $attendee = '';
+ $attendee = addslashes($arr["attendee"]);
}
+
if (isset($arr["location"])) {
- $location = $arr["location"];
- } else {
- $location = '';
+ $location = addslashes($arr["location"]);
}
+
if (isset($arr["status"])) {
- $status = $arr["status"];
- } else {
- $status = '';
+ $status = addslashes($arr["status"]);
}
- if ($event_text != "") {
- if ($lines) $event_text = word_wrap($event_text, $wrap, $lines);
- $dsc = urlencode(addslashes($arr["description"]));
- echo '<a class="'.$class.'" href="';
- if ((!(ereg("([[:alpha:]]+://[^<>[:space:]]+)", $ev, $res))) || ($dsc)) {
- echo "javascript:w=window.open('";
- echo "includes/event.php?event=";
- echo urlencode(addslashes($ev));
- echo "&cal=";
- echo urlencode(addslashes($cal));
- echo "&start=$st&end=$end&description=$dsc&status=$status&location=$location&organizer=$organizer&attendee=$attendee";
- echo "','Popup','";
- echo "scrollbars=yes,width=460,height=275";
- echo "');w.focus()";
+
+ if (isset($arr["description"])) {
+ $description = addslashes(stripslashes(urldecode($arr["description"])));
+ }
+
+ if (!empty($event_text)) {
+ if ($lines > 0) {
+ $event_text = word_wrap($event_text, $wrap, $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);
+ // fix for URL-length bug in IE: populate and submit a hidden form on click
+ static $popup_data_index = 0;
+echo <<<END
+
+ <script language="Javascript" type="text/javascript"><!--
+ var eventData = new EventData('$escaped_event', '$escaped_calendar', '$escaped_start', '$escaped_end', '$description', '$status', '$location', '$organizer', '$attendee');
+ document.popup_data[$popup_data_index] = eventData;
+ // --></script>
+
+END;
+ echo "<a class=\"$link_class\" href=\"#\" onclick=\"openEventWindow($popup_data_index);\">";
+ $popup_data_index++;
} else {
- echo $res[1];
+ echo "<a class=\"$link_class\" href=\"{$res[1]}\">";
}
- echo '">'.$clic.$event_text.$fclic.'</a>';
+ echo "{$pre_text}{$event_text}{$post_text}</a>\n";
}
}
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 2928263..1383a21 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -51,20 +51,18 @@ if (($is_webcal == false) && ($save_parsed_cals == 'yes') && ($cal != $ALL_CALEN
}
if ($parse_file) {
-// some initializations, that have to be outside the calnumber loop
- // auxiliary array for determining overlaps of events
$overlap_array = array ();
-
- // using $uid to set specific points in array, if $uid is not in the
- // .ics file, we need to have some unique place in the array
$uid_counter = 0;
}
$calnumber = 1;
foreach ($cal_filelist as $filename) {
-
+
+ // Find the real name of the calendar.
+ $actual_calname = str_replace($calendar_path, '', $filename);
+ $actual_calname = str_replace('/', '', str_replace('.ics', '', $actual_calname));
+
if ($parse_file) {
- // patch to speed up parser
$ifile = fopen($filename, "r");
if ($ifile == FALSE) exit(error($error_invalidcal_lang, $filename));
@@ -231,7 +229,7 @@ foreach ($cal_filelist as $filename) {
if (($end > $mArray_begin) && ($end < $mArray_end)) {
while ($start != $end) {
$start_date2 = date('Ymd', $start);
- $master_array[($start_date2)][('-1')][$uid]= array ('event_text' => $summary, 'description' => $description, 'calnumber' => $calnumber);
+ $master_array[($start_date2)][('-1')][$uid]= array ('event_text' => $summary, 'description' => $description, 'calnumber' => $calnumber, 'calname' => $actual_calname );
$start = strtotime('+1 day', $start);
}
if (!$write_processed) $master_array[($start_date)]['-1'][$uid]['exception'] = true;
@@ -258,7 +256,7 @@ foreach ($cal_filelist as $filename) {
$end_time_tmp = '0000';
}
$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, 'end_unixtime' => $end_unixtime, '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) );
+ $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, 'end_unixtime' => $end_unixtime, '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 );
$start_tmp = strtotime('+1 day',$start_tmp);
}
if (!$write_processed) $master_array[$start_date][($hour.$minute)][$uid]['exception'] = true;
@@ -273,7 +271,7 @@ foreach ($cal_filelist as $filename) {
// This if statement should prevent writing of an excluded date if its the first recurrance - CL
if (!in_array($start_date, $except_dates)) {
$nbrOfOverlaps = checkOverlap($start_date, $start_time, $end_time_tmp1, $uid);
- $master_array[($start_date)][($hour.$minute)][$uid] = array ('event_start' => $start_time, 'event_end' => $end_time_tmp1, 'display_end' => $display_end_tmp, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, '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 );
+ $master_array[($start_date)][($hour.$minute)][$uid] = array ('event_start' => $start_time, 'event_end' => $end_time_tmp1, 'display_end' => $display_end_tmp, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, '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 );
if (!$write_processed) $master_array[($start_date)][($hour.$minute)][$uid]['exception'] = true;
}
}
@@ -575,7 +573,7 @@ foreach ($cal_filelist as $filename) {
$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, 'calnumber' => $calnumber);
+ $master_array[($start_date2)][('-1')][]= array ('event_text' => $summary, 'description' => $description, 'calnumber' => $calnumber, 'calname' => $actual_calname );
$start_time2 = strtotime('+1 day', $start_time2);
}
} else {
@@ -600,7 +598,7 @@ foreach ($cal_filelist as $filename) {
$end_time_tmp = '0000';
}
$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);
+ $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);
$start_tmp = strtotime('+1 day',$start_tmp);
}
} else {
@@ -615,7 +613,7 @@ foreach ($cal_filelist as $filename) {
$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);
+ $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);
}
}
}
@@ -657,7 +655,7 @@ foreach ($cal_filelist as $filename) {
} else {
$vtodo_sort = $vtodo_priority;
}
- $master_array['-2']["$vtodo_sort"]["$uid"] = array ('start_date' => $start_date, 'start_time' => $start_time, 'vtodo_text' => $summary, 'due_date'=> $due_date, 'due_time'=> $due_time, 'completed_date' => $completed_date, 'completed_time' => $completed_time, 'priority' => $vtodo_priority, 'status' => $status, 'class' => $class, 'categories' => $vtodo_categories, 'description' => $description);
+ $master_array['-2']["$vtodo_sort"]["$uid"] = array ('start_date' => $start_date, 'start_time' => $start_time, 'vtodo_text' => $summary, 'due_date'=> $due_date, 'due_time'=> $due_time, 'completed_date' => $completed_date, 'completed_time' => $completed_time, 'priority' => $vtodo_priority, 'status' => $status, 'class' => $class, 'categories' => $vtodo_categories, 'description' => $description, 'calname' => $actual_calname);
unset ($start_date, $start_time, $due_date, $due_time, $completed_date, $completed_time, $vtodo_priority, $status, $class, $vtodo_categories, $summary, $description);
$vtodo_set = FALSE;
} elseif ($line == 'BEGIN:VTODO') {
diff --git a/functions/init.inc.php b/functions/init.inc.php
index 5bae3c7..3be7abb 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -6,7 +6,7 @@
//chmod(BASE.'calendars/School.ics',0666);
// uncomment when developing, comment for shipping version
-error_reporting (0);
+error_reporting (E_ALL);
$ALL_CALENDARS_COMBINED = 'all_calendars_combined971';
if (!defined('BASE')) define('BASE', './');

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