Vergleich inc/functions_indicators.php - 1.8.5 - 1.8.8

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
/**
* Mark a particular thread as read for the current user.
*

/**
* Mark a particular thread as read for the current user.
*

 * @param int The thread ID
* @param int The forum ID of the thread

 * @param int $tid The thread ID
* @param int $fid The forum ID of the thread

 */
function mark_thread_read($tid, $fid)
{

 */
function mark_thread_read($tid, $fid)
{

Zeile 51Zeile 51
/**
* Fetches the number of unread threads for the current user in a particular forum.
*

/**
* Fetches the number of unread threads for the current user in a particular forum.
*

 * @param string The forums (CSV list)

 * @param string $fid The forums (CSV list)

 * @return int The number of unread threads
*/
function fetch_unread_count($fid)
{
global $cache, $db, $mybb;


 * @return int The number of unread threads
*/
function fetch_unread_count($fid)
{
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;
}

				{
++$count;
}

Zeile 123Zeile 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 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 142Zeile 172
/**
* Mark a particular forum as read.
*

/**
* Mark a particular forum as read.
*

 * @param int The forum ID

 * @param int $fid The forum ID

 */
function mark_forum_read($fid)
{

 */
function mark_forum_read($fid)
{