aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorJason Oster <parasytic@users.sourceforge.net>2010-05-12 15:44:36 +0000
committerJason Oster <parasytic@users.sourceforge.net>2010-05-12 15:44:36 +0000
commitaf6c1cc978039b5740855264a01d4171b311b72e (patch)
tree503e2d01e5cad6c243cc256675e6c89ae027d5db /functions
parent3920179c73e5b78591003ec36ea7991e7f06fd60 (diff)
downloadphpicalendar-af6c1cc978039b5740855264a01d4171b311b72e.tar.gz
phpicalendar-af6c1cc978039b5740855264a01d4171b311b72e.tar.bz2
phpicalendar-af6c1cc978039b5740855264a01d4171b311b72e.zip
Stop parsing headers when a timestamp is obtained, and refactor resolve_path()
Diffstat (limited to 'functions')
-rw-r--r--functions/date_functions.php24
1 files changed, 13 insertions, 11 deletions
diff --git a/functions/date_functions.php b/functions/date_functions.php
index a97e3ca..22a37ca 100644
--- a/functions/date_functions.php
+++ b/functions/date_functions.php
@@ -64,6 +64,7 @@ function remote_filemtime($url, $recurse = 0) {
$result = strtotime($value);
break;
}
+ if ($result) break;
}
$remote_files[$url] = $result;
@@ -75,8 +76,13 @@ function remote_filemtime($url, $recurse = 0) {
* Utility function for remote_filemtime()
*/
function resolve_path($url, $rel_path) {
- $uri = parse_url($url);
+ if (parse_url($rel_path) !== FALSE) {
+ // Path is a URL
+ return $rel_path;
+ }
+ // Path is relative to this domain
+ $uri = parse_url($url);
$uri['proto'] = (isset($uri['proto']) ? $uri['proto'] : 'http://');
$uri['port'] = (isset($uri['port']) ? (':' . $uri['port']) : '');
$auth = (
@@ -85,18 +91,14 @@ function resolve_path($url, $rel_path) {
''
);
- if (parse_url($rel_path) === false) {
- // Path is relative to this domain
- $rel_path = str_replace('\\', '/', $rel_path);
-
- if ($rel_path{0} == '/')
- return $uri['proto'] . '://' . $auth . $uri['host'] . $uri['port'] . $rel_path;
-
- return $uri['proto'] . '://' . $auth . $uri['host'] . $uri['port'] . $uri['path'] . '/' . $rel_path;
+ $rel_path = str_replace('\\', '/', $rel_path);
+ if ($rel_path{0} == '/') {
+ // Absolute path
+ return $uri['proto'] . '://' . $auth . $uri['host'] . $uri['port'] . $rel_path;
}
- // Path is absolute
- return $rel_path;
+ // Relative path
+ return $uri['proto'] . '://' . $auth . $uri['host'] . $uri['port'] . @$uri['path'] . '/' . $rel_path;
}
// takes iCalendar 2 day format and makes it into 3 characters

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