Skip to content

Commit f36d329

Browse files
author
Jason Oster
committed
HTML/CSS template rewrites, nice-title integration, XSS fixes, version bump
1 parent 710abd2 commit f36d329

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+849
-3690
lines changed

README

+20-2
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,32 @@ COPYING for more information about our license.
8888

8989
Changes:
9090
--------
91-
2.31 Fix events ending at midnight bug in day view
91+
2.4
92+
Event information displayed with Nice Titles
93+
More ICS input sanitizing
94+
Better display of tabs/line breaks in calendar events
95+
Many updates to included templates; HTML fixes, better CSS support
96+
Webcal caching now works like local calendar caching (with save_parsed_cals enabled)
97+
Updates to Czech and French translations
98+
Fixes for attendee/organizer parsing and email address hyperlinking
99+
Fixes for Print View
100+
Fix setting time format in preferences page
101+
Fix default calendar selections in listbox picker
102+
Fix timezone DST calculation with all-day events
103+
Fix dates before 1970
104+
Fixed bugs with ALL_CALENDARS_COMBINED and saving parsed calendars (using wrong file name)
105+
Better handling of URLs and email addresses in event descriptions (also strip "blocked" protocols, added by some mail servers)
106+
107+
2.31
108+
Fix events ending at midnight bug in day view
92109
Fix publish.php for 2.3 config system
93110
add option to hide location in month view
94111
add option to make individual events downloadable from event view
95112
Fix calendar showing modified events twice
96113
Make multiline descriptions display with line breaks in event popup
97114
Fix German language file
98-
2.3 Major changes to recurrence handling
115+
2.3
116+
Major changes to recurrence handling
99117
Added more languages
100118
Added login to month view
101119
Consolidated common rss functions

default_config.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
class Configs{
33
private static $instance;
44
private function __construct(){
5-
$this->phpicalendar_version = '2.32alpha';
6-
// Configuration file for PHP iCalendar 2.32
5+
$this->phpicalendar_version = '2.4alpha';
6+
// Configuration file for PHP iCalendar 2.4
77
//
88
// To set values, change the text between the single quotes
99
// Follow instructions to the right for detailed information

functions/calendar_functions.php

-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ function display_ical_list($cals, $pick=FALSE) {
264264
$return .= "<option value=\"$cal_encoded_tmp\">$cal_displayname_tmp</option>\n";
265265
}
266266
} else {
267-
$cal_httpPrefix_tmp = str_replace('webcal://', 'http://', $cal_tmp);
268267
if ($cal_encoded_tmp == $cal || $cal_encoded_tmp == urldecode($cal)) {
269268
$return .= "<option value=\"$current_view.php?cal=$cal_encoded_tmp&amp;getdate=$getdate\" selected=\"selected\">$cal_displayname_tmp</option>";
270269
} else {

functions/date_functions.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $lin
234234
$full_event_text = $event_text;
235235
$event_text = strip_tags($event_text, '<b><i><u><img>');
236236
}
237+
238+
if (!empty($link_class)) $link_class = ' class="'.$link_class.'"';
237239

238240
if (!empty($event_text)) {
239241
$title = strip_tags(str_replace("<br />","\n",$title));
@@ -254,10 +256,10 @@ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $lin
254256
document.popup_data[$popup_data_index] = eventData;
255257
// --></script>";
256258

257-
$return .= '<a class="'.$link_class.'" title="'.$title.'" href="#" onclick="openEventWindow('.$popup_data_index.'); return false;">';
259+
$return .= '<a'.$link_class.' title="'.$title.'" href="#" onclick="openEventWindow('.$popup_data_index.'); return false;">';
258260
$popup_data_index++;
259261
} else {
260-
$return .= '<a class="'.$link_class.'" title="'.$title.'" href="'.$res[1].'">';
262+
$return .= '<a'.$link_class.' title="'.$title.'" href="'.$res[1].'">';
261263
}
262264
$return .= $pre_text.$event_text.$post_text.'</a>'."\n";
263265
}

functions/event.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function openEventWindow(num) {
1111
form.elements.event_data.value = data.event_data;
1212

1313
// open a new window
14-
var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275');
14+
var w = window.open('', 'Popup', 'scrollbars=yes,width=550,height=350');
1515
form.target = 'Popup';
1616
form.submit();
1717
}
@@ -36,7 +36,7 @@ function openTodoInfo(num) {
3636
form.elements.todo_data.value = data.todo_data;
3737

3838
// open a new window
39-
var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275');
39+
var w = window.open('', 'Popup', 'scrollbars=yes,width=550,height=350');
4040
form.target = 'Popup';
4141
form.submit();
4242
}

functions/template.php

+33-9
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function draw_search($template_p) {
253253
}#end draw_search
254254

255255
function draw_week($template_p) {
256-
global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $timeFormat_small;
256+
global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat;
257257

258258
// Figure out colspans and initialize weekarray
259259
$thisdate = $start_week_time;
@@ -306,6 +306,10 @@ function draw_week($template_p) {
306306
while ($day < $phpiCal_config->week_length){
307307
$colspan = 0;
308308
$replace .= $loop_begin; # <td>
309+
310+
if ($weekarray[$day] == $getdate) $replace = str_replace('{TODAY}', "rowToday", $replace);
311+
$replace = str_replace('{TODAY}', "rowOff", $replace);
312+
309313
if(array_search($weekarray[$day], $allday_uids)){
310314
$uid = array_search($weekarray[$day], $allday_uids);
311315
unset($allday_uids[$uid]);
@@ -464,9 +468,14 @@ function draw_week($template_p) {
464468
} else {
465469
$class = '';
466470
$dayborder = 0;
467-
}
471+
}
472+
$tclass = $class;
473+
if ($thisday == $getdate) {
474+
if ($tclass) $tclass = ' class="weekborder weektoday"';
475+
else $tclass = ' class="weektoday"';
476+
}
468477
$drawWidth = 1;
469-
$weekdisplay .= '<td colspan="' . $nbrGridCols[$thisday] . '" ' . $class . '>&nbsp;</td>'."\n";
478+
$weekdisplay .= '<td colspan="' . $nbrGridCols[$thisday] . '"' . $tclass . '>&nbsp;</td>'."\n";
470479
} else {
471480
# have events
472481
$emptyWidth = $nbrGridCols[$thisday];
@@ -478,13 +487,18 @@ function draw_week($template_p) {
478487
switch ($el["state"]) {
479488
case "begin":
480489
if ($ended_counter) {
481-
$weekdisplay .= '<td colspan="' . $ended_counter . '" '.$class.'>&nbsp;</td>';
490+
$tclass = $class;
491+
if ($thisday == $getdate) {
492+
if ($tclass) $tclass = ' class="weekborder weektoday"';
493+
else $tclass = ' class="weektoday"';
494+
}
495+
$weekdisplay .= '<td colspan="' . $ended_counter . '"' . $tclass . '>&nbsp;</td>';
482496
$ended_counter = 0;
483497
}
484498
$event_length[$thisday][$i]["state"] = "started";
485499
$uid = $event_length[$thisday][$i]["key"];
486500
$event_start = $this_time_arr[$uid]['start_unixtime'];
487-
$event_start = date ($timeFormat_small, $event_start);
501+
$event_start = date ($timeFormat, $event_start);
488502
$event_calno = $this_time_arr[$uid]['calnumber'];
489503
$event_status = strtolower($this_time_arr[$uid]['status']);
490504
$event_recur = $this_time_arr[$uid]['recur'];
@@ -510,7 +524,12 @@ function draw_week($template_p) {
510524
break;
511525
case "started":
512526
if ($ended_counter) {
513-
$weekdisplay .= '<td colspan="' . $ended_counter . '" '.$class.'>&nbsp;</td>';
527+
$tclass = $class;
528+
if ($thisday == $getdate) {
529+
if ($tclass) $tclass = ' class="weekborder weektoday"';
530+
else $tclass = ' class="weektoday"';
531+
}
532+
$weekdisplay .= '<td colspan="' . $ended_counter . '"' . $tclass . '>&nbsp;</td>';
514533
$ended_counter = 0;
515534
}
516535
break;
@@ -528,7 +547,12 @@ function draw_week($template_p) {
528547
$emptyWidth += $ended_counter;
529548
//fill empty space on the right
530549
if ($emptyWidth > 0) {
531-
$weekdisplay .= "<td colspan=\"" . $emptyWidth . "\" $class>&nbsp;</td>\n";
550+
$tclass = $class;
551+
if ($thisday == $getdate) {
552+
if ($tclass) $tclass = ' class="weekborder weektoday"';
553+
else $tclass = ' class="weektoday"';
554+
}
555+
$weekdisplay .= "<td colspan=\"" . $emptyWidth . "\"$tclass>&nbsp;</td>\n";
532556
}
533557
while (isset($event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]["state"]) && $event_length[$thisday][(sizeof($event_length[$thisday]) - 1)]["state"] == "ended") {
534558
array_pop($event_length[$thisday]);
@@ -981,7 +1005,7 @@ function draw_month($template_p, $offset = '+0', $type) {
9811005
$start2 = date($timeFormat_small, $val['start_unixtime']);
9821006
if ($type == 'large') {
9831007
$switch['EVENT'] .= '<div class="V9"><img src="templates/'.$phpiCal_config->template.'/images/monthdot_'.$event_calno.'.gif" alt="" width="9" height="9" border="0" />';
984-
$switch['EVENT'] .= openevent($daylink, $cal_time, $uid, $val, $phpiCal_config->month_event_lines, 10, 'ps3', "$start2 ").'';
1008+
$switch['EVENT'] .= openevent($daylink, $cal_time, $uid, $val, $phpiCal_config->month_event_lines, 10, 'ps3', "<span style=\"font-weight: bold;\">$start2</span> ");
9851009
$switch['EVENT'] .= (isset($val['location']) && $val['location'] != '' && $phpiCal_config->month_locations == 'yes') ? "<br />".$val['location']."<br />" : '';
9861010
$switch['EVENT'] .= '</div>';
9871011
} else {
@@ -1033,7 +1057,7 @@ function nosearch() {
10331057
}
10341058

10351059
function monthbottom() {
1036-
global $phpiCal_config, $getdate, $master_array, $this_year, $this_month, $cal, $timeFormat, $timeFormat_small, $dateFormat_week_list, $lang;
1060+
global $phpiCal_config, $getdate, $master_array, $this_year, $this_month, $cal, $timeFormat, $dateFormat_week_list, $lang;
10371061
preg_match("!<\!-- loop showbottomevents_odd on -->(.*)<\!-- loop showbottomevents_odd off -->!Uis", $this->page, $match1);
10381062
preg_match("!<\!-- loop showbottomevents_even on -->(.*)<\!-- loop showbottomevents_even off -->!Uis", $this->page, $match2);
10391063

month.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@
8484
'rss_available' => '',
8585
'rss_valid' => '',
8686
'show_search' => $phpiCal_config->show_search,
87+
'next_day' => $tomorrows_date,
8788
'next_month' => $next_month,
89+
'prev_day' => $yesterdays_date,
8890
'prev_month' => $prev_month,
8991
'show_goto' => '',
9092
'show_user_login' => $show_user_login,
@@ -110,6 +112,8 @@
110112
'l_tomorrows' => $lang['l_tomorrows'],
111113
'l_jump' => $lang['l_jump'],
112114
'l_todo' => $lang['l_todo'],
115+
'l_prev' => $lang['l_prev'],
116+
'l_next' => $lang['l_next'],
113117
'l_day' => $lang['l_day'],
114118
'l_week' => $lang['l_week'],
115119
'l_month' => $lang['l_month'],
@@ -148,10 +152,8 @@
148152
} else {
149153
$page->nomonthbottom($page);
150154
}
151-
$page->draw_subscribe($page);
152155

156+
$page->draw_subscribe($page);
153157
$page->output();
154158

155-
156-
157159
?>

nicetitle/nicetitle.css

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
div.nicetitle {
2+
position: absolute;
3+
padding: 4px;
4+
top: 0px;
5+
left: 0px;
6+
color: white;
7+
font-size: 12px;
8+
font-family: Verdana, Helvetica, Arial, sans-serif;
9+
font-weight: bold;
10+
width: 25em;
11+
background: url(ntbg.png);
12+
13+
-moz-border-radius: 5px;
14+
-webkit-border-radius: 5px;
15+
border-radius: 5px;
16+
text-shadow: black 1px 1px 1px;
17+
}
18+
div.nicetitle p {
19+
margin: 0;
20+
padding: 0 3px;
21+
}
22+
div.nicetitle p.destination {
23+
font-size: 9px;
24+
text-align: left;
25+
padding-top: 3px;
26+
}
27+
28+
@media print {
29+
div.nicetitle {
30+
display: none;
31+
}
32+
}

0 commit comments

Comments
 (0)