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

G

Gemini_13

Гость
#11
frost444, буду благодарен, я аякс неосили еще, старый адаптироный мод могу выложить.
 

frost444

Пользователь
#13
Gemini_13, я с телефона вообще писать не могу т.к. опера не может отобразить форму ответа(
 
G

Gemini_13

Гость
#14
это часть адаптированного мода
PHP:
#
#-----[ SQL ]------------------------------------------
#
 
      INSERT INTO bb_config (config_name, config_value) VALUES ('join_interval', '3');
 
#
#-----[ 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=#999999]" . $lang['ADDED_LATER'] . delta_time($post_id_last_row['post_time'], TIMENOW, 'seconds'). ":[/color][/size]\n\n ";
 
        if ( $post_id_last_row['poster_id'] == $poster_id && ( $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 = $last_message_row['post_text'];
            $last_message = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $last_message);
            $last_message = undo_htmlspecialchars(addslashes($last_message));
        }
    }
    $added = 0;
    // 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, DB()->escape($username), DB()->escape($subject), DB()->escape($message), DB()->escape($poll_title), $poll_options, $poll_length, $update_post_time);
 
#
#-----[ IN-LINE FIND ]------------------------------------------
#
 
        , $poll_length
 
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
 
        , $added
 
#
#-----[ OPEN ]------------------------------------------
#
 
        /includes/functions_post.php
 
#
#-----[ FIND ]------------------------------------------
#
 
        function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, $post_username, $post_subject, $post_message, $poll_title, &$poll_options, &$poll_length, $update_post_time)
 
#
#-----[ 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'] = 'Склеивание сообщений';
$lang['JOIN_INTERVAL'] = 'Интервал склеивания сообщений';
$lang['JOIN_INTERVAL_EXPLAIN'] = 'Интервал времени по какому мод склеивает сообщения';
 
#
#-----[ OPEN ]------------------------------------------
#
 
        /language/lang_russian/lang_main.php
 
#
#-----[ В самый низ добавить ]------------------------------------------
#
 
// Склеивание сообщений
$lang['ADDED_LATER'] = 'Добавлено спустя ';
 
#
#-----[ OPEN ]------------------------------------------
#
 
      templates\admin\admin_board.tpl
 
#
#-----[ FIND ]------------------------------------------
#
 
<!-- ENDIF / CONFIG_MODS -->
 
#
#-----[ BEFORE, ADD ]------------------------------------------
#
 
<tr class="row3 med">
    <td class="bold tCenter" colspan="2">{L_JOIN}</td>
</tr>
<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>
 
#
#-----[ OPEN ]------------------------------------------
#
 
      includes\bbcode.php
 
#
#-----[ FIND ]------------------------------------------
#
 
class words_rate
 
#
#-----[ BEFORE, ADD ]------------------------------------------
#
 
function undo_htmlspecialchars($input)
{
    $input = preg_replace("/&gt;/i", ">", $input);
    $input = preg_replace("/&lt;/i", "<", $input);
    $input = preg_replace("/&quot;/i", "\"", $input);
    $input = preg_replace("/&amp;/i", "&", $input);
    return $input;
}
 
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#

frost444, у мну адроид 4, стандартный браузер. только флеш не понимает покачто, а так грешить на него грех :)
 
G

Gemini_13

Гость
#19
Alexander.S, я выложил то, что я адаптировал. Код Bustra не проверял.

frost444, так будет чуток лучше
PHP:
$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]';
Заменить на:
PHP:
$separator = '[br][size=9][color=#999999]' . $lang['ADDED_LATER'] . delta_time($post_id_last_row['post_time'], TIMENOW, 'seconds'). ':[/color][/size][br]';
 
Сверху