aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/index.php11
-rw-r--r--phpBB/adm/swatch.php2
-rw-r--r--phpBB/common.php10
-rw-r--r--phpBB/includes/acm/bootstrap.php16
-rw-r--r--phpBB/includes/classes/session.php2
-rw-r--r--phpBB/includes/classes/template.php2
-rw-r--r--phpBB/includes/classes/user.php2
-rw-r--r--phpBB/includes/constants.php123
-rw-r--r--phpBB/includes/core/bootstrap.php32
-rw-r--r--phpBB/includes/core/core.php46
-rw-r--r--phpBB/includes/functions.php17
-rw-r--r--phpBB/includes/functions_admin.php6
-rw-r--r--phpBB/install/database_update.php2
-rw-r--r--phpBB/install/index.php68
-rw-r--r--phpBB/install/install_install.php16
-rw-r--r--phpBB/install/install_update.php2
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/modules/acp/acp_database.php10
-rw-r--r--phpBB/modules/ucp/ucp_groups.php4
19 files changed, 154 insertions, 219 deletions
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php
index a6a6dcb563..c66935d84a 100644
--- a/phpBB/adm/index.php
+++ b/phpBB/adm/index.php
@@ -171,26 +171,25 @@ function adm_page_footer($copyright_html = true)
global $starttime;
// Output page creation time
- if (defined('DEBUG'))
+ if (phpbb::$base_config['debug'])
{
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
- if (phpbb_request::variable('explain', false) && phpbb::$acl->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists(phpbb::$db, 'sql_report'))
+ if (phpbb_request::variable('explain', false) && phpbb::$acl->acl_get('a_') && phpbb::$base_config['debug_extra'] && method_exists(phpbb::$db, 'sql_report'))
{
phpbb::$db->sql_report('display');
}
$debug_output = sprintf('Time : %.3fs | ' . phpbb::$db->sql_num_queries() . ' Queries | GZIP : ' . ((phpbb::$config['gzip_compress']) ? 'On' : 'Off') . ((phpbb::$user->system['load']) ? ' | Load : ' . phpbb::$user->system['load'] : ''), $totaltime);
- if (phpbb::$acl->acl_get('a_') && defined('DEBUG_EXTRA'))
+ if (phpbb::$acl->acl_get('a_') && phpbb::$base_config['debug_extra'])
{
if (function_exists('memory_get_usage'))
{
if ($memory_usage = memory_get_usage())
{
- global $base_memory_usage;
- $memory_usage -= $base_memory_usage;
+ $memory_usage -= phpbb::$base_config['memory_usage'];
$memory_usage = get_formatted_filesize($memory_usage);
$debug_output .= ' | Memory Usage: ' . $memory_usage;
@@ -202,7 +201,7 @@ function adm_page_footer($copyright_html = true)
}
phpbb::$template->assign_vars(array(
- 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
+ 'DEBUG_OUTPUT' => (phpbb::$base_config['debug']) ? $debug_output : '',
'TRANSLATION_INFO' => (!empty(phpbb::$user->lang['TRANSLATION_INFO'])) ? phpbb::$user->lang['TRANSLATION_INFO'] : '',
'S_COPYRIGHT_HTML' => $copyright_html,
'VERSION' => phpbb::$config['version'])
diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php
index 7ee6d7d0c0..a7ece7e30d 100644
--- a/phpBB/adm/swatch.php
+++ b/phpBB/adm/swatch.php
@@ -23,7 +23,7 @@ $auth->acl($user->data);
$user->setup();
// Set custom template for admin area
-$template->set_custom_template(PHPBB_ROOT_PATH . CONFIG_ADM_FOLDER . '/style', 'admin');
+$template->set_custom_template(PHPBB_ROOT_PATH . phpbb::$base_config['admin_folder'] . '/style', 'admin');
$template->set_filenames(array(
'body' => 'colour_swatch.html')
diff --git a/phpBB/common.php b/phpBB/common.php
index b0db9ad5b2..aa72b83612 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
require PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT;
// Run through remaining Framework states
-if (defined('PHPBB_CONFIG_MISSING') || !defined('PHPBB_INSTALLED'))
+if (!phpbb::$base_config['config_set'] || !phpbb::$base_config['installed'])
{
// Redirect the user to the installer
// We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information
@@ -66,16 +66,16 @@ phpbb_request::disable_super_globals();
// @todo Syndicate config variables somehow and check them here. It would be also nice to not have so many global vars from the config file (means: re-think layout of config file, maybe require phpbb:: to be set)
-if (!empty($dbms))
+if (!empty(phpbb::$base_config['dbms']))
{
// Register DB object.
- phpbb::assign('db', phpbb_db_dbal::connect($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false));
+ phpbb::assign('db', phpbb_db_dbal::connect(phpbb::$base_config['dbms'], phpbb::$base_config['dbhost'], phpbb::$base_config['dbuser'], phpbb::$base_config['dbpasswd'], phpbb::$base_config['dbname'], phpbb::$base_config['dbport'], false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false));
}
// We do not need the db password any longer, unset for safety purposes
-if (!empty($dbpasswd))
+if (!empty(phpbb::$base_config['dbpasswd']))
{
- unset($dbpasswd);
+ unset(phpbb::$base_config['dbpasswd']);
}
// Register Cache Manager
diff --git a/phpBB/includes/acm/bootstrap.php b/phpBB/includes/acm/bootstrap.php
index 849f3e3863..ea671706e5 100644
--- a/phpBB/includes/acm/bootstrap.php
+++ b/phpBB/includes/acm/bootstrap.php
@@ -17,15 +17,6 @@ if (!defined('IN_PHPBB'))
}
/**
-* Define missing ACM config variable... if not initialized yet
-* @ignore
-*/
-if (!defined('CONFIG_ACM_TYPE'))
-{
- define('CONFIG_ACM_TYPE', 'file');
-}
-
-/**
* Base cache class.
*
* A prefix of # for $var_name indicates global data.
@@ -63,6 +54,9 @@ class phpbb_acm
/**
* Magic method for calling type-specific functions.
* Functions directly supported are: get(), put(), exists(), destroy()
+ *
+ * The type is added to the methods name, for getting sql data just use get_sql() for example.
+ *
* see {@link phpbb_acm_abstract phpbb_acm_abstract} for more information
*
* @access public
@@ -176,8 +170,10 @@ class phpbb_acm
* @return bool Returns true on success, else false.
* @access public
*/
- public function register($cache_type, $cache_append = false, $cache_object = CONFIG_ACM_TYPE)
+ public function register($cache_type, $cache_append = false, $cache_object = false)
{
+ $cache_object = ($cache_object === false) ? basename(phpbb::$base_config['acm_type']) : basename($cache_object);
+
// We need to init every cache type...
if (!isset($this->cache_types[$cache_type]))
{
diff --git a/phpBB/includes/classes/session.php b/phpBB/includes/classes/session.php
index 616f85b349..e5f4bd8e0c 100644
--- a/phpBB/includes/classes/session.php
+++ b/phpBB/includes/classes/session.php
@@ -1265,7 +1265,7 @@ abstract class phpbb_session
if ($user_ip !== $session_ip || $user_browser !== $session_browser || $user_forwarded_for !== $session_forwarded_for || !$referer_valid)
{
// Added logging temporarly to help debug bugs...
- if (defined('DEBUG_EXTRA') && $this->data['user_id'] != ANONYMOUS && $log_failure)
+ if (phpbb::$base_config['debug_extra'] && $this->data['user_id'] != ANONYMOUS && $log_failure)
{
if ($referer_valid)
{
diff --git a/phpBB/includes/classes/template.php b/phpBB/includes/classes/template.php
index f574f4d9fb..a3277475cf 100644
--- a/phpBB/includes/classes/template.php
+++ b/phpBB/includes/classes/template.php
@@ -236,7 +236,7 @@ class phpbb_template
$recompile = (!file_exists($filename) || @filesize($filename) === 0 || (phpbb::$config['load_tplcompile'] && @filemtime($filename) < filemtime($this->files[$handle]))) ? true : false;
- if (defined('DEBUG_EXTRA'))
+ if (phpbb::$base_config['debug_extra'])
{
$recompile = true;
}
diff --git a/phpBB/includes/classes/user.php b/phpBB/includes/classes/user.php
index a050c43fbb..d4d083916c 100644
--- a/phpBB/includes/classes/user.php
+++ b/phpBB/includes/classes/user.php
@@ -457,7 +457,7 @@ class phpbb_user extends phpbb_session
// Disable board if the install/ directory is still present
// For the brave development army we do not care about this, else we need to comment out this everytime we develop locally
- if (!defined('DEBUG_EXTRA') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists(PHPBB_ROOT_PATH . 'install'))
+ if (!phpbb::$base_config['debug_extra'] && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists(PHPBB_ROOT_PATH . 'install'))
{
// Adjust the message slightly according to the permissions
if (phpbb::$acl->acl_gets('a_', 'm_') || phpbb::$acl->acl_getf_global('m_'))
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index c62e50d481..f4863bd24f 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -173,69 +173,68 @@ define('REFERER_VALIDATE_PATH', 2);
define('VOTE_CONVERTED', 127);
// Table names
-define('ACL_GROUPS_TABLE', $table_prefix . 'acl_groups');
-define('ACL_OPTIONS_TABLE', $table_prefix . 'acl_options');
-define('ACL_ROLES_DATA_TABLE', $table_prefix . 'acl_roles_data');
-define('ACL_ROLES_TABLE', $table_prefix . 'acl_roles');
-define('ACL_USERS_TABLE', $table_prefix . 'acl_users');
-define('ATTACHMENTS_TABLE', $table_prefix . 'attachments');
-define('BANLIST_TABLE', $table_prefix . 'banlist');
-define('BBCODES_TABLE', $table_prefix . 'bbcodes');
-define('BOOKMARKS_TABLE', $table_prefix . 'bookmarks');
-define('BOTS_TABLE', $table_prefix . 'bots');
-define('CONFIG_TABLE', $table_prefix . 'config');
-define('CONFIRM_TABLE', $table_prefix . 'confirm');
-define('DISALLOW_TABLE', $table_prefix . 'disallow');
-define('DRAFTS_TABLE', $table_prefix . 'drafts');
-define('EXTENSIONS_TABLE', $table_prefix . 'extensions');
-define('EXTENSION_GROUPS_TABLE', $table_prefix . 'extension_groups');
-define('FORUMS_TABLE', $table_prefix . 'forums');
-define('FORUMS_ACCESS_TABLE', $table_prefix . 'forums_access');
-define('FORUMS_TRACK_TABLE', $table_prefix . 'forums_track');
-define('FORUMS_WATCH_TABLE', $table_prefix . 'forums_watch');
-define('GROUPS_TABLE', $table_prefix . 'groups');
-define('ICONS_TABLE', $table_prefix . 'icons');
-define('LANG_TABLE', $table_prefix . 'lang');
-define('LOG_TABLE', $table_prefix . 'log');
-define('MODERATOR_CACHE_TABLE', $table_prefix . 'moderator_cache');
-define('MODULES_TABLE', $table_prefix . 'modules');
-define('POLL_OPTIONS_TABLE', $table_prefix . 'poll_options');
-define('POLL_VOTES_TABLE', $table_prefix . 'poll_votes');
-define('POSTS_TABLE', $table_prefix . 'posts');
-define('PRIVMSGS_TABLE', $table_prefix . 'privmsgs');
-define('PRIVMSGS_FOLDER_TABLE', $table_prefix . 'privmsgs_folder');
-define('PRIVMSGS_RULES_TABLE', $table_prefix . 'privmsgs_rules');
-define('PRIVMSGS_TO_TABLE', $table_prefix . 'privmsgs_to');
-define('PROFILE_FIELDS_TABLE', $table_prefix . 'profile_fields');
-define('PROFILE_FIELDS_DATA_TABLE', $table_prefix . 'profile_fields_data');
-define('PROFILE_FIELDS_LANG_TABLE', $table_prefix . 'profile_fields_lang');
-define('PROFILE_LANG_TABLE', $table_prefix . 'profile_lang');
-define('RANKS_TABLE', $table_prefix . 'ranks');
-define('REPORTS_TABLE', $table_prefix . 'reports');
-define('REPORTS_REASONS_TABLE', $table_prefix . 'reports_reasons');
-define('SEARCH_RESULTS_TABLE', $table_prefix . 'search_results');
-define('SEARCH_WORDLIST_TABLE', $table_prefix . 'search_wordlist');
-define('SEARCH_WORDMATCH_TABLE', $table_prefix . 'search_wordmatch');
-define('SESSIONS_TABLE', $table_prefix . 'sessions');
-define('SESSIONS_KEYS_TABLE', $table_prefix . 'sessions_keys');
-define('SITELIST_TABLE', $table_prefix . 'sitelist');
-define('SMILIES_TABLE', $table_prefix . 'smilies');
-define('STYLES_TABLE', $table_prefix . 'styles');
-define('STYLES_TEMPLATE_TABLE', $table_prefix . 'styles_template');
-define('STYLES_THEME_TABLE', $table_prefix . 'styles_theme');
-define('STYLES_IMAGESET_TABLE', $table_prefix . 'styles_imageset');
-define('STYLES_IMAGESET_DATA_TABLE',$table_prefix . 'styles_imageset_data');
-define('TOPICS_TABLE', $table_prefix . 'topics');
-define('TOPICS_POSTED_TABLE', $table_prefix . 'topics_posted');
-define('TOPICS_TRACK_TABLE', $table_prefix . 'topics_track');
-define('TOPICS_WATCH_TABLE', $table_prefix . 'topics_watch');
-define('USER_GROUP_TABLE', $table_prefix . 'user_group');
-define('USERS_TABLE', $table_prefix . 'users');
-define('WARNINGS_TABLE', $table_prefix . 'warnings');
-define('WORDS_TABLE', $table_prefix . 'words');
-define('ZEBRA_TABLE', $table_prefix . 'zebra');
+define('ACL_GROUPS_TABLE', phpbb::$base_config['table_prefix'] . 'acl_groups');
+define('ACL_OPTIONS_TABLE', phpbb::$base_config['table_prefix'] . 'acl_options');
+define('ACL_ROLES_DATA_TABLE', phpbb::$base_config['table_prefix'] . 'acl_roles_data');
+define('ACL_ROLES_TABLE', phpbb::$base_config['table_prefix'] . 'acl_roles');
+define('ACL_USERS_TABLE', phpbb::$base_config['table_prefix'] . 'acl_users');
+define('ATTACHMENTS_TABLE', phpbb::$base_config['table_prefix'] . 'attachments');
+define('BANLIST_TABLE', phpbb::$base_config['table_prefix'] . 'banlist');
+define('BBCODES_TABLE', phpbb::$base_config['table_prefix'] . 'bbcodes');
+define('BOOKMARKS_TABLE', phpbb::$base_config['table_prefix'] . 'bookmarks');
+define('BOTS_TABLE', phpbb::$base_config['table_prefix'] . 'bots');
+define('CONFIG_TABLE', phpbb::$base_config['table_prefix'] . 'config');
+define('CONFIRM_TABLE', phpbb::$base_config['table_prefix'] . 'confirm');
+define('DISALLOW_TABLE', phpbb::$base_config['table_prefix'] . 'disallow');
+define('DRAFTS_TABLE', phpbb::$base_config['table_prefix'] . 'drafts');
+define('EXTENSIONS_TABLE', phpbb::$base_config['table_prefix'] . 'extensions');
+define('EXTENSION_GROUPS_TABLE', phpbb::$base_config['table_prefix'] . 'extension_groups');
+define('FORUMS_TABLE', phpbb::$base_config['table_prefix'] . 'forums');
+define('FORUMS_ACCESS_TABLE', phpbb::$base_config['table_prefix'] . 'forums_access');
+define('FORUMS_TRACK_TABLE', phpbb::$base_config['table_prefix'] . 'forums_track');
+define('FORUMS_WATCH_TABLE', phpbb::$base_config['table_prefix'] . 'forums_watch');
+define('GROUPS_TABLE', phpbb::$base_config['table_prefix'] . 'groups');
+define('ICONS_TABLE', phpbb::$base_config['table_prefix'] . 'icons');
+define('LANG_TABLE', phpbb::$base_config['table_prefix'] . 'lang');
+define('LOG_TABLE', phpbb::$base_config['table_prefix'] . 'log');
+define('MODERATOR_CACHE_TABLE', phpbb::$base_config['table_prefix'] . 'moderator_cache');
+define('MODULES_TABLE', phpbb::$base_config['table_prefix'] . 'modules');
+define('POLL_OPTIONS_TABLE', phpbb::$base_config['table_prefix'] . 'poll_options');
+define('POLL_VOTES_TABLE', phpbb::$base_config['table_prefix'] . 'poll_votes');
+define('POSTS_TABLE', phpbb::$base_config['table_prefix'] . 'posts');
+define('PRIVMSGS_TABLE', phpbb::$base_config['table_prefix'] . 'privmsgs');
+define('PRIVMSGS_FOLDER_TABLE', phpbb::$base_config['table_prefix'] . 'privmsgs_folder');
+define('PRIVMSGS_RULES_TABLE', phpbb::$base_config['table_prefix'] . 'privmsgs_rules');
+define('PRIVMSGS_TO_TABLE', phpbb::$base_config['table_prefix'] . 'privmsgs_to');
+define('PROFILE_FIELDS_TABLE', phpbb::$base_config['table_prefix'] . 'profile_fields');
+define('PROFILE_FIELDS_DATA_TABLE', phpbb::$base_config['table_prefix'] . 'profile_fields_data');
+define('PROFILE_FIELDS_LANG_TABLE', phpbb::$base_config['table_prefix'] . 'profile_fields_lang');
+define('PROFILE_LANG_TABLE', phpbb::$base_config['table_prefix'] . 'profile_lang');
+define('RANKS_TABLE', phpbb::$base_config['table_prefix'] . 'ranks');
+define('REPORTS_TABLE', phpbb::$base_config['table_prefix'] . 'reports');
+define('REPORTS_REASONS_TABLE', phpbb::$base_config['table_prefix'] . 'reports_reasons');
+define('SEARCH_RESULTS_TABLE', phpbb::$base_config['table_prefix'] . 'search_results');
+define('SEARCH_WORDLIST_TABLE', phpbb::$base_config['table_prefix'] . 'search_wordlist');
+define('SEARCH_WORDMATCH_TABLE', phpbb::$base_config['table_prefix'] . 'search_wordmatch');
+define('SESSIONS_TABLE', phpbb::$base_config['table_prefix'] . 'sessions');
+define('SESSIONS_KEYS_TABLE', phpbb::$base_config['table_prefix'] . 'sessions_keys');
+define('SITELIST_TABLE', phpbb::$base_config['table_prefix'] . 'sitelist');
+define('SMILIES_TABLE', phpbb::$base_config['table_prefix'] . 'smilies');
+define('STYLES_TABLE', phpbb::$base_config['table_prefix'] . 'styles');
+define('STYLES_TEMPLATE_TABLE', phpbb::$base_config['table_prefix'] . 'styles_template');
+define('STYLES_THEME_TABLE', phpbb::$base_config['table_prefix'] . 'styles_theme');
+define('STYLES_IMAGESET_TABLE', phpbb::$base_config['table_prefix'] . 'styles_imageset');
+define('STYLES_IMAGESET_DATA_TABLE',phpbb::$base_config['table_prefix'] . 'styles_imageset_data');
+define('TOPICS_TABLE', phpbb::$base_config['table_prefix'] . 'topics');
+define('TOPICS_POSTED_TABLE', phpbb::$base_config['table_prefix'] . 'topics_posted');
+define('TOPICS_TRACK_TABLE', phpbb::$base_config['table_prefix'] . 'topics_track');
+define('TOPICS_WATCH_TABLE', phpbb::$base_config['table_prefix'] . 'topics_watch');
+define('USER_GROUP_TABLE', phpbb::$base_config['table_prefix'] . 'user_group');
+define('USERS_TABLE', phpbb::$base_config['table_prefix'] . 'users');
+define('WARNINGS_TABLE', phpbb::$base_config['table_prefix'] . 'warnings');
+define('WORDS_TABLE', phpbb::$base_config['table_prefix'] . 'words');
+define('ZEBRA_TABLE', phpbb::$base_config['table_prefix'] . 'zebra');
// Additional tables
-
?> \ No newline at end of file
diff --git a/phpBB/includes/core/bootstrap.php b/phpBB/includes/core/bootstrap.php
index 4d604dadcc..0a4910b052 100644
--- a/phpBB/includes/core/bootstrap.php
+++ b/phpBB/includes/core/bootstrap.php
@@ -61,44 +61,14 @@ if (defined('IN_CRON'))
// Set some default configuration parameter if the config file does not exist
if (!file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT))
{
- define('CONFIG_ADM_FOLDER', 'adm');
- define('CONFIG_ACM_TYPE', 'file');
-
+ // phpbb::$base_config['config_set'] = false
// This allows common.php or an installation script to do specific actions if the configuration is missing
- define('PHPBB_CONFIG_MISSING', true);
}
else
{
require PHPBB_ROOT_PATH . 'config.' . PHP_EXT;
}
-// Set default configuration variables if phpBB is not installed
-if (!defined('PHPBB_INSTALLED'))
-{
- $dbms = $dbhost = $dbport = $dbname = $dbuser = $dbpasswd = '';
- $table_prefix = 'phpbb_';
-}
-
-if (defined('DEBUG_EXTRA'))
-{
- $base_memory_usage = 0;
- if (function_exists('memory_get_usage'))
- {
- $base_memory_usage = memory_get_usage();
- }
-}
-
-// Load Extensions
-if (!empty($load_extensions))
-{
- $load_extensions = explode(',', $load_extensions);
-
- foreach ($load_extensions as $extension)
- {
- @dl(trim($extension));
- }
-}
-
// Register autoload function
spl_autoload_register('__phpbb_autoload');
diff --git a/phpBB/includes/core/core.php b/phpBB/includes/core/core.php
index 717ff0d4a2..09b6365da2 100644
--- a/phpBB/includes/core/core.php
+++ b/phpBB/includes/core/core.php
@@ -81,7 +81,24 @@ abstract class phpbb
* @var array The phpBB configuration array
*/
public static $config = array();
- /**#@-*/
+
+ /**
+ * @var array The base configuration array
+ */
+ public static $base_config = array(
+ 'table_prefix' => 'phpbb_',
+ 'admin_folder' => 'adm',
+ 'acm_type' => 'file',
+
+ 'config_set' => false,
+ 'extensions_set' => false,
+
+ 'memory_usage' => 0,
+
+ 'debug' => false,
+ 'debug_extra' => false,
+ 'installed' => false,
+ );
/**#@+
* Permission constant
@@ -145,6 +162,33 @@ abstract class phpbb
}
/**
+ * Set base configuration - called from config.php file
+ */
+ public static function set_config($config)
+ {
+ phpbb::$base_config = array_merge(phpbb::$base_config, $config);
+ phpbb::$base_config['config_set'] = true;
+
+ if (phpbb::$base_config['debug_extra'] && function_exists('memory_get_usage'))
+ {
+ phpbb::$base_config['memory_usage'] = memory_get_usage();
+ }
+
+ // Load Extensions
+ if (!empty(phpbb::$base_config['extensions']) && !phpbb::$base_config['extensions_set'])
+ {
+ $load_extensions = explode(',', phpbb::$base_config['extensions']);
+
+ foreach ($load_extensions as $extension)
+ {
+ @dl(trim($extension));
+ }
+
+ phpbb::$base_config['extensions_set'] = true;
+ }
+ }
+
+ /**
* Get instance of static property
*
* @param string $variable The name of the instance to retrieve.
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index b5be112e5c..1f6e7bcae7 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2026,7 +2026,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
// Check the error reporting level and return if the error level does not match
// If DEBUG is defined the default level is E_ALL
- if (($errno & ((defined('DEBUG')) ? E_ALL | E_STRICT : error_reporting())) == 0)
+ if (($errno & ((phpbb::$base_config['debug']) ? E_ALL | E_STRICT : error_reporting())) == 0)
{
return;
}
@@ -2122,7 +2122,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
echo ' <div>' . $msg_text;
- if ((phpbb::registered('acl') && phpbb::$acl->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG_EXTRA'))
+ if ((phpbb::registered('acl') && phpbb::$acl->acl_get('a_')) || defined('IN_INSTALL') || phpbb::$base_config['debug_extra'])
{
echo ($backtrace = get_backtrace()) ? '<br /><br />BACKTRACE' . $backtrace : '';
}
@@ -2522,26 +2522,25 @@ function page_footer($run_cron = true)
global $starttime;
// Output page creation time
- if (defined('DEBUG'))
+ if (phpbb::$base_config['debug'])
{
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
- if (phpbb_request::variable('explain', false) && /*phpbb::$acl->acl_get('a_') &&*/ defined('DEBUG_EXTRA') && method_exists(phpbb::$db, 'sql_report'))
+ if (phpbb_request::variable('explain', false) && /*phpbb::$acl->acl_get('a_') &&*/ phpbb::$base_config['debug_extra'] && method_exists(phpbb::$db, 'sql_report'))
{
phpbb::$db->sql_report('display');
}
$debug_output = sprintf('Time : %.3fs | ' . phpbb::$db->sql_num_queries() . ' Queries | GZIP : ' . ((phpbb::$config['gzip_compress']) ? 'On' : 'Off') . ((phpbb::$user->system['load']) ? ' | Load : ' . phpbb::$user->system['load'] : ''), $totaltime);
- if (/*phpbb::$acl->acl_get('a_') &&*/ defined('DEBUG_EXTRA'))
+ if (/*phpbb::$acl->acl_get('a_') &&*/ phpbb::$base_config['debug_extra'])
{
if (function_exists('memory_get_usage'))
{
if ($memory_usage = memory_get_usage())
{
- global $base_memory_usage;
- $memory_usage -= $base_memory_usage;
+ $memory_usage -= phpbb::$base_config['memory_usage'];
$memory_usage = get_formatted_filesize($memory_usage);
$debug_output .= ' | Memory Usage: ' . $memory_usage;
@@ -2553,10 +2552,10 @@ function page_footer($run_cron = true)
}
phpbb::$template->assign_vars(array(
- 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
+ 'DEBUG_OUTPUT' => (phpbb::$base_config['debug']) ? $debug_output : '',
'TRANSLATION_INFO' => (!empty(phpbb::$user->lang['TRANSLATION_INFO'])) ? phpbb::$user->lang['TRANSLATION_INFO'] : '',
- 'U_ACP' => (phpbb::$acl->acl_get('a_') && !empty(phpbb::$user->is_registered)) ? phpbb::$url->append_sid(CONFIG_ADM_FOLDER . '/index', false, true, phpbb::$user->session_id) : '',
+ 'U_ACP' => (phpbb::$acl->acl_get('a_') && !empty(phpbb::$user->is_registered)) ? phpbb::$url->append_sid(phpbb::$base_config['admin_folder'] . '/index', false, true, phpbb::$user->session_id) : '',
));
// Call cron-type script
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 856db6ebf6..79664fe6d1 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2707,8 +2707,6 @@ function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limi
*/
function get_database_size()
{
- global $table_prefix;
-
$database_size = false;
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
@@ -2737,9 +2735,9 @@ function get_database_size()
{
if ((isset($row['Type']) && $row['Type'] != 'MRG_MyISAM') || (isset($row['Engine']) && ($row['Engine'] == 'MyISAM' || $row['Engine'] == 'InnoDB')))
{
- if ($table_prefix != '')
+ if (phpbb::$base_config['table_prefix'] != '')
{
- if (strpos($row['Name'], $table_prefix) !== false)
+ if (strpos($row['Name'], phpbb::$base_config['table_prefix']) !== false)
{
$database_size += $row['Data_length'] + $row['Index_length'];
}
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 0b495cf995..f72f963bff 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -337,7 +337,7 @@ function change_database_data($version)
*/
function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
{
- if (defined('DEBUG_EXTRA'))
+ if (phpbb::$base_config['debug_extra'])
{
echo "<br />\n{$sql}\n<br />";
}
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index b09330f88b..bb22ebaf36 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -56,74 +56,6 @@ else
@ini_set('memory_limit', $mem_limit);
*/
-/* Try and load an appropriate language if required
-$language = basename(request_var('language', ''));
-
-if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language)
-{
- $accept_lang_ary = explode(',', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
- foreach ($accept_lang_ary as $accept_lang)
- {
- // Set correct format ... guess full xx_yy form
- $accept_lang = substr($accept_lang, 0, 2) . '_' . substr($accept_lang, 3, 2);
-
- if (file_exists(PHPBB_ROOT_PATH . 'language/' . $accept_lang))
- {
- $language = $accept_lang;
- break;
- }
- else
- {
- // No match on xx_yy so try xx
- $accept_lang = substr($accept_lang, 0, 2);
- if (file_exists(PHPBB_ROOT_PATH . 'language/' . $accept_lang))
- {
- $language = $accept_lang;
- break;
- }
- }
- }
-}
-
-// No appropriate language found ... so let's use the first one in the language
-// dir, this may or may not be English
-if (!$language)
-{
- $dir = @opendir(PHPBB_ROOT_PATH . 'language');
-
- if (!$dir)
- {
- die('Unable to access the language directory');
- exit;
- }
-
- while (($file = readdir($dir)) !== false)
- {
- $path = PHPBB_ROOT_PATH . 'language/' . $file;
-
- if (!is_file($path) && !is_link($path) && file_exists($path . '/iso.txt'))
- {
- $language = $file;
- break;
- }
- }
- closedir($dir);
-}
-
-if (!file_exists(PHPBB_ROOT_PATH . 'language/' . $language))
-{
- die('No language found!');
-}
-
-// And finally, load the relevant language files
-include(PHPBB_ROOT_PATH . 'language/' . $language . '/common.' . PHP_EXT);
-include(PHPBB_ROOT_PATH . 'language/' . $language . '/acp/common.' . PHP_EXT);
-include(PHPBB_ROOT_PATH . 'language/' . $language . '/acp/board.' . PHP_EXT);
-include(PHPBB_ROOT_PATH . 'language/' . $language . '/install.' . PHP_EXT);
-include(PHPBB_ROOT_PATH . 'language/' . $language . '/posting.' . PHP_EXT);
-
-*/
-
// Initialize some common config variables
phpbb::$config += array(
'load_tplcompile' => true,
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 46618d7eb0..001acc4584 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -21,9 +21,9 @@ if (!empty($setmodules))
// If phpBB is already installed we do not include this module
if (@file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && !file_exists(PHPBB_ROOT_PATH . 'cache/install_lock'))
{
- include_once(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
+ include PHPBB_ROOT_PATH . 'config.' . PHP_EXT;
- if (defined('PHPBB_INSTALLED'))
+ if (phpbb::$base_config['installed'])
{
return;
}
@@ -800,6 +800,7 @@ class install_install extends module
// Time to convert the data provided into a config file
$config_data = "<?php\n";
$config_data .= "// phpBB 3.0.x auto-generated configuration file\n// Do not change anything in this file!\n";
+ $config_data .= "if (class_exists('phpbb') && defined('IN_PHPBB'))\n{\n\tphpbb::set_config(array(\n";
$config_data_array = array(
'dbms' => $available_dbms[$data['dbms']]['DRIVER'],
@@ -809,21 +810,18 @@ class install_install extends module
'dbuser' => $data['dbuser'],
'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']),
'table_prefix' => $data['table_prefix'],
+ 'admin_folder' => 'adm',
'acm_type' => 'file',
- 'load_extensions' => $load_extensions,
+ 'extensions' => $load_extensions,
);
foreach ($config_data_array as $key => $value)
{
- $config_data .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n";
+ $config_data .= "\t\t'{$key}' => '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "',\n";
}
unset($config_data_array);
- $config_data .= "\n// If you rename your admin folder, please change this value\n";
- $config_data .= "@define('CONFIG_ADM_FOLDER', 'adm');\n";
- $config_data .= "@define('PHPBB_INSTALLED', true);\n";
- $config_data .= "@define('DEBUG', true);\n";
- $config_data .= "@define('DEBUG_EXTRA', true);\n";
+ $config_data .= "\n\t\t'debug' => true,\n\t\t'debug_extra' => true,\n\n\t\t// DO NOT CHANGE\n\t\t'installed' => true,\n\t));\n}\n";
$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
// Attempt to write out the config file directly. If it works, this is the easiest way to do it ...
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index d347c0af59..137b9d4957 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -24,7 +24,7 @@ if (!empty($setmodules))
{
include_once(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
- if (!defined('PHPBB_INSTALLED'))
+ if (!phpbb::$base_config['installed'])
{
return;
}
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 26d9b89953..aeb235afa5 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -569,7 +569,7 @@ switch ($mode)
'S_GROUP_OPTIONS' => $group_options,
'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false,
- 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid(CONFIG_ADM_FOLDER . '/index', 'i=users&amp;mode=overview&amp;u=' . $user_id, true, $user->session_id) : '',
+ 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid(phpbb::$base_config['admin_folder'] . '/index', 'i=users&amp;mode=overview&amp;u=' . $user_id, true, $user->session_id) : '',
'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid('mcp', 'i=ban&amp;mode=user&amp;u=' . $user_id, true, $user->session_id) : '',
'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid('ucp', "mode=switch_perm&amp;u={$user_id}") : '',
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid('mcp', 'i=queue', true, $user->session_id) : '',
diff --git a/phpBB/modules/acp/acp_database.php b/phpBB/modules/acp/acp_database.php
index 14e38bc697..1b4a08df84 100644
--- a/phpBB/modules/acp/acp_database.php
+++ b/phpBB/modules/acp/acp_database.php
@@ -25,7 +25,7 @@ class acp_database
function main($id, $mode)
{
- global $db, $user, $auth, $template, $table_prefix;
+ global $db, $user, $auth, $template;
$user->add_lang('acp/database');
@@ -116,7 +116,7 @@ class acp_database
break;
}
- $extractor->write_start($table_prefix);
+ $extractor->write_start();
foreach ($table as $table_name)
{
@@ -175,7 +175,7 @@ class acp_database
asort($tables);
foreach ($tables as $table_name)
{
- if (strlen($table_prefix) === 0 || stripos($table_name, $table_prefix) === 0)
+ if (strlen(phpbb::$base_config['table_prefix']) === 0 || stripos($table_name, phpbb::$base_config['table_prefix']) === 0)
{
$template->assign_block_vars('tables', array(
'TABLE' => $table_name
@@ -600,11 +600,11 @@ class base_extractor
*/
class mysql_extractor extends base_extractor
{
- function write_start($table_prefix)
+ function write_start()
{
$sql_data = "#\n";
$sql_data .= "# phpBB Backup Script\n";
- $sql_data .= "# Dump of tables for $table_prefix\n";
+ $sql_data .= "# Dump of tables for " . phpbb::$base_config['table_prefix'] . "\n";
$sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
$sql_data .= "#\n";
$this->flush($sql_data);
diff --git a/phpBB/modules/ucp/ucp_groups.php b/phpBB/modules/ucp/ucp_groups.php
index 3c44b88b81..c605fe00c1 100644
--- a/phpBB/modules/ucp/ucp_groups.php
+++ b/phpBB/modules/ucp/ucp_groups.php
@@ -437,7 +437,7 @@ class ucp_groups
$group_name = $group_row['group_name'];
$group_type = $group_row['group_type'];
- $avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . PHPBB_ROOT_PATH . CONFIG_ADM_FOLDER . '/images/no_avatar.gif" alt="" />';
+ $avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . PHPBB_ROOT_PATH . phpbb::$base_config['admin_folder'] . '/images/no_avatar.gif" alt="" />';
$template->assign_vars(array(
'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name,
@@ -712,7 +712,7 @@ class ucp_groups
'GROUP_CLOSED' => $type_closed,
'GROUP_HIDDEN' => $type_hidden,
- 'U_SWATCH' => append_sid(CONFIG_ADM_FOLDER . '/swatch', 'form=ucp&amp;name=group_colour'),
+ 'U_SWATCH' => append_sid(phpbb::$base_config['admin_folder'] . '/swatch', 'form=ucp&amp;name=group_colour'),
'S_UCP_ACTION' => $this->u_action . "&amp;action=$action&amp;g=$group_id",
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], phpbb::$config['avatar_filesize'] / 1024),
));