aboutsummaryrefslogtreecommitdiffstats
path: root/functions/init.inc.php
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2003-06-30 22:48:25 +0000
committerChad Little <clittle@users.sourceforge.net>2003-06-30 22:48:25 +0000
commitbf8d96066ff80a8717420ac80e16b96d337e33c3 (patch)
treed1550a1aebe7ee7113e98162a2b8204662d08fa4 /functions/init.inc.php
parent743cae611eeb4436d3d8dc865c010b2b3fd0102a (diff)
downloadphpicalendar-bf8d96066ff80a8717420ac80e16b96d337e33c3.tar.gz
phpicalendar-bf8d96066ff80a8717420ac80e16b96d337e33c3.tar.bz2
phpicalendar-bf8d96066ff80a8717420ac80e16b96d337e33c3.zip
Multiple Calendar support.
Diffstat (limited to 'functions/init.inc.php')
-rw-r--r--functions/init.inc.php47
1 files changed, 35 insertions, 12 deletions
diff --git a/functions/init.inc.php b/functions/init.inc.php
index 1d8af84..3033e76 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -62,12 +62,16 @@ if (isset($HTTP_GET_VARS['cal']) && $HTTP_GET_VARS['cal'] != '') {
}
} else {
if (isset($default_cal_check)) {
- $calcheck = $calendar_path.'/'.$default_cal_check.'.ics';
- $calcheckopen = @fopen($calcheck, "r");
- if ($calcheckopen == FALSE) {
- $cal_filename = $default_cal;
+ if ($default_cal_check != 'all_calenders_combined971') {
+ $calcheck = $calendar_path.'/'.$default_cal_check.'.ics';
+ $calcheckopen = @fopen($calcheck, "r");
+ if ($calcheckopen == FALSE) {
+ $cal_filename = $default_cal;
+ } else {
+ $cal_filename = $default_cal_check;
+ }
} else {
- $cal_filename = $default_cal_check;
+ $cal_filename = 'all_calenders_combined971';
}
} else {
$cal_filename = $default_cal;
@@ -91,16 +95,35 @@ if ($is_webcal) {
exit(error($error_restrictedcal_lang, $cal_filename));
} else {
if (!isset($filename)) {
- $filename = $calendar_path.'/'.$cal_filename.'.ics';
- if (true == false) {
+ // empty the filelist array
+ $cal_filelist = array();
+ if ($cal == 'all_calenders_combined971') { // Create an array with the paths to all files to be combined
+ // Note: code here is similar to code in list_icals.php
+ // open directory
$dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename));
- while ($file = readdir($dir_handle)) {
- if (substr($file, -4) == '.ics') {
- $cal = urlencode(substr($file, 0, -4));
- $filename = $calendar_path.'/'.$file;
- break;
+
+
+ // build the array
+ while (false != ($file = readdir($dir_handle))) {
+ if (substr($file, -4) == ".ics") {
+ $file = $calendar_path.'/'.$file;
+ array_push($cal_filelist, $file);
+ }
+ }
+ natcasesort($cal_filelist);
+ } else { // Handle a single file
+ $filename = $calendar_path.'/'.$cal_filename.'.ics';
+ if (true == false) {
+ $dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename));
+ while ($file = readdir($dir_handle)) {
+ if (substr($file, -4) == '.ics') {
+ $cal = urlencode(substr($file, 0, -4));
+ $filename = $calendar_path.'/'.$file;
+ break;
+ }
}
}
+ array_push($cal_filelist, $filename);
}
}

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