Vergleich inc/functions_indicators.php - 1.8.7 - 1.8.26

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 58Zeile 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 97Zeile 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;
}
}

return $count;

				{
++$count;
}
}

return $count;

		}

		}


// Not read any threads?
return false;


// Not read any threads?
return false;

Zeile 118Zeile 148
		switch($db->type)
{
case "pgsql":

		switch($db->type)
{
case "pgsql":

				$query = $db->query("
SELECT COUNT(t.tid) AS unread_count
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}

				$query = $db->query("
SELECT COUNT(t.tid) AS unread_count
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 {$where2} AND t.lastpost > COALESCE(tr.dateline,$cutoff) AND t.lastpost > COALESCE(fr.dateline,$cutoff) AND t.lastpost>$cutoff

				");
break;
default:

				");
break;
default:

Zeile 132Zeile 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 179Zeile 209

$fids[] = $child;
$ignored_forums[] = $child;


$fids[] = $child;
$ignored_forums[] = $child;

					}


					}


					if(fetch_unread_count(implode(",", $fids)) == 0)
{
$forums_to_read[] = $forum;

					if(fetch_unread_count(implode(",", $fids)) == 0)
{
$forums_to_read[] = $forum;

Zeile 253Zeile 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 295Zeile 334
				}
}


				}
}


			if($mark_query != '')

			if(!empty($mark_query))

			{
switch($db->type)
{

			{
switch($db->type)
{