Strona 1 z 1

Co to za modyfikacja

: 27 maja 2007, 09:24
autor: AKURAT
Mam pytanko jak sie nazywa ta modyfikacja

szukalem ale nie znalazlem konkretnych
tylko takie jakby szczatkowe
np. 10 najnowszych tematów itd.

a chodzi mi konktertnie o
http://img511.imageshack.us/img511/7854/32491265ns6.jpg

: 27 maja 2007, 10:25
autor: jaroslw
Table with Lasts Topics on index by KARQL
##############################################################
## MOD Title: Table with Lasts Topics on index by KARQL
## MOD Author: KARQL < karql@op.pl > (N/A) unitedcrew.net
## MOD Description: This mod added small table on the top of the forum index
## with x lasts topics, most popular and biggest number of answers.
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 3 Minutes
## Files To Edit(3): index.php,
## language/lang_english/lang_main.php,
## templates/subSilver/index_body.tpl
##
## Included Files: (0)
## License: http://opensource.org/licenses/gpl-license.php GNU Public License v2
##############################################################
## MOD History:
##
## 2005-07-30 - Version 1.0.0
## - making this mod
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#

index.php

#
#-----[ FIND ]------------------------------------------
#

'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

'L_LASTS_TOPICS' => $lang['lasts_topics'],
'L_TOPICS_ANSWERS' => $lang['topic_answers'],
'L_TOPICS_VIEWS' => $lang['topic_views'],

#
#-----[ FIND ]------------------------------------------
#

$template->pparse('body');

#
#-----[ BEFORE, ADD ]------------------------------------------
# Change setings would you prefer

/////// Table with Lasts Topics on index by KARQL ///////

//SETINGS//
$lasts_topics = '5'; //liczba ostanich tematow
$short_topic_long ='20'; //dlugosc skroconego tematu
$tr_color = '1'; //jesli chcesz kolorowac na przemian wiersze wpisz 1 jesli nie 0
//SETINGS//

if ( COLOR_RANKS === true )
{
$query = 'u.user_id, u.username, u.user_rank, u.user_posts,';
}

else
{
$query = 'u.user_id, u.username,';
}

$sql = 'SELECT t.topic_id, t.topic_title, t.topic_time, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, '.$query.' f.forum_id, f.auth_read FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p, '.USERS_TABLE.' u, '.FORUMS_TABLE.' f WHERE t.topic_last_post_id = p.post_id AND p.poster_id=u.user_id AND t.forum_id=f.forum_id ORDER BY t.topic_time DESC LIMIT '.$lasts_topics;

$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Opis błędu", "", __LINE__, __FILE__, $sql);
}

$topic_count = $db->sql_numrows($result);
$topic_rows = $db->sql_fetchrowset($result);

for($i = 0; $i < $topic_count; $i++)
{
$last_post_time = create_date( $board_config['default_dateformat'], $topic_rows[$i]['post_time'], $board_config['board_timezone'] );
$topic_title = $topic_rows[$i]['topic_title'];
$topic_title_short = $topic_rows[$i]['topic_title'];
$link_author = ( $topic_rows[$i]['user_id'] == ANONYMOUS ) ? ( ($topic_rows[$i]['username'] != '' ) ? $lang['Guest'] . ' ' : $lang['Guest'] . ' ' ) : $topic_rows[$i]['username'];

if ( COLOR_RANKS === true )
{
$author = ( $topic_rows[$i]['user_id'] == ANONYMOUS ) ? ( ($topic_rows[$i]['username'] != '' ) ? $lang['Guest'] . ' ' : $lang['Guest'] . ' ' ) : color_username($topic_rows[$i]['user_id'], $topic_rows[$i]['username'], $topic_rows[$i]['user_rank'], $topic_rows[$i]['user_posts']);
}

else
{
$author = ( $topic_rows[$i]['user_id'] == ANONYMOUS ) ? ( ($topic_rows[$i]['username'] != '' ) ? $lang['Guest'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="profile.php?mode=viewprofile&u='.$topic_rows[$i]['user_id'].'">'.$topic_rows[$i]['username'].'</a>';
}

if ( count($orig_word) )
{
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
$topic_title_short = preg_replace($orig_word, $replacement_word, $topic_title_short);
}

if (strlen($topic_title_short)>$short_topic_long)
{
$topic_title_short = substr($topic_title_short,0,$short_topic_long) . '...';
}

$topic_link = '<a href="'.$phpbb_root_path.'viewtopic.php?t='.$topic_rows[$i]['topic_id'].'" title="'.$lang['Topic'].': '.$topic_title.' '.$lang['author_last_post'].': '.$link_author.' '.$lang['last_post_date'].': '.$last_post_time.'">'.$topic_title_short.'</a><br />';

$auth_read_all = array();
$auth_read_all=auth(AUTH_READ, AUTH_LIST_ALL, $userdata, $forum_data);
$auth_data = '';

if ( $tr_color == true )
{
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
}
else
{
$row_class = $theme['td_class1'];
}

if (!$auth_read_all[$topic_rows[$i]['forum_id']]['auth_read'])
{
$template->assign_block_vars("topic_last", array(
'ROW_CLASS' => $row_class,
'LINK' => '',
'AUTHOR' => $author,
));
}

else
{
$template->assign_block_vars("topic_last", array(
'ROW_CLASS' => $row_class,
'LINK' => $topic_link,
'AUTHOR' => $author,
));
}
}


$sql = 'SELECT t.topic_id, t.topic_title, t.topic_replies, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username, f.forum_id, f.auth_read FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p, '.USERS_TABLE.' u, '.FORUMS_TABLE.' f WHERE t.topic_last_post_id = p.post_id AND p.poster_id=u.user_id AND t.forum_id=f.forum_id ORDER BY t.topic_replies DESC, t.topic_title ASC LIMIT '.$lasts_topics;

$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Opis błędu", "", __LINE__, __FILE__, $sql);
}

$topic_count = $db->sql_numrows($result);
$topic_rows = $db->sql_fetchrowset($result);

for($i = 0; $i < $topic_count; $i++)
{
$last_post_time = create_date( $board_config['default_dateformat'], $topic_rows[$i]['post_time'], $board_config['board_timezone'] );
$topic_title = $topic_rows[$i]['topic_title'];
$topic_title_short = $topic_rows[$i]['topic_title'];

$author = ( $topic_rows[$i]['user_id'] == ANONYMOUS ) ? ( ($topic_rows[$i]['username'] != '' ) ? $lang['Guest'] . ' ' : $lang['Guest'] . ' ' ) : $topic_rows[$i]['username'] ;

if ( count($orig_word) )
{
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
$topic_title_short = preg_replace($orig_word, $replacement_word, $topic_title_short);
}

if (strlen($topic_title_short)>$short_topic_long)
{
$topic_title_short = substr($topic_title_short,0,$short_topic_long) . '...';
}

$topic_link = '<a href="'.$phpbb_root_path.'viewtopic.php?t='.$topic_rows[$i]['topic_id'].'" title="'.$lang['Topic'].': '.$topic_title.' '.$lang['author_last_post'].': '.$author.' '.$lang['last_post_date'].': '.$last_post_time.'">'.$topic_title_short.'</a><br />';


$auth_read_all = array();
$auth_read_all=auth(AUTH_READ, AUTH_LIST_ALL, $userdata, $forum_data);
$auth_data = '';

if ( $tr_color == true )
{
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
}
else
{
$row_class = $theme['td_class1'];
}

if (!$auth_read_all[$topic_rows[$i]['forum_id']]['auth_read'])
{
$template->assign_block_vars("topic_replies", array(
'ROW_CLASS' => $row_class,
'LINK' => '',
'REPLIES' => $topic_rows[$i]['topic_replies'],
));
}

else
{
$template->assign_block_vars("topic_replies", array(
'ROW_CLASS' => $row_class,
'LINK' => $topic_link,
'REPLIES' => $topic_rows[$i]['topic_replies'],
));
}
}


$sql = 'SELECT t.topic_id, t.topic_title, t.topic_views, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username, f.forum_id, f.auth_read FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p, '.USERS_TABLE.' u, '.FORUMS_TABLE.' f WHERE t.topic_last_post_id = p.post_id AND p.poster_id=u.user_id AND t.forum_id=f.forum_id ORDER BY t.topic_views DESC, t.topic_title ASC LIMIT '.$lasts_topics;

$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Opis błędu", "", __LINE__, __FILE__, $sql);
}

$topic_count = $db->sql_numrows($result);
$topic_rows = $db->sql_fetchrowset($result);

for($i = 0; $i < $topic_count; $i++)
{
$last_post_time = create_date( $board_config['default_dateformat'], $topic_rows[$i]['post_time'], $board_config['board_timezone'] );
$topic_title = $topic_rows[$i]['topic_title'];
$topic_title_short = $topic_rows[$i]['topic_title'];
$author = ( $topic_rows[$i]['user_id'] == ANONYMOUS ) ? ( ($topic_rows[$i]['username'] != '' ) ? $lang['Guest'] . ' ' : $lang['Guest'] . ' ' ) : $topic_rows[$i]['username'] ;

if ( count($orig_word) )
{
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
$topic_title_short = preg_replace($orig_word, $replacement_word, $topic_title_short);
}

if (strlen($topic_title_short)>$short_topic_long)
{
$topic_title_short = substr($topic_title_short,0,$short_topic_long) . '...';
}

$topic_link = '<a href="'.$phpbb_root_path.'viewtopic.php?t='.$topic_rows[$i]['topic_id'].'" title="'.$lang['Topic'].': '.$topic_title.' '.$lang['author_last_post'].': '.$author.' '.$lang['last_post_date'].': '.$last_post_time.'">'.$topic_title_short.'</a><br />';

$auth_read_all = array();
$auth_read_all=auth(AUTH_READ, AUTH_LIST_ALL, $userdata, $forum_data);
$auth_data = '';

if ( $tr_color == true )
{
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
}
else
{
$row_class = $theme['td_class1'];
}

if (!$auth_read_all[$topic_rows[$i]['forum_id']]['auth_read'])
{
$template->assign_block_vars("topic_views", array(
'ROW_CLASS' => $row_class,
'LINK' => '',
'VIEWS' => $topic_rows[$i]['topic_views'],
));
}

else
{
$template->assign_block_vars("topic_views", array(
'ROW_CLASS' => $row_class,
'LINK' => $topic_link,
'VIEWS' => $topic_rows[$i]['topic_views'],
));
}

}
/////// Table with Lasts Topics on index by KARQL ///////

#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#

//
// That's all, Folks!
// -------------------------------------------------

?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

/////// Table with Lasts Topics on index by KARQL ///////
$lang['lasts_topics'] = 'Lasts Topics';
$lang['topic_answers'] = 'Most Answers';
$lang['topic_views'] = 'Most Popular';
$lang['author_last_post'] = 'Author last post';
$lang['last_post_date'] = 'Date last post';
/////// Table with Lasts Topics on index by KARQL ///////

#
#-----[ OPEN ]------------------------------------------
#

language/lang_polish/lang_main.php

#
#-----[ FIND ]------------------------------------------
#

//
// That's all, Folks!
// -------------------------------------------------

?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

/////// Table with Lasts Topics on index by KARQL ///////
$lang['lasts_topics'] = 'Ostatnie Tematy';
$lang['topic_answers'] = 'Najwięcej Odpowiedzi';
$lang['topic_views'] = 'Najczę¶ciej Czytane';
$lang['author_last_post'] = 'Autor ostatniego postu';
$lang['last_post_date'] = 'Data ostatniego postu';
/////// Table with Lasts Topics on index by KARQL ///////

#
#-----[ OPEN ]------------------------------------------
#

templastes/subSilver/index_body.tpl

#
#-----[ FIND ]------------------------------------------
#

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="2" class="thCornerL" height="25" nowrap="nowrap">&nbsp;{L_FORUM}&nbsp;</th>
<th width="50" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICS}&nbsp;</th>
<th width="50" class="thTop" nowrap="nowrap">&nbsp;{L_POSTS}&nbsp;</th>
<th class="thCornerR" nowrap="nowrap">&nbsp;{L_LASTPOST}&nbsp;</th>
</tr>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- Table with Lasts Topics on index by KARQL -->
<table width="100%">
<tr>
<td width="33%" valign="top">
<table width="100%" cellspacing="1" cellpadding="4" border="0" align="left" class="forumline">
<tr>
<th class="thCornerL" colspan="2">{L_LASTS_TOPICS}</th>
</tr>
<!-- BEGIN topic_last -->
<tr>
<td class="{topic_last.ROW_CLASS}" width="70%"><span class="gensmall">{topic_last.LINK}</span></td>
<td class="{topic_last.ROW_CLASS}" width="30%" align="center"><span class="gensmall">{topic_last.AUTHOR}</span></td>
</tr>
<!-- END topic_last -->
</table>
</td>
<td width="33%" valign="top">
<table width="100%" cellspacing="1" cellpadding="4" border="0" align="left" class="forumline">
<tr>
<th class="thCornerL" colspan="2">{L_TOPICS_ANSWERS}</th>
</tr>
<!-- BEGIN topic_replies -->
<tr>
<td class="{topic_replies.ROW_CLASS}" width="80%"><span class="gensmall">{topic_replies.LINK}</span></td>
<td class="{topic_replies.ROW_CLASS}" width="20%" align="center"><span class="gensmall">{topic_replies.REPLIES}</span></td>
</tr>
<!-- END topic_replies -->
</table>
</td>
<td width="33%" valign="top">
<table width="100%" cellspacing="1" cellpadding="4" border="0" align="left" class="forumline">
<tr>
<th class="thCornerL" colspan="2">{L_TOPICS_VIEWS}</th>
</tr>
<!-- BEGIN topic_views -->
<tr>
<td class="{topic_views.ROW_CLASS}" width="80%"><span class="gensmall">{topic_views.LINK}</span></td>
<td class="{topic_views.ROW_CLASS}" width="20%" align="center"><span class="gensmall">{topic_views.VIEWS}</span></td>
</tr>
<!-- END topic_views -->
</table>
</td>
</table>
<br clear="all" />
<!-- Table with Lasts Topics on index by KARQL -->

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Sorry za taką długą wstawke, ale nie mam jak wrzucić na serwer ;p

: 27 maja 2007, 17:46
autor: AKURAT
dziekuje !!