diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-12-28 23:30:09 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-12-28 23:30:09 +0000 |
commit | 19aed179e53f9660a7202e2e50816e1cef0f7be9 (patch) | |
tree | e2707fd68720f206c88f8bcaff6e2fc3173c9c94 /phpBB/includes | |
parent | 4ded6cf5eef0892f9ef1d7351664e1d78445c419 (diff) | |
download | forums-19aed179e53f9660a7202e2e50816e1cef0f7be9.tar forums-19aed179e53f9660a7202e2e50816e1cef0f7be9.tar.gz forums-19aed179e53f9660a7202e2e50816e1cef0f7be9.tar.bz2 forums-19aed179e53f9660a7202e2e50816e1cef0f7be9.tar.xz forums-19aed179e53f9660a7202e2e50816e1cef0f7be9.zip |
$config to phpbb::$config
git-svn-id: file:///svn/phpbb/trunk@9242 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
26 files changed, 456 insertions, 498 deletions
diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php index 9ff10ccf7d..77a462ac6b 100644 --- a/phpBB/includes/auth/auth_apache.php +++ b/phpBB/includes/auth/auth_apache.php @@ -192,7 +192,7 @@ function autologin_apache() */ function user_row_apache($username, $password) { - global $db, $config, $user; + global $db, $user; // first retrieve default group id $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index 670b16c4e3..9e9f347d6a 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -26,7 +26,7 @@ if (!defined('IN_PHPBB')) */ function login_db(&$username, &$password) { - global $db, $config; + global $db; // do not allow empty password if (!$password) @@ -65,7 +65,7 @@ function login_db(&$username, &$password) // If there are too much login attempts, we need to check for an confirm image // Every auth module is able to define what to do by itself... - if ($config['max_login_attempts'] && $row['user_login_attempts'] >= $config['max_login_attempts']) + if (phpbb::$config['max_login_attempts'] && $row['user_login_attempts'] >= phpbb::$config['max_login_attempts']) { $confirm_id = request_var('confirm_id', ''); $confirm_code = request_var('confirm_code', ''); @@ -81,7 +81,7 @@ function login_db(&$username, &$password) } else { - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = phpbb_captcha_factory::get_instance(phpbb::$config['captcha_plugin']); $captcha->init(CONFIRM_LOGIN); $vc_response = $captcha->validate(); if ($vc_response) diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index 797d3c1cbb..19ec9db683 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -27,21 +27,21 @@ if (!defined('IN_PHPBB')) */ function init_ldap() { - global $config, $user; + global $user; if (!@extension_loaded('ldap')) { return $user->lang['LDAP_NO_LDAP_EXTENSION']; } - $config['ldap_port'] = (int) $config['ldap_port']; - if ($config['ldap_port']) + phpbb::$config['ldap_port'] = (int) phpbb::$config['ldap_port']; + if (phpbb::$config['ldap_port']) { - $ldap = @ldap_connect($config['ldap_server'], $config['ldap_port']); + $ldap = @ldap_connect(phpbb::$config['ldap_server'], phpbb::$config['ldap_port']); } else { - $ldap = @ldap_connect($config['ldap_server']); + $ldap = @ldap_connect(phpbb::$config['ldap_server']); } if (!$ldap) @@ -52,9 +52,9 @@ function init_ldap() @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); - if ($config['ldap_user'] || $config['ldap_password']) + if (phpbb::$config['ldap_user'] || phpbb::$config['ldap_password']) { - if (!@ldap_bind($ldap, htmlspecialchars_decode($config['ldap_user']), htmlspecialchars_decode($config['ldap_password']))) + if (!@ldap_bind($ldap, htmlspecialchars_decode(phpbb::$config['ldap_user']), htmlspecialchars_decode(phpbb::$config['ldap_password']))) { return $user->lang['LDAP_INCORRECT_USER_PASSWORD']; } @@ -63,9 +63,9 @@ function init_ldap() // ldap_connect only checks whether the specified server is valid, so the connection might still fail $search = @ldap_search( $ldap, - $config['ldap_base_dn'], + phpbb::$config['ldap_base_dn'], ldap_user_filter($user->data['username']), - (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), + (empty(phpbb::$config['ldap_email'])) ? array(phpbb::$config['ldap_uid']) : array(phpbb::$config['ldap_uid'], phpbb::$config['ldap_email']), 0, 1 ); @@ -85,7 +85,7 @@ function init_ldap() return sprintf($user->lang['LDAP_NO_IDENTITY'], $user->data['username']); } - if (!empty($config['ldap_email']) && !isset($result[0][$config['ldap_email']])) + if (!empty(phpbb::$config['ldap_email']) && !isset($result[0][phpbb::$config['ldap_email']])) { return $user->lang['LDAP_NO_EMAIL']; } @@ -98,7 +98,7 @@ function init_ldap() */ function login_ldap(&$username, &$password) { - global $db, $config, $user; + global $db, $user; // do not allow empty password if (!$password) @@ -128,14 +128,14 @@ function login_ldap(&$username, &$password) ); } - $config['ldap_port'] = (int) $config['ldap_port']; - if ($config['ldap_port']) + phpbb::$config['ldap_port'] = (int) phpbb::$config['ldap_port']; + if (phpbb::$config['ldap_port']) { - $ldap = @ldap_connect($config['ldap_server'], $config['ldap_port']); + $ldap = @ldap_connect(phpbb::$config['ldap_server'], phpbb::$config['ldap_port']); } else { - $ldap = @ldap_connect($config['ldap_server']); + $ldap = @ldap_connect(phpbb::$config['ldap_server']); } if (!$ldap) @@ -150,9 +150,9 @@ function login_ldap(&$username, &$password) @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); - if ($config['ldap_user'] || $config['ldap_password']) + if (phpbb::$config['ldap_user'] || phpbb::$config['ldap_password']) { - if (!@ldap_bind($ldap, $config['ldap_user'], htmlspecialchars_decode($config['ldap_password']))) + if (!@ldap_bind($ldap, phpbb::$config['ldap_user'], htmlspecialchars_decode(phpbb::$config['ldap_password']))) { return $user->lang['LDAP_NO_SERVER_CONNECTION']; } @@ -160,9 +160,9 @@ function login_ldap(&$username, &$password) $search = @ldap_search( $ldap, - $config['ldap_base_dn'], + phpbb::$config['ldap_base_dn'], ldap_user_filter($username), - (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), + (empty(phpbb::$config['ldap_email'])) ? array(phpbb::$config['ldap_uid']) : array(phpbb::$config['ldap_uid'], phpbb::$config['ldap_email']), 0, 1 ); @@ -223,7 +223,7 @@ function login_ldap(&$username, &$password) $ldap_user_row = array( 'username' => $username, 'user_password' => phpbb_hash($password), - 'user_email' => (!empty($config['ldap_email'])) ? $ldap_result[0][$config['ldap_email']][0] : '', + 'user_email' => (!empty(phpbb::$config['ldap_email'])) ? $ldap_result[0][phpbb::$config['ldap_email']][0] : '', 'group_id' => (int) $row['group_id'], 'user_type' => phpbb::USER_NORMAL, 'user_ip' => $user->ip, @@ -271,12 +271,10 @@ function login_ldap(&$username, &$password) */ function ldap_user_filter($username) { - global $config; - - $filter = '(' . $config['ldap_uid'] . '=' . ldap_escape(htmlspecialchars_decode($username)) . ')'; - if ($config['ldap_user_filter']) + $filter = '(' . phpbb::$config['ldap_uid'] . '=' . ldap_escape(htmlspecialchars_decode($username)) . ')'; + if (phpbb::$config['ldap_user_filter']) { - $filter = "(&$filter({$config['ldap_user_filter']}))"; + $filter = "(&$filter({phpbb::$config['ldap_user_filter']}))"; } return $filter; } diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php index 74afc152a2..e8ad9df37d 100644 --- a/phpBB/includes/captcha/captcha_gd.php +++ b/phpBB/includes/captcha/captcha_gd.php @@ -32,7 +32,6 @@ class captcha */ public static function execute($code, $seed) { - global $config; srand($seed); mt_srand($seed); @@ -79,9 +78,9 @@ class captcha $width_avail -= $offset[$i]; } - if ($config['captcha_gd_x_grid']) + if (phpbb::$config['captcha_gd_x_grid']) { - $grid = (int) $config['captcha_gd_x_grid']; + $grid = (int) phpbb::$config['captcha_gd_x_grid']; for ($y = 0; $y < self::height; $y += mt_rand($grid - 2, $grid + 2)) { $current_colour = $scheme[array_rand($scheme)]; @@ -89,9 +88,9 @@ class captcha } } - if ($config['captcha_gd_y_grid']) + if (phpbb::$config['captcha_gd_y_grid']) { - $grid = (int) $config['captcha_gd_y_grid']; + $grid = (int) phpbb::$config['captcha_gd_y_grid']; for ($x = 0; $x < self::width; $x += mt_rand($grid - 2, $grid + 2)) { $current_colour = $scheme[array_rand($scheme)]; @@ -109,8 +108,8 @@ class captcha $characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); $xoffset += $dimm[2]; } - - if ($config['captcha_gd_foreground_noise']) + + if (phpbb::$config['captcha_gd_foreground_noise']) { self::noise_line($img, 0, 0, self::width, self::height, $colour->get_resource('background'), $scheme, $bg_colours); } @@ -1123,7 +1122,7 @@ class colour_manager { $mode = $this->mode; } - + if (!is_array($colour)) { if (isset($this->named_rgb[$colour])) @@ -1317,7 +1316,7 @@ class colour_manager } // This is a hard problem. I chicken out and try to maintain readability at the cost of less randomness. - + while ($count > 0) { $colour[1] = ($colour[1] + mt_rand(40,60)) % 99; diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index c8545cdd69..7cc3bf8abb 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -32,7 +32,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function init($type) { - global $config, $db, $user; + global $db, $user; // read input $this->confirm_id = request_var('confirm_id', ''); @@ -76,7 +76,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function get_template() { - global $config, $user, $template; + global $user, $template; $template->set_filenames(array( 'captcha' => 'captcha_default.html') @@ -92,7 +92,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function get_demo_template($id) { - global $config, $user, $template; + global $user, $template; $template->set_filenames(array( 'captcha_demo' => 'captcha_default_acp_demo.html') @@ -121,7 +121,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin static function garbage_collect($type) { - global $db, $config; + global $db; $sql = 'SELECT DISTINCT c.session_id FROM ' . CONFIRM_TABLE . ' c @@ -161,7 +161,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function validate() { - global $config, $db, $user; + global $db, $user; $this->confirm_code = request_var('confirm_code', ''); diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php index 906a63105a..8711c9bb14 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -50,7 +50,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha implements phpbb_captcha_pl function acp_page($id, &$module) { - global $config, $db, $template, $user; + global $db, $template, $user; $captcha_vars = array( 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', @@ -87,7 +87,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha implements phpbb_captcha_pl { foreach ($captcha_vars as $captcha_var => $template_var) { - $var = request_var($captcha_var, (int) $config[$captcha_var]); + $var = request_var($captcha_var, (int) phpbb::$config[$captcha_var]); $template->assign_var($template_var, $var); } $template->assign_vars(array( diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php index 57f0cb88e3..6b1629f8ad 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php @@ -50,8 +50,8 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha implements phpbb_captc function acp_page($id, &$module) { - global $config, $db, $template, $user; - + global $db, $template, $user; + trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); } } diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index ea5069fe99..ddb52ba8e8 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -28,7 +28,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu function init($type) { - global $config, $db, $user; + global $db, $user; $user->add_lang('recaptcha'); parent::init($type); @@ -44,9 +44,9 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu static function is_available() { - global $config, $user; + global $user; $user->add_lang('recaptcha'); - return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey'])); + return (isset(phpbb::$config['recaptcha_pubkey']) && !empty(phpbb::$config['recaptcha_pubkey'])); } static function get_name() @@ -61,7 +61,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu function acp_page($id, &$module) { - global $config, $db, $template, $user; + global $db, $template, $user; $captcha_vars = array( 'recaptcha_pubkey' => 'RECAPTCHA_PUBKEY', @@ -96,7 +96,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu { foreach ($captcha_vars as $captcha_var => $template_var) { - $var = request_var($captcha_var, (isset($config[$captcha_var])) ? (string) $config[$captcha_var] : ''); + $var = request_var($captcha_var, (isset(phpbb::$config[$captcha_var])) ? (string) phpbb::$config[$captcha_var] : ''); $template->assign_var($template_var, $var); } $template->assign_vars(array( @@ -122,7 +122,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu function get_template() { - global $config, $user, $template; + global $user, $template; $template->set_filenames(array( 'captcha' => 'captcha_recaptcha.html') @@ -130,7 +130,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu $template->assign_vars(array( 'RECAPTCHA_SERVER' => self::recaptcha_server, - 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', + 'RECAPTCHA_PUBKEY' => isset(phpbb::$config['recaptcha_pubkey']) ? phpbb::$config['recaptcha_pubkey'] : '', 'RECAPTCHA_ERRORGET' => '', 'S_RECAPTCHA_AVAILABLE' => self::is_available(), )); @@ -260,7 +260,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu */ protected function recaptcha_check_answer($extra_params = array()) { - global $config, $user; + global $user; // discard spam submissions if ($this->challenge == null || strlen($this->challenge) == 0 || $this->response == null || strlen($this->response) == 0) @@ -269,7 +269,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu } $response = $this->_recaptcha_http_post(self::recaptcha_verify_server, '/verify', array( - 'privatekey' => $config['recaptcha_privkey'], + 'privatekey' => phpbb::$config['recaptcha_privkey'], 'remoteip' => $user->ip, 'challenge' => $this->challenge, 'response' => $this->response, diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index ddb3aef4d7..f491ee0bf5 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -600,7 +600,7 @@ class dbal */ function sql_error($sql = '') { - global $auth, $user, $config; + global $auth, $user; // Set var to retrieve errored status $this->sql_error_triggered = true; @@ -634,9 +634,9 @@ class dbal } else { - if (!empty($config['board_contact'])) + if (!empty(phpbb::$config['board_contact'])) { - $message .= '<br /><br />' . sprintf($user->lang['SQL_ERROR_OCCURRED'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'); + $message .= '<br /><br />' . sprintf($user->lang['SQL_ERROR_OCCURRED'], '<a href="mailto:' . htmlspecialchars(phpbb::$config['board_contact']) . '">', '</a>'); } else { diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index f6ded04431..f66d954ea8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -395,31 +395,31 @@ function tz_select($default = '', $truncate = false) */ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $user_id = 0) { - global $db, $user, $config; + global $db, $user; if ($mode == 'all') { if ($forum_id === false || !sizeof($forum_id)) { - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { // Mark all forums read (index page) $db->sql_query('DELETE FROM ' . TOPICS_TRACK_TABLE . " WHERE user_id = {$user->data['user_id']}"); $db->sql_query('DELETE FROM ' . FORUMS_TRACK_TABLE . " WHERE user_id = {$user->data['user_id']}"); $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . time() . " WHERE user_id = {$user->data['user_id']}"); } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking_topics = phpbb_request::variable($config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); + $tracking_topics = phpbb_request::variable(phpbb::$config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); unset($tracking_topics['tf']); unset($tracking_topics['t']); unset($tracking_topics['f']); - $tracking_topics['l'] = base_convert(time() - $config['board_startdate'], 10, 36); + $tracking_topics['l'] = base_convert(time() - phpbb::$config['board_startdate'], 10, 36); $user->set_cookie('track', tracking_serialize($tracking_topics), time() + 31536000); - phpbb_request::overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking_topics), phpbb_request::COOKIE); + phpbb_request::overwrite(phpbb::$config['cookie_name'] . '_track', tracking_serialize($tracking_topics), phpbb_request::COOKIE); unset($tracking_topics); @@ -443,7 +443,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ // Add 0 to forums array to mark global announcements correctly $forum_id[] = 0; - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { $sql = 'DELETE FROM ' . TOPICS_TRACK_TABLE . " WHERE user_id = {$user->data['user_id']} @@ -487,9 +487,9 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ $db->sql_multi_insert(FORUMS_TRACK_TABLE, $sql_ary); } } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking = phpbb_request::variable($config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); + $tracking = phpbb_request::variable(phpbb::$config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); $tracking = ($tracking) ? tracking_unserialize($tracking) : array(); foreach ($forum_id as $f_id) @@ -511,7 +511,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ unset($tracking['f'][$f_id]); } - $tracking['f'][$f_id] = base_convert(time() - $config['board_startdate'], 10, 36); + $tracking['f'][$f_id] = base_convert(time() - phpbb::$config['board_startdate'], 10, 36); } if (isset($tracking['tf']) && empty($tracking['tf'])) @@ -520,7 +520,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } $user->set_cookie('track', tracking_serialize($tracking), time() + 31536000); - phpbb_request::overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), phpbb_request::COOKIE); + phpbb_request::overwrite(phpbb::$config['cookie_name'] . '_track', tracking_serialize($tracking), phpbb_request::COOKIE); unset($tracking); } @@ -534,7 +534,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ return; } - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { $sql = 'UPDATE ' . TOPICS_TRACK_TABLE . ' SET mark_time = ' . (($post_time) ? $post_time : time()) . " @@ -559,9 +559,9 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ $db->sql_return_on_error(false); } } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking = phpbb_request::variable($config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); + $tracking = phpbb_request::variable(phpbb::$config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); $tracking = ($tracking) ? tracking_unserialize($tracking) : array(); $topic_id36 = base_convert($topic_id, 10, 36); @@ -572,11 +572,11 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } $post_time = ($post_time) ? $post_time : time(); - $tracking['t'][$topic_id36] = base_convert($post_time - $config['board_startdate'], 10, 36); + $tracking['t'][$topic_id36] = base_convert($post_time - phpbb::$config['board_startdate'], 10, 36); // If the cookie grows larger than 10000 characters we will remove the smallest value // This can result in old topics being unread - but most of the time it should be accurate... - if (strlen(phpbb_request::variable($config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE)) > 10000) + if (strlen(phpbb_request::variable(phpbb::$config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE)) > 10000) { //echo 'Cookie grown too large' . print_r($tracking, true); @@ -606,7 +606,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ if ($user->data['is_registered']) { - $user->data['user_lastmark'] = intval(base_convert(max($time_keys) + $config['board_startdate'], 36, 10)); + $user->data['user_lastmark'] = intval(base_convert(max($time_keys) + phpbb::$config['board_startdate'], 36, 10)); $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . $user->data['user_lastmark'] . " WHERE user_id = {$user->data['user_id']}"); } else @@ -616,7 +616,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } $user->set_cookie('track', tracking_serialize($tracking), time() + 31536000); - phpbb_request::overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking)); + phpbb_request::overwrite(phpbb::$config['cookie_name'] . '_track', tracking_serialize($tracking)); } return; @@ -630,7 +630,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ $use_user_id = (!$user_id) ? $user->data['user_id'] : $user_id; - if ($config['load_db_track'] && $use_user_id != ANONYMOUS) + if (phpbb::$config['load_db_track'] && $use_user_id != ANONYMOUS) { $db->sql_return_on_error(true); @@ -654,7 +654,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ */ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $global_announce_list = false) { - global $config, $user; + global $user; $last_read = array(); @@ -734,7 +734,7 @@ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $ */ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_list = false) { - global $config, $user; + global $user; $last_read = array(); @@ -743,7 +743,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis $topic_ids = array($topic_ids); } - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { global $db; @@ -792,19 +792,19 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis } } } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { global $tracking_topics; if (!isset($tracking_topics) || !sizeof($tracking_topics)) { - $tracking_topics = phpbb_request::variable($config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); + $tracking_topics = phpbb_request::variable(phpbb::$config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); } if (!$user->data['is_registered']) { - $user_lastmark = (isset($tracking_topics['l'])) ? base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate'] : 0; + $user_lastmark = (isset($tracking_topics['l'])) ? base_convert($tracking_topics['l'], 36, 10) + phpbb::$config['board_startdate'] : 0; } else { @@ -817,7 +817,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis if (isset($tracking_topics['t'][$topic_id36])) { - $last_read[$topic_id] = base_convert($tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; + $last_read[$topic_id] = base_convert($tracking_topics['t'][$topic_id36], 36, 10) + phpbb::$config['board_startdate']; } } @@ -830,13 +830,13 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis { if (isset($tracking_topics['f'][0])) { - $mark_time[0] = base_convert($tracking_topics['f'][0], 36, 10) + $config['board_startdate']; + $mark_time[0] = base_convert($tracking_topics['f'][0], 36, 10) + phpbb::$config['board_startdate']; } } if (isset($tracking_topics['f'][$forum_id])) { - $mark_time[$forum_id] = base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']; + $mark_time[$forum_id] = base_convert($tracking_topics['f'][$forum_id], 36, 10) + phpbb::$config['board_startdate']; } $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user_lastmark; @@ -870,32 +870,32 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis */ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false) { - global $db, $tracking_topics, $user, $config; + global $db, $tracking_topics, $user; // Determine the users last forum mark time if not given. if ($mark_time_forum === false) { - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { $mark_time_forum = (!empty($f_mark_time)) ? $f_mark_time : $user->data['user_lastmark']; } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking_topics = phpbb_request::variable($config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); + $tracking_topics = phpbb_request::variable(phpbb::$config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); if (!$user->data['is_registered']) { - $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + phpbb::$config['board_startdate']) : 0; } - $mark_time_forum = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + $mark_time_forum = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + phpbb::$config['board_startdate']) : $user->data['user_lastmark']; } } // Check the forum for any left unread topics. // If there are none, we mark the forum as read. - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { if ($mark_time_forum >= $forum_last_post_time) { @@ -916,7 +916,7 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti $db->sql_freeresult($result); } } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { // Get information from cookie $row = false; @@ -1202,10 +1202,10 @@ function on_page($num_items, $per_page, $start) */ function add_form_key($form_name) { - global $config, $template, $user; + global $template, $user; $now = time(); - $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : ''; + $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty(phpbb::$config['form_token_sid_guests'])) ? $user->session_id : ''; $token = sha1($now . $user->data['user_form_salt'] . $form_name . $token_sid); $s_fields = build_hidden_fields(array( @@ -1227,12 +1227,12 @@ function add_form_key($form_name) */ function check_form_key($form_name, $timespan = false, $return_page = '', $trigger = false) { - global $config, $user; + global $user; if ($timespan === false) { // we enforce a minimum value of half a minute here. - $timespan = ($config['form_token_lifetime'] == -1) ? -1 : max(30, $config['form_token_lifetime']); + $timespan = (phpbb::$config['form_token_lifetime'] == -1) ? -1 : max(30, phpbb::$config['form_token_lifetime']); } if (phpbb_request::is_set_post('creation_time') && phpbb_request::is_set_post('form_token')) @@ -1245,7 +1245,7 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg // If creation_time and the time() now is zero we can assume it was not a human doing this (the check for if ($diff)... if ($diff && ($diff <= $timespan || $timespan === -1)) { - $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : ''; + $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty(phpbb::$config['form_token_sid_guests'])) ? $user->session_id : ''; $key = sha1($creation_time . $user->data['user_form_salt'] . $form_name . $token_sid); if ($key === $token) @@ -1380,7 +1380,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo */ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true) { - global $db, $user, $template, $auth, $config; + global $db, $user, $template, $auth; include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT); @@ -1501,7 +1501,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa { case LOGIN_ERROR_ATTEMPTS: - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = phpbb_captcha_factory::get_instance(phpbb::$config['captcha_plugin']); $captcha->init(CONFIRM_LOGIN); $captcha->reset(); @@ -1517,10 +1517,10 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa case LOGIN_ERROR_PASSWORD_CONVERT: $err = sprintf( $user->lang[$result['error_msg']], - ($config['email_enable']) ? '<a href="' . append_sid('ucp', 'mode=sendpassword') . '">' : '', - ($config['email_enable']) ? '</a>' : '', - ($config['board_contact']) ? '<a href="mailto:' . utf8_htmlspecialchars($config['board_contact']) . '">' : '', - ($config['board_contact']) ? '</a>' : '' + (phpbb::$config['email_enable']) ? '<a href="' . append_sid('ucp', 'mode=sendpassword') . '">' : '', + (phpbb::$config['email_enable']) ? '</a>' : '', + (phpbb::$config['board_contact']) ? '<a href="mailto:' . utf8_htmlspecialchars(phpbb::$config['board_contact']) . '">' : '', + (phpbb::$config['board_contact']) ? '</a>' : '' ); break; @@ -1531,7 +1531,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa // Assign admin contact to some error messages if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD') { - $err = (!$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . utf8_htmlspecialchars($config['board_contact']) . '">', '</a>'); + $err = (!phpbb::$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . utf8_htmlspecialchars(phpbb::$config['board_contact']) . '">', '</a>'); } break; @@ -1571,8 +1571,8 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa 'LOGIN_ERROR' => $err, 'LOGIN_EXPLAIN' => $l_explain, - 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid('ucp', 'mode=sendpassword') : '', - 'U_RESEND_ACTIVATION' => ($config['require_activation'] != USER_ACTIVATION_NONE && $config['email_enable']) ? append_sid('ucp', 'mode=resend_act') : '', + 'U_SEND_PASSWORD' => (phpbb::$config['email_enable']) ? append_sid('ucp', 'mode=sendpassword') : '', + 'U_RESEND_ACTIVATION' => (phpbb::$config['require_activation'] != USER_ACTIVATION_NONE && phpbb::$config['email_enable']) ? append_sid('ucp', 'mode=resend_act') : '', 'U_TERMS_USE' => append_sid('ucp', 'mode=terms'), 'U_PRIVACY' => append_sid('ucp', 'mode=privacy'), @@ -1625,7 +1625,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa */ function login_forum_box($forum_data) { - global $db, $config, $user, $template; + global $db, $user, $template; $password = request_var('password', '', true); @@ -2108,7 +2108,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) } // Another quick fix for those having gzip compression enabled, but do not flush if the coder wants to catch "something". ;) - if (!empty($config['gzip_compress'])) + if (!empty(phpbb::$config['gzip_compress'])) { if (@extension_loaded('zlib') && !headers_sent() && !ob_get_level()) { diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index f9fde6fcd0..89f2b831fb 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -221,10 +221,10 @@ function size_select_options($size_compare) */ function group_select_options($group_id, $exclude_ids = false, $manage_founder = false) { - global $db, $user, $config; + global $db, $user; $exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; - $sql_and = (!$config['coppa_enable']) ? (($exclude_sql) ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : ''; + $sql_and = (!phpbb::$config['coppa_enable']) ? (($exclude_sql) ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : ''; $sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ') . 'group_founder_manage = ' . (int) $manage_founder : ''; $sql = 'SELECT group_id, group_name, group_type @@ -525,7 +525,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) */ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true) { - global $db, $config; + global $db; $approved_topics = 0; $forum_ids = $topic_ids = array(); @@ -619,7 +619,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s if ($approved_topics) { - set_config('num_topics', $config['num_topics'] - $approved_topics, true); + set_config('num_topics', phpbb::$config['num_topics'] - $approved_topics, true); } return $return; @@ -630,7 +630,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s */ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true) { - global $db, $config; + global $db; if ($where_type === 'range') { @@ -738,7 +738,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // Remove the message from the search index - $search_type = basename($config['search_type']); + $search_type = basename(phpbb::$config['search_type']); if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) { @@ -776,7 +776,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = if ($approved_posts) { - set_config('num_posts', $config['num_posts'] - $approved_posts, true); + set_config('num_posts', phpbb::$config['num_posts'] - $approved_posts, true); } // We actually remove topics now to not be inconsistent (the delete_topics function calls this function too) @@ -797,7 +797,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = */ function delete_attachments($mode, $ids, $resync = true) { - global $db, $config; + global $db; if (is_array($ids) && sizeof($ids)) { @@ -894,8 +894,8 @@ function delete_attachments($mode, $ids, $resync = true) if ($space_removed || $files_removed) { - set_config('upload_dir_size', $config['upload_dir_size'] - $space_removed, true); - set_config('num_files', $config['num_files'] - $files_removed, true); + set_config('upload_dir_size', phpbb::$config['upload_dir_size'] - $space_removed, true); + set_config('num_files', phpbb::$config['num_files'] - $files_removed, true); } // If we do not resync, we do not need to adjust any message, post, topic or user entries @@ -1014,9 +1014,9 @@ function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = true) */ function update_posted_info(&$topic_ids) { - global $db, $config; + global $db; - if (empty($topic_ids) || !$config['load_db_track']) + if (empty($topic_ids) || !phpbb::$config['load_db_track']) { return; } @@ -1065,7 +1065,7 @@ function update_posted_info(&$topic_ids) */ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) { - global $db, $config; + global $db; // Because of copying topics or modifications a physical filename could be assigned more than once. If so, do not remove the file itself. $sql = 'SELECT COUNT(attach_id) AS num_entries @@ -1082,7 +1082,7 @@ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) } $filename = ($mode == 'thumbnail') ? 'thumb_' . basename($filename) : basename($filename); - return @unlink(PHPBB_ROOT_PATH . $config['upload_path'] . '/' . $filename); + return @unlink(PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/' . $filename); } /** @@ -2900,9 +2900,9 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port */ function tidy_warnings() { - global $db, $config; + global $db; - $expire_date = time() - ($config['warnings_expire_days'] * 86400); + $expire_date = time() - (phpbb::$config['warnings_expire_days'] * 86400); $warning_list = $user_list = array(); $sql = 'SELECT * FROM ' . WARNINGS_TABLE . " diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 7f8ee5d4c0..9922b2c2a9 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -110,10 +110,10 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, */ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false, $force_display = false) { - global $config, $auth, $template, $user, $db; + global $auth, $template, $user, $db; // We only return if the jumpbox is not forced to be displayed (in case it is needed for functionality) - if (!$config['load_jumpbox'] && $force_display === false) + if (!phpbb::$config['load_jumpbox'] && $force_display === false) { return; } @@ -209,7 +209,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list */ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_poster, $last_topic_poster) { - global $config, $auth, $user; + global $auth, $user; // Check permission and make sure the last post was not already bumped if (!$auth->acl_get('f_bump', $forum_id) || $topic_bumped) @@ -218,7 +218,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po } // Check bump time range, is the user really allowed to bump the topic at this time? - $bump_time = ($config['bump_type'] == 'm') ? $config['bump_interval'] * 60 : (($config['bump_type'] == 'h') ? $config['bump_interval'] * 3600 : $config['bump_interval'] * 86400); + $bump_time = (phpbb::$config['bump_type'] == 'm') ? phpbb::$config['bump_interval'] * 60 : ((phpbb::$config['bump_type'] == 'h') ? phpbb::$config['bump_interval'] * 3600 : phpbb::$config['bump_interval'] * 86400); // Check bump time if ($last_post_time + $bump_time > time()) @@ -356,8 +356,6 @@ function get_context($text, $words, $length = 400) */ function decode_message(&$message, $bbcode_uid = '') { - global $config; - if ($bbcode_uid) { $match = array('<br />', "[/*:m:$bbcode_uid]", ":u:$bbcode_uid", ":o:$bbcode_uid", ":$bbcode_uid"); @@ -673,10 +671,10 @@ function censor_text($text) // We moved the word censor checks in here because we call this function quite often - and then only need to do the check once if (!isset($censors) || !is_array($censors)) { - global $config, $user, $auth; + global $user, $auth; // We check here if the user is having viewing censors disabled (and also allowed to do so). - if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors')) + if (!$user->optionget('viewcensors') && phpbb::$config['allow_nocensors'] && $auth->acl_get('u_chgcensors')) { $censors = array(); } @@ -710,15 +708,15 @@ function bbcode_nl2br($text) */ function smiley_text($text, $force_option = false) { - global $config, $user; + global $user; - if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) + if ($force_option || !phpbb::$config['allow_smilies'] || !$user->optionget('viewsmilies')) { return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text); } else { - return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . PHPBB_ROOT_PATH . $config['smilies_path'] . '/\2 />', $text); + return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . PHPBB_ROOT_PATH . phpbb::$config['smilies_path'] . '/\2 />', $text); } } @@ -739,7 +737,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, } global $template, $user; - global $extensions, $config; + global $extensions; // $compiled_attachments = array(); @@ -802,7 +800,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, } // Sort correctly - if ($config['display_order']) + if (phpbb::$config['display_order']) { // Ascending sort krsort($attachments); @@ -827,8 +825,8 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, // Some basics... $attachment['extension'] = strtolower(trim($attachment['extension'])); - $filename = PHPBB_ROOT_PATH . $config['upload_path'] . '/' . basename($attachment['physical_filename']); - $thumbnail_filename = PHPBB_ROOT_PATH . $config['upload_path'] . '/thumb_' . basename($attachment['physical_filename']); + $filename = PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/' . basename($attachment['physical_filename']); + $thumbnail_filename = PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/thumb_' . basename($attachment['physical_filename']); $upload_icon = ''; @@ -840,7 +838,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, } else if ($extensions[$attachment['extension']]['upload_icon']) { - $upload_icon = '<img src="' . PHPBB_ROOT_PATH . $config['upload_icons_path'] . '/' . trim($extensions[$attachment['extension']]['upload_icon']) . '" alt="" />'; + $upload_icon = '<img src="' . PHPBB_ROOT_PATH . phpbb::$config['upload_icons_path'] . '/' . trim($extensions[$attachment['extension']]['upload_icon']) . '" alt="" />'; } } @@ -883,9 +881,9 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, } else { - if ($config['img_display_inlined']) + if (phpbb::$config['img_display_inlined']) { - if ($config['img_link_width'] || $config['img_link_height']) + if (phpbb::$config['img_link_width'] || phpbb::$config['img_link_height']) { $dimension = @getimagesize($filename); @@ -896,7 +894,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, } else { - $display_cat = ($dimension[0] <= $config['img_link_width'] && $dimension[1] <= $config['img_link_height']) ? ATTACHMENT_CATEGORY_IMAGE : ATTACHMENT_CATEGORY_NONE; + $display_cat = ($dimension[0] <= phpbb::$config['img_link_width'] && $dimension[1] <= phpbb::$config['img_link_height']) ? ATTACHMENT_CATEGORY_IMAGE : ATTACHMENT_CATEGORY_NONE; } } } @@ -1033,7 +1031,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, foreach ($matches[0] as $num => $capture) { // Flip index if we are displaying the reverse way - $index = ($config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num]; + $index = (phpbb::$config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num]; $replace['from'][] = $matches[0][$num]; $replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 66875f0e69..6e06545b25 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -418,7 +418,7 @@ function remote_avatar_dims() function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false) { - global $config, $convert, $user; + global $convert, $user; $relative_path = empty($convert->convertor['source_path_absolute']); @@ -432,7 +432,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false if (is_dir($src_path)) { // Do not die on failure... safe mode restrictions may be in effect. - copy_dir($convert->convertor['avatar_gallery_path'], path($config['avatar_gallery_path']) . $gallery_name, !$subdirs_as_galleries, false, false, $relative_path); + copy_dir($convert->convertor['avatar_gallery_path'], path(phpbb::$config['avatar_gallery_path']) . $gallery_name, !$subdirs_as_galleries, false, false, $relative_path); // only doing 1 level deep. (ibf 1.x) // notes: ibf has 2 tiers: directly in the avatar directory for base gallery (handled in the above statement), plus subdirs(handled below). @@ -478,7 +478,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false $dir = $dirlist[$i]; // Do not die on failure... safe mode restrictions may be in effect. - copy_dir(path($convert->convertor['avatar_gallery_path'], $relative_path) . $dir, path($config['avatar_gallery_path']) . $dir, true, false, false, $relative_path); + copy_dir(path($convert->convertor['avatar_gallery_path'], $relative_path) . $dir, path(phpbb::$config['avatar_gallery_path']) . $dir, true, false, false, $relative_path); } } } @@ -486,13 +486,13 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false function import_attachment_files($category_name = '') { - global $config, $convert, $db, $user; + global $convert, $db, $user; $sql = 'SELECT config_value AS upload_path FROM ' . CONFIG_TABLE . " WHERE config_name = 'upload_path'"; $result = $db->sql_query($sql); - $config['upload_path'] = $db->sql_fetchfield('upload_path'); + phpbb::$config['upload_path'] = $db->sql_fetchfield('upload_path'); $db->sql_freeresult($result); $relative_path = empty($convert->convertor['source_path_absolute']); @@ -504,7 +504,7 @@ function import_attachment_files($category_name = '') if (is_dir(relative_base(path($convert->convertor['upload_path'], $relative_path), $relative_path))) { - copy_dir($convert->convertor['upload_path'], path($config['upload_path']) . $category_name, true, false, true, $relative_path); + copy_dir($convert->convertor['upload_path'], path(phpbb::$config['upload_path']) . $category_name, true, false, true, $relative_path); } } @@ -542,7 +542,7 @@ function base64_unpack($string) function _import_check($config_var, $source, $use_target) { - global $convert, $config; + global $convert; $result = array( 'orig_source' => $source, @@ -551,7 +551,7 @@ function _import_check($config_var, $source, $use_target) ); // copy file will prepend PHPBB_ROOT_PATH - $target = $config[$config_var] . '/' . basename(($use_target === false) ? $source : $use_target); + $target = phpbb::$config[$config_var] . '/' . basename(($use_target === false) ? $source : $use_target); if (!empty($convert->convertor[$config_var]) && strpos($source, $convert->convertor[$config_var]) !== 0) { @@ -584,7 +584,7 @@ function import_attachment($source, $use_target = false) return ''; } - global $convert, $config, $user; + global $convert, $user; if (empty($convert->convertor['upload_path'])) { @@ -606,7 +606,7 @@ function import_attachment($source, $use_target = false) { $thumb_source = $convert->convertor['upload_path'] . $thumb_source; } - $thumb_target = $config['upload_path'] . '/thumb_' . $result['target']; + $thumb_target = phpbb::$config['upload_path'] . '/thumb_' . $result['target']; if (file_exists(relative_base($thumb_source, $result['relative_path'], __LINE__, __FILE__))) { @@ -625,7 +625,7 @@ function import_rank($source, $use_target = false) return ''; } - global $convert, $config, $user; + global $convert, $user; if (!isset($convert->convertor['ranks_path'])) { @@ -643,7 +643,7 @@ function import_smiley($source, $use_target = false) return ''; } - global $convert, $config, $user; + global $convert, $user; if (!isset($convert->convertor['smilies_path'])) { @@ -663,7 +663,7 @@ function import_avatar($source, $use_target = false, $user_id = false) return; } - global $convert, $config, $user; + global $convert, $user; if (!isset($convert->convertor['avatar_path'])) { @@ -672,7 +672,7 @@ function import_avatar($source, $use_target = false, $user_id = false) if ($use_target === false && $user_id !== false) { - $use_target = $config['avatar_salt'] . '_' . $user_id . '.' . substr(strrchr($source, '.'), 1); + $use_target = phpbb::$config['avatar_salt'] . '_' . $user_id . '.' . substr(strrchr($source, '.'), 1); } $result = _import_check('avatar_path', $source, $use_target); @@ -741,7 +741,7 @@ function get_smiley_dim($source, $axis) return $smiley_cache[$source][$axis]; } - global $convert, $config, $user; + global $convert, $user; $orig_source = $source; @@ -856,7 +856,7 @@ function get_upload_avatar_dim($source, $axis) $source = substr($source, 7); } - global $convert, $config, $user; + global $convert, $user; if (!isset($convert->convertor['avatar_path'])) { @@ -898,7 +898,7 @@ function get_gallery_avatar_dim($source, $axis) return $avatar_cache[$source][$axis]; } - global $convert, $config, $user; + global $convert, $user; $orig_source = $source; @@ -1111,7 +1111,7 @@ function words_unique(&$words) */ function add_user_group($group_id, $user_id, $group_leader=false) { - global $convert, $config, $user, $db; + global $convert, $user, $db; $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'group_id' => $group_id, @@ -1131,7 +1131,7 @@ function add_user_group($group_id, $user_id, $group_leader=false) */ function user_group_auth($group, $select_query, $use_src_db) { - global $convert, $config, $user, $db, $src_db, $same_db; + global $convert, $user, $db, $src_db, $same_db; if (!in_array($group, array('guests', 'registered', 'registered_coppa', 'global_moderators', 'administrators', 'bots'))) { @@ -1187,7 +1187,7 @@ function get_config() return $convert_config; } - global $src_db, $same_db, $config; + global $src_db, $same_db; global $convert; if ($convert->config_schema['table_format'] != 'file') @@ -1261,7 +1261,7 @@ function get_config() */ function restore_config($schema) { - global $db, $config; + global $db; $convert_config = get_config(); foreach ($schema['settings'] as $config_name => $src) @@ -1354,8 +1354,6 @@ function extract_variables_from_file($_filename) function get_path($src_path, $src_url, $test_file) { - global $config; - $board_config = get_config(); $test_file = preg_replace('/\.php$/i', '.' . PHP_EXT, $test_file); @@ -1465,7 +1463,7 @@ function compare_table($tables, $tablename, &$prefixes) */ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO) { - global $db, $convert, $user, $config; + global $db, $convert, $user; static $acl_option_ids, $group_ids; if (($ug_type == 'group' || $ug_type == 'group_role') && is_string($ug_id)) @@ -1764,7 +1762,7 @@ function sync_post_count($offset, $limit) */ function add_bots() { - global $db, $convert, $user, $config; + global $db, $convert, $user; $db->sql_query($convert->truncate_statement . BOTS_TABLE); @@ -1857,7 +1855,7 @@ function add_bots() 'user_password' => '', 'user_colour' => '9E8DA7', 'user_email' => '', - 'user_lang' => $config['default_lang'], + 'user_lang' => phpbb::$config['default_lang'], 'user_style' => 1, 'user_timezone' => 0, 'user_allow_massemail' => 0, @@ -1885,16 +1883,16 @@ function add_bots() */ function update_dynamic_config() { - global $db, $config; + global $db; // Get latest username $sql = 'SELECT user_id, username, user_colour FROM ' . USERS_TABLE . ' WHERE user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')'; - if (!empty($config['increment_user_id'])) + if (!empty(phpbb::$config['increment_user_id'])) { - $sql .= ' AND user_id <> ' . $config['increment_user_id']; + $sql .= ' AND user_id <> ' . phpbb::$config['increment_user_id']; } $sql .= ' ORDER BY user_id DESC'; @@ -1976,7 +1974,7 @@ function update_dynamic_config() */ function update_topics_posted() { - global $db, $config; + global $db; if ($db->truncate) { @@ -2249,7 +2247,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $source_relative_path = true) { - global $convert, $config, $user, $db; + global $convert, $user, $db; if (substr($trg, -1) == '/') { @@ -2303,7 +2301,7 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_failure = true, $source_relative_path = true) { - global $convert, $config, $user, $db; + global $convert, $user, $db; $dirlist = $filelist = $bad_dirs = array(); $src = path($src, $source_relative_path); @@ -2319,7 +2317,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ if (!@is_writable($trg_path)) { - $bad_dirs[] = path($config['script_path']) . $trg; + $bad_dirs[] = path(phpbb::$config['script_path']) . $trg; } if ($handle = @opendir($src_path)) @@ -2412,7 +2410,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ function relative_base($path, $is_relative = true, $line = false, $file = false) { - global $convert, $config, $user, $db; + global $convert, $user, $db; if (!$is_relative) { @@ -2440,9 +2438,7 @@ function get_smiley_display() function fill_dateformat($user_dateformat) { - global $config; - - return ((empty($user_dateformat)) ? $config['default_dateformat'] : $user_dateformat); + return ((empty($user_dateformat)) ? phpbb::$config['default_dateformat'] : $user_dateformat); } diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 18788f1204..8fe2c55249 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ function display_forums($root_data = '', $display_moderators = true, $return_moderators = false) { - global $db, $auth, $user, $template, $config; + global $db, $auth, $user, $template; $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array(); $parent_id = $visible_forums = 0; @@ -61,19 +61,19 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'LEFT_JOIN' => array(), ); - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id'); $sql_array['SELECT'] .= ', ft.mark_time'; } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking_topics = phpbb_request::variable($config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); + $tracking_topics = phpbb_request::variable(phpbb::$config['cookie_name'] . '_track', '', false, phpbb_request::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); if (!$user->data['is_registered']) { - $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + phpbb::$config['board_startdate']) : 0; } } @@ -140,17 +140,17 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_ids[] = $forum_id; - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { $forum_tracking_info[$forum_id] = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark']; } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { if (!$user->data['is_registered']) { - $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + phpbb::$config['board_startdate']) : 0; } - $forum_tracking_info[$forum_id] = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + $forum_tracking_info[$forum_id] = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + phpbb::$config['board_startdate']) : $user->data['user_lastmark']; } $row['forum_topics'] = ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics']; @@ -469,7 +469,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } $template->assign_vars(array( - 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid('viewforum', 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums') : '', + 'U_MARK_FORUMS' => ($user->data['is_registered'] || phpbb::$config['load_anon_lastread']) ? append_sid('viewforum', 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums') : '', 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false, 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'], 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST')) @@ -612,10 +612,10 @@ function get_forum_parents(&$forum_data) */ function topic_generate_pagination($replies, $url) { - global $config, $user; + global $user; // Make sure $per_page is a valid value - $per_page = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page']; + $per_page = (phpbb::$config['posts_per_page'] <= 0) ? 1 : phpbb::$config['posts_per_page']; if (($replies + 1) > $per_page) { @@ -654,11 +654,11 @@ function topic_generate_pagination($replies, $url) */ function get_moderators(&$forum_moderators, $forum_id = false) { - global $config, $template, $db, $user, $auth; + global $template, $db, $user, $auth; // Have we disabled the display of moderators? If so, then return // from whence we came ... - if (!$config['load_moderators']) + if (!phpbb::$config['load_moderators']) { return; } @@ -739,7 +739,7 @@ function get_moderators(&$forum_moderators, $forum_id = false) */ function gen_forum_auth_level($mode, $forum_id, $forum_status) { - global $template, $auth, $user, $config; + global $template, $auth, $user; $locked = ($forum_status == ITEM_LOCKED && !$auth->acl_get('m_edit', $forum_id)) ? true : false; @@ -750,7 +750,7 @@ function gen_forum_auth_level($mode, $forum_id, $forum_status) ($user->data['is_registered'] && $auth->acl_gets('f_delete', 'm_delete', $forum_id) && !$locked) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'], ); - if ($config['allow_attachments']) + if (phpbb::$config['allow_attachments']) { $rules[] = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && !$locked) ? $user->lang['RULES_ATTACH_CAN'] : $user->lang['RULES_ATTACH_CANNOT']; } @@ -768,7 +768,7 @@ function gen_forum_auth_level($mode, $forum_id, $forum_status) */ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$folder_alt, &$topic_type) { - global $user, $config; + global $user; $folder = $folder_new = ''; @@ -806,7 +806,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold $folder_new = 'topic_unread'; // Hot topic threshold is for posts in a topic, which is replies + the first post. ;) - if ($config['hot_threshold'] && ($replies + 1) >= $config['hot_threshold'] && $topic_row['topic_status'] != ITEM_LOCKED) + if (phpbb::$config['hot_threshold'] && ($replies + 1) >= phpbb::$config['hot_threshold'] && $topic_row['topic_status'] != ITEM_LOCKED) { $folder .= '_hot'; $folder_new .= '_hot'; @@ -1151,7 +1151,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, */ function get_user_rank($user_id, $user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) { - global $ranks, $config; + global $ranks; if (empty($ranks)) { @@ -1161,8 +1161,8 @@ function get_user_rank($user_id, $user_rank, $user_posts, &$rank_title, &$rank_i if (!empty($user_rank)) { $rank_title = (isset($ranks['special'][$user_rank]['rank_title'])) ? $ranks['special'][$user_rank]['rank_title'] : ''; - $rank_img = (!empty($ranks['special'][$user_rank]['rank_image'])) ? '<img src="' . PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] . '" alt="' . $ranks['special'][$user_rank]['rank_title'] . '" title="' . $ranks['special'][$user_rank]['rank_title'] . '" />' : ''; - $rank_img_src = (!empty($ranks['special'][$user_rank]['rank_image'])) ? PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] : ''; + $rank_img = (!empty($ranks['special'][$user_rank]['rank_image'])) ? '<img src="' . PHPBB_ROOT_PATH . phpbb::$config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] . '" alt="' . $ranks['special'][$user_rank]['rank_title'] . '" title="' . $ranks['special'][$user_rank]['rank_title'] . '" />' : ''; + $rank_img_src = (!empty($ranks['special'][$user_rank]['rank_image'])) ? PHPBB_ROOT_PATH . phpbb::$config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] : ''; } else if ($user_id != ANONYMOUS) { @@ -1173,8 +1173,8 @@ function get_user_rank($user_id, $user_rank, $user_posts, &$rank_title, &$rank_i if ($user_posts >= $rank['rank_min']) { $rank_title = $rank['rank_title']; - $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $rank['rank_image'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; - $rank_img_src = (!empty($rank['rank_image'])) ? PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $rank['rank_image'] : ''; + $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . PHPBB_ROOT_PATH . phpbb::$config['ranks_path'] . '/' . $rank['rank_image'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; + $rank_img_src = (!empty($rank['rank_image'])) ? PHPBB_ROOT_PATH . phpbb::$config['ranks_path'] . '/' . $rank['rank_image'] : ''; break; } } @@ -1195,7 +1195,7 @@ function get_user_rank($user_id, $user_rank, $user_posts, &$rank_title, &$rank_i */ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR') { - global $user, $config; + global $user; if (empty($avatar) || !$avatar_type) { @@ -1211,7 +1211,7 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ break; case AVATAR_GALLERY: - $avatar_img = PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/'; + $avatar_img = PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path'] . '/'; break; } diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 2c81b73e7f..b12c0b1a8f 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -95,7 +95,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'db2' => array( 'LABEL' => 'IBM DB2', 'SCHEMA' => 'db2', - 'MODULE' => 'ibm_db2', + 'MODULE' => 'ibm_db2', 'DELIM' => ';', 'COMMENTS' => 'remove_comments', 'DRIVER' => 'db2', @@ -195,7 +195,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 function dbms_select($default = '', $only_20x_options = false) { global $lang; - + $available_dbms = get_available_dbms(false, false, $only_20x_options); $dbms_options = ''; foreach ($available_dbms as $dbms_name => $details) @@ -277,7 +277,7 @@ function get_tables($db) */ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true) { - global $config, $lang; + global $lang; $dbms = $dbms_details['DRIVER']; @@ -476,7 +476,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, unset($final); } break; - + case 'oracle': if ($unicode_check) { @@ -503,7 +503,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, } } break; - + case 'postgres': if ($unicode_check) { diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index ed9f25744b..98162eeb6e 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -34,9 +34,7 @@ class messenger */ function __construct($use_queue = true) { - global $config; - - $this->use_queue = (!$config['email_package_size']) ? false : $use_queue; + $this->use_queue = (!phpbb::$config['email_package_size']) ? false : $use_queue; $this->subject = ''; } @@ -55,14 +53,12 @@ class messenger */ function to($address, $realname = '') { - global $config; - $pos = isset($this->addresses['to']) ? sizeof($this->addresses['to']) : 0; $this->addresses['to'][$pos]['email'] = trim($address); // If empty sendmail_path on windows, PHP changes the to line - if (!$config['smtp_delivery'] && DIRECTORY_SEPARATOR == '\\') + if (!phpbb::$config['smtp_delivery'] && DIRECTORY_SEPARATOR == '\\') { $this->addresses['to'][$pos]['name'] = ''; } @@ -153,8 +149,6 @@ class messenger */ function template($template_file, $template_lang = '') { - global $config; - if (!trim($template_file)) { trigger_error('No template file set', E_USER_ERROR); @@ -162,7 +156,7 @@ class messenger if (!trim($template_lang)) { - $template_lang = basename($config['default_lang']); + $template_lang = basename(phpbb::$config['default_lang']); } if (empty($this->tpl_msg[$template_lang . $template_file])) @@ -200,12 +194,12 @@ class messenger */ function send($method = NOTIFY_EMAIL, $break = false) { - global $config, $user; + global $user; // We add some standard variables we always use, no need to specify them always $this->vars['U_BOARD'] = (!isset($this->vars['U_BOARD'])) ? generate_board_url() : $this->vars['U_BOARD']; - $this->vars['EMAIL_SIG'] = (!isset($this->vars['EMAIL_SIG'])) ? str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])) : $this->vars['EMAIL_SIG']; - $this->vars['SITENAME'] = (!isset($this->vars['SITENAME'])) ? htmlspecialchars_decode($config['sitename']) : $this->vars['SITENAME']; + $this->vars['EMAIL_SIG'] = (!isset($this->vars['EMAIL_SIG'])) ? str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode(phpbb::$config['board_email_sig'])) : $this->vars['EMAIL_SIG']; + $this->vars['SITENAME'] = (!isset($this->vars['SITENAME'])) ? htmlspecialchars_decode(phpbb::$config['sitename']) : $this->vars['SITENAME']; // Escape all quotes, else the eval will fail. $this->msg = str_replace ("'", "\'", $this->msg); @@ -262,7 +256,7 @@ class messenger */ public static function error($type, $msg) { - global $user, $config; + global $user; // Session doesn't exist, create it if (!isset($user->session_id) || $user->session_id === '') @@ -276,7 +270,7 @@ class messenger switch ($type) { case 'EMAIL': - $message = '<strong>EMAIL/' . (($config['smtp_delivery']) ? 'SMTP' : 'PHP/' . $config['email_function_name'] . '()') . '</strong>'; + $message = '<strong>EMAIL/' . ((phpbb::$config['smtp_delivery']) ? 'SMTP' : 'PHP/' . phpbb::$config['email_function_name'] . '()') . '</strong>'; break; default: @@ -293,9 +287,7 @@ class messenger */ function save_queue() { - global $config; - - if ($config['email_package_size'] && $this->use_queue && !empty($this->queue)) + if (phpbb::$config['email_package_size'] && $this->use_queue && !empty($this->queue)) { $this->queue->save(); return; @@ -307,8 +299,6 @@ class messenger */ private function build_header($to, $cc, $bcc) { - global $config; - $headers = array(); $headers[] = 'From: ' . $this->from; @@ -324,10 +314,10 @@ class messenger } $headers[] = 'Reply-To: ' . $this->replyto; - $headers[] = 'Return-Path: <' . $config['board_email'] . '>'; - $headers[] = 'Sender: <' . $config['board_email'] . '>'; + $headers[] = 'Return-Path: <' . phpbb::$config['board_email'] . '>'; + $headers[] = 'Sender: <' . phpbb::$config['board_email'] . '>'; $headers[] = 'MIME-Version: 1.0'; - $headers[] = 'Message-ID: <' . md5(unique_id(time())) . '@' . $config['server_name'] . '>'; + $headers[] = 'Message-ID: <' . md5(unique_id(time())) . '@' . phpbb::$config['server_name'] . '>'; $headers[] = 'Date: ' . date('r', time()); $headers[] = 'Content-Type: text/plain; charset=UTF-8'; // format=flowed $headers[] = 'Content-Transfer-Encoding: 8bit'; // 7bit @@ -354,32 +344,32 @@ class messenger */ private function msg_email() { - global $config, $user; + global $user; - if (empty($config['email_enable'])) + if (empty(phpbb::$config['email_enable'])) { return false; } $use_queue = false; - if ($config['email_package_size'] && $this->use_queue) + if (phpbb::$config['email_package_size'] && $this->use_queue) { if (empty($this->queue)) { $this->queue = new queue(); - $this->queue->init('email', $config['email_package_size']); + $this->queue->init('email', phpbb::$config['email_package_size']); } $use_queue = true; } if (empty($this->replyto)) { - $this->replyto = '<' . $config['board_contact'] . '>'; + $this->replyto = '<' . phpbb::$config['board_contact'] . '>'; } if (empty($this->from)) { - $this->from = '<' . $config['board_contact'] . '>'; + $this->from = '<' . phpbb::$config['board_contact'] . '>'; } // Build to, cc and bcc strings @@ -406,14 +396,14 @@ class messenger $mail_to = ($to == '') ? 'undisclosed-recipients:;' : $to; $err_msg = ''; - if ($config['smtp_delivery']) + if (phpbb::$config['smtp_delivery']) { $result = smtpmail($this->addresses, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $err_msg, $headers); } else { ob_start(); - $result = $config['email_function_name']($mail_to, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers); + $result = phpbb::$config['email_function_name']($mail_to, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers); $err_msg = ob_get_clean(); } @@ -442,9 +432,9 @@ class messenger */ private function msg_jabber() { - global $config, $db, $user; + global $db, $user; - if (empty($config['jab_enable']) || empty($config['jab_host']) || empty($config['jab_username']) || empty($config['jab_password'])) + if (empty(phpbb::$config['jab_enable']) || empty(phpbb::$config['jab_host']) || empty(phpbb::$config['jab_username']) || empty(phpbb::$config['jab_password'])) { return false; } @@ -455,12 +445,12 @@ class messenger } $use_queue = false; - if ($config['jab_package_size'] && $this->use_queue) + if (phpbb::$config['jab_package_size'] && $this->use_queue) { if (empty($this->queue)) { $this->queue = new queue(); - $this->queue->init('jabber', $config['jab_package_size']); + $this->queue->init('jabber', phpbb::$config['jab_package_size']); } $use_queue = true; } @@ -475,7 +465,7 @@ class messenger if (!$use_queue) { include_once(PHPBB_ROOT_PATH . 'includes/functions_jabber.' . PHP_EXT); - $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_use_ssl']); + $this->jabber = new jabber(phpbb::$config['jab_host'], phpbb::$config['jab_port'], phpbb::$config['jab_username'], phpbb::$config['jab_password'], phpbb::$config['jab_use_ssl']); if (!$this->jabber->connect()) { @@ -553,7 +543,7 @@ class queue */ public function process() { - global $db, $config, $user; + global $db, $user; set_config('last_queue_run', time(), true); @@ -564,7 +554,7 @@ class queue return; } - if (!file_exists($this->cache_file) || (file_exists($this->cache_file . '.lock') && filemtime($this->cache_file) > time() - $config['queue_interval'])) + if (!file_exists($this->cache_file) || (file_exists($this->cache_file . '.lock') && filemtime($this->cache_file) > time() - phpbb::$config['queue_interval'])) { return; } @@ -597,7 +587,7 @@ class queue { case 'email': // Delete the email queued objects if mailing is disabled - if (!$config['email_enable']) + if (!phpbb::$config['email_enable']) { unset($this->queue_data['email']); continue 2; @@ -605,14 +595,14 @@ class queue break; case 'jabber': - if (!$config['jab_enable']) + if (!phpbb::$config['jab_enable']) { unset($this->queue_data['jabber']); continue 2; } include_once(PHPBB_ROOT_PATH . 'includes/functions_jabber.' . PHP_EXT); - $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_use_ssl']); + $this->jabber = new jabber(phpbb::$config['jab_host'], phpbb::$config['jab_port'], phpbb::$config['jab_username'], phpbb::$config['jab_password'], phpbb::$config['jab_use_ssl']); if (!$this->jabber->connect()) { @@ -643,14 +633,14 @@ class queue $err_msg = ''; $to = (!$to) ? 'undisclosed-recipients:;' : $to; - if ($config['smtp_delivery']) + if (phpbb::$config['smtp_delivery']) { $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers); } else { ob_start(); - $result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers); + $result = phpbb::$config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers); $err_msg = ob_get_clean(); } @@ -757,7 +747,7 @@ class queue */ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '') { - global $config, $user; + global $user; // Fix any bare linefeeds in the message to make it RFC821 Compliant. $message = preg_replace("#(?<!\r)\n#si", "\r\n", $message); @@ -837,11 +827,11 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '') $errno = 0; $errstr = ''; - $smtp->add_backtrace('Connecting to ' . $config['smtp_host'] . ':' . $config['smtp_port']); + $smtp->add_backtrace('Connecting to ' . phpbb::$config['smtp_host'] . ':' . phpbb::$config['smtp_port']); // Ok we have error checked as much as we can to this point let's get on it already. ob_start(); - $smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20); + $smtp->socket = fsockopen(phpbb::$config['smtp_host'], phpbb::$config['smtp_port'], $errno, $errstr, 20); $error_contents = ob_get_clean(); if (!$smtp->socket) @@ -864,7 +854,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '') } // Let me in. This function handles the complete authentication process - if ($err_msg = $smtp->log_into_server($config['smtp_host'], $config['smtp_username'], $config['smtp_password'], $config['smtp_auth_method'])) + if ($err_msg = $smtp->log_into_server(phpbb::$config['smtp_host'], phpbb::$config['smtp_username'], phpbb::$config['smtp_password'], phpbb::$config['smtp_auth_method'])) { $smtp->close_session($err_msg); return false; @@ -872,7 +862,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '') // From this point onward most server response codes should be 250 // Specify who the mail is from.... - $smtp->server_send('MAIL FROM:<' . $config['board_email'] . '>'); + $smtp->server_send('MAIL FROM:<' . phpbb::$config['board_email'] . '>'); if ($err_msg = $smtp->server_parse('250', __LINE__)) { $smtp->close_session($err_msg); @@ -1075,8 +1065,6 @@ class smtp_class // severe problems and is not fixable! if ($default_auth_method == 'POP-BEFORE-SMTP' && $username && $password) { - global $config; - $errno = 0; $errstr = ''; @@ -1088,7 +1076,7 @@ class smtp_class // We need to close the previous session, else the server is not // able to get our ip for matching... - if (!$this->socket = @fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 10)) + if (!$this->socket = @fsockopen(phpbb::$config['smtp_host'], phpbb::$config['smtp_port'], $errno, $errstr, 10)) { if ($errstr) { @@ -1290,7 +1278,7 @@ class smtp_class */ private function digest_md5($username, $password) { - global $config, $user; + global $user; $this->server_send('AUTH DIGEST-MD5'); if ($err_msg = $this->server_parse('334', __LINE__)) @@ -1365,7 +1353,7 @@ class smtp_class } $cnonce = base64_encode($str); - $digest_uri = 'smtp/' . $config['smtp_host']; + $digest_uri = 'smtp/' . phpbb::$config['smtp_host']; $auth_1 = sprintf('%s:%s:%s', pack('H32', md5(sprintf('%s:%s:%s', $username, $md5_challenge['realm'], $password))), $md5_challenge['nonce'], $cnonce); $auth_2 = 'AUTHENTICATE:' . $digest_uri; diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 6a7301c798..9206febca6 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -78,7 +78,7 @@ class p_master */ function list_modules($p_class) { - global $auth, $db, $user, $config; + global $auth, $db, $user; // Sanitise for future path use, it's escaped as appropriate for queries $this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class)); @@ -310,7 +310,7 @@ class p_master */ function module_auth($module_auth, $forum_id = false) { - global $auth, $config; + global $auth; $module_auth = trim($module_auth); @@ -358,7 +358,7 @@ class p_master $forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id; $is_auth = false; - eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', 'phpbb_request::variable(\'\\1\', false)'), $module_auth) . ');'); + eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) phpbb::$config[\'\\1\']', 'phpbb_request::variable(\'\\1\', false)'), $module_auth) . ');'); return $is_auth; } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index e30e088132..29d6e3ea7c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ function generate_smilies($mode, $forum_id) { - global $auth, $db, $user, $config, $template; + global $auth, $db, $user, $template; if ($mode == 'window') { @@ -88,7 +88,7 @@ function generate_smilies($mode, $forum_id) $template->assign_block_vars('smiley', array( 'SMILEY_CODE' => $row['code'], 'A_SMILEY_CODE' => addslashes($row['code']), - 'SMILEY_IMG' => PHPBB_ROOT_PATH . $config['smilies_path'] . '/' . $row['smiley_url'], + 'SMILEY_IMG' => PHPBB_ROOT_PATH . phpbb::$config['smilies_path'] . '/' . $row['smiley_url'], 'SMILEY_WIDTH' => $row['smiley_width'], 'SMILEY_HEIGHT' => $row['smiley_height'], 'SMILEY_DESC' => $row['emotion']) @@ -245,7 +245,7 @@ function update_post_information($type, $ids, $return_update_sql = false) */ function posting_gen_topic_icons($mode, $icon_id) { - global $config, $template; + global $template; // Grab icons $icons = phpbb_cache::obtain_icons(); @@ -263,7 +263,7 @@ function posting_gen_topic_icons($mode, $icon_id) { $template->assign_block_vars('topic_icon', array( 'ICON_ID' => $id, - 'ICON_IMG' => PHPBB_ROOT_PATH . $config['icons_path'] . '/' . $data['img'], + 'ICON_IMG' => PHPBB_ROOT_PATH . phpbb::$config['icons_path'] . '/' . $data['img'], 'ICON_WIDTH' => $data['width'], 'ICON_HEIGHT' => $data['height'], @@ -347,7 +347,7 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) */ function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false) { - global $auth, $user, $config, $db; + global $auth, $user, $db; $filedata = array( 'error' => array() @@ -356,9 +356,9 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage include_once(PHPBB_ROOT_PATH . 'includes/functions_upload.' . PHP_EXT); $upload = new fileupload(); - if ($config['check_attachment_content']) + if (phpbb::$config['check_attachment_content']) { - $upload->set_disallowed_content(explode('|', $config['mime_triggers'])); + $upload->set_disallowed_content(explode('|', phpbb::$config['mime_triggers'])); } if (!$local) @@ -400,12 +400,12 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage } // Do we have to create a thumbnail? - $filedata['thumbnail'] = ($cat_id == ATTACHMENT_CATEGORY_IMAGE && $config['img_create_thumbnail']) ? 1 : 0; + $filedata['thumbnail'] = ($cat_id == ATTACHMENT_CATEGORY_IMAGE && phpbb::$config['img_create_thumbnail']) ? 1 : 0; // Check Image Size, if it is an image if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id) && $cat_id == ATTACHMENT_CATEGORY_IMAGE) { - $file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']); + $file->upload->set_allowed_dimensions(0, 0, phpbb::$config['img_max_width'], phpbb::$config['img_max_height']); } // Admins and mods are allowed to exceed the allowed filesize @@ -417,7 +417,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage } else { - $allowed_filesize = ($is_message) ? $config['max_filesize_pm'] : $config['max_filesize']; + $allowed_filesize = ($is_message) ? phpbb::$config['max_filesize_pm'] : phpbb::$config['max_filesize']; } $file->upload->set_max_filesize($allowed_filesize); @@ -428,7 +428,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage // Are we uploading an image *and* this image being within the image category? Only then perform additional image checks. $no_image = ($cat_id == ATTACHMENT_CATEGORY_IMAGE) ? false : true; - $file->move_file($config['upload_path'], false, $no_image); + $file->move_file(phpbb::$config['upload_path'], false, $no_image); if (sizeof($file->error)) { @@ -447,9 +447,9 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage $filedata['filetime'] = time(); // Check our complete quota - if ($config['attachment_quota']) + if (phpbb::$config['attachment_quota']) { - if ($config['upload_dir_size'] + $file->get('filesize') > $config['attachment_quota']) + if (phpbb::$config['upload_dir_size'] + $file->get('filesize') > phpbb::$config['attachment_quota']) { $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED']; $filedata['post_attach'] = false; @@ -461,7 +461,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage } // Check free disk space - if ($free_space = @disk_free_space(PHPBB_ROOT_PATH . $config['upload_path'])) + if ($free_space = @disk_free_space(PHPBB_ROOT_PATH . phpbb::$config['upload_path'])) { if ($free_space <= $file->get('filesize')) { @@ -494,10 +494,8 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage */ function get_img_size_format($width, $height) { - global $config; - // Maximum Width the Image can take - $max_width = ($config['img_max_thumb_width']) ? $config['img_max_thumb_width'] : 400; + $max_width = (phpbb::$config['img_max_thumb_width']) ? phpbb::$config['img_max_thumb_width'] : 400; if ($width > $height) { @@ -585,9 +583,7 @@ function get_supported_image_types($type = false) */ function create_thumbnail($source, $destination, $mimetype) { - global $config; - - $min_filesize = (int) $config['img_min_thumb_filesize']; + $min_filesize = (int) phpbb::$config['img_min_thumb_filesize']; $img_filesize = (file_exists($source)) ? @filesize($source) : false; if (!$img_filesize || $img_filesize <= $min_filesize) @@ -620,14 +616,14 @@ function create_thumbnail($source, $destination, $mimetype) $used_imagick = false; // Only use imagemagick if defined and the passthru function not disabled - if ($config['img_imagick'] && function_exists('passthru')) + if (phpbb::$config['img_imagick'] && function_exists('passthru')) { - if (substr($config['img_imagick'], -1) !== '/') + if (substr(phpbb::$config['img_imagick'], -1) !== '/') { - $config['img_imagick'] .= '/'; + phpbb::$config['img_imagick'] .= '/'; } - @passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -antialias -sample ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $destination) . '"'); + @passthru(escapeshellcmd(phpbb::$config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -antialias -sample ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $destination) . '"'); if (file_exists($destination)) { @@ -765,20 +761,20 @@ function posting_gen_inline_attachments(&$attachment_data) */ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true) { - global $template, $config, $user, $auth; + global $template, $user, $auth; // Some default template variables $template->assign_vars(array( 'S_SHOW_ATTACH_BOX' => $show_attach_box, 'S_HAS_ATTACHMENTS' => sizeof($attachment_data), - 'FILESIZE' => $config['max_filesize'], + 'FILESIZE' => phpbb::$config['max_filesize'], 'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '', )); if (sizeof($attachment_data)) { // We display the posted attachments within the desired order. - ($config['display_order']) ? krsort($attachment_data) : ksort($attachment_data); + (phpbb::$config['display_order']) ? krsort($attachment_data) : ksort($attachment_data); foreach ($attachment_data as $count => $attach_row) { @@ -932,7 +928,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0) */ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true) { - global $user, $auth, $db, $template, $bbcode, $config; + global $user, $auth, $db, $template, $bbcode; // Go ahead and pull all data for this topic $sql = 'SELECT p.post_id @@ -942,7 +938,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' ORDER BY p.post_time '; $sql .= ($mode == 'post_review') ? 'ASC' : 'DESC'; - $result = $db->sql_query_limit($sql, $config['posts_per_page']); + $result = $db->sql_query_limit($sql, phpbb::$config['posts_per_page']); $post_list = array(); @@ -1102,7 +1098,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id */ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id, $topic_id, $post_id) { - global $db, $user, $config, $auth; + global $db, $user, $auth; $topic_notification = ($mode == 'reply' || $mode == 'quote') ? true : false; $forum_notification = ($mode == 'post') ? true : false; @@ -1112,7 +1108,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id trigger_error('WRONG_NOTIFICATION_MODE'); } - if (($topic_notification && !$config['allow_topic_notify']) || ($forum_notification && !$config['allow_forum_notify'])) + if (($topic_notification && !phpbb::$config['allow_topic_notify']) || ($forum_notification && !phpbb::$config['allow_forum_notify'])) { return; } @@ -1329,7 +1325,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id */ function delete_post($forum_id, $topic_id, $post_id, &$data) { - global $db, $user, $auth, $config; + global $db, $user, $auth; // Specify our post mode $post_mode = 'delete'; @@ -1515,7 +1511,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) } // Adjust posted info for this user by looking for a post by him/her within this topic... - if ($post_mode != 'delete_topic' && $config['load_db_track'] && $data['poster_id'] != ANONYMOUS) + if ($post_mode != 'delete_topic' && phpbb::$config['load_db_track'] && $data['poster_id'] != ANONYMOUS) { $sql = 'SELECT poster_id FROM ' . POSTS_TABLE . ' @@ -1550,7 +1546,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) */ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true) { - global $db, $auth, $user, $config, $template; + global $db, $auth, $user, $template; // We do not handle erasing posts here if ($mode == 'delete') @@ -1603,7 +1599,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $post_approval = 1; // Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected. - if ((($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts']) || !$auth->acl_get('f_noapprove', $data['forum_id'])) && !$auth->acl_get('m_approve', $data['forum_id'])) + if (((phpbb::$config['enable_queue_trigger'] && $user->data['user_posts'] < phpbb::$config['queue_trigger_posts']) || !$auth->acl_get('f_noapprove', $data['forum_id'])) && !$auth->acl_get('m_approve', $data['forum_id'])) { $post_approval = 0; } @@ -1805,8 +1801,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics = forum_topics - 1'; $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies'] + 1); - set_config('num_topics', $config['num_topics'] - 1, true); - set_config('num_posts', $config['num_posts'] - ($topic_row['topic_replies'] + 1), true); + set_config('num_topics', phpbb::$config['num_topics'] - 1, true); + set_config('num_posts', phpbb::$config['num_posts'] - ($topic_row['topic_replies'] + 1), true); // Only decrement this post, since this is the one non-approved now if ($auth->acl_get('f_postcount', $data['forum_id'])) @@ -1826,7 +1822,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1'; $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1'; - set_config('num_posts', $config['num_posts'] - 1, true); + set_config('num_posts', phpbb::$config['num_posts'] - 1, true); if ($auth->acl_get('f_postcount', $data['forum_id'])) { @@ -2067,7 +2063,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u else { // insert attachment into db - if (!@file_exists(PHPBB_ROOT_PATH . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + if (!@file_exists(PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) { continue; } @@ -2093,8 +2089,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($space_taken && $files_added) { - set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true); - set_config('num_files', $config['num_files'] + $files_added, true); + set_config('upload_dir_size', phpbb::$config['upload_dir_size'] + $space_taken, true); + set_config('num_files', phpbb::$config['num_files'] + $files_added, true); } } @@ -2327,13 +2323,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { if ($post_mode == 'post') { - set_config('num_topics', $config['num_topics'] + 1, true); - set_config('num_posts', $config['num_posts'] + 1, true); + set_config('num_topics', phpbb::$config['num_topics'] + 1, true); + set_config('num_posts', phpbb::$config['num_posts'] + 1, true); } if ($post_mode == 'reply') { - set_config('num_posts', $config['num_posts'] + 1, true); + set_config('num_posts', phpbb::$config['num_posts'] + 1, true); } } @@ -2374,7 +2370,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($update_message && $data['enable_indexing']) { // Select the search method and do some additional checks to ensure it can actually be utilised - $search_type = basename($config['search_type']); + $search_type = basename(phpbb::$config['search_type']); if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) { @@ -2426,7 +2422,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u markread('topic', $data['forum_id'], $data['topic_id'], time()); // - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { $sql = 'SELECT mark_time FROM ' . FORUMS_TRACK_TABLE . ' @@ -2436,12 +2432,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $f_mark_time = (int) $db->sql_fetchfield('mark_time'); $db->sql_freeresult($result); } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { $f_mark_time = false; } - if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered']) + if ((phpbb::$config['load_db_lastread'] && $user->data['is_registered']) || phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { // Update forum info $sql = 'SELECT forum_last_post_time diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ad77981ead..b13d2eb624 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -221,7 +221,7 @@ function get_folder($user_id, $folder_id = false) */ function clean_sentbox($num_sentbox_messages) { - global $db, $user, $config; + global $db, $user; // Check Message Limit if ($user->data['message_limit'] && $num_sentbox_messages > $user->data['message_limit']) @@ -250,7 +250,7 @@ function clean_sentbox($num_sentbox_messages) */ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) { - global $user, $config; + global $user; if (!isset($rules[$rule_row['rule_check']][$rule_row['rule_connection']])) { @@ -365,7 +365,7 @@ function update_pm_counts() */ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) { - global $db, $user, $config; + global $db, $user; if (!$user->data['user_new_privmsg']) { @@ -588,7 +588,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) if (sizeof($move_into_folder)) { // Determine Full Folder Action - we need the move to folder id later eventually - $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; + $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? (phpbb::$config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; $sql_folder = array_keys($move_into_folder); if ($full_folder_action >= 0) @@ -632,12 +632,12 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // But we are making sure that the other way around works too (more messages in queue than allowed to be stored) if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + sizeof($msg_ary)) > $user->data['message_limit']) { - $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; + $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? (phpbb::$config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; // If destination folder itself is full... if ($full_folder_action >= 0 && ($folder[$full_folder_action] + sizeof($msg_ary)) > $user->data['message_limit']) { - $full_folder_action = $config['full_folder_action'] - (FULL_FOLDER_NONE*(-1)); + $full_folder_action = phpbb::$config['full_folder_action'] - (FULL_FOLDER_NONE*(-1)); } // If Full Folder Action is to move to another folder, we simply adjust the destination folder @@ -1258,7 +1258,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) */ function get_folder_status($folder_id, $folder) { - global $db, $user, $config; + global $db, $user; if (isset($folder[$folder_id])) { @@ -1291,7 +1291,7 @@ function get_folder_status($folder_id, $folder) */ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) { - global $db, $auth, $config, $template, $user; + global $db, $auth, $template, $user; // We do not handle erasing pms here if ($mode == 'delete') @@ -1543,7 +1543,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) else { // insert attachment into db - if (!@file_exists(PHPBB_ROOT_PATH . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + if (!@file_exists(PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) { continue; } @@ -1569,8 +1569,8 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) if ($space_taken && $files_added) { - set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true); - set_config('num_files', $config['num_files'] + $files_added, true); + set_config('upload_dir_size', phpbb::$config['upload_dir_size'] + $space_taken, true); + set_config('num_files', phpbb::$config['num_files'] + $files_added, true); } } @@ -1600,7 +1600,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) */ function pm_notification($mode, $author, $recipients, $subject, $message) { - global $db, $user, $config, $auth; + global $db, $user, $auth; $subject = censor_text($subject); @@ -1687,7 +1687,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message) */ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false) { - global $db, $user, $config, $template, $auth, $bbcode; + global $db, $user, $template, $auth, $bbcode; // Get History Messages (could be newer) $sql = 'SELECT t.*, p.*, u.* @@ -1841,7 +1841,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode */ function set_user_message_limit() { - global $user, $db, $config; + global $user, $db; // Get maximum about from user memberships - if it is 0, there is no limit set and we use the maximum value within the config. $sql = 'SELECT MAX(g.group_message_limit) as max_message_limit @@ -1853,7 +1853,7 @@ function set_user_message_limit() $message_limit = (int) $db->sql_fetchfield('max_message_limit'); $db->sql_freeresult($result); - $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; + $user->data['message_limit'] = (!$message_limit) ? phpbb::$config['pm_max_msgs'] : $message_limit; } ?>
\ No newline at end of file diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index 8ae2f7fced..4a7c4fde70 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -837,8 +837,6 @@ class custom_profile */ private function get_profile_field($profile_row) { - global $config; - $var_name = 'pf_' . $profile_row['field_ident']; switch ($profile_row['field_type']) @@ -988,9 +986,9 @@ class custom_profile_admin extends custom_profile */ public function get_bool_options() { - global $user, $config, $lang_defs; + global $user, $lang_defs; - $default_lang_id = $lang_defs['iso'][$config['default_lang']]; + $default_lang_id = $lang_defs['iso'][phpbb::$config['default_lang']]; $profile_row = array( 'var_name' => 'field_default_value', @@ -1018,9 +1016,9 @@ class custom_profile_admin extends custom_profile */ public function get_dropdown_options() { - global $user, $config, $lang_defs; + global $user, $lang_defs; - $default_lang_id = $lang_defs['iso'][$config['default_lang']]; + $default_lang_id = $lang_defs['iso'][phpbb::$config['default_lang']]; $profile_row[0] = array( 'var_name' => 'field_default_value', @@ -1052,9 +1050,9 @@ class custom_profile_admin extends custom_profile */ public function get_date_options() { - global $user, $config, $lang_defs; + global $user, $lang_defs; - $default_lang_id = $lang_defs['iso'][$config['default_lang']]; + $default_lang_id = $lang_defs['iso'][phpbb::$config['default_lang']]; $profile_row = array( 'var_name' => 'field_default_value', diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index dc2f399dcd..f50394cc09 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -261,7 +261,7 @@ class filespec * Move file to destination folder * The phpbb_root_path variable will be applied to the destination path * - * @param string $destination_path Destination path, for example $config['avatar_path'] + * @param string $destination_path Destination path, for example phpbb::$config['avatar_path'] * @param bool $overwrite If set to true, an already existing file will be overwritten * @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()} * diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index f6223b93aa..f4afd31780 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -113,7 +113,7 @@ function update_last_username() */ function user_update_name($old_name, $new_name) { - global $config, $db; + global $db; $update_ary = array( FORUMS_TABLE => array('forum_last_poster_name'), @@ -133,7 +133,7 @@ function user_update_name($old_name, $new_name) } } - if ($config['newest_username'] == $old_name) + if (phpbb::$config['newest_username'] == $old_name) { set_config('newest_username', $new_name, true); } @@ -151,7 +151,7 @@ function user_update_name($old_name, $new_name) */ function user_add($user_row, $cp_data = false) { - global $db, $user, $auth, $config; + global $db, $user, $auth; if (empty($user_row['username']) || !isset($user_row['group_id']) || !isset($user_row['user_email']) || !isset($user_row['user_type'])) { @@ -179,10 +179,10 @@ function user_add($user_row, $cp_data = false) // These are the additional vars able to be specified $additional_vars = array( 'user_permissions' => '', - 'user_timezone' => $config['board_timezone'], - 'user_dateformat' => $config['default_dateformat'], - 'user_lang' => $config['default_lang'], - 'user_style' => $config['default_style'], + 'user_timezone' => phpbb::$config['board_timezone'], + 'user_dateformat' => phpbb::$config['default_dateformat'], + 'user_lang' => phpbb::$config['default_lang'], + 'user_style' => phpbb::$config['default_style'], 'user_actkey' => '', 'user_ip' => '', 'user_regdate' => time(), @@ -196,7 +196,7 @@ function user_add($user_row, $cp_data = false) 'user_lastpost_time' => 0, 'user_lastpage' => '', 'user_posts' => 0, - 'user_dst' => (int) $config['board_dst'], + 'user_dst' => (int) phpbb::$config['board_dst'], 'user_colour' => '', 'user_occ' => '', 'user_interests' => '', @@ -280,7 +280,7 @@ function user_add($user_row, $cp_data = false) { set_config('newest_user_id', $user_id, true); set_config('newest_username', $user_row['username'], true); - set_config('num_users', $config['num_users'] + 1, true); + set_config('num_users', phpbb::$config['num_users'] + 1, true); $sql = 'SELECT group_colour FROM ' . GROUPS_TABLE . ' @@ -300,7 +300,7 @@ function user_add($user_row, $cp_data = false) */ function user_delete($mode, $user_id, $post_username = false) { - global $config, $db, $user, $auth; + global $db, $user, $auth; $sql = 'SELECT * FROM ' . USERS_TABLE . ' @@ -560,7 +560,7 @@ function user_delete($mode, $user_id, $post_username = false) $db->sql_transaction('commit'); // Reset newest user info if appropriate - if ($config['newest_user_id'] == $user_id) + if (phpbb::$config['newest_user_id'] == $user_id) { update_last_username(); } @@ -568,7 +568,7 @@ function user_delete($mode, $user_id, $post_username = false) // Decrement number of users if this user is active if ($user_row['user_type'] != phpbb::USER_INACTIVE && $user_row['user_type'] != phpbb::USER_IGNORE) { - set_config('num_users', $config['num_users'] - 1, true); + set_config('num_users', phpbb::$config['num_users'] - 1, true); } return false; @@ -581,7 +581,7 @@ function user_delete($mode, $user_id, $post_username = false) */ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) { - global $config, $db, $user, $auth; + global $db, $user, $auth; $deactivated = $activated = 0; $sql_statements = array(); @@ -649,12 +649,12 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) if ($deactivated) { - set_config('num_users', $config['num_users'] - $deactivated, true); + set_config('num_users', phpbb::$config['num_users'] - $deactivated, true); } if ($activated) { - set_config('num_users', $config['num_users'] + $activated, true); + set_config('num_users', phpbb::$config['num_users'] + $activated, true); } // Update latest username @@ -1344,7 +1344,7 @@ function validate_match($string, $optional = false, $match = '') */ function validate_username($username, $allowed_username = false) { - global $config, $db, $user; + global $db, $user; $clean_username = utf8_clean_string($username); $allowed_username = ($allowed_username === false) ? $user->data['username_clean'] : utf8_clean_string($allowed_username); @@ -1363,7 +1363,7 @@ function validate_username($username, $allowed_username = false) $mbstring = $pcre = false; // generic UTF-8 character types supported - switch ($config['allow_name_chars']) + switch (phpbb::$config['allow_name_chars']) { case 'USERNAME_CHARS_ANY': $regex = '.+'; @@ -1440,7 +1440,7 @@ function validate_username($username, $allowed_username = false) */ function validate_password($password) { - global $config, $db, $user; + global $db, $user; if (!$password) { @@ -1456,7 +1456,7 @@ function validate_password($password) $chars = array(); - switch ($config['pass_complex']) + switch (phpbb::$config['pass_complex']) { case 'PASS_TYPE_CASE': $chars[] = $low; @@ -1510,7 +1510,7 @@ function validate_password($password) */ function validate_email($email, $allowed_email = false) { - global $config, $db, $user; + global $db, $user; $email = strtolower($email); $allowed_email = ($allowed_email === false) ? strtolower($user->data['user_email']) : strtolower($allowed_email); @@ -1527,7 +1527,7 @@ function validate_email($email, $allowed_email = false) // Check MX record. // The idea for this is from reading the UseBB blog/announcement. :) - if ($config['email_check_mx']) + if (phpbb::$config['email_check_mx']) { list(, $domain) = explode('@', $email); @@ -1542,7 +1542,7 @@ function validate_email($email, $allowed_email = false) return ($ban_reason === true) ? 'EMAIL_BANNED' : $ban_reason; } - if (!$config['allow_emailreuse']) + if (!phpbb::$config['allow_emailreuse']) { $sql = 'SELECT user_email_hash FROM ' . USERS_TABLE . " @@ -1768,7 +1768,7 @@ function validate_jabber($jid) */ function avatar_delete($mode, $row, $clean_db = false) { - global $config, $db, $user; + global $db, $user; // Check if the users avatar is actually *not* a group avatar if ($mode == 'user') @@ -1784,9 +1784,9 @@ function avatar_delete($mode, $row, $clean_db = false) avatar_remove_db($row[$mode . '_avatar']); } $filename = get_avatar_filename($row[$mode . '_avatar']); - if (file_exists(PHPBB_ROOT_PATH . $config['avatar_path'] . '/' . $filename)) + if (file_exists(PHPBB_ROOT_PATH . phpbb::$config['avatar_path'] . '/' . $filename)) { - @unlink(PHPBB_ROOT_PATH . $config['avatar_path'] . '/' . $filename); + @unlink(PHPBB_ROOT_PATH . phpbb::$config['avatar_path'] . '/' . $filename); return true; } @@ -1798,7 +1798,7 @@ function avatar_delete($mode, $row, $clean_db = false) */ function avatar_remote($data, &$error) { - global $config, $db, $user; + global $db, $user; if (!preg_match('#^(http|https|ftp)://#i', $data['remotelink'])) { @@ -1850,20 +1850,20 @@ function avatar_remote($data, &$error) return false; } - if ($config['avatar_max_width'] || $config['avatar_max_height']) + if (phpbb::$config['avatar_max_width'] || phpbb::$config['avatar_max_height']) { - if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height']) + if ($width > phpbb::$config['avatar_max_width'] || $height > phpbb::$config['avatar_max_height']) { - $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $width, $height); + $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], phpbb::$config['avatar_min_width'], phpbb::$config['avatar_min_height'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], $width, $height); return false; } } - if ($config['avatar_min_width'] || $config['avatar_min_height']) + if (phpbb::$config['avatar_min_width'] || phpbb::$config['avatar_min_height']) { - if ($width < $config['avatar_min_width'] || $height < $config['avatar_min_height']) + if ($width < phpbb::$config['avatar_min_width'] || $height < phpbb::$config['avatar_min_height']) { - $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $width, $height); + $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], phpbb::$config['avatar_min_width'], phpbb::$config['avatar_min_height'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], $width, $height); return false; } } @@ -1876,11 +1876,11 @@ function avatar_remote($data, &$error) */ function avatar_upload($data, &$error) { - global $config, $db, $user; + global $db, $user; // Init upload class include_once(PHPBB_ROOT_PATH . 'includes/functions_upload.' . PHP_EXT); - $upload = new fileupload('AVATAR_', array('jpg', 'jpeg', 'gif', 'png'), $config['avatar_filesize'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], explode('|', $config['mime_triggers'])); + $upload = new fileupload('AVATAR_', array('jpg', 'jpeg', 'gif', 'png'), phpbb::$config['avatar_filesize'], phpbb::$config['avatar_min_width'], phpbb::$config['avatar_min_height'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], explode('|', phpbb::$config['mime_triggers'])); if (!empty($_FILES['uploadfile']['name'])) { @@ -1891,10 +1891,10 @@ function avatar_upload($data, &$error) $file = $upload->remote_upload($data['uploadurl']); } - $prefix = $config['avatar_salt'] . '_'; + $prefix = phpbb::$config['avatar_salt'] . '_'; $file->clean_filename('avatar', $prefix, $data['user_id']); - $destination = $config['avatar_path']; + $destination = phpbb::$config['avatar_path']; // Adjust destination path (no trailing slash) if (substr($destination, -1, 1) == '/' || substr($destination, -1, 1) == '\\') @@ -1925,9 +1925,6 @@ function avatar_upload($data, &$error) */ function get_avatar_filename($avatar_entry) { - global $config; - - if ($avatar_entry[0] === 'g') { $avatar_group = true; @@ -1939,7 +1936,7 @@ function get_avatar_filename($avatar_entry) } $ext = substr(strrchr($avatar_entry, '.'), 1); $avatar_entry = intval($avatar_entry); - return $config['avatar_salt'] . '_' . (($avatar_group) ? 'g' : '') . $avatar_entry . '.' . $ext; + return phpbb::$config['avatar_salt'] . '_' . (($avatar_group) ? 'g' : '') . $avatar_entry . '.' . $ext; } /** @@ -1947,11 +1944,11 @@ function get_avatar_filename($avatar_entry) */ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var = 'avatar_row') { - global $user, $template, $config; + global $user, $template; $avatar_list = array(); - $path = PHPBB_ROOT_PATH . $config['avatar_gallery_path']; + $path = PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path']; if (!file_exists($path) || !is_dir($path)) { @@ -2030,13 +2027,13 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var foreach ($avatar_row_ary as $avatar_col_ary) { $template->assign_block_vars($block_var . '.avatar_column', array( - 'AVATAR_IMAGE' => PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'], + 'AVATAR_IMAGE' => PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'], 'AVATAR_NAME' => $avatar_col_ary['name'], 'AVATAR_FILE' => $avatar_col_ary['filename']) ); $template->assign_block_vars($block_var . '.avatar_option_column', array( - 'AVATAR_IMAGE' => PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'], + 'AVATAR_IMAGE' => PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'], 'S_OPTIONS_AVATAR' => $avatar_col_ary['filename']) ); } @@ -2051,7 +2048,7 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var */ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $current_y = 0) { - global $config, $user; + global $user; switch ($avatar_type) { @@ -2059,11 +2056,11 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $ break; case AVATAR_UPLOAD : - $avatar = PHPBB_ROOT_PATH . $config['avatar_path'] . '/' . get_avatar_filename($avatar); + $avatar = PHPBB_ROOT_PATH . phpbb::$config['avatar_path'] . '/' . get_avatar_filename($avatar); break; case AVATAR_GALLERY : - $avatar = PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $avatar ; + $avatar = PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path'] . '/' . $avatar ; break; } @@ -2086,14 +2083,14 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $ if ($current_x != 0) { $image_data[1] = (int) floor(($current_x / $image_data[0]) * $image_data[1]); - $image_data[1] = min($config['avatar_max_height'], $image_data[1]); - $image_data[1] = max($config['avatar_min_height'], $image_data[1]); + $image_data[1] = min(phpbb::$config['avatar_max_height'], $image_data[1]); + $image_data[1] = max(phpbb::$config['avatar_min_height'], $image_data[1]); } if ($current_y != 0) { $image_data[0] = (int) floor(($current_y / $image_data[1]) * $image_data[0]); - $image_data[0] = min($config['avatar_max_width'], $image_data[1]); - $image_data[0] = max($config['avatar_min_width'], $image_data[1]); + $image_data[0] = min(phpbb::$config['avatar_max_width'], $image_data[1]); + $image_data[0] = max(phpbb::$config['avatar_min_width'], $image_data[1]); } } return array($image_data[0], $image_data[1]); @@ -2104,7 +2101,7 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $ */ function avatar_process_user(&$error, $custom_userdata = false) { - global $config, $auth, $user, $db; + global $auth, $user, $db; $data = array( 'uploadurl' => request_var('uploadurl', ''), @@ -2141,17 +2138,17 @@ function avatar_process_user(&$error, $custom_userdata = false) $avatar_select = basename(request_var('avatar_select', '')); // Can we upload? - $can_upload = ($config['allow_avatar_upload'] && file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + $can_upload = (phpbb::$config['allow_avatar_upload'] && file_exists(PHPBB_ROOT_PATH . phpbb::$config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . phpbb::$config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) { list($sql_ary['user_avatar_type'], $sql_ary['user_avatar'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = avatar_upload($data, $error); } - else if ($data['remotelink'] && $change_avatar && $config['allow_avatar_remote']) + else if ($data['remotelink'] && $change_avatar && phpbb::$config['allow_avatar_remote']) { list($sql_ary['user_avatar_type'], $sql_ary['user_avatar'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = avatar_remote($data, $error); } - else if ($avatar_select && $change_avatar && $config['allow_avatar_local']) + else if ($avatar_select && $change_avatar && phpbb::$config['allow_avatar_local']) { $category = basename(request_var('category', '')); @@ -2159,14 +2156,14 @@ function avatar_process_user(&$error, $custom_userdata = false) $sql_ary['user_avatar'] = $avatar_select; // check avatar gallery - if (!is_dir(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category)) + if (!is_dir(PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path'] . '/' . $category)) { $sql_ary['user_avatar'] = ''; $sql_ary['user_avatar_type'] = $sql_ary['user_avatar_width'] = $sql_ary['user_avatar_height'] = 0; } else { - list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category . '/' . $sql_ary['user_avatar']); + list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize(PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path'] . '/' . $category . '/' . $sql_ary['user_avatar']); $sql_ary['user_avatar'] = $category . '/' . $sql_ary['user_avatar']; } } @@ -2194,22 +2191,22 @@ function avatar_process_user(&$error, $custom_userdata = false) } } } - if (($config['avatar_max_width'] || $config['avatar_max_height']) && + if ((phpbb::$config['avatar_max_width'] || phpbb::$config['avatar_max_height']) && (($data['width'] != $userdata['user_avatar_width']) || $data['height'] != $userdata['user_avatar_height'])) { - if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height']) + if ($data['width'] > phpbb::$config['avatar_max_width'] || $data['height'] > phpbb::$config['avatar_max_height']) { - $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']); + $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], phpbb::$config['avatar_min_width'], phpbb::$config['avatar_min_height'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], $data['width'], $data['height']); } } if (!sizeof($error)) { - if ($config['avatar_min_width'] || $config['avatar_min_height']) + if (phpbb::$config['avatar_min_width'] || phpbb::$config['avatar_min_height']) { - if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height']) + if ($data['width'] < phpbb::$config['avatar_min_width'] || $data['height'] < phpbb::$config['avatar_min_height']) { - $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']); + $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], phpbb::$config['avatar_min_width'], phpbb::$config['avatar_min_height'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], $data['width'], $data['height']); } } } @@ -2265,7 +2262,7 @@ function avatar_process_user(&$error, $custom_userdata = false) */ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow_desc_bbcode = false, $allow_desc_urls = false, $allow_desc_smilies = false) { - global $config, $db, $user, $file_upload; + global $db, $user, $file_upload; $error = array(); $attribute_ary = array( @@ -2426,15 +2423,15 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow */ function group_correct_avatar($group_id, $old_entry) { - global $config, $db; + global $db; $group_id = (int)$group_id; $ext = substr(strrchr($old_entry, '.'), 1); $old_filename = get_avatar_filename($old_entry); - $new_filename = $config['avatar_salt'] . "_g$group_id.$ext"; + $new_filename = phpbb::$config['avatar_salt'] . "_g$group_id.$ext"; $new_entry = 'g' . $group_id . '_' . substr(time(), -5) . ".$ext"; - $avatar_path = PHPBB_ROOT_PATH . $config['avatar_path']; + $avatar_path = PHPBB_ROOT_PATH . phpbb::$config['avatar_path']; if (@rename($avatar_path . '/'. $old_filename, $avatar_path . '/' . $new_filename)) { $sql = 'UPDATE ' . GROUPS_TABLE . ' @@ -2450,7 +2447,7 @@ function group_correct_avatar($group_id, $old_entry) */ function avatar_remove_db($avatar_name) { - global $config, $db; + global $db; $sql = 'UPDATE ' . USERS_TABLE . " SET user_avatar = '', @@ -2839,7 +2836,7 @@ function remove_default_rank($group_id, $user_ids) */ function group_user_attributes($action, $group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $group_attributes = false) { - global $db, $auth, $config; + global $db, $auth; // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); @@ -2976,7 +2973,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna */ function group_validate_groupname($group_id, $group_name) { - global $config, $db; + global $db; $group_name = utf8_clean_string($group_name); @@ -3112,9 +3109,7 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary); $db->sql_query($sql); - global $config; - - if (in_array($config['newest_user_id'], $user_id_ary)) + if (in_array(phpbb::$config['newest_user_id'], $user_id_ary)) { set_config('newest_user_colour', $sql_ary['user_colour'], true); } diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 5bbadd4d4c..14b87c05b2 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -194,16 +194,16 @@ class bbcode_firstpass extends bbcode */ function bbcode_size($stx, $in) { - global $user, $config; + global $user; if (!$this->check_bbcode('size', $in)) { return $in; } - if ($config['max_' . $this->mode . '_font_size'] && $config['max_' . $this->mode . '_font_size'] < $stx) + if (phpbb::$config['max_' . $this->mode . '_font_size'] && phpbb::$config['max_' . $this->mode . '_font_size'] < $stx) { - $this->warn_msg[] = sprintf($user->lang['MAX_FONT_SIZE_EXCEEDED'], $config['max_' . $this->mode . '_font_size']); + $this->warn_msg[] = sprintf($user->lang['MAX_FONT_SIZE_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_font_size']); return '[size=' . $stx . ']' . $in . '[/size]'; } @@ -274,7 +274,7 @@ class bbcode_firstpass extends bbcode */ function bbcode_img($in) { - global $user, $config; + global $user; if (!$this->check_bbcode('img', $in)) { @@ -298,7 +298,7 @@ class bbcode_firstpass extends bbcode $in = 'http://' . $in; } - if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) + if (phpbb::$config['max_' . $this->mode . '_img_height'] || phpbb::$config['max_' . $this->mode . '_img_width']) { $stats = @getimagesize($in); @@ -309,16 +309,16 @@ class bbcode_firstpass extends bbcode } else { - if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $stats[1]) + if (phpbb::$config['max_' . $this->mode . '_img_height'] && phpbb::$config['max_' . $this->mode . '_img_height'] < $stats[1]) { $error = true; - $this->warn_msg[] = sprintf($user->lang['MAX_IMG_HEIGHT_EXCEEDED'], $config['max_' . $this->mode . '_img_height']); + $this->warn_msg[] = sprintf($user->lang['MAX_IMG_HEIGHT_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_img_height']); } - if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $stats[0]) + if (phpbb::$config['max_' . $this->mode . '_img_width'] && phpbb::$config['max_' . $this->mode . '_img_width'] < $stats[0]) { $error = true; - $this->warn_msg[] = sprintf($user->lang['MAX_IMG_WIDTH_EXCEEDED'], $config['max_' . $this->mode . '_img_width']); + $this->warn_msg[] = sprintf($user->lang['MAX_IMG_WIDTH_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_img_width']); } } } @@ -336,7 +336,7 @@ class bbcode_firstpass extends bbcode */ function bbcode_flash($width, $height, $in) { - global $user, $config; + global $user; if (!$this->check_bbcode('flash', $in)) { @@ -353,18 +353,18 @@ class bbcode_firstpass extends bbcode } // Apply the same size checks on flash files as on images - if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) + if (phpbb::$config['max_' . $this->mode . '_img_height'] || phpbb::$config['max_' . $this->mode . '_img_width']) { - if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $height) + if (phpbb::$config['max_' . $this->mode . '_img_height'] && phpbb::$config['max_' . $this->mode . '_img_height'] < $height) { $error = true; - $this->warn_msg[] = sprintf($user->lang['MAX_FLASH_HEIGHT_EXCEEDED'], $config['max_' . $this->mode . '_img_height']); + $this->warn_msg[] = sprintf($user->lang['MAX_FLASH_HEIGHT_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_img_height']); } - if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $width) + if (phpbb::$config['max_' . $this->mode . '_img_width'] && phpbb::$config['max_' . $this->mode . '_img_width'] < $width) { $error = true; - $this->warn_msg[] = sprintf($user->lang['MAX_FLASH_WIDTH_EXCEEDED'], $config['max_' . $this->mode . '_img_width']); + $this->warn_msg[] = sprintf($user->lang['MAX_FLASH_WIDTH_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_img_width']); } } @@ -685,7 +685,7 @@ class bbcode_firstpass extends bbcode */ function bbcode_quote($in) { - global $config, $user; + global $user; /** * If you change this code, make sure the cases described within the following reports are still working: @@ -752,10 +752,10 @@ class bbcode_firstpass extends bbcode $this->parsed_items['quote']++; // the buffer holds a valid opening tag - if ($config['max_quote_depth'] && sizeof($close_tags) >= $config['max_quote_depth']) + if (phpbb::$config['max_quote_depth'] && sizeof($close_tags) >= phpbb::$config['max_quote_depth']) { // there are too many nested quotes - $error_ary['quote_depth'] = sprintf($user->lang['QUOTE_DEPTH_EXCEEDED'], $config['max_quote_depth']); + $error_ary['quote_depth'] = sprintf($user->lang['QUOTE_DEPTH_EXCEEDED'], phpbb::$config['max_quote_depth']); $out .= $buffer . $tok; $tok = '[]'; @@ -916,8 +916,6 @@ class bbcode_firstpass extends bbcode */ function validate_url($var1, $var2) { - global $config; - $var1 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var1))); $var2 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var2))); @@ -979,11 +977,11 @@ class bbcode_firstpass extends bbcode */ function path_in_domain($url) { - global $config, $user; + global $user; - if ($config['force_server_vars']) + if (phpbb::$config['force_server_vars']) { - $check_path = $config['script_path']; + $check_path = phpbb::$config['script_path']; } else { @@ -996,9 +994,9 @@ class bbcode_firstpass extends bbcode $server_name = $user->host; // Forcing server vars is the only way to specify/override the protocol - if ($config['force_server_vars'] || !$server_name) + if (phpbb::$config['force_server_vars'] || !$server_name) { - $server_name = $config['server_name']; + $server_name = phpbb::$config['server_name']; } // Check again in correct order... @@ -1061,7 +1059,7 @@ class parse_message extends bbcode_firstpass */ function parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post') { - global $config, $db, $user; + global $db, $user; $mode = ($mode != 'post') ? 'sig' : 'post'; @@ -1091,13 +1089,13 @@ class parse_message extends bbcode_firstpass $this->message = preg_replace($match, $replace, trim($this->message)); // Message length check. 0 disables this check completely. - if ($config['max_' . $mode . '_chars'] > 0) + if (phpbb::$config['max_' . $mode . '_chars'] > 0) { $msg_len = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)); - if ((!$msg_len && $mode !== 'sig') || $config['max_' . $mode . '_chars'] && $msg_len > $config['max_' . $mode . '_chars']) + if ((!$msg_len && $mode !== 'sig') || phpbb::$config['max_' . $mode . '_chars'] && $msg_len > phpbb::$config['max_' . $mode . '_chars']) { - $this->warn_msg[] = (!$msg_len) ? $user->lang['TOO_FEW_CHARS'] : sprintf($user->lang['TOO_MANY_CHARS_' . strtoupper($mode)], $msg_len, $config['max_' . $mode . '_chars']); + $this->warn_msg[] = (!$msg_len) ? $user->lang['TOO_FEW_CHARS'] : sprintf($user->lang['TOO_MANY_CHARS_' . strtoupper($mode)], $msg_len, phpbb::$config['max_' . $mode . '_chars']); return (!$update_this_message) ? $return_message : $this->warn_msg; } } @@ -1128,7 +1126,7 @@ class parse_message extends bbcode_firstpass // Parse smilies if ($allow_smilies) { - $this->smilies($config['max_' . $mode . '_smilies']); + $this->smilies(phpbb::$config['max_' . $mode . '_smilies']); } $num_urls = 0; @@ -1145,16 +1143,16 @@ class parse_message extends bbcode_firstpass { $this->magic_url(generate_board_url()); - if ($config['max_' . $mode . '_urls']) + if (phpbb::$config['max_' . $mode . '_urls']) { $num_urls += preg_match_all('#\<!-- ([lmwe]) --\>.*?\<!-- \1 --\>#', $this->message, $matches); } } // Check number of links - if ($config['max_' . $mode . '_urls'] && $num_urls > $config['max_' . $mode . '_urls']) + if (phpbb::$config['max_' . $mode . '_urls'] && $num_urls > phpbb::$config['max_' . $mode . '_urls']) { - $this->warn_msg[] = sprintf($user->lang['TOO_MANY_URLS'], $config['max_' . $mode . '_urls']); + $this->warn_msg[] = sprintf($user->lang['TOO_MANY_URLS'], phpbb::$config['max_' . $mode . '_urls']); return (!$update_this_message) ? $return_message : $this->warn_msg; } @@ -1309,7 +1307,7 @@ class parse_message extends bbcode_firstpass */ function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) { - global $config, $auth, $user, $db; + global $auth, $user, $db; $error = array(); @@ -1337,7 +1335,7 @@ class parse_message extends bbcode_firstpass } $cfg = array(); - $cfg['max_attachments'] = ($is_message) ? $config['max_attachments_pm'] : $config['max_attachments']; + $cfg['max_attachments'] = ($is_message) ? phpbb::$config['max_attachments_pm'] : phpbb::$config['max_attachments']; $forum_id = ($is_message) ? 0 : $forum_id; if ($submit && in_array($mode, array('post', 'reply', 'quote', 'edit')) && $upload_file) @@ -1497,7 +1495,7 @@ class parse_message extends bbcode_firstpass */ function get_submitted_attachment_data($check_user_id = false) { - global $user, $db, $config; + global $user, $db; $this->filename_data['filecomment'] = utf8_normalize_nfc(request_var('filecomment', '', true)); $attachment_data = phpbb_request::variable('attachment_data', array(0 => array('' => '')), true, phpbb_request::POST); @@ -1584,7 +1582,7 @@ class parse_message extends bbcode_firstpass */ function parse_poll(&$poll) { - global $auth, $user, $config; + global $auth, $user; $poll_max_options = $poll['poll_max_options']; @@ -1593,7 +1591,7 @@ class parse_message extends bbcode_firstpass $this->message = $poll['poll_option_text']; $bbcode_bitfield = $this->bbcode_bitfield; - $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false); + $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], (phpbb::$config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, phpbb::$config['allow_post_links'], false); $bbcode_bitfield = base64_encode(base64_decode($bbcode_bitfield) | base64_decode($this->bbcode_bitfield)); $this->message = $tmp_message; @@ -1616,7 +1614,7 @@ class parse_message extends bbcode_firstpass { $this->warn_msg[] = $user->lang['POLL_TITLE_TOO_LONG']; } - $poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false); + $poll['poll_title'] = $this->parse($poll['enable_bbcode'], (phpbb::$config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, phpbb::$config['allow_post_links'], false); if (strlen($poll['poll_title']) > 255) { $this->warn_msg[] = $user->lang['POLL_TITLE_COMP_TOO_LONG']; @@ -1631,7 +1629,7 @@ class parse_message extends bbcode_firstpass { $this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS']; } - else if ($poll['poll_options_size'] > (int) $config['max_poll_options']) + else if ($poll['poll_options_size'] > (int) phpbb::$config['max_poll_options']) { $this->warn_msg[] = $user->lang['TOO_MANY_POLL_OPTIONS']; } @@ -1640,7 +1638,7 @@ class parse_message extends bbcode_firstpass $this->warn_msg[] = $user->lang['TOO_MANY_USER_OPTIONS']; } - $poll['poll_max_options'] = ($poll['poll_max_options'] < 1) ? 1 : (($poll['poll_max_options'] > $config['max_poll_options']) ? $config['max_poll_options'] : $poll['poll_max_options']); + $poll['poll_max_options'] = ($poll['poll_max_options'] < 1) ? 1 : (($poll['poll_max_options'] > phpbb::$config['max_poll_options']) ? phpbb::$config['max_poll_options'] : $poll['poll_max_options']); } } diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 2e8aed4050..fdbd75b52b 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -36,9 +36,7 @@ class fulltext_mysql extends search_backend function __construct(&$error) { - global $config; - - $this->word_length = array('min' => $config['fulltext_mysql_min_word_len'], 'max' => $config['fulltext_mysql_max_word_len']); + $this->word_length = array('min' => phpbb::$config['fulltext_mysql_min_word_len'], 'max' => phpbb::$config['fulltext_mysql_max_word_len']); $error = false; } @@ -96,8 +94,6 @@ class fulltext_mysql extends search_backend */ public function split_keywords(&$keywords, $terms) { - global $config; - if ($terms == 'all') { $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#'); @@ -155,7 +151,7 @@ class fulltext_mysql extends search_backend // check word length $clean_len = utf8_strlen(str_replace('*', '', $clean_word)); - if (($clean_len < $config['fulltext_mysql_min_word_len']) || ($clean_len > $config['fulltext_mysql_max_word_len'])) + if (($clean_len < phpbb::$config['fulltext_mysql_min_word_len']) || ($clean_len > phpbb::$config['fulltext_mysql_max_word_len'])) { $this->common_words[] = $word; unset($this->split_words[$i]); @@ -210,8 +206,6 @@ class fulltext_mysql extends search_backend */ private function split_message($text) { - global $config; - // Split words $text = preg_replace('#([^\p{L}\p{N}\'*])#u', '$1$1', str_replace('\'\'', '\' \'', trim($text))); @@ -224,7 +218,7 @@ class fulltext_mysql extends search_backend for ($i = 0, $n = sizeof($text); $i < $n; $i++) { $text[$i] = trim($text[$i]); - if (utf8_strlen($text[$i]) < $config['fulltext_mysql_min_word_len'] || utf8_strlen($text[$i]) > $config['fulltext_mysql_max_word_len']) + if (utf8_strlen($text[$i]) < phpbb::$config['fulltext_mysql_min_word_len'] || utf8_strlen($text[$i]) > phpbb::$config['fulltext_mysql_max_word_len']) { unset($text[$i]); } @@ -256,7 +250,7 @@ class fulltext_mysql extends search_backend */ public function keyword_search($type, &$fields, &$terms, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page) { - global $config, $db; + global $db; // No keywords? No posts. if (!$this->search_query) @@ -369,7 +363,7 @@ class fulltext_mysql extends search_backend WHERE MATCH ($sql_match) AGAINST ('" . $db->sql_escape(htmlspecialchars_decode($this->search_query)) . "' IN BOOLEAN MODE) $sql_where_options ORDER BY $sql_sort"; - $result = $db->sql_query_limit($sql, $config['search_block_size'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['search_block_size'], $start); while ($row = $db->sql_fetchrow($result)) { @@ -415,7 +409,7 @@ class fulltext_mysql extends search_backend */ public function author_search($type, $firstpost_only, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page) { - global $config, $db; + global $db; // No author? No posts. if (!sizeof($author_ary)) @@ -524,7 +518,7 @@ class fulltext_mysql extends search_backend } // Only read one block of posts from the db and then cache it - $result = $db->sql_query_limit($sql, $config['search_block_size'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['search_block_size'], $start); while ($row = $db->sql_fetchrow($result)) { @@ -593,7 +587,7 @@ class fulltext_mysql extends search_backend */ public function tidy() { - global $db, $config; + global $db; // destroy too old cached search results $this->destroy_cache(array()); @@ -772,7 +766,7 @@ class fulltext_mysql extends search_backend */ function acp() { - global $user, $config; + global $user; $tpl = ''; diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 5ec2a9657d..e10b37f79c 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -46,9 +46,7 @@ class fulltext_native extends search_backend */ function __construct(&$error) { - global $config; - - $this->word_length = array('min' => $config['fulltext_native_min_chars'], 'max' => $config['fulltext_native_max_chars']); + $this->word_length = array('min' => phpbb::$config['fulltext_native_min_chars'], 'max' => phpbb::$config['fulltext_native_max_chars']); /** * Load the UTF tools @@ -404,7 +402,7 @@ class fulltext_native extends search_backend */ public function keyword_search($type, &$fields, &$terms, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page) { - global $config, $db; + global $db; // No keywords? No posts. if (empty($this->search_query)) @@ -702,7 +700,7 @@ class fulltext_native extends search_backend unset($sql_where, $sql_sort, $group_by); $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query_limit($sql, $config['search_block_size'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['search_block_size'], $start); while ($row = $db->sql_fetchrow($result)) { @@ -758,7 +756,7 @@ class fulltext_native extends search_backend */ public function author_search($type, $firstpost_only, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page) { - global $config, $db; + global $db; // No author? No posts. if (!sizeof($author_ary)) @@ -921,7 +919,7 @@ class fulltext_native extends search_backend } // Only read one block of posts from the db and then cache it - $result = $db->sql_query_limit($sql, $config['search_block_size'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['search_block_size'], $start); while ($row = $db->sql_fetchrow($result)) { @@ -1046,9 +1044,9 @@ class fulltext_native extends search_backend */ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) { - global $config, $db, $user; + global $db, $user; - if (!$config['fulltext_native_load_upd']) + if (!phpbb::$config['fulltext_native_load_upd']) { /** * The search indexer is disabled, return @@ -1100,7 +1098,7 @@ class fulltext_native extends search_backend // Get unique words from the above arrays $unique_add_words = array_unique(array_merge($words['add']['post'], $words['add']['title'])); - + // We now have unique arrays of all words to be added and removed and // individual arrays of added and removed words for text and title. What // we need to do now is add the new words (if they don't already exist) @@ -1265,11 +1263,11 @@ class fulltext_native extends search_backend */ public function tidy() { - global $db, $config; + global $db; // Is the fulltext indexer disabled? If yes then we need not // carry on ... it's okay ... I know when I'm not wanted boo hoo - if (!$config['fulltext_native_load_upd']) + if (!phpbb::$config['fulltext_native_load_upd']) { set_config('search_last_gc', time(), true); return; @@ -1278,13 +1276,13 @@ class fulltext_native extends search_backend $destroy_cache_words = array(); // Remove common words - if ($config['num_posts'] >= 100 && $config['fulltext_native_common_thres']) + if (phpbb::$config['num_posts'] >= 100 && phpbb::$config['fulltext_native_common_thres']) { - $common_threshold = ((double) $config['fulltext_native_common_thres']) / 100.0; + $common_threshold = ((double) phpbb::$config['fulltext_native_common_thres']) / 100.0; // First, get the IDs of common words $sql = 'SELECT word_id, word_text FROM ' . SEARCH_WORDLIST_TABLE . ' - WHERE word_count > ' . floor($config['num_posts'] * $common_threshold) . ' + WHERE word_count > ' . floor(phpbb::$config['num_posts'] * $common_threshold) . ' OR word_common = 1'; $result = $db->sql_query($sql); @@ -1631,7 +1629,7 @@ class fulltext_native extends search_backend */ public function acp() { - global $user, $config; + global $user; /** @@ -1641,19 +1639,19 @@ class fulltext_native extends search_backend $tpl = ' <dl> <dt><label for="fulltext_native_load_upd">' . $user->lang['YES_SEARCH_UPDATE'] . ':</label><br /><span>' . $user->lang['YES_SEARCH_UPDATE_EXPLAIN'] . '</span></dt> - <dd><label><input type="radio" id="fulltext_native_load_upd" name="config[fulltext_native_load_upd]" value="1"' . (($config['fulltext_native_load_upd']) ? ' checked="checked"' : '') . ' class="radio" /> ' . $user->lang['YES'] . '</label><label><input type="radio" name="config[fulltext_native_load_upd]" value="0"' . ((!$config['fulltext_native_load_upd']) ? ' checked="checked"' : '') . ' class="radio" /> ' . $user->lang['NO'] . '</label></dd> + <dd><label><input type="radio" id="fulltext_native_load_upd" name="config[fulltext_native_load_upd]" value="1"' . ((phpbb::$config['fulltext_native_load_upd']) ? ' checked="checked"' : '') . ' class="radio" /> ' . $user->lang['YES'] . '</label><label><input type="radio" name="config[fulltext_native_load_upd]" value="0"' . ((!phpbb::$config['fulltext_native_load_upd']) ? ' checked="checked"' : '') . ' class="radio" /> ' . $user->lang['NO'] . '</label></dd> </dl> <dl> <dt><label for="fulltext_native_min_chars">' . $user->lang['MIN_SEARCH_CHARS'] . ':</label><br /><span>' . $user->lang['MIN_SEARCH_CHARS_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_native_min_chars" type="text" size="3" maxlength="3" name="config[fulltext_native_min_chars]" value="' . (int) $config['fulltext_native_min_chars'] . '" /></dd> + <dd><input id="fulltext_native_min_chars" type="text" size="3" maxlength="3" name="config[fulltext_native_min_chars]" value="' . (int) phpbb::$config['fulltext_native_min_chars'] . '" /></dd> </dl> <dl> <dt><label for="fulltext_native_max_chars">' . $user->lang['MAX_SEARCH_CHARS'] . ':</label><br /><span>' . $user->lang['MAX_SEARCH_CHARS_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_native_max_chars" type="text" size="3" maxlength="3" name="config[fulltext_native_max_chars]" value="' . (int) $config['fulltext_native_max_chars'] . '" /></dd> + <dd><input id="fulltext_native_max_chars" type="text" size="3" maxlength="3" name="config[fulltext_native_max_chars]" value="' . (int) phpbb::$config['fulltext_native_max_chars'] . '" /></dd> </dl> <dl> <dt><label for="fulltext_native_common_thres">' . $user->lang['COMMON_WORD_THRESHOLD'] . ':</label><br /><span>' . $user->lang['COMMON_WORD_THRESHOLD_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_native_common_thres" type="text" size="3" maxlength="3" name="config[fulltext_native_common_thres]" value="' . (int) $config['fulltext_native_common_thres'] . '" /> %</dd> + <dd><input id="fulltext_native_common_thres" type="text" size="3" maxlength="3" name="config[fulltext_native_common_thres]" value="' . (int) phpbb::$config['fulltext_native_common_thres'] . '" /> %</dd> </dl> '; diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/search.php index f3a5cc363f..7fead1845c 100644 --- a/phpBB/includes/search/search.php +++ b/phpBB/includes/search/search.php @@ -152,9 +152,9 @@ class search_backend */ protected function save_ids($search_key, $keywords, $author_ary, $result_count, &$id_ary, $start, $sort_dir) { - global $config, $db, $user; + global $db, $user; - $length = min(sizeof($id_ary), $config['search_block_size']); + $length = min(sizeof($id_ary), phpbb::$config['search_block_size']); // nothing to cache so exit if (!$length) @@ -222,10 +222,10 @@ class search_backend $store += $store_ids; // if the cache is too big - if (sizeof($store) - 2 > 20 * $config['search_block_size']) + if (sizeof($store) - 2 > 20 * phpbb::$config['search_block_size']) { // remove everything in front of two blocks in front of the current start index - for ($i = 0, $n = $id_range[0] - 2 * $config['search_block_size']; $i < $n; $i++) + for ($i = 0, $n = $id_range[0] - 2 * phpbb::$config['search_block_size']; $i < $n; $i++) { if (isset($store[$i])) { @@ -235,7 +235,7 @@ class search_backend // remove everything after two blocks after the current stop index end($id_range); - for ($i = $store[-1] - 1, $n = current($id_range) + 2 * $config['search_block_size']; $i > $n; $i--) + for ($i = $store[-1] - 1, $n = current($id_range) + 2 * phpbb::$config['search_block_size']; $i > $n; $i--) { if (isset($store[$i])) { @@ -243,7 +243,7 @@ class search_backend } } } - phpbb::$acm->put('search_results_' . $search_key, $store, $config['search_store_results']); + phpbb::$acm->put('search_results_' . $search_key, $store, phpbb::$config['search_store_results']); $sql = 'UPDATE ' . SEARCH_RESULTS_TABLE . ' SET search_time = ' . time() . ' @@ -261,7 +261,7 @@ class search_backend */ public function destroy_cache($words, $authors = false) { - global $db, $config; + global $db; // clear all searches that searched for the specified words if (sizeof($words)) @@ -307,7 +307,7 @@ class search_backend $sql = 'DELETE FROM ' . SEARCH_RESULTS_TABLE . ' - WHERE search_time < ' . (time() - $config['search_store_results']); + WHERE search_time < ' . (time() - phpbb::$config['search_store_results']); $db->sql_query($sql); } } |