aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-07-18 17:08:03 -0700
committerfriendica <info@friendica.com>2012-07-18 17:08:03 -0700
commitd92a4a686dd989613cfb628896902c7a4f21c522 (patch)
tree6e255cfe2108602c32b40d9d4c424f790176467e /include/network.php
parent0400779b43525de44dab7d076aa184d634aba0f2 (diff)
downloadvolse-hubzilla-d92a4a686dd989613cfb628896902c7a4f21c522.tar.gz
volse-hubzilla-d92a4a686dd989613cfb628896902c7a4f21c522.tar.bz2
volse-hubzilla-d92a4a686dd989613cfb628896902c7a4f21c522.zip
eliminate the obsolete "last-child" indicator
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php31
1 files changed, 16 insertions, 15 deletions
diff --git a/include/network.php b/include/network.php
index 221906296..54e7e023d 100644
--- a/include/network.php
+++ b/include/network.php
@@ -14,15 +14,16 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
return false;
@curl_setopt($ch, CURLOPT_HEADER, true);
-
+
if (!is_null($accept_content)){
curl_setopt($ch,CURLOPT_HTTPHEADER, array (
"Accept: " . $accept_content
));
}
-
+
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
- @curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
+ //@curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
+ @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Friendica)");
if(intval($timeout)) {
@@ -59,7 +60,6 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
$base = $s;
$curl_info = @curl_getinfo($ch);
$http_code = $curl_info['http_code'];
-
// logger('fetch_url:' . $http_code . ' data: ' . $s);
$header = '';
@@ -73,24 +73,22 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
}
if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
- $matches = array();
- preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
- $newurl = trim(array_pop($matches));
+ $matches = array();
+ preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
+ $newurl = trim(array_pop($matches));
if(strpos($newurl,'/') === 0)
$newurl = $url . $newurl;
- $url_parsed = @parse_url($newurl);
- if (isset($url_parsed)) {
- $redirects++;
- return fetch_url($newurl,$binary,$redirects,$timeout);
- }
- }
+ $url_parsed = @parse_url($newurl);
+ if (isset($url_parsed)) {
+ $redirects++;
+ return fetch_url($newurl,$binary,$redirects,$timeout);
+ }
+ }
$a->set_curl_code($http_code);
$body = substr($s,strlen($header));
-
$a->set_curl_headers($header);
-
@curl_close($ch);
return($body);
}}
@@ -798,6 +796,9 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
$a = get_app();
+ // Picture addresses can contain special characters
+ $s = htmlspecialchars_decode($s);
+
$matches = null;
$c = preg_match_all('/\[img\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER);
if($c) {