diff options
author | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-28 03:20:29 +0000 |
---|---|---|
committer | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-28 03:20:29 +0000 |
commit | bbfbcfca381146e0ca2a161616513cf2e66f3337 (patch) | |
tree | 554d9644f2a0cafa4ff6145d06061eb09c7fae48 | |
parent | cb5276baef1831d87d67770a0d76fb2300af5045 (diff) | |
download | phpicalendar-bbfbcfca381146e0ca2a161616513cf2e66f3337.tar.gz phpicalendar-bbfbcfca381146e0ca2a161616513cf2e66f3337.tar.bz2 phpicalendar-bbfbcfca381146e0ca2a161616513cf2e66f3337.zip |
get recursive path working
-rw-r--r-- | config.inc.php | 51 | ||||
-rw-r--r-- | functions/calendar_functions.php | 40 |
2 files changed, 37 insertions, 54 deletions
diff --git a/config.inc.php b/config.inc.php index 2bcb4f1..db7a9e0 100644 --- a/config.inc.php +++ b/config.inc.php @@ -20,12 +20,16 @@ As noted, phpicalendar should work without adjusting the default settings. Chan calendar_path is a FILE path default_path, cookie_uri, and download_uri are a URL paths, e.g. http://www.example.com/phpicalendar; set these if you are having problems. + +Note that the allow_webcals setting allows webcals to be passed as URLs. You do NOT need to override the default setting to list specific webcals for inclusion in the SPECIAL CALENDARS section below. */ # 'calendar_path' => '/Library/WebServer/Documents/phpicalendar/calendars/recur_tests', # 'default_path' => '', # 'save_parsed_cals' => 'yes', # 'cookie_uri' => '', # 'download_uri' => '', +# 'allow_webcals' => 'yes', + 'recursive_path' => 'yes', /* ** Timezones ** If timezone is not set, all events show in the local time of the source calendar. This isn't a problem if all your calendars are in the same timezone. If you set a timezone for the server, events in other timezones are shown when they occur at the server's time. @@ -42,10 +46,10 @@ phpicalendar currently supports about 30 language variants. For a list of suppo */ # 'language' => 'Spanish', -# 'default_cal' => 'US Holidays', // Exact filename of calendar without .ics. Or set to 'ALL_CALENDARS_COMBINED to open all calenders combined into one. +# 'default_cal' => 'US Holidays', // Exact filename of calendar without .ics. # 'template' => 'green'; // Template support: change this to have a different "skin" for your installation. - 'default_view' => 'year', // Default view for calendars' => 'day', 'week', 'month', 'year' - 'printview_default' => 'yes', // Set print view as the default view. Uses'default_view (listed above). + # 'default_view' => 'year', // Default view for calendars' => 'day', 'week', 'month', 'year' +# 'printview_default' => 'yes', // Set print view as the default view. Uses'default_view (listed above). # 'gridLength' => 10, // Grid size in day and week views. Allowed values are 1,2,3,4,10,12,15,20,30,60. Default is 15 # 'minical_view' => 'current', // Where do the mini-calendars go when clicked?' => 'day', 'week', 'month', 'current' # 'allow_preferences' => 'no', @@ -59,36 +63,35 @@ phpicalendar currently supports about 30 language variants. For a list of suppo # 'day_start' => '0600', // Start time for day grid # 'day_end' => '2000', // End time for day grid - +); /* ========= SPECIAL CALENDARS ========= -*/ - 'allow_webcals' => 'yes', +these arrays provide extra calendar options. + ** Blacklisted Calendars -); + +*/ +$blacklisted_cals = array( +'' +); +/* ========= SPECIAL CALENDARS ========= -$blacklisted_cals[] = ''; // Fill in between the quotes the name of the calendars -$blacklisted_cals[] = ''; // you wish to 'blacklist' or that you don't want to show up in your calendar -$blacklisted_cals[] = ''; // list. This should be the exact calendar filename without .ics -$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 +these arrays provide extra calendar options. -$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 -// add more lines as necessary +*/ +$list_webcals[] = array( +# 'webcal://dimer.tamu.edu/calendars/seminars/Biochem.ics' +); +$more_webcals['recur_tests'] = array(); +$locked_cals[] = array( -#$more_webcals['cpath'][] = '' //add webcals that will show up only for a particular cpath. +); +/* ========= SPECIAL CALENDARS ========= -$locked_cals[] = ''; // Fill in-between the quotes the names of the calendars you wish to hide -$locked_cals[] = ''; // unless unlocked by a username/password login. This should be the -$locked_cals[] = ''; // exact calendar filename without the .ics suffix. -$locked_cals[] = ''; // -// add more lines as necessary +these arrays provide extra calendar options. +*/ $locked_map['user1:pass'] = array(''); // Map username:password accounts to locked calendars that should be $locked_map['user2:pass'] = array(''); // unlocked if logged in. Calendar names should be the same as what is $locked_map['user3:pass'] = array(''); // listed in the $locked_cals, again without the .ics suffix. diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php index b02ebec..09279da 100644 --- a/functions/calendar_functions.php +++ b/functions/calendar_functions.php @@ -1,5 +1,4 @@ <?php - // This function returns a list of all calendars that the current user // has access to. Basically, all local calendars found in the calendar // directory, plus any webcals listed in the configuration file, but @@ -48,8 +47,7 @@ function availableCalendars($username, $password, $cal_filename, $admin = false) if (!isset($http_user) && !$admin) { foreach ($list_webcals as $file) { // Make sure the URL ends with .ics. - if (!preg_match("/.ics$/i", $file)) continue; - + if (!preg_match("/.ics$/i", $file)) continue; // Add this calendar. array_push($calendars, $file); } @@ -100,49 +98,33 @@ function availableCalendars($username, $password, $cal_filename, $admin = false) // Push directories onto the search paths if recursive paths is // turned on. if (is_dir($file)) { - if ($recursive_path == 'yes') { - array_push($search_paths, $file); - } + if ($phpiCal_config->recursive_path == 'yes') array_push($search_paths, $file); continue; - } - + } // Make sure the file is real. if (!is_file($file)) continue; - // Make sure the file ends in .ics. if (!preg_match("/^.*\.ics$/i", $file)) continue; - // Make sure this is not a blacklisted calendar. $cal_name = getCalendarName($file); 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, $apache_map[$http_user])) continue; - } - + if (isset($http_user) && !in_array($cal_name, $apache_map[$http_user])) continue; + // Make sure this calendar is not locked. - if (!$admin && - in_array($cal_name, $locked_cals) && - !in_array($cal_name, $unlocked_cals)) - { - continue; - } + if (!$admin && in_array($cal_name, $locked_cals) && !in_array($cal_name, $unlocked_cals)) continue; // Add this calendar if we're looking for it, and remove it's name // from the local list because we've found it. if ($find_all || in_array($cal_name, $cal_filename_local)) { array_push($calendars, $file); - $cal_filename_local = array_diff($cal_filename_local, array($cal_name)); - + $cal_filename_local = array_diff($cal_filename_local, array($cal_name)); // If the local list is empty, we're done. - if (empty($cal_filename_local)) - break 2; + if (empty($cal_filename_local)) break 2; } } } - // Return the sorted calendar list. natcasesort($calendars); return $calendars; @@ -171,8 +153,7 @@ function availableCalendarNames($username, $password, $cal_filename, $admin = fa return $calendars; } -// This function returns the calendar name for the specified calendar -// path. +// This function returns the calendar name for the specified calendar path. // // $cal_path = The path to the calendar file. function getCalendarName($cal_path) { @@ -256,7 +237,6 @@ function display_ical_list($cals, $pick=FALSE) { else { // Strip path and .ics suffix. $cal_tmp = getCalendarName($cal_tmp); - // Add calendar label. $cal_displayname_tmp .= " $calendar_lang"; } @@ -294,4 +274,4 @@ function display_ical_list($cals, $pick=FALSE) { } } return $return; -} +}
\ No newline at end of file |