diff options
author | jwangen <jwangen> | 2002-10-02 03:01:44 +0000 |
---|---|---|
committer | jwangen <jwangen> | 2002-10-02 03:01:44 +0000 |
commit | 6ab942a62550e6f22a3b3e4e3adc67c5207eeda2 (patch) | |
tree | 034d7f21dc38e64b104b47eb6ab3c9b414ebe915 /functions/list_icals.php | |
parent | c4c389ff735a71c66c902aa115a3ee9240293ac3 (diff) | |
download | phpicalendar-6ab942a62550e6f22a3b3e4e3adc67c5207eeda2.tar.gz phpicalendar-6ab942a62550e6f22a3b3e4e3adc67c5207eeda2.tar.bz2 phpicalendar-6ab942a62550e6f22a3b3e4e3adc67c5207eeda2.zip |
Added the ability to not list icals if specified in config.inc.php.
Diffstat (limited to 'functions/list_icals.php')
-rw-r--r-- | functions/list_icals.php | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/functions/list_icals.php b/functions/list_icals.php index a4025c5..8ca60d1 100644 --- a/functions/list_icals.php +++ b/functions/list_icals.php @@ -1,38 +1,40 @@ <?php +if ($display_ical_list == "yes") { -// start of <select> tag -if (isset($getdate)) { - $query="&getdate=$getdate"; -} else { - $query=""; -} -print "<form>\n<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value+'$query');\">\n"; - -// open file -$dir_handle = @opendir($calendar_path) or die("Unable to open $calendar_path"); - -// build the <option> tags -while ($file = readdir($dir_handle)) { - if (substr($file, -4) == ".ics") { - // $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 ($cal_tmp == $cal) { - print "<option value=\"$current_view.php?cal=$cal_tmp\" selected>$cal_displayname_tmp Calendar</option>\n"; - } else { - print "<option value=\"$current_view.php?cal=$cal_tmp\">$cal_displayname_tmp Calendar</option>\n"; - } - + // start of <select> tag + if (isset($getdate)) { + $query="&getdate=$getdate"; + } else { + $query=""; } + print "<form>\n<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value+'$query');\">\n"; + + // open file + $dir_handle = @opendir($calendar_path) or die("Unable to open $calendar_path"); + + // build the <option> tags + while ($file = readdir($dir_handle)) { + if (substr($file, -4) == ".ics") { + // $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 ($cal_tmp == $cal) { + print "<option value=\"$current_view.php?cal=$cal_tmp\" selected>$cal_displayname_tmp Calendar</option>\n"; + } else { + print "<option value=\"$current_view.php?cal=$cal_tmp\">$cal_displayname_tmp Calendar</option>\n"; + } + } + } + + // close file + closedir($dir_handle); + + // finish <select> + print "</select>\n</form>"; + } - -// close file -closedir($dir_handle); - -// finish <select> -print "</select>\n</form>"; -?>
\ No newline at end of file +?>
\ No newline at end of file |