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 | |
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')
102 files changed, 1212 insertions, 1293 deletions
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index be11528a60..37d67d863f 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -89,7 +89,7 @@ adm_page_footer(); */ function adm_page_header($page_title) { - global $config, $db, $user, $template; + global $db, $user, $template; global $SID, $_SID; if (defined('HEADER_INC')) @@ -100,7 +100,7 @@ function adm_page_header($page_title) define('HEADER_INC', true); // gzip_compression - if ($config['gzip_compress']) + if (phpbb::$config['gzip_compress']) { if (@extension_loaded('zlib') && !headers_sent()) { @@ -126,12 +126,12 @@ function adm_page_header($page_title) 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS && !$user->data['is_bot']), 'T_IMAGES_PATH' => PHPBB_ROOT_PATH . 'images/', - 'T_SMILIES_PATH' => PHPBB_ROOT_PATH . $config['smilies_path'] . '/', - 'T_AVATAR_PATH' => PHPBB_ROOT_PATH . $config['avatar_path'] . '/', - 'T_AVATAR_GALLERY_PATH' => PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/', - 'T_ICONS_PATH' => PHPBB_ROOT_PATH . $config['icons_path'] . '/', - 'T_RANKS_PATH' => PHPBB_ROOT_PATH . $config['ranks_path'] . '/', - 'T_UPLOAD_PATH' => PHPBB_ROOT_PATH . $config['upload_path'] . '/', + 'T_SMILIES_PATH' => PHPBB_ROOT_PATH . phpbb::$config['smilies_path'] . '/', + 'T_AVATAR_PATH' => PHPBB_ROOT_PATH . phpbb::$config['avatar_path'] . '/', + 'T_AVATAR_GALLERY_PATH' => PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path'] . '/', + 'T_ICONS_PATH' => PHPBB_ROOT_PATH . phpbb::$config['icons_path'] . '/', + 'T_RANKS_PATH' => PHPBB_ROOT_PATH . phpbb::$config['ranks_path'] . '/', + 'T_UPLOAD_PATH' => PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/', 'ICON_MOVE_UP' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />', 'ICON_MOVE_UP_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />', @@ -166,7 +166,7 @@ function adm_page_header($page_title) */ function adm_page_footer($copyright_html = true) { - global $db, $config, $template, $user, $auth; + global $db, $template, $user, $auth; global $starttime; // Output page creation time @@ -180,7 +180,7 @@ function adm_page_footer($copyright_html = true) $db->sql_report('display'); } - $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); + $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ((phpbb::$config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); if ($auth->acl_get('a_') && defined('DEBUG_EXTRA')) { @@ -204,7 +204,7 @@ function adm_page_footer($copyright_html = true) 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'S_COPYRIGHT_HTML' => $copyright_html, - 'VERSION' => $config['version']) + 'VERSION' => phpbb::$config['version']) ); $template->display('body'); diff --git a/phpBB/cron.php b/phpBB/cron.php index aa16453002..b892084a55 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -34,17 +34,17 @@ echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw== // flush(); // -if (!isset($config['cron_lock'])) +if (!isset(phpbb::$config['cron_lock'])) { set_config('cron_lock', '0', true); } // make sure cron doesn't run multiple times in parallel -if ($config['cron_lock']) +if (phpbb::$config['cron_lock']) { // if the other process is running more than an hour already we have to assume it // aborted without cleaning the lock - $time = explode(' ', $config['cron_lock']); + $time = explode(' ', phpbb::$config['cron_lock']); $time = $time[0]; if ($time + 3600 >= time()) @@ -57,7 +57,7 @@ define('CRON_ID', time() . ' ' . unique_id()); $sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = '" . $db->sql_escape(CRON_ID) . "' - WHERE config_name = 'cron_lock' AND config_value = '" . $db->sql_escape($config['cron_lock']) . "'"; + WHERE config_name = 'cron_lock' AND config_value = '" . $db->sql_escape(phpbb::$config['cron_lock']) . "'"; $db->sql_query($sql); // another cron process altered the table between script start and UPDATE query so exit @@ -74,13 +74,13 @@ switch ($cron_type) { case 'queue': - if (time() - $config['queue_interval'] <= $config['last_queue_run'] || !file_exists(PHPBB_ROOT_PATH . 'cache/queue.' . PHP_EXT)) + if (time() - phpbb::$config['queue_interval'] <= phpbb::$config['last_queue_run'] || !file_exists(PHPBB_ROOT_PATH . 'cache/queue.' . PHP_EXT)) { break; } // A user reported using the mail() function while using shutdown does not work. We do not want to risk that. - if ($use_shutdown_function && !$config['smtp_delivery']) + if ($use_shutdown_function && !phpbb::$config['smtp_delivery']) { $use_shutdown_function = false; } @@ -101,7 +101,7 @@ switch ($cron_type) case 'tidy_cache': - if (time() - $config['cache_gc'] <= $config['cache_last_gc'] || !method_exists(phpbb::$acm, 'tidy')) + if (time() - phpbb::$config['cache_gc'] <= phpbb::$config['cache_last_gc'] || !method_exists(phpbb::$acm, 'tidy')) { break; } @@ -120,9 +120,9 @@ switch ($cron_type) case 'tidy_search': // Select the search method - $search_type = basename($config['search_type']); + $search_type = basename(phpbb::$config['search_type']); - if (time() - $config['search_gc'] <= $config['search_last_gc'] || !file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) + if (time() - phpbb::$config['search_gc'] <= phpbb::$config['search_last_gc'] || !file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) { break; } @@ -151,7 +151,7 @@ switch ($cron_type) case 'tidy_warnings': - if (time() - $config['warnings_gc'] <= $config['warnings_last_gc']) + if (time() - phpbb::$config['warnings_gc'] <= phpbb::$config['warnings_last_gc']) { break; } @@ -171,7 +171,7 @@ switch ($cron_type) case 'tidy_database': - if (time() - $config['database_gc'] <= $config['database_last_gc']) + if (time() - phpbb::$config['database_gc'] <= phpbb::$config['database_last_gc']) { break; } @@ -191,7 +191,7 @@ switch ($cron_type) case 'tidy_sessions': - if (time() - $config['session_gc'] <= $config['session_last_gc']) + if (time() - phpbb::$config['session_gc'] <= phpbb::$config['session_last_gc']) { break; } diff --git a/phpBB/develop/repair_bots.php b/phpBB/develop/repair_bots.php index 6d3e57da57..dc38726e7c 100644 --- a/phpBB/develop/repair_bots.php +++ b/phpBB/develop/repair_bots.php @@ -94,7 +94,7 @@ echo 'done'; */ function add_bots($bots) { - global $db, $config; + global $db; $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'"; $result = $db->sql_query($sql); @@ -126,7 +126,7 @@ function add_bots($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, diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php index 23acee6a1a..af2dd6a288 100644 --- a/phpBB/develop/search_fill.php +++ b/phpBB/develop/search_fill.php @@ -32,7 +32,7 @@ $user->session_begin(); $auth->acl($user->data); $user->setup(); -$search_type = $config['search_type']; +$search_type = phpbb::$config['search_type']; if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) { @@ -76,7 +76,7 @@ for(;$postcounter <= $max_post_id; $postcounter += $batchsize) $batchstart = $postcounter + 1; $batchend = $postcounter + $batchsize; $batchcount++; - + $sql = "SELECT * FROM " . POSTS_TABLE . " WHERE post_id @@ -92,7 +92,7 @@ for(;$postcounter <= $max_post_id; $postcounter += $batchsize) $db->sql_freeresult($result); $post_rows = sizeof($rowset); - + if( $post_rows ) { diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 820063bae2..4c67b1defb 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -809,7 +809,7 @@ $sql_array = array( 'ORDER_BY' => 'left_id' ); -if ($config['load_db_lastread']) +if (phpbb::$config['load_db_lastread']) { $sql_array['LEFT_JOIN'] = array( array( diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 9dfdf6a5ae..ba4cd1651d 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -14,8 +14,7 @@ define('IN_PHPBB', true); if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../'); if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); -include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); - +include(PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT); // Thank you sun. if (isset($_SERVER['CONTENT_TYPE'])) @@ -35,7 +34,7 @@ if (phpbb_request::is_set('avatar', phpbb_request::GET)) // worst-case default $browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0'; - $config = phpbb_cache::obtain_config(); + phpbb::$config = phpbb_cache::obtain_config(); $filename = phpbb_request::variable('avatar', '', false, phpbb_request::GET); $avatar_group = false; $exit = false; @@ -98,7 +97,7 @@ if (!$download_id) trigger_error('NO_ATTACHMENT_SELECTED'); } -if (!$config['allow_attachments'] && !$config['allow_pm_attach']) +if (!phpbb::$config['allow_attachments'] && !phpbb::$config['allow_pm_attach']) { trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED'); } @@ -115,7 +114,7 @@ if (!$attachment) trigger_error('ERROR_NO_ATTACHMENT'); } -if ((!$attachment['in_message'] && !$config['allow_attachments']) || ($attachment['in_message'] && !$config['allow_pm_attach'])) +if ((!$attachment['in_message'] && !phpbb::$config['allow_attachments']) || ($attachment['in_message'] && !phpbb::$config['allow_pm_attach'])) { trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED'); } @@ -262,17 +261,17 @@ else if ($download_mode == PHYSICAL_LINK) { // This presenting method should no longer be used - if (!@is_dir(PHPBB_ROOT_PATH . $config['upload_path'])) + if (!@is_dir(PHPBB_ROOT_PATH . phpbb::$config['upload_path'])) { trigger_error($user->lang['PHYSICAL_DOWNLOAD_NOT_POSSIBLE']); } - redirect(PHPBB_ROOT_PATH . $config['upload_path'] . '/' . $attachment['physical_filename']); + redirect(PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/' . $attachment['physical_filename']); file_gc(); } else { - send_file_to_browser($attachment, $config['upload_path'], $display_cat); + send_file_to_browser($attachment, phpbb::$config['upload_path'], $display_cat); file_gc(); } } @@ -284,10 +283,8 @@ else */ function send_avatar_to_browser($file, $browser) { - global $config; - - $prefix = $config['avatar_salt'] . '_'; - $image_dir = $config['avatar_path']; + $prefix = phpbb::$config['avatar_salt'] . '_'; + $image_dir = phpbb::$config['avatar_path']; // Adjust image_dir path (no trailing slash) if (substr($image_dir, -1, 1) == '/' || substr($image_dir, -1, 1) == '\\') @@ -382,7 +379,7 @@ function wrap_img_in_html($src, $title) */ function send_file_to_browser($attachment, $upload_dir, $category) { - global $user, $db, $config; + global $user, $db; $filename = PHPBB_ROOT_PATH . $upload_dir . '/' . $attachment['physical_filename']; @@ -515,9 +512,9 @@ function header_filename($file) */ function download_allowed() { - global $config, $user, $db; + global $user, $db; - if (!$config['secure_downloads']) + if (!phpbb::$config['secure_downloads']) { return true; } @@ -526,7 +523,7 @@ function download_allowed() if (!$url) { - return ($config['secure_allow_empty_referer']) ? true : false; + return (phpbb::$config['secure_allow_empty_referer']) ? true : false; } // Split URL into domain and script part @@ -534,13 +531,13 @@ function download_allowed() if ($url === false) { - return ($config['secure_allow_empty_referer']) ? true : false; + return (phpbb::$config['secure_allow_empty_referer']) ? true : false; } $hostname = $url['host']; unset($url); - $allowed = ($config['secure_allow_deny']) ? false : true; + $allowed = (phpbb::$config['secure_allow_deny']) ? false : true; $iplist = array(); if (($ip_ary = @gethostbynamel($hostname)) !== false) @@ -558,9 +555,9 @@ function download_allowed() $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']; } if (preg_match('#^.*?' . preg_quote($server_name, '#') . '.*?$#i', $hostname)) @@ -588,12 +585,12 @@ function download_allowed() { if ($row['ip_exclude']) { - $allowed = ($config['secure_allow_deny']) ? false : true; + $allowed = (phpbb::$config['secure_allow_deny']) ? false : true; break 2; } else { - $allowed = ($config['secure_allow_deny']) ? true : false; + $allowed = (phpbb::$config['secure_allow_deny']) ? true : false; } } } @@ -605,12 +602,12 @@ function download_allowed() { if ($row['ip_exclude']) { - $allowed = ($config['secure_allow_deny']) ? false : true; + $allowed = (phpbb::$config['secure_allow_deny']) ? false : true; break; } else { - $allowed = ($config['secure_allow_deny']) ? true : false; + $allowed = (phpbb::$config['secure_allow_deny']) ? true : false; } } } 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); } } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 996deb0339..67794221a6 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -371,23 +371,15 @@ header('Content-type: text/html; charset=UTF-8'); <?php // To let set_config() calls succeed, we need to make the config array available globally -$config = array(); -$sql = 'SELECT * - FROM ' . CONFIG_TABLE; -$result = $db->sql_query($sql); - -while ($row = $db->sql_fetchrow($result)) -{ - $config[$row['config_name']] = $row['config_value']; -} -$db->sql_freeresult($result); +phpbb::$acm->destroy('#config'); +$config = phpbb_cache::obtain_config(); -echo $lang['PREVIOUS_VERSION'] . ' :: <strong>' . $config['version'] . '</strong><br />'; +echo $lang['PREVIOUS_VERSION'] . ' :: <strong>' . phpbb::$config['version'] . '</strong><br />'; echo $lang['UPDATED_VERSION'] . ' :: <strong>' . $updates_to_version . '</strong></p>'; -$current_version = str_replace('rc', 'RC', strtolower($config['version'])); +$current_version = str_replace('rc', 'RC', strtolower(phpbb::$config['version'])); $latest_version = str_replace('rc', 'RC', strtolower($updates_to_version)); -$orig_version = $config['version']; +$orig_version = phpbb::$config['version']; // If the latest version and the current version are 'unequal', we will update the version_update_from, else we do not update anything. if ($inline_update) @@ -708,7 +700,7 @@ if (function_exists('exit_handler')) */ function change_database_data($version) { - global $db, $map_dbms, $errored, $error_ary, $config; + global $db, $map_dbms, $errored, $error_ary; switch ($version) { diff --git a/phpBB/install/index.php b/phpBB/install/index.php index ac8796feb2..407ccec4db 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -243,9 +243,7 @@ $auth = new auth(); $template = new template(); // Set some standard variables we want to force -$config = array( - 'load_tplcompile' => '1' -); +phpbb::$config['load_tplcompile'] = '1'; $template->set_custom_template('../adm/style', 'admin'); $template->assign_var('T_TEMPLATE_PATH', '../adm/style'); @@ -284,7 +282,7 @@ class module */ function create($module_type, $module_url, $selected_mod = false, $selected_submod = false) { - global $db, $config; + global $db; $module = array(); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 7e93f008f6..d38b833204 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1438,7 +1438,7 @@ class install_install extends module */ function build_search_index($mode, $sub) { - global $db, $lang, $config; + global $db, $lang; // Obtain any submitted data $data = $this->get_submitted_data(); @@ -1468,7 +1468,7 @@ class install_install extends module include_once(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); include_once(PHPBB_ROOT_PATH . 'includes/search/fulltext_native.' . PHP_EXT); - // Fill the config array - it is needed by those functions we call + /* Fill the config array - it is needed by those functions we call $sql = 'SELECT * FROM ' . CONFIG_TABLE; $result = $db->sql_query($sql); @@ -1479,7 +1479,7 @@ class install_install extends module $config[$row['config_name']] = $row['config_value']; } $db->sql_freeresult($result); - +*/ $error = false; $search = new fulltext_native($error); @@ -1833,7 +1833,7 @@ class install_install extends module */ function add_bots($mode, $sub) { - global $db, $lang, $config; + global $db, $lang; // Obtain any submitted data $data = $this->get_submitted_data(); @@ -1843,13 +1843,6 @@ class install_install extends module FROM ' . CONFIG_TABLE; $result = $db->sql_query($sql); - $config = array(); - while ($row = $db->sql_fetchrow($result)) - { - $config[$row['config_name']] = $row['config_value']; - } - $db->sql_freeresult($result); - $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name_clean = 'bots'"; @@ -1911,7 +1904,7 @@ class install_install extends module */ function email_admin($mode, $sub) { - global $auth, $config, $db, $lang, $template, $user; + global $auth, $db, $lang, $template, $user; $this->page_title = $lang['STAGE_FINAL']; @@ -1922,13 +1915,6 @@ class install_install extends module FROM ' . CONFIG_TABLE; $result = $db->sql_query($sql); - $config = array(); - while ($row = $db->sql_fetchrow($result)) - { - $config[$row['config_name']] = $row['config_value']; - } - $db->sql_freeresult($result); - $user->session_begin(); $auth->login($data['admin_name'], $data['admin_pass1'], false, true, true); @@ -1937,7 +1923,7 @@ class install_install extends module // So it's time to send an email to the administrator confirming the details // they entered - if ($config['email_enable']) + if (phpbb::$config['email_enable']) { include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); @@ -1947,7 +1933,7 @@ class install_install extends module $messenger->to($data['board_email1'], $data['admin_name']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); @@ -1961,11 +1947,11 @@ class install_install extends module } // And finally, add a note to the log - add_log('admin', 'LOG_INSTALL_INSTALLED', $config['version']); + add_log('admin', 'LOG_INSTALL_INSTALLED', phpbb::$config['version']); $template->assign_vars(array( 'TITLE' => $lang['INSTALL_CONGRATS'], - 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid('install/index', 'mode=convert&language=' . $data['language']), '../docs/README.html'), + 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], phpbb::$config['version'], append_sid('install/index', 'mode=convert&language=' . $data['language']), '../docs/README.html'), 'L_SUBMIT' => $lang['INSTALL_LOGIN'], 'U_ACTION' => append_sid('adm/index'), )); diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index a396c04dc5..4da795bb4b 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -70,7 +70,7 @@ class install_update extends module function main($mode, $sub) { - global $template, $user, $db, $config, $auth; + global $template, $user, $db, $auth; $this->tpl_name = 'install_update'; $this->page_title = 'UPDATE_INSTALLATION'; @@ -98,20 +98,8 @@ class install_update extends module // We do not need this any longer, unset for safety purposes unset($dbpasswd); - $config = array(); - - $sql = 'SELECT config_name, config_value - FROM ' . CONFIG_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $config[$row['config_name']] = $row['config_value']; - } - $db->sql_freeresult($result); - // Force template recompile - $config['load_tplcompile'] = 1; + phpbb::$config['load_tplcompile'] = 1; // First of all, init the user session $user->session_begin(); @@ -140,7 +128,7 @@ class install_update extends module } // For the current version we trick a bit. ;) - $this->current_version = (!empty($config['version_update_from'])) ? $config['version_update_from'] : $config['version']; + $this->current_version = (!empty(phpbb::$config['version_update_from'])) ? phpbb::$config['version_update_from'] : phpbb::$config['version']; $up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->latest_version)), '<')) ? false : true; @@ -149,7 +137,7 @@ class install_update extends module { $template->assign_vars(array( 'S_ERROR' => true, - 'ERROR_MSG' => ($up_to_date) ? $user->lang['NO_UPDATE_FILES_UP_TO_DATE'] : sprintf($user->lang['NO_UPDATE_FILES_OUTDATED'], $config['version'], $this->current_version, $this->latest_version)) + 'ERROR_MSG' => ($up_to_date) ? $user->lang['NO_UPDATE_FILES_UP_TO_DATE'] : sprintf($user->lang['NO_UPDATE_FILES_OUTDATED'], phpbb::$config['version'], $this->current_version, $this->latest_version)) ); return; @@ -163,7 +151,7 @@ class install_update extends module { $template->assign_vars(array( 'S_ERROR' => true, - 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $config['version'], $this->update_info['version']['from'], $this->update_info['version']['to'])) + 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], phpbb::$config['version'], $this->update_info['version']['from'], $this->update_info['version']['to'])) ); return; @@ -278,7 +266,7 @@ class install_update extends module // Redirect the user to the database update script with some explanations... $template->assign_vars(array( 'S_DB_UPDATE' => true, - 'S_DB_UPDATE_FINISHED' => ($config['version'] == $this->update_info['version']['to']) ? true : false, + 'S_DB_UPDATE_FINISHED' => (phpbb::$config['version'] == $this->update_info['version']['to']) ? true : false, 'U_DB_UPDATE' => append_sid('install/database_update', 'type=1&language=' . $user->data['user_lang']), 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_db"), 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check"), @@ -785,7 +773,7 @@ class install_update extends module // To ease the update process create a file location map $update_list = phpbb::$acm->get('update_list'); - $script_path = ($config['force_server_vars']) ? (($config['script_path'] == '/') ? '/' : $config['script_path'] . '/') : $user->page['root_script_path']; + $script_path = (phpbb::$config['force_server_vars']) ? ((phpbb::$config['script_path'] == '/') ? '/' : phpbb::$config['script_path'] . '/') : $user->page['root_script_path']; foreach ($update_list as $status => $files) { diff --git a/phpBB/mcp.php b/phpBB/mcp.php index ab48cc69ba..db77fee8c8 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -332,7 +332,7 @@ function extra_url() */ function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false) { - global $auth, $db, $config, $user; + global $auth, $db, $user; static $rowset = array(); $topics = array(); @@ -373,7 +373,7 @@ function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false) 'WHERE' => $db->sql_in_set('t.topic_id', $topic_ids) ); - if ($read_tracking && $config['load_db_lastread']) + if ($read_tracking && phpbb::$config['load_db_lastread']) { $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time'; @@ -427,7 +427,7 @@ function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false) */ function get_post_data($post_ids, $acl_list = false, $read_tracking = false) { - global $db, $auth, $config, $user; + global $db, $auth, $user; $rowset = array(); @@ -457,7 +457,7 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false) AND t.topic_id = p.topic_id', ); - if ($read_tracking && $config['load_db_lastread']) + if ($read_tracking && phpbb::$config['load_db_lastread']) { $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time'; @@ -507,7 +507,7 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false) */ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false) { - global $auth, $db, $user, $config; + global $auth, $db, $user; $rowset = array(); @@ -521,7 +521,7 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false) return array(); } - if ($read_tracking && $config['load_db_lastread']) + if ($read_tracking && phpbb::$config['load_db_lastread']) { $read_tracking_join = ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id)'; diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 46c4734b6f..b646094050 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -251,7 +251,7 @@ switch ($mode) 'RANK_IMG_SRC' => $rank_img_src, 'U_GROUP' => $u_group, - 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid('ucp', 'i=pm&mode=compose&u=' . $row['user_id']) : '', + 'U_PM' => (phpbb::$config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid('ucp', 'i=pm&mode=compose&u=' . $row['user_id']) : '', 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), @@ -296,7 +296,7 @@ switch ($mode) case 'jabber': $lang = 'JABBER'; $sql_field = 'user_jabber'; - $s_select = (@extension_loaded('xml') && $config['jab_enable']) ? 'S_SEND_JABBER' : 'S_NO_SEND_JABBER'; + $s_select = (@extension_loaded('xml') && phpbb::$config['jab_enable']) ? 'S_SEND_JABBER' : 'S_NO_SEND_JABBER'; $s_action = append_sid('memberlist', "mode=contact&action=$action&u=$user_id"); break; @@ -329,14 +329,14 @@ switch ($mode) case 'jabber': add_form_key('memberlist_messaging'); - if ($submit && @extension_loaded('xml') && $config['jab_enable']) + if ($submit && @extension_loaded('xml') && phpbb::$config['jab_enable']) { if (check_form_key('memberlist_messaging')) { include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); - $subject = sprintf($user->lang['IM_JABBER_SUBJECT'], $user->data['username'], $config['server_name']); + $subject = sprintf($user->lang['IM_JABBER_SUBJECT'], $user->data['username'], phpbb::$config['server_name']); $message = utf8_normalize_nfc(request_var('message', '', true)); if (empty($message)) @@ -353,7 +353,7 @@ switch ($mode) $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( - 'BOARD_CONTACT' => $config['board_contact'], + 'BOARD_CONTACT' => phpbb::$config['board_contact'], 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), 'TO_USERNAME' => htmlspecialchars_decode($row['username']), 'MESSAGE' => htmlspecialchars_decode($message)) @@ -377,11 +377,11 @@ switch ($mode) 'A_IM_CONTACT' => addslashes($row[$sql_field]), 'U_AIM_CONTACT' => ($action == 'aim') ? 'aim:addbuddy?screenname=' . urlencode($row[$sql_field]) : '', - 'U_AIM_MESSAGE' => ($action == 'aim') ? 'aim:goim?screenname=' . urlencode($row[$sql_field]) . '&message=' . urlencode($config['sitename']) : '', + 'U_AIM_MESSAGE' => ($action == 'aim') ? 'aim:goim?screenname=' . urlencode($row[$sql_field]) . '&message=' . urlencode(phpbb::$config['sitename']) : '', 'USERNAME' => $row['username'], 'CONTACT_NAME' => $row[$sql_field], - 'SITENAME' => $config['sitename'], + 'SITENAME' => phpbb::$config['sitename'], 'PRESENCE_IMG' => $presence_img, @@ -458,7 +458,7 @@ switch ($mode) $friend = ($row['friend']) ? true : false; $db->sql_freeresult($result); - if ($config['load_onlinetrack']) + if (phpbb::$config['load_onlinetrack']) { $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline FROM ' . SESSIONS_TABLE . " @@ -472,7 +472,7 @@ switch ($mode) unset($row); } - if ($config['load_user_activity']) + if (phpbb::$config['load_user_activity']) { display_user_activity($member); } @@ -480,7 +480,7 @@ switch ($mode) // Do the relevant calculations $memberdays = max(1, round((time() - $member['user_regdate']) / 86400)); $posts_per_day = $member['user_posts'] / $memberdays; - $percentage = ($config['num_posts']) ? min(100, ($member['user_posts'] / $config['num_posts']) * 100) : 0; + $percentage = (phpbb::$config['num_posts']) ? min(100, ($member['user_posts'] / phpbb::$config['num_posts']) * 100) : 0; if ($member['user_sig']) @@ -504,7 +504,7 @@ switch ($mode) // Custom Profile Fields $profile_fields = array(); - if ($config['load_cpf_viewprofile']) + if (phpbb::$config['load_cpf_viewprofile']) { include_once(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); $cp = new custom_profile(); @@ -640,7 +640,7 @@ switch ($mode) add_form_key('memberlist_email'); - if (!$config['email_enable']) + if (!phpbb::$config['email_enable']) { trigger_error('EMAIL_DISABLED'); } @@ -651,7 +651,7 @@ switch ($mode) } // Are we trying to abuse the facility? - if (time() - $user->data['user_emailtime'] < $config['flood_interval']) + if (time() - $user->data['user_emailtime'] < phpbb::$config['flood_interval']) { trigger_error('FLOOD_EMAIL_LIMIT'); } @@ -663,7 +663,7 @@ switch ($mode) // Send email to user... if ($user_id) { - if ($user_id == ANONYMOUS || !$config['board_email_form']) + if ($user_id == ANONYMOUS || !phpbb::$config['board_email_form']) { trigger_error('NO_EMAIL'); } @@ -738,7 +738,7 @@ switch ($mode) $name = utf8_normalize_nfc(request_var('name', '', true)); $email = request_var('email', ''); - $email_lang = request_var('lang', $config['default_lang']); + $email_lang = request_var('lang', phpbb::$config['default_lang']); $subject = utf8_normalize_nfc(request_var('subject', '', true)); $message = utf8_normalize_nfc(request_var('message', '', true)); $cc = phpbb_request::is_set_post('cc_email'); @@ -837,13 +837,13 @@ switch ($mode) $notify_type = NOTIFY_EMAIL; } - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( - 'BOARD_CONTACT' => $config['board_contact'], + 'BOARD_CONTACT' => phpbb::$config['board_contact'], 'TO_USERNAME' => htmlspecialchars_decode($row['to_name']), 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), 'MESSAGE' => htmlspecialchars_decode($message)) @@ -948,7 +948,7 @@ switch ($mode) // We validate form and field here, only id/class allowed $form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form; $field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field; - if (($mode == 'searchuser' || sizeof(array_intersect(phpbb_request::variable_names(phpbb_request::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) + if (($mode == 'searchuser' || sizeof(array_intersect(phpbb_request::variable_names(phpbb_request::GET), $search_params)) > 0) && (phpbb::$config['load_search'] || $auth->acl_get('a_'))) { $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); @@ -1138,8 +1138,8 @@ switch ($mode) { $rank_title = $ranks['special'][$group_row['group_rank']]['rank_title']; } - $rank_img = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? '<img src="' . $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] . '" alt="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" title="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" /><br />' : ''; - $rank_img_src = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] : ''; + $rank_img = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? '<img src="' . phpbb::$config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] . '" alt="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" title="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" /><br />' : ''; + $rank_img_src = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? phpbb::$config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] : ''; } else { @@ -1159,7 +1159,7 @@ switch ($mode) 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, - 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid('ucp', 'i=pm&mode=compose&g=' . $group_id) : '',) + 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && phpbb::$config['allow_privmsg'] && phpbb::$config['allow_mass_pm']) ? append_sid('ucp', 'i=pm&mode=compose&g=' . $group_id) : '',) ); $sql_select = ', ug.group_leader'; @@ -1197,7 +1197,7 @@ switch ($mode) } else { - $total_users = $config['num_users']; + $total_users = phpbb::$config['num_users']; } $s_char_options = '<option value=""' . ((!$first_char) ? ' selected="selected"' : '') . '> </option>'; @@ -1265,7 +1265,7 @@ switch ($mode) unset($search_params, $sort_params); // Some search user specific data - if ($mode == 'searchuser' && ($config['load_search'] || $auth->acl_get('a_'))) + if ($mode == 'searchuser' && (phpbb::$config['load_search'] || $auth->acl_get('a_'))) { $group_selected = request_var('search_group_id', 0); $s_group_select = '<option value="0"' . ((!$group_selected) ? ' selected="selected"' : '') . '> </option>'; @@ -1280,7 +1280,7 @@ switch ($mode) $sql = 'SELECT group_id, group_name, group_type FROM ' . GROUPS_TABLE; - if (!$config['coppa_enable']) + if (!phpbb::$config['coppa_enable']) { $sql .= " WHERE group_name <> 'REGISTERED_COPPA'"; } @@ -1299,7 +1299,7 @@ switch ($mode) ) WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; - if (!$config['coppa_enable']) + if (!phpbb::$config['coppa_enable']) { $sql .= " AND g.group_name <> 'REGISTERED_COPPA'"; } @@ -1355,7 +1355,7 @@ switch ($mode) WHERE u.user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ") $sql_where ORDER BY $order_by"; - $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $user_list = array(); while ($row = $db->sql_fetchrow($result)) @@ -1370,7 +1370,7 @@ switch ($mode) // Session time?! Session time... $sql = 'SELECT session_user_id, MAX(session_time) AS session_time FROM ' . SESSIONS_TABLE . ' - WHERE session_time >= ' . (time() - $config['session_length']) . ' + WHERE session_time >= ' . (time() - phpbb::$config['session_length']) . ' AND ' . $db->sql_in_set('session_user_id', $user_list) . ' GROUP BY session_user_id'; $result = $db->sql_query($sql); @@ -1411,7 +1411,7 @@ switch ($mode) $db->sql_freeresult($result); // Load custom profile fields - if ($config['load_cpf_memberlist']) + if (phpbb::$config['load_cpf_memberlist']) { include_once(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); $cp = new custom_profile(); @@ -1435,7 +1435,7 @@ switch ($mode) $leaders_set = ($leaders_set || $is_leader); $cp_row = array(); - if ($config['load_cpf_memberlist']) + if (phpbb::$config['load_cpf_memberlist']) { $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$user_id]) : array(); } @@ -1470,8 +1470,8 @@ switch ($mode) // Generate page $template->assign_vars(array( - 'PAGINATION' => generate_pagination($pagination_url, $total_users, $config['topics_per_page'], $start), - 'PAGE_NUMBER' => on_page($total_users, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($pagination_url, $total_users, phpbb::$config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($total_users, phpbb::$config['topics_per_page'], $start), 'TOTAL_USERS' => ($total_users == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $total_users), 'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']), @@ -1485,7 +1485,7 @@ switch ($mode) 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), - 'U_FIND_MEMBER' => ($config['load_search'] || $auth->acl_get('a_')) ? append_sid('memberlist', 'mode=searchuser' . (($start) ? "&start=$start" : '') . (!empty($params) ? '&' . implode('&', $params) : '')) : '', + 'U_FIND_MEMBER' => (phpbb::$config['load_search'] || $auth->acl_get('a_')) ? append_sid('memberlist', 'mode=searchuser' . (($start) ? "&start=$start" : '') . (!empty($params) ? '&' . implode('&', $params) : '')) : '', 'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser') ? $u_hide_find_member : '', 'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), 'U_SORT_FROM' => $sort_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'), @@ -1527,7 +1527,7 @@ page_footer(); */ function show_profile($data) { - global $config, $auth, $template, $user; + global $auth, $template, $user; $username = $data['username']; $user_id = $data['user_id']; @@ -1537,16 +1537,16 @@ function show_profile($data) if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_email')) { - $email = ($config['board_email_form'] && $config['email_enable']) ? append_sid('memberlist', 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $data['user_email']); + $email = (phpbb::$config['board_email_form'] && phpbb::$config['email_enable']) ? append_sid('memberlist', 'mode=email&u=' . $user_id) : ((phpbb::$config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $data['user_email']); } else { $email = ''; } - if ($config['load_onlinetrack']) + if (phpbb::$config['load_onlinetrack']) { - $update_time = $config['load_online_time'] * 60; + $update_time = phpbb::$config['load_online_time'] * 60; $online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; } else @@ -1565,7 +1565,7 @@ function show_profile($data) $age = ''; - if ($config['allow_birthdays'] && $data['user_birthday']) + if (phpbb::$config['allow_birthdays'] && $data['user_birthday']) { list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday'])); @@ -1604,17 +1604,17 @@ function show_profile($data) 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])), 'AVATAR_IMG' => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']), - 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), - 'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false, + 'ONLINE_IMG' => (!phpbb::$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'S_ONLINE' => (phpbb::$config['load_onlinetrack'] && $online) ? true : false, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'ICQ_STATUS_IMG' => (!empty($data['user_icq'])) ? '<img src="http://web.icq.com/whitepages/online?icq=' . $data['user_icq'] . '&img=5" width="18" height="18" />' : '', - 'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false, + 'S_JABBER_ENABLED' => (phpbb::$config['jab_enable']) ? true : false, 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid('search', "author_id=$user_id&sr=posts") : '', 'U_NOTES' => $auth->acl_getf_global('m_') ? append_sid('mcp', 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', 'U_WARN' => $auth->acl_get('m_warn') ? append_sid('mcp', 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', - 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid('ucp', 'i=pm&mode=compose&u=' . $user_id) : '', + 'U_PM' => (phpbb::$config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid('ucp', 'i=pm&mode=compose&u=' . $user_id) : '', 'U_EMAIL' => $email, 'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '', 'U_ICQ' => ($data['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($data['user_icq']) : '', diff --git a/phpBB/modules/acp/acp_attachments.php b/phpBB/modules/acp/acp_attachments.php index a447ffd923..5e8e28a1ed 100644 --- a/phpBB/modules/acp/acp_attachments.php +++ b/phpBB/modules/acp/acp_attachments.php @@ -26,7 +26,7 @@ class acp_attachments function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); @@ -127,7 +127,7 @@ class acp_attachments ) ); - $this->new_config = $config; + $this->new_config = phpbb::$config; $cfg_array = (phpbb_request::is_set('config')) ? request_var('config', array('' => '')) : $this->new_config; $error = array(); @@ -517,7 +517,7 @@ class acp_attachments $max_filesize = ($size_select == 'kb') ? round($max_filesize * 1024) : (($size_select == 'mb') ? round($max_filesize * 1048576) : $max_filesize); $allow_group = phpbb_request::is_set_post('allow_group'); - if ($max_filesize == $config['max_filesize']) + if ($max_filesize == phpbb::$config['max_filesize']) { $max_filesize = 0; } @@ -684,13 +684,13 @@ class acp_attachments if ($ext_group_row['max_filesize'] == 0) { - $ext_group_row['max_filesize'] = (int) $config['max_filesize']; + $ext_group_row['max_filesize'] = (int) phpbb::$config['max_filesize']; } $size_format = ($ext_group_row['max_filesize'] >= 1048576) ? 'mb' : (($ext_group_row['max_filesize'] >= 1024) ? 'kb' : 'b'); $ext_group_row['max_filesize'] = get_formatted_filesize($ext_group_row['max_filesize'], false); - $img_path = $config['upload_icons_path']; + $img_path = phpbb::$config['upload_icons_path']; $filename_list = ''; $no_image_select = false; @@ -1006,8 +1006,8 @@ class acp_attachments if ($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); } } } diff --git a/phpBB/modules/acp/acp_ban.php b/phpBB/modules/acp/acp_ban.php index c6ce71371d..60f38c8e77 100644 --- a/phpBB/modules/acp/acp_ban.php +++ b/phpBB/modules/acp/acp_ban.php @@ -25,7 +25,7 @@ class acp_ban function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); diff --git a/phpBB/modules/acp/acp_bbcodes.php b/phpBB/modules/acp/acp_bbcodes.php index b76d4f5e27..cd10558261 100644 --- a/phpBB/modules/acp/acp_bbcodes.php +++ b/phpBB/modules/acp/acp_bbcodes.php @@ -25,7 +25,7 @@ class acp_bbcodes function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('acp/posting'); diff --git a/phpBB/modules/acp/acp_board.php b/phpBB/modules/acp/acp_board.php index b428ef12d7..bc2dc2821c 100644 --- a/phpBB/modules/acp/acp_board.php +++ b/phpBB/modules/acp/acp_board.php @@ -27,7 +27,7 @@ class acp_board function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('acp/board'); @@ -370,7 +370,7 @@ class acp_board $user->add_lang($display_vars['lang']); } - $this->new_config = $config; + $this->new_config = phpbb::$config; $cfg_array = (phpbb_request::is_set('config')) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config; $error = array(); @@ -452,7 +452,7 @@ class acp_board // Check if we need to create config fields for this plugin and save config when submit was pressed foreach ($fields['config'] as $field) { - if (!isset($config[$field])) + if (!isset(phpbb::$config[$field])) { set_config($field, ''); } @@ -689,10 +689,10 @@ class acp_board */ function select_acc_activation($value, $key = '') { - global $user, $config; + global $user; $radio_ary = array(USER_ACTIVATION_DISABLE => 'ACC_DISABLE', USER_ACTIVATION_NONE => 'ACC_NONE'); - if ($config['email_enable']) + if (phpbb::$config['email_enable']) { $radio_ary += array(USER_ACTIVATION_SELF => 'ACC_USER', USER_ACTIVATION_ADMIN => 'ACC_ADMIN'); } @@ -791,14 +791,14 @@ class acp_board */ function dateformat_select($value, $key) { - global $user, $config; + global $user; // Let the format_date function operate with the acp values $old_tz = $user->timezone; $old_dst = $user->dst; - $user->timezone = $config['board_timezone']; - $user->dst = $config['board_dst']; + $user->timezone = phpbb::$config['board_timezone']; + $user->dst = phpbb::$config['board_dst']; $dateformat_options = ''; diff --git a/phpBB/modules/acp/acp_bots.php b/phpBB/modules/acp/acp_bots.php index 7a23ca09c5..f4d78e7cc9 100644 --- a/phpBB/modules/acp/acp_bots.php +++ b/phpBB/modules/acp/acp_bots.php @@ -25,7 +25,7 @@ class acp_bots function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; $action = request_var('action', ''); $submit = phpbb_request::is_set_post('submit'); @@ -147,8 +147,8 @@ class acp_bots 'bot_agent' => request_var('bot_agent', ''), 'bot_ip' => request_var('bot_ip', ''), 'bot_active' => request_var('bot_active', true), - 'bot_lang' => request_var('bot_lang', $config['default_lang']), - 'bot_style' => request_var('bot_style' , $config['default_style']), + 'bot_lang' => request_var('bot_lang', phpbb::$config['default_lang']), + 'bot_style' => request_var('bot_style' , phpbb::$config['default_style']), ); if ($submit) diff --git a/phpBB/modules/acp/acp_captcha.php b/phpBB/modules/acp/acp_captcha.php index c45b6e8c36..2eedf4da7c 100644 --- a/phpBB/modules/acp/acp_captcha.php +++ b/phpBB/modules/acp/acp_captcha.php @@ -26,13 +26,13 @@ class acp_captcha function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('acp/board'); include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT); - $selected = request_var('select_captcha', $config['captcha_plugin']); + $selected = request_var('select_captcha', phpbb::$config['captcha_plugin']); $configure = request_var('configure', false); // Oh, they are just here for the view @@ -70,15 +70,15 @@ class acp_captcha { set_config($config_var, request_var($config_var, false)); } - if ($selected !== $config['captcha_plugin']) + if ($selected !== phpbb::$config['captcha_plugin']) { // sanity check if (isset($captchas['available'][$selected])) { - $old_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $old_captcha = phpbb_captcha_factory::get_instance(phpbb::$config['captcha_plugin']); $old_captcha->uninstall(); set_config('captcha_plugin', $selected); - $new_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $new_captcha = phpbb_captcha_factory::get_instance(phpbb::$config['captcha_plugin']); $new_captcha->install(); } else @@ -127,7 +127,7 @@ class acp_captcha */ function deliver_demo($selected) { - global $db, $user, $config; + global $db, $user; $captcha = phpbb_captcha_factory::get_instance($selected); $captcha->init(CONFIRM_REG); diff --git a/phpBB/modules/acp/acp_database.php b/phpBB/modules/acp/acp_database.php index 837e7280e2..14e38bc697 100644 --- a/phpBB/modules/acp/acp_database.php +++ b/phpBB/modules/acp/acp_database.php @@ -25,7 +25,7 @@ class acp_database function main($id, $mode) { - global $db, $user, $auth, $template, $table_prefix, $config; + global $db, $user, $auth, $template, $table_prefix; $user->add_lang('acp/database'); diff --git a/phpBB/modules/acp/acp_disallow.php b/phpBB/modules/acp/acp_disallow.php index 507cbbdf15..5f3797ba29 100644 --- a/phpBB/modules/acp/acp_disallow.php +++ b/phpBB/modules/acp/acp_disallow.php @@ -25,7 +25,7 @@ class acp_disallow function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); diff --git a/phpBB/modules/acp/acp_email.php b/phpBB/modules/acp/acp_email.php index 3e9be9e34c..4626a607f3 100644 --- a/phpBB/modules/acp/acp_email.php +++ b/phpBB/modules/acp/acp_email.php @@ -25,7 +25,7 @@ class acp_email function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; $user->add_lang('acp/email'); $this->tpl_name = 'acp_email'; @@ -168,7 +168,7 @@ class acp_email $messenger->template('admin_send_email', $used_lang); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); @@ -177,7 +177,7 @@ class acp_email $messenger->set_mail_priority($priority); $messenger->assign_vars(array( - 'CONTACT_EMAIL' => $config['board_contact'], + 'CONTACT_EMAIL' => phpbb::$config['board_contact'], 'MESSAGE' => htmlspecialchars_decode($message)) ); diff --git a/phpBB/modules/acp/acp_forums.php b/phpBB/modules/acp/acp_forums.php index 30a038c611..d568fd2caf 100644 --- a/phpBB/modules/acp/acp_forums.php +++ b/phpBB/modules/acp/acp_forums.php @@ -26,7 +26,7 @@ class acp_forums function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('acp/forums'); $this->tpl_name = 'acp_forums'; @@ -1628,7 +1628,7 @@ class acp_forums */ function delete_forum_content($forum_id) { - global $db, $config; + global $db; include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); diff --git a/phpBB/modules/acp/acp_groups.php b/phpBB/modules/acp/acp_groups.php index fce4ba7e55..408b0b33f7 100644 --- a/phpBB/modules/acp/acp_groups.php +++ b/phpBB/modules/acp/acp_groups.php @@ -25,7 +25,7 @@ class acp_groups function main($id, $mode) { - global $config, $db, $user, $auth, $template, $file_uploads; + global $db, $user, $auth, $template, $file_uploads; $user->add_lang('acp/groups'); $this->tpl_name = 'acp_groups'; @@ -48,7 +48,7 @@ class acp_groups // Clear some vars - $can_upload = (file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $file_uploads) ? true : false; + $can_upload = (file_exists(PHPBB_ROOT_PATH . phpbb::$config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . phpbb::$config['avatar_path']) && $file_uploads) ? true : false; $group_row = array(); // Grab basic data for group, if group_id is set and exists @@ -339,14 +339,14 @@ class acp_groups } } } - else if ($avatar_select && $config['allow_avatar_local']) + else if ($avatar_select && phpbb::$config['allow_avatar_local']) { // 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)) { $submit_ary['avatar_type'] = AVATAR_GALLERY; - list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select); + list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize(PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select); $submit_ary['avatar'] = $category . '/' . $avatar_select; } } @@ -358,21 +358,21 @@ class acp_groups else if ($data['width'] && $data['height']) { // Only update the dimensions? - if ($config['avatar_max_width'] || $config['avatar_max_height']) + if (phpbb::$config['avatar_max_width'] || phpbb::$config['avatar_max_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']); } } } @@ -521,7 +521,7 @@ class acp_groups $display_gallery = phpbb_request::is_set_post('display_gallery'); - if ($config['allow_avatar_local'] && $display_gallery) + if (phpbb::$config['allow_avatar_local'] && $display_gallery) { avatar_gallery($category, $avatar_select, 4); } @@ -547,8 +547,8 @@ class acp_groups 'S_CAN_UPLOAD' => $can_upload, 'S_ERROR' => (sizeof($error)) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, - 'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false, - 'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false, + 'S_DISPLAY_GALLERY' => (phpbb::$config['allow_avatar_local'] && !$display_gallery) ? true : false, + 'S_IN_GALLERY' => (phpbb::$config['allow_avatar_local'] && $display_gallery) ? true : false, 'S_USER_FOUNDER' => ($user->data['user_type'] == phpbb::USER_FOUNDER) ? true : false, 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', @@ -571,7 +571,7 @@ class acp_groups 'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == phpbb::USER_FOUNDER) ? false : 0)), 'AVATAR' => $avatar_img, 'AVATAR_IMAGE' => $avatar_img, - 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], + 'AVATAR_MAX_FILESIZE' => phpbb::$config['avatar_filesize'], 'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '', 'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '', @@ -589,7 +589,7 @@ class acp_groups 'U_BACK' => $u_back, 'U_SWATCH' => append_sid(PHPBB_ADMIN_PATH . 'swatch.' . PHP_EXT, 'form=settings&name=group_colour'), 'U_ACTION' => "{$this->u_action}&action=$action&g=$group_id", - 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)), + 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], round(phpbb::$config['avatar_filesize'] / 1024)), ) ); @@ -650,8 +650,8 @@ class acp_groups 'S_GROUP_SPECIAL' => ($group_row['group_type'] == GROUP_SPECIAL) ? true : false, 'S_ACTION_OPTIONS' => $s_action_options, - 'S_ON_PAGE' => on_page($total_members, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start, true), + 'S_ON_PAGE' => on_page($total_members, phpbb::$config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, phpbb::$config['topics_per_page'], $start, true), 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], 'U_ACTION' => $this->u_action . "&g=$group_id", @@ -667,7 +667,7 @@ class acp_groups AND u.user_id = ug.user_id AND ug.group_leader = 0 ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean"; - $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $pending = false; diff --git a/phpBB/modules/acp/acp_icons.php b/phpBB/modules/acp/acp_icons.php index c766ab5540..0badeafaf7 100644 --- a/phpBB/modules/acp/acp_icons.php +++ b/phpBB/modules/acp/acp_icons.php @@ -26,7 +26,7 @@ class acp_icons function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('acp/posting'); @@ -48,14 +48,14 @@ class acp_icons $table = SMILIES_TABLE; $lang = 'SMILIES'; $fields = 'smiley'; - $img_path = $config['smilies_path']; + $img_path = phpbb::$config['smilies_path']; break; case 'icons': $table = ICONS_TABLE; $lang = 'ICONS'; $fields = 'icons'; - $img_path = $config['icons_path']; + $img_path = phpbb::$config['icons_path']; break; } diff --git a/phpBB/modules/acp/acp_inactive.php b/phpBB/modules/acp/acp_inactive.php index d1feaf4901..ef150748ae 100644 --- a/phpBB/modules/acp/acp_inactive.php +++ b/phpBB/modules/acp/acp_inactive.php @@ -31,7 +31,7 @@ class acp_inactive function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); @@ -76,7 +76,7 @@ class acp_inactive if ($action == 'activate') { - if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + if (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) { // Get those 'being activated'... $sql = 'SELECT user_id, username, user_email, user_lang @@ -95,7 +95,7 @@ class acp_inactive user_active_flip('activate', $mark); - if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users)) + if (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users)) { include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); @@ -107,7 +107,7 @@ class acp_inactive $messenger->to($row['user_email'], $row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); @@ -153,7 +153,7 @@ class acp_inactive break; case 'remind': - if (empty($config['email_enable'])) + if (empty(phpbb::$config['email_enable'])) { trigger_error($user->lang['EMAIL_DISABLED'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -216,7 +216,7 @@ class acp_inactive $inactive = array(); $inactive_count = 0; - $start = view_inactive_users($inactive, $inactive_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); + $start = view_inactive_users($inactive, $inactive_count, phpbb::$config['topics_per_page'], $start, $sql_where, $sql_sort); foreach ($inactive as $row) { @@ -232,7 +232,7 @@ class acp_inactive } $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE'); - if ($config['email_enable']) + if (phpbb::$config['email_enable']) { $option_ary += array('remind' => 'REMIND'); } @@ -244,8 +244,8 @@ class acp_inactive 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, - 'S_ON_PAGE' => on_page($inactive_count, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $inactive_count, $config['topics_per_page'], $start, true), + 'S_ON_PAGE' => on_page($inactive_count, phpbb::$config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $inactive_count, phpbb::$config['topics_per_page'], $start, true), 'U_ACTION' => $this->u_action . '&start=' . $start, )); diff --git a/phpBB/modules/acp/acp_jabber.php b/phpBB/modules/acp/acp_jabber.php index cb8a6a3a83..a7f8da170c 100644 --- a/phpBB/modules/acp/acp_jabber.php +++ b/phpBB/modules/acp/acp_jabber.php @@ -26,7 +26,7 @@ class acp_jabber function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('acp/board'); @@ -43,13 +43,13 @@ class acp_jabber $this->tpl_name = 'acp_jabber'; $this->page_title = 'ACP_JABBER_SETTINGS'; - $jab_enable = request_var('jab_enable', $config['jab_enable']); - $jab_host = request_var('jab_host', $config['jab_host']); - $jab_port = request_var('jab_port', $config['jab_port']); - $jab_username = request_var('jab_username', $config['jab_username']); - $jab_password = request_var('jab_password', $config['jab_password']); - $jab_package_size = request_var('jab_package_size', $config['jab_package_size']); - $jab_use_ssl = request_var('jab_use_ssl', $config['jab_use_ssl']); + $jab_enable = request_var('jab_enable', phpbb::$config['jab_enable']); + $jab_host = request_var('jab_host', phpbb::$config['jab_host']); + $jab_port = request_var('jab_port', phpbb::$config['jab_port']); + $jab_username = request_var('jab_username', phpbb::$config['jab_username']); + $jab_password = request_var('jab_password', phpbb::$config['jab_password']); + $jab_package_size = request_var('jab_package_size', phpbb::$config['jab_package_size']); + $jab_use_ssl = request_var('jab_use_ssl', phpbb::$config['jab_use_ssl']); $form_name = 'acp_jabber'; add_form_key($form_name); diff --git a/phpBB/modules/acp/acp_language.php b/phpBB/modules/acp/acp_language.php index fd33057e07..71523dfa6d 100644 --- a/phpBB/modules/acp/acp_language.php +++ b/phpBB/modules/acp/acp_language.php @@ -31,7 +31,7 @@ class acp_language function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; global $safe_mode, $file_uploads; /** @@ -460,15 +460,15 @@ class acp_language $missing_vars = $missing_files = array(); // Get email templates - $email_files = filelist(PHPBB_ROOT_PATH . 'language/' . $config['default_lang'], 'email', 'txt'); + $email_files = filelist(PHPBB_ROOT_PATH . 'language/' . phpbb::$config['default_lang'], 'email', 'txt'); $email_files = $email_files['email/']; // Get acp files - $acp_files = filelist(PHPBB_ROOT_PATH . 'language/' . $config['default_lang'], 'acp', PHP_EXT); + $acp_files = filelist(PHPBB_ROOT_PATH . 'language/' . phpbb::$config['default_lang'], 'acp', PHP_EXT); $acp_files = $acp_files['acp/']; // Get mod files - $mods_files = filelist(PHPBB_ROOT_PATH . 'language/' . $config['default_lang'], 'mods', PHP_EXT); + $mods_files = filelist(PHPBB_ROOT_PATH . 'language/' . phpbb::$config['default_lang'], 'mods', PHP_EXT); $mods_files = (isset($mods_files['mods/'])) ? $mods_files['mods/'] : array(); // Check if our current filename matches the files @@ -536,7 +536,7 @@ class acp_language ); // If current lang is different from the default lang, then first try to grab missing/additional vars - if ($lang_iso != $config['default_lang']) + if ($lang_iso != phpbb::$config['default_lang']) { $is_missing_var = false; @@ -544,7 +544,7 @@ class acp_language { if (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, '', $file))) { - $missing_vars[$file] = $this->compare_language_files($config['default_lang'], $lang_iso, '', $file); + $missing_vars[$file] = $this->compare_language_files(phpbb::$config['default_lang'], $lang_iso, '', $file); if (sizeof($missing_vars[$file])) { @@ -562,7 +562,7 @@ class acp_language { if (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, 'acp', $file))) { - $missing_vars['acp/' . $file] = $this->compare_language_files($config['default_lang'], $lang_iso, 'acp', $file); + $missing_vars['acp/' . $file] = $this->compare_language_files(phpbb::$config['default_lang'], $lang_iso, 'acp', $file); if (sizeof($missing_vars['acp/' . $file])) { @@ -581,7 +581,7 @@ class acp_language { if (file_exists(PHPBB_ROOT_PATH . $this->get_filename($lang_iso, 'mods', $file))) { - $missing_vars['mods/' . $file] = $this->compare_language_files($config['default_lang'], $lang_iso, 'mods', $file); + $missing_vars['mods/' . $file] = $this->compare_language_files(phpbb::$config['default_lang'], $lang_iso, 'mods', $file); if (sizeof($missing_vars['mods/' . $file])) { @@ -774,7 +774,7 @@ class acp_language $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if ($row['lang_iso'] == $config['default_lang']) + if ($row['lang_iso'] == phpbb::$config['default_lang']) { trigger_error($user->lang['NO_REMOVE_DEFAULT_LANG'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -782,7 +782,7 @@ class acp_language $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id); $sql = 'UPDATE ' . USERS_TABLE . " - SET user_lang = '" . $db->sql_escape($config['default_lang']) . "' + SET user_lang = '" . $db->sql_escape(phpbb::$config['default_lang']) . "' WHERE user_lang = '" . $db->sql_escape($row['lang_iso']) . "'"; $db->sql_query($sql); @@ -914,7 +914,7 @@ class acp_language // Now let's copy the default language entries for custom profile fields for this new language - makes admin's life easier. $sql = 'SELECT lang_id FROM ' . LANG_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + WHERE lang_iso = '" . $db->sql_escape(phpbb::$config['default_lang']) . "'"; $result = $db->sql_query($sql); $default_lang_id = (int) $db->sql_fetchfield('lang_id'); $db->sql_freeresult($result); @@ -1097,7 +1097,7 @@ class acp_language while ($row = $db->sql_fetchrow($result)) { $installed[] = $row['lang_iso']; - $tagstyle = ($row['lang_iso'] == $config['default_lang']) ? '*' : ''; + $tagstyle = ($row['lang_iso'] == phpbb::$config['default_lang']) ? '*' : ''; $template->assign_block_vars('lang', array( 'U_DETAILS' => $this->u_action . "&action=details&id={$row['lang_id']}", diff --git a/phpBB/modules/acp/acp_logs.php b/phpBB/modules/acp/acp_logs.php index 95442b336c..728ed1f878 100644 --- a/phpBB/modules/acp/acp_logs.php +++ b/phpBB/modules/acp/acp_logs.php @@ -25,7 +25,7 @@ class acp_logs function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('mcp'); @@ -122,15 +122,15 @@ class acp_logs // Grab log data $log_data = array(); $log_count = 0; - view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort); + view_log($mode, $log_data, $log_count, phpbb::$config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort); $template->assign_vars(array( 'L_TITLE' => $l_title, 'L_EXPLAIN' => $l_title_explain, 'U_ACTION' => $this->u_action, - 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, $config['topics_per_page'], $start, true), + 'S_ON_PAGE' => on_page($log_count, phpbb::$config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, phpbb::$config['topics_per_page'], $start, true), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, diff --git a/phpBB/modules/acp/acp_main.php b/phpBB/modules/acp/acp_main.php index 78ada1d09d..ee96eab767 100644 --- a/phpBB/modules/acp/acp_main.php +++ b/phpBB/modules/acp/acp_main.php @@ -25,7 +25,7 @@ class acp_main function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; // Show restore permissions notice if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) @@ -210,7 +210,7 @@ class acp_main break; } - $step = ($config['num_posts']) ? (max((int) ($config['num_posts'] / 5), 20000)) : 20000; + $step = (phpbb::$config['num_posts']) ? (max((int) (phpbb::$config['num_posts'] / 5), 20000)) : 20000; $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0'); while ($start < $max_post_id) @@ -341,31 +341,31 @@ class acp_main } // Get forum statistics - $total_posts = $config['num_posts']; - $total_topics = $config['num_topics']; - $total_users = $config['num_users']; - $total_files = $config['num_files']; + $total_posts = phpbb::$config['num_posts']; + $total_topics = phpbb::$config['num_topics']; + $total_users = phpbb::$config['num_users']; + $total_files = phpbb::$config['num_files']; - $start_date = $user->format_date($config['board_startdate']); + $start_date = $user->format_date(phpbb::$config['board_startdate']); - $boarddays = (time() - $config['board_startdate']) / 86400; + $boarddays = (time() - phpbb::$config['board_startdate']) / 86400; $posts_per_day = sprintf('%.2f', $total_posts / $boarddays); $topics_per_day = sprintf('%.2f', $total_topics / $boarddays); $users_per_day = sprintf('%.2f', $total_users / $boarddays); $files_per_day = sprintf('%.2f', $total_files / $boarddays); - $upload_dir_size = get_formatted_filesize($config['upload_dir_size']); + $upload_dir_size = get_formatted_filesize(phpbb::$config['upload_dir_size']); $avatar_dir_size = 0; - if ($avatar_dir = @opendir(PHPBB_ROOT_PATH . $config['avatar_path'])) + if ($avatar_dir = @opendir(PHPBB_ROOT_PATH . phpbb::$config['avatar_path'])) { while (($file = readdir($avatar_dir)) !== false) { if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false) { - $avatar_dir_size += filesize(PHPBB_ROOT_PATH . $config['avatar_path'] . '/' . $file); + $avatar_dir_size += filesize(PHPBB_ROOT_PATH . phpbb::$config['avatar_path'] . '/' . $file); } } closedir($avatar_dir); @@ -398,7 +398,7 @@ class acp_main $files_per_day = $total_files; } - if ($config['allow_attachments'] || $config['allow_pm_attach']) + if (phpbb::$config['allow_attachments'] || phpbb::$config['allow_pm_attach']) { $sql = 'SELECT COUNT(attach_id) AS total_orphan FROM ' . ATTACHMENTS_TABLE . ' @@ -430,9 +430,9 @@ class acp_main 'UPLOAD_DIR_SIZE' => $upload_dir_size, 'TOTAL_ORPHAN' => $total_orphan, 'S_TOTAL_ORPHAN' => ($total_orphan === false) ? false : true, - 'GZIP_COMPRESSION' => ($config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF'], + 'GZIP_COMPRESSION' => (phpbb::$config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF'], 'DATABASE_INFO' => $db->sql_server_info(), - 'BOARD_VERSION' => $config['version'], + 'BOARD_VERSION' => phpbb::$config['version'], 'U_ACTION' => $this->u_action, 'U_ADMIN_LOG' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&mode=admin'), @@ -482,7 +482,7 @@ class acp_main } $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE'); - if ($config['email_enable']) + if (phpbb::$config['email_enable']) { $option_ary += array('remind' => 'REMIND'); } diff --git a/phpBB/modules/acp/acp_modules.php b/phpBB/modules/acp/acp_modules.php index e04961099c..bf5f17449b 100644 --- a/phpBB/modules/acp/acp_modules.php +++ b/phpBB/modules/acp/acp_modules.php @@ -43,7 +43,7 @@ class acp_modules function main($id, $mode) { - global $db, $user, $auth, $template, $module, $config; + global $db, $user, $auth, $template, $module; // Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant) define('MODULE_INCLUDE', true); @@ -601,7 +601,7 @@ class acp_modules */ function make_module_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $ignore_noncat = false) { - global $db, $user, $auth, $config; + global $db, $user, $auth; $sql = 'SELECT module_id, module_enabled, module_basename, parent_id, module_langname, left_id, right_id, module_auth FROM ' . MODULES_TABLE . " diff --git a/phpBB/modules/acp/acp_permission_roles.php b/phpBB/modules/acp/acp_permission_roles.php index 8348c622c5..4b37bd01cc 100644 --- a/phpBB/modules/acp/acp_permission_roles.php +++ b/phpBB/modules/acp/acp_permission_roles.php @@ -25,7 +25,7 @@ class acp_permission_roles function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT); diff --git a/phpBB/modules/acp/acp_permissions.php b/phpBB/modules/acp/acp_permissions.php index 8b3b424ce8..e3d7dafd12 100644 --- a/phpBB/modules/acp/acp_permissions.php +++ b/phpBB/modules/acp/acp_permissions.php @@ -26,7 +26,7 @@ class acp_permissions function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT); @@ -79,7 +79,7 @@ class acp_permissions if ($select_all_groups) { // Add default groups to selection - $sql_and = (!$config['coppa_enable']) ? " AND group_name <> 'REGISTERED_COPPA'" : ''; + $sql_and = (!phpbb::$config['coppa_enable']) ? " AND group_name <> 'REGISTERED_COPPA'" : ''; $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . ' diff --git a/phpBB/modules/acp/acp_php_info.php b/phpBB/modules/acp/acp_php_info.php index 3df63edc17..0e042bebe0 100644 --- a/phpBB/modules/acp/acp_php_info.php +++ b/phpBB/modules/acp/acp_php_info.php @@ -25,7 +25,7 @@ class acp_php_info function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; if ($mode != 'info') { @@ -34,7 +34,7 @@ class acp_php_info $this->tpl_name = 'acp_php_info'; $this->page_title = 'ACP_PHP_INFO'; - + ob_start(); @phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES); $phpinfo = ob_get_clean(); diff --git a/phpBB/modules/acp/acp_profile.php b/phpBB/modules/acp/acp_profile.php index 75bbd1ab14..529f84de94 100644 --- a/phpBB/modules/acp/acp_profile.php +++ b/phpBB/modules/acp/acp_profile.php @@ -28,7 +28,7 @@ class acp_profile function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); @@ -217,7 +217,7 @@ class acp_profile $sql = 'SELECT lang_id FROM ' . LANG_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + WHERE lang_iso = '" . $db->sql_escape(phpbb::$config['default_lang']) . "'"; $result = $db->sql_query($sql); $default_lang_id = (int) $db->sql_fetchfield('lang_id'); $db->sql_freeresult($result); @@ -291,7 +291,7 @@ class acp_profile $save = phpbb_request::is_set('save'); // The language id of default language - $this->edit_lang_id = $this->lang_defs['iso'][$config['default_lang']]; + $this->edit_lang_id = $this->lang_defs['iso'][phpbb::$config['default_lang']]; // We are editing... we need to grab basic things if ($action == 'edit') @@ -741,7 +741,7 @@ class acp_profile 'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false, 'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false, - 'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], $config['default_lang']), + 'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], phpbb::$config['default_lang']), 'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$field_type])], 'FIELD_IDENT' => $cp->vars['field_ident'], 'LANG_NAME' => $cp->vars['lang_name'], @@ -902,9 +902,9 @@ class acp_profile */ function build_language_options(&$cp, $field_type, $action = 'create') { - global $user, $config, $db; + global $user, $db; - $default_lang_id = (!empty($this->edit_lang_id)) ? $this->edit_lang_id : $this->lang_defs['iso'][$config['default_lang']]; + $default_lang_id = (!empty($this->edit_lang_id)) ? $this->edit_lang_id : $this->lang_defs['iso'][phpbb::$config['default_lang']]; $sql = 'SELECT lang_id, lang_iso FROM ' . LANG_TABLE . ' @@ -1022,14 +1022,14 @@ class acp_profile */ function save_profile_field(&$cp, $field_type, $action = 'create') { - global $db, $config, $user; + global $db, $user; $field_id = request_var('field_id', 0); // Collect all information, if something is going wrong, abort the operation $profile_sql = $profile_lang = $empty_lang = $profile_lang_fields = array(); - $default_lang_id = (!empty($this->edit_lang_id)) ? $this->edit_lang_id : $this->lang_defs['iso'][$config['default_lang']]; + $default_lang_id = (!empty($this->edit_lang_id)) ? $this->edit_lang_id : $this->lang_defs['iso'][phpbb::$config['default_lang']]; if ($action == 'create') { diff --git a/phpBB/modules/acp/acp_prune.php b/phpBB/modules/acp/acp_prune.php index 0f6fa9933d..c901f03269 100644 --- a/phpBB/modules/acp/acp_prune.php +++ b/phpBB/modules/acp/acp_prune.php @@ -51,7 +51,7 @@ class acp_prune */ function prune_forums($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $all_forums = request_var('all_forums', 0); $forum_id = request_var('f', array(0)); @@ -227,7 +227,7 @@ class acp_prune */ function prune_users($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('memberlist'); diff --git a/phpBB/modules/acp/acp_ranks.php b/phpBB/modules/acp/acp_ranks.php index 64ed46cc96..92510525b7 100644 --- a/phpBB/modules/acp/acp_ranks.php +++ b/phpBB/modules/acp/acp_ranks.php @@ -25,7 +25,7 @@ class acp_ranks function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('acp/posting'); @@ -156,7 +156,7 @@ class acp_ranks } $db->sql_freeresult($result); - $imglist = filelist(PHPBB_ROOT_PATH . $config['ranks_path'], ''); + $imglist = filelist(PHPBB_ROOT_PATH . phpbb::$config['ranks_path'], ''); $edit_img = $filename_list = ''; foreach ($imglist as $path => $img_ary) @@ -195,12 +195,12 @@ class acp_ranks $template->assign_vars(array( 'S_EDIT' => true, 'U_BACK' => $this->u_action, - 'RANKS_PATH' => PHPBB_ROOT_PATH . $config['ranks_path'], + 'RANKS_PATH' => PHPBB_ROOT_PATH . phpbb::$config['ranks_path'], 'U_ACTION' => $this->u_action . '&id=' . $rank_id, 'RANK_TITLE' => (isset($ranks['rank_title'])) ? $ranks['rank_title'] : '', 'S_FILENAME_LIST' => $filename_list, - 'RANK_IMAGE' => ($edit_img) ? PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $edit_img : PHPBB_ADMIN_PATH . 'images/spacer.gif', + 'RANK_IMAGE' => ($edit_img) ? PHPBB_ROOT_PATH . phpbb::$config['ranks_path'] . '/' . $edit_img : PHPBB_ADMIN_PATH . 'images/spacer.gif', 'S_SPECIAL_RANK' => (!isset($ranks['rank_special']) || $ranks['rank_special']) ? true : false, 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0) ); @@ -226,7 +226,7 @@ class acp_ranks 'S_RANK_IMAGE' => ($row['rank_image']) ? true : false, 'S_SPECIAL_RANK' => ($row['rank_special']) ? true : false, - 'RANK_IMAGE' => PHPBB_ROOT_PATH . $config['ranks_path'] . '/' . $row['rank_image'], + 'RANK_IMAGE' => PHPBB_ROOT_PATH . phpbb::$config['ranks_path'] . '/' . $row['rank_image'], 'RANK_TITLE' => $row['rank_title'], 'MIN_POSTS' => $row['rank_min'], diff --git a/phpBB/modules/acp/acp_reasons.php b/phpBB/modules/acp/acp_reasons.php index 1c80fcfa40..7f21bd27bd 100644 --- a/phpBB/modules/acp/acp_reasons.php +++ b/phpBB/modules/acp/acp_reasons.php @@ -25,7 +25,7 @@ class acp_reasons function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang(array('mcp', 'acp/posting')); diff --git a/phpBB/modules/acp/acp_search.php b/phpBB/modules/acp/acp_search.php index 380890ec64..029d9300ad 100644 --- a/phpBB/modules/acp/acp_search.php +++ b/phpBB/modules/acp/acp_search.php @@ -50,7 +50,7 @@ class acp_search function settings($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $submit = phpbb_request::is_set_post('submit'); @@ -76,7 +76,7 @@ class acp_search } $name = ucfirst(strtolower(str_replace('_', ' ', $type))); - $selected = ($config['search_type'] == $type) ? ' selected="selected"' : ''; + $selected = (phpbb::$config['search_type'] == $type) ? ' selected="selected"' : ''; $search_options .= '<option value="' . $type . '"' . $selected . '>' . $name . '</option>'; if (method_exists($search, 'acp')) @@ -126,7 +126,7 @@ class acp_search } // only change config if anything was actually changed - if ($submit && ($config[$config_name] != $config_value)) + if ($submit && (phpbb::$config[$config_name] != $config_value)) { set_config($config_name, $config_value); $updated = true; @@ -141,7 +141,7 @@ class acp_search add_log('admin', 'LOG_CONFIG_SEARCH'); } - if (isset($cfg_array['search_type']) && in_array($cfg_array['search_type'], $search_types, true) && ($cfg_array['search_type'] != $config['search_type'])) + if (isset($cfg_array['search_type']) && in_array($cfg_array['search_type'], $search_types, true) && ($cfg_array['search_type'] != phpbb::$config['search_type'])) { $search = null; $error = false; @@ -184,7 +184,7 @@ class acp_search $search = null; $error = false; - if (!$this->init_search($config['search_type'], $search, $error)) + if (!$this->init_search(phpbb::$config['search_type'], $search, $error)) { if ($updated) { @@ -210,14 +210,14 @@ class acp_search $this->page_title = 'ACP_SEARCH_SETTINGS'; $template->assign_vars(array( - 'LIMIT_SEARCH_LOAD' => (float) $config['limit_search_load'], - 'MIN_SEARCH_AUTHOR_CHARS' => (int) $config['min_search_author_chars'], - 'SEARCH_INTERVAL' => (float) $config['search_interval'], - 'SEARCH_GUEST_INTERVAL' => (float) $config['search_anonymous_interval'], - 'SEARCH_STORE_RESULTS' => (int) $config['search_store_results'], + 'LIMIT_SEARCH_LOAD' => (float) phpbb::$config['limit_search_load'], + 'MIN_SEARCH_AUTHOR_CHARS' => (int) phpbb::$config['min_search_author_chars'], + 'SEARCH_INTERVAL' => (float) phpbb::$config['search_interval'], + 'SEARCH_GUEST_INTERVAL' => (float) phpbb::$config['search_anonymous_interval'], + 'SEARCH_STORE_RESULTS' => (int) phpbb::$config['search_store_results'], 'S_SEARCH_TYPES' => $search_options, - 'S_YES_SEARCH' => (bool) $config['load_search'], + 'S_YES_SEARCH' => (bool) phpbb::$config['load_search'], 'S_SETTINGS' => true, 'U_ACTION' => $this->u_action) @@ -226,7 +226,7 @@ class acp_search function index($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $action = request_var('action', array('' => false)); if (sizeof($action)) @@ -237,7 +237,7 @@ class acp_search { $action = request_var('action', ''); } - $this->state = explode(',', $config['search_indexing_state']); + $this->state = explode(',', phpbb::$config['search_indexing_state']); if (phpbb_request::is_set_post('cancel')) { @@ -407,10 +407,10 @@ class acp_search // pretend the number of posts was as big as the number of ids we indexed so far // just an estimation as it includes deleted posts - $num_posts = $config['num_posts']; - $config['num_posts'] = min($config['num_posts'], $post_counter); + $num_posts = phpbb::$config['num_posts']; + phpbb::$config['num_posts'] = min(phpbb::$config['num_posts'], $post_counter); $this->search->tidy(); - $config['num_posts'] = $num_posts; + phpbb::$config['num_posts'] = $num_posts; if ($post_counter <= $this->max_post_id) { @@ -471,7 +471,7 @@ class acp_search 'L_NAME' => $name, 'NAME' => $type, - 'S_ACTIVE' => ($type == $config['search_type']) ? true : false, + 'S_ACTIVE' => ($type == phpbb::$config['search_type']) ? true : false, 'S_HIDDEN_FIELDS' => build_hidden_fields(array('search_type' => $type)), 'S_INDEXED' => (bool) $search->index_created(), 'S_STATS' => (bool) sizeof($statistics)) diff --git a/phpBB/modules/acp/acp_styles.php b/phpBB/modules/acp/acp_styles.php index 17c33c9c82..061de5ae76 100644 --- a/phpBB/modules/acp/acp_styles.php +++ b/phpBB/modules/acp/acp_styles.php @@ -31,7 +31,7 @@ class acp_styles function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; // Hardcoded template bitfield to add for new templates $bitfield = new bitfield(); @@ -192,7 +192,7 @@ parse_css_file = {PARSE_CSS_FILE} case 'activate': case 'deactivate': - if ($style_id == $config['default_style']) + if ($style_id == phpbb::$config['default_style']) { trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -206,7 +206,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($action == 'deactivate') { $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . $config['default_style'] . " + SET user_style = ' . phpbb::$config['default_style'] . " WHERE user_style = $style_id"; $db->sql_query($sql); @@ -474,7 +474,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function frontend($mode, $options, $actions) { - global $user, $template, $db, $config; + global $user, $template, $db; $sql_from = ''; $style_count = array(); @@ -557,7 +557,7 @@ parse_css_file = {PARSE_CSS_FILE} } $template->assign_block_vars('installed', array( - 'S_DEFAULT_STYLE' => ($mode == 'style' && $row['style_id'] == $config['default_style']) ? true : false, + 'S_DEFAULT_STYLE' => ($mode == 'style' && $row['style_id'] == phpbb::$config['default_style']) ? true : false, 'U_EDIT' => $this->u_action . '&action=' . (($mode == 'style') ? 'details' : 'edit') . '&id=' . $row[$mode . '_id'], 'U_STYLE_ACT_DEACT' => $this->u_action . '&action=' . $stylevis . '&id=' . $row[$mode . '_id'], 'L_STYLE_ACT_DEACT' => $user->lang['STYLE_' . strtoupper($stylevis)], @@ -631,7 +631,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function edit_template($template_id) { - global $config, $db, $user, $template, $safe_mode; + global $db, $user, $template, $safe_mode; if (defined('PHPBB_DISABLE_ACP_EDITOR')) { @@ -801,7 +801,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function template_cache($template_id) { - global $config, $db, $user, $template; + global $db, $user, $template; $source = str_replace('/', '.', request_var('source', '')); $file_ary = array_diff(request_var('delete', array('')), array('')); @@ -920,7 +920,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function edit_theme($theme_id) { - global $config, $db, $user, $template, $safe_mode; + global $db, $user, $template, $safe_mode; $this->page_title = 'EDIT_THEME'; @@ -1376,7 +1376,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function remove($mode, $style_id) { - global $db, $template, $user, $config; + global $db, $template, $user; $new_id = request_var('new_id', 0); $update = phpbb_request::is_set_post('update'); @@ -1461,7 +1461,7 @@ parse_css_file = {PARSE_CSS_FILE} WHERE forum_style = $style_id"; $db->sql_query($sql); - if ($style_id == $config['default_style']) + if ($style_id == phpbb::$config['default_style']) { set_config('default_style', $new_id); } @@ -1512,7 +1512,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function export($mode, $style_id) { - global $db, $template, $user, $config; + global $db, $template, $user; $update = phpbb_request::is_set_post('update'); @@ -1620,7 +1620,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($mode == 'style') { - $style_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['style_name'], $style_row['style_copyright'], $config['version']), $this->style_cfg); + $style_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['style_name'], $style_row['style_copyright'], phpbb::$config['version']), $this->style_cfg); $style_cfg .= (!$inc_template) ? "\nrequired_template = {$style_row['template_name']}" : ''; $style_cfg .= (!$inc_theme) ? "\nrequired_theme = {$style_row['theme_name']}" : ''; @@ -1637,7 +1637,7 @@ parse_css_file = {PARSE_CSS_FILE} // Export template core code if ($mode == 'template' || $inc_template) { - $template_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['template_name'], $style_row['template_copyright'], $config['version']), $this->template_cfg); + $template_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['template_name'], $style_row['template_copyright'], phpbb::$config['version']), $this->template_cfg); $data[] = array( 'src' => $template_cfg, @@ -1657,7 +1657,7 @@ parse_css_file = {PARSE_CSS_FILE} // Export theme core code if ($mode == 'theme' || $inc_theme) { - $theme_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['theme_name'], $style_row['theme_copyright'], $config['version']), $this->theme_cfg); + $theme_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['theme_name'], $style_row['theme_copyright'], phpbb::$config['version']), $this->theme_cfg); // Read old cfg file $items = phpbb_cache::obtain_cfg_item($style_row, 'theme'); @@ -1695,7 +1695,7 @@ parse_css_file = {PARSE_CSS_FILE} // Export imageset core code if ($mode == 'imageset' || $inc_imageset) { - $imageset_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['imageset_name'], $style_row['imageset_copyright'], $config['version']), $this->imageset_cfg); + $imageset_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['imageset_name'], $style_row['imageset_copyright'], phpbb::$config['version']), $this->imageset_cfg); $imageset_main = array(); @@ -1764,7 +1764,7 @@ parse_css_file = {PARSE_CSS_FILE} foreach ($imageset_lang as $lang => $imageset_localized) { - $imageset_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['imageset_name'], $style_row['imageset_copyright'], $config['version']), $this->imageset_cfg); + $imageset_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['imageset_name'], $style_row['imageset_copyright'], phpbb::$config['version']), $this->imageset_cfg); foreach ($this->imageset_keys as $topic => $key_array) { @@ -1909,7 +1909,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function details($mode, $style_id) { - global $template, $db, $config, $user, $safe_mode; + global $template, $db, $user, $safe_mode; $update = phpbb_request::is_set_post('update'); $l_type = strtoupper($mode); @@ -1948,7 +1948,7 @@ parse_css_file = {PARSE_CSS_FILE} trigger_error($user->lang['NO_' . $l_type] . adm_back_link($this->u_action), E_USER_WARNING); } - $style_row['style_default'] = ($mode == 'style' && $config['default_style'] == $style_id) ? 1 : 0; + $style_row['style_default'] = ($mode == 'style' && phpbb::$config['default_style'] == $style_id) ? 1 : 0; if ($update) { @@ -1975,7 +1975,7 @@ parse_css_file = {PARSE_CSS_FILE} $error[] = $user->lang['STYLE_ERR_NO_IDS']; } - if ($mode == 'style' && $style_row['style_active'] && !$style_active && $config['default_style'] == $style_id) + if ($mode == 'style' && $style_row['style_active'] && !$style_active && phpbb::$config['default_style'] == $style_id) { $error[] = $user->lang['DEACTIVATE_DEFAULT']; } @@ -2260,7 +2260,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function install($mode) { - global $config, $db, $user, $template; + global $db, $user, $template; $l_type = strtoupper($mode); @@ -2415,7 +2415,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function add($mode) { - global $config, $db, $user, $template; + global $db, $user, $template; $l_type = strtoupper($mode); $element_ary = array('template' => STYLES_TEMPLATE_TABLE, 'theme' => STYLES_THEME_TABLE, 'imageset' => STYLES_IMAGESET_TABLE); @@ -2563,7 +2563,7 @@ parse_css_file = {PARSE_CSS_FILE} function generate_stylesheets($theme) { - global $db, $config; + global $db; // get all the lang_dirs $sql = 'SELECT lang_dir @@ -2590,7 +2590,7 @@ parse_css_file = {PARSE_CSS_FILE} $theme['imageset_id'] = $theme_row['imageset_id']; $theme['template_path'] = $theme_row['template_path']; - $user_image_lang = (file_exists(PHPBB_ROOT_PATH . 'styles/' . $theme['imageset_path'] . '/imageset/' . $lang_dir)) ? $lang_dir : $config['default_lang']; + $user_image_lang = (file_exists(PHPBB_ROOT_PATH . 'styles/' . $theme['imageset_path'] . '/imageset/' . $lang_dir)) ? $lang_dir : phpbb::$config['default_lang']; // Parse Theme Data $replace = array( @@ -2750,7 +2750,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function install_style(&$error, $action, $root_path, &$id, $name, $path, $copyright, $active, $default, &$style_row, $template_root_path = false, $template_path = false, $theme_root_path = false, $theme_path = false, $imageset_root_path = false, $imageset_path = false) { - global $config, $db, $user; + global $db, $user; $element_ary = array('template', 'theme', 'imageset'); @@ -2829,7 +2829,7 @@ parse_css_file = {PARSE_CSS_FILE} { $sql = 'UPDATE ' . USERS_TABLE . " SET user_style = $id - WHERE user_style = " . $config['default_style']; + WHERE user_style = " . phpbb::$config['default_style']; $db->sql_query($sql); set_config('default_style', $id); diff --git a/phpBB/modules/acp/acp_update.php b/phpBB/modules/acp/acp_update.php index d021fe5e09..ca18a23b16 100644 --- a/phpBB/modules/acp/acp_update.php +++ b/phpBB/modules/acp/acp_update.php @@ -25,7 +25,7 @@ class acp_update function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; $user->add_lang('install'); @@ -57,10 +57,10 @@ class acp_update $version_update_from = (string) $db->sql_fetchfield('config_value'); $db->sql_freeresult($result); - $current_version = (!empty($version_update_from)) ? $version_update_from : $config['version']; + $current_version = (!empty($version_update_from)) ? $version_update_from : phpbb::$config['version']; $up_to_date_automatic = (version_compare(str_replace('rc', 'RC', strtolower($current_version)), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true; - $up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($config['version'])), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true; + $up_to_date = (version_compare(str_replace('rc', 'RC', strtolower(phpbb::$config['version'])), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true; $template->assign_vars(array( 'S_UP_TO_DATE' => $up_to_date, @@ -69,7 +69,7 @@ class acp_update 'U_ACTION' => $this->u_action, 'LATEST_VERSION' => $latest_version, - 'CURRENT_VERSION' => $config['version'], + 'CURRENT_VERSION' => phpbb::$config['version'], 'AUTO_VERSION' => $version_update_from, 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link), diff --git a/phpBB/modules/acp/acp_users.php b/phpBB/modules/acp/acp_users.php index 0cb973058c..02940154b9 100644 --- a/phpBB/modules/acp/acp_users.php +++ b/phpBB/modules/acp/acp_users.php @@ -31,7 +31,7 @@ class acp_users function main($id, $mode) { - global $config, $db, $user, $auth, $template, $file_uploads; + global $db, $user, $auth, $template, $file_uploads; $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; @@ -300,7 +300,7 @@ class acp_users trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - if ($config['email_enable']) + if (phpbb::$config['email_enable']) { include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); @@ -338,13 +338,13 @@ class acp_users $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( - 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], phpbb::$config['sitename'])), 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u={$user_row['user_id']}&k=$user_actkey") ); @@ -664,9 +664,9 @@ class acp_users // Validation data - we do not check the password complexity setting here $check_ary = array( 'new_password' => array( - array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + array('string', true, phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), array('password')), - 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + 'password_confirm' => array('string', true, phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), ); // Check username if altered @@ -674,7 +674,7 @@ class acp_users { $check_ary += array( 'username' => array( - array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('string', false, phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), array('username', $user_row['username']) ), ); @@ -837,7 +837,7 @@ class acp_users $quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH'); - if ($config['email_enable'] && ($user_row['user_type'] == phpbb::USER_NORMAL || $user_row['user_type'] == phpbb::USER_INACTIVE)) + if (phpbb::$config['email_enable'] && ($user_row['user_type'] == phpbb::USER_NORMAL || $user_row['user_type'] == phpbb::USER_INACTIVE)) { $quick_tool_ary['reactivate'] = 'FORCE'; } @@ -849,7 +849,7 @@ class acp_users $s_action_options .= '<option value="' . $value . '">' . $user->lang['USER_ADMIN_' . $lang] . '</option>'; } - if ($config['load_onlinetrack']) + if (phpbb::$config['load_onlinetrack']) { $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline FROM ' . SESSIONS_TABLE . " @@ -900,8 +900,8 @@ class acp_users $db->sql_freeresult($result); $template->assign_vars(array( - 'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[phpbb::$config['allow_name_chars'] . '_EXPLAIN'], phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), + 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[phpbb::$config['pass_complex'] . '_EXPLAIN'], phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']), 'S_FOUNDER' => ($user->data['user_type'] == phpbb::USER_FOUNDER) ? true : false, @@ -1007,12 +1007,12 @@ class acp_users // Grab log data $log_data = array(); $log_count = 0; - view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); + view_log('user', $log_data, $log_count, phpbb::$config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); $template->assign_vars(array( 'S_FEEDBACK' => true, - 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&$u_sort_param", $log_count, $config['topics_per_page'], $start, true), + 'S_ON_PAGE' => on_page($log_count, phpbb::$config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&$u_sort_param", $log_count, phpbb::$config['topics_per_page'], $start, true), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, @@ -1403,7 +1403,7 @@ class acp_users $template->assign_vars(array( 'S_PREFS' => true, - 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, + 'S_JABBER_DISABLED' => (phpbb::$config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, 'VIEW_EMAIL' => $data['viewemail'], 'MASS_EMAIL' => $data['massemail'], @@ -1436,8 +1436,8 @@ class acp_users 'DATE_FORMAT' => $data['dateformat'], 'S_DATEFORMAT_OPTIONS' => $dateformat_options, 'S_CUSTOM_DATEFORMAT' => $s_custom, - 'DEFAULT_DATEFORMAT' => $config['default_dateformat'], - 'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']), + 'DEFAULT_DATEFORMAT' => phpbb::$config['default_dateformat'], + 'A_DEFAULT_DATEFORMAT' => addslashes(phpbb::$config['default_dateformat']), 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => style_select($data['style']), @@ -1452,7 +1452,7 @@ class acp_users include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); - $can_upload = (file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $file_uploads) ? true : false; + $can_upload = (file_exists(PHPBB_ROOT_PATH . phpbb::$config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . phpbb::$config['avatar_path']) && $file_uploads) ? true : false; if ($submit) { @@ -1478,24 +1478,24 @@ class acp_users $avatar_select = basename(request_var('avatar_select', '')); $category = basename(request_var('category', '')); - if ($config['allow_avatar_local'] && $display_gallery) + if (phpbb::$config['allow_avatar_local'] && $display_gallery) { avatar_gallery($category, $avatar_select, 4); } $template->assign_vars(array( 'S_AVATAR' => true, - 'S_CAN_UPLOAD' => ($can_upload && $config['allow_avatar_upload']) ? true : false, - 'S_ALLOW_REMOTE' => ($config['allow_avatar_remote']) ? true : false, - 'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false, - 'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false, + 'S_CAN_UPLOAD' => ($can_upload && phpbb::$config['allow_avatar_upload']) ? true : false, + 'S_ALLOW_REMOTE' => (phpbb::$config['allow_avatar_remote']) ? true : false, + 'S_DISPLAY_GALLERY' => (phpbb::$config['allow_avatar_local'] && !$display_gallery) ? true : false, + 'S_IN_GALLERY' => (phpbb::$config['allow_avatar_local'] && $display_gallery) ? true : false, 'AVATAR_IMAGE' => $avatar_img, - 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], + 'AVATAR_MAX_FILESIZE' => phpbb::$config['avatar_filesize'], 'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'], 'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'], - 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024))) + 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], round(phpbb::$config['avatar_filesize'] / 1024))) ); break; @@ -1546,9 +1546,9 @@ class acp_users include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); - $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false; - $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false; - $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; + $enable_bbcode = (phpbb::$config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false; + $enable_smilies = (phpbb::$config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false; + $enable_urls = (phpbb::$config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; $signature = utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true)); $preview = phpbb_request::is_set_post('preview'); @@ -1560,7 +1560,7 @@ class acp_users $message_parser = new parse_message($signature); // Allowing Quote BBCode - $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig'); + $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, phpbb::$config['allow_sig_img'], phpbb::$config['allow_sig_flash'], true, phpbb::$config['allow_sig_links'], true, 'sig'); if (sizeof($message_parser->warn_msg)) { @@ -1613,19 +1613,19 @@ class acp_users 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', - 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), - 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], - 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], - 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], - 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + 'BBCODE_STATUS' => (phpbb::$config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), + 'SMILIES_STATUS' => (phpbb::$config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'IMG_STATUS' => (phpbb::$config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => (phpbb::$config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => (phpbb::$config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], - 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), + 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], phpbb::$config['max_sig_chars']), - 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], - 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], - 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false, - 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false, - 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) + 'S_BBCODE_ALLOWED' => phpbb::$config['allow_sig_bbcode'], + 'S_SMILIES_ALLOWED' => phpbb::$config['allow_sig_smilies'], + 'S_BBCODE_IMG' => (phpbb::$config['allow_sig_img']) ? true : false, + 'S_BBCODE_FLASH' => (phpbb::$config['allow_sig_flash']) ? true : false, + 'S_LINKS_ALLOWED' => (phpbb::$config['allow_sig_links']) ? true : false) ); // Assigning custom bbcodes @@ -1739,7 +1739,7 @@ class acp_users WHERE a.poster_id = ' . $user_id . " AND a.is_orphan = 0 ORDER BY $order_by"; - $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['posts_per_page'], $start); while ($row = $db->sql_fetchrow($result)) { @@ -1775,11 +1775,11 @@ class acp_users $template->assign_vars(array( 'S_ATTACHMENTS' => true, - 'S_ON_PAGE' => on_page($num_attachments, $config['topics_per_page'], $start), + 'S_ON_PAGE' => on_page($num_attachments, phpbb::$config['topics_per_page'], $start), 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, - 'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start, true)) + 'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir", $num_attachments, phpbb::$config['topics_per_page'], $start, true)) ); break; @@ -1915,7 +1915,7 @@ class acp_users $s_group_options = ''; while ($row = $db->sql_fetchrow($result)) { - if (!$config['coppa_enable'] && $row['group_name'] == 'REGISTERED_COPPA') + if (!phpbb::$config['coppa_enable'] && $row['group_name'] == 'REGISTERED_COPPA') { continue; } diff --git a/phpBB/modules/acp/acp_words.php b/phpBB/modules/acp/acp_words.php index 61728c01af..87989640ec 100644 --- a/phpBB/modules/acp/acp_words.php +++ b/phpBB/modules/acp/acp_words.php @@ -26,7 +26,7 @@ class acp_words function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('acp/posting'); diff --git a/phpBB/modules/mcp/mcp_ban.php b/phpBB/modules/mcp/mcp_ban.php index f4f3708799..35535711e2 100644 --- a/phpBB/modules/mcp/mcp_ban.php +++ b/phpBB/modules/mcp/mcp_ban.php @@ -25,7 +25,7 @@ class mcp_ban function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); diff --git a/phpBB/modules/mcp/mcp_forum.php b/phpBB/modules/mcp/mcp_forum.php index 2f90e99e93..346d29d34b 100644 --- a/phpBB/modules/mcp/mcp_forum.php +++ b/phpBB/modules/mcp/mcp_forum.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ function mcp_forum_view($id, $mode, $action, $forum_info) { - global $template, $db, $user, $auth, $module, $config; + global $template, $db, $user, $auth, $module; $user->add_lang(array('viewtopic', 'viewforum')); @@ -90,7 +90,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) make_jumpbox($url . "&i=$id&action=$action&mode=$mode" . (($merge_select) ? $selected_ids : ''), $forum_id, false, 'm_', true); - $topics_per_page = ($forum_info['forum_topics_per_page']) ? $forum_info['forum_topics_per_page'] : $config['topics_per_page']; + $topics_per_page = ($forum_info['forum_topics_per_page']) ? $forum_info['forum_topics_per_page'] : phpbb::$config['topics_per_page']; $sort_days = $total = 0; $sort_key = $sort_dir = ''; @@ -138,7 +138,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $topic_rows = array(); - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $read_tracking_join = ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')'; $read_tracking_select = ', tt.mark_time'; @@ -184,7 +184,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) // Get topic tracking info if (sizeof($topic_list)) { - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $topic_rows, array($forum_id => $forum_info['mark_time']), array()); } diff --git a/phpBB/modules/mcp/mcp_front.php b/phpBB/modules/mcp/mcp_front.php index 4b229c616f..ad30774e2f 100644 --- a/phpBB/modules/mcp/mcp_front.php +++ b/phpBB/modules/mcp/mcp_front.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ function mcp_front_view($id, $mode, $action) { - global $template, $db, $user, $auth, $module, $config; + global $template, $db, $user, $auth, $module; // Latest 5 unapproved if ($module->loaded('queue')) @@ -33,7 +33,7 @@ function mcp_front_view($id, $mode, $action) $forum_id = request_var('f', 0); $template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false); - + if (!empty($forum_list)) { $sql = 'SELECT COUNT(post_id) AS total diff --git a/phpBB/modules/mcp/mcp_logs.php b/phpBB/modules/mcp/mcp_logs.php index 22b413279f..b91a7906b8 100644 --- a/phpBB/modules/mcp/mcp_logs.php +++ b/phpBB/modules/mcp/mcp_logs.php @@ -33,7 +33,7 @@ class mcp_logs function main($id, $mode) { - global $auth, $db, $user, $template, $config; + global $auth, $db, $user, $template; $user->add_lang('acp/common'); @@ -166,12 +166,12 @@ class mcp_logs // Grab log data $log_data = array(); $log_count = 0; - view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort); + view_log('mod', $log_data, $log_count, phpbb::$config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort); $template->assign_vars(array( - 'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($log_count, phpbb::$config['topics_per_page'], $start), 'TOTAL' => ($log_count == 1) ? $user->lang['TOTAL_LOG'] : sprintf($user->lang['TOTAL_LOGS'], $log_count), - 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, phpbb::$config['topics_per_page'], $start), 'L_TITLE' => $user->lang['MCP_LOGS'], @@ -187,7 +187,7 @@ class mcp_logs foreach ($log_data as $row) { $data = array(); - + $checks = array('viewtopic', 'viewforum'); foreach ($checks as $check) { diff --git a/phpBB/modules/mcp/mcp_main.php b/phpBB/modules/mcp/mcp_main.php index 71bdc78b0f..a3d5ae8a46 100644 --- a/phpBB/modules/mcp/mcp_main.php +++ b/phpBB/modules/mcp/mcp_main.php @@ -33,7 +33,7 @@ class mcp_main function main($id, $mode) { - global $auth, $db, $user, $template, $action, $config; + global $auth, $db, $user, $template, $action; $quickmod = ($mode == 'quickmod') ? true : false; @@ -931,7 +931,7 @@ function mcp_delete_post($post_ids) */ function mcp_fork_topic($topic_ids) { - global $auth, $user, $db, $template, $config; + global $auth, $user, $db, $template; if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) { @@ -1174,8 +1174,8 @@ function mcp_fork_topic($topic_ids) } sync('forum', 'forum_id', $to_forum_id); - set_config('num_topics', $config['num_topics'] + sizeof($new_topic_id_list), true); - set_config('num_posts', $config['num_posts'] + $total_posts, true); + set_config('num_topics', phpbb::$config['num_topics'] + sizeof($new_topic_id_list), true); + set_config('num_posts', phpbb::$config['num_posts'] + $total_posts, true); foreach ($new_topic_id_list as $topic_id => $new_topic_id) { diff --git a/phpBB/modules/mcp/mcp_notes.php b/phpBB/modules/mcp/mcp_notes.php index 5ca3d8f606..dbd61dfb40 100644 --- a/phpBB/modules/mcp/mcp_notes.php +++ b/phpBB/modules/mcp/mcp_notes.php @@ -33,7 +33,7 @@ class mcp_notes function main($id, $mode) { - global $auth, $db, $user, $template, $config; + global $auth, $db, $user, $template; $action = request_var('action', array('' => '')); @@ -71,7 +71,7 @@ class mcp_notes */ function mcp_notes_user_view($action) { - global $template, $db, $user, $auth, $config; + global $template, $db, $user, $auth; $user_id = request_var('u', 0); $username = request_var('username', '', true); @@ -193,7 +193,7 @@ class mcp_notes $log_data = array(); $log_count = 0; - view_log('user', $log_data, $log_count, $config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); + view_log('user', $log_data, $log_count, phpbb::$config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); if ($log_count) { @@ -220,8 +220,8 @@ class mcp_notes 'L_TITLE' => $user->lang['MCP_NOTES_USER'], - 'PAGE_NUMBER' => on_page($log_count, $config['posts_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&st=$st&sk=$sk&sd=$sd", $log_count, $config['posts_per_page'], $start), + 'PAGE_NUMBER' => on_page($log_count, phpbb::$config['posts_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&st=$st&sk=$sk&sd=$sd", $log_count, phpbb::$config['posts_per_page'], $start), 'TOTAL_REPORTS' => ($log_count == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $log_count), 'USERNAME' => $userrow['username'], diff --git a/phpBB/modules/mcp/mcp_post.php b/phpBB/modules/mcp/mcp_post.php index b296c3626f..8d4a4683cc 100644 --- a/phpBB/modules/mcp/mcp_post.php +++ b/phpBB/modules/mcp/mcp_post.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ function mcp_post_details($id, $mode, $action) { - global $template, $db, $user, $auth, $config; + global $template, $db, $user, $auth; $user->add_lang('posting'); @@ -112,7 +112,7 @@ function mcp_post_details($id, $mode, $action) $topic_tracking_info = array(); // Get topic tracking info - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $tmp_topic_data = array($post_info['topic_id'] => $post_info); $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time'])); @@ -228,7 +228,7 @@ function mcp_post_details($id, $mode, $action) // Get User Notes $log_data = array(); $log_count = 0; - view_log('user', $log_data, $log_count, $config['posts_per_page'], 0, 0, 0, $post_info['user_id']); + view_log('user', $log_data, $log_count, phpbb::$config['posts_per_page'], 0, 0, 0, $post_info['user_id']); if ($log_count) { @@ -394,7 +394,7 @@ function mcp_post_details($id, $mode, $action) */ function change_poster(&$post_info, $userdata) { - global $auth, $db, $config; + global $auth, $db; if (empty($userdata) || $userdata['user_id'] == $post_info['user_id']) { @@ -434,7 +434,7 @@ function change_poster(&$post_info, $userdata) markread('post', $post_info['forum_id'], $post_info['topic_id'], time(), $userdata['user_id']); // Remove the dotted topic option if the old user has no more posts within this topic - if ($config['load_db_track'] && $post_info['user_id'] != ANONYMOUS) + if (phpbb::$config['load_db_track'] && $post_info['user_id'] != ANONYMOUS) { $sql = 'SELECT topic_id FROM ' . POSTS_TABLE . ' @@ -465,7 +465,7 @@ function change_poster(&$post_info, $userdata) } // refresh search cache of this post - $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)) { diff --git a/phpBB/modules/mcp/mcp_queue.php b/phpBB/modules/mcp/mcp_queue.php index eefeb08f3d..1d122b8581 100644 --- a/phpBB/modules/mcp/mcp_queue.php +++ b/phpBB/modules/mcp/mcp_queue.php @@ -34,7 +34,7 @@ class mcp_queue function main($id, $mode) { global $auth, $db, $user, $template; - global $config, $action; + global $action; include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); @@ -112,7 +112,7 @@ class mcp_queue $extensions = $attachments = $topic_tracking_info = array(); // Get topic tracking info - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $tmp_topic_data = array($post_info['topic_id'] => $post_info); $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time'])); @@ -320,7 +320,7 @@ class mcp_queue AND t.topic_first_post_id <> p.post_id $limit_time_sql ORDER BY $sort_order_sql"; - $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $i = 0; $post_ids = array(); @@ -371,7 +371,7 @@ class mcp_queue AND topic_approved = 0 $limit_time_sql ORDER BY $sort_order_sql"; - $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $rowset = array(); while ($row = $db->sql_fetchrow($result)) @@ -445,8 +445,8 @@ class mcp_queue 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')), 'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true, - 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start), - 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, phpbb::$config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($total, phpbb::$config['topics_per_page'], $start), 'TOPIC_ID' => $topic_id, 'TOTAL' => ($total == 1) ? (($mode == 'unapproved_posts') ? $user->lang['VIEW_TOPIC_POST'] : $user->lang['VIEW_FORUM_TOPIC']) : sprintf((($mode == 'unapproved_posts') ? $user->lang['VIEW_TOPIC_POSTS'] : $user->lang['VIEW_FORUM_TOPICS']), $total), )); @@ -462,7 +462,7 @@ class mcp_queue */ function approve_post($post_id_list, $id, $mode) { - global $db, $template, $user, $config; + global $db, $template, $user; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -651,12 +651,12 @@ function approve_post($post_id_list, $id, $mode) if ($total_topics) { - set_config('num_topics', $config['num_topics'] + $total_topics, true); + set_config('num_topics', phpbb::$config['num_topics'] + $total_topics, true); } if ($total_posts) { - set_config('num_posts', $config['num_posts'] + $total_posts, true); + set_config('num_posts', phpbb::$config['num_posts'] + $total_posts, true); } unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql); @@ -703,7 +703,7 @@ function approve_post($post_id_list, $id, $mode) $messenger->save_queue(); // Send out normal user notifications - $email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']); + $email_sig = str_replace('<br />', "\n", "-- \n" . phpbb::$config['board_email_sig']); foreach ($post_info as $post_id => $post_data) { @@ -787,7 +787,7 @@ function approve_post($post_id_list, $id, $mode) */ function disapprove_post($post_id_list, $id, $mode) { - global $db, $template, $user, $config; + global $db, $template, $user; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { diff --git a/phpBB/modules/mcp/mcp_reports.php b/phpBB/modules/mcp/mcp_reports.php index a86e156438..fc48a24482 100644 --- a/phpBB/modules/mcp/mcp_reports.php +++ b/phpBB/modules/mcp/mcp_reports.php @@ -34,7 +34,7 @@ class mcp_reports function main($id, $mode) { global $auth, $db, $user, $template; - global $config, $action; + global $action; include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); @@ -121,7 +121,7 @@ class mcp_reports $topic_tracking_info = $extensions = $attachments = array(); // Get topic tracking info - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $tmp_topic_data = array($post_info['topic_id'] => $post_info); $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time'])); @@ -351,7 +351,7 @@ class mcp_reports AND t.topic_id = p.topic_id $limit_time_sql ORDER BY $sort_order_sql"; - $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $i = 0; $report_ids = array(); @@ -421,8 +421,8 @@ class mcp_reports 'S_FORUM_OPTIONS' => $forum_options, 'S_CLOSED' => ($mode == 'reports_closed') ? true : false, - 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start), - 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, phpbb::$config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($total, phpbb::$config['topics_per_page'], $start), 'TOPIC_ID' => $topic_id, 'TOTAL' => $total, 'TOTAL_REPORTS' => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total), @@ -440,7 +440,7 @@ class mcp_reports */ function close_report($report_id_list, $mode, $action) { - global $db, $template, $user, $config; + global $db, $template, $user; $sql = 'SELECT r.post_id FROM ' . REPORTS_TABLE . ' r diff --git a/phpBB/modules/mcp/mcp_topic.php b/phpBB/modules/mcp/mcp_topic.php index 22675a8c84..9da64df6f9 100644 --- a/phpBB/modules/mcp/mcp_topic.php +++ b/phpBB/modules/mcp/mcp_topic.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ function mcp_topic_view($id, $mode, $action) { - global $template, $db, $user, $auth, $config; + global $template, $db, $user, $auth; $url = append_sid(PHPBB_ROOT_PATH. 'mcp.' . PHP_EXT . '?' . extra_url()); @@ -108,7 +108,7 @@ function mcp_topic_view($id, $mode, $action) $total = $topic_info['topic_replies'] + 1; } - $posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page']))); + $posts_per_page = max(0, request_var('posts_per_page', intval(phpbb::$config['posts_per_page']))); if ($posts_per_page == 0) { $posts_per_page = $total; @@ -154,7 +154,7 @@ function mcp_topic_view($id, $mode, $action) $topic_tracking_info = array(); // Get topic tracking info - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $tmp_topic_data = array($topic_id => $topic_info); $topic_tracking_info = get_topic_tracking($topic_info['forum_id'], $topic_id, $tmp_topic_data, array($topic_info['forum_id'] => $topic_info['forum_mark_time'])); @@ -336,7 +336,7 @@ function mcp_topic_view($id, $mode, $action) */ function split_topic($action, $topic_id, $to_forum_id, $subject) { - global $db, $template, $user, $auth, $config; + global $db, $template, $user, $auth; $post_id_list = request_var('post_id_list', array(0)); $forum_id = request_var('forum_id', 0); @@ -500,7 +500,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $success_msg = 'TOPIC_SPLIT_SUCCESS'; // Update forum statistics - set_config('num_topics', $config['num_topics'] + 1, true); + set_config('num_topics', phpbb::$config['num_topics'] + 1, true); // Link back to both topics $return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); diff --git a/phpBB/modules/mcp/mcp_warn.php b/phpBB/modules/mcp/mcp_warn.php index 959b90079c..48515a6c64 100644 --- a/phpBB/modules/mcp/mcp_warn.php +++ b/phpBB/modules/mcp/mcp_warn.php @@ -33,7 +33,7 @@ class mcp_warn function main($id, $mode) { - global $auth, $db, $user, $template, $config; + global $auth, $db, $user, $template; $action = request_var('action', array('' => '')); @@ -75,7 +75,7 @@ class mcp_warn */ function mcp_warn_front_view() { - global $template, $db, $user, $auth, $config; + global $template, $db, $user, $auth; $template->assign_vars(array( 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=mcp&field=username&select_single=true'), @@ -133,7 +133,7 @@ class mcp_warn */ function mcp_warn_list_view($action) { - global $template, $db, $user, $auth, $config; + global $template, $db, $user, $auth; $user->add_lang('memberlist'); @@ -156,7 +156,7 @@ class mcp_warn $users = array(); $user_count = 0; - view_warned_users($users, $user_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); + view_warned_users($users, $user_count, phpbb::$config['topics_per_page'], $start, $sql_where, $sql_sort); foreach ($users as $row) { @@ -180,8 +180,8 @@ class mcp_warn 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'PAGE_NUMBER' => on_page($user_count, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination(append_sid('mcp', "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"), $user_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($user_count, phpbb::$config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination(append_sid('mcp', "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"), $user_count, phpbb::$config['topics_per_page'], $start), 'TOTAL_USERS' => ($user_count == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $user_count), )); } @@ -191,7 +191,7 @@ class mcp_warn */ function mcp_warn_post_view($action) { - global $template, $db, $user, $auth, $config; + global $template, $db, $user, $auth; $post_id = request_var('p', 0); $forum_id = request_var('f', 0); @@ -246,7 +246,7 @@ class mcp_warn } // Check if can send a notification - if ($config['allow_privmsg']) + if (phpbb::$config['allow_privmsg']) { $auth2 = new auth(); $auth2->acl($user_row); @@ -332,7 +332,7 @@ class mcp_warn */ function mcp_warn_user_view($action) { - global $config, $module; + global $module; global $template, $db, $user, $auth; $user_id = request_var('u', 0); @@ -369,7 +369,7 @@ class mcp_warn } // Check if can send a notification - if ($config['allow_privmsg']) + if (phpbb::$config['allow_privmsg']) { $auth2 = new auth(); $auth2->acl($user_row); @@ -438,14 +438,14 @@ class mcp_warn */ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) { - global $template, $db, $user, $auth, $config; + global $template, $db, $user, $auth; if ($send_pm) { include_once(PHPBB_ROOT_PATH . 'includes/functions_privmsgs.' . PHP_EXT); include_once(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT); - $user_row['user_lang'] = (file_exists(PHPBB_ROOT_PATH . 'language/' . $user_row['user_lang'] . '/mcp.' . PHP_EXT)) ? $user_row['user_lang'] : $config['default_lang']; + $user_row['user_lang'] = (file_exists(PHPBB_ROOT_PATH . 'language/' . $user_row['user_lang'] . '/mcp.' . PHP_EXT)) ? $user_row['user_lang'] : phpbb::$config['default_lang']; include(PHPBB_ROOT_PATH . 'language/' . basename($user_row['user_lang']) . '/mcp.' . PHP_EXT); $message_parser = new parse_message(); diff --git a/phpBB/modules/ucp/ucp_activate.php b/phpBB/modules/ucp/ucp_activate.php index bc4618f5fd..7fd265ecf4 100644 --- a/phpBB/modules/ucp/ucp_activate.php +++ b/phpBB/modules/ucp/ucp_activate.php @@ -27,7 +27,7 @@ class ucp_activate function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user_id = request_var('u', 0); $key = request_var('k', ''); @@ -85,7 +85,7 @@ class ucp_activate $db->sql_query($sql); } - if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) + if (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) { include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); @@ -95,7 +95,7 @@ class ucp_activate $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); diff --git a/phpBB/modules/ucp/ucp_attachments.php b/phpBB/modules/ucp/ucp_attachments.php index 5bd66028a2..0ccc6afba8 100644 --- a/phpBB/modules/ucp/ucp_attachments.php +++ b/phpBB/modules/ucp/ucp_attachments.php @@ -27,7 +27,7 @@ class ucp_attachments function main($id, $mode) { - global $template, $user, $db, $config; + global $template, $user, $db; $start = request_var('start', 0); $sort_key = request_var('sk', 'a'); @@ -127,7 +127,7 @@ class ucp_attachments WHERE a.poster_id = ' . $user->data['user_id'] . " AND a.is_orphan = 0 ORDER BY $order_by"; - $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $row_count = 0; if ($row = $db->sql_fetchrow($result)) @@ -172,8 +172,8 @@ class ucp_attachments $db->sql_freeresult($result); $template->assign_vars(array( - 'PAGE_NUMBER' => on_page($num_attachments, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($num_attachments, phpbb::$config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&sk=$sort_key&sd=$sort_dir", $num_attachments, phpbb::$config['topics_per_page'], $start), 'TOTAL_ATTACHMENTS' => $num_attachments, 'L_TITLE' => $user->lang['UCP_ATTACHMENTS'], diff --git a/phpBB/modules/ucp/ucp_confirm.php b/phpBB/modules/ucp/ucp_confirm.php index 26ffc3c5fb..d8e4a06b60 100644 --- a/phpBB/modules/ucp/ucp_confirm.php +++ b/phpBB/modules/ucp/ucp_confirm.php @@ -35,9 +35,9 @@ class ucp_confirm function main($id, $mode) { - global $db, $user, $config; + global $db, $user; include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT); - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = phpbb_captcha_factory::get_instance(phpbb::$config['captcha_plugin']); $captcha->init(request_var('type', 0)); $captcha->execute(); garbage_collection(); diff --git a/phpBB/modules/ucp/ucp_groups.php b/phpBB/modules/ucp/ucp_groups.php index f8c676df5f..e081583358 100644 --- a/phpBB/modules/ucp/ucp_groups.php +++ b/phpBB/modules/ucp/ucp_groups.php @@ -26,7 +26,7 @@ class ucp_groups function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $user->add_lang('groups'); @@ -485,7 +485,7 @@ class ucp_groups $avatar_select = basename(request_var('avatar_select', '')); $category = basename(request_var('category', '')); - $can_upload = (file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $file_uploads) ? true : false; + $can_upload = (file_exists(PHPBB_ROOT_PATH . phpbb::$config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . phpbb::$config['avatar_path']) && $file_uploads) ? true : false; // Did we submit? if ($update) @@ -536,14 +536,14 @@ class ucp_groups } } } - else if ($avatar_select && $config['allow_avatar_local']) + else if ($avatar_select && phpbb::$config['allow_avatar_local']) { // 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)) { $submit_ary['avatar_type'] = AVATAR_GALLERY; - list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize(PHPBB_ROOT_PATH . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select); + list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize(PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select); $submit_ary['avatar'] = $category . '/' . $avatar_select; } } @@ -555,21 +555,21 @@ class ucp_groups else if ($data['width'] && $data['height']) { // Only update the dimensions? - if ($config['avatar_max_width'] || $config['avatar_max_height']) + if (phpbb::$config['avatar_max_width'] || phpbb::$config['avatar_max_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']); } } } @@ -670,12 +670,12 @@ class ucp_groups $display_gallery = phpbb_request::is_set_post('display_gallery'); - if ($config['allow_avatar_local'] && $display_gallery) + if (phpbb::$config['allow_avatar_local'] && $display_gallery) { avatar_gallery($category, $avatar_select, 4); } - $avatars_enabled = ($can_upload || ($config['allow_avatar_local'] || $config['allow_avatar_remote'])) ? true : false; + $avatars_enabled = ($can_upload || (phpbb::$config['allow_avatar_local'] || phpbb::$config['allow_avatar_remote'])) ? true : false; $template->assign_vars(array( 'S_EDIT' => true, @@ -685,8 +685,8 @@ class ucp_groups 'S_ERROR' => (sizeof($error)) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, 'S_AVATARS_ENABLED' => $avatars_enabled, - 'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false, - 'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false, + 'S_DISPLAY_GALLERY' => (phpbb::$config['allow_avatar_local'] && !$display_gallery) ? true : false, + 'S_IN_GALLERY' => (phpbb::$config['allow_avatar_local'] && $display_gallery) ? true : false, 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', @@ -699,7 +699,7 @@ class ucp_groups 'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'], 'S_RANK_OPTIONS' => $rank_options, - 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], + 'AVATAR_MAX_FILESIZE' => phpbb::$config['avatar_filesize'], 'GROUP_TYPE_FREE' => GROUP_FREE, 'GROUP_TYPE_OPEN' => GROUP_OPEN, @@ -714,7 +714,7 @@ class ucp_groups 'U_SWATCH' => append_sid(CONFIG_ADM_FOLDER . '/swatch', 'form=ucp&name=group_colour'), 'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id", - 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), + 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], phpbb::$config['avatar_filesize'] / 1024), )); break; @@ -780,7 +780,7 @@ class ucp_groups AND u.user_id = ug.user_id AND ug.group_leader = 0 ORDER BY ug.user_pending DESC, u.username_clean"; - $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $pending = false; $approved = false; @@ -830,8 +830,8 @@ class ucp_groups $template->assign_vars(array( 'S_LIST' => true, 'S_ACTION_OPTIONS' => $s_action_options, - 'S_ON_PAGE' => on_page($total_members, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start), + 'S_ON_PAGE' => on_page($total_members, phpbb::$config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, phpbb::$config['topics_per_page'], $start), 'U_ACTION' => $this->u_action . "&g=$group_id", 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=ucp&field=usernames'), diff --git a/phpBB/modules/ucp/ucp_main.php b/phpBB/modules/ucp/ucp_main.php index 2b239e8205..24fc74d8cb 100644 --- a/phpBB/modules/ucp/ucp_main.php +++ b/phpBB/modules/ucp/ucp_main.php @@ -33,7 +33,7 @@ class ucp_main function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; switch ($mode) { @@ -44,14 +44,14 @@ class ucp_main $sql_from = TOPICS_TABLE . ' t '; $sql_select = ''; - if ($config['load_db_track']) + if (phpbb::$config['load_db_track']) { $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id'] . ')'; $sql_select .= ', tp.topic_posted'; } - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')'; @@ -100,7 +100,7 @@ class ucp_main } $topic_tracking_info = array(); - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $topic_tracking_info = get_topic_tracking(0, $topic_list, $rowset, false, $topic_list); } @@ -163,7 +163,7 @@ class ucp_main ); } - if ($config['load_user_activity']) + if (phpbb::$config['load_user_activity']) { if (!function_exists('display_user_activity')) { @@ -175,7 +175,7 @@ class ucp_main // Do the relevant calculations $memberdays = max(1, round((time() - $user->data['user_regdate']) / 86400)); $posts_per_day = $user->data['user_posts'] / $memberdays; - $percentage = ($config['num_posts']) ? min(100, ($user->data['user_posts'] / $config['num_posts']) * 100) : 0; + $percentage = (phpbb::$config['num_posts']) ? min(100, ($user->data['user_posts'] / phpbb::$config['num_posts']) * 100) : 0; $template->assign_vars(array( 'USER_COLOR' => (!empty($user->data['user_colour'])) ? $user->data['user_colour'] : '', @@ -254,7 +254,7 @@ class ucp_main $forbidden_forums = array(); - if ($config['allow_forum_notify']) + if (phpbb::$config['allow_forum_notify']) { $forbidden_forums = $auth->acl_getf('!f_read', true); $forbidden_forums = array_unique(array_keys($forbidden_forums)); @@ -274,7 +274,7 @@ class ucp_main 'ORDER_BY' => 'left_id' ); - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $sql_array['LEFT_JOIN'] = array( array( @@ -287,7 +287,7 @@ class ucp_main } else { - $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(); } @@ -298,13 +298,13 @@ class ucp_main { $forum_id = $row['forum_id']; - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $forum_check = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark']; } else { - $forum_check = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + $forum_check = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + phpbb::$config['board_startdate']) : $user->data['user_lastmark']; } $unread_forum = ($row['forum_last_post_time'] > $forum_check) ? true : false; @@ -356,7 +356,7 @@ class ucp_main } // Subscribed Topics - if ($config['allow_topic_notify']) + if (phpbb::$config['allow_topic_notify']) { if (empty($forbidden_forums)) { @@ -367,15 +367,15 @@ class ucp_main } $template->assign_vars(array( - 'S_TOPIC_NOTIFY' => $config['allow_topic_notify'], - 'S_FORUM_NOTIFY' => $config['allow_forum_notify'], + 'S_TOPIC_NOTIFY' => phpbb::$config['allow_topic_notify'], + 'S_FORUM_NOTIFY' => phpbb::$config['allow_forum_notify'], )); break; case 'bookmarks': - if (!$config['allow_bookmarks']) + if (!phpbb::$config['allow_bookmarks']) { $template->assign_vars(array( 'S_NO_DISPLAY_BOOKMARKS' => true) @@ -633,7 +633,7 @@ class ucp_main */ function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array()) { - global $user, $db, $template, $config, $auth; + global $user, $db, $template, $auth; $table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE; $start = request_var('start', 0); @@ -658,8 +658,8 @@ class ucp_main if ($topics_count) { $template->assign_vars(array( - 'PAGINATION' => generate_pagination($this->u_action, $topics_count, $config['topics_per_page'], $start), - 'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action, $topics_count, phpbb::$config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($topics_count, phpbb::$config['topics_per_page'], $start), 'TOTAL_TOPICS' => ($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count)) ); } @@ -705,21 +705,21 @@ class ucp_main $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 't.forum_id = f.forum_id'); - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']); $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']); $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time AS forum_mark_time'; } - if ($config['load_db_track']) + if (phpbb::$config['load_db_track']) { $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id']); $sql_array['SELECT'] .= ', tp.topic_posted'; } $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $topic_list = $topic_forum_list = $global_announce_list = $rowset = array(); while ($row = $db->sql_fetchrow($result)) @@ -729,7 +729,7 @@ class ucp_main $topic_list[] = $topic_id; $rowset[$topic_id] = $row; - $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread']) ? $row['forum_mark_time'] : 0; + $topic_forum_list[$row['forum_id']]['forum_mark_time'] = (phpbb::$config['load_db_lastread']) ? $row['forum_mark_time'] : 0; $topic_forum_list[$row['forum_id']]['topics'][] = $topic_id; if ($row['topic_type'] == POST_GLOBAL) @@ -740,7 +740,7 @@ class ucp_main $db->sql_freeresult($result); $topic_tracking_info = array(); - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { foreach ($topic_forum_list as $f_id => $topic_row) { diff --git a/phpBB/modules/ucp/ucp_pm.php b/phpBB/modules/ucp/ucp_pm.php index 15e73bda27..76992be0df 100644 --- a/phpBB/modules/ucp/ucp_pm.php +++ b/phpBB/modules/ucp/ucp_pm.php @@ -43,7 +43,7 @@ class ucp_pm function main($id, $mode) { - global $user, $template, $auth, $db, $config; + global $user, $template, $auth, $db; if (!$user->data['is_registered']) { @@ -51,7 +51,7 @@ class ucp_pm } // Is PM disabled? - if (!$config['allow_privmsg']) + if (!phpbb::$config['allow_privmsg']) { trigger_error('PM_DISABLED'); } diff --git a/phpBB/modules/ucp/ucp_pm_compose.php b/phpBB/modules/ucp/ucp_pm_compose.php index d81f5287eb..cebb3a11dc 100644 --- a/phpBB/modules/ucp/ucp_pm_compose.php +++ b/phpBB/modules/ucp/ucp_pm_compose.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) */ function compose_pm($id, $mode, $action) { - global $template, $db, $auth, $user, $config; + global $template, $db, $auth, $user; // Damn php and globals - i know, this is horrible // Needed for handle_message_list_actions() @@ -62,7 +62,7 @@ function compose_pm($id, $mode, $action) || $remove_u || $remove_g || $add_to || $add_bcc; $action = ($delete && !$preview && !$refresh && $submit) ? 'delete' : $action; - $select_single = ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? false : true; + $select_single = (phpbb::$config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? false : true; $error = array(); $current_time = time(); @@ -81,7 +81,7 @@ function compose_pm($id, $mode, $action) if ($action != 'edit') { // Add groups to PM box - if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) + if (phpbb::$config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) { $sql = 'SELECT g.group_id, g.group_name, g.group_type FROM ' . GROUPS_TABLE . ' g'; @@ -113,8 +113,8 @@ function compose_pm($id, $mode, $action) $template->assign_vars(array( 'S_SHOW_PM_BOX' => true, - 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false, - 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) ? $group_options : '', + 'S_ALLOW_MASS_PM' => (phpbb::$config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false, + 'S_GROUP_OPTIONS' => (phpbb::$config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) ? $group_options : '', 'U_FIND_USERNAME' => append_sid('memberlist', "mode=searchuser&form=postform&field=username_list&select_single=$select_single"), )); } @@ -206,7 +206,7 @@ function compose_pm($id, $mode, $action) break; } - if ($action == 'forward' && (!$config['forward_pm'] || !$auth->acl_get('u_pm_forward'))) + if ($action == 'forward' && (!phpbb::$config['forward_pm'] || !$auth->acl_get('u_pm_forward'))) { trigger_error('NO_AUTH_FORWARD_MESSAGE'); } @@ -353,14 +353,14 @@ function compose_pm($id, $mode, $action) $check_value = 0; } - if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group'))) + if (($to_group_id || isset($address_list['g'])) && (!phpbb::$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group'))) { trigger_error('NO_AUTH_GROUP_MESSAGE'); } if ($action == 'edit' && !$refresh && !$preview && !$submit) { - if (!($message_time > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time'])) + if (!($message_time > time() - (phpbb::$config['pm_edit_time'] * 60) || !phpbb::$config['pm_edit_time'])) { trigger_error('CANNOT_EDIT_MESSAGE_TIME'); } @@ -428,7 +428,7 @@ function compose_pm($id, $mode, $action) $max_recipients = (int) $db->sql_fetchfield('max_recipients'); $db->sql_freeresult($result); - $max_recipients = (!$max_recipients) ? $config['pm_max_recipients'] : $max_recipients; + $max_recipients = (!$max_recipients) ? phpbb::$config['pm_max_recipients'] : $max_recipients; // If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients if (($action == 'reply' || $action == 'quote') && $max_recipients) @@ -454,14 +454,14 @@ function compose_pm($id, $mode, $action) handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc); // Check mass pm to group permission - if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group')) && !empty($address_list['g'])) + if ((!phpbb::$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group')) && !empty($address_list['g'])) { $address_list = array(); $error[] = $user->lang['NO_AUTH_GROUP_MESSAGE']; } // Check mass pm to users permission - if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1) + if ((!phpbb::$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1) { $address_list = get_recipients($address_list, 1); $error[] = $user->lang('TOO_MANY_RECIPIENTS', 1); @@ -494,9 +494,9 @@ function compose_pm($id, $mode, $action) if (!in_array($action, array('quote', 'edit', 'delete', 'forward'))) { - $enable_sig = ($config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig') && $user->optionget('attachsig')); - $enable_smilies = ($config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && $user->optionget('smilies')); - $enable_bbcode = ($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode') && $user->optionget('bbcode')); + $enable_sig = (phpbb::$config['allow_sig'] && phpbb::$config['allow_sig_pm'] && $auth->acl_get('u_sig') && $user->optionget('attachsig')); + $enable_smilies = (phpbb::$config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && $user->optionget('smilies')); + $enable_bbcode = (phpbb::$config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode') && $user->optionget('bbcode')); $enable_urls = true; } @@ -526,11 +526,11 @@ function compose_pm($id, $mode, $action) $message_parser->bbcode_uid = $bbcode_uid; } - $bbcode_status = ($config['allow_bbcode'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode')) ? true : false; - $smilies_status = ($config['allow_smilies'] && $config['auth_smilies_pm'] && $auth->acl_get('u_pm_smilies')) ? true : false; - $img_status = ($config['auth_img_pm'] && $auth->acl_get('u_pm_img')) ? true : false; - $flash_status = ($config['auth_flash_pm'] && $auth->acl_get('u_pm_flash')) ? true : false; - $url_status = ($config['allow_post_links']) ? true : false; + $bbcode_status = (phpbb::$config['allow_bbcode'] && phpbb::$config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode')) ? true : false; + $smilies_status = (phpbb::$config['allow_smilies'] && phpbb::$config['auth_smilies_pm'] && $auth->acl_get('u_pm_smilies')) ? true : false; + $img_status = (phpbb::$config['auth_img_pm'] && $auth->acl_get('u_pm_img')) ? true : false; + $flash_status = (phpbb::$config['auth_flash_pm'] && $auth->acl_get('u_pm_flash')) ? true : false; + $url_status = (phpbb::$config['allow_post_links']) ? true : false; // Save Draft if ($save && $auth->acl_get('u_savedrafts')) @@ -640,7 +640,7 @@ function compose_pm($id, $mode, $action) $enable_bbcode = (!$bbcode_status || phpbb_request::is_set_post('disable_bbcode')) ? false : true; $enable_smilies = (!$smilies_status || phpbb_request::is_set_post'disable_smilies')) ? false : true; $enable_urls = (phpbb_request::is_set_post('disable_magic_url')) ? 0 : 1; - $enable_sig = (!$config['allow_sig'] ||!$config['allow_sig_pm']) ? false : phpbb_request::is_set_post('attach_sig'); + $enable_sig = (!phpbb::$config['allow_sig'] ||!phpbb::$config['allow_sig_pm']) ? false : phpbb_request::is_set_post('attach_sig'); if ($submit) { @@ -662,7 +662,7 @@ function compose_pm($id, $mode, $action) } // Parse message - $message_parser->parse($enable_bbcode, ($config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']); + $message_parser->parse($enable_bbcode, (phpbb::$config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, phpbb::$config['allow_post_links']); // On a refresh we do not care about message parsing errors if (sizeof($message_parser->warn_msg) && !$refresh) @@ -670,14 +670,14 @@ function compose_pm($id, $mode, $action) $error[] = implode('<br />', $message_parser->warn_msg); } - if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('u_ignoreflood')) + if ($action != 'edit' && !$preview && !$refresh && phpbb::$config['flood_interval'] && !$auth->acl_get('u_ignoreflood')) { // Flood check $last_post_time = $user->data['user_lastpost_time']; if ($last_post_time) { - if ($last_post_time && ($current_time - $last_post_time) < intval($config['flood_interval'])) + if ($last_post_time && ($current_time - $last_post_time) < intval(phpbb::$config['flood_interval'])) { $error[] = $user->lang['FLOOD_ERROR']; } @@ -746,7 +746,7 @@ function compose_pm($id, $mode, $action) $preview_signature_bitfield = $user->data['user_sig_bbcode_bitfield']; // Signature - if ($enable_sig && $config['allow_sig'] && $preview_signature) + if ($enable_sig && phpbb::$config['allow_sig'] && $preview_signature) { $parse_sig = new parse_message($preview_signature); $parse_sig->bbcode_uid = $preview_signature_uid; @@ -805,7 +805,7 @@ function compose_pm($id, $mode, $action) if ($action == 'quotepost') { $post_id = request_var('p', 0); - if ($config['allow_post_links']) + if (phpbb::$config['allow_post_links']) { $message_link = "[url=" . generate_board_url() . '/viewtopic.' . PHP_EXT . "?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}: {$message_subject}[/url]\n\n"; } @@ -830,7 +830,7 @@ function compose_pm($id, $mode, $action) { $fwd_to_field = write_pm_addresses(array('to' => $post['to_address']), 0, true); - if ($config['allow_post_links']) + if (phpbb::$config['allow_post_links']) { $quote_username_text = '[url=' . generate_board_url() . '/memberlist.' . PHP_EXT . "?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]"; } @@ -861,7 +861,7 @@ function compose_pm($id, $mode, $action) // Generate PM Icons $s_pm_icons = false; - if ($config['enable_pm_icons']) + if (phpbb::$config['enable_pm_icons']) { $s_pm_icons = posting_gen_topic_icons($action, $icon_id); } @@ -976,8 +976,8 @@ function compose_pm($id, $mode, $action) $s_hidden_address_field = build_address_field($address_list); - $bbcode_checked = (isset($enable_bbcode)) ? !$enable_bbcode : (($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode')) ? !$user->optionget('bbcode') : 1); - $smilies_checked = (isset($enable_smilies)) ? !$enable_smilies : (($config['allow_smilies'] && $auth->acl_get('u_pm_smilies')) ? !$user->optionget('smilies') : 1); + $bbcode_checked = (isset($enable_bbcode)) ? !$enable_bbcode : ((phpbb::$config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode')) ? !$user->optionget('bbcode') : 1); + $smilies_checked = (isset($enable_smilies)) ? !$enable_smilies : ((phpbb::$config['allow_smilies'] && $auth->acl_get('u_pm_smilies')) ? !$user->optionget('smilies') : 1); $urls_checked = (isset($enable_urls)) ? !$enable_urls : 0; $sig_checked = $enable_sig; @@ -1016,13 +1016,13 @@ function compose_pm($id, $mode, $action) $s_hidden_fields .= (isset($check_value)) ? '<input type="hidden" name="status_switch" value="' . $check_value . '" />' : ''; $s_hidden_fields .= ($draft_id || phpbb_request::is_set('draft_loaded')) ? '<input type="hidden" name="draft_loaded" value="' . request_var('draft_loaded', (int) $draft_id) . '" />' : ''; - $form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"'; + $form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !phpbb::$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"'; // Start assigning vars for main posting page ... $template->assign_vars(array( 'L_POST_A' => $page_title, 'L_ICON' => $user->lang['PM_ICON'], - 'L_MESSAGE_BODY_EXPLAIN' => (intval($config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '', + 'L_MESSAGE_BODY_EXPLAIN' => (intval(phpbb::$config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval(phpbb::$config['max_post_chars'])) : '', 'SUBJECT' => (isset($message_subject)) ? $message_subject : '', 'MESSAGE' => $message_text, @@ -1033,7 +1033,7 @@ function compose_pm($id, $mode, $action) 'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', - 'MAX_RECIPIENTS' => ($config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0, + 'MAX_RECIPIENTS' => (phpbb::$config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0, 'S_COMPOSE_PM' => true, 'S_EDIT_POST' => ($action == 'edit'), @@ -1042,7 +1042,7 @@ function compose_pm($id, $mode, $action) 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, 'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '', - 'S_SIG_ALLOWED' => ($config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig')), + 'S_SIG_ALLOWED' => (phpbb::$config['allow_sig'] && phpbb::$config['allow_sig_pm'] && $auth->acl_get('u_sig')), 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', 'S_LINKS_ALLOWED' => $url_status, 'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '', @@ -1068,7 +1068,7 @@ function compose_pm($id, $mode, $action) display_custom_bbcodes(); // Show attachment box for adding attachments if true - $allowed = ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype); + $allowed = ($auth->acl_get('u_pm_attach') && phpbb::$config['allow_pm_attach'] && $form_enctype); // Attachment entry posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); diff --git a/phpBB/modules/ucp/ucp_pm_options.php b/phpBB/modules/ucp/ucp_pm_options.php index 4b25056d82..43e1c8713a 100644 --- a/phpBB/modules/ucp/ucp_pm_options.php +++ b/phpBB/modules/ucp/ucp_pm_options.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions) { - global $user, $template, $auth, $config, $db; + global $user, $template, $auth, $db; $redirect_url = append_sid('ucp', "i=pm&mode=options"); @@ -29,7 +29,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Change "full folder" setting - what to do if folder is full if (phpbb_request::is_set_post('fullfolder')) { - check_form_key('ucp_pm_options', $config['form_token_lifetime'], $redirect_url); + check_form_key('ucp_pm_options', phpbb::$config['form_token_lifetime'], $redirect_url); $full_action = request_var('full_action', 0); $set_folder_id = 0; @@ -97,7 +97,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $num_folder = (int) $db->sql_fetchfield('num_folder'); $db->sql_freeresult($result); - if ($num_folder >= $config['pm_max_boxes']) + if ($num_folder >= phpbb::$config['pm_max_boxes']) { trigger_error('MAX_FOLDER_REACHED'); } @@ -429,7 +429,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit if ($user->data['user_full_folder'] == FULL_FOLDER_NONE) { // -3 here to let the correct folder id be selected - $to_folder_id = $config['full_folder_action'] - 3; + $to_folder_id = phpbb::$config['full_folder_action'] - 3; } else { @@ -453,7 +453,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit if ($user->data['user_full_folder'] == FULL_FOLDER_NONE) { - switch ($config['full_folder_action']) + switch (phpbb::$config['full_folder_action']) { case 1: $s_delete_checked = ' checked="checked"'; @@ -472,10 +472,10 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit 'S_DELETE_CHECKED' => $s_delete_checked, 'S_HOLD_CHECKED' => $s_hold_checked, 'S_MOVE_CHECKED' => $s_move_checked, - 'S_MAX_FOLDER_REACHED' => ($num_user_folder >= $config['pm_max_boxes']) ? true : false, - 'S_MAX_FOLDER_ZERO' => ($config['pm_max_boxes'] == 0) ? true : false, + 'S_MAX_FOLDER_REACHED' => ($num_user_folder >= phpbb::$config['pm_max_boxes']) ? true : false, + 'S_MAX_FOLDER_ZERO' => (phpbb::$config['pm_max_boxes'] == 0) ? true : false, - 'DEFAULT_ACTION' => ($config['full_folder_action'] == 1) ? $user->lang['DELETE_OLDEST_MESSAGES'] : $user->lang['HOLD_NEW_MESSAGES'], + 'DEFAULT_ACTION' => (phpbb::$config['full_folder_action'] == 1) ? $user->lang['DELETE_OLDEST_MESSAGES'] : $user->lang['HOLD_NEW_MESSAGES'], 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=ucp&field=rule_string&select_single=true'), )); diff --git a/phpBB/modules/ucp/ucp_pm_viewfolder.php b/phpBB/modules/ucp/ucp_pm_viewfolder.php index 7024c1d318..7c5c2480c2 100644 --- a/phpBB/modules/ucp/ucp_pm_viewfolder.php +++ b/phpBB/modules/ucp/ucp_pm_viewfolder.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) */ function view_folder($id, $mode, $folder_id, $folder) { - global $user, $template, $auth, $db, $config; + global $user, $template, $auth, $db; $submit_export = phpbb_request::is_set_post('submit_export'); @@ -228,12 +228,12 @@ function view_folder($id, $mode, $folder_id, $folder) 'SUBJECT' => censor_text($row['message_subject']), 'FOLDER' => (isset($folder[$row['folder_id']])) ? $folder[$row['folder_id']]['folder_name'] : '', 'U_FOLDER' => (isset($folder[$row['folder_id']])) ? append_sid('ucp', 'folder=' . $row['folder_id']) : '', - 'PM_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '', - 'PM_ICON_URL' => (!empty($icons[$row['icon_id']])) ? $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] : '', + 'PM_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . phpbb::$config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '', + 'PM_ICON_URL' => (!empty($icons[$row['icon_id']])) ? phpbb::$config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] : '', 'FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, 'src'), 'PM_IMG' => ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '', - 'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && $config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && phpbb::$config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'S_PM_DELETED' => ($row['pm_deleted']) ? true : false, 'S_AUTHOR_DELETED' => ($row['author_id'] == ANONYMOUS) ? true : false, @@ -249,7 +249,7 @@ function view_folder($id, $mode, $folder_id, $folder) 'S_SHOW_RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? true : false, 'S_SHOW_COLOUR_LEGEND' => true, - 'S_PM_ICONS' => ($config['enable_pm_icons']) ? true : false) + 'S_PM_ICONS' => (phpbb::$config['enable_pm_icons']) ? true : false) ); } } @@ -438,7 +438,7 @@ function view_folder($id, $mode, $folder_id, $folder) */ function get_pm_from($folder_id, $folder, $user_id) { - global $user, $db, $template, $config, $auth; + global $user, $db, $template, $auth; $start = request_var('start', 0); @@ -497,8 +497,8 @@ function get_pm_from($folder_id, $folder, $user_id) } $template->assign_vars(array( - 'PAGINATION' => generate_pagination(append_sid('ucp', "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"), $pm_count, $config['topics_per_page'], $start), - 'PAGE_NUMBER' => on_page($pm_count, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination(append_sid('ucp', "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"), $pm_count, phpbb::$config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($pm_count, phpbb::$config['topics_per_page'], $start), 'TOTAL_MESSAGES' => (($pm_count == 1) ? $user->lang['VIEW_PM_MESSAGE'] : sprintf($user->lang['VIEW_PM_MESSAGES'], $pm_count)), 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'PM_LOCKED') : $user->img('button_pm_new', 'POST_PM'), @@ -508,7 +508,7 @@ function get_pm_from($folder_id, $folder, $user_id) 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'S_TOPIC_ICONS' => ($config['enable_pm_icons']) ? true : false, + 'S_TOPIC_ICONS' => (phpbb::$config['enable_pm_icons']) ? true : false, 'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid('ucp', 'i=pm&mode=compose') : '', 'S_PM_ACTION' => append_sid('ucp', "i=pm&mode=view&action=view_folder&f=$folder_id" . (($start !== 0) ? "&start=$start" : ''))) @@ -519,14 +519,14 @@ function get_pm_from($folder_id, $folder, $user_id) // If the user is trying to reach late pages, start searching from the end $store_reverse = false; - $sql_limit = $config['topics_per_page']; + $sql_limit = phpbb::$config['topics_per_page']; if ($start > $pm_count / 2) { $store_reverse = true; - if ($start + $config['topics_per_page'] > $pm_count) + if ($start + phpbb::$config['topics_per_page'] > $pm_count) { - $sql_limit = min($config['topics_per_page'], max(1, $pm_count - $start)); + $sql_limit = min(phpbb::$config['topics_per_page'], max(1, $pm_count - $start)); } // Select the sort order diff --git a/phpBB/modules/ucp/ucp_pm_viewmessage.php b/phpBB/modules/ucp/ucp_pm_viewmessage.php index cd183a1085..793e9078a2 100644 --- a/phpBB/modules/ucp/ucp_pm_viewmessage.php +++ b/phpBB/modules/ucp/ucp_pm_viewmessage.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) { - global $user, $template, $auth, $db, $config; + global $user, $template, $auth, $db; $user->add_lang(array('viewtopic', 'memberlist')); @@ -79,7 +79,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $message_row['message_subject'] = censor_text($message_row['message_subject']); // Editing information - if ($message_row['message_edit_count'] && $config['display_last_edited']) + if ($message_row['message_edit_count'] && phpbb::$config['display_last_edited']) { $l_edit_time_total = ($message_row['message_edit_count'] == 1) ? $user->lang['EDITED_TIME_TOTAL'] : $user->lang['EDITED_TIMES_TOTAL']; $l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, (!$message_row['message_edit_user']) ? $message_row['username'] : $message_row['message_edit_user'], $user->format_date($message_row['message_edit_time'], false, true), $message_row['message_edit_count']); @@ -93,7 +93,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $display_notice = false; $attachments = array(); - if ($message_row['message_attachment'] && $config['allow_pm_attach']) + if ($message_row['message_attachment'] && phpbb::$config['allow_pm_attach']) { if ($auth->acl_get('u_pm_download')) { @@ -143,7 +143,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $user_info['sig'] = ''; - $signature = ($message_row['enable_sig'] && $config['allow_sig'] && $auth->acl_get('u_sig') && $user->optionget('viewsigs')) ? $user_info['user_sig'] : ''; + $signature = ($message_row['enable_sig'] && phpbb::$config['allow_sig'] && $auth->acl_get('u_sig') && $user->optionget('viewsigs')) ? $user_info['user_sig'] : ''; // End signature parsing, only if needed if ($signature) @@ -180,8 +180,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'AUTHOR_POSTS' => (!empty($user_info['user_posts'])) ? $user_info['user_posts'] : '', 'AUTHOR_FROM' => (!empty($user_info['user_from'])) ? $user_info['user_from'] : '', - 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : ((isset($user_info['online']) && $user_info['online']) ? $user->img('icon_user_online', $user->lang['ONLINE']) : $user->img('icon_user_offline', $user->lang['OFFLINE'])), - 'S_ONLINE' => (!$config['load_onlinetrack']) ? false : ((isset($user_info['online']) && $user_info['online']) ? true : false), + 'ONLINE_IMG' => (!phpbb::$config['load_onlinetrack']) ? '' : ((isset($user_info['online']) && $user_info['online']) ? $user->img('icon_user_online', $user->lang['ONLINE']) : $user->img('icon_user_offline', $user->lang['OFFLINE'])), + 'S_ONLINE' => (!phpbb::$config['load_onlinetrack']) ? false : ((isset($user_info['online']) && $user_info['online']) ? true : false), 'DELETE_IMG' => $user->img('icon_post_delete', $user->lang['DELETE_MESSAGE']), 'INFO_IMG' => $user->img('icon_post_info', $user->lang['VIEW_PM_INFO']), 'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['READ_PROFILE']), @@ -198,7 +198,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'EDITED_MESSAGE' => $l_edited_by, 'MESSAGE_ID' => $message_row['msg_id'], - 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid('ucp', 'i=pm&mode=compose&u=' . $author_id) : '', + 'U_PM' => (phpbb::$config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid('ucp', 'i=pm&mode=compose&u=' . $author_id) : '', 'U_WWW' => (!empty($user_info['user_website'])) ? $user_info['user_website'] : '', 'U_ICQ' => ($user_info['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($user_info['user_icq']) : '', 'U_AIM' => ($user_info['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid('memberlist', 'mode=contact&action=aim&u=' . $author_id) : '', @@ -209,7 +209,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_EMAIL' => $user_info['email'], 'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=$folder_id&p=" . $message_row['msg_id'] : '', - 'U_EDIT' => (($message_row['message_time'] > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $auth->acl_get('u_pm_edit')) ? "$url&mode=compose&action=edit&f=$folder_id&p=" . $message_row['msg_id'] : '', + 'U_EDIT' => (($message_row['message_time'] > time() - (phpbb::$config['pm_edit_time'] * 60) || !phpbb::$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $auth->acl_get('u_pm_edit')) ? "$url&mode=compose&action=edit&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_POST_REPLY_PM' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_PREVIOUS_PM' => "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=previous", 'U_NEXT_PM' => "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=next", @@ -219,8 +219,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, 'S_SPECIAL_FOLDER' => in_array($folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)), - 'U_PRINT_PM' => ($config['print_pm'] && $auth->acl_get('u_pm_printpm')) ? "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=print" : '', - 'U_FORWARD_PM' => ($config['forward_pm'] && $auth->acl_get('u_sendpm') && $auth->acl_get('u_pm_forward')) ? "$url&mode=compose&action=forward&f=$folder_id&p=" . $message_row['msg_id'] : '') + 'U_PRINT_PM' => (phpbb::$config['print_pm'] && $auth->acl_get('u_pm_printpm')) ? "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=print" : '', + 'U_FORWARD_PM' => (phpbb::$config['forward_pm'] && $auth->acl_get('u_sendpm') && $auth->acl_get('u_pm_forward')) ? "$url&mode=compose&action=forward&f=$folder_id&p=" . $message_row['msg_id'] : '') ); // Display not already displayed Attachments for this post, we already parsed them. ;) @@ -249,7 +249,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) */ function get_user_information($user_id, $user_row) { - global $db, $auth, $user, $config; + global $db, $auth, $user; if (!$user_id) { @@ -271,7 +271,7 @@ function get_user_information($user_id, $user_row) $user_row['rank_title'] = $user_row['rank_image'] = $user_row['rank_image_src'] = $user_row['email'] = ''; // Generate online information for user - if ($config['load_onlinetrack']) + if (phpbb::$config['load_onlinetrack']) { $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . " @@ -281,7 +281,7 @@ function get_user_information($user_id, $user_row) $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - $update_time = $config['load_online_time'] * 60; + $update_time = phpbb::$config['load_online_time'] * 60; if ($row) { $user_row['online'] = (time() - $update_time < $row['online_time'] && ($row['viewonline'])) ? true : false; @@ -299,7 +299,7 @@ function get_user_information($user_id, $user_row) if (!empty($user_row['user_allow_viewemail']) || $auth->acl_get('a_email')) { - $user_row['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid('memberlist', "mode=email&u=$user_id") : ((($config['board_hide_emails'] && !$auth->acl_get('a_email')) || empty($user_row['user_email'])) ? '' : 'mailto:' . $user_row['user_email']); + $user_row['email'] = (phpbb::$config['board_email_form'] && phpbb::$config['email_enable']) ? append_sid('memberlist', "mode=email&u=$user_id") : (((phpbb::$config['board_hide_emails'] && !$auth->acl_get('a_email')) || empty($user_row['user_email'])) ? '' : 'mailto:' . $user_row['user_email']); } return $user_row; diff --git a/phpBB/modules/ucp/ucp_prefs.php b/phpBB/modules/ucp/ucp_prefs.php index 4e78d480ab..3c4cb354d7 100644 --- a/phpBB/modules/ucp/ucp_prefs.php +++ b/phpBB/modules/ucp/ucp_prefs.php @@ -27,7 +27,7 @@ class ucp_prefs function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; $submit = phpbb_request::is_set_post('submit'); $error = $data = array(); @@ -53,7 +53,7 @@ class ucp_prefs 'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']), ); - if ($data['notifymethod'] == NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml'))) + if ($data['notifymethod'] == NOTIFY_IM && (!phpbb::$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml'))) { // Jabber isnt enabled, or no jabber field filled in. Update the users table to be sure its correct. $data['notifymethod'] = NOTIFY_BOTH; @@ -61,7 +61,7 @@ class ucp_prefs if ($submit) { - $data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style']; + $data['style'] = (phpbb::$config['override_user_style']) ? phpbb::$config['default_style'] : $data['style']; $error = validate_data($data, array( 'dateformat' => array('string', false, 1, 30), @@ -145,14 +145,14 @@ class ucp_prefs 'A_DATE_FORMAT' => addslashes($data['dateformat']), 'S_DATEFORMAT_OPTIONS' => $dateformat_options, 'S_CUSTOM_DATEFORMAT' => $s_custom, - 'DEFAULT_DATEFORMAT' => $config['default_dateformat'], - 'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']), + 'DEFAULT_DATEFORMAT' => phpbb::$config['default_dateformat'], + 'A_DEFAULT_DATEFORMAT' => addslashes(phpbb::$config['default_dateformat']), 'S_LANG_OPTIONS' => language_select($data['lang']), - 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']), + 'S_STYLE_OPTIONS' => (phpbb::$config['override_user_style']) ? '' : style_select($data['style']), 'S_TZ_OPTIONS' => tz_select($data['tz'], true), 'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false, - 'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false) + 'S_SELECT_NOTIFY' => (phpbb::$config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false) ); break; diff --git a/phpBB/modules/ucp/ucp_profile.php b/phpBB/modules/ucp/ucp_profile.php index cdae16b6f4..c23981b0d4 100644 --- a/phpBB/modules/ucp/ucp_profile.php +++ b/phpBB/modules/ucp/ucp_profile.php @@ -29,7 +29,7 @@ class ucp_profile function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; $user->add_lang('posting'); @@ -59,19 +59,19 @@ class ucp_profile // Do not check cur_password, it is the old one. $check_ary = array( 'new_password' => array( - array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + array('string', true, phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), array('password')), - 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + 'password_confirm' => array('string', true, phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), 'email' => array( array('string', false, 6, 60), array('email')), 'email_confirm' => array('string', true, 6, 60), ); - if ($auth->acl_get('u_chgname') && $config['allow_namechange']) + if ($auth->acl_get('u_chgname') && phpbb::$config['allow_namechange']) { $check_ary['username'] = array( - array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('string', false, phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), array('username'), ); } @@ -83,7 +83,7 @@ class ucp_profile $error[] = 'NEW_PASSWORD_ERROR'; } - if (($data['new_password'] || ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) || ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])) && !phpbb_check_hash($data['cur_password'], $user->data['user_password'])) + if (($data['new_password'] || ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) || ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && phpbb::$config['allow_namechange'])) && !phpbb_check_hash($data['cur_password'], $user->data['user_password'])) { $error[] = 'CUR_PASSWORD_ERROR'; } @@ -107,15 +107,15 @@ class ucp_profile if (!sizeof($error)) { $sql_ary = array( - 'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'], - 'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'], + 'username' => ($auth->acl_get('u_chgname') && phpbb::$config['allow_namechange']) ? $data['username'] : $user->data['username'], + 'username_clean' => ($auth->acl_get('u_chgname') && phpbb::$config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'], 'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'], 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? hexdec(crc32($data['email']) . strlen($data['email'])) : $user->data['user_email_hash'], 'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? phpbb_hash($data['new_password']) : $user->data['user_password'], 'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0, ); - if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) + if ($auth->acl_get('u_chgname') && phpbb::$config['allow_namechange'] && $data['username'] != $user->data['username']) { add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $data['username']); } @@ -133,9 +133,9 @@ class ucp_profile $message = 'PROFILE_UPDATED'; - if ($config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != phpbb::USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) + if (phpbb::$config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != phpbb::USER_FOUNDER && (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF || phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN)) { - $message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN'; + $message = (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN'; include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); @@ -148,12 +148,12 @@ class ucp_profile $messenger = new messenger(false); - $template_file = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate'; + $template_file = (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate'; $messenger->template($template_file, $user->data['user_lang']); $messenger->to($data['email'], $data['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); @@ -165,7 +165,7 @@ class ucp_profile $messenger->send(NOTIFY_EMAIL); - if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + if (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) { // Grab an array of user_id's with a_user permissions ... these users can activate a user $admin_ary = $auth->acl_get_list(false, 'a_user', false); @@ -217,7 +217,7 @@ class ucp_profile } // Need to update config, forum, topic, posting, messages, etc. - if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) + if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && phpbb::$config['allow_namechange']) { user_update_name($user->data['username'], $data['username']); } @@ -253,11 +253,11 @@ class ucp_profile 'NEW_PASSWORD' => $data['new_password'], 'CUR_PASSWORD' => '', - 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_USERNAME_EXPLAIN' => sprintf($user->lang[phpbb::$config['allow_name_chars'] . '_EXPLAIN'], phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), + 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[phpbb::$config['pass_complex'] . '_EXPLAIN'], phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), - 'S_FORCE_PASSWORD' => ($auth->acl_get('u_chgpasswd') && $config['chg_passforce'] && $user->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) ? true : false, - 'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false, + 'S_FORCE_PASSWORD' => ($auth->acl_get('u_chgpasswd') && phpbb::$config['chg_passforce'] && $user->data['user_passchg'] < time() - (phpbb::$config['chg_passforce'] * 86400)) ? true : false, + 'S_CHANGE_USERNAME' => (phpbb::$config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false, 'S_CHANGE_EMAIL' => ($auth->acl_get('u_chgemail')) ? true : false, 'S_CHANGE_PASSWORD' => ($auth->acl_get('u_chgpasswd')) ? true : false) ); @@ -283,7 +283,7 @@ class ucp_profile 'interests' => utf8_normalize_nfc(request_var('interests', $user->data['user_interests'], true)), ); - if ($config['allow_birthdays']) + if (phpbb::$config['allow_birthdays']) { $data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0; @@ -320,7 +320,7 @@ class ucp_profile 'interests' => array('string', true, 2, 500), ); - if ($config['allow_birthdays']) + if (phpbb::$config['allow_birthdays']) { $validate_array = array_merge($validate_array, array( 'bday_day' => array('num', true, 1, 31), @@ -349,7 +349,7 @@ class ucp_profile { $data['notify'] = $user->data['user_notify_type']; - if (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')) + if (!phpbb::$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')) { // User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled) // Disable notify by Jabber now for this user. @@ -369,7 +369,7 @@ class ucp_profile 'user_notify_type' => $data['notify'], ); - if ($config['allow_birthdays']) + if (phpbb::$config['allow_birthdays']) { $sql_ary['user_birthday'] = $data['user_birthday']; } @@ -409,7 +409,7 @@ class ucp_profile $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } - if ($config['allow_birthdays']) + if (phpbb::$config['allow_birthdays']) { $s_birthday_day_options = '<option value="0"' . ((!$data['bday_day']) ? ' selected="selected"' : '') . '>--</option>'; for ($i = 1; $i < 32; $i++) @@ -474,9 +474,9 @@ class ucp_profile include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); - $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false; - $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false; - $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; + $enable_bbcode = (phpbb::$config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false; + $enable_smilies = (phpbb::$config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false; + $enable_urls = (phpbb::$config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; $signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true)); @@ -491,7 +491,7 @@ class ucp_profile $message_parser = new parse_message($signature); // Allowing Quote BBCode - $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig'); + $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, phpbb::$config['allow_sig_img'], phpbb::$config['allow_sig_flash'], true, phpbb::$config['allow_sig_links'], true, 'sig'); if (sizeof($message_parser->warn_msg)) { @@ -544,19 +544,19 @@ class ucp_profile 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', - 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), - 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], - 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], - 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], - 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + 'BBCODE_STATUS' => (phpbb::$config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), + 'SMILIES_STATUS' => (phpbb::$config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'IMG_STATUS' => (phpbb::$config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => (phpbb::$config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => (phpbb::$config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], - 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), + 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], phpbb::$config['max_sig_chars']), - 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], - 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], - 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false, - 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false, - 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) + 'S_BBCODE_ALLOWED' => phpbb::$config['allow_sig_bbcode'], + 'S_SMILIES_ALLOWED' => phpbb::$config['allow_sig_smilies'], + 'S_BBCODE_IMG' => (phpbb::$config['allow_sig_img']) ? true : false, + 'S_BBCODE_FLASH' => (phpbb::$config['allow_sig_flash']) ? true : false, + 'S_LINKS_ALLOWED' => (phpbb::$config['allow_sig_links']) ? true : false) ); // Build custom bbcodes array @@ -572,7 +572,7 @@ class ucp_profile $avatar_select = basename(request_var('avatar_select', '')); $category = basename(request_var('category', '')); - $can_upload = ($config['allow_avatar_upload'] && file_exists(PHPBB_ROOT_PATH . $config['avatar_path']) && @is_writable(PHPBB_ROOT_PATH . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@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']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; add_form_key('ucp_avatar'); @@ -598,22 +598,22 @@ class ucp_profile $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']), - 'AVATAR_SIZE' => $config['avatar_filesize'], + 'AVATAR_SIZE' => phpbb::$config['avatar_filesize'], 'U_GALLERY' => append_sid('ucp', 'i=profile&mode=avatar&display_gallery=1'), 'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '', - 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), + 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], phpbb::$config['avatar_filesize'] / 1024), )); - if ($display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) + if ($display_gallery && $auth->acl_get('u_chgavatar') && phpbb::$config['allow_avatar_local']) { avatar_gallery($category, $avatar_select, 4); } else { - $avatars_enabled = ($can_upload || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false; + $avatars_enabled = ($can_upload || ($auth->acl_get('u_chgavatar') && (phpbb::$config['allow_avatar_local'] || phpbb::$config['allow_avatar_remote']))) ? true : false; $template->assign_vars(array( 'AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']), @@ -622,8 +622,8 @@ class ucp_profile 'S_AVATARS_ENABLED' => $avatars_enabled, 'S_UPLOAD_AVATAR_FILE' => $can_upload, 'S_UPLOAD_AVATAR_URL' => $can_upload, - 'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false, - 'S_DISPLAY_GALLERY' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false) + 'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && phpbb::$config['allow_avatar_remote']) ? true : false, + 'S_DISPLAY_GALLERY' => ($auth->acl_get('u_chgavatar') && phpbb::$config['allow_avatar_local']) ? true : false) ); } diff --git a/phpBB/modules/ucp/ucp_register.php b/phpBB/modules/ucp/ucp_register.php index 55f75bd9fb..68da529809 100644 --- a/phpBB/modules/ucp/ucp_register.php +++ b/phpBB/modules/ucp/ucp_register.php @@ -27,10 +27,10 @@ class ucp_register function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; // - if ($config['require_activation'] == USER_ACTIVATION_DISABLE) + if (phpbb::$config['require_activation'] == USER_ACTIVATION_DISABLE) { trigger_error('UCP_REGISTER_DISABLE'); } @@ -53,14 +53,14 @@ class ucp_register } - if ($config['enable_confirm']) + if (phpbb::$config['enable_confirm']) { include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT); - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = phpbb_captcha_factory::get_instance(phpbb::$config['captcha_plugin']); $captcha->init(CONFIRM_REG); } - if ($change_lang || $user_lang != $config['default_lang']) + if ($change_lang || $user_lang != phpbb::$config['default_lang']) { $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang); @@ -90,7 +90,7 @@ class ucp_register $error = $cp_data = $cp_error = array(); - if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable'])) + if (!$agreed || ($coppa === false && phpbb::$config['coppa_enable']) || ($coppa && !phpbb::$config['coppa_enable'])) { $add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : ''; $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; @@ -106,16 +106,16 @@ class ucp_register 'email' => strtolower(request_var('email', '')), 'email_confirm' => strtolower(request_var('email_confirm', '')), 'lang' => $user->lang_name, - 'tz' => request_var('tz', (float) $config['board_timezone']), + 'tz' => request_var('tz', (float) phpbb::$config['board_timezone']), )); - if ($config['enable_confirm']) + if (phpbb::$config['enable_confirm']) { $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); } } - if ($coppa === false && $config['coppa_enable']) + if ($coppa === false && phpbb::$config['coppa_enable']) { $now = getdate(); $coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']); @@ -136,7 +136,7 @@ class ucp_register else { $template->assign_vars(array( - 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), + 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], phpbb::$config['sitename'], generate_board_url()), 'S_SHOW_COPPA' => false, 'S_REGISTRATION' => true, @@ -155,19 +155,19 @@ class ucp_register $timezone = date('Z') / 3600; $is_dst = date('I'); - if ($config['board_timezone'] == $timezone || $config['board_timezone'] == ($timezone - 1)) + if (phpbb::$config['board_timezone'] == $timezone || phpbb::$config['board_timezone'] == ($timezone - 1)) { $timezone = ($is_dst) ? $timezone - 1 : $timezone; if (!isset($user->lang['tz_zones'][(string) $timezone])) { - $timezone = $config['board_timezone']; + $timezone = phpbb::$config['board_timezone']; } } else { - $is_dst = $config['board_dst']; - $timezone = $config['board_timezone']; + $is_dst = phpbb::$config['board_dst']; + $timezone = phpbb::$config['board_timezone']; } $data = array( @@ -185,12 +185,12 @@ class ucp_register { $error = validate_data($data, array( 'username' => array( - array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('string', false, phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), array('username', '')), 'new_password' => array( - array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), + array('string', false, phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), array('password')), - 'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), + 'password_confirm' => array('string', false, phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), 'email' => array( array('string', false, 6, 60), array('email')), @@ -205,7 +205,7 @@ class ucp_register // Replace "error" strings with their real, localised form $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); - if ($config['enable_confirm']) + if (phpbb::$config['enable_confirm']) { $vc_response = $captcha->validate(); if ($vc_response) @@ -216,13 +216,13 @@ class ucp_register { $captcha->reset(); } - if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts']) + if (phpbb::$config['max_reg_attempts'] && $captcha->get_attempt_count() > phpbb::$config['max_reg_attempts']) { $error[] = $user->lang['TOO_MANY_REGISTERS']; } } // DNSBL check - if ($config['check_dnsbl']) + if (phpbb::$config['check_dnsbl']) { if (($dnsbl = $user->check_dnsbl('register')) !== false) { @@ -269,8 +269,8 @@ class ucp_register $group_id = $row['group_id']; if (($coppa || - $config['require_activation'] == USER_ACTIVATION_SELF || - $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable']) + phpbb::$config['require_activation'] == USER_ACTIVATION_SELF || + phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) && phpbb::$config['email_enable']) { $user_actkey = gen_rand_string(10); $key_len = 54 - (strlen($server_url)); @@ -314,17 +314,17 @@ class ucp_register trigger_error('NO_USER', E_USER_ERROR); } - if ($coppa && $config['email_enable']) + if ($coppa && phpbb::$config['email_enable']) { $message = $user->lang['ACCOUNT_COPPA']; $email_template = 'coppa_welcome_inactive'; } - else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) + else if (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF && phpbb::$config['email_enable']) { $message = $user->lang['ACCOUNT_INACTIVE']; $email_template = 'user_welcome_inactive'; } - else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable']) + else if (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN && phpbb::$config['email_enable']) { $message = $user->lang['ACCOUNT_INACTIVE_ADMIN']; $email_template = 'admin_welcome_inactive'; @@ -335,7 +335,7 @@ class ucp_register $email_template = 'user_welcome'; } - if ($config['email_enable']) + if (phpbb::$config['email_enable']) { include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); @@ -345,13 +345,13 @@ class ucp_register $messenger->to($data['email'], $data['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( - 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], phpbb::$config['sitename'])), 'USERNAME' => htmlspecialchars_decode($data['username']), 'PASSWORD' => htmlspecialchars_decode($data['new_password']), 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u=$user_id&k=$user_actkey") @@ -360,15 +360,15 @@ class ucp_register if ($coppa) { $messenger->assign_vars(array( - 'FAX_INFO' => $config['coppa_fax'], - 'MAIL_INFO' => $config['coppa_mail'], - 'EMAIL_ADDRESS' => $data['email']) - ); + 'FAX_INFO' => phpbb::$config['coppa_fax'], + 'MAIL_INFO' => phpbb::$config['coppa_mail'], + 'EMAIL_ADDRESS' => $data['email'], + )); } $messenger->send(NOTIFY_EMAIL); - if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + if (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) { // Grab an array of user_id's with a_user permissions ... these users can activate a user $admin_ary = $auth->acl_get_list(false, 'a_user', false); @@ -415,7 +415,7 @@ class ucp_register 'change_lang' => 0, ); - if ($config['coppa_enable']) + if (phpbb::$config['coppa_enable']) { $s_hidden_fields['coppa'] = $coppa; } @@ -425,7 +425,7 @@ class ucp_register // Visual Confirmation - Show images - if ($config['enable_confirm']) + if (phpbb::$config['enable_confirm']) { if ($change_lang) { @@ -437,14 +437,14 @@ class ucp_register } $template->assign_vars(array( - 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'), + 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars(phpbb::$config['board_contact']) . '">', '</a>'), 'S_CAPTCHA' => $captcha->get_template(), )); } // $l_reg_cond = ''; - switch ($config['require_activation']) + switch (phpbb::$config['require_activation']) { case USER_ACTIVATION_SELF: $l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE']; @@ -464,8 +464,8 @@ class ucp_register 'EMAIL_CONFIRM' => $data['email_confirm'], 'L_REG_COND' => $l_reg_cond, - 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_USERNAME_EXPLAIN' => sprintf($user->lang[phpbb::$config['allow_name_chars'] . '_EXPLAIN'], phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), + 'L_PASSWORD_EXPLAIN' => sprintf($user->lang[phpbb::$config['pass_complex'] . '_EXPLAIN'], phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_TZ_OPTIONS' => tz_select($data['tz']), diff --git a/phpBB/modules/ucp/ucp_remind.php b/phpBB/modules/ucp/ucp_remind.php index 550051ae18..2a921a52b2 100644 --- a/phpBB/modules/ucp/ucp_remind.php +++ b/phpBB/modules/ucp/ucp_remind.php @@ -27,7 +27,7 @@ class ucp_remind function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); @@ -78,7 +78,7 @@ class ucp_remind $key_len = 54 - strlen($server_url); $key_len = max(6, $key_len); // we want at least 6 - $key_len = ($config['max_pass_chars']) ? min($key_len, $config['max_pass_chars']) : $key_len; // we want at most $config['max_pass_chars'] + $key_len = (phpbb::$config['max_pass_chars']) ? min($key_len, phpbb::$config['max_pass_chars']) : $key_len; // we want at most phpbb::$config['max_pass_chars'] $user_actkey = substr(gen_rand_string(10), 0, $key_len); $user_password = gen_rand_string(8); diff --git a/phpBB/modules/ucp/ucp_resend.php b/phpBB/modules/ucp/ucp_resend.php index 38b333a5a4..cde79ccabd 100644 --- a/phpBB/modules/ucp/ucp_resend.php +++ b/phpBB/modules/ucp/ucp_resend.php @@ -27,7 +27,7 @@ class ucp_resend function main($id, $mode) { - global $db, $user, $auth, $template, $config; + global $db, $user, $auth, $template; $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); @@ -88,18 +88,18 @@ class ucp_resend include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(false); - if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa) + if (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF || $coppa) { $messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']); $messenger->to($user_row['user_email'], $user_row['username']); - $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']); $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( - 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], phpbb::$config['sitename'])), 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'U_ACTIVATE' => generate_board_url() . '/ucp.' . PHP_EXT . "?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") ); @@ -107,16 +107,16 @@ class ucp_resend if ($coppa) { $messenger->assign_vars(array( - 'FAX_INFO' => $config['coppa_fax'], - 'MAIL_INFO' => $config['coppa_mail'], - 'EMAIL_ADDRESS' => $user_row['user_email']) - ); + 'FAX_INFO' => phpbb::$config['coppa_fax'], + 'MAIL_INFO' => phpbb::$config['coppa_mail'], + 'EMAIL_ADDRESS' => $user_row['user_email'], + )); } $messenger->send(NOTIFY_EMAIL); } - if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + if (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) { // Grab an array of user_id's with a_user permissions ... these users can activate a user $admin_ary = $auth->acl_get_list(false, 'a_user', false); @@ -145,7 +145,7 @@ class ucp_resend meta_refresh(3, append_sid('index')); - $message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT']; + $message = (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT']; $message .= '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); trigger_error($message); } diff --git a/phpBB/modules/ucp/ucp_zebra.php b/phpBB/modules/ucp/ucp_zebra.php index a928e9985a..060aa7d9a7 100644 --- a/phpBB/modules/ucp/ucp_zebra.php +++ b/phpBB/modules/ucp/ucp_zebra.php @@ -26,7 +26,7 @@ class ucp_zebra function main($id, $mode) { - global $config, $db, $user, $auth, $template; + global $db, $user, $auth, $template; $submit = phpbb_request::is_set_post('submit') || phpbb_request::is_set('add', phpbb_request::GET) || phpbb_request::is_set('remove', phpbb_request::GET); $s_hidden_fields = ''; diff --git a/phpBB/posting.php b/phpBB/posting.php index e5bfc462ea..e2484dfd15 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -45,10 +45,10 @@ $mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var $error = $post_data = array(); $current_time = time(); -if ($config['enable_post_confirm'] && !$user->data['is_registered']) +if (phpbb::$config['enable_post_confirm'] && !$user->data['is_registered']) { include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT); - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = phpbb_captcha_factory::get_instance(phpbb::$config['captcha_plugin']); $captcha->init(CONFIRM_POST); } @@ -267,7 +267,7 @@ if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)) trigger_error('USER_CANNOT_EDIT'); } - if (!($post_data['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) + if (!($post_data['post_time'] > time() - (phpbb::$config['edit_time'] * 60) || !phpbb::$config['edit_time'])) { trigger_error('CANNOT_EDIT_TIME'); } @@ -424,9 +424,9 @@ $post_data['enable_urls'] = $post_data['enable_magic_url']; if ($mode != 'edit') { - $post_data['enable_sig'] = ($config['allow_sig'] && $user->optionget('attachsig')) ? true: false; - $post_data['enable_smilies'] = ($config['allow_smilies'] && $user->optionget('smilies')) ? true : false; - $post_data['enable_bbcode'] = ($config['allow_bbcode'] && $user->optionget('bbcode')) ? true : false; + $post_data['enable_sig'] = (phpbb::$config['allow_sig'] && $user->optionget('attachsig')) ? true: false; + $post_data['enable_smilies'] = (phpbb::$config['allow_smilies'] && $user->optionget('smilies')) ? true : false; + $post_data['enable_bbcode'] = (phpbb::$config['allow_bbcode'] && $user->optionget('bbcode')) ? true : false; $post_data['enable_urls'] = true; } @@ -453,7 +453,7 @@ if ($user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == $check_value = (($post_data['enable_bbcode']+1) << 8) + (($post_data['enable_smilies']+1) << 4) + (($post_data['enable_urls']+1) << 2) + (($post_data['enable_sig']+1) << 1); // Check if user is watching this topic -if ($mode != 'post' && $config['allow_topic_notify'] && $user->data['is_registered']) +if ($mode != 'post' && phpbb::$config['allow_topic_notify'] && $user->data['is_registered']) { $sql = 'SELECT topic_id FROM ' . TOPICS_WATCH_TABLE . ' @@ -471,11 +471,11 @@ if ($mode == 'edit' && $post_data['bbcode_uid']) } // HTML, BBCode, Smilies, Images and Flash status -$bbcode_status = ($config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? true : false; -$smilies_status = ($bbcode_status && $config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? true : false; +$bbcode_status = (phpbb::$config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? true : false; +$smilies_status = ($bbcode_status && phpbb::$config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? true : false; $img_status = ($bbcode_status && $auth->acl_get('f_img', $forum_id)) ? true : false; -$url_status = ($config['allow_post_links']) ? true : false; -$flash_status = ($bbcode_status && $auth->acl_get('f_flash', $forum_id) && $config['allow_post_flash']) ? true : false; +$url_status = (phpbb::$config['allow_post_links']) ? true : false; +$flash_status = ($bbcode_status && $auth->acl_get('f_flash', $forum_id) && phpbb::$config['allow_post_flash']) ? true : false; $quote_status = ($auth->acl_get('f_reply', $forum_id)) ? true : false; // Save Draft @@ -591,9 +591,9 @@ if ($submit || $preview || $refresh) $post_data['enable_bbcode'] = (!$bbcode_status || phpbb_request::is_set_post('disable_bbcode')) ? false : true; $post_data['enable_smilies'] = (!$smilies_status || phpbb_request::is_set_post('disable_smilies')) ? false : true; $post_data['enable_urls'] = phpbb_request::is_set_post('disable_magic_url'); - $post_data['enable_sig'] = (!$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig')) ? false : ((phpbb_request::is_set_post('attach_sig') && $user->data['is_registered']) ? true : false); + $post_data['enable_sig'] = (!phpbb::$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig')) ? false : ((phpbb_request::is_set_post('attach_sig') && $user->data['is_registered']) ? true : false); - if ($config['allow_topic_notify'] && $user->data['is_registered']) + if (phpbb::$config['allow_topic_notify'] && $user->data['is_registered']) { $notify = phpbb_request::is_set_post('notify'); } @@ -693,7 +693,7 @@ if ($submit || $preview || $refresh) $message_parser->warn_msg = array(); } - $message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']); + $message_parser->parse($post_data['enable_bbcode'], (phpbb::$config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, phpbb::$config['allow_post_links']); // On a refresh we do not care about message parsing errors if (sizeof($message_parser->warn_msg) && $refresh) @@ -706,7 +706,7 @@ if ($submit || $preview || $refresh) $message_parser->bbcode_bitfield = $post_data['bbcode_bitfield']; } - if ($mode != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('f_ignoreflood', $forum_id)) + if ($mode != 'edit' && !$preview && !$refresh && phpbb::$config['flood_interval'] && !$auth->acl_get('f_ignoreflood', $forum_id)) { // Flood check $last_post_time = 0; @@ -720,7 +720,7 @@ if ($submit || $preview || $refresh) $sql = 'SELECT post_time AS last_post_time FROM ' . POSTS_TABLE . " WHERE poster_ip = '" . $user->ip . "' - AND post_time > " . ($current_time - $config['flood_interval']); + AND post_time > " . ($current_time - phpbb::$config['flood_interval']); $result = $db->sql_query_limit($sql, 1); if ($row = $db->sql_fetchrow($result)) { @@ -729,7 +729,7 @@ if ($submit || $preview || $refresh) $db->sql_freeresult($result); } - if ($last_post_time && ($current_time - $last_post_time) < intval($config['flood_interval'])) + if ($last_post_time && ($current_time - $last_post_time) < intval(phpbb::$config['flood_interval'])) { $error[] = $user->lang['FLOOD_ERROR']; } @@ -747,7 +747,7 @@ if ($submit || $preview || $refresh) } } - if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) + if (phpbb::$config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { $vc_response = $captcha->validate(); if ($vc_response) @@ -849,7 +849,7 @@ if ($submit || $preview || $refresh) } // DNSBL check - if ($config['check_dnsbl'] && !$refresh) + if (phpbb::$config['check_dnsbl'] && !$refresh) { if (($dnsbl = $user->check_dnsbl('post')) !== false) { @@ -996,12 +996,12 @@ if ($submit || $preview || $refresh) } $redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message); - if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) + if (phpbb::$config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { $captcha->reset(); } // 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'])) { meta_refresh(10, $redirect_url); $message = ($mode == 'edit') ? $user->lang['POST_EDITED_MOD'] : $user->lang['POST_STORED_MOD']; @@ -1033,14 +1033,14 @@ if (!sizeof($error) && $preview) $preview_signature_bitfield = ($mode == 'edit') ? $post_data['user_sig_bbcode_bitfield'] : $user->data['user_sig_bbcode_bitfield']; // Signature - if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id)) + if ($post_data['enable_sig'] && phpbb::$config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id)) { $parse_sig = new parse_message($preview_signature); $parse_sig->bbcode_uid = $preview_signature_uid; $parse_sig->bbcode_bitfield = $preview_signature_bitfield; // Not sure about parameters for bbcode/smilies/urls... in signatures - $parse_sig->format_display($config['allow_sig_bbcode'], true, $config['allow_sig_smilies']); + $parse_sig->format_display(phpbb::$config['allow_sig_bbcode'], true, phpbb::$config['allow_sig_smilies']); $preview_signature = $parse_sig->message; unset($parse_sig); } @@ -1179,15 +1179,15 @@ if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id)) $s_topic_icons = posting_gen_topic_icons($mode, $post_data['icon_id']); } -$bbcode_checked = (isset($post_data['enable_bbcode'])) ? !$post_data['enable_bbcode'] : (($config['allow_bbcode']) ? !$user->optionget('bbcode') : 1); -$smilies_checked = (isset($post_data['enable_smilies'])) ? !$post_data['enable_smilies'] : (($config['allow_smilies']) ? !$user->optionget('smilies') : 1); +$bbcode_checked = (isset($post_data['enable_bbcode'])) ? !$post_data['enable_bbcode'] : ((phpbb::$config['allow_bbcode']) ? !$user->optionget('bbcode') : 1); +$smilies_checked = (isset($post_data['enable_smilies'])) ? !$post_data['enable_smilies'] : ((phpbb::$config['allow_smilies']) ? !$user->optionget('smilies') : 1); $urls_checked = (isset($post_data['enable_urls'])) ? !$post_data['enable_urls'] : 0; $sig_checked = $post_data['enable_sig']; $lock_topic_checked = (isset($topic_lock) && $topic_lock) ? $topic_lock : (($post_data['topic_status'] == ITEM_LOCKED) ? 1 : 0); $lock_post_checked = (isset($post_lock)) ? $post_lock : $post_data['post_edit_locked']; // If the user is replying or posting and not already watching this topic but set to always being notified we need to overwrite this setting -$notify_set = ($mode != 'edit' && $config['allow_topic_notify'] && $user->data['is_registered'] && !$post_data['notify_set']) ? $user->data['user_notify'] : $post_data['notify_set']; +$notify_set = ($mode != 'edit' && phpbb::$config['allow_topic_notify'] && $user->data['is_registered'] && !$post_data['notify_set']) ? $user->data['user_notify'] : $post_data['notify_set']; $notify_checked = (isset($notify)) ? $notify : (($mode == 'post') ? $user->data['user_notify'] : $notify_set); // Page title & action URL, include session_id for security purpose @@ -1218,7 +1218,7 @@ generate_forum_nav($post_data); // Build Forum Rules generate_forum_rules($post_data); -if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) +if (phpbb::$config['enable_post_confirm'] && !$user->data['is_registered'] && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) { $captcha->reset(); @@ -1238,7 +1238,7 @@ if ($solved_captcha !== false) $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields()); } -$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"'; +$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !phpbb::$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"'; add_form_key('posting'); @@ -1246,7 +1246,7 @@ add_form_key('posting'); $template->assign_vars(array( 'L_POST_A' => $page_title, 'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'], - 'L_MESSAGE_BODY_EXPLAIN' => (intval($config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '', + 'L_MESSAGE_BODY_EXPLAIN' => (intval(phpbb::$config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval(phpbb::$config['max_post_chars'])) : '', 'FORUM_NAME' => $post_data['forum_name'], 'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '', @@ -1276,14 +1276,14 @@ $template->assign_vars(array( 'S_EDIT_REASON' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_DISPLAY_USERNAME' => (!$user->data['is_registered'] || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS)) ? true : false, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, - 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id))) ? true : false, + 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - (phpbb::$config['edit_time'] * 60) || !phpbb::$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id))) ? true : false, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, 'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '', - 'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id) && $config['allow_sig'] && $user->data['is_registered']) ? true : false, + 'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id) && phpbb::$config['allow_sig'] && $user->data['is_registered']) ? true : false, 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', - 'S_NOTIFY_ALLOWED' => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !$config['allow_topic_notify'] || !$config['email_enable']) ? false : true, + 'S_NOTIFY_ALLOWED' => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !phpbb::$config['allow_topic_notify'] || !phpbb::$config['email_enable']) ? false : true, 'S_NOTIFY_CHECKED' => ($notify_checked) ? ' checked="checked"' : '', 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false, 'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '', @@ -1318,7 +1318,7 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_ 'S_POLL_DELETE' => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))), 'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false, - 'L_POLL_OPTIONS_EXPLAIN' => sprintf($user->lang['POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN'], $config['max_poll_options']), + 'L_POLL_OPTIONS_EXPLAIN' => sprintf($user->lang['POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN'], phpbb::$config['max_poll_options']), 'VOTE_CHANGE_CHECKED' => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '', // 'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '', @@ -1329,7 +1329,7 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_ } // Show attachment box for adding attachments if true -$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype); +$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && phpbb::$config['allow_attachments'] && $form_enctype); // Attachment entry posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); @@ -1384,10 +1384,10 @@ function upload_popup($forum_style = 0) */ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) { - global $user, $db, $auth, $config; + global $user, $db, $auth; // If moderator removing post or user itself removing post, present a confirmation screen - if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']))) + if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - (phpbb::$config['edit_time'] * 60) || !phpbb::$config['edit_time']))) { $s_hidden_fields = build_hidden_fields(array( 'p' => $post_id, diff --git a/phpBB/search.php b/phpBB/search.php index a1804673c8..70bd468d6a 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -48,21 +48,21 @@ $return_chars = request_var('ch', ($topic_id) ? -1 : 300); $search_forum = request_var('fid', array(0)); // Is user able to search? Has search been disabled? -if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$config['load_search']) +if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !phpbb::$config['load_search']) { $template->assign_var('S_NO_SEARCH', true); trigger_error('NO_SEARCH'); } // Check search load limit -if ($user->load && $config['limit_search_load'] && ($user->load > doubleval($config['limit_search_load']))) +if ($user->load && phpbb::$config['limit_search_load'] && ($user->load > doubleval(phpbb::$config['limit_search_load']))) { $template->assign_var('S_NO_SEARCH', true); trigger_error('NO_SEARCH_TIME'); } // Check flood limit ... if applicable -$interval = ($user->data['user_id'] == ANONYMOUS) ? $config['search_anonymous_interval'] : $config['search_interval']; +$interval = ($user->data['user_id'] == ANONYMOUS) ? phpbb::$config['search_anonymous_interval'] : phpbb::$config['search_interval']; if ($interval && !$auth->acl_get('u_ignoreflood')) { if ($user->data['user_last_search'] > time() - $interval) @@ -103,9 +103,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) } else if ($author) { - if ((strpos($author, '*') !== false) && (utf8_strlen(str_replace(array('*', '%'), '', $author)) < $config['min_search_author_chars'])) + if ((strpos($author, '*') !== false) && (utf8_strlen(str_replace(array('*', '%'), '', $author)) < phpbb::$config['min_search_author_chars'])) { - trigger_error(sprintf($user->lang['TOO_FEW_AUTHOR_CHARS'], $config['min_search_author_chars'])); + trigger_error(sprintf($user->lang['TOO_FEW_AUTHOR_CHARS'], phpbb::$config['min_search_author_chars'])); } $sql_where = (strpos($author, '*') !== false) ? ' username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($author))) : " username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; @@ -219,7 +219,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // Select which method we'll use to obtain the post_id or topic_id information - $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)) { @@ -383,7 +383,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // show_results should not change after this - $per_page = ($show_results == 'posts') ? $config['posts_per_page'] : $config['topics_per_page']; + $per_page = ($show_results == 'posts') ? phpbb::$config['posts_per_page'] : phpbb::$config['topics_per_page']; $total_match_count = 0; if ($search_id) @@ -543,14 +543,14 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($user->data['is_registered']) { - if ($config['load_db_track'] && $author_id !== $user->data['user_id']) + if (phpbb::$config['load_db_track'] && $author_id !== $user->data['user_id']) { $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tp.topic_id)'; $sql_select .= ', tp.topic_posted'; } - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id) @@ -560,9 +560,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) } } - if ($config['load_anon_lastread'] || ($user->data['is_registered'] && !$config['load_db_lastread'])) + if (phpbb::$config['load_anon_lastread'] || ($user->data['is_registered'] && !phpbb::$config['load_db_lastread'])) { - $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(); } @@ -588,7 +588,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $rowset[$row['topic_id']] = $row; - if (!isset($forums[$row['forum_id']]) && $user->data['is_registered'] && $config['load_db_lastread']) + if (!isset($forums[$row['forum_id']]) && $user->data['is_registered'] && phpbb::$config['load_db_lastread']) { $forums[$row['forum_id']]['mark_time'] = $row['f_mark_time']; } @@ -624,17 +624,17 @@ if ($keywords || $author || $author_id || $search_id || $submit) foreach ($forums as $forum_id => $forum) { - if ($user->data['is_registered'] && $config['load_db_lastread']) + if ($user->data['is_registered'] && phpbb::$config['load_db_lastread']) { $topic_tracking_info[$forum_id] = get_topic_tracking($forum_id, $forum['topic_list'], $forum['rowset'], array($forum_id => $forum['mark_time']), ($forum_id) ? false : $forum['topic_list']); } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { $topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list'], ($forum_id) ? false : $forum['topic_list']); 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; } } } @@ -665,7 +665,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); // Does this post have an attachment? If so, add it to the list - if ($row['post_attachment'] && $config['allow_attachments']) + if ($row['post_attachment'] && phpbb::$config['allow_attachments']) { $attach_list[$row['forum_id']][] = $row['post_id']; } @@ -773,7 +773,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($show_results == 'topics') { - if ($config['load_db_track'] && $author_id === $user->data['user_id']) + if (phpbb::$config['load_db_track'] && $author_id === $user->data['user_id']) { $row['topic_posted'] = 1; } diff --git a/phpBB/style.php b/phpBB/style.php index 7792df8a90..b83693b5fc 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -48,10 +48,10 @@ if ($sid) $db->sql_freeresult($result); } -$recompile = $config['load_tplcompile']; +$recompile = phpbb::$config['load_tplcompile']; if (!$user) { - $id = $config['default_style']; + $id = phpbb::$config['default_style']; $recompile = false; $user = array('user_id' => ANONYMOUS); } @@ -74,10 +74,10 @@ if (!$theme) if ($user['user_id'] == ANONYMOUS) { - $user['user_lang'] = $config['default_lang']; + $user['user_lang'] = phpbb::$config['default_lang']; } -$user_image_lang = (file_exists(PHPBB_ROOT_PATH . 'styles/' . $theme['imageset_path'] . '/imageset/' . $user['user_lang'])) ? $user['user_lang'] : $config['default_lang']; +$user_image_lang = (file_exists(PHPBB_ROOT_PATH . 'styles/' . $theme['imageset_path'] . '/imageset/' . $user['user_lang'])) ? $user['user_lang'] : phpbb::$config['default_lang']; $sql = 'SELECT * FROM ' . STYLES_IMAGESET_DATA_TABLE . ' @@ -94,7 +94,7 @@ while ($row = $db->sql_fetchrow($result)) $db->sql_freeresult($result); // gzip_compression -if ($config['gzip_compress']) +if (phpbb::$config['gzip_compress']) { // IE6 is not able to compress the style (do not ask us why!) $browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? strtolower(htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT'])) : ''; diff --git a/phpBB/ucp.php b/phpBB/ucp.php index eabe067479..dfa640b388 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -124,7 +124,7 @@ switch ($mode) $template->assign_vars(array( 'S_AGREEMENT' => true, 'AGREEMENT_TITLE' => $user->lang[$title], - 'AGREEMENT_TEXT' => sprintf($user->lang[$message], $config['sitename'], generate_board_url()), + 'AGREEMENT_TEXT' => sprintf($user->lang[$message], phpbb::$config['sitename'], generate_board_url()), 'U_BACK' => append_sid('ucp', 'mode=login'), 'L_BACK' => $user->lang['BACK_TO_LOGIN']) ); @@ -143,7 +143,7 @@ switch ($mode) $cookies = phpbb_request::variable_names(phpbb_request::COOKIE); foreach ($cookies as $cookie_name) { - $cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name); + $cookie_name = str_replace(phpbb::$config['cookie_name'] . '_', '', $cookie_name); // Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_ if (strpos($cookie_name, 'poll_') !== 0) @@ -257,7 +257,7 @@ switch ($mode) } // Do not display subscribed topics/forums if not allowed - if (!$config['allow_topic_notify'] && !$config['allow_forum_notify']) + if (!phpbb::$config['allow_topic_notify'] && !phpbb::$config['allow_forum_notify']) { $module->set_display('main', 'subscribed', false); } @@ -282,9 +282,9 @@ switch ($mode) */ function _display_friends() { - global $config, $db, $template, $user, $auth; + global $db, $template, $user, $auth; - $update_time = $config['load_online_time'] * 60; + $update_time = phpbb::$config['load_online_time'] * 60; $sql = $db->sql_build_query('SELECT_DISTINCT', array( 'SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline', diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 72e65096a2..4186d19f09 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -45,7 +45,7 @@ $sql_from = FORUMS_TABLE . ' f'; $lastread_select = ''; // Grab appropriate forum data -if ($config['load_db_lastread'] && $user->data['is_registered']) +if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { $sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id)'; @@ -130,7 +130,7 @@ $active_forum_ary = $moderators = array(); if ($forum_data['left_id'] != $forum_data['right_id'] - 1) { - list($active_forum_ary, $moderators) = display_forums($forum_data, $config['load_moderators'], $config['load_moderators']); + list($active_forum_ary, $moderators) = display_forums($forum_data, phpbb::$config['load_moderators'], phpbb::$config['load_moderators']); } else { @@ -163,7 +163,7 @@ if (!$auth->acl_get('f_read', $forum_id)) { $template->assign_vars(array( 'S_NO_READ_ACCESS' => true, - 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false, + 'S_AUTOLOGIN_ENABLED' => (phpbb::$config['allow_autologin']) ? true : false, 'S_LOGIN_ACTION' => append_sid('ucp', 'mode=login') . '&redirect=' . urlencode(str_replace('&', '&', build_url(array('_f_')))), )); @@ -187,7 +187,7 @@ if ($mark_read == 'topics') // Is a forum specific topic count required? if ($forum_data['forum_topics_per_page']) { - $config['topics_per_page'] = $forum_data['forum_topics_per_page']; + phpbb::$config['topics_per_page'] = $forum_data['forum_topics_per_page']; } // Do the forum Prune thang - cron type job ... @@ -203,7 +203,7 @@ $s_watching_forum = array( 'is_watching' => false, ); -if (($config['email_enable'] || $config['jab_enable']) && $config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && $auth->acl_get('f_subscribe', $forum_id)) +if ((phpbb::$config['email_enable'] || phpbb::$config['jab_enable']) && phpbb::$config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && $auth->acl_get('f_subscribe', $forum_id)) { $notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL; watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status); @@ -256,7 +256,7 @@ else // Make sure $start is set to the last page if it exceeds the amount if ($start < 0 || $start > $topics_count) { - $start = ($start < 0) ? 0 : floor(($topics_count - 1) / $config['topics_per_page']) * $config['topics_per_page']; + $start = ($start < 0) ? 0 : floor(($topics_count - 1) / phpbb::$config['topics_per_page']) * phpbb::$config['topics_per_page']; } // Basic pagewide vars @@ -301,7 +301,7 @@ $template->assign_vars(array( 'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'], 'S_WATCHING_FORUM' => $s_watching_forum['is_watching'], 'S_FORUM_ACTION' => append_sid('viewforum', "f=$forum_id&start=$start"), - 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, + 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && phpbb::$config['load_search']) ? true : false, 'S_SEARCHBOX_ACTION' => append_sid('search', 'fid[]=' . $forum_id), 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true, 'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false, @@ -310,7 +310,7 @@ $template->assign_vars(array( 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid('mcp', "f=$forum_id&i=main&mode=forum_view", true, $user->session_id) : '', 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid('posting', 'mode=post&f=' . $forum_id) : '', 'U_VIEW_FORUM' => append_sid('viewforum', "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . "&start=$start"), - 'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid('viewforum', 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics") : '', + 'U_MARK_TOPICS' => ($user->data['is_registered'] || phpbb::$config['load_anon_lastread']) ? append_sid('viewforum', 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics") : '', )); // Grab icons @@ -331,13 +331,13 @@ $sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_app if ($user->data['is_registered']) { - if ($config['load_db_track']) + if (phpbb::$config['load_db_track']) { $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id']); $sql_array['SELECT'] .= ', tp.topic_posted'; } - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']); $sql_array['SELECT'] .= ', tt.mark_time'; @@ -384,14 +384,14 @@ if ($forum_data['forum_type'] == FORUM_POST) // If the user is trying to reach late pages, start searching from the end $store_reverse = false; -$sql_limit = $config['topics_per_page']; +$sql_limit = phpbb::$config['topics_per_page']; if ($start > $topics_count / 2) { $store_reverse = true; - if ($start + $config['topics_per_page'] > $topics_count) + if ($start + phpbb::$config['topics_per_page'] > $topics_count) { - $sql_limit = min($config['topics_per_page'], max(1, $topics_count - $start)); + $sql_limit = min(phpbb::$config['topics_per_page'], max(1, $topics_count - $start)); } // Select the sort order @@ -524,8 +524,8 @@ if ($s_display_active) } $template->assign_vars(array( - 'PAGINATION' => generate_pagination(append_sid('viewforum', "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')), $topics_count, $config['topics_per_page'], $start), - 'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination(append_sid('viewforum', "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')), $topics_count, phpbb::$config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($topics_count, phpbb::$config['topics_per_page'], $start), 'TOTAL_TOPICS' => ($s_display_active) ? false : (($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count))) ); @@ -545,18 +545,18 @@ if (sizeof($topic_list)) $topic_forum_list = array(); foreach ($rowset as $t_id => $row) { - $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread'] && $user->data['is_registered'] && isset($row['forum_mark_time'])) ? $row['forum_mark_time'] : 0; + $topic_forum_list[$row['forum_id']]['forum_mark_time'] = (phpbb::$config['load_db_lastread'] && $user->data['is_registered'] && isset($row['forum_mark_time'])) ? $row['forum_mark_time'] : 0; $topic_forum_list[$row['forum_id']]['topics'][] = $t_id; } - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { foreach ($topic_forum_list as $f_id => $topic_row) { $topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']), false); } } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { foreach ($topic_forum_list as $f_id => $topic_row) { @@ -568,20 +568,20 @@ if (sizeof($topic_list)) } else { - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { $topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $rowset, array($forum_id => $forum_data['mark_time']), $global_announce_list); $mark_time_forum = (!empty($forum_data['mark_time'])) ? $forum_data['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']) { $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, $global_announce_list); 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']; } } diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 2606bf8aa9..bab4e0315c 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -27,7 +27,7 @@ $session_id = request_var('s', ''); $start = request_var('start', 0); $sort_key = request_var('sk', 'b'); $sort_dir = request_var('sd', 'd'); -$show_guests= ($config['load_online_guests']) ? request_var('sg', 0) : 0; +$show_guests= (phpbb::$config['load_online_guests']) ? request_var('sg', 0) : 0; // Can this user view profiles/memberlist? if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) @@ -102,7 +102,7 @@ if (!$show_guests) $sql = 'SELECT COUNT(DISTINCT session_ip) as num_guests FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = ' . ANONYMOUS . ' - AND session_time >= ' . (time() - ($config['load_online_time'] * 60)); + AND session_time >= ' . (time() - (phpbb::$config['load_online_time'] * 60)); } else { @@ -111,7 +111,7 @@ if (!$show_guests) SELECT DISTINCT session_ip FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = ' . ANONYMOUS . ' - AND session_time >= ' . (time() - ($config['load_online_time'] * 60)) . + AND session_time >= ' . (time() - (phpbb::$config['load_online_time'] * 60)) . ')'; break; } @@ -124,7 +124,7 @@ if (!$show_guests) $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_type, u.user_colour, s.session_id, s.session_time, s.session_page, s.session_ip, s.session_browser, s.session_viewonline FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . ' s WHERE u.user_id = s.session_user_id - AND s.session_time >= ' . (time() - ($config['load_online_time'] * 60)) . + AND s.session_time >= ' . (time() - (phpbb::$config['load_online_time'] * 60)) . ((!$show_guests) ? ' AND s.session_user_id <> ' . ANONYMOUS : '') . ' ORDER BY ' . $order_by; $result = $db->sql_query($sql); @@ -162,7 +162,7 @@ while ($row = $db->sql_fetchrow($result)) $counter++; } - if (!$view_online || $counter > $start + $config['topics_per_page'] || $counter <= $start) + if (!$view_online || $counter > $start + phpbb::$config['topics_per_page'] || $counter <= $start) { continue; } @@ -173,7 +173,7 @@ while ($row = $db->sql_fetchrow($result)) $guest_counter++; $counter++; - if ($counter > $start + $config['topics_per_page'] || $counter <= $start) + if ($counter > $start + phpbb::$config['topics_per_page'] || $counter <= $start) { continue; } @@ -369,7 +369,7 @@ foreach ($vars_online as $l_prefix => $var_ary) } unset($vars_online); -$pagination = generate_pagination(append_sid('viewonline', "sg=$show_guests&sk=$sort_key&sd=$sort_dir"), $counter, $config['topics_per_page'], $start); +$pagination = generate_pagination(append_sid('viewonline', "sg=$show_guests&sk=$sort_key&sd=$sort_dir"), $counter, phpbb::$config['topics_per_page'], $start); // Grab group details for legend display if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) @@ -418,7 +418,7 @@ $template->assign_vars(array( 'TOTAL_GUEST_USERS_ONLINE' => sprintf($l_g_user_s, $guest_counter), 'LEGEND' => $legend, 'PAGINATION' => $pagination, - 'PAGE_NUMBER' => on_page($counter, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($counter, phpbb::$config['topics_per_page'], $start), 'U_SORT_USERNAME' => append_sid('viewonline', 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), 'U_SORT_UPDATED' => append_sid('viewonline', 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), @@ -426,11 +426,11 @@ $template->assign_vars(array( 'U_SWITCH_GUEST_DISPLAY' => append_sid('viewonline', 'sg=' . ((int) !$show_guests)), 'L_SWITCH_GUEST_DISPLAY' => ($show_guests) ? $user->lang['HIDE_GUESTS'] : $user->lang['DISPLAY_GUESTS'], - 'S_SWITCH_GUEST_DISPLAY' => ($config['load_online_guests']) ? true : false) + 'S_SWITCH_GUEST_DISPLAY' => (phpbb::$config['load_online_guests']) ? true : false) ); // We do not need to load the who is online box here. ;) -$config['load_online'] = false; +phpbb::$config['load_online'] = false; // Output the page page_header($user->lang['WHO_IS_ONLINE']); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 75cadb8460..cb7d117dd7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -200,7 +200,7 @@ if ($user->data['is_registered']) 'ON' => 'tw.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tw.topic_id' ); - if ($config['allow_bookmarks']) + if (phpbb::$config['allow_bookmarks']) { $sql_array['SELECT'] .= ', bm.topic_id as bookmarked'; $sql_array['LEFT_JOIN'][] = array( @@ -209,7 +209,7 @@ if ($user->data['is_registered']) ); } - if ($config['load_db_lastread']) + if (phpbb::$config['load_db_lastread']) { $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time'; @@ -369,7 +369,7 @@ if (phpbb_request::is_set('e', phpbb_request::GET)) // What is start equal to? if ($post_id) { - $start = floor(($topic_data['prev_posts']) / $config['posts_per_page']) * $config['posts_per_page']; + $start = floor(($topic_data['prev_posts']) / phpbb::$config['posts_per_page']) * phpbb::$config['posts_per_page']; } // Get topic tracking info @@ -378,13 +378,13 @@ if (!isset($topic_tracking_info)) $topic_tracking_info = array(); // Get topic tracking info - if ($config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) { $tmp_topic_data = array($topic_id => $topic_data); $topic_tracking_info = get_topic_tracking($forum_id, $topic_id, $tmp_topic_data, array($forum_id => $topic_data['forum_mark_time'])); unset($tmp_topic_data); } - else if ($config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) { $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id); } @@ -448,7 +448,7 @@ if ($hilit_words) // Make sure $start is set to the last page if it exceeds the amount if ($start < 0 || $start >= $total_posts) { - $start = ($start < 0) ? 0 : floor(($total_posts - 1) / $config['posts_per_page']) * $config['posts_per_page']; + $start = ($start < 0) ? 0 : floor(($total_posts - 1) / phpbb::$config['posts_per_page']) * phpbb::$config['posts_per_page']; } // General Viewtopic URL for return links @@ -461,12 +461,12 @@ $s_watching_topic = array( 'is_watching' => false, ); -if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'] && $user->data['is_registered']) +if ((phpbb::$config['email_enable'] || phpbb::$config['jab_enable']) && phpbb::$config['allow_topic_notify'] && $user->data['is_registered']) { watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start); // Reset forum notification if forum notify is set - if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id)) + if (phpbb::$config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id)) { $s_watching_forum = $s_watching_topic; watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0); @@ -474,7 +474,7 @@ if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_n } // Bookmarks -if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0)) +if (phpbb::$config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0)) { if (check_link_hash(request_var('hash', ''), "topic_$topic_id")) { @@ -539,7 +539,7 @@ $topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '<option value="topic_logs">' . $user->lang['VIEW_TOPIC_LOGS'] . '</option>' : ''; // If we've got a hightlight set pass it on to pagination. -$pagination = generate_pagination(append_sid('viewtopic', "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); +$pagination = generate_pagination(append_sid('viewtopic', "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, phpbb::$config['posts_per_page'], $start); // Navigation links generate_forum_nav($topic_data); @@ -571,7 +571,7 @@ $template->assign_vars(array( 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'PAGINATION' => $pagination, - 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), + 'PAGE_NUMBER' => on_page($total_posts, phpbb::$config['posts_per_page'], $start), 'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid('mcp', "i=main&mode=topic_view&f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', @@ -608,7 +608,7 @@ $template->assign_vars(array( 'S_MOD_ACTION' => append_sid('mcp', "f=$forum_id&t=$topic_id&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), 'S_VIEWTOPIC' => true, - 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, + 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && phpbb::$config['load_search']) ? true : false, 'S_SEARCHBOX_ACTION' => append_sid('search', 't=' . $topic_id), 'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, @@ -621,14 +621,14 @@ $template->assign_vars(array( 'U_VIEW_OLDER_TOPIC' => append_sid('viewtopic', "f=$forum_id&t=$topic_id&view=previous"), 'U_VIEW_NEWER_TOPIC' => append_sid('viewtopic', "f=$forum_id&t=$topic_id&view=next"), 'U_PRINT_TOPIC' => ($auth->acl_get('f_print', $forum_id)) ? $viewtopic_url . '&view=print' : '', - 'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? append_sid('memberlist', "mode=email&t=$topic_id") : '', + 'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && phpbb::$config['email_enable']) ? append_sid('memberlist', "mode=email&t=$topic_id") : '', 'U_WATCH_TOPIC' => $s_watching_topic['link'], 'L_WATCH_TOPIC' => $s_watching_topic['title'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], - 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', - 'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], + 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && phpbb::$config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', + 'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && phpbb::$config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid('posting', "mode=post&f=$forum_id") : '', 'U_POST_REPLY_TOPIC' => ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid('posting', "mode=reply&f=$forum_id&t=$topic_id") : '', @@ -673,7 +673,7 @@ if (!empty($topic_data['poll_start'])) // Cookie based guest tracking ... I don't like this but hum ho // it's oft requested. This relies on "nice" users who don't feel // the need to delete cookies to mess with results. - $cur_voted_list = phpbb_request::variable($config['cookie_name'] . '_poll_' . $topic_id, '', false, phpbb_request::COOKIE); + $cur_voted_list = phpbb_request::variable(phpbb::$config['cookie_name'] . '_poll_' . $topic_id, '', false, phpbb_request::COOKIE); if (!empty($cur_voted_list)) { $cur_voted_id = array_map('intval', explode(',', $cur_voted_list)); @@ -858,15 +858,15 @@ if (!empty($topic_data['poll_start'])) // If the user is trying to reach the second half of the topic, fetch it starting from the end $store_reverse = false; -$sql_limit = $config['posts_per_page']; +$sql_limit = phpbb::$config['posts_per_page']; if ($start > $total_posts / 2) { $store_reverse = true; - if ($start + $config['posts_per_page'] > $total_posts) + if ($start + phpbb::$config['posts_per_page'] > $total_posts) { - $sql_limit = min($config['posts_per_page'], max(1, $total_posts - $start)); + $sql_limit = min(phpbb::$config['posts_per_page'], max(1, $total_posts - $start)); } // Select the sort order @@ -956,7 +956,7 @@ while ($row = $db->sql_fetchrow($result)) $poster_id = $row['poster_id']; // Does post have an attachment? If so, add it to the list - if ($row['post_attachment'] && $config['allow_attachments']) + if ($row['post_attachment'] && phpbb::$config['allow_attachments']) { $attach_list[] = $row['post_id']; @@ -1002,7 +1002,7 @@ while ($row = $db->sql_fetchrow($result)) $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); // Is a signature attached? Are we going to display it? - if ($row['enable_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) + if ($row['enable_sig'] && phpbb::$config['allow_sig'] && $user->optionget('viewsigs')) { $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['user_sig_bbcode_bitfield']); } @@ -1055,7 +1055,7 @@ while ($row = $db->sql_fetchrow($result)) $user_sig = ''; // We add the signature to every posters entry because enable_sig is post dependant - if ($row['user_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) + if ($row['user_sig'] && phpbb::$config['allow_sig'] && $user->optionget('viewsigs')) { $user_sig = $row['user_sig']; } @@ -1099,7 +1099,7 @@ while ($row = $db->sql_fetchrow($result)) if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email')) { - $user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid('memberlist', "mode=email&u=$poster_id") : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); + $user_cache[$poster_id]['email'] = (phpbb::$config['board_email_form'] && phpbb::$config['email_enable']) ? append_sid('memberlist', "mode=email&u=$poster_id") : ((phpbb::$config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); } else { @@ -1117,7 +1117,7 @@ while ($row = $db->sql_fetchrow($result)) $user_cache[$poster_id]['icq'] = ''; } - if ($config['allow_birthdays'] && !empty($row['user_birthday'])) + if (phpbb::$config['allow_birthdays'] && !empty($row['user_birthday'])) { list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); @@ -1142,7 +1142,7 @@ while ($row = $db->sql_fetchrow($result)) $db->sql_freeresult($result); // Load custom profile fields -if ($config['load_cpf_viewtopic']) +if (phpbb::$config['load_cpf_viewtopic']) { include(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); $cp = new custom_profile(); @@ -1152,7 +1152,7 @@ if ($config['load_cpf_viewtopic']) } // Generate online information for user -if ($config['load_onlinetrack'] && sizeof($id_cache)) +if (phpbb::$config['load_onlinetrack'] && sizeof($id_cache)) { $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . ' @@ -1160,7 +1160,7 @@ if ($config['load_onlinetrack'] && sizeof($id_cache)) GROUP BY session_user_id'; $result = $db->sql_query($sql); - $update_time = $config['load_online_time'] * 60; + $update_time = phpbb::$config['load_online_time'] * 60; while ($row = $db->sql_fetchrow($result)) { $user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; @@ -1311,7 +1311,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } // Editing information - if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason']) + if (($row['post_edit_count'] && phpbb::$config['display_last_edited']) || $row['post_edit_reason']) { // Get usernames for all following posts if not already stored if (!sizeof($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])))) @@ -1392,7 +1392,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $cp_row = array(); // - if ($config['load_cpf_viewtopic']) + if (phpbb::$config['load_cpf_viewtopic']) { $cp_row = (isset($profile_fields_cache[$poster_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$poster_id]) : array(); } @@ -1435,17 +1435,17 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '', 'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '', 'ICQ_STATUS_IMG' => $user_cache[$poster_id]['icq_status_img'], - 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), - 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), + 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !phpbb::$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'S_ONLINE' => ($poster_id == ANONYMOUS || !phpbb::$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), - 'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? append_sid('posting', "mode=edit&f=$forum_id&p={$row['post_id']}") : ''), + 'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - (phpbb::$config['edit_time'] * 60) || !phpbb::$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? append_sid('posting', "mode=edit&f=$forum_id&p={$row['post_id']}") : ''), 'U_QUOTE' => ($auth->acl_get('f_reply', $forum_id)) ? append_sid('posting', "mode=quote&f=$forum_id&p={$row['post_id']}") : '', 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid('mcp', "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', - 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid('posting', "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), + 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - (phpbb::$config['edit_time'] * 60) || !phpbb::$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid('posting', "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], - 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid('ucp', 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '', + 'U_PM' => ($poster_id != ANONYMOUS && phpbb::$config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid('ucp', 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '', 'U_EMAIL' => $user_cache[$poster_id]['email'], 'U_WWW' => $user_cache[$poster_id]['www'], 'U_ICQ' => $user_cache[$poster_id]['icq'], @@ -1563,7 +1563,7 @@ if ($all_marked_read) } else if (!$all_marked_read) { - $last_page = ((floor($start / $config['posts_per_page']) + 1) == max(ceil($total_posts / $config['posts_per_page']), 1)) ? true : false; + $last_page = ((floor($start / phpbb::$config['posts_per_page']) + 1) == max(ceil($total_posts / phpbb::$config['posts_per_page']), 1)) ? true : false; // What can happen is that we are at the last displayed page. If so, we also display the #unread link based in $post_unread if ($last_page && $post_unread) |