Перейти к контенту

Антифлуд - склейка сообщений


d1pro

Рекомендуемые сообщения

Мод: Антифлуд - склейка сообщений

Категория: Моды

Совместимость: 2.0.x

Описание:

Этот мод добавляет текст нового сообщения к предыдущему, если оно было добавлено

тем же автором некоторое время назад. Таким образом предотвращается

создание двойных сообщений в случае "глюка" браузера. Да и просто

позволяет не редактировать последнее сообщение с целью того, чтобы

дописать что-то, что забыл сказать.

Так же корректно цепляет аттачи. Время и разделитель настраиваются через

админку.

26.09.2004. Обновление для IPB2 Final

11.10.2004. По многочисленным просьбам добавлена возможность указания времени

15.10.2004. Исправлен баг с одновременным добавлением постов разными авторами

 

Подробнее...

Скачать

Ссылка на комментарий
Поделиться на других сайтах

  • Ответы 191
  • Создана
  • Последний ответ

Лучшие авторы в этой теме

Лучшие авторы в этой теме

  • d1pro

    d1pro 41 публикация

  • GiV

    GiV 8 публикаций

  • Shaggoth

    Shaggoth 7 публикаций

  • Sex

    Sex 7 публикаций

Загружено фотографий

Song

Хм... По-моему это и есть обычная склейка + плюс еще аттачи приклеивает если были запостены с новым постом...

Ссылка на комментарий
Поделиться на других сайтах

в том то и дело что у меня PF2 а этого нету.

Добавлено в [mergetime]1091904656[/mergetime]

как нить по другому этот файл присабачить можно?

Ссылка на комментарий
Поделиться на других сайтах

IPx

в том то и дело что у меня PF2 а этого нету.

Добавлено в 21:51

как нить по другому этот файл присабачить можно?

 

Идешь в ACP => View All General Settings

 

В самом низу есть Import an XML settings file

и там форма загрузки файла *.xml

Либо можно указать имя файла этого *.xml предварительно загрузив его через ftp в корень форума.

Ссылка на комментарий
Поделиться на других сайтах

theIggs

За идею в смысле что ли? За идею thanx... Реализация своя.

Добавлено в [mergetime]1091965950[/mergetime]

А пиво по-моему за реализацию ставят :D

Ссылка на комментарий
Поделиться на других сайтах

theIggs

А кто был автор хака для предыдущей версии? Добавлю респекты в текст :D...

Добавлено в [mergetime]1091970469[/mergetime]

Усе понял ;)...

Ссылка на комментарий
Поделиться на других сайтах

Ronaldo

Трудно сказать. Но это самая верхняя строчка самого верхнего блока. Кстати, русскификация админки может быть не от PF2, так там импорта может и не быть...

Ссылка на комментарий
Поделиться на других сайтах

  • 3 недели спустя...

Sex

Конечно, если его переписать заново, то без проблем. А вообще под 1.3 уже есть такой мод...

Ссылка на комментарий
Поделиться на других сайтах

  • 2 недели спустя...
Надо дописывать. Мне такая фича кажется сомнительной и не нужной, поэтому я ее не стал делать...
Ссылка на комментарий
Поделиться на других сайтах

В моде:

  //-------------------------------------------------
 // Add post to DB
 //-------------------------------------------------

 $this->post['post_key']    = $this->post_key;
 $this->post['post_parent'] = intval($ibforums->input['parent_id']);

 $DB->do_insert( 'posts', $this->post );

 $this->post['pid'] = $DB->get_insert_id();

 //-------------------------------------------------
 // If we are still here, lets update the
 // board/forum/topic stats
 //-------------------------------------------------

 $this->class->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'reply');

 

в форуме:

 

  //-------------------------------------------------
 // Add post to DB
 //-------------------------------------------------
 
 $this->post['post_key']    = $this->post_key;
 $this->post['post_parent'] = intval($ibforums->input['parent_id']);
 
 //-------------------------------------------------
 // Typecast
 //-------------------------------------------------
 
 $DB->force_data_type = array( 'pid'  => 'int',
          'post' => 'string' );
 
 $DB->do_insert( 'posts', $this->post );
 
 $this->post['pid'] = $DB->get_insert_id();
 
 //-------------------------------------------------
 // If we are still here, lets update the
 // board/forum/topic stats
 //-------------------------------------------------
 
 $this->class->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'reply');

 

Доработай!

Добавлено в [mergetime]1095159502[/mergetime]

 $DB->force_data_type = array( 'pid'  => 'int',
          'post' => 'string' );

Куда девать строку?

Добавлено в [mergetime]1095159953[/mergetime]

Решено. Для pf4 надо вставлять:

 

                //-------------------------------------------------
                // Add post to DB
                //-------------------------------------------------

                //merge posts

                //-------------------------------------------------
                // Unset append flag
                //-------------------------------------------------

                $append_post = 0;

                //-------------------------------------------------
                // Are we merging or what?
                //-------------------------------------------------

        if (($this->topic['last_poster_id'] == $this->post['author_id']) and ($this->post['author_id']) and ((time() - $this->last_post) < $ibforums->vars['flood_time']) and ( $ibforums->vars['flood_enabled'] ) )
        {
                        $DB->simple_construct( array( 'select' => 'pid, post', 'from' => 'posts', 'where' => "topic_id=".$this->topic['tid'] , 'order' => 'post_date DESC', 'limit' => array('0','1') ) );
                        $DB->simple_exec();

                        $this->lastpost = $DB->fetch_row();

            if ( strlen ($this->lastpost['post'].$ibforums->vars['flood_separator'].$this->post['post']) <= ($ibforums->vars['max_post_length'] * 1024) )
            {
                    //-------------------------------------------------
                    // Set append flag
                    //-------------------------------------------------

                $append_post = 1;

                $this->post['post_key']    = $this->post_key;
                $this->post['post']                      = $this->lastpost['post'].$ibforums->vars['flood_separator'].$this->post['post'];

                    //-------------------------------------------------
                    // Update attachments or we'll lose them
                    //-------------------------------------------------

                    $DB->do_update( 'attachments', array( 'attach_post_key' => $this->post_key ), 'attach_pid='.$this->lastpost['pid'] );

                    //-------------------------------------------------
                    // Update last post
                    //-------------------------------------------------

                    $DB->do_update( 'posts', $this->post, "pid=".$this->lastpost['pid'] );
                    $this->post['pid'] = $this->lastpost['pid'];

                    $dbs = array( 'last_title'       => $this->topic['title'],
                                  'last_id'          => $this->topic['tid'],
                                  'last_post'        => time(),
                                  'last_poster_name' => $ibforums->member['id'] ?  $ibforums->member['name'] : $ibforums->input['UserName'],
                                  'last_poster_id'   => $ibforums->member['id'],
                               );

                    $DB->do_update( 'forums', $dbs, "id=".intval($this->class->forum['id']) );

                    //----------------------------------------
                    // Update forum cache
                    //----------------------------------------

                    $std->update_forum_cache();

                    $std->update_cache( array( 'name' => 'stats'      , 'array' => 1, 'deletefirst' => 0, 'donow' => 1 ) );
                        }
        }

                //-------------------------------------------------
                // If append flag is not set, then just add a new post
                //-------------------------------------------------

        if ( ! $append_post )
        {
                $this->post['post_key']    = $this->post_key;
                $this->post['post_parent'] = intval($ibforums->input['parent_id']);

                $DB->do_insert( 'posts', $this->post );

                $this->post['pid'] = $DB->get_insert_id();

                //-------------------------------------------------
                // If we are still here, lets update the
                // board/forum/topic stats
                //-------------------------------------------------

                $this->class->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'reply');
        }
                //-------------------------------------------------
                // Typecast
                //-------------------------------------------------

                $DB->force_data_type = array( 'pid'  => 'int',
                                                                          'post' => 'string' );
        //merge posts

Ссылка на комментарий
Поделиться на других сайтах

Не-а, ты не совсем правильно сделал. Я уже переделал для PF4, еще в день его выхода, но еще не выкладывал просто...

                //-------------------------------------------------
                // Add post to DB
                //-------------------------------------------------

                //merge posts

                //-------------------------------------------------
                // Unset append flag
                //-------------------------------------------------

                $append_post = false;

                //-------------------------------------------------
                // Are we merging or what?
                //-------------------------------------------------

                if (($this->topic['last_poster_id'] == $this->post['author_id']) and ($this->post['author_id']) and ((time() - $this->last_post) < $ibforums->vars['flood_time']) and ( $ibforums->vars['flood_enabled'] ) )
                {
                       $DB->simple_construct( array( 'select' => 'pid, post', 'from' => 'posts', 'where' => "topic_id=".$this->topic['tid'] , 'order' => 'post_date DESC', 'limit' => array('0','1') ) );
                       $DB->simple_exec();

                       $this->lastpost = $DB->fetch_row();

                       if ( strlen ($this->lastpost['post'].$ibforums->vars['flood_separator'].$this->post['post']) <= ($ibforums->vars['max_post_length'] * 1024) )
                       {
                            //-------------------------------------------------
                            // Set append flag
                            //-------------------------------------------------

                            $append_post = true;

                            $this->post['post_key']    = $this->post_key;
                            $this->post['post']        = $this->lastpost['post'].$ibforums->vars['flood_separator'].$this->post['post'];

                            //-------------------------------------------------
                            // Update attachments or we'll lose them
                            //-------------------------------------------------

                            $DB->do_update( 'attachments', array( 'attach_post_key' => $this->post_key ), 'attach_pid='.$this->lastpost['pid'] );

                            //-------------------------------------------------
                            // Update last post
                            //-------------------------------------------------

                            $DB->force_data_type = array( 'pid'  => 'int',
                                                          'post' => 'string' );

                            $DB->do_update( 'posts', $this->post, "pid=".$this->lastpost['pid'] );
                            $this->post['pid'] = $this->lastpost['pid'];

                            $dbs = array( 'last_title'       => $this->topic['title'],
                                          'last_id'          => $this->topic['tid'],
                                          'last_post'        => time(),
                                          'last_poster_name' => $ibforums->member['id'] ?  $ibforums->member['name'] : $ibforums->input['UserName'],
                                          'last_poster_id'   => $ibforums->member['id'],
                                        );


                            $DB->do_update( 'forums', $dbs, "id=".intval($this->class->forum['id']) );

                            //----------------------------------------
                            // Update forum cache
                            //----------------------------------------

                            $std->update_forum_cache();

                            $std->update_cache( array( 'name' => 'stats'      , 'array' => 1, 'deletefirst' => 0, 'donow' => 1 ) );
                        }
                }

                //-------------------------------------------------
                // If append flag is not set, then just add a new post
                //-------------------------------------------------

                if ( ! $append_post )
                {
                        $this->post['post_key']    = $this->post_key;
                        $this->post['post_parent'] = intval($ibforums->input['parent_id']);

                        //-------------------------------------------------
                        // Typecast
                        //-------------------------------------------------

                        $DB->force_data_type = array( 'pid'  => 'int',
                                                      'post' => 'string' );

                        $DB->do_insert( 'posts', $this->post );

                        $this->post['pid'] = $DB->get_insert_id();


                        //-------------------------------------------------
                        // If we are still here, lets update the
                        // board/forum/topic stats
                        //-------------------------------------------------

                        $this->class->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'reply');
                }
                //merge posts

Ссылка на комментарий
Поделиться на других сайтах

Batang

Ты не все и не туда прописал. Хотя в общем-то во время выполнения разница вряд ли будет заметна, по крайней мере с мускулом...

Ссылка на комментарий
Поделиться на других сайтах

d1pro

Чёт не нашёл в здешней базе такого мода для 1.3 :D

помоги братик, может он есть, только не тут...

Ссылка на комментарий
Поделиться на других сайтах


×
×
  • Создать...

Важная информация

Находясь на нашем сайте, вы соглашаетесь на использование файлов cookie, а также с нашим положением о конфиденциальности Политика конфиденциальности и пользовательским соглашением Условия использования.