findById($UserID);
if (is_null($user)) {
return "Unknown [$UserID]";
}
global $Viewer; // FIXME this is wrong
$imgProxy = new \Gazelle\Util\ImageProxy($Viewer);
$Classes = $userMan->classList();
if ($user->primaryClass() < $Classes[MOD]['Level']) {
$OverrideParanoia = $Viewer->permitted('users_override_paranoia', $user->primaryClass());
} else {
// Don't override paranoia for mods who don't want to show their donor heart
$OverrideParanoia = false;
}
$Username = $user->username();
if ($IsDonorForum) {
[$Prefix, $Suffix, $HasComma] = $user->donorTitles();
$Username = "$Prefix $Username" . ($HasComma ? ', ' : ' ') . $Suffix;
}
if ($Title) {
$Str = "$Username";
} else {
$Str = "$Username";
}
if ($Badges) {
$DonorRank = $user->donorRank();
if ($DonorRank == 0 && (new \Gazelle\User\Privilege($user))->isDonor()) {
$DonorRank = 1;
}
if ($DonorRank > 0 && ($OverrideParanoia || $user->propertyVisible($Viewer, 'hide_donor_heart'))) {
$EnabledRewards = $user->enabledDonorRewards();
$DonorRewards = $user->donorRewards();
$IconText = ($EnabledRewards['HasDonorIconMouseOverText'] && !empty($DonorRewards['IconMouseOverText']))
? display_str($DonorRewards['IconMouseOverText']) : 'Donor';
$IconLink = ($EnabledRewards['HasDonorIconLink'] && !empty($DonorRewards['CustomIconLink']))
? display_str($DonorRewards['CustomIconLink']) : 'donate.php';
if ($EnabledRewards['HasCustomDonorIcon'] && !empty($DonorRewards['CustomIcon'])) {
$IconImage = $imgProxy->process($DonorRewards['CustomIcon'], 'donoricon', $UserID);
} else {
if ($user->specialDonorRank() === MAX_SPECIAL_RANK) {
$DonorHeart = 6;
} elseif ($DonorRank === 5) {
$DonorHeart = 4; // Two points between rank 4 and 5
} elseif ($DonorRank >= MAX_RANK) {
$DonorHeart = 5;
} else {
$DonorHeart = $DonorRank;
}
if ($DonorHeart === 1) {
$IconImage = STATIC_SERVER . '/common/symbols/donor.png';
} else {
$IconImage = STATIC_SERVER . "/common/symbols/donor_{$DonorHeart}.png";
}
}
$Str .= "
";
}
}
$Str .= ($IsWarned && $user->isWarned()) ? '
' : '';
$Str .= ($IsEnabled && $user->isDisabled())
? '
'
: '';
if ($Badges) {
$badgeList = [];
$privilege = new Gazelle\User\Privilege($user);
foreach ($privilege->badgeList() as $badge => $name) {
$badgeList[] = '' . $badge . '';
}
if ($badgeList) {
$Str .= ' '.implode(' ', $badgeList);
}
}
if ($Class) {
$userClass = $userMan->userclassName($user->primaryClass());
if ($Title) {
$Str .= " ($userClass)";
} else {
$Str .= " ($userClass)";
}
}
if ($Title) {
// Image proxy CTs
$userTitle = $user->title();
if ($Viewer->permitted('site_proxy_images') && !empty($userTitle)) {
$userTitle = preg_replace_callback('/src=("?)(http.+?)(["\s>])/',
function($Matches) use ($imgProxy) {
return 'src=' . $Matches[1] . $imgProxy->process($Matches[2]) . $Matches[3];
}, $userTitle
);
}
if ($userTitle) {
$Str .= ' (' . $userTitle . ')';
}
}
return $Str;
}
}