From cb5276baef1831d87d67770a0d76fb2300af5045 Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Sun, 28 Dec 2008 02:31:59 +0000 Subject: fix for webcals --- config.inc.php | 3 ++- default_config.php | 5 ----- functions/calendar_functions.php | 16 ++++++++-------- functions/init.inc.php | 24 +++++++++--------------- functions/init/cpaths.php | 4 ++-- 5 files changed, 21 insertions(+), 31 deletions(-) diff --git a/config.inc.php b/config.inc.php index e541891..2bcb4f1 100644 --- a/config.inc.php +++ b/config.inc.php @@ -74,7 +74,8 @@ $blacklisted_cals[] = ''; // list. This should be the e $blacklisted_cals[] = ''; // the parser will *not* parse any cal that is in this list (it will not be Web accessible) // add more lines as necessary -$list_webcals[] = 'http://www.google.com/calendar/ical/jim.hu.biobio%40gmail.com/public/basic.ics'; // Fill in between the quotes exact URL of a calendar that you wish +$list_webcals[] = 'http://www.google.com/calendar/ical/jim.hu.biobio%40gmail.com/public/basic.ics'; // Fill in between the quotes exact URL of a +$list_webcals[] = 'webcal://dimer.tamu.edu/calendars/seminars/Biochem.ics'; // Fill in between the quotes exact URL of a calendar that you wish calendar that you wish $list_webcals[] = ''; // to show up in your calendar list. You must prefix the URL with http:// $list_webcals[] = ''; // or webcal:// and the filename should contain the .ics suffix $list_webcals[] = ''; // $allow_webcals does *not* need to be "yes" for these to show up and work diff --git a/default_config.php b/default_config.php index ef7acd4..717f851 100644 --- a/default_config.php +++ b/default_config.php @@ -74,11 +74,6 @@ class Configs{ // Colors will repeat from the beginning for calendars past $this->unique_colors (7 by default), with no limit. $this->unique_colors = '7'; - $this->blacklisted_cals = array(); - $this->list_webcals = array(); - $this->locked_cals = array(); - $this->locked_map = array(); - $this->verbose_errors = false; return true; } diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php index b814cb1..b02ebec 100644 --- a/functions/calendar_functions.php +++ b/functions/calendar_functions.php @@ -14,14 +14,14 @@ // returned. function availableCalendars($username, $password, $cal_filename, $admin = false) { // Import globals. - global $allow_webcals, $allow_login, $calendar_path, $recursive_path, $support_ical, $locked_map, $apache_map, $lang, $_SERVER, $phpiCal_config; + global $list_webcals, $blacklisted_cals, $locked_cals, $locked_map, $apache_map, $lang, $_SERVER, $phpiCal_config; // Create the list of available calendars. $calendars = array(); // Grab any HTTP authentication. unset($http_user); - if ((isset($_SERVER['PHP_AUTH_USER'])) && ($allow_login == 'yes')) { + if ((isset($_SERVER['PHP_AUTH_USER'])) && ($phpiCal_config->allow_login == 'yes')) { $http_user = $_SERVER['PHP_AUTH_USER']; } @@ -46,7 +46,7 @@ function availableCalendars($username, $password, $cal_filename, $admin = false) // Add web calendars. if ($cal_filename_local[0] == $phpiCal_config->ALL_CALENDARS_COMBINED || $admin) { if (!isset($http_user) && !$admin) { - foreach ($phpiCal_config->list_webcals as $file) { + foreach ($list_webcals as $file) { // Make sure the URL ends with .ics. if (!preg_match("/.ics$/i", $file)) continue; @@ -74,7 +74,7 @@ function availableCalendars($username, $password, $cal_filename, $admin = false) // subdirectory, or we are supporting the iCal repository format. // The latter is necessary because the calendar name cannot be // used to identify the calendar filename. - if ($find_all || $recursive_path == 'yes' || $support_ical == 'yes') { + if ($find_all || $phpiCal_config->recursive_path == 'yes' || $phpiCal_config->support_ical == 'yes') { // Open the directory. $dir_handle = @opendir($search_path) or die(error(sprintf($lang['l_error_path'], $search_path), implode(',', $cal_filename))); @@ -114,18 +114,18 @@ function availableCalendars($username, $password, $cal_filename, $admin = false) // Make sure this is not a blacklisted calendar. $cal_name = getCalendarName($file); - if (in_array($cal_name, $phpiCal_config->blacklisted_cals)) continue; + if (in_array($cal_name, $blacklisted_cals)) continue; // If HTTP authenticated, make sure this calendar is available // to the user. if (isset($http_user)) { - if (!in_array($cal_name, $phpiCal_config->apache_map[$http_user])) continue; + if (!in_array($cal_name, $apache_map[$http_user])) continue; } // Make sure this calendar is not locked. if (!$admin && - in_array($cal_name, $phpiCal_config->locked_cals) && - !in_array($cal_name, $phpiCal_config->unlocked_cals)) + in_array($cal_name, $locked_cals) && + !in_array($cal_name, $unlocked_cals)) { continue; } diff --git a/functions/init.inc.php b/functions/init.inc.php index f629f76..3c1c469 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -112,7 +112,7 @@ foreach ($web_cals as $web_cal) { // We can only include this web calendar if we allow all web calendars // (as defined by $allow_webcals) or if the web calendar shows up in the // list of web calendars defined in config.inc.php. - if ($allow_webcals != 'yes' && + if ($phpiCal_config->allow_webcals != 'yes' && !in_array($cal_webcalPrefix, $list_webcals) && !in_array($cal_httpPrefix, $list_webcals) && !in_array($cal_httpsPrefix, $list_webcals)) @@ -187,19 +187,13 @@ function getmicrotime() { $uid_list = array(); #uncomment for diagnostics -#echo "after init.inc.ics
";
-#echo "cals";
-#print_r($cals);echo"\n\n";
-#echo "cal_filenames";
-#print_r($cal_filenames);echo"\n\n";
-#echo "web_cals";
-#print_r($web_cals);echo"\n\n";
-#echo "local_cals";
-#print_r($local_cals);echo"\n\n";
-#echo "cal_filelist";
-#print_r($cal_filelist);
-#echo "cal_displaynames";
-#print_r($cal_displaynames);
+#echo "after init.inc.ics
"; 
+#echo "cals";print_r($cals);echo"\n\n";
+#echo "cal_filenames";print_r($cal_filenames);echo"\n\n";
+#echo "web_cals";print_r($web_cals);echo"\n\n";
+#echo "local_cals";print_r($local_cals);echo"\n\n";
+#echo "cal_filelist";print_r($cal_filelist);
+#echo "cal_displaynames";print_r($cal_displaynames);
 #echo "

"; -?> +?> \ No newline at end of file diff --git a/functions/init/cpaths.php b/functions/init/cpaths.php index c1ab50b..773f3cb 100644 --- a/functions/init/cpaths.php +++ b/functions/init/cpaths.php @@ -26,7 +26,7 @@ if (isset($user_template["$cpath"])){ $template = $user_template["$cpath"]; } #set up specific webcals for a particular cpath -if (isset($phpiCal_config->more_webcals) && is_array($phpiCal_config->more_webcals[$cpath])){ - $list_webcals = array_merge($phpiCal_config->list_webcals, $phpiCal_config->more_webcals["$cpath"]); +if (isset($more_webcals) && is_array($more_webcals[$cpath])){ + $list_webcals = array_merge($list_webcals, $more_webcals["$cpath"]); } $phpiCal_config->setProperty('calendar_path',$calendar_path); \ No newline at end of file -- cgit v1.2.3