Склеивание сообщений

B

Bustra

Гость
Описание: Мод склеивает сообщения одного автора, написанные друг за другом.
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 ]------------------------------------------
#
 

qaqra

Пользователь
у мну вопрос не в тему ..просто что бы не создавть лишних тем... как сделать что бы пасскей автоматом новому юзеру вкл? и тем юзерам которые есть..а то я как то упустил... а теперь 135 тыс юзеров не улыбает вручную...запрос же нада сделать в БД тока вот какой? R375 Заранее Спасибо !!!
 
B

Bustra

Гость
Boec, в ajax несилен... вроде можно было отключать создание и редактирование постов (ajax)
 

frost444

Пользователь
мой posts.php выглядит так
PHP:
<?php
 
if (!defined('IN_AJAX')) die(basename(__FILE__));
 
global $lang, $bb_cfg, $userdata, $datastore;
 
if (!isset($this->request['type']))
{
    $this->ajax_die('empty type');
}
if (isset($this->request['post_id']))
{
    $post_id = (int) $this->request['post_id'];
    $post = DB()->fetch_row("SELECT t.*, f.*, p.*, pt.post_text
        FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f, ". BB_POSTS ." p, ". BB_POSTS_TEXT ." pt
        WHERE p.post_id = $post_id
            AND t.topic_id = p.topic_id
            AND f.forum_id = t.forum_id
            AND p.post_id  = pt.post_id
        LIMIT 1");
}
 
if (!defined('WORD_LIST_OBTAINED'))
{
    $orig_word = array();
    $replace_word = array();
    obtain_word_list($orig_word, $replace_word);
    define('WORD_LIST_OBTAINED', true);
}
 
switch($this->request['type'])
{
    case 'delete';
        if(!$post) $this->ajax_die('not post');
 
        $is_auth = auth(AUTH_ALL, $post['forum_id'], $userdata, $post);
 
        if($post['post_id'] != $post['topic_first_post_id'] && ($is_auth['auth_mod'] || ($userdata['user_id'] == $post['poster_id'] && $is_auth['auth_delete'] && $post['topic_last_post_id'] == $post['post_id'] && $post['post_time'] + 3600*3 > TIMENOW)))
        {
            if (empty($this->request['confirmed']))
            {
                $this->prompt_for_confirm($lang['CONFIRM_DELETE']);
            }
            post_delete($post_id);
            $this->response['hide']    = true;
            $this->response['post_id'] = $post_id;
        }
        else
        {
            $this->ajax_die(sprintf($lang['SORRY_AUTH_DELETE'], strip_tags($is_auth['auth_delete_type'])));
        }
        break;
 
    case 'reply';
        if(!$post) $this->ajax_die($lang['NOT_POST']);
 
        $is_auth = auth(AUTH_ALL, $post['forum_id'], $userdata, $post);
        if(bf($userdata['user_opt'], 'user_opt', 'allow_post'))
        {
            $this->ajax_die($lang['RULES_REPLY_CANNOT']);
        }
        else if(!$is_auth['auth_reply'])
        {
            $this->ajax_die(sprintf($lang['SORRY_AUTH_REPLY'], strip_tags($is_auth['auth_reply_type'])));
        }
 
        // Use trim to get rid of spaces placed there by MS-SQL 2000
        $quote_username = (trim($post['post_username']) != '') ? $post['post_username'] : get_username($post['poster_id']);
        $message = "[quote=\"". $quote_username ."\"]". $post['post_text'] ."[/quote]\n";
        // hide user passkey
        $message = preg_replace('#(?<=\?uk=)[a-zA-Z0-9]{10}(?=&)#', 'passkey', $message);
        // hide sid
        $message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]{12}#', 'sid', $message);
 
        if (!empty($orig_word))
        {
            $message = (!empty($message)) ? preg_replace($orig_word, $replace_word, $message) : '';
        }
 
        if($post['post_id'] == $post['topic_first_post_id'])
        {
            $message = "[quote]". $post['topic_title'] ."[/quote]\n";
        }
        if(mb_strlen($message, 'UTF-8') > 1000)
        {
            $this->response['redirect'] = make_url('posting.php?mode=quote&p='. $post_id);
        }
 
        $this->response['quote']  = true;
        $this->response['message'] = $message;
        break;
 
    case 'view_message':
        $message = (string) $this->request['message'];
        if(!trim($message)) $this->ajax_die($lang['EMPTY_MESSAGE']);
     
        $this->response['message_html'] = bbcode2html($message);
        $this->response['res_id'] = @$this->request['res_id'];
        break;
 
    case 'edit':
    case 'editor':
        if(!$post) $this->ajax_die($lang['NOT_POST']);
 
        if((mb_strlen($post['post_text'], 'UTF-8') > 1000) || $post['post_attachment'] || ($post['topic_first_post_id'] == $post_id))
        {
            $this->response['redirect'] = make_url('posting.php?mode=editpost&p='. $post_id);
        }
        else if($this->request['type'] == 'editor')
        {
            $text = (string) $this->request['text'];
            $text = prepare_message($text);
 
            if(mb_strlen($text) > 2)
            {
                if($text != $post['post_text'])
                {
                    if($bb_cfg['max_smilies'])
                    {
                        $count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="'. $bb_cfg['smilies_path']);
                        if($count_smilies > $bb_cfg['max_smilies'])
                        {
                            $this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
                        }
                    }
                    DB()->query("UPDATE ". BB_POSTS_TEXT ." SET post_text = '". DB()->escape($text) ."' WHERE post_id = $post_id LIMIT 1");
                    add_search_words($post_id, stripslashes($text), stripslashes($post['topic_title']));
                    update_post_html(array(
                        'post_id'        => $post_id,
                        'post_text'      => $text,
                    ));
                }
            }
            else $this->ajax_die($lang['EMPTY_MESSAGE']);
 
            $this->response['html'] = bbcode2html($text);
        }
        else
        {
            $is_auth = auth(AUTH_ALL, $post['forum_id'], $userdata, $post);
            if ($post['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod'])
            {
                $this->ajax_die($lang['TOPIC_LOCKED']);
            }
            else if(!$is_auth['auth_edit'])
            {
                $this->ajax_die(sprintf($lang['SORRY_AUTH_EDIT'], strip_tags($is_auth['auth_edit_type'])));
            }
 
            $hidden_form = '<input type="hidden" name="mode" value="editpost" />';
            $hidden_form .= '<input type="hidden" name="'. POST_POST_URL .'" value="'. $post_id .'" />';
            $hidden_form .= '<input type="hidden" name="subject" value="'. $post['topic_title'] .'" />';
 
            $this->response['text'] = '
                <form action="posting.php" method="post" name="post">
                    '. $hidden_form .'
                    <div class="buttons mrg_4">
                        <input type="button" value="B" name="codeB" title="'.$lang['BOLD'].'" style="font-weight: bold; width: 30px;" />
                        <input type="button" value="i" name="codeI" title="'.$lang['ITALIC'].'" style="width: 30px; font-style: italic;" />
                        <input type="button" value="u" name="codeU" title="'.$lang['UNDERLINE'].'" style="width: 30px; text-decoration: underline;" />
                        <input type="button" value="s" name="codeS" title="'.$lang['STRIKEOUT'].'" style="width: 30px; text-decoration: line-through;" />&nbsp;&nbsp;
                        <input type="button" value="'.$lang['QUOTE'].'" name="codeQuote" title="'.$lang['QUOTE_TITLE'].'" style="width: 57px;" />
                        <input type="button" value="Img" name="codeImg" title="'.$lang['IMG_TITLE'].'" style="width: 40px;" />
                        <input type="button" value="'.$lang['URL'].'" name="codeUrl" title="'.$lang['URL_TITLE'].'" style="width: 63px; text-decoration: underline;" /><input type="hidden" name="codeUrl2" />&nbsp;
                        <input type="button" value="'.$lang['CODE'].'" name="codeCode" title="'.$lang['CODE_TITLE'].'" style="width: 43px;" />
                        <input type="button" value="'.$lang['LIST'].'" name="codeList" title="'.$lang['LIST_TITLE'].'" style="width: 60px;" />
                        <input type="button" value="1." name="codeOpt" title="'.$lang['LIST_ITEM'].'" style="width: 30px;" />&nbsp;
                        <input type="button" value="'.$lang['QUOTE_SEL'].'" name="quoteselected" title="'.$lang['QUOTE_SELECTED'].'" onmouseout="bbcode.refreshSelection(false);" onmouseover="bbcode.refreshSelection(true);" onclick="bbcode.onclickQuoteSel();" />&nbsp;
                    </div>
                    <textarea id="message-'. $post_id .'" class="editor mrg_4" name="message" rows="18" cols="92">'. $post['post_text'] .'</textarea>
                    <div class="mrg_4 tCenter">
                        <input title="Alt+Enter" name="preview" type="submit" value="'.$lang['PREVIEW'].'">
                        <input type="button" onclick="edit_post('. $post_id .');" value="'. $lang['CANCEL'] .'">
                        <input type="button" onclick="edit_post('. $post_id .', \'editor\', $(\'#message-'. $post_id .'\').val()); return false;" class="bold" value="'. $lang['SUBMIT'] .'">
                    </div><hr>
                    <script type="text/javascript">
                    var bbcode = new BBCode("message-'. $post_id .'");
                    var ctrl = "ctrl";
 
                    bbcode.addTag("codeB", "b", null, "B", ctrl);
                    bbcode.addTag("codeI", "i", null, "I", ctrl);
                    bbcode.addTag("codeU", "u", null, "U", ctrl);
                    bbcode.addTag("codeS", "s", null, "S", ctrl);
 
                    bbcode.addTag("codeQuote", "quote", null, "Q", ctrl);
                    bbcode.addTag("codeImg", "img", null, "R", ctrl);
                    bbcode.addTag("codeUrl", "url", "/url", "", ctrl);
                    bbcode.addTag("codeUrl2", "url=", "/url", "W", ctrl);
 
                    bbcode.addTag("codeCode", "code", null, "K", ctrl);
                    bbcode.addTag("codeList",  "list", null, "L", ctrl);
                    bbcode.addTag("codeOpt", "*", "", "0", ctrl);
                    </script>
                </form>';
        }
        $this->response['post_id'] = $post_id;
        break;
 
    case 'add':
        if (!isset($this->request['topic_id']))
        {
            $this->ajax_die('empty topic_id');
        }
        $topic_id = (int) $this->request['topic_id'];
        $t_data = DB()->fetch_row("SELECT t.*, f.*
            FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f
            WHERE t.topic_id = $topic_id
                AND f.forum_id = t.forum_id
            LIMIT 1");
            $t_data['points_disabled'] = $userdata['user_id'];
            $t_data['admin_allow_points'] = $userdata['admin_allow_points'];
        if(!$t_data) $this->ajax_die($lang['TOPIC_POST_NOT_EXIST']);
    if ($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_data['poster_post'] = ($post_id_last_row['poster_id'] == $userdata['user_id']);
        $post_id = $post_id_last_row['post_id'];
        $current_time = time();
        $difference_time = $current_time - $post_id_last_row['post_time'];
        $hours = floor($difference_time/60/60);
        $minutes = floor($difference_time/60%60);
        $seconds = $difference_time%60;
        $separator = '[br][size=9][color=#999999]--добавлено спустя';
        if ( $hours != 0 )
            {
                if ( $hours == 1 )            $separator .= ' ' . $hours . ' час';
                if ( $hours > 1 && $hours < 5 )        $separator .= ' ' . $hours . ' часа';
                if ( $hours > 4 )            $separator .= ' ' . $hours . ' часов';
            }
        if ( $minutes != 0 )
            {
                if ( $minutes > 10 && $minutes < 15 )            { $separator .= ' ' . $minutes . ' минут'; }
                else if (($minutes%10) == 1 )                { $separator .= ' ' . $minutes . ' минуту'; }
                else if (($minutes%10) > 1 && ($minutes%10) < 5 )    { $separator .= ' ' . $minutes . ' минуты'; }
                else if (($minutes%10) > 4 )                { $separator .= ' ' . $minutes . ' минут'; }
            }
        if ( $hours == 0 && $minutes == 0 )
            {
                if ( $seconds > 10 && $seconds < 15 )            { $separator .= ' ' . $seconds . ' секунд'; }
                else if (($seconds%10) == 1 )                { $separator .= ' ' . $seconds . ' секунду'; }
                else if (($seconds%10) > 1 && ($seconds%10) < 5 )    { $separator .= ' ' . $seconds . ' секунды'; }
                else if (($seconds%10) > 4 )                { $separator .= ' ' . $seconds . ' секунд'; }
            }
        $separator .= '--[/color][/size][br]';
     
        if ($post_id_last_row['poster_id'] == $poster_id && $post_data['poster_post'] && $t_data['topic_replies'] >= 1 && ( $difference_time < ( $bb_cfg['join_interval'] * 3600 ) ) )
        { 
            $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 = addslashes($last_message);
         
        } 
    }
 
        $is_auth = auth(AUTH_ALL, $t_data['forum_id'], $userdata, $t_data);
        if(bf($userdata['user_opt'], 'user_opt', 'allow_post'))
        {
            $this->ajax_die($lang['RULES_REPLY_CANNOT']);
        }
        else if(!$is_auth['auth_reply'])
        {
            $this->ajax_die(sprintf($lang['SORRY_AUTH_REPLY'], strip_tags($is_auth['auth_reply_type'])));
        }
 
        $message = (string) $this->request['message'];
        $message = prepare_message($message);
 
        // Flood control
        $where_sql = (IS_GUEST) ? "p.poster_ip = '". USER_IP ."'" : "p.poster_id = {$userdata['user_id']}";
 
        $sql = "SELECT MAX(p.post_time) AS last_post_time FROM ". BB_POSTS ." p WHERE $where_sql";
        if ($row = DB()->fetch_row($sql) AND $row['last_post_time'])
        {
            if ($userdata['user_level'] == USER)
            {
                if (TIMENOW - $row['last_post_time'] < $bb_cfg['flood_interval'])
                {
                    $this->ajax_die($lang['FLOOD_ERROR']);
                }
            }
        }
 
        // Double Post Control
        if (!empty($row['last_post_time']) && !IS_AM)
        {
            $sql = "
                SELECT pt.post_text
                FROM ". BB_POSTS ." p, ". BB_POSTS_TEXT ." pt
                WHERE $where_sql
                    AND p.post_time = ". (int) $row['last_post_time'] ."
                    AND pt.post_id = p.post_id
                LIMIT 1
            ";
 
            if ($row = DB()->fetch_row($sql))
            {
                $last_msg = DB()->escape($row['post_text']);
 
                if ($last_msg == $message)
                {
                    $this->ajax_die($lang['DOUBLE_POST_ERROR']);
                }
            }
        }
 
        if($bb_cfg['max_smilies'])
        {
            $count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="'. $bb_cfg['smilies_path']);
            if($count_smilies > $bb_cfg['max_smilies'])
            {
                $this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
            }
        }
    if ( !empty($last_message) )
    {
        $messages = ( $last_message != $message ) ? $last_message . $separator . $message : $message;
        $added = 1;
            if(mb_strlen($messages) > 2)
            {
                if($messages != $messages['post_text'])
                {
                    DB()->sql_query("UPDATE ". BB_POSTS_TEXT ." SET post_text = '". DB()->escape($messages) ."' WHERE post_id = $post_id LIMIT 1");
                    add_search_words($post_id, stripslashes($messages), stripslashes($messages['topic_title']));
                    update_post_html(array(
                        'post_id'        => $post_id,
                        'post_text'      => $messages,
                    ));
        $this->response['html'] = bbcode2html($messages);
        $this->response['post_id'] = $post_id;
        $this->response['redirect'] = make_url(POST_URL . "$post_id#$post_id");
        }
}     
    }else{
        DB()->sql_query("INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_time, poster_ip) VALUES ($topic_id, ". $t_data['forum_id'] .", ". $userdata['user_id'] .", '". TIMENOW ."', '". USER_IP ."')");
        $post_id = DB()->sql_nextid();
        DB()->sql_query("INSERT INTO " . BB_POSTS_TEXT . " (post_id, post_text) VALUES ($post_id, '". DB()->escape($message) ."')");
     
        update_post_stats('reply', $t_data, $t_data['forum_id'], $topic_id, $post_id, $userdata['user_id']);
 
        add_search_words($post_id, stripslashes($message), stripslashes($t_data['topic_title']));
        update_post_html(array(
            'post_id'        => $post_id,
            'post_text'      => $message,
        ));
 
        $this->response['redirect'] = make_url(POST_URL . $post_id .'#'. $post_id);
        }
        break;
 
 
    default:
        $this->ajax_die('empty type');
        break;
}
сохраять в кодировки UTF-8 без BOM
 
Сверху