Problem with the events from calendar pro on ezportal mod

Allgemeiner Support zum phpBB 2 Board und phpBB 2 Modifikationen
Forumsregeln
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Antworten
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Problem with the events from calendar pro on ezportal mod

Beitrag von superjoost »

Hello.

First of all: Thanx for the great mods you've been making. The installation was very easy and evertything went well...

Only I have one problem. I installed the Events on ezPortal from calpro ( 1.1.0 ) MOD

Everything goes well... All the events are properly displayed on the ezportal portal,

Here comes the problem: When a user takes a view at the portal after a while the post-count is set at 0! (View posts since last visit (0) )
The post count should have increased since the last time they visited.

What could have gone wrong?

I don't completely understand this part of the mod:

Code: Alles auswählen

# ------------------
# If you have not installed the eventlists add now:
if ($cal_config['number_events'] <> 0)
{
	$template->assign_block_vars('event_list', array(
	 'EVENTS' => $lang["Events"]));
}

# ------------------
# If you have installed the eventlists you may add now:
if ($cal_config['number_events'] <> 0 && $cal_config['view_new_events'] == 1 && $userdata['session_logged_in'] )
{
	$template->assign_block_vars('event_list', array(
	'EVENTS' => '<a href="'. $phpbb_root_path .'cal_view_new.'.$phpEx.'">'. $lang["Events"] .'</a>'));
}
else
{
	$template->assign_block_vars('event_list', array(
	'EVENTS' => $lang['Events']));
}
Has this part got something to do with this mod?


Here comes the code from the portal.php:

Code: Alles auswählen

<?php 	
/***************************************************************************
 *                                portal.php
 *                            -------------------
 *   begin                : Tuesday, August 13, 2002
 *   copyright            : (C) 2002 Smartor
 *   email                : smartor_xp@hotmail.com
 *
 *   $Id: portal.php,v 2.1.7 2003/01/30, 17:05:58 Smartor Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   Some code in this file I borrowed from the original index.php, Welcome
 *   Avatar MOD and others...
 *
 ***************************************************************************/

//
// Set configuration for ezPortal
//

// Welcome Text: note that we are in PHP file, so use \' instead of ' and use \\ instead of \ (HTML enabled)
$CFG['welcome_text'] = 'Welcome to <b>My Community</b><br /><br />Thanks for using ezPortal,<br /><br />Have a good time! ^_^';

// Number of news on portal
$CFG['number_of_news'] = '5';

// Length of news
$CFG['news_length'] = '11350';

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

// Poll Forum ID: separate by comma for multi-forums, eg. '3,8,14'
$CFG['poll_forum'] = '12';

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

// Number of Recent Topics Part 2 - Te Koop
$CFG['number_recent_topics2'] = '5'; 

// Exceptional Forums for Recent Topics Part 2, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank) 
$CFG['exceptional_forums2'] = '2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'; 

// Number of Recent Topics Part 3 - Gevraagd 
$CFG['number_recent_topics3'] = '5'; 

// Exceptional Forums for Recent Topics Part 3, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank) 
$CFG['exceptional_forums3'] = '1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'; 

// Number of Recent Topics (not Forum ID)
$CFG['number_recent_topics'] = '10';

// Excluding forums for Recent Topics, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank)
$CFG['exceptional_forums'] = '1,3,6';

//
// END configuration
// --------------------------------------------------------

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);
include($phpbb_root_path . 'cal_functions.'.$phpEx);
include($phpbb_root_path . 'cal_settings.'.$phpEx);
include_once('cal_constants.inc');
$session_loc = CAL_DAY_VIEW;
include_once('cal_main.inc');

$cal_config = array();

$sql = "SELECT * FROM ".$table_prefix."cal_config";
if(!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't query calendar config table", "", __LINE__, __FILE__, $sql);
}
else
{
	while( $row = $db->sql_fetchrow($result) )
	{
		$cal_config[$row['config_name']] = $row['config_value'];
	}
}

// ChatBox Mod
include($phpbb_root_path . 'chatbox_front.php');

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

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

//
// If you don't use these stats on your index you may want to consider
// removing them
//
$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'];
}

//
// Events
//
if ($cal_config['number_events'] <> 0)
{
	$currentmonth = mydateformat(time(), 'm');
	$tz_diff = mytime();

	// Set unixtimes to GMT to search by
	$this_date_unix = gmmktime(0,0,0,$month,$day,$year) - $tz_diff;
	$this_end_unix = gmmktime(23,59,59,$month,$day,$year) - $tz_diff;

	// Set link dates (in local time)
	$your_date = gmmktime(0,0,0,$month,$day,$year);

	$lastseconds = $your_date - (24*60*60);
	$lastday = gmdate('j', $lastseconds);
	$lastmonth = gmdate('m', $lastseconds);
	$lastyear = gmdate('Y', $lastseconds);

	$nextseconds = $your_date + (24*60*60);
	$nextday = gmdate('j', $nextseconds);
	$nextmonth = gmdate('m', $nextseconds);
	$nextyear = gmdate('Y', $nextseconds);

	// MOD group specific and private events - start
	$sql = "SELECT *, c.event_start FROM ".CAL_TABLE." AS c
		LEFT JOIN ".CAL_RECUR." AS r ON c.r_group_id = r.r_group_id
		LEFT JOIN ".CAL_CATS." AS cat ON c.category = cat.cat_id
		LEFT JOIN ".CAL_GROUP_EVENT." AS ge ON c.id = ge.event_id
		LEFT JOIN ".USERS_TABLE." AS u ON u.user_id = c.user_id
		WHERE c.valid = 'yes' AND c.r_type != 'D' AND ";

	if(isset($groups[0])) {
		// If the user is member of 1+ usegroups then check for these results too.
		while(list(,$group) = each($groups)) {
			if(count($groups > 1) && isset($sql_groups)) {
				 $sql_groups .= " OR ";
			}
			$sql_groups .= "ge.group_id = ".$group['group_id'];
		}
		$sql_access = '(c.event_access = 2 AND ('.$sql_groups.' OR ge.group_id IS NULL OR ge.group_id = 0))';
	}
	$sql_access .= ($groups && $cal_config['allow_private']) ? ' OR ' : '';
	if($cal_config['allow_private']) {
		$sql_access .= ' (c.event_access = 1 AND c.user_id = '.$userdata['user_id'].') ';
	}
	$sql .= ($sql_access) ? '('.$sql_access.' OR c.event_access = 0)  AND ' : 'c.event_access = 0 AND ';
	// MOD end


	if ($id) {
		$sql .= " id = '$id'";
	}
	else {
	// MOD Null time/stable date fix
		if($board_config['board_timezone'] < 12) {
			$sql .= " c.event_start > $this_date_unix ";
		}
		else {
			$time_adjust = 12 * 60 * 60;
			$sql .= " ((c.event_start >= '$this_date_unix' AND event_time_set >= 1)
				OR (c.event_start >= '". ($this_date_unix + $time_adjust) ."' AND event_time_set = 0)) ";
		}
		if ( $cal_config['day_number'] == 0 )
		{
			$event_span_date = '';
			$sql_timespan = '';
			$sql_limit = " LIMIT 0," . $cal_config['number_events'];
		}
		else
		{
			$cal_days = $cal_config['number_events'];
			$event_span_date = strtotime("$year-$month-$day 23:59:59 + $cal_days days");
			$sql_timespan = ' AND c.event_start <= '. $event_span_date;
			$sql_limit = '';
		}
		$sql .= $sql_timespan." ORDER BY c.event_start".$sql_limit;
	}
	$time_adjust = ($board_config['board_timezone'] >= 12) ? (12 * 60 * 60) : 0;
	// MOD end

	if ( !($result = $db->sql_query($sql)) ) {
		message_die(GENERAL_ERROR, 'Could not select Event data');
	}

	$check=0;
	while ($row = $db->sql_fetchrow($result)) {
		// MOD group specific events - start
		// Stop repeats of the same event
		/* 	Because the events are in order of date, duplicate events created for users in multiple usergroups
			will follow duplicate events and can be screened out here
		*/
		if($prev_event_id == $row['id']) {
			continue;
		}
		$prev_event_id = $row['id'];
		// MOD end

		if ($row['r_subject'] != '' && $row['subject'] != '') {
			$subject = '['. stripslashes($row['r_subject']) .'] ' .stripslashes($row['subject']);
		}
		elseif ($row['subject'] != '') {
			$subject = stripslashes($row['subject']);
		}
		else {
			$subject = stripslashes($row['r_subject']);
		}

		if ($row['r_desc'] != '' && $row['description'] != '') {
			$zdesc = stripslashes($row['r_desc']) .'<BR><BR>'. stripslashes($row['description']);
		}
		elseif ($row['r_desc'] != '') {
			$zdesc = stripslashes($row['r_desc']);
		}
		else {
			$zdesc = stripslashes($row['description']);
		}
		$category = stripslashes($row['cat_name']);
		if( $row['bbcode_uid'] != '' ) {
			$zdesc = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($zdesc, $row['bbcode_uid']) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $zdesc);
		}
		if ( $board_config['allow_smilies'] ) {
			$zdesc = smilies_pass($zdesc);
		}

		$start_date = mydateformat($row['event_start'], $cal_config['cal_dateformat']);
		$end_date = mydateformat($row['event_end'], $cal_config['cal_dateformat']);

		$author = ( $userdata['session_logged_in'] ) ? '<a href="'. $phpbb_root_path .'profile.'.$phpEx.'?mode=viewprofile&'. POST_USERS_URL .'='. $row['user_id'] .'">('. stripslashes($row['username']) .')</a>' : '('. stripslashes($row['username']) .')';
		$subject = ( $userdata['session_logged_in'] ) ? '<a href="'. $phpbb_root_path .'cal_display.'.$phpEx.'?id='. $row['id'].'">'. $subject .'</a>' : $subject;
		if ( $start_date == $end_date )
		{
		   $span = $start_date;
		}
		else
		{
		   $span = $start_date . " - " . $end_date;
		}
		$template->assign_block_vars('event', array(
		   'SUBJECT' => $subject,
		   'SPAN' => $span,
		   'AUTHOR' => $author));
	}
	if ( $start_date == '' )
	{
	   $template->assign_block_vars('event', array(
		'SUBJECT' => $lang["No_events"]));
	}
}

if ($cal_config['number_events'] <> 0 && $cal_config['view_new_events'] == 1 && $userdata['session_logged_in'] )
{
	$template->assign_block_vars('event_list', array(
	'EVENTS' => '<a href="'. $phpbb_root_path .'cal_view_new.'.$phpEx.'">'. $lang["Events"] .'</a>'));
}
else
{
	$template->assign_block_vars('event_list', array(
	'EVENTS' => $lang['Events']));
}
//
// Recent Topics
//
$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'])
		)
	);
}
//
// END - Recent Topics
//
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 output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Home'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'portal_body.tpl')
);

//
// Avatar On 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;
	}
}
// Check For Anonymous User
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'];
}
//
// END: Avatar On 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'],
	// ChatBox
	'L_WHO_IS_CHATTING' => $lang['Who_is_Chatting'],
	'TOTAL_CHATTERS_ONLINE' => sprintf($lang['How_Many_Chatters'], $howmanychat),
	'CHATTERS_LIST' => sprintf($lang['Who_Are_Chatting' ],$chatters),
	'L_LOGIN_TO_JOIN_CHAT' => $lang['Login_to_join_chat'],
	'L_CLICK_TO_JOIN_CHAT' => $lang['Click_to_join_chat'],
	'S_JOIN_CHAT' => append_sid("chatbox_mod/chatbox.$phpEx"),
	'CHATBOX_NAME' => $userdata['user_id'] . '_ChatBox',
	// Recent Topics
	'L_RECENT_TOPICS' => $lang['Recent_topics'],
	'L_RECENT_ARTICLES' => $lang['Recent_articles'],


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

//
// 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
//

// 
// Recent Topics Part 2 - Te Koop
// 
$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_forums2'] == '' ) 
{ 
$except_forum_id = '\'start\''; 
} 
else 
{ 
$except_forum_id = $CFG['exceptional_forums2']; 
} 

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_topics2']; 
if (!$result = $db->sql_query($sql)) 
{ 
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql); 
} 
$number_recent_topics2 = $db->sql_numrows($result); 
$recent_topic_row2 = array(); 
while ($row = $db->sql_fetchrow($result)) 
{ 
$recent_topic_row2[] = $row; 
} 
for ($i = 0; $i < $number_recent_topics2; $i++) 
{ 
$template->assign_block_vars('recent_topic_row2', array( 
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row2[$i]['post_id']) . '#' .$recent_topic_row2[$i]['post_id'], 
'L_TITLE' => $recent_topic_row2[$i]['topic_title'], 
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row2[$i]['user_id']), 
'S_POSTER' => $recent_topic_row2[$i]['username'], 
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row2[$i]['post_time'], $board_config['board_timezone']) 
) 
); 
} 
// 
// END - Recent Topics Part 2 - Te Koop
// 





// 
// Recent Topics Part 3 - Gevraagd
// 
$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_forums3'] == '' ) 
{ 
$except_forum_id = '\'start\''; 
} 
else 
{ 
$except_forum_id = $CFG['exceptional_forums3']; 
} 

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_topics3']; 
if (!$result = $db->sql_query($sql)) 
{ 
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql); 
} 
$number_recent_topics3 = $db->sql_numrows($result); 
$recent_topic_row3 = array(); 
while ($row = $db->sql_fetchrow($result)) 
{ 
$recent_topic_row3[] = $row; 
} 
for ($i = 0; $i < $number_recent_topics3; $i++) 
{ 
$template->assign_block_vars('recent_topic_row3', array( 
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row3[$i]['post_id']) . '#' .$recent_topic_row3[$i]['post_id'], 
'L_TITLE' => $recent_topic_row3[$i]['topic_title'], 
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row3[$i]['user_id']), 
'S_POSTER' => $recent_topic_row3[$i]['username'], 
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row3[$i]['post_time'], $board_config['board_timezone']) 
) 
); 
} 
// 
// END - Recent Topics Part 3 - Gevraagd
// 


//\\ 
//\\ Start - Poll
//\\


// 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 Poll
//\\ 
//
// 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'])
		)
	);
}

//
// Generate the page
//
$template->pparse('body');

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

?>
Thank you for your time!

Joost
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Not required.
If you install the eventlists on the calander pro, you must insert the second part of the events on portal mod you posted here, if not, the first. Like the mod named.

Short:
You must not install the eventlists to uses the events on portal.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

Okay. That's Clear. I've only inserted the first part.

My portal.php looks like this now:

Code: Alles auswählen

<?php
/***************************************************************************
 *                                portal.php
 *                            -------------------
 *   begin                : Tuesday, August 13, 2002
 *   copyright            : (C) 2002 Smartor
 *   email                : smartor_xp@hotmail.com
 *
 *   $Id: portal.php,v 2.1.7 2003/01/30, 17:05:58 Smartor Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   Some code in this file I borrowed from the original index.php, Welcome
 *   Avatar MOD and others...
 *
 ***************************************************************************/

//
// Set configuration for ezPortal
//

// Welcome Text: note that we are in PHP file, so use \' instead of ' and use \\ instead of \ (HTML enabled)
$CFG['welcome_text'] = 'Welcome to <b>My Community</b><br /><br />Thanks for using ezPortal,<br /><br />Have a good time! ^_^';

// Number of news on portal
$CFG['number_of_news'] = '5';

// Length of news
$CFG['news_length'] = '11350';

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

// Poll Forum ID: separate by comma for multi-forums, eg. '3,8,14'
$CFG['poll_forum'] = '12';

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

// Number of Recent Topics Part 2 - Te Koop
$CFG['number_recent_topics2'] = '5'; 

// Exceptional Forums for Recent Topics Part 2, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank) 
$CFG['exceptional_forums2'] = '2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'; 

// Number of Recent Topics Part 3 - Gevraagd 
$CFG['number_recent_topics3'] = '5'; 

// Exceptional Forums for Recent Topics Part 3, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank) 
$CFG['exceptional_forums3'] = '1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'; 

// Number of Recent Topics (not Forum ID)
$CFG['number_recent_topics'] = '10';

// Excluding forums for Recent Topics, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank)
$CFG['exceptional_forums'] = '1,3,6';

//
// END configuration
// --------------------------------------------------------

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);
include($phpbb_root_path . 'cal_functions.'.$phpEx);
include($phpbb_root_path . 'cal_settings.'.$phpEx);
include_once('cal_constants.inc');
$session_loc = CAL_DAY_VIEW;
include_once('cal_main.inc');

$cal_config = array();

$sql = "SELECT * FROM ".$table_prefix."cal_config";
if(!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't query calendar config table", "", __LINE__, __FILE__, $sql);
}
else
{
	while( $row = $db->sql_fetchrow($result) )
	{
		$cal_config[$row['config_name']] = $row['config_value'];
	}
}

// ChatBox Mod
include($phpbb_root_path . 'chatbox_front.php');

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

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

//
// If you don't use these stats on your index you may want to consider
// removing them
//
$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'];
}

//
// Events
//
if ($cal_config['number_events'] <> 0)
{
	$currentmonth = mydateformat(time(), 'm');
	$tz_diff = mytime();

	// Set unixtimes to GMT to search by
	$this_date_unix = gmmktime(0,0,0,$month,$day,$year) - $tz_diff;
	$this_end_unix = gmmktime(23,59,59,$month,$day,$year) - $tz_diff;

	// Set link dates (in local time)
	$your_date = gmmktime(0,0,0,$month,$day,$year);

	$lastseconds = $your_date - (24*60*60);
	$lastday = gmdate('j', $lastseconds);
	$lastmonth = gmdate('m', $lastseconds);
	$lastyear = gmdate('Y', $lastseconds);

	$nextseconds = $your_date + (24*60*60);
	$nextday = gmdate('j', $nextseconds);
	$nextmonth = gmdate('m', $nextseconds);
	$nextyear = gmdate('Y', $nextseconds);

	// MOD group specific and private events - start
	$sql = "SELECT *, c.event_start FROM ".CAL_TABLE." AS c
		LEFT JOIN ".CAL_RECUR." AS r ON c.r_group_id = r.r_group_id
		LEFT JOIN ".CAL_CATS." AS cat ON c.category = cat.cat_id
		LEFT JOIN ".CAL_GROUP_EVENT." AS ge ON c.id = ge.event_id
		LEFT JOIN ".USERS_TABLE." AS u ON u.user_id = c.user_id
		WHERE c.valid = 'yes' AND c.r_type != 'D' AND ";

	if(isset($groups[0])) {
		// If the user is member of 1+ usegroups then check for these results too.
		while(list(,$group) = each($groups)) {
			if(count($groups > 1) && isset($sql_groups)) {
				 $sql_groups .= " OR ";
			}
			$sql_groups .= "ge.group_id = ".$group['group_id'];
		}
		$sql_access = '(c.event_access = 2 AND ('.$sql_groups.' OR ge.group_id IS NULL OR ge.group_id = 0))';
	}
	$sql_access .= ($groups && $cal_config['allow_private']) ? ' OR ' : '';
	if($cal_config['allow_private']) {
		$sql_access .= ' (c.event_access = 1 AND c.user_id = '.$userdata['user_id'].') ';
	}
	$sql .= ($sql_access) ? '('.$sql_access.' OR c.event_access = 0)  AND ' : 'c.event_access = 0 AND ';
	// MOD end


	if ($id) {
		$sql .= " id = '$id'";
	}
	else {
	// MOD Null time/stable date fix
		if($board_config['board_timezone'] < 12) {
			$sql .= " c.event_start > $this_date_unix ";
		}
		else {
			$time_adjust = 12 * 60 * 60;
			$sql .= " ((c.event_start >= '$this_date_unix' AND event_time_set >= 1)
				OR (c.event_start >= '". ($this_date_unix + $time_adjust) ."' AND event_time_set = 0)) ";
		}
		if ( $cal_config['day_number'] == 0 )
		{
			$event_span_date = '';
			$sql_timespan = '';
			$sql_limit = " LIMIT 0," . $cal_config['number_events'];
		}
		else
		{
			$cal_days = $cal_config['number_events'];
			$event_span_date = strtotime("$year-$month-$day 23:59:59 + $cal_days days");
			$sql_timespan = ' AND c.event_start <= '. $event_span_date;
			$sql_limit = '';
		}
		$sql .= $sql_timespan." ORDER BY c.event_start".$sql_limit;
	}
	$time_adjust = ($board_config['board_timezone'] >= 12) ? (12 * 60 * 60) : 0;
	// MOD end

	if ( !($result = $db->sql_query($sql)) ) {
		message_die(GENERAL_ERROR, 'Could not select Event data');
	}

	$check=0;
	while ($row = $db->sql_fetchrow($result)) {
		// MOD group specific events - start
		// Stop repeats of the same event
		/* 	Because the events are in order of date, duplicate events created for users in multiple usergroups
			will follow duplicate events and can be screened out here
		*/
		if($prev_event_id == $row['id']) {
			continue;
		}
		$prev_event_id = $row['id'];
		// MOD end

		if ($row['r_subject'] != '' && $row['subject'] != '') {
			$subject = '['. stripslashes($row['r_subject']) .'] ' .stripslashes($row['subject']);
		}
		elseif ($row['subject'] != '') {
			$subject = stripslashes($row['subject']);
		}
		else {
			$subject = stripslashes($row['r_subject']);
		}

		if ($row['r_desc'] != '' && $row['description'] != '') {
			$zdesc = stripslashes($row['r_desc']) .'<BR><BR>'. stripslashes($row['description']);
		}
		elseif ($row['r_desc'] != '') {
			$zdesc = stripslashes($row['r_desc']);
		}
		else {
			$zdesc = stripslashes($row['description']);
		}
		$category = stripslashes($row['cat_name']);
		if( $row['bbcode_uid'] != '' ) {
			$zdesc = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($zdesc, $row['bbcode_uid']) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $zdesc);
		}
		if ( $board_config['allow_smilies'] ) {
			$zdesc = smilies_pass($zdesc);
		}

		$start_date = mydateformat($row['event_start'], $cal_config['cal_dateformat']);
		$end_date = mydateformat($row['event_end'], $cal_config['cal_dateformat']);

		$author = ( $userdata['session_logged_in'] ) ? '<a href="'. $phpbb_root_path .'profile.'.$phpEx.'?mode=viewprofile&'. POST_USERS_URL .'='. $row['user_id'] .'">('. stripslashes($row['username']) .')</a>' : '('. stripslashes($row['username']) .')';
		$subject = ( $userdata['session_logged_in'] ) ? '<a href="'. $phpbb_root_path .'cal_display.'.$phpEx.'?id='. $row['id'].'">'. $subject .'</a>' : $subject;
		if ( $start_date == $end_date )
		{
		   $span = $start_date;
		}
		else
		{
		   $span = $start_date . " - " . $end_date;
		}
		$template->assign_block_vars('event', array(
		   'SUBJECT' => $subject,
		   'SPAN' => $span,
		   'AUTHOR' => $author));
	}
	if ( $start_date == '' )
	{
	   $template->assign_block_vars('event', array(
		'SUBJECT' => $lang["No_events"]));
	}
}

if ($cal_config['number_events'] <> 0)
{
	$template->assign_block_vars('event_list', array(
	 'EVENTS' => $lang["Events"]));
}

//
// Recent Topics
//
$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'])
		)
	);
}
//
// END - Recent Topics
//
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 output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Home'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'portal_body.tpl')
);

//
// Avatar On 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;
	}
}
// Check For Anonymous User
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'];
}
//
// END: Avatar On 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'],
	// ChatBox
	'L_WHO_IS_CHATTING' => $lang['Who_is_Chatting'],
	'TOTAL_CHATTERS_ONLINE' => sprintf($lang['How_Many_Chatters'], $howmanychat),
	'CHATTERS_LIST' => sprintf($lang['Who_Are_Chatting' ],$chatters),
	'L_LOGIN_TO_JOIN_CHAT' => $lang['Login_to_join_chat'],
	'L_CLICK_TO_JOIN_CHAT' => $lang['Click_to_join_chat'],
	'S_JOIN_CHAT' => append_sid("chatbox_mod/chatbox.$phpEx"),
	'CHATBOX_NAME' => $userdata['user_id'] . '_ChatBox',
	// Recent Topics
	'L_RECENT_TOPICS' => $lang['Recent_topics'],
	'L_RECENT_ARTICLES' => $lang['Recent_articles'],


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

//
// 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
//

// 
// Recent Topics Part 2 - Te Koop
// 
$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_forums2'] == '' ) 
{ 
$except_forum_id = '\'start\''; 
} 
else 
{ 
$except_forum_id = $CFG['exceptional_forums2']; 
} 

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_topics2']; 
if (!$result = $db->sql_query($sql)) 
{ 
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql); 
} 
$number_recent_topics2 = $db->sql_numrows($result); 
$recent_topic_row2 = array(); 
while ($row = $db->sql_fetchrow($result)) 
{ 
$recent_topic_row2[] = $row; 
} 
for ($i = 0; $i < $number_recent_topics2; $i++) 
{ 
$template->assign_block_vars('recent_topic_row2', array( 
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row2[$i]['post_id']) . '#' .$recent_topic_row2[$i]['post_id'], 
'L_TITLE' => $recent_topic_row2[$i]['topic_title'], 
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row2[$i]['user_id']), 
'S_POSTER' => $recent_topic_row2[$i]['username'], 
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row2[$i]['post_time'], $board_config['board_timezone']) 
) 
); 
} 
// 
// END - Recent Topics Part 2 - Te Koop
// 





// 
// Recent Topics Part 3 - Gevraagd
// 
$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_forums3'] == '' ) 
{ 
$except_forum_id = '\'start\''; 
} 
else 
{ 
$except_forum_id = $CFG['exceptional_forums3']; 
} 

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_topics3']; 
if (!$result = $db->sql_query($sql)) 
{ 
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql); 
} 
$number_recent_topics3 = $db->sql_numrows($result); 
$recent_topic_row3 = array(); 
while ($row = $db->sql_fetchrow($result)) 
{ 
$recent_topic_row3[] = $row; 
} 
for ($i = 0; $i < $number_recent_topics3; $i++) 
{ 
$template->assign_block_vars('recent_topic_row3', array( 
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row3[$i]['post_id']) . '#' .$recent_topic_row3[$i]['post_id'], 
'L_TITLE' => $recent_topic_row3[$i]['topic_title'], 
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row3[$i]['user_id']), 
'S_POSTER' => $recent_topic_row3[$i]['username'], 
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row3[$i]['post_time'], $board_config['board_timezone']) 
) 
); 
} 
// 
// END - Recent Topics Part 3 - Gevraagd
// 


//\\ 
//\\ Start - Poll
//\\


// 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 Poll
//\\ 
//
// 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'])
		)
	);
}

//
// Generate the page
//
$template->pparse('body');

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

?>
I have the same problem that I mentioned in the startpost. When I insert the following part of the mod, the postcount function doesn't work anymore. Do you know what could have gone wrong?

Code: Alles auswählen

#
#-----[ OPEN ]------------------------------------------
#
portal.php

#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'fetchposts.'.$phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'cal_functions.'.$phpEx);
include($phpbb_root_path . 'cal_settings.'.$phpEx);
include_once('cal_constants.inc');
$session_loc = CAL_DAY_VIEW;
include_once('cal_main.inc');

$cal_config = array();

$sql = "SELECT * FROM ".$table_prefix."cal_config";
if(!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't query calendar config table", "", __LINE__, __FILE__, $sql);
}
else
{
	while( $row = $db->sql_fetchrow($result) )
	{
		$cal_config[$row['config_name']] = $row['config_value'];
	}
}

#
#-----[ FIND ]------------------------------------------
#
//
// Recent Topics
//

#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// Events
//
if ($cal_config['number_events'] <> 0)
{
	$currentmonth = mydateformat(time(), 'm');
	$tz_diff = mytime();

	// Set unixtimes to GMT to search by
	$this_date_unix = gmmktime(0,0,0,$month,$day,$year) - $tz_diff;
	$this_end_unix = gmmktime(23,59,59,$month,$day,$year) - $tz_diff;

	// Set link dates (in local time)
	$your_date = gmmktime(0,0,0,$month,$day,$year);

	$lastseconds = $your_date - (24*60*60);
	$lastday = gmdate('j', $lastseconds);
	$lastmonth = gmdate('m', $lastseconds);
	$lastyear = gmdate('Y', $lastseconds);

	$nextseconds = $your_date + (24*60*60);
	$nextday = gmdate('j', $nextseconds);
	$nextmonth = gmdate('m', $nextseconds);
	$nextyear = gmdate('Y', $nextseconds);

	// MOD group specific and private events - start
	$sql = "SELECT *, c.event_start FROM ".CAL_TABLE." AS c
		LEFT JOIN ".CAL_RECUR." AS r ON c.r_group_id = r.r_group_id
		LEFT JOIN ".CAL_CATS." AS cat ON c.category = cat.cat_id
		LEFT JOIN ".CAL_GROUP_EVENT." AS ge ON c.id = ge.event_id
		LEFT JOIN ".USERS_TABLE." AS u ON u.user_id = c.user_id
		WHERE c.valid = 'yes' AND c.r_type != 'D' AND ";

	if(isset($groups[0])) {
		// If the user is member of 1+ usegroups then check for these results too.
		while(list(,$group) = each($groups)) {
			if(count($groups > 1) && isset($sql_groups)) {
				 $sql_groups .= " OR ";
			}
			$sql_groups .= "ge.group_id = ".$group['group_id'];
		}
		$sql_access = '(c.event_access = 2 AND ('.$sql_groups.' OR ge.group_id IS NULL OR ge.group_id = 0))';
	}
	$sql_access .= ($groups && $cal_config['allow_private']) ? ' OR ' : '';
	if($cal_config['allow_private']) {
		$sql_access .= ' (c.event_access = 1 AND c.user_id = '.$userdata['user_id'].') ';
	}
	$sql .= ($sql_access) ? '('.$sql_access.' OR c.event_access = 0)  AND ' : 'c.event_access = 0 AND ';
	// MOD end


	if ($id) {
		$sql .= " id = '$id'";
	}
	else {
	// MOD Null time/stable date fix
		if($board_config['board_timezone'] < 12) {
			$sql .= " c.event_start > $this_date_unix ";
		}
		else {
			$time_adjust = 12 * 60 * 60;
			$sql .= " ((c.event_start >= '$this_date_unix' AND event_time_set >= 1)
				OR (c.event_start >= '". ($this_date_unix + $time_adjust) ."' AND event_time_set = 0)) ";
		}
		if ( $cal_config['day_number'] == 0 )
		{
			$event_span_date = '';
			$sql_timespan = '';
			$sql_limit = " LIMIT 0," . $cal_config['number_events'];
		}
		else
		{
			$cal_days = $cal_config['number_events'];
			$event_span_date = strtotime("$year-$month-$day 23:59:59 + $cal_days days");
			$sql_timespan = ' AND c.event_start <= '. $event_span_date;
			$sql_limit = '';
		}
		$sql .= $sql_timespan." ORDER BY c.event_start".$sql_limit;
	}
	$time_adjust = ($board_config['board_timezone'] >= 12) ? (12 * 60 * 60) : 0;
	// MOD end

	if ( !($result = $db->sql_query($sql)) ) {
		message_die(GENERAL_ERROR, 'Could not select Event data');
	}

	$check=0;
	while ($row = $db->sql_fetchrow($result)) {
		// MOD group specific events - start
		// Stop repeats of the same event
		/* 	Because the events are in order of date, duplicate events created for users in multiple usergroups
			will follow duplicate events and can be screened out here
		*/
		if($prev_event_id == $row['id']) {
			continue;
		}
		$prev_event_id = $row['id'];
		// MOD end

		if ($row['r_subject'] != '' && $row['subject'] != '') {
			$subject = '['. stripslashes($row['r_subject']) .'] ' .stripslashes($row['subject']);
		}
		elseif ($row['subject'] != '') {
			$subject = stripslashes($row['subject']);
		}
		else {
			$subject = stripslashes($row['r_subject']);
		}

		if ($row['r_desc'] != '' && $row['description'] != '') {
			$zdesc = stripslashes($row['r_desc']) .'<BR><BR>'. stripslashes($row['description']);
		}
		elseif ($row['r_desc'] != '') {
			$zdesc = stripslashes($row['r_desc']);
		}
		else {
			$zdesc = stripslashes($row['description']);
		}
		$category = stripslashes($row['cat_name']);
		if( $row['bbcode_uid'] != '' ) {
			$zdesc = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($zdesc, $row['bbcode_uid']) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $zdesc);
		}
		if ( $board_config['allow_smilies'] ) {
			$zdesc = smilies_pass($zdesc);
		}

		$start_date = mydateformat($row['event_start'], $cal_config['cal_dateformat']);
		$end_date = mydateformat($row['event_end'], $cal_config['cal_dateformat']);

		$author = ( $userdata['session_logged_in'] ) ? '<a href="'. $phpbb_root_path .'profile.'.$phpEx.'?mode=viewprofile&'. POST_USERS_URL .'='. $row['user_id'] .'">('. stripslashes($row['username']) .')</a>' : '('. stripslashes($row['username']) .')';
		$subject = ( $userdata['session_logged_in'] ) ? '<a href="'. $phpbb_root_path .'cal_display.'.$phpEx.'?id='. $row['id'].'">'. $subject .'</a>' : $subject;
		if ( $start_date == $end_date )
		{
		   $span = $start_date;
		}
		else
		{
		   $span = $start_date . " - " . $end_date;
		}
		$template->assign_block_vars('event', array(
		   'SUBJECT' => $subject,
		   'SPAN' => $span,
		   'AUTHOR' => $author));
	}
	if ( $start_date == '' )
	{
	   $template->assign_block_vars('event', array(
		'SUBJECT' => $lang["No_events"]));
	}
}
if ($cal_config['number_events'] <> 0)
{
	$template->assign_block_vars('event_list', array(
	 'EVENTS' => $lang["Events"]));
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Here comes the problem: When a user takes a view at the portal after a while the post-count is set at 0! (View posts since last visit (0) )
The post count should have increased since the last time they visited.
Yes, but this will not be changed by the Events on ezPortal Mod.

Should the session will be restarted? Check the session length you've entered in the ACP. This should be 3600 (seconds).
And check this with different browsers.
Also check the cookie name. Rename it and retry. You also can insert a cookie domain, but do this without http://
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

This problem is really weird.
The session length is correct (3600)
the cookie domain is allright too. Everything works fine. Hundreds of users use it everyday in - out. I cleared my cache a few times.. -> no result

When i upload the changed version of portal.php the odd problem appears....
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Can you please post a link to test it live?
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

The normal portal is: http://www.kreidler.nl/forum/portal.php

I've created a test-page so you can compare it. I've excluded the code from the portal.php and included your code in the link below:

http://www.kreidler.nl/forum/portal_oxpus.php

Thanx for your time!
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

I've tested both portal pages parallel now for more than 5 minutes (session resetting!): On both will be alltimes displayed "1" new post since last visit. No differenz to see...
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

That's the weird thing that I also experience.

When you shut down the browser (stay automatically logged in)
and return to the /portal_oxpus.php after a couple of hours.. The postcount is set at ( 0 ). It shoud have had increased..

This is really weird though!
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Yes, but this is not an error!
The last loggin will set with the last session-time.
After closing the browser and reopen your board a new session will be initiated and you will get the number of new posts since the last loggin. E.g. since, you have closed your browser ;)
Not from the first time you've registered on your board.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

[quote="oxpus - Fri 07.Jan, 2005 11:27";p="19991"]Yes, but this is not an error!
The last loggin will set with the last session-time.
After closing the browser and reopen your board a new session will be initiated and you will get the number of new posts since the last loggin. E.g. since, you have closed your browser ;)
Not from the first time you've registered on your board.[/quote]

That's not exactly what I mean.

When I close the browser and return to the portal other users have been posting a while.. Normally about 150 post per day or something. When I return to the portal_oxpus.php after 1 day it says:

0 new messages

When I return to portal.php after 1 day it says something like:

158 new messages (depending how much is posted in 1 day)
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Okay, sorry, missunderstanding.
Please attach both portal-files to compare and try to fix the error.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

Nevermind. Those things happen. My English writing / exclaminations aren't the best :-)

Here are the codes:

portal.php:

Code: Alles auswählen

-- deleted by Admin --
Zuletzt geändert von superjoost am Fr 07.Jan, 2005 19:38, insgesamt 2-mal geändert.
From the Netherlands
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

the: portal_oxpus.php

in the post above I also tried to post the portal_body.tpl

Code: Alles auswählen

-- deleted by Admin --
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Sorry, I missed: Attach these files as a Zip-File. Posting within the BBCode CODE will destroy some code of them...
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

Okidoki. Here they come:
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Wondering why the fields aren't resetted on the next sql statement :confused:
There may be a field "total" on the calendar tables to overwrite the status for the new posts.
I now moved the code block for this before the events code block.
Upload the portal_oxpus.php and retry.

-- File deleted by ADMIN --
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

I've uploaded the portal_oxpus.php file.
take a look if you want.
The same problem occurs

Strange problem I have...
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Okay, try this one..
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

Okay... I've uploaded it. Thanx for your fast support & help!

Gladly, It seems to be working out.
It says: "New messages"
only the amount of new messages isn't shown. When I press the link of the new messages the new messages are displayed!.. (-->>> GOOD!!)
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Hm, if you can live without the number...
This should be displayed, so my intention...

Okay, next try...
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

Oxpus. Sorry for the mis-understanding. I double-checked it, but it still isn't right I guess. I re-uploaded the last portal_oxpus.php.

The posts still aren't showing up (not even when I click the new posts link)

There seems to be some kinda cookie-problem or so. When I visit the portal.php and after that I visit: portal_oxpus.php all links are displayed like this:
/viewtopic.php?p=109795#109795

When I close the browser & Return to the portal_oxpus.php (after a while) , the links appear in this way, with the codes after the link:

/viewtopic.php?p=109798&sid=db8ceb6053e239925eccd0fe836b3dd2#109798
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Don't worry about this. If there's no problem to enter the different topics, there are no errors on the portal.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
superjoost
Beiträge: 13
Registriert: Do 06.Jan, 2005 01:03

Beitrag von superjoost »

I'm not worried about the codes.

the portal-new-messages function still doens't work (no new messages show up)
From the Netherlands
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

1. The server time is wrong. Let this check by your hoster
2. This also will affect the new posts message.
3. At least check your cookie settings (ACP). Enter a new cookie name and try with/without a cookie domain.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Antworten