query("UPDATE users_notify_quoted SET UnRead = '0' WHERE UserID = '$LoggedUser[ID]'");
$Cache->delete_value('notify_quoted_' . $LoggedUser['ID']);
header('Location: userhistory.php?action=quote_notifications');
die();
}
if (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage'];
} else {
$PerPage = POSTS_PER_PAGE;
}
list($Page, $Limit) = Format::page_limit($PerPage);
// Get $Limit last quote notifications
// We deal with the information about torrents and requests later on...
$sql = "
SELECT
SQL_CALC_FOUND_ROWS
q.Page,
q.PageID,
q.PostID,
q.QuoterID,
q.Date,
q.UnRead,
f.ID as ForumID,
f.Name as ForumName,
t.Title as ForumTitle,
a.Name as ArtistName,
c.Name as CollageName
FROM users_notify_quoted AS q
LEFT JOIN forums_topics AS t ON t.ID = q.PageID
LEFT JOIN forums AS f ON f.ID = t.ForumID
LEFT JOIN artists_group AS a ON a.ArtistID = q.PageID
LEFT JOIN collages AS c ON c.ID = q.PageID
WHERE q.UserID = $LoggedUser[ID]
AND (q.Page != 'forums' OR " . Forums::user_forums_sql() . ")
AND (q.Page != 'collages' OR c.Deleted = '0')
$UnreadSQL
ORDER BY q.Date DESC
LIMIT $Limit";
$DB->query($sql);
$Results = $DB->to_array(false, MYSQLI_ASSOC, false);
$DB->query('SELECT FOUND_ROWS()');
list($NumResults) = $DB->next_record();
$TorrentGroups = $Requests = array();
foreach ($Results as $Result) {
if ($Result['Page'] == 'torrents') {
$TorrentGroups[] = $Result['PageID'];
} elseif ($Result['Page'] == 'requests') {
$Requests[] = $Result['PageID'];
}
}
$TorrentGroups = Torrents::get_groups($TorrentGroups, true, true, false);
$Requests = Requests::get_requests($Requests);
//Start printing page
View::show_header('Quote Notifications');
?>
if (!$NumResults) { ?>
No=($UnreadSQL ? ' new' : '')?> quotes.
} ?>
foreach ($Results as $Result) {
switch ($Result['Page']) {
case 'forums':
$Links = 'Forums:
' . display_str($Result['ForumName']) . ' > ' .
'
' . Format::cut_string($Result['ForumTitle'], 75) . '';
$JumpLink = 'forums.php?action=viewthread&threadid=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
break;
case 'artist':
$Links = 'Artist:
' . display_str($Result['ArtistName']) . '';
$JumpLink = 'artist.php?id=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
break;
case 'collages':
$Links = 'Collage:
' . display_str($Result['CollageName']) . '';
$JumpLink = 'collages.php?action=comments&collageid=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
break;
case 'requests':
if (!isset($Requests['matches'][$Result['PageID']])) {
error(0);
}
list(,,,,, $CategoryID, $Title, $Year,,,,,,,,,,,,) = $Requests['matches'][$Result['PageID']];
$CategoryName = $Categories[$CategoryID - 1];
$Links = 'Request: ';
if($CategoryName == "Music") {
$Links .= Artists::display_artists(Requests::get_artists($Result['PageID'])) . '
' . $Title . " [" . $Year . "]";
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
$Links .= '
' . $Title . " [" . $Year . "]";
} else {
$Links .= '
' . $Title . "";
}
$JumpLink = 'requests.php?action=view&id=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
break;
case 'torrents':
if (!isset($TorrentGroups['matches'][$Result['PageID']])) {
error(0);
}
$GroupInfo = $TorrentGroups['matches'][$Result['PageID']];
$Links = 'Torrent: ' . Artists::display_artists($GroupInfo['ExtendedArtists']) . '
' . $GroupInfo['Name'] . '';
if($GroupInfo['Year'] > 0) {
$Links .= " [" . $GroupInfo['Year'] . "]";
}
if ($GroupInfo['ReleaseType'] > 0) {
$Links .= " [" . $ReleaseTypes[$GroupInfo['ReleaseType']] . "]";
}
$JumpLink = 'torrents.php?id=' . $GroupInfo['ID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
break;
default:
error(0);
}
?>
=$Links?>
> Quoted by =Users::format_username($Result['QuoterID'], false, false, false, false) . ' ' . time_diff($Result['Date']) ?>
=($Result['UnRead'] ? ' (New!)' : '')?>
↑
|
} ?>
View::show_footer(); ?>