From bd33e0486d992eb8904f84862c052ee2f9d01d55 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 1 Dec 2013 00:16:02 -0800 Subject: deprecate a->get_curl_code() and $a->get_curl_headers() --- include/network.php | 192 ++++------------------------------------------------ 1 file changed, 12 insertions(+), 180 deletions(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 99a0a8e2b..367e0df56 100644 --- a/include/network.php +++ b/include/network.php @@ -65,7 +65,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_ if($binary) @curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); - $a->set_curl_code(0); +// $a->set_curl_code(0); // don't let curl abort the entire application // if it throws any errors. @@ -101,10 +101,10 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_ } } - $a->set_curl_code($http_code); +// $a->set_curl_code($http_code); $body = substr($s,strlen($header)); - $a->set_curl_headers($header); +// $a->set_curl_headers($header); @curl_close($ch); return($body); } @@ -156,7 +156,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr); } - $a->set_curl_code(0); +// $a->set_curl_code(0); // don't let curl abort the entire application // if it throws any errors. @@ -195,10 +195,10 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0) } } } - $a->set_curl_code($http_code); +// $a->set_curl_code($http_code); $body = substr($s,strlen($header)); - $a->set_curl_headers($header); +// $a->set_curl_headers($header); curl_close($ch); return($body); @@ -586,175 +586,6 @@ function webfinger($s, $debug = false) { } -function lrdd($uri, $debug = false) { - - $a = get_app(); - - // default priority is host priority, host-meta first - - $priority = 'host'; - - // All we have is an email address. Resource-priority is irrelevant - // because our URI isn't directly resolvable. - - if(strstr($uri,'@')) { - return(webfinger($uri)); - } - - // get the host meta file - - $host = @parse_url($uri); - - if($host) { - $url = ((x($host,'scheme')) ? $host['scheme'] : 'http') . '://'; - $url .= $host['host'] . '/.well-known/host-meta' ; - } - else - return array(); - - logger('lrdd: constructed url: ' . $url); - - $xml = fetch_url($url); - $headers = $a->get_curl_headers(); - - if (! $xml) - return array(); - - logger('lrdd: host_meta: ' . $xml, LOGGER_DATA); - - if(! stristr($xml,'].*)>.*rel\=[\'\"]lrdd[\'\"]/',$line,$matches)) { - return(fetch_xrd_links($matches[1])); - break; - } - } - } - } - - - // priority 'resource' - - - $html = fetch_url($uri); - $headers = $a->get_curl_headers(); - logger('lrdd: headers=' . $headers, LOGGER_DEBUG); - - // don't try and parse raw xml as html - if(! strstr($html,'getElementsByTagName('link'); - foreach($items as $item) { - $x = $item->getAttribute('rel'); - if($x == "lrdd") { - $pagelink = $item->getAttribute('href'); - break; - } - } - } - } - - if(isset($pagelink)) - return(fetch_xrd_links($pagelink)); - - // next look in HTTP headers - - $lines = explode("\n",$headers); - if(count($lines)) { - foreach($lines as $line) { - // TODO alter the following regex to support multiple relations (space separated) - if((stristr($line,'link:')) && preg_match('/<([^>].*)>.*rel\=[\'\"]lrdd[\'\"]/',$line,$matches)) { - $pagelink = $matches[1]; - break; - } - // don't try and run feeds through the html5 parser - if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml')))) - return array(); - if(stristr($html,'is_valid()) { $orig_width = $ph->getWidth(); $orig_height = $ph->getHeight(); -- cgit v1.2.3