<?php//This is going to be the main index, I'll add the header laterdefine('IN_PHPBB', true);define('IN_PORTAL', true);require('rootpath.php');//Lets stop now if they haven't set the root pathif ( $phpbb_root_path == '' ){ die('You must set a value in rootpath.php');}include($phpbb_root_path . 'extension.inc');include($phpbb_root_path . 'common.'.$phpEx);//// Start session management//$userdata = session_pagestart($user_ip, PAGE_INDEX);init_userprefs($userdata);//// End session management////Build a portal config array.//Code from common.php$sql = "SELECT * FROM " . PORTAL_CONFIG_TABLE;if( !($result = $db->sql_query($sql)) ){ message_die(CRITICAL_ERROR, "Could not query portal config information", "", __LINE__, __FILE__, $sql);}while ( $row = $db->sql_fetchrow($result) ){ $portal_config[$row['config_name']] = $row['config_value'];}if ( $portal_config['portal_disable'] && $userdata['user_level'] != ADMIN ){ //Redirect to the forum index if the portal is disabled redirect(append_sid('index.' . $phpEx));}else{ //Show the Header and set the body handle $page_title = $lang['Index']; include($phpbb_root_path . 'includes/page_header.' . $phpEx); $template->set_filenames(array( 'body' => 'portal_body.tpl') ); //Sets a path for the block template files //Idea came from statistics MOD $block_path = $phpbb_root_path . 'portal_blocks/'; //Couldn't hurt to know which blocks are enabled and where they go $_sql = 'SELECT * FROM ' . PORTAL_BLOCKS_TABLE . ' WHERE `block_enable` = "1" ORDER BY `block_order`'; if ( !($_result = $db->sql_query($_sql)) ) { message_die(GENERAL_ERROR, 'Couldn\'t query portal block data', '', __LINE__, __FILE__, $sql); } //Loop through and include the blocks while( $_row = $db->sql_fetchrow($_result) ) { //Get ahold of the block's language file if ( $userdata['session_logged_in'] ) { include($phpbb_root_path . 'portal_blocks/block_' . $_row['block_filename'] . './lang_' . $userdata['user_lang'] . '/lang.php'); } else { include($phpbb_root_path . 'portal_blocks/block_' . $_row['block_filename'] . './lang_' . $board_config['default_lang'] . '/lang.php'); } $template->set_filenames(array( $_row['block_id'] => $block_path . 'block_' . $_row['block_filename'] . '/template.tpl') ); //Include the block if ( !include($phpbb_root_path . 'portal_blocks/block_' . $_row['block_filename'] . '/block.' . $phpEx) ) { message_die(GENERAL_ERROR, 'Cound\'t open block file for: ' . $_row['block_filename']); } //Left column assignments if ( $block_column == 'left' ) { $template->assign_block_vars('blocks', array('LEFT_COLUMN' => $template->store_pparse($_row['block_id']))); } //Right column assignments elseif ( $block_column == 'right' ) { $template->assign_block_vars('blocks', array('RIGHT_COLUMN' => $template->store_pparse($_row['block_id']))); } //If all else fails: send an error else { message_die(GENERAL_ERROR, 'Block column not set', '', __LINE__, __FILE__, $sql); } } //Put it all together and show it $template->pparse('body'); //And throw in a footer for good measure include($phpbb_root_path . 'includes/page_tail.' . $phpEx);}?>