Localizare în limba română :
Nu este prezentă.
Descrierea MOD-ului :
Afişează ultimele 5 subiecte din forum pe index.php
Instalare
Instalarea este intermediară, şi se poate realiza în 20 de minute.
Fişiere ce trebuie modificate
index.php, search.php, index_body.tpl, lang_main.php
Conţinut
Cod: Selectaţi tot
#
#-----[ SE DESCHIDE ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ CAUTA ]------------------------------------------
#
$lang['A_critical_error'] = 'A Critical Error Occurred';
#
#-----[ DUPA, ADAUGA ]------------------------------------------
#
// BEGIN Recent Topics mod (drathbun)
$lang['Most_recent_activity'] = 'Most recent activity (all forums)';
// END Recent Topics mod (drathbun)
#
#-----[ SE DESCHIDE ]------------------------------------------
#
index.php
#
#-----[ CAUTA ]------------------------------------------
#
//
// Okay, let's build the index
//
#
#-----[ DUPA, ADAUGA ]------------------------------------------
#
// BEGIN Recent Topics mod (drathbun)
$auth_view_forum_sql = '';
// END Recent Topics mod (drathbun)
#
#-----[ CAUTA ]------------------------------------------
#
$display_forums = true;
#
#-----[ DUPA, ADAUGA ]------------------------------------------
#
// BEGIN Recent Topics mod (drathbun)
// This line builds this list of forums
// a user is "auth'd" to view, to be used
// later as a where clause
$auth_view_forum_sql .= ($auth_view_forum_sql == '' ? '' : ', ' ) . $forum_data[$j]['forum_id'];
// END Recent Topics mod (drathbun)
#
#-----[ CAUTA ]------------------------------------------
#
}// if ... total_categories
#
#-----[ INAINTE, ADAUGA ]------------------------------------------
#
// BEGIN Recent Topics mod (drathbun)
// The main code for the mod begins here. Earlier on the list of
// authorized forums was built. First, check to see if there are any,
// and if not, use (0) as a substitute. Otherwise we have a comma-delimted
// list of forums which we then bracket with parenthesis (). The input might
// be 1, 2, 3 and the output will be (1, 2, 3). This will later be used
// in the sql used to retrieve the recent activity.
$auth_view_forum_sql = ($auth_view_forum_sql == '' ? '(0)' : '(' . $auth_view_forum_sql . ')');
$template->assign_vars(array(
'L_MOST_RECENT_ACTIVITY' => $lang['Most_recent_activity'],
'URL_MOST_RECENT_ACTIVITY' => append_sid("search.$phpEx?search_id=recent"),
'AUTH_SQL' => $auth_view_forum_sql
));
$sql = "SELECT t.topic_id topic_id,
t.topic_title topic_title,
t.topic_last_post_id topic_last_post_id,
p.post_time post_time,
p.poster_id last_post_user_id,
t.topic_replies topic_replies,
t.topic_views topic_views,
f.forum_name forum_name,
f.forum_id forum_id,
u.username username
FROM " . TOPICS_TABLE . " t, "
. POSTS_TABLE . " p, "
. FORUMS_TABLE . " f, "
. USERS_TABLE . " u
WHERE t.forum_id IN " . $auth_view_forum_sql . " AND (t.topic_status <> 2)
AND t.topic_last_post_id = p.post_id
AND t.forum_id = f.forum_id
AND t.forum_id = f.forum_id
AND p.poster_id = u.user_id
ORDER BY p.post_time DESC, t.topic_replies DESC
LIMIT 5";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't retrieve topic data for recent replies", "", __LINE__, __FILE__, $sql);
}
$topic_count = $db->sql_numrows($result);
$recent_topics = $db->sql_fetchrowset($result);
for ($i = 0; $i < $topic_count; $i++)
{
$class = ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'];
// set local copy of variables from sql result set
$topic_post_time = create_date($board_config['default_dateformat'], $recent_topics[$i]['post_time'], $board_config['board_timezone']);
$topic_last_post_id = $recent_topics[$i]['topic_last_post_id'];
$topic_replies = $recent_topics[$i]['topic_replies'];
$topic_views = $recent_topics[$i]['topic_views'];
$topic_id = $recent_topics[$i]['topic_id'];
$forum_id = $recent_topics[$i]['forum_id'];
// Build url to jump to last post in topic,
// need to add "page" information, this was borrowed from
// existing phpBB code for generating topic listings from
// viewforums.php
$topic_jump_url = $topic_post_time . '<br />';
$topic_jump_url .= ( $recent_topics[$i]['last_post_user_id'] == ANONYMOUS ) ? ( ($recent_topics[$i]['post_username'] != '' ) ? $recent_topics[$i]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $recent_topics[$i]['last_post_user_id']) . '">' . $recent_topics[$i]['username'] . '</a> ';
$topic_jump_url .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topics[$i]['topic_last_post_id']) . '#' . $recent_topics[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
// build url to jump to various pages of topic if
// longer than board limit
if( ( $topic_replies + 1 ) > $board_config['posts_per_page'] )
{
$total_pages = ceil( ( $topic_replies + 1 ) / $board_config['posts_per_page'] );
$goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
$times = 1;
for($j = 0; $j < $topic_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 = '';
}
$template->assign_block_vars('topicrecent', array(
'CLASS' => $class,
'TITLE' => $recent_topics[$i]['topic_title'],
'TIME' => $topic_post_time,
'FORUM' => $recent_topics[$i]['forum_name'],
'FORUM_URL' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"),
'JUMP_URL' => $topic_jump_url,
'GOTO_PAGE' => $goto_page,
'REPLIES' => $topic_replies,
'VIEWS' => $topic_views,
'TOPIC_URL' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"))
);
}
// END Recent Topics mod (drathbun)
#
#-----[ SE DESCHIDE ]------------------------------------------
#
search.php
#
#-----[ CAUTA LINIA ]------------------------------------------
#
if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' )
#
#-----[ INLOCUIESTE-O CU ]------------------------------------------
#
if ( $search_id == 'recent' || $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' )
#
#-----[ CAUTA ]------------------------------------------
#
if ( $search_id == 'newposts' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' ) )
#
#-----[ INLOCUIESTE-O CU ]------------------------------------------
#
if ( $search_id == 'recent' || $search_id == 'newposts' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' ) )
#
#-----[ CAUTA ]------------------------------------------
#
else if ( $search_id == 'egosearch' )
#
#-----[ DUPA, ADAUGA ]------------------------------------------
#
else if ( $search_id == 'recent' )
{
$temptime = time() - 604800; // 604800 seconds is 7 days
$sql = "SELECT post_id
FROM " . POSTS_TABLE . "
WHERE post_time >=$temptime ";
$show_results = "topics";
$sortby = 0;
$sortby_dir = "DESC";
}
#
#-----[ SE DESCHIDE ]------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ CAUTA ]------------------------------------------
#
<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2">
<tr>
<td align="left"><span class="gensmall"><a href="{U_MARK_READ}" class="gensmall">{L_MARK_FORUMS_READ}</a></span></td>
<td align="right"><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table>
#
#-----[ DUPA, ADAUGA ]------------------------------------------
#
<!-- inceput Topics MOD -->
<!-- Recent Topics Mod (drathbun) -->
<br clear="all" />
<table width="100%" border="0" cellpadding="4" cellspacing="1" class="forumline" width="100%">
<tr>
<td class="catHead" colspan="5" height="28"><a href="{URL_MOST_RECENT_ACTIVITY}" class="cattitle">Ultimele discutii</a></td>
</tr>
<tr>
<th class="thCornerL" align="center" nowrap="nowrap"><strong>{L_FORUM}</strong></th>
<th class="thTop" align="center" width="100%"><strong>Subiect</strong></th>
<th class="thTop" align="center" width="50"><strong>{L_REPLIES}</strong></th>
<th class="thTop" align="center" width="50"><strong>{L_VIEWS}</strong></th>
<th class="thCornerR" align="center"><strong>Ultimul mesaj</strong></th>
</tr>
<!-- BEGIN topicrecent -->
<tr>
<td class="row1" align="left" valign="middle" nowrap="nowrap"><span class="genmed"><a href="{topicrecent.FORUM_URL}" class="topictitle">{topicrecent.FORUM}</a></span></td>
<td class="row1" align="left" valign="middle"><span class="genmed"><a href="{topicrecent.TOPIC_URL}" class="topictitle">{topicrecent.TITLE}</a></span><span class="gensmall"><br />{topicrecent.GOTO_PAGE}</a></span></td>
<td class="row2" align="center" valign="middle"><span class="gensmall">{topicrecent.REPLIES}</span></td>
<td class="row2" align="center" valign="middle"><span class="gensmall">{topicrecent.VIEWS}</span></td>
<td class="row3right" align="center" valign="middle" nowrap="nowrap"><span class="gensmall">{topicrecent.JUMP_URL}</span></td>
</tr>
<!-- END topicrecent -->
</table>
<br clear="all" />
<!-- Recent Topics Mod (drathbun) -->
<!-- sfarsit Topics MOD -->
#
#-----[ SALVEAZA ]------------------------------------------
#