mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7565 - Refactor way of retrieving user's picture
This commit is contained in:
@@ -1264,19 +1264,13 @@ class UserRights
|
||||
{
|
||||
$sUserPicturesFolder = 'images/user-pictures/';
|
||||
$sUserPicturePlaceholderPrefKey = 'user_picture_placeholder';
|
||||
$sPictureUrl = null;
|
||||
|
||||
// First, check cache
|
||||
if (array_key_exists($sLogin, static::$m_aCacheContactPictureAbsUrl)) {
|
||||
return static::$m_aCacheContactPictureAbsUrl[$sLogin];
|
||||
}
|
||||
|
||||
// Then, the default picture
|
||||
if ($bAllowDefaultPicture === true) {
|
||||
$sPictureUrl = utils::GetAbsoluteUrlAppRoot().$sUserPicturesFolder.'user-profile-default-256px.png';
|
||||
} else {
|
||||
$sPictureUrl = null;
|
||||
}
|
||||
|
||||
// Then check if the user has a contact attached and if it has an picture defined
|
||||
$sContactId = UserRights::GetContactId($sLogin);
|
||||
if (!empty($sContactId)) {
|
||||
@@ -1323,6 +1317,11 @@ class UserRights
|
||||
}
|
||||
// Else, no contact and no login, then it's for an unknown origin (system, extension, ...)
|
||||
|
||||
// Then, the default picture
|
||||
if (utils::IsNullOrEmptyString($sPictureUrl) && $bAllowDefaultPicture === true) {
|
||||
$sPictureUrl = utils::GetAbsoluteUrlAppRoot().$sUserPicturesFolder.'user-profile-default-256px.png';
|
||||
}
|
||||
|
||||
// Update cache
|
||||
static::$m_aCacheContactPictureAbsUrl[$sLogin] = $sPictureUrl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user