Fix gravatar in main/admin/user_list.php - refs #4507

1.10.x
Imanol Losada 11 years ago
parent 289cafb8c3
commit 25281a24a2
  1. 16
      main/inc/lib/usermanager.lib.php

@ -1237,7 +1237,7 @@ class UserManager
$noPicturePath = array('dir' => $base.'img/', 'file' => 'unknown.jpg');
if (empty($id) || empty($type)) {
if ((empty($id) || empty($type)) && !api_get_configuration_value('gravatar_enabled')) {
return $anonymous ? $noPicturePath : array('dir' => '', 'file' => '');
}
@ -1247,7 +1247,7 @@ class UserManager
$sql = "SELECT email, picture_uri FROM $user_table WHERE user_id=".$user_id;
$res = Database::query($sql);
if (!Database::num_rows($res)) {
if (!Database::num_rows($res) && !api_get_configuration_value('gravatar_enabled')) {
return $anonymous ? $noPicturePath : array('dir' => '', 'file' => '');
}
@ -1265,9 +1265,6 @@ class UserManager
$dir = $base.$userPath;
}
if (empty($picture_filename) ||
(!empty($picture_filename) && !file_exists($systemImagePath.$picture_filename))
) {
if (api_get_configuration_value('gravatar_enabled')) {
$avatarSize = api_getimagesize($noPicturePath['dir'].$noPicturePath['file']);
$avatarSize = $avatarSize['width'] > $avatarSize['height'] ?
@ -1282,10 +1279,10 @@ class UserManager
)
);
}
if ($anonymous) {
if (empty($picture_filename) && $anonymous) {
return $noPicturePath;
}
}
return array('dir' => $dir, 'file' => $picture_filename);
}
@ -3260,8 +3257,10 @@ class UserManager
break;
}
$picture['file'] = api_get_path(WEB_CODE_PATH).'img/'.$picture_file;
if (!api_get_configuration_value('gravatar_enabled')) {
return $picture;
}
}
switch ($size_picture) {
case USER_IMAGE_SIZE_ORIGINAL :
@ -3318,6 +3317,9 @@ class UserManager
}
}
}
if (api_get_configuration_value('gravatar_enabled')) {
$picture['file'] = $image_array['file'];
}
return $picture;
}

Loading…
Cancel
Save