Commit 3ad2a6df authored by Mario's avatar Mario

Merge branch 'dev' into 'dev'

Fix URL and use z_fetch_url()

See merge request !222
parents e30a0ced 81954a4b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* Name: Gravatar Support * Name: Gravatar Support
* Description: If there is no avatar image for a new user or contact this plugin will look for one at Gravatar. * Description: If there is no avatar image for a new user or contact this plugin will look for one at Gravatar.
* Version: 1.1 * Version: 1.1.1
* MinVersion: 1.14 * MinVersion: 1.14
* Author: Klaus Weidenbach <http://friendica.dszdw.net/profile/klaus> * Author: Klaus Weidenbach <http://friendica.dszdw.net/profile/klaus>
* Portig to Hubzilla: Sergey Lukin <mailto:sergey.lukin@cybergnosis.su> * Portig to Hubzilla: Sergey Lukin <mailto:sergey.lukin@cybergnosis.su>
...@@ -90,17 +90,17 @@ function gravatar_get_profile_photo($a, &$b) { ...@@ -90,17 +90,17 @@ function gravatar_get_profile_photo($a, &$b) {
$rating = 'g'; // suitable for display on all websites with any audience type $rating = 'g'; // suitable for display on all websites with any audience type
} }
$hash = md5(trim(strtolower($email))); $hash = md5(trim(strtolower($email)));
$url = 'https://secure.gravatar.com/avatar/' . $hash . '.jpg?s=' . $resolutions[$imgscale] .'&r=' . $rating; $url = 'https://www.gravatar.com/avatar/' . $hash . '.jpg?s=' . $resolutions[$imgscale] .'&r=' . $rating;
if ($default_avatar != "gravatar" && $default_avatar != "hub_default") { if ($default_avatar != "gravatar" && $default_avatar != "hub_default") {
$url .= '&d=' . $default_avatar; $url .= '&d=' . $default_avatar;
} elseif ($default_avatar == "hub_default") { } elseif ($default_avatar == "hub_default") {
$url .= '&d=' . App::$config['system']['baseurl'] . "/" . get_default_profile_photo($resolutions[$imgscale]); $url .= '&d=' . App::$config['system']['baseurl'] . "/" . get_default_profile_photo($resolutions[$imgscale]);
} }
$data = file_get_contents($url); $i = z_fetch_url($url);
if ($data) { if ($i['success']) {
$b['mimetype'] = 'image/jpg'; $b['mimetype'] = 'image/jpg';
$b['data'] = $data; $b['data'] = $i['body'];
} }
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment