Zeile 58 | Zeile 58 |
---|
{ global $cache, $db, $mybb;
|
{ global $cache, $db, $mybb;
|
$onlyview = $onlyview2 = ''; $permissions = forum_permissions($fid);
| $forums_all = $forums_own = array(); $forums = explode(',', $fid); foreach($forums as $forum) { $permissions = forum_permissions($forum); if(!empty($permissions['canonlyviewownthreads'])) { $forums_own[] = $forum; } else { $forums_all[] = $forum; } } if(!empty($forums_own)) { $where = "(fid IN (".implode(',', $forums_own).") AND uid = {$mybb->user['uid']})"; $where2 = "(t.fid IN (".implode(',', $forums_own).") AND t.uid = {$mybb->user['uid']})"; } if(!empty($forums_all)) { if(isset($where)) { $where = "({$where} OR fid IN (".implode(',', $forums_all)."))"; $where2 = "({$where2} OR t.fid IN (".implode(',', $forums_all)."))"; } else { $where = 'fid IN ('.implode(',', $forums_all).')'; $where2 = 't.fid IN ('.implode(',', $forums_all).')'; } }
|
$cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if(!empty($permissions['canonlyviewownthreads']))
| $cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if(!empty($permissions['canonlyviewownthreads']))
|
Zeile 76 | Zeile 106 |
---|
if(isset($mybb->cookies['mybb']['threadread'])) {
|
if(isset($mybb->cookies['mybb']['threadread'])) {
|
$threadsread = my_unserialize($mybb->cookies['mybb']['threadread']);
| $threadsread = my_unserialize($mybb->cookies['mybb']['threadread'], false);
|
} if(isset($mybb->cookies['mybb']['forumread'])) {
|
} if(isset($mybb->cookies['mybb']['forumread'])) {
|
$forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
| $forumsread = my_unserialize($mybb->cookies['mybb']['forumread'], false);
|
}
if(!empty($threadsread))
| }
if(!empty($threadsread))
|
Zeile 97 | Zeile 127 |
---|
$count = 0;
// We've read at least some threads, are they here?
|
$count = 0;
// We've read at least some threads, are they here?
|
$query = $db->simple_select("threads", "lastpost, tid, fid", "visible=1 AND closed NOT LIKE 'moved|%' AND fid IN ({$fid}) AND lastpost > '{$cutoff}'{$onlyview}", array("limit" => 100));
| $query = $db->simple_select("threads", "lastpost, tid, fid", "visible=1 AND closed NOT LIKE 'moved|%' AND {$where} AND lastpost > '{$cutoff}'", array("limit" => 100));
|
while($thread = $db->fetch_array($query)) {
|
while($thread = $db->fetch_array($query)) {
|
if(isset($threadsread[$thread['tid']]) && $thread['lastpost'] > (int)$threadsread[$thread['tid']] && isset($forumsread[$thread['fid']]) && $thread['lastpost'] > (int)$forumsread[$thread['fid']])
| if((!isset($threadsread[$thread['tid']]) || $thread['lastpost'] > (int)$threadsread[$thread['tid']]) && (!isset($forumsread[$thread['fid']]) || $thread['lastpost'] > (int)$forumsread[$thread['fid']]))
|
{ ++$count; }
| { ++$count; }
|
Zeile 123 | Zeile 153 |
---|
FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."threadsread tr ON (tr.tid=t.tid AND tr.uid='{$mybb->user['uid']}') LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=t.fid AND fr.uid='{$mybb->user['uid']}')
|
FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."threadsread tr ON (tr.tid=t.tid AND tr.uid='{$mybb->user['uid']}') LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=t.fid AND fr.uid='{$mybb->user['uid']}')
|
WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' AND t.fid IN ($fid) AND t.lastpost > COALESCE(tr.dateline,$cutoff) AND t.lastpost > COALESCE(fr.dateline,$cutoff) AND t.lastpost>$cutoff{$onlyview2}
| WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' AND {$where2} AND t.lastpost > COALESCE(tr.dateline,$cutoff) AND t.lastpost > COALESCE(fr.dateline,$cutoff) AND t.lastpost>$cutoff
|
"); break; default:
| "); break; default:
|
Zeile 132 | Zeile 162 |
---|
FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."threadsread tr ON (tr.tid=t.tid AND tr.uid='{$mybb->user['uid']}') LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=t.fid AND fr.uid='{$mybb->user['uid']}')
|
FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."threadsread tr ON (tr.tid=t.tid AND tr.uid='{$mybb->user['uid']}') LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=t.fid AND fr.uid='{$mybb->user['uid']}')
|
WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' AND t.fid IN ($fid) AND t.lastpost > IFNULL(tr.dateline,$cutoff) AND t.lastpost > IFNULL(fr.dateline,$cutoff) AND t.lastpost>$cutoff{$onlyview2}
| WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' AND {$where2} AND t.lastpost > IFNULL(tr.dateline,$cutoff) AND t.lastpost > IFNULL(fr.dateline,$cutoff) AND t.lastpost>$cutoff
|
"); } return $db->fetch_field($query, "unread_count");
| "); } return $db->fetch_field($query, "unread_count");
|
Zeile 158 | Zeile 188 |
---|
{ $ignored_forums = array(); $forums = array_reverse(explode(",", get_parent_list($fid)));
|
{ $ignored_forums = array(); $forums = array_reverse(explode(",", get_parent_list($fid)));
|
|
|
unset($forums[0]); if(!empty($forums)) {
| unset($forums[0]); if(!empty($forums)) {
|
Zeile 253 | Zeile 283 |
---|
$update_count = 15; }
|
$update_count = 15; }
|
$mark_query = '';
| switch($db->type) { case "pgsql": case "sqlite": $mark_query = array(); break; default: $mark_query = ''; }
|
$done = 0; foreach(array_keys($forums) as $fid) {
| $done = 0; foreach(array_keys($forums) as $fid) {
|
Zeile 295 | Zeile 334 |
---|
} }
|
} }
|
if($mark_query != '')
| if(!empty($mark_query))
|
{ switch($db->type) {
| { switch($db->type) {
|