aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorJason Oster <parasytic@users.sourceforge.net>2009-06-18 16:21:45 +0000
committerJason Oster <parasytic@users.sourceforge.net>2009-06-18 16:21:45 +0000
commit6836bebf950e2f69a310e92df6af730913f10945 (patch)
tree131a340945bfb1ac1518dd4b5ec91aa359f48c1c /functions
parent63f31be4ed0df62c710405dec683c383b1d05460 (diff)
downloadphpicalendar-6836bebf950e2f69a310e92df6af730913f10945.tar.gz
phpicalendar-6836bebf950e2f69a310e92df6af730913f10945.tar.bz2
phpicalendar-6836bebf950e2f69a310e92df6af730913f10945.zip
Fixed webcal protocol prefixes
Diffstat (limited to 'functions')
-rw-r--r--functions/ical_parser.php7
-rw-r--r--functions/init.inc.php11
2 files changed, 7 insertions, 11 deletions
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 3db6e3f..6f8111d 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -87,10 +87,9 @@ foreach ($cal_filelist as $cal_key=>$filename) {
$is_webcal = FALSE;
if (substr($filename, 0, 7) == 'http://' || substr($filename, 0, 8) == 'https://' || substr($filename, 0, 9) == 'webcal://') {
$is_webcal = TRUE;
- $cal_webcalPrefix = str_replace('http://','webcal://',$filename);
- $cal_httpPrefix = str_replace('webcal://','http://',$filename);
- $cal_httpsPrefix = str_replace('webcal://','https://',$filename);
- $cal_httpsPrefix = str_replace('http://','https://',$cal_httpsPrefix);
+ $cal_webcalPrefix = str_replace(array('http://', 'https://'), 'webcal://', $filename);
+ $cal_httpPrefix = str_replace(array('webcal://', 'https://'), 'http://', $filename);
+ $cal_httpsPrefix = str_replace(array('http://', 'webcal://'), 'https://', $filename);
$filename = $cal_httpPrefix;
$master_array['-4'][$calnumber]['webcal'] = 'yes';
$actual_mtime = time();
diff --git a/functions/init.inc.php b/functions/init.inc.php
index f0cc213..04069cf 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -98,10 +98,9 @@ $cals = array();
foreach ($web_cals as $web_cal) {
// Make some protocol alternatives, and set our real identifier to the
// HTTP protocol.
- $cal_webcalPrefix = str_replace('http://','webcal://',$web_cal);
- $cal_httpPrefix = str_replace('webcal://','http://',$web_cal);
- $cal_httpsPrefix = str_replace('webcal://','https://',$web_cal);
- $cal_httpsPrefix = str_replace('http://','https://',$web_cal);
+ $cal_webcalPrefix = str_replace(array('http://', 'https://'), 'webcal://', $web_cal);
+ $cal_httpPrefix = str_replace(array('webcal://', 'https://'), 'http://', $web_cal);
+ $cal_httpsPrefix = str_replace(array('http://', 'webcal://'), 'https://', $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
@@ -122,12 +121,10 @@ foreach ($web_cals as $web_cal) {
$web_cal = md5($phpiCal_config->salt.$web_cal);
}
$cals[] = urlencode($web_cal);
- //$filename = $cal_filename;
$subscribe_path = $cal_webcalPrefix;
// Add the webcal to the available calendars.
- $web_cal = $cal_httpPrefix;
- $cal_filelist[] = $web_cal;
+ $cal_filelist[] = $cal_httpPrefix;
}
// Process the local calendars.

© 2014-2022 Faster IT GmbH | imprint | privacy policy