From bbfbcfca381146e0ca2a161616513cf2e66f3337 Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Sun, 28 Dec 2008 03:20:29 +0000 Subject: get recursive path working --- functions/calendar_functions.php | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 'functions') 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 @@ 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 -- cgit v1.2.3