В принципе, этот мод и Обновить время последнего сообщения при редактировании друг друга дополняют и изначально писались как одно целое. Но, поскольку их обоих можно использовать независимо друг от друга, то в результате получилось два мода.
Версия phpBB: 2.0.11
Код: Выделить всё
##############################################################
## MOD Title: Show new posts before submit
## MOD Author: Meithar < N/A > (N/A) N/A
## MOD Description: If you submit new message and topic has new posts (if someone
## replied while you wrote your message), this mod delay submiting and show you these
## new posts.
##
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 1 Minutes
##
## Files To Edit: posting.php
## templates/subSilver/posting_body.tpl
## language/lang_english/lang_main.php
##
## Included Files: templates/subSilver/posting_show_new_posts.tpl
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes: Work only for registered users.
##
##############################################################
## MOD History:
##
## 2004-12-26 - Version 1.0.0
## - first version
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------
#
copy templates/subSilver/posting_show_new_posts.tpl to templates/subSilver/posting_show_new_posts.tpl
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
// --------------------
// What shall we do?
//
if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$topic_has_new_posts = FALSE;
if ( $userdata['session_logged_in'] && ($submit || $preview || $mode == 'quote' || $mode == 'reply') && isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) )
{
$tracking_topics = unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']);
if ( $topic_last_read = intval($tracking_topics[$topic_id]) )
{
$sql = 'SELECT p.*, pt.post_text, pt.bbcode_uid, u.username
FROM ' . POSTS_TABLE . ' p, ' . POSTS_TEXT_TABLE . ' pt, ' . USERS_TABLE . ' u
WHERE p.topic_id = ' . intval($topic_id) . '
AND u.user_id = p.poster_id
AND pt.post_id = p.post_id
AND p.post_time > ' . $topic_last_read . '
ORDER BY p.post_time
LIMIT ' . $board_config['posts_per_page'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain new posts information', '', __LINE__, __FILE__, $sql);
}
if ( $rowset = $db->sql_fetchrowset($result) )
{
$topic_has_new_posts = TRUE;
$template->set_filenames(array('show_new_posts' => 'posting_show_new_posts.tpl'));
if ( !defined('WORD_LIST_OBTAINED') )
{
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
define('WORD_LIST_OBTAINED', TRUE);
}
for ($i = 0; $i < count($rowset); $i++)
{
if ( $rowset[$i]['poster_id'] == ANONYMOUS )
{
$new_post_username = ($rowset[$i]['post_username'] == '') ? $lang['Guest'] : $rowset[$i]['post_username'];
}
else
{
$new_post_username = $rowset[$i]['username'];
}
$new_post_post_date = create_date($board_config['default_dateformat'], $rowset[$i]['post_time'], $board_config['board_timezone']);
$new_post_message = ( !empty($orig_word) ) ? preg_replace($orig_word, $replacement_word, $rowset[$i]['post_text']) : $rowset[$i]['post_text'];
if ( !$board_config['allow_html'] && $rowset[$i]['enable_html'] )
{
$new_post_message = preg_replace('#(<)([\/]?.*?)(>)#is', '<\2>', $new_post_message);
}
if ( $rowset[$i]['bbcode_uid'] != '' )
{
$new_post_message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($new_post_message, $rowset[$i]['bbcode_uid']) : preg_replace('/\:[0-9a-z\:]+\]/i', ']', $new_post_message);
}
$new_post_message = make_clickable($new_post_message);
if ( $board_config['allow_smilies'] && $rowset[$i]['enable_smilies'] )
{
$new_post_message = smilies_pass($new_post_message);
}
$new_post_message = str_replace("\n", '<br />', $new_post_message);
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('new_posts', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'POSTER_NAME' => $new_post_username,
'POST_DATE' => $new_post_post_date,
'MESSAGE' => $new_post_message,
)
);
}
$template->assign_vars(array(
'NEW_POST_MINI_POST_IMG' => $images['icon_minipost_new'],
'L_NEW_POSTS_PREVIEW' => $lang['New_Posts_Preview'],
'L_NEW_POSTS_AUTHOR' => $lang['Author'],
'L_NEW_POSTS_MESSAGE' => $lang['Message'],
'L_NEW_POSTS_POSTED' => $lang['Posted'],
)
);
$template->assign_var_from_handle('SHOW_NEW_POSTS_BOX', 'show_new_posts');
$tracking_topics[$topic_id] = time();
setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
unset($rowset, $new_post_message);
}
$db->sql_freeresult($result);
}
}
#
#-----[ FIND ]------------------------------------------
#
else if ( $submit || $confirm )
#
#-----[ REPLACE WITH ]------------------------------------------
#
else if ( ($submit || $confirm) && !$topic_has_new_posts )
#
#-----[ FIND ]------------------------------------------
#
if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' )
#
#-----[ REPLACE WITH ]------------------------------------------
#
if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' || ($submit && $topic_has_new_posts) )
#
#-----[ FIND ]------------------------------------------
#
if( $preview )
{
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
#
#-----[ REPLACE WITH ]------------------------------------------
#
if( $preview )
{
if ( !defined('WORD_LIST_OBTAINED') )
{
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
define('WORD_LIST_OBTAINED', TRUE);
}
#
#-----[ FIND ]------------------------------------------
#
if ( $mode == 'quote' )
{
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replace_word);
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $mode == 'quote' )
{
if ( !defined('WORD_LIST_OBTAINED') )
{
$orig_word = array();
$replace_word = array();
obtain_word_list($orig_word, $replace_word);
define('WORD_LIST_OBTAINED', TRUE);
}
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
{POST_PREVIEW_BOX}
#
#-----[ BEFORE, ADD ]------------------------------------------
#
{SHOW_NEW_POSTS_BOX}
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
// -------------------------------------------------
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['New_Posts_Preview'] = 'Topic has new posts:';
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Код: Выделить всё
<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
<tr>
<td colspan="2" height="28" class="catHead" align="center"><span class="cattitle">{L_NEW_POSTS_PREVIEW}</span></td>
</tr>
<tr>
<th class="thLeft" width="22%" height="26">{L_NEW_POSTS_AUTHOR}</th>
<th class="thRight">{L_NEW_POSTS_MESSAGE}</th>
</tr>
<!-- BEGIN new_posts -->
<tr>
<td width="22%" align="left" valign="top" class="{new_posts.ROW_CLASS}"><span class="name"><b>{new_posts.POSTER_NAME}</b></span></td>
<td class="{new_posts.ROW_CLASS}" height="28" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><img src="{NEW_POST_MINI_POST_IMG}" width="12" height="9" border="0" /><span class="postdetails">{L_NEW_POSTS_POSTED}: {new_posts.POST_DATE}</span></td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<tr>
<td colspan="2"><span class="postbody">{new_posts.MESSAGE}</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" height="1" class="spaceRow"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<!-- END new_posts -->
</table>
<br clear="all" />