From 742ac5bdea19e6e2190f977d67bba7b781cc252e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 9 Jan 2013 18:28:05 +0100 Subject: [PATCH] [feature/controller] Include portal files and fix incorrect variables B3P-114 --- root/controller/main.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/root/controller/main.php b/root/controller/main.php index bb84529f..98ba2ef5 100644 --- a/root/controller/main.php +++ b/root/controller/main.php @@ -71,6 +71,13 @@ class phpbb_ext_board3_portal_controller_main $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $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'; 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)) { - 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(); @@ -168,14 +175,14 @@ class phpbb_ext_board3_portal_controller_main * 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($this->user->data['group_id'], $group_ary))) { continue; } 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']) { @@ -215,7 +222,7 @@ class phpbb_ext_board3_portal_controller_main { $this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( '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'], 'CODE' => $template_module['code'], '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( '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_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']), + 'TITLE' => (isset($this->user->lang[$row['module_name']])) ? $this->user->lang[$row['module_name']] : utf8_normalize_nfc($row['module_name']), )); } unset($template_module);