From f36d3298f0401e4fb1ca131d18d51d3d47e39818 Mon Sep 17 00:00:00 2001 From: Jason Oster Date: Tue, 7 Jul 2009 14:48:28 +0000 Subject: HTML/CSS template rewrites, nice-title integration, XSS fixes, version bump --- functions/calendar_functions.php | 1 - functions/date_functions.php | 6 ++++-- functions/event.js | 4 ++-- functions/template.php | 42 +++++++++++++++++++++++++++++++--------- 4 files changed, 39 insertions(+), 14 deletions(-) (limited to 'functions') diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php index 80bab71..3cd17e4 100644 --- a/functions/calendar_functions.php +++ b/functions/calendar_functions.php @@ -264,7 +264,6 @@ function display_ical_list($cals, $pick=FALSE) { $return .= "\n"; } } else { - $cal_httpPrefix_tmp = str_replace('webcal://', 'http://', $cal_tmp); if ($cal_encoded_tmp == $cal || $cal_encoded_tmp == urldecode($cal)) { $return .= ""; } else { diff --git a/functions/date_functions.php b/functions/date_functions.php index 4751ad2..0aeef60 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -234,6 +234,8 @@ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $lin $full_event_text = $event_text; $event_text = strip_tags($event_text, ''); } + + if (!empty($link_class)) $link_class = ' class="'.$link_class.'"'; if (!empty($event_text)) { $title = strip_tags(str_replace("
","\n",$title)); @@ -254,10 +256,10 @@ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $lin document.popup_data[$popup_data_index] = eventData; // -->"; - $return .= ''; + $return .= ''; $popup_data_index++; } else { - $return .= ''; + $return .= ''; } $return .= $pre_text.$event_text.$post_text.''."\n"; } diff --git a/functions/event.js b/functions/event.js index 9020de9..13aa609 100644 --- a/functions/event.js +++ b/functions/event.js @@ -11,7 +11,7 @@ function openEventWindow(num) { form.elements.event_data.value = data.event_data; // open a new window - var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275'); + var w = window.open('', 'Popup', 'scrollbars=yes,width=550,height=350'); form.target = 'Popup'; form.submit(); } @@ -36,7 +36,7 @@ function openTodoInfo(num) { form.elements.todo_data.value = data.todo_data; // open a new window - var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275'); + var w = window.open('', 'Popup', 'scrollbars=yes,width=550,height=350'); form.target = 'Popup'; form.submit(); } diff --git a/functions/template.php b/functions/template.php index cc80925..9ce5124 100644 --- a/functions/template.php +++ b/functions/template.php @@ -253,7 +253,7 @@ class Page { }#end draw_search function draw_week($template_p) { - global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $timeFormat_small; + global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat; // Figure out colspans and initialize weekarray $thisdate = $start_week_time; @@ -306,6 +306,10 @@ class Page { while ($day < $phpiCal_config->week_length){ $colspan = 0; $replace .= $loop_begin; # + + if ($weekarray[$day] == $getdate) $replace = str_replace('{TODAY}', "rowToday", $replace); + $replace = str_replace('{TODAY}', "rowOff", $replace); + if(array_search($weekarray[$day], $allday_uids)){ $uid = array_search($weekarray[$day], $allday_uids); unset($allday_uids[$uid]); @@ -464,9 +468,14 @@ class Page { } else { $class = ''; $dayborder = 0; - } + } + $tclass = $class; + if ($thisday == $getdate) { + if ($tclass) $tclass = ' class="weekborder weektoday"'; + else $tclass = ' class="weektoday"'; + } $drawWidth = 1; - $weekdisplay .= ' '."\n"; + $weekdisplay .= ' '."\n"; } else { # have events $emptyWidth = $nbrGridCols[$thisday]; @@ -478,13 +487,18 @@ class Page { switch ($el["state"]) { case "begin": if ($ended_counter) { - $weekdisplay .= ' '; + $tclass = $class; + if ($thisday == $getdate) { + if ($tclass) $tclass = ' class="weekborder weektoday"'; + else $tclass = ' class="weektoday"'; + } + $weekdisplay .= ' '; $ended_counter = 0; } $event_length[$thisday][$i]["state"] = "started"; $uid = $event_length[$thisday][$i]["key"]; $event_start = $this_time_arr[$uid]['start_unixtime']; - $event_start = date ($timeFormat_small, $event_start); + $event_start = date ($timeFormat, $event_start); $event_calno = $this_time_arr[$uid]['calnumber']; $event_status = strtolower($this_time_arr[$uid]['status']); $event_recur = $this_time_arr[$uid]['recur']; @@ -510,7 +524,12 @@ class Page { break; case "started": if ($ended_counter) { - $weekdisplay .= ' '; + $tclass = $class; + if ($thisday == $getdate) { + if ($tclass) $tclass = ' class="weekborder weektoday"'; + else $tclass = ' class="weektoday"'; + } + $weekdisplay .= ' '; $ended_counter = 0; } break; @@ -528,7 +547,12 @@ class Page { $emptyWidth += $ended_counter; //fill empty space on the right if ($emptyWidth > 0) { - $weekdisplay .= " \n"; + $tclass = $class; + if ($thisday == $getdate) { + if ($tclass) $tclass = ' class="weekborder weektoday"'; + else $tclass = ' class="weektoday"'; + } + $weekdisplay .= " \n"; } while (isset($event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]["state"]) && $event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]["state"] == "ended") { array_pop($event_length[$thisday]); @@ -981,7 +1005,7 @@ class Page { $start2 = date($timeFormat_small, $val['start_unixtime']); if ($type == 'large') { $switch['EVENT'] .= '
'; - $switch['EVENT'] .= openevent($daylink, $cal_time, $uid, $val, $phpiCal_config->month_event_lines, 10, 'ps3', "$start2 ").''; + $switch['EVENT'] .= openevent($daylink, $cal_time, $uid, $val, $phpiCal_config->month_event_lines, 10, 'ps3', "$start2 "); $switch['EVENT'] .= (isset($val['location']) && $val['location'] != '' && $phpiCal_config->month_locations == 'yes') ? "
".$val['location']."
" : ''; $switch['EVENT'] .= '
'; } else { @@ -1033,7 +1057,7 @@ class Page { } function monthbottom() { - global $phpiCal_config, $getdate, $master_array, $this_year, $this_month, $cal, $timeFormat, $timeFormat_small, $dateFormat_week_list, $lang; + global $phpiCal_config, $getdate, $master_array, $this_year, $this_month, $cal, $timeFormat, $dateFormat_week_list, $lang; preg_match("!<\!-- loop showbottomevents_odd on -->(.*)<\!-- loop showbottomevents_odd off -->!Uis", $this->page, $match1); preg_match("!<\!-- loop showbottomevents_even on -->(.*)<\!-- loop showbottomevents_even off -->!Uis", $this->page, $match2); -- cgit v1.2.3