You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 8, 2021. It is now read-only.
(tt.mark_time IS NOT NULL AND t.topic_last_post_time > tt.mark_time) OR
1856
1855
(tt.mark_time IS NULL AND ft.mark_time IS NOT NULL AND t.topic_last_post_time > ft.mark_time) OR
1857
-
(tt.mark_time IS NULL AND ft.mark_time IS NULL)
1856
+
(tt.mark_time IS NULL AND ft.mark_time IS NULL AND t.topic_last_post_time > $last_mark)
1858
1857
)
1859
1858
$sql_extra
1860
1859
$sql_sort",
1861
1860
);
1861
+
// start mod view or mark unread posts (and end mod too)...reverted a 3.0.9 change to the WHERE clause above since that change is inconsistent with this mod
// start mod view or mark unread posts - set flag that toggles text for link to unreads (if user not logged in or board not using db for unreads, set to true so that text will always read view unreads
4638
+
$s_exists_unreads = check_unread_posts();
4639
+
// end mod view or mark unread posts
4637
4640
// The following assigns all _common_ variables that may be used at any point in a template.
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
6
+
*
7
+
*/
8
+
9
+
/**
10
+
* @ignore
11
+
*/
12
+
if (!defined('IN_PHPBB'))
13
+
{
14
+
exit;
15
+
}
16
+
17
+
18
+
/**
19
+
* checks to see if the user has any unread posts in the forum
20
+
* (returns true if there are unread posts and false if there are not)
21
+
*/
22
+
functioncheck_unread_posts()
23
+
{
24
+
global$db, $user, $auth, $exists_unreads;
25
+
26
+
// The next block of code skips the check if the user is a guest (since prosilver and subsilver hide the unread link from guests)
27
+
// or if the user is a a bot. If you use a template that shows the link to unread posts for guests, you may want to get rid of the first part of the if
28
+
// clause so that the text of the link to unread posts will toggle rather than always reading 'View unread posts'.
29
+
if (($user->data['user_id'] == ANONYMOUS) || $user->data['is_bot'])
30
+
{
31
+
returntrue;
32
+
}
33
+
34
+
// if the user is on the index and functions_display has already checked for unreads, we skip unnecessary queries and return true or false
35
+
if ($exists_unreads == 1)
36
+
{
37
+
returntrue;
38
+
}
39
+
if ($exists_unreads == -1)
40
+
{
41
+
returnfalse;
42
+
}
43
+
44
+
// user not on index so we need to check whether there are unreads
45
+
46
+
// find forums where last post time is greater than the forum's mark time (or, if there is none, the user's lastmark time)
47
+
$sql = 'SELECT f.forum_id
48
+
FROM ' . FORUMS_TABLE . ' f
49
+
LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft
50
+
ON (f.forum_id = ft.forum_id AND ft.user_id = ' . $user->data['user_id'] . ')
51
+
WHERE f.forum_last_post_time > ft.mark_time
52
+
OR (ft.mark_time IS NULL AND f.forum_last_post_time > ' . $user->data['user_lastmark'] . ')';
53
+
$result = $db->sql_query($sql);
54
+
55
+
// cycle through the results and return true if we hit one the user is authorized to read
56
+
while($row = $db->sql_fetchrow($result))
57
+
{
58
+
if ($auth->acl_get('f_read', $row['forum_id']))
59
+
{
60
+
returntrue;
61
+
}
62
+
}
63
+
$db->sql_freeresult($result);
64
+
65
+
// last step: check to see if any global topics are unread, since the preceding test only checks regular forums
66
+
// (this code is copied from the test for global unreads that appears in display_forums()
// start mod view or mark unread posts (and end mod too)...added reference to unreadbox in next line to supress move to unread box entry in dropdown menu
// start mod view or mark unread posts (and end mod too)...added reference to unreadbox in next line to supress move to unread box entry in dropdown menu
0 commit comments