Да вроде работает тег юрла...
Хм... Последнее сообщение: что есть уже новая тема со ссылкой на новую, после создания новой темы в старой теме угадывается, но при переходе к нему (к последнему) - его нет... Исчезло...
Старая закрытая тема с исчезнувшим 11-м сообщением...
Код: Выделить всё
// idiotnesia wuz here
$newURL = '1';
if ($mode == 'reply' && $data['topic_replies_real'] >= 9)
{
$db->sql_query('UPDATE ' . TOPICS_TABLE . ' SET topic_status = ' . ITEM_LOCKED . ' WHERE topic_id = ' . (int) $data['topic_id'] . ' AND topic_moved_id = 0');
$my_subject = $data['topic_title'];
$data['message'] = generate_text_for_edit($data['message'], $data['bbcode_uid'], true);
$data['message'] = $data['message']['text'];
$my_text = '[url=' . generate_board_url() . '/viewtopic.' . $phpEx . '?f=' . $data['forum_id'] . '&t=' . $data['topic_id'] . ']' . 'Предыдущая тема' . '[/url]<br />' . $data['message'];
// variables to hold the parameters for submit_post
$poll = $uid = $bitfield = $options = '';
generate_text_for_storage($my_subject, $uid, $bitfield, $options, false, false, false);
generate_text_for_storage($my_text, $uid, $bitfield, $options, true, true, true);
$my_data = array(
'forum_id' => (int) $data['forum_id'],
'icon_id' => false,
'enable_bbcode' => true,
'enable_smilies' => true,
'enable_urls' => true,
'enable_sig' => true,
'message' => $my_text,
'message_md5' => (string)md5($my_text),
'bbcode_bitfield' => $bitfield,
'bbcode_uid' => $uid,
'post_edit_locked' => 0,
'post_expire_time' => -1,
'topic_expire_type' => 0,
'expire_forum_id' => 0,
'forum_ranon_flags' => 0,
'topic_featured' => 0,
'post_id' => 0,
'topic_title' => $my_subject,
'notify_set' => false,
'notify' => false,
'post_time' => 0,
'forum_name' => '',
'enable_indexing' => true,
);
$newURL = submit_post('post', $my_subject, '', POST_NORMAL, $poll, $my_data);
//$newURL = "{$phpbb_root_path}viewtopic.$phpEx";
//$newURL = append_sid($newURL, 'f=' . $data['forum_id'] . '&t=' . $my_data['topic_id']) . '#' . $my_data['topic_id'];
$next_topic = $data['message'] . '<br />[url=' . generate_board_url() . '/viewtopic.' . $phpEx . '?f=' . $data['forum_id'] . '&t=' . $my_data['topic_id'] . ']' . 'Следующая тема' . '[/url]';
generate_text_for_storage($next_topic, $uid, $bitfield, $options, true, true, true);
$current_time = time();
$new_data = array(
'topic_title' => $my_subject,
'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'],
'topic_attachment' => (isset($data['topic_attachment'])) ? (int) $data['topic_attachment'] : 0,
'post_id' => (int) $data['post_id'],
'topic_id' => (int) $data['topic_id'],
'forum_id' => (int) $data['forum_id'],
'icon_id' => (int) $data['icon_id'],
'poster_id' => (int) $data['poster_id'],
'enable_sig' => (bool) $data['enable_sig'],
'enable_bbcode' => (bool) $data['enable_bbcode'],
'enable_smilies' => (bool) $data['enable_smilies'],
'enable_urls' => (bool) $data['enable_urls'],
'enable_indexing' => (bool) $data['enable_indexing'],
'message_md5' => (string)md5($next_topic),
'post_time' => (isset($data['post_time'])) ? (int) $data['post_time'] : $current_time,
'post_checksum' => (isset($data['post_checksum'])) ? (string) $data['post_checksum'] : '',
'post_edit_reason' => $data['post_edit_reason'],
'post_edit_user' => 0,
'forum_parents' => $data['forum_parents'],
'forum_name' => $data['forum_name'],
'notify' => (isset($data['notify'])) ? $data['notify'] : false,
'notify_set' => (isset($data['notify_set'])) ? $data['notify_set'] : false,
'poster_ip' => (isset($data['poster_ip'])) ? $data['poster_ip'] : $user->ip,
'post_edit_locked' => (int) $data['post_edit_locked'],
'bbcode_bitfield' => $bitfield,
'bbcode_uid' => $uid,
'message' => $next_topic,
//'attachment_data' => $message_parser->attachment_data,
//'filename_data' => $message_parser->filename_data,
'topic_approved' => (isset($data['topic_approved'])) ? $data['topic_approved'] : false,
'post_approved' => (isset($data['post_approved'])) ? $data['post_approved'] : false,
'topic_replies_real' => $data['topic_replies_real'],
);
submit_post('edit', $my_subject, '', POST_NORMAL, $poll, $new_data);
}