Vergleich inc/functions_indicators.php - 1.8.1 - 1.8.23

  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;
}
}

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

				$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']}')

					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)
{

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)
{