Double Post Control 1.1.0

主題已鎖定
頭像
cloudsnow30
.※.稜鏡之森の守護使者.※.
.※.稜鏡之森の守護使者.※.
文章: 145
註冊時間: 週六 2006-03-04 03:29
個人狀態: 冬眠喵型態
性別:
來自: 雲上天國
擁有感謝: 2 次
星座:
聯繫:

Double Post Control 1.1.0

文章 cloudsnow30 »

防止重覆發表相同文章

MOD Name: Double Post Control 1.1.0
Author: Kinetix-
MOD Description: This MOD effectively stops users from posting the same message twice in a row, which can be caused by page-loading problems and when a user clicks the "Submit" problem twice (double-post).

MOD Version: 1.1.0 (Updated 11/16/04)

Installation Level: Easy
Installation Time: ~ 1 Minute

代碼: 選擇全部

############################################################## 
## MOD Title: Double Post Control MOD 
## MOD Author: Kinetix < webmaster@ikrontik.tk > (N/A) http://www.ikrontik.tk 
## MOD Description: This MOD effectively stops users from posting the same message 
##                  twice in a row. 
## MOD Version: 1.1.0 
## 
## Installation Level: Easy 
## Installation Time: 1 Minute 
## Files To Edit: 2: includes/functions_post.php 
##                   language/lang_english/lang_main.php 
## Included Files: 0 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: None. 
## 
############################################################## 
## MOD History:  1.0.0 Initial Release 
##               1.1.0 Posts with BBCode were not double post checked (uid). 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# IMPORTANT: Some FIND commands only contain partial lines.  Unless the script calls for an 
# "IN-LINE ADD," always add new segments of code on separate lines.  Also, before an In-Line 
# Find, you'll often see a FIND.  These FINDS are there to help you locate the lines where 
# In-Line FIND will work. 
# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/functions_post.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
      // 
      // Flood control 
      // 
      $where_sql = ($userdata['user_id'] == ANONYMOUS) ? "poster_ip = '$user_ip'" : 'poster_id = ' . $userdata['user_id']; 
      $sql = "SELECT MAX(post_time) AS last_post_time 
         FROM " . POSTS_TABLE . " 
         WHERE $where_sql"; 
      if ($result = $db->sql_query($sql)) 
      { 
         if ($row = $db->sql_fetchrow($result)) 
         { 
            if (intval($row['last_post_time']) > 0 && ($current_time - intval($row['last_post_time'])) < intval($board_config['flood_interval'])) 
            { 
               message_die(GENERAL_MESSAGE, $lang['Flood_Error']); 
            } 
         } 
      } 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

      // 
      // Double Post Control 
      // 
      $lastposttime = intval($row['last_post_time']); 
      if($mode != 'editpost') 
      { 
         $sql = "SELECT pt.post_text, pt.bbcode_uid 
            FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt 
            WHERE $where_sql AND p.post_time = $lastposttime AND pt.post_id = p.post_id 
            LIMIT 1"; 
         if ($result = $db->sql_query($sql)) 
         { 
            if ($row = $db->sql_fetchrow($result)) 
            { 
               // Update BBCode to current UID 
               $row['post_text'] = str_replace(":" . $row['bbcode_uid'] . "]", ":" . $bbcode_uid . "]", $row['post_text']); 
               if ($row['post_text'] == $post_message) 
               { 
                  message_die(GENERAL_MESSAGE, $lang['Double_Post_Error']); 
               } 
            } 
            $db->sql_freeresult($result); 
         } 
      } 
# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_main.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
$lang['Flood_Error'] = 'You cannot make another post so soon after your last; please try again in a short while.'; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
$lang['Double_Post_Error'] = 'You cannot make another post with the exact same text as your last.'; 
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
中文化

代碼: 選擇全部

# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_chinese_traditional_taiwan/lang_main.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
$lang['Flood_Error'] = '嚴禁惡意的快速發文攻擊, 請稍後再試'; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
$lang['Double_Post_Error'] = '您不能重覆發表相同的文章'; 
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
Sakura Moon ~ 櫻井璃月 ~
論壇系統管理員-Cloud Snow 晴雪
主題已鎖定

回到「PHPBB2-外掛列表」