Pagina 1 van 1

CMX News Mod en ezPortal en Split Topics en CH 2.0.x

Geplaatst: 27 mei 2005, 20:49
door Bee
Voor deze mod heb je van beide mods de laatste versie nodig, geinstalleerd en wel op je forum.

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;">&nbsp;</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  

Geplaatst: 27 mei 2005, 20:51
door Nevels
En dan krijg je net zoiets als jij ook op de voorpagina hebt op Avrill.nl ?

Geplaatst: 27 mei 2005, 20:55
door Bee
Nevels schreef:En dan krijg je net zoiets als jij ook op de voorpagina hebt op Avrill.nl ?
Nee, dan krijg je zoiets wat ik heb op http://veerman.dyndns.ws/project/megamod/portal.php (is niet altijd online, is mijn eigen computertje). Op Avrill.nl gebruik ik daarentegen wel gewoon Cutenews, en daar is geen integratie met phpBB.

Geplaatst: 27 mei 2005, 21:39
door B-sTyLe
thnx bee :D

Geplaatst: 29 mei 2005, 12:27
door Hotzenwalder
Kan iemand die een link naar de download van die Slash News mod plaatsen, want ik kan wel de site van de maker vinden, maar niet een link om de mod te downloaden. :cry:

Geplaatst: 29 mei 2005, 16:26
door Bee

Geplaatst: 29 mei 2005, 17:41
door Hotzenwalder
Thanks... (ik woon trouwens een dorp verder in w'veen)

Geplaatst: 29 mei 2005, 19:32
door Bee
[off-topic]
Hotzenwalder schreef:Thanks... (ik woon trouwens een dorp verder in w'veen)
Kom ik eigenlijk nooit, des te vaker in Alphen a/d Rijn ;)

[/offtopic]

Er is nog een versie van deze mod, door iemand anders gemaakt, er zijn enkele verschillen hiertussen:

- Daar wordt de welkomstekst wel getoond
- Posts worden daar gesplitst
- Bij deze versie kan je de nieuwsinstellingen in het ACP aanpassen, bij die andere niet.
- De andere versie heeft 3 andere mods nodig.

Geplaatst: 01 jun 2005, 17:13
door Hotzenwalder
Hoe weet ik welke delen te skippen? Ik wil alleen de CMX en de EZPortal en Split Topic delen. Niet CH.

Geplaatst: 01 jun 2005, 18:48
door Bee
Er staat bij welke bestanden je moet aanpassen, je zoekt uit welke bestanden er bij jou aanwezig zijn, en die pas je wel aan. Bestanden die niet aanwezig zijn hoef je niet aan te passen. Zo simpel is het bij deze mod ;)

Geplaatst: 20 jun 2005, 06:37
door Hotzenwalder
Mijn portal.php is al aardig gemodified, dus ik kom er niet helemaal uit (kan sommige stukken niet vinden in mijn code). Hier is de code van portal.php. Wat moet nu waar komen?

Code: Selecteer alles

<?php
/***************************************************************************
 *                                portal.php
 *                            -------------------
 *   begin                : Dinsdag, 13 Augustus, 2002
 *   copyright            : (C) 2003 Smartor
 *   email                : smartor_xp@hotmail.com
 *	 vertaling		 	  : Admiral Rob
 *	 e-mail				  : admiralrob@phpbb-nl.com
 *
 *   $Id: portal.php,v 2.1.0 2002/9/27, 23:07:35 Smartor Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   Dit programma is gratis software; je kunt het verdelenen/of aanpassen
 *   onder de regels van de GNU General Public License zoals gemaakt door
 *   de Free Software Foundation; of versie 2 van de lecentie of
 *   (bij uw optie) elke latere versie.
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   Dezelfde code die ik geleend had van de originele index.phpindex.php, Welkom
 *   Avatar mod en andere...
 *
 ***************************************************************************/

//
// Stel configuratie voor ezPortal in
//

// Welkom tekst: pas op dat we in een .php bestand zijn, dus gebruik \' in plaats van ' en gebruik \\ in plaats van \ (HTML aan)
$CFG['welcome_text'] = 'Welkom op <b>Mijn Forum</b><br /><br />Bedankt voor het gebruik van ezPortal,<br /><br />Veel plezier! ^_^';

// News Forum ID: separate by comma for multi-forums, eg. '1,2,5'
$CFG['journal_forum'] = '7';

// Hoeveelheid nieuws op portal
$CFG['number_of_news'] = '3';

// Lengte van nieuws
$CFG['news_length'] = '1600';

// Nieuws bron forum ID: scheid met comma voor meerdere forums, bijv. '1,2,5'
$CFG['news_forum'] = '7';

// Poll bron forum ID: scheid met comma voor meerdere forums, bijv. '3,8,14'
$CFG['poll_forum'] = '2';

// Aantal recente OnderwerpenN (geen forum ID)
$CFG['number_recent_topics'] = '10';

// Bijzondere foprums voor Recente Onderwerpen, bijv. '2,4,10' (bericht: mijn recente onderwerpen script heeft zijn eigen permissie checking, zodat je deze variabel leeg kunt laten)
$CFG['exceptional_forums'] = '';

// Number of Recent Articles: change number according to how many you want displayed
$CFG['number_recent_articles'] = '10';

//
// BEEINDIG configuratie
// --------------------------------------------------------

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);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

//
// Beeindig session management
//

//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);

//
// Als je deze statistieken niet op index.php gebruikt, kun je overwegen ze te verwijderen
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];

if( $total_posts == 0 )
{
	$l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
	$l_total_post_s = $lang['Posted_article_total'];
}
else
{
	$l_total_post_s = $lang['Posted_articles_total'];
}

if( $total_users == 0 )
{
	$l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
	$l_total_user_s = $lang['Registered_user_total'];
}
else
{
	$l_total_user_s = $lang['Registered_users_total'];
}

//
// Recente onderwerpen
//
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
	$forum_data[] = $row;
}

$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);

if( $CFG['exceptional_forums'] == '' )
{
	$except_forum_id = '\'start\'';
}
else
{
	$except_forum_id = $CFG['exceptional_forums'];
}

for ($i = 0; $i < count($forum_data); $i++)
{
	if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
	{
		if ($except_forum_id == '\'start\'')
		{
			$except_forum_id = $forum_data[$i]['forum_id'];
		}
		else
		{
			$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
		}
	}
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
		FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
		WHERE t.forum_id NOT IN (" . $except_forum_id . ")
			AND t.topic_status <> 2
			AND p.post_id = t.topic_last_post_id
			AND p.poster_id = u.user_id
		ORDER BY p.post_id DESC
		LIMIT " . $CFG['number_recent_topics'];
if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
	$recent_topic_row[] = $row;
}
for ($i = 0; $i < $number_recent_topics; $i++)
{
	$template->assign_block_vars('recent_topic_row', array(
		'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
		'L_TITLE' => $recent_topic_row[$i]['topic_title'],
		'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
		'S_POSTER' => $recent_topic_row[$i]['username'],
		'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
		)
	);
}
//
// BEEINDIG - Recente onderwerpen
//


if( $userdata['session_logged_in'] )
{
	$sql = "SELECT COUNT(post_id) as total
			FROM " . POSTS_TABLE . "
			WHERE post_time >= " . $userdata['user_lastvisit'];
	$result = $db->sql_query($sql);
	if( $result )
	{
		$row = $db->sql_fetchrow($result);
		$lang['Search_new'] = $lang['Search_new'] . "&nbsp;(" . $row['total'] . ")";
	}
}

//
// Start pagina output
//
define('SHOW_ONLINE', true);
$page_title = $lang['Home'];
include($phpbb_root_path . 'includes/page_header1.'.$phpEx);

if(!isset($HTTP_GET_VARS['article']))
{
$template->set_filenames(array(
   'body' => 'portal_body.tpl')
);
}
else
{
$template->set_filenames(array(
   'body' => 'portal_body_1.tpl')
);
}

//
// Avatar op index mod
//
$avatar_img = '';
if ( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] )
{
	switch( $userdata['user_avatar_type'] )
	{
		case USER_AVATAR_UPLOAD:
			$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
			break;
		case USER_AVATAR_REMOTE:
			$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
			break;
		case USER_AVATAR_GALLERY:
			$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
			break;
	}
}
// Zoek naar anonieme gebruikers
if ($userdata['user_id'] != '-1')
{
	$name_link = '<a href="' . append_sid("profile.$phpEx?mode=editprofile&" . $userdata['user_id']) . '">' . $userdata['username'] . '</a>';
}
else
{
	$name_link = $lang['Guest'];
}
//
// BEEINDIG: Avatar op index mod
//


$template->assign_vars(array(
	'WELCOME_TEXT' => $CFG['welcome_text'],
	'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
	'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
	'TOTAL_TOPICS' => sprintf($lang['total_topics'], $total_topics),
	'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
	'L_FORUM' => $lang['Forum'],
	'L_BOARD_NAVIGATION' => $lang['Board_navigation'],
	'L_STATISTICS' => $lang['Statistics'],	
	'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
	'L_POSTED' => $lang['Posted'],
	'L_COMMENTS' => $lang['Comments'],
	'L_VIEW_COMMENTS' => $lang['View_comments'],
	'L_POST_COMMENT' => $lang['Post_your_comment'],
	'L_SEND_PASSWORD' => $lang['Forgotten_password'],
	'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
	'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '<a href="' . append_sid("profile.$phpEx?mode=register") . '">', '</a>'),
	'L_REMEMBER_ME' => $lang['Remember_me'],
	'L_VIEW_COMPLETE_LIST' => $lang['View_complete_list'],
	'L_POLL' => $lang['Poll'],
	'L_VOTE_BUTTON' => $lang['Vote'],
	// Zoek
	'L_SEARCH_AT' => $lang['Search_at'],
	'L_ADVANCED_SEARCH' => $lang['Advanced_search'],
	'L_RECENT_ARTICLES' => $lang['Recent_articles'],
	// Recente Onderwerpen
	'L_RECENT_TOPICS' => $lang['Recent_topics'],

	// Welkom avatar
	'L_NAME_WELCOME' => $lang['Welcome'],
	'U_NAME_LINK' => $name_link,
	'AVATAR_IMG' => $avatar_img)
);

//
// Haal berichten van mededeling forum op
//
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'])
		)
	);
}
//
// BEEINDIG: Haal mededelingen op
//

//\\
//\\ Start - vgan's Portal Poll Mod V. 2.0
//\\


// Set the vote graphic length to 100
// 	Note: If the bars look too long at %100, (only 1 vote) set this value lower.
// 	      Likewise, if it looks too short to you, increase it here.
$length = 100;

//  Get the poll forum from EZportal config above
$poll_forum = $CFG['poll_forum'];

{
	$template->assign_block_vars('PORTAL_POLL', array());

	$sql = 'SELECT
 		  t.*, vd.*
		FROM
		  ' . TOPICS_TABLE . ' AS t,
		  ' . VOTE_DESC_TABLE . ' AS vd
		WHERE
		  t.forum_id = ' . $poll_forum . ' AND
		  t.topic_status <> 1 AND
		  t.topic_status <> 2 AND
		  t.topic_vote = 1 AND
		  t.topic_id = vd.topic_id
		ORDER BY
		  t.topic_time DESC
		LIMIT
		  0,1';


	if(!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Couldn't obtain poll information.", "", __LINE__, __FILE__, $sql);
	}

	if(!$total_posts = $db->sql_numrows($result))
	{
		message_die(GENERAL_MESSAGE, $lang['No_posts_topic']);
	}
	$pollrow = $db->sql_fetchrowset($result);
	$db->sql_freeresult($result);

	$topic_id = $pollrow[0]['topic_id'] ;

		$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result
			FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
			WHERE vd.topic_id = $topic_id
				AND vr.vote_id = vd.vote_id
			ORDER BY vr.vote_option_id ASC";
		if( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't obtain vote data for this topic", "", __LINE__, __FILE__, $sql);
		}

		if( $vote_options = $db->sql_numrows($result) )
		{
			$vote_info = $db->sql_fetchrowset($result);

			$vote_id = $vote_info[0]['vote_id'];
			$vote_title = $vote_info[0]['vote_text'];

			$sql = "SELECT vote_id
				FROM " . VOTE_USERS_TABLE . "
				WHERE vote_id = $vote_id
					AND vote_user_id = " . $userdata['user_id'];
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't obtain user vote data for this topic", "", __LINE__, __FILE__, $sql);
			}

			$user_voted = ( $db->sql_numrows($result) ) ? TRUE : 0;

			if( isset($HTTP_GET_VARS['vote']) || isset($HTTP_POST_VARS['vote']) )
			{
				$view_result = ( ( ( isset($HTTP_GET_VARS['vote']) ) ? $HTTP_GET_VARS['vote'] : $HTTP_POST_VARS['vote'] ) == "viewresult" ) ? TRUE : 0;
			}
			else
			{
				$view_result = 0;
			}

			$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;

			if( $user_voted || $view_result || $poll_expired || $forum_row['topic_status'] == TOPIC_LOCKED )
			{

				$template->set_filenames(array(
					"pollbox" => "portal_poll_result.tpl")
				);

				$vote_results_sum = 0;

				for($i = 0; $i < $vote_options; $i++)
				{
					$vote_results_sum += $vote_info[$i]['vote_result'];
				}

				$vote_graphic = 0;
				$vote_graphic_max = count($images['voting_graphic']);

				for($i = 0; $i < $vote_options; $i++)
				{
					$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0;
					$portal_vote_graphic_length = round($vote_percent * $length);

					$vote_graphic_img = $images['voting_graphic'][$vote_graphic];
					$vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0;

					if( count($orig_word) )
					{
						$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
					}

					$template->assign_block_vars("poll_option", array(
						"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'],
						"POLL_OPTION_RESULT" => $vote_info[$i]['vote_result'],
						"POLL_OPTION_PERCENT" => sprintf("%.1d%%", ($vote_percent * 100)),

						"POLL_OPTION_IMG" => $vote_graphic_img,
						"POLL_OPTION_IMG_WIDTH" => $portal_vote_graphic_length/1)
					);
				}

				$template->assign_vars(array(
					"L_TOTAL_VOTES" => $lang['Total_votes'],
					"TOTAL_VOTES" => $vote_results_sum,
               			"L_VIEW_RESULTS" => $lang['View_results'],
               			"U_VIEW_RESULTS" => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult"))
				);

			}
			else
			{
				$template->set_filenames(array(
					"pollbox" => "portal_poll_ballot.tpl")
				);

				for($i = 0; $i < $vote_options; $i++)
				{
					if( count($orig_word) )
					{
						$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
					}

					$template->assign_block_vars("poll_option", array(
						"POLL_OPTION_ID" => $vote_info[$i]['vote_option_id'],
						"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'])
					);
				}
				$template->assign_vars(array(
					"LOGIN_TO_VOTE" => '<b><a href="' . append_sid("login.$phpEx?redirect=portal.$phpEx") . '">' . $lang['Login_to_vote'] . '</a><b>')
				);

				$s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '"><input type="hidden" name="mode" value="vote">';
			}

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

			$template->assign_vars(array(
				"POLL_QUESTION" => $vote_title,
				"L_SUBMIT_VOTE" => $lang['Submit_vote'],
				"S_HIDDEN_FIELDS" => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : "",
				"S_POLL_ACTION" => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id"))
			);

			$template->assign_var_from_handle("PORTAL_POLL", "pollbox");
		}
}

//\\
//\\ End - vgan's Portal Poll Mod V. 2.0
//\\
//
// Fetch recent articles
//
$article_row = phpbb_fetch_articles($CFG['number_recent_articles']);
for( $i = 0; $i < count($article_row); $i++ )
{
	$poster_id = $article_row[$i]['user_id'];

	$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $poster_id);
	$poster = ( $poster_id != ANONYMOUS ) ? '<a href="' . $temp_url . '">' . $article_row[$i]['username'] . '</a>' : $lang['Guest'];

	if( $poster_id == ANONYMOUS && $article_row[$i]['article_username'] != '' )
	{
		$poster = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $article_row[$i]['article_username']) : $poster;
	}


	$template->assign_block_vars('recent_article_row', array(
		'U_ARTICLE_TITLE' => append_sid("cms_view_article.$phpEx?aid=" . $article_row[$i]['article_id']),

		'ARTICLE_TITLE' => ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $article_row[$i]['article_title']) : $article_row[$i]['article_title'],
		'POSTER' => $poster,
		'POSTTIME' => create_date($board_config['default_dateformat'], $article_row[$i]['time'], $board_config['board_timezone'])
		)
	);
}


//
// Maak de pagina
//
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>

Geplaatst: 20 jun 2005, 07:57
door Bee

Code: Selecteer alles

// 
// Haal berichten van mededeling forum op 
// 
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']) 
      ) 
   ); 
} 
// 
// BEEINDIG: Haal mededelingen op 
//

Geplaatst: 21 jun 2005, 07:55
door Hotzenwalder
Ik heb het werkend, maar... de datums van de comments onder de topics kloppen niet. Er zit twee uur verschil in. Als ik een comment post om 07:00 PM wordt het 05:00 pm. Ook staan de comments zo gesorteerd dat de laatste
reactie bovenaan staat, terwijl het normaal gesproken op het forum net andersom is (laatste reactie onderaan). Is dat nog te veranderen?

Verder vraag ik me af of het ook mogelijk is om de avatar te laten zien bij de comments. Die moet dan waarschijnlijk opgehaald worden uit de database door één van de CMX News php files te bewerken, maar welke haalt de gegevens op?