torrents.Time';
$Conditions[] = "comments.AuthorID != $UserID";
$Title = 'Comments left on torrents ' . ($Self ? 'you\'ve' : $Username . ' has') . ' uploaded';
$Header = 'Comments left on torrents ' . ($Self ? 'you\'ve' : Users::format_username($UserID, false, false, false) . ' has') . ' uploaded';
} else {
$Type = 'default';
$Conditions[] = "comments.AuthorID = $UserID";
$Title = 'Torrent comments left by ' . ($Self ? 'you' : $Username);
$Header = 'Torrent comments left by ' . ($Self ? 'you' : Users::format_username($UserID, false, false, false));
}
break;
}
$Join[] = "JOIN comments ON comments.Page = '$Action' AND comments.PageID = $Field1";
$Join = implode("\n\t\t", $Join);
$Conditions = implode(" AND ", $Conditions);
$Conditions = ($Conditions ? 'WHERE ' . $Conditions : '');
$SQL = "
SELECT
SQL_CALC_FOUND_ROWS
comments.AuthorID,
comments.Page,
comments.PageID,
$Field2,
comments.ID,
comments.Body,
comments.AddedTime,
comments.EditedTime,
comments.EditedUserID
FROM $Table
$Join
$Conditions
GROUP BY comments.ID
ORDER BY comments.ID DESC
LIMIT $Limit";
$Comments = $DB->query($SQL);
$Count = $DB->record_count();
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
$Pages = Format::get_pages($Page, $Results, $PerPage, 11);
$DB->set_query_id($Comments);
if ($Action == 'requests') {
$RequestIDs = array_flip(array_flip($DB->collect('PageID')));
$Artists = [];
foreach ($RequestIDs as $RequestID) {
$Artists[$RequestID] = Requests::get_artists($RequestID);
}
$DB->set_query_id($Comments);
} elseif ($Action == 'torrents') {
$GroupIDs = array_flip(array_flip($DB->collect('PageID')));
$Artists = Artists::get_artists($GroupIDs);
$DB->set_query_id($Comments);
}
$LinkID = (!$Self ? '&id=' . $UserID : '');
$ActionLinks = $TypeLinks = [];
if ($Action != 'artist') {
$ActionLinks[] = 'Artist comments';
}
if ($Action != 'collages') {
$ActionLinks[] = 'Collage comments';
}
if ($Action != 'requests') {
$ActionLinks[] = 'Request comments';
}
if ($Action != 'torrents') {
$ActionLinks[] = 'Torrent comments';
}
switch ($Action) {
case 'collages':
$BaseLink = 'comments.php?action=collages' . $LinkID;
if ($Type != 'default') {
$TypeLinks[] = 'Display comments left on collages ' . ($Self ? 'you\'ve' : $Username . ' has') . ' made';
}
if ($Type != 'created') {
$TypeLinks[] = 'Display comments left on ' . ($Self ? 'your collages' : 'collages created by ' .$Username) . '';
}
if ($Type != 'contributed') {
$TypeLinks[] = 'Display comments left on collages ' . ($Self ? 'you\'ve' : $Username . ' has') . ' contributed to';
}
break;
case 'requests':
$BaseLink = 'comments.php?action=requests' . $LinkID;
if ($Type != 'default') {
$TypeLinks[] = 'Display comments left on requests ' . ($Self ? 'you\'ve' : $Username . 'has') . ' made';
}
if ($Type != 'created') {
//
//your requests
$TypeLinks[] = 'Display comments left on requests ' . ($Self ? 'you' : $Username) . ' created';
}
if ($Type != 'voted') {
$TypeLinks[] = 'Display comments left on requests ' . ($Self ? 'you\'ve' : $Username . ' has') . ' voted on';
}
break;
case 'torrents':
if ($Type != 'default') {
$TypeLinks[] = 'Display comments left on torrents ' . ($Self ? 'you\'ve' : $Username . ' has' ) . ' made';
}
if ($Type != 'uploaded') {
$TypeLinks[] = 'Display comments left on torrents ' . ($Self ? 'you\'ve' : $Username . ' has') . ' uploaded';
}
break;
}
$Links = implode(' ', $ActionLinks) . (count($TypeLinks) ? '
' . implode(' ', $TypeLinks) : '');
View::show_header($Title, 'bbcode,comments');
?>