aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/Photo.php7
-rw-r--r--mod/parse_url.php32
-rwxr-xr-xmod/setup.php4
3 files changed, 15 insertions, 28 deletions
diff --git a/include/Photo.php b/include/Photo.php
index d470de0ad..8daac450e 100644
--- a/include/Photo.php
+++ b/include/Photo.php
@@ -672,9 +672,12 @@ function import_profile_photo($photo,$xchan) {
$filename = basename($photo);
- $img_str = fetch_url($photo,true);
-
$type = guess_image_type($photo,true);
+ $result = z_fetch_url($photo,true);
+
+ if($result['success'])
+ $img_str = $result['body'];
+
$img = new Photo($img_str, $type);
if($img->is_valid()) {
diff --git a/mod/parse_url.php b/mod/parse_url.php
index 600d3dc8b..d9bef2fa1 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -55,34 +55,18 @@ function completeurl($url, $scheme) {
function parseurl_getsiteinfo($url) {
$siteinfo = array();
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, 1);
- curl_setopt($ch, CURLOPT_NOBODY, 0);
- curl_setopt($ch, CURLOPT_TIMEOUT, 3);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch,CURLOPT_USERAGENT,'Opera/9.64(Windows NT 5.1; U; de) Presto/2.1.1');
-
- $header = curl_exec($ch);
- curl_close($ch);
-
- // Fetch the first mentioned charset. Can be in body or header
- if (preg_match('/charset=(.*?)['."'".'"\s\n]/', $header, $matches))
- $charset = trim(array_pop($matches));
- else
- $charset = "utf-8";
- $pos = strpos($header, "\r\n\r\n");
+ $result = z_fetch_url($url);
+ if(! $result['success'])
+ return $siteinfo;
- if ($pos)
- $body = trim(substr($header, $pos));
- else
- $body = $header;
+ $header = $result['header'];
+ $body = $result['body'];
- $body = mb_convert_encoding($body, "UTF-8", $charset);
- $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
+ $body = mb_convert_encoding($body, "UTF-8", $charset);
+ $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
- $doc = new DOMDocument();
+ $doc = new DOMDocument();
@$doc->loadHTML($body);
deletenode($doc, 'style');
diff --git a/mod/setup.php b/mod/setup.php
index b05b0cec3..37bb572f9 100755
--- a/mod/setup.php
+++ b/mod/setup.php
@@ -467,8 +467,8 @@ function check_htaccess(&$checks) {
$status = true;
$help = "";
if (function_exists('curl_init')){
- $test = fetch_url($a->get_baseurl()."/setup/testrewrite");
- if ($test!="ok") {
+ $test = z_fetch_url($a->get_baseurl()."/setup/testrewrite");
+ if ((! $test['success']) || ($test['body'] != "ok")) {
$status = false;
$help = t('Url rewrite in .htaccess is not working. Check your server configuration.');
}