[ticket/454] Remove constants.php

B3P-454
This commit is contained in:
Marc Alexander
2015-02-01 01:54:44 +01:00
parent cbe947fba4
commit f1b77b1a2b
6 changed files with 13 additions and 33 deletions

View File

@@ -26,6 +26,9 @@ class portal_module
/** @var \board3\portal\portal\modules\constraints_handler */ /** @var \board3\portal\portal\modules\constraints_handler */
protected $modules_constraints; protected $modules_constraints;
/** @var int Board3 module enabled */
const B3_MODULE_ENABLED = 1;
public function __construct() public function __construct()
{ {
global $db, $user, $cache, $request, $template, $table_prefix; global $db, $user, $cache, $request, $template, $table_prefix;
@@ -35,8 +38,6 @@ class portal_module
$this->root_path = $phpbb_root_path . 'ext/board3/portal/'; $this->root_path = $phpbb_root_path . 'ext/board3/portal/';
include($this->root_path . 'includes/constants.' . $phpEx);
$this->db = $db; $this->db = $db;
$this->user = $user; $this->user = $user;
$this->cache = $cache; $this->cache = $cache;
@@ -268,7 +269,7 @@ class portal_module
'module_image_width' => $this->request->variable('module_img_width', 0), 'module_image_width' => $this->request->variable('module_img_width', 0),
'module_image_height' => $this->request->variable('module_img_height', 0), 'module_image_height' => $this->request->variable('module_img_height', 0),
'module_group_ids' => $module_permission, 'module_group_ids' => $module_permission,
'module_status' => $this->request->variable('module_status', B3_MODULE_ENABLED), 'module_status' => $this->request->variable('module_status', self::B3_MODULE_ENABLED),
); );
if(!(isset($this->c_class->hide_name) && $this->c_class->hide_name == true)) if(!(isset($this->c_class->hide_name) && $this->c_class->hide_name == true))
@@ -473,7 +474,7 @@ class portal_module
'module_group_ids' => '', 'module_group_ids' => '',
'module_image_height' => 16, 'module_image_height' => 16,
'module_image_width' => 16, 'module_image_width' => 16,
'module_status' => B3_MODULE_ENABLED, 'module_status' => self::B3_MODULE_ENABLED,
); );
$sql = 'INSERT INTO ' . PORTAL_MODULES_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); $sql = 'INSERT INTO ' . PORTAL_MODULES_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
$this->db->sql_query($sql); $this->db->sql_query($sql);

View File

@@ -74,6 +74,9 @@ class helper
*/ */
protected $portal_modules; protected $portal_modules;
/** @var int Board3 module disabled */
const B3_MODULE_DISABLED = 0;
/** /**
* Constructor * Constructor
* NOTE: The parameters of this method must match in order and type with * NOTE: The parameters of this method must match in order and type with
@@ -139,7 +142,7 @@ class helper
public function get_portal_module($row) public function get_portal_module($row)
{ {
// Do not try to load non-existent or disabled modules // Do not try to load non-existent or disabled modules
if ($row['module_status'] == B3_MODULE_DISABLED || !is_object($module = $this->portal_helper->get_module($row['module_classname']))) if ($row['module_status'] == self::B3_MODULE_DISABLED || !is_object($module = $this->portal_helper->get_module($row['module_classname'])))
{ {
return false; return false;
} }

View File

@@ -116,7 +116,6 @@ class main
if (!function_exists('obtain_portal_config')) if (!function_exists('obtain_portal_config'))
{ {
include($this->includes_path . 'constants' . $this->php_ext);
include($this->includes_path . 'functions_modules' . $this->php_ext); include($this->includes_path . 'functions_modules' . $this->php_ext);
include($this->includes_path . 'functions' . $this->php_ext); include($this->includes_path . 'functions' . $this->php_ext);
} }

View File

@@ -1,23 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2.1
* @copyright (c) 2013 Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
// Config constants
define('B3_MODULE_DISABLED', 0);
define('B3_MODULE_ENABLED', 1);
// Tables and paths
define('PORTAL_ROOT_PATH', 'portal/');

View File

@@ -25,6 +25,9 @@ class database_handler
/** @var int Move direction left */ /** @var int Move direction left */
const MOVE_DIRECTION_LEFT = -1; const MOVE_DIRECTION_LEFT = -1;
/** @var int Board3 module enabled */
const B3_MODULE_ENABLED = 1;
/** @var \phpbb\db\driver\driver_interface */ /** @var \phpbb\db\driver\driver_interface */
protected $db; protected $db;
@@ -72,7 +75,7 @@ class database_handler
'module_group_ids' => '', 'module_group_ids' => '',
'module_image_height' => 16, 'module_image_height' => 16,
'module_image_width' => 16, 'module_image_width' => 16,
'module_status' => B3_MODULE_ENABLED, 'module_status' => self::B3_MODULE_ENABLED,
); );
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . ' $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '

View File

@@ -23,9 +23,6 @@ class helper_test extends \board3\portal\tests\testframework\test_case
parent::setUp(); parent::setUp();
define(B3_MODULE_DISABLED, 0);
define(B3_MODULE_ENABLED, 1);
$cache = $this->getMock('\phpbb\cache\driver', array('get', 'put')); $cache = $this->getMock('\phpbb\cache\driver', array('get', 'put'));
$this->auth = $this->getMock('\phpbb\auth\auth', array('acl_get')); $this->auth = $this->getMock('\phpbb\auth\auth', array('acl_get'));
$this->auth->expects($this->any()) $this->auth->expects($this->any())