Seite 1 von 1

Birthday Mod 2.0.1 und Portal Mod 1.50

Verfasst: 13.09.2006 19:17
von cheffe76
Hi,
ich habe mir heute den Birthday mod installiert. Der tut auch soweit.
Hat diesen Mod schon mal jemand ins Portal eingebunden ??
Ich hab in der suche nicht gefunden.
Kann mir jemand helfen.
Danke
Gruß
Cheffe :D

Verfasst: 13.09.2006 22:56
von MaxMoon
Wenn ich so auf der Admin-Seite unter Intro + Portal/Konfiguration schaue, steht da:

Birthday MOD:
Voraussetzung für die Funktion ist ein installierter
Birthday Mod Version 1.4.19 (PART 1) von Niels Chr. Rød Denmark

Verfasst: 13.09.2006 23:34
von easygo
Geht wohl eher um Birthdays 2.01 von TerraFrost :-?

Schon blöd, wenn sich die MOD-Namen kaum noch unterscheiden.

Verfasst: 14.09.2006 10:03
von cheffe76
Hi,
genau das ist mein Problem.
Ich weis ja
Wer lesen kann ist klar im Vorteil...
Es geht um den von Terra frost.
Gruß
cheffe :(

Verfasst: 14.09.2006 14:00
von easygo
Sollte ja nun kein Problem sein, den Code (analog index.php) ins IMPortal zu stecken.

Wohin? erkennt man an den Kommentaren -->

CODE TAKEN FROM Birthday Mod Version 1.51 from Niels ... /START ... /END

So ähnlich verhält sich das auch mit den Templates. easy

Verfasst: 18.09.2006 12:57
von cheffe76
Ich hab nun eine menge ausprobiert, es aber leider nicht hin bekommen.
Kann sich mal jemand die portal.php und die portal_body.php anschauen und mir einen Tip geben.
Vielen Danke.
Cu cheffe :cry:
Portal.php

Code: Alles auswählen

<?php
/***************************************************************************
 *                                   Portal
 *                          ------------------------
 *   Version              : Version 1.50 - 03.11.2003
 *   copyright            : (C) 2003 AWSW
 *   Grundversion		  : Brummelchen @ www.phpbb.de
 *   Besonderer Dank an	  : saerdnaer & acid @ www.phpbb.de
 *   URL                  : http://www.awsw.de
 *
 *   $Id: portal.php,v 1.50 2003/11/03 AWSW 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.
 *
 ***************************************************************************/



// phpBB STANDARD START
    define('IN_PHPBB', true);
    $phpbb_root_path = './';
    include($phpbb_root_path . 'extension.inc');
    include($phpbb_root_path . 'common.'.$phpEx);
    include($phpbb_root_path . 'portal_poll.'.$phpEx);
// phpBB STANDARD END



// SESSION MANAGMENT START
    $userdata = session_pagestart($user_ip, PAGE_PORTAL);
    init_userprefs($userdata);
// SESSION MANAGMENT END



// DATABASE CHANGES MADE ? START
$sql = "SELECT * FROM " . INTROPORTALMOD_TABLE;
if(!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, '<b>Could not query Intro + Portal configuration !<br><br>RUN <a href="intro_portal_mod_db_install.php" target="_blank">intro_portal_mod_db_install.php</a> AND DELETE IT AFTER THAT AND CHECK THE FILES TO EDIT !!!<br><br>Fehler beim Abfragen der Intro + Portal Konfiguration !<br><br>FÜHRE DIE <a href="intro_portal_mod_db_install.php" target="_blank">intro_portal_mod_db_install.php</a> AUS UND LÖSCHE SIE DANACH UND ÜBERPRÜFE DIE ZU EDITIERENDEN DATEIEN !!!<br><br><a href="http://www.awsw.de" target="_blank">HTH AWSW</a></b>', '', __LINE__, __FILE__, $sql);
}
// DATABASE CHANGES MADE ? END



// LOAD THE APPROPRIATE INTROPORTAL LANGUAGE FILE START
if( isset($HTTP_GET_VARS['mode']) )
{
	switch( $HTTP_GET_VARS['mode'] )
	{
		    default:
			$lang_file = 'lang_introportal';
			$l_title = $lang['introportal'];
			break;
	}
}
else
{
	$lang_file = 'lang_introportal';
	$l_title = $lang['introportal'];
}
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/' . $lang_file . '.' . $phpEx);
// LOAD THE APPROPRIATE INTROPORTAL LANGUAGE FILE END



// POST COUNT IN SEARCH TOPICS START
if( $userdata['session_logged_in'] && $introportalmod_config['searchtopics_active'] == "1")
{
$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'] . " (" . $row['total'] . ")";
}
$template->assign_block_vars('switch_searchtopics_active', array());
}
// POST COUNT IN SEARCH TOPICS END



// WELCOME USER ADDON IN PORTAL - START
$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" /><br>' : '';
			break;
		case USER_AVATAR_REMOTE:
			$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" /><br>' : '';
			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" /><br>' : '';
			break;
	}
}
// WELCOME USER ADDON IN PORTAL - END



// OUTPUT PAGE HEADER START
define('SHOW_ONLINE', true);
$page_title = $lang['IntroPortalMOD2'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

// IS THE INTRO+PORTAL MOD DISABLED START
if( $introportalmod_config['introportalmod_disable'] == "1" || $introportalmod_config['portal_disable'] == "1" )
{
	message_die(GENERAL_MESSAGE, $introportalmod_config['portal_disable_msg'] , 'Information');
}
// IS THE INTRO+PORTAL MOD DISABLED END

$template->set_filenames(array(
    'body' => 'portal_body.tpl')
);
// OUTPUT PAGE HEADER END



// LAST REG USERS START
if( $introportalmod_config['lastnewmembers_active'] == "1" )
{
$last_reg_users_limit = $introportalmod_config['lastnewmembers_limit'];
    $sql = "SELECT user_id, username, user_regdate
        FROM " . USERS_TABLE . "
        WHERE user_id <> " . ANONYMOUS . "
        ORDER BY user_regdate DESC
        LIMIT $last_reg_users_limit";
    if ( !($result = $db->sql_query($sql)) )
    {
            message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql);
    }
    while ($row = $db->sql_fetchrow($result))
    {
        $user_id=$row['user_id'];
        	if( $introportalmod_config['lastnewmembers_active'] == "1" )
			{
            $template->assign_block_vars("last_registrations", array(
                    'USERNAME' => $row['username'],
                    'REG_DATE' => create_date($board_config['default_dateformat'], $row['user_regdate'], $board_config['board_timezone']),
            		'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
            );
        }
    }
$template->assign_block_vars('switch_lastnewmembers_active', array());
}
// LAST REG USERS END



// MOST POSTS START
if( $introportalmod_config['topposter_active'] == "1" )
{
$most_posts_limit = $introportalmod_config['topposter_limit'];
    $sql = "SELECT user_id, username, user_posts
        FROM " . USERS_TABLE . "
        WHERE user_id <> " . ANONYMOUS . "
        ORDER BY user_posts DESC
        LIMIT $most_posts_limit";
    if ( !($result = $db->sql_query($sql)) )
    {
            message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql);
    }
    while ($row = $db->sql_fetchrow($result))
    {
        $user_id=$row['user_id'];
        if( $introportalmod_config['topposter_active'] == "1" )
			{
            $template->assign_block_vars("most_posts", array(
                    'USERNAME' => $row['username'],
                    'POSTS' => $row['user_posts'],
            		'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
            );
            }
    }
$template->assign_block_vars('switch_topposter_active', array());
}
// MOST POSTS END



// BEST TOPICS START
if( $introportalmod_config['topposts_active'] == "1" )
{
$beste_topics = $introportalmod_config['topposts_limit'];
    $sql = "SELECT topic_id,topic_title,topic_replies
        FROM " . TOPICS_TABLE . " t
        LEFT JOIN " . FORUMS_TABLE . " f
        ON t.forum_id=f.forum_id
        WHERE f.auth_view < 2
        ORDER BY topic_replies DESC
        LIMIT $beste_topics";
    if ( !($result = $db->sql_query($sql)) )
    {
            message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql);
    }
    while ($row = $db->sql_fetchrow($result))
    {
        $topic_id=$row['topic_id'];
        if( $introportalmod_config['topposts_active'] == "1" )
		{
        $template->assign_block_vars("best_topics", array(
                    'TOPIC_TITLE' => $row['topic_title'],
                    'REPLIES' => $row['topic_replies'],
            		'VIEWTOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"))
            );
        }
    }
$template->assign_block_vars('switch_topposts_active', array());
}
// BEST TOPICS END



// USER / POST COUNT START
if( $introportalmod_config['userpostcount_active'] == "1" )
{
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$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'];
}
$template->assign_block_vars('switch_userpostcount_active', array());
}
// USER / POST COUNT END



// CHECK FOR ANONYMOUS USER START
if ($userdata['user_id'] != '-1')
{
$name_link = $userdata['username'];
}
else
{
$name_link = $lang['Guest'];
}
// CHECK FOR ANONYMOUS USER END



// TEMPLATE VARS START
$template->assign_vars(array(
        'FORUM_ID' => $forum_id,
        'FORUM_NAME' => $forum_row['forum_name'],
        'MODERATORS' => $forum_moderators,
        'POST_IMG' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'],
        'FOLDER_IMG' => $images['folder'],
        'FOLDER_NEW_IMG' => $images['folder_new'],
        'FOLDER_HOT_IMG' => $images['folder_hot'],
        'FOLDER_HOT_NEW_IMG' => $images['folder_hot_new'],
        'FOLDER_LOCKED_IMG' => $images['folder_locked'],
        'FOLDER_LOCKED_NEW_IMG' => $images['folder_locked_new'],
        'FOLDER_STICKY_IMG' => $images['folder_sticky'],
        'FOLDER_STICKY_NEW_IMG' => $images['folder_sticky_new'],
        'FOLDER_ANNOUNCE_IMG' => $images['folder_announce'],
        'FOLDER_ANNOUNCE_NEW_IMG' => $images['folder_announce_new'],
        'FORUM_IMG' => $images['forum'],
		'FORUM_NEW_IMG' => $images['forum_new'],
		'FORUM_LOCKED_IMG' => $images['forum_locked'],
		'FOLDER_GLOBAL_ANNOUNCE_IMG' => $images['folder_global_announce'],
		'FOLDER_GLOBAL_ANNOUNCE_NEW_IMG' => $images['folder_global_announce_new'],
		'UserPostCount' => $lang['UserPostCount'],
		'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
		'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
		'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'), 'BIRTHDAYS' => $birthdays, 'UPCOMING' => $upcoming,
		'IntroPortaltext1' => $lang['IntroPortaltext1'],
		'IntroPortaltext2' => $lang['IntroPortaltext2'],
		'IntroPortaltext3' => $lang['IntroPortaltext3'],
		'IntroPortaltext4' => $lang['IntroPortaltext4'],
		'IntroPortaltext5' => $lang['IntroPortaltext5'],
		'IntroPortaltext6' => $lang['IntroPortaltext6'],
		'IntroPortaltext7' => $lang['IntroPortaltext7'],
		'IntroPortaltext8' => $lang['IntroPortaltext8'],
		'IntroPortaltext9' => $lang['IntroPortaltext9'],
		'IntroPortaltext10' => $lang['IntroPortaltext10'],
		'IntroPortaltext11' => $lang['IntroPortaltext11'],
		'IntroPortaltext12' => $lang['IntroPortaltext12'],
		'IntroPortaltext13' => $lang['IntroPortaltext13'],
		'IntroPortaltext14' => $lang['IntroPortaltext14'],
		'IntroPortaltext15' => $lang['IntroPortaltext15'],
		'IntroPortaltext16' => $lang['IntroPortaltext16'],
		'IntroPortaltext17' => $lang['IntroPortaltext17'],
		'IntroPortaltext18' => $lang['IntroPortaltext18'],
		'IntroPortaltext19' => $lang['IntroPortaltext19'],
		'IntroPortaltext20' => $lang['IntroPortaltext20'],
		'IntroPortaltext21' => $lang['IntroPortaltext21'],
		'IntroPortaltext22' => $lang['IntroPortaltext22'],
		'IntroPortaltext23' => $lang['IntroPortaltext23'],
		'IntroPortaltext24' => $lang['IntroPortaltext24'],
		'IntroPortaltext25' => $lang['IntroPortaltext25'],
		'IntroPortaltext26' => $lang['IntroPortaltext26'],

'IntroPortaltext27' => $lang['IntroPortaltext27'],

		'INTRO_PORTAL_VERSION' => $introportalmod_config['modversion'],
		'L_Welcome' =>  $lang['UserWelcome'],
		'L_UserNote' => $lang['UserNote'],
		'L_POLL' => $lang['Topic_Poll'],
		'L_VOTE_BUTTON' => $lang['Submit_vote'],
		'L_EMAIL' => $lang['Email'],
		'L_PM' => $lang['Private_Message'],
		'L_WEBSITE' => $lang['Website'],
		'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_TOPICS' => $lang['Topics'],
        'L_REPLIES' => $lang['Replies'],
        'L_VIEWS' => $lang['Views'],
        'L_POSTS' => $lang['Posts'],
        'L_LASTPOST' => $lang['Last_Post'],
        'L_MODERATOR' => $l_moderators,
        'L_MARK_TOPICS_READ' => $lang['Mark_all_topics'],
        'L_POST_NEW_TOPIC' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'],
        'L_NO_NEW_POSTS' => $lang['No_new_posts'],
        'L_NEW_POSTS' => $lang['New_posts'],
        'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'],
        'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'],
        'L_NO_NEW_POSTS_HOT' => $lang['No_new_posts_hot'],
        'L_NEW_POSTS_HOT' => $lang['New_posts_hot'],
        'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
        'L_FORUM_LOCKED' => $lang['Forum_is_locked'],
		'L_GLOBAL_ANNOUNCEMENT' => $lang['Post_global_announcement'],
		'IntroPortalLegende' => $lang['IntroPortalLegende'],
        'L_STICKY' => $lang['Post_Sticky'],
        'L_POSTED' => $lang['Posted'],
        'L_JOINED' => $lang['Joined'],
        'L_AUTHOR' => $lang['Author'],
    	  'L_TODAYS_BIRTHDAYS' => $lang['Todays_Birthdays'],
	  'L_VIEW_BIRTHDAYS' => $lang['View_Birthdays'],
        'L_FORUM' => $lang['Forum'],
	  	'U_NAME_LINK' => $name_link,
	  	'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
	  	'AVATAR_IMG' => $avatar_img,
        'S_AUTH_LIST' => $s_auth_can,
        'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),
        'U_MARK_READ' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&mark=topics"))
);
// TEMPLATE VARS END



// TURN OFF BOXES FROM ACP START

// SWITCH PARTNERSITES START
if( $introportalmod_config['partners_active'] == "1" )
{
	$template->assign_block_vars('switch_partners_active', array(
	$template->assign_vars(array(
	'PORTAL_PARTNERLINKS' => str_replace("\n", "\n<br />\n", make_clickable($introportalmod_config['Partnersitelinks']))
	))
	));
}
// SWITCH PARTNERSITES END

// SWITCH HEISE NEWSTICKER START
if( $introportalmod_config['heise_active'] == "1" )
{
	$template->assign_block_vars('switch_heise_active', array(
	$template->assign_vars(array(
	'Heise_NEWSTICKER' => implode("",file("http://" . $_SERVER['HTTP_HOST'] . $board_config['script_path'] . "portal_heise_ticker.php")),
	))
	));
}
// SWITCH HEISE NEWSTICKER END

// SWITCH FREENET NEWSTICKER START
if( $introportalmod_config['freenet_active'] == "1" )
{
    $template->assign_block_vars('switch_freenet_active', array());
}
// SWITCH FREENET NEWSTICKER END

// SWITCH NAVIGATION START
if( $introportalmod_config['navigation_active'] == "1" )
{
$sql_level = ($userdata['user_id']==ANONYMOUS) ? ANONYMOUS : (($userdata['user_level']==ADMIN) ? MOD : (($userdata['user_level']==MOD) ? ADMIN : $userdata['user_level']));
$sql = "SELECT * FROM " . $table_prefix . "introportalmodnav
		WHERE link_active
		AND (IF(link_level_type,IF(link_level_type=1,'$sql_level'<=link_level,IF(link_level_type=2,'$sql_level'>=link_level,'$sql_level'<>link_level)),link_level='$sql_level') OR link_id=0)
		ORDER BY link_cat , link_sub, link_id";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not get navigation information', '', __LINE__, __FILE__, $sql);
}
$links = $db->sql_fetchrowset($result);

$i=0;
if (!empty($links))
{
while (list ($id,$link) = each($links))
{
	eval('$link_name = ' . $link['link_name'] . ';');
	if ($link['link_id']==0)
	{
		if ($link['link_sub']==0)
		{
			// new cat
			// only show if, link pressent in this cat
			$s=1;
			$found = FALSE;
			while ($links[$id+$s][link_cat]==$link[link_cat] && $s<sizeof($links))
			{
				$found = ($links[$id+$s++][link_id]!=0) ? TRUE : $found;
			}
			if ($found)
			{
				if ($i==0)
				{
					$i=3;
					$template->assign_block_vars('row', array());
				} else
				{
					$i--;
				}
				$template->assign_block_vars('row.cat', array(
					'CAT_NAME' => $link_name));
			}
		} else
		{
			// only show if, LINK pressent in this SUB
			$s=1;
			$found = FALSE;
			while ($links[$id+$s][link_sub]==$link[link_sub] && $s<sizeof($links))
			{
				$found = ($links[$id+$s++][link_id]!=0) ? TRUE : $found;
			}
			if ($found)
			{
				$template->assign_block_vars('row.cat.sub', array(
					'SUB_NAME' => $link_name));
			}
		}
	} else
	{
		$row_color = $theme['td_color1'];
		$row_class = $theme['td_class1'];
		$template->assign_block_vars('row.cat.sub.link', array(
				'LINK_NAME' => $link_name,
				'LINK_URL' => $link['link_url'],
				'ROW_COLOR' => '#' . $row_color,
				'ROW_CLASS' => $row_class));
	}
}
} else
{
	$template->assign_block_vars('row', array());
	$template->assign_block_vars('row.cat', array(
		'CAT_NAME' => $lang['No_links']));
}
if (!($template->_tpldata['row.'][0]))
{
	$template->assign_block_vars('row', array());
	$template->assign_block_vars('row.cat', array('CAT_NAME' => $lang['No_links']));
}
$template->assign_block_vars('switch_navigation_active', array());
}
// SWITCH NAVIGATION END

// SWITCH LEFT, CENTER AND RIGHT COLUMN + BORDER START
if( $introportalmod_config['left_active'] == "1" )
{
	$template->assign_block_vars('switch_left_active', array());
}
if( $introportalmod_config['center_active'] == "1" )
{
	$template->assign_block_vars('switch_center_active', array());
}
if( $introportalmod_config['right_active'] == "1" )
{
	$template->assign_block_vars('switch_right_active', array());
}
if( $introportalmod_config['border_active'] == "1" )
{
	$template->assign_block_vars('switch_border_active', array());
}
// SWITCH LEFT, CENTER AND RIGHT COLUMN + BORDER END

// SWITCH WHOISONLINE START
if( $introportalmod_config['whoisonline_active'] == "1" )
{
	$template->assign_block_vars('switch_whoisonline_active', array());
}
// SWITCH WHOISONLINE END

// SWITCH GOOGLE START
if( $introportalmod_config['google_active'] == "1" )
{
	$template->assign_block_vars('switch_google_active', array());
}
// SWITCH GOOGLE END

// SWITCH LOGIN START
if ( !$userdata['session_logged_in'] && $introportalmod_config['loginform_active'] == "1" )
{
	$template->assign_block_vars('switch_loginform_active', array());
}
// SWITCH LOGIN END

// SWITCH WELCOMEUSER START
if( !$userdata['session_logged_in'] && $introportalmod_config['welcomeuser_active'] == "1" )
{
	$template->assign_block_vars('switch_welcomeuser_out_active', array());
}
if( $userdata['session_logged_in'] && $introportalmod_config['welcomeuser_active'] == "1" )
{
	$template->assign_block_vars('switch_welcomeuser_in_active', array());
}
// SWITCH WELCOMEUSER END

// SWITCH FORUMLEGEND START
if( $introportalmod_config['forumlegend_active'] == "1" )
{
	$template->assign_block_vars('switch_forumlegend_active', array());
}
// SWITCH FORUMLEGEND END

// SWITCH BIRTHDAY MOD START
if( $introportalmod_config['birthdaymod_active'] == "1" )
{
// CODE TAKEN FROM Birthday Mod Version 1.51 from Niels Chr. Rød Denmark http://mods.db9.dk/ START
	$sql = "SELECT user_id, username, user_birthday, user_level 
		FROM " . USERS_TABLE . " 
		WHERE user_birthday >= " . gmdate('md0000',time() + (3600 * $board_config['board_timezone'])) . " 
			AND user_birthday <= " . gmdate('md9999',time() + (3600 * $board_config['board_timezone']));
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query members birthday information', '', __LINE__, __FILE__, $sql);
	}

	$user_birthdays = array();
	while ( $row = $db->sql_fetchrow($result) )
	{
		$bday_year = $row['user_birthday'] % 10000;
		$age = ( $bday_year ) ? ' ('.(gmdate('Y')-$bday_year).')' : '';
		$color = '';
		if ( $row['user_level'] == ADMIN )
		{
			$color = ' style="color:#' . $theme['fontcolor3'] . '"';
		}
		else if ( $row['user_level'] == MOD )
		{
			$color = ' style="color:#' . $theme['fontcolor2'] . '"';
		}
		$user_birthdays[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $color . '>' . $row['username'] . '</a>' . $age;
	}
	$db->sql_freeresult($result);

	$birthdays = (!empty($user_birthdays)) ?
		sprintf($lang['Congratulations'],implode(', ',$user_birthdays)) :
		$lang['No_birthdays'];

	if ( $board_config['bday_lookahead'] != -1 )
	{
		$start = gmdate('md9999',strtotime('+'.$board_config['bday_lookahead'].' day') + (3600 * $board_config['board_timezone']));
		$end = gmdate('md0000',strtotime('+1 day') + (3600 * $board_config['board_timezone']));
		$operator = ($start > $end) ? 'AND' : 'OR';
		$sql = "SELECT user_id, username, user_birthday, user_level 
			FROM " . USERS_TABLE . " 
			WHERE (user_birthday <= $start 
				$operator user_birthday >= $end)
				AND user_birthday <> 0";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not query upcoming birthday information', '', __LINE__, __FILE__, $sql);
		}
		$upcoming_birthdays = array();
		while ( $row = $db->sql_fetchrow($result) )
		{
			$bday_year = $row['user_birthday'] % 10000;
			$age = ( $bday_year ) ? ' ('.(gmdate('Y')-$bday_year).')' : '';
			$color = '';
			if ( $row['user_level'] == ADMIN )
			{
				$color = ' style="color:#' . $theme['fontcolor3'] . '"';
			}
			else if ( $row['user_level'] == MOD )
			{
				$color = ' style="color:#' . $theme['fontcolor2'] . '"';
			}
			$upcoming_birthdays[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $color . '>' . $row['username'] . '</a>' . $age;
		}

		$upcoming = (!empty($upcoming_birthdays)) ?
			sprintf($lang['Upcoming_birthdays'],$board_config['bday_lookahead'],implode(', ',$upcoming_birthdays)) :
			sprintf($lang['No_upcoming'],$board_config['bday_lookahead']);
	}

	if ( !empty($user_birthdays) || !empty($upcoming_birthdays) || $board_config['bday_show'] )
	{
		$template->assign_block_vars('birthdays',array());
		if ( !empty($upcoming_birthdays) || $board_config['bday_show'] )
		{
			$template->assign_block_vars('birthdays.upcoming',array());
		}
	}

// CODE TAKEN FROM Birthday Mod Version 1.51 from Niels Chr. Rød Denmark http://mods.db9.dk/ END
$template->assign_block_vars('switch_birthdaymod_active', array(
$template->assign_vars(array(
// CODE TAKEN FROM Birthday Mod Version 1.4.15 from Niels Chr. Rød Denmark http://mods.db9.dk/ START
'L_TODAYS_BIRTHDAYS' => $lang['Todays_Birthdays'],
'L_VIEW_BIRTHDAYS' => $lang['View_Birthdays'],
//'L_Birthday_Portal' => $lang['Birthday_Portal'],
//'L_WHOSBIRTHDAY_WEEK' => ($board_config['birthday_check_day']>1) ? sprintf((($birthday_week_list)? $lang['Birthday_week'].$birthday_week_list:$lang['Nobirthday_week']),$board_config['birthday_check_day']) : '',
//'L_WHOSBIRTHDAY_TODAY' => ($board_config['birthday_check_day']) ? ($birthday_today_list)? $lang['Birthday_today'].$birthday_today_list:$lang['Nobirthday_today'] : ''
// CODE TAKEN FROM Birthday Mod Version 1.4.15 from Niels Chr. Rød Denmark http://mods.db9.dk/ END
))
));
}
// SWITCH BIRTHDAY MOD END

// SWITCH LAST VISIT MOD START
if( $introportalmod_config['lastvisitmod_active'] == "1" && $introportalmod_config['whoisonline_active'] == "1" )
{
// CODE TAKEN FROM Last Visit Mod 1.2.5 from Niels Chr. Rød Denmark http://mods.db9.dk/ START
$time_now=time();
$time1Hour=$time_now-3600;
$minutes = date('is', $time_now);
$hour_now = $time_now - (60*($minutes[0].$minutes[1])) - ($minutes[2].$minutes[3]);
$dato=create_date('H', $time_now,$board_config['board_timezone']);
$timetoday = $hour_now - (3600*$dato);
$sql = 'SELECT session_ip, MAX(session_time) as session_time FROM '.SESSIONS_TABLE.' WHERE session_user_id="'.ANONYMOUS.'" AND session_time >= '.$timetoday.' AND session_time< '.($timetoday+86399).' GROUP BY session_ip';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "<b>LAST VISIT MOD: </b>Couldn't retrieve guest user today data", "", __LINE__, __FILE__, $sql);
while( $guest_list = $db->sql_fetchrow($result))
{
	if ($guest_list['session_time'] >$time1Hour) $users_lasthour++;
}
$guests_today = $db->sql_numrows($result);
$sql = 'SELECT user_id,username,user_allow_viewonline,user_level,user_lastlogon FROM ' . USERS_TABLE . ' WHERE user_id!="'.ANONYMOUS.'" AND user_session_time >= '.$timetoday.' AND user_session_time< '.($timetoday+86399).' ORDER BY username';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "<b>LAST VISIT MOD: </b>Couldn't retrieve user today data", "", __LINE__, __FILE__, $sql);
while( $todayrow = $db->sql_fetchrow($result))
{
	$style_color = "";
	if ($todayrow['user_lastlogon']>=$time1Hour)
	{
		$users_lasthour++;
	}
	switch ($todayrow['user_level'])
	{
		case ADMIN :
		      $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
      		$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
			break;
		case MOD :
		      $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
      		$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
			break;
	}
 	$users_today_list.=( $todayrow['user_allow_viewonline'])?' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'>' . $todayrow['username'] . '</a>,' : (($userdata[user_level]==ADMIN) ? ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><i>' . $todayrow['username'] . '</i></a>,' : '');
	if (!$todayrow['user_allow_viewonline']) $logged_hidden_today++;
	else $logged_visible_today++;
}
if ($users_today_list)
{
	$users_today_list[ strlen( $users_today_list)-1] = ' ';
} else
{
	$users_today_list = $lang['None'];
}
$total_users_today = $db->sql_numrows($result)+$guests_today;
$users_today_list = $lang['Registered_users'].' ' . $users_today_list;
$l_today_user_s = ($total_users_today) ? ( ( $total_users_today == 1 )? $lang['User_today_total'] : $lang['Users_today_total'] ) : $lang['Users_today_zero_total'];
$l_today_r_user_s = ($logged_visible_today) ? ( ( $logged_visible_today == 1 ) ? $lang['Reg_user_total'] : $lang['Reg_users_total'] ) : $lang['Reg_users_zero_total'];
$l_today_h_user_s = ($logged_hidden_today) ? (($logged_hidden_today == 1) ? $lang['Hidden_user_total'] : $lang['Hidden_users_total'] ) : $lang['Hidden_users_zero_total'];
$l_today_g_user_s = ($guests_today) ? (($guests_today == 1) ? $lang['Guest_user_total'] : $lang['Guest_users_total']) : $lang['Guest_users_zero_total'];
$l_today_users = sprintf($l_today_user_s, $total_users_today);
$l_today_users .= sprintf($l_today_r_user_s, $logged_visible_today);
$l_today_users .= sprintf($l_today_h_user_s, $logged_hidden_today);
$l_today_users .= sprintf($l_today_g_user_s, $guests_today);
// CODE TAKEN FROM Last Visit Mod 1.2.5 from Niels Chr. Rød Denmark http://mods.db9.dk/ END
$template->assign_block_vars('switch_lastvisitmod_active', array(
$template->assign_vars(array(
// CODE TAKEN FROM Last Visit Mod 1.2.5 from Niels Chr. Rød Denmark http://mods.db9.dk/ START
'USERS_TODAY_LIST' => $users_today_list,
'L_USERS_LASTHOUR' =>($users_lasthour)?sprintf($lang['Users_lasthour_explain'],$users_lasthour):$lang['Users_lasthour_none_explain'],
'L_USERS_TODAY' =>$l_today_users
// CODE TAKEN FROM Last Visit Mod 1.2.5 from Niels Chr. Rød Denmark http://mods.db9.dk/ END
))
));
}
// SWITCH LAST VISIT MOD END

// SWITCH CHAT BOX MOD START
if( $userdata['session_logged_in'] && $introportalmod_config['chatboxmod_active'] == "1" )
{
// CODE TAKEN FROM Chat Box MOD 1.19g from Smartor http://phpbbhacks.com/viewhack.php?id=510 START
require_once($phpbb_root_path . 'chatbox_front.php');
// CODE TAKEN FROM Chat Box MOD 1.19g from Smartor http://phpbbhacks.com/viewhack.php?id=510 END
$template->assign_block_vars('switch_chatboxmod_active', array(
$template->assign_vars(array(
// CODE TAKEN FROM Chat Box MOD 1.19g from Smartor http://phpbbhacks.com/viewhack.php?id=510 START
'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_CLICK_TO_JOIN_CHAT' => $lang['Click_to_join_chat'],
'CHATBOX_NAME' => $userdata['user_id'] . '_ChatBox',
'S_JOIN_CHAT' => append_sid("chatbox_mod/chatbox.$phpEx")
// CODE TAKEN FROM Chat Box MOD 1.19g from Smartor http://phpbbhacks.com/viewhack.php?id=510 END
))
));
}
// SWITCH CHAT BOX MOD END

// SWITCH GLOBALBOX START
if( $introportalmod_config['globalbox_active'] == "1" )
{
$template->assign_block_vars('switch_globalbox_active', array(
$template->assign_vars(array(
// TEMPLATE CODE VARS START
'GLOBALBOX1' => $lang['globalbox1'],
'GLOBALBOX2' => $lang['globalbox2']
// TEMPLATE CODE VARS END
))
));
}
// SWITCH GLOBALBOX END 

// SWITCH GLOBAL ANNOUNCEMENT MOD START
if ( $introportalmod_config['forumlegend_active'] == "1" && $introportalmod_config['globalannouncemod_active'] == "1" )
{
	$template->assign_block_vars('switch_globalannouncemod_active', array());
}
// SWITCH GLOBAL ANNOUNCEMENT MOD END

// SWITCH WETTER START
if ( $introportalmod_config['wetter_active'] == "1" )
{
	if ( $userdata['user_plz'] != '' )
	{
	$template->assign_vars(array(
	'U_PLZ' => $userdata['user_plz']
	)
	);
	}
	else
	{
	$template->assign_vars(array(
	'U_PLZ' => $introportalmod_config['wetter_plz']
	)
	);
	}
	$template->assign_block_vars('switch_wetter_active', array());
}
// SWITCH WETTER END


// TURN OFF BOXES FROM ACP END



// LAST TOPICS START
if( $introportalmod_config['lasttopics_active'] == "1" )
{
$length = $introportalmod_config['lasttopics_length_portal'];
$limit = $introportalmod_config['lasttopics_limit'];

$sql = "SELECT post_id FROM " . POSTS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not obtain matched posts list', '', __LINE__, __FILE__, $sql);
}
$recent_ids = array();
while( $row = $db->sql_fetchrow($result) )
{
	$recent_ids[] = $row['post_id'];
}
$db->sql_freeresult($result);

$recent_forum = ( isset($HTTP_POST_VARS['forum']) ) ? intval($HTTP_POST_VARS['forum']) : -1;
if ( $recent_forum == -1 )
{
        $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
        $ignore_forum_sql = '';
        while( list($key, $value) = each($is_auth_ary) )
        {
                if ( !$value['auth_read'] )
                {
                        $ignore_forum_sql .= ( ( $ignore_forum_sql != '' ) ? ', ' : '' ) . $key;
                }
        }
        if ( $ignore_forum_sql != '' )
        {
                $auth_sql .= ( $auth_sql != '' ) ? " AND f.forum_id NOT IN ($ignore_forum_sql) " : "f.forum_id NOT IN ($ignore_forum_sql) ";
        }
}
                if ( $recent_author == '' && $auth_sql == '' )
                {
                        $sql = "SELECT topic_id FROM " . POSTS_TABLE . "
                                WHERE post_id IN (" . implode(", ", $recent_ids) . ")
                                $where_sql GROUP BY topic_id";
                }
                else
                {
                        $from_sql = POSTS_TABLE . " p";
                        if ( $auth_sql != '' )
                        {
                                $from_sql .= ", " . FORUMS_TABLE . " f";
                                $where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
                        }
                        $sql = "SELECT p.topic_id FROM $from_sql
                                WHERE p.post_id IN (" . implode(", ", $recent_ids) . ")
                                $where_sql GROUP BY p.topic_id";
                }
                if ( !($result = $db->sql_query($sql)) )
                {
                       // message_die(GENERAL_ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql);
                }

                $recent_ids = array();
                while( $row = $db->sql_fetchrow($result) )
                {
                        $recent_ids[] = $row['topic_id'];
                }
                $db->sql_freeresult($result);

$auth_results = implode(', ', $recent_ids);
$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
        FROM ". TOPICS_TABLE ." t, ". FORUMS_TABLE ." f, ". USERS_TABLE ." u, ". POSTS_TABLE ." p, ". POSTS_TABLE ." p2, ". USERS_TABLE ." u2
        WHERE t.topic_id IN ($auth_results)
              AND t.topic_poster = u.user_id
              AND f.forum_id = t.forum_id
              AND p.post_id = t.topic_first_post_id
              AND p2.post_id = t.topic_last_post_id
              AND u2.user_id = p2.poster_id
        ORDER BY t.topic_last_post_id DESC LIMIT $limit";
if ( !$result = $db->sql_query($sql) )
{
      // message_die(GENERAL_ERROR, 'Could not obtain main information', '', __LINE__, __FILE__, $sql);
}
$line = array();
while( $row = $db->sql_fetchrow($result) )
{
        $line[] = $row;
}
$db->sql_freeresult($result);

        $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
        $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
        for($i = 0; $i < count($line); $i++)
        {
                $forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $line[$i]['forum_id']);
                $forum_id = $line[$i]['forum_id'];
                $topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $line[$i]['topic_id']);
                $topic_id = $line[$i]['topic_id'];

                $orig_word = array();
                $replacement_word = array();
                obtain_word_list($orig_word, $replacement_word);
                $word_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $line[$i]['topic_title']) : $line[$i]['topic_title'];
                $topic_title = ( strlen($line[$i]['topic_title']) < $length ) ? $word_censor : substr(stripslashes($word_censor), 0, $length) . "...";

                $topic_type = ( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE ) ? $lang['Topic_global_announcement'] .' ': '';
                $topic_type .= ( $line[$i]['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';
				$topic_type .= ( $line[$i]['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';
                $topic_type .= ( $line[$i]['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';

                $views = $line[$i]['topic_views'];
                $replies = $line[$i]['topic_replies'];
                if ( ( $replies + 1 ) > $board_config['posts_per_page'] )
                {
                        $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
                        $goto_page = ' [ ';
                        $times = 1;
                        for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
                        {
                                $goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '" >' . $times . '</a>';
                                if ( $times == 1 && $total_pages > 4 )
                                {
                                        $goto_page .= ' ... ';
                                        $times = $total_pages - 3;
                                        $j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
                                }
                                else if ( $times < $total_pages )
                                {
                                        $goto_page .= ', ';
                                }
                                $times++;
                        }
                        $goto_page .= ' ] ';
                }
                else
                {
                        $goto_page = '';
                }

                if ( $line[$i]['topic_status'] == TOPIC_LOCKED )
                {
                        $folder = $images['folder_locked'];
                        $folder_new = $images['folder_locked_new'];
                }
				else if( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE )
				{
						$folder = $images['folder_global_announce'];
						$folder_new = $images['folder_global_announce_new'];
				}
                else if ( $line[$i]['topic_type'] == POST_ANNOUNCE )
                {
                        $folder = $images['folder_announce'];
                        $folder_new = $images['folder_announce_new'];
                }

                else if ( $line[$i]['topic_type'] == POST_STICKY )
                {
                        $folder = $images['folder_sticky'];
                        $folder_new = $images['folder_sticky_new'];
                }
                else
                {
                        if ( $replies >= $board_config['hot_threshold'] )
                        {
                                $folder = $images['folder_hot'];
                                $folder_new = $images['folder_hot_new'];
                        }
                        else
                        {
                                $folder = $images['folder'];
                                $folder_new = $images['folder_new'];
                        }
                }

                if ( $userdata['session_logged_in'] )
                {
                        if ( $line[$i]['post_time'] > $userdata['user_lastvisit'] )
                        {
                                if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                                {
                                        $unread_topics = true;
                                        if ( !empty($tracking_topics[$topic_id]) )
                                        {
                                                if ( $tracking_topics[$topic_id] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
                                                }
                                        }
                                        if ( !empty($tracking_forums[$forum_id]) )
                                        {
                                                if ( $tracking_forums[$forum_id] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
					}
                                        }
                                        if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                                        {
                                                if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
					}
                                        }
                                        if ( $unread_topics )
                                        {
                                                $folder_image = $folder_new;
					$folder_alt = $lang['New_posts'];
                				$newest_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
                                        }
                                        else
                                        {
                                                $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                                                $folder_image = $folder;
					$folder_alt = $folder_alt;
					$newest_img = '';
                                        }
                                }
                                else if ( $line[$i]['post_time'] > $userdata['user_lastvisit'] )
                                {
                                        $folder_image = $folder_new;
                                        $folder_alt = $lang['New_posts'];
                                        $newest_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="'. $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
                                }
                                else
                                {
                                        $folder_image = $folder;
                                        $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                                        $newest_img = '';
                                }
                        }
                        else
                        {
                                $folder_image = $folder;
                                $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                                $newest_img = '';
                        }
                }
                else
                {
                        $folder_image = $folder;
                        $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                        $newest_img = '';
                }

                $first_time = create_date($board_config['default_dateformat'], $line[$i]['topic_time'], $board_config['board_timezone']);
                $first_author = ( $line[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $line[$i]['user_id']) . '" class="gensmall">'.$line[$i]['username'].'</a>' : ( ($line[$i]['post_username'] != '' ) ? $line[$i]['post_username'] : $lang['Guest'] );
                $last_time = create_date($board_config['default_dateformat'], $line[$i]['post_time'], $board_config['board_timezone']);
                $last_author = ( $line[$i]['id2'] == ANONYMOUS ) ? ( ($line[$i]['post_username2'] != '' ) ? $line[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $line[$i]['id2']) . '" class="gensmall">' . $line[$i]['user2'] . '</a>';
                $last_url = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $line[$i]['topic_last_post_id']) . '#' . $line[$i]['topic_last_post_id'] . '"><img src="'. $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';

                $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

                $template->assign_block_vars('recent', array(
                        'TOPIC_TITLE' => $topic_title,
                        'TOPIC_TYPE' => $topic_type,
                        'VIEWS' => $views,
                        'REPLIES' => $replies,
                        'GOTO_PAGE' => $goto_page,
						'TOPIC_FOLDER_IMG' => $folder_image,
                        'NEWEST_IMG' => $newest_img,
                        'FIRST_TIME' => $first_time,
                        'FIRST_AUTHOR' => $first_author,
                        'LAST_TIME' => $last_time,
                        'LAST_AUTHOR' => $last_author,
                        'LAST_URL' => $last_url,
                        'ROW_CLASS' => $row_class,
                        'L_BY' => $lang['by'],
                        'L_STARTED' => $lang['Started'],
                        'L_REPLIES' => $lang['Replies'],
                        'L_VIEWS' => $lang['Views'],
                        'FORUM_NAME' => $line[$i]['forum_name'],
                        'U_VIEW_FORUM' => $forum_url,
                        'FORUM_ID' => $forum_id,
                        'U_VIEW_TOPIC' => $topic_url,
                        'TOPIC_ID' => $topic_id
                ));
        }

        $template->assign_vars(array(
                'L_RECENT_TITLE' => $lang['Title']
        ));
$template->assign_block_vars('switch_lasttopics_active', array());
}
// LAST TOPICS END

// GLOBAL ANNOUNCEMENT START
if( $introportalmod_config['globalannouncebox_active'] == "1" )
{
$length = $introportalmod_config['lasttopics_length_portal'];
$limit = $introportalmod_config['globalannouncebox_limit'];

$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
        FROM ". TOPICS_TABLE ." t, ". FORUMS_TABLE ." f, ". USERS_TABLE ." u, ". POSTS_TABLE ." p, ". POSTS_TABLE ." p2, ". USERS_TABLE ." u2
        WHERE t.topic_type = 3
              AND t.topic_poster = u.user_id
              AND f.forum_id = t.forum_id
              AND p.post_id = t.topic_first_post_id
              AND p2.post_id = t.topic_last_post_id
              AND u2.user_id = p2.poster_id
        ORDER BY t.topic_last_post_id DESC LIMIT $limit";
if ( !$result = $db->sql_query($sql) )
{
      // message_die(GENERAL_ERROR, 'Could not obtain main information', '', __LINE__, __FILE__, $sql);
}
$line = array();
while( $row = $db->sql_fetchrow($result) )
{
        $line[] = $row;
}
$db->sql_freeresult($result);

        $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
        $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
        for($i = 0; $i < count($line); $i++)
        {
                $forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $line[$i]['forum_id']);
                $forum_id = $line[$i]['forum_id'];
                $topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $line[$i]['topic_id']);
                $topic_id = $line[$i]['topic_id'];

                $orig_word = array();
                $replacement_word = array();
                obtain_word_list($orig_word, $replacement_word);
                $word_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $line[$i]['topic_title']) : $line[$i]['topic_title'];
                $topic_title = ( strlen($line[$i]['topic_title']) < $length ) ? $word_censor : substr(stripslashes($word_censor), 0, $length) . "...";

                $topic_type = ( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE ) ? $lang['Topic_global_announcement'] .' ': '';
                $topic_type .= ( $line[$i]['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';
            $topic_type .= ( $line[$i]['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';
                $topic_type .= ( $line[$i]['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';

                $views = $line[$i]['topic_views'];
                $replies = $line[$i]['topic_replies'];
                if ( ( $replies + 1 ) > $board_config['posts_per_page'] )
                {
                        $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
                        $goto_page = ' [ ';
                        $times = 1;
                        for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
                        {
                                $goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '" >' . $times . '</a>';
                                if ( $times == 1 && $total_pages > 4 )
                                {
                                        $goto_page .= ' ... ';
                                        $times = $total_pages - 3;
                                        $j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
                                }
                                else if ( $times < $total_pages )
                                {
                                        $goto_page .= ', ';
                                }
                                $times++;
                        }
                        $goto_page .= ' ] ';
                }
                else
                {
                        $goto_page = '';
                }

                if ( $line[$i]['topic_status'] == TOPIC_LOCKED )
                {
                        $folder = $images['folder_locked'];
                        $folder_new = $images['folder_locked_new'];
                }
            else if( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE )
            {
                  $folder = $images['folder_global_announce'];
                  $folder_new = $images['folder_global_announce_new'];
                }

                if ( $userdata['session_logged_in'] )
                {
                        if ( $line[$i]['post_time'] > $userdata['user_lastvisit'] )
                        {
                                if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                                {
                                        $unread_topics = true;
                                        if ( !empty($tracking_topics[$topic_id]) )
                                        {
                                                if ( $tracking_topics[$topic_id] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
                                                }
                                        }