findById((int)$_GET['id']);
if (is_null($User)) {
header("Location: log.php?search=User+" . (int)$_GET['id']);
exit;
}
$UserID = $User->id();
$Username = $User->username();
$userBonus = new Gazelle\User\Bonus($User);
$viewerBonus = new Gazelle\User\Bonus($Viewer);
$PRL = new Gazelle\User\PermissionRateLimit($User);
$donorMan = new Gazelle\Manager\Donation;
$tgMan = (new Gazelle\Manager\TGroup)->setViewer($Viewer);
if (!empty($_POST)) {
authorize();
foreach (['action', 'flsubmit', 'fltype'] as $arg) {
if (!isset($_POST[$arg])) {
error(403);
}
}
if ($_POST['action'] !== 'fltoken' || $_POST['flsubmit'] !== 'Send') {
error(403);
}
if (!preg_match('/^fl-(other-[1-4])$/', $_POST['fltype'], $match)) {
error(403);
}
$FL_OTHER_tokens = $viewerBonus->purchaseTokenOther($UserID, $match[1], $_POST['message'] ?? '');
if (!$FL_OTHER_tokens) {
error('Purchase of tokens not concluded. Either you lacked funds or they have chosen to decline FL tokens.');
}
}
if ($UserID == $Viewer->id()) {
$OwnProfile = true;
$User->forceCacheFlush(true);
$Preview = (int)($_GET['preview'] ?? 0);
if ($Preview == 1) {
$OwnProfile = false;
}
$FL_Items = [];
} else {
$OwnProfile = false;
//Don't allow any kind of previewing on others' profiles
$Preview = 0;
$FL_Items = $viewerBonus->getListOther($Viewer->bonusPointsTotal());
}
$FA_Key = null;
// Image proxy CTs
$imgProxy = new Gazelle\Util\ImageProxy($Viewer);
$DisplayCustomTitle = ($Viewer->permitted('site_proxy_images') && !empty($User->title()))
? preg_replace_callback('/src=("?)(http.+?)(["\s>])/',
fn ($m) => 'src=' . $m[1] . $imgProxy->process($m[2]) . $m[3], $User->title())
: $User->title();
$Paranoia = ($Preview == 1) ? explode(',', $_GET['paranoia']) : $User->paranoia();
function check_paranoia_here($Setting) {
global $Paranoia, $Class, $UserID, $Preview;
if ($Preview == 1) {
return check_paranoia($Setting, $Paranoia ?? [], $Class);
} else {
return check_paranoia($Setting, $Paranoia ?? [], $Class, $UserID);
}
}
[$ClassRatio, $Buffer] = $User->buffer();
View::show_header($Username, ['js' => 'jquery.imagesloaded,jquery.wookmark,user,bbcode,requests,lastfm,comments,info_paster', 'css' => 'tiles']);
echo $Twig->render('user/header.twig', [
'badge_list' => (new Gazelle\User\Privilege($User))->badgeList(),
'freeleech' => [
'item' => $FL_Items,
'other' => $FL_OTHER_tokens ?? null,
],
'hourly_rate' => $userBonus->hourlyRate(),
'preview_user' => $Preview ? $userMan->findById(PARANOIA_PREVIEW_USER) : $Viewer,
'user' => $User,
'userMan' => $userMan,
'viewer' => $Viewer,
]);
if ($OwnProfile || $Viewer->permitted('users_mod')) {
$nextClass = $User->nextClass();
if ($nextClass) {
?>
permitted('users_mod') && $User->onRatioWatch()) { ?>
Ratio watch
This user is currently on ratio watch and must upload =Format::get_size(($User->downloadedSize() * $User->requiredRatio()) - $User->uploadedSize())?> in the next =time_diff($User->ratioWatchExpiry()) ?>, or their leeching privileges will be revoked. Amount downloaded while on ratio watch: =Format::get_size($User->downloadedSize() - $User->downloadedOnRatioWatch())?>
= display_str($User->infoTitle()) ?>
Hide
= $User->infoProfile() ? Text::full_format($User->infoProfile()) : 'This profile is currently empty.' ?>
enabledDonorRewards();
$ProfileRewards = $User->profileDonorRewards();
for ($i = 1; $i <= 4; $i++) {
if ($EnabledRewards['HasProfileInfo' . $i] && $ProfileRewards['ProfileInfo' . $i]) {
?>
=!empty($ProfileRewards['ProfileInfoTitle' . $i]) ? display_str($ProfileRewards['ProfileInfoTitle' . $i]) : "Extra Profile " . ($i + 1)?>
Hide
= Text::full_format($ProfileRewards['ProfileInfo' . $i]); ?>
render('user/recent.twig', [
'id' => $UserID,
'recent' => array_map(fn ($id) => $tgMan->findById($id), $User->recentSnatchList()),
'title' => 'Snatches',
'type' => 'snatched',
]);
}
if (check_paranoia_here('uploads')) {
echo $Twig->render('user/recent.twig', [
'id' => $UserID,
'recent' => array_map(fn ($id) => $tgMan->findById($id), $User->recentUploadList()),
'title' => 'Uploads',
'type' => 'uploaded',
]);
}
if ($OwnProfile || !$User->hasAttr('hide-vote-recent') || $Viewer->permitted('view-release-votes')) {
echo $Twig->render('user/recent-vote.twig', [
'recent' => $vote->recent($tgMan),
'show_link' => $OwnProfile || !$User->hasAttr('hide-vote-history') || $Viewer->permitted('view-release-votes'),
'user_id' => $UserID,
]);
}
$FirstCol = true;
$Collages = (new Gazelle\Manager\Collage)->findPersonalByUserId($UserID);
foreach ($Collages as $collage) {
?>
permitted('users_edit_usernames')) {
[$linkGroupId, $comments, $list] = (new Gazelle\Manager\UserLink($User))->info();
echo $Twig->render('user/linked.twig', [
'auth' => $Viewer->auth(),
'comments' => $comments,
'group_id' => $linkGroupId,
'hash' => sha1($comments ?? ''),
'list' => $list,
'user_id' => $UserID,
]);
}
if ($Viewer->permitted('users_view_invites')) {
$tree = new Gazelle\User\InviteTree($User);
if ($tree->hasInvitees()) {
?>
= $Twig->render('user/invite-tree.twig', [
...(new Gazelle\User\InviteTree($User))->details($userMan, $Viewer),
'user' => $User,
'viewer' => $Viewer,
]) ?>
permitted('users_give_donor')) {
echo $Twig->render('donation/history.twig', [
'history' => $User->donorHistory(),
]);
}
// Requests
if (!$Viewer->disableRequests() && check_paranoia_here('requestsvoted_list')) {
$requestList = (new Gazelle\Manager\Request)->findUnfilledByUser($User, 100);
$hide = count($requestList) > 5;
if ($requestList) {
?>
|
Request Name
|
Vote
|
Bounty
|
Added
|
|
= $request->smartLink() ?>
|
= $request->userVotedTotal() ?>
permitted('site_vote')) { ?>
+
|
= Format::get_size($request->bountyTotal()) ?>
|
= time_diff($request->created()) ?>
|
permitted('users_mod') || $Viewer->isStaffPMReader()) {
echo $Twig->render('admin/staffpm-list.twig', [
'list' => (new Gazelle\Staff($User))->userStaffPmList($Viewer->id()),
]);
}
// Displays a table of forum warnings viewable only to Forum Moderators
if ($User->isStaff() && $Viewer->permitted('users_warn')) {
$ForumWarnings = $User->forumWarning();
if ($ForumWarnings) {
?>
permitted('users_mod') || $Viewer->isStaff()) { ?>
permitted('users_mod') */ ?>