diff options
author | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-27 23:18:07 +0000 |
---|---|---|
committer | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-27 23:18:07 +0000 |
commit | fb1fa4e8eeb2accaf71675dbf9810ec5af47bc79 (patch) | |
tree | 892273a81e75ff9929c558dc0bb4f6d0d06cbce4 /functions | |
parent | 195553ad26b4c8c3639041698309b47ae6d1b1f3 (diff) | |
download | phpicalendar-fb1fa4e8eeb2accaf71675dbf9810ec5af47bc79.tar.gz phpicalendar-fb1fa4e8eeb2accaf71675dbf9810ec5af47bc79.tar.bz2 phpicalendar-fb1fa4e8eeb2accaf71675dbf9810ec5af47bc79.zip |
new rss icons;allow subweek calendars
Diffstat (limited to 'functions')
-rw-r--r-- | functions/ical_parser.php | 4 | ||||
-rw-r--r-- | functions/init/configs.php | 20 | ||||
-rw-r--r-- | functions/init/date_range.php | 5 | ||||
-rw-r--r-- | functions/template.php | 13 |
4 files changed, 35 insertions, 7 deletions
diff --git a/functions/ical_parser.php b/functions/ical_parser.php index 2791f65..82e76fe 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -11,7 +11,7 @@ include_once(BASE.'functions/parse/recur_functions.php'); $parse_file = true; if ($phpiCal_config->save_parsed_cals == 'yes') { if (sizeof ($cal_filelist) > 1) { - $parsedcal = $tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$cal_filename).'-'.$this_year; + $parsedcal = $phpiCal_config->tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$cal_filename).'-'.$this_year; if (file_exists($parsedcal)) { $fd = fopen($parsedcal, 'r'); $contents = fread($fd, filesize($parsedcal)); @@ -51,7 +51,7 @@ if ($phpiCal_config->save_parsed_cals == 'yes') { } else { foreach ($cal_filelist as $filename) { $realcal_mtime = filemtime($filename); - $parsedcal = $tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$cal_filename).'-'.$this_year; + $parsedcal = $phpiCal_config->tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$cal_filename).'-'.$this_year; if (file_exists($parsedcal)) { $parsedcal_mtime = filemtime($parsedcal); if ($realcal_mtime == $parsedcal_mtime) { diff --git a/functions/init/configs.php b/functions/init/configs.php index f94c47b..17921ba 100644 --- a/functions/init/configs.php +++ b/functions/init/configs.php @@ -5,6 +5,25 @@ if (is_file(BASE.'config.inc.php')){ include(BASE.'config.inc.php'); foreach($configs as $key=>$value) $phpiCal_config->setProperty($key, $value); } + +# adjust gridlength to allowed values +$g = $phpiCal_config->gridLength; +if (!in_array($g,array(1,2,3,4,10,12,15,20,30,60)) && $g < 11){ + $g = 10; +}elseif($g < 13){ + $g = 12; +}elseif($g < 17){ + $g = 15; +}elseif($g < 25){ + $g = 20; +}elseif($g < 45){ + $g = 30; +}else{ + $g = 60; +} +$phpiCal_config->setProperty('gridLength', $g); + + if ($phpiCal_config->cookie_uri == '') { $phpiCal_config->setProperty('cookie_uri', $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/')) ); if ($phpiCal_config->cookie_uri == 'localhost') $phpiCal_config->setProperty('cookie_uri', ''); @@ -23,6 +42,7 @@ if (isset($_COOKIE[$cookie_name]) && !isset($_POST['unset'])) { if (isset($phpicalendar['cookie_startday'])) $phpiCal_config->setProperty('week_start_day', $phpicalendar['cookie_startday']); if (isset($phpicalendar['cookie_time'])) $phpiCal_config->setProperty('day_start', $phpicalendar['cookie_time']); if (isset($phpicalendar['cookie_endtime'])) $phpiCal_config->setProperty('day_end', $phpicalendar['cookie_endtime']); + if (isset($phpicalendar['cookie_timezone'])) $phpiCal_config->setProperty('timezone', $phpicalendar['timezone']); } # language support diff --git a/functions/init/date_range.php b/functions/init/date_range.php index 7a51b47..d9f7b54 100644 --- a/functions/init/date_range.php +++ b/functions/init/date_range.php @@ -33,6 +33,7 @@ switch ($current_view){ $mArray_begin = mktime (0,0,0,$start_month,1,($start_year)); $mArray_end = mktime (0,0,0,$end_month,31,($end_year)); break; + case 'error': case 'preferences': $mArray_begin = time(); $mArray_end = time(); @@ -45,3 +46,7 @@ switch ($current_view){ $mArray_begin = mktime (0,0,0,12,21,($this_year - 1)); $mArray_end = mktime (0,0,0,1,31,($this_year + 1)); } +if ($phpiCal_config->save_parsed_cals == 'yes') { + $mArray_begin = mktime (0,0,0,12,21,($this_year - 1)); + $mArray_end = mktime (0,0,0,1,31,($this_year + 1)); +}
\ No newline at end of file diff --git a/functions/template.php b/functions/template.php index 95b0586..46f5163 100644 --- a/functions/template.php +++ b/functions/template.php @@ -269,7 +269,7 @@ class Page { $event_length[$thisday] = array (); $thisdate = ($thisdate + (25 * 60 * 60)); } - + #echo "<pre>";print_r($nbrGridCols); // Replaces the allday events preg_match("!<\!-- loop allday on -->(.*)<\!-- loop allday off -->!Uis", $this->page, $match1); preg_match("!<\!-- loop alldaysofweek on -->(.*)<\!-- loop allday on -->!Uis", $this->page, $match2); @@ -510,7 +510,7 @@ class Page { $loop_dof = trim($match1[1]); $start_wt = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day)); $start_day = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day)); - for ($i=0; $i<7; $i++) { + for ($i=0; $i<$phpiCal_config->week_length; $i++) { $day_num = date("w", $start_day); $daylink = date('Ymd', $start_wt); if ($current_view == 'day') { @@ -883,7 +883,7 @@ class Page { $weekday_loop = ''; $middle = ''; - for ($i=0; $i<7; $i++) { + for ($i=0; $i< $phpiCal_config->week_length; $i++) { $day_num = date("w", $start_day); $weekday = $langtype[$day_num]; $start_day = strtotime("+1 day", $start_day); @@ -910,7 +910,7 @@ class Page { } else { $temp = $t_month[2]; } - if (isset($master_array[$daylink])) { + if (isset($master_array[$daylink]) && $i <= $phpiCal_config->week_length) { if ($type != 'small') { foreach ($master_array[$daylink] as $cal_time => $event_times) { foreach ($event_times as $uid => $val) { @@ -953,7 +953,10 @@ class Page { $middle .= $temp; $start_day = strtotime("+1 day", $start_day); - if ($i == 7) { + if ($i == $phpiCal_config->week_length) { + if ($phpiCal_config->week_length != 7) { + $start_day = strtotime("+".(7-$phpiCal_config->week_length)." day", $start_day); + } $i = 0; $middle .= $endweek; $checkagain = date ("m", $start_day); |