1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Bugtracker #4528 - check for duplicate posts

This commit is contained in:
e107steved
2008-10-03 19:27:56 +00:00
parent 87f676d764
commit be01f7b0b8

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.5 $ | $Revision: 1.6 $
| $Date: 2007-09-29 20:52:07 $ | $Date: 2008-10-03 19:27:56 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -62,7 +62,7 @@ class e107forum
$tmp = explode(chr(1), $thread_info['thread_user']); $tmp = explode(chr(1), $thread_info['thread_user']);
$thread_lastuser = $tmp[0]; $thread_lastuser = $tmp[0];
} }
$sql->db_Update('forum_t', "thread_lastpost = ".intval($thread_info['thread_datestamp']).", thread_lastuser = '".$tp -> toDB($thread_lastuser, true)."' WHERE thread_id = ".intval($id)); $sql->db_Update('forum_t', "thread_lastpost = ".intval($thread_info['thread_datestamp']).", thread_lastuser = '".$tp -> toDB($thread_lastuser, true)."' WHERE thread_id = ".$id);
} }
return $thread_info; return $thread_info;
} }
@@ -97,7 +97,7 @@ class e107forum
} }
} }
} }
if ($sql->db_Select("forum_t", "*", "thread_forum_id='$id' ORDER BY thread_datestamp DESC LIMIT 0,1")) if ($sql->db_Select("forum_t", "*", "thread_forum_id={$id} ORDER BY thread_datestamp DESC LIMIT 0,1"))
{ {
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
$tmp = explode(chr(1), $row['thread_user']); $tmp = explode(chr(1), $row['thread_user']);
@@ -116,7 +116,7 @@ class e107forum
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))
@@ -128,7 +128,7 @@ class e107forum
$u_new .= USERVIEWED; $u_new .= USERVIEWED;
$t = array_unique(explode('.',$u_new)); // Filter duplicates $t = array_unique(explode('.',$u_new)); // Filter duplicates
$u_new = implode('.',$t); $u_new = implode('.',$t);
$sql->db_Update("user", "user_viewed='{$u_new}' WHERE user_id='".USERID."' "); $sql->db_Update("user", "user_viewed='{$u_new}' WHERE user_id=".USERID);
header("location:".e_SELF); header("location:".e_SELF);
exit; exit;
} }
@@ -139,13 +139,13 @@ 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);
} }
function forum_getparents() function forum_getparents()
{ {
global $sql; global $sql;
if ($sql->db_Select('forum', '*', "forum_parent='0' ORDER BY forum_order ASC")) if ($sql->db_Select('forum', '*', "forum_parent=0 ORDER BY forum_order ASC"))
{ {
while ($row = $sql->db_Fetch()) { while ($row = $sql->db_Fetch()) {
$ret[] = $row; $ret[] = $row;
@@ -254,7 +254,7 @@ class e107forum
$_newqry = " $_newqry = "
SELECT DISTINCT ff.forum_sub, ft.thread_forum_id FROM #forum_t AS ft SELECT DISTINCT ff.forum_sub, ft.thread_forum_id FROM #forum_t AS ft
LEFT JOIN #forum AS ff ON ft.thread_forum_id = ff.forum_id LEFT JOIN #forum AS ff ON ft.thread_forum_id = ff.forum_id
WHERE thread_parent = 0 AND thread_lastpost > '".USERLV."' {$viewed} WHERE thread_parent = 0 AND thread_lastpost > ".USERLV." {$viewed}
"; ";
if($sql->db_Select_gen($_newqry)) if($sql->db_Select_gen($_newqry))
{ {
@@ -292,14 +292,14 @@ class e107forum
$thread_id = intval($thread_id); $thread_id = intval($thread_id);
global $sql; global $sql;
$tmp = str_replace("-".$thread_id."-", "", USERREALM); $tmp = str_replace("-".$thread_id."-", "", USERREALM);
return $sql->db_Update("user", "user_realm='$tmp' WHERE user_id='".USERID."' "); return $sql->db_Update("user", "user_realm='$tmp' WHERE user_id=".USERID);
} }
function track($thread_id, $from) function track($thread_id, $from)
{ {
$thread_id = intval($thread_id); $thread_id = intval($thread_id);
global $sql; global $sql;
return $sql->db_Update("user", "user_realm='".USERREALM."-".$thread_id."-' WHERE user_id='".USERID."' "); return $sql->db_Update("user", "user_realm='".USERREALM."-".$thread_id."-' WHERE user_id=".USERID);
} }
function forum_get($forum_id) function forum_get($forum_id)
@@ -407,7 +407,7 @@ class e107forum
function forum_get_topic_count($forum_id) function forum_get_topic_count($forum_id)
{ {
global $sql; global $sql;
return $sql->db_Count("forum_t", "(*)", " WHERE thread_forum_id='".intval($forum_id)."' AND thread_parent='0' "); return $sql->db_Count("forum_t", "(*)", " WHERE thread_forum_id=".intval($forum_id)." AND thread_parent=0 ");
} }
function thread_getnext($thread_id, $forum_id, $from = 0, $limit = 100) function thread_getnext($thread_id, $forum_id, $from = 0, $limit = 100)
@@ -599,7 +599,7 @@ class e107forum
{ {
$thread_id = intval($thread_id); $thread_id = intval($thread_id);
global $sql; global $sql;
return $sql->db_Update("forum_t", "thread_views=thread_views+1 WHERE thread_id='$thread_id' "); return $sql->db_Update("forum_t", "thread_views=thread_views+1 WHERE thread_id=".$thread_id);
} }
@@ -668,7 +668,7 @@ class e107forum
$forum_sub = intval($forum_sub); $forum_sub = intval($forum_sub);
$ip = $e107->getip(); $ip = $e107->getip();
//Check for duplicate post //Check for duplicate post
if ($sql->db_Count('forum_t', '(*)', "WHERE thread_thread='$thread_thread' and thread_datestamp > ".($post_time - 180))) if ($sql->db_Count('forum_t', '(*)', "WHERE thread_thread='{$thread_thread}' and thread_datestamp > ".($post_time - 180)))
{ {
return -1; return -1;
} }