aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavef <davefd2@users.sourceforge.net>2005-05-16 19:14:59 +0000
committerdavef <davefd2@users.sourceforge.net>2005-05-16 19:14:59 +0000
commit81b77a2e087100632ef3c1fb1f8d2f75f867a27e (patch)
treee224a6b82613a883d9211c4a304b2d34955b2386
parentc4cd9ef3029afc434d5ae41693d059ccfe459799 (diff)
downloadphpicalendar-81b77a2e087100632ef3c1fb1f8d2f75f867a27e.tar.gz
phpicalendar-81b77a2e087100632ef3c1fb1f8d2f75f867a27e.tar.bz2
phpicalendar-81b77a2e087100632ef3c1fb1f8d2f75f867a27e.zip
Big openevent cleanup - changed the openevent api, which significantly simplifies the code.
-rw-r--r--functions/date_functions.php38
-rw-r--r--functions/event.js30
-rw-r--r--functions/ical_parser.php14
-rw-r--r--functions/template.php147
-rw-r--r--includes/event.php45
-rw-r--r--templates/default/event.tpl2
-rw-r--r--templates/default/header.tpl15
7 files changed, 116 insertions, 175 deletions
diff --git a/functions/date_functions.php b/functions/date_functions.php
index e6913b4..6c524db 100644
--- a/functions/date_functions.php
+++ b/functions/date_functions.php
@@ -162,44 +162,38 @@ function chooseOffset($time) {
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 = "
}
$return .= $pre_text.$event_text.$post_text.'</a>'."\n";
}
-
+
return $return;
}
-
-
?>
diff --git a/functions/event.js b/functions/event.js
index c3d43c1..9f9f613 100644
--- a/functions/event.js
+++ b/functions/event.js
@@ -4,16 +4,9 @@ function openEventWindow(num) {
// 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 @@ function openEventWindow(num) {
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 @@ function openTodoInfo(vtodo_array) {
document.popup_data = new Array();
//-->
-</script> \ No newline at end of file
+</script>
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 0b5c77f..595ead9 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -462,7 +462,9 @@ foreach ($cal_filelist as $filename) {
$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);
@@ -677,7 +679,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, '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 {
@@ -706,7 +708,7 @@ foreach ($cal_filelist as $filename) {
// Let's double check the until to not write past it
$until_check = $start_date_tmp.$time_tmp.'00';
if ($abs_until > $until_check) {
- $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' => 0, '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' => 0, '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);
checkOverlap($start_date_tmp, $time_tmp, $uid);
}
$start_tmp = strtotime('+1 day',$start_tmp);
@@ -722,7 +724,7 @@ foreach ($cal_filelist as $filename) {
// Let's double check the until to not write past it
$until_check = $recur_data_date.$hour.$minute.'00';
if ($abs_until > $until_check) {
- $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' => 0, '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' => 0, '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);
checkOverlap($recur_data_date, ($hour.$minute), $uid);
}
}
@@ -1196,7 +1198,7 @@ if ($parse_file) {
//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
@@ -1205,5 +1207,5 @@ if ($cal == $ALL_CALENDARS_COMBINED) {
}
$template_started = getmicrotime();
-
+
?>
diff --git a/functions/template.php b/functions/template.php
index 8307529..c4a4856 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -264,17 +264,15 @@ class Page {
$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'];
$event_calno = (($event_calno - 1) % $unique_colors) + 1;
- $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 @@ class Page {
$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) {
@@ -426,7 +424,7 @@ class Page {
// Used to "join" ended events, so the ended case below results in one colspan'd td instead of multiple tds.
$ended_counter = 0;
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"]) {
@@ -436,12 +434,11 @@ class Page {
$ended_counter = 0;
}
$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']);
$event_calno = (($event_calno - 1) % $unique_colors) + 1;
if ($event_status != '') {
$confirmed = '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
@@ -449,13 +446,9 @@ class Page {
$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_end'])) $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);
@@ -463,7 +456,7 @@ class Page {
$weekdisplay .= $event_temp;
$weekdisplay .= '</td>';
// End event drawing
-
+
break;
case "started":
if ($ended_counter) {
@@ -495,34 +488,29 @@ class Page {
}
$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'];
$event_calno = (($event_calno - 1) % $unique_colors) + 1;
- $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]);
@@ -601,12 +589,12 @@ class Page {
}
}
} 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) {
@@ -661,14 +649,15 @@ class Page {
$ended_counter = 0;
}
$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']);
$event_calno = (($event_calno - 1) % $unique_colors) + 1;
if ($event_status != '') {
$confirmed = '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
@@ -680,14 +669,12 @@ class Page {
// 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
@@ -737,40 +724,34 @@ class Page {
$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;
@@ -923,28 +904,22 @@ class Page {
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'];
$event_calno = (($event_calno - 1) % $unique_colors) + 1;
- $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" />';
@@ -1003,22 +978,22 @@ class Page {
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];
@@ -1036,11 +1011,11 @@ class Page {
$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));
diff --git a/includes/event.php b/includes/event.php
index 7bfd5d4..3d97fca 100644
--- a/includes/event.php
+++ b/includes/event.php
@@ -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 @@ function decode_popup ($item) {
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 @@ if (is_array($attendee)) {
$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 @@ if (sizeof($organizer) == 0) $organizer = '';
$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' => urldecode($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'],
diff --git a/templates/default/event.tpl b/templates/default/event.tpl
index fd51da6..43c2db2 100644
--- a/templates/default/event.tpl
+++ b/templates/default/event.tpl
@@ -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 -->
diff --git a/templates/default/header.tpl b/templates/default/header.tpl
index f06438a..a7ec486 100644
--- a/templates/default/header.tpl
+++ b/templates/default/header.tpl
@@ -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>

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