da Acid die alte Mod-Datenbank schon geschlossen hat und in der neuen Datenbank dieser Mod (http://www.phpbb.de/topic27032-340.html) noch nicht steht, geht es erst einmal hier weiter.
Ich habe die Änderungen gefunden, die mir damals Acid geschickt hatte. Hier nun der geänderte Mod:
recent.php
Code: Alles auswählen
<?php
// ############ Edit below ############
$length = '25'; // Laenge des Titels
$limit = '15'; // Anzahl der Themen
$limit_text = '3'; // Anzahl der Texte
$forums = '1,2'; // ID der Foren, die angezeigt werden sollen; separate them with a comma
$topics = '1,2'; // ID der Topics, die angezeigt werden sollen; separate them with a comma
$content = '100'; // length of post_text
// ############ Edit above ############
include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
FROM ". TOPICS_TABLE ." t, ". FORUMS_TABLE ." f, ". USERS_TABLE ." u, ". POSTS_TABLE ." p, ". POSTS_TABLE ." p2, ". USERS_TABLE ." u2
WHERE f.forum_id IN ($forums) AND t.topic_id IN ($topics)
AND t.topic_poster = u.user_id
AND f.forum_id = t.forum_id
AND p.post_id = t.topic_first_post_id
AND p2.post_id = t.topic_last_post_id
AND u2.user_id = p2.poster_id
ORDER BY t.topic_last_post_id DESC LIMIT $limit";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic information.', '', __LINE__, __FILE__, $sql);
}
$line = array();
while( $row = $db->sql_fetchrow($result) )
{
$line[] = $row;
}
$db->sql_freeresult($result);
$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
for($i = 0; $i < count($line); $i++)
{
$forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $line[$i]['forum_id']);
$forum_id = $line[$i]['forum_id'];
$topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $line[$i]['topic_id']);
$topic_id = $line[$i]['topic_id'];
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$word_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $line[$i]['topic_title']) : $line[$i]['topic_title'];
$topic_title = ( strlen($line[$i]['topic_title']) < $length ) ? $word_censor : substr(stripslashes($word_censor), 0, $length) . "...";
$topic_type = ( $line[$i]['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';
$topic_type .= ( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE ) ? $lang['Topic_global_announcement'] .' ': '';
$topic_type .= ( $line[$i]['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';
$topic_type .= ( $line[$i]['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';
$views = $line[$i]['topic_views'];
$replies = $line[$i]['topic_replies'];
if ( ( $replies + 1 ) > $board_config['posts_per_page'] )
{
$total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
$goto_page = ' [ ';
$times = 1;
for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
{
$goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '" >' . $times . '</a>';
if ( $times == 1 && $total_pages > 4 )
{
$goto_page .= ' ... ';
$times = $total_pages - 3;
$j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
}
else if ( $times < $total_pages )
{
$goto_page .= ', ';
}
$times++;
}
$goto_page .= ' ] ';
}
else
{
$goto_page = '';
}
if ( $line[$i]['topic_status'] == TOPIC_LOCKED )
{
$folder = $images['folder_locked'];
$folder_new = $images['folder_locked_new'];
}
else if ( $line[$i]['topic_type'] == POST_ANNOUNCE )
{
$folder = $images['folder_announce'];
$folder_new = $images['folder_announce_new'];
}
else if ( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE )
{
$folder = $images['folder_global_announce'];
$folder_new = $images['folder_global_announce_new'];
}
else if ( $line[$i]['topic_type'] == POST_STICKY )
{
$folder = $images['folder_sticky'];
$folder_new = $images['folder_sticky_new'];
}
else
{
if ( $replies >= $board_config['hot_threshold'] )
{
$folder = $images['folder_hot'];
$folder_new = $images['folder_hot_new'];
}
else
{
$folder = $images['folder'];
$folder_new = $images['folder_new'];
}
}
if ( $userdata['session_logged_in'] )
{
if ( $line[$i]['post_time'] > $userdata['user_lastvisit'] )
{
if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
$unread_topics = true;
if ( !empty($tracking_topics[$topic_id]) )
{
if ( $tracking_topics[$topic_id] > $line[$i]['post_time'] )
{
$unread_topics = false;
}
}
if ( !empty($tracking_forums[$forum_id]) )
{
if ( $tracking_forums[$forum_id] > $line[$i]['post_time'] )
{
$unread_topics = false;
}
}
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $line[$i]['post_time'] )
{
$unread_topics = false;
}
}
if ( $unread_topics )
{
$folder_image = $folder_new;
$folder_alt = $lang['New_posts'];
$newest_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
}
else
{
$folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
$folder_image = $folder;
$folder_alt = $folder_alt;
$newest_img = '';
}
}
else if ( $line[$i]['post_time'] > $userdata['user_lastvisit'] )
{
$folder_image = $folder_new;
$folder_alt = $lang['New_posts'];
$newest_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="'. $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
}
else
{
$folder_image = $folder;
$folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
$newest_img = '';
}
}
else
{
$folder_image = $folder;
$folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
$newest_img = '';
}
}
else
{
$folder_image = $folder;
$folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
$newest_img = '';
}
$first_time = create_date($board_config['default_dateformat'], $line[$i]['topic_time'], $board_config['board_timezone']);
$first_author = ( $line[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $line[$i]['user_id']) . '" class="genmed">'.$line[$i]['username'].'</a>' : ( ($line[$i]['post_username'] != '' ) ? $line[$i]['post_username'] : $lang['Guest'] );
$last_time = create_date($board_config['default_dateformat'], $line[$i]['post_time'], $board_config['board_timezone']);
$last_author = ( $line[$i]['id2'] == ANONYMOUS ) ? ( ($line[$i]['post_username2'] != '' ) ? $line[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $line[$i]['id2']) . '" class="genmed">' . $line[$i]['user2'] . '</a>';
$last_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $line[$i]['topic_last_post_id']) . '#' . $line[$i]['topic_last_post_id'] . '"><img src="'. $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('recent', array(
'TOPIC_TITLE' => $topic_title,
'TOPIC_TYPE' => $topic_type,
'VIEWS' => $views,
'REPLIES' => $replies,
'GOTO_PAGE' => $goto_page,
'TOPIC_FOLDER_IMG' => '<img src='.$folder_image.' width=19 height=18 alt='.$folder_alt.' />',
'NEWEST_IMG' => $newest_img,
'FIRST_TIME' => $first_time,
'FIRST_AUTHOR' => $first_author,
'LAST_TIME' => $last_time,
'LAST_AUTHOR' => $last_author,
'LAST_URL' => $last_url,
'ROW_CLASS' => $row_class,
'L_BY' => $lang['by'],
'L_STARTED' => $lang['Started'],
'L_REPLIES' => $lang['Replies'],
'L_VIEWS' => $lang['Views'],
'FORUM_NAME' => $line[$i]['forum_name'],
'U_VIEW_FORUM' => $forum_url,
'FORUM_ID' => $forum_id,
'U_VIEW_TOPIC' => $topic_url,
'TOPIC_ID' => $topic_id
));
$sql = "SELECT t.topic_id, t.topic_last_post_id, p.post_id, p.enable_html, p.enable_smilies, p.enable_bbcode, p.topic_id, pt.*
FROM ". TOPICS_TABLE ." t, ". POSTS_TABLE ." p, ". POSTS_TEXT_TABLE ." pt
WHERE p.post_id = pt.post_id AND p.topic_id = $topic_id AND p.topic_id = t.topic_id
ORDER BY t.topic_last_post_id DESC LIMIT $limit_text";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not obtain text information.', '', __LINE__, __FILE__, $sql);
}
while( $text = $db->sql_fetchrow($result) )
{
$bbcode_uid = $text['bbcode_uid'];
$post_text = $text['post_text'];
$text_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $post_text) : $post_text;
$post_text = ( strlen($post_text) < $content ) ? $text_censor : substr(stripslashes($text_censor), 0, $content) . "...";
if ( !$board_config['allow_html'] )
{
if ( $text['enable_html'] )
{
$post_text = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $post_text);
}
}
if ( $board_config['allow_bbcode'] )
{
if ( $bbcode_uid != '' )
{
$post_text = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($post_text, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $post_text);
}
}
if ( $board_config['allow_smilies'] )
{
if ( $text['enable_smilies'] )
{
$post_text = smilies_pass($post_text);
}
}
$post_text = str_replace("\n", "\n<br />\n", $post_text);
$post_text = make_clickable($post_text);
$template->assign_block_vars('recent.text', array(
'POST_TEXT' => $post_text,
));
}
}
$template->assign_vars(array(
'L_RECENT_TITLE' => $lang['Title']
));
?>
Code: Alles auswählen
#
# Änderungen von Acid für den recent_topic_mod Version 2 für die index.php
#
#
#
#
#
#
#
################################################
#
#------[ neuer Teil für die index-body.tpl ]-----------------
#
<table width="60%" cellpadding="1" cellspacing="1" border="0" align="center" class="forumline">
<tr>
<th colspan="7">{L_RECENT_TITLE}</th>
</tr>
<!-- BEGIN recent -->
<tr>
<td class="{recent.ROW_CLASS}" align="center" valign="middle">{recent.TOPIC_FOLDER_IMG}</td>
<td class="{recent.ROW_CLASS}"><a href="{recent.U_VIEW_FORUM}" class="genmed">{recent.FORUM_NAME}</td>
<td class="{recent.ROW_CLASS}"><span class="topictitle">{recent.NEWEST_IMG}{recent.TOPIC_TYPE}<a href="{recent.U_VIEW_TOPIC}" class="topictitle">{recent.TOPIC_TITLE}</a></span>
<font size="-6">{recent.GOTO_PAGE}<br />{recent.L_STARTED} {recent.FIRST_TIME} {recent.L_BY} {recent.FIRST_AUTHOR}</font></td>
<td class="{recent.ROW_CLASS}" align="right"><span class="postdetails">{recent.REPLIES} {recent.L_REPLIES}
<br />{recent.VIEWS} {recent.L_VIEWS}</span> </td>
<td class="{recent.ROW_CLASS}" align="right" valign="middle" nowrap="nowrap"><span class="gensmall"> {recent.LAST_URL} {recent.LAST_TIME}
<br />{recent.LAST_AUTHOR}</span> </td>
</tr>
<!-- BEGIN text -->
<tr>
<td colspan="7" class="{recent.ROW_CLASS}"><span class="gensmall"> {recent.text.POST_TEXT}</span></td>
</tr>
<!-- END text -->
<!-- END recent -->
</table>
#
#--------------------------------------------------------
#
#
#---------[ Bestehender Teil ]----------------------------
#
<!-- BEGIN recent -->
<!-- BEGIN switch_user_logged -->
<tr>
<td class="row1" width="100%">
<p><span class="gensmall">Forum: »» <a href="{recent.U_VIEW_FORUM}" class="genmed">{recent.FORUM_NAME} </a>««</span><br>
<span class="gensmall"></span><span class="topictitle">{recent.TOPIC_TYPE}
<a href="{recent.U_VIEW_TOPIC}" class="genmed">{recent.TOPIC_TITLE}</a></span><br>
<span class="gensmall">{recent.L_STARTED} {recent.FIRST_TIME} {recent.L_BY} {recent.FIRST_AUTHOR}<br>{recent.L_ON} {recent.FIRST_POST}</span></p>
<span class="gensmall"><blockquote>{recent.POST_TEXT}</blockquote></span>
<p><span class="gensmall"> {recent.LAST_URL} {recent.LAST_TIME} {recent.LAST_AUTHOR}</span> </p>
</td>
</tr>
<!-- END switch_user_logged -->
<!-- END recent -->
#
#-------------------------------------------------------
#
Gruß Helmut
