B
Bustra
Гость
Описание: Мод склеивает сообщения одного автора, написанные друг за другом.
P.S проверить на работоспособность времени нету.. Если у кого то не будет работать или заработает отпишитесь в теме.
Автор: не знаю кто точно
P.S проверить на работоспособность времени нету.. Если у кого то не будет работать или заработает отпишитесь в теме.
Автор: не знаю кто точно
PHP:
#
#-----[ SQL ]------------------------------------------
#
INSERT INTO bb_config (config_name, config_value) VALUES ('join_interval', '18');
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
//
// Submit post/vote (newtopic, edit, reply, etc.)
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
// double_post eliminate start
if ( $mode == 'reply' && $userdata['user_id'] != ANONYMOUS )
{
$poster_id = $userdata['user_id'];
$sql = "SELECT post_id, poster_id, post_time, MAX(post_time) FROM " . BB_POSTS . " WHERE topic_id = $topic_id GROUP BY post_time ORDER BY post_time DESC LIMIT 1";
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$post_id_last_row = DB()->sql_fetchrow($result);
$post_id = $post_id_last_row['post_id'];
$difference_time = TIMENOW - $post_id_last_row['post_time'];
$separator = ' \n\n[size=9][color=red]Дополнительное сообщение добавлено спустя ' . delta_time($post_id_last_row['post_time'], TIMENOW, 'seconds'). ':[/color][/size]\n\n ';
if ( $post_id_last_row['poster_id'] == $poster_id && ($post_id_last_row['post_id'] != $first_row['pid']) && ( $difference_time < ( $bb_cfg['join_interval'] * 3600 ) ) )
{
$mode = 'editpost';
$sql = "SELECT post_text FROM " . BB_POSTS_TEXT . " WHERE post_id = $post_id";
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$last_message_row = DB()->sql_fetchrow($result);
// i don't know much about parsing the message, so it may well be that, there are some wrongs, anyway all seems to work fine
$last_message = str_replace('', $last_message_row['post_text']);
$last_message = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $last_message);
$last_message = undo_htmlspecialchars(addslashes($last_message));
}
}
// double_post eliminate end
#
#-----[ FIND ]------------------------------------------
#
$poll_length = ( isset($_POST['poll_length']) && $is_auth['auth_pollcreate'] ) ? $_POST['poll_length'] : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( !empty($last_message) )
{
$message = ( $last_message != $message ) ? $last_message . $separator . $message : $message;
$added = 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 ]------------------------------------------
#
, $poll_length
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, $added
#
#-----[ FIND ]------------------------------------------
#
$post_id_last_row = DB()->sql_fetchrow($result);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// release mod
$sql2 = "SELECT min(post_id) AS pid FROM " . BB_POSTS . " WHERE topic_id = $topic_id";
if ( !($result2 = DB()->sql_query($sql2)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$first_row = DB()->sql_fetchrow($result2);
// end release mod
#
#-----[ FIND ]------------------------------------------
#
if ( $post_id_last_row['poster_id'] == $poster_id && ( $difference_time < ( $board_config['join_interval'] * 3600 ) ) )
#
#-----[ REPLACE]------------------------------------------
#
if ( $post_id_last_row['poster_id'] == $poster_id && ($post_id_last_row['post_id'] != $first_row['pid']) && ( $difference_time < ( $board_config['join_interval'] * 3600 ) ) )
#
#-----[ 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, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length)
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, &$poll_length
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, &$added
#
#-----[ FIND ]------------------------------------------
#
$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";
#
#-----[ REPLACE]------------------------------------------
#
$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && @$post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";
#
#-----[ FIND ]------------------------------------------
#
if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))
{
$topic_vote = (!empty($poll_title) && count($poll_options) >= 2) ? 1 : 0;
#
#-----[ BEFORE, ADD ]------------------------------------------
#
if ( $added && $mode == 'editpost' )
{
$sql = "UPDATE " . BB_POSTS . " SET post_time = " . $current_time . " WHERE post_id = " . $post_id;
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update last post time', '', __LINE__, __FILE__, $sql);
}
}
#
#-----[ OPEN ]------------------------------------------
#
admin\admin_board.php
#
#-----[ FIND ]------------------------------------------
#
'FLOOD_INTERVAL' => $new['flood_interval'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'JOIN_INTERVAL' => $new['join_interval'],
#
#-----[ OPEN ]------------------------------------------
#
/language/lang_russian/lang_admin.php
#
#-----[ В самый низ добавить ]------------------------------------------
#
$lang['JOIN_INTERVAL'] = 'Интервал склеивания сообщений';
$lang['JOIN_INTERVAL_EXPLAIN'] = 'Интервал времени по какому мод склеивает сообщения';
#
#-----[ OPEN ]------------------------------------------
#
templates\admin\admin_board.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td><h4>{L_FLOOD_INTERVAL}</h4><h6>{L_FLOOD_INTERVAL_EXPLAIN}</h6></td>
<td>
<input class="post" type="text" size="3" maxlength="4" name="flood_interval" value="{FLOOD_INTERVAL}" /> {L_SEC}
</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td><h4>{L_JOIN_INTERVAL}</h4><h6>{L_JOIN_INTERVAL_EXPLAIN}</h6></td>
<td><input class="post" type="text" size="3" maxlength="4" name="join_interval" value="{JOIN_INTERVAL}" /></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#