/* User topic subscription page */ if(!empty($LoggedUser['DisableForums'])) { error(403); } include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class $Text = new TEXT; if (isset($LoggedUser['PostsPerPage'])) { $PerPage = $LoggedUser['PostsPerPage']; } else { $PerPage = POSTS_PER_PAGE; } list($Page,$Limit) = page_limit($PerPage); show_header('Subscribed topics','subscriptions,bbcode'); if($LoggedUser['CustomForums']) { unset($LoggedUser['CustomForums']['']); $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0)); $PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1)); } $ShowUnread = (!isset($_GET['showunread']) && !isset($HeavyInfo['SubscriptionsUnread']) || isset($HeavyInfo['SubscriptionsUnread']) && !!$HeavyInfo['SubscriptionsUnread'] || isset($_GET['showunread']) && !!$_GET['showunread']); $ShowCollapsed = (!isset($_GET['collapse']) && !isset($HeavyInfo['SubscriptionsCollapse']) || isset($HeavyInfo['SubscriptionsCollapse']) && !!$HeavyInfo['SubscriptionsCollapse'] || isset($_GET['collapse']) && !!$_GET['collapse']); $sql = 'SELECT SQL_CALC_FOUND_ROWS MAX(p.ID) AS ID FROM (SELECT TopicID FROM users_subscriptions WHERE UserID = '.$LoggedUser['ID'].') AS s LEFT JOIN forums_last_read_topics AS l ON s.TopicID = l.TopicID AND l.UserID = '.$LoggedUser['ID'].' JOIN forums_topics AS t ON t.ID = s.TopicID JOIN forums_posts AS p ON t.ID = p.TopicID JOIN forums AS f ON f.ID = t.ForumID WHERE p.ID <= IFNULL(l.PostID,t.LastPostID) AND ((f.MinClassRead <= '.$LoggedUser['Class']; if(!empty($RestrictedForums)) { $sql.=' AND f.ID NOT IN (\''.$RestrictedForums.'\')'; } $sql .= ')'; if(!empty($PermittedForums)) { $sql.=' OR f.ID IN (\''.$PermittedForums.'\')'; } $sql .= ')'; if($ShowUnread) { $sql .= ' AND IF(l.PostID IS NULL OR (t.IsLocked = \'1\' && t.IsSticky = \'0\'), t.LastPostID, l.PostID) < t.LastPostID'; $sql .= ' OR (t.AuthorID != '.$LoggedUser['ID'].' AND l.PostID IS NULL)'; } $sql .= ' GROUP BY t.ID ORDER BY t.LastPostID DESC LIMIT '.$Limit; $PostIDs = $DB->query($sql); $DB->query('SELECT FOUND_ROWS()'); list($NumResults) = $DB->next_record(); if($NumResults > $PerPage*($Page-1)) { $DB->set_query_id($PostIDs); $PostIDs = $DB->collect('ID'); $sql = 'SELECT f.ID AS ForumID, f.Name AS ForumName, p.TopicID, t.Title, p.Body, t.LastPostID, t.IsLocked, t.IsSticky, p.ID, um.ID, um.Username, ui.Avatar, p.EditedUserID, p.EditedTime, ed.Username AS EditedUsername FROM forums_posts AS p LEFT JOIN forums_topics AS t ON t.ID = p.TopicID LEFT JOIN forums AS f ON f.ID = t.ForumID LEFT JOIN users_main AS um ON um.ID = p.AuthorID LEFT JOIN users_info AS ui ON ui.UserID = um.ID LEFT JOIN users_main AS ed ON ed.ID = um.ID WHERE p.ID IN ('.implode(',',$PostIDs).') ORDER BY f.Name ASC, t.LastPostID DESC'; $DB->query($sql); } ?>
=$ForumName?> > =cut_string($ThreadTitle, 75)?> if($PostID<$LastPostID && !$Locked) { ?> (New!) } ?> [Unsubscribe] ↑ |