summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-07-10 20:18:20 +0400
committerAndrew Dolgov <[email protected]>2013-07-10 20:18:20 +0400
commitfe61dc18233a46f521bbf4884fc25f3e78e1c684 (patch)
treef7b854db98b945c0c847960bd456110ed87850ef /include
parent6bd7913e20c6b6672546ee74c34c2e9a9b191e7a (diff)
geturl: limit amount of redirects
Diffstat (limited to 'include')
-rw-r--r--include/functions.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php
index d71f81ac4..8a8f7b5d0 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -4090,7 +4090,9 @@
return in_array($interface, class_implements($class));
}
- function geturl($url){
+ function geturl($url, $depth = 0){
+
+ if ($depth == 20) return $url;
if (!function_exists('curl_init'))
return user_error('CURL Must be installed for geturl function to work. Ask your host to enable it or uncomment extension=php_curl.dll in php.ini', E_USER_ERROR);
@@ -4129,7 +4131,7 @@
preg_match("/(Location:|URI:)[^(\n)]*/", $header, $matches);
$url = trim(str_replace($matches[1],"",$matches[0]));
$url_parsed = parse_url($url);
- return (isset($url_parsed))? geturl($url):'';
+ return (isset($url_parsed))? geturl($url, $depth + 1):'';
}
global $fetch_last_error;