Hyper
Active Member
¤ عنوان : جلوگيري از ارسال پستهاي تكراري يا disable multiple replies
¤ نويسنده : emrag
¤ شرح : از ارسال پست تكراري در تاپيك ها كه معمولا بدليل اشكال در سرويس هاي اينترنت بوجود مي آيد ، جلوگيري ميكند
¤ نسخه : 1.0.4
¤ سطح : آسان
¤ زمان نصب : 10 دقيقه
¤ فايل هاي مورد نياز : 4 فايل
¤ فايل هاي افزودني : 0 فايل
¤ تاريخ :
¤ منبع : http://www.phpbbhacks.com
نكته مهم : پيش از ايجاد تغييرات لازم از فايل هاي مورد نياز نسخه پشتيبان تهيه كنيد ...
¤ نويسنده : emrag
¤ شرح : از ارسال پست تكراري در تاپيك ها كه معمولا بدليل اشكال در سرويس هاي اينترنت بوجود مي آيد ، جلوگيري ميكند
¤ نسخه : 1.0.4
¤ سطح : آسان
¤ زمان نصب : 10 دقيقه
¤ فايل هاي مورد نياز : 4 فايل
¤ فايل هاي افزودني : 0 فايل
¤ تاريخ :
¤ منبع : http://www.phpbbhacks.com
نكته مهم : پيش از ايجاد تغييرات لازم از فايل هاي مورد نياز نسخه پشتيبان تهيه كنيد ...
کد:
#
#-----[ SQL ]------------------------------------------
#
# you can use db_update_multi.php file instead of this code ;)
#
ALTER TABLE phpbb_posts ADD enable_multiple_replies TINYINT(1) unsigned default 0
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#----[ FIND ]------------------------------------------
#
$select_sql = ( !$submit ) ? ", t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig" : ;
#
#----[ IN LINE, FIND ]------------------------------------------
#
, p.enable_smilies
#
#-----[ AFTER, ADD ]------------------------------------------
#
, p.enable_multiple_replies
#
#----[ FIND ]------------------------------------------
#
if ( !$board_config[allow_smilies] )
{
$smilies_on = 0;
}
else
{
$smilies_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS[disable_smilies]) ) ? 0 : TRUE ) : ( ( $userdata[user_id] == ANONYMOUS ) ? $board_config[allow_smilies] : $userdata[user_allowsmile] );
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
$multiple_replies_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS[disable_multiple_replies]) ) ? 0 : TRUE ) : ( ( $userdata[user_id] == ANONYMOUS ) ? 1 : 1 );
#
#----[ FIND ]------------------------------------------
#
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("", "", $username), str_replace("", "", $subject), str_replace("", "", $message), str_replace("", "", $poll_title), $poll_options, $poll_length);
#
#----[ IN LINE, FIND ]------------------------------------------
#
, $smilies_on
#
#-----[ AFTER, ADD ]------------------------------------------
#
, $multiple_replies_on
#
#----[ FIND ]------------------------------------------
#
$preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
#
#----[ IN LINE, FIND ]------------------------------------------
#
, $smilies_on
#
#----[ AFTER, ADD ]------------------------------------------
#
, $multiple_replies_on
#
#----[ FIND ]------------------------------------------
#
$bbcode_on = ( $post_info[enable_bbcode] ) ? true : false;
$smilies_on = ( $post_info[enable_smilies] ) ? true : false;
#
#----[ AFTER, ADD ]------------------------------------------
#
$multiple_replies_on = ( $post_info[enable_multiple_replies] ) ? true : false;
#
#----[ FIND ]------------------------------------------
#
//
// Notify checkbox - only show if user is logged in
//
if ( $userdata[session_logged_in] && $is_auth[auth_read] )
{
if ( $mode != editpost || ( $mode == editpost && $post_info[poster_id] != ANONYMOUS ) )
{
$template->assign_block_vars(switch_notify_checkbox, array());
}
}
#
#----[ AFTER, ADD ]------------------------------------------
#
//
// Multiple replies - only show if mode = newtopic or edit
//
if ( $userdata[session_logged_in] )
{
if ( $mode == editpost && $post_data[first_post] || ( $mode == newtopic && $post_info[poster_id] != ANONYMOUS ) )
{
$template->assign_block_vars(switch_multiple_replies_checkbox, array());
}
}
#
#----[ FIND ]------------------------------------------
#
L_DISABLE_HTML => $lang[Disable_HTML_post],
L_DISABLE_BBCODE => $lang[Disable_BBCode_post],
#
#----[ AFTER, ADD ]------------------------------------------
#
L_DISABLE_MULTIPLE_REPLIES => $lang[Disable_Multiple_Replies],
#
#----[ FIND ]------------------------------------------
#
S_BBCODE_CHECKED => ( !$bbcode_on ) ? checked="checked" : ,
S_SMILIES_CHECKED => ( !$smilies_on ) ? checked="checked" : ,
#
#----[ AFTER, ADD ]------------------------------------------
#
S_MULTIPLE_REPLIES_CHECKED => ( !$multiple_replies_on ) ? checked="checked" : ,
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php
#
#----[ FIND ]------------------------------------------
#
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$multiple_replies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length)
#
#----[ IN LINE FIND ]------------------------------------------
#
, &$smilies_on
#
#----[ AFTER, ADD ]------------------------------------------
#
, &$multiple_replies_on
#
#----[ 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 ]------------------------------------------
#
//
// allow multiple replies control
//
if (($userdata[user_level] != ADMIN OR $userdata[user_level] != MOD))
{
if($mode != editpost)
{
$sql = "SELECT enable_multiple_replies, topic_id
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id
LIMIT 1";
if ($result = $db->sql_query($sql))
{
while ($row = $db->sql_fetchrow($result))
{
if ($row[enable_multiple_replies] == 0)
{
message_die(GENERAL_MESSAGE, "Üzgünüz tekrar mesaj gönderemezsiniz");
}
}
$db->sql_freeresult($result);
}
}
}
#
#----[ FIND ]------------------------------------------
#
$sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $userdata[user_id] . ", $post_username, $current_time, $user_ip, $bbcode_on, $html_on, $smilies_on, $attach_sig)" : "UPDATE " . POSTS_TABLE . " SET post_username = $post_username, enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id";
#
#----[ IN LINE FIND ]------------------------------------------
#
, enable_sig
#
#----[ AFTER, ADD ]------------------------------------------
#
, enable_multiple_replies
#
#----[ IN LINE FIND ]------------------------------------------
#
, $attach_sig
#
#----[ AFTER, ADD ]------------------------------------------
#
, $multiple_replies_on
#
#----[ IN LINE FIND ]------------------------------------------
#
, enable_smilies = $smilies_on
#
#----[ AFTER, ADD ]------------------------------------------
#
, enable_multiple_replies = $multiple_replies_on
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#----[ FIND ]------------------------------------------
#
?>
#
#----[ BEFORE, ADD ]------------------------------------------
#
$lang[Disable_Multiple_Replies] = جلوگيري از ارسال پست تكراري : ;
#
#-----[ OPEN ]------------------------------------------
#
templates/subsilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN switch_smilies_checkbox -->
<tr>
<td>
<input type="checkbox" name="disable_smilies" {S_SMILIES_CHECKED} />
</td>
<td><span class="gen">{L_DISABLE_SMILIES}</span></td>
</tr>
<!-- END switch_smilies_checkbox -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_multiple_replies_checkbox -->
<tr>
<td>
<input type="checkbox" name="disable_multiple_replies" {S_MULTIPLE_REPLIES_CHECKED} />
</td>
<td><span class="gen">{L_DISABLE_MULTIPLE_REPLIES}</span></td>
</tr>
<!-- END switch_multiple_replies_checkbox -->
#
#-----[ SAVE ALL FILES/CLOSE ]------------------------------------------
#
# EoM