• 255 Closing a Thread With 250 posts - закрытие в 250 постов • 
Данная тема достигла ограничения в 250 постов
При создании темы о модах для двигателя форумов phpBB ветки до версии 3.0.14 название темы должно начинаться с названия мода на английском, без указания версии, затем тире, затем короткое название мода на русском с маленькой буквы. Создание тем не о модах в данном подфоруме запрещено. Посторонние темы о двиге и посторонних проблемах для ветки до версии 3.0.14 в соседнем подфоруме.

    255 Closing a Thread With 250 posts - закрытие в 250 постов

Сообщение Разместил Александр Лешванов 28 апр 2017, 14:27

Дор АВТОЗАКРЫТИЕ ТЕМЫ и СОЗДАНИЕ НОВОЙ ТЕМЫ после 250 постов Closing a Thread With 250 posts от Татьяна5
Автоматически закрывает старую тему и открывает новую тему при достижении 250 сообщений и выводит сообщение - "Данная тема достигла ограничения в 250 постов и создана новая ".

Аватар пользователя
Александр Лешванов
(можно Николаич)
(можно Николаич) 
*
Google Chrome 49.0.262 Google Chrome 49.0.262
Windows XP Windows XP
Монитор: 1152 x 864 1152 x 864

  255 Closing a Thread With 250 posts - закрытие в 250 постов

Сообщение Разместил Александр Лешванов 28 апр 2017, 14:31

Открыть: posting.php
Найти:
Код: выделить все
if ($mode == 'edit')
         {
            $data['topic_replies_real'] = $post_data['topic_replies_real'];
            $data['topic_replies'] = $post_data['topic_replies'];
         }

Добавить после:
Код: выделить все
 // idiotnesia wuz here
         if ($mode == 'reply')
         {
            $data['topic_replies_real'] = $post_data['topic_replies_real'];
         }

Открыть: includes/functions_posting.php
Найти
Код: выделить все
      // Send Notifications

Добавить перед:
Код: выделить все
// idiotnesia wuz here -------------------------------------------------------
   $newURL = '1';
    if ($mode == 'reply' && $data['topic_replies_real'] >= 249)
    {
        $db->sql_query('UPDATE ' . TOPICS_TABLE . ' SET topic_status = ' . ITEM_LOCKED . ' WHERE topic_id = ' . (int) $data['topic_id'] . ' AND topic_moved_id = 0');
      $data['message'] = generate_text_for_edit($data['message'], $data['bbcode_uid'], true);
      $data['message'] = htmlspecialchars(html_entity_decode($data['message']['text']));
      // variables to hold the parameters for submit_post
      $poll = $uid = $bitfield = $options = '';
      $allow_bbcode = $data['enable_bbcode'];
      $allow_urls = $data['enable_urls'];
      $allow_smilies = $data['enable_smilies'];
      //Create next topic
      $next_topic_text   = '[url=' . generate_board_url() . '/viewtopic.' . $phpEx . '?f=' . $data['forum_id'] . '&amp;t=' . $data['topic_id'] . ']' . $user->lang['PREVIOUS_TOPIC'] . '[/url]<br />' . $data['message'];
      //If old post has attachments
      $sql = 'SELECT attach_id, mimetype FROM ' . ATTACHMENTS_TABLE . ' WHERE post_msg_id = ' . (int) $data['post_id'];
      $result = $db->sql_query($sql);
      while ($attach_row = $db->sql_fetchrow($result))
      {
         if(strpos($attach_row['mimetype'], 'image/') !== false)
         {
            $next_topic_text .= '<br />[img]' . generate_board_url() . '/download/file.php?id= ' . (int) $attach_row['attach_id'] . '[/img]';
         }
         else
         {
            $next_topic_text .= '<br />[url=' . generate_board_url() . '/download/file.php?id= ' . (int) $attach_row['attach_id'] . ']' . $user->lang['DOWNLOAD_FILE'] . '[/url]';
         }
      }
      $db->sql_freeresult($result);
      $next_topic_text = preg_replace('/[attachment=(.*?)[/attachment]/', '', $next_topic_text);
      generate_text_for_storage($next_topic_text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
      $next_topic_data = array(
         'forum_id'      => $data['forum_id'],
         'icon_id'      => $data['icon_id'],
         'topic_title'   => $subject,
         'enable_bbcode'      => $data['enable_bbcode'],
         'enable_smilies'   => $data['enable_smilies'],
         'enable_urls'      => $data['enable_urls'],
         'enable_sig'      => $data['enable_sig'],
         'message'      => $next_topic_text,
         'message_md5'   => (string)md5($next_topic_text),
         'bbcode_bitfield'   => $bitfield,
         'bbcode_uid'      => $uid,
         'post_edit_locked'   => $data['post_edit_locked'],
         'notify_set'      => $data['notify_set'],
         'notify'         => $data['notify'],
         'post_time'       => $current_time,
         'forum_name'      => $data['forum_name'],
         'enable_indexing'   => $data['enable_indexing'],
         'post_expire_time'   => -1,
         'topic_expire_type'   => 0,
         'expire_forum_id'   => 0,
         'forum_ranon_flags' => 0,
         'topic_featured'   => 0,
         'post_id'          => 0,
      );
      $newURL = submit_post('post', $subject, '', POST_NORMAL, $poll, $next_topic_data);
      //Edit old topic
      $this_topic_text = $data['message'] . '<br />[url=' . generate_board_url() . '/viewtopic.' . $phpEx . '?f=' . $data['forum_id'] . '&amp;t=' . $next_topic_data['topic_id'] . ']' . $user->lang['NEXT_TOPIC'] . '[/url]';
      generate_text_for_storage($this_topic_text, $uid, $bitfield, $options, true, true, true);
      $this_topic_data = array(
         'forum_id'            => (int)  $data['forum_id'],
         'poster_id'            => (int) $data['poster_id'],
         'icon_id'            => (int) $data['icon_id'],
         'post_approved'         => (isset($data['post_approved'])) ? $data['post_approved'] : false,
         'enable_bbcode'         => (bool) $data['enable_bbcode'],
         'enable_smilies'      => (bool) $data['enable_smilies'],
         'enable_urls'         => (bool) $data['enable_urls'],
         'enable_sig'         => (bool) $data['enable_sig'],
         'topic_title'         => $subject,
         'message_md5'         => (string)md5($this_topic_text),
         'attachment_data'      => $data['attachment_data'],
         'bbcode_bitfield'      => $bitfield,
         'bbcode_uid'         => $uid,
         'post_edit_locked'      => (int) $data['post_edit_locked'],
         'message'            => $this_topic_text,
         'topic_approved'      => (isset($data['topic_approved'])) ? $data['topic_approved'] : false,
         'topic_first_post_id'   => (isset($data['topic_first_post_id'])) ? (int) $data['topic_first_post_id'] : 0,
         'topic_last_post_id'   => (isset($data['topic_last_post_id'])) ? (int) $data['topic_last_post_id'] : 0,
         'topic_time_limit'      => (int) $data['topic_time_limit'],
         'post_id'            => (int)  $data['post_id'],
         'topic_id'            => (int)  $data['topic_id'],
         'topic_replies_real'   => $data['topic_replies_real'],
         'enable_indexing'      => (bool) $data['enable_indexing'],
         'post_time'            => (isset($data['post_time'])) ? (int) $data['post_time'] : $current_time,
         'post_edit_reason'      => $data['post_edit_reason'],
         'post_edit_user'      => 0,
         'forum_name'         => $data['forum_name'],
         'notify'            => (isset($data['notify'])) ? $data['notify'] : false,
         'notify_set'         => (isset($data['notify_set'])) ? $data['notify_set'] : false,
         'post_expire_time'      => -1,
         'topic_expire_type'     => 0,
         'expire_forum_id'      => 0,
         'forum_ranon_flags'     => 0,
         'topic_featured'       => 0,
      );
      submit_post('edit', $subject, '', POST_NORMAL, $poll, $this_topic_data);
    }
// idiotnesia wuz here ------------------------------------------------------

Найти:
Код: выделить все
   $url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx";
   if (isset($data['post_moved_link']))
      {
         $url = ( $data['post_moved_link'] )? $data['post_id'] : append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor;
      }
      else
      {
         $url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor; //Добавлено FEAR93
      }

Добавить до:
Код: выделить все
   if($newURL == '1'){

Добавить после:
Код: выделить все
   }
   else
   {
      $url = (isset($data['post_moved_link']) &&  $data['post_moved_link']) ? $data['post_id'] : $newURL;
   }

Аватар пользователя
Александр Лешванов
(можно Николаич)
(можно Николаич) 
*
Google Chrome 49.0.262 Google Chrome 49.0.262
Windows XP Windows XP

  255 Closing a Thread With 250 posts - закрытие в 250 постов

Сообщение Разместил Александр Лешванов 28 апр 2017, 14:32

Или инструкцией в архиве от автора -

Аватар пользователя
Александр Лешванов
(можно Николаич)
(можно Николаич) 
*
Google Chrome 49.0.262 Google Chrome 49.0.262
Windows XP Windows XP

  255 Closing a Thread With 250 posts - закрытие в 250 постов

Сообщение Разместил Александр Лешванов 29 апр 2017, 04:29

Вывод информации что тема закрыта примерно так -
viewtopic.php
Найти
Код: выделить все
'QUICK_REPLY'            => false,

Добавить после
Код: выделить все
'S_IS_FILLED'            => true,

И на страницах тем будет работать условие <!-- IF S_IS_FILLED -->, когда тема заполнена
Между условием - языковую переменную....
То есть в viewtopic_body.htmlдобавляем блок -
Код: выделить все
<!-- БЛОК СООБЩЕНИЯ О 250 ПОСТАХ в ТЕМЕ -->
<!-- IF S_IS_FILLED -->
   <div class="m-stat">
      <h5 style="text-align: center; font: bold 20px Arial; color: #008000; text-shadow: 2px 2px 8px #3652ad;"><img src="{T_THEME_PATH}/images/yeux_viewtopic.gif" alt="" />&nbsp;&bull;&nbsp;{L_TOPIC_250_POST}&nbsp;&bull;&nbsp;<img src="{T_THEME_PATH}/images/yeux_viewtopic.gif" alt="" /></h5>
    </div>
<!-- ENDIF -->

А в языковыйviewtopic.phpдобавляем переменную -
Код: выделить все
   'TOPIC_250_POST'           => 'Данная тема достигла ограничения в 250 постов и добавление сообщений в ней отключено.<br />Перейти в следующую тему можно по фразе - ссылке в последнем сообщении.',

Готово!!!!

Аватар пользователя
Александр Лешванов
(можно Николаич)
(можно Николаич) 
*
Google Chrome 49.0.262 Google Chrome 49.0.262
Windows XP Windows XP

  255 Closing a Thread With 250 posts - закрытие в 250 постов

Сообщение Разместил Александр Лешванов 19 ноя 2019, 11:38

Другой вариант под СЕО -

Открыть: posting.php
Найти:
Код: выделить все
if ($mode == 'edit')
         {
            $data['topic_replies_real'] = $post_data['topic_replies_real'];
            $data['topic_replies'] = $post_data['topic_replies'];
         }

Добавить после:
Код: выделить все
 // idiotnesia wuz here
         if ($mode == 'reply')
         {
            $data['topic_replies_real'] = $post_data['topic_replies_real'];
         }

Открыть: includes/functions_posting.php
Найти
Код: выделить все
      // Send Notifications

Добавить перед:
Код: выделить все
// idiotnesia wuz here -------------------------------------------------------
   $newURL = '1';
    if ($mode == 'reply' && $data['topic_replies_real'] >= 249)
    {
        $db->sql_query('UPDATE ' . TOPICS_TABLE . ' SET topic_status = ' . ITEM_LOCKED . ' WHERE topic_id = ' . (int) $data['topic_id'] . ' AND topic_moved_id = 0');
      
      $data['message'] = generate_text_for_edit($data['message'], $data['bbcode_uid'], true);
      $data['message'] = htmlspecialchars(html_entity_decode($data['message']['text']));
      
      // variables to hold the parameters for submit_post
      $poll = $uid = $bitfield = $options = '';
      $allow_bbcode = $data['enable_bbcode'];
      $allow_urls = $data['enable_urls'];
      $allow_smilies = $data['enable_smilies'];
      
      
      //Create next topic
      
      $next_topic_text   = '[url=' . generate_board_url() . '/viewtopic.' . $phpEx . '?f=' . $data['forum_id'] . '&amp;t=' . $data['topic_id'] . ']' . $user->lang['PREVIOUS_TOPIC'] . '[/url]<br />' . $data['message'];
      
      //If old post has attachments
      $sql = 'SELECT attach_id, mimetype FROM ' . ATTACHMENTS_TABLE . ' WHERE post_msg_id = ' . (int) $data['post_id'];
      $result = $db->sql_query($sql);
      while ($attach_row = $db->sql_fetchrow($result))
      {
         if(strpos($attach_row['mimetype'], 'image/') !== false)
         {
            $next_topic_text .= '<br />[img]' . generate_board_url() . '/download/file.php?id= ' . (int) $attach_row['attach_id'] . '[/img]';
         }
         else
         {
            $next_topic_text .= '<br />[url=' . generate_board_url() . '/download/file.php?id= ' . (int) $attach_row['attach_id'] . ']' . $user->lang['DOWNLOAD_FILE'] . '[/url]';
         }
      }
      $db->sql_freeresult($result);
      $next_topic_text = preg_replace('/[attachment=(.*?)[/attachment]/', '', $next_topic_text);
      
      generate_text_for_storage($next_topic_text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
      
      $next_topic_data = array(
         'forum_id'      => $data['forum_id'],
         'icon_id'      => $data['icon_id'],
         'topic_title'   => $subject,

         'enable_bbcode'      => $data['enable_bbcode'],
         'enable_smilies'   => $data['enable_smilies'],
         'enable_urls'      => $data['enable_urls'],
         'enable_sig'      => $data['enable_sig'],

         'message'      => $next_topic_text,
         'message_md5'   => (string)md5($next_topic_text),
                  
         'bbcode_bitfield'   => $bitfield,
         'bbcode_uid'      => $uid,

         'post_edit_locked'   => $data['post_edit_locked'],
         'notify_set'      => $data['notify_set'],
         'notify'         => $data['notify'],
         'post_time'       => $current_time,
         'forum_name'      => $data['forum_name'],
         'enable_indexing'   => $data['enable_indexing'],
         'post_expire_time'   => -1,
         'topic_expire_type'   => 0,
         'expire_forum_id'   => 0,
         'forum_ranon_flags' => 0,
         'topic_featured'   => 0,
         'post_id'          => 0,
      );
      
      $newURL = submit_post('post', $subject, '', POST_NORMAL, $poll, $next_topic_data);
      
      //Edit old topic
      $this_topic_text = $data['message'] . '<br />[url=' . generate_board_url() . '/viewtopic.' . $phpEx . '?f=' . $data['forum_id'] . '&amp;t=' . $next_topic_data['topic_id'] . ']' . $user->lang['NEXT_TOPIC'] . '[/url]';
      generate_text_for_storage($this_topic_text, $uid, $bitfield, $options, true, true, true);
      
      $this_topic_data = array(
         'forum_id'            => (int)  $data['forum_id'],
         'poster_id'            => (int) $data['poster_id'],
         'icon_id'            => (int) $data['icon_id'],
         'post_approved'         => (isset($data['post_approved'])) ? $data['post_approved'] : false,
         'enable_bbcode'         => (bool) $data['enable_bbcode'],
         'enable_smilies'      => (bool) $data['enable_smilies'],
         'enable_urls'         => (bool) $data['enable_urls'],
         'enable_sig'         => (bool) $data['enable_sig'],
         'topic_title'         => $subject,
         'message_md5'         => (string)md5($this_topic_text),
         'attachment_data'      => $data['attachment_data'],
         'bbcode_bitfield'      => $bitfield,
         'bbcode_uid'         => $uid,
         'post_edit_locked'      => (int) $data['post_edit_locked'],
         'message'            => $this_topic_text,
         
         'topic_approved'      => (isset($data['topic_approved'])) ? $data['topic_approved'] : false,
         'topic_first_post_id'   => (isset($data['topic_first_post_id'])) ? (int) $data['topic_first_post_id'] : 0,
         'topic_last_post_id'   => (isset($data['topic_last_post_id'])) ? (int) $data['topic_last_post_id'] : 0,
         'topic_time_limit'      => (int) $data['topic_time_limit'],
         'post_id'            => (int)  $data['post_id'],
         'topic_id'            => (int)  $data['topic_id'],
         'topic_replies_real'   => $data['topic_replies_real'],
         
         'enable_indexing'      => (bool) $data['enable_indexing'],
         'post_time'            => (isset($data['post_time'])) ? (int) $data['post_time'] : $current_time,
         'post_edit_reason'      => $data['post_edit_reason'],
         'post_edit_user'      => 0,
         'forum_name'         => $data['forum_name'],
         'notify'            => (isset($data['notify'])) ? $data['notify'] : false,
         'notify_set'         => (isset($data['notify_set'])) ? $data['notify_set'] : false,
         'post_expire_time'      => -1,
         'topic_expire_type'     => 0,
         'expire_forum_id'      => 0,
         'forum_ranon_flags'     => 0,
         'topic_featured'       => 0,
      );
      
      submit_post('edit', $subject, '', POST_NORMAL, $poll, $this_topic_data);
    }
// idiotnesia wuz here ------------------------------------------------------

Найти:
Код: выделить все
   $url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx";
   if (isset($data['post_moved_link']))
      {
         $url = ( $data['post_moved_link'] )? $data['post_id'] : append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor;
      }
      else
      {
         $url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor; //Добавлено FEAR93
      }

Добавить до:
Код: выделить все
   if($newURL == '1'){

Добавить после:
Код: выделить все
   }
   else
   {
      $url = (isset($data['post_moved_link']) &&  $data['post_moved_link']) ? $data['post_id'] : $newURL;
   }

Порядок!!!!

Ещё вот такие правки можно, под Fotovideoforum.ru
includes/functions_posting.php
Найти
Код: выделить все
$next_topic_text   = '[url=' . generate_board_url() . '/viewtopic.' . $phpEx . '?f=' . $data['forum_id'] . '&amp;t=' . $data['topic_id'] . ']' . $user->lang['PREVIOUS_TOPIC'] . '[/url]<br />' . $data['message'];

Заменить на (заменяю ссылку на тему для seo)
Код: выделить все
$next_topic_text   = '[url=' . generate_board_url() . '/topic' . $data['topic_id'] . '.html]' . $user->lang['PREVIOUS_TOPIC'] . '[/url]<br />' . $data['message'];

Найти
Код: выделить все
$next_topic_text .= '<br />[img]' . generate_board_url() . '/download/file.php?id= ' . (int) $attach_row['attach_id'] . '[/img]';

Заменить на (img на hsimg)
Код: выделить все
$next_topic_text .= '<br />[hsimg]' . generate_board_url() . '/download/file.php?id= ' . (int) $attach_row['attach_id'] . '[/hsimg]';

Найти
Код: выделить все
$this_topic_text = $data['message'] . '<br />[url=' . generate_board_url() . '/viewtopic.' . $phpEx . '?f=' . $data['forum_id'] . '&amp;t=' . $next_topic_data['topic_id'] . ']' . $user->lang['NEXT_TOPIC'] . '[/url]';

Заменить на (тоже seo-ссылки)
Код: выделить все
$this_topic_text = $data['message'] . '<br />[url=' . generate_board_url() . '/topic' . $next_topic_data['topic_id']. '.html]' . $user->lang['NEXT_TOPIC'] . '[/url]';

Остаются ссылки на вложения, но тут они не так просто замещаются

Аватар пользователя
Александр Лешванов
(можно Николаич)
(можно Николаич) 
*
Google Chrome 49.0.262 Google Chrome 49.0.262
Windows XP Windows XP

Вернуться в 450 модов движка форумов phpBB (до версии 3.0.14)



 • Блок вывода аналогичных по названию других тем нашего форума • 

HTML5 Validated Счетчик ИКС Яндекс.Метрика