include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
include(SERVER_ROOT.'/sections/requests/functions.php');
if (empty($_GET['id']) || !is_numeric($_GET['id']))
error(404);
$UserID = $_GET['id'];
if ($UserID == $LoggedUser['ID']) {
$OwnProfile = true;
} else {
$OwnProfile = false;
}
if (check_perms('users_mod')) { // Person viewing is a staff member
$DB->query("SELECT
m.Username,
m.Email,
m.LastAccess,
m.IP,
p.Level AS Class,
m.Uploaded,
m.Downloaded,
m.RequiredRatio,
m.Title,
m.torrent_pass,
m.Enabled,
m.Paranoia,
m.Invites,
m.can_leech,
m.Visible,
i.JoinDate,
i.Info,
i.Avatar,
i.Country,
i.AdminComment,
i.Donor,
i.Artist,
i.Warned,
i.SupportFor,
i.RestrictedForums,
i.PermittedForums,
i.Inviter,
inviter.Username,
COUNT(posts.id) AS ForumPosts,
i.RatioWatchEnds,
i.RatioWatchDownload,
i.DisableAvatar,
i.DisableInvites,
i.DisablePosting,
i.DisableForums,
i.DisableTagging,
i.DisableUpload,
i.DisableWiki,
i.DisablePM,
i.DisableIRC,
i.DisableRequests,
i.HideCountryChanges,
m.FLTokens,
SHA1(i.AdminComment)
FROM users_main AS m
JOIN users_info AS i ON i.UserID = m.ID
LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID
LEFT JOIN permissions AS p ON p.ID=m.PermissionID
LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.ID
WHERE m.ID = '".$UserID."' GROUP BY AuthorID");
if ($DB->record_count() == 0) { // If user doesn't exist
header("Location: log.php?search=User+".$UserID);
}
list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $CustomTitle, $torrent_pass, $Enabled, $Paranoia, $Invites, $DisableLeech, $Visible, $JoinDate, $Info, $Avatar, $Country, $AdminComment, $Donor, $Artist, $Warned, $SupportFor, $RestrictedForums, $PermittedForums, $InviterID, $InviterName, $ForumPosts, $RatioWatchEnds, $RatioWatchDownload, $DisableAvatar, $DisableInvites, $DisablePosting, $DisableForums, $DisableTagging, $DisableUpload, $DisableWiki, $DisablePM, $DisableIRC, $DisableRequests, $DisableCountry, $FLTokens, $CommentHash) = $DB->next_record(MYSQLI_NUM, array(8,11));
} else { // Person viewing is a normal user
$DB->query("SELECT
m.Username,
m.Email,
m.LastAccess,
m.IP,
p.Level AS Class,
m.Uploaded,
m.Downloaded,
m.RequiredRatio,
m.Enabled,
m.Paranoia,
m.Invites,
m.Title,
m.torrent_pass,
m.can_leech,
i.JoinDate,
i.Info,
i.Avatar,
m.FLTokens,
i.Country,
i.Donor,
i.Warned,
COUNT(posts.id) AS ForumPosts,
i.Inviter,
i.DisableInvites,
inviter.username
FROM users_main AS m
JOIN users_info AS i ON i.UserID = m.ID
LEFT JOIN permissions AS p ON p.ID=m.PermissionID
LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID
LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.ID
WHERE m.ID = $UserID GROUP BY AuthorID");
if ($DB->record_count() == 0) { // If user doesn't exist
header("Location: log.php?search=User+".$UserID);
}
list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $Enabled, $Paranoia, $Invites, $CustomTitle, $torrent_pass, $DisableLeech, $JoinDate, $Info, $Avatar, $FLTokens, $Country, $Donor, $Warned, $ForumPosts, $InviterID, $DisableInvites, $InviterName, $RatioWatchEnds, $RatioWatchDownload) = $DB->next_record(MYSQLI_NUM, array(9,11));
}
// Image proxy CTs
$DisplayCustomTitle = $CustomTitle;
if (check_perms('site_proxy_images') && !empty($CustomTitle)) {
$DisplayCustomTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) {
return 'src='.$Matches[1].'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($Matches[2]).$Matches[3];
}, $CustomTitle);
}
$Paranoia = unserialize($Paranoia);
if (!is_array($Paranoia)) {
$Paranoia = array();
}
$ParanoiaLevel = 0;
foreach ($Paranoia as $P) {
$ParanoiaLevel++;
if (strpos($P, '+')) {
$ParanoiaLevel++;
}
}
$JoinedDate = time_diff($JoinDate);
$LastAccess = time_diff($LastAccess);
function check_paranoia_here($Setting) {
global $Paranoia, $Class, $UserID;
return check_paranoia($Setting, $Paranoia, $Class, $UserID);
}
$Badges=($Donor) ? '' : '';
$Badges.=($Warned!='0000-00-00 00:00:00') ? '' : '';
$Badges.=($Enabled == '1' || $Enabled == '0' || !$Enabled) ? '': '';
View::show_header($Username,'user,bbcode,requests,jquery,lastfm');
?>
=$Username?>
if (!$OwnProfile) { ?>
Send message
if (check_perms("users_mod")) {
$DB->query("SELECT PushService FROM users_push_notifications WHERE UserID = '$UserID'");
if ($DB->record_count() > 0) { ?>
Push user
}
}
$DB->query("SELECT FriendID FROM friends WHERE UserID='$LoggedUser[ID]' AND FriendID='$UserID'");
if ($DB->record_count() == 0) { ?>
Add to friends
}?>
Report user
}
if (check_perms('users_edit_profiles', $Class)) {
?>
Settings
}
if (check_perms('users_view_invites', $Class)) {
?>
Invites
}
if (check_perms('admin_manage_permissions', $Class)) {
?>
Permissions
}
if (check_perms('users_logout', $Class) && check_perms('users_view_ips', $Class)) {
?>
Sessions
}
if (check_perms('admin_reports')) {
?>
Reports
}
if (check_perms('users_mod')) {
?>
FL tokens
}
if (check_perms('admin_clear_cache') && check_perms('users_override_paranoia')) {
?>
Clear cache
} ?>
if ($RatioWatchEnds!='0000-00-00 00:00:00'
&& (time() < strtotime($RatioWatchEnds))
&& ($Downloaded*$RequiredRatio)>$Uploaded
) {
?>
Ratio watch
This user is currently on ratio watch and must upload =Format::get_size(($Downloaded*$RequiredRatio)-$Uploaded)?> in the next =time_diff($RatioWatchEnds)?>, or their leeching privileges will be revoked. Amount downloaded while on ratio watch: =Format::get_size($Downloaded-$RatioWatchDownload)?>
} ?>
Profile if ($CustomTitle) {?> -
echo html_entity_decode($DisplayCustomTitle); } ?>
=!empty($Badges)?"$Badges ":''?>Hide
if (!$Info) { ?>
This profile is currently empty.
} else {
echo $Text->full_format($Info);
}
?>
if ($Snatched > 4 && check_paranoia_here('snatched')) {
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
if (!is_array($RecentSnatches)) {
$DB->query("SELECT
g.ID,
g.Name,
g.WikiImage
FROM xbt_snatched AS s
INNER JOIN torrents AS t ON t.ID=s.fid
INNER JOIN torrents_group AS g ON t.GroupID=g.ID
WHERE s.uid='$UserID'
AND g.CategoryID='1'
AND g.WikiImage <> ''
GROUP BY g.ID
ORDER BY s.tstamp DESC
LIMIT 5");
$RecentSnatches = $DB->to_array();
$Artists = Artists::get_artists($DB->collect('ID'));
foreach ($RecentSnatches as $Key => $SnatchInfo) {
$RecentSnatches[$Key]['Artist'] = Artists::display_artists($Artists[$SnatchInfo['ID']], false, true);
}
$Cache->cache_value('recent_snatches_'.$UserID, $RecentSnatches, 0); //inf cache
}
?>
Recent snatches |
foreach ($RecentSnatches as $RS) { ?>
|
} ?>
}
if (!isset($Uploads)) {
$Uploads = 0;
}
if ($Uploads > 4 && check_paranoia_here('uploads')) {
$RecentUploads = $Cache->get_value('recent_uploads_'.$UserID);
if (!is_array($RecentUploads)) {
$DB->query("SELECT
g.ID,
g.Name,
g.WikiImage
FROM torrents_group AS g
INNER JOIN torrents AS t ON t.GroupID=g.ID
WHERE t.UserID='$UserID'
AND g.CategoryID='1'
AND g.WikiImage <> ''
GROUP BY g.ID
ORDER BY t.Time DESC
LIMIT 5");
$RecentUploads = $DB->to_array();
$Artists = Artists::get_artists($DB->collect('ID'));
foreach ($RecentUploads as $Key => $UploadInfo) {
$RecentUploads[$Key]['Artist'] = Artists::display_artists($Artists[$UploadInfo['ID']], false, true);
}
$Cache->cache_value('recent_uploads_'.$UserID, $RecentUploads, 0); //inf cache
}
?>
Recent uploads |
foreach ($RecentUploads as $RU) { ?>
|
} ?>
}
$DB->query("SELECT ID, Name FROM collages WHERE UserID='$UserID' AND CategoryID='0' AND Deleted='0' ORDER BY Featured DESC, Name ASC");
$Collages = $DB->to_array();
$FirstCol = true;
foreach ($Collages as $CollageInfo) {
list($CollageID, $CName) = $CollageInfo;
$DB->query("SELECT ct.GroupID,
tg.WikiImage,
tg.CategoryID
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID
WHERE ct.CollageID='$CollageID'
ORDER BY ct.Sort LIMIT 5");
$Collage = $DB->to_array();
?>
=display_str($CName)?> - See full
=$FirstCol?'Hide':'Show'?>
|
foreach ($Collage as $C) {
$Group = Torrents::get_groups(array($C['GroupID']));
$Group = array_pop($Group['matches']);
extract(Torrents::array_group($Group));
$Name = '';
$Name .= Artists::display_artists(array('1'=>$Artists), false, true);
$Name .= $GroupName;
?>
|
} ?>
$FirstCol = false;
}
// Linked accounts
if (check_perms('users_mod')) {
include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
user_dupes_table($UserID);
}
if ((check_perms('users_view_invites')) && $Invited > 0) {
include(SERVER_ROOT.'/classes/class_invite_tree.php');
$Tree = new INVITE_TREE($UserID, array('visible'=>false));
?>
}
// Requests
if (check_paranoia_here('requestsvoted_list')) {
$DB->query("SELECT
r.ID,
r.CategoryID,
r.Title,
r.Year,
r.TimeAdded,
COUNT(rv.UserID) AS Votes,
SUM(rv.Bounty) AS Bounty
FROM requests AS r
LEFT JOIN users_main AS u ON u.ID=UserID
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
WHERE r.UserID = ".$UserID."
AND r.TorrentID = 0
GROUP BY r.ID
ORDER BY Votes DESC");
if ($DB->record_count() > 0) {
$Requests = $DB->to_array();
?>
Request name
|
Vote
|
Bounty
|
Added
|
foreach ($Requests as $Request) {
list($RequestID, $CategoryID, $Title, $Year, $TimeAdded, $Votes, $Bounty) = $Request;
$Request = Requests::get_requests(array($RequestID));
$Request = $Request['matches'][$RequestID];
if (empty($Request)) {
continue;
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $ReleaseType,
$BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request;
$CategoryName = $Categories[$CategoryID - 1];
if ($CategoryName == 'Music') {
$ArtistForm = get_request_artists($RequestID);
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
$FullName = $ArtistLink."$Title [$Year]";
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
$FullName = "$Title [$Year]";
} else {
$FullName ="$Title";
}
$Row = (empty($Row) || $Row == 'a') ? 'b' : 'a';
?>
=$FullName ?>
|
=$Votes?>
if (check_perms('site_vote')) { ?>
+
} ?>
|
=Format::get_size($Bounty)?>
|
=time_diff($TimeAdded) ?>
|
} ?>
}
}
$IsFLS = $LoggedUser['ExtraClasses'][41];
if (check_perms('users_mod', $Class) || $IsFLS) {
$UserLevel = $LoggedUser['EffectiveClass'];
$DB->query("SELECT
SQL_CALC_FOUND_ROWS
ID,
Subject,
Status,
Level,
AssignedToUser,
Date,
ResolverID
FROM staff_pm_conversations
WHERE UserID = $UserID AND (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."')
ORDER BY Date DESC");
if ($DB->record_count()) {
$StaffPMs = $DB->to_array();
?>
Subject |
Date |
Assigned to |
Resolved by |
foreach ($StaffPMs as $StaffPM) {
list($ID, $Subject, $Status, $Level, $AssignedTo, $Date, $ResolverID) = $StaffPM;
// Get assigned
if ($AssignedToUser == '') {
// Assigned to class
$Assigned = ($Level == 0) ? "First Line Support" : $ClassLevels[$Level]['Name'];
// No + on Sysops
if ($Assigned != 'Sysop') {
$Assigned .= "+";
}
} else {
// Assigned to user
$Assigned = Users::format_username($UserID, true, true, true, true);
}
if ($ResolverID) {
$Resolver = Users::format_username($ResolverID, true, true, true, true);
} else {
$Resolver = "(unresolved)";
}
?>
=display_str($Subject)?> |
=time_diff($Date, 2, true)?> |
=$Assigned?> |
=$Resolver?> |
} ?>
}
}
?>
// Displays a table of forum warnings viewable only to Forum Moderators
if ($LoggedUser['Class'] == 650 && check_perms('users_warn', $Class)) {
$DB->query("SELECT Comment FROM users_warnings_forums WHERE UserID = '$UserID'");
list($ForumWarnings) = $DB->next_record();
if ($DB->record_count() > 0) {
?>
}
}
if (check_perms('users_mod', $Class)) { ?>
} ?>
View::show_footer(); ?>