From 477d20ee0494bcc59dcdbe53aa8ddf668fa8f9eb Mon Sep 17 00:00:00 2001 From: fenner Date: Mon, 2 Dec 2002 01:15:39 +0000 Subject: Sort the ical choices. --- functions/list_icals.php | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/functions/list_icals.php b/functions/list_icals.php index 3dbf3d6..f06edb3 100644 --- a/functions/list_icals.php +++ b/functions/list_icals.php @@ -12,24 +12,31 @@ if ($display_ical_list == "yes") { // open file $dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename)); + // empty the filelist array + $filelist = array(); + // build the \n"; - } else { - print "\n"; - } - } + array_push($filelist, $file); } + } + natcasesort($filelist); + foreach ($filelist as $file) { + + // $cal_filename is the filename of the calendar without .ics + // $cal is a urlencoded version of $cal_filename + // $cal_displayname is $cal_filename with occurrences of "32" replaced with " " + $cal_filename_tmp = substr($file,0,-4); + $cal_tmp = urlencode($cal_filename_tmp); + $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); + if (!in_array($cal_filename_tmp, $blacklisted_cals)) { + if ($cal_tmp == $cal) { + print "\n"; + } else { + print "\n"; + } + } } foreach($list_webcals as $cal_tmp) { if ($cal_tmp != '') { @@ -53,4 +60,4 @@ if ($display_ical_list == "yes") { print "\n"; } -?> \ No newline at end of file +?> -- cgit v1.2.3