1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00

Possible improvement in 'mark all posts read'

This commit is contained in:
e107steved
2007-09-29 20:52:13 +00:00
parent 43381d6749
commit 5c0d75fbf6

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
| $Revision: 1.4 $ | $Revision: 1.5 $
| $Date: 2007-09-26 19:39:06 $ | $Date: 2007-09-29 20:52:07 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -110,19 +110,25 @@ class e107forum
} }
} }
function forum_markasread($forum_id) { function forum_markasread($forum_id)
{
global $sql; global $sql;
if ($forum_id != 'all') { if ($forum_id != 'all')
{
$forum_id = intval($forum_id); $forum_id = intval($forum_id);
$extra = " AND thread_forum_id='$forum_id' "; $extra = " AND thread_forum_id='{$forum_id}' ";
} }
$qry = "thread_lastpost > ".USERLV." AND thread_parent = 0 {$extra} "; $qry = "thread_lastpost > ".USERLV." AND thread_parent = 0 {$extra} ";
if ($sql->db_Select('forum_t', 'thread_id', $qry)) { if ($sql->db_Select('forum_t', 'thread_id', $qry))
while ($row = $sql->db_Fetch()) { {
$u_new .= ".".$row['thread_id']."."; while ($row = $sql->db_Fetch())
{
$u_new .= $row['thread_id'].".";
} }
$u_new .= USERVIEWED; $u_new .= USERVIEWED;
$sql->db_Update("user", "user_viewed='$u_new' WHERE user_id='".USERID."' "); $t = array_unique(explode('.',$u_new)); // Filter duplicates
$u_new = implode('.',$t);
$sql->db_Update("user", "user_viewed='{$u_new}' WHERE user_id='".USERID."' ");
header("location:".e_SELF); header("location:".e_SELF);
exit; exit;
} }
@@ -132,7 +138,7 @@ class e107forum
{ {
global $sql; global $sql;
$thread_id = intval($thread_id); $thread_id = intval($thread_id);
$u_new = USERVIEWED.".$thread_id"; $u_new = USERVIEWED.".".$thread_id;
return $sql->db_Update("user", "user_viewed='$u_new' WHERE user_id='".USERID."' "); return $sql->db_Update("user", "user_viewed='$u_new' WHERE user_id='".USERID."' ");
} }