wie haben die das denn ins portal integriert??
merke: es ist nicht immer von vorteil auf dem neusten stand sein zu wollen
Code: Alles auswählen
#################################################################
## MOD Title: Slash News for ez-portal (phpbb2+1.2)
## MOD Author: Sisuk (phpbb2.de)
## MOD Coder: Frold; slightly modified by CIRESTodd and myself (all by phpbb2.de)
## MOD Description: Allows you to use the CMX-News-Mod on the ez-portal by smartor.
## Attention: This mod is especially for the premodded portal.php which comes with phpbb2+1.2
## by phpbb2.de http://www.phpbb2.de
## It may work on other packages using the ez-portal... but I don´t know:)
## It OVERRIDES the News-Settings which comes with phpbb2+1.2. So take care!!!
##
## Installation Level: Easy
## Installation Time: 5-10 Minutes
## Files To Edit:
## portal.php,
## portal_body.tpl
##
## Files included:
## news_comment.gif
## news_email.gif
## news_print.gif
## icon_latest_reply.gif
##
#################################################################
## Author Notes:
## - What you need: To get this mod running, you need a working installation of the CMX-News-Mod
## by CodeMonkeyX < nickyoungso@yahoo.com > (Nicholas Young-Soares) http://www.codemonkeyx.net
##
## - Installation Overview:
## 0. BACK UP YOU FORUMS AND DATABASE!!!
##
## 1. Install the mod by following the commands in this file.
##
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ COPY ]------------------------------------------
#
copy root/images/news_comment.gif to images/news_comment.gif
copy root/images/news_email.gif to images/news_email.gif
copy root/images/news_print.gif to images/news_print.gif
copy root/images/icon_latest_reply.gif to images/icon_latest_reply.gif
#
#-----[ OPEN ]------------------------------------------
#
portal.php
#
#-----[ FIND ]------------------------------------------
#
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'fetchposts.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once ($phpbb_root_path . 'includes/functions_news.' . $phpEx );
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
if(isset( $topics ) )
{
#
#-----[ FIND ]------------------------------------------
#
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
} else {
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
}
#
#-----[ FIND ]------------------------------------------
#
// Welcome Avatar
'L_NAME_WELCOME' => $lang['Welcome'],
'U_NAME_LINK' => $name_link,
'USERNAME' => $name,
'AVATAR_IMG' => $avatar_img)
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
if(!isset($topics))
{
#
#-----[ FIND ]------------------------------------------
#
//
// 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
//
//
// Fetch Poll
//
$fetchpoll = phpbb_fetch_poll($CFG['poll_forum']);
if (!empty($fetchpoll))
{
$template->assign_vars(array(
'S_POLL_QUESTION' => $fetchpoll['vote_text'],
'S_POLL_ACTION' => append_sid('posting.'.$phpEx.'?'.POST_TOPIC_URL.'='.$fetchpoll['topic_id']),
'S_TOPIC_ID' => $fetchpoll['topic_id'],
'L_SUBMIT_VOTE' => $lang['Submit_vote'],
'L_LOGIN_TO_VOTE' => $lang['Login_to_vote']
)
);
for ($i = 0; $i < count($fetchpoll['options']); $i++)
{
$template->assign_block_vars('poll_option_row', array(
'OPTION_ID' => $fetchpoll['options'][$i]['vote_option_id'],
'OPTION_TEXT' => $fetchpoll['options'][$i]['vote_option_text'],
'VOTE_RESULT' => $fetchpoll['options'][$i]['vote_result'],
)
);
}
}
else
{
$template->assign_vars(array(
'S_POLL_QUESTION' => $lang['No_poll'],
'DISABLED' => 'disabled="disabled"'
)
);
}
#
#-----[ AND REPLACE WITH ]------------------------------------------
#
//
// Fetch Posts from Announcements Forum
//
$template->assign_block_vars('welcome_text', array());
$news_id = isset($HTTP_GET_VARS['news_id']) ? intval($HTTP_GET_VARS['news_id']) : 0;
$start = isset($HTTP_GET_VARS['start']) ? intval($HTTP_GET_VARS['start']) : 0;
$NEWS_CFG['recent_categories'] = 5;
$NEWS_CFG['news_category'] = 0;
$NEWS_CFG['num_news_items'] = $board_config['news_item_num'];
$NEWS_CFG['news_body_trim'] = $board_config['news_item_trim'];
$NEWS_CFG['news_topic_trim'] = $board_config['news_topic_trim'];
if( $news_id > 0 )
{
$NEWS_CFG['news_category'] = $news_id;
}
$news_link = 'News';
if( $news_id )
{
$sql = "SELECT news_category
FROM " . NEWS_TABLE . "
WHERE news_id = " . $news_id;
$result = $db->sql_query($sql);
if( $result )
{
$row = $db->sql_fetchrow($result);
$cat_name = ' & ' . $row['news_category'];
$news_link = ' & <a href="portal.php">News</a>';
}
}
//
// Get page data.
//
if( !isset( $article ) )
{
$topics_count = fetch_news_count( $news_id );
$news_items = fetch_news_posts(
$NEWS_CFG['num_news_items'],
$NEWS_CFG['news_category'],
0,
$NEWS_CFG['news_body_trim'],
$NEWS_CFG['news_topic_trim'],
' . . . ',
'',
true,
$start
);
}
else
{
$news_items = fetch_news_post( $article );
}
$cats = fetch_recent_categories( $NEWS_CFG['recent_categories'] );
if( !empty( $news_items ) )
{
//$template->set_filenames( array('body' => 'news_body.tpl' ) );
$template->assign_vars( array(
'L_NEWS' => $news_link,
'L_CAT_NAME' => $cat_name,
'L_NEWS_TOPICS' => $lang['News'] . ' ' . $lang['Topics'],
'L_NEWS_INDEX' => $lang['News'] . ' ' . $lang['Index'],
'L_POSTER' => $lang['Poster'],
'L_DATE' => $lang['Date'],
'L_COMMENTS' => $lang['View_Comments'],
'U_VIEWTOPICS' => append_sid($phpbb_root_path . 'portal.' . $phpEx . '?topics'),
'U_VIEWNEWS' => append_sid($phpbb_root_path . 'news_viewnews.' . $phpEx),
'PAGINATION' => (!isset( $article )) ? generate_pagination("portal.$phpEx?news_id=".$news_id, $topics_count, $NEWS_CFG['num_news_items'], $start) : ''
)
);
for ($i = 0; $i < count($news_items); $i++)
{
//
// Convert array.
//
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? 'row1' : 'row2';
while( list( $k, $v ) = each( $news_items[$i] ) )
{
$posts_vars[strtoupper($k)] = $v;
}
$posts_vars['READ_MORE_LINK'] = ( $news_items[$i]['body_trimmed'] == true ) ? '(<a href="' . $news_items[$i]['read_more_url'] . '">' . $lang['Read_More'] . '</a>)' : '';
$posts_vars['ROW_COLOR'] = '#' . $row_color;
$posts_vars['ROW_CLASS'] = $row_class;
$template->assign_block_vars('newsitem', $posts_vars);
}
for( $i = 0; $i < count( $cats ); $i++ )
{
while( list( $k, $v ) = each( $cats[$i] ) )
{
$cat_vars[strtoupper($k)] = $v;
}
$template->assign_block_vars('catitem', $cat_vars);
}
//$template->pparse('body');
}
else
{
$template->assign_vars( array(
'L_CAT_NAME' => $cat_name,
'NO_NEWS' => 'No news found<br><br><a href="javascript:history.go(-1)">& Back</a>'));
}
//
// END: Fetch Announcements
//
} else {
//
// START: Display News Topics
//
$template->assign_vars( array(
'L_NEWS_CATEGORIES' => $lang['News_Categories'],
'L_NEWS_INDEX' => $lang['News'] . ' ' . $lang['Index'],
'U_NEWS_INDEX' => $phpbb_root_path . 'portal.' . $phpEx
)
);
$cats = fetch_categories( );
$count = 0;
while( $count < count( $cats ) )
{
$template->assign_block_vars('catrow', array( ) );
for( $i = 0; $i < 5; $i++ )
{
$cat_vars = array( );
$row_class = ( !($count % 2) ) ? 'row1' : 'row2';
$cats[$count]['news_url'] = $phpbb_root_path . 'portal.' . $phpEx . '?news_id=' . $cats[$count]['news_id'];
if( $cats[$count]['news_image_link'] != '' )
{
$cats[$count]['news_href'] = '<a href="' . $cats[$count]['news_url'] . '" border="0">' . $cats[$count]['news_image_link'] . '</a>';
}
while( $count < count( $cats ) && list( $k, $v ) = each( $cats[$count] ) )
{
$cat_vars[strtoupper($k)] = $v;
}
$cat_vars['ROW_CLASS'] = $row_class;
$template->assign_block_vars('catrow.catitem', $cat_vars);
$count++;
}
}
}
//
// Fetch Poll
//
$fetchpoll = phpbb_fetch_poll($CFG['poll_forum']);
if (!empty($fetchpoll))
{
$template->assign_vars(array(
'S_POLL_QUESTION' => $fetchpoll['vote_text'],
'S_POLL_ACTION' => append_sid('posting.'.$phpEx.'?'.POST_TOPIC_URL.'='.$fetchpoll['topic_id']),
'S_TOPIC_ID' => $fetchpoll['topic_id'],
'L_SUBMIT_VOTE' => $lang['Submit_vote'],
'L_LOGIN_TO_VOTE' => $lang['Login_to_vote']
)
);
for ($i = 0; $i < count($fetchpoll['options']); $i++)
{
$template->assign_block_vars('poll_option_row', array(
'OPTION_ID' => $fetchpoll['options'][$i]['vote_option_id'],
'OPTION_TEXT' => $fetchpoll['options'][$i]['vote_option_text'],
'VOTE_RESULT' => $fetchpoll['options'][$i]['vote_result'],
)
);
}
}
else
{
$template->assign_vars(array(
'S_POLL_QUESTION' => $lang['No_poll'],
'DISABLED' => 'disabled="disabled"'
)
);
}
#
#-----[ OPEN ]------------------------------------------
#
templates/subsilver/portal_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN fetchpost_row -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th height="25"><span class="genmed"><b>{L_ANNOUNCEMENT}: {fetchpost_row.TITLE}</b></span></th>
</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 -->
#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- BEGIN newsitem -->
<TABLE class=forumline cellSpacing=1 cellPadding=3 width="100%" border=0>
<TBODY>
<TR>
<TD class=cat colSpan=2><SPAN class=genmed><A href="{newsitem.COMMENTS_URL}">{newsitem.TOPIC_TITLE}</A></SPAN></TD></TR>
<TR>
<td class="row2" colspan="2" valign="middle" height="18"><span class="gensmall"><img src="/templates/fisubsilver/images/icon_latest_reply.gif"> <b>{L_POSTED}</b> {L_WORD_ON} {newsitem.FORMAT_TOPIC_TIME} by <a href="{newsitem.POSTER_URL}"><b>{newsitem.USERNAME}<b/></a></span></td>
<TR>
<TD class=row1 vAlign=top><A href="{U_VIEWNEWS}?news_id={newsitem.NEWS_ID}" border="0"><img src="{newsitem.NEWS_IMAGE}" border="0" alt="{newsitem.NEWS_CATEGORY}" title="{newsitem.NEWS_CATEGORY}" /></A> </TD>
<TD class=row1 vAlign=top width="100%">
<SPAN class=gensmall>{newsitem.POST_TEXT} <br /><br />(<A href="{newsitem.COMMENTS_URL}">READ MORE</A>)</SMALL>
</SPAN></TD>
<TR>
<td class="row3" valign="middle" align="center" height="18">
<a href="posting.php?mode=reply&t={newsitem.TOPIC_ID}" target="_blank"><img src="images/news_comment.gif" alt="{L_PRINT_NEWS}" title="{L_PRINT_NEWS}" /></a>
<a href="printview.php?t={newsitem.TOPIC_ID}&start=0" target="_blank"><img src="images/news_print.gif" alt="{L_PRINT_NEWS}" title="{L_PRINT_NEWS}" /></a>
<a href="tellafriend.php?topic={newsitem.TOPIC_TITLE}&link={TELL_LINK}{newsitem.TOPIC_ID}"><img src="images/news_email.gif" alt="{L_EMAIL_NEWS}" title="{L_EMAIL_NEWS}" /></a>
</td>
<td class="row3" valign="middle" align="center" height="18">
<span class="gensmall">This news item has been viewed <b>{newsitem.TOPIC_VIEWS}</b> times and has <a href="{newsitem.COMMENTS_URL}"><b>{newsitem.TOPIC_REPLIES} Comments</b></a>.</span>
</td>
</TR></TBODY></TABLE>
<br />
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="100%" valign="bottom"><center>{NO_NEWS}</center>
<a href="{U_VIEWNEWS}">{L_NEWS_INDEX}</a>
<br />
{PAGINATION}</td>
</tr>
</table>
<!-- END newsitem -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Code: Alles auswählen
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
} else {
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
}Code: Alles auswählen
$template->set_filenames(array('body' => 'portal_body.tpl'));
}
else
{
$template->set_filenames(array('body' => 'portal_body.tpl'));
}
Code: Alles auswählen
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="100%" valign="bottom"><center>{NO_NEWS}</center>
<a href="{U_VIEWNEWS}">{L_NEWS_INDEX}</a>
<br />
{PAGINATION}</td>
</tr>
</table>
Code: Alles auswählen
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_ug_auth.php
#
#-----[ FIND ]*------------------------------------------
#
$forum_auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate');
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$forum_auth_fields = array('auth_view', 'auth_read', 'auth_post',
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
'auth_news',
$forum_auth_fields = array('auth_view'
Code: Alles auswählen
## Files included:
## news_comment.gif
## news_email.gif
## news_print.gif
## icon_latest_reply.gif Code: Alles auswählen
<b>{newsitem.TOPIC_REPLIES} Kommentare</b>
Code: Alles auswählen
<b> und </b>
Code: Alles auswählen
<tr>
<td class="row2" colspan="2" height="18"><span class="gensmall"> {L_POSTED} {L_WORD_ON} {newsitem.FORMAT_TOPIC_TIME} von <a href="{newsitem.POSTER_URL}"><b>{newsitem.USERNAME}<b/></a></span><span class="gensmall" ><a href="{newsitem.COMMENTS_URL}"><b>{newsitem.TOPIC_REPLIES} Kommentare</b></a></span></td>
</tr>Code: Alles auswählen
<tr>
<td class="row2" colspan="2" height="18"><span class="gensmall"> {L_POSTED} {L_WORD_ON} {newsitem.FORMAT_TOPIC_TIME} von <a href="{newsitem.POSTER_URL}"><b>{newsitem.USERNAME}<b/></a><img src="{SPACER}" border="0" width="100%" height="1"><a href="{newsitem.COMMENTS_URL}"><b>{newsitem.TOPIC_REPLIES} Kommentare</b></a></span></td>
</tr>
Code: Alles auswählen
<tr>
<td class="row3" height="24">
<table border="0" cellspacing="0" cellpadding="2" align="left">
<tr>
<td><span class="gensmall">{L_COMMENTS}: {fetchpost_row.REPLIES}
<!-- | {fetchpost_row.L_VIEWS}: {fetchpost_row.VIEWS} -->
</span></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" align="right">
<tr>
<td><span class="gensmall">[ <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>
</td>
</tr>