web: if using HTTPS, use it also for gravatar avatars (from Janus).

Include a function gravatar_update() in db_update.php to fix existing avatar URLs
This commit is contained in:
David Anderson 2015-07-24 14:09:11 -07:00
parent 3e6ae6f48d
commit 776e6fec64
3 changed files with 10 additions and 2 deletions

View File

@ -1015,6 +1015,14 @@ function workunit_big_ids() {
");
}
// run this is your projects uses HTTPS, to patch up the gravatar URLs
//
function gravatar_update() {
do_query("update forum_preferences
SET avatar = REPLACE(avatar, 'http://www.gravatar.com', '//www.gravatar.com')
");
}
// Updates are done automatically if you use "upgrade".
//
// If you need to do updates manually,

View File

@ -80,7 +80,7 @@ if ($avatar_type==0){
}
$avatar_url="";
} elseif ($avatar_type == 1) {
$avatar_url = "http://www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&d=identicon";
$avatar_url = "//www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&d=identicon";
} elseif ($avatar_type==2){
if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) {
if ($_FILES['picture']['tmp_name']!="") {

View File

@ -54,7 +54,7 @@ if (!DISABLE_FORUMS) {
$select_0 = $select_1 = $select_2 = "";
if (strlen($user->prefs->avatar)){
if (substr($user->prefs->avatar, 0, 4) == 'http') { // Gravatar
if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar
$select_1 = "checked=\"true\"";
} else {
$select_2 = "checked=\"true\"";