Let op, bevat nog één bug, die wel te omzeilen is: De welkomstekst wordt na deze aanpassing niet meer weergeven. Ik ben bezig met een fix!
Code: Selecteer alles
##############################################################
## MOD Title: CMX Slash News Mod & ezPortal & Split Topics & Categories Hierarchy 2.0.x integration
## MOD Author: Bee <basweb@lycos.nl> (Bas Veerman) http://phpbb.avrill.nl/
## MOD Description: This mod is an integration between four mods:
## - CMX Slash News Mod
## - Smartor ezPortal
## - Split Topic Types (Or Topic Calendar, Or Announces Suite)
## - Categories Hierarchy
## You don't need all this mods, you can skip what you don't need!
## MOD Version: 0.5.0
##
## Installation Level: Intermediate
## Installation Time: 10 Minutes
## Files To Edit: portal.php, includes/functions_topics_list.php, includes/def_auth.php, templates/subSilver/portal_body.tpl
## Included Files: n/a
##############################################################
## 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: This is a beta mod, use it for testing purposes only!
##
##############################################################
## MOD History:
##
## 2005-05-27 - Version 0.5.0
## - First tryout version
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
portal.php
#
#-----[ FIND ]------------------------------------------
#
$CFG['welcome_text'] =
#
#-----[ REPLACE WITH ]------------------------------------------
#
$CFG_PORTAL['welcome_text'] =
#
#-----[ DELETE ]------------------------------------------
#
// Number of news on portal
$CFG['number_of_news'] = '5';
// Length of news
$CFG['news_length'] = '200';
// News Forum ID: separate by comma for multi-forums, eg. '1,2,5'
$CFG['news_forum'] = '1';
#
#-----[ FIND ]------------------------------------------
#
$CFG['poll_forum'] = '1';
#
#-----[ REPLACE WITH ]------------------------------------------
#
$CFG_PORTAL['poll_forum'] = '1';
#
#-----[ FIND ]------------------------------------------
#
include_once( $phpbb_root_path . 'common.' . $phpEx );
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once ($phpbb_root_path . 'includes/news.' . $phpEx );
#
#-----[ FIND ]------------------------------------------
#
$userdata = session_pagestart($user_ip, PAGE_INDEX);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$userdata = session_pagestart( $user_ip, PAGE_INDEX, $session_length );
#
#-----[ FIND ]------------------------------------------
#
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$template->set_filenames( array(
'news' => 'portal_body.tpl' )
);
#
#-----[ FIND ]------------------------------------------
#
'WELCOME_TEXT' => $CFG['welcome_text'],
#
#-----[ REPLACE WITH ]------------------------------------------
#
'WELCOME_TEXT' => $CFG_PORTAL['welcome_text'],
#
#-----[ DELETE ]------------------------------------------
#
//
// Fetch Posts from Announcements Forum
//
if(!isset($HTTP_GET_VARS['article']))
{
$template->assign_block_vars('welcome_text', array());
$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], $CFG['news_length']);
for ($i = 0; $i < count($fetchposts); $i++)
{
if( $fetchposts[$i]['striped'] == 1 )
{
$open_bracket = '[ ';
$close_bracket = ' ]';
$read_full = $lang['Read_Full'];
}
else
{
$open_bracket = '';
$close_bracket = '';
$read_full = '';
}
$template->assign_block_vars('fetchpost_row', array(
'TITLE' => $fetchposts[$i]['topic_title'],
'POSTER' => $fetchposts[$i]['username'],
'TIME' => $fetchposts[$i]['topic_time'],
'TEXT' => $fetchposts[$i]['post_text'],
'REPLIES' => $fetchposts[$i]['topic_replies'],
'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id']),
'U_READ_FULL' => append_sid('portal.' . $phpEx . '?article=' . $i),
'L_READ_FULL' => $read_full,
'OPEN' => $open_bracket,
'CLOSE' => $close_bracket)
);
}
}
else
{
$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], 0);
$i = intval($HTTP_GET_VARS['article']);
$template->assign_block_vars('fetchpost_row', array(
'TITLE' => $fetchposts[$i]['topic_title'],
'POSTER' => $fetchposts[$i]['username'],
'TIME' => $fetchposts[$i]['topic_time'],
'TEXT' => $fetchposts[$i]['post_text'],
'REPLIES' => $fetchposts[$i]['topic_replies'],
'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id'])
)
);
}
//
// END: Fetch Announcements
//
#
#-----[ FIND ]------------------------------------------
#
$fetchpoll = phpbb_fetch_poll($CFG['poll_forum']);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$fetchpoll = phpbb_fetch_poll($CFG_PORTAL['poll_forum']);
#
#-----[ FIND ]------------------------------------------
#
$template->assign_vars(array(
'S_POLL_QUESTION' => $lang['No_poll'],
'DISABLED' => 'disabled="disabled"'
)
);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
$content =& new NewsModule( $phpbb_root_path );
$content->setVariables( array(
'L_INDEX' => $lang['Index'],
'L_CATEGORIES' => $lang['Categories'],
'L_ARCHIVES' => $lang['Archives']
) );
if( (isset( $_GET['news'] ) && $_GET['news'] == 'categories') )
{
// View the news categories.
$content->setVariables( array( 'TITLE' => $lang['News'] . ' ' . $lang['Categories'] ) );
$content->renderTopics( );
}
elseif( isset( $_GET['news'] ) && $_GET['news'] == 'archives' )
{
// View the news Archives.
$year = (isset( $_GET['year'] )) ? $_GET['year'] : 0;
$month = (isset( $_GET['month'] )) ? $_GET['month'] : 0;
$day = (isset( $_GET['day'] )) ? $_GET['day'] : 0;
$key = (isset( $_GET['key'] )) ? $_GET['key'] : '';
$content->setVariables( array( 'TITLE' => $lang['News'] . ' ' . $lang['Archives'] ) );
$content->renderArchives( $year, $month, $day, $key );
}
else
{
// View news articles.
$topic_id = 0;
if( isset( $_GET['topic_id'] ) )
{
$topic_id = $_GET['topic_id'];
}
elseif( isset( $_GET['news_id'] ) )
{
$topic_id = $_GET['news_id'];
}
$content->setVariables( array( 'TITLE' => $lang['News'] . ' ' . $lang['Articles'] ) );
$content->renderArticles( $topic_id );
}
$content->renderPagination( );
$content->display( );
$content->clear( );
#
#-----[ DELETE ]------------------------------------------
#
//
// Generate the page
//
$template->pparse('body');
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/portal_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- END welcome_text -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
<tr><th>{TITLE}</th></tr>
<tr>
<td class="row1">
<!-- BEGIN pagination -->
<div class="nav" style="float: right;text-align: right; padding: 10px; margin: 10px 0 10px 20px; clear: both;">
{pagination.PAGINATION}
</div>
<!-- END pagination -->
<div class="nav" style=" padding: 0; margin: 10px 0;">
<a href="{INDEX_FILE}" alt="Index">{L_INDEX}</a> |
<a href="{INDEX_FILE}?news=categories" alt="Index">{L_CATEGORIES}</a> |
<a href="{INDEX_FILE}?news=archives" alt="Index">{L_ARCHIVES}</a>
</div>
<!-- BEGIN categories -->
<div style="border: #ddd solid 1px; float: left; padding: 10px; margin: 10px;">
<a href="{INDEX_FILE}?cat_id={categories.ID}"><img style="border: 0" src="{categories.IMAGE}" alt="{articles.TITLE}" /></a>
</div>
<!-- END categories -->
<!-- BEGIN arch -->
<ul style=" padding: 0 1.3em; margin: 10px 0;">
<!-- BEGIN year -->
<li class="gen"><a href="{INDEX_FILE}?news=archives&year={arch.year.YEAR}">{arch.year.YEAR}</a></li>
<!-- BEGIN month -->
<li class="gen" style="margin-left: 1em;"> <a href="{INDEX_FILE}?news=archives&year={arch.year.YEAR}&month={arch.year.month.MONTH}">{arch.year.month.L_MONTH} {arch.year.month.POST_COUNT} </a></li>
<!-- BEGIN day -->
<li class="gen" style="margin-left: 2em;"> <a href="{INDEX_FILE}?news=archives&year={arch.year.YEAR}&month={arch.year.month.MONTH}&day={arch.year.month.day.DAY}">{arch.year.month.day.L_DAY} {arch.year.month.day.POST_COUNT}</a></li>
<!-- END day -->
<!-- END month -->
<!-- END year -->
</ul>
<!-- END arch -->
<!-- BEGIN articles -->
<div style="border: #ddd solid 1px; padding: 10px; margin-bottom: 10px; clear: both;">
<div style="float: right; padding: 5px; margin: 5px;">
<a href="{INDEX_FILE}?cat_id={articles.CAT_ID}"><img src="{articles.CAT_IMG}" alt="{articles.CATEGORY}" style="border: 0" /></a>
</div>
<div class="topictitle"><a href="{INDEX_FILE}?topic_id={articles.ID}">{articles.L_TITLE}</a></div>
<div class="postdetails">{articles.POST_DATE} by {articles.L_POSTER} | <a href="{articles.U_COMMENTS}">{articles.L_COMMENTS}</a></div>
<hr />
<div class="postbody">
{articles.BODY} {articles.READ_MORE_LINK}
</div>
<div style="clear:both; height: 0; margin:0; padding: 0;"> </div>
</div>
<!-- END articles -->
<!-- BEGIN comments -->
<hr />
<div style="border: #ddd solid 1px; padding: 10px; margin: 10px 0 10px 20px; clear: both;">
<div class="topictitle">{comments.L_TITLE}</div>
<div class="postdetails">{comments.POST_DATE} by {comments.L_POSTER}</div>
<hr />
<div class="postbody">
{comments.BODY}
</div>
</div>
<!-- END comments -->
<!-- BEGIN pagination -->
<hr />
<div class="nav" style="text-align: right; padding: 10px; margin: 10px 0 10px 20px; clear: both;">
{pagination.PAGINATION}
</div>
<!-- END pagination -->
</td>
</tr>
</table>
#
#-----[ DELETE ]------------------------------------------
#
<!-- BEGIN fetchpost_row -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" height="25"><span class="genmed"><b>{L_ANNOUNCEMENT}: {fetchpost_row.TITLE}</b></span></td>
</tr>
<tr>
<td class="row2" align="left" height="24"><span class="gensmall">{L_POSTED}: <b>{fetchpost_row.POSTER}</b> @ {fetchpost_row.TIME}</span></td>
</tr>
<tr>
<td class="row1" align="left"><span class="gensmall" style="line-height:150%">{fetchpost_row.TEXT}<br /><br />{fetchpost_row.OPEN}<a href="{fetchpost_row.U_READ_FULL}">{fetchpost_row.L_READ_FULL}</a>{fetchpost_row.CLOSE}</span></td>
</tr>
<tr>
<td class="row3" align="left" height="24"><span class="gensmall">{L_COMMENTS}: {fetchpost_row.REPLIES} :: <a href="{fetchpost_row.U_VIEW_COMMENTS}">{L_VIEW_COMMENTS}</a> (<a href="{fetchpost_row.U_POST_COMMENT}">{L_POST_COMMENT}</a>)</span></td>
</tr>
</table>
<br />
<!-- END fetch_post_row -->
#
#-----[ OPEN ]---------------------------------------
#
includes/functions_topics_list.php
#
#-----[ FIND ]---------------------------------------
#
'LAST_POST_IMG' => $last_post_url,
#
#-----[ AFTER, ADD ]---------------------------------------
#
// BEGIN cmx_mod
'L_NEWS' => $news_label,
// END cmx_mod
#
#-----[ FIND ]---------------------------------------
#
break;
}
// categories hierarchy v 2 compliancy
#
#-----[ BEFORE, ADD ]---------------------------------------
#
// BEGIN cmx_mod
$news_label = ( $topic_rowset[$i]['news_id'] > 0 ) ? $lang['News'] . ':' : '';
// END cmx_mod
#
#-----[ OPEN ]------------------------------------------
#
includes/def_auth.php
#
#-----[ FIND ]------------------------------------------
#
// View Read Post
#
#-----[ IN-LINE FIND ]------------------------------------------
#
Post
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
News
#
#-----[ FIND ]------------------------------------------
#
0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL,
#
#-----[ IN-LINE FIND ]---------------------------------------------
#
0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
AUTH_MOD,
#
#-----[ FIND ]------------------------------------------
#
1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG,
#
#-----[ IN-LINE FIND ]---------------------------------------------
#
1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
AUTH_MOD,
#
#-----[ FIND ]------------------------------------------
#
2 => array(AUTH_REG, AUTH_REG, AUTH_REG,
#
#-----[ IN-LINE FIND ]---------------------------------------------
#
2 => array(AUTH_REG, AUTH_REG, AUTH_REG,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
AUTH_MOD,
#
#-----[ FIND ]------------------------------------------
#
3 => array(AUTH_ALL, AUTH_ACL, AUTH_ACL,
#
#-----[ IN-LINE FIND ]---------------------------------------------
#
3 => array(AUTH_ALL, AUTH_ACL, AUTH_ACL,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
AUTH_ACL,
#
#-----[ FIND ]------------------------------------------
#
4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL,
#
#-----[ IN-LINE FIND ]---------------------------------------------
#
4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
AUTH_ACL,
#
#-----[ FIND ]------------------------------------------
#
5 => array(AUTH_ALL, AUTH_MOD, AUTH_MOD,
#
#-----[ IN-LINE FIND ]---------------------------------------------
#
5 => array(AUTH_ALL, AUTH_MOD, AUTH_MOD,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
AUTH_MOD,
#
#-----[ FIND ]------------------------------------------
#
6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD,
#
#-----[ IN-LINE FIND ]---------------------------------------------
#
6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD,
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
AUTH_MOD,
#
#-----[ FIND ]------------------------------------------
#
'auth_post' => $lang['Post'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'auth_news' => $lang['News'],
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM