query(" (SELECT SQL_CALC_FOUND_ROWS s.Page, s.PageID, lr.PostID, null AS ForumID, null AS ForumName, IF(s.Page = 'artist', a.Name, co.Name) AS Name, c.ID AS LastPost, c.AddedTime AS LastPostTime, c_lr.Body AS LastReadBody, c_lr.EditedTime AS LastReadEditedTime, um.ID AS LastReadUserID, um.Username AS LastReadUsername, ui.Avatar AS LastReadAvatar, c_lr.EditedUserID AS LastReadEditedUserID FROM users_subscriptions_comments AS s LEFT JOIN users_comments_last_read AS lr ON lr.UserID = $LoggedUser[ID] AND lr.Page = s.Page AND lr.PageID = s.PageID LEFT JOIN artists_group AS a ON s.Page = 'artist' AND a.ArtistID = s.PageID LEFT JOIN collages AS co ON s.Page = 'collages' AND co.ID = s.PageID LEFT JOIN comments AS c ON c.ID = (SELECT MAX(ID) FROM comments WHERE Page = s.Page AND PageID = s.PageID) LEFT JOIN comments AS c_lr ON c_lr.ID = lr.PostID LEFT JOIN users_main AS um ON um.ID = c_lr.AuthorID LEFT JOIN users_info AS ui ON ui.UserID = um.ID WHERE s.UserID = $LoggedUser[ID] AND s.Page IN ('artist', 'collages', 'requests', 'torrents') AND (s.Page != 'collages' OR co.Deleted = '0')" . ($ShowUnread ? ' AND c.ID > IF(lr.PostID IS NULL, 0, lr.PostID)' : '') . " GROUP BY s.PageID) UNION ALL (SELECT 'forums', s.TopicID, lr.PostID, f.ID, f.Name, t.Title, p.ID, p.AddedTime, p_lr.Body, p_lr.EditedTime, um.ID, um.Username, ui.Avatar, p_lr.EditedUserID FROM users_subscriptions AS s LEFT JOIN forums_last_read_topics AS lr ON lr.UserID = $LoggedUser[ID] AND s.TopicID = lr.TopicID LEFT JOIN forums_topics AS t ON t.ID = s.TopicID LEFT JOIN forums AS f ON f.ID = t.ForumID LEFT JOIN forums_posts AS p ON p.ID = (SELECT MAX(ID) FROM forums_posts WHERE TopicID = s.TopicID) LEFT JOIN forums_posts AS p_lr ON p_lr.ID = lr.PostID LEFT JOIN users_main AS um ON um.ID = p_lr.AuthorID LEFT JOIN users_info AS ui ON ui.UserID = um.ID WHERE s.UserID = $LoggedUser[ID]" . ($ShowUnread ? " AND p.ID > IF(t.IsLocked = '1' AND t.IsSticky = '0'" . ", p.ID, IF(lr.PostID IS NULL, 0, lr.PostID))" : '') . ' AND ' . Forums::user_forums_sql() . " GROUP BY t.ID) ORDER BY LastPostTime DESC LIMIT $Limit"); $Results = $DB->to_array(false, MYSQLI_ASSOC, false); $DB->query('SELECT FOUND_ROWS()'); list($NumResults) = $DB->next_record(); $Debug->log_var($Results, 'Results'); $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); include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class $Text = new TEXT; ?>

Subscriptions

No subscriptions
' . display_str($Result['Name']) . ''; $JumpLink = 'artist.php?id=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID']; break; case 'collages': $Links = 'Collage: ' . display_str($Result['Name']) . ''; $JumpLink = 'collages.php?action=comments&collageid=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID']; break; case 'requests': if (!isset($Requests[$Result['PageID']])) { continue; } $Request = $Requests[$Result['PageID']]; $CategoryName = $Categories[$CategoryID - 1]; $Links = 'Request: '; if ($CategoryName == 'Music' || $CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') { $Links .= ($CategoryName == 'Music' ? Artists::display_artists(Requests::get_artists($Result['PageID'])) : '') . '' . $Request['Title'] . " [" . $Request['Year'] . "]"; } else { $Links .= '' . $Request['Title'] . ""; } $JumpLink = 'requests.php?action=view&id=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID']; break; case 'torrents': if (!isset($TorrentGroups[$Result['PageID']])) { continue; } $GroupInfo = $TorrentGroups[$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; case 'forums': $Links = 'Forums: ' . display_str($Result['ForumName']) . ' > ' . '' . Format::cut_string($Result['Name'], 75) . ''; $JumpLink = 'forums.php?action=viewthread&threadid=' . $Result['PageID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID']; break; default: error(0); } ?>
(New!)' : '')?> Unsubscribe Unsubscribe  
full_format($Result['LastReadBody']) ?>

Last edited by