A little bit of clean up
Fixed a few small XHTML validation errors Fixed incorrect language string Fixed empty latest bots block if no bot has visited the site
This commit is contained in:
54
root/portal.php
Normal file → Executable file
54
root/portal.php
Normal file → Executable file
@@ -14,35 +14,38 @@ define('IN_PHPBB', true);
|
||||
define('IN_PORTAL', true);
|
||||
|
||||
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
|
||||
|
||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
||||
|
||||
include($phpbb_root_path . 'common.' . $phpEx);
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
include($phpbb_root_path . 'portal/includes/constants.' . $phpEx);
|
||||
$portal_root_path = PORTAL_ROOT_PATH;
|
||||
include($phpbb_root_path . $portal_root_path . 'includes/functions_modules.' . $phpEx);
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
include($phpbb_root_path . $portal_root_path . 'includes/functions.' . $phpEx);
|
||||
//include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
|
||||
|
||||
|
||||
// Start session management
|
||||
$user->session_begin();
|
||||
$auth->acl($user->data);
|
||||
$user->setup('mods/portal');
|
||||
|
||||
/*
|
||||
/**
|
||||
* Make sure we do an isset first,
|
||||
* else we will get errors if someone uninstalls the portal and forgets to remove portal.php
|
||||
*/
|
||||
if (!isset($config['board3_enable']) || !$config['board3_enable'] || !$auth->acl_get('u_view_portal'))
|
||||
{
|
||||
redirect(reapply_sid($phpbb_root_path . 'index.' . $phpEx));
|
||||
redirect(append_sid($phpbb_root_path . 'index.' . $phpEx));
|
||||
}
|
||||
|
||||
/**
|
||||
* get initial data
|
||||
*/
|
||||
$portal_config = obtain_portal_config();
|
||||
$portal_modules = obtain_portal_modules();
|
||||
|
||||
/*
|
||||
/**
|
||||
* set up column_count array
|
||||
* with this we can hide unneeded parts of the portal
|
||||
*/
|
||||
$module_count = array(
|
||||
'total' => 0,
|
||||
@@ -53,9 +56,10 @@ $module_count = array(
|
||||
'bottom' => 0,
|
||||
);
|
||||
|
||||
$portal_modules = obtain_portal_modules();
|
||||
|
||||
foreach($portal_modules as $row)
|
||||
/**
|
||||
* start assigning block vars
|
||||
*/
|
||||
foreach ($portal_modules as $row)
|
||||
{
|
||||
$class_name = 'portal_' . $row['module_classname'] . '_module';
|
||||
if (!class_exists($class_name))
|
||||
@@ -67,12 +71,14 @@ foreach($portal_modules as $row)
|
||||
trigger_error(sprintf($user->lang['CLASS_NOT_FOUND'], $class_name, 'portal_' . $row['module_classname']), E_USER_ERROR);
|
||||
}
|
||||
|
||||
|
||||
$module = new $class_name();
|
||||
|
||||
// Check for permissions before loading anything
|
||||
/**
|
||||
* Check for permissions before loading anything
|
||||
* the default group of a user always defines his/her permission (KISS)
|
||||
*/
|
||||
$group_ary = (!empty($row['module_group_ids'])) ? explode(',', $row['module_group_ids']) : '';
|
||||
if((is_array($group_ary) && !in_array($user->data['group_id'], $group_ary)))
|
||||
if ((is_array($group_ary) && !in_array($user->data['group_id'], $group_ary)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -115,10 +121,10 @@ foreach($portal_modules as $row)
|
||||
}
|
||||
|
||||
// Custom Blocks that have been defined in the ACP will return an array instead of just the name of the template file
|
||||
if(is_array($template_module))
|
||||
if (is_array($template_module))
|
||||
{
|
||||
$template->assign_block_vars('modules_' . column_num_string($row['module_column']), array(
|
||||
'TEMPLATE_FILE' => 'portal/modules/' . $template_module['template'],
|
||||
'TEMPLATE_FILE' => 'portal/modules/' . $template_module['template'],
|
||||
'IMAGE_SRC' => $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $template_module['image_src'],
|
||||
'TITLE' => $template_module['title'],
|
||||
'CODE' => $template_module['code'],
|
||||
@@ -128,10 +134,10 @@ foreach($portal_modules as $row)
|
||||
else
|
||||
{
|
||||
$template->assign_block_vars('modules_' . column_num_string($row['module_column']), array(
|
||||
'TEMPLATE_FILE' => 'portal/modules/' . $template_module,
|
||||
'TEMPLATE_FILE' => 'portal/modules/' . $template_module,
|
||||
'IMAGE_SRC' => $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'],
|
||||
'IMAGE_WIDTH' => $row['module_image_width'],
|
||||
'IMAGE_HEIGHT' => $row['module_image_height'],
|
||||
'IMAGE_WIDTH' => $row['module_image_width'],
|
||||
'IMAGE_HEIGHT' => $row['module_image_height'],
|
||||
'MODULE_ID' => $row['module_id'],
|
||||
'TITLE' => (isset($user->lang[$row['module_name']])) ? $user->lang[$row['module_name']] : utf8_normalize_nfc($row['module_name']),
|
||||
));
|
||||
@@ -143,20 +149,20 @@ $module_count['total'] = sizeof($portal_modules);
|
||||
// Redirect to index if there are currently no active modules
|
||||
if($module_count['total'] < 1)
|
||||
{
|
||||
redirect(reapply_sid($phpbb_root_path . 'index.' . $phpEx));
|
||||
redirect(append_sid($phpbb_root_path . 'index.' . $phpEx));
|
||||
}
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_SMALL_BLOCK' => true,
|
||||
'S_PORTAL_LEFT_COLUMN' => $config['board3_left_column_width'],
|
||||
'S_PORTAL_RIGHT_COLUMN' => $config['board3_right_column_width'],
|
||||
// 'S_SMALL_BLOCK' => true,
|
||||
'S_PORTAL_LEFT_COLUMN' => $config['board3_left_column_width'],
|
||||
'S_PORTAL_RIGHT_COLUMN' => $config['board3_right_column_width'],
|
||||
'S_LEFT_COLUMN' => ($module_count['left'] > 0 && $config['board3_left_column']) ? true : false,
|
||||
'S_CENTER_COLUMN' => ($module_count['center'] > 0) ? true : false,
|
||||
'S_RIGHT_COLUMN' => ($module_count['right'] > 0 && $config['board3_right_column']) ? true : false,
|
||||
'S_TOP_COLUMN' => ($module_count['top'] > 0) ? true : false,
|
||||
'S_BOTTOM_COLUMN' => ($module_count['bottom'] > 0) ? true : false,
|
||||
'S_DISPLAY_PHPBB_MENU' => $config['board3_phpbb_menu'],
|
||||
'S_DISPLAY_PHPBB_MENU' => $config['board3_phpbb_menu'],
|
||||
'S_DISPLAY_JUMPBOX' => $config['board3_display_jumpbox'],
|
||||
));
|
||||
|
||||
@@ -171,4 +177,4 @@ make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
|
||||
|
||||
page_footer();
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user