From a430b6f5528f4698cefb45edde90bf869f05eeda Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Tue, 21 Mar 2006 09:52:29 +0000 Subject: add year printview, fix misc bugs --- README | 7 +++- functions/ical_parser.php | 2 +- functions/init.inc.php | 4 ++- functions/template.php | 3 +- languages/afrikaans.inc.php | 1 + languages/brazilian.inc.php | 1 + languages/catalan.inc.php | 1 + languages/czech.inc.php | 1 + languages/danish.inc.php | 1 + languages/english.inc.php | 2 ++ languages/esperanto.inc.php | 1 + languages/french.inc.php | 1 + languages/german.inc.php | 1 + languages/italian.inc.php | 1 + languages/japanese.inc.php | 1 + languages/korean.inc.php | 1 + languages/lithuanian.inc.php | 1 + languages/norwegian.inc.php | 1 + languages/polish.inc.php | 1 + languages/portuguese.inc.php | 1 + languages/spanish.inc.php | 1 + languages/swedish.inc.php | 1 + languages/traditional_chinese.inc.php | 1 + print.php | 22 ++++++++---- rss/rss.php | 47 +++++++++++------------- templates/default/footer.tpl | 2 +- templates/default/print.tpl | 1 + templates/default/year.tpl | 4 +++ year.php | 67 +++++++++++++++++++++++++++++++++-- 29 files changed, 139 insertions(+), 40 deletions(-) diff --git a/README b/README index eaeb280..449deb1 100644 --- a/README +++ b/README @@ -82,13 +82,18 @@ COPYING for more information about our license. Changes: -------- cvs +2.22rc1 allow image tags in events use real calendar names instead of filenames - -bug fixes + Year printview + Added sidebar to year view + -bug fixes from 2.21 Suppress lots of warnings and notices all combined selection of webcals passing of webcals in calendar links More items controlled by language files + Problem with webcals with encoded spaces in URL + Fixes related to various recurring event combinations 2.21 -patched security hole -bug fixes from 2.2 diff --git a/functions/ical_parser.php b/functions/ical_parser.php index e24b953..fe8ca33 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -423,7 +423,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { $start_date_time = strtotime($start_date); $this_month_start_time = strtotime($this_year.$this_month.'01'); - if ($current_view == 'year' || ($save_parsed_cals == 'yes' && !$is_webcal)) { + if ($current_view == 'year' || ($save_parsed_cals == 'yes' && !$is_webcal)|| $current_view == 'print' && $printview == 'year') { $start_range_time = strtotime($this_year.'-01-01 -2 weeks'); $end_range_time = strtotime($this_year.'-12-31 +2 weeks'); } else { diff --git a/functions/init.inc.php b/functions/init.inc.php index d22ba78..7f55713 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -134,6 +134,8 @@ $local_cals = array(); foreach ($cal_filenames as $cal_filename) { // If the calendar identifier begins with a web protocol, this is a web // calendar. + $cal_filename = urldecode($cal_filename); #need to decode for substr statements to identify webcals + $cal_filename = str_replace(' ','%20', $cal_filename); #need to reencode blank spaces for matching with $list_webcals if (substr($cal_filename, 0, 7) == 'http://' || substr($cal_filename, 0, 8) == 'https://' || substr($cal_filename, 0, 9) == 'webcal://') @@ -147,7 +149,7 @@ foreach ($cal_filenames as $cal_filename) { if (in_array($cal_filename, $blacklisted_cals)) { exit(error($lang['l_error_restrictedcal'], $cal_filename)); } - $local_cals[] = str_replace(".ics", '', basename($cal_filename)); + $local_cals[] = urldecode(str_replace(".ics", '', basename($cal_filename))); } } diff --git a/functions/template.php b/functions/template.php index af93258..32e0b2d 100644 --- a/functions/template.php +++ b/functions/template.php @@ -61,10 +61,11 @@ class Page { $loop_event = trim($match1[1]); $loop_day = trim($match3[1]); $parse_month = date ("Ym", strtotime($getdate)); + $parse_year = date ("Y", strtotime($getdate)); foreach($master_array as $key => $val) { preg_match ('/([0-9]{6})([0-9]{2})/', $key, $regs); - if ((($regs[1] == $parse_month) && ($printview == 'month')) || (($key == $getdate) && ($printview == 'day')) || ((($key >= $week_start) && ($key <= $week_end)) && ($printview == 'week'))) { + if ((($regs[1] == $parse_month) && ($printview == 'month')) || (($key == $getdate) && ($printview == 'day')) || ((($key >= $week_start) && ($key <= $week_end)) && ($printview == 'week')) || ((substr($regs[1],0,4) == $parse_year) && ($printview == 'year'))) { $events_week++; $dayofmonth = strtotime ($key); $dayofmonth = localizeDate ($dateFormat_day, $dayofmonth); diff --git a/languages/afrikaans.inc.php b/languages/afrikaans.inc.php index b0e4a3e..d04a248 100644 --- a/languages/afrikaans.inc.php +++ b/languages/afrikaans.inc.php @@ -180,6 +180,7 @@ $dateFormat_week_list = '%a, %e %b'; $dateFormat_week_jump = '%e %b'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %e %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/brazilian.inc.php b/languages/brazilian.inc.php index 25e1137..d9292ea 100644 --- a/languages/brazilian.inc.php +++ b/languages/brazilian.inc.php @@ -175,6 +175,7 @@ $dateFormat_week_list = '%a, %e %b'; $dateFormat_week_jump = '%e %b'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %e %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/catalan.inc.php b/languages/catalan.inc.php index 8941363..fc2ed2e 100644 --- a/languages/catalan.inc.php +++ b/languages/catalan.inc.php @@ -175,6 +175,7 @@ $dateFormat_week_list = '%a, %e de %b'; $dateFormat_week_jump = '%e de %b'; $dateFormat_month = '%B de %Y'; $dateFormat_month_list = '%A, %e de %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/czech.inc.php b/languages/czech.inc.php index 1e136b9..ff3c9e1 100644 --- a/languages/czech.inc.php +++ b/languages/czech.inc.php @@ -174,6 +174,7 @@ $dateFormat_week_list = '%a, %e. %b'; $dateFormat_week_jump = '%e. %B';// new since last translation $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %e. %B'; +$dateFormat_year = '%Y'; /* Notes about $dateFormat_* diff --git a/languages/danish.inc.php b/languages/danish.inc.php index 973ce75..4503f3c 100644 --- a/languages/danish.inc.php +++ b/languages/danish.inc.php @@ -165,6 +165,7 @@ $dateFormat_week_list = '%a, %e %b'; $dateFormat_week_jump = '%e %b'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %e %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/english.inc.php b/languages/english.inc.php index dd3a8b8..c3fb741 100644 --- a/languages/english.inc.php +++ b/languages/english.inc.php @@ -176,6 +176,8 @@ $dateFormat_week_list = '%a, %b %e'; $dateFormat_week_jump = '%b %e'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %B %e'; +$dateFormat_year = '%Y'; + /* Notes about dateFormat_* diff --git a/languages/esperanto.inc.php b/languages/esperanto.inc.php index c7e0ad8..407b6c8 100644 --- a/languages/esperanto.inc.php +++ b/languages/esperanto.inc.php @@ -167,6 +167,7 @@ $dateFormat_week_list = '%a, %e %b'; $dateFormat_week_jump = '%e %b'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %B %e'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/french.inc.php b/languages/french.inc.php index 59d8bce..7a572ce 100644 --- a/languages/french.inc.php +++ b/languages/french.inc.php @@ -178,6 +178,7 @@ $dateFormat_week_list = '%a %e %b'; $dateFormat_week_jump = '%e %b'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A %e %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/german.inc.php b/languages/german.inc.php index de3e7ed..0522f18 100644 --- a/languages/german.inc.php +++ b/languages/german.inc.php @@ -178,6 +178,7 @@ $dateFormat_week_list = '%a, %e. %b'; $dateFormat_week_jump = ' %e. %b'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %e. %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/italian.inc.php b/languages/italian.inc.php index afe6717..6ef78c3 100644 --- a/languages/italian.inc.php +++ b/languages/italian.inc.php @@ -178,6 +178,7 @@ $dateFormat_week_list = '%a, %e %b'; $dateFormat_week_jump = '%e %b'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %e %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/japanese.inc.php b/languages/japanese.inc.php index 42f120f..9155cf4 100644 --- a/languages/japanese.inc.php +++ b/languages/japanese.inc.php @@ -177,6 +177,7 @@ $dateFormat_week_list = '%b%e日(%a)'; $dateFormat_week_jump = '%b%e日'; $dateFormat_month = '%Y年%B'; $dateFormat_month_list = '%B%e日 %A'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/korean.inc.php b/languages/korean.inc.php index fd7b2cf..b0e0a2f 100644 --- a/languages/korean.inc.php +++ b/languages/korean.inc.php @@ -163,6 +163,7 @@ $dateFormat_week_list = '%b %e일, %a'; $dateFormat_week_jump = '%b %e일'; $dateFormat_month = '%Y년 %B'; $dateFormat_month_list = '%B %e일, %A'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/lithuanian.inc.php b/languages/lithuanian.inc.php index adaebb8..6101ecb 100644 --- a/languages/lithuanian.inc.php +++ b/languages/lithuanian.inc.php @@ -176,6 +176,7 @@ $dateFormat_week_list = '%b %e d., %a'; $dateFormat_week_jump = '%b %e d.'; $dateFormat_month = '%Y m. %b mėn.'; $dateFormat_month_list = '%A, %B %e d.'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/norwegian.inc.php b/languages/norwegian.inc.php index 47fc561..8c0e113 100644 --- a/languages/norwegian.inc.php +++ b/languages/norwegian.inc.php @@ -177,6 +177,7 @@ $dateFormat_week_list = '%a %e. %b'; $dateFormat_week_jump = '%b %e'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A %e. %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/polish.inc.php b/languages/polish.inc.php index e5eb9a4..48507bc 100644 --- a/languages/polish.inc.php +++ b/languages/polish.inc.php @@ -163,6 +163,7 @@ $dateFormat_week_list = '%a, %e %b'; $dateFormat_week_jump = '%e %B';// new since last translation $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %e %B'; +$dateFormat_year = '%Y'; /* Notes about $dateFormat_* diff --git a/languages/portuguese.inc.php b/languages/portuguese.inc.php index c75e38a..f4dbd60 100644 --- a/languages/portuguese.inc.php +++ b/languages/portuguese.inc.php @@ -175,6 +175,7 @@ $dateFormat_week_list = '%a, %e %b'; $dateFormat_week_jump = '%e %b'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %e %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/spanish.inc.php b/languages/spanish.inc.php index 51ba938..6d8a239 100644 --- a/languages/spanish.inc.php +++ b/languages/spanish.inc.php @@ -175,6 +175,7 @@ $dateFormat_week_list = '%a, %e de %b'; $dateFormat_week_jump = '%e de %b'; $dateFormat_month = '%B de %Y'; $dateFormat_month_list = '%A, %e de %B'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/swedish.inc.php b/languages/swedish.inc.php index 2c8b33c..674cc04 100644 --- a/languages/swedish.inc.php +++ b/languages/swedish.inc.php @@ -176,6 +176,7 @@ $dateFormat_week_list = '%a, %e %b'; $dateFormat_week_jump = '%e %b'; $dateFormat_month = '%B %Y'; $dateFormat_month_list = '%A, %B %e'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/languages/traditional_chinese.inc.php b/languages/traditional_chinese.inc.php index 6923dc0..2c5a1d0 100644 --- a/languages/traditional_chinese.inc.php +++ b/languages/traditional_chinese.inc.php @@ -165,6 +165,7 @@ $dateFormat_week_list = '%a, %b%e日'; $dateFormat_week_jump = '%b %e 日'; $dateFormat_month = '%Y 年 %B'; $dateFormat_month_list = '%A, %B %e 日'; +$dateFormat_year = '%Y'; /* Notes about dateFormat_* diff --git a/print.php b/print.php index 34a9c92..cf09828 100644 --- a/print.php +++ b/print.php @@ -1,18 +1,17 @@ $filemod) $filemod = $calinfo['mtime']; } $filemodtime = date("r", $filemod); @@ -137,7 +123,13 @@ $rss .= ''."\n"; $rss .= ''.$cal_displayname; if ($theview !=""){$rss .= ' - '.$theview;} $rss .= "\n"; -$rss .= ''.htmlspecialchars ("$default_path").''."\n"; + +$views = array('day','week','month','year'); +if (in_array($rssview, $views)) $default_path .= "/$rssview.php"; +$rss_link = $default_path."/"; +if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; +$rss .= "$rss_link\n"; + $rss .= ''.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.''."\n"; $rss .= ''.$language.''."\n"; $rss .= 'Copyright '.date('Y').', '.htmlspecialchars ("$default_path").''."\n"; @@ -183,7 +175,8 @@ $uid_arr = array(); $rss_title = urldecode ("$dayofweek: $event_text"); - $rss_link = htmlspecialchars ("$default_path/day.php?getdate=$thisdate&cal=$cal&cpath=$cpath"); + $rss_link = "$default_path/day.php?getdate=$thisdate&cal=$cal"; + if (isset($cpath) && $cpath !='') $rss_link.="&cpath=$cpath"; $rss_description = htmlspecialchars ("$dayofweek $event_start: $description"); $rss .= ''."\n"; diff --git a/templates/default/footer.tpl b/templates/default/footer.tpl index feb39e4..5d450c9 100644 --- a/templates/default/footer.tpl +++ b/templates/default/footer.tpl @@ -1,4 +1,4 @@ -

{L_POWERED_BY} PHP iCalendar 2.21
+

{L_POWERED_BY} PHP iCalendar 2.22rc1

diff --git a/templates/default/print.tpl b/templates/default/print.tpl index c1c8d4e..dfc773b 100644 --- a/templates/default/print.tpl +++ b/templates/default/print.tpl @@ -13,6 +13,7 @@ {L_DAY} {L_WEEK} {L_MONTH} + {L_YEAR} diff --git a/templates/default/year.tpl b/templates/default/year.tpl index 2428fa1..eb89065 100644 --- a/templates/default/year.tpl +++ b/templates/default/year.tpl @@ -56,6 +56,10 @@ {MONTH_MEDIUM|03} + +  + + {SIDEBAR} diff --git a/year.php b/year.php index ba967fc..b9f0825 100644 --- a/year.php +++ b/year.php @@ -3,6 +3,7 @@ define('BASE', './'); $current_view = 'year'; require_once(BASE.'functions/ical_parser.php'); +require_once(BASE.'functions/list_functions.php'); require_once(BASE.'functions/template.php'); header("Content-Type: text/html; charset=$charset"); @@ -15,15 +16,45 @@ $next_year = date ("Ymd", $next_year); $prev_year = strtotime ("-1 year", strtotime($getdate)); $prev_year = date ("Ymd", $prev_year); +$sidebar_date = localizeDate($dateFormat_day, strtotime($getdate)); + +// For the side months +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]; + +// select for calendars +$list_icals = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED)); +$list_years = list_years(); +$list_months = list_months(); +$list_weeks = list_weeks(); +$list_jumps = list_jumps(); +$list_calcolors = ' '.$lang['l_all_day'].'
+ '.$lang['l_event']."
"; +; +$list_icals_pick = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED), TRUE); + +// login/logout +$is_logged_in = ($username != '' && !$invalid_login) ? true : false; +$show_user_login = (!$is_logged_in && $allow_login == 'yes'); +$login_querys = login_querys(); +$logout_querys = logout_querys(); + + + $page = new Page(BASE.'templates/'.$template.'/year.tpl'); $page->replace_files(array( 'header' => BASE.'templates/'.$template.'/header.tpl', - 'footer' => BASE.'templates/'.$template.'/footer.tpl' + 'footer' => BASE.'templates/'.$template.'/footer.tpl', + 'sidebar' => BASE.'templates/'.$template.'/sidebar_year.tpl', + 'search_box' => BASE.'templates/'.$template.'/search_box.tpl' )); $page->replace_tags(array( 'event_js' => '', + 'current_view' => $current_view, 'template' => $template, 'charset' => $charset, 'default_path' => '', @@ -33,24 +64,56 @@ $page->replace_tags(array( 'getdate' => $getdate, 'calendar_name' => $cal_displayname, 'display_date' => $this_year, + 'sidebar_date' => $sidebar_date, 'rss_powered' => $rss_powered, 'rss_available' => '', 'rss_valid' => '', 'todo_available' => '', 'event_js' => '', 'this_year' => $this_year, + 'next_day' => $next_day, + 'next_week' => $next_week, + 'prev_day' => $prev_day, + 'prev_week' => $prev_week, 'next_year' => $next_year, 'prev_year' => $prev_year, + 'show_goto' => '', + 'show_user_login' => $show_user_login, + 'invalid_login' => $invalid_login, + 'login_querys' => $login_querys, + 'is_logged_in' => $is_logged_in, + 'username' => $username, + 'logout_querys' => $logout_querys, + 'list_icals' => $list_icals, + 'list_icals_pick' => $list_icals_pick, + 'list_years' => $list_years, + 'list_months' => $list_months, + 'list_weeks' => $list_weeks, + 'list_jumps' => $list_jumps, + 'legend' => $list_calcolors, + 'style_select' => $style_select, + 'l_goprint' => $lang['l_goprint'], + 'l_preferences' => $lang['l_preferences'], + 'l_calendar' => $lang['l_calendar'], + 'l_legend' => $lang['l_legend'], + 'l_tomorrows' => $lang['l_tomorrows'], + 'l_jump' => $lang['l_jump'], + 'l_todo' => $lang['l_todo'], 'l_day' => $lang['l_day'], 'l_week' => $lang['l_week'], 'l_month' => $lang['l_month'], 'l_year' => $lang['l_year'], + 'l_search' => $lang['l_search'], + 'l_subscribe' => $lang['l_subscribe'], + 'l_download' => $lang['l_download'], 'l_pick_multiple' => $lang['l_pick_multiple'], 'l_powered_by' => $lang['l_powered_by'], 'l_this_site_is' => $lang['l_this_site_is'] )); - +$page->tomorrows_events($page); +$page->get_vtodo($page); +$page->draw_subscribe($page); $page->output(); ?> -- cgit v1.2.3