aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS4
-rw-r--r--day.php2
-rw-r--r--functions/calendar_functions.php4
-rw-r--r--functions/date_functions.php38
-rw-r--r--functions/draw_functions.php22
-rw-r--r--functions/init.inc.php7
-rw-r--r--functions/parse/end_vevent.php13
-rw-r--r--functions/parse/parse_tzs.php4
-rw-r--r--functions/parse/recur_functions.php3
-rw-r--r--functions/template.php2
-rw-r--r--languages/english.inc.php2
-rw-r--r--preferences.php7
12 files changed, 39 insertions, 69 deletions
diff --git a/AUTHORS b/AUTHORS
index bff1ef3..289fd09 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -52,8 +52,8 @@ Norwegian Geir Kielland <geir dot kielland at jus dot uio dot no>
Polish Stanislaw Cieslicki <stahoo at poczta dot onet dot pl>
Portuguese Rui Costa <ruicosta at ubi dot pt>
Luciano Antonio Costa <bits dot e dot bytes at gmail dot com>
-Slovak Jan Michalicka contact@jimi.sk
+Slovak Jan Michalicka <contact at jimi dot sk>
Spanish Javier Navarro <jnavarro at xips dot es>
Luis Fernando Rocha <ludwig_von_rocht at yahoo dot com>
-Russian Sergey <1c@3555686 dot com>
+Russian Sergey <1c at 3555686 dot com>
Swedish Jonas Hjelm <jonas at hnet dot se>
diff --git a/day.php b/day.php
index 932b6c1..60a0653 100644
--- a/day.php
+++ b/day.php
@@ -86,7 +86,7 @@ $page->replace_tags(array(
'list_weeks' => $list_weeks,
'list_jumps' => $list_jumps,
'legend' => $list_calcolors,
- 'style_select' => @$style_select,
+# 'style_select' => $style_select,
'l_goprint' => $lang['l_goprint'],
'l_preferences' => $lang['l_preferences'],
'l_calendar' => $lang['l_calendar'],
diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php
index 8f02bd7..ef423b6 100644
--- a/functions/calendar_functions.php
+++ b/functions/calendar_functions.php
@@ -73,9 +73,9 @@ function availableCalendars($username, $password, $cal_filename, $admin = false)
if ($find_all || $phpiCal_config->recursive_path == 'yes' || $phpiCal_config->support_ical == 'yes') {
// Open the directory.
$dir_handle = opendir($search_path)
- or die(error("cal fn 78:".sprintf($lang['l_error_path'], $search_path), implode(',', $cal_filename)));
+ or die(error(sprintf($lang['l_error_path'], $search_path), implode(',', $cal_filename)));
if ($dir_handle === false)
- die(error(" cal fn 80:".sprintf($lang['l_error_path'], $search_path), implode(',', $cal_filename)));
+ die(error(sprintf($lang['l_error_path'], $search_path), implode(',', $cal_filename)));
// Add each file in the directory that does not begin with a dot.
while (false !== ($file = readdir($dir_handle))) {
diff --git a/functions/date_functions.php b/functions/date_functions.php
index c03c5ae..fa8cdd9 100644
--- a/functions/date_functions.php
+++ b/functions/date_functions.php
@@ -1,18 +1,8 @@
<?php
+require_once(BASE."functions/is_daylight.php");
// date_functions.php
// functions for returning or comparing dates
-// not a date function, but I didn't know where to put it
-// for backwards compatibility
-if (phpversion() < '4.1') {
- function array_key_exists($key, $arr) {
- if (!is_array($arr)) return false;
- foreach (array_keys($arr) as $k) {
- if ("$k" == "$key") return true;
- }
- return false;
- }
-}
// takes iCalendar 2 day format and makes it into 3 characters
// if $txt is true, it returns the 3 letters, otherwise it returns the
@@ -290,28 +280,4 @@ function match_tz($data){
if (strpos(" $data",$key) > 0) return $key;
}
return $data;
-}
-
-require_once(BASE."functions/is_daylight.php");
-/* function is_daylight($date, $timezone) returns 1 if daylight time, 0 if not
-
- default is to use the server's date function. This will be off when the timezone's rules are not the same as the server's rules. In php5.2+ there seems to be a better way to do this, but we can't count on users having php5.2+.
-
- Although we set dt_start and st_start in parse_tzs.php, these are not rrules and I don't know how to use them yet. So we'll do it by brute force for the ones we know about, from: http://www.webexhibits.org/daylightsaving/g.html
-
- Note that this sends a screwy time value - it's not necessarily UTC unixtime, since the mktime functions that create the time are not using the timezone.
-
-function is_daylight($time, $timezone){
- global $tz_array;
- # default to std time, overwrite if daylight.
- $dlst = 0;
- switch ($timezone){
- default:
- $dlst = date('I', $time);
- }
-
- return $dlst;
-
-}
-*/
-?> \ No newline at end of file
+}?> \ No newline at end of file
diff --git a/functions/draw_functions.php b/functions/draw_functions.php
index a5a98a9..77564c9 100644
--- a/functions/draw_functions.php
+++ b/functions/draw_functions.php
@@ -1,21 +1,23 @@
<?php
-// function returns starttime and endtime and event length for drawing into a grid
-
+# drawEventTimes returns starttime and endtime and event length for drawing into a grid
function drawEventTimes ($start, $end) {
global $phpiCal_config;
+ $sta_h = $sta_min = $end_h = $end_min = "00";
$gridLength = $phpiCal_config->gridLength;
- preg_match ('/([0-9]{2})([0-9]{2})/', $start, $time);
- $sta_h = @$time[1];
- $sta_min = @$time[2];
+ if (preg_match ('/([0-9]{2})([0-9]{2})/', $start, $time)){
+ $sta_h = $time[1];
+ $sta_min = $time[2];
+ }
$sta_min = sprintf("%02d", floor($sta_min / $gridLength) * $gridLength);
if ($sta_min == 60) {
$sta_h = sprintf("%02d", ($sta_h + 1));
$sta_min = "00";
}
- preg_match ('/([0-9]{2})([0-9]{2})/', $end, $time);
- $end_h = @$time[1];
- $end_min = @$time[2];
+ if (preg_match ('/([0-9]{2})([0-9]{2})/', $end, $time)){
+ $end_h = $time[1];
+ $end_min = $time[2];
+ }
$end_min = sprintf("%02d", floor($end_min / $gridLength) * $gridLength);
if ($end_min == 60) {
$end_h = sprintf("%02d", ($end_h + 1));
@@ -28,10 +30,8 @@ function drawEventTimes ($start, $end) {
$end_h = sprintf("%02d", ($end_h + 1));
$end_min = "00";
}
- }
-
+ }
$draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min);
-
return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len);
}
diff --git a/functions/init.inc.php b/functions/init.inc.php
index 8d15778..1b227cc 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -11,11 +11,12 @@ include_once(BASE.'error.php');
include_once(BASE.'functions/calendar_functions.php');
include_once(BASE.'functions/userauth_functions.php');
-
+# require php 5
+if (phpversion() < '5.1') die (error(sprintf($lang['l_php_version_required'],phpversion()) ) );
// Grab the action (login or logout).
+$action = '';
if (isset($_GET['action'])) $action = $_GET['action'];
-else if (isset($_POST['action'])) $action = $_POST['action'];
-else $action = '';
+else if (isset($_POST['action'])) $action = $_POST['action'];
// Login and/or logout.
list($username, $password, $invalid_login) = user_login();
diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php
index 9a13bbe..27f7bd3 100644
--- a/functions/parse/end_vevent.php
+++ b/functions/parse/end_vevent.php
@@ -177,8 +177,9 @@ foreach ($rrule_array as $key => $val) {
break;
}
}
+# convert wkst to a 3 char day for strtotime to work
+$wkst3char = two2threeCharDays($wkst);
if($current_view == 'search') $freq_type = 'none';
-
# $recur is the recurrence info that goes into the master array for this VEVENT
$recur = @$recur_array[($start_date)][($hour.$minute)][$uid]['recur'];
@@ -206,16 +207,16 @@ $start_date_unixtime = strtotime($start_date);
$next_range_unixtime = $start_date_unixtime;
# conditions where we don't need to iterate over the whole range
-# if repeating without limit, and steps are by 1, don't go back before the mArray beginning.
+# if repeating without limit, and steps are by 1, don't go back before the mArray beginning.
if($count == 1000000 && $interval == 1 && $mArray_begin > $next_range_unixtime) $next_range_unixtime = $mArray_begin;
-# if the beginning of our range is less than the start of the item, we may as well set the range to start at start_time
+# if the beginning of our range is less than the start of the item, we may as well set the range to start at start_time
if ($next_range_unixtime < $start_date_unixtime) $next_range_unixtime = $start_date_unixtime;
-# stop at the until limit if set
+# stop at the until limit if set
if(isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime;
-# more adjustments
+# more adjustments
switch ($freq_type){
case 'week':
# need to get the first value of $next_range_unixtime onto the right day of the week
@@ -231,8 +232,6 @@ if(!isset($rrule_array['FREQ']) && isset($end_date)){
$end_range_unixtime = strtotime($end_date);
$count = 1;
}
-// convert wkst to a 3 char day for strtotime to work
-$wkst3char = two2threeCharDays($wkst);
/* The while loop below increments $next_range_time by $freq type. For the larger freq types, there is only
one $next_range_time per repeat, but the BYXXX rules may write more than one event in that repeat cycle
diff --git a/functions/parse/parse_tzs.php b/functions/parse/parse_tzs.php
index a135b0f..8b02cb5 100644
--- a/functions/parse/parse_tzs.php
+++ b/functions/parse/parse_tzs.php
@@ -1,8 +1,8 @@
<?php
$ifile = @fopen($filename, "r");
-if ($ifile == FALSE) exit(error($lang['l_error_cantopen']." parse_tz", $filename));
+if ($ifile == FALSE) exit(error($lang['l_error_cantopen'], $filename));
$nextline = fgets($ifile);
-if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($lang['l_error_invalidcal']." parse_tz", $filename));
+if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($lang['l_error_invalidcal'], $filename));
// read file in line by line
// XXX end line is skipped because of the 1-line readahead
diff --git a/functions/parse/recur_functions.php b/functions/parse/recur_functions.php
index 0526e1d..e936c64 100644
--- a/functions/parse/recur_functions.php
+++ b/functions/parse/recur_functions.php
@@ -1,4 +1,4 @@
-<?php
+<?php
/* from the std
"BYxxx rule parts modify the recurrence in some manner. BYxxx rule parts for a period of time which is the same or greater than the frequency generally reduce or limit the number of occurrences of the recurrence generated. For example, "FREQ=DAILY;BYMONTH=1" reduces the number of recurrence instances from all days (if BYMONTH tag is not present) to all days in January. BYxxx rule parts for a period of time less than the frequency generally increase or expand the number of occurrences of the recurrence. For example, "FREQ=YEARLY;BYMONTH=1,2" increases the number of days within the yearly recurrence set from 1 (if BYMONTH tag is not present) to 2.
@@ -28,6 +28,7 @@ function add_recur($times,$freq=''){
$until_date = date("Ymd",$end_range_unixtime);
foreach ($times as $time){
#echo "time:". date("Ymd",$time)."\n";
+ if (!isset($time) || $time == '') continue;
$date = date("Ymd",$time);
$time = strtotime("$date 12:00:00");
# day offset fixes shifts across day boundaries due to time diffs.
diff --git a/functions/template.php b/functions/template.php
index 5535f69..5470bf9 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -1062,7 +1062,7 @@ class Page {
$file = str_replace("templates/$phpiCal_config->template","templates/default",$file);
}
if (!is_file($file)){
- exit(error($lang['l_error_path']." template 1065", $file));
+ exit(error($lang['l_error_path'], $file));
}
ob_start();
include($file);
diff --git a/languages/english.inc.php b/languages/english.inc.php
index b5bd4f3..d2cfbc5 100644
--- a/languages/english.inc.php
+++ b/languages/english.inc.php
@@ -204,6 +204,7 @@ Notes about dateFormat_*
$lang['l_error_title'] = 'Error!';
$lang['l_error_window'] = 'There was an error!';
$lang['l_error_calendar'] = 'The calendar "%s" was being processed when this error occurred.';
+$lang['l_php_version_required'] = 'PHP version "%s" detected. PHP 5.1 or greater is required to run this version of phpicalendar.';
$lang['l_error_path'] = 'Unable to open the path: "%s"';
$lang['l_error_back'] = 'Please use the "Back" button to return.';
$lang['l_error_remotecal'] = 'This server blocks remote calendars which have not been approved.';
@@ -211,5 +212,6 @@ $lang['l_error_restrictedcal'] = 'You have tried to access a calendar that is r
$lang['l_error_invalidcal'] = 'Invalid calendar file. Please try a different calendar.';
$lang['l_error_cantopen'] = 'Unable to open calendar.';
$lang['l_error_cache'] = 'Unable to write to cache directory. Please check your config.';
+$lang['l_prefs_off'] = 'Preferences are disabled on this installation.';
?> \ No newline at end of file
diff --git a/preferences.php b/preferences.php
index 9bcda9c..400f09e 100644
--- a/preferences.php
+++ b/preferences.php
@@ -6,7 +6,7 @@ require_once(BASE.'functions/template.php');
$display_date = $lang['l_preferences'];
if ($phpiCal_config->allow_preferences != 'yes') {
- exit(error('Preferences are not available for this installation.', $cal));
+ exit(error($lang['l_prefs_off'], $cal));
}
$current_view = "preferences";
@@ -30,6 +30,7 @@ if ($action == 'setcookie') {
$cookie_startday = $_POST['cookie_startday'];
$cookie_time = $_POST['cookie_time'];
$cookie_endtime = $_POST['cookie_endtime'];
+ $cookie_timezone = $_POST['cookie_timezone'];
$cookie_unset = @$_POST['unset'];
$the_cookie = array ("cookie_language" => "$cookie_language", "cookie_calendar" => "$cookie_calendar", "cookie_view" => "$cookie_view", "cookie_startday" => "$cookie_startday", "cookie_style" => "$cookie_style", "cookie_time" => "$cookie_time","cookie_endtime" => "$cookie_endtime", "cookie_cpath"=>"$cookie_cpath", "cookie_timezone"=>"$cookie_timezone");
$the_cookie = serialize($the_cookie);
@@ -58,7 +59,7 @@ if (isset($_COOKIE[$cookie_name])) {
$cookie_startday = $phpicalendar['cookie_startday'];
$cookie_time = $phpicalendar['cookie_time'];
$cookie_endtime = $phpicalendar['cookie_endtime'];
- $cookie_endtime = $phpicalendar['cookie_timezone'];
+ $cookie_timezone = $phpicalendar['cookie_timezone'];
if ($cookie_unset) {
unset ($cookie_language, $cookie_calendar, $cookie_view, $cookie_style,$cookie_startday);
}
@@ -226,7 +227,7 @@ $page->replace_tags(array(
'cpath' => $cpath,
'cal' => $cal,
'getdate' => $getdate,
- 'calendar_name' => $calendar_name,
+ 'calendar_name' => $cal_displayname,
'display_date' => $display_date,
'rss_powered' => $rss_powered,
'rss_available' => '',

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