[feature/controller] Include portal files and fix incorrect variables

B3P-114
This commit is contained in:
Marc Alexander
2013-01-09 18:28:05 +01:00
parent 632c7ab24f
commit 742ac5bdea

View File

@@ -71,6 +71,13 @@ class phpbb_ext_board3_portal_controller_main
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->root_path = $phpbb_root_path . '/ext/board3/portal/portal/'; $this->root_path = $phpbb_root_path . '/ext/board3/portal/portal/';
if (!function_exists('obtain_portal_config'))
{
include($this->root_path . 'includes/constants' . $this->php_ext);
include($this->root_path . 'includes/functions_modules' . $this->php_ext);
include($this->root_path . 'includes/functions' . $this->php_ext);
}
} }
/** /**
@@ -154,11 +161,11 @@ class phpbb_ext_board3_portal_controller_main
$class_name = 'portal_' . $row['module_classname'] . '_module'; $class_name = 'portal_' . $row['module_classname'] . '_module';
if (!class_exists($class_name)) if (!class_exists($class_name))
{ {
include("{$this->root_path}modules/portal_{$row['module_classname']}.{$this->php_ext}"); include("{$this->root_path}modules/portal_{$row['module_classname']}{$this->php_ext}");
} }
if (!class_exists($class_name)) if (!class_exists($class_name))
{ {
trigger_error(sprintf($user->lang['CLASS_NOT_FOUND'], $class_name, 'portal_' . $row['module_classname']), E_USER_ERROR); trigger_error(sprintf($this->user->lang['CLASS_NOT_FOUND'], $class_name, 'portal_' . $row['module_classname']), E_USER_ERROR);
} }
$module = new $class_name(); $module = new $class_name();
@@ -168,14 +175,14 @@ class phpbb_ext_board3_portal_controller_main
* the default group of a user always defines his/her permission (KISS) * the default group of a user always defines his/her permission (KISS)
*/ */
$group_ary = (!empty($row['module_group_ids'])) ? explode(',', $row['module_group_ids']) : ''; $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($this->user->data['group_id'], $group_ary)))
{ {
continue; continue;
} }
if ($module->language) if ($module->language)
{ {
$user->add_lang_ext('board3/portal', 'mods/portal/' . $module->language); $this->user->add_lang_ext('board3/portal', 'mods/portal/' . $module->language);
} }
if ($row['module_column'] == column_string_num('left') && $this->config['board3_left_column']) if ($row['module_column'] == column_string_num('left') && $this->config['board3_left_column'])
{ {
@@ -215,7 +222,7 @@ class phpbb_ext_board3_portal_controller_main
{ {
$this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( $this->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' => $this->root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $template_module['image_src'], 'IMAGE_SRC' => $this->root_path . 'styles/' . $this->user->theme['theme_path'] . '/theme/images/portal/' . $template_module['image_src'],
'TITLE' => $template_module['title'], 'TITLE' => $template_module['title'],
'CODE' => $template_module['code'], 'CODE' => $template_module['code'],
'MODULE_ID' => $row['module_id'], 'MODULE_ID' => $row['module_id'],
@@ -227,11 +234,11 @@ class phpbb_ext_board3_portal_controller_main
{ {
$this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( $this->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' => $this->root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'], 'IMAGE_SRC' => $this->root_path . 'styles/' . $this->user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'],
'IMAGE_WIDTH' => $row['module_image_width'], 'IMAGE_WIDTH' => $row['module_image_width'],
'IMAGE_HEIGHT' => $row['module_image_height'], 'IMAGE_HEIGHT' => $row['module_image_height'],
'MODULE_ID' => $row['module_id'], 'MODULE_ID' => $row['module_id'],
'TITLE' => (isset($user->lang[$row['module_name']])) ? $user->lang[$row['module_name']] : utf8_normalize_nfc($row['module_name']), 'TITLE' => (isset($this->user->lang[$row['module_name']])) ? $this->user->lang[$row['module_name']] : utf8_normalize_nfc($row['module_name']),
)); ));
} }
unset($template_module); unset($template_module);