diff options
107 files changed, 3127 insertions, 3651 deletions
diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php index a7ece7e30d..78bb18edab 100644 --- a/phpBB/adm/swatch.php +++ b/phpBB/adm/swatch.php @@ -18,9 +18,9 @@ if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); // Start session management -$user->session_begin(false); -$auth->acl($user->data); -$user->setup(); +phpbb::$user->session_begin(false); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup(); // Set custom template for admin area $template->set_custom_template(PHPBB_ROOT_PATH . phpbb::$base_config['admin_folder'] . '/style', 'admin'); @@ -41,8 +41,8 @@ $template->assign_vars(array( 'NAME' => $name, 'T_IMAGES_PATH' => PHPBB_ROOT_PATH . 'images/', - 'S_USER_LANG' => $user->lang['USER_LANG'], - 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], + 'S_USER_LANG' => phpbb::$user->lang['USER_LANG'], + 'S_CONTENT_DIRECTION' => phpbb::$user->lang['DIRECTION'], 'S_CONTENT_ENCODING' => 'UTF-8', )); diff --git a/phpBB/cron.php b/phpBB/cron.php index b892084a55..9d4b1aa99f 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -17,8 +17,8 @@ if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); // Do not update users last page entry -$user->session_begin(false); -$auth->acl($user->data); +phpbb::$user->session_begin(false); +$auth->acl(phpbb::$user->data); $cron_type = request_var('cron_type', ''); $use_shutdown_function = (@function_exists('register_shutdown_function')) ? true : false; @@ -58,7 +58,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(phpbb::$config['cron_lock']) . "'"; -$db->sql_query($sql); +phpbb::$db->sql_query($sql); // another cron process altered the table between script start and UPDATE query so exit if ($db->sql_affectedrows() != 1) @@ -202,7 +202,7 @@ switch ($cron_type) } else { - $user->session_gc(); + phpbb::$user->session_gc(); } break; @@ -276,8 +276,6 @@ exit; */ function unlock_cron() { - global $db; - $sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = '0' WHERE config_name = 'cron_lock' AND config_value = '" . $db->sql_escape(CRON_ID) . "'"; diff --git a/phpBB/develop/posting-api.php b/phpBB/develop/posting-api.php index 1378748e38..1781d77d98 100644 --- a/phpBB/develop/posting-api.php +++ b/phpBB/develop/posting-api.php @@ -33,7 +33,7 @@ class posting_api topic_last_post_title topic_last_post_time */ - + /* post table: post_id @@ -46,7 +46,7 @@ class posting_api poster_id forum_id post_time - + /* forum table: forum_id @@ -81,8 +81,6 @@ class posting_api // shadow'd and not deleted (it must first exist for it to be shadow'd or deleted!) static function insert_topic($data) { - global $db; - // one transaction, we can now garuntee that atomicity of insertions $db->sql_transaction('begin'); @@ -111,7 +109,7 @@ class posting_api $username = (string) $db->sql_fetchfield('username'); $db->sql_freeresult($result); } - + $sql = 'SELECT forum_topics, forum_unapproved_topics, forum_posts, forum_unapproved_posts FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . (int) $forum_id; @@ -185,7 +183,7 @@ class posting_api { $data['shadow_topic_id'] = $topic_id; $data['forum_id'] = $shadow_forum_id; - self::insert_shadow_topic($data); + self::insert_shadow_topic($data); } // we are consistant, victory is ours @@ -195,8 +193,6 @@ class posting_api // inserts a shadow topic into the database static function insert_shadow_topic($data) { - global $db; - // one transaction, we can now garuntee that atomicity of insertions $db->sql_transaction('begin'); @@ -223,7 +219,7 @@ class posting_api $username = $row['username']; $db->sql_freeresult($result); } - + $sql = 'SELECT forum_topics, forum_shadow_topics FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . (int) $forum_id; @@ -272,7 +268,6 @@ class posting_api static function insert_post($data) { - global $db; // one transaction, we can now garuntee that atomicity of insertions $db->transaction('BEGIN'); @@ -387,8 +382,6 @@ class posting_api static function delete_topics($data) { - global $db; - // lets get this party started $db->sql_transaction('begin'); @@ -451,13 +444,13 @@ class posting_api 'forum_shadow_posts' => max($forum_row['forum_shadow_posts'] - $topic_row['forum_shadow_posts'], 0), 'forum_deleted_posts' => max($forum_row['forum_deleted_posts'] - $topic_row['forum_deleted_posts'], 0), 'forum_unapproved_posts' => max($forum_row['forum_unapproved_posts'] - $topic_row['forum_unapproved_posts'], 0), - + 'forum_topics' => max($forum_row['forum_topics'] - $topic_row['forum_topics'], 0), 'forum_shadow_topics' => max($forum_row['forum_shadow_topics'] - $topic_row['forum_shadow_topics'], 0), 'forum_deleted_topics' => max($forum_row['forum_deleted_topics'] - $topic_row['forum_deleted_topics'], 0), 'forum_unapproved_topics' => max($forum_row['forum_unapproved_topics'] - $topic_row['forum_unapproved_topics'], 0), ); - + // get the last "normal" post in the forum, we _must_ update it $sql = 'SELECT MAX(post_id) as max_post_id FROM ' . POSTS_TABLE . ' @@ -466,7 +459,7 @@ class posting_api $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + // anything left? if ($row) { @@ -477,7 +470,7 @@ class posting_api $result = $db->sql_query($sql); $last_post = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + $forum_array['forum_last_user_id'] = (int) $last_post['poster_id']; $forum_array['forum_last_poster_name'] = $last_post['post_username']; $forum_array['forum_last_post_title'] = $last_post['post_subject']; @@ -491,8 +484,8 @@ class posting_api $forum_array['forum_last_post_title'] = ''; $forum_array['forum_last_post_time'] = 0; } - - $db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_array, "forum_id = $forum_id"); + + $db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_array, "forum_id = $forum_id"); } // let's not get too hasty, we can kill off the shadows later, @@ -527,8 +520,6 @@ class posting_api static function delete_posts($data) { - global $db; - // lets get this party started $db->sql_transaction('begin'); @@ -589,7 +580,7 @@ class posting_api 'forum_deleted_posts' => max($forum_row['forum_deleted_posts'] - $topic_row['forum_deleted_posts'], 0), 'forum_unapproved_posts' => max($forum_row['forum_unapproved_posts'] - $topic_row['forum_unapproved_posts'], 0), ); - + // get the last "normal" post in the forum, we _must_ update it $sql = 'SELECT MAX(post_id) as max_post_id FROM ' . POSTS_TABLE . ' @@ -598,7 +589,7 @@ class posting_api $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + // anything left? if ($row) { @@ -609,7 +600,7 @@ class posting_api $result = $db->sql_query($sql); $last_post = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + $forum_array['forum_last_user_id'] = (int) $last_post['poster_id']; $forum_array['forum_last_poster_name'] = $last_post['post_username']; $forum_array['forum_last_post_title'] = $last_post['post_subject']; @@ -623,7 +614,7 @@ class posting_api $forum_array['forum_last_post_title'] = ''; $forum_array['forum_last_post_time'] = 0; } - + $db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_array, "forum_id = $forum_id"); } @@ -651,7 +642,7 @@ class posting_api 'topic_deleted_posts' => max($topic_row['topic_deleted_posts'] - $post_row['topic_deleted_posts'], 0), 'topic_unapproved_posts' => max($topic_row['topic_unapproved_posts'] - $post_row['topic_unapproved_posts'], 0), ); - + // get the last "normal" post in the topic, we _must_ update it $sql = 'SELECT MAX(post_id) as max_post_id FROM ' . POSTS_TABLE . ' @@ -660,7 +651,7 @@ class posting_api $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + // anything left? if ($row) { @@ -671,7 +662,7 @@ class posting_api $result = $db->sql_query($sql); $last_post = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + $topic_array['topic_last_user_id'] = (int) $last_post['poster_id']; $topic_array['topic_last_poster_name'] = $last_post['post_username']; $topic_array['topic_last_post_title'] = $last_post['post_subject']; @@ -682,9 +673,9 @@ class posting_api // mark this post for execution! $empty_topic_ids[] = $topic_id; } - + $db->sql_handle_data('UPDATE', TOPICS_TABLE, $topic_array, "topic_id = $topic_id"); - } + } $shadow_post_ids = array(); @@ -725,8 +716,6 @@ class posting_api static function move_topics($data) { - global $db; - // lets get this party started $db->transaction('begin'); @@ -831,7 +820,7 @@ class posting_api $result = $db->sql_query($sql); $last_post = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + $forum_data['forum_last_user_id'] = (int) $last_post['poster_id']; $forum_data['forum_last_poster_name'] = $last_post['post_username']; $forum_data['forum_last_post_title'] = $last_post['post_subject']; @@ -845,7 +834,7 @@ class posting_api $forum_data['forum_last_post_title'] = ''; $forum_data['forum_last_post_time'] = 0; } - + // update the old forum $db->sql_handle_data('UPDATE', FORUMS_TABLE, $forum_data, "forum_id = $forum_id"); } diff --git a/phpBB/develop/repair_bots.php b/phpBB/develop/repair_bots.php index dc38726e7c..6743b7deba 100644 --- a/phpBB/develop/repair_bots.php +++ b/phpBB/develop/repair_bots.php @@ -18,9 +18,9 @@ include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); -$user->setup(); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup(); $bots = array( 'AdsBot [Google]' => array('AdsBot-Google', ''), @@ -94,8 +94,6 @@ echo 'done'; */ function add_bots($bots) { - global $db; - $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'"; $result = $db->sql_query($sql); $group_id = (int) $db->sql_fetchfield('group_id', $result); diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php index af2dd6a288..4d80b19f55 100644 --- a/phpBB/develop/search_fill.php +++ b/phpBB/develop/search_fill.php @@ -28,9 +28,9 @@ define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); -$user->setup(); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup(); $search_type = phpbb::$config['search_type']; diff --git a/phpBB/download/file.php b/phpBB/download/file.php index ba4cd1651d..31331dd87a 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -88,9 +88,9 @@ $mode = request_var('mode', ''); $thumbnail = request_var('t', false); // Start session management, do not update session page. -$user->session_begin(false); -$auth->acl($user->data); -$user->setup('viewtopic'); +phpbb::$user->session_begin(false); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup('viewtopic'); if (!$download_id) { @@ -107,7 +107,7 @@ $sql = 'SELECT attach_id, in_message, post_msg_id, extension, is_orphan, poster_ WHERE attach_id = $download_id"; $result = $db->sql_query_limit($sql, 1); $attachment = $db->sql_fetchrow($result); -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); if (!$attachment) { @@ -124,7 +124,7 @@ $row = array(); if ($attachment['is_orphan']) { // We allow admins having attachment permissions to see orphan attachments... - $own_attachment = ($auth->acl_get('a_attach') || $attachment['poster_id'] == $user->data['user_id']) ? true : false; + $own_attachment = ($auth->acl_get('a_attach') || $attachment['poster_id'] == phpbb::$user->data['user_id']) ? true : false; if (!$own_attachment || ($attachment['in_message'] && !$auth->acl_get('u_pm_download')) || (!$attachment['in_message'] && !$auth->acl_get('u_download'))) { @@ -181,7 +181,7 @@ else $allowed = false; while ($user_row = $db->sql_fetchrow($result)) { - if ($user->data['user_id'] == $user_row['user_id'] || $user->data['user_id'] == $user_row['author_id']) + if (phpbb::$user->data['user_id'] == $user_row['user_id'] || phpbb::$user->data['user_id'] == $user_row['author_id']) { $allowed = true; break; @@ -200,14 +200,14 @@ else $extensions = array(); if (!extension_allowed($row['forum_id'], $attachment['extension'], $extensions)) { - trigger_error(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])); + trigger_error(sprintf(phpbb::$user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])); } } if (!download_allowed()) { header('HTTP/1.0 403 forbidden'); - trigger_error($user->lang['LINKAGE_FORBIDDEN']); + trigger_error(phpbb::$user->lang['LINKAGE_FORBIDDEN']); } $download_mode = (int) $extensions[$attachment['extension']]['download_mode']; @@ -218,7 +218,7 @@ $sql = 'SELECT attach_id, is_orphan, in_message, post_msg_id, extension, physica WHERE attach_id = $download_id"; $result = $db->sql_query_limit($sql, 1); $attachment = $db->sql_fetchrow($result); -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); if (!$attachment) { @@ -228,12 +228,12 @@ if (!$attachment) $attachment['physical_filename'] = basename($attachment['physical_filename']); $display_cat = $extensions[$attachment['extension']]['display_cat']; -if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !$user->optionget('viewimg')) +if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !phpbb::$user->optionget('viewimg')) { $display_cat = ATTACHMENT_CATEGORY_NONE; } -if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !$user->optionget('viewflash')) +if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !phpbb::$user->optionget('viewflash')) { $display_cat = ATTACHMENT_CATEGORY_NONE; } @@ -251,7 +251,7 @@ else if (($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT $db->sql_query($sql); } -if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && ((strpos(strtolower($user->browser), 'msie') !== false) && (strpos(strtolower($user->browser), 'msie 8.0') === false))) +if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && ((strpos(strtolower(phpbb::$user->system['browser']), 'msie') !== false) && (strpos(strtolower(phpbb::$user->system['browser']), 'msie 8.0') === false))) { wrap_img_in_html(append_sid('download/file', 'id=' . $attachment['attach_id']), $attachment['real_filename']); } @@ -263,7 +263,7 @@ else // This presenting method should no longer be used if (!@is_dir(PHPBB_ROOT_PATH . phpbb::$config['upload_path'])) { - trigger_error($user->lang['PHYSICAL_DOWNLOAD_NOT_POSSIBLE']); + trigger_error(phpbb::$user->lang['PHYSICAL_DOWNLOAD_NOT_POSSIBLE']); } redirect(PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/' . $attachment['physical_filename']); @@ -379,20 +379,18 @@ function wrap_img_in_html($src, $title) */ function send_file_to_browser($attachment, $upload_dir, $category) { - global $user, $db; - $filename = PHPBB_ROOT_PATH . $upload_dir . '/' . $attachment['physical_filename']; if (!@file_exists($filename)) { - trigger_error($user->lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . sprintf($user->lang['FILE_NOT_FOUND_404'], $filename)); + trigger_error(phpbb::$user->lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . sprintf(phpbb::$user->lang['FILE_NOT_FOUND_404'], $filename)); } // Correct the mime type - we force application/octetstream for all files, except images // Please do not change this, it is a security precaution if ($category != ATTACHMENT_CATEGORY_IMAGE || strpos($attachment['mimetype'], 'image') !== 0) { - $attachment['mimetype'] = (strpos(strtolower($user->browser), 'msie') !== false || strpos(strtolower($user->browser), 'opera') !== false) ? 'application/octetstream' : 'application/octet-stream'; + $attachment['mimetype'] = (strpos(strtolower(phpbb::$user->system['browser']), 'msie') !== false || strpos(strtolower(phpbb::$user->system['browser']), 'opera') !== false) ? 'application/octetstream' : 'application/octet-stream'; } if (@ob_get_length()) @@ -411,7 +409,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) // PHP track_errors setting On? if (!empty($php_errormsg)) { - trigger_error($user->lang['UNABLE_TO_DELIVER_FILE'] . '<br />' . sprintf($user->lang['TRACKED_PHP_ERROR'], $php_errormsg)); + trigger_error(phpbb::$user->lang['UNABLE_TO_DELIVER_FILE'] . '<br />' . sprintf(phpbb::$user->lang['TRACKED_PHP_ERROR'], $php_errormsg)); } trigger_error('UNABLE_TO_DELIVER_FILE'); @@ -436,13 +434,13 @@ function send_file_to_browser($attachment, $upload_dir, $category) */ // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. - $is_ie8 = (strpos(strtolower($user->browser), 'msie 8.0') !== false); + $is_ie8 = (strpos(strtolower(phpbb::$user->system['browser']), 'msie 8.0') !== false); header('Content-Type: ' . $attachment['mimetype'] . (($is_ie8) ? '; authoritative=true;' : '')); - if (empty($user->browser) || (!$is_ie8 && (strpos(strtolower($user->browser), 'msie') !== false))) + if (empty(phpbb::$user->system['browser']) || (!$is_ie8 && (strpos(strtolower(phpbb::$user->system['browser']), 'msie') !== false))) { header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); - if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) + if (empty(phpbb::$user->system['browser']) || (strpos(strtolower(phpbb::$user->system['browser']), 'msie 6.0') !== false)) { header('expires: -1'); } @@ -464,7 +462,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Close the db connection before sending the file $db->sql_close(); - if (!set_modified_headers($attachment['filetime'], $user->browser)) + if (!set_modified_headers($attachment['filetime'], phpbb::$user->system['browser'])) { // Try to deliver in chunks @set_time_limit(0); @@ -512,8 +510,6 @@ function header_filename($file) */ function download_allowed() { - global $user, $db; - if (!phpbb::$config['secure_downloads']) { return true; @@ -552,7 +548,7 @@ function download_allowed() } // Check for own server... - $server_name = $user->host; + $server_name = phpbb::$user->system['host']; // Forcing server vars is the only way to specify/override the protocol if (phpbb::$config['force_server_vars'] || !$server_name) diff --git a/phpBB/faq.php b/phpBB/faq.php index f8d1f1d459..9810f7a2fa 100644 --- a/phpBB/faq.php +++ b/phpBB/faq.php @@ -17,9 +17,9 @@ if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); -$user->setup(); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup(); $mode = request_var('mode', ''); @@ -27,19 +27,19 @@ $mode = request_var('mode', ''); switch ($mode) { case 'bbcode': - $l_title = $user->lang['BBCODE_GUIDE']; - $user->add_lang('bbcode', false, true); + $l_title = phpbb::$user->lang['BBCODE_GUIDE']; + phpbb::$user->add_lang('bbcode', false, true); break; default: - $l_title = $user->lang['FAQ_EXPLAIN']; - $user->add_lang('faq', false, true); + $l_title = phpbb::$user->lang['FAQ_EXPLAIN']; + phpbb::$user->add_lang('faq', false, true); break; } // Pull the array data from the lang pack $help_blocks = array(); -foreach ($user->help as $help_ary) +foreach (phpbb::$user->help as $help_ary) { if ($help_ary[0] == '--') { @@ -59,7 +59,7 @@ foreach ($user->help as $help_ary) // Lets build a page ... $template->assign_vars(array( 'L_FAQ_TITLE' => $l_title, - 'L_BACK_TO_TOP' => $user->lang['BACK_TO_TOP']) + 'L_BACK_TO_TOP' => phpbb::$user->lang['BACK_TO_TOP']) ); page_header($l_title); diff --git a/phpBB/includes/acm/acm_apc.php b/phpBB/includes/acm/acm_apc.php index e4c4b79de3..e0714b1f0a 100644 --- a/phpBB/includes/acm/acm_apc.php +++ b/phpBB/includes/acm/acm_apc.php @@ -1,10 +1,10 @@ <?php -/** +/** * * @package acm * @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @copyright (c) 2009 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ @@ -17,32 +17,35 @@ if (!defined('IN_PHPBB')) } /** -* ACM APC Based Caching +* ACM File Based Caching * @package acm */ class acm { - private $vars = array(); - private $is_modified = false; + var $vars = array(); + var $is_modified = false; - public $sql_rowset = array(); - public $cache_dir = ''; + var $sql_rowset = array(); + var $sql_row_pointer = array(); + var $cache_dir = ''; /** * Set cache path */ - function __construct() + function acm() { - $this->cache_dir = PHPBB_ROOT_PATH . 'cache/'; + $this->cache_dir = $phpbb_root_path . 'cache/'; } /** * Load global cache */ - private function load() + function load() { // grab the global cache - if ($this->vars = apc_fetch('global')) + $this->vars = apc_fetch('global'); + + if ($this->vars !== false) { return true; } @@ -53,20 +56,22 @@ class acm /** * Unload cache object */ - public function unload() + function unload() { $this->save(); unset($this->vars); unset($this->sql_rowset); + unset($this->sql_row_pointer); $this->vars = array(); $this->sql_rowset = array(); + $this->sql_row_pointer = array(); } /** * Save modified objects */ - private function save() + function save() { if (!$this->is_modified) { @@ -81,7 +86,7 @@ class acm /** * Tidy cache */ - public function tidy() + function tidy() { // cache has auto GC, no need to have any code here :) @@ -91,28 +96,29 @@ class acm /** * Get saved cache object */ - public function get($var_name) + function get($var_name) { - if ($var_name[0] === '_') + if ($var_name[0] == '_') { + if (!$this->_exists($var_name)) + { + return false; + } + return apc_fetch($var_name); } else { - if (!sizeof($this->vars)) - { - $this->load(); - } - return (isset($this->vars[$var_name])) ? $this->vars[$var_name] : false; + return ($this->_exists($var_name)) ? $this->vars[$var_name] : false; } } /** * Put data into cache */ - public function put($var_name, $var, $ttl = 31536000) + function put($var_name, $var, $ttl = 31536000) { - if ($var_name[0] === '_') + if ($var_name[0] == '_') { apc_store($var_name, $var, $ttl); } @@ -126,7 +132,7 @@ class acm /** * Purge cache data */ - public function purge() + function purge() { // Purge all phpbb cache files $dir = @opendir($this->cache_dir); @@ -143,7 +149,7 @@ class acm continue; } - @unlink($this->cache_dir . $entry); + $this->remove_file($this->cache_dir . $entry); } closedir($dir); @@ -151,10 +157,11 @@ class acm unset($this->vars); unset($this->sql_rowset); + unset($this->sql_row_pointer); $this->vars = array(); - $this->var_expires = array(); $this->sql_rowset = array(); + $this->sql_row_pointer = array(); $this->is_modified = false; } @@ -162,9 +169,9 @@ class acm /** * Destroy cache data */ - public function destroy($var_name, $table = '') + function destroy($var_name, $table = '') { - if ($var_name === 'sql' && !empty($table)) + if ($var_name == 'sql' && !empty($table)) { if (!is_array($table)) { @@ -175,6 +182,7 @@ class acm { // gives us the md5s that we want $temp = apc_fetch('sql_' . $table_name); + if ($temp === false) { continue; @@ -193,7 +201,12 @@ class acm return; } - if ($var_name[0] === '_') + if (!$this->_exists($var_name)) + { + return; + } + + if ($var_name[0] == '_') { apc_delete($var_name); } @@ -208,9 +221,29 @@ class acm } /** + * Check if a given cache entry exist + */ + function _exists($var_name) + { + if ($var_name[0] == '_') + { + return true; + } + else + { + if (!sizeof($this->vars)) + { + $this->load(); + } + + return isset($this->vars[$var_name]); + } + } + + /** * Load cached sql query */ - public function sql_load($query) + function sql_load($query) { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); @@ -224,6 +257,7 @@ class acm } $this->sql_rowset[$query_id] = $temp; + $this->sql_row_pointer[$query_id] = 0; return $query_id; } @@ -231,25 +265,15 @@ class acm /** * Save sql query */ - public function sql_save($query, &$query_result, $ttl) + function sql_save($query, &$query_result, $ttl) { - global $db; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - // determine which tables this query belongs to: - - // grab all the FROM tables, avoid getting a LEFT JOIN - preg_match('/FROM \(?(\w+(?: (?!LEFT JOIN)\w+)?(?:, ?\w+(?: (?!LEFT JOIN)\w+)?)*)\)?/', $query, $regs); + // determine which tables this query belongs to + preg_match('/FROM \\(?(\\w+(?: \\w+)?(?:, ?\\w+(?: \\w+)?)*)\\)?/', $query, $regs); $tables = array_map('trim', explode(',', $regs[1])); - // now get the LEFT JOIN - preg_match_all('/LEFT JOIN\s+(\w+)(?: \w+)?/', $query, $result, PREG_PATTERN_ORDER); - $tables = array_merge($tables, $result[1]); - - $query_hash = md5($query); - foreach ($tables as $table_name) { if (($pos = strpos($table_name, ' ')) !== false) @@ -262,13 +286,14 @@ class acm { $temp = array(); } - $temp[$query_hash] = true; + $temp[md5($query)] = true; apc_store('sql_' . $table_name, $temp, $ttl); } // store them in the right place $query_id = sizeof($this->sql_rowset); $this->sql_rowset[$query_id] = array(); + $this->sql_row_pointer[$query_id] = 0; while ($row = $db->sql_fetchrow($query_result)) { @@ -276,35 +301,63 @@ class acm } $db->sql_freeresult($query_result); - apc_store('sql_' . $query_hash, $this->sql_rowset[$query_id], $ttl); + apc_store('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl); $query_result = $query_id; } /** + * Ceck if a given sql query exist in cache + */ + function sql_exists($query_id) + { + return isset($this->sql_rowset[$query_id]); + } + + /** * Fetch row from cache (database) */ - public function sql_fetchrow($query_id) + function sql_fetchrow($query_id) { - list(, $row) = each($this->sql_rowset[$query_id]); + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; + } - return ($row !== NULL) ? $row : false; + return false; } /** * Fetch a field from the current row of a cached database result (database) */ - public function sql_fetchfield($query_id, $field) + function sql_fetchfield($query_id, $field) { - $row = current($this->sql_rowset[$query_id]); + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false; + } - return ($row !== false && isset($row[$field])) ? $row[$field] : false; + return false; + } + + /** + * Seek a specific row in an a cached database result (database) + */ + function sql_rowseek($rownum, $query_id) + { + if ($rownum >= sizeof($this->sql_rowset[$query_id])) + { + return false; + } + + $this->sql_row_pointer[$query_id] = $rownum; + return true; } /** * Free memory used for a cached database result (database) */ - public function sql_freeresult($query_id) + function sql_freeresult($query_id) { if (!isset($this->sql_rowset[$query_id])) { @@ -312,9 +365,24 @@ class acm } unset($this->sql_rowset[$query_id]); + unset($this->sql_row_pointer[$query_id]); return true; } + + /** + * Removes/unlinks file + */ + function remove_file($filename, $check = false) + { + if ($check && !@is_writable($this->cache_dir)) + { + // E_USER_ERROR - not using language entry - intended. + trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); + } + + return @unlink($filename); + } } ?>
\ No newline at end of file diff --git a/phpBB/includes/acm/acm_eaccelerator.php b/phpBB/includes/acm/acm_eaccelerator.php index 00d08f70d3..a1bc59d803 100644 --- a/phpBB/includes/acm/acm_eaccelerator.php +++ b/phpBB/includes/acm/acm_eaccelerator.php @@ -1,72 +1,69 @@ <?php -/** +/** * * @package acm * @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @copyright (c) 2005 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* ACM eAccelerator Based Caching +* ACM Memcache Based Caching * @package acm */ class acm { - private $vars = array(); - private $is_modified = false; + var $vars = array(); + var $is_modified = false; - public $sql_rowset = array(); - public $cache_dir = ''; + var $sql_rowset = array(); + var $sql_row_pointer = array(); + var $cache_dir = ''; /** * Set cache path */ - function __construct() + function acm() { - $this->cache_dir = PHPBB_ROOT_PATH . 'cache/'; + $this->cache_dir = $phpbb_root_path . 'cache/'; } /** * Load global cache */ - private function load() + function load() { // grab the global cache - if ($this->vars = eaccelerator_get('global')) + $temp = eaccelerator_get('global'); + + if ($temp !== null) { - return true; + $this->vars = $temp; + } + else + { + return false; } - return false; + return true; } /** * Unload cache object */ - public function unload() + function unload() { $this->save(); unset($this->vars); unset($this->sql_rowset); - - $this->vars = array(); - $this->sql_rowset = array(); + unset($this->sql_row_pointer); } /** * Save modified objects */ - private function save() + function save() { if (!$this->is_modified) { @@ -81,7 +78,7 @@ class acm /** * Tidy cache */ - public function tidy() + function tidy() { eaccelerator_gc(); @@ -91,9 +88,9 @@ class acm /** * Get saved cache object */ - public function get($var_name) + function get($var_name) { - if ($var_name[0] === '_') + if ($var_name[0] == '_') { $temp = eaccelerator_get($var_name); @@ -119,9 +116,9 @@ class acm /** * Put data into cache */ - public function put($var_name, $var, $ttl = 31536000) + function put($var_name, $var, $ttl = 31536000) { - if ($var_name[0] === '_') + if ($var_name[0] == '_') { eaccelerator_put($var_name, $var, $ttl); } @@ -135,7 +132,7 @@ class acm /** * Purge cache data */ - public function purge() + function purge() { // Purge all phpbb cache files $dir = @opendir($this->cache_dir); @@ -163,10 +160,7 @@ class acm unset($this->vars); unset($this->sql_rowset); - - $this->vars = array(); - $this->var_expires = array(); - $this->sql_rowset = array(); + unset($this->sql_row_pointer); $this->is_modified = false; } @@ -174,9 +168,9 @@ class acm /** * Destroy cache data */ - public function destroy($var_name, $table = '') + function destroy($var_name, $table = '') { - if ($var_name === 'sql' && !empty($table)) + if ($var_name == 'sql' && !empty($table)) { if (!is_array($table)) { @@ -209,7 +203,7 @@ class acm return; } - if ($var_name[0] === '_') + if ($var_name[0] == '_') { eaccelerator_rm($var_name); } @@ -226,7 +220,7 @@ class acm /** * Load cached sql query */ - public function sql_load($query) + function sql_load($query) { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); @@ -241,31 +235,23 @@ class acm $this->sql_rowset[$query_id] = $temp; + $this->sql_row_pointer[$query_id] = 0; + return $query_id; } /** * Save sql query */ - public function sql_save($query, &$query_result, $ttl) + function sql_save($query, &$query_result, $ttl) { - global $db; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - // determine which tables this query belongs to: - - // grab all the FROM tables, avoid getting a LEFT JOIN - preg_match('/FROM \(?(\w+(?: (?!LEFT JOIN)\w+)?(?:, ?\w+(?: (?!LEFT JOIN)\w+)?)*)\)?/', $query, $regs); + // determine which tables this query belongs to + preg_match('/FROM \\(?(\\w+(?: \\w+)?(?:, ?\\w+(?: \\w+)?)*)\\)?/', $query, $regs); $tables = array_map('trim', explode(',', $regs[1])); - // now get the LEFT JOIN - preg_match_all('/LEFT JOIN\s+(\w+)(?: \w+)?/', $query, $result, PREG_PATTERN_ORDER); - $tables = array_merge($tables, $result[1]); - - $query_hash = md5($query); - foreach ($tables as $table_name) { if (($pos = strpos($table_name, ' ')) !== false) @@ -278,13 +264,14 @@ class acm { $temp = array(); } - $temp[$query_hash] = true; + $temp[md5($query)] = true; eaccelerator_put('sql_' . $table_name, $temp, $ttl); } // store them in the right place $query_id = sizeof($this->sql_rowset); $this->sql_rowset[$query_id] = array(); + $this->sql_row_pointer[$query_id] = 0; while ($row = $db->sql_fetchrow($query_result)) { @@ -292,35 +279,63 @@ class acm } $db->sql_freeresult($query_result); - eaccelerator_put('sql_' . $query_hash, $this->sql_rowset[$query_id], $ttl); + eaccelerator_put('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl); $query_result = $query_id; } /** + * Ceck if a given sql query exist in cache + */ + function sql_exists($query_id) + { + return isset($this->sql_rowset[$query_id]); + } + + /** * Fetch row from cache (database) */ - public function sql_fetchrow($query_id) + function sql_fetchrow($query_id) { - list(, $row) = each($this->sql_rowset[$query_id]); + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; + } - return ($row !== NULL) ? $row : false; + return false; } /** * Fetch a field from the current row of a cached database result (database) */ - public function sql_fetchfield($query_id, $field) + function sql_fetchfield($query_id, $field) + { + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false; + } + + return false; + } + + /** + * Seek a specific row in an a cached database result (database) + */ + function sql_rowseek($rownum, $query_id) { - $row = current($this->sql_rowset[$query_id]); + if ($rownum >= sizeof($this->sql_rowset[$query_id])) + { + return false; + } - return ($row !== false && isset($row[$field])) ? $row[$field] : false; + $this->sql_row_pointer[$query_id] = $rownum; + return true; } /** * Free memory used for a cached database result (database) */ - public function sql_freeresult($query_id) + function sql_freeresult($query_id) { if (!isset($this->sql_rowset[$query_id])) { @@ -328,6 +343,7 @@ class acm } unset($this->sql_rowset[$query_id]); + unset($this->sql_row_pointer[$query_id]); return true; } diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index bbb556f173..a89657b04e 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -1,10 +1,10 @@ <?php -/** +/** * * @package acm * @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @copyright (c) 2005 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ @@ -17,33 +17,38 @@ if (!defined('IN_PHPBB')) } /** -* ACM Memcache Based Caching +* ACM File Based Caching * @package acm */ class acm { - private $vars = array(); - private $is_modified = false; + var $vars = array(); + var $is_modified = false; + + var $sql_rowset = array(); + var $sql_row_pointer = array(); + var $cache_dir = ''; - public $sql_rowset = array(); - public $cache_dir = ''; - private $memcache; + var $memcache; /** * Set cache path */ - function __construct() + function acm() { + $this->cache_dir = $phpbb_root_path . 'cache/'; $this->memcache = memcache_connect('localhost', 11211); } /** * Load global cache */ - private function load() + function load() { // grab the global cache - if ($this->vars = memcache_get($this->memcache, 'global')) + $this->vars = memcache_get($this->memcache, 'global'); + + if ($this->vars !== false) { return true; } @@ -54,20 +59,22 @@ class acm /** * Unload cache object */ - public function unload() + function unload() { $this->save(); unset($this->vars); unset($this->sql_rowset); + unset($this->sql_row_pointer); $this->vars = array(); $this->sql_rowset = array(); + $this->sql_row_pointer = array(); } /** * Save modified objects */ - private function save() + function save() { if (!$this->is_modified) { @@ -82,7 +89,7 @@ class acm /** * Tidy cache */ - public function tidy() + function tidy() { // cache has auto GC, no need to have any code here :) @@ -92,28 +99,29 @@ class acm /** * Get saved cache object */ - public function get($var_name) + function get($var_name) { - if ($var_name[0] === '_') + if ($var_name[0] == '_') { + if (!$this->_exists($var_name)) + { + return false; + } + return memcache_get($this->memcache, $var_name); } else { - if (!sizeof($this->vars)) - { - $this->load(); - } - return (isset($this->vars[$var_name])) ? $this->vars[$var_name] : false; + return ($this->_exists($var_name)) ? $this->vars[$var_name] : false; } } /** * Put data into cache */ - public function put($var_name, $var, $ttl = 31536000) + function put($var_name, $var, $ttl = 2592000) { - if ($var_name[0] === '_') + if ($var_name[0] == '_') { memcache_set($this->memcache, $var_name, $var, 0, $ttl); } @@ -127,7 +135,7 @@ class acm /** * Purge cache data */ - public function purge() + function purge() { // Purge all phpbb cache files $dir = @opendir($this->cache_dir); @@ -144,7 +152,7 @@ class acm continue; } - @unlink($this->cache_dir . $entry); + $this->remove_file($this->cache_dir . $entry); } closedir($dir); @@ -152,20 +160,22 @@ class acm unset($this->vars); unset($this->sql_rowset); + unset($this->sql_row_pointer); $this->vars = array(); - $this->var_expires = array(); $this->sql_rowset = array(); + $this->sql_row_pointer = array(); $this->is_modified = false; } + /** * Destroy cache data */ - public function destroy($var_name, $table = '') + function destroy($var_name, $table = '') { - if ($var_name === 'sql' && !empty($table)) + if ($var_name == 'sql' && !empty($table)) { if (!is_array($table)) { @@ -176,6 +186,7 @@ class acm { // gives us the md5s that we want $temp = memcache_get($this->memcache, 'sql_' . $table_name); + if ($temp === false) { continue; @@ -194,7 +205,12 @@ class acm return; } - if ($var_name[0] === '_') + if (!$this->_exists($var_name)) + { + return; + } + + if ($var_name[0] == '_') { memcache_delete($this->memcache, $var_name); } @@ -209,9 +225,29 @@ class acm } /** + * Check if a given cache entry exist + */ + function _exists($var_name) + { + if ($var_name[0] == '_') + { + return true; + } + else + { + if (!sizeof($this->vars)) + { + $this->load(); + } + + return isset($this->vars[$var_name]); + } + } + + /** * Load cached sql query */ - public function sql_load($query) + function sql_load($query) { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); @@ -225,7 +261,7 @@ class acm } $this->sql_rowset[$query_id] = $temp; - + $this->sql_row_pointer[$query_id] = 0; return $query_id; } @@ -233,25 +269,15 @@ class acm /** * Save sql query */ - public function sql_save($query, &$query_result, $ttl) + function sql_save($query, &$query_result, $ttl) { - global $db; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - // determine which tables this query belongs to: - - // grab all the FROM tables, avoid getting a LEFT JOIN - preg_match('/FROM \(?(\w+(?: (?!LEFT JOIN)\w+)?(?:, ?\w+(?: (?!LEFT JOIN)\w+)?)*)\)?/', $query, $regs); + // determine which tables this query belongs to + preg_match('/FROM \\(?(\\w+(?: \\w+)?(?:, ?\\w+(?: \\w+)?)*)\\)?/', $query, $regs); $tables = array_map('trim', explode(',', $regs[1])); - // now get the LEFT JOIN - preg_match_all('/LEFT JOIN\s+(\w+)(?: \w+)?/', $query, $result, PREG_PATTERN_ORDER); - $tables = array_merge($tables, $result[1]); - - $query_hash = md5($query); - foreach ($tables as $table_name) { if (($pos = strpos($table_name, ' ')) !== false) @@ -264,13 +290,14 @@ class acm { $temp = array(); } - $temp[$query_hash] = true; + $temp[md5($query)] = true; memcache_set($this->memcache, 'sql_' . $table_name, $temp, 0, $ttl); } // store them in the right place $query_id = sizeof($this->sql_rowset); $this->sql_rowset[$query_id] = array(); + $this->sql_row_pointer[$query_id] = 0; while ($row = $db->sql_fetchrow($query_result)) { @@ -278,35 +305,63 @@ class acm } $db->sql_freeresult($query_result); - memcache_set($this->memcache, 'sql_' . $query_hash, $this->sql_rowset[$query_id], 0, $ttl); + memcache_set($this->memcache, 'sql_' . md5($query), $this->sql_rowset[$query_id], 0, $ttl); $query_result = $query_id; } /** + * Ceck if a given sql query exist in cache + */ + function sql_exists($query_id) + { + return isset($this->sql_rowset[$query_id]); + } + + /** * Fetch row from cache (database) */ - public function sql_fetchrow($query_id) + function sql_fetchrow($query_id) { - list(, $row) = each($this->sql_rowset[$query_id]); + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; + } - return ($row !== NULL) ? $row : false; + return false; } /** * Fetch a field from the current row of a cached database result (database) */ - public function sql_fetchfield($query_id, $field) + function sql_fetchfield($query_id, $field) { - $row = current($this->sql_rowset[$query_id]); + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false; + } - return ($row !== false && isset($row[$field])) ? $row[$field] : false; + return false; + } + + /** + * Seek a specific row in an a cached database result (database) + */ + function sql_rowseek($rownum, $query_id) + { + if ($rownum >= sizeof($this->sql_rowset[$query_id])) + { + return false; + } + + $this->sql_row_pointer[$query_id] = $rownum; + return true; } /** * Free memory used for a cached database result (database) */ - public function sql_freeresult($query_id) + function sql_freeresult($query_id) { if (!isset($this->sql_rowset[$query_id])) { @@ -314,9 +369,24 @@ class acm } unset($this->sql_rowset[$query_id]); + unset($this->sql_row_pointer[$query_id]); return true; } + + /** + * Removes/unlinks file + */ + function remove_file($filename, $check = false) + { + if ($check && !@is_writable($this->cache_dir)) + { + // E_USER_ERROR - not using language entry - intended. + trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); + } + + return @unlink($filename); + } } ?>
\ No newline at end of file diff --git a/phpBB/includes/acm/acm_xcache.php b/phpBB/includes/acm/acm_xcache.php index 38db4d27d8..9531f5e03d 100644 --- a/phpBB/includes/acm/acm_xcache.php +++ b/phpBB/includes/acm/acm_xcache.php @@ -1,45 +1,38 @@ <?php -/** +/** * * @package acm * @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @copyright (c) 2005 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ /** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** * ACM XCache Based Caching * @package acm */ class acm { - private $vars = array(); - private $is_modified = false; + var $vars = array(); + var $is_modified = false; - public $sql_rowset = array(); - public $cache_dir = ''; + var $sql_rowset = array(); + var $sql_row_pointer = array(); + var $cache_dir = ''; /** * Set cache path */ - function __construct() + function acm() { - $this->cache_dir = PHPBB_ROOT_PATH . 'cache/'; + $this->cache_dir = $phpbb_root_path . 'cache/'; } /** * Load global cache */ - private function load() + function load() { // grab the global cache if (xcache_isset('global')) @@ -54,20 +47,18 @@ class acm /** * Unload cache object */ - public function unload() + function unload() { $this->save(); unset($this->vars); unset($this->sql_rowset); - - $this->vars = array(); - $this->sql_rowset = array(); + unset($this->sql_row_pointer); } /** * Save modified objects */ - private function save() + function save() { if (!$this->is_modified) { @@ -82,7 +73,7 @@ class acm /** * Tidy cache */ - public function tidy() + function tidy() { // cache has auto GC, no need to have any code here :) @@ -92,9 +83,9 @@ class acm /** * Get saved cache object */ - public function get($var_name) + function get($var_name) { - if ($var_name[0] === '_') + if ($var_name[0] == '_') { return (xcache_isset($var_name)) ? xcache_get($var_name) : false; } @@ -111,9 +102,9 @@ class acm /** * Put data into cache */ - public function put($var_name, $var, $ttl = 31536000) + function put($var_name, $var, $ttl = 31536000) { - if ($var_name[0] === '_') + if ($var_name[0] == '_') { xcache_set($var_name, $var, $ttl); } @@ -127,7 +118,7 @@ class acm /** * Purge cache data */ - public function purge() + function purge() { // Purge all phpbb cache files $dir = @opendir($this->cache_dir); @@ -156,10 +147,7 @@ class acm unset($this->vars); unset($this->sql_rowset); - - $this->vars = array(); - $this->var_expires = array(); - $this->sql_rowset = array(); + unset($this->sql_row_pointer); $this->is_modified = false; } @@ -167,9 +155,9 @@ class acm /** * Destroy cache data */ - public function destroy($var_name, $table = '') + function destroy($var_name, $table = '') { - if ($var_name === 'sql' && !empty($table)) + if ($var_name == 'sql' && !empty($table)) { if (!is_array($table)) { @@ -198,7 +186,7 @@ class acm return; } - if ($var_name[0] === '_') + if ($var_name[0] == '_') { xcache_unset($var_name); } @@ -215,21 +203,20 @@ class acm /** * Load cached sql query */ - public function sql_load($query) + function sql_load($query) { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); $query_id = sizeof($this->sql_rowset); - $query_hash = md5($query); - - if (!xcache_isset('sql_' . $query_hash)) + if (!xcache_isset('sql_' . md5($query))) { return false; } - $this->sql_rowset[$query_id] = xcache_get('sql_' . $query_hash); + $this->sql_rowset[$query_id] = xcache_get('sql_' . md5($query)); + $this->sql_row_pointer[$query_id] = 0; return $query_id; } @@ -237,25 +224,15 @@ class acm /** * Save sql query */ - public function sql_save($query, &$query_result, $ttl) + function sql_save($query, &$query_result, $ttl) { - global $db; - // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - // determine which tables this query belongs to: - - // grab all the FROM tables, avoid getting a LEFT JOIN - preg_match('/FROM \(?(\w+(?: (?!LEFT JOIN)\w+)?(?:, ?\w+(?: (?!LEFT JOIN)\w+)?)*)\)?/', $query, $regs); + // determine which tables this query belongs to + preg_match('/FROM \\(?(\\w+(?: \\w+)?(?:, ?\\w+(?: \\w+)?)*)\\)?/', $query, $regs); $tables = array_map('trim', explode(',', $regs[1])); - // now get the LEFT JOIN - preg_match_all('/LEFT JOIN\s+(\w+)(?: \w+)?/', $query, $result, PREG_PATTERN_ORDER); - $tables = array_merge($tables, $result[1]); - - $query_hash = md5($query); - foreach ($tables as $table_name) { if (($pos = strpos($table_name, ' ')) !== false) @@ -271,13 +248,14 @@ class acm { $temp = array(); } - $temp[$query_hash] = true; + $temp[md5($query)] = true; xcache_set('sql_' . $table_name, $temp, $ttl); } // store them in the right place $query_id = sizeof($this->sql_rowset); $this->sql_rowset[$query_id] = array(); + $this->sql_row_pointer[$query_id] = 0; while ($row = $db->sql_fetchrow($query_result)) { @@ -285,35 +263,63 @@ class acm } $db->sql_freeresult($query_result); - xcache_set('sql_' . $query_hash, $this->sql_rowset[$query_id], $ttl); + xcache_set('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl); $query_result = $query_id; } /** + * Ceck if a given sql query exist in cache + */ + function sql_exists($query_id) + { + return isset($this->sql_rowset[$query_id]); + } + + /** * Fetch row from cache (database) */ - public function sql_fetchrow($query_id) + function sql_fetchrow($query_id) { - list(, $row) = each($this->sql_rowset[$query_id]); + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; + } - return ($row !== NULL) ? $row : false; + return false; } /** * Fetch a field from the current row of a cached database result (database) */ - public function sql_fetchfield($query_id, $field) + function sql_fetchfield($query_id, $field) { - $row = current($this->sql_rowset[$query_id]); + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false; + } + + return false; + } - return ($row !== false && isset($row[$field])) ? $row[$field] : false; + /** + * Seek a specific row in an a cached database result (database) + */ + function sql_rowseek($rownum, $query_id) + { + if ($rownum >= sizeof($this->sql_rowset[$query_id])) + { + return false; + } + + $this->sql_row_pointer[$query_id] = $rownum; + return true; } /** * Free memory used for a cached database result (database) */ - public function sql_freeresult($query_id) + function sql_freeresult($query_id) { if (!isset($this->sql_rowset[$query_id])) { @@ -321,6 +327,7 @@ class acm } unset($this->sql_rowset[$query_id]); + unset($this->sql_row_pointer[$query_id]); return true; } diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php index fa41c41de4..97112913cf 100644 --- a/phpBB/includes/auth/auth_apache.php +++ b/phpBB/includes/auth/auth_apache.php @@ -28,11 +28,9 @@ if (!defined('IN_PHPBB')) */ function init_apache() { - global $user; - - if (!isset($_SERVER['PHP_AUTH_USER']) || $user->data['username'] !== $_SERVER['PHP_AUTH_USER']) + if (!isset($_SERVER['PHP_AUTH_USER']) || phpbb::$user->data['username'] !== $_SERVER['PHP_AUTH_USER']) { - return $user->lang['APACHE_SETUP_BEFORE_USE']; + return phpbb::$user->lang['APACHE_SETUP_BEFORE_USE']; } return false; } @@ -42,8 +40,6 @@ function init_apache() */ function login_apache(&$username, &$password) { - global $db; - // do not allow empty password if (!$password) { @@ -136,8 +132,6 @@ function login_apache(&$username, &$password) */ function autologin_apache() { - global $db; - if (!isset($_SERVER['PHP_AUTH_USER'])) { return array(); @@ -192,7 +186,6 @@ function autologin_apache() */ function user_row_apache($username, $password) { - global $db, $user; // first retrieve default group id $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " @@ -214,7 +207,7 @@ function user_row_apache($username, $password) 'user_email' => '', 'group_id' => (int) $row['group_id'], 'user_type' => phpbb::USER_NORMAL, - 'user_ip' => $user->ip, + 'user_ip' => phpbb::$user->ip, ); } diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index 19ec9db683..84eb6f33d4 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -27,11 +27,9 @@ if (!defined('IN_PHPBB')) */ function init_ldap() { - global $user; - if (!@extension_loaded('ldap')) { - return $user->lang['LDAP_NO_LDAP_EXTENSION']; + return phpbb::$user->lang['LDAP_NO_LDAP_EXTENSION']; } phpbb::$config['ldap_port'] = (int) phpbb::$config['ldap_port']; @@ -46,7 +44,7 @@ function init_ldap() if (!$ldap) { - return $user->lang['LDAP_NO_SERVER_CONNECTION']; + return phpbb::$user->lang['LDAP_NO_SERVER_CONNECTION']; } @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); @@ -56,7 +54,7 @@ function init_ldap() { if (!@ldap_bind($ldap, htmlspecialchars_decode(phpbb::$config['ldap_user']), htmlspecialchars_decode(phpbb::$config['ldap_password']))) { - return $user->lang['LDAP_INCORRECT_USER_PASSWORD']; + return phpbb::$user->lang['LDAP_INCORRECT_USER_PASSWORD']; } } @@ -64,7 +62,7 @@ function init_ldap() $search = @ldap_search( $ldap, phpbb::$config['ldap_base_dn'], - ldap_user_filter($user->data['username']), + ldap_user_filter(phpbb::$user->data['username']), (empty(phpbb::$config['ldap_email'])) ? array(phpbb::$config['ldap_uid']) : array(phpbb::$config['ldap_uid'], phpbb::$config['ldap_email']), 0, 1 @@ -72,7 +70,7 @@ function init_ldap() if ($search === false) { - return $user->lang['LDAP_NO_SERVER_CONNECTION']; + return phpbb::$user->lang['LDAP_NO_SERVER_CONNECTION']; } $result = @ldap_get_entries($ldap, $search); @@ -82,12 +80,12 @@ function init_ldap() if (!is_array($result) || sizeof($result) < 2) { - return sprintf($user->lang['LDAP_NO_IDENTITY'], $user->data['username']); + return sprintf(phpbb::$user->lang['LDAP_NO_IDENTITY'], phpbb::$user->data['username']); } if (!empty(phpbb::$config['ldap_email']) && !isset($result[0][phpbb::$config['ldap_email']])) { - return $user->lang['LDAP_NO_EMAIL']; + return phpbb::$user->lang['LDAP_NO_EMAIL']; } return false; @@ -98,8 +96,6 @@ function init_ldap() */ function login_ldap(&$username, &$password) { - global $db, $user; - // do not allow empty password if (!$password) { @@ -154,7 +150,7 @@ function login_ldap(&$username, &$password) { if (!@ldap_bind($ldap, phpbb::$config['ldap_user'], htmlspecialchars_decode(phpbb::$config['ldap_password']))) { - return $user->lang['LDAP_NO_SERVER_CONNECTION']; + return phpbb::$user->lang['LDAP_NO_SERVER_CONNECTION']; } } @@ -226,7 +222,7 @@ function login_ldap(&$username, &$password) '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, + 'user_ip' => phpbb::$user->ip, ); unset($ldap_result); @@ -293,40 +289,38 @@ function ldap_escape($string) */ function acp_ldap(&$new) { - global $user; - $tpl = ' <dl> - <dt><label for="ldap_server">' . $user->lang['LDAP_SERVER'] . ':</label><br /><span>' . $user->lang['LDAP_SERVER_EXPLAIN'] . '</span></dt> + <dt><label for="ldap_server">' . phpbb::$user->lang['LDAP_SERVER'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_SERVER_EXPLAIN'] . '</span></dt> <dd><input type="text" id="ldap_server" size="40" name="config[ldap_server]" value="' . $new['ldap_server'] . '" /></dd> </dl> <dl> - <dt><label for="ldap_port">' . $user->lang['LDAP_PORT'] . ':</label><br /><span>' . $user->lang['LDAP_PORT_EXPLAIN'] . '</span></dt> + <dt><label for="ldap_port">' . phpbb::$user->lang['LDAP_PORT'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_PORT_EXPLAIN'] . '</span></dt> <dd><input type="text" id="ldap_port" size="40" name="config[ldap_port]" value="' . $new['ldap_port'] . '" /></dd> </dl> <dl> - <dt><label for="ldap_dn">' . $user->lang['LDAP_DN'] . ':</label><br /><span>' . $user->lang['LDAP_DN_EXPLAIN'] . '</span></dt> + <dt><label for="ldap_dn">' . phpbb::$user->lang['LDAP_DN'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_DN_EXPLAIN'] . '</span></dt> <dd><input type="text" id="ldap_dn" size="40" name="config[ldap_base_dn]" value="' . $new['ldap_base_dn'] . '" /></dd> </dl> <dl> - <dt><label for="ldap_uid">' . $user->lang['LDAP_UID'] . ':</label><br /><span>' . $user->lang['LDAP_UID_EXPLAIN'] . '</span></dt> + <dt><label for="ldap_uid">' . phpbb::$user->lang['LDAP_UID'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_UID_EXPLAIN'] . '</span></dt> <dd><input type="text" id="ldap_uid" size="40" name="config[ldap_uid]" value="' . $new['ldap_uid'] . '" /></dd> </dl> <dl> - <dt><label for="ldap_user_filter">' . $user->lang['LDAP_USER_FILTER'] . ':</label><br /><span>' . $user->lang['LDAP_USER_FILTER_EXPLAIN'] . '</span></dt> + <dt><label for="ldap_user_filter">' . phpbb::$user->lang['LDAP_USER_FILTER'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_USER_FILTER_EXPLAIN'] . '</span></dt> <dd><input type="text" id="ldap_user_filter" size="40" name="config[ldap_user_filter]" value="' . $new['ldap_user_filter'] . '" /></dd> </dl> <dl> - <dt><label for="ldap_email">' . $user->lang['LDAP_EMAIL'] . ':</label><br /><span>' . $user->lang['LDAP_EMAIL_EXPLAIN'] . '</span></dt> + <dt><label for="ldap_email">' . phpbb::$user->lang['LDAP_EMAIL'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_EMAIL_EXPLAIN'] . '</span></dt> <dd><input type="text" id="ldap_email" size="40" name="config[ldap_email]" value="' . $new['ldap_email'] . '" /></dd> </dl> <dl> - <dt><label for="ldap_user">' . $user->lang['LDAP_USER'] . ':</label><br /><span>' . $user->lang['LDAP_USER_EXPLAIN'] . '</span></dt> + <dt><label for="ldap_user">' . phpbb::$user->lang['LDAP_USER'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_USER_EXPLAIN'] . '</span></dt> <dd><input type="text" id="ldap_user" size="40" name="config[ldap_user]" value="' . $new['ldap_user'] . '" /></dd> </dl> <dl> - <dt><label for="ldap_password">' . $user->lang['LDAP_PASSWORD'] . ':</label><br /><span>' . $user->lang['LDAP_PASSWORD_EXPLAIN'] . '</span></dt> + <dt><label for="ldap_password">' . phpbb::$user->lang['LDAP_PASSWORD'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_PASSWORD_EXPLAIN'] . '</span></dt> <dd><input type="password" id="ldap_password" size="40" name="config[ldap_password]" value="' . $new['ldap_password'] . '" /></dd> </dl> '; diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index d688f660f2..bea6d967ae 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -128,12 +128,10 @@ class bbcode */ function bbcode_cache_init() { - global $user; - if (empty($this->template_filename)) { - $this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']); - $this->template_filename = PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html'; + $this->template_bitfield = new bitfield(phpbb::$user->theme['bbcode_bitfield']); + $this->template_filename = PHPBB_ROOT_PATH . 'styles/' . phpbb::$user->theme['template_path'] . '/template/bbcode.html'; if (!@file_exists($this->template_filename)) { @@ -163,8 +161,6 @@ class bbcode if (sizeof($sql)) { - global $db; - $sql = 'SELECT * FROM ' . BBCODES_TABLE . ' WHERE ' . $db->sql_in_set('bbcode_id', $sql); @@ -225,7 +221,7 @@ class bbcode break; case 4: - if ($user->optionget('viewimg')) + if (phpbb::$user->optionget('viewimg')) { $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( @@ -304,7 +300,7 @@ class bbcode break; case 11: - if ($user->optionget('viewflash')) + if (phpbb::$user->optionget('viewflash')) { $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( @@ -365,7 +361,7 @@ class bbcode } // Replace {L_*} lang strings - $bbcode_tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl); + $bbcode_tpl = preg_replace('/{L_([A-Z_]+)}/e', "phpbb::\$user->lang('\$1')", $bbcode_tpl); if (!empty($rowset[$bbcode_id]['second_pass_replace'])) { @@ -398,8 +394,6 @@ class bbcode static $bbcode_hardtpl = array(); if (empty($bbcode_hardtpl)) { - global $user; - $bbcode_hardtpl = array( 'b_open' => '<span style="font-weight: bold">', 'b_close' => '</span>', @@ -407,7 +401,7 @@ class bbcode 'i_close' => '</span>', 'u_open' => '<span style="text-decoration: underline">', 'u_close' => '</span>', - 'img' => '<img src="$1" alt="' . $user->lang['IMAGE'] . '" />', + 'img' => '<img src="$1" alt="' . phpbb::$user->lang['IMAGE'] . '" />', 'size' => '<span style="font-size: $1%; line-height: normal">$2</span>', 'color' => '<span style="color: $1">$2</span>', 'email' => '<a href="mailto:$1">$2</a>' @@ -457,8 +451,6 @@ class bbcode */ function bbcode_tpl_replace($tpl_name, $tpl) { - global $user; - static $replacements = array( 'quote_username_open' => array('{USERNAME}' => '$1'), 'color' => array('{COLOR}' => '$1', '{TEXT}' => '$2'), @@ -469,7 +461,7 @@ class bbcode 'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2') ); - $tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl); + $tpl = preg_replace('/{L_([A-Z_]+)}/e', "phpbb::\$user->lang('\$1')", $tpl); if (!empty($replacements[$tpl_name])) { diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index 7cc3bf8abb..adbb06e7db 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -32,8 +32,6 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function init($type) { - global $db, $user; - // read input $this->confirm_id = request_var('confirm_id', ''); $this->confirm_code = request_var('confirm_code', ''); @@ -48,8 +46,6 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function execute_demo() { - global $user; - $this->code = gen_rand_string(mt_rand(5, 8)); $this->seed = hexdec(substr(unique_id(), 4, 10)); @@ -76,8 +72,6 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function get_template() { - global $user, $template; - $template->set_filenames(array( 'captcha' => 'captcha_default.html') ); @@ -92,8 +86,6 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function get_demo_template($id) { - global $user, $template; - $template->set_filenames(array( 'captcha_demo' => 'captcha_default_acp_demo.html') ); @@ -121,8 +113,6 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin static function garbage_collect($type) { - global $db; - $sql = 'SELECT DISTINCT c.session_id FROM ' . CONFIRM_TABLE . ' c LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) @@ -161,13 +151,11 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function validate() { - global $db, $user; - $this->confirm_code = request_var('confirm_code', ''); if (!$this->confirm_id) { - $error = $user->lang['CONFIRM_CODE_WRONG']; + $error = phpbb::$user->lang['CONFIRM_CODE_WRONG']; } else { @@ -178,7 +166,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin } else { - $error = $user->lang['CONFIRM_CODE_WRONG']; + $error = phpbb::$user->lang['CONFIRM_CODE_WRONG']; } } @@ -200,10 +188,8 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin */ protected function generate_code() { - global $db, $user; - $this->code = gen_rand_string(mt_rand(5, 8)); - $this->confirm_id = md5(unique_id($user->ip)); + $this->confirm_id = md5(unique_id(phpbb::$user->ip)); $this->seed = hexdec(substr(unique_id(), 4, 10)); $this->solved = false; // compute $seed % 0x7fffffff @@ -211,7 +197,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'confirm_id' => (string) $this->confirm_id, - 'session_id' => (string) $user->session_id, + 'session_id' => (string) phpbb::$user->session_id, 'confirm_type' => (int) $this->type, 'code' => (string) $this->code, 'seed' => (int) $this->seed) @@ -224,11 +210,10 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin */ protected function load_code() { - global $db, $user; $sql = 'SELECT code, seed FROM ' . CONFIRM_TABLE . " WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "' AND confirm_type = " . $this->type; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); @@ -245,8 +230,6 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin protected function check_code() { - global $db; - if (empty($this->code)) { if (!$this->load_code()) @@ -259,22 +242,18 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin protected function delete_code() { - global $db, $user; - $sql = 'DELETE FROM ' . CONFIRM_TABLE . " WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "' AND confirm_type = " . $this->type; $db->sql_query($sql); } function get_attempt_count() { - global $db, $user; - $sql = 'SELECT COUNT(session_id) AS attempts FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + WHERE session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "' AND confirm_type = " . $this->type; $result = $db->sql_query($sql); $attempts = (int) $db->sql_fetchfield('attempts'); @@ -286,10 +265,8 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin function reset() { - global $db, $user; - $sql = 'DELETE FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + WHERE session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "' AND confirm_type = " . (int) $this->type; $db->sql_query($sql); diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php index 8711c9bb14..bb4d550903 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -50,8 +50,6 @@ class phpbb_captcha_gd extends phpbb_default_captcha implements phpbb_captcha_pl function acp_page($id, &$module) { - global $db, $template, $user; - $captcha_vars = array( 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', @@ -77,11 +75,11 @@ class phpbb_captcha_gd extends phpbb_default_captcha implements phpbb_captcha_pl set_config($captcha_var, $value); } } - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); + trigger_error(phpbb::$user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); } else if ($submit) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); } else { 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 6b1629f8ad..1dbebcdbd6 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php @@ -50,9 +50,7 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha implements phpbb_captc function acp_page($id, &$module) { - global $db, $template, $user; - - trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); + trigger_error(phpbb::$user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); } } diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php index ac09e4f3c7..f76c42338e 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php @@ -37,8 +37,6 @@ class phpbb_captcha_nogd extends phpbb_default_captcha implements phpbb_captcha_ static function get_name() { - global $user; - return 'CAPTCHA_NO_GD'; } @@ -50,9 +48,7 @@ class phpbb_captcha_nogd extends phpbb_default_captcha implements phpbb_captcha_ function acp_page($id, &$module) { - global $user; - - trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); + trigger_error(phpbb::$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 ddb52ba8e8..e70500e797 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -2,7 +2,7 @@ /** * * @package VC -* @version $Id: constants.php 8818 2008-09-04 14:06:43Z acydburn $ +* @version $Id$ * @copyright (c) 2006 2008 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -28,9 +28,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu function init($type) { - global $db, $user; - - $user->add_lang('recaptcha'); + phpbb::$user->add_lang('recaptcha'); parent::init($type); $this->challenge = request_var('recaptcha_challenge_field', ''); @@ -44,8 +42,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu static function is_available() { - global $user; - $user->add_lang('recaptcha'); + phpbb::$user->add_lang('recaptcha'); return (isset(phpbb::$config['recaptcha_pubkey']) && !empty(phpbb::$config['recaptcha_pubkey'])); } @@ -61,8 +58,6 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu function acp_page($id, &$module) { - global $db, $template, $user; - $captcha_vars = array( 'recaptcha_pubkey' => 'RECAPTCHA_PUBKEY', 'recaptcha_privkey' => 'RECAPTCHA_PRIVKEY', @@ -86,11 +81,11 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu set_config($captcha_var, $value); } } - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); + trigger_error(phpbb::$user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); } else if ($submit) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); } else { @@ -122,8 +117,6 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu function get_template() { - global $user, $template; - $template->set_filenames(array( 'captcha' => 'captcha_recaptcha.html') ); @@ -260,17 +253,15 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu */ protected function recaptcha_check_answer($extra_params = array()) { - global $user; - // discard spam submissions if ($this->challenge == null || strlen($this->challenge) == 0 || $this->response == null || strlen($this->response) == 0) { - return $user->lang['RECAPTCHA_INCORRECT']; + return phpbb::$user->lang['RECAPTCHA_INCORRECT']; } $response = $this->_recaptcha_http_post(self::recaptcha_verify_server, '/verify', array( 'privatekey' => phpbb::$config['recaptcha_privkey'], - 'remoteip' => $user->ip, + 'remoteip' => phpbb::$user->ip, 'challenge' => $this->challenge, 'response' => $this->response, ) + $extra_params @@ -287,7 +278,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu { if ($answers[1] === 'incorrect-captcha-sol') { - return $user->lang['RECAPTCHA_INCORRECT']; + return phpbb::$user->lang['RECAPTCHA_INCORRECT']; } } } diff --git a/phpBB/includes/classes/session.php b/phpBB/includes/classes/session.php index e5f4bd8e0c..04840fff55 100644 --- a/phpBB/includes/classes/session.php +++ b/phpBB/includes/classes/session.php @@ -58,21 +58,6 @@ abstract class phpbb_session public $system = NULL; /** - * @var bool Is true if the user is a logged in registered user - */ - public $is_registered = false; - - /** - * @var bool Is true if the user is logged in and a search engine/bot - */ - public $is_bot = false; - - /** - * @var bool Is true if user is founder - */ - public $is_founder = false; - - /** * @var array Extra url parameter to append to every URL in phpBB */ public $extra_url = array(); @@ -304,6 +289,7 @@ abstract class phpbb_session else { $this->is_registered = true; + $this->is_guest = false; $this->is_founder = $this->data['user_type'] == phpbb::USER_FOUNDER; } @@ -824,6 +810,7 @@ abstract class phpbb_session { $this->setup('ucp'); $this->is_registered = $this->is_bot = $this->is_founder = false; + $this->is_guest = true; // Set as a precaution to allow login_box() handling this case correctly as well as this function not being executed again. define('IN_CHECK_BAN', 1); @@ -1113,6 +1100,7 @@ abstract class phpbb_session $this->is_registered = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == phpbb::USER_NORMAL || $this->data['user_type'] == phpbb::USER_FOUNDER)) ? true : false; $this->is_bot = (!$this->is_registered && $this->data['user_id'] != ANONYMOUS) ? true : false; $this->is_founder = $this->data['user_type'] == phpbb::USER_FOUNDER; + $this->is_guest = (!$this->is_registered && $this->data['user_id'] == ANONYMOUS) ? true : false; $this->data['user_lang'] = basename($this->data['user_lang']); return true; diff --git a/phpBB/includes/classes/template.php b/phpBB/includes/classes/template.php index a3277475cf..984a9af2e1 100644 --- a/phpBB/includes/classes/template.php +++ b/phpBB/includes/classes/template.php @@ -17,6 +17,16 @@ if (!defined('IN_PHPBB')) } /** +* @todo +* IMG_ for image substitution? +* {IMG_[key]:[alt]:[type]} +* {IMG_ICON_CONTACT:CONTACT:full} -> phpbb::$user->img('icon_contact', 'CONTACT', 'full'); +* +* More in-depth... +* yadayada +*/ + +/** * Base Template class. * @package phpBB3 */ diff --git a/phpBB/includes/classes/user.php b/phpBB/includes/classes/user.php index beba494e98..e060bcda52 100644 --- a/phpBB/includes/classes/user.php +++ b/phpBB/includes/classes/user.php @@ -92,6 +92,26 @@ class phpbb_user extends phpbb_session public $img_array = array(); /** + * @var bool Is true if the user is a logged in registered user + */ + public $is_registered = false; + + /** + * @var bool Is true if the user is logged in and a search engine/bot + */ + public $is_bot = false; + + /** + * @var bool Is true if user is founder + */ + public $is_founder = false; + + /** + * @var bool Is true if user is anonymous/guest + */ + public $is_guest = true; + + /** * Ablility to add new option (id 7). Enabled user options is stored in $data['user_options']. * @var array user options defining their possibilities to view flash, images, etc. User options only supports set/unset (true/false) */ @@ -539,7 +559,7 @@ class phpbb_user extends phpbb_session // Does the user need to change their password? If so, redirect to the // ucp profile reg_details page ... of course do not redirect if we're already in the ucp - if (!defined('IN_ADMIN') && !defined('ADMIN_START') && phpbb::$config['chg_passforce'] && $this->data['is_registered'] && phpbb::$acl->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - (phpbb::$config['chg_passforce'] * 86400)) + if (!defined('IN_ADMIN') && !defined('ADMIN_START') && phpbb::$config['chg_passforce'] && $this->is_registered && phpbb::$acl->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - (phpbb::$config['chg_passforce'] * 86400)) { if (strpos($this->page['query_string'], 'mode=reg_details') === false && $this->page['page_name'] != 'ucp.' . PHP_EXT) { diff --git a/phpBB/includes/core/url.php b/phpBB/includes/core/url.php index c743b36641..c182998b87 100644 --- a/phpBB/includes/core/url.php +++ b/phpBB/includes/core/url.php @@ -430,7 +430,7 @@ class phpbb_url extends phpbb_plugin_support if ($server_port && (($cookie_secure && $server_port <> 443) || (!$cookie_secure && $server_port <> 80))) { - // HTTP HOST can carry a port number (we fetch $user->host, but for old versions this may be true) + // HTTP HOST can carry a port number (we fetch $user->system['host'], but for old versions this may be true) if (strpos($server_name, ':') === false) { $url .= ':' . $server_port; diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index 0837ac90d1..674a3b58b4 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -439,8 +439,6 @@ class diff3 extends diff */ function merged_output($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $label_sep = 'DIFF_SEP_EXPLAIN', $get_conflicts = false, $merge_new = false) { - global $user; - if ($get_conflicts) { foreach ($this->_edits as $edit) @@ -454,9 +452,9 @@ class diff3 extends diff return $this->_conflicting_blocks; } - $label1 = (!empty($user->lang[$label1])) ? $user->lang[$label1] : $label1; - $label2 = (!empty($user->lang[$label2])) ? $user->lang[$label2] : $label2; - $label_sep = (!empty($user->lang[$label_sep])) ? $user->lang[$label_sep] : $label_sep; + $label1 = (!empty(phpbb::$user->lang[$label1])) ? phpbb::$user->lang[$label1] : $label1; + $label2 = (!empty(phpbb::$user->lang[$label2])) ? phpbb::$user->lang[$label2] : $label2; + $label_sep = (!empty(phpbb::$user->lang[$label_sep])) ? phpbb::$user->lang[$label_sep] : $label_sep; $lines = array(); diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index 7f7a3366b1..8194b63da6 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -598,15 +598,13 @@ class diff_renderer_side_by_side extends diff_renderer */ function get_diff_content($diff) { - global $user; - $output = ''; $output .= '<table cellspacing="0" class="hrdiff"> <caption> - <span class="unmodified"> </span> ' . $user->lang['LINE_UNMODIFIED'] . ' - <span class="added"> </span> ' . $user->lang['LINE_ADDED'] . ' - <span class="modified"> </span> ' . $user->lang['LINE_MODIFIED'] . ' - <span class="removed"> </span> ' . $user->lang['LINE_REMOVED'] . ' + <span class="unmodified"> </span> ' . phpbb::$user->lang['LINE_UNMODIFIED'] . ' + <span class="added"> </span> ' . phpbb::$user->lang['LINE_ADDED'] . ' + <span class="modified"> </span> ' . phpbb::$user->lang['LINE_MODIFIED'] . ' + <span class="removed"> </span> ' . phpbb::$user->lang['LINE_REMOVED'] . ' </caption> <tbody> '; @@ -616,14 +614,14 @@ class diff_renderer_side_by_side extends diff_renderer // Is the diff empty? if (!sizeof($this->lines)) { - $output .= '<tr><th colspan="2">' . $user->lang['NO_VISIBLE_CHANGES'] . '</th></tr>'; + $output .= '<tr><th colspan="2">' . phpbb::$user->lang['NO_VISIBLE_CHANGES'] . '</th></tr>'; } else { // Iterate through every header block of changes foreach ($this->lines as $header) { - $output .= '<tr><th>' . $user->lang['LINE'] . ' ' . $header['oldline'] . '</th><th>' . $user->lang['LINE'] . ' ' . $header['newline'] . '</th></tr>'; + $output .= '<tr><th>' . phpbb::$user->lang['LINE'] . ' ' . $header['oldline'] . '</th><th>' . phpbb::$user->lang['LINE'] . ' ' . $header['newline'] . '</th></tr>'; // Each header block consists of a number of changes (add, remove, change). $current_context = ''; diff --git a/phpBB/includes/formatted_text.php b/phpBB/includes/formatted_text.php index 0e7c1d7ea8..418c886998 100644 --- a/phpBB/includes/formatted_text.php +++ b/phpBB/includes/formatted_text.php @@ -34,51 +34,51 @@ class formatted_text * @var string */ private $meta; - + /** * Formatting options as bit flag. - * + * * @see bbcode_parser * * @var int */ private $flags; - + /** * Compiled $text. For dispaly. * * @var string */ private $compiled; - + /** * Set to true if text, meta or flags have been changed, false otherwise. * * @var bool */ private $changed; - + /** * DB table to update * * @var string */ private $update_table = ''; - + /** * Column in $update_table to update. * * @var string */ private $update_column = ''; - + /** * Where clause for auto update. * * @var string */ private $update_where = ''; - + /** * Creates a new instance. * @@ -110,12 +110,12 @@ class formatted_text $this->to_db($this->update_table, $this->update_column, $this->update_where); } } - + /** * Convieniently initialize a formatted_text object from * a database result set. The array must contain the following indexes: * $column, {$column}_meta and {$column}_flags - * + * * * @param array $data * @param string $column @@ -125,7 +125,7 @@ class formatted_text { return new formatted_text($data[$column], $data[$column . '_meta'], (int) $data[$column . '_flags']); } - + /** * Returns the $text formatted, ready to be displayed on a webpage. * @@ -148,9 +148,8 @@ class formatted_text */ public function to_db($table, $column, $where = '1') { - global $db; $this->changed = false; - + $sql = 'UPDATE ' . $table . ' SET ' . $db->sql_build_query('UPDATE', $this->to_db_data($column)) . ' WHERE ' . $where; return (bool) $db->sql_query($sql); @@ -182,7 +181,7 @@ class formatted_text $this->update_column = $column; $this->update_where = $where; } - + /** * Sets $meta if not set. */ @@ -196,7 +195,7 @@ class formatted_text $parser = new phpbb_bbcode_parser; $this->meta = $parser->first_pass($this->text); } - + /** * Sets $compiled if not set. */ @@ -243,7 +242,7 @@ class formatted_text $this->compiled = ''; } } - + /** * Returns the current text. * @@ -253,7 +252,7 @@ class formatted_text { return $this->text; } - + /** * Returns the current(!!) metadata. * @@ -263,7 +262,7 @@ class formatted_text { return $this->meta; } - + /** * Returns the current flags. * @@ -273,7 +272,7 @@ class formatted_text { return $this->flags; } - + /** * Returns true if $this is equal to $other. * Objects are only equal if $text and $flags are equal. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bdd175e9da..48314467de 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -16,8 +16,6 @@ if (!defined('IN_PHPBB')) exit; } -// Common global functions - /** * Wrapper function of phpbb_request::variable which exists for backwards compatability. * See {@link phpbb_request::variable phpbb_request::variable} for documentation of this function's use. @@ -75,6 +73,7 @@ function set_config($config_name, $config_value, $is_dynamic = false) /** * Return formatted string for filesizes +* @todo move those functions to a helper class? */ function get_formatted_filesize($bytes, $add_size_lang = true) { @@ -96,6 +95,7 @@ function get_formatted_filesize($bytes, $add_size_lang = true) * at the beginning of the script in which it's used. * @return bool Either true if the maximum execution time is nearly reached, or false * if some time is still left. +* @todo helper? */ function still_on_time($extra_time = 15) { @@ -126,11 +126,11 @@ function still_on_time($extra_time = 15) return (ceil($current_time - $start_time) < $max_execution_time) ? true : false; } - /** * Add a secret hash for use in links/GET requests * @param string $link_name The name of the link; has to match the name used in check_link_hash, otherwise no restrictions apply * @return string the hash +* @todo add to security, but do not use the current hash mechanism */ /* @todo should use our hashing instead of a "custom" one @@ -151,6 +151,7 @@ function still_on_time($extra_time = 15) * @param string $token the submitted token * @param string $link_name The name of the link * @return boolean true if all is fine +* @todo add to security */ function check_link_hash($token, $link_name) @@ -162,6 +163,7 @@ function still_on_time($extra_time = 15) /** * Pick a language, any language ... +* @todo integrated into form builder? */ function language_select($default = '') { @@ -183,6 +185,7 @@ function language_select($default = '') /** * Pick a template/theme combo, +* @todo integrated into form builder? */ function style_select($default = '', $all = false) { @@ -206,6 +209,7 @@ function style_select($default = '', $all = false) /** * Pick a timezone +* @todo integrated into form builder? */ function tz_select($default = '', $truncate = false) { @@ -231,13 +235,12 @@ function tz_select($default = '', $truncate = false) return $tz_select; } -// Functions handling topic/post tracking/marking - /** * Marks a topic/forum as read * Marks a topic as posted to * * @param int $user_id can only be used with $mode == 'post' +* @todo add to a tracking class used by forum/topic/post API, except for the marking features */ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $user_id = 0) { @@ -495,6 +498,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ /** * Get topic tracking info by using already fetched info +* @todo add to a tracking class used by forum/topic/post API */ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $global_announce_list = false) { @@ -571,6 +575,7 @@ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $ /** * Get topic tracking info from db (for cookie based tracking only this function is used) +* @todo add to a tracking class used by forum/topic/post API */ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_list = false) { @@ -703,6 +708,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis * @param int $mark_time_forum false if the mark time needs to be obtained, else the last users forum mark time * * @return true if complete forum got marked read, else false. +* @todo add to a tracking class used by forum/topic/post API */ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false) { @@ -803,6 +809,7 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti /** * Transform an array into a serialized format +* @todo add to a tracking class used by forum/topic/post API */ function tracking_serialize($input) { @@ -823,6 +830,7 @@ function tracking_serialize($input) /** * Transform a serialized array into an actual array +* @todo add to a tracking class used by forum/topic/post API */ function tracking_unserialize($string, $max_depth = 3) { @@ -927,11 +935,10 @@ function tracking_unserialize($string, $max_depth = 3) /** * Pagination routine, generates page number sequence * tpl_prefix is for using different pagination blocks at one page +* @todo $pagination = phpbb_api::new('pagination') */ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = false, $tpl_prefix = '') { - global $template; - // Make sure $per_page is a valid value $per_page = ($per_page <= 0) ? 1 : $per_page; @@ -1010,11 +1017,10 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add /** * Return current page (pagination) +* @todo $pagination = phpbb_api::new('pagination') */ function on_page($num_items, $per_page, $start) { - global $template; - // Make sure $per_page is a valid value $per_page = ($per_page <= 0) ? 1 : $per_page; @@ -1035,11 +1041,10 @@ function on_page($num_items, $per_page, $start) /** * Add a secret token to the form (requires the S_FORM_TOKEN template variable) * @param string $form_name The name of the form; has to match the name used in check_form_key, otherwise no restrictions apply +* @todo add to form builder */ function add_form_key($form_name) { - global $template; - $now = time(); $token_sid = (phpbb::$user->data['user_id'] == ANONYMOUS && !empty(phpbb::$config['form_token_sid_guests'])) ? phpbb::$user->session_id : ''; $token = sha1($now . phpbb::$user->data['user_form_salt'] . $form_name . $token_sid); @@ -1060,6 +1065,7 @@ function add_form_key($form_name) * @param int $timespan The maximum acceptable age for a submitted form in seconds. Defaults to the config setting. * @param string $return_page The address for the return link * @param bool $trigger If true, the function will triger an error when encountering an invalid form +* @todo add to form builder */ function check_form_key($form_name, $timespan = false, $return_page = '', $trigger = false) { @@ -1112,8 +1118,6 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg */ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '') { - global $template; - if (phpbb_request::is_set_post('cancel')) { return false; @@ -1415,8 +1419,6 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa */ function login_forum_box($forum_data) { - global $template; - $password = request_var('password', '', true); $sql = 'SELECT forum_id @@ -1491,6 +1493,7 @@ function login_forum_box($forum_data) /** * Little helper for the build_hidden_fields function +* @todo helper class or form builder ;) */ function _build_hidden_fields($key, $value, $specialchar, $stripslashes) { @@ -1525,6 +1528,7 @@ function _build_hidden_fields($key, $value, $specialchar, $stripslashes) * @param bool $stripslashes if true, keys and values get stripslashed * * @return string the hidden fields +* @todo helper class or form builder? */ function build_hidden_fields($field_ary, $specialchar = false, $stripslashes = false) { @@ -1591,6 +1595,7 @@ function parse_cfg_file($filename, $lines = false) /** * Add log event +* @todo phpbb::$log */ function add_log() { @@ -1647,6 +1652,7 @@ function add_log() /** * Return a nicely formatted backtrace (parts from the php manual by diz at ysagoon dot com) +* @todo helper? */ function get_backtrace() { @@ -1713,6 +1719,7 @@ function get_backtrace() * This function returns a regular expression pattern for commonly used expressions * Use with / as delimiter for email mode and # for url modes * mode can be: email|bbcode_htm|url|url_inline|www_url|www_url_inline|relative_url|relative_url_inline|ipv4|ipv6 +* @todo helper? */ function get_preg_expression($mode) { @@ -1773,6 +1780,7 @@ function get_preg_expression($mode) * ones as specified in the length paramater. * If length is zero, then an empty string is returned. * If length is greater than 3 the complete IP will be returned +* @todo helper? */ function short_ipv6($ip, $length) { @@ -2367,7 +2375,7 @@ function page_header($page_title = '', $display_online_list = true) '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'] . '/', - 'T_STYLESHEET_LINK' => (!phpbb::$user->theme['theme_storedb']) ? PHPBB_ROOT_PATH . 'styles/' . phpbb::$user->theme['theme_path'] . '/theme/stylesheet.css' : phpbb::$url->get(PHPBB_ROOT_PATH . 'style.' . PHP_EXT . '?id=' . phpbb::$user->theme['style_id'] . '&lang=' . phpbb::$user->data['user_lang']), //PHPBB_ROOT_PATH . "store/{$user->theme['theme_id']}_{$user->theme['imageset_id']}_{$user->lang_name}.css" + 'T_STYLESHEET_LINK' => (!phpbb::$user->theme['theme_storedb']) ? PHPBB_ROOT_PATH . 'styles/' . phpbb::$user->theme['theme_path'] . '/theme/stylesheet.css' : phpbb::$url->get(PHPBB_ROOT_PATH . 'style.' . PHP_EXT . '?id=' . phpbb::$user->theme['style_id'] . '&lang=' . phpbb::$user->data['user_lang']), //PHPBB_ROOT_PATH . "store/{phpbb::$user->theme['theme_id']}_{phpbb::$user->theme['imageset_id']}_{phpbb::$user->lang_name}.css" 'T_STYLESHEET_NAME' => phpbb::$user->theme['theme_name'], 'SITE_LOGO_IMG' => phpbb::$user->img('site_logo'), diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 79664fe6d1..b648f76cf3 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -20,8 +20,6 @@ if (!defined('IN_PHPBB')) * Recalculate Binary Tree function recalc_btree($sql_id, $sql_table, $module_class = '') { - global $db; - if (!$sql_id || !$sql_table) { return; @@ -112,8 +110,6 @@ function recalc_btree($sql_id, $sql_table, $module_class = '') */ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false, $return_array = false) { - global $db, $user, $auth; - $acl = ($ignore_acl) ? '' : (($only_acl_post) ? 'f_post' : array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel')); // This query is identical to the jumpbox one @@ -194,9 +190,7 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = */ function size_select_options($size_compare) { - global $user; - - $size_types_text = array($user->lang['BYTES'], $user->lang['KIB'], $user->lang['MIB']); + $size_types_text = array(phpbb::$user->lang['BYTES'], phpbb::$user->lang['KIB'], phpbb::$user->lang['MIB']); $size_types = array('b', 'kb', 'mb'); $s_size_options = ''; @@ -221,8 +215,6 @@ function size_select_options($size_compare) */ function group_select_options($group_id, $exclude_ids = false, $manage_founder = false) { - 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 = (!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 : ''; @@ -239,7 +231,7 @@ function group_select_options($group_id, $exclude_ids = false, $manage_founder = while ($row = $db->sql_fetchrow($result)) { $selected = ($row['group_id'] == $group_id) ? ' selected="selected"' : ''; - $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } $db->sql_freeresult($result); @@ -251,7 +243,6 @@ function group_select_options($group_id, $exclude_ids = false, $manage_founder = */ function get_forum_list($acl_list = 'f_list', $id_only = true, $postable_only = false, $no_cache = false) { - global $db, $auth; static $forum_rows; if (!isset($forum_rows)) @@ -314,8 +305,6 @@ function get_forum_list($acl_list = 'f_list', $id_only = true, $postable_only = */ function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $include_forum = true) { - global $db; - switch ($type) { case 'parents': @@ -407,8 +396,6 @@ function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png') */ function move_topics($topic_ids, $forum_id, $auto_sync = true) { - global $db; - if (empty($topic_ids)) { return; @@ -462,8 +449,6 @@ function move_topics($topic_ids, $forum_id, $auto_sync = true) */ function move_posts($post_ids, $topic_id, $auto_sync = true) { - global $db; - if (!is_array($post_ids)) { $post_ids = array($post_ids); @@ -525,8 +510,6 @@ 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; - $approved_topics = 0; $forum_ids = $topic_ids = array(); @@ -630,8 +613,6 @@ 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; - if ($where_type === 'range') { $where_clause = $where_ids; @@ -797,8 +778,6 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = */ function delete_attachments($mode, $ids, $resync = true) { - global $db; - if (is_array($ids) && sizeof($ids)) { $ids = array_unique($ids); @@ -1014,8 +993,6 @@ function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = true) */ function update_posted_info(&$topic_ids) { - global $db; - if (empty($topic_ids) || !phpbb::$config['load_db_track']) { return; @@ -1065,8 +1042,6 @@ function update_posted_info(&$topic_ids) */ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) { - 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 FROM ' . ATTACHMENTS_TABLE . " @@ -1108,8 +1083,6 @@ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) */ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sync_extra = false) { - global $db; - if (is_array($where_ids)) { $where_ids = array_unique($where_ids); @@ -1975,8 +1948,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, */ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true) { - global $db; - if (!is_array($forum_id)) { $forum_id = array($forum_id); @@ -2050,8 +2021,6 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync */ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_freq) { - global $db; - $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; @@ -2118,8 +2087,6 @@ function remove_comments(&$output) */ function cache_moderators() { - global $db, $auth; - // Remove cached sql results phpbb::$acm->destroy_sql(MODERATOR_CACHE_TABLE); @@ -2516,8 +2483,6 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id */ function update_foes($group_id = false, $user_id = false) { - global $db, $auth; - // update foes for some user if (is_array($user_id) && sizeof($user_id)) { @@ -2680,8 +2645,6 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li */ function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_warnings DESC') { - global $db; - $sql = 'SELECT user_id, username, user_colour, user_warnings, user_last_warning FROM ' . USERS_TABLE . ' WHERE user_warnings > 0 @@ -2835,8 +2798,6 @@ function get_database_size() */ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 10) { - global $user; - if ($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) { @fputs($fsock, "GET $directory/$filename HTTP/1.1\r\n"); @@ -2861,7 +2822,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port } else if (stripos($line, '404 not found') !== false) { - $errstr = $user->lang['FILE_NOT_FOUND'] . ': ' . $filename; + $errstr = phpbb::$user->lang['FILE_NOT_FOUND'] . ': ' . $filename; return false; } } @@ -2877,7 +2838,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port } else { - $errstr = $user->lang['FSOCK_DISABLED']; + $errstr = phpbb::$user->lang['FSOCK_DISABLED']; return false; } } @@ -2894,8 +2855,6 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port */ function tidy_warnings() { - global $db; - $expire_date = time() - (phpbb::$config['warnings_expire_days'] * 86400); $warning_list = $user_list = array(); @@ -2936,8 +2895,6 @@ function tidy_warnings() */ function tidy_database() { - global $db; - // Here we check permission consistency // Sometimes, it can happen permission tables having forums listed which do not exist @@ -2969,17 +2926,15 @@ function tidy_database() */ function add_permission_language() { - global $user; - // First of all, our own file. We need to include it as the first file because it presets all relevant variables. - $user->add_lang('acp/permissions_phpbb'); + phpbb::$user->add_lang('acp/permissions_phpbb'); $files_to_add = array(); // Now search in acp and mods folder for permissions_ files. foreach (array('acp/', 'mods/') as $path) { - $dh = @opendir($user->lang_path . $user->lang_name . '/' . $path); + $dh = @opendir(phpbb::$user->lang_path . phpbb::$user->lang_name . '/' . $path); if ($dh) { @@ -2999,7 +2954,7 @@ function add_permission_language() return false; } - $user->add_lang($files_to_add); + phpbb::$user->add_lang($files_to_add); return true; } diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 56f91eff3b..59334545f7 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -40,6 +40,7 @@ if (!defined('IN_PHPBB')) /** * Generate sort selection fields +* @todo phpbb_api::new('sort') */ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, &$sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir, &$u_sort_param, $def_st = false, $def_sk = false, $def_sd = false) { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index ceb0d1a99a..c002ac2392 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -489,8 +489,6 @@ function generate_forum_rules(&$forum_data) return; } - global $template; - if ($forum_data['forum_rules']) { $forum_data['forum_rules'] = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']); @@ -509,8 +507,6 @@ function generate_forum_rules(&$forum_data) */ function generate_forum_nav(&$forum_data) { - global $db, $user, $template, $auth; - if (!$auth->acl_get('f_list', $forum_data['forum_id'])) { return; @@ -566,8 +562,6 @@ function generate_forum_nav(&$forum_data) */ function get_forum_parents(&$forum_data) { - global $db; - $forum_parents = array(); if ($forum_data['parent_id'] > 0) @@ -608,8 +602,6 @@ function get_forum_parents(&$forum_data) */ function topic_generate_pagination($replies, $url) { - global $user; - // Make sure $per_page is a valid value $per_page = (phpbb::$config['posts_per_page'] <= 0) ? 1 : phpbb::$config['posts_per_page']; @@ -632,7 +624,7 @@ function topic_generate_pagination($replies, $url) } else if ($times < $total_pages) { - $pagination .= '<span class="page-sep">' . $user->lang['COMMA_SEPARATOR'] . '</span>'; + $pagination .= '<span class="page-sep">' . phpbb::$user->lang['COMMA_SEPARATOR'] . '</span>'; } $times++; } @@ -733,20 +725,18 @@ function get_moderators(&$forum_moderators, $forum_id = false) */ function gen_forum_auth_level($mode, $forum_id, $forum_status) { - global $template, $auth, $user; - $locked = ($forum_status == ITEM_LOCKED && !$auth->acl_get('m_edit', $forum_id)) ? true : false; $rules = array( - ($auth->acl_get('f_post', $forum_id) && !$locked) ? $user->lang['RULES_POST_CAN'] : $user->lang['RULES_POST_CANNOT'], - ($auth->acl_get('f_reply', $forum_id) && !$locked) ? $user->lang['RULES_REPLY_CAN'] : $user->lang['RULES_REPLY_CANNOT'], - ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id) && !$locked) ? $user->lang['RULES_EDIT_CAN'] : $user->lang['RULES_EDIT_CANNOT'], - ($user->data['is_registered'] && $auth->acl_gets('f_delete', 'm_delete', $forum_id) && !$locked) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'], + ($auth->acl_get('f_post', $forum_id) && !$locked) ? phpbb::$user->lang['RULES_POST_CAN'] : phpbb::$user->lang['RULES_POST_CANNOT'], + ($auth->acl_get('f_reply', $forum_id) && !$locked) ? phpbb::$user->lang['RULES_REPLY_CAN'] : phpbb::$user->lang['RULES_REPLY_CANNOT'], + (phpbb::$user->is_registered && $auth->acl_gets('f_edit', 'm_edit', $forum_id) && !$locked) ? phpbb::$user->lang['RULES_EDIT_CAN'] : phpbb::$user->lang['RULES_EDIT_CANNOT'], + (phpbb::$user->is_registered && $auth->acl_gets('f_delete', 'm_delete', $forum_id) && !$locked) ? phpbb::$user->lang['RULES_DELETE_CAN'] : phpbb::$user->lang['RULES_DELETE_CANNOT'], ); 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']; + $rules[] = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && !$locked) ? phpbb::$user->lang['RULES_ATTACH_CAN'] : phpbb::$user->lang['RULES_ATTACH_CANNOT']; } foreach ($rules as $rule) @@ -762,13 +752,11 @@ 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; - $folder = $folder_new = ''; if ($topic_row['topic_status'] == ITEM_MOVED) { - $topic_type = $user->lang['VIEW_TOPIC_MOVED']; + $topic_type = phpbb::$user->lang['VIEW_TOPIC_MOVED']; $folder_img = 'topic_moved'; $folder_alt = 'TOPIC_MOVED'; } @@ -777,19 +765,19 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold switch ($topic_row['topic_type']) { case POST_GLOBAL: - $topic_type = $user->lang['VIEW_TOPIC_GLOBAL']; + $topic_type = phpbb::$user->lang['VIEW_TOPIC_GLOBAL']; $folder = 'global_read'; $folder_new = 'global_unread'; break; case POST_ANNOUNCE: - $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT']; + $topic_type = phpbb::$user->lang['VIEW_TOPIC_ANNOUNCEMENT']; $folder = 'announce_read'; $folder_new = 'announce_unread'; break; case POST_STICKY: - $topic_type = $user->lang['VIEW_TOPIC_STICKY']; + $topic_type = phpbb::$user->lang['VIEW_TOPIC_STICKY']; $folder = 'sticky_read'; $folder_new = 'sticky_unread'; break; @@ -810,7 +798,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold if ($topic_row['topic_status'] == ITEM_LOCKED) { - $topic_type = $user->lang['VIEW_TOPIC_LOCKED']; + $topic_type = phpbb::$user->lang['VIEW_TOPIC_LOCKED']; $folder .= '_locked'; $folder_new .= '_locked'; } @@ -828,7 +816,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold if ($topic_row['poll_start'] && $topic_row['topic_status'] != ITEM_MOVED) { - $topic_type = $user->lang['VIEW_TOPIC_POLL']; + $topic_type = phpbb::$user->lang['VIEW_TOPIC_POLL']; } } @@ -838,8 +826,6 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold */ function display_custom_bbcodes() { - global $db, $template; - // Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing) $num_predefined_bbcodes = 22; @@ -870,8 +856,6 @@ function display_custom_bbcodes() */ function display_reasons($reason_id = 0) { - global $db, $user, $template; - $sql = 'SELECT * FROM ' . REPORTS_REASONS_TABLE . ' ORDER BY reason_order ASC'; @@ -880,10 +864,10 @@ function display_reasons($reason_id = 0) while ($row = $db->sql_fetchrow($result)) { // If the reason is defined within the language file, we will use the localized version, else just use the database entry... - if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) + if (isset(phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) { - $row['reason_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; - $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; + $row['reason_description'] = phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; + $row['reason_title'] = phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; } $template->assign_block_vars('reason', array( @@ -901,8 +885,6 @@ function display_reasons($reason_id = 0) */ function display_user_activity(&$userdata) { - global $auth, $template, $db, $user; - // Do not display user activity for users having more than 5000 posts... if ($userdata['user_posts'] > 5000) { @@ -990,14 +972,14 @@ function display_user_activity(&$userdata) $active_t_pct = ($userdata['user_posts']) ? ($active_t_count / $userdata['user_posts']) * 100 : 0; } - $l_active_pct = ($userdata['user_id'] != ANONYMOUS && $userdata['user_id'] == $user->data['user_id']) ? $user->lang['POST_PCT_ACTIVE_OWN'] : $user->lang['POST_PCT_ACTIVE']; + $l_active_pct = ($userdata['user_id'] != ANONYMOUS && $userdata['user_id'] == phpbb::$user->data['user_id']) ? phpbb::$user->lang['POST_PCT_ACTIVE_OWN'] : phpbb::$user->lang['POST_PCT_ACTIVE']; $template->assign_vars(array( 'ACTIVE_FORUM' => $active_f_name, - 'ACTIVE_FORUM_POSTS' => ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count), + 'ACTIVE_FORUM_POSTS' => ($active_f_count == 1) ? sprintf(phpbb::$user->lang['USER_POST'], 1) : sprintf(phpbb::$user->lang['USER_POSTS'], $active_f_count), 'ACTIVE_FORUM_PCT' => sprintf($l_active_pct, $active_f_pct), 'ACTIVE_TOPIC' => censor_text($active_t_name), - 'ACTIVE_TOPIC_POSTS' => ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), + 'ACTIVE_TOPIC_POSTS' => ($active_t_count == 1) ? sprintf(phpbb::$user->lang['USER_POST'], 1) : sprintf(phpbb::$user->lang['USER_POSTS'], $active_t_count), 'ACTIVE_TOPIC_PCT' => sprintf($l_active_pct, $active_t_pct), 'U_ACTIVE_FORUM' => phpbb::$url->append_sid('viewforum', 'f=' . $active_f_id), 'U_ACTIVE_TOPIC' => phpbb::$url->append_sid('viewtopic', 't=' . $active_t_id), @@ -1010,12 +992,12 @@ function display_user_activity(&$userdata) */ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0) { - global $template, $db, $user, $start; + global $start; $table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE; $where_sql = ($mode == 'forum') ? 'forum_id' : 'topic_id'; $match_id = ($mode == 'forum') ? $forum_id : $topic_id; - $u_url = "uid={$user->data['user_id']}"; + $u_url = 'uid=' . phpbb::$user->data['user_id']; $u_url .= ($mode == 'forum') ? '&f' : '&f=' . $forum_id . '&t'; // Is user watching this thread? @@ -1044,7 +1026,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($uid != $user_id) { $redirect_url = phpbb::$url->append_sid("view$mode", "$u_url=$match_id&start=$start"); - $message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); } if (phpbb_request::variable('unwatch', '', false, phpbb_request::GET) == $mode) @@ -1061,7 +1043,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, meta_refresh(3, $redirect_url); - $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); } else @@ -1092,11 +1074,11 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status) VALUES ($user_id, $match_id, 0)"; $db->sql_query($sql); - $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); } else { - $message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); } meta_refresh(3, $redirect_url); @@ -1125,7 +1107,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($can_watch) { $s_watching['link'] = phpbb::$url->append_sid("view$mode", "$u_url=$match_id&" . (($is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start&hash=" . generate_link_hash("{$mode}_$match_id")); - $s_watching['title'] = $user->lang[(($is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; + $s_watching['title'] = phpbb::$user->lang[(($is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; $s_watching['is_watching'] = $is_watching; } @@ -1189,8 +1171,6 @@ 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; - if (empty($avatar) || !$avatar_type) { return ''; @@ -1210,7 +1190,7 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ } $avatar_img .= $avatar; - return '<img src="' . (str_replace(' ', '%20', $avatar_img)) . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />'; + return '<img src="' . (str_replace(' ', '%20', $avatar_img)) . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty(phpbb::$user->lang[$alt])) ? phpbb::$user->lang[$alt] : $alt) . '" />'; } ?>
\ No newline at end of file diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index dd89fa260e..24b291cc7e 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -194,8 +194,6 @@ class messenger */ function send($method = NOTIFY_EMAIL, $break = false) { - 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(phpbb::$config['board_email_sig'])) : $this->vars['EMAIL_SIG']; @@ -213,12 +211,12 @@ class messenger $match = array(); if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match)) { - $this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']); + $this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : phpbb::$user->lang['NO_EMAIL_SUBJECT']); $drop_header .= '[\r\n]*?' . preg_quote($match[1], '#'); } else { - $this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']); + $this->subject = (($this->subject != '') ? $this->subject : phpbb::$user->lang['NO_EMAIL_SUBJECT']); } if ($drop_header) @@ -256,12 +254,10 @@ class messenger */ public static function error($type, $msg) { - global $user; - // Session doesn't exist, create it - if (!isset($user->session_id) || $user->session_id === '') + if (!isset(phpbb::$user->session_id) || phpbb::$user->session_id === '') { - $user->session_begin(); + phpbb::$user->session_begin(); } $calling_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']; @@ -344,8 +340,6 @@ class messenger */ private function msg_email() { - global $user; - if (empty(phpbb::$config['email_enable'])) { return false; @@ -432,8 +426,6 @@ class messenger */ private function msg_jabber() { - global $db, $user; - if (empty(phpbb::$config['jab_enable']) || empty(phpbb::$config['jab_host']) || empty(phpbb::$config['jab_username']) || empty(phpbb::$config['jab_password'])) { return false; @@ -469,13 +461,13 @@ class messenger if (!$this->jabber->connect()) { - self::error('JABBER', $user->lang['ERR_JAB_CONNECT'] . '<br />' . $this->jabber->get_log()); + self::error('JABBER', phpbb::$user->lang['ERR_JAB_CONNECT'] . '<br />' . $this->jabber->get_log()); return false; } if (!$this->jabber->login()) { - self::error('JABBER', $user->lang['ERR_JAB_AUTH'] . '<br />' . $this->jabber->get_log()); + self::error('JABBER', phpbb::$user->lang['ERR_JAB_AUTH'] . '<br />' . $this->jabber->get_log()); return false; } @@ -543,8 +535,6 @@ class queue */ public function process() { - global $db, $user; - set_config('last_queue_run', time(), true); // Delete stale lock file @@ -606,13 +596,13 @@ class queue if (!$this->jabber->connect()) { - messenger::error('JABBER', $user->lang['ERR_JAB_CONNECT']); + messenger::error('JABBER', phpbb::$user->lang['ERR_JAB_CONNECT']); continue 2; } if (!$this->jabber->login()) { - messenger::error('JABBER', $user->lang['ERR_JAB_AUTH']); + messenger::error('JABBER', phpbb::$user->lang['ERR_JAB_AUTH']); continue 2; } @@ -747,8 +737,6 @@ class queue */ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '') { - global $user; - // Fix any bare linefeeds in the message to make it RFC821 Compliant. $message = preg_replace("#(?<!\r)\n#si", "\r\n", $message); @@ -783,13 +771,13 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '') if (trim($subject) == '') { - $err_msg = (isset($user->lang['NO_EMAIL_SUBJECT'])) ? $user->lang['NO_EMAIL_SUBJECT'] : 'No email subject specified'; + $err_msg = (isset(phpbb::$user->lang['NO_EMAIL_SUBJECT'])) ? phpbb::$user->lang['NO_EMAIL_SUBJECT'] : 'No email subject specified'; return false; } if (trim($message) == '') { - $err_msg = (isset($user->lang['NO_EMAIL_MESSAGE'])) ? $user->lang['NO_EMAIL_MESSAGE'] : 'Email message was blank'; + $err_msg = (isset(phpbb::$user->lang['NO_EMAIL_MESSAGE'])) ? phpbb::$user->lang['NO_EMAIL_MESSAGE'] : 'Email message was blank'; return false; } @@ -841,7 +829,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '') $errstr = utf8_convert_message($errstr); } - $err_msg = (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + $err_msg = (isset(phpbb::$user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf(phpbb::$user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; $err_msg .= ($error_contents) ? '<br /><br />' . htmlspecialchars($error_contents) : ''; return false; } @@ -903,9 +891,9 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '') // We try to send messages even if a few people do not seem to have valid email addresses, but if no one has, we have to exit here. if (!$rcpt) { - $user->session_begin(); + phpbb::$user->session_begin(); $err_msg .= '<br /><br />'; - $err_msg .= (isset($user->lang['INVALID_EMAIL_LOG'])) ? sprintf($user->lang['INVALID_EMAIL_LOG'], htmlspecialchars($mail_to_address)) : '<strong>' . htmlspecialchars($mail_to_address) . '</strong> possibly an invalid email address?'; + $err_msg .= (isset(phpbb::$user->lang['INVALID_EMAIL_LOG'])) ? sprintf(phpbb::$user->lang['INVALID_EMAIL_LOG'], htmlspecialchars($mail_to_address)) : '<strong>' . htmlspecialchars($mail_to_address) . '</strong> possibly an invalid email address?'; $smtp->close_session($err_msg); return false; } @@ -1006,8 +994,6 @@ class smtp_class */ public function server_parse($response, $line) { - global $user; - $this->server_response = ''; $this->responses = array(); $this->numeric_response_code = 0; @@ -1016,7 +1002,7 @@ class smtp_class { if (!($this->server_response = fgets($this->socket, 256))) { - return (isset($user->lang['NO_EMAIL_RESPONSE_CODE'])) ? $user->lang['NO_EMAIL_RESPONSE_CODE'] : 'Could not get mail server response codes'; + return (isset(phpbb::$user->lang['NO_EMAIL_RESPONSE_CODE'])) ? phpbb::$user->lang['NO_EMAIL_RESPONSE_CODE'] : 'Could not get mail server response codes'; } $this->responses[] = substr(rtrim($this->server_response), 4); $this->numeric_response_code = (int) substr($this->server_response, 0, 3); @@ -1027,7 +1013,7 @@ class smtp_class if (!(substr($this->server_response, 0, 3) == $response)) { $this->numeric_response_code = (int) substr($this->server_response, 0, 3); - return (isset($user->lang['EMAIL_SMTP_ERROR_RESPONSE'])) ? sprintf($user->lang['EMAIL_SMTP_ERROR_RESPONSE'], $line, $this->server_response) : "Ran into problems sending Mail at <strong>Line $line</strong>. Response: $this->server_response"; + return (isset(phpbb::$user->lang['EMAIL_SMTP_ERROR_RESPONSE'])) ? sprintf(phpbb::$user->lang['EMAIL_SMTP_ERROR_RESPONSE'], $line, $this->server_response) : "Ran into problems sending Mail at <strong>Line $line</strong>. Response: $this->server_response"; } return 0; @@ -1052,10 +1038,8 @@ class smtp_class */ public function log_into_server($hostname, $username, $password, $default_auth_method) { - global $user; - $err_msg = ''; - $local_host = (function_exists('php_uname')) ? php_uname('n') : $user->host; + $local_host = (function_exists('php_uname')) ? php_uname('n') : phpbb::$user->system['host']; // If we are authenticating through pop-before-smtp, we // have to login ones before we get authenticated @@ -1083,7 +1067,7 @@ class smtp_class $errstr = utf8_convert_message($errstr); } - $err_msg = (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + $err_msg = (isset(phpbb::$user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf(phpbb::$user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; return $err_msg; } @@ -1129,7 +1113,7 @@ class smtp_class if (!isset($this->commands['AUTH'])) { - return (isset($user->lang['SMTP_NO_AUTH_SUPPORT'])) ? $user->lang['SMTP_NO_AUTH_SUPPORT'] : 'SMTP server does not support authentication'; + return (isset(phpbb::$user->lang['SMTP_NO_AUTH_SUPPORT'])) ? phpbb::$user->lang['SMTP_NO_AUTH_SUPPORT'] : 'SMTP server does not support authentication'; } // Get best authentication method @@ -1157,7 +1141,7 @@ class smtp_class if (!$method) { - return (isset($user->lang['NO_SUPPORTED_AUTH_METHODS'])) ? $user->lang['NO_SUPPORTED_AUTH_METHODS'] : 'No supported authentication methods'; + return (isset(phpbb::$user->lang['NO_SUPPORTED_AUTH_METHODS'])) ? phpbb::$user->lang['NO_SUPPORTED_AUTH_METHODS'] : 'No supported authentication methods'; } $method = strtolower(str_replace('-', '_', $method)); @@ -1169,8 +1153,6 @@ class smtp_class */ private function pop_before_smtp($hostname, $username, $password) { - global $user; - if (!$this->socket = @fsockopen($hostname, 110, $errno, $errstr, 10)) { if ($errstr) @@ -1178,7 +1160,7 @@ class smtp_class $errstr = utf8_convert_message($errstr); } - return (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + return (isset(phpbb::$user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf(phpbb::$user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; } $this->server_send("USER $username", true); @@ -1278,8 +1260,6 @@ class smtp_class */ private function digest_md5($username, $password) { - global $user; - $this->server_send('AUTH DIGEST-MD5'); if ($err_msg = $this->server_parse('334', __LINE__)) { @@ -1328,7 +1308,7 @@ class smtp_class // Realm if (empty($tokens['realm'])) { - $tokens['realm'] = (function_exists('php_uname')) ? php_uname('n') : $user->host; + $tokens['realm'] = (function_exists('php_uname')) ? php_uname('n') : phpbb::$user->system['host']; } // Maxbuf @@ -1363,7 +1343,7 @@ class smtp_class } else { - return (isset($user->lang['INVALID_DIGEST_CHALLENGE'])) ? $user->lang['INVALID_DIGEST_CHALLENGE'] : 'Invalid digest challenge'; + return (isset(phpbb::$user->lang['INVALID_DIGEST_CHALLENGE'])) ? phpbb::$user->lang['INVALID_DIGEST_CHALLENGE'] : 'Invalid digest challenge'; } $base64_method_digest_md5 = base64_encode($input_string); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 5df9f6ff21..76836c8616 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -21,8 +21,6 @@ if (!defined('IN_PHPBB')) */ function generate_smilies($mode, $forum_id) { - global $auth, $db, $user, $template; - if ($mode == 'window') { if ($forum_id) @@ -34,14 +32,14 @@ function generate_smilies($mode, $forum_id) $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - $user->setup('posting', (int) $row['forum_style']); + phpbb::$user->setup('posting', (int) $row['forum_style']); } else { - $user->setup('posting'); + phpbb::$user->setup('posting'); } - page_header($user->lang['SMILIES']); + page_header(phpbb::$user->lang['SMILIES']); $template->set_filenames(array( 'body' => 'posting_smilies.html') @@ -120,8 +118,6 @@ function generate_smilies($mode, $forum_id) */ function update_post_information($type, $ids, $return_update_sql = false) { - global $db; - if (empty($ids)) { return; @@ -245,8 +241,6 @@ function update_post_information($type, $ids, $return_update_sql = false) */ function posting_gen_topic_icons($mode, $icon_id) { - global $template; - // Grab icons $icons = phpbb_cache::obtain_icons(); @@ -284,7 +278,7 @@ function posting_gen_topic_icons($mode, $icon_id) */ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) { - global $auth, $user, $template, $topic_type; + global $topic_type; $toggle = false; @@ -308,7 +302,7 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) $topic_type_array[] = array( 'VALUE' => $topic_value['const'], 'S_CHECKED' => ($cur_topic_type == $topic_value['const'] || ($forum_id == 0 && $topic_value['const'] == POST_GLOBAL)) ? ' checked="checked"' : '', - 'L_TOPIC_TYPE' => $user->lang[$topic_value['lang']] + 'L_TOPIC_TYPE' => phpbb::$user->lang[$topic_value['lang']] ); } } @@ -318,7 +312,7 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) $topic_type_array = array_merge(array(0 => array( 'VALUE' => POST_NORMAL, 'S_CHECKED' => ($topic_type == POST_NORMAL) ? ' checked="checked"' : '', - 'L_TOPIC_TYPE' => $user->lang['POST_NORMAL'])), + 'L_TOPIC_TYPE' => phpbb::$user->lang['POST_NORMAL'])), $topic_type_array ); @@ -347,8 +341,6 @@ 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, $db; - $filedata = array( 'error' => array() ); @@ -372,7 +364,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage if (!$filedata['post_attach']) { - $filedata['error'][] = $user->lang['NO_UPLOAD_FORM_FOUND']; + $filedata['error'][] = phpbb::$user->lang['NO_UPLOAD_FORM_FOUND']; return $filedata; } @@ -396,7 +388,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage // If this error occurs a user tried to exploit an IE Bug by renaming extensions // Since the image category is displaying content inline we need to catch this. - trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']); + trigger_error(phpbb::$user->lang['ATTACHED_IMAGE_NOT_IMAGE']); } // Do we have to create a thumbnail? @@ -423,7 +415,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage $file->upload->set_max_filesize($allowed_filesize); } - $file->clean_filename('unique', $user->data['user_id'] . '_'); + $file->clean_filename('unique', phpbb::$user->data['user_id'] . '_'); // 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; @@ -451,7 +443,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage { if (phpbb::$config['upload_dir_size'] + $file->get('filesize') > phpbb::$config['attachment_quota']) { - $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED']; + $filedata['error'][] = phpbb::$user->lang['ATTACH_QUOTA_REACHED']; $filedata['post_attach'] = false; $file->remove(); @@ -465,7 +457,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage { if ($free_space <= $file->get('filesize')) { - $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED']; + $filedata['error'][] = phpbb::$user->lang['ATTACH_QUOTA_REACHED']; $filedata['post_attach'] = false; $file->remove(); @@ -737,8 +729,6 @@ function create_thumbnail($source, $destination, $mimetype) */ function posting_gen_inline_attachments(&$attachment_data) { - global $template; - if (sizeof($attachment_data)) { $s_inline_attachment_options = ''; @@ -761,8 +751,6 @@ function posting_gen_inline_attachments(&$attachment_data) */ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true) { - global $template, $user, $auth; - // Some default template variables $template->assign_vars(array( 'S_SHOW_ATTACH_BOX' => $show_attach_box, @@ -786,7 +774,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a $hidden .= '<input type="hidden" name="attachment_data[' . $count . '][' . $key . ']" value="' . $value . '" />'; } - $download_link = append_sid('download/file', 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false); + $download_link = append_sid('download/file', 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? phpbb::$user->session_id : false); $template->assign_block_vars('attach_row', array( 'FILENAME' => basename($attach_row['real_filename']), @@ -814,8 +802,6 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a */ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0) { - global $user, $db, $template, $auth; - $topic_ids = $forum_ids = $draft_rows = array(); // Load those drafts not connected to forums/topics @@ -834,7 +820,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0) $sql = 'SELECT d.*, f.forum_id, f.forum_name FROM ' . DRAFTS_TABLE . ' d LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = d.forum_id) - WHERE d.user_id = ' . $user->data['user_id'] . " + WHERE d.user_id = ' . phpbb::$user->data['user_id'] . " $sql_and ORDER BY d.save_time DESC"; $result = $db->sql_query($sql); @@ -909,7 +895,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0) $template->assign_block_vars('draftrow', array( 'DRAFT_ID' => $draft['draft_id'], - 'DATE' => $user->format_date($draft['save_time']), + 'DATE' => phpbb::$user->format_date($draft['save_time']), 'DRAFT_SUBJECT' => $draft['draft_subject'], 'TITLE' => $title, @@ -928,7 +914,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; + global $bbcode; // Go ahead and pull all data for this topic $sql = 'SELECT p.post_id @@ -1061,13 +1047,13 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, 'POST_SUBJECT' => $post_subject, - 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), - 'POST_DATE' => $user->format_date($row['post_time']), + 'MINI_POST_IMG' => phpbb::$user->img('icon_post_target', 'POST'), + 'POST_DATE' => phpbb::$user->format_date($row['post_time']), 'MESSAGE' => $message, 'DECODED_MESSAGE' => $decoded_message, 'POST_ID' => $row['post_id'], 'U_MINI_POST' => append_sid('viewtopic', 'p=' . $row['post_id']) . '#p' . $row['post_id'], - 'U_MCP_DETAILS' => ($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_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? append_sid('mcp', 'i=main&mode=post_details&f=' . $forum_id . '&p=' . $row['post_id'], true, phpbb::$user->session_id) : '', 'POSTER_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '') ); @@ -1087,7 +1073,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id if ($mode == 'topic_review') { - $template->assign_var('QUOTE_IMG', $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE'])); + $template->assign_var('QUOTE_IMG', phpbb::$user->img('icon_post_quote', 'REPLY_WITH_QUOTE')); } return true; @@ -1098,8 +1084,6 @@ 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, $auth; - $topic_notification = ($mode == 'reply' || $mode == 'quote') ? true : false; $forum_notification = ($mode == 'post') ? true : false; @@ -1123,7 +1107,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id AND ban_exclude <> 1'; $result = $db->sql_query($sql); - $sql_ignore_users = ANONYMOUS . ', ' . $user->data['user_id']; + $sql_ignore_users = ANONYMOUS . ', ' . phpbb::$user->data['user_id']; while ($row = $db->sql_fetchrow($result)) { $sql_ignore_users .= ', ' . (int) $row['ban_userid']; @@ -1325,8 +1309,6 @@ 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; - // Specify our post mode $post_mode = 'delete'; if (($data['topic_first_post_id'] === $data['topic_last_post_id']) && $data['topic_replies_real'] == 0) @@ -1546,8 +1528,6 @@ 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, $template; - // We do not handle erasing posts here if ($mode == 'delete') { @@ -1578,7 +1558,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Collect some basic information about which tables and which rows to update/insert $sql_data = $topic_row = array(); - $poster_id = ($mode == 'edit') ? $data['poster_id'] : (int) $user->data['user_id']; + $poster_id = ($mode == 'edit') ? $data['poster_id'] : (int) phpbb::$user->data['user_id']; // Retrieve some additional information if not present if ($mode == 'edit' && (!isset($data['post_approved']) || !isset($data['topic_approved']) || $data['post_approved'] === false || $data['topic_approved'] === false)) @@ -1599,7 +1579,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 (((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'])) + if (((phpbb::$config['enable_queue_trigger'] && phpbb::$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; } @@ -1614,16 +1594,16 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u case 'reply': $sql_data[POSTS_TABLE]['sql'] = array( 'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'], - 'poster_id' => (int) $user->data['user_id'], + 'poster_id' => (int) phpbb::$user->data['user_id'], 'icon_id' => $data['icon_id'], - 'poster_ip' => $user->ip, + 'poster_ip' => phpbb::$user->ip, 'post_time' => $current_time, 'post_approved' => $post_approval, 'enable_bbcode' => $data['enable_bbcode'], 'enable_smilies' => $data['enable_smilies'], 'enable_magic_url' => $data['enable_urls'], 'enable_sig' => $data['enable_sig'], - 'post_username' => (!$user->data['is_registered']) ? $username : '', + 'post_username' => (!phpbb::$user->is_registered) ? $username : '', 'post_subject' => $subject, 'post_text' => $data['message'], 'post_checksum' => $data['message_md5'], @@ -1669,10 +1649,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // If the person editing this post is different to the one having posted then we will add a log entry stating the edit // Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods - if ($user->data['user_id'] != $poster_id) + if (phpbb::$user->data['user_id'] != $poster_id) { $log_subject = ($subject) ? $subject : $data['topic_title']; - add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']); + add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : phpbb::$user->lang['GUEST']); } if (!isset($sql_data[POSTS_TABLE]['sql'])) @@ -1714,14 +1694,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { case 'post': $sql_data[TOPICS_TABLE]['sql'] = array( - 'topic_poster' => (int) $user->data['user_id'], + 'topic_poster' => (int) phpbb::$user->data['user_id'], 'topic_time' => $current_time, 'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'], 'icon_id' => $data['icon_id'], 'topic_approved' => $post_approval, 'topic_title' => $subject, - 'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), - 'topic_first_poster_colour' => $user->data['user_colour'], + 'topic_first_poster_name' => (!phpbb::$user->is_registered && $username) ? $username : ((!phpbb::$user->is_guest) ? phpbb::$user->data['username'] : ''), + 'topic_first_poster_colour' => phpbb::$user->data['user_colour'], 'topic_type' => $topic_type, 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0, 'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : 0, @@ -1868,9 +1848,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_first_post_id' => $data['post_id'], 'topic_last_post_id' => $data['post_id'], 'topic_last_post_time' => $current_time, - 'topic_last_poster_id' => (int) $user->data['user_id'], - 'topic_last_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), - 'topic_last_poster_colour' => $user->data['user_colour'], + 'topic_last_poster_id' => (int) phpbb::$user->data['user_id'], + 'topic_last_poster_name' => (!phpbb::$user->is_registered && $username) ? $username : ((!phpbb::$user->is_guest) ? phpbb::$user->data['username'] : ''), + 'topic_last_poster_colour' => phpbb::$user->data['user_colour'], 'topic_last_post_subject' => (string) $subject, ); } @@ -2033,7 +2013,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . ' AND is_orphan = 1 - AND poster_id = ' . $user->data['user_id']; + AND poster_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $orphan_rows = array(); @@ -2082,7 +2062,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . ' WHERE attach_id = ' . $attach_row['attach_id'] . ' AND is_orphan = 1 - AND poster_id = ' . $user->data['user_id']; + AND poster_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); } } @@ -2110,9 +2090,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data['post_id']; $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'"; $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . $current_time; - $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $user->data['user_id']; - $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape((!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '')) . "'"; - $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($user->data['user_colour']) . "'"; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) phpbb::$user->data['user_id']; + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape((!phpbb::$user->is_registered && $username) ? $username : ((!phpbb::$user->is_guest) ? phpbb::$user->data['username'] : '')) . "'"; + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape(phpbb::$user->data['user_colour']) . "'"; } else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies'])) { @@ -2268,9 +2248,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($post_mode == 'reply') { $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_id = ' . (int) $data['post_id']; - $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_poster_id = ' . (int) $user->data['user_id']; - $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape((!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '')) . "'"; - $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_colour = '" . (($user->data['user_id'] != ANONYMOUS) ? $db->sql_escape($user->data['user_colour']) : '') . "'"; + $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_poster_id = ' . (int) phpbb::$user->data['user_id']; + $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape((!phpbb::$user->is_registered && $username) ? $username : ((!phpbb::$user->is_guest) ? phpbb::$user->data['username'] : '')) . "'"; + $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_colour = '" . ((!phpbb::$user->is_guest) ? $db->sql_escape(phpbb::$user->data['user_colour']) : '') . "'"; $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'"; $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_time = ' . (int) $current_time; } @@ -2362,7 +2342,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { $sql = 'DELETE FROM ' . DRAFTS_TABLE . " WHERE draft_id = $draft_id - AND user_id = {$user->data['user_id']}"; + AND user_id = " . phpbb::$user->data['user_id']; $db->sql_query($sql); } @@ -2394,18 +2374,18 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // Topic Notification, do not change if moderator is changing other users posts... - if ($user->data['user_id'] == $poster_id) + if (phpbb::$user->data['user_id'] == $poster_id) { if (!$data['notify_set'] && $data['notify']) { $sql = 'INSERT INTO ' . TOPICS_WATCH_TABLE . ' (user_id, topic_id) - VALUES (' . $user->data['user_id'] . ', ' . $data['topic_id'] . ')'; + VALUES (' . phpbb::$user->data['user_id'] . ', ' . $data['topic_id'] . ')'; $db->sql_query($sql); } else if ($data['notify_set'] && !$data['notify']) { $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . ' + WHERE user_id = ' . phpbb::$user->data['user_id'] . ' AND topic_id = ' . $data['topic_id']; $db->sql_query($sql); } @@ -2422,22 +2402,22 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u markread('topic', $data['forum_id'], $data['topic_id'], time()); // - if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && phpbb::$user->is_registered) { $sql = 'SELECT mark_time FROM ' . FORUMS_TRACK_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . ' + WHERE user_id = ' . phpbb::$user->data['user_id'] . ' AND forum_id = ' . $data['forum_id']; $result = $db->sql_query($sql); $f_mark_time = (int) $db->sql_fetchfield('mark_time'); $db->sql_freeresult($result); } - else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || phpbb::$user->is_registered) { $f_mark_time = false; } - if ((phpbb::$config['load_db_lastread'] && $user->data['is_registered']) || phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) + if ((phpbb::$config['load_db_lastread'] && phpbb::$user->is_registered) || phpbb::$config['load_anon_lastread'] || phpbb::$user->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 b13d2eb624..dc5e6f3744 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -115,8 +115,6 @@ $global_rule_conditions = array( */ function get_folder($user_id, $folder_id = false) { - global $db, $user, $template; - $folder = array(); // Get folder information @@ -155,7 +153,7 @@ function get_folder($user_id, $folder_id = false) $num_unread[PRIVMSGS_OUTBOX] = $num_messages[PRIVMSGS_OUTBOX]; $folder[PRIVMSGS_INBOX] = array( - 'folder_name' => $user->lang['PM_INBOX'], + 'folder_name' => phpbb::$user->lang['PM_INBOX'], 'num_messages' => $num_messages[PRIVMSGS_INBOX], 'unread_messages' => $num_unread[PRIVMSGS_INBOX] ); @@ -177,13 +175,13 @@ function get_folder($user_id, $folder_id = false) $db->sql_freeresult($result); $folder[PRIVMSGS_OUTBOX] = array( - 'folder_name' => $user->lang['PM_OUTBOX'], + 'folder_name' => phpbb::$user->lang['PM_OUTBOX'], 'num_messages' => $num_messages[PRIVMSGS_OUTBOX], 'unread_messages' => $num_unread[PRIVMSGS_OUTBOX] ); $folder[PRIVMSGS_SENTBOX] = array( - 'folder_name' => $user->lang['PM_SENTBOX'], + 'folder_name' => phpbb::$user->lang['PM_SENTBOX'], 'num_messages' => $num_messages[PRIVMSGS_SENTBOX], 'unread_messages' => $num_unread[PRIVMSGS_SENTBOX] ); @@ -221,19 +219,17 @@ function get_folder($user_id, $folder_id = false) */ function clean_sentbox($num_sentbox_messages) { - global $db, $user; - // Check Message Limit - if ($user->data['message_limit'] && $num_sentbox_messages > $user->data['message_limit']) + if (phpbb::$user->data['message_limit'] && $num_sentbox_messages > phpbb::$user->data['message_limit']) { // Delete old messages $sql = 'SELECT t.msg_id FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p WHERE t.msg_id = p.msg_id - AND t.user_id = ' . $user->data['user_id'] . ' + AND t.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.folder_id = ' . PRIVMSGS_SENTBOX . ' ORDER BY p.message_time ASC'; - $result = $db->sql_query_limit($sql, ($num_sentbox_messages - $user->data['message_limit'])); + $result = $db->sql_query_limit($sql, ($num_sentbox_messages - phpbb::$user->data['message_limit'])); $delete_ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -241,7 +237,7 @@ function clean_sentbox($num_sentbox_messages) $delete_ids[] = $row['msg_id']; } $db->sql_freeresult($result); - delete_pm($user->data['user_id'], $delete_ids, PRIVMSGS_SENTBOX); + delete_pm(phpbb::$user->data['user_id'], $delete_ids, PRIVMSGS_SENTBOX); } } @@ -250,8 +246,6 @@ function clean_sentbox($num_sentbox_messages) */ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) { - global $user; - if (!isset($rules[$rule_row['rule_check']][$rule_row['rule_connection']])) { return false; @@ -287,8 +281,6 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) break; case ACTION_DELETE_MESSAGE: - global $db, $auth; - // Check for admins/mods - users are not allowed to remove those messages... // We do the check here to make sure the data we use is consistent $sql = 'SELECT user_id, user_type, user_permissions @@ -321,16 +313,14 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) */ function update_pm_counts() { - global $user, $db; - // Update unread count $sql = 'SELECT COUNT(msg_id) as num_messages FROM ' . PRIVMSGS_TO_TABLE . ' WHERE pm_unread = 1 AND folder_id <> ' . PRIVMSGS_OUTBOX . ' - AND user_id = ' . $user->data['user_id']; + AND user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); - $user->data['user_unread_privmsg'] = (int) $db->sql_fetchfield('num_messages'); + phpbb::$user->data['user_unread_privmsg'] = (int) $db->sql_fetchfield('num_messages'); $db->sql_freeresult($result); // Update new pm count @@ -338,24 +328,24 @@ function update_pm_counts() FROM ' . PRIVMSGS_TO_TABLE . ' WHERE pm_new = 1 AND folder_id IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') - AND user_id = ' . $user->data['user_id']; + AND user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); - $user->data['user_new_privmsg'] = (int) $db->sql_fetchfield('num_messages'); + phpbb::$user->data['user_new_privmsg'] = (int) $db->sql_fetchfield('num_messages'); $db->sql_freeresult($result); $db->sql_query('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'user_unread_privmsg' => (int) $user->data['user_unread_privmsg'], - 'user_new_privmsg' => (int) $user->data['user_new_privmsg'], - )) . ' WHERE user_id = ' . $user->data['user_id']); + 'user_unread_privmsg' => (int) phpbb::$user->data['user_unread_privmsg'], + 'user_new_privmsg' => (int) phpbb::$user->data['user_new_privmsg'], + )) . ' WHERE user_id = ' . phpbb::$user->data['user_id']); // Ok, here we need to repair something, other boxes than privmsgs_no_box and privmsgs_hold_box should not carry the pm_new flag. - if (!$user->data['user_new_privmsg']) + if (!phpbb::$user->data['user_new_privmsg']) { $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' SET pm_new = 0 WHERE pm_new = 1 AND folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') - AND user_id = ' . $user->data['user_id']; + AND user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); } } @@ -365,15 +355,13 @@ function update_pm_counts() */ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) { - global $db, $user; - - if (!$user->data['user_new_privmsg']) + if (!phpbb::$user->data['user_new_privmsg']) { return array('not_moved' => 0, 'removed' => 0); } - $user_message_rules = (int) $user->data['user_message_rules']; - $user_id = (int) $user->data['user_id']; + $user_message_rules = (int) phpbb::$user->data['user_message_rules']; + $user_id = (int) phpbb::$user->data['user_id']; $action_ary = $move_into_folder = array(); $num_removed = 0; @@ -444,7 +432,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) 'bcc' => explode(':', $row['bcc_address']), 'friend' => (isset($zebra[$row['author_id']])) ? $zebra[$row['author_id']]['friend'] : 0, 'foe' => (isset($zebra[$row['author_id']])) ? $zebra[$row['author_id']]['foe'] : 0, - 'user_in_group' => array($user->data['group_id']), + 'user_in_group' => array(phpbb::$user->data['group_id']), 'author_in_group' => array()) ); @@ -588,7 +576,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) ? (phpbb::$config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; + $full_folder_action = (phpbb::$user->data['user_full_folder'] == FULL_FOLDER_NONE) ? (phpbb::$config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : phpbb::$user->data['user_full_folder']; $sql_folder = array_keys($move_into_folder); if ($full_folder_action >= 0) @@ -630,12 +618,12 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Check Message Limit - we calculate with the complete array, most of the time it is one message // 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']) + if (phpbb::$user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + sizeof($msg_ary)) > phpbb::$user->data['message_limit']) { - $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']; + $full_folder_action = (phpbb::$user->data['user_full_folder'] == FULL_FOLDER_NONE) ? (phpbb::$config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : phpbb::$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']) + if ($full_folder_action >= 0 && ($folder[$full_folder_action] + sizeof($msg_ary)) > phpbb::$user->data['message_limit']) { $full_folder_action = phpbb::$config['full_folder_action'] - (FULL_FOLDER_NONE*(-1)); } @@ -653,7 +641,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) WHERE user_id = $user_id AND folder_id = $dest_folder ORDER BY msg_id ASC"; - $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + sizeof($msg_ary)) - $user->data['message_limit'])); + $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + sizeof($msg_ary)) - phpbb::$user->data['message_limit'])); $delete_ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -729,8 +717,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) */ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_folder_id) { - global $db, $user; - $num_moved = 0; if (!is_array($move_msg_ids)) @@ -759,8 +745,8 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol if ($message_limit && $row['pm_count'] + sizeof($move_msg_ids) > $message_limit) { - $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $row['folder_name']) . '<br /><br />'; - $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid('ucp', 'i=pm&folder=' . $row['folder_id']) . '">', '</a>', $row['folder_name']); + $message = sprintf(phpbb::$user->lang['NOT_ENOUGH_SPACE_FOLDER'], $row['folder_name']) . '<br /><br />'; + $message .= sprintf(phpbb::$user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid('ucp', 'i=pm&folder=' . $row['folder_id']) . '">', '</a>', $row['folder_name']); trigger_error($message); } } @@ -776,8 +762,8 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol if ($message_limit && $num_messages + sizeof($move_msg_ids) > $message_limit) { - $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $user->lang['PM_INBOX']) . '<br /><br />'; - $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid('ucp', 'i=pm&folder=inbox') . '">', '</a>', $user->lang['PM_INBOX']); + $message = sprintf(phpbb::$user->lang['NOT_ENOUGH_SPACE_FOLDER'], phpbb::$user->lang['PM_INBOX']) . '<br /><br />'; + $message .= sprintf(phpbb::$user->lang['CLICK_RETURN_FOLDER'], '<a href="' . append_sid('ucp', 'i=pm&folder=inbox') . '">', '</a>', phpbb::$user->lang['PM_INBOX']); trigger_error($message); } } @@ -830,8 +816,6 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) return; } - global $db, $user; - $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " SET pm_unread = 0 WHERE msg_id = $msg_id @@ -844,19 +828,19 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) WHERE user_id = $user_id"; $db->sql_query($sql); - if ($user->data['user_id'] == $user_id) + if (phpbb::$user->data['user_id'] == $user_id) { - $user->data['user_unread_privmsg']--; + phpbb::$user->data['user_unread_privmsg']--; // Try to cope with previous wrong conversions... - if ($user->data['user_unread_privmsg'] < 0) + if (phpbb::$user->data['user_unread_privmsg'] < 0) { $sql = 'UPDATE ' . USERS_TABLE . " SET user_unread_privmsg = 0 WHERE user_id = $user_id"; $db->sql_query($sql); - $user->data['user_unread_privmsg'] = 0; + phpbb::$user->data['user_unread_privmsg'] = 0; } } } @@ -866,8 +850,6 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) */ function handle_mark_actions($user_id, $mark_action) { - global $db, $user; - $msg_ids = request_var('marked_msg_id', array(0)); $cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX); $confirm = phpbb_request::is_set_post('confirm'); @@ -900,7 +882,7 @@ function handle_mark_actions($user_id, $mark_action) $redirect = append_sid('ucp', 'i=pm&folder=' . $cur_folder_id); meta_refresh(3, $redirect); - trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $redirect . '">', '</a>')); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FOLDER'], '<a href="' . $redirect . '">', '</a>')); } else { @@ -928,8 +910,6 @@ function handle_mark_actions($user_id, $mark_action) */ function delete_pm($user_id, $msg_ids, $folder_id) { - global $db, $user; - $user_id = (int) $user_id; $folder_id = (int) $folder_id; @@ -1036,8 +1016,8 @@ function delete_pm($user_id, $msg_ids, $folder_id) $db->sql_query('UPDATE ' . USERS_TABLE . " SET $set_sql WHERE user_id = $user_id"); - $user->data['user_new_privmsg'] -= $num_new; - $user->data['user_unread_privmsg'] -= $num_unread; + phpbb::$user->data['user_new_privmsg'] -= $num_new; + phpbb::$user->data['user_unread_privmsg'] -= $num_unread; } // Now we have to check which messages we can delete completely @@ -1079,8 +1059,6 @@ function delete_pm($user_id, $msg_ids, $folder_id) */ function rebuild_header($check_ary) { - global $db; - $address = array(); foreach ($check_ary as $check_type => $address_field) @@ -1115,8 +1093,6 @@ function rebuild_header($check_ary) */ function write_pm_addresses($check_ary, $author_id, $plaintext = false) { - global $db, $user, $template; - $addresses = array(); foreach ($check_ary as $check_type => $address_field) @@ -1149,7 +1125,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) while ($row = $db->sql_fetchrow($result)) { - if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) + if ($check_type == 'to' || $author_id == phpbb::$user->data['user_id'] || $row['user_id'] == phpbb::$user->data['user_id']) { if ($plaintext) { @@ -1175,9 +1151,9 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) while ($row = $db->sql_fetchrow($result)) { - if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) + if ($check_type == 'to' || $author_id == phpbb::$user->data['user_id'] || $row['user_id'] == phpbb::$user->data['user_id']) { - $address[] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $address[] = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']; } } $db->sql_freeresult($result); @@ -1195,9 +1171,9 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) { if (!isset($address['group'][$row['group_id']])) { - if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) + if ($check_type == 'to' || $author_id == phpbb::$user->data['user_id'] || $row['user_id'] == phpbb::$user->data['user_id']) { - $row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']; $address['group'][$row['group_id']] = array('name' => $row['group_name'], 'colour' => $row['group_colour']); } } @@ -1258,8 +1234,6 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) */ function get_folder_status($folder_id, $folder) { - global $db, $user; - if (isset($folder[$folder_id])) { $folder = $folder[$folder_id]; @@ -1272,12 +1246,12 @@ function get_folder_status($folder_id, $folder) $return = array( 'folder_name' => $folder['folder_name'], 'cur' => $folder['num_messages'], - 'remaining' => ($user->data['message_limit']) ? $user->data['message_limit'] - $folder['num_messages'] : 0, - 'max' => $user->data['message_limit'], - 'percent' => ($user->data['message_limit']) ? (($user->data['message_limit'] > 0) ? round(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100) : 0, + 'remaining' => (phpbb::$user->data['message_limit']) ? phpbb::$user->data['message_limit'] - $folder['num_messages'] : 0, + 'max' => phpbb::$user->data['message_limit'], + 'percent' => (phpbb::$user->data['message_limit']) ? ((phpbb::$user->data['message_limit'] > 0) ? round(($folder['num_messages'] / phpbb::$user->data['message_limit']) * 100) : 100) : 0, ); - $return['message'] = sprintf($user->lang['FOLDER_STATUS_MSG'], $return['percent'], $return['cur'], $return['max']); + $return['message'] = sprintf(phpbb::$user->lang['FOLDER_STATUS_MSG'], $return['percent'], $return['cur'], $return['max']); return $return; } @@ -1291,8 +1265,6 @@ function get_folder_status($folder_id, $folder) */ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) { - global $db, $auth, $template, $user; - // We do not handle erasing pms here if ($mode == 'delete') { @@ -1513,7 +1485,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . ' AND in_message = 1 AND is_orphan = 1 - AND poster_id = ' . $user->data['user_id']; + AND poster_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $orphan_rows = array(); @@ -1562,7 +1534,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . ' WHERE attach_id = ' . $attach_row['attach_id'] . ' AND is_orphan = 1 - AND poster_id = ' . $user->data['user_id']; + AND poster_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); } } @@ -1600,11 +1572,9 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) */ function pm_notification($mode, $author, $recipients, $subject, $message) { - global $db, $user, $auth; - $subject = censor_text($subject); - unset($recipients[ANONYMOUS], $recipients[$user->data['user_id']]); + unset($recipients[ANONYMOUS], $recipients[phpbb::$user->data['user_id']]); if (!sizeof($recipients)) { @@ -1687,7 +1657,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, $template, $auth, $bbcode; + global $bbcode; // Get History Messages (could be newer) $sql = 'SELECT t.*, p.*, u.* @@ -1724,11 +1694,11 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode { $folder_id = (int) $row['folder_id']; - $row['folder'][] = (isset($folder[$folder_id])) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER']; + $row['folder'][] = (isset($folder[$folder_id])) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : phpbb::$user->lang['UNKNOWN_FOLDER']; if (isset($rowset[$row['msg_id']])) { - $rowset[$row['msg_id']]['folder'][] = (isset($folder[$folder_id])) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER']; + $rowset[$row['msg_id']]['folder'][] = (isset($folder[$folder_id])) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : phpbb::$user->lang['UNKNOWN_FOLDER']; } else { @@ -1773,7 +1743,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $decoded_message = false; - if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) + if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != phpbb::$user->data['user_id']) { $decoded_message = $message; decode_message($decoded_message, $row['bbcode_uid']); @@ -1806,7 +1776,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode 'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $row['username'], $row['user_colour'], $row['username']), 'SUBJECT' => $subject, - 'SENT_DATE' => $user->format_date($row['message_time']), + 'SENT_DATE' => phpbb::$user->format_date($row['message_time']), 'MESSAGE' => $message, 'FOLDER' => implode(', ', $row['folder']), 'DECODED_MESSAGE' => $decoded_message, @@ -1817,15 +1787,15 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode 'MSG_ID' => $row['msg_id'], 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], - 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', - 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') + 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != phpbb::$user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', + 'U_POST_REPLY_PM' => ($author_id != phpbb::$user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') ); unset($rowset[$id]); $prev_id = $id; } $template->assign_vars(array( - 'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE']), + 'QUOTE_IMG' => phpbb::$user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), 'HISTORY_TITLE' => $title, 'U_VIEW_NEXT_HISTORY' => ($next_history_pm) ? "$url&p=" . $next_history_pm : '', @@ -1841,19 +1811,17 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode */ function set_user_message_limit() { - 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 FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug - WHERE ug.user_id = ' . $user->data['user_id'] . ' + WHERE ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND ug.user_pending = 0 AND ug.group_id = g.group_id'; $result = $db->sql_query($sql); $message_limit = (int) $db->sql_fetchfield('max_message_limit'); $db->sql_freeresult($result); - $user->data['message_limit'] = (!$message_limit) ? phpbb::$config['pm_max_msgs'] : $message_limit; + phpbb::$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 4a7c4fde70..bc12a1b33f 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -33,8 +33,6 @@ class custom_profile */ public function generate_profile_fields($mode, $lang_id) { - global $db, $template, $auth; - $sql_where = ''; switch ($mode) { @@ -202,14 +200,12 @@ class custom_profile */ private function build_cache() { - global $db, $user, $auth; - $this->profile_cache = array(); // Display hidden/no_view fields for admin/moderator $sql = 'SELECT l.*, f.* FROM ' . PROFILE_LANG_TABLE . ' l, ' . PROFILE_FIELDS_TABLE . ' f - WHERE l.lang_id = ' . $user->get_iso_lang_id() . ' + WHERE l.lang_id = ' . phpbb::$user->get_iso_lang_id() . ' AND f.field_active = 1 ' . ((!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) ? ' AND f.field_hide = 0 ' : '') . ' AND f.field_no_view = 0 @@ -229,8 +225,6 @@ class custom_profile */ private function get_option_lang($field_id, $lang_id, $field_type, $preview) { - global $db; - if ($preview) { $lang_options = (!is_array($this->vars['lang_options'])) ? explode("\n", $this->vars['lang_options']) : $this->vars['lang_options']; @@ -266,8 +260,6 @@ class custom_profile */ public function submit_cp_field($mode, $lang_id, &$cp_data, &$cp_error) { - global $auth, $db, $user; - $sql_where = ''; switch ($mode) { @@ -311,32 +303,32 @@ class custom_profile { case 'FIELD_INVALID_DATE': case 'FIELD_REQUIRED': - $error = sprintf($user->lang[$cp_result], $row['lang_name']); + $error = sprintf(phpbb::$user->lang[$cp_result], $row['lang_name']); break; case 'FIELD_TOO_SHORT': case 'FIELD_TOO_SMALL': - $error = sprintf($user->lang[$cp_result], $row['lang_name'], $row['field_minlen']); + $error = sprintf(phpbb::$user->lang[$cp_result], $row['lang_name'], $row['field_minlen']); break; case 'FIELD_TOO_LONG': case 'FIELD_TOO_LARGE': - $error = sprintf($user->lang[$cp_result], $row['lang_name'], $row['field_maxlen']); + $error = sprintf(phpbb::$user->lang[$cp_result], $row['lang_name'], $row['field_maxlen']); break; case 'FIELD_INVALID_CHARS': switch ($row['field_validation']) { case '[0-9]+': - $error = sprintf($user->lang[$cp_result . '_NUMBERS_ONLY'], $row['lang_name']); + $error = sprintf(phpbb::$user->lang[$cp_result . '_NUMBERS_ONLY'], $row['lang_name']); break; case '[\w]+': - $error = sprintf($user->lang[$cp_result . '_ALPHA_ONLY'], $row['lang_name']); + $error = sprintf(phpbb::$user->lang[$cp_result . '_ALPHA_ONLY'], $row['lang_name']); break; case '[\w_\+\. \-\[\]]+': - $error = sprintf($user->lang[$cp_result . '_SPACERS_ONLY'], $row['lang_name']); + $error = sprintf(phpbb::$user->lang[$cp_result . '_SPACERS_ONLY'], $row['lang_name']); break; } break; @@ -358,8 +350,6 @@ class custom_profile */ public function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false) { - global $db; - if ($mode == 'grab') { if (!is_array($user_id)) @@ -489,9 +479,8 @@ class custom_profile } else if ($day && $month && $year) { - global $user; // d/m/y 00:00 GMT isn't necessarily on the same d/m/y in the user's timezone, so add the timezone seconds - return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) + $user->timezone + $user->dst, $user->lang['DATE_FORMAT'], true); + return phpbb::$user->format_date(gmmktime(0, 0, 0, $month, $day, $year) + phpbb::$user->timezone + phpbb::$user->dst, phpbb::$user->lang['DATE_FORMAT'], true); } return $value; @@ -555,14 +544,12 @@ class custom_profile */ private function get_var($field_validation, &$profile_row, $default_value, $preview) { - global $user; - $profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident']; $user_ident = $profile_row['field_ident']; // checkbox - only testing for isset if ($profile_row['field_type'] == FIELD_BOOL && $profile_row['field_length'] == 2) { - $value = (phpbb_request::is_set($profile_row['field_ident'])) ? true : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]); + $value = (phpbb_request::is_set($profile_row['field_ident'])) ? true : ((!isset(phpbb::$user->profile_fields[$user_ident]) || $preview) ? $default_value : phpbb::$user->profile_fields[$user_ident]); } else if ($profile_row['field_type'] == FIELD_INT) { @@ -572,17 +559,17 @@ class custom_profile } else { - if (!$preview && isset($user->profile_fields[$user_ident]) && is_null($user->profile_fields[$user_ident])) + if (!$preview && isset(phpbb::$user->profile_fields[$user_ident]) && is_null(phpbb::$user->profile_fields[$user_ident])) { $value = null; } - else if (!isset($user->profile_fields[$user_ident]) || $preview) + else if (!isset(phpbb::$user->profile_fields[$user_ident]) || $preview) { $value = $default_value; } else { - $value = $user->profile_fields[$user_ident]; + $value = phpbb::$user->profile_fields[$user_ident]; } } @@ -590,7 +577,7 @@ class custom_profile } else { - $value = (phpbb_request::is_set($profile_row['field_ident'])) ? request_var($profile_row['field_ident'], $default_value, true) : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]); + $value = (phpbb_request::is_set($profile_row['field_ident'])) ? request_var($profile_row['field_ident'], $default_value, true) : ((!isset(phpbb::$user->profile_fields[$user_ident]) || $preview) ? $default_value : phpbb::$user->profile_fields[$user_ident]); if (gettype($value) == 'string') { @@ -614,8 +601,6 @@ class custom_profile */ private function generate_int($profile_row, $preview = false) { - global $template; - $profile_row['field_value'] = $this->get_var('int', $profile_row, $profile_row['field_default_value'], $preview); $template->assign_block_vars(self::$profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER)); } @@ -626,8 +611,6 @@ class custom_profile */ private function generate_date($profile_row, $preview = false) { - global $user, $template; - $profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident']; $user_ident = $profile_row['field_ident']; @@ -639,14 +622,14 @@ class custom_profile { $profile_row['field_default_value'] = sprintf('%2d-%2d-%4d', $now['mday'], $now['mon'], $now['year']); } - list($day, $month, $year) = explode('-', ((!isset($user->profile_fields[$user_ident]) || $preview) ? $profile_row['field_default_value'] : $user->profile_fields[$user_ident])); + list($day, $month, $year) = explode('-', ((!isset(phpbb::$user->profile_fields[$user_ident]) || $preview) ? $profile_row['field_default_value'] : phpbb::$user->profile_fields[$user_ident])); } else { if ($preview && $profile_row['field_default_value'] == 'now') { $profile_row['field_default_value'] = sprintf('%2d-%2d-%4d', $now['mday'], $now['mon'], $now['year']); - list($day, $month, $year) = explode('-', ((!isset($user->profile_fields[$user_ident]) || $preview) ? $profile_row['field_default_value'] : $user->profile_fields[$user_ident])); + list($day, $month, $year) = explode('-', ((!isset(phpbb::$user->profile_fields[$user_ident]) || $preview) ? $profile_row['field_default_value'] : phpbb::$user->profile_fields[$user_ident])); } else { @@ -685,8 +668,6 @@ class custom_profile */ private function generate_bool($profile_row, $preview = false) { - global $template; - $value = $this->get_var('int', $profile_row, $profile_row['field_default_value'], $preview); $profile_row['field_value'] = $value; @@ -716,8 +697,6 @@ class custom_profile */ private function generate_string($profile_row, $preview = false) { - global $template; - $profile_row['field_value'] = $this->get_var('string', $profile_row, $profile_row['lang_default_value'], $preview); $template->assign_block_vars(self::$profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER)); } @@ -728,8 +707,6 @@ class custom_profile */ private function generate_text($profile_row, $preview = false) { - global $template, $user; - $field_length = explode('|', $profile_row['field_length']); $profile_row['field_rows'] = $field_length[0]; $profile_row['field_cols'] = $field_length[1]; @@ -744,8 +721,6 @@ class custom_profile */ private function generate_dropdown($profile_row, $preview = false) { - global $user, $template; - $value = $this->get_var('int', $profile_row, $profile_row['field_default_value'], $preview); if (!isset($this->options_lang[$profile_row['field_id']]) || !isset($this->options_lang[$profile_row['field_id']][$profile_row['lang_id']]) || !sizeof($this->options_lang[$profile_row['field_id']][$profile_row['lang_id']])) @@ -773,8 +748,6 @@ class custom_profile */ private function process_field_row($mode, $profile_row) { - global $template; - $preview = ($mode == 'preview') ? true : false; // set template filename @@ -801,8 +774,6 @@ class custom_profile */ public static function build_insert_sql_array($cp_data) { - global $db, $user, $auth; - $sql_not_in = array(); foreach ($cp_data as $key => $null) { @@ -811,7 +782,7 @@ class custom_profile $sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value FROM ' . PROFILE_LANG_TABLE . ' l, ' . PROFILE_FIELDS_TABLE . ' f - WHERE l.lang_id = ' . $user->get_iso_lang_id() . ' + WHERE l.lang_id = ' . phpbb::$user->get_iso_lang_id() . ' ' . ((sizeof($sql_not_in)) ? ' AND ' . $db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . ' AND l.field_id = f.field_id'; $result = $db->sql_query($sql); @@ -916,15 +887,13 @@ class custom_profile_admin extends custom_profile */ public function validate_options() { - global $user; - $validate_ary = array('CHARS_ANY' => '.*', 'NUMBERS_ONLY' => '[0-9]+', 'ALPHA_ONLY' => '[\w]+', 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+'); $validate_options = ''; foreach ($validate_ary as $lang => $value) { $selected = ($this->vars['field_validation'] == $value) ? ' selected="selected"' : ''; - $validate_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; + $validate_options .= '<option value="' . $value . '"' . $selected . '>' . phpbb::$user->lang[$lang] . '</option>'; } return $validate_options; @@ -935,13 +904,11 @@ class custom_profile_admin extends custom_profile */ public function get_string_options() { - global $user; - $options = array( - 0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'), - 1 => array('TITLE' => $user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'), - 2 => array('TITLE' => $user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'), - 3 => array('TITLE' => $user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>') + 0 => array('TITLE' => phpbb::$user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'), + 1 => array('TITLE' => phpbb::$user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'), + 2 => array('TITLE' => phpbb::$user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'), + 3 => array('TITLE' => phpbb::$user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>') ); return $options; @@ -952,13 +919,11 @@ class custom_profile_admin extends custom_profile */ public function get_text_options() { - global $user; - $options = array( - 0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input name="rows" size="5" value="' . $this->vars['rows'] . '" /> ' . $user->lang['ROWS'] . '</dd><dd><input name="columns" size="5" value="' . $this->vars['columns'] . '" /> ' . $user->lang['COLUMNS'] . ' <input type="hidden" name="field_length" value="' . $this->vars['field_length'] . '" />'), - 1 => array('TITLE' => $user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_minlen" size="10" value="' . $this->vars['field_minlen'] . '" />'), - 2 => array('TITLE' => $user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_maxlen" size="10" value="' . $this->vars['field_maxlen'] . '" />'), - 3 => array('TITLE' => $user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>') + 0 => array('TITLE' => phpbb::$user->lang['FIELD_LENGTH'], 'FIELD' => '<input name="rows" size="5" value="' . $this->vars['rows'] . '" /> ' . phpbb::$user->lang['ROWS'] . '</dd><dd><input name="columns" size="5" value="' . $this->vars['columns'] . '" /> ' . phpbb::$user->lang['COLUMNS'] . ' <input type="hidden" name="field_length" value="' . $this->vars['field_length'] . '" />'), + 1 => array('TITLE' => phpbb::$user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_minlen" size="10" value="' . $this->vars['field_minlen'] . '" />'), + 2 => array('TITLE' => phpbb::$user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_maxlen" size="10" value="' . $this->vars['field_maxlen'] . '" />'), + 3 => array('TITLE' => phpbb::$user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>') ); return $options; @@ -969,13 +934,11 @@ class custom_profile_admin extends custom_profile */ public function get_int_options() { - global $user; - $options = array( - 0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'), - 1 => array('TITLE' => $user->lang['MIN_FIELD_NUMBER'], 'FIELD' => '<input type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'), - 2 => array('TITLE' => $user->lang['MAX_FIELD_NUMBER'], 'FIELD' => '<input type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'), - 3 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => '<input type="post" name="field_default_value" value="' . $this->vars['field_default_value'] . '" />') + 0 => array('TITLE' => phpbb::$user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'), + 1 => array('TITLE' => phpbb::$user->lang['MIN_FIELD_NUMBER'], 'FIELD' => '<input type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'), + 2 => array('TITLE' => phpbb::$user->lang['MAX_FIELD_NUMBER'], 'FIELD' => '<input type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'), + 3 => array('TITLE' => phpbb::$user->lang['DEFAULT_VALUE'], 'FIELD' => '<input type="post" name="field_default_value" value="' . $this->vars['field_default_value'] . '" />') ); return $options; @@ -986,7 +949,7 @@ class custom_profile_admin extends custom_profile */ public function get_bool_options() { - global $user, $lang_defs; + global $lang_defs; $default_lang_id = $lang_defs['iso'][phpbb::$config['default_lang']]; @@ -1004,8 +967,8 @@ class custom_profile_admin extends custom_profile ); $options = array( - 0 => array('TITLE' => $user->lang['FIELD_TYPE'], 'EXPLAIN' => $user->lang['BOOL_TYPE_EXPLAIN'], 'FIELD' => '<label><input type="radio" class="radio" name="field_length" value="1"' . (($this->vars['field_length'] == 1) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . $user->lang['RADIO_BUTTONS'] . '</label><label><input type="radio" class="radio" name="field_length" value="2"' . (($this->vars['field_length'] == 2) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . $user->lang['CHECKBOX'] . '</label>'), - 1 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => $this->process_field_row('preview', $profile_row)) + 0 => array('TITLE' => phpbb::$user->lang['FIELD_TYPE'], 'EXPLAIN' => phpbb::$user->lang['BOOL_TYPE_EXPLAIN'], 'FIELD' => '<label><input type="radio" class="radio" name="field_length" value="1"' . (($this->vars['field_length'] == 1) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . phpbb::$user->lang['RADIO_BUTTONS'] . '</label><label><input type="radio" class="radio" name="field_length" value="2"' . (($this->vars['field_length'] == 2) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . phpbb::$user->lang['CHECKBOX'] . '</label>'), + 1 => array('TITLE' => phpbb::$user->lang['DEFAULT_VALUE'], 'FIELD' => $this->process_field_row('preview', $profile_row)) ); return $options; @@ -1016,7 +979,7 @@ class custom_profile_admin extends custom_profile */ public function get_dropdown_options() { - global $user, $lang_defs; + global $lang_defs; $default_lang_id = $lang_defs['iso'][phpbb::$config['default_lang']]; @@ -1038,8 +1001,8 @@ class custom_profile_admin extends custom_profile $profile_row[1]['field_default_value'] = $this->vars['field_novalue']; $options = array( - 0 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => $this->process_field_row('preview', $profile_row[0])), - 1 => array('TITLE' => $user->lang['NO_VALUE_OPTION'], 'EXPLAIN' => $user->lang['NO_VALUE_OPTION_EXPLAIN'], 'FIELD' => $this->process_field_row('preview', $profile_row[1])) + 0 => array('TITLE' => phpbb::$user->lang['DEFAULT_VALUE'], 'FIELD' => $this->process_field_row('preview', $profile_row[0])), + 1 => array('TITLE' => phpbb::$user->lang['NO_VALUE_OPTION'], 'EXPLAIN' => phpbb::$user->lang['NO_VALUE_OPTION_EXPLAIN'], 'FIELD' => $this->process_field_row('preview', $profile_row[1])) ); return $options; @@ -1050,7 +1013,7 @@ class custom_profile_admin extends custom_profile */ public function get_date_options() { - global $user, $lang_defs; + global $lang_defs; $default_lang_id = $lang_defs['iso'][phpbb::$config['default_lang']]; @@ -1076,8 +1039,8 @@ class custom_profile_admin extends custom_profile } $options = array( - 0 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => $this->process_field_row('preview', $profile_row)), - 1 => array('TITLE' => $user->lang['ALWAYS_TODAY'], 'FIELD' => '<label><input type="radio" class="radio" name="always_now" value="1"' . (($s_checked) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . $user->lang['YES'] . '</label><label><input type="radio" class="radio" name="always_now" value="0"' . ((!$s_checked) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . $user->lang['NO'] . '</label>'), + 0 => array('TITLE' => phpbb::$user->lang['DEFAULT_VALUE'], 'FIELD' => $this->process_field_row('preview', $profile_row)), + 1 => array('TITLE' => phpbb::$user->lang['ALWAYS_TODAY'], 'FIELD' => '<label><input type="radio" class="radio" name="always_now" value="1"' . (($s_checked) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . phpbb::$user->lang['YES'] . '</label><label><input type="radio" class="radio" name="always_now" value="0"' . ((!$s_checked) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . phpbb::$user->lang['NO'] . '</label>'), ); return $options; diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index 63f8d72e9f..808f28a147 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -255,7 +255,7 @@ class ftp extends transfer $this->password = $password; $this->timeout = $timeout; - // Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (/ at the end) + // Make sure $this->root_path is layed out the same way as the phpbb::$user->page['root_script_path'] value (/ at the end) $this->root_path = str_replace('\\', '/', $this->root_path); if (!empty($root_path)) @@ -274,13 +274,11 @@ class ftp extends transfer */ private function data() { - global $user; - return array( 'host' => 'localhost', 'username' => 'anonymous', 'password' => '', - 'root_path' => $user->page['root_script_path'], + 'root_path' => phpbb::$user->page['root_script_path'], 'port' => 21, 'timeout' => 10 ); @@ -478,7 +476,7 @@ class ftp_fsock extends transfer $this->password = $password; $this->timeout = $timeout; - // Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (/ at the end) + // Make sure $this->root_path is layed out the same way as the phpbb::$user->page['root_script_path'] value (/ at the end) $this->root_path = str_replace('\\', '/', $this->root_path); if (!empty($root_path)) @@ -497,13 +495,11 @@ class ftp_fsock extends transfer */ private function data() { - global $user; - return array( 'host' => 'localhost', 'username' => 'anonymous', 'password' => '', - 'root_path' => $user->page['root_script_path'], + 'root_path' => phpbb::$user->page['root_script_path'], 'port' => 21, 'timeout' => 10 ); diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 142ec1537a..63c62215d1 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -269,8 +269,6 @@ class filespec */ function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false) { - global $user; - if (sizeof($this->error)) { return false; @@ -312,7 +310,7 @@ class filespec { if (!@move_uploaded_file($this->filename, $this->destination_file)) { - $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); + $this->error[] = sprintf(phpbb::$user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); return false; } } @@ -327,7 +325,7 @@ class filespec { if (!@copy($this->filename, $this->destination_file)) { - $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); + $this->error[] = sprintf(phpbb::$user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); return false; } } @@ -340,7 +338,7 @@ class filespec if (!@copy($this->filename, $this->destination_file)) { - $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); + $this->error[] = sprintf(phpbb::$user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); return false; } @unlink($this->filename); @@ -375,23 +373,23 @@ class filespec { if (!isset($types[$this->image_info[2]])) { - $this->error[] = sprintf($user->lang['IMAGE_FILETYPE_INVALID'], $this->image_info[2], $this->mimetype); + $this->error[] = sprintf(phpbb::$user->lang['IMAGE_FILETYPE_INVALID'], $this->image_info[2], $this->mimetype); } else { - $this->error[] = sprintf($user->lang['IMAGE_FILETYPE_MISMATCH'], $types[$this->image_info[2]][0], $this->extension); + $this->error[] = sprintf(phpbb::$user->lang['IMAGE_FILETYPE_MISMATCH'], $types[$this->image_info[2]][0], $this->extension); } } // Make sure the dimensions match a valid image if (empty($this->width) || empty($this->height)) { - $this->error[] = $user->lang['ATTACHED_IMAGE_NOT_IMAGE']; + $this->error[] = phpbb::$user->lang['ATTACHED_IMAGE_NOT_IMAGE']; } } else { - $this->error[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; + $this->error[] = phpbb::$user->lang['UNABLE_GET_IMAGE_SIZE']; } } @@ -407,8 +405,6 @@ class filespec */ function additional_checks() { - global $user; - if (!$this->file_moved) { return false; @@ -417,17 +413,17 @@ class filespec // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form if ($this->upload->max_filesize && ($this->get('filesize') > $this->upload->max_filesize || $this->filesize == 0)) { - $size_lang = ($this->upload->max_filesize >= 1048576) ? $user->lang['MIB'] : (($this->upload->max_filesize >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES'] ); + $size_lang = ($this->upload->max_filesize >= 1048576) ? phpbb::$user->lang['MIB'] : (($this->upload->max_filesize >= 1024) ? phpbb::$user->lang['KIB'] : phpbb::$user->lang['BYTES'] ); $max_filesize = get_formatted_filesize($this->upload->max_filesize, false); - $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'WRONG_FILESIZE'], $max_filesize, $size_lang); + $this->error[] = sprintf(phpbb::$user->lang[$this->upload->error_prefix . 'WRONG_FILESIZE'], $max_filesize, $size_lang); return false; } if (!$this->upload->valid_dimensions($this)) { - $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'WRONG_SIZE'], $this->upload->min_width, $this->upload->min_height, $this->upload->max_width, $this->upload->max_height, $this->width, $this->height); + $this->error[] = sprintf(phpbb::$user->lang[$this->upload->error_prefix . 'WRONG_SIZE'], $this->upload->min_width, $this->upload->min_height, $this->upload->max_width, $this->upload->max_height, $this->width, $this->height); return false; } @@ -561,8 +557,6 @@ class fileupload */ function form_upload($form_name) { - global $user; - unset($_FILES[$form_name]['local_mode']); $file = new filespec($_FILES[$form_name], $this); @@ -587,21 +581,21 @@ class fileupload // Check if empty file got uploaded (not catched by is_uploaded_file) if (isset($_FILES[$form_name]['size']) && $_FILES[$form_name]['size'] == 0) { - $file->error[] = $user->lang[$this->error_prefix . 'EMPTY_FILEUPLOAD']; + $file->error[] = phpbb::$user->lang[$this->error_prefix . 'EMPTY_FILEUPLOAD']; return $file; } // PHP Upload filesize exceeded if ($file->get('filename') == 'none') { - $file->error[] = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize')); + $file->error[] = (@ini_get('upload_max_filesize') == '') ? phpbb::$user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf(phpbb::$user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize')); return $file; } // Not correctly uploaded if (!$file->is_uploaded()) { - $file->error[] = $user->lang[$this->error_prefix . 'NOT_UPLOADED']; + $file->error[] = phpbb::$user->lang[$this->error_prefix . 'NOT_UPLOADED']; return $file; } @@ -615,8 +609,6 @@ class fileupload */ function local_upload($source_file, $filedata = false) { - global $user; - $form_name = 'local'; $_FILES[$form_name]['local_mode'] = true; @@ -670,14 +662,14 @@ class fileupload // PHP Upload filesize exceeded if ($file->get('filename') == 'none') { - $file->error[] = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize')); + $file->error[] = (@ini_get('upload_max_filesize') == '') ? phpbb::$user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf(phpbb::$user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize')); return $file; } // Not correctly uploaded if (!$file->is_uploaded()) { - $file->error[] = $user->lang[$this->error_prefix . 'NOT_UPLOADED']; + $file->error[] = phpbb::$user->lang[$this->error_prefix . 'NOT_UPLOADED']; return $file; } @@ -696,20 +688,18 @@ class fileupload */ function remote_upload($upload_url) { - global $user; - $upload_ary = array(); $upload_ary['local_mode'] = true; if (!preg_match('#^(https?://).*?\.(' . implode('|', $this->allowed_extensions) . ')$#i', $upload_url, $match)) { - $file = new fileerror($user->lang[$this->error_prefix . 'URL_INVALID']); + $file = new fileerror(phpbb::$user->lang[$this->error_prefix . 'URL_INVALID']); return $file; } if (empty($match[2])) { - $file = new fileerror($user->lang[$this->error_prefix . 'URL_INVALID']); + $file = new fileerror(phpbb::$user->lang[$this->error_prefix . 'URL_INVALID']); return $file; } @@ -734,7 +724,7 @@ class fileupload if (!($fsock = @fsockopen($host, $port, $errno, $errstr))) { - $file = new fileerror($user->lang[$this->error_prefix . 'NOT_UPLOADED']); + $file = new fileerror(phpbb::$user->lang[$this->error_prefix . 'NOT_UPLOADED']); return $file; } @@ -772,7 +762,7 @@ class fileupload } else if (stripos($line, '404 not found') !== false) { - $file = new fileerror($user->lang[$this->error_prefix . 'URL_NOT_FOUND']); + $file = new fileerror(phpbb::$user->lang[$this->error_prefix . 'URL_NOT_FOUND']); return $file; } } @@ -782,7 +772,7 @@ class fileupload if (empty($data)) { - $file = new fileerror($user->lang[$this->error_prefix . 'EMPTY_REMOTE_DATA']); + $file = new fileerror(phpbb::$user->lang[$this->error_prefix . 'EMPTY_REMOTE_DATA']); return $file; } @@ -791,7 +781,7 @@ class fileupload if (!($fp = @fopen($filename, 'wb'))) { - $file = new fileerror($user->lang[$this->error_prefix . 'NOT_UPLOADED']); + $file = new fileerror(phpbb::$user->lang[$this->error_prefix . 'NOT_UPLOADED']); return $file; } @@ -813,27 +803,25 @@ class fileupload */ function assign_internal_error($errorcode) { - global $user; - switch ($errorcode) { case 1: - $error = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize')); + $error = (@ini_get('upload_max_filesize') == '') ? phpbb::$user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf(phpbb::$user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize')); break; case 2: - $size_lang = ($this->max_filesize >= 1048576) ? $user->lang['MIB'] : (($this->max_filesize >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES']); + $size_lang = ($this->max_filesize >= 1048576) ? phpbb::$user->lang['MIB'] : (($this->max_filesize >= 1024) ? phpbb::$user->lang['KIB'] : phpbb::$user->lang['BYTES']); $max_filesize = get_formatted_filesize($this->max_filesize, false); - $error = sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize, $size_lang); + $error = sprintf(phpbb::$user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize, $size_lang); break; case 3: - $error = $user->lang[$this->error_prefix . 'PARTIAL_UPLOAD']; + $error = phpbb::$user->lang[$this->error_prefix . 'PARTIAL_UPLOAD']; break; case 4: - $error = $user->lang[$this->error_prefix . 'NOT_UPLOADED']; + $error = phpbb::$user->lang[$this->error_prefix . 'NOT_UPLOADED']; break; case 6: @@ -853,33 +841,31 @@ class fileupload */ function common_checks(&$file) { - global $user; - // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form if ($this->max_filesize && ($file->get('filesize') > $this->max_filesize || $file->get('filesize') == 0)) { - $size_lang = ($this->max_filesize >= 1048576) ? $user->lang['MIB'] : (($this->max_filesize >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES']); + $size_lang = ($this->max_filesize >= 1048576) ? phpbb::$user->lang['MIB'] : (($this->max_filesize >= 1024) ? phpbb::$user->lang['KIB'] : phpbb::$user->lang['BYTES']); $max_filesize = get_formatted_filesize($this->max_filesize, false); - $file->error[] = sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize, $size_lang); + $file->error[] = sprintf(phpbb::$user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize, $size_lang); } // check Filename if (preg_match("#[\\/:*?\"<>|]#i", $file->get('realname'))) { - $file->error[] = sprintf($user->lang[$this->error_prefix . 'INVALID_FILENAME'], $file->get('realname')); + $file->error[] = sprintf(phpbb::$user->lang[$this->error_prefix . 'INVALID_FILENAME'], $file->get('realname')); } // Invalid Extension if (!$this->valid_extension($file)) { - $file->error[] = sprintf($user->lang[$this->error_prefix . 'DISALLOWED_EXTENSION'], $file->get('extension')); + $file->error[] = sprintf(phpbb::$user->lang[$this->error_prefix . 'DISALLOWED_EXTENSION'], $file->get('extension')); } // MIME Sniffing if (!$this->valid_content($file)) { - $file->error[] = sprintf($user->lang[$this->error_prefix . 'DISALLOWED_CONTENT']); + $file->error[] = sprintf(phpbb::$user->lang[$this->error_prefix . 'DISALLOWED_CONTENT']); } } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index fb9c5002d6..14ce7726e3 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -292,8 +292,6 @@ function user_add($user_row, $cp_data = false) */ function user_delete($mode, $user_id, $post_username = false) { - global $user, $auth; - $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id; @@ -378,7 +376,7 @@ function user_delete($mode, $user_id, $post_username = false) if ($post_username === false) { - $post_username = $user->lang['GUEST']; + $post_username = phpbb::$user->lang['GUEST']; } // If the user is inactive and newly registered we assume no posts from this user being there... @@ -573,8 +571,6 @@ function user_delete($mode, $user_id, $post_username = false) */ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) { - global $user, $auth; - $deactivated = $activated = 0; $sql_statements = array(); @@ -613,7 +609,7 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) $deactivated++; // Remove the users session key... - $user->reset_login_keys($row['user_id']); + phpbb::$user->reset_login_keys($row['user_id']); } $sql_ary += array( @@ -666,8 +662,6 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) */ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason = '') { - global $user, $auth; - // Delete stale bans $sql = 'DELETE FROM ' . BANLIST_TABLE . ' WHERE ban_end < ' . time() . ' @@ -741,7 +735,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas if ($username != '') { $clean_name = utf8_clean_string($username); - if ($clean_name == $user->data['username_clean']) + if ($clean_name == phpbb::$user->data['username_clean']) { trigger_error('CANNOT_BAN_YOURSELF', E_USER_WARNING); } @@ -766,11 +760,11 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas // Do not allow banning yourself if (sizeof($founder)) { - $sql .= ' AND ' . phpbb::$db->sql_in_set('user_id', array_merge(array_keys($founder), array($user->data['user_id'])), true); + $sql .= ' AND ' . phpbb::$db->sql_in_set('user_id', array_merge(array_keys($founder), array(phpbb::$user->data['user_id'])), true); } else { - $sql .= ' AND user_id <> ' . $user->data['user_id']; + $sql .= ' AND user_id <> ' . phpbb::$user->data['user_id']; } $result = phpbb::$db->sql_query($sql); @@ -1061,8 +1055,6 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas */ function user_unban($mode, $ban) { - global $user, $auth; - // Delete stale bans $sql = 'DELETE FROM ' . BANLIST_TABLE . ' WHERE ban_end < ' . time() . ' @@ -1185,8 +1177,6 @@ function user_ipwhois($ip) */ function validate_data($data, $val_ary) { - global $user; - $error = array(); foreach ($val_ary as $var => $val_seq) @@ -1204,7 +1194,7 @@ function validate_data($data, $val_ary) if ($result = call_user_func_array('validate_' . $function, $validate)) { // Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted. - $error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var); + $error[] = (empty(phpbb::$user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var); } } } @@ -1330,16 +1320,14 @@ function validate_match($string, $optional = false, $match = '') * Used for registering, changing names, and posting anonymously with a username * * @param string $username The username to check -* @param string $allowed_username An allowed username, default being $user->data['username'] +* @param string $allowed_username An allowed username, default being phpbb::$user->data['username'] * * @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) */ function validate_username($username, $allowed_username = false) { - global $user; - $clean_username = utf8_clean_string($username); - $allowed_username = ($allowed_username === false) ? $user->data['username_clean'] : utf8_clean_string($allowed_username); + $allowed_username = ($allowed_username === false) ? phpbb::$user->data['username_clean'] : utf8_clean_string($allowed_username); if ($allowed_username == $clean_username) { @@ -1432,8 +1420,6 @@ function validate_username($username, $allowed_username = false) */ function validate_password($password) { - global $user; - if (!$password) { return false; @@ -1496,16 +1482,14 @@ function validate_password($password) * Check to see if email address is banned or already present in the DB * * @param string $email The email to check -* @param string $allowed_email An allowed email, default being $user->data['user_email'] +* @param string $allowed_email An allowed email, default being phpbb::$user->data['user_email'] * * @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) */ function validate_email($email, $allowed_email = false) { - global $user; - $email = strtolower($email); - $allowed_email = ($allowed_email === false) ? strtolower($user->data['user_email']) : strtolower($allowed_email); + $allowed_email = ($allowed_email === false) ? strtolower(phpbb::$user->data['user_email']) : strtolower($allowed_email); if ($allowed_email == $email) { @@ -1529,7 +1513,7 @@ function validate_email($email, $allowed_email = false) } } - if (($ban_reason = $user->check_ban(false, false, $email, true)) !== false) + if (($ban_reason = phpbb::$user->check_ban(false, false, $email, true)) !== false) { return ($ban_reason === true) ? 'EMAIL_BANNED' : $ban_reason; } @@ -1760,8 +1744,6 @@ function validate_jabber($jid) */ function avatar_delete($mode, $row, $clean_db = false) { - global $user; - // Check if the users avatar is actually *not* a group avatar if ($mode == 'user') { @@ -1790,28 +1772,26 @@ function avatar_delete($mode, $row, $clean_db = false) */ function avatar_remote($data, &$error) { - global $user; - if (!preg_match('#^(http|https|ftp)://#i', $data['remotelink'])) { $data['remotelink'] = 'http://' . $data['remotelink']; } if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $data['remotelink'])) { - $error[] = $user->lang['AVATAR_URL_INVALID']; + $error[] = phpbb::$user->lang['AVATAR_URL_INVALID']; return false; } // Make sure getimagesize works... if (($image_data = @getimagesize($data['remotelink'])) === false && (empty($data['width']) || empty($data['height']))) { - $error[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; + $error[] = phpbb::$user->lang['UNABLE_GET_IMAGE_SIZE']; return false; } if (!empty($image_data) && ($image_data[0] < 2 || $image_data[1] < 2)) { - $error[] = $user->lang['AVATAR_NO_SIZE']; + $error[] = phpbb::$user->lang['AVATAR_NO_SIZE']; return false; } @@ -1820,7 +1800,7 @@ function avatar_remote($data, &$error) if ($width < 2 || $height < 2) { - $error[] = $user->lang['AVATAR_NO_SIZE']; + $error[] = phpbb::$user->lang['AVATAR_NO_SIZE']; return false; } @@ -1833,11 +1813,11 @@ function avatar_remote($data, &$error) { if (!isset($types[$image_data[2]])) { - $error[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; + $error[] = phpbb::$user->lang['UNABLE_GET_IMAGE_SIZE']; } else { - $error[] = sprintf($user->lang['IMAGE_FILETYPE_MISMATCH'], $types[$image_data[2]][0], $extension); + $error[] = sprintf(phpbb::$user->lang['IMAGE_FILETYPE_MISMATCH'], $types[$image_data[2]][0], $extension); } return false; } @@ -1846,7 +1826,7 @@ function avatar_remote($data, &$error) { if ($width > phpbb::$config['avatar_max_width'] || $height > phpbb::$config['avatar_max_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); + $error[] = sprintf(phpbb::$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; } } @@ -1855,7 +1835,7 @@ function avatar_remote($data, &$error) { if ($width < phpbb::$config['avatar_min_width'] || $height < phpbb::$config['avatar_min_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); + $error[] = sprintf(phpbb::$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; } } @@ -1868,8 +1848,6 @@ function avatar_remote($data, &$error) */ function avatar_upload($data, &$error) { - global $user; - // Init upload class include_once(PHPBB_ROOT_PATH . 'includes/functions_upload.' . PHP_EXT); $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'])); @@ -1936,15 +1914,13 @@ function get_avatar_filename($avatar_entry) */ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var = 'avatar_row') { - global $user, $template; - $avatar_list = array(); $path = PHPBB_ROOT_PATH . phpbb::$config['avatar_gallery_path']; if (!file_exists($path) || !is_dir($path)) { - $avatar_list = array($user->lang['NO_AVATAR_CATEGORY'] => array()); + $avatar_list = array(phpbb::$user->lang['NO_AVATAR_CATEGORY'] => array()); } else { @@ -1953,7 +1929,7 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var if (!$dp) { - return array($user->lang['NO_AVATAR_CATEGORY'] => array()); + return array(phpbb::$user->lang['NO_AVATAR_CATEGORY'] => array()); } while (($file = readdir($dp)) !== false) @@ -1990,7 +1966,7 @@ function avatar_gallery($category, $avatar_select, $items_per_column, $block_var if (!sizeof($avatar_list)) { - $avatar_list = array($user->lang['NO_AVATAR_CATEGORY'] => array()); + $avatar_list = array(phpbb::$user->lang['NO_AVATAR_CATEGORY'] => array()); } @ksort($avatar_list); @@ -2040,8 +2016,6 @@ 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 $user; - switch ($avatar_type) { case AVATAR_REMOTE : @@ -2059,13 +2033,13 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $ // Make sure getimagesize works... if (($image_data = @getimagesize($avatar)) === false) { - $error[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; + $error[] = phpbb::$user->lang['UNABLE_GET_IMAGE_SIZE']; return false; } if ($image_data[0] < 2 || $image_data[1] < 2) { - $error[] = $user->lang['AVATAR_NO_SIZE']; + $error[] = phpbb::$user->lang['AVATAR_NO_SIZE']; return false; } @@ -2093,8 +2067,6 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $ */ function avatar_process_user(&$error, $custom_userdata = false) { - global $auth, $user; - $data = array( 'uploadurl' => request_var('uploadurl', ''), 'remotelink' => request_var('remotelink', ''), @@ -2118,7 +2090,7 @@ function avatar_process_user(&$error, $custom_userdata = false) if ($custom_userdata === false) { - $userdata = &$user->data; + $userdata = &phpbb::$user->data; } else { @@ -2188,7 +2160,7 @@ function avatar_process_user(&$error, $custom_userdata = false) { if ($data['width'] > phpbb::$config['avatar_max_width'] || $data['height'] > phpbb::$config['avatar_max_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']); + $error[] = sprintf(phpbb::$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']); } } @@ -2198,7 +2170,7 @@ function avatar_process_user(&$error, $custom_userdata = false) { if ($data['width'] < phpbb::$config['avatar_min_width'] || $data['height'] < phpbb::$config['avatar_min_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']); + $error[] = sprintf(phpbb::$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']); } } } @@ -2218,7 +2190,7 @@ function avatar_process_user(&$error, $custom_userdata = false) $ext_new = $ext_old = ''; if (isset($sql_ary['user_avatar'])) { - $userdata = ($custom_userdata === false) ? $user->data : $custom_userdata; + $userdata = ($custom_userdata === false) ? phpbb::$user->data : $custom_userdata; $ext_new = (empty($sql_ary['user_avatar'])) ? '' : substr(strrchr($sql_ary['user_avatar'], '.'), 1); $ext_old = (empty($userdata['user_avatar'])) ? '' : substr(strrchr($userdata['user_avatar'], '.'), 1); @@ -2235,7 +2207,7 @@ function avatar_process_user(&$error, $custom_userdata = false) $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE user_id = ' . (($custom_userdata === false) ? $user->data['user_id'] : $custom_userdata['user_id']); + WHERE user_id = ' . (($custom_userdata === false) ? phpbb::$user->data['user_id'] : $custom_userdata['user_id']); phpbb::$db->sql_query($sql); } @@ -2254,7 +2226,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 $user, $file_upload; + global $file_upload; $error = array(); $attribute_ary = array( @@ -2279,18 +2251,18 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow // Check data. Limit group name length. if (!utf8_strlen($name) || utf8_strlen($name) > 60) { - $error[] = (!utf8_strlen($name)) ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG']; + $error[] = (!utf8_strlen($name)) ? phpbb::$user->lang['GROUP_ERR_USERNAME'] : phpbb::$user->lang['GROUP_ERR_USER_LONG']; } $err = group_validate_groupname($group_id, $name); if (!empty($err)) { - $error[] = $user->lang[$err]; + $error[] = phpbb::$user->lang[$err]; } if (!in_array($type, array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE))) { - $error[] = $user->lang['GROUP_ERR_TYPE']; + $error[] = phpbb::$user->lang['GROUP_ERR_TYPE']; } if (!sizeof($error)) @@ -2400,7 +2372,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow group_set_user_default($group_id, $user_ary, $sql_ary); } - $name = ($type == GROUP_SPECIAL) ? $user->lang['G_' . $name] : $name; + $name = ($type == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $name] : $name; add_log('admin', $log, $name); group_update_listings($group_id); @@ -2520,8 +2492,6 @@ function group_delete($group_id, $group_name = false) */ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false) { - global $auth; - // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); @@ -2621,8 +2591,6 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, */ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false) { - global $auth; - $group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'REGISTERED_COPPA', 'REGISTERED', 'BOTS', 'GUESTS'); // We need both username and user_id info @@ -2818,8 +2786,6 @@ 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 $auth; - // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); @@ -3104,8 +3070,6 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal */ function get_group_name($group_id) { - global $user; - $sql = 'SELECT group_name, group_type FROM ' . GROUPS_TABLE . ' WHERE group_id = ' . (int) $group_id; @@ -3118,7 +3082,7 @@ function get_group_name($group_id) return ''; } - return ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + return ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']; } /** @@ -3193,8 +3157,6 @@ function group_memberships($group_id_ary = false, $user_id_ary = false, $return_ */ function group_update_listings($group_id) { - global $auth; - $hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_')); if (!sizeof($hold_ary)) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 14b87c05b2..8fa3223586 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -42,8 +42,6 @@ class bbcode_firstpass extends bbcode $this->bbcode_init(); } - global $user; - $this->bbcode_bitfield = ''; $bitfield = new bitfield(); @@ -55,7 +53,7 @@ class bbcode_firstpass extends bbcode { if (preg_match($regexp, $this->message)) { - $this->warn_msg[] = sprintf($user->lang['UNAUTHORISED_BBCODE'] , '[' . $bbcode_name . ']'); + $this->warn_msg[] = sprintf(phpbb::$user->lang['UNAUTHORISED_BBCODE'] , '[' . $bbcode_name . ']'); continue; } } @@ -135,7 +133,6 @@ class bbcode_firstpass extends bbcode if (!is_array($rowset)) { - global $db; $rowset = array(); $sql = 'SELECT * @@ -194,8 +191,6 @@ class bbcode_firstpass extends bbcode */ function bbcode_size($stx, $in) { - global $user; - if (!$this->check_bbcode('size', $in)) { return $in; @@ -203,7 +198,7 @@ class bbcode_firstpass extends bbcode 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'], phpbb::$config['max_' . $this->mode . '_font_size']); + $this->warn_msg[] = sprintf(phpbb::$user->lang['MAX_FONT_SIZE_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_font_size']); return '[size=' . $stx . ']' . $in . '[/size]'; } @@ -274,8 +269,6 @@ class bbcode_firstpass extends bbcode */ function bbcode_img($in) { - global $user; - if (!$this->check_bbcode('img', $in)) { return $in; @@ -305,20 +298,20 @@ class bbcode_firstpass extends bbcode if ($stats === false) { $error = true; - $this->warn_msg[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; + $this->warn_msg[] = phpbb::$user->lang['UNABLE_GET_IMAGE_SIZE']; } else { 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'], phpbb::$config['max_' . $this->mode . '_img_height']); + $this->warn_msg[] = sprintf(phpbb::$user->lang['MAX_IMG_HEIGHT_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_img_height']); } 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'], phpbb::$config['max_' . $this->mode . '_img_width']); + $this->warn_msg[] = sprintf(phpbb::$user->lang['MAX_IMG_WIDTH_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_img_width']); } } } @@ -336,8 +329,6 @@ class bbcode_firstpass extends bbcode */ function bbcode_flash($width, $height, $in) { - global $user; - if (!$this->check_bbcode('flash', $in)) { return $in; @@ -358,13 +349,13 @@ class bbcode_firstpass extends bbcode 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'], phpbb::$config['max_' . $this->mode . '_img_height']); + $this->warn_msg[] = sprintf(phpbb::$user->lang['MAX_FLASH_HEIGHT_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_img_height']); } 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'], phpbb::$config['max_' . $this->mode . '_img_width']); + $this->warn_msg[] = sprintf(phpbb::$user->lang['MAX_FLASH_WIDTH_EXCEEDED'], phpbb::$config['max_' . $this->mode . '_img_width']); } } @@ -685,8 +676,6 @@ class bbcode_firstpass extends bbcode */ function bbcode_quote($in) { - global $user; - /** * If you change this code, make sure the cases described within the following reports are still working: * #3572 - [quote="[test]test"]test [ test[/quote] - (correct: parsed) @@ -755,7 +744,7 @@ class bbcode_firstpass extends bbcode 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'], phpbb::$config['max_quote_depth']); + $error_ary['quote_depth'] = sprintf(phpbb::$user->lang['QUOTE_DEPTH_EXCEEDED'], phpbb::$config['max_quote_depth']); $out .= $buffer . $tok; $tok = '[]'; @@ -977,21 +966,19 @@ class bbcode_firstpass extends bbcode */ function path_in_domain($url) { - global $user; - if (phpbb::$config['force_server_vars']) { $check_path = phpbb::$config['script_path']; } else { - $check_path = ($user->page['root_script_path'] != '/') ? substr($user->page['root_script_path'], 0, -1) : '/'; + $check_path = (phpbb::$user->page['root_script_path'] != '/') ? substr(phpbb::$user->page['root_script_path'], 0, -1) : '/'; } // Is the user trying to link to a php file in this domain and script path? if (strpos($url, '.' . PHP_EXT) !== false && strpos($url, $check_path) !== false) { - $server_name = $user->host; + $server_name = phpbb::$user->system['host']; // Forcing server vars is the only way to specify/override the protocol if (phpbb::$config['force_server_vars'] || !$server_name) @@ -1059,8 +1046,6 @@ 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 $db, $user; - $mode = ($mode != 'post') ? 'sig' : 'post'; $this->mode = $mode; @@ -1095,7 +1080,7 @@ class parse_message extends bbcode_firstpass 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, phpbb::$config['max_' . $mode . '_chars']); + $this->warn_msg[] = (!$msg_len) ? phpbb::$user->lang['TOO_FEW_CHARS'] : sprintf(phpbb::$user->lang['TOO_MANY_CHARS_' . strtoupper($mode)], $msg_len, phpbb::$config['max_' . $mode . '_chars']); return (!$update_this_message) ? $return_message : $this->warn_msg; } } @@ -1103,7 +1088,7 @@ class parse_message extends bbcode_firstpass // Check for "empty" message if ($mode !== 'sig' && utf8_clean_string($this->message) === '') { - $this->warn_msg[] = $user->lang['TOO_FEW_CHARS']; + $this->warn_msg[] = phpbb::$user->lang['TOO_FEW_CHARS']; return (!$update_this_message) ? $return_message : $this->warn_msg; } @@ -1152,7 +1137,7 @@ class parse_message extends bbcode_firstpass // Check number of links if (phpbb::$config['max_' . $mode . '_urls'] && $num_urls > phpbb::$config['max_' . $mode . '_urls']) { - $this->warn_msg[] = sprintf($user->lang['TOO_MANY_URLS'], phpbb::$config['max_' . $mode . '_urls']); + $this->warn_msg[] = sprintf(phpbb::$user->lang['TOO_MANY_URLS'], phpbb::$config['max_' . $mode . '_urls']); return (!$update_this_message) ? $return_message : $this->warn_msg; } @@ -1252,7 +1237,6 @@ class parse_message extends bbcode_firstpass */ function smilies($max_smilies = 0) { - global $db, $user; static $match; static $replace; @@ -1292,7 +1276,7 @@ class parse_message extends bbcode_firstpass if ($num_matches !== false && $num_matches > $max_smilies) { - $this->warn_msg[] = sprintf($user->lang['TOO_MANY_SMILIES'], $max_smilies); + $this->warn_msg[] = sprintf(phpbb::$user->lang['TOO_MANY_SMILIES'], $max_smilies); return; } } @@ -1307,8 +1291,6 @@ class parse_message extends bbcode_firstpass */ function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) { - global $auth, $user, $db; - $error = array(); $num_attachments = sizeof($this->attachment_data); @@ -1358,7 +1340,7 @@ class parse_message extends bbcode_firstpass 'thumbnail' => $filedata['thumbnail'], 'is_orphan' => 1, 'in_message' => ($is_message) ? 1 : 0, - 'poster_id' => $user->data['user_id'], + 'poster_id' => phpbb::$user->data['user_id'], ); $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); @@ -1388,7 +1370,7 @@ class parse_message extends bbcode_firstpass } else { - $error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $cfg['max_attachments']); + $error[] = sprintf(phpbb::$user->lang['TOO_MANY_ATTACHMENTS'], $cfg['max_attachments']); } } @@ -1411,7 +1393,7 @@ class parse_message extends bbcode_firstpass FROM ' . ATTACHMENTS_TABLE . ' WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id'] . ' AND is_orphan = 1 - AND poster_id = ' . $user->data['user_id']; + AND poster_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1460,7 +1442,7 @@ class parse_message extends bbcode_firstpass 'thumbnail' => $filedata['thumbnail'], 'is_orphan' => 1, 'in_message' => ($is_message) ? 1 : 0, - 'poster_id' => $user->data['user_id'], + 'poster_id' => phpbb::$user->data['user_id'], ); $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); @@ -1479,7 +1461,7 @@ class parse_message extends bbcode_firstpass } else { - $error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $cfg['max_attachments']); + $error[] = sprintf(phpbb::$user->lang['TOO_MANY_ATTACHMENTS'], $cfg['max_attachments']); } } } @@ -1495,13 +1477,11 @@ class parse_message extends bbcode_firstpass */ function get_submitted_attachment_data($check_user_id = false) { - 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); $this->attachment_data = array(); - $check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id; + $check_user_id = ($check_user_id === false) ? phpbb::$user->data['user_id'] : $check_user_id; if (!sizeof($attachment_data)) { @@ -1554,7 +1534,7 @@ class parse_message extends bbcode_firstpass $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan)) . ' - AND poster_id = ' . $user->data['user_id'] . ' + AND poster_id = ' . phpbb::$user->data['user_id'] . ' AND is_orphan = 1'; $result = $db->sql_query($sql); @@ -1582,8 +1562,6 @@ class parse_message extends bbcode_firstpass */ function parse_poll(&$poll) { - global $auth, $user; - $poll_max_options = $poll['poll_max_options']; // Parse Poll Option text ;) @@ -1606,18 +1584,18 @@ class parse_message extends bbcode_firstpass if (!$poll['poll_title'] && $poll['poll_options_size']) { - $this->warn_msg[] = $user->lang['NO_POLL_TITLE']; + $this->warn_msg[] = phpbb::$user->lang['NO_POLL_TITLE']; } else { if (utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)) > 100) { - $this->warn_msg[] = $user->lang['POLL_TITLE_TOO_LONG']; + $this->warn_msg[] = phpbb::$user->lang['POLL_TITLE_TOO_LONG']; } $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']; + $this->warn_msg[] = phpbb::$user->lang['POLL_TITLE_COMP_TOO_LONG']; } } @@ -1627,15 +1605,15 @@ class parse_message extends bbcode_firstpass if (sizeof($poll['poll_options']) == 1) { - $this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS']; + $this->warn_msg[] = phpbb::$user->lang['TOO_FEW_POLL_OPTIONS']; } else if ($poll['poll_options_size'] > (int) phpbb::$config['max_poll_options']) { - $this->warn_msg[] = $user->lang['TOO_MANY_POLL_OPTIONS']; + $this->warn_msg[] = phpbb::$user->lang['TOO_MANY_POLL_OPTIONS']; } else if ($poll_max_options > $poll['poll_options_size']) { - $this->warn_msg[] = $user->lang['TOO_MANY_USER_OPTIONS']; + $this->warn_msg[] = phpbb::$user->lang['TOO_MANY_USER_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 fdbd75b52b..cda1c9f437 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -46,8 +46,6 @@ class fulltext_mysql extends search_backend */ public function init() { - global $db, $user; - $result = $db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\''); $info = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -64,7 +62,7 @@ class fulltext_mysql extends search_backend if ($engine != 'MyISAM') { - return $user->lang['FULLTEXT_MYSQL_NOT_MYISAM']; + return phpbb::$user->lang['FULLTEXT_MYSQL_NOT_MYISAM']; } $sql = 'SHOW VARIABLES @@ -250,8 +248,6 @@ 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 $db; - // No keywords? No posts. if (!$this->search_query) { @@ -409,8 +405,6 @@ 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 $db; - // No author? No posts. if (!sizeof($author_ary)) { @@ -557,8 +551,6 @@ class fulltext_mysql extends search_backend */ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) { - global $db; - // Split old and new post/subject to obtain array of words $split_text = $this->split_message($message); $split_title = ($subject) ? $this->split_message($subject) : array(); @@ -587,8 +579,6 @@ class fulltext_mysql extends search_backend */ public function tidy() { - global $db; - // destroy too old cached search results $this->destroy_cache(array()); @@ -600,8 +590,6 @@ class fulltext_mysql extends search_backend */ public function create_index($acp_module, $u_action) { - global $db; - // Make sure we can actually use MySQL with fulltext indexes if ($error = $this->init()) { @@ -647,8 +635,6 @@ class fulltext_mysql extends search_backend */ public function delete_index($acp_module, $u_action) { - global $db; - // Make sure we can actually use MySQL with fulltext indexes if ($error = $this->init()) { @@ -705,22 +691,18 @@ class fulltext_mysql extends search_backend */ public function index_stats() { - global $user; - if (empty($this->stats)) { $this->get_stats(); } return array( - $user->lang['FULLTEXT_MYSQL_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0, + phpbb::$user->lang['FULLTEXT_MYSQL_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0, ); } private function get_stats() { - global $db; - if ($db->dbms_type !== 'mysql') { $this->stats = array(); @@ -766,8 +748,6 @@ class fulltext_mysql extends search_backend */ function acp() { - global $user; - $tpl = ''; // These are fields required in the config table diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index c8d9df2b28..8543061976 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -855,8 +855,7 @@ class install_install extends module } unset($config_data_array); - $config_data .= "\n\t\t'debug' => true,\n\t\t'debug_extra' => true,\n\n\t\t// DO NOT CHANGE\n\t\t'installed' => true,\n\t));\n}\n"; - $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! + $config_data .= "\n\t\t'debug' => true,\n\t\t'debug_extra' => true,\n\n\t\t// DO NOT CHANGE\n\t\t'installed' => true,\n\t));\n}\n\n"; // Attempt to write out the config file directly. If it works, this is the easiest way to do it ... if ((file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && is_writable(PHPBB_ROOT_PATH . 'config.' . PHP_EXT)) || is_writable(PHPBB_ROOT_PATH)) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 137b9d4957..19cf3051c9 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -117,7 +117,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'], phpbb::$config['version'], $this->current_version, $this->latest_version)) + 'ERROR_MSG' => ($up_to_date) ? phpbb::$user->lang['NO_UPDATE_FILES_UP_TO_DATE'] : sprintf(phpbb::$user->lang['NO_UPDATE_FILES_OUTDATED'], phpbb::$config['version'], $this->current_version, $this->latest_version)) ); return; @@ -131,7 +131,7 @@ class install_update extends module { $template->assign_vars(array( 'S_ERROR' => true, - 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], phpbb::$config['version'], $this->update_info['version']['from'], $this->update_info['version']['to'])) + 'ERROR_MSG' => sprintf(phpbb::$user->lang['INCOMPATIBLE_UPDATE_FILES'], phpbb::$config['version'], $this->update_info['version']['from'], $this->update_info['version']['to'])) ); return; @@ -144,7 +144,7 @@ class install_update extends module $template->assign_vars(array( 'S_WARNING' => true, - 'WARNING_MSG' => sprintf($user->lang['OLD_UPDATE_FILES'], $this->update_info['version']['from'], $this->update_info['version']['to'], $this->latest_version)) + 'WARNING_MSG' => sprintf(phpbb::$user->lang['OLD_UPDATE_FILES'], $this->update_info['version']['from'], $this->update_info['version']['to'], $this->latest_version)) ); } @@ -162,10 +162,10 @@ class install_update extends module $lang = array(); include($this->new_location . 'language/en/install.php'); // only add new keys to user's language in english - $new_keys = array_diff(array_keys($lang), array_keys($user->lang)); + $new_keys = array_diff(array_keys($lang), array_keys(phpbb::$user->lang)); foreach ($new_keys as $i => $new_key) { - $user->lang[$new_key] = $lang[$new_key]; + phpbb::$user->lang[$new_key] = $lang[$new_key]; } } } @@ -237,7 +237,7 @@ class install_update extends module // Should not happen at all if (!$valid) { - trigger_error($user->lang['DATABASE_UPDATE_INFO_OLD'], E_USER_ERROR); + trigger_error(phpbb::$user->lang['DATABASE_UPDATE_INFO_OLD'], E_USER_ERROR); } // Just a precaution @@ -247,7 +247,7 @@ class install_update extends module $template->assign_vars(array( 'S_DB_UPDATE' => true, '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' => append_sid('install/database_update', 'type=1&language=' . phpbb::$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"), )); @@ -306,8 +306,8 @@ class install_update extends module 'S_IN_PROGRESS' => true, 'S_COLLECTED' => (int) $update_list['status'], 'S_TO_COLLECT' => sizeof($this->update_info['files']), - 'L_IN_PROGRESS' => $user->lang['COLLECTING_FILE_DIFFS'], - 'L_IN_PROGRESS_EXPLAIN' => sprintf($user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files'])), + 'L_IN_PROGRESS' => phpbb::$user->lang['COLLECTING_FILE_DIFFS'], + 'L_IN_PROGRESS_EXPLAIN' => sprintf(phpbb::$user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files'])), )); return; @@ -339,9 +339,9 @@ class install_update extends module $template->assign_block_vars('files', array( 'S_STATUS' => true, 'STATUS' => $status, - 'L_STATUS' => $user->lang['STATUS_' . strtoupper($status)], - 'TITLE' => $user->lang['FILES_' . strtoupper($status)], - 'EXPLAIN' => $user->lang['FILES_' . strtoupper($status) . '_EXPLAIN'], + 'L_STATUS' => phpbb::$user->lang['STATUS_' . strtoupper($status)], + 'TITLE' => phpbb::$user->lang['FILES_' . strtoupper($status)], + 'EXPLAIN' => phpbb::$user->lang['FILES_' . strtoupper($status) . '_EXPLAIN'], ) ); @@ -376,7 +376,7 @@ class install_update extends module 'CUSTOM_ORIGINAL' => ($file_struct['custom']) ? $file_struct['original'] : '', 'U_SHOW_DIFF' => $diff_url, - 'L_SHOW_DIFF' => ($status != 'up_to_date') ? $user->lang['SHOW_DIFF_' . strtoupper($status)] : '', + 'L_SHOW_DIFF' => ($status != 'up_to_date') ? phpbb::$user->lang['SHOW_DIFF_' . strtoupper($status)] : '', 'U_VIEW_MOD_FILE' => $diff_url . '&op=' . MERGE_MOD_FILE, 'U_VIEW_NEW_FILE' => $diff_url . '&op=' . MERGE_NEW_FILE, @@ -516,7 +516,7 @@ class install_update extends module if ($update_list === false) { - trigger_error($user->lang['NO_UPDATE_INFO'], E_USER_ERROR); + trigger_error(phpbb::$user->lang['NO_UPDATE_INFO'], E_USER_ERROR); } // Check if the conflicts data is valid @@ -564,7 +564,7 @@ class install_update extends module // Check number of conflicting files, they need to be equal. For modified files the number can differ if (sizeof($update_list['conflict']) != sizeof($conflicts)) { - trigger_error($user->lang['MERGE_SELECT_ERROR'], E_USER_ERROR); + trigger_error(phpbb::$user->lang['MERGE_SELECT_ERROR'], E_USER_ERROR); } // Before we do anything, let us diff the files and store the raw file information "somewhere" @@ -622,8 +622,8 @@ class install_update extends module $template->assign_vars(array( 'S_IN_PROGRESS' => true, - 'L_IN_PROGRESS' => $user->lang['MERGING_FILES'], - 'L_IN_PROGRESS_EXPLAIN' => $user->lang['MERGING_FILES_EXPLAIN'], + 'L_IN_PROGRESS' => phpbb::$user->lang['MERGING_FILES'], + 'L_IN_PROGRESS_EXPLAIN' => phpbb::$user->lang['MERGING_FILES_EXPLAIN'], )); return; @@ -753,7 +753,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 = (phpbb::$config['force_server_vars']) ? ((phpbb::$config['script_path'] == '/') ? '/' : phpbb::$config['script_path'] . '/') : $user->page['root_script_path']; + $script_path = (phpbb::$config['force_server_vars']) ? ((phpbb::$config['script_path'] == '/') ? '/' : phpbb::$config['script_path'] . '/') : phpbb::$user->page['root_script_path']; foreach ($update_list as $status => $files) { @@ -847,8 +847,8 @@ class install_update extends module { $template->assign_block_vars('data', array( 'DATA' => $data, - 'NAME' => $user->lang[strtoupper($method . '_' . $data)], - 'EXPLAIN' => $user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'], + 'NAME' => phpbb::$user->lang[strtoupper($method . '_' . $data)], + 'EXPLAIN' => phpbb::$user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'], 'DEFAULT' => (request_var($data, false)) ? request_var($data, '') : $default )); } @@ -856,7 +856,7 @@ class install_update extends module $template->assign_vars(array( 'S_CONNECTION_SUCCESS' => ($test_ftp_connection && $test_connection === true) ? true : false, 'S_CONNECTION_FAILED' => ($test_ftp_connection && $test_connection !== true) ? true : false, - 'ERROR_MSG' => ($test_ftp_connection && $test_connection !== true) ? $user->lang[$test_connection] : '', + 'ERROR_MSG' => ($test_ftp_connection && $test_connection !== true) ? phpbb::$user->lang[$test_connection] : '', 'S_FTP_UPLOAD' => true, 'UPLOAD_METHOD' => $method, @@ -1004,8 +1004,6 @@ class install_update extends module */ function show_diff(&$update_list) { - global $template, $user; - $this->tpl_name = 'install_update_diff'; // Got the diff template itself updated? If so, we are able to directly use it @@ -1032,13 +1030,13 @@ class install_update extends module if (empty($found_entry)) { - trigger_error($user->lang['FILE_DIFF_NOT_ALLOWED'], E_USER_ERROR); + trigger_error(phpbb::$user->lang['FILE_DIFF_NOT_ALLOWED'], E_USER_ERROR); } // If the status is 'up_to_date' then we do not need to show a diff if ($status == 'up_to_date') { - trigger_error($user->lang['FILE_ALREADY_UP_TO_DATE'], E_USER_ERROR); + trigger_error(phpbb::$user->lang['FILE_ALREADY_UP_TO_DATE'], E_USER_ERROR); } $original_file = ($found_entry['custom']) ? $found_entry['original'] : $file; @@ -1138,7 +1136,7 @@ class install_update extends module $diff_mode_options = ''; foreach (array('side_by_side', 'inline', 'unified', 'raw') as $option) { - $diff_mode_options .= '<option value="' . $option . '"' . (($diff_mode == $option) ? ' selected="selected"' : '') . '>' . $user->lang['DIFF_' . strtoupper($option)] . '</option>'; + $diff_mode_options .= '<option value="' . $option . '"' . (($diff_mode == $option) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['DIFF_' . strtoupper($option)] . '</option>'; } // Now the correct renderer @@ -1166,8 +1164,6 @@ class install_update extends module */ function get_update_structure(&$update_list) { - global $user; - if ($update_list === false) { $update_list = array( @@ -1213,7 +1209,7 @@ class install_update extends module // Make sure the update files are consistent by checking if the file is in new_files... if (!file_exists($this->new_location . $file)) { - trigger_error($user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR); + trigger_error(phpbb::$user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR); } // If the file exists within the old directory the file got removed and we will write it back @@ -1293,8 +1289,6 @@ class install_update extends module */ function make_update_diff(&$update_list, $original_file, $file, $custom = false) { - global $user; - $update_ary = array('filename' => $file, 'custom' => $custom); if ($custom) @@ -1338,7 +1332,7 @@ class install_update extends module // Check for existance, else abort immediately if (!file_exists($this->old_location . $original_file) || !file_exists($this->new_location . $original_file)) { - trigger_error($user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR); + trigger_error(phpbb::$user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR); } $tmp = array( @@ -1470,8 +1464,6 @@ class install_update extends module */ function get_file($mode) { - global $user, $db; - $errstr = ''; $errno = 0; @@ -1510,7 +1502,7 @@ class install_update extends module include(PHPBB_ROOT_PATH . 'install/update/index.php'); $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; - $errstr = ($info === false) ? $user->lang['WRONG_INFO_FILE_FORMAT'] : ''; + $errstr = ($info === false) ? phpbb::$user->lang['WRONG_INFO_FILE_FORMAT'] : ''; if ($info !== false) { diff --git a/phpBB/mcp.php b/phpBB/mcp.php index db77fee8c8..710eec97ea 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -19,9 +19,9 @@ include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); require(PHPBB_ROOT_PATH . 'includes/functions_module.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); -$user->setup('mcp'); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup('mcp'); $module = new p_master(); @@ -42,14 +42,14 @@ else } // Only Moderators can go beyond this point -if (!$user->data['is_registered']) +if (!phpbb::$user->is_registered) { - if ($user->data['is_bot']) + if (phpbb::$user->is_bot) { redirect(append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT)); } - login_box('', $user->lang['LOGIN_EXPLAIN_MCP']); + login_box('', phpbb::$user->lang['LOGIN_EXPLAIN_MCP']); } $quickmod = phpbb_request::is_set('quickmod'); @@ -117,10 +117,10 @@ if (!$auth->acl_getf_global('m_')) ); $allow_user = false; - if ($quickmod && isset($user_quickmod_actions[$action]) && $user->data['is_registered'] && $auth->acl_gets($user_quickmod_actions[$action], $forum_id)) + if ($quickmod && isset($user_quickmod_actions[$action]) && phpbb::$user->is_registered && $auth->acl_gets($user_quickmod_actions[$action], $forum_id)) { $topic_info = get_topic_data(array($topic_id)); - if ($topic_info[$topic_id]['topic_poster'] == $user->data['user_id']) + if ($topic_info[$topic_id]['topic_poster'] == phpbb::$user->data['user_id']) { $allow_user = true; } @@ -332,7 +332,6 @@ function extra_url() */ function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false) { - global $auth, $db, $user; static $rowset = array(); $topics = array(); @@ -379,12 +378,12 @@ function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false) $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), - 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id' + 'ON' => 'tt.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.topic_id = tt.topic_id' ); $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id' + 'ON' => 'ft.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.forum_id = ft.forum_id' ); } @@ -427,8 +426,6 @@ 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, $user; - $rowset = array(); if (!sizeof($post_ids)) @@ -463,12 +460,12 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false) $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), - 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id' + 'ON' => 'tt.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.topic_id = tt.topic_id' ); $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id' + 'ON' => 'ft.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.forum_id = ft.forum_id' ); } @@ -507,8 +504,6 @@ 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; - $rowset = array(); if (!is_array($forum_id)) @@ -523,7 +518,7 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false) 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'] . ' + $read_tracking_join = ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . phpbb::$user->data['user_id'] . ' AND ft.forum_id = f.forum_id)'; $read_tracking_select = ', ft.mark_time'; } @@ -563,8 +558,6 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false) */ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE') { - global $db, $user, $auth, $template; - $sort_days = request_var('st', 0); $min_time = ($sort_days) ? time() - ($sort_days * 86400) : 0; @@ -687,34 +680,34 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, $sort_key = request_var('sk', $default_key); $sort_dir = request_var('sd', $default_dir); - $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + $sort_dir_text = array('a' => phpbb::$user->lang['ASCENDING'], 'd' => phpbb::$user->lang['DESCENDING']); switch ($type) { case 'topics': - $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); + $limit_days = array(0 => phpbb::$user->lang['ALL_TOPICS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('a' => phpbb::$user->lang['AUTHOR'], 't' => phpbb::$user->lang['POST_TIME'], 'tt' => phpbb::$user->lang['TOPIC_TIME'], 'r' => phpbb::$user->lang['REPLIES'], 's' => phpbb::$user->lang['SUBJECT'], 'v' => phpbb::$user->lang['VIEWS']); $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_replies_real' : 't.topic_replies'), 's' => 't.topic_title', 'v' => 't.topic_views'); $limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : ''; break; case 'posts': - $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $limit_days = array(0 => phpbb::$user->lang['ALL_POSTS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('a' => phpbb::$user->lang['AUTHOR'], 't' => phpbb::$user->lang['POST_TIME'], 's' => phpbb::$user->lang['SUBJECT']); $sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.post_time', 's' => 'p.post_subject'); $limit_time_sql = ($min_time) ? "AND p.post_time >= $min_time" : ''; break; case 'reports': - $limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); + $limit_days = array(0 => phpbb::$user->lang['ALL_REPORTS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('a' => phpbb::$user->lang['AUTHOR'], 'r' => phpbb::$user->lang['REPORTER'], 'p' => phpbb::$user->lang['POST_TIME'], 't' => phpbb::$user->lang['REPORT_TIME'], 's' => phpbb::$user->lang['SUBJECT']); $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.post_time', 't' => 'r.report_time', 's' => 'p.post_subject'); break; case 'logs': - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('u' => phpbb::$user->lang['SORT_USERNAME'], 't' => phpbb::$user->lang['SORT_DATE'], 'i' => phpbb::$user->lang['SORT_IP'], 'o' => phpbb::$user->lang['SORT_ACTION']); $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); $limit_time_sql = ($min_time) ? "AND l.log_time >= $min_time" : ''; @@ -764,8 +757,6 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, */ function check_ids(&$ids, $table, $sql_id, $acl_list = false, $single_forum = false) { - global $db, $auth; - if (!is_array($ids) || empty($ids)) { return false; diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index aeb235afa5..2bea0d32cd 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -18,9 +18,9 @@ include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); -$user->setup(array('memberlist', 'groups')); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup(array('memberlist', 'groups')); // Grab data $mode = request_var('mode', ''); @@ -45,12 +45,12 @@ switch ($mode) // Can this user view profiles/memberlist? if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) { - if ($user->data['user_id'] != ANONYMOUS) + if (phpbb::$user->data['user_id'] != ANONYMOUS) { trigger_error('NO_VIEW_USERS'); } - login_box('', ((isset($user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $user->lang['LOGIN_EXPLAIN_MEMBERLIST'])); + login_box('', ((isset(phpbb::$user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? phpbb::$user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : phpbb::$user->lang['LOGIN_EXPLAIN_MEMBERLIST'])); } break; } @@ -74,7 +74,7 @@ switch ($mode) // Display a listing of board admins, moderators include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); - $page_title = $user->lang['THE_TEAM']; + $page_title = phpbb::$user->lang['THE_TEAM']; $template_html = 'memberlist_leaders.html'; $user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false); @@ -162,7 +162,7 @@ switch ($mode) 'LEFT_JOIN' => array( array( 'FROM' => array(USER_GROUP_TABLE => 'ug'), - 'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id'] + 'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . phpbb::$user->data['user_id'] ) ), @@ -221,19 +221,19 @@ switch ($mode) // If the mod is only moderating non-viewable forums we skip the user. There is no gain in displaying the person then... if (!$s_forum_select && $undisclosed_forum) { -// $s_forum_select = '<option value="">' . $user->lang['FORUM_UNDISCLOSED'] . '</option>'; +// $s_forum_select = '<option value="">' . phpbb::$user->lang['FORUM_UNDISCLOSED'] . '</option>'; continue; } // The person is moderating several "public" forums, therefore the person should be listed, but not giving the real group name if hidden. - if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id']) + if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != phpbb::$user->data['user_id']) { - $group_name = $user->lang['GROUP_UNDISCLOSED']; + $group_name = phpbb::$user->lang['GROUP_UNDISCLOSED']; $u_group = ''; } else { - $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $group_name = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']; $u_group = append_sid('memberlist', 'mode=group&g=' . $row['group_id']); } @@ -262,13 +262,13 @@ switch ($mode) $db->sql_freeresult($result); $template->assign_vars(array( - 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE'])) + 'PM_IMG' => phpbb::$user->img('icon_contact_pm', phpbb::$user->lang['SEND_PRIVATE_MESSAGE'])) ); break; case 'contact': - $page_title = $user->lang['IM_USER']; + $page_title = phpbb::$user->lang['IM_USER']; $template_html = 'memberlist_im.html'; if (!$auth->acl_get('u_sendim')) @@ -336,7 +336,7 @@ switch ($mode) include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); - $subject = sprintf($user->lang['IM_JABBER_SUBJECT'], $user->data['username'], phpbb::$config['server_name']); + $subject = sprintf(phpbb::$user->lang['IM_JABBER_SUBJECT'], phpbb::$user->data['username'], phpbb::$config['server_name']); $message = utf8_normalize_nfc(request_var('message', '', true)); if (empty($message)) @@ -349,12 +349,12 @@ switch ($mode) $messenger->template('profile_send_im', $row['user_lang']); $messenger->subject(htmlspecialchars_decode($subject)); - $messenger->replyto($user->data['user_email']); + $messenger->replyto(phpbb::$user->data['user_email']); $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( 'BOARD_CONTACT' => phpbb::$config['board_contact'], - 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), + 'FROM_USERNAME' => htmlspecialchars_decode(phpbb::$user->data['username']), 'TO_USERNAME' => htmlspecialchars_decode($row['username']), 'MESSAGE' => htmlspecialchars_decode($message)) ); @@ -385,8 +385,8 @@ switch ($mode) 'PRESENCE_IMG' => $presence_img, - 'L_SEND_IM_EXPLAIN' => $user->lang['IM_' . $lang], - 'L_IM_SENT_JABBER' => sprintf($user->lang['IM_SENT_JABBER'], $row['username']), + 'L_SEND_IM_EXPLAIN' => phpbb::$user->lang['IM_' . $lang], + 'L_IM_SENT_JABBER' => sprintf(phpbb::$user->lang['IM_SENT_JABBER'], $row['username']), $s_select => true, 'S_IM_ACTION' => $s_action) @@ -442,15 +442,15 @@ switch ($mode) $group_options = ''; while ($row = $db->sql_fetchrow($result)) { - $group_options .= '<option value="' . $row['group_id'] . '"' . (($row['group_id'] == $member['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $group_options .= '<option value="' . $row['group_id'] . '"' . (($row['group_id'] == $member['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } $db->sql_freeresult($result); // What colour is the zebra $sql = 'SELECT friend, foe - FROM ' . ZEBRA_TABLE . " - WHERE zebra_id = $user_id - AND user_id = {$user->data['user_id']}"; + FROM ' . ZEBRA_TABLE . ' + WHERE zebra_id = ' . $user_id . ' + AND user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); @@ -515,7 +515,7 @@ switch ($mode) // We need to check if the module 'zebra' is accessible $zebra_enabled = false; - if ($user->data['user_id'] != $user_id && $user->data['is_registered']) + if (phpbb::$user->data['user_id'] != $user_id && phpbb::$user->is_registered) { include_once(PHPBB_ROOT_PATH . 'includes/functions_module.' . PHP_EXT); $module = new p_master(); @@ -544,10 +544,10 @@ switch ($mode) } $template->assign_vars(array( - 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $member['posts_in_queue']), + 'L_POSTS_IN_QUEUE' => phpbb::$user->lang('NUM_POSTS_IN_QUEUE', $member['posts_in_queue']), - 'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day), - 'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage), + 'POSTS_DAY' => sprintf(phpbb::$user->lang['POST_DAY'], $posts_per_day), + 'POSTS_PCT' => sprintf(phpbb::$user->lang['POST_PCT'], $percentage), 'OCCUPATION' => (!empty($member['user_occ'])) ? censor_text($member['user_occ']) : '', 'INTERESTS' => (!empty($member['user_interests'])) ? censor_text($member['user_interests']) : '', @@ -555,26 +555,26 @@ switch ($mode) 'POSTS_IN_QUEUE'=> $member['posts_in_queue'], 'AVATAR_IMG' => $poster_avatar, - 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), - 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']), - 'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']), - 'ICQ_IMG' => $user->img('icon_contact_icq', $user->lang['ICQ']), - 'AIM_IMG' => $user->img('icon_contact_aim', $user->lang['AIM']), - 'MSN_IMG' => $user->img('icon_contact_msnm', $user->lang['MSNM']), - 'YIM_IMG' => $user->img('icon_contact_yahoo', $user->lang['YIM']), - 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), - 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), + 'PM_IMG' => phpbb::$user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), + 'EMAIL_IMG' => phpbb::$user->img('icon_contact_email', 'EMAIL'), + 'WWW_IMG' => phpbb::$user->img('icon_contact_www', 'WWW'), + 'ICQ_IMG' => phpbb::$user->img('icon_contact_icq', 'ICQ'), + 'AIM_IMG' => phpbb::$user->img('icon_contact_aim', 'AIM'), + 'MSN_IMG' => phpbb::$user->img('icon_contact_msnm', 'MSNM'), + 'YIM_IMG' => phpbb::$user->img('icon_contact_yahoo', 'YIM'), + 'JABBER_IMG' => phpbb::$user->img('icon_contact_jabber', 'JABBER'), + 'SEARCH_IMG' => phpbb::$user->img('icon_user_search', 'SEARCH'), 'S_PROFILE_ACTION' => append_sid('memberlist', 'mode=group'), 'S_GROUP_OPTIONS' => $group_options, 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false, - 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid(phpbb::$base_config['admin_folder'] . '/index', 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', - 'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid('mcp', 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '', - 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid('ucp', "mode=switch_perm&u={$user_id}") : '', - 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid('mcp', 'i=queue', true, $user->session_id) : '', + 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid(phpbb::$base_config['admin_folder'] . '/index', 'i=users&mode=overview&u=' . $user_id, true, phpbb::$user->session_id) : '', + 'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != phpbb::$user->data['user_id']) ? append_sid('mcp', 'i=ban&mode=user&u=' . $user_id, true, phpbb::$user->session_id) : '', + 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && phpbb::$user->data['user_id'] != $user_id) ? append_sid('ucp', "mode=switch_perm&u={$user_id}") : '', + 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid('mcp', 'i=queue', true, phpbb::$user->session_id) : '', - 'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false, + 'S_ZEBRA' => (phpbb::$user->data['user_id'] != $user_id && phpbb::$user->data['is_registered'] && $zebra_enabled) ? true : false, 'U_ADD_FRIEND' => (!$friend) ? append_sid('ucp', 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', 'U_ADD_FOE' => (!$foe) ? append_sid('ucp', 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', 'U_REMOVE_FRIEND' => ($friend) ? append_sid('ucp', 'i=zebra&remove=1&usernames[]=' . $user_id) : '', @@ -597,26 +597,26 @@ switch ($mode) // Inactive reason/account? if ($member['user_type'] == phpbb::USER_INACTIVE) { - $user->add_lang('acp/common'); + phpbb::$user->add_lang('acp/common'); - $inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_UNKNOWN']; switch ($member['user_inactive_reason']) { case INACTIVE_REGISTER: - $inactive_reason = $user->lang['INACTIVE_REASON_REGISTER']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_REGISTER']; break; case INACTIVE_PROFILE: - $inactive_reason = $user->lang['INACTIVE_REASON_PROFILE']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_PROFILE']; break; case INACTIVE_MANUAL: - $inactive_reason = $user->lang['INACTIVE_REASON_MANUAL']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_MANUAL']; break; case INACTIVE_REMIND: - $inactive_reason = $user->lang['INACTIVE_REASON_REMIND']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_REMIND']; break; } @@ -627,7 +627,7 @@ switch ($mode) } // Now generate page title - $page_title = sprintf($user->lang['VIEWING_PROFILE'], $member['username']); + $page_title = sprintf(phpbb::$user->lang['VIEWING_PROFILE'], $member['username']); $template_html = 'memberlist_view.html'; break; @@ -635,7 +635,7 @@ switch ($mode) case 'email': // Send an email - $page_title = $user->lang['SEND_EMAIL']; + $page_title = phpbb::$user->lang['SEND_EMAIL']; $template_html = 'memberlist_email.html'; add_form_key('memberlist_email'); @@ -651,7 +651,7 @@ switch ($mode) } // Are we trying to abuse the facility? - if (time() - $user->data['user_emailtime'] < phpbb::$config['flood_interval']) + if (time() - phpbb::$user->data['user_emailtime'] < phpbb::$config['flood_interval']) { trigger_error('FLOOD_EMAIL_LIMIT'); } @@ -754,12 +754,12 @@ switch ($mode) { if (!$subject) { - $error[] = $user->lang['EMPTY_SUBJECT_EMAIL']; + $error[] = phpbb::$user->lang['EMPTY_SUBJECT_EMAIL']; } if (!$message) { - $error[] = $user->lang['EMPTY_MESSAGE_EMAIL']; + $error[] = phpbb::$user->lang['EMPTY_MESSAGE_EMAIL']; } $name = $row['username']; @@ -770,12 +770,12 @@ switch ($mode) { if (!$email || !preg_match('/^' . get_preg_expression('email') . '$/i', $email)) { - $error[] = $user->lang['EMPTY_ADDRESS_EMAIL']; + $error[] = phpbb::$user->lang['EMPTY_ADDRESS_EMAIL']; } if (!$name) { - $error[] = $user->lang['EMPTY_NAME_EMAIL']; + $error[] = phpbb::$user->lang['EMPTY_NAME_EMAIL']; } } @@ -783,7 +783,7 @@ switch ($mode) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_emailtime = ' . time() . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); @@ -808,13 +808,13 @@ switch ($mode) if ($cc) { $mail_to_users[] = array( - 'email_lang' => $user->data['user_lang'], - 'email' => $user->data['user_email'], - 'name' => $user->data['username'], - 'username' => $user->data['username'], + 'email_lang' => phpbb::$user->data['user_lang'], + 'email' => phpbb::$user->data['user_email'], + 'name' => phpbb::$user->data['username'], + 'username' => phpbb::$user->data['username'], 'to_name' => $name, - 'user_jabber' => $user->data['user_jabber'], - 'user_notify_type' => ($user_id) ? $user->data['user_notify_type'] : NOTIFY_EMAIL, + 'user_jabber' => phpbb::$user->data['user_jabber'], + 'user_notify_type' => ($user_id) ? phpbb::$user->data['user_notify_type'] : NOTIFY_EMAIL, 'topic_title' => (!$user_id) ? $row['topic_title'] : '', 'forum_id' => (!$user_id) ? $row['forum_id'] : 0, ); @@ -823,7 +823,7 @@ switch ($mode) foreach ($mail_to_users as $row) { $messenger->template($email_tpl, $row['email_lang']); - $messenger->replyto($user->data['user_email']); + $messenger->replyto(phpbb::$user->data['user_email']); $messenger->to($row['email'], $row['name']); if ($user_id) @@ -838,14 +838,14 @@ switch ($mode) } $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->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); $messenger->assign_vars(array( 'BOARD_CONTACT' => phpbb::$config['board_contact'], 'TO_USERNAME' => htmlspecialchars_decode($row['to_name']), - 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), + 'FROM_USERNAME' => htmlspecialchars_decode(phpbb::$user->data['username']), 'MESSAGE' => htmlspecialchars_decode($message)) ); @@ -861,8 +861,8 @@ switch ($mode) } meta_refresh(3, append_sid('index')); - $message = ($user_id) ? sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>') : sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$row['forum_id']}&t=$topic_id") . '">', '</a>'); - trigger_error($user->lang['EMAIL_SENT'] . '<br /><br />' . $message); + $message = ($user_id) ? sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>') : sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$row['forum_id']}&t=$topic_id") . '">', '</a>'); + trigger_error(phpbb::$user->lang['EMAIL_SENT'] . '<br /><br />' . $message); } } @@ -872,7 +872,7 @@ switch ($mode) 'S_SEND_USER' => true, 'USERNAME' => $row['username'], - 'L_EMAIL_BODY_EXPLAIN' => $user->lang['EMAIL_BODY_EXPLAIN'], + 'L_EMAIL_BODY_EXPLAIN' => phpbb::$user->lang['EMAIL_BODY_EXPLAIN'], 'S_POST_ACTION' => append_sid('memberlist', 'mode=email&u=' . $user_id)) ); } @@ -883,7 +883,7 @@ switch ($mode) 'NAME' => $name, 'S_LANG_OPTIONS' => language_select($email_lang), - 'L_EMAIL_BODY_EXPLAIN' => $user->lang['EMAIL_TOPIC_EXPLAIN'], + 'L_EMAIL_BODY_EXPLAIN' => phpbb::$user->lang['EMAIL_TOPIC_EXPLAIN'], 'S_POST_ACTION' => append_sid('memberlist', 'mode=email&t=' . $topic_id)) ); } @@ -897,17 +897,17 @@ switch ($mode) case 'group': default: // The basic memberlist - $page_title = $user->lang['MEMBERLIST']; + $page_title = phpbb::$user->lang['MEMBERLIST']; $template_html = 'memberlist_body.html'; // Sorting - $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_LOCATION'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT'], 'e' => $user->lang['SORT_EMAIL'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['JABBER']); + $sort_key_text = array('a' => phpbb::$user->lang['SORT_USERNAME'], 'b' => phpbb::$user->lang['SORT_LOCATION'], 'c' => phpbb::$user->lang['SORT_JOINED'], 'd' => phpbb::$user->lang['SORT_POST_COUNT'], 'e' => phpbb::$user->lang['SORT_EMAIL'], 'f' => phpbb::$user->lang['WEBSITE'], 'g' => phpbb::$user->lang['ICQ'], 'h' => phpbb::$user->lang['AIM'], 'i' => phpbb::$user->lang['MSNM'], 'j' => phpbb::$user->lang['YIM'], 'k' => phpbb::$user->lang['JABBER']); if ($auth->acl_get('u_viewonline')) { - $sort_key_text['l'] = $user->lang['SORT_LAST_ACTIVE']; + $sort_key_text['l'] = phpbb::$user->lang['SORT_LAST_ACTIVE']; } - $sort_key_text['m'] = $user->lang['SORT_RANK']; + $sort_key_text['m'] = phpbb::$user->lang['SORT_RANK']; $sort_key_sql = array('a' => 'u.username_clean', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'e' => 'u.user_email', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_jabber'); @@ -917,7 +917,7 @@ switch ($mode) } $sort_key_sql['m'] = 'u.user_rank'; - $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + $sort_dir_text = array('a' => phpbb::$user->lang['ASCENDING'], 'd' => phpbb::$user->lang['DESCENDING']); $s_sort_key = ''; foreach ($sort_key_text as $key => $value) @@ -969,7 +969,7 @@ switch ($mode) $find_key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); - $find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']); + $find_count = array('lt' => phpbb::$user->lang['LESS_THAN'], 'eq' => phpbb::$user->lang['EQUAL_TO'], 'gt' => phpbb::$user->lang['MORE_THAN']); $s_find_count = ''; foreach ($find_count as $key => $value) { @@ -977,7 +977,7 @@ switch ($mode) $s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; } - $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']); + $find_time = array('lt' => phpbb::$user->lang['BEFORE'], 'gt' => phpbb::$user->lang['AFTER']); $s_find_join_time = ''; foreach ($find_time as $key => $value) { @@ -1088,7 +1088,7 @@ switch ($mode) // We JOIN here to save a query for determining membership for hidden groups. ;) $sql = 'SELECT g.*, ug.user_id FROM ' . GROUPS_TABLE . ' g - LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id'] . " AND ug.group_id = $group_id) + LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.user_pending = 0 AND ug.user_id = ' . phpbb::$user->data['user_id'] . " AND ug.group_id = $group_id) WHERE g.group_id = $group_id"; $result = $db->sql_query($sql); $group_row = $db->sql_fetchrow($result); @@ -1113,7 +1113,7 @@ switch ($mode) $group_row['l_group_type'] = 'HIDDEN'; // Check for membership or special permissions - if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $group_row['user_id'] != $user->data['user_id']) + if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $group_row['user_id'] != phpbb::$user->data['user_id']) { trigger_error('NO_GROUP'); } @@ -1150,9 +1150,9 @@ switch ($mode) $template->assign_vars(array( 'GROUP_DESC' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), - 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], + 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], 'GROUP_COLOR' => $group_row['group_colour'], - 'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']], + 'GROUP_TYPE' => phpbb::$user->lang['GROUP_IS_' . $group_row['l_group_type']], 'GROUP_RANK' => $rank_title, 'AVATAR_IMG' => $avatar_img, @@ -1205,7 +1205,7 @@ switch ($mode) { $s_char_options .= '<option value="' . chr($i) . '"' . (($first_char == chr($i)) ? ' selected="selected"' : '') . '>' . chr($i-32) . '</option>'; } - $s_char_options .= '<option value="other"' . (($first_char == 'other') ? ' selected="selected"' : '') . '>' . $user->lang['OTHER'] . '</option>'; + $s_char_options .= '<option value="other"' . (($first_char == 'other') ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['OTHER'] . '</option>'; // Build a relevant pagination_url $params = $sort_params = array(); @@ -1294,10 +1294,10 @@ switch ($mode) LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON ( g.group_id = ug.group_id - AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND ug.user_pending = 0 ) - WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . phpbb::$user->data['user_id'] . ')'; if (!phpbb::$config['coppa_enable']) { @@ -1311,7 +1311,7 @@ switch ($mode) while ($row = $db->sql_fetchrow($result)) { $group_ids[] = $row['group_id']; - $s_group_select .= '<option value="' . $row['group_id'] . '"' . (($group_selected == $row['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $s_group_select .= '<option value="' . $row['group_id'] . '"' . (($group_selected == $row['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } $db->sql_freeresult($result); @@ -1472,18 +1472,18 @@ switch ($mode) $template->assign_vars(array( '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']), - 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), - 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']), - 'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']), - 'ICQ_IMG' => $user->img('icon_contact_icq', $user->lang['ICQ']), - 'AIM_IMG' => $user->img('icon_contact_aim', $user->lang['AIM']), - 'MSN_IMG' => $user->img('icon_contact_msnm', $user->lang['MSNM']), - 'YIM_IMG' => $user->img('icon_contact_yahoo', $user->lang['YIM']), - 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), - 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), + 'TOTAL_USERS' => ($total_users == 1) ? phpbb::$user->lang['LIST_USER'] : sprintf(phpbb::$user->lang['LIST_USERS'], $total_users), + + 'PROFILE_IMG' => phpbb::$user->img('icon_user_profile', 'PROFILE'), + 'PM_IMG' => phpbb::$user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), + 'EMAIL_IMG' => phpbb::$user->img('icon_contact_email', 'EMAIL'), + 'WWW_IMG' => phpbb::$user->img('icon_contact_www', 'WWW'), + 'ICQ_IMG' => phpbb::$user->img('icon_contact_icq', 'ICQ'), + 'AIM_IMG' => phpbb::$user->img('icon_contact_aim', 'AIM'), + 'MSN_IMG' => phpbb::$user->img('icon_contact_msnm', 'MSNM'), + 'YIM_IMG' => phpbb::$user->img('icon_contact_yahoo', 'YIM'), + 'JABBER_IMG' => phpbb::$user->img('icon_contact_jabber', 'JABBER'), + 'SEARCH_IMG' => phpbb::$user->img('icon_user_search', 'SEARCH'), '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 : '', @@ -1527,8 +1527,6 @@ page_footer(); */ function show_profile($data) { - global $auth, $template, $user; - $username = $data['username']; $user_id = $data['user_id']; @@ -1571,7 +1569,7 @@ function show_profile($data) if ($bday_year) { - $now = getdate(time() + $user->timezone + $user->dst - date('Z')); + $now = getdate(time() + phpbb::$user->timezone + phpbb::$user->dst - date('Z')); $diff = $now['mon'] - $bday_month; if ($diff == 0) @@ -1591,8 +1589,8 @@ function show_profile($data) return array( 'AGE' => $age, 'RANK_TITLE' => $rank_title, - 'JOINED' => $user->format_date($data['user_regdate']), - 'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit), + 'JOINED' => phpbb::$user->format_date($data['user_regdate']), + 'VISITED' => (empty($last_visit)) ? ' - ' : phpbb::$user->format_date($last_visit), 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, @@ -1604,7 +1602,7 @@ 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' => (!phpbb::$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'ONLINE_IMG' => (!phpbb::$config['load_onlinetrack']) ? '' : (($online) ? phpbb::$user->img('icon_user_online', 'ONLINE') : phpbb::$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, @@ -1612,8 +1610,8 @@ function show_profile($data) '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_NOTES' => $auth->acl_getf_global('m_') ? append_sid('mcp', 'i=notes&mode=user_notes&u=' . $user_id, true, phpbb::$user->session_id) : '', + 'U_WARN' => $auth->acl_get('m_warn') ? append_sid('mcp', 'i=warn&mode=warn_user&u=' . $user_id, true, phpbb::$user->session_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'] : '', @@ -1629,9 +1627,9 @@ function show_profile($data) 'USER_YIM' => $data['user_yim'], 'USER_MSN' => $data['user_msnm'], 'USER_JABBER' => $data['user_jabber'], - 'USER_JABBER_IMG' => ($data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '', + 'USER_JABBER_IMG' => ($data['user_jabber']) ? phpbb::$user->img('icon_contact_jabber', $data['user_jabber']) : '', - 'L_VIEWING_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username), + 'L_VIEWING_PROFILE' => sprintf(phpbb::$user->lang['VIEWING_PROFILE'], $username), ); } diff --git a/phpBB/modules/acp/acp_attachments.php b/phpBB/modules/acp/acp_attachments.php index 97c679173d..a0e42d2ef3 100644 --- a/phpBB/modules/acp/acp_attachments.php +++ b/phpBB/modules/acp/acp_attachments.php @@ -26,9 +26,7 @@ class acp_attachments function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); + phpbb::$user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); $error = $notify = array(); $submit = phpbb_request::is_set_post('submit'); @@ -39,7 +37,7 @@ class acp_attachments if ($submit && !check_form_key($form_key)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } switch ($mode) @@ -69,8 +67,8 @@ class acp_attachments $this->page_title = $l_title; $template->assign_vars(array( - 'L_TITLE' => $user->lang[$l_title], - 'L_TITLE_EXPLAIN' => $user->lang[$l_title . '_EXPLAIN'], + 'L_TITLE' => phpbb::$user->lang[$l_title], + 'L_TITLE_EXPLAIN' => phpbb::$user->lang[$l_title . '_EXPLAIN'], 'U_ACTION' => $this->u_action) ); @@ -93,7 +91,7 @@ class acp_attachments } $db->sql_freeresult($result); - $l_legend_cat_images = $user->lang['SETTINGS_CAT_IMAGES'] . ' [' . $user->lang['ASSIGNED_GROUP'] . ': ' . ((!empty($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE])) ? implode(', ', $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : $user->lang['NO_EXT_GROUP']) . ']'; + $l_legend_cat_images = phpbb::$user->lang['SETTINGS_CAT_IMAGES'] . ' [' . phpbb::$user->lang['ASSIGNED_GROUP'] . ': ' . ((!empty($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE])) ? implode(', ', $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : phpbb::$user->lang['NO_EXT_GROUP']) . ']'; $display_vars = array( 'title' => 'ACP_ATTACHMENT_SETTINGS', @@ -120,8 +118,8 @@ class acp_attachments 'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'img_create_thumbnail' => array('lang' => 'CREATE_THUMBNAIL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'img_max_thumb_width' => array('lang' => 'MAX_THUMB_WIDTH', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' px'), - 'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), - 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'string', 'type' => 'text:20:200', 'explain' => true, 'append' => ' <span>[ <a href="' . $this->u_action . '&action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'), + 'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['BYTES']), + 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'string', 'type' => 'text:20:200', 'explain' => true, 'append' => ' <span>[ <a href="' . $this->u_action . '&action=imgmagick">' . phpbb::$user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'), 'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' px'), 'img_link' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' px'), ) @@ -173,7 +171,7 @@ class acp_attachments if (!sizeof($error)) { - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); } } @@ -240,9 +238,9 @@ class acp_attachments 'WARNING_MSG' => implode('<br />', $error), 'DEFINED_IPS' => $defined_ips, - 'L_SECURE_TITLE' => $user->lang['DEFINE_' . $allow_deny . '_IPS'], - 'L_IP_EXCLUDE' => $user->lang['EXCLUDE_FROM_' . $allow_deny . '_IP'], - 'L_REMOVE_IPS' => $user->lang['REMOVE_' . $allow_deny . '_IPS']) + 'L_SECURE_TITLE' => phpbb::$user->lang['DEFINE_' . $allow_deny . '_IPS'], + 'L_IP_EXCLUDE' => phpbb::$user->lang['EXCLUDE_FROM_' . $allow_deny . '_IP'], + 'L_REMOVE_IPS' => phpbb::$user->lang['REMOVE_' . $allow_deny . '_IPS']) ); // Output relevant options @@ -257,7 +255,7 @@ class acp_attachments { $template->assign_block_vars('options', array( 'S_LEGEND' => true, - 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) + 'LEGEND' => (isset(phpbb::$user->lang[$vars])) ? phpbb::$user->lang[$vars] : $vars) ); continue; @@ -268,11 +266,11 @@ class acp_attachments $l_explain = ''; if ($vars['explain'] && isset($vars['lang_explain'])) { - $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; + $l_explain = (isset(phpbb::$user->lang[$vars['lang_explain']])) ? phpbb::$user->lang[$vars['lang_explain']] : $vars['lang_explain']; } else if ($vars['explain']) { - $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; + $l_explain = (isset(phpbb::$user->lang[$vars['lang'] . '_EXPLAIN'])) ? phpbb::$user->lang[$vars['lang'] . '_EXPLAIN'] : ''; } $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); @@ -283,7 +281,7 @@ class acp_attachments $template->assign_block_vars('options', array( 'KEY' => $config_key, - 'TITLE' => $user->lang[$vars['lang']], + 'TITLE' => phpbb::$user->lang[$vars['lang']], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content, @@ -374,7 +372,7 @@ class acp_attachments if ($row = $db->sql_fetchrow($result)) { - $error[] = sprintf($user->lang['EXTENSION_EXIST'], $add_extension); + $error[] = sprintf(phpbb::$user->lang['EXTENSION_EXIST'], $add_extension); } $db->sql_freeresult($result); @@ -393,7 +391,7 @@ class acp_attachments if (!sizeof($error)) { - $notify[] = $user->lang['EXTENSIONS_UPDATED']; + $notify[] = phpbb::$user->lang['EXTENSIONS_UPDATED']; } phpbb::$acm->destroy('extensions'); @@ -453,7 +451,7 @@ class acp_attachments if (!$group_id && $action == 'edit') { - trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($group_id) @@ -467,7 +465,7 @@ class acp_attachments if (!$ext_row) { - trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } } else @@ -480,7 +478,7 @@ class acp_attachments if (!$group_name) { - $error[] = $user->lang['NO_EXT_GROUP_NAME']; + $error[] = phpbb::$user->lang['NO_EXT_GROUP_NAME']; } // Check New Group Name @@ -498,7 +496,7 @@ class acp_attachments { if (utf8_clean_string($row['group_name']) === $clean_group_name) { - $error[] = sprintf($user->lang['EXTENSION_GROUP_EXIST'], $new_group_name); + $error[] = sprintf(phpbb::$user->lang['EXTENSION_GROUP_EXIST'], $new_group_name); break; } } @@ -579,17 +577,17 @@ class acp_attachments if (!sizeof($error)) { - $notify[] = $user->lang['SUCCESS_EXTENSION_GROUP_' . strtoupper($action)]; + $notify[] = phpbb::$user->lang['SUCCESS_EXTENSION_GROUP_' . strtoupper($action)]; } } $cat_lang = array( - ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], - ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], - ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'], - ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], - ATTACHMENT_CATEGORY_QUICKTIME => $user->lang['CAT_QUICKTIME_FILES'], + ATTACHMENT_CATEGORY_NONE => phpbb::$user->lang['NO_FILE_CAT'], + ATTACHMENT_CATEGORY_IMAGE => phpbb::$user->lang['CAT_IMAGES'], + ATTACHMENT_CATEGORY_WM => phpbb::$user->lang['CAT_WM_FILES'], + ATTACHMENT_CATEGORY_RM => phpbb::$user->lang['CAT_RM_FILES'], + ATTACHMENT_CATEGORY_FLASH => phpbb::$user->lang['CAT_FLASH_FILES'], + ATTACHMENT_CATEGORY_QUICKTIME => phpbb::$user->lang['CAT_QUICKTIME_FILES'], ); $group_id = request_var('g', 0); @@ -623,11 +621,11 @@ class acp_attachments phpbb::$acm->destroy('extensions'); - trigger_error($user->lang['EXTENSION_GROUP_DELETED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['EXTENSION_GROUP_DELETED'] . adm_back_link($this->u_action)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'group_id' => $group_id, @@ -641,7 +639,7 @@ class acp_attachments if (!$group_id) { - trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -763,7 +761,7 @@ class acp_attachments 'U_EXTENSIONS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&mode=extensions"), 'U_BACK' => $this->u_action, - 'L_LEGEND' => $user->lang[strtoupper($action) . '_EXTENSION_GROUP']) + 'L_LEGEND' => phpbb::$user->lang[strtoupper($action) . '_EXTENSION_GROUP']) ); $s_forum_id_options = ''; @@ -910,7 +908,7 @@ class acp_attachments $db->sql_query($sql); add_log('admin', 'LOG_ATTACH_ORPHAN_DEL', implode(', ', $delete_files)); - $notify[] = sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode(', ', $delete_files)); + $notify[] = sprintf(phpbb::$user->lang['LOG_ATTACH_ORPHAN_DEL'], implode(', ', $delete_files)); } $upload_list = array(); @@ -963,9 +961,9 @@ class acp_attachments $post_row = $post_info[$upload_list[$row['attach_id']]]; $template->assign_block_vars('upload', array( - 'FILE_INFO' => sprintf($user->lang['UPLOADING_FILE_TO'], $row['real_filename'], $post_row['post_id']), + 'FILE_INFO' => sprintf(phpbb::$user->lang['UPLOADING_FILE_TO'], $row['real_filename'], $post_row['post_id']), 'S_DENIED' => (!$auth->acl_get('f_attach', $post_row['forum_id'])) ? true : false, - 'L_DENIED' => (!$auth->acl_get('f_attach', $post_row['forum_id'])) ? sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) : '') + 'L_DENIED' => (!$auth->acl_get('f_attach', $post_row['forum_id'])) ? sprintf(phpbb::$user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) : '') ); if (!$auth->acl_get('f_attach', $post_row['forum_id'])) @@ -1028,7 +1026,7 @@ class acp_attachments { $template->assign_block_vars('orphan', array( 'FILESIZE' => get_formatted_filesize($row['filesize']), - 'FILETIME' => $user->format_date($row['filetime']), + 'FILETIME' => phpbb::$user->format_date($row['filetime']), 'REAL_FILENAME' => basename($row['real_filename']), 'PHYSICAL_FILENAME' => basename($row['physical_filename']), 'ATTACH_ID' => $row['attach_id'], @@ -1063,15 +1061,13 @@ class acp_attachments */ function category_select($select_name, $group_id = false, $key = '') { - global $db, $user; - $types = array( - ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], - ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], - ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'], - ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], - ATTACHMENT_CATEGORY_QUICKTIME => $user->lang['CAT_QUICKTIME_FILES'], + ATTACHMENT_CATEGORY_NONE => phpbb::$user->lang['NO_FILE_CAT'], + ATTACHMENT_CATEGORY_IMAGE => phpbb::$user->lang['CAT_IMAGES'], + ATTACHMENT_CATEGORY_WM => phpbb::$user->lang['CAT_WM_FILES'], + ATTACHMENT_CATEGORY_RM => phpbb::$user->lang['CAT_RM_FILES'], + ATTACHMENT_CATEGORY_FLASH => phpbb::$user->lang['CAT_FLASH_FILES'], + ATTACHMENT_CATEGORY_QUICKTIME => phpbb::$user->lang['CAT_QUICKTIME_FILES'], ); if ($group_id) @@ -1108,8 +1104,6 @@ class acp_attachments */ function group_select($select_name, $default_group = false, $key = '') { - global $db, $user; - $group_select = '<select name="' . $select_name . '"' . (($key) ? ' id="' . $key . '"' : '') . '>'; $sql = 'SELECT group_id, group_name @@ -1125,7 +1119,7 @@ class acp_attachments $db->sql_freeresult($result); $row['group_id'] = 0; - $row['group_name'] = $user->lang['NOT_ASSIGNED']; + $row['group_name'] = phpbb::$user->lang['NOT_ASSIGNED']; $group_name[] = $row; for ($i = 0; $i < sizeof($group_name); $i++) @@ -1193,8 +1187,6 @@ class acp_attachments */ function test_upload(&$error, $upload_dir, $create_directory = false) { - global $user; - // Does the target directory exist, is it a directory and writable. if ($create_directory) { @@ -1207,19 +1199,19 @@ class acp_attachments if (!file_exists(PHPBB_ROOT_PATH . $upload_dir)) { - $error[] = sprintf($user->lang['NO_UPLOAD_DIR'], $upload_dir); + $error[] = sprintf(phpbb::$user->lang['NO_UPLOAD_DIR'], $upload_dir); return; } if (!is_dir(PHPBB_ROOT_PATH . $upload_dir)) { - $error[] = sprintf($user->lang['UPLOAD_NOT_DIR'], $upload_dir); + $error[] = sprintf(phpbb::$user->lang['UPLOAD_NOT_DIR'], $upload_dir); return; } if (!is_writable(PHPBB_ROOT_PATH . $upload_dir)) { - $error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir); + $error[] = sprintf(phpbb::$user->lang['NO_WRITE_UPLOAD'], $upload_dir); return; } } @@ -1229,8 +1221,6 @@ class acp_attachments */ function perform_site_list() { - global $db, $user; - if (phpbb_request::is_set('securesubmit')) { // Grab the list of entries @@ -1383,7 +1373,7 @@ class acp_attachments add_log('admin', $log_entry, $ip_list_log); } - trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); } else if (phpbb_request::is_set_post('unsecuresubmit')) { @@ -1412,7 +1402,7 @@ class acp_attachments add_log('admin', 'LOG_DOWNLOAD_REMOVE_IP', $l_unip_list); } - trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); } } diff --git a/phpBB/modules/acp/acp_ban.php b/phpBB/modules/acp/acp_ban.php index 60f38c8e77..8946da6ee5 100644 --- a/phpBB/modules/acp/acp_ban.php +++ b/phpBB/modules/acp/acp_ban.php @@ -25,22 +25,20 @@ class acp_ban function main($id, $mode) { - global $db, $user, $auth, $template; - include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $bansubmit = phpbb_request::is_set_post('bansubmit'); $unbansubmit = phpbb_request::is_set_post('unbansubmit'); $current_time = time(); - $user->add_lang(array('acp/ban', 'acp/users')); + phpbb::$user->add_lang(array('acp/ban', 'acp/users')); $this->tpl_name = 'acp_ban'; $form_key = 'acp_ban'; add_form_key($form_key); if (($bansubmit || $unbansubmit) && !check_form_key($form_key)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } // Ban submitted? @@ -58,7 +56,7 @@ class acp_ban { user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason); - trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action)); } } else if ($unbansubmit) @@ -69,31 +67,31 @@ class acp_ban { user_unban($mode, $ban); - trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action)); } } // Define language vars - $this->page_title = $user->lang[strtoupper($mode) . '_BAN']; + $this->page_title = phpbb::$user->lang[strtoupper($mode) . '_BAN']; - $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN']; - $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN']; - $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN']; - $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN']; - $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED']; + $l_ban_explain = phpbb::$user->lang[strtoupper($mode) . '_BAN_EXPLAIN']; + $l_ban_exclude_explain = phpbb::$user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN']; + $l_unban_title = phpbb::$user->lang[strtoupper($mode) . '_UNBAN']; + $l_unban_explain = phpbb::$user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN']; + $l_no_ban_cell = phpbb::$user->lang[strtoupper($mode) . '_NO_BANNED']; switch ($mode) { case 'user': - $l_ban_cell = $user->lang['USERNAME']; + $l_ban_cell = phpbb::$user->lang['USERNAME']; break; case 'ip': - $l_ban_cell = $user->lang['IP_HOSTNAME']; + $l_ban_cell = phpbb::$user->lang['IP_HOSTNAME']; break; case 'email': - $l_ban_cell = $user->lang['EMAIL_ADDRESS']; + $l_ban_cell = phpbb::$user->lang['EMAIL_ADDRESS']; break; } @@ -120,10 +118,8 @@ class acp_ban */ static function display_ban_options($mode) { - global $user, $db, $template; - // Ban length options - $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -> '); + $ban_end_text = array(0 => phpbb::$user->lang['PERMANENT'], 30 => phpbb::$user->lang['30_MINS'], 60 => phpbb::$user->lang['1_HOUR'], 360 => phpbb::$user->lang['6_HOURS'], 1440 => phpbb::$user->lang['1_DAY'], 10080 => phpbb::$user->lang['7_DAYS'], 20160 => phpbb::$user->lang['2_WEEKS'], 40320 => phpbb::$user->lang['1_MONTH'], -1 => phpbb::$user->lang['UNTIL'] . ' -> '); $ban_end_options = ''; foreach ($ban_end_text as $length => $text) @@ -136,7 +132,7 @@ class acp_ban case 'user': $field = 'username'; - $l_ban_cell = $user->lang['USERNAME']; + $l_ban_cell = phpbb::$user->lang['USERNAME']; $sql = 'SELECT b.*, u.user_id, u.username, u.username_clean FROM ' . BANLIST_TABLE . ' b, ' . USERS_TABLE . ' u @@ -149,7 +145,7 @@ class acp_ban case 'ip': $field = 'ban_ip'; - $l_ban_cell = $user->lang['IP_HOSTNAME']; + $l_ban_cell = phpbb::$user->lang['IP_HOSTNAME']; $sql = 'SELECT * FROM ' . BANLIST_TABLE . ' @@ -161,7 +157,7 @@ class acp_ban case 'email': $field = 'ban_email'; - $l_ban_cell = $user->lang['EMAIL_ADDRESS']; + $l_ban_cell = phpbb::$user->lang['EMAIL_ADDRESS']; $sql = 'SELECT * FROM ' . BANLIST_TABLE . ' @@ -180,7 +176,7 @@ class acp_ban $banned_options .= '<option' . (($row['ban_exclude']) ? ' class="sep"' : '') . ' value="' . $row['ban_id'] . '">' . $row[$field] . '</option>'; $time_length = ($row['ban_end']) ? ($row['ban_end'] - $row['ban_start']) / 60 : 0; - $ban_length[$row['ban_id']] = (isset($ban_end_text[$time_length])) ? $ban_end_text[$time_length] : $user->lang['UNTIL'] . ' -> ' . $user->format_date($row['ban_end']); + $ban_length[$row['ban_id']] = (isset($ban_end_text[$time_length])) ? $ban_end_text[$time_length] : phpbb::$user->lang['UNTIL'] . ' -> ' . phpbb::$user->format_date($row['ban_end']); $ban_reasons[$row['ban_id']] = $row['ban_reason']; $ban_give_reasons[$row['ban_id']] = $row['ban_give_reason']; diff --git a/phpBB/modules/acp/acp_bbcodes.php b/phpBB/modules/acp/acp_bbcodes.php index cd10558261..27afddae23 100644 --- a/phpBB/modules/acp/acp_bbcodes.php +++ b/phpBB/modules/acp/acp_bbcodes.php @@ -25,9 +25,7 @@ class acp_bbcodes function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/posting'); + phpbb::$user->add_lang('acp/posting'); // Set up general vars $action = request_var('action', ''); @@ -57,7 +55,7 @@ class acp_bbcodes if (!$row) { - trigger_error($user->lang['BBCODE_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BBCODE_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } $bbcode_match = $row['bbcode_match']; @@ -76,7 +74,7 @@ class acp_bbcodes if (!$row) { - trigger_error($user->lang['BBCODE_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BBCODE_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } // No break here @@ -101,14 +99,14 @@ class acp_bbcodes 'U_BACK' => $this->u_action, 'U_ACTION' => $this->u_action . '&action=' . (($action == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&bbcode=$bbcode_id" : ''), - 'L_BBCODE_USAGE_EXPLAIN'=> sprintf($user->lang['BBCODE_USAGE_EXPLAIN'], '<a href="#down">', '</a>'), + 'L_BBCODE_USAGE_EXPLAIN'=> sprintf(phpbb::$user->lang['BBCODE_USAGE_EXPLAIN'], '<a href="#down">', '</a>'), 'BBCODE_MATCH' => $bbcode_match, 'BBCODE_TPL' => $bbcode_tpl, 'BBCODE_HELPLINE' => $bbcode_helpline, 'DISPLAY_ON_POSTING' => $display_on_posting) ); - foreach ($user->lang['tokens'] as $token => $token_explain) + foreach (phpbb::$user->lang['tokens'] as $token => $token_explain) { $template->assign_block_vars('token', array( 'TOKEN' => '{' . $token . '}', @@ -140,7 +138,7 @@ class acp_bbcodes // Grab the end, interrogate the last closing tag if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded))) { - trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -155,23 +153,23 @@ class acp_bbcodes if (!preg_match('%\\[' . $test . '[^]]*].*?\\[/' . $test . ']%s', $bbcode_match)) { - trigger_error($user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING); } if (strlen($data['bbcode_tag']) > 16) { - trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); } if (strlen($bbcode_match) > 4000) { - trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); } if (strlen($bbcode_helpline) > 255) { - trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql_ary = array( @@ -211,7 +209,7 @@ class acp_bbcodes if ($bbcode_id > 1511) { - trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql_ary['bbcode_id'] = (int) $bbcode_id; @@ -236,7 +234,7 @@ class acp_bbcodes add_log('admin', $log_action, $data['bbcode_tag']); - trigger_error($user->lang[$lang] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang[$lang] . adm_back_link($this->u_action)); break; @@ -259,7 +257,7 @@ class acp_bbcodes } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'bbcode' => $bbcode_id, 'i' => $id, 'mode' => $mode, @@ -420,8 +418,7 @@ class acp_bbcodes if (!preg_match('/^[a-zA-Z0-9_-]+=?$/', $bbcode_tag)) { - global $user; - trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } $fp_match = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $fp_match); diff --git a/phpBB/modules/acp/acp_board.php b/phpBB/modules/acp/acp_board.php index bc2dc2821c..beb6009cf9 100644 --- a/phpBB/modules/acp/acp_board.php +++ b/phpBB/modules/acp/acp_board.php @@ -27,9 +27,7 @@ class acp_board function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/board'); + phpbb::$user->add_lang('acp/board'); $action = request_var('action', ''); $submit = phpbb_request::is_set_post('submit'); @@ -62,7 +60,7 @@ class acp_board 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'WARNINGS', - 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['DAYS']), ) ); break; @@ -106,9 +104,9 @@ class acp_board 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), - 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), - 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['BYTES']), + 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['PIXEL']), + 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['PIXEL']), 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true), 'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true) ) @@ -125,7 +123,7 @@ class acp_board 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), - 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['MINUTES']), 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), 'legend2' => 'GENERAL_OPTIONS', @@ -162,9 +160,9 @@ class acp_board 'enable_queue_trigger' => array('lang' => 'ENABLE_QUEUE_TRIGGER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'queue_trigger_posts' => array('lang' => 'QUEUE_TRIGGER_POSTS', 'validate' => 'int:0:250', 'type' => 'text:4:4', 'explain' => true), 'bump_type' => false, - 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['MINUTES']), 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['SECONDS']), 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), @@ -175,8 +173,8 @@ class acp_board 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'), 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), - 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), - 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['PIXEL']), + 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['PIXEL']), ) ); break; @@ -198,8 +196,8 @@ class acp_board 'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'), 'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), - 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), - 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['PIXEL']), + 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['PIXEL']), ) ); break; @@ -217,7 +215,7 @@ class acp_board 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), - 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['DAYS']), 'legend2' => 'GENERAL_OPTIONS', 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), @@ -253,9 +251,9 @@ class acp_board 'vars' => array( 'legend1' => 'GENERAL_SETTINGS', 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true), - 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60', 'type' => 'text:5:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60', 'type' => 'text:5:10', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['SECONDS']), 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), - 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0', 'type' => 'text:4:3', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0', 'type' => 'text:4:3', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['MINUTES']), 'legend2' => 'GENERAL_OPTIONS', 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), @@ -317,7 +315,7 @@ class acp_board 'vars' => array( 'legend1' => 'ACP_SECURITY_SETTINGS', 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['DAYS']), 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), @@ -325,10 +323,10 @@ class acp_board 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), - 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['DAYS']), 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), 'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . phpbb::$user->lang['SECONDS']), 'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), ) @@ -367,7 +365,7 @@ class acp_board if (isset($display_vars['lang'])) { - $user->add_lang($display_vars['lang']); + phpbb::$user->add_lang($display_vars['lang']); } $this->new_config = phpbb::$config; @@ -379,7 +377,7 @@ class acp_board if ($submit && !check_form_key($form_key)) { - $error[] = $user->lang['FORM_INVALID']; + $error[] = phpbb::$user->lang['FORM_INVALID']; } // Do not write values if there is an error if (sizeof($error)) @@ -510,15 +508,15 @@ class acp_board { add_log('admin', 'LOG_CONFIG_' . strtoupper($mode)); - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); } $this->tpl_name = 'acp_board'; $this->page_title = $display_vars['title']; $template->assign_vars(array( - 'L_TITLE' => $user->lang[$display_vars['title']], - 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], + 'L_TITLE' => phpbb::$user->lang[$display_vars['title']], + 'L_TITLE_EXPLAIN' => phpbb::$user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => (sizeof($error)) ? true : false, 'ERROR_MSG' => implode('<br />', $error), @@ -538,7 +536,7 @@ class acp_board { $template->assign_block_vars('options', array( 'S_LEGEND' => true, - 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) + 'LEGEND' => (isset(phpbb::$user->lang[$vars])) ? phpbb::$user->lang[$vars] : $vars) ); continue; @@ -549,11 +547,11 @@ class acp_board $l_explain = ''; if ($vars['explain'] && isset($vars['lang_explain'])) { - $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; + $l_explain = (isset(phpbb::$user->lang[$vars['lang_explain']])) ? phpbb::$user->lang[$vars['lang_explain']] : $vars['lang_explain']; } else if ($vars['explain']) { - $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; + $l_explain = (isset(phpbb::$user->lang[$vars['lang'] . '_EXPLAIN'])) ? phpbb::$user->lang[$vars['lang'] . '_EXPLAIN'] : ''; } $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); @@ -565,7 +563,7 @@ class acp_board $template->assign_block_vars('options', array( 'KEY' => $config_key, - 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'], + 'TITLE' => (isset(phpbb::$user->lang[$vars['lang']])) ? phpbb::$user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content, @@ -641,14 +639,12 @@ class acp_board */ function mail_auth_select($selected_method, $key = '') { - global $user; - $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); $s_smtp_auth_options = ''; foreach ($auth_methods as $method) { - $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>'; + $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>'; } return $s_smtp_auth_options; @@ -659,9 +655,7 @@ class acp_board */ function full_folder_select($value, $key = '') { - global $user; - - return '<option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . $user->lang['DELETE_OLDEST_MESSAGES'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . $user->lang['HOLD_NEW_MESSAGES_SHORT'] . '</option>'; + return '<option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['DELETE_OLDEST_MESSAGES'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['HOLD_NEW_MESSAGES_SHORT'] . '</option>'; } /** @@ -689,8 +683,6 @@ class acp_board */ function select_acc_activation($value, $key = '') { - global $user; - $radio_ary = array(USER_ACTIVATION_DISABLE => 'ACC_DISABLE', USER_ACTIVATION_NONE => 'ACC_NONE'); if (phpbb::$config['email_enable']) { @@ -705,9 +697,7 @@ class acp_board */ function username_length($value, $key = '') { - global $user; - - return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $this->new_config['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS']; + return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . phpbb::$user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $this->new_config['max_name_chars'] . '" /> ' . phpbb::$user->lang['MAX_CHARS']; } /** @@ -715,14 +705,12 @@ class acp_board */ function select_username_chars($selected_value, $key) { - global $user; - $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII'); $user_char_options = ''; foreach ($user_char_ary as $user_type) { $selected = ($selected_value == $user_type) ? ' selected="selected"' : ''; - $user_char_options .= '<option value="' . $user_type . '"' . $selected . '>' . $user->lang[$user_type] . '</option>'; + $user_char_options .= '<option value="' . $user_type . '"' . $selected . '>' . phpbb::$user->lang[$user_type] . '</option>'; } return $user_char_options; @@ -733,9 +721,7 @@ class acp_board */ function password_length($value, $key) { - global $user; - - return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $this->new_config['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS']; + return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . phpbb::$user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $this->new_config['max_pass_chars'] . '" /> ' . phpbb::$user->lang['MAX_CHARS']; } /** @@ -743,14 +729,12 @@ class acp_board */ function select_password_chars($selected_value, $key) { - global $user; - $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL'); $pass_char_options = ''; foreach ($pass_type_ary as $pass_type) { $selected = ($selected_value == $pass_type) ? ' selected="selected"' : ''; - $pass_char_options .= '<option value="' . $pass_type . '"' . $selected . '>' . $user->lang[$pass_type] . '</option>'; + $pass_char_options .= '<option value="' . $pass_type . '"' . $selected . '>' . phpbb::$user->lang[$pass_type] . '</option>'; } return $pass_char_options; @@ -761,14 +745,12 @@ class acp_board */ function bump_interval($value, $key) { - global $user; - $s_bump_type = ''; $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); foreach ($types as $type => $lang) { $selected = ($this->new_config['bump_type'] == $type) ? ' selected="selected"' : ''; - $s_bump_type .= '<option value="' . $type . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; + $s_bump_type .= '<option value="' . $type . '"' . $selected . '>' . phpbb::$user->lang[$lang] . '</option>'; } return '<input id="' . $key . '" type="text" size="3" maxlength="4" name="config[bump_interval]" value="' . $value . '" /> <select name="config[bump_type]">' . $s_bump_type . '</select>'; @@ -779,8 +761,6 @@ class acp_board */ function board_disable($value, $key) { - global $user; - $radio_ary = array(1 => 'YES', 0 => 'NO'); return h_radio('config[board_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $this->new_config['board_disable_msg'] . '" />'; @@ -791,34 +771,32 @@ class acp_board */ function dateformat_select($value, $key) { - global $user; - // Let the format_date function operate with the acp values - $old_tz = $user->timezone; - $old_dst = $user->dst; + $old_tz = phpbb::$user->timezone; + $old_dst = phpbb::$user->dst; - $user->timezone = phpbb::$config['board_timezone']; - $user->dst = phpbb::$config['board_dst']; + phpbb::$user->timezone = phpbb::$config['board_timezone']; + phpbb::$user->dst = phpbb::$config['board_dst']; $dateformat_options = ''; - foreach ($user->lang['dateformats'] as $format => $null) + foreach (phpbb::$user->lang['dateformats'] as $format => $null) { $dateformat_options .= '<option value="' . $format . '"' . (($format == $value) ? ' selected="selected"' : '') . '>'; - $dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : ''); + $dateformat_options .= phpbb::$user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? phpbb::$user->lang['VARIANT_DATE_SEPARATOR'] . phpbb::$user->format_date(time(), $format, true) : ''); $dateformat_options .= '</option>'; } $dateformat_options .= '<option value="custom"'; - if (!isset($user->lang['dateformats'][$value])) + if (!isset(phpbb::$user->lang['dateformats'][$value])) { $dateformat_options .= ' selected="selected"'; } - $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; + $dateformat_options .= '>' . phpbb::$user->lang['CUSTOM_DATEFORMAT'] . '</option>'; // Reset users date options - $user->timezone = $old_tz; - $user->dst = $old_dst; + phpbb::$user->timezone = $old_tz; + phpbb::$user->dst = $old_dst; return "<select name=\"dateoptions\" id=\"dateoptions\" onchange=\"if (this.value == 'custom') { document.getElementById('" . addslashes($key) . "').value = '" . addslashes($value) . "'; } else { document.getElementById('" . addslashes($key) . "').value = this.value; }\">$dateformat_options</select> <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />"; diff --git a/phpBB/modules/acp/acp_bots.php b/phpBB/modules/acp/acp_bots.php index f4d78e7cc9..fd18d105e9 100644 --- a/phpBB/modules/acp/acp_bots.php +++ b/phpBB/modules/acp/acp_bots.php @@ -25,8 +25,6 @@ class acp_bots function main($id, $mode) { - global $db, $user, $auth, $template; - $action = request_var('action', ''); $submit = phpbb_request::is_set_post('submit'); $mark = request_var('mark', array(0)); @@ -39,7 +37,7 @@ class acp_bots $error = array(); - $user->add_lang('acp/bots'); + phpbb::$user->add_lang('acp/bots'); $this->tpl_name = 'acp_bots'; $this->page_title = 'ACP_BOTS'; $form_key = 'acp_bots'; @@ -47,7 +45,7 @@ class acp_bots if ($submit && !check_form_key($form_key)) { - $error[] = $user->lang['FORM_INVALID']; + $error[] = phpbb::$user->lang['FORM_INVALID']; } // User wants to do something, how inconsiderate of them! @@ -124,11 +122,11 @@ class acp_bots phpbb::$acm->destroy('bots'); add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary)); - trigger_error($user->lang['BOT_DELETED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['BOT_DELETED'] . adm_back_link($this->u_action)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'mark' => $mark, 'id' => $bot_id, 'mode' => $mode, @@ -155,14 +153,14 @@ class acp_bots { if (!$bot_row['bot_agent'] && !$bot_row['bot_ip']) { - $error[] = $user->lang['ERR_BOT_NO_MATCHES']; + $error[] = phpbb::$user->lang['ERR_BOT_NO_MATCHES']; } if ($bot_row['bot_ip'] && !preg_match('#^[\d\.,:]+$#', $bot_row['bot_ip'])) { if (!$ip_list = gethostbynamel($bot_row['bot_ip'])) { - $error[] = $user->lang['ERR_BOT_NO_IP']; + $error[] = phpbb::$user->lang['ERR_BOT_NO_IP']; } else { @@ -172,9 +170,9 @@ class acp_bots $bot_row['bot_ip'] = str_replace(' ', '', $bot_row['bot_ip']); // Make sure the admin is not adding a bot with an user agent similar to his one - if ($bot_row['bot_agent'] && substr($user->data['session_browser'], 0, 149) === substr($bot_row['bot_agent'], 0, 149)) + if ($bot_row['bot_agent'] && substr(phpbb::$user->data['session_browser'], 0, 149) === substr($bot_row['bot_agent'], 0, 149)) { - $error[] = $user->lang['ERR_BOT_AGENT_MATCHES_UA']; + $error[] = phpbb::$user->lang['ERR_BOT_AGENT_MATCHES_UA']; } $bot_name = false; @@ -190,7 +188,7 @@ class acp_bots if (!$bot_row) { - $error[] = $user->lang['NO_BOT']; + $error[] = phpbb::$user->lang['NO_BOT']; } else { @@ -199,7 +197,7 @@ class acp_bots } if (!$this->validate_botname($bot_row['bot_name'], $bot_name)) { - $error[] = $user->lang['BOT_NAME_TAKEN']; + $error[] = phpbb::$user->lang['BOT_NAME_TAKEN']; } if (!sizeof($error)) @@ -217,7 +215,7 @@ class acp_bots if (!$group_row) { - trigger_error($user->lang['NO_BOT_GROUP'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_BOT_GROUP'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); } @@ -256,7 +254,7 @@ class acp_bots if (!$row) { - trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); } $sql_ary = array( @@ -293,7 +291,7 @@ class acp_bots phpbb::$acm->destroy('bots'); add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']); - trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['BOT_' . $log] . adm_back_link($this->u_action)); } } @@ -309,7 +307,7 @@ class acp_bots if (!$bot_row) { - trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); } $bot_row['bot_lang'] = $bot_row['user_lang']; @@ -322,7 +320,7 @@ class acp_bots foreach ($_options as $value => $lang) { $selected = ($bot_row['bot_active'] == $value) ? ' selected="selected"' : ''; - $s_active_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; + $s_active_options .= '<option value="' . $value . '"' . $selected . '>' . phpbb::$user->lang[$lang] . '</option>'; } $style_select = style_select($bot_row['bot_style'], true); @@ -331,7 +329,7 @@ class acp_bots $l_title = ($action == 'edit') ? 'EDIT' : 'ADD'; $template->assign_vars(array( - 'L_TITLE' => $user->lang['BOT_' . $l_title], + 'L_TITLE' => phpbb::$user->lang['BOT_' . $l_title], 'U_ACTION' => $this->u_action . "&id=$bot_id&action=$action", 'U_BACK' => $this->u_action, 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', @@ -357,7 +355,7 @@ class acp_bots $_options = array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE'); foreach ($_options as $value => $lang) { - $s_options .= '<option value="' . $value . '">' . $user->lang[$lang] . '</option>'; + $s_options .= '<option value="' . $value . '">' . phpbb::$user->lang[$lang] . '</option>'; } $template->assign_vars(array( @@ -379,10 +377,10 @@ class acp_bots $template->assign_block_vars('bots', array( 'BOT_NAME' => $row['bot_name'], 'BOT_ID' => $row['bot_id'], - 'LAST_VISIT' => ($row['user_lastvisit']) ? $user->format_date($row['user_lastvisit']) : $user->lang['BOT_NEVER'], + 'LAST_VISIT' => ($row['user_lastvisit']) ? phpbb::$user->format_date($row['user_lastvisit']) : phpbb::$user->lang['BOT_NEVER'], 'U_ACTIVATE_DEACTIVATE' => $this->u_action . "&id={$row['bot_id']}&action=$active_value", - 'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang], + 'L_ACTIVATE_DEACTIVATE' => phpbb::$user->lang[$active_lang], 'U_EDIT' => $this->u_action . "&id={$row['bot_id']}&action=edit", 'U_DELETE' => $this->u_action . "&id={$row['bot_id']}&action=delete") ); @@ -395,8 +393,6 @@ class acp_bots */ function validate_botname($newname, $oldname = false) { - global $db; - if ($oldname && utf8_clean_string($newname) === $oldname) { return true; diff --git a/phpBB/modules/acp/acp_captcha.php b/phpBB/modules/acp/acp_captcha.php index 2eedf4da7c..df265ee877 100644 --- a/phpBB/modules/acp/acp_captcha.php +++ b/phpBB/modules/acp/acp_captcha.php @@ -26,9 +26,7 @@ class acp_captcha function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/board'); + phpbb::$user->add_lang('acp/board'); include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT); @@ -83,14 +81,14 @@ class acp_captcha } else { - trigger_error($user->lang['CAPTCHA_UNAVAILABLE'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['CAPTCHA_UNAVAILABLE'] . adm_back_link($this->u_action)); } } - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); } else if ($submit) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link()); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link()); } else { @@ -98,18 +96,18 @@ class acp_captcha foreach ($captchas['available'] as $value => $title) { $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : ''; - $captcha_select .= '<option value="' . $value . '"' . $current . '>' . $user->lang[$title] . '</option>'; + $captcha_select .= '<option value="' . $value . '"' . $current . '>' . phpbb::$user->lang[$title] . '</option>'; } foreach ($captchas['unavailable'] as $value => $title) { - $captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option" >' . $user->lang[$title] . '</option>'; + $captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option" >' . phpbb::$user->lang[$title] . '</option>'; } $demo_captcha = phpbb_captcha_factory::get_instance($selected); foreach ($config_vars as $config_var => $template_var) { - $template->assign_var($template_var, request_var($config_var, $config[$config_var])) ; + $template->assign_var($template_var, request_var($config_var, phpbb::$config[$config_var])) ; } $template->assign_vars(array( @@ -127,8 +125,6 @@ class acp_captcha */ function deliver_demo($selected) { - global $db, $user; - $captcha = phpbb_captcha_factory::get_instance($selected); $captcha->init(CONFIRM_REG); $captcha->execute_demo(); diff --git a/phpBB/modules/acp/acp_database.php b/phpBB/modules/acp/acp_database.php index 1b4a08df84..80672f6033 100644 --- a/phpBB/modules/acp/acp_database.php +++ b/phpBB/modules/acp/acp_database.php @@ -25,9 +25,7 @@ class acp_database function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/database'); + phpbb::$user->add_lang('acp/database'); $this->tpl_name = 'acp_database'; $this->page_title = 'ACP_DATABASE'; @@ -55,7 +53,7 @@ class acp_database if (!sizeof($table)) { - trigger_error($user->lang['TABLE_SELECT_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['TABLE_SELECT_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); } $store = $download = $structure = $schema_data = false; @@ -166,7 +164,7 @@ class acp_database exit; } - trigger_error($user->lang['BACKUP_SUCCESS'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['BACKUP_SUCCESS'] . adm_back_link($this->u_action)); break; default: @@ -221,14 +219,14 @@ class acp_database if (!preg_match('#^backup_\d{10,}_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches)) { - trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } $file_name = PHPBB_ROOT_PATH . 'store/' . $matches[0]; if (!file_exists($file_name) || !is_readable($file_name)) { - trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($delete) @@ -237,11 +235,11 @@ class acp_database { unlink($file_name); add_log('admin', 'LOG_DB_DELETE'); - trigger_error($user->lang['BACKUP_DELETE'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['BACKUP_DELETE'] . adm_back_link($this->u_action)); } else { - confirm_box(false, $user->lang['DELETE_SELECTED_BACKUP'], build_hidden_fields(array('delete' => $delete, 'file' => $file))); + confirm_box(false, phpbb::$user->lang['DELETE_SELECTED_BACKUP'], build_hidden_fields(array('delete' => $delete, 'file' => $file))); } } else @@ -371,7 +369,7 @@ class acp_database { if ($sub === false) { - trigger_error($user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); } pg_put_line($db->db_connect_id, $sub . "\n"); } @@ -402,7 +400,7 @@ class acp_database phpbb::$acm->purge(); add_log('admin', 'LOG_DB_RESTORE'); - trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action)); break; } @@ -612,8 +610,6 @@ class mysql_extractor extends base_extractor function write_table($table_name) { - global $db; - $sql = 'SHOW CREATE TABLE ' . $table_name; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); @@ -627,7 +623,6 @@ class mysql_extractor extends base_extractor function write_data($table_name) { - global $db; if ($db->sql_layer === 'mysqli') { $this->write_data_mysqli($table_name); @@ -640,7 +635,6 @@ class mysql_extractor extends base_extractor function write_data_mysqli($table_name) { - global $db; $sql = "SELECT * FROM $table_name"; $result = mysqli_query($db->db_connect_id, $sql, MYSQLI_USE_RESULT); @@ -719,7 +713,6 @@ class mysql_extractor extends base_extractor function write_data_mysql($table_name) { - global $db; $sql = "SELECT * FROM $table_name"; $result = mysql_unbuffered_query($sql, $db->db_connect_id); @@ -820,7 +813,6 @@ class sqlite_extractor extends base_extractor function write_table($table_name) { - global $db; $sql_data = '-- Table: ' . $table_name . "\n"; $sql_data .= "DROP TABLE $table_name;\n"; @@ -869,7 +861,6 @@ class sqlite_extractor extends base_extractor function write_data($table_name) { - global $db; static $proper; if (is_null($proper)) @@ -959,7 +950,6 @@ class postgres_extractor extends base_extractor function write_table($table_name) { - global $db; static $domains_created = array(); $sql = "SELECT a.domain_name, a.data_type, a.character_maximum_length, a.domain_default @@ -1157,7 +1147,6 @@ class postgres_extractor extends base_extractor function write_data($table_name) { - global $db; // Grab all of the data from current table. $sql = "SELECT * FROM $table_name"; @@ -1259,7 +1248,6 @@ class mssql_extractor extends base_extractor function write_table($table_name) { - global $db; $sql_data = '-- Table: ' . $table_name . "\n"; $sql_data .= "IF OBJECT_ID(N'$table_name', N'U') IS NOT NULL\n"; $sql_data .= "DROP TABLE $table_name;\n"; @@ -1368,8 +1356,6 @@ class mssql_extractor extends base_extractor function write_data($table_name) { - global $db; - if ($db->sql_layer === 'mssql') { $this->write_data_mssql($table_name); @@ -1387,7 +1373,6 @@ class mssql_extractor extends base_extractor function write_data_mssql($table_name) { - global $db; $ary_type = $ary_name = array(); $ident_set = false; $sql_data = ''; @@ -1481,7 +1466,6 @@ class mssql_extractor extends base_extractor function write_data_odbc($table_name) { - global $db; $ary_type = $ary_name = array(); $ident_set = false; $sql_data = ''; @@ -1594,7 +1578,6 @@ class db2_extractor extends base_extractor function write_table($table_name) { - global $db; $sql_data = '-- Table: ' . $table_name . "\n"; $sql_data .= "\nCREATE TABLE $table_name (\n"; $rows = array(); @@ -1676,7 +1659,6 @@ class db2_extractor extends base_extractor function write_data($table_name) { - global $db; $ary_type = $ary_name = array(); $result = db2_columns($db->db_connect_id, '', '%', $table_name); $i = 0; @@ -1753,7 +1735,6 @@ class oracle_extractor extends base_extractor { function write_table($table_name) { - global $db; $sql_data = '-- Table: ' . $table_name . "\n"; $sql_data .= "DROP TABLE $table_name;\n"; $sql_data .= '\\' . "\n"; @@ -1869,7 +1850,6 @@ class oracle_extractor extends base_extractor function write_data($table_name) { - global $db; $ary_type = $ary_name = array(); // Grab all of the data from current table. @@ -1965,7 +1945,6 @@ class firebird_extractor extends base_extractor function write_data($table_name) { - global $db; $ary_type = $ary_name = array(); // Grab all of the data from current table. @@ -2034,8 +2013,6 @@ class firebird_extractor extends base_extractor function write_table($table_name) { - global $db; - $sql_data = '-- Table: ' . $table_name . "\n"; $sql_data .= "DROP TABLE $table_name;\n"; diff --git a/phpBB/modules/acp/acp_disallow.php b/phpBB/modules/acp/acp_disallow.php index 5f3797ba29..37317c7d2c 100644 --- a/phpBB/modules/acp/acp_disallow.php +++ b/phpBB/modules/acp/acp_disallow.php @@ -25,11 +25,9 @@ class acp_disallow function main($id, $mode) { - global $db, $user, $auth, $template; - include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); - $user->add_lang('acp/posting'); + phpbb::$user->add_lang('acp/posting'); // Set up general vars $this->tpl_name = 'acp_disallow'; @@ -43,7 +41,7 @@ class acp_disallow if (($allow || $disallow) && !check_form_key($form_key)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($disallow) @@ -52,7 +50,7 @@ class acp_disallow if (!$disallowed_user) { - trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user)); @@ -60,7 +58,7 @@ class acp_disallow phpbb::$acm->destroy('disallowed_usernames'); - $message = $user->lang['DISALLOW_SUCCESSFUL']; + $message = phpbb::$user->lang['DISALLOW_SUCCESSFUL']; add_log('admin', 'LOG_DISALLOW_ADD', str_replace('%', '*', $disallowed_user)); trigger_error($message . adm_back_link($this->u_action)); @@ -71,7 +69,7 @@ class acp_disallow if (!$disallowed_id) { - trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'DELETE FROM ' . DISALLOW_TABLE . ' @@ -82,7 +80,7 @@ class acp_disallow add_log('admin', 'LOG_DISALLOW_DELETE'); - trigger_error($user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action)); } // Grab the current list of disallowed usernames... diff --git a/phpBB/modules/acp/acp_email.php b/phpBB/modules/acp/acp_email.php index 4626a607f3..ac21b068c0 100644 --- a/phpBB/modules/acp/acp_email.php +++ b/phpBB/modules/acp/acp_email.php @@ -25,9 +25,7 @@ class acp_email function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/email'); + phpbb::$user->add_lang('acp/email'); $this->tpl_name = 'acp_email'; $this->page_title = 'ACP_MASS_EMAIL'; @@ -53,17 +51,17 @@ class acp_email if (!check_form_key($form_key)) { - $error[] = $user->lang['FORM_INVALID']; + $error[] = phpbb::$user->lang['FORM_INVALID']; } if (!$subject) { - $error[] = $user->lang['NO_EMAIL_SUBJECT']; + $error[] = phpbb::$user->lang['NO_EMAIL_SUBJECT']; } if (!$message) { - $error[] = $user->lang['NO_EMAIL_MESSAGE']; + $error[] = phpbb::$user->lang['NO_EMAIL_MESSAGE']; } if (!sizeof($error)) @@ -105,7 +103,7 @@ class acp_email if (!$row) { $db->sql_freeresult($result); - trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } $i = $j = 0; @@ -169,9 +167,9 @@ class acp_email $messenger->template('admin_send_email', $used_lang); $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->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); $messenger->subject(htmlspecialchars_decode($subject)); $messenger->set_mail_priority($priority); @@ -204,7 +202,7 @@ class acp_email else { // Not great but the logging routine doesn't cope well with localising on the fly - $group_name = $user->lang['ALL_USERS']; + $group_name = phpbb::$user->lang['ALL_USERS']; } add_log('admin', 'LOG_MASS_EMAIL', $group_name); @@ -212,12 +210,12 @@ class acp_email if (!$errored) { - $message = ($use_queue) ? $user->lang['EMAIL_SENT_QUEUE'] : $user->lang['EMAIL_SENT']; + $message = ($use_queue) ? phpbb::$user->lang['EMAIL_SENT_QUEUE'] : phpbb::$user->lang['EMAIL_SENT']; trigger_error($message . adm_back_link($this->u_action)); } else { - $message = sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&mode=critical') . '">', '</a>'); + $message = sprintf(phpbb::$user->lang['EMAIL_SEND_ERROR'], '<a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&mode=critical') . '">', '</a>'); trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -236,12 +234,12 @@ class acp_email } $db->sql_freeresult($result); - $select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>'; + $select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['ALL_USERS'] . '</option>'; $select_list .= group_select_options($group_id, $exclude); - $s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>'; - $s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>'; - $s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>'; + $s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . phpbb::$user->lang['MAIL_LOW_PRIORITY'] . '</option>'; + $s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . phpbb::$user->lang['MAIL_NORMAL_PRIORITY'] . '</option>'; + $s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . phpbb::$user->lang['MAIL_HIGH_PRIORITY'] . '</option>'; $template->assign_vars(array( 'S_WARNING' => (sizeof($error)) ? true : false, diff --git a/phpBB/modules/acp/acp_forums.php b/phpBB/modules/acp/acp_forums.php index ea7e8b5da3..d2a99196c7 100644 --- a/phpBB/modules/acp/acp_forums.php +++ b/phpBB/modules/acp/acp_forums.php @@ -26,9 +26,7 @@ class acp_forums function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/forums'); + phpbb::$user->add_lang('acp/forums'); $this->tpl_name = 'acp_forums'; $this->page_title = 'ACP_MANAGE_FORUMS'; @@ -44,7 +42,7 @@ class acp_forums if ($update && !check_form_key($form_key)) { $update = false; - $errors[] = $user->lang['FORM_INVALID']; + $errors[] = phpbb::$user->lang['FORM_INVALID']; } // Check additional permissions @@ -62,7 +60,7 @@ class acp_forums if (!$auth->acl_get('a_forumdel')) { - trigger_error($user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } break; @@ -71,7 +69,7 @@ class acp_forums if (!$auth->acl_get('a_forumadd')) { - trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } break; @@ -98,7 +96,7 @@ class acp_forums $auth->acl_clear_prefetch(); phpbb::$acm->destroy_sql(FORUMS_TABLE); - trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + trigger_error(phpbb::$user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); break; @@ -250,12 +248,12 @@ class acp_forums $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; - $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; + $message = ($action == 'add') ? phpbb::$user->lang['FORUM_CREATED'] : phpbb::$user->lang['FORUM_UPDATED']; // Redirect to permissions if ($auth->acl_get('a_fauth')) { - $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions' . $acl_url) . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['REDIRECT_ACL'], '<a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions' . $acl_url) . '">', '</a>'); } // redirect directly to permission settings screen if authed @@ -278,7 +276,7 @@ class acp_forums if (!$forum_id) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } $sql = 'SELECT * @@ -290,7 +288,7 @@ class acp_forums if (!$row) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } $move_forum_name = $this->move_forum_by($row, $action, 1); @@ -306,7 +304,7 @@ class acp_forums case 'sync': if (!$forum_id) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } @set_time_limit(0); @@ -320,7 +318,7 @@ class acp_forums if (!$row) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } if ($row['forum_topics_real']) @@ -366,7 +364,7 @@ class acp_forums 'U_PROGRESS_BAR' => $this->u_action . "&action=progress_bar&start=$topics_done&total={$row['forum_topics_real']}", 'UA_PROGRESS_BAR' => addslashes($this->u_action . "&action=progress_bar&start=$topics_done&total={$row['forum_topics_real']}"), 'S_CONTINUE_SYNC' => true, - 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $topics_done, $row['forum_topics_real'])) + 'L_PROGRESS_EXPLAIN' => sprintf(phpbb::$user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $topics_done, $row['forum_topics_real'])) ); return; @@ -380,7 +378,7 @@ class acp_forums 'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&action=progress_bar'), 'S_CONTINUE_SYNC' => true, - 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], 0, $row['forum_topics_real'])) + 'L_PROGRESS_EXPLAIN' => sprintf(phpbb::$user->lang['SYNC_IN_PROGRESS_EXPLAIN'], 0, $row['forum_topics_real'])) ); return; @@ -398,7 +396,7 @@ class acp_forums if (!$row) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } sync('forum', 'forum_id', $forum_id, false, true); @@ -406,7 +404,7 @@ class acp_forums add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']); phpbb::$acm->destroy_sql(FORUMS_TABLE); - $template->assign_var('L_FORUM_RESYNCED', sprintf($user->lang['FORUM_RESYNCED'], $row['forum_name'])); + $template->assign_var('L_FORUM_RESYNCED', sprintf(phpbb::$user->lang['FORUM_RESYNCED'], $row['forum_name'])); break; @@ -548,12 +546,12 @@ class acp_forums foreach ($forum_type_ary as $value => $lang) { - $forum_type_options .= '<option value="' . $value . '"' . (($value == $forum_data['forum_type']) ? ' selected="selected"' : '') . '>' . $user->lang['TYPE_' . $lang] . '</option>'; + $forum_type_options .= '<option value="' . $value . '"' . (($value == $forum_data['forum_type']) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['TYPE_' . $lang] . '</option>'; } $styles_list = style_select($forum_data['forum_style'], true); - $statuslist = '<option value="' . ITEM_UNLOCKED . '"' . (($forum_data['forum_status'] == ITEM_UNLOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['UNLOCKED'] . '</option><option value="' . ITEM_LOCKED . '"' . (($forum_data['forum_status'] == ITEM_LOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['LOCKED'] . '</option>'; + $statuslist = '<option value="' . ITEM_UNLOCKED . '"' . (($forum_data['forum_status'] == ITEM_UNLOCKED) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['UNLOCKED'] . '</option><option value="' . ITEM_LOCKED . '"' . (($forum_data['forum_status'] == ITEM_LOCKED) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['LOCKED'] . '</option>'; $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . ' @@ -618,7 +616,7 @@ class acp_forums if (strlen($forum_data['forum_password']) == 32) { - $errors[] = $user->lang['FORUM_PASSWORD_OLD']; + $errors[] = phpbb::$user->lang['FORUM_PASSWORD_OLD']; } $template->assign_vars(array( @@ -631,8 +629,8 @@ class acp_forums 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, 'U_EDIT_ACTION' => $this->u_action . "&parent_id={$this->parent_id}&action=$action&f=$forum_id", - 'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'], - 'L_TITLE' => $user->lang[$this->page_title], + 'L_COPY_PERMISSIONS_EXPLAIN' => phpbb::$user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'], + 'L_TITLE' => phpbb::$user->lang[$this->page_title], 'ERROR_MSG' => (sizeof($errors)) ? implode('<br />', $errors) : '', 'FORUM_NAME' => $forum_data['forum_name'], @@ -694,7 +692,7 @@ class acp_forums if (!$forum_id) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } $forum_data = $this->get_forum_info($forum_id); @@ -746,11 +744,11 @@ class acp_forums // Default management page if (!$this->parent_id) { - $navigation = $user->lang['FORUM_INDEX']; + $navigation = phpbb::$user->lang['FORUM_INDEX']; } else { - $navigation = '<a href="' . $this->u_action . '">' . $user->lang['FORUM_INDEX'] . '</a>'; + $navigation = '<a href="' . $this->u_action . '">' . phpbb::$user->lang['FORUM_INDEX'] . '</a>'; $forums_nav = get_forum_branch($this->parent_id, 'parents', 'descending'); foreach ($forums_nav as $row) @@ -788,18 +786,18 @@ class acp_forums if ($row['forum_status'] == ITEM_LOCKED) { - $folder_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang['LOCKED'] . '" />'; + $folder_image = '<img src="images/icon_folder_lock.gif" alt="' . phpbb::$user->lang['LOCKED'] . '" />'; } else { switch ($forum_type) { case FORUM_LINK: - $folder_image = '<img src="images/icon_folder_link.gif" alt="' . $user->lang['LINK'] . '" />'; + $folder_image = '<img src="images/icon_folder_link.gif" alt="' . phpbb::$user->lang['LINK'] . '" />'; break; default: - $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . $user->lang['SUBFORUM'] . '" />' : '<img src="images/icon_folder.gif" alt="' . $user->lang['FOLDER'] . '" />'; + $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . phpbb::$user->lang['SUBFORUM'] . '" />' : '<img src="images/icon_folder.gif" alt="' . phpbb::$user->lang['FOLDER'] . '" />'; break; } } @@ -865,8 +863,6 @@ class acp_forums */ function get_forum_info($forum_id) { - global $db; - $sql = 'SELECT * FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; @@ -887,23 +883,21 @@ class acp_forums */ function update_forum_data(&$forum_data) { - global $db, $user; - $errors = array(); if (!$forum_data['forum_name']) { - $errors[] = $user->lang['FORUM_NAME_EMPTY']; + $errors[] = phpbb::$user->lang['FORUM_NAME_EMPTY']; } if (utf8_strlen($forum_data['forum_desc']) > 4000) { - $errors[] = $user->lang['FORUM_DESC_TOO_LONG']; + $errors[] = phpbb::$user->lang['FORUM_DESC_TOO_LONG']; } if (utf8_strlen($forum_data['forum_rules']) > 4000) { - $errors[] = $user->lang['FORUM_RULES_TOO_LONG']; + $errors[] = phpbb::$user->lang['FORUM_RULES_TOO_LONG']; } if ($forum_data['forum_password'] || $forum_data['forum_password_confirm']) @@ -911,14 +905,14 @@ class acp_forums if ($forum_data['forum_password'] != $forum_data['forum_password_confirm']) { $forum_data['forum_password'] = $forum_data['forum_password_confirm'] = ''; - $errors[] = $user->lang['FORUM_PASSWORD_MISMATCH']; + $errors[] = phpbb::$user->lang['FORUM_PASSWORD_MISMATCH']; } } if ($forum_data['prune_days'] < 0 || $forum_data['prune_viewed'] < 0 || $forum_data['prune_freq'] < 0) { $forum_data['prune_days'] = $forum_data['prune_viewed'] = $forum_data['prune_freq'] = 0; - $errors[] = $user->lang['FORUM_DATA_NEGATIVE']; + $errors[] = phpbb::$user->lang['FORUM_DATA_NEGATIVE']; } $range_test_ary = array( @@ -992,12 +986,12 @@ class acp_forums if (!$row) { - trigger_error($user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&' . $this->parent_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&' . $this->parent_id), E_USER_WARNING); } if ($row['forum_type'] == FORUM_LINK) { - $errors[] = $user->lang['PARENT_IS_LINK_FORUM']; + $errors[] = phpbb::$user->lang['PARENT_IS_LINK_FORUM']; return $errors; } @@ -1042,7 +1036,7 @@ class acp_forums // Has subforums and want to change into a link? if ($row['right_id'] - $row['left_id'] > 1 && $forum_data_sql['forum_type'] == FORUM_LINK) { - $errors[] = $user->lang['FORUM_WITH_SUBFORUMS_NOT_TO_LINK']; + $errors[] = phpbb::$user->lang['FORUM_WITH_SUBFORUMS_NOT_TO_LINK']; return $errors; } @@ -1057,7 +1051,7 @@ class acp_forums } else { - return array($user->lang['NO_DESTINATION_FORUM']); + return array(phpbb::$user->lang['NO_DESTINATION_FORUM']); } } else if ($forum_data_sql['type_action'] == 'delete') @@ -1066,7 +1060,7 @@ class acp_forums } else { - return array($user->lang['NO_FORUM_ACTION']); + return array(phpbb::$user->lang['NO_FORUM_ACTION']); } $forum_data_sql['forum_posts'] = $forum_data_sql['forum_topics'] = $forum_data_sql['forum_topics_real'] = $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0; @@ -1145,7 +1139,7 @@ class acp_forums { if (!$subforums_to_id) { - return array($user->lang['NO_DESTINATION_FORUM']); + return array(phpbb::$user->lang['NO_DESTINATION_FORUM']); } $sql = 'SELECT forum_name @@ -1157,7 +1151,7 @@ class acp_forums if (!$_row) { - return array($user->lang['NO_FORUM']); + return array(phpbb::$user->lang['NO_FORUM']); } $subforums_to_name = $_row['forum_name']; @@ -1255,8 +1249,6 @@ class acp_forums */ function move_forum($from_id, $to_id) { - global $db, $user; - $to_data = $moved_ids = $errors = array(); // Check if we want to move to a parent with link type @@ -1266,7 +1258,7 @@ class acp_forums if ($to_data['forum_type'] == FORUM_LINK) { - $errors[] = $user->lang['PARENT_IS_LINK_FORUM']; + $errors[] = phpbb::$user->lang['PARENT_IS_LINK_FORUM']; return $errors; } } @@ -1350,8 +1342,6 @@ class acp_forums */ function move_forum_content($from_id, $to_id, $sync = true) { - global $db; - $table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); foreach ($table_ary as $table) @@ -1387,8 +1377,6 @@ class acp_forums */ function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0) { - global $db, $user; - $forum_data = $this->get_forum_info($forum_id); $errors = array(); @@ -1404,7 +1392,7 @@ class acp_forums { if (!$posts_to_id) { - $errors[] = $user->lang['NO_DESTINATION_FORUM']; + $errors[] = phpbb::$user->lang['NO_DESTINATION_FORUM']; } else { @@ -1419,7 +1407,7 @@ class acp_forums if (!$row) { - $errors[] = $user->lang['NO_FORUM']; + $errors[] = phpbb::$user->lang['NO_FORUM']; } else { @@ -1468,7 +1456,7 @@ class acp_forums { if (!$subforums_to_id) { - $errors[] = $user->lang['NO_DESTINATION_FORUM']; + $errors[] = phpbb::$user->lang['NO_DESTINATION_FORUM']; } else { @@ -1483,7 +1471,7 @@ class acp_forums if (!$row) { - $errors[] = $user->lang['NO_FORUM']; + $errors[] = phpbb::$user->lang['NO_FORUM']; } else { @@ -1628,8 +1616,6 @@ class acp_forums */ function delete_forum_content($forum_id) { - global $db; - include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); $db->sql_transaction('begin'); @@ -1830,8 +1816,6 @@ class acp_forums */ function move_forum_by($forum_row, $action = 'move_up', $steps = 1) { - global $db; - /** * Fetch all the siblings between the module's current spot * and where we want to move it to. If there are less than $steps @@ -1911,17 +1895,15 @@ class acp_forums */ function display_progress_bar($start, $total) { - global $template, $user; - - page_header($user->lang['SYNC_IN_PROGRESS']); + page_header(phpbb::$user->lang['SYNC_IN_PROGRESS']); $template->set_filenames(array( 'body' => 'progress_bar.html') ); $template->assign_vars(array( - 'L_PROGRESS' => $user->lang['SYNC_IN_PROGRESS'], - 'L_PROGRESS_EXPLAIN' => ($start && $total) ? sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : $user->lang['SYNC_IN_PROGRESS']) + 'L_PROGRESS' => phpbb::$user->lang['SYNC_IN_PROGRESS'], + 'L_PROGRESS_EXPLAIN' => ($start && $total) ? sprintf(phpbb::$user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : phpbb::$user->lang['SYNC_IN_PROGRESS']) ); page_footer(); diff --git a/phpBB/modules/acp/acp_groups.php b/phpBB/modules/acp/acp_groups.php index 7ded95e228..784bdab7c9 100644 --- a/phpBB/modules/acp/acp_groups.php +++ b/phpBB/modules/acp/acp_groups.php @@ -25,9 +25,9 @@ class acp_groups function main($id, $mode) { - global $db, $user, $auth, $template, $file_uploads; + global $file_uploads; - $user->add_lang('acp/groups'); + phpbb::$user->add_lang('acp/groups'); $this->tpl_name = 'acp_groups'; $this->page_title = 'ACP_GROUPS_MANAGE'; @@ -63,13 +63,13 @@ class acp_groups if (!$group_row) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } // Check if the user is allowed to manage this group if set to founder only. - if (!phpbb::$user->is_founder && $group_row['group_founder_manage']) + if (!phpbb::phpbb::$user->is_founder && $group_row['group_founder_manage']) { - trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -81,11 +81,11 @@ class acp_groups case 'promote': if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } // Approve, demote or promote - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; $error = group_user_attributes($action, $group_id, $mark_ary, false, $group_name); if (!$error) @@ -105,11 +105,11 @@ class acp_groups break; } - trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); + trigger_error(phpbb::$user->lang[$message] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); } else { - trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang[$error] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING); } break; @@ -117,12 +117,12 @@ class acp_groups case 'default': if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) { - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; if (!sizeof($mark_ary)) { @@ -162,11 +162,11 @@ class acp_groups group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row); } - trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); + trigger_error(phpbb::$user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'mark' => $mark_ary, 'g' => $group_id, 'i' => $id, @@ -181,11 +181,11 @@ class acp_groups case 'delete': if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } else if ($action === 'delete' && $group_row['group_type'] == GROUP_SPECIAL) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -197,14 +197,14 @@ class acp_groups case 'delete': if (!$auth->acl_get('a_groupdel')) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } $error = group_delete($group_id, $group_row['group_name']); break; case 'deleteusers': - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; $error = group_user_del($group_id, $mark_ary, false, $group_name); break; } @@ -213,15 +213,15 @@ class acp_groups if ($error) { - trigger_error($user->lang[$error] . adm_back_link($back_link), E_USER_WARNING); + trigger_error(phpbb::$user->lang[$error] . adm_back_link($back_link), E_USER_WARNING); } $message = ($action == 'delete') ? 'GROUP_DELETED' : 'GROUP_USERS_REMOVE'; - trigger_error($user->lang[$message] . adm_back_link($back_link)); + trigger_error(phpbb::$user->lang[$message] . adm_back_link($back_link)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'mark' => $mark_ary, 'g' => $group_id, 'i' => $id, @@ -234,25 +234,25 @@ class acp_groups case 'addusers': if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!$name_ary) { - trigger_error($user->lang['NO_USERS'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_USERS'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING); } $name_ary = array_unique(explode("\n", $name_ary)); - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; // Add user/s to group if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, $leader, 0, $group_row)) { - trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang[$error] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING); } $message = ($leader) ? 'GROUP_MODS_ADDED' : 'GROUP_USERS_ADDED'; - trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); + trigger_error(phpbb::$user->lang[$message] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); break; case 'edit': @@ -264,16 +264,16 @@ class acp_groups if ($action == 'edit' && !$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($action == 'add' && !$auth->acl_get('a_groupadd')) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } $error = array(); - $user->add_lang('ucp'); + phpbb::$user->add_lang('ucp'); $avatar_select = basename(request_var('avatar_select', '')); $category = basename(request_var('category', '')); @@ -283,7 +283,7 @@ class acp_groups { if (!check_form_key($form_key)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } $group_name = utf8_normalize_nfc(request_var('group_name', '', true)); @@ -362,7 +362,7 @@ class acp_groups { if ($data['width'] > phpbb::$config['avatar_max_width'] || $data['height'] > phpbb::$config['avatar_max_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']); + $error[] = sprintf(phpbb::$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']); } } @@ -372,7 +372,7 @@ class acp_groups { if ($data['width'] < phpbb::$config['avatar_min_width'] || $data['height'] < phpbb::$config['avatar_min_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']); + $error[] = sprintf(phpbb::$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']); } } } @@ -462,7 +462,7 @@ class acp_groups phpbb::$acm->destroy_sql(GROUPS_TABLE); $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED'; - trigger_error($user->lang[$message] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang[$message] . adm_back_link($this->u_action)); } } @@ -504,7 +504,7 @@ class acp_groups ORDER BY rank_title'; $result = $db->sql_query($sql); - $rank_options = '<option value="0"' . ((!$group_rank) ? ' selected="selected"' : '') . '>' . $user->lang['USER_DEFAULT'] . '</option>'; + $rank_options = '<option value="0"' . ((!$group_rank) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['USER_DEFAULT'] . '</option>'; while ($row = $db->sql_fetchrow($result)) { @@ -553,7 +553,7 @@ class acp_groups 'S_USER_FOUNDER' => phpbb::$user->is_founder, 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', - 'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name, + 'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_name] : $group_name, 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_DESC' => $group_desc_data['text'], 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', @@ -590,7 +590,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'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], round(phpbb::$config['avatar_filesize'] / 1024)), + 'L_AVATAR_EXPLAIN' => sprintf(phpbb::$user->lang['AVATAR_EXPLAIN'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], round(phpbb::$config['avatar_filesize'] / 1024)), ) ); @@ -601,7 +601,7 @@ class acp_groups if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } $this->page_title = 'GROUP_MEMBERS'; @@ -622,7 +622,7 @@ class acp_groups 'USERNAME' => $row['username'], 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, - 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', + 'JOINED' => ($row['user_regdate']) ? phpbb::$user->format_date($row['user_regdate']) : ' - ', 'USER_POSTS' => $row['user_posts'], 'USER_ID' => $row['user_id']) ); @@ -643,7 +643,7 @@ class acp_groups foreach ($options as $option => $lang) { - $s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>'; + $s_action_options .= '<option value="' . $option . '">' . phpbb::$user->lang['GROUP_' . $lang] . '</option>'; } $template->assign_vars(array( @@ -653,7 +653,7 @@ class acp_groups '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'], + 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], 'U_ACTION' => $this->u_action . "&g=$group_id", 'U_BACK' => $this->u_action, @@ -688,7 +688,7 @@ class acp_groups 'USERNAME' => $row['username'], 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, - 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', + 'JOINED' => ($row['user_regdate']) ? phpbb::$user->format_date($row['user_regdate']) : ' - ', 'USER_POSTS' => $row['user_posts'], 'USER_ID' => $row['user_id']) ); @@ -752,7 +752,7 @@ class acp_groups foreach ($row_ary as $group_id => $row) { - $group_name = (!empty($user->lang['G_' . $row['group_name']]))? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $group_name = (!empty(phpbb::$user->lang['G_' . $row['group_name']]))? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']; $template->assign_block_vars('groups', array( 'U_LIST' => "{$this->u_action}&action=list&g=$group_id", diff --git a/phpBB/modules/acp/acp_icons.php b/phpBB/modules/acp/acp_icons.php index 0badeafaf7..a8fc4ff1c5 100644 --- a/phpBB/modules/acp/acp_icons.php +++ b/phpBB/modules/acp/acp_icons.php @@ -26,9 +26,7 @@ class acp_icons function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/posting'); + phpbb::$user->add_lang('acp/posting'); // Set up general vars $action = request_var('action', ''); @@ -212,18 +210,18 @@ class acp_icons $display_count++; } $after_txt = ($mode == 'smilies') ? $row['code'] : $row['icons_url']; - $order_lists[$row['display_on_posting']] = '<option value="' . ($row[$fields . '_order'] + 1) . '"' . $selected . '>' . sprintf($user->lang['AFTER_' . $lang], ' -> ' . $after_txt) . '</option>' . $order_lists[$row['display_on_posting']]; + $order_lists[$row['display_on_posting']] = '<option value="' . ($row[$fields . '_order'] + 1) . '"' . $selected . '>' . sprintf(phpbb::$user->lang['AFTER_' . $lang], ' -> ' . $after_txt) . '</option>' . $order_lists[$row['display_on_posting']]; if (!empty($default_row)) { - $add_order_lists[$row['display_on_posting']] = '<option value="' . ($row[$fields . '_order'] + 1) . '"' . (($row[$fields . '_id'] == $default_row['smiley_id']) ? ' selected="selected"' : '') . '>' . sprintf($user->lang['AFTER_' . $lang], ' -> ' . $after_txt) . '</option>' . $add_order_lists[$row['display_on_posting']]; + $add_order_lists[$row['display_on_posting']] = '<option value="' . ($row[$fields . '_order'] + 1) . '"' . (($row[$fields . '_id'] == $default_row['smiley_id']) ? ' selected="selected"' : '') . '>' . sprintf(phpbb::$user->lang['AFTER_' . $lang], ' -> ' . $after_txt) . '</option>' . $add_order_lists[$row['display_on_posting']]; } } } $db->sql_freeresult($result); - $order_list = '<option value="1"' . ((!isset($after)) ? ' selected="selected"' : '') . '>' . $user->lang['FIRST'] . '</option>'; - $add_order_list = '<option value="1">' . $user->lang['FIRST'] . '</option>'; + $order_list = '<option value="1"' . ((!isset($after)) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['FIRST'] . '</option>'; + $add_order_list = '<option value="1">' . phpbb::$user->lang['FIRST'] . '</option>'; if ($action == 'add') { @@ -243,15 +241,15 @@ class acp_icons 'S_ORDER_LIST_UNDISPLAY' => $order_list . $order_lists[0], 'S_ORDER_LIST_DISPLAY_COUNT' => $display_count + 1, - 'L_TITLE' => $user->lang['ACP_' . $lang], - 'L_EXPLAIN' => $user->lang['ACP_' . $lang . '_EXPLAIN'], - 'L_CONFIG' => $user->lang[$lang . '_CONFIG'], - 'L_URL' => $user->lang[$lang . '_URL'], - 'L_LOCATION' => $user->lang[$lang . '_LOCATION'], - 'L_WIDTH' => $user->lang[$lang . '_WIDTH'], - 'L_HEIGHT' => $user->lang[$lang . '_HEIGHT'], - 'L_ORDER' => $user->lang[$lang . '_ORDER'], - 'L_NO_ICONS' => $user->lang['NO_' . $lang . '_' . strtoupper($action)], + 'L_TITLE' => phpbb::$user->lang['ACP_' . $lang], + 'L_EXPLAIN' => phpbb::$user->lang['ACP_' . $lang . '_EXPLAIN'], + 'L_CONFIG' => phpbb::$user->lang[$lang . '_CONFIG'], + 'L_URL' => phpbb::$user->lang[$lang . '_URL'], + 'L_LOCATION' => phpbb::$user->lang[$lang . '_LOCATION'], + 'L_WIDTH' => phpbb::$user->lang[$lang . '_WIDTH'], + 'L_HEIGHT' => phpbb::$user->lang[$lang . '_HEIGHT'], + 'L_ORDER' => phpbb::$user->lang[$lang . '_ORDER'], + 'L_NO_ICONS' => phpbb::$user->lang['NO_' . $lang . '_' . strtoupper($action)], 'COLSPAN' => $colspan, 'ID' => $icon_id, @@ -450,15 +448,15 @@ class acp_icons $errormsgs = ''; foreach ($errors as $img => $error) { - $errormsgs .= '<br />' . sprintf($user->lang[$error], $img); + $errormsgs .= '<br />' . sprintf(phpbb::$user->lang[$error], $img); } if ($action == 'modify') { - trigger_error($user->lang[$suc_lang . '_EDITED'] . $errormsgs . adm_back_link($this->u_action), $level); + trigger_error(phpbb::$user->lang[$suc_lang . '_EDITED'] . $errormsgs . adm_back_link($this->u_action), $level); } else { - trigger_error($user->lang[$suc_lang . '_ADDED'] . $errormsgs . adm_back_link($this->u_action), $level); + trigger_error(phpbb::$user->lang[$suc_lang . '_ADDED'] . $errormsgs . adm_back_link($this->u_action), $level); } break; @@ -474,7 +472,7 @@ class acp_icons if (!($pak_ary = @file(PHPBB_ROOT_PATH . $img_path . '/' . $pak))) { - trigger_error($user->lang['PAK_FILE_NOT_READABLE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['PAK_FILE_NOT_READABLE'] . adm_back_link($this->u_action), E_USER_WARNING); } // Make sure the pak_ary is valid @@ -485,12 +483,12 @@ class acp_icons if ((sizeof($data[1]) != 4 && $mode == 'icons') || ((sizeof($data[1]) != 6 || (empty($data[1][4]) || empty($data[1][5]))) && $mode == 'smilies' )) { - trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } } else { - trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -545,7 +543,7 @@ class acp_icons if ((sizeof($data[1]) != 4 && $mode == 'icons') || (sizeof($data[1]) != 6 && $mode == 'smilies')) { - trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } // Stripslash here because it got addslashed before... (on export) @@ -610,7 +608,7 @@ class acp_icons phpbb::$acm->destroy('icons'); phpbb::$acm->destroy_sql($table); - trigger_error($user->lang[$lang . '_IMPORT_SUCCESS'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang[$lang . '_IMPORT_SUCCESS'] . adm_back_link($this->u_action)); } else { @@ -625,12 +623,12 @@ class acp_icons 'S_CHOOSE_PAK' => true, 'S_PAK_OPTIONS' => $pak_options, - 'L_TITLE' => $user->lang['ACP_' . $lang], - 'L_EXPLAIN' => $user->lang['ACP_' . $lang . '_EXPLAIN'], - 'L_NO_PAK_OPTIONS' => $user->lang['NO_' . $lang . '_PAK'], - 'L_CURRENT' => $user->lang['CURRENT_' . $lang], - 'L_CURRENT_EXPLAIN' => $user->lang['CURRENT_' . $lang . '_EXPLAIN'], - 'L_IMPORT_SUBMIT' => $user->lang['IMPORT_' . $lang], + 'L_TITLE' => phpbb::$user->lang['ACP_' . $lang], + 'L_EXPLAIN' => phpbb::$user->lang['ACP_' . $lang . '_EXPLAIN'], + 'L_NO_PAK_OPTIONS' => phpbb::$user->lang['NO_' . $lang . '_PAK'], + 'L_CURRENT' => phpbb::$user->lang['CURRENT_' . $lang], + 'L_CURRENT_EXPLAIN' => phpbb::$user->lang['CURRENT_' . $lang . '_EXPLAIN'], + 'L_IMPORT_SUBMIT' => phpbb::$user->lang['IMPORT_' . $lang], 'U_BACK' => $this->u_action, 'U_ACTION' => $this->u_action . '&action=import', @@ -645,8 +643,8 @@ class acp_icons $this->tpl_name = 'message_body'; $template->assign_vars(array( - 'MESSAGE_TITLE' => $user->lang['EXPORT_' . $lang], - 'MESSAGE_TEXT' => sprintf($user->lang['EXPORT_' . $lang . '_EXPLAIN'], '<a href="' . $this->u_action . '&action=send">', '</a>'), + 'MESSAGE_TITLE' => phpbb::$user->lang['EXPORT_' . $lang], + 'MESSAGE_TEXT' => sprintf(phpbb::$user->lang['EXPORT_' . $lang . '_EXPLAIN'], '<a href="' . $this->u_action . '&action=send">', '</a>'), 'S_USER_NOTICE' => true, ) @@ -697,7 +695,7 @@ class acp_icons } else { - trigger_error($user->lang['NO_' . strtoupper($fields) . '_EXPORT'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_' . strtoupper($fields) . '_EXPORT'] . adm_back_link($this->u_action), E_USER_WARNING); } break; @@ -727,14 +725,14 @@ class acp_icons break; } - $notice = $user->lang[$lang . '_DELETED']; + $notice = phpbb::$user->lang[$lang . '_DELETED']; phpbb::$acm->destroy('icons'); phpbb::$acm->destroy_sql($table); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'id' => $icon_id, @@ -811,13 +809,13 @@ class acp_icons $db->sql_freeresult($result); $template->assign_vars(array( - 'L_TITLE' => $user->lang['ACP_' . $lang], - 'L_EXPLAIN' => $user->lang['ACP_' . $lang . '_EXPLAIN'], - 'L_IMPORT' => $user->lang['IMPORT_' . $lang], - 'L_EXPORT' => $user->lang['EXPORT_' . $lang], - 'L_NOT_DISPLAYED' => $user->lang[$lang . '_NOT_DISPLAYED'], - 'L_ICON_ADD' => $user->lang['ADD_' . $lang], - 'L_ICON_EDIT' => $user->lang['EDIT_' . $lang], + 'L_TITLE' => phpbb::$user->lang['ACP_' . $lang], + 'L_EXPLAIN' => phpbb::$user->lang['ACP_' . $lang . '_EXPLAIN'], + 'L_IMPORT' => phpbb::$user->lang['IMPORT_' . $lang], + 'L_EXPORT' => phpbb::$user->lang['EXPORT_' . $lang], + 'L_NOT_DISPLAYED' => phpbb::$user->lang[$lang . '_NOT_DISPLAYED'], + 'L_ICON_ADD' => phpbb::$user->lang['ADD_' . $lang], + 'L_ICON_EDIT' => phpbb::$user->lang['EDIT_' . $lang], 'NOTICE' => $notice, 'COLSPAN' => ($mode == 'smilies') ? 5 : 3, diff --git a/phpBB/modules/acp/acp_inactive.php b/phpBB/modules/acp/acp_inactive.php index ef150748ae..fe34b40ee8 100644 --- a/phpBB/modules/acp/acp_inactive.php +++ b/phpBB/modules/acp/acp_inactive.php @@ -31,11 +31,9 @@ class acp_inactive function main($id, $mode) { - global $db, $user, $auth, $template; - include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); - $user->add_lang('memberlist'); + phpbb::$user->add_lang('memberlist'); $action = request_var('action', ''); $mark = request_var('mark', array(0)); @@ -54,7 +52,7 @@ class acp_inactive { if ($action !== 'delete' && !check_form_key($form_key)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } switch ($action) @@ -108,8 +106,8 @@ class acp_inactive $messenger->to($row['user_email'], $row['username']); $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_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username'])) @@ -127,7 +125,7 @@ class acp_inactive { if (!$auth->acl_get('a_userdel')) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } foreach ($mark as $user_id) @@ -146,7 +144,7 @@ class acp_inactive 'submit' => 1, 'start' => $start, ); - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); } } @@ -155,7 +153,7 @@ class acp_inactive case 'remind': if (empty(phpbb::$config['email_enable'])) { - trigger_error($user->lang['EMAIL_DISABLED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['EMAIL_DISABLED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey @@ -180,7 +178,7 @@ class acp_inactive $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username']), - 'REGISTER_DATE' => $user->format_date($row['user_regdate']), + 'REGISTER_DATE' => phpbb::$user->format_date($row['user_regdate']), 'U_ACTIVATE' => generate_board_url() . '/ucp.' . PHP_EXT . '?mode=activate&u=' . $row['user_id'] . '&k=' . $row['user_actkey']) ); @@ -202,8 +200,8 @@ class acp_inactive } // Sorting - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME']); + $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('i' => phpbb::$user->lang['SORT_INACTIVE'], 'j' => phpbb::$user->lang['SORT_REG_DATE'], 'l' => phpbb::$user->lang['SORT_LAST_VISIT'], 'r' => phpbb::$user->lang['SORT_REASON'], 'u' => phpbb::$user->lang['SORT_USERNAME']); $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'r' => 'user_inactive_reason', 'u' => 'username_clean'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -221,9 +219,9 @@ class acp_inactive foreach ($inactive as $row) { $template->assign_block_vars('inactive', array( - 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), - 'JOINED' => $user->format_date($row['user_regdate']), - 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), + 'INACTIVE_DATE' => phpbb::$user->format_date($row['user_inactive_time']), + 'JOINED' => phpbb::$user->format_date($row['user_regdate']), + 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : phpbb::$user->format_date($row['user_lastvisit']), 'REASON' => $row['inactive_reason'], 'USER_ID' => $row['user_id'], 'USERNAME' => $row['username'], diff --git a/phpBB/modules/acp/acp_jabber.php b/phpBB/modules/acp/acp_jabber.php index a7f8da170c..67a986516d 100644 --- a/phpBB/modules/acp/acp_jabber.php +++ b/phpBB/modules/acp/acp_jabber.php @@ -26,9 +26,7 @@ class acp_jabber function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/board'); + phpbb::$user->add_lang('acp/board'); include_once(PHPBB_ROOT_PATH . 'includes/functions_jabber.' . PHP_EXT); @@ -58,12 +56,12 @@ class acp_jabber { if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } $error = array(); - $message = $user->lang['JAB_SETTINGS_CHANGED']; + $message = phpbb::$user->lang['JAB_SETTINGS_CHANGED']; $log = 'JAB_SETTINGS_CHANGED'; // Is this feature enabled? Then try to establish a connection @@ -73,13 +71,13 @@ class acp_jabber if (!$jabber->connect()) { - trigger_error($user->lang['ERR_JAB_CONNECT'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['ERR_JAB_CONNECT'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING); } // We'll try to authorise using this account if (!$jabber->login()) { - trigger_error($user->lang['ERR_JAB_AUTH'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['ERR_JAB_AUTH'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING); } $jabber->disconnect(); @@ -113,7 +111,7 @@ class acp_jabber $template->assign_vars(array( 'U_ACTION' => $this->u_action, 'JAB_ENABLE' => $jab_enable, - 'L_JAB_SERVER_EXPLAIN' => sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/">', '</a>'), + 'L_JAB_SERVER_EXPLAIN' => sprintf(phpbb::$user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/">', '</a>'), 'JAB_HOST' => $jab_host, 'JAB_PORT' => $jab_port, 'JAB_USERNAME' => $jab_username, diff --git a/phpBB/modules/acp/acp_language.php b/phpBB/modules/acp/acp_language.php index 65255a18d3..97e80ec8f9 100644 --- a/phpBB/modules/acp/acp_language.php +++ b/phpBB/modules/acp/acp_language.php @@ -31,7 +31,6 @@ class acp_language function main($id, $mode) { - global $db, $user, $auth, $template; global $safe_mode, $file_uploads; /** @@ -77,7 +76,7 @@ class acp_language $this->language_directory = basename($this->language_directory); $this->language_file = basename($this->language_file); - $user->add_lang('acp/language'); + phpbb::$user->add_lang('acp/language'); $this->tpl_name = 'acp_language'; $this->page_title = 'ACP_LANGUAGE_PACKS'; @@ -100,7 +99,7 @@ class acp_language break; default: - trigger_error($user->lang['INVALID_UPLOAD_METHOD'], E_USER_ERROR); + trigger_error(phpbb::$user->lang['INVALID_UPLOAD_METHOD'], E_USER_ERROR); break; } @@ -127,8 +126,8 @@ class acp_language $default_value = request_var($data, ''); $template->assign_block_vars('data', array( 'DATA' => $data, - 'NAME' => $user->lang[strtoupper($method . '_' . $data)], - 'EXPLAIN' => $user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'], + 'NAME' => phpbb::$user->lang[strtoupper($method . '_' . $data)], + 'EXPLAIN' => phpbb::$user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'], 'DEFAULT' => (empty($default_value)) ? $default : $default_value )); } @@ -161,12 +160,12 @@ class acp_language if (!$submit || !check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } if (!$lang_id) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -188,7 +187,7 @@ class acp_language add_log('admin', 'LOG_LANGUAGE_PACK_UPDATED', $sql_ary['lang_english_name']); - trigger_error($user->lang['LANGUAGE_DETAILS_UPDATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['LANGUAGE_DETAILS_UPDATED'] . adm_back_link($this->u_action)); break; case 'submit_file': @@ -197,22 +196,22 @@ class acp_language if (!$submit || !check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } if (!$lang_id || empty($_POST['entry'])) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($this->language_directory != 'email' && !is_array($_POST['entry'])) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!$this->language_file || (!$this->language_directory && !in_array($this->language_file, $this->main_files))) { - trigger_error($user->lang['NO_FILE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FILE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -224,7 +223,7 @@ class acp_language if (!$row) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } // Before we attempt to write anything let's check if the admin really chose a correct filename @@ -237,7 +236,7 @@ class acp_language if (!in_array($this->language_file, $email_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; @@ -248,7 +247,7 @@ class acp_language if (!in_array($this->language_file, $acp_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; @@ -259,14 +258,14 @@ class acp_language if (!in_array($this->language_file, $mods_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; default: if (!in_array($this->language_file, $this->main_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; } @@ -301,7 +300,7 @@ class acp_language if (!$fp) { - trigger_error(sprintf($user->lang['UNABLE_TO_WRITE_FILE'], $filename) . adm_back_link($this->u_action . '&id=' . $lang_id . '&action=details&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); + trigger_error(sprintf(phpbb::$user->lang['UNABLE_TO_WRITE_FILE'], $filename) . adm_back_link($this->u_action . '&id=' . $lang_id . '&action=details&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); } if ($this->language_directory == 'email') @@ -400,14 +399,14 @@ class acp_language if ($method != 'ftp' && $method != 'ftp_fsock') { - trigger_error($user->lang['INVALID_UPLOAD_METHOD'], E_USER_ERROR); + trigger_error(phpbb::$user->lang['INVALID_UPLOAD_METHOD'], E_USER_ERROR); } $transfer = new $method(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); if (($result = $transfer->open_session()) !== true) { - trigger_error($user->lang[$result] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); + trigger_error(phpbb::$user->lang[$result] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); } $transfer->rename($lang_path . $file, $lang_path . $file . '.bak'); @@ -419,7 +418,7 @@ class acp_language $transfer->delete_file($lang_path . $file); $transfer->rename($lang_path . $file . '.bak', $lang_path . $file); - trigger_error($user->lang['UPLOAD_FAILED'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); + trigger_error(phpbb::$user->lang['UPLOAD_FAILED'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); } $transfer->close_session(); @@ -432,7 +431,7 @@ class acp_language add_log('admin', 'LOG_LANGUAGE_FILE_REPLACED', $file); - trigger_error($user->lang['UPLOAD_COMPLETED'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file))); + trigger_error(phpbb::$user->lang['UPLOAD_COMPLETED'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file))); } add_log('admin', 'LOG_LANGUAGE_FILE_SUBMITTED', $this->language_file); @@ -444,7 +443,7 @@ class acp_language if (!$lang_id) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $this->page_title = 'LANGUAGE_PACK_DETAILS'; @@ -477,28 +476,28 @@ class acp_language case 'email': if (!in_array($this->language_file, $email_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; case 'acp': if (!in_array($this->language_file, $acp_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; case 'mods': if (!in_array($this->language_file, $mods_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } break; default: if (!in_array($this->language_file, $this->main_files)) { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); } } @@ -608,7 +607,7 @@ class acp_language { $template->assign_vars(array( 'S_MISSING_FILES' => true, - 'L_MISSING_FILES' => sprintf($user->lang['THOSE_MISSING_LANG_FILES'], $lang_entries['lang_local_name']), + 'L_MISSING_FILES' => sprintf(phpbb::$user->lang['THOSE_MISSING_LANG_FILES'], $lang_entries['lang_local_name']), 'MISSING_FILES' => implode('<br />', $missing_files)) ); } @@ -617,7 +616,7 @@ class acp_language { $template->assign_vars(array( 'S_MISSING_VARS' => true, - 'L_MISSING_VARS_EXPLAIN' => sprintf($user->lang['THOSE_MISSING_LANG_VARIABLES'], $lang_entries['lang_local_name']), + 'L_MISSING_VARS_EXPLAIN' => sprintf(phpbb::$user->lang['THOSE_MISSING_LANG_VARIABLES'], $lang_entries['lang_local_name']), 'U_MISSING_ACTION' => $this->u_action . "&action=$action&id=$lang_id") ); @@ -638,7 +637,7 @@ class acp_language } // Main language files - $s_lang_options = '<option value="|common.' . PHP_EXT . '" class="sep">' . $user->lang['LANGUAGE_FILES'] . '</option>'; + $s_lang_options = '<option value="|common.' . PHP_EXT . '" class="sep">' . phpbb::$user->lang['LANGUAGE_FILES'] . '</option>'; foreach ($this->main_files as $file) { if (strpos($file, 'help_') === 0) @@ -653,7 +652,7 @@ class acp_language } // Help Files - $s_lang_options .= '<option value="|common.' . PHP_EXT . '" class="sep">' . $user->lang['HELP_FILES'] . '</option>'; + $s_lang_options .= '<option value="|common.' . PHP_EXT . '" class="sep">' . phpbb::$user->lang['HELP_FILES'] . '</option>'; foreach ($this->main_files as $file) { if (strpos($file, 'help_') !== 0) @@ -677,7 +676,7 @@ class acp_language continue; } - $s_lang_options .= '<option value="|common.' . PHP_EXT . '" class="sep">' . $user->lang[strtoupper($check) . '_FILES'] . '</option>'; + $s_lang_options .= '<option value="|common.' . PHP_EXT . '" class="sep">' . phpbb::$user->lang[strtoupper($check) . '_FILES'] . '</option>'; foreach (${$check . '_files'} as $file) { @@ -699,7 +698,7 @@ class acp_language if (!$file_from_store && !file_exists(PHPBB_ROOT_PATH . $no_store_filename)) { - $print_message = sprintf($user->lang['MISSING_LANGUAGE_FILE'], $no_store_filename); + $print_message = sprintf(phpbb::$user->lang['MISSING_LANGUAGE_FILE'], $no_store_filename); } else { @@ -764,7 +763,7 @@ class acp_language if (!$lang_id) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -776,7 +775,7 @@ class acp_language 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); + trigger_error(phpbb::$user->lang['NO_REMOVE_DEFAULT_LANG'] . adm_back_link($this->u_action), E_USER_WARNING); } $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id); @@ -800,7 +799,7 @@ class acp_language add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']); - trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action)); + trigger_error(sprintf(phpbb::$user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action)); break; case 'install': @@ -809,7 +808,7 @@ class acp_language if (!$lang_iso || !file_exists(PHPBB_ROOT_PATH . "language/$lang_iso/iso.txt")) { - trigger_error($user->lang['LANGUAGE_PACK_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['LANGUAGE_PACK_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } $file = file(PHPBB_ROOT_PATH . "language/$lang_iso/iso.txt"); @@ -831,12 +830,12 @@ class acp_language if ($row) { - trigger_error($user->lang['LANGUAGE_PACK_ALREADY_INSTALLED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['LANGUAGE_PACK_ALREADY_INSTALLED'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!$lang_pack['name'] || !$lang_pack['local_name']) { - trigger_error($user->lang['INVALID_LANGUAGE_PACK'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['INVALID_LANGUAGE_PACK'] . adm_back_link($this->u_action), E_USER_WARNING); } // Add language pack @@ -949,7 +948,7 @@ class acp_language add_log('admin', 'LOG_LANGUAGE_PACK_INSTALLED', $lang_pack['name']); - trigger_error(sprintf($user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name']) . adm_back_link($this->u_action)); + trigger_error(sprintf(phpbb::$user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name']) . adm_back_link($this->u_action)); break; @@ -957,7 +956,7 @@ class acp_language if (!$lang_id) { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * diff --git a/phpBB/modules/acp/acp_logs.php b/phpBB/modules/acp/acp_logs.php index 728ed1f878..dd10046097 100644 --- a/phpBB/modules/acp/acp_logs.php +++ b/phpBB/modules/acp/acp_logs.php @@ -25,9 +25,7 @@ class acp_logs function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('mcp'); + phpbb::$user->add_lang('mcp'); // Set up general vars $action = request_var('action', ''); @@ -75,7 +73,7 @@ class acp_logs } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'f' => $forum_id, 'start' => $start, 'delmarked' => $deletemark, @@ -92,8 +90,8 @@ class acp_logs } // Sorting - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('u' => phpbb::$user->lang['SORT_USERNAME'], 't' => phpbb::$user->lang['SORT_DATE'], 'i' => phpbb::$user->lang['SORT_IP'], 'o' => phpbb::$user->lang['SORT_ACTION']); $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -103,15 +101,15 @@ class acp_logs $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); - $l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS']; - $l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN']; + $l_title = phpbb::$user->lang['ACP_' . strtoupper($mode) . '_LOGS']; + $l_title_explain = phpbb::$user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN']; $this->page_title = $l_title; // Define forum list if we're looking @ mod logs if ($mode == 'mod') { - $forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id); + $forum_box = '<option value="0">' . phpbb::$user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id); $template->assign_vars(array( 'S_SHOW_FORUMS' => true, @@ -148,7 +146,7 @@ class acp_logs { if (isset($row[$check]) && $row[$check]) { - $data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>'; + $data[] = '<a href="' . $row[$check] . '">' . phpbb::$user->lang['LOGVIEW_' . strtoupper($check)] . '</a>'; } } @@ -157,7 +155,7 @@ class acp_logs 'REPORTEE_USERNAME' => ($row['reportee_username'] && $row['user_id'] != $row['reportee_id']) ? $row['reportee_username_full'] : '', 'IP' => $row['ip'], - 'DATE' => $user->format_date($row['time']), + 'DATE' => phpbb::$user->format_date($row['time']), 'ACTION' => $row['action'], 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', 'ID' => $row['id'], diff --git a/phpBB/modules/acp/acp_modules.php b/phpBB/modules/acp/acp_modules.php index 977a47a2e4..afc3c75b1e 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 $auth, $template, $module; + global $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); @@ -599,8 +599,6 @@ 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 $auth; - $sql = 'SELECT module_id, module_enabled, module_basename, parent_id, module_langname, left_id, right_id, module_auth FROM ' . MODULES_TABLE . " WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "' diff --git a/phpBB/modules/acp/acp_permission_roles.php b/phpBB/modules/acp/acp_permission_roles.php index 4b37bd01cc..ca497850ac 100644 --- a/phpBB/modules/acp/acp_permission_roles.php +++ b/phpBB/modules/acp/acp_permission_roles.php @@ -25,14 +25,12 @@ class acp_permission_roles function main($id, $mode) { - 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); $auth_admin = new auth_admin(); - $user->add_lang('acp/permissions'); + phpbb::$user->add_lang('acp/permissions'); add_permission_language(); $this->tpl_name = 'acp_permission_roles'; @@ -73,8 +71,8 @@ class acp_permission_roles } $template->assign_vars(array( - 'L_TITLE' => $user->lang[$this->page_title], - 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN']) + 'L_TITLE' => phpbb::$user->lang[$this->page_title], + 'L_EXPLAIN' => phpbb::$user->lang[$this->page_title . '_EXPLAIN']) ); // Take action... admin submitted something @@ -86,7 +84,7 @@ class acp_permission_roles if (!$role_id) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -98,16 +96,16 @@ class acp_permission_roles if (!$role_row) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) { $this->remove_role($role_id, $permission_type); - $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; + $role_name = (!empty(phpbb::$user->lang[$role_row['role_name']])) ? phpbb::$user->lang[$role_row['role_name']] : $role_row['role_name']; add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_REMOVED', $role_name); - trigger_error($user->lang['ROLE_DELETED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['ROLE_DELETED'] . adm_back_link($this->u_action)); } else { @@ -124,7 +122,7 @@ class acp_permission_roles case 'edit': if (!$role_id) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } // Get role we edit @@ -137,7 +135,7 @@ class acp_permission_roles if (!$role_row) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } // no break; @@ -146,7 +144,7 @@ class acp_permission_roles if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } $role_name = utf8_normalize_nfc(request_var('role_name', '', true)); @@ -155,12 +153,12 @@ class acp_permission_roles if (!$role_name) { - trigger_error($user->lang['NO_ROLE_NAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_ROLE_NAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } if (utf8_strlen($role_description) > 4000) { - trigger_error($user->lang['ROLE_DESCRIPTION_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['ROLE_DESCRIPTION_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); } // if we add/edit a role we check the name to be unique among the settings... @@ -175,7 +173,7 @@ class acp_permission_roles // Make sure we only print out the error if we add the role or change it's name if ($row && ($mode == 'add' || ($mode == 'edit' && $role_row['role_name'] != $role_name))) { - trigger_error(sprintf($user->lang['ROLE_NAME_ALREADY_EXIST'], $role_name) . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(sprintf(phpbb::$user->lang['ROLE_NAME_ALREADY_EXIST'], $role_name) . adm_back_link($this->u_action), E_USER_WARNING); } $sql_ary = array( @@ -212,10 +210,10 @@ class acp_permission_roles // Now add the auth settings $auth_admin->acl_set_role($role_id, $auth_settings); - $role_name = (!empty($user->lang[$role_name])) ? $user->lang[$role_name] : $role_name; + $role_name = (!empty(phpbb::$user->lang[$role_name])) ? phpbb::$user->lang[$role_name] : $role_name; add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_' . strtoupper($action), $role_name); - trigger_error($user->lang['ROLE_' . strtoupper($action) . '_SUCCESS'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['ROLE_' . strtoupper($action) . '_SUCCESS'] . adm_back_link($this->u_action)); break; } @@ -275,7 +273,7 @@ class acp_permission_roles { if (!$role_id) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -302,7 +300,7 @@ class acp_permission_roles if (!$role_row) { - trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } $template->assign_vars(array( @@ -313,7 +311,7 @@ class acp_permission_roles 'ROLE_NAME' => $role_row['role_name'], 'ROLE_DESCRIPTION' => $role_row['role_description'], - 'L_ACL_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)], + 'L_ACL_TYPE' => phpbb::$user->lang['ACL_TYPE_' . strtoupper($permission_type)], ) ); @@ -347,11 +345,11 @@ class acp_permission_roles if (sizeof($hold_ary)) { - $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; + $role_name = (!empty(phpbb::$user->lang[$role_row['role_name']])) ? phpbb::$user->lang[$role_row['role_name']] : $role_row['role_name']; $template->assign_vars(array( 'S_DISPLAY_ROLE_MASK' => true, - 'L_ROLE_ASSIGNED_TO' => sprintf($user->lang['ROLE_ASSIGNED_TO'], $role_name)) + 'L_ROLE_ASSIGNED_TO' => sprintf(phpbb::$user->lang['ROLE_ASSIGNED_TO'], $role_name)) ); $auth_admin->display_role_mask($hold_ary); @@ -411,11 +409,11 @@ class acp_permission_roles $s_role_options = ''; while ($row = $db->sql_fetchrow($result)) { - $role_name = (!empty($user->lang[$row['role_name']])) ? $user->lang[$row['role_name']] : $row['role_name']; + $role_name = (!empty(phpbb::$user->lang[$row['role_name']])) ? phpbb::$user->lang[$row['role_name']] : $row['role_name']; $template->assign_block_vars('roles', array( 'ROLE_NAME' => $role_name, - 'ROLE_DESCRIPTION' => (!empty($user->lang[$row['role_description']])) ? $user->lang[$row['role_description']] : nl2br($row['role_description']), + 'ROLE_DESCRIPTION' => (!empty(phpbb::$user->lang[$row['role_description']])) ? phpbb::$user->lang[$row['role_description']] : nl2br($row['role_description']), 'U_EDIT' => $this->u_action . '&action=edit&role_id=' . $row['role_id'], 'U_REMOVE' => $this->u_action . '&action=remove&role_id=' . $row['role_id'], @@ -429,7 +427,7 @@ class acp_permission_roles if ($display_item == $row['role_id']) { $template->assign_vars(array( - 'L_ROLE_ASSIGNED_TO' => sprintf($user->lang['ROLE_ASSIGNED_TO'], $role_name)) + 'L_ROLE_ASSIGNED_TO' => sprintf(phpbb::$user->lang['ROLE_ASSIGNED_TO'], $role_name)) ); } } @@ -455,8 +453,6 @@ class acp_permission_roles */ function display_auth_options($auth_options) { - global $template, $user; - $content_array = $categories = array(); $key_sort_array = array(0); $auth_options = array(0 => $auth_options); @@ -472,7 +468,7 @@ class acp_permission_roles foreach ($content_array as $cat => $cat_array) { $template->assign_block_vars('auth', array( - 'CAT_NAME' => $user->lang['permission_cat'][$cat], + 'CAT_NAME' => phpbb::$user->lang['permission_cat'][$cat], 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, @@ -487,7 +483,7 @@ class acp_permission_roles 'S_NO' => ($allowed == phpbb::ACL_NO) ? true : false, 'FIELD_NAME' => $permission, - 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) + 'PERMISSION' => phpbb::$user->lang['acl_' . $permission]['lang']) ); } } @@ -498,8 +494,6 @@ class acp_permission_roles */ function remove_role($role_id, $permission_type) { - global $db; - $auth_admin = new auth_admin(); // Get complete auth array diff --git a/phpBB/modules/acp/acp_permissions.php b/phpBB/modules/acp/acp_permissions.php index 725532db2c..9617e41436 100644 --- a/phpBB/modules/acp/acp_permissions.php +++ b/phpBB/modules/acp/acp_permissions.php @@ -26,14 +26,12 @@ class acp_permissions function main($id, $mode) { - 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); $auth_admin = new auth_admin(); - $user->add_lang('acp/permissions'); + phpbb::$user->add_lang('acp/permissions'); add_permission_language(); $this->tpl_name = 'acp_permissions'; @@ -49,7 +47,7 @@ class acp_permissions if ($user_id && isset($auth_admin->acl_options['id'][$permission]) && $auth->acl_get('a_viewauth')) { - $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $user->lang['acl_' . $permission]['lang']); + $this->page_title = sprintf(phpbb::$user->lang['TRACE_PERMISSION'], phpbb::$user->lang['acl_' . $permission]['lang']); $this->permission_trace($user_id, $forum_id, $permission); return; } @@ -107,7 +105,7 @@ class acp_permissions if (!sizeof($user_id)) { - trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } } unset($username); @@ -204,8 +202,8 @@ class acp_permissions } $template->assign_vars(array( - 'L_TITLE' => $user->lang[$this->page_title], - 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN']) + 'L_TITLE' => phpbb::$user->lang[$this->page_title], + 'L_EXPLAIN' => phpbb::$user->lang[$this->page_title . '_EXPLAIN']) ); // Get permission type @@ -213,7 +211,7 @@ class acp_permissions if (!in_array($permission_type, $this->permission_dropdown)) { - trigger_error($user->lang['WRONG_PERMISSION_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_PERMISSION_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -226,7 +224,7 @@ class acp_permissions if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } // All users/groups selected? $all_users = phpbb_request::is_set_post('all_users'); @@ -252,18 +250,18 @@ class acp_permissions } else { - trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } break; case 'apply_permissions': if (!phpbb_request::is_set_post('setting')) { - trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } $this->set_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id); @@ -272,11 +270,11 @@ class acp_permissions case 'apply_all_permissions': if (!phpbb_request::is_set_post('setting')) { - trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } $this->set_all_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id); @@ -464,12 +462,12 @@ class acp_permissions // Do not allow forum_ids being set and no other setting defined (will bog down the server too much) if (sizeof($forum_id) && !sizeof($user_id) && !sizeof($group_id)) { - trigger_error($user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action), E_USER_WARNING); } $template->assign_vars(array( 'S_PERMISSION_DROPDOWN' => (sizeof($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, - 'L_PERMISSION_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)], + 'L_PERMISSION_TYPE' => phpbb::$user->lang['ACL_TYPE_' . strtoupper($permission_type)], 'U_ACTION' => $this->u_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields) @@ -500,8 +498,6 @@ class acp_permissions */ function build_subforum_options($forum_list) { - global $user; - $s_options = ''; $forum_list = array_merge($forum_list); @@ -530,7 +526,7 @@ class acp_permissions if ($branch_there) { - $s_options .= ' [' . $user->lang['PLUS_SUBFORUMS'] . ']'; + $s_options .= ' [' . phpbb::$user->lang['PLUS_SUBFORUMS'] . ']'; } $s_options .= '</option>'; @@ -544,8 +540,6 @@ class acp_permissions */ function build_permission_dropdown($options, $default_option, $permission_scope) { - global $user, $auth; - $s_dropdown_options = ''; foreach ($options as $setting) { @@ -555,7 +549,7 @@ class acp_permissions } $selected = ($setting == $default_option) ? ' selected="selected"' : ''; - $l_setting = (isset($user->lang['permission_type'][$permission_scope][$setting])) ? $user->lang['permission_type'][$permission_scope][$setting] : $user->lang['permission_type'][$setting]; + $l_setting = (isset(phpbb::$user->lang['permission_type'][$permission_scope][$setting])) ? phpbb::$user->lang['permission_type'][$permission_scope][$setting] : phpbb::$user->lang['permission_type'][$setting]; $s_dropdown_options .= '<option value="' . $setting . '"' . $selected . '>' . $l_setting . '</option>'; } @@ -567,8 +561,6 @@ class acp_permissions */ function check_existence($mode, &$ids) { - global $db, $user; - switch ($mode) { case 'user': @@ -604,7 +596,7 @@ class acp_permissions if (!sizeof($ids)) { - trigger_error($user->lang['SELECTED_' . strtoupper($mode) . '_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['SELECTED_' . strtoupper($mode) . '_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -613,8 +605,6 @@ class acp_permissions */ function set_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id) { - global $user, $auth; - $psubmit = request_var('psubmit', array(0 => array(0 => 0))); // User or group to be set? @@ -623,7 +613,7 @@ class acp_permissions // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } $ug_id = $forum_id = 0; @@ -690,7 +680,7 @@ class acp_permissions $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_id, $forum_id); - trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } /** @@ -698,15 +688,13 @@ class acp_permissions */ function set_all_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id) { - global $user, $auth; - // User or group to be set? $ug_type = (sizeof($user_id)) ? 'user' : 'group'; // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } $auth_settings = phpbb_request::variable('setting', array(0 => array(0 => array('' => 0))), false, phpbb_request::POST); @@ -755,7 +743,7 @@ class acp_permissions $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids); - trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } /** @@ -764,8 +752,6 @@ class acp_permissions */ function check_assigned_role($role_id, &$auth_settings) { - global $db; - $sql = 'SELECT o.auth_option, r.auth_setting FROM ' . ACL_OPTIONS_TABLE . ' o, ' . ACL_ROLES_DATA_TABLE . ' r WHERE o.auth_option_id = r.auth_option_id @@ -801,15 +787,13 @@ class acp_permissions */ function remove_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id, &$forum_id) { - global $user, $db, $auth; - // User or group to be set? $ug_type = (sizeof($user_id)) ? 'user' : 'group'; // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } $auth_admin->acl_delete($ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : false), $permission_type); @@ -822,7 +806,7 @@ class acp_permissions $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0))); - trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } /** @@ -830,8 +814,6 @@ class acp_permissions */ function log_action($mode, $action, $permission_type, $ug_type, $ug_id, $forum_id) { - global $db, $user; - if (!is_array($ug_id)) { $ug_id = array($ug_id); @@ -850,7 +832,7 @@ class acp_permissions $l_ug_list = ''; while ($row = $db->sql_fetchrow($result)) { - $l_ug_list .= (($l_ug_list != '') ? ', ' : '') . ((isset($row['group_type']) && $row['group_type'] == GROUP_SPECIAL) ? '<span class="sep">' . $user->lang['G_' . $row['name']] . '</span>' : $row['name']); + $l_ug_list .= (($l_ug_list != '') ? ', ' : '') . ((isset($row['group_type']) && $row['group_type'] == GROUP_SPECIAL) ? '<span class="sep">' . phpbb::$user->lang['G_' . $row['name']] . '</span>' : $row['name']); } $db->sql_freeresult($result); @@ -884,9 +866,7 @@ class acp_permissions */ function permission_trace($user_id, $forum_id, $permission) { - global $db, $template, $user, $auth; - - if ($user_id != $user->data['user_id']) + if ($user_id != phpbb::$user->data['user_id']) { $sql = 'SELECT user_id, username, user_permissions, user_type FROM ' . USERS_TABLE . ' @@ -897,7 +877,7 @@ class acp_permissions } else { - $userdata = $user->data; + $userdata = phpbb::$user->data; } if (!$userdata) @@ -920,7 +900,7 @@ class acp_permissions $back = request_var('back', 0); $template->assign_vars(array( - 'PERMISSION' => $user->lang['acl_' . $permission]['lang'], + 'PERMISSION' => phpbb::$user->lang['acl_' . $permission]['lang'], 'PERMISSION_USERNAME' => $userdata['username'], 'FORUM_NAME' => $forum_name, @@ -930,8 +910,8 @@ class acp_permissions ); $template->assign_block_vars('trace', array( - 'WHO' => $user->lang['DEFAULT'], - 'INFORMATION' => $user->lang['TRACE_DEFAULT'], + 'WHO' => phpbb::$user->lang['DEFAULT'], + 'INFORMATION' => phpbb::$user->lang['TRACE_DEFAULT'], 'S_SETTING_NO' => true, 'S_TOTAL_NO' => true) @@ -950,7 +930,7 @@ class acp_permissions { $groups[$row['group_id']] = array( 'auth_setting' => phpbb::ACL_NO, - 'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'] + 'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name'] ); } $db->sql_freeresult($result); @@ -974,16 +954,16 @@ class acp_permissions switch ($row['auth_setting']) { case phpbb::ACL_NO: - $information = $user->lang['TRACE_GROUP_NO' . $add_key]; + $information = phpbb::$user->lang['TRACE_GROUP_NO' . $add_key]; break; case phpbb::ACL_YES: - $information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_GROUP_YES_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? $user->lang['TRACE_GROUP_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_YES_TOTAL_NO' . $add_key]); + $information = ($total == phpbb::ACL_YES) ? phpbb::$user->lang['TRACE_GROUP_YES_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? phpbb::$user->lang['TRACE_GROUP_YES_TOTAL_NEVER' . $add_key] : phpbb::$user->lang['TRACE_GROUP_YES_TOTAL_NO' . $add_key]); $total = ($total == phpbb::ACL_NO) ? phpbb::ACL_YES : $total; break; case phpbb::ACL_NEVER: - $information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_NEVER_TOTAL_NO' . $add_key]); + $information = ($total == phpbb::ACL_YES) ? phpbb::$user->lang['TRACE_GROUP_NEVER_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? phpbb::$user->lang['TRACE_GROUP_NEVER_TOTAL_NEVER' . $add_key] : phpbb::$user->lang['TRACE_GROUP_NEVER_TOTAL_NO' . $add_key]); $total = phpbb::ACL_NEVER; break; } @@ -1009,17 +989,17 @@ class acp_permissions switch ($auth_setting) { case phpbb::ACL_NO: - $information = ($total == phpbb::ACL_NO) ? $user->lang['TRACE_USER_NO_TOTAL_NO' . $add_key] : $user->lang['TRACE_USER_KEPT' . $add_key]; + $information = ($total == phpbb::ACL_NO) ? phpbb::$user->lang['TRACE_USER_NO_TOTAL_NO' . $add_key] : phpbb::$user->lang['TRACE_USER_KEPT' . $add_key]; $total = ($total == phpbb::ACL_NO) ? phpbb::ACL_NEVER : $total; break; case phpbb::ACL_YES: - $information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_USER_YES_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? $user->lang['TRACE_USER_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_YES_TOTAL_NO' . $add_key]); + $information = ($total == phpbb::ACL_YES) ? phpbb::$user->lang['TRACE_USER_YES_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? phpbb::$user->lang['TRACE_USER_YES_TOTAL_NEVER' . $add_key] : phpbb::$user->lang['TRACE_USER_YES_TOTAL_NO' . $add_key]); $total = ($total == phpbb::ACL_NO) ? phpbb::ACL_YES : $total; break; case phpbb::ACL_NEVER: - $information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_USER_NEVER_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? $user->lang['TRACE_USER_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_NEVER_TOTAL_NO' . $add_key]); + $information = ($total == phpbb::ACL_YES) ? phpbb::$user->lang['TRACE_USER_NEVER_TOTAL_YES' . $add_key] : (($total == phpbb::ACL_NEVER) ? phpbb::$user->lang['TRACE_USER_NEVER_TOTAL_NEVER' . $add_key] : phpbb::$user->lang['TRACE_USER_NEVER_TOTAL_NO' . $add_key]); $total = phpbb::ACL_NEVER; break; } @@ -1038,7 +1018,7 @@ class acp_permissions if ($forum_id != 0 && isset($auth->acl_options['global'][$permission])) { - if ($user_id != $user->data['user_id']) + if ($user_id != phpbb::$user->data['user_id']) { $auth2 = new auth(); $auth2->acl($userdata); @@ -1051,19 +1031,19 @@ class acp_permissions if ($auth_setting) { - $information = ($total == phpbb::ACL_YES) ? $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_YES'] : $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_NEVER']; + $information = ($total == phpbb::ACL_YES) ? phpbb::$user->lang['TRACE_USER_GLOBAL_YES_TOTAL_YES'] : phpbb::$user->lang['TRACE_USER_GLOBAL_YES_TOTAL_NEVER']; $total = phpbb::ACL_YES; } else { - $information = $user->lang['TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT']; + $information = phpbb::$user->lang['TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT']; } // If there is no auth information we do not need to worry the user by showing non-relevant data. if ($auth_setting) { $template->assign_block_vars('trace', array( - 'WHO' => sprintf($user->lang['TRACE_GLOBAL_SETTING'], $userdata['username']), + 'WHO' => sprintf(phpbb::$user->lang['TRACE_GLOBAL_SETTING'], $userdata['username']), 'INFORMATION' => sprintf($information, '<a href="' . $this->u_action . "&u=$user_id&f=0&auth=$permission&back=$forum_id\">", '</a>'), 'S_SETTING_NO' => false, @@ -1081,7 +1061,7 @@ class acp_permissions { $template->assign_block_vars('trace', array( 'WHO' => $userdata['username'], - 'INFORMATION' => $user->lang['TRACE_USER_FOUNDER'], + 'INFORMATION' => phpbb::$user->lang['TRACE_USER_FOUNDER'], 'S_SETTING_NO' => ($auth_setting == phpbb::ACL_NO) ? true : false, 'S_SETTING_YES' => ($auth_setting == phpbb::ACL_YES) ? true : false, @@ -1107,8 +1087,6 @@ class acp_permissions */ function retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type) { - global $db, $user; - $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((sizeof($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); // Permission options are only able to be a permission set... therefore we will pre-fetch the possible options and also the possible roles @@ -1178,7 +1156,7 @@ class acp_permissions $defined_group_ids = array(); while ($row = $db->sql_fetchrow($result)) { - $s_defined_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $s_defined_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; $defined_group_ids[] = $row['group_id']; } $db->sql_freeresult($result); diff --git a/phpBB/modules/acp/acp_php_info.php b/phpBB/modules/acp/acp_php_info.php index 0e042bebe0..5f7b516f66 100644 --- a/phpBB/modules/acp/acp_php_info.php +++ b/phpBB/modules/acp/acp_php_info.php @@ -25,8 +25,6 @@ class acp_php_info function main($id, $mode) { - global $db, $user, $auth, $template; - if ($mode != 'info') { trigger_error('NO_MODE', E_USER_ERROR); diff --git a/phpBB/modules/acp/acp_profile.php b/phpBB/modules/acp/acp_profile.php index 529f84de94..fc1c8e1004 100644 --- a/phpBB/modules/acp/acp_profile.php +++ b/phpBB/modules/acp/acp_profile.php @@ -28,13 +28,11 @@ class acp_profile function main($id, $mode) { - global $db, $user, $auth, $template; - include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_profile_fields.' . PHP_EXT); - $user->add_lang(array('ucp', 'acp/profile')); + phpbb::$user->add_lang(array('ucp', 'acp/profile')); $this->tpl_name = 'acp_profile'; $this->page_title = 'ACP_CUSTOM_PROFILE_FIELDS'; @@ -101,7 +99,7 @@ class acp_profile if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -193,7 +191,7 @@ class acp_profile $db->sql_transaction('commit'); add_log('admin', 'LOG_PROFILE_FIELD_REMOVED', $field_ident); - trigger_error($user->lang['REMOVED_PROFILE_FIELD'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['REMOVED_PROFILE_FIELD'] . adm_back_link($this->u_action)); } else { @@ -212,7 +210,7 @@ class acp_profile if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT lang_id @@ -224,7 +222,7 @@ class acp_profile if (!in_array($default_lang_id, $this->lang_defs['entry'][$field_id])) { - trigger_error($user->lang['DEFAULT_LANGUAGE_NOT_FILLED'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['DEFAULT_LANGUAGE_NOT_FILLED'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " @@ -240,7 +238,7 @@ class acp_profile $db->sql_freeresult($result); add_log('admin', 'LOG_PROFILE_FIELD_ACTIVATE', $field_ident); - trigger_error($user->lang['PROFILE_FIELD_ACTIVATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['PROFILE_FIELD_ACTIVATED'] . adm_back_link($this->u_action)); break; @@ -249,7 +247,7 @@ class acp_profile if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " @@ -265,7 +263,7 @@ class acp_profile $db->sql_freeresult($result); add_log('admin', 'LOG_PROFILE_FIELD_DEACTIVATE', $field_ident); - trigger_error($user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action)); break; @@ -298,7 +296,7 @@ class acp_profile { if (!$field_id) { - trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT l.*, f.* @@ -324,7 +322,7 @@ class acp_profile if (!$field_row) { - trigger_error($user->lang['FIELD_NOT_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FIELD_NOT_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } $this->edit_lang_id = $field_row['lang_id']; @@ -357,7 +355,7 @@ class acp_profile if (!$field_type) { - trigger_error($user->lang['NO_FIELD_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FIELD_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } $field_row = array_merge($default_values[$field_type], array( @@ -588,32 +586,32 @@ class acp_profile // Check values for step 1 if ($cp->vars['field_ident'] == '') { - $error[] = $user->lang['EMPTY_FIELD_IDENT']; + $error[] = phpbb::$user->lang['EMPTY_FIELD_IDENT']; } if (!preg_match('/^[a-z_]+$/', $cp->vars['field_ident'])) { - $error[] = $user->lang['INVALID_CHARS_FIELD_IDENT']; + $error[] = phpbb::$user->lang['INVALID_CHARS_FIELD_IDENT']; } if (strlen($cp->vars['field_ident']) > 17) { - $error[] = $user->lang['INVALID_FIELD_IDENT_LEN']; + $error[] = phpbb::$user->lang['INVALID_FIELD_IDENT_LEN']; } if ($cp->vars['lang_name'] == '') { - $error[] = $user->lang['EMPTY_USER_FIELD_NAME']; + $error[] = phpbb::$user->lang['EMPTY_USER_FIELD_NAME']; } if ($field_type == FIELD_DROPDOWN && !sizeof($cp->vars['lang_options'])) { - $error[] = $user->lang['NO_FIELD_ENTRIES']; + $error[] = phpbb::$user->lang['NO_FIELD_ENTRIES']; } if ($field_type == FIELD_BOOL && (empty($cp->vars['lang_options'][0]) || empty($cp->vars['lang_options'][1]))) { - $error[] = $user->lang['NO_FIELD_ENTRIES']; + $error[] = phpbb::$user->lang['NO_FIELD_ENTRIES']; } // Check for already existing field ident @@ -628,7 +626,7 @@ class acp_profile if ($row) { - $error[] = $user->lang['FIELD_IDENT_ALREADY_EXIST']; + $error[] = phpbb::$user->lang['FIELD_IDENT_ALREADY_EXIST']; } } } @@ -720,8 +718,8 @@ class acp_profile 'S_EDIT_MODE' => ($action == 'edit') ? true : false, 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', - 'L_TITLE' => $user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)], - 'L_EXPLAIN' => $user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)], + 'L_TITLE' => phpbb::$user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)], + 'L_EXPLAIN' => phpbb::$user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)], 'U_ACTION' => $this->u_action . "&action=$action&step=$step", 'U_BACK' => $this->u_action) @@ -741,8 +739,8 @@ 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'], phpbb::$config['default_lang']), - 'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$field_type])], + 'L_LANG_SPECIFIC' => sprintf(phpbb::$user->lang['LANG_SPECIFIC_OPTIONS'], phpbb::$config['default_lang']), + 'FIELD_TYPE' => phpbb::$user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$field_type])], 'FIELD_IDENT' => $cp->vars['field_ident'], 'LANG_NAME' => $cp->vars['lang_name'], 'LANG_EXPLAIN' => $cp->vars['lang_explain']) @@ -755,7 +753,7 @@ class acp_profile 'S_TEXT' => ($field_type == FIELD_TEXT) ? true : false, 'S_STRING' => ($field_type == FIELD_STRING) ? true : false, - 'L_DEFAULT_VALUE_EXPLAIN' => $user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN'], + 'L_DEFAULT_VALUE_EXPLAIN' => phpbb::$user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN'], 'LANG_DEFAULT_VALUE' => $cp->vars['lang_default_value']) ); } @@ -782,7 +780,7 @@ class acp_profile 'S_BOOL' => ($field_type == FIELD_BOOL) ? true : false, 'S_DROPDOWN' => ($field_type == FIELD_DROPDOWN) ? true : false, - 'L_LANG_OPTIONS_EXPLAIN' => $user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_ENTRIES_EXPLAIN'], + 'L_LANG_OPTIONS_EXPLAIN' => phpbb::$user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_ENTRIES_EXPLAIN'], 'LANG_OPTIONS' => ($field_type == FIELD_DROPDOWN) ? implode("\n", $cp->vars['lang_options']) : '', 'FIRST_LANG_OPTION' => ($field_type == FIELD_BOOL) ? $cp->vars['lang_options'][0] : '', 'SECOND_LANG_OPTION' => ($field_type == FIELD_BOOL) ? $cp->vars['lang_options'][1] : '') @@ -795,7 +793,7 @@ class acp_profile $template->assign_vars(array( 'S_STEP_TWO' => true, - 'L_NEXT_STEP' => (sizeof($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS']) + 'L_NEXT_STEP' => (sizeof($this->lang_defs['iso']) == 1) ? phpbb::$user->lang['SAVE'] : phpbb::$user->lang['PROFILE_LANG_OPTIONS']) ); // Build options based on profile type @@ -818,7 +816,7 @@ class acp_profile foreach ($options as $lang_id => $lang_ary) { $template->assign_block_vars('options', array( - 'LANGUAGE' => sprintf($user->lang[(($lang_id == $this->edit_lang_id) ? 'DEFAULT_' : '') . 'ISO_LANGUAGE'], $lang_ary['lang_iso'])) + 'LANGUAGE' => sprintf(phpbb::$user->lang[(($lang_id == $this->edit_lang_id) ? 'DEFAULT_' : '') . 'ISO_LANGUAGE'], $lang_ary['lang_iso'])) ); foreach ($lang_ary['fields'] as $field_ident => $field_ary) @@ -864,9 +862,9 @@ class acp_profile $template->assign_block_vars('fields', array( 'FIELD_IDENT' => $row['field_ident'], - 'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$row['field_type']])], + 'FIELD_TYPE' => phpbb::$user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$row['field_type']])], - 'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang], + 'L_ACTIVATE_DEACTIVATE' => phpbb::$user->lang[$active_lang], 'U_ACTIVATE_DEACTIVATE' => $this->u_action . "&action=$active_value&field_id=$id", 'U_EDIT' => $this->u_action . "&action=edit&field_id=$id", 'U_TRANSLATE' => $this->u_action . "&action=edit&field_id=$id&step=3", @@ -888,7 +886,7 @@ class acp_profile $s_select_type = ''; foreach (custom_profile::$profile_types as $key => $value) { - $s_select_type .= '<option value="' . $key . '">' . $user->lang['FIELD_' . strtoupper($value)] . '</option>'; + $s_select_type .= '<option value="' . $key . '">' . phpbb::$user->lang['FIELD_' . strtoupper($value)] . '</option>'; } $template->assign_vars(array( @@ -902,8 +900,6 @@ class acp_profile */ function build_language_options(&$cp, $field_type, $action = 'create') { - global $user, $db; - $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 @@ -951,13 +947,13 @@ class acp_profile { $lang_options[1]['lang_iso'] = $this->lang_defs['id'][$default_lang_id]; $lang_options[1]['fields'][$field] = array( - 'TITLE' => $user->lang['CP_' . strtoupper($field)], + 'TITLE' => phpbb::$user->lang['CP_' . strtoupper($field)], 'FIELD' => '<dd>' . ((is_array($cp->vars[$field])) ? implode('<br />', $cp->vars[$field]) : bbcode_nl2br($cp->vars[$field])) . '</dd>' ); - if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) + if (isset(phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) { - $lang_options[1]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; + $lang_options[1]['fields'][$field]['EXPLAIN'] = phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; } } @@ -976,25 +972,25 @@ class acp_profile case 'two_options': $lang_options[$lang_id]['fields'][$field] = array( - 'TITLE' => $user->lang['CP_' . strtoupper($field)], + 'TITLE' => phpbb::$user->lang['CP_' . strtoupper($field)], 'FIELD' => ' - <dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . ((isset($value[$lang_id][0])) ? $value[$lang_id][0] : $var[0]) . '" /> ' . $user->lang['FIRST_OPTION'] . '</dd> - <dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . ((isset($value[$lang_id][1])) ? $value[$lang_id][1] : $var[1]) . '" /> ' . $user->lang['SECOND_OPTION'] . '</dd>' + <dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . ((isset($value[$lang_id][0])) ? $value[$lang_id][0] : $var[0]) . '" /> ' . phpbb::$user->lang['FIRST_OPTION'] . '</dd> + <dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . ((isset($value[$lang_id][1])) ? $value[$lang_id][1] : $var[1]) . '" /> ' . phpbb::$user->lang['SECOND_OPTION'] . '</dd>' ); break; case 'optionfield': $value = ((isset($value[$lang_id])) ? ((is_array($value[$lang_id])) ? implode("\n", $value[$lang_id]) : $value[$lang_id]) : implode("\n", $var)); $lang_options[$lang_id]['fields'][$field] = array( - 'TITLE' => $user->lang['CP_' . strtoupper($field)], + 'TITLE' => phpbb::$user->lang['CP_' . strtoupper($field)], 'FIELD' => '<dd><textarea name="l_' . $field . '[' . $lang_id . ']" rows="7" cols="80">' . $value . '</textarea></dd>' ); break; } - if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) + if (isset(phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) { - $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; + $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; } } else @@ -1002,13 +998,13 @@ class acp_profile $var = ($action == 'create' || !is_array($cp->vars[$field])) ? $cp->vars[$field] : $cp->vars[$field][$lang_id]; $lang_options[$lang_id]['fields'][$field] = array( - 'TITLE' => $user->lang['CP_' . strtoupper($field)], + 'TITLE' => phpbb::$user->lang['CP_' . strtoupper($field)], 'FIELD' => ($field_type == 'string') ? '<dd><input class="medium" type="text" name="l_' . $field . '[' . $lang_id . ']" value="' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '" /></dd>' : '<dd><textarea name="l_' . $field . '[' . $lang_id . ']" rows="3" cols="80">' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '</textarea></dd>' ); - if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) + if (isset(phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) { - $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; + $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = phpbb::$user->lang['CP_' . strtoupper($field) . '_EXPLAIN']; } } } @@ -1022,8 +1018,6 @@ class acp_profile */ function save_profile_field(&$cp, $field_type, $action = 'create') { - global $db, $user; - $field_id = request_var('field_id', 0); // Collect all information, if something is going wrong, abort the operation @@ -1297,12 +1291,12 @@ class acp_profile if ($action == 'edit') { add_log('admin', 'LOG_PROFILE_FIELD_EDIT', $cp->vars['field_ident'] . ':' . $cp->vars['lang_name']); - trigger_error($user->lang['CHANGED_PROFILE_FIELD'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['CHANGED_PROFILE_FIELD'] . adm_back_link($this->u_action)); } else { add_log('admin', 'LOG_PROFILE_FIELD_CREATE', substr($field_ident, 3) . ':' . $cp->vars['lang_name']); - trigger_error($user->lang['ADDED_PROFILE_FIELD'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['ADDED_PROFILE_FIELD'] . adm_back_link($this->u_action)); } } @@ -1311,8 +1305,6 @@ class acp_profile */ function update_insert($table, $sql_ary, $where_fields) { - global $db; - $where_sql = array(); $check_key = ''; @@ -1359,8 +1351,6 @@ class acp_profile */ function add_field_ident($field_ident, $field_type) { - global $db; - switch ($db->dbms_type) { case 'mysql': diff --git a/phpBB/modules/acp/acp_prune.php b/phpBB/modules/acp/acp_prune.php index c901f03269..2974d8c9c2 100644 --- a/phpBB/modules/acp/acp_prune.php +++ b/phpBB/modules/acp/acp_prune.php @@ -25,9 +25,7 @@ class acp_prune function main($id, $mode) { - global $user; - - $user->add_lang('acp/prune'); + phpbb::$user->add_lang('acp/prune'); include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); switch ($mode) @@ -51,8 +49,6 @@ class acp_prune */ function prune_forums($id, $mode) { - global $db, $user, $auth, $template; - $all_forums = request_var('all_forums', 0); $forum_id = request_var('f', array(0)); $submit = phpbb_request::is_set_post('submit'); @@ -160,7 +156,7 @@ class acp_prune } else { - confirm_box(false, $user->lang['PRUNE_FORUM_CONFIRM'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['PRUNE_FORUM_CONFIRM'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'submit' => 1, @@ -197,7 +193,7 @@ class acp_prune if (!$row) { $db->sql_freeresult($result); - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FORUM'] . adm_back_link($this->u_action), E_USER_WARNING); } $forum_list = $s_hidden_fields = ''; @@ -213,7 +209,7 @@ class acp_prune $l_selected_forums = (sizeof($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; $template->assign_vars(array( - 'L_SELECTED_FORUMS' => $user->lang[$l_selected_forums], + 'L_SELECTED_FORUMS' => phpbb::$user->lang[$l_selected_forums], 'U_ACTION' => $this->u_action, 'U_BACK' => $this->u_action, 'FORUM_LIST' => $forum_list, @@ -227,9 +223,7 @@ class acp_prune */ function prune_users($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('memberlist'); + phpbb::$user->add_lang('memberlist'); $prune = phpbb_request::is_set_post('prune'); @@ -273,11 +267,11 @@ class acp_prune } add_log('admin', $l_log, implode(', ', $usernames)); - $msg = $user->lang['USER_' . strtoupper($action) . '_SUCCESS']; + $msg = phpbb::$user->lang['USER_' . strtoupper($action) . '_SUCCESS']; } else { - $msg = $user->lang['USER_PRUNE_FAILURE']; + $msg = phpbb::$user->lang['USER_PRUNE_FAILURE']; } trigger_error($msg . adm_back_link($this->u_action)); @@ -290,7 +284,7 @@ class acp_prune if (!sizeof($user_ids)) { - trigger_error($user->lang['USER_PRUNE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['USER_PRUNE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); } // Assign to template @@ -299,7 +293,7 @@ class acp_prune $template->assign_block_vars('users', array( 'USERNAME' => $usernames[$user_id], 'U_PROFILE' => append_sid('memberlist', 'mode=viewprofile&u=' . $user_id), - 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', + 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=users&mode=overview&u=' . $user_id, true, phpbb::$user->session_id) : '', )); } @@ -308,7 +302,7 @@ class acp_prune 'S_DELETE' => ($action == 'delete') ? true : false, )); - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'prune' => 1, @@ -329,7 +323,7 @@ class acp_prune } } - $find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']); + $find_count = array('lt' => phpbb::$user->lang['LESS_THAN'], 'eq' => phpbb::$user->lang['EQUAL_TO'], 'gt' => phpbb::$user->lang['MORE_THAN']); $s_find_count = ''; foreach ($find_count as $key => $value) @@ -338,7 +332,7 @@ class acp_prune $s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; } - $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']); + $find_time = array('lt' => phpbb::$user->lang['BEFORE'], 'gt' => phpbb::$user->lang['AFTER']); $s_find_join_time = ''; foreach ($find_time as $key => $value) { @@ -365,8 +359,6 @@ class acp_prune */ function get_prune_users(&$user_ids, &$usernames) { - global $user, $db; - $users = request_var('users', '', true); if ($users) @@ -390,7 +382,7 @@ class acp_prune if ((sizeof($active) && sizeof($active) != 3) || (sizeof($joined) && sizeof($joined) != 3)) { - trigger_error($user->lang['WRONG_ACTIVE_JOINED_DATE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['WRONG_ACTIVE_JOINED_DATE'] . adm_back_link($this->u_action), E_USER_WARNING); } $count = request_var('count', ''); @@ -446,7 +438,7 @@ class acp_prune while ($row = $db->sql_fetchrow($result)) { // Do not prune bots and the user currently pruning. - if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + if ($row['user_id'] != phpbb::$user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) { $user_ids[] = $row['user_id']; $usernames[$row['user_id']] = $row['username']; diff --git a/phpBB/modules/acp/acp_ranks.php b/phpBB/modules/acp/acp_ranks.php index 92510525b7..de4b9d4b54 100644 --- a/phpBB/modules/acp/acp_ranks.php +++ b/phpBB/modules/acp/acp_ranks.php @@ -25,9 +25,7 @@ class acp_ranks function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/posting'); + phpbb::$user->add_lang('acp/posting'); // Set up general vars $action = request_var('action', ''); @@ -47,7 +45,7 @@ class acp_ranks if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } $rank_title = utf8_normalize_nfc(request_var('title', '', true)); $special_rank = request_var('special_rank', 0); @@ -62,7 +60,7 @@ class acp_ranks if (!$rank_title) { - trigger_error($user->lang['NO_RANK_TITLE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_RANK_TITLE'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql_ary = array( @@ -75,14 +73,14 @@ class acp_ranks if ($rank_id) { $sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id"; - $message = $user->lang['RANK_UPDATED']; + $message = phpbb::$user->lang['RANK_UPDATED']; add_log('admin', 'LOG_RANK_UPDATED', $rank_title); } else { $sql = 'INSERT INTO ' . RANKS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); - $message = $user->lang['RANK_ADDED']; + $message = phpbb::$user->lang['RANK_ADDED']; add_log('admin', 'LOG_RANK_ADDED', $rank_title); } @@ -98,7 +96,7 @@ class acp_ranks if (!$rank_id) { - trigger_error($user->lang['MUST_SELECT_RANK'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['MUST_SELECT_RANK'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -125,7 +123,7 @@ class acp_ranks } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'rank_id' => $rank_id, diff --git a/phpBB/modules/acp/acp_reasons.php b/phpBB/modules/acp/acp_reasons.php index 7f21bd27bd..4dac0895fd 100644 --- a/phpBB/modules/acp/acp_reasons.php +++ b/phpBB/modules/acp/acp_reasons.php @@ -25,9 +25,7 @@ class acp_reasons function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang(array('mcp', 'acp/posting')); + phpbb::$user->add_lang(array('mcp', 'acp/posting')); // Set up general vars $action = request_var('action', ''); @@ -56,12 +54,12 @@ class acp_reasons { if (!check_form_key($form_name)) { - $error[] = $user->lang['FORM_INVALID']; + $error[] = phpbb::$user->lang['FORM_INVALID']; } // Reason specified? if (!$reason_row['reason_title'] || !$reason_row['reason_description']) { - $error[] = $user->lang['NO_REASON_INFO']; + $error[] = phpbb::$user->lang['NO_REASON_INFO']; } $check_double = ($action == 'add') ? true : false; @@ -98,7 +96,7 @@ class acp_reasons if ($row || ($action == 'add' && strtolower($reason_row['reason_title']) == 'other')) { - $error[] = $user->lang['REASON_ALREADY_EXIST']; + $error[] = phpbb::$user->lang['REASON_ALREADY_EXIST']; } } @@ -138,7 +136,7 @@ class acp_reasons } add_log('admin', 'LOG_REASON_' . $log, $reason_row['reason_title']); - trigger_error($user->lang['REASON_' . $log] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['REASON_' . $log] . adm_back_link($this->u_action)); } } else if ($reason_id) @@ -152,7 +150,7 @@ class acp_reasons if (!$reason_row) { - trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -161,13 +159,13 @@ class acp_reasons $translated = false; // If the reason is defined within the language file, we will use the localized version, else just use the database entry... - if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])])) + if (isset(phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])]) && isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])])) { $translated = true; } $template->assign_vars(array( - 'L_TITLE' => $user->lang['REASON_' . $l_title], + 'L_TITLE' => phpbb::$user->lang['REASON_' . $l_title], 'U_ACTION' => $this->u_action . "&id=$reason_id&action=$action", 'U_BACK' => $this->u_action, 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', @@ -175,10 +173,10 @@ class acp_reasons 'REASON_TITLE' => $reason_row['reason_title'], 'REASON_DESCRIPTION' => $reason_row['reason_description'], - 'TRANSLATED_TITLE' => ($translated) ? $user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])] : '', - 'TRANSLATED_DESCRIPTION'=> ($translated) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])] : '', + 'TRANSLATED_TITLE' => ($translated) ? phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])] : '', + 'TRANSLATED_DESCRIPTION'=> ($translated) ? phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])] : '', - 'S_AVAILABLE_TITLES' => implode(', ', array_map('htmlspecialchars', array_keys($user->lang['report_reasons']['TITLE']))), + 'S_AVAILABLE_TITLES' => implode(', ', array_map('htmlspecialchars', array_keys(phpbb::$user->lang['report_reasons']['TITLE']))), 'S_EDIT_REASON' => true, 'S_TRANSLATED' => $translated, 'S_ERROR' => (sizeof($error)) ? true : false, @@ -199,12 +197,12 @@ class acp_reasons if (!$reason_row) { - trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); } if (strtolower($reason_row['reason_title']) == 'other') { - trigger_error($user->lang['NO_REMOVE_DEFAULT_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_REMOVE_DEFAULT_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); } // Let the deletion be confirmed... @@ -231,11 +229,11 @@ class acp_reasons $db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id); add_log('admin', 'LOG_REASON_REMOVED', $reason_row['reason_title']); - trigger_error($user->lang['REASON_REMOVED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['REASON_REMOVED'] . adm_back_link($this->u_action)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'action' => $action, @@ -313,10 +311,10 @@ class acp_reasons $other_reason = ($row['reason_title'] == 'other') ? true : false; // If the reason is defined within the language file, we will use the localized version, else just use the database entry... - if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) + if (isset(phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) { - $row['reason_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; - $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; + $row['reason_description'] = phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; + $row['reason_title'] = phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; $translated = true; } diff --git a/phpBB/modules/acp/acp_search.php b/phpBB/modules/acp/acp_search.php index 46ce052f21..d5440080fb 100644 --- a/phpBB/modules/acp/acp_search.php +++ b/phpBB/modules/acp/acp_search.php @@ -29,9 +29,7 @@ class acp_search function main($id, $mode) { - global $user; - - $user->add_lang('acp/search'); + phpbb::$user->add_lang('acp/search'); // For some this may be of help... @ini_set('memory_limit', '128M'); @@ -50,8 +48,6 @@ class acp_search function settings($id, $mode) { - global $db, $user, $auth, $template; - $submit = phpbb_request::is_set_post('submit'); $search_types = $this->get_search_types(); @@ -158,7 +154,7 @@ class acp_search { add_log('admin', 'LOG_CONFIG_SEARCH'); } - $extra_message = '<br />' . $user->lang['SWITCHED_SEARCH_BACKEND'] . '<br /><a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=search&mode=index') . '">» ' . $user->lang['GO_TO_SEARCH_INDEX'] . '</a>'; + $extra_message = '<br />' . phpbb::$user->lang['SWITCHED_SEARCH_BACKEND'] . '<br /><a href="' . append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=search&mode=index') . '">» ' . phpbb::$user->lang['GO_TO_SEARCH_INDEX'] . '</a>'; } else { @@ -167,7 +163,7 @@ class acp_search } else { - confirm_box(false, $user->lang['CONFIRM_SEARCH_BACKEND'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_SEARCH_BACKEND'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'submit' => true, @@ -202,7 +198,7 @@ class acp_search trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); } - trigger_error($user->lang['CONFIG_UPDATED'] . $extra_message . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['CONFIG_UPDATED'] . $extra_message . adm_back_link($this->u_action)); } unset($cfg_array); @@ -226,8 +222,6 @@ class acp_search function index($id, $mode) { - global $db, $user, $auth, $template; - $action = request_var('action', array('' => false)); if (sizeof($action)) { @@ -341,7 +335,7 @@ class acp_search $totaltime = $mtime[0] + $mtime[1] - $starttime; $rows_per_second = $row_count / $totaltime; meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter)); - trigger_error(sprintf($user->lang['SEARCH_INDEX_DELETE_REDIRECT'], $post_counter, $row_count, $rows_per_second)); + trigger_error(sprintf(phpbb::$user->lang['SEARCH_INDEX_DELETE_REDIRECT'], $post_counter, $row_count, $rows_per_second)); } } @@ -351,7 +345,7 @@ class acp_search $this->save_state(); add_log('admin', 'LOG_SEARCH_INDEX_REMOVED', $name); - trigger_error($user->lang['SEARCH_INDEX_REMOVED'] . adm_back_link($this->u_action) . $this->close_popup_js()); + trigger_error(phpbb::$user->lang['SEARCH_INDEX_REMOVED'] . adm_back_link($this->u_action) . $this->close_popup_js()); break; case 'create': @@ -418,7 +412,7 @@ class acp_search $totaltime = $mtime[0] + $mtime[1] - $starttime; $rows_per_second = $row_count / $totaltime; meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter)); - trigger_error(sprintf($user->lang['SEARCH_INDEX_CREATE_REDIRECT'], $post_counter, $row_count, $rows_per_second)); + trigger_error(sprintf(phpbb::$user->lang['SEARCH_INDEX_CREATE_REDIRECT'], $post_counter, $row_count, $rows_per_second)); } } @@ -428,7 +422,7 @@ class acp_search $this->save_state(); add_log('admin', 'LOG_SEARCH_INDEX_CREATED', $name); - trigger_error($user->lang['SEARCH_INDEX_CREATED'] . adm_back_link($this->u_action) . $this->close_popup_js()); + trigger_error(phpbb::$user->lang['SEARCH_INDEX_CREATED'] . adm_back_link($this->u_action) . $this->close_popup_js()); break; } } @@ -507,27 +501,25 @@ class acp_search $template->assign_vars(array( 'S_CONTINUE_INDEXING' => $this->state[1], 'U_CONTINUE_INDEXING' => $this->u_action . '&action=' . $this->state[1], - 'L_CONTINUE' => ($this->state[1] == 'create') ? $user->lang['CONTINUE_INDEXING'] : $user->lang['CONTINUE_DELETING_INDEX'], - 'L_CONTINUE_EXPLAIN' => ($this->state[1] == 'create') ? $user->lang['CONTINUE_INDEXING_EXPLAIN'] : $user->lang['CONTINUE_DELETING_INDEX_EXPLAIN']) + 'L_CONTINUE' => ($this->state[1] == 'create') ? phpbb::$user->lang['CONTINUE_INDEXING'] : phpbb::$user->lang['CONTINUE_DELETING_INDEX'], + 'L_CONTINUE_EXPLAIN' => ($this->state[1] == 'create') ? phpbb::$user->lang['CONTINUE_INDEXING_EXPLAIN'] : phpbb::$user->lang['CONTINUE_DELETING_INDEX_EXPLAIN']) ); } } function display_progress_bar($type) { - global $template, $user; - $l_type = ($type == 'create') ? 'INDEXING_IN_PROGRESS' : 'DELETING_INDEX_IN_PROGRESS'; - page_header($user->lang[$l_type]); + page_header(phpbb::$user->lang[$l_type]); $template->set_filenames(array( 'body' => 'progress_bar.html') ); $template->assign_vars(array( - 'L_PROGRESS' => $user->lang[$l_type], - 'L_PROGRESS_EXPLAIN' => $user->lang[$l_type . '_EXPLAIN']) + 'L_PROGRESS' => phpbb::$user->lang[$l_type], + 'L_PROGRESS_EXPLAIN' => phpbb::$user->lang[$l_type . '_EXPLAIN']) ); page_footer(); @@ -567,8 +559,6 @@ class acp_search function get_max_post_id() { - global $db; - $sql = 'SELECT MAX(post_id) as max_post_id FROM '. POSTS_TABLE; $result = $db->sql_query($sql); @@ -597,11 +587,9 @@ class acp_search */ function init_search($type, &$search, &$error) { - global $user; - if (!preg_match('#^\w+$#', $type) || !file_exists(PHPBB_ROOT_PATH . "includes/search/$type." . PHP_EXT)) { - $error = $user->lang['NO_SUCH_SEARCH_MODULE']; + $error = phpbb::$user->lang['NO_SUCH_SEARCH_MODULE']; return $error; } @@ -609,7 +597,7 @@ class acp_search if (!class_exists($type)) { - $error = $user->lang['NO_SUCH_SEARCH_MODULE']; + $error = phpbb::$user->lang['NO_SUCH_SEARCH_MODULE']; return $error; } diff --git a/phpBB/modules/acp/acp_styles.php b/phpBB/modules/acp/acp_styles.php index eb426b6c6e..dc12063c95 100644 --- a/phpBB/modules/acp/acp_styles.php +++ b/phpBB/modules/acp/acp_styles.php @@ -31,8 +31,6 @@ class acp_styles function main($id, $mode) { - global $db, $user, $auth, $template; - // Hardcoded template bitfield to add for new templates $bitfield = new bitfield(); $bitfield->set(0); @@ -44,7 +42,7 @@ class acp_styles define('TEMPLATE_BITFIELD', $bitfield->get_base64()); unset($bitfield); - $user->add_lang('acp/styles'); + phpbb::$user->add_lang('acp/styles'); $this->tpl_name = 'acp_styles'; $this->page_title = 'ACP_CAT_STYLES'; @@ -194,7 +192,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($style_id == phpbb::$config['default_style']) { - trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'UPDATE ' . STYLES_TABLE . ' @@ -237,18 +235,18 @@ parse_css_file = {PARSE_CSS_FILE} if (!$template_row) { - trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) { $this->clear_template_cache($template_row); - trigger_error($user->lang['TEMPLATE_CACHE_CLEARED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['TEMPLATE_CACHE_CLEARED'] . adm_back_link($this->u_action)); } else { - confirm_box(false, $user->lang['CONFIRM_TEMPLATE_CLEAR_CACHE'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_TEMPLATE_CLEAR_CACHE'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'action' => $action, @@ -278,12 +276,12 @@ parse_css_file = {PARSE_CSS_FILE} if (!$theme_row) { - trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!$theme_row['theme_storedb']) { - trigger_error($user->lang['THEME_ERR_REFRESH_FS'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['THEME_ERR_REFRESH_FS'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -303,12 +301,12 @@ parse_css_file = {PARSE_CSS_FILE} phpbb::$acm->destroy_sql(STYLES_THEME_TABLE); add_log('admin', 'LOG_THEME_REFRESHED', $theme_row['theme_name']); - trigger_error($user->lang['THEME_REFRESHED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['THEME_REFRESHED'] . adm_back_link($this->u_action)); } } else { - confirm_box(false, $user->lang['CONFIRM_THEME_REFRESH'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_THEME_REFRESH'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'action' => $action, @@ -336,7 +334,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$imageset_row) { - trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -450,11 +448,11 @@ parse_css_file = {PARSE_CSS_FILE} phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE); add_log('admin', 'LOG_IMAGESET_REFRESHED', $imageset_row['imageset_name']); - trigger_error($user->lang['IMAGESET_REFRESHED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['IMAGESET_REFRESHED'] . adm_back_link($this->u_action)); } else { - confirm_box(false, $user->lang['CONFIRM_IMAGESET_REFRESH'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_IMAGESET_REFRESH'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'action' => $action, @@ -474,8 +472,6 @@ parse_css_file = {PARSE_CSS_FILE} */ function frontend($mode, $options, $actions) { - global $user, $template, $db; - $sql_from = ''; $style_count = array(); @@ -518,13 +514,13 @@ parse_css_file = {PARSE_CSS_FILE} 'S_FRONTEND' => true, 'S_STYLE' => ($mode == 'style') ? true : false, - 'L_TITLE' => $user->lang[$this->page_title], - 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'], - 'L_NAME' => $user->lang[$l_prefix . '_NAME'], - 'L_INSTALLED' => $user->lang['INSTALLED_' . $l_prefix], - 'L_UNINSTALLED' => $user->lang['UNINSTALLED_' . $l_prefix], - 'L_NO_UNINSTALLED' => $user->lang['NO_UNINSTALLED_' . $l_prefix], - 'L_CREATE' => $user->lang['CREATE_' . $l_prefix], + 'L_TITLE' => phpbb::$user->lang[$this->page_title], + 'L_EXPLAIN' => phpbb::$user->lang[$this->page_title . '_EXPLAIN'], + 'L_NAME' => phpbb::$user->lang[$l_prefix . '_NAME'], + 'L_INSTALLED' => phpbb::$user->lang['INSTALLED_' . $l_prefix], + 'L_UNINSTALLED' => phpbb::$user->lang['UNINSTALLED_' . $l_prefix], + 'L_NO_UNINSTALLED' => phpbb::$user->lang['NO_UNINSTALLED_' . $l_prefix], + 'L_CREATE' => phpbb::$user->lang['CREATE_' . $l_prefix], 'U_ACTION' => $this->u_action, ) @@ -536,7 +532,7 @@ parse_css_file = {PARSE_CSS_FILE} $installed = array(); - $basis_options = '<option class="sep" value="">' . $user->lang['OPTIONAL_BASIS'] . '</option>'; + $basis_options = '<option class="sep" value="">' . phpbb::$user->lang['OPTIONAL_BASIS'] . '</option>'; while ($row = $db->sql_fetchrow($result)) { $installed[] = $row[$mode . '_name']; @@ -547,20 +543,20 @@ parse_css_file = {PARSE_CSS_FILE} $s_options = array(); foreach ($options as $option) { - $s_options[] = '<a href="' . $this->u_action . "&action=$option&id=" . $row[$mode . '_id'] . '">' . $user->lang[strtoupper($option)] . '</a>'; + $s_options[] = '<a href="' . $this->u_action . "&action=$option&id=" . $row[$mode . '_id'] . '">' . phpbb::$user->lang[strtoupper($option)] . '</a>'; } $s_actions = array(); foreach ($actions as $option) { - $s_actions[] = '<a href="' . $this->u_action . "&action=$option&id=" . $row[$mode . '_id'] . '">' . $user->lang[strtoupper($option)] . '</a>'; + $s_actions[] = '<a href="' . $this->u_action . "&action=$option&id=" . $row[$mode . '_id'] . '">' . phpbb::$user->lang[strtoupper($option)] . '</a>'; } $template->assign_block_vars('installed', array( '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)], + 'L_STYLE_ACT_DEACT' => phpbb::$user->lang['STYLE_' . strtoupper($stylevis)], 'S_OPTIONS' => implode(' | ', $s_options), 'S_ACTIONS' => implode(' | ', $s_actions), 'U_PREVIEW' => ($mode == 'style') ? append_sid('index', "style=" . $row[$mode . '_id']) : '', @@ -631,11 +627,11 @@ parse_css_file = {PARSE_CSS_FILE} */ function edit_template($template_id) { - global $db, $user, $template, $safe_mode; + global $safe_mode; if (defined('PHPBB_DISABLE_ACP_EDITOR')) { - trigger_error($user->lang['EDITOR_DISABLED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['EDITOR_DISABLED'] . adm_back_link($this->u_action)); } $this->page_title = 'EDIT_TEMPLATE'; @@ -661,12 +657,12 @@ parse_css_file = {PARSE_CSS_FILE} if (!$template_info) { - trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($save_changes && !check_form_key('acp_styles')) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } else if (!$save_changes) { @@ -684,7 +680,7 @@ parse_css_file = {PARSE_CSS_FILE} //if (!$safe_mode && !$template_info['template_storedb'] && file_exists($file) && @is_writable($file)) if (!($fp = @fopen($file, 'wb'))) { - trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); } fwrite($fp, $template_data); fclose($fp); @@ -695,7 +691,7 @@ parse_css_file = {PARSE_CSS_FILE} phpbb::$acm->destroy_sql(STYLES_TABLE); add_log('admin', 'LOG_TEMPLATE_EDIT', $template_info['template_name'], $template_file); - trigger_error($user->lang['TEMPLATE_FILE_UPDATED'] . $additional . adm_back_link($this->u_action . "&action=edit&id=$template_id&text_rows=$text_rows&template_file=$template_file")); + trigger_error(phpbb::$user->lang['TEMPLATE_FILE_UPDATED'] . $additional . adm_back_link($this->u_action . "&action=edit&id=$template_id&text_rows=$text_rows&template_file=$template_file")); } // Generate a category array containing template filenames @@ -708,7 +704,7 @@ parse_css_file = {PARSE_CSS_FILE} { if (!file_exists($template_path . "/$template_file") || !($template_data = file_get_contents($template_path . "/$template_file"))) { - trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -778,14 +774,14 @@ parse_css_file = {PARSE_CSS_FILE} 'U_ACTION' => $this->u_action . "&action=edit&id=$template_id&text_rows=$text_rows", 'U_BACK' => $this->u_action, - 'L_EDIT' => $user->lang['EDIT_TEMPLATE'], - 'L_EDIT_EXPLAIN' => $user->lang['EDIT_TEMPLATE_EXPLAIN'], - 'L_EDITOR' => $user->lang['TEMPLATE_EDITOR'], - 'L_EDITOR_HEIGHT' => $user->lang['TEMPLATE_EDITOR_HEIGHT'], - 'L_FILE' => $user->lang['TEMPLATE_FILE'], - 'L_SELECT' => $user->lang['SELECT_TEMPLATE'], - 'L_SELECTED' => $user->lang['SELECTED_TEMPLATE'], - 'L_SELECTED_FILE' => $user->lang['SELECTED_TEMPLATE_FILE'], + 'L_EDIT' => phpbb::$user->lang['EDIT_TEMPLATE'], + 'L_EDIT_EXPLAIN' => phpbb::$user->lang['EDIT_TEMPLATE_EXPLAIN'], + 'L_EDITOR' => phpbb::$user->lang['TEMPLATE_EDITOR'], + 'L_EDITOR_HEIGHT' => phpbb::$user->lang['TEMPLATE_EDITOR_HEIGHT'], + 'L_FILE' => phpbb::$user->lang['TEMPLATE_FILE'], + 'L_SELECT' => phpbb::$user->lang['SELECT_TEMPLATE'], + 'L_SELECTED' => phpbb::$user->lang['SELECTED_TEMPLATE'], + 'L_SELECTED_FILE' => phpbb::$user->lang['SELECTED_TEMPLATE_FILE'], 'SELECTED_TEMPLATE' => $template_info['template_name'], 'TEMPLATE_FILE' => $template_file, @@ -801,8 +797,6 @@ parse_css_file = {PARSE_CSS_FILE} */ function template_cache($template_id) { - global $db, $user, $template; - $source = str_replace('/', '.', request_var('source', '')); $file_ary = array_diff(request_var('delete', array('')), array('')); $submit = phpbb_request::is_set_post('submit'); @@ -816,14 +810,14 @@ parse_css_file = {PARSE_CSS_FILE} if (!$template_row) { - trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); } // User wants to delete one or more files ... if ($submit && $file_ary) { $this->clear_template_cache($template_row, $file_ary); - trigger_error($user->lang['TEMPLATE_CACHE_CLEARED'] . adm_back_link($this->u_action . "&action=cache&id=$template_id")); + trigger_error(phpbb::$user->lang['TEMPLATE_CACHE_CLEARED'] . adm_back_link($this->u_action . "&action=cache&id=$template_id")); } $cache_prefix = 'tpl_' . str_replace('_', '-', $template_row['template_path']); @@ -833,7 +827,7 @@ parse_css_file = {PARSE_CSS_FILE} // on larger source files ... if ($source && file_exists(PHPBB_ROOT_PATH . "cache/{$cache_prefix}_$source.html." . PHP_EXT)) { - page_header($user->lang['TEMPLATE_CACHE']); + page_header(phpbb::$user->lang['TEMPLATE_CACHE']); $template->set_filenames(array( 'body' => 'viewsource.html') @@ -897,10 +891,10 @@ parse_css_file = {PARSE_CSS_FILE} $template->assign_block_vars('file', array( 'U_VIEWSOURCE' => $this->u_action . "&action=cache&id=$template_id&source=$file", - 'CACHED' => $user->format_date(filemtime(PHPBB_ROOT_PATH . "cache/$filename")), + 'CACHED' => phpbb::$user->format_date(filemtime(PHPBB_ROOT_PATH . "cache/$filename")), 'FILENAME' => $file, - 'FILESIZE' => sprintf('%.1f ' . $user->lang['KIB'], filesize(PHPBB_ROOT_PATH . "cache/$filename") / 1024), - 'MODIFIED' => $user->format_date(filemtime(PHPBB_ROOT_PATH . "styles/{$template_row['template_path']}/template/$tpl_file.html"))) + 'FILESIZE' => sprintf('%.1f ' . phpbb::$user->lang['KIB'], filesize(PHPBB_ROOT_PATH . "cache/$filename") / 1024), + 'MODIFIED' => phpbb::$user->format_date(filemtime(PHPBB_ROOT_PATH . "styles/{$template_row['template_path']}/template/$tpl_file.html"))) ); } @@ -920,7 +914,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function edit_theme($theme_id) { - global $db, $user, $template, $safe_mode; + global $safe_mode; $this->page_title = 'EDIT_THEME'; @@ -943,7 +937,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!($theme_info = $db->sql_fetchrow($result))) { - trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); } $db->sql_freeresult($result); @@ -956,14 +950,14 @@ parse_css_file = {PARSE_CSS_FILE} // Get the filesystem location of the current file $file = PHPBB_ROOT_PATH . "styles/{$theme_info['theme_path']}/theme/$theme_file"; $additional = ''; - $message = $user->lang['THEME_UPDATED']; + $message = phpbb::$user->lang['THEME_UPDATED']; // If the theme is stored on the filesystem try to write the file else store it in the database if (!$safe_mode && !$theme_info['theme_storedb'] && file_exists($file) && @is_writable($file)) { if (!($fp = @fopen($file, 'wb'))) { - trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); } fwrite($fp, $theme_data); fclose($fp); @@ -987,7 +981,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$theme_info['theme_storedb']) { add_log('admin', 'LOG_THEME_EDIT_DETAILS', $theme_info['theme_name']); - $message .= '<br />' . $user->lang['EDIT_THEME_STORED_DB']; + $message .= '<br />' . phpbb::$user->lang['EDIT_THEME_STORED_DB']; } } phpbb::$acm->destroy_sql(STYLES_THEME_TABLE); @@ -1007,7 +1001,7 @@ parse_css_file = {PARSE_CSS_FILE} { if (!file_exists($theme_path . "/$theme_file") || !($theme_data = file_get_contents($theme_path . "/$theme_file"))) { - trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); } } } @@ -1083,14 +1077,14 @@ parse_css_file = {PARSE_CSS_FILE} 'U_ACTION' => $this->u_action . "&action=edit&id=$theme_id&text_rows=$text_rows", 'U_BACK' => $this->u_action, - 'L_EDIT' => $user->lang['EDIT_THEME'], - 'L_EDIT_EXPLAIN' => $user->lang['EDIT_THEME_EXPLAIN'], - 'L_EDITOR' => $user->lang['THEME_EDITOR'], - 'L_EDITOR_HEIGHT' => $user->lang['THEME_EDITOR_HEIGHT'], - 'L_FILE' => $user->lang['THEME_FILE'], - 'L_SELECT' => $user->lang['SELECT_THEME'], - 'L_SELECTED' => $user->lang['SELECTED_THEME'], - 'L_SELECTED_FILE' => $user->lang['SELECTED_THEME_FILE'], + 'L_EDIT' => phpbb::$user->lang['EDIT_THEME'], + 'L_EDIT_EXPLAIN' => phpbb::$user->lang['EDIT_THEME_EXPLAIN'], + 'L_EDITOR' => phpbb::$user->lang['THEME_EDITOR'], + 'L_EDITOR_HEIGHT' => phpbb::$user->lang['THEME_EDITOR_HEIGHT'], + 'L_FILE' => phpbb::$user->lang['THEME_FILE'], + 'L_SELECT' => phpbb::$user->lang['SELECT_THEME'], + 'L_SELECTED' => phpbb::$user->lang['SELECTED_THEME'], + 'L_SELECTED_FILE' => phpbb::$user->lang['SELECTED_THEME_FILE'], 'SELECTED_TEMPLATE' => $theme_info['theme_name'], 'TEMPLATE_FILE' => $theme_file, @@ -1107,8 +1101,6 @@ parse_css_file = {PARSE_CSS_FILE} */ function edit_imageset($imageset_id) { - global $db, $user, $template; - $this->page_title = 'EDIT_IMAGESET'; $update = phpbb_request::is_set_post('update'); @@ -1157,7 +1149,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$imageset_row) { - trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); } // Check to see whether the selected image exists in the table @@ -1184,7 +1176,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($imgpath && !file_exists(PHPBB_ROOT_PATH . "styles/$imageset_path/imageset/$imgpath")) { - trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); } if ($imgsize && $imgpath) @@ -1291,7 +1283,7 @@ parse_css_file = {PARSE_CSS_FILE} foreach ($this->imageset_keys as $category => $img_ary) { $template->assign_block_vars('category', array( - 'NAME' => $user->lang['IMG_CAT_' . strtoupper($category)] + 'NAME' => phpbb::$user->lang['IMG_CAT_' . strtoupper($category)] )); foreach ($img_ary as $img) @@ -1303,7 +1295,7 @@ parse_css_file = {PARSE_CSS_FILE} $template->assign_block_vars('category.images', array( 'SELECTED' => ($img == $imgname && $language == $imgnamelang), 'VALUE' => $img . '-' . $language, - 'TEXT' => $user->lang['IMG_' . strtoupper($img)] . ' [ ' . $language . ' ]' + 'TEXT' => phpbb::$user->lang['IMG_' . strtoupper($img)] . ' [ ' . $language . ' ]' )); } } @@ -1312,7 +1304,7 @@ parse_css_file = {PARSE_CSS_FILE} $template->assign_block_vars('category.images', array( 'SELECTED' => ($img == $imgname), 'VALUE' => $img, - 'TEXT' => (($category == 'custom') ? $img : $user->lang['IMG_' . strtoupper($img)]) + 'TEXT' => (($category == 'custom') ? $img : phpbb::$user->lang['IMG_' . strtoupper($img)]) )); } } @@ -1355,8 +1347,8 @@ parse_css_file = {PARSE_CSS_FILE} $template->assign_vars(array( 'S_EDIT_IMAGESET' => true, - 'L_TITLE' => $user->lang[$this->page_title], - 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'], + 'L_TITLE' => phpbb::$user->lang[$this->page_title], + 'L_EXPLAIN' => phpbb::$user->lang[$this->page_title . '_EXPLAIN'], 'IMAGE_OPTIONS' => $img_options, 'IMAGE_SIZE' => $image_width, 'IMAGE_HEIGHT' => $image_height, @@ -1376,8 +1368,6 @@ parse_css_file = {PARSE_CSS_FILE} */ function remove($mode, $style_id) { - global $db, $template, $user; - $new_id = request_var('new_id', 0); $update = phpbb_request::is_set_post('update'); $sql_where = ''; @@ -1417,7 +1407,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$style_row) { - trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = "SELECT {$mode}_id, {$mode}_name @@ -1439,7 +1429,7 @@ parse_css_file = {PARSE_CSS_FILE} } else { - trigger_error($user->lang['ONLY_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['ONLY_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } $db->sql_freeresult($result); @@ -1484,7 +1474,7 @@ parse_css_file = {PARSE_CSS_FILE} add_log('admin', 'LOG_' . $l_prefix . '_DELETE', $style_row[$mode . '_name']); $message = ($mode != 'style') ? $l_prefix . '_DELETED_FS' : $l_prefix . '_DELETED'; - trigger_error($user->lang[$message] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang[$message] . adm_back_link($this->u_action)); } $this->page_title = 'DELETE_' . $l_prefix; @@ -1493,11 +1483,11 @@ parse_css_file = {PARSE_CSS_FILE} 'S_DELETE' => true, 'S_REPLACE_OPTIONS' => $s_options, - 'L_TITLE' => $user->lang[$this->page_title], - 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'], - 'L_NAME' => $user->lang[$l_prefix . '_NAME'], - 'L_REPLACE' => $user->lang['REPLACE_' . $l_prefix], - 'L_REPLACE_EXPLAIN' => $user->lang['REPLACE_' . $l_prefix . '_EXPLAIN'], + 'L_TITLE' => phpbb::$user->lang[$this->page_title], + 'L_EXPLAIN' => phpbb::$user->lang[$this->page_title . '_EXPLAIN'], + 'L_NAME' => phpbb::$user->lang[$l_prefix . '_NAME'], + 'L_REPLACE' => phpbb::$user->lang['REPLACE_' . $l_prefix], + 'L_REPLACE_EXPLAIN' => phpbb::$user->lang['REPLACE_' . $l_prefix . '_EXPLAIN'], 'U_ACTION' => $this->u_action . "&action=delete&id=$style_id", 'U_BACK' => $this->u_action, @@ -1512,8 +1502,6 @@ parse_css_file = {PARSE_CSS_FILE} */ function export($mode, $style_id) { - global $db, $template, $user; - $update = phpbb_request::is_set_post('update'); $inc_template = request_var('inc_template', 0); @@ -1546,7 +1534,7 @@ parse_css_file = {PARSE_CSS_FILE} case 'style': if ($update && ($inc_template + $inc_theme + $inc_imageset) < 1) { - $error[] = $user->lang['STYLE_ERR_MORE_ELEMENTS']; + $error[] = phpbb::$user->lang['STYLE_ERR_MORE_ELEMENTS']; } $name = 'style_name'; @@ -1603,7 +1591,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$style_row) { - trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } $var_ary = array('style_id', 'style_name', 'style_copyright', 'template_id', 'template_name', 'template_path', 'template_copyright', 'bbcode_bitfield', 'theme_id', 'theme_name', 'theme_path', 'theme_copyright', 'theme_storedb', 'theme_mtime', 'theme_data', 'imageset_id', 'imageset_name', 'imageset_path', 'imageset_copyright'); @@ -1810,7 +1798,7 @@ parse_css_file = {PARSE_CSS_FILE} break; default: - $error[] = $user->lang[$l_prefix . '_ERR_ARCHIVE']; + $error[] = phpbb::$user->lang[$l_prefix . '_ERR_ARCHIVE']; } if (!sizeof($error)) @@ -1862,7 +1850,7 @@ parse_css_file = {PARSE_CSS_FILE} exit; } - trigger_error(sprintf($user->lang[$l_prefix . '_EXPORTED'], "store/$path$ext") . adm_back_link($this->u_action)); + trigger_error(sprintf(phpbb::$user->lang[$l_prefix . '_EXPORTED'], "store/$path$ext") . adm_back_link($this->u_action)); } } @@ -1875,7 +1863,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$style_row) { - trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } $this->page_title = $l_prefix . '_EXPORT'; @@ -1891,9 +1879,9 @@ parse_css_file = {PARSE_CSS_FILE} 'S_ERROR_MSG' => (sizeof($error)) ? true : false, 'S_STYLE' => ($mode == 'style') ? true : false, - 'L_TITLE' => $user->lang[$this->page_title], - 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'], - 'L_NAME' => $user->lang[$l_prefix . '_NAME'], + 'L_TITLE' => phpbb::$user->lang[$this->page_title], + 'L_EXPLAIN' => phpbb::$user->lang[$this->page_title . '_EXPLAIN'], + 'L_NAME' => phpbb::$user->lang[$l_prefix . '_NAME'], 'U_ACTION' => $this->u_action . '&action=export&id=' . $style_id, 'U_BACK' => $this->u_action, @@ -1909,7 +1897,7 @@ parse_css_file = {PARSE_CSS_FILE} */ function details($mode, $style_id) { - global $template, $db, $user, $safe_mode; + global $safe_mode; $update = phpbb_request::is_set_post('update'); $l_type = strtoupper($mode); @@ -1945,7 +1933,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$style_row) { - trigger_error($user->lang['NO_' . $l_type] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_' . $l_type] . adm_back_link($this->u_action), E_USER_WARNING); } $style_row['style_default'] = ($mode == 'style' && phpbb::$config['default_style'] == $style_id) ? 1 : 0; @@ -1972,17 +1960,17 @@ parse_css_file = {PARSE_CSS_FILE} if ($mode == 'style' && (!$template_id || !$theme_id || !$imageset_id)) { - $error[] = $user->lang['STYLE_ERR_NO_IDS']; + $error[] = phpbb::$user->lang['STYLE_ERR_NO_IDS']; } if ($mode == 'style' && $style_row['style_active'] && !$style_active && phpbb::$config['default_style'] == $style_id) { - $error[] = $user->lang['DEACTIVATE_DEFAULT']; + $error[] = phpbb::$user->lang['DEACTIVATE_DEFAULT']; } if (!$name || $conflict) { - $error[] = $user->lang[$l_type . '_ERR_STYLE_NAME']; + $error[] = phpbb::$user->lang[$l_type . '_ERR_STYLE_NAME']; } if (!sizeof($error)) @@ -1990,12 +1978,12 @@ parse_css_file = {PARSE_CSS_FILE} // Check length settings if (utf8_strlen($name) > 30) { - $error[] = $user->lang[$l_type . '_ERR_NAME_LONG']; + $error[] = phpbb::$user->lang[$l_type . '_ERR_NAME_LONG']; } if (utf8_strlen($copyright) > 60) { - $error[] = $user->lang[$l_type . '_ERR_COPY_LONG']; + $error[] = phpbb::$user->lang[$l_type . '_ERR_COPY_LONG']; } } } @@ -2065,7 +2053,7 @@ parse_css_file = {PARSE_CSS_FILE} } else { - trigger_error($user->lang[$l_type . '_DETAILS_UPDATED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang[$l_type . '_DETAILS_UPDATED'] . adm_back_link($this->u_action)); } } @@ -2107,11 +2095,11 @@ parse_css_file = {PARSE_CSS_FILE} 'U_ACTION' => $this->u_action . '&action=details&id=' . $style_id, 'U_BACK' => $this->u_action, - 'L_TITLE' => $user->lang[$this->page_title], - 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'], - 'L_NAME' => $user->lang[$l_type . '_NAME'], - 'L_LOCATION' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION'] : '', - 'L_LOCATION_EXPLAIN' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION_EXPLAIN'] : '', + 'L_TITLE' => phpbb::$user->lang[$this->page_title], + 'L_EXPLAIN' => phpbb::$user->lang[$this->page_title . '_EXPLAIN'], + 'L_NAME' => phpbb::$user->lang[$l_type . '_NAME'], + 'L_LOCATION' => ($mode == 'template' || $mode == 'theme') ? phpbb::$user->lang[$l_type . '_LOCATION'] : '', + 'L_LOCATION_EXPLAIN' => ($mode == 'template' || $mode == 'theme') ? phpbb::$user->lang[$l_type . '_LOCATION_EXPLAIN'] : '', 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', 'NAME' => $style_row[$mode . '_name'], @@ -2190,13 +2178,11 @@ parse_css_file = {PARSE_CSS_FILE} */ function template_cache_filelist($template_path) { - global $user; - $cache_prefix = 'tpl_' . str_replace('_', '-', $template_path); if (!($dp = @opendir(PHPBB_ROOT_PATH . 'cache'))) { - trigger_error($user->lang['TEMPLATE_ERR_CACHE_READ'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['TEMPLATE_ERR_CACHE_READ'] . adm_back_link($this->u_action), E_USER_WARNING); } $file_ary = array(); @@ -2226,14 +2212,12 @@ parse_css_file = {PARSE_CSS_FILE} */ function clear_template_cache($template_row, $file_ary = false) { - global $user; - $cache_prefix = 'tpl_' . str_replace('_', '-', $template_row['template_path']); if (!$file_ary || !is_array($file_ary)) { $file_ary = $this->template_cache_filelist($template_row['template_path']); - $log_file_list = $user->lang['ALL_FILES']; + $log_file_list = phpbb::$user->lang['ALL_FILES']; } else { @@ -2260,8 +2244,6 @@ parse_css_file = {PARSE_CSS_FILE} */ function install($mode) { - global $db, $user, $template; - $l_type = strtoupper($mode); $error = $installcfg = $style_row = array(); @@ -2279,7 +2261,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!file_exists($cfg_file)) { - $error[] = $user->lang[$l_type . '_ERR_NOT_' . $l_type]; + $error[] = phpbb::$user->lang[$l_type . '_ERR_NOT_' . $l_type]; } else { @@ -2348,7 +2330,7 @@ parse_css_file = {PARSE_CSS_FILE} } else { - trigger_error($user->lang['NO_' . $l_type] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_' . $l_type] . adm_back_link($this->u_action), E_USER_WARNING); } $style_row['style_active'] = request_var('style_active', 1); @@ -2375,7 +2357,7 @@ parse_css_file = {PARSE_CSS_FILE} { phpbb::$acm->destroy_sql(STYLES_TABLE); - trigger_error($user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action)); } } @@ -2395,11 +2377,11 @@ parse_css_file = {PARSE_CSS_FILE} 'U_ACTION' => $this->u_action . "&action=install&path=" . urlencode($install_path), 'U_BACK' => $this->u_action, - 'L_TITLE' => $user->lang[$this->page_title], - 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'], - 'L_NAME' => $user->lang[$l_type . '_NAME'], - 'L_LOCATION' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION'] : '', - 'L_LOCATION_EXPLAIN' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION_EXPLAIN'] : '', + 'L_TITLE' => phpbb::$user->lang[$this->page_title], + 'L_EXPLAIN' => phpbb::$user->lang[$this->page_title . '_EXPLAIN'], + 'L_NAME' => phpbb::$user->lang[$l_type . '_NAME'], + 'L_LOCATION' => ($mode == 'template' || $mode == 'theme') ? phpbb::$user->lang[$l_type . '_LOCATION'] : '', + 'L_LOCATION_EXPLAIN' => ($mode == 'template' || $mode == 'theme') ? phpbb::$user->lang[$l_type . '_LOCATION_EXPLAIN'] : '', 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', 'NAME' => $style_row[$mode . '_name'], @@ -2415,8 +2397,6 @@ parse_css_file = {PARSE_CSS_FILE} */ function add($mode) { - global $db, $user, $template; - $l_type = strtoupper($mode); $element_ary = array('template' => STYLES_TEMPLATE_TABLE, 'theme' => STYLES_THEME_TABLE, 'imageset' => STYLES_IMAGESET_TABLE); $error = array(); @@ -2468,7 +2448,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$row) { - $error[] = $user->lang['NO_' . $l_type]; + $error[] = phpbb::$user->lang['NO_' . $l_type]; } if (!sizeof($error)) @@ -2487,7 +2467,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($mode == 'style' && (!$style_row['template_id'] || !$style_row['theme_id'] || !$style_row['imageset_id'])) { - $error[] = $user->lang['STYLE_ERR_NO_IDS']; + $error[] = phpbb::$user->lang['STYLE_ERR_NO_IDS']; } } @@ -2505,7 +2485,7 @@ parse_css_file = {PARSE_CSS_FILE} { phpbb::$acm->destroy_sql(STYLES_TABLE); - trigger_error($user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action)); } } @@ -2548,11 +2528,11 @@ parse_css_file = {PARSE_CSS_FILE} 'U_ACTION' => $this->u_action . '&action=add&basis=' . $basis, 'U_BACK' => $this->u_action, - 'L_TITLE' => $user->lang[$this->page_title], - 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'], - 'L_NAME' => $user->lang[$l_type . '_NAME'], - 'L_LOCATION' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION'] : '', - 'L_LOCATION_EXPLAIN' => ($mode == 'template' || $mode == 'theme') ? $user->lang[$l_type . '_LOCATION_EXPLAIN'] : '', + 'L_TITLE' => phpbb::$user->lang[$this->page_title], + 'L_EXPLAIN' => phpbb::$user->lang[$this->page_title . '_EXPLAIN'], + 'L_NAME' => phpbb::$user->lang[$l_type . '_NAME'], + 'L_LOCATION' => ($mode == 'template' || $mode == 'theme') ? phpbb::$user->lang[$l_type . '_LOCATION'] : '', + 'L_LOCATION_EXPLAIN' => ($mode == 'template' || $mode == 'theme') ? phpbb::$user->lang[$l_type . '_LOCATION_EXPLAIN'] : '', 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', 'NAME' => $style_row[$mode . '_name'], @@ -2563,8 +2543,6 @@ parse_css_file = {PARSE_CSS_FILE} function generate_stylesheets($theme) { - global $db; - // get all the lang_dirs $sql = 'SELECT lang_dir FROM ' . LANG_TABLE; @@ -2695,8 +2673,6 @@ parse_css_file = {PARSE_CSS_FILE} */ function test_installed($element, &$error, $root_path, $reqd_name, &$id, &$name, &$copyright) { - global $db, $user; - switch ($element) { case 'template': @@ -2730,7 +2706,7 @@ parse_css_file = {PARSE_CSS_FILE} { if (!($cfg = @file("$root_path$element/$element.cfg"))) { - $error[] = sprintf($user->lang['REQUIRES_' . $l_element], $reqd_name); + $error[] = sprintf(phpbb::$user->lang['REQUIRES_' . $l_element], $reqd_name); return false; } @@ -2750,24 +2726,22 @@ 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 $db, $user; - $element_ary = array('template', 'theme', 'imageset'); if (!$name) { - $error[] = $user->lang['STYLE_ERR_STYLE_NAME']; + $error[] = phpbb::$user->lang['STYLE_ERR_STYLE_NAME']; } // Check length settings if (utf8_strlen($name) > 30) { - $error[] = $user->lang['STYLE_ERR_NAME_LONG']; + $error[] = phpbb::$user->lang['STYLE_ERR_NAME_LONG']; } if (utf8_strlen($copyright) > 60) { - $error[] = $user->lang['STYLE_ERR_COPY_LONG']; + $error[] = phpbb::$user->lang['STYLE_ERR_COPY_LONG']; } // Check if the name already exist @@ -2780,7 +2754,7 @@ parse_css_file = {PARSE_CSS_FILE} if ($row) { - $error[] = $user->lang['STYLE_ERR_NAME_EXIST']; + $error[] = phpbb::$user->lang['STYLE_ERR_NAME_EXIST']; } if (sizeof($error)) @@ -2800,7 +2774,7 @@ parse_css_file = {PARSE_CSS_FILE} if (!$style_row['template_id'] || !$style_row['theme_id'] || !$style_row['imageset_id']) { - $error[] = $user->lang['STYLE_ERR_NO_IDS']; + $error[] = phpbb::$user->lang['STYLE_ERR_NO_IDS']; } if (sizeof($error)) @@ -2845,8 +2819,6 @@ parse_css_file = {PARSE_CSS_FILE} */ function install_element($mode, &$error, $action, $root_path, &$id, $name, $path, $copyright, $store_db = 0) { - global $db, $user; - switch ($mode) { case 'template': @@ -2866,18 +2838,18 @@ parse_css_file = {PARSE_CSS_FILE} if (!$name) { - $error[] = $user->lang[$l_type . '_ERR_STYLE_NAME']; + $error[] = phpbb::$user->lang[$l_type . '_ERR_STYLE_NAME']; } // Check length settings if (utf8_strlen($name) > 30) { - $error[] = $user->lang[$l_type . '_ERR_NAME_LONG']; + $error[] = phpbb::$user->lang[$l_type . '_ERR_NAME_LONG']; } if (utf8_strlen($copyright) > 60) { - $error[] = $user->lang[$l_type . '_ERR_COPY_LONG']; + $error[] = phpbb::$user->lang[$l_type . '_ERR_COPY_LONG']; } // Check if the name already exist @@ -2898,7 +2870,7 @@ parse_css_file = {PARSE_CSS_FILE} return false; } - $error[] = $user->lang[$l_type . '_ERR_NAME_EXIST']; + $error[] = phpbb::$user->lang[$l_type . '_ERR_NAME_EXIST']; } if (sizeof($error)) diff --git a/phpBB/modules/acp/acp_update.php b/phpBB/modules/acp/acp_update.php index ca18a23b16..f65ca47a33 100644 --- a/phpBB/modules/acp/acp_update.php +++ b/phpBB/modules/acp/acp_update.php @@ -25,9 +25,7 @@ class acp_update function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('install'); + phpbb::$user-3>add_lang('install'); $this->tpl_name = 'acp_update'; $this->page_title = 'ACP_VERSION_CHECK'; @@ -72,7 +70,7 @@ class acp_update 'CURRENT_VERSION' => phpbb::$config['version'], 'AUTO_VERSION' => $version_update_from, - 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link), + 'UPDATE_INSTRUCTIONS' => sprintf(phpbb::$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 1019ffad19..b45edfb1a3 100644 --- a/phpBB/modules/acp/acp_users.php +++ b/phpBB/modules/acp/acp_users.php @@ -31,9 +31,9 @@ class acp_users function main($id, $mode) { - global $db, $user, $auth, $template, $file_uploads; + global $file_uploads; - $user->add_lang(array('posting', 'ucp', 'acp/users')); + phpbb::$user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; $this->page_title = 'ACP_USER_' . strtoupper($mode); @@ -60,7 +60,7 @@ class acp_users $ipwhois = user_ipwhois($user_ip); $template->assign_vars(array( - 'MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $domain), + 'MESSAGE_TITLE' => sprintf(phpbb::$user->lang['IP_WHOIS_FOR'], $domain), 'MESSAGE_TEXT' => nl2br($ipwhois)) ); @@ -94,7 +94,7 @@ class acp_users if (!$user_id) { - trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -110,7 +110,7 @@ class acp_users if (!$user_row) { - trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } // Generate overall "header" for user admin @@ -140,7 +140,7 @@ class acp_users foreach ($dropdown_modes as $module_mode => $null) { $selected = ($mode == $module_mode) ? ' selected="selected"' : ''; - $s_form_options .= '<option value="' . $module_mode . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($module_mode)] . '</option>'; + $s_form_options .= '<option value="' . $module_mode . '"' . $selected . '>' . phpbb::$user->lang['ACP_USER_' . strtoupper($module_mode)] . '</option>'; } $template->assign_vars(array( @@ -154,7 +154,7 @@ class acp_users // Prevent normal users/admins change/view founders if they are not a founder by themselves if (!phpbb::$user->is_founder && $user_row['user_type'] == phpbb::USER_FOUNDER) { - trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); } switch ($mode) @@ -163,7 +163,7 @@ class acp_users include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); - $user->add_lang('acp/ban'); + phpbb::$user->add_lang('acp/ban'); $delete = request_var('delete', 0); $delete_type = request_var('delete_type', ''); @@ -176,18 +176,18 @@ class acp_users { if (!$auth->acl_get('a_userdel')) { - trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } // Check if the user wants to remove himself or the guest user account if ($user_id == ANONYMOUS) { - trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - if ($user_id == $user->data['user_id']) + if ($user_id == phpbb::$user->data['user_id']) { - trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if (confirm_box(true)) @@ -195,11 +195,11 @@ class acp_users user_delete($delete_type, $user_id, $user_row['username']); add_log('admin', 'LOG_USER_DELETED', $user_row['username']); - trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['USER_DELETED'] . adm_back_link($this->u_action)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'u' => $user_id, 'i' => $id, 'mode' => $mode, @@ -218,19 +218,19 @@ class acp_users case 'banemail': case 'banip': - if ($user_id == $user->data['user_id']) + if ($user_id == phpbb::$user->data['user_id']) { - trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($user_row['user_type'] == phpbb::USER_FOUNDER) { - trigger_error($user->lang['CANNOT_BAN_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_BAN_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $ban = array(); @@ -268,36 +268,36 @@ class acp_users break; } - $ban_reason = utf8_normalize_nfc(request_var('ban_reason', $user->lang[$reason], true)); + $ban_reason = utf8_normalize_nfc(request_var('ban_reason', phpbb::$user->lang[$reason], true)); $ban_give_reason = utf8_normalize_nfc(request_var('ban_give_reason', '', true)); // Log not used at the moment, we simply utilize the ban function. $result = user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason); - trigger_error((($result === false) ? $user->lang['BAN_ALREADY_ENTERED'] : $user->lang['BAN_SUCCESSFUL']) . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error((($result === false) ? phpbb::$user->lang['BAN_ALREADY_ENTERED'] : phpbb::$user->lang['BAN_SUCCESSFUL']) . adm_back_link($this->u_action . '&u=' . $user_id)); break; case 'reactivate': - if ($user_id == $user->data['user_id']) + if ($user_id == phpbb::$user->data['user_id']) { - trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($user_row['user_type'] == phpbb::USER_FOUNDER) { - trigger_error($user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($user_row['user_type'] == phpbb::USER_IGNORE) { - trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if (phpbb::$config['email_enable']) @@ -339,12 +339,12 @@ class acp_users $messenger->to($user_row['user_email'], $user_row['username']); $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->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); $messenger->assign_vars(array( - 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], phpbb::$config['sitename'])), + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf(phpbb::$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") ); @@ -354,32 +354,32 @@ class acp_users add_log('admin', 'LOG_USER_REACTIVATE', $user_row['username']); add_log('user', $user_id, 'LOG_USER_REACTIVATE_USER'); - trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id)); } break; case 'active': - if ($user_id == $user->data['user_id']) + if ($user_id == phpbb::$user->data['user_id']) { // It is only deactivation since the user is already activated (else he would not have reached this page) - trigger_error($user->lang['CANNOT_DEACTIVATE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_DEACTIVATE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($user_row['user_type'] == phpbb::USER_FOUNDER) { - trigger_error($user->lang['CANNOT_DEACTIVATE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_DEACTIVATE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($user_row['user_type'] == phpbb::USER_IGNORE) { - trigger_error($user->lang['CANNOT_DEACTIVATE_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_DEACTIVATE_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } user_active_flip('flip', $user_id); @@ -390,7 +390,7 @@ class acp_users add_log('admin', $log, $user_row['username']); add_log('user', $user_id, $log . '_USER'); - trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id)); break; @@ -398,7 +398,7 @@ class acp_users if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $sql_ary = array( @@ -414,7 +414,7 @@ class acp_users add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']); add_log('user', $user_id, 'LOG_USER_DEL_SIG_USER'); - trigger_error($user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); break; @@ -422,7 +422,7 @@ class acp_users if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $sql_ary = array( @@ -446,7 +446,7 @@ class acp_users add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']); add_log('user', $user_id, 'LOG_USER_DEL_AVATAR_USER'); - trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); break; case 'delposts': @@ -457,11 +457,11 @@ class acp_users delete_posts('poster_id', $user_id); add_log('admin', 'LOG_USER_DEL_POSTS', $user_row['username']); - trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'u' => $user_id, 'i' => $id, 'mode' => $mode, @@ -479,11 +479,11 @@ class acp_users delete_attachments('user', $user_id); add_log('admin', 'LOG_USER_DEL_ATTACH', $user_row['username']); - trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'u' => $user_id, 'i' => $id, 'mode' => $mode, @@ -498,10 +498,10 @@ class acp_users if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - $user->add_lang('acp/forums'); + phpbb::$user->add_lang('acp/forums'); $new_forum_id = request_var('new_f', 0); @@ -529,12 +529,12 @@ class acp_users if (!$forum_info) { - trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($forum_info['forum_type'] != FORUM_POST) { - trigger_error($user->lang['MOVE_POSTS_NO_POSTABLE_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['MOVE_POSTS_NO_POSTABLE_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } // Two stage? @@ -646,7 +646,7 @@ class acp_users add_log('admin', 'LOG_USER_MOVE_POSTS', $user_row['username'], $forum_info['forum_name']); add_log('user', $user_id, 'LOG_USER_MOVE_POSTS_USER', $forum_info['forum_name']); - trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); break; } @@ -729,12 +729,12 @@ class acp_users // Make sure the user is not setting an Inactive or ignored user to be a founder if ($user_row['user_type'] == phpbb::USER_IGNORE) { - trigger_error($user->lang['CANNOT_SET_FOUNDER_IGNORED'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_SET_FOUNDER_IGNORED'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($user_row['user_type'] == phpbb::USER_INACTIVE) { - trigger_error($user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $sql_ary['user_type'] = phpbb::USER_FOUNDER; @@ -756,7 +756,7 @@ class acp_users } else { - trigger_error($user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } } } @@ -788,7 +788,7 @@ class acp_users 'user_pass_convert' => 0, ); - $user->reset_login_keys($user_id); + phpbb::$user->reset_login_keys($user_id); add_log('user', $user_id, 'LOG_USER_NEW_PASSWORD', $user_row['username']); } @@ -810,14 +810,14 @@ class acp_users add_log('admin', 'LOG_USER_USER_UPDATE', $data['username']); - trigger_error($user->lang['USER_OVERVIEW_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_OVERVIEW_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } - if ($user_id == $user->data['user_id']) + if ($user_id == phpbb::$user->data['user_id']) { $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH'); } @@ -843,10 +843,10 @@ class acp_users } } - $s_action_options = '<option class="sep" value="">' . $user->lang['SELECT_OPTION'] . '</option>'; + $s_action_options = '<option class="sep" value="">' . phpbb::$user->lang['SELECT_OPTION'] . '</option>'; foreach ($quick_tool_ary as $value => $lang) { - $s_action_options .= '<option value="' . $value . '">' . $user->lang['USER_ADMIN_' . $lang] . '</option>'; + $s_action_options .= '<option value="' . $value . '">' . phpbb::$user->lang['USER_ADMIN_' . $lang] . '</option>'; } if (phpbb::$config['load_onlinetrack']) @@ -868,24 +868,24 @@ class acp_users $inactive_reason = ''; if ($user_row['user_type'] == phpbb::USER_INACTIVE) { - $inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_UNKNOWN']; switch ($user_row['user_inactive_reason']) { case INACTIVE_REGISTER: - $inactive_reason = $user->lang['INACTIVE_REASON_REGISTER']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_REGISTER']; break; case INACTIVE_PROFILE: - $inactive_reason = $user->lang['INACTIVE_REASON_PROFILE']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_PROFILE']; break; case INACTIVE_MANUAL: - $inactive_reason = $user->lang['INACTIVE_REASON_MANUAL']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_MANUAL']; break; case INACTIVE_REMIND: - $inactive_reason = $user->lang['INACTIVE_REASON_REMIND']; + $inactive_reason = phpbb::$user->lang['INACTIVE_REASON_REMIND']; break; } } @@ -900,29 +900,29 @@ class acp_users $db->sql_freeresult($result); $template->assign_vars(array( - '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']), + 'L_NAME_CHARS_EXPLAIN' => sprintf(phpbb::$user->lang[phpbb::$config['allow_name_chars'] . '_EXPLAIN'], phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), + 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf(phpbb::$user->lang[phpbb::$config['pass_complex'] . '_EXPLAIN'], phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), + 'L_POSTS_IN_QUEUE' => phpbb::$user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']), 'S_FOUNDER' => phpbb::$user->is_founder, 'S_OVERVIEW' => true, 'S_USER_IP' => ($user_row['user_ip']) ? true : false, 'S_USER_FOUNDER' => ($user_row['user_type'] == phpbb::USER_FOUNDER) ? true : false, 'S_ACTION_OPTIONS' => $s_action_options, - 'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false, + 'S_OWN_ACCOUNT' => ($user_id == phpbb::$user->data['user_id']) ? true : false, 'S_USER_INACTIVE' => ($user_row['user_type'] == phpbb::USER_INACTIVE) ? true : false, 'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'), 'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}", - 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid('mcp', 'i=queue', true, $user->session_id) : '', + 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid('mcp', 'i=queue', true, phpbb::$user->session_id) : '', - 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid('ucp', "mode=switch_perm&u={$user_row['user_id']}") : '', + 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && phpbb::$user->data['user_id'] != $user_row['user_id']) ? append_sid('ucp', "mode=switch_perm&u={$user_row['user_id']}") : '', 'POSTS_IN_QUEUE' => $user_row['posts_in_queue'], 'USER' => $user_row['username'], - 'USER_REGISTERED' => $user->format_date($user_row['user_regdate']), + 'USER_REGISTERED' => phpbb::$user->format_date($user_row['user_regdate']), 'REGISTERED_IP' => ($ip == 'hostname') ? gethostbyaddr($user_row['user_ip']) : $user_row['user_ip'], - 'USER_LASTACTIVE' => ($last_visit) ? $user->format_date($last_visit) : ' - ', + 'USER_LASTACTIVE' => ($last_visit) ? phpbb::$user->format_date($last_visit) : ' - ', 'USER_EMAIL' => $user_row['user_email'], 'USER_WARNINGS' => $user_row['user_warnings'], 'USER_POSTS' => $user_row['user_posts'], @@ -933,7 +933,7 @@ class acp_users case 'feedback': - $user->add_lang('mcp'); + phpbb::$user->add_lang('mcp'); // Set up general vars $start = request_var('start', 0); @@ -952,7 +952,7 @@ class acp_users { if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $where_sql = ''; @@ -982,19 +982,19 @@ class acp_users { if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } add_log('admin', 'LOG_USER_FEEDBACK', $user_row['username']); add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $user_row['username']); add_log('user', $user_id, 'LOG_USER_GENERAL', $message); - trigger_error($user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } // Sorting - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('u' => phpbb::$user->lang['SORT_USERNAME'], 't' => phpbb::$user->lang['SORT_DATE'], 'i' => phpbb::$user->lang['SORT_IP'], 'o' => phpbb::$user->lang['SORT_ACTION']); $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -1025,7 +1025,7 @@ class acp_users $template->assign_block_vars('log', array( 'USERNAME' => $row['username_full'], 'IP' => $row['ip'], - 'DATE' => $user->format_date($row['time']), + 'DATE' => phpbb::$user->format_date($row['time']), 'ACTION' => nl2br($row['action']), 'ID' => $row['id']) ); @@ -1044,7 +1044,7 @@ class acp_users $sql = 'SELECT lang_id FROM ' . LANG_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'"; + WHERE lang_iso = '" . $db->sql_escape(phpbb::$user->data['user_lang']) . "'"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1180,11 +1180,11 @@ class acp_users } } - trigger_error($user->lang['USER_PROFILE_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_PROFILE_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } $s_birthday_day_options = '<option value="0"' . ((!$data['bday_day']) ? ' selected="selected"' : '') . '>--</option>'; @@ -1230,7 +1230,7 @@ class acp_users ); // Get additional profile fields and assign them to the template block var 'profile_fields' - $user->get_profile_fields($user_id); + phpbb::$user->get_profile_fields($user_id); $cp->generate_profile_fields('profile', $user_row['iso_lang_id']); @@ -1338,40 +1338,40 @@ class acp_users WHERE user_id = $user_id"; $db->sql_query($sql); - trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } $dateformat_options = ''; - foreach ($user->lang['dateformats'] as $format => $null) + foreach (phpbb::$user->lang['dateformats'] as $format => $null) { $dateformat_options .= '<option value="' . $format . '"' . (($format == $data['dateformat']) ? ' selected="selected"' : '') . '>'; - $dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : ''); + $dateformat_options .= phpbb::$user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? phpbb::$user->lang['VARIANT_DATE_SEPARATOR'] . phpbb::$user->format_date(time(), $format, true) : ''); $dateformat_options .= '</option>'; } $s_custom = false; $dateformat_options .= '<option value="custom"'; - if (!isset($user->lang['dateformats'][$data['dateformat']])) + if (!isset(phpbb::$user->lang['dateformats'][$data['dateformat']])) { $dateformat_options .= ' selected="selected"'; $s_custom = true; } - $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; + $dateformat_options .= '>' . phpbb::$user->lang['CUSTOM_DATEFORMAT'] . '</option>'; - $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + $sort_dir_text = array('a' => phpbb::$user->lang['ASCENDING'], 'd' => phpbb::$user->lang['DESCENDING']); // Topic ordering options - $limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); + $limit_topic_days = array(0 => phpbb::$user->lang['ALL_TOPICS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_topic_text = array('a' => phpbb::$user->lang['AUTHOR'], 't' => phpbb::$user->lang['POST_TIME'], 'r' => phpbb::$user->lang['REPLIES'], 's' => phpbb::$user->lang['SUBJECT'], 'v' => phpbb::$user->lang['VIEWS']); // Post ordering options - $limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $limit_post_days = array(0 => phpbb::$user->lang['ALL_POSTS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_post_text = array('a' => phpbb::$user->lang['AUTHOR'], 't' => phpbb::$user->lang['POST_TIME'], 's' => phpbb::$user->lang['SUBJECT']); $_options = array('topic', 'post'); foreach ($_options as $sort_option) @@ -1459,16 +1459,16 @@ class acp_users if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if (avatar_process_user($error, $user_row)) { - trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_row['user_id'])); + trigger_error(phpbb::$user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_row['user_id'])); } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } // Generate users avatar @@ -1495,7 +1495,7 @@ class acp_users 'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'], 'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'], - 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], round(phpbb::$config['avatar_filesize'] / 1024))) + 'L_AVATAR_EXPLAIN' => sprintf(phpbb::$user->lang['AVATAR_EXPLAIN'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], round(phpbb::$config['avatar_filesize'] / 1024))) ); break; @@ -1506,7 +1506,7 @@ class acp_users { if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $rank_id = request_var('user_rank', 0); @@ -1516,7 +1516,7 @@ class acp_users WHERE user_id = $user_id"; $db->sql_query($sql); - trigger_error($user->lang['USER_RANK_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_RANK_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } $sql = 'SELECT * @@ -1525,7 +1525,7 @@ class acp_users ORDER BY rank_title'; $result = $db->sql_query($sql); - $s_rank_options = '<option value="0"' . ((!$user_row['user_rank']) ? ' selected="selected"' : '') . '>' . $user->lang['NO_SPECIAL_RANK'] . '</option>'; + $s_rank_options = '<option value="0"' . ((!$user_row['user_rank']) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['NO_SPECIAL_RANK'] . '</option>'; while ($row = $db->sql_fetchrow($result)) { @@ -1546,8 +1546,8 @@ 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 = (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_bbcode = (phpbb::$config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !phpbb::$user->optionget('bbcode'))) ? false : true) : false; + $enable_smilies = (phpbb::$config['allow_sig_smilies']) ? ((request_var('disable_smilies', !phpbb::$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)); @@ -1585,11 +1585,11 @@ class acp_users WHERE user_id = ' . $user_id; $db->sql_query($sql); - trigger_error($user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error(phpbb::$user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } $signature_preview = ''; @@ -1613,13 +1613,13 @@ class acp_users 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', - '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'], + 'BBCODE_STATUS' => (phpbb::$config['allow_sig_bbcode']) ? sprintf(phpbb::$user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf(phpbb::$user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), + 'SMILIES_STATUS' => (phpbb::$config['allow_sig_smilies']) ? phpbb::$user->lang['SMILIES_ARE_ON'] : phpbb::$user->lang['SMILIES_ARE_OFF'], + 'IMG_STATUS' => (phpbb::$config['allow_sig_img']) ? phpbb::$user->lang['IMAGES_ARE_ON'] : phpbb::$user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => (phpbb::$config['allow_sig_flash']) ? phpbb::$user->lang['FLASH_IS_ON'] : phpbb::$user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => (phpbb::$config['allow_sig_links']) ? phpbb::$user->lang['URL_IS_ON'] : phpbb::$user->lang['URL_IS_OFF'], - 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], phpbb::$config['max_sig_chars']), + 'L_SIGNATURE_EXPLAIN' => sprintf(phpbb::$user->lang['SIGNATURE_EXPLAIN'], phpbb::$config['max_sig_chars']), 'S_BBCODE_ALLOWED' => phpbb::$config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => phpbb::$config['allow_sig_smilies'], @@ -1678,14 +1678,14 @@ class acp_users delete_attachments('attach', $marked); - $message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; + $message = (sizeof($log_attachments) == 1) ? phpbb::$user->lang['ATTACHMENT_DELETED'] : phpbb::$user->lang['ATTACHMENTS_DELETED']; add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode(', ', $log_attachments)); trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'u' => $user_id, 'i' => $id, 'mode' => $mode, @@ -1696,10 +1696,10 @@ class acp_users } } - $sk_text = array('a' => $user->lang['SORT_FILENAME'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']); + $sk_text = array('a' => phpbb::$user->lang['SORT_FILENAME'], 'c' => phpbb::$user->lang['SORT_EXTENSION'], 'd' => phpbb::$user->lang['SORT_SIZE'], 'e' => phpbb::$user->lang['SORT_DOWNLOADS'], 'f' => phpbb::$user->lang['SORT_POST_TIME'], 'g' => phpbb::$user->lang['SORT_TOPIC_TITLE']); $sk_sql = array('a' => 'a.real_filename', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title'); - $sd_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + $sd_text = array('a' => phpbb::$user->lang['ASCENDING'], 'd' => phpbb::$user->lang['DESCENDING']); $s_sort_key = ''; foreach ($sk_text as $key => $value) @@ -1758,7 +1758,7 @@ class acp_users 'EXTENSION' => $row['extension'], 'SIZE' => get_formatted_filesize($row['filesize']), 'DOWNLOAD_COUNT' => $row['download_count'], - 'POST_TIME' => $user->format_date($row['filetime']), + 'POST_TIME' => phpbb::$user->format_date($row['filetime']), 'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'], 'ATTACH_ID' => $row['attach_id'], @@ -1788,7 +1788,7 @@ class acp_users include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); - $user->add_lang(array('groups', 'acp/groups')); + phpbb::$user->add_lang(array('groups', 'acp/groups')); $group_id = request_var('g', 0); if ($group_id) @@ -1803,7 +1803,7 @@ class acp_users if (!phpbb::$user->is_founder && $founder_manage) { - trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } } else @@ -1818,7 +1818,7 @@ class acp_users case 'default': if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } group_user_attributes($action, $group_id, $user_id); @@ -1834,19 +1834,19 @@ class acp_users { if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if ($error = group_user_del($group_id, $user_id)) { - trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $error = array(); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'u' => $user_id, 'i' => $id, 'mode' => $mode, @@ -1864,18 +1864,18 @@ class acp_users if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } // Add user/s to group if ($error = group_user_add($group_id, $user_id)) { - trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + trigger_error(phpbb::$user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } $error = array(); @@ -1926,7 +1926,7 @@ class acp_users continue; } - $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } $db->sql_freeresult($result); @@ -1937,7 +1937,7 @@ class acp_users { $template->assign_block_vars('group', array( 'S_NEW_GROUP_TYPE' => true, - 'GROUP_TYPE' => $user->lang['USER_GROUP_' . strtoupper($group_type)]) + 'GROUP_TYPE' => phpbb::$user->lang['USER_GROUP_' . strtoupper($group_type)]) ); } @@ -1949,8 +1949,8 @@ class acp_users 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'], 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], - 'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'], - 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], + 'GROUP_NAME' => ($group_type == 'special') ? phpbb::$user->lang['G_' . $data['group_name']] : $data['group_name'], + 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? phpbb::$user->lang['GROUP_DEMOTE'] : phpbb::$user->lang['GROUP_PROMOTE'], 'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false, @@ -1972,7 +1972,7 @@ class acp_users $auth_admin = new auth_admin(); - $user->add_lang('acp/permissions'); + phpbb::$user->add_lang('acp/permissions'); add_permission_language(); $forum_id = request_var('f', 0); @@ -2016,7 +2016,7 @@ class acp_users $db->sql_freeresult($result); } - $s_forum_options = '<option value="0"' . ((!$forum_id) ? ' selected="selected"' : '') . '>' . $user->lang['VIEW_GLOBAL_PERMS'] . '</option>'; + $s_forum_options = '<option value="0"' . ((!$forum_id) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['VIEW_GLOBAL_PERMS'] . '</option>'; $s_forum_options .= make_forum_select($forum_id, false, true, false, false, false); $template->assign_vars(array( @@ -2042,21 +2042,19 @@ class acp_users } /** - * Optionset replacement for this module based on $user->optionset + * Optionset replacement for this module based on phpbb::$user->optionset */ function optionset(&$user_row, $key, $value, $data = false) { - global $user; - $var = ($data) ? $data : $user_row['user_options']; - if ($value && !($var & 1 << $user->keyoptions[$key])) + if ($value && !($var & 1 << phpbb::$user->keyoptions[$key])) { - $var += 1 << $user->keyoptions[$key]; + $var += 1 << phpbb::$user->keyoptions[$key]; } - else if (!$value && ($var & 1 << $user->keyoptions[$key])) + else if (!$value && ($var & 1 << phpbb::$user->keyoptions[$key])) { - $var -= 1 << $user->keyoptions[$key]; + $var -= 1 << phpbb::$user->keyoptions[$key]; } else { @@ -2075,14 +2073,12 @@ class acp_users } /** - * Optionget replacement for this module based on $user->optionget + * Optionget replacement for this module based on phpbb::$user->optionget */ function optionget(&$user_row, $key, $data = false) { - global $user; - $var = ($data) ? $data : $user_row['user_options']; - return ($var & 1 << $user->keyoptions[$key]) ? true : false; + return ($var & 1 << phpbb::$user->keyoptions[$key]) ? true : false; } } diff --git a/phpBB/modules/acp/acp_words.php b/phpBB/modules/acp/acp_words.php index 87989640ec..878c23acc1 100644 --- a/phpBB/modules/acp/acp_words.php +++ b/phpBB/modules/acp/acp_words.php @@ -26,9 +26,7 @@ class acp_words function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('acp/posting'); + phpbb::$user->add_lang('acp/posting'); // Set up general vars $action = request_var('action', ''); @@ -50,7 +48,7 @@ class acp_words if (!$word_id) { - trigger_error($user->lang['NO_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql = 'SELECT * @@ -81,7 +79,7 @@ class acp_words if (!check_form_key($form_name)) { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } $word_id = request_var('id', 0); $word = utf8_normalize_nfc(request_var('word', '', true)); @@ -89,7 +87,7 @@ class acp_words if (!$word || !$replacement) { - trigger_error($user->lang['ENTER_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['ENTER_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); } $sql_ary = array( @@ -111,7 +109,7 @@ class acp_words $log_action = ($word_id) ? 'LOG_WORD_EDIT' : 'LOG_WORD_ADD'; add_log('admin', $log_action, $word); - $message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED']; + $message = ($word_id) ? phpbb::$user->lang['WORD_UPDATED'] : phpbb::$user->lang['WORD_ADDED']; trigger_error($message . adm_back_link($this->u_action)); break; @@ -122,7 +120,7 @@ class acp_words if (!$word_id) { - trigger_error($user->lang['NO_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(phpbb::$user->lang['NO_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); } if (confirm_box(true)) @@ -142,11 +140,11 @@ class acp_words add_log('admin', 'LOG_WORD_DELETE', $deleted_word); - trigger_error($user->lang['WORD_REMOVED'] . adm_back_link($this->u_action)); + trigger_error(phpbb::$user->lang['WORD_REMOVED'] . adm_back_link($this->u_action)); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'i' => $id, 'mode' => $mode, 'id' => $word_id, diff --git a/phpBB/modules/acp/auth.php b/phpBB/modules/acp/auth.php index 92e61f0480..649ffee656 100644 --- a/phpBB/modules/acp/auth.php +++ b/phpBB/modules/acp/auth.php @@ -27,8 +27,6 @@ class auth_admin extends auth */ function __construct() { - global $db; - if (($this->acl_options = phpbb::$acm->get('acl_options')) === false) { $sql = 'SELECT auth_option_id, auth_option, is_global, is_local @@ -73,8 +71,6 @@ class auth_admin extends auth */ public function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = phpbb::ACL_NEVER) { - global $db, $user; - $hold_ary = array(); $view_user_mask = ($mode == 'view' && $group_id === false) ? true : false; @@ -129,7 +125,7 @@ class auth_admin extends auth while ($userdata = $db->sql_fetchrow($result)) { - if ($user->data['user_id'] != $userdata['user_id']) + if (phpbb::$user->data['user_id'] != $userdata['user_id']) { $auth2 = new auth(); $auth2->acl($userdata); @@ -224,8 +220,6 @@ class auth_admin extends auth */ public function get_role_mask($role_id) { - global $db; - $hold_ary = array(); // Get users having this role set... @@ -262,15 +256,13 @@ class auth_admin extends auth */ public function display_mask($mode, $permission_type, array $hold_ary, $user_mode = 'user', $local = false, $group_display = true) { - global $template, $user, $db; - // Define names for template loops, might be able to be set $tpl_pmask = 'p_mask'; $tpl_fmask = 'f_mask'; $tpl_category = 'category'; $tpl_mask = 'mask'; - $l_acl_type = (isset($user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)])) ? $user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type); + $l_acl_type = (isset(phpbb::$user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)])) ? phpbb::$user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type); // Allow trace for viewing permissions and in user mode $show_trace = ($mode == 'view' && $user_mode == 'user') ? true : false; @@ -295,7 +287,7 @@ class auth_admin extends auth $ug_names_ary = array(); while ($row = $db->sql_fetchrow($result)) { - $ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['ug_name']] : $row['ug_name']); + $ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['ug_name']] : $row['ug_name']); } $db->sql_freeresult($result); @@ -405,7 +397,7 @@ class auth_admin extends auth { if ($groups[$row['group_id']]['group_type'] == GROUP_SPECIAL) { - $user_groups_default[$row['user_id']][] = $user->lang['G_' . $groups[$row['group_id']]['group_name']]; + $user_groups_default[$row['user_id']][] = phpbb::$user->lang['G_' . $groups[$row['group_id']]['group_name']]; } else { @@ -468,8 +460,8 @@ class auth_admin extends auth @reset($roles); while (list($role_id, $role_row) = each($roles)) { - $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); - $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; + $role_description = (!empty(phpbb::$user->lang[$role_row['role_description']])) ? phpbb::$user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); + $role_name = (!empty(phpbb::$user->lang[$role_row['role_name']])) ? phpbb::$user->lang[$role_row['role_name']] : $role_row['role_name']; $title = ($role_description) ? ' title="' . $role_description . '"' : ''; $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_name . '</option>'; @@ -477,7 +469,7 @@ class auth_admin extends auth if ($s_role_options) { - $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . ' title="' . htmlspecialchars($user->lang['NO_ROLE_ASSIGNED_EXPLAIN']) . '">' . $user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options; + $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . ' title="' . htmlspecialchars(phpbb::$user->lang['NO_ROLE_ASSIGNED_EXPLAIN']) . '">' . phpbb::$user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options; } if (!$current_role_id && $mode != 'view') @@ -554,8 +546,8 @@ class auth_admin extends auth @reset($roles); while (list($role_id, $role_row) = each($roles)) { - $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); - $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; + $role_description = (!empty(phpbb::$user->lang[$role_row['role_description']])) ? phpbb::$user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); + $role_name = (!empty(phpbb::$user->lang[$role_row['role_name']])) ? phpbb::$user->lang[$role_row['role_name']] : $role_row['role_name']; $title = ($role_description) ? ' title="' . $role_description . '"' : ''; $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_name . '</option>'; @@ -563,7 +555,7 @@ class auth_admin extends auth if ($s_role_options) { - $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . ' title="' . htmlspecialchars($user->lang['NO_ROLE_ASSIGNED_EXPLAIN']) . '">' . $user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options; + $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . ' title="' . htmlspecialchars(phpbb::$user->lang['NO_ROLE_ASSIGNED_EXPLAIN']) . '">' . phpbb::$user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options; } if (!$current_role_id && $mode != 'view') @@ -606,8 +598,6 @@ class auth_admin extends auth */ public function display_role_mask(array $hold_ary) { - global $db, $template, $user; - if (!sizeof($hold_ary)) { return; @@ -633,7 +623,7 @@ class auth_admin extends auth $auth_ary = $hold_ary[$forum_id]; $template->assign_block_vars('role_mask', array( - 'NAME' => ($forum_id == 0) ? $user->lang['GLOBAL_MASK'] : $forum_name, + 'NAME' => ($forum_id == 0) ? phpbb::$user->lang['GLOBAL_MASK'] : $forum_name, 'FORUM_ID' => $forum_id) ); @@ -668,7 +658,7 @@ class auth_admin extends auth { $template->assign_block_vars('role_mask.groups', array( 'GROUP_ID' => $row['group_id'], - 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], + 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name'], 'U_PROFILE' => append_sid('memberlist', "mode=group&g={$row['group_id']}")) ); } @@ -687,8 +677,6 @@ class auth_admin extends auth */ public function acl_add_option(array $options) { - global $db; - $cur_options = array(); $sql = 'SELECT auth_option, is_global, is_local @@ -772,8 +760,6 @@ class auth_admin extends auth */ public function acl_set($ug_type, $forum_id, $ug_id, $auth, $role_id = 0, $clear_prefetch = true) { - global $db; - // One or more forums if (!is_array($forum_id)) { @@ -905,8 +891,6 @@ class auth_admin extends auth */ public function acl_set_role($role_id, $auth) { - global $db; - // Get any-flag as required reset($auth); $flag = key($auth); @@ -968,8 +952,6 @@ class auth_admin extends auth */ public function acl_delete($mode, $ug_id = false, $forum_id = false, $permission_type = false) { - global $db; - if ($ug_id === false && $forum_id === false) { return; @@ -1076,8 +1058,6 @@ class auth_admin extends auth */ private static function assign_cat_array(array $category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view) { - global $template, $user; - @reset($category_array); while (list($cat, $cat_array) = each($category_array)) { @@ -1086,13 +1066,13 @@ class auth_admin extends auth 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, - 'CAT_NAME' => $user->lang['permission_cat'][$cat]) + 'CAT_NAME' => phpbb::$user->lang['permission_cat'][$cat]) ); /* Sort permissions by name (more naturaly and user friendly than sorting by a primary key) * Commented out due to it's memory consumption and time needed * - $key_array = array_intersect(array_keys($user->lang), array_map(create_function('$a', 'return "acl_" . $a;'), array_keys($cat_array['permissions']))); + $key_array = array_intersect(array_keys(phpbb::$user->lang), array_map(create_function('$a', 'return "acl_" . $a;'), array_keys($cat_array['permissions']))); $values_array = $cat_array['permissions']; $cat_array['permissions'] = array(); @@ -1121,7 +1101,7 @@ class auth_admin extends auth 'U_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', 'UA_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', - 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) + 'PERMISSION' => phpbb::$user->lang['acl_' . $permission]['lang']) ); } else @@ -1139,7 +1119,7 @@ class auth_admin extends auth 'U_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', 'UA_TRACE' => ($show_trace) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', - 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) + 'PERMISSION' => phpbb::$user->lang['acl_' . $permission]['lang']) ); } } @@ -1152,8 +1132,6 @@ class auth_admin extends auth */ public static function build_permission_array(array $permission_row, array &$content_array, array &$categories, array $key_sort_array) { - global $user; - foreach ($key_sort_array as $forum_id) { if (!isset($permission_row[$forum_id])) @@ -1167,20 +1145,20 @@ class auth_admin extends auth @reset($permissions); while (list($permission, $auth_setting) = each($permissions)) { - if (!isset($user->lang['acl_' . $permission])) + if (!isset(phpbb::$user->lang['acl_' . $permission])) { - $user->lang['acl_' . $permission] = array( + phpbb::$user->lang['acl_' . $permission] = array( 'cat' => 'misc', 'lang' => '{ acl_' . $permission . ' }' ); } - $cat = $user->lang['acl_' . $permission]['cat']; + $cat = phpbb::$user->lang['acl_' . $permission]['cat']; // Build our categories array if (!isset($categories[$cat])) { - $categories[$cat] = $user->lang['permission_cat'][$cat]; + $categories[$cat] = phpbb::$user->lang['permission_cat'][$cat]; } // Build our content array @@ -1217,8 +1195,6 @@ class auth_admin extends auth */ public function ghost_permissions($from_user_id, $to_user_id) { - global $db; - if ($to_user_id == ANONYMOUS) { return false; diff --git a/phpBB/modules/mcp/mcp_ban.php b/phpBB/modules/mcp/mcp_ban.php index 35535711e2..a5680dcbff 100644 --- a/phpBB/modules/mcp/mcp_ban.php +++ b/phpBB/modules/mcp/mcp_ban.php @@ -25,8 +25,6 @@ class mcp_ban function main($id, $mode) { - global $db, $user, $auth, $template; - include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); // Include the admin banning interface... @@ -36,7 +34,7 @@ class mcp_ban $unbansubmit = phpbb_request::is_set_post('unbansubmit'); $current_time = time(); - $user->add_lang(array('acp/ban', 'acp/users')); + phpbb::$user->add_lang(array('acp/ban', 'acp/users')); $this->tpl_name = 'mcp_ban'; // Ban submitted? @@ -62,11 +60,11 @@ class mcp_ban { user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason); - trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">« ' . $user->lang['BACK_TO_PREV'] . '</a>'); + trigger_error(phpbb::$user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">« ' . phpbb::$user->lang['BACK_TO_PREV'] . '</a>'); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'mode' => $mode, 'ban' => $ban, 'bansubmit' => true, @@ -88,11 +86,11 @@ class mcp_ban { user_unban($mode, $ban); - trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">« ' . $user->lang['BACK_TO_PREV'] . '</a>'); + trigger_error(phpbb::$user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">« ' . phpbb::$user->lang['BACK_TO_PREV'] . '</a>'); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'mode' => $mode, 'unbansubmit' => true, 'unban' => $ban))); @@ -101,7 +99,7 @@ class mcp_ban } // Ban length options - $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -> '); + $ban_end_text = array(0 => phpbb::$user->lang['PERMANENT'], 30 => phpbb::$user->lang['30_MINS'], 60 => phpbb::$user->lang['1_HOUR'], 360 => phpbb::$user->lang['6_HOURS'], 1440 => phpbb::$user->lang['1_DAY'], 10080 => phpbb::$user->lang['7_DAYS'], 20160 => phpbb::$user->lang['2_WEEKS'], 40320 => phpbb::$user->lang['1_MONTH'], -1 => phpbb::$user->lang['UNTIL'] . ' -> '); $ban_end_options = ''; foreach ($ban_end_text as $length => $text) @@ -110,26 +108,26 @@ class mcp_ban } // Define language vars - $this->page_title = $user->lang[strtoupper($mode) . '_BAN']; + $this->page_title = phpbb::$user->lang[strtoupper($mode) . '_BAN']; - $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN']; - $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN']; - $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN']; - $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN']; - $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED']; + $l_ban_explain = phpbb::$user->lang[strtoupper($mode) . '_BAN_EXPLAIN']; + $l_ban_exclude_explain = phpbb::$user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN']; + $l_unban_title = phpbb::$user->lang[strtoupper($mode) . '_UNBAN']; + $l_unban_explain = phpbb::$user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN']; + $l_no_ban_cell = phpbb::$user->lang[strtoupper($mode) . '_NO_BANNED']; switch ($mode) { case 'user': - $l_ban_cell = $user->lang['USERNAME']; + $l_ban_cell = phpbb::$user->lang['USERNAME']; break; case 'ip': - $l_ban_cell = $user->lang['IP_HOSTNAME']; + $l_ban_cell = phpbb::$user->lang['IP_HOSTNAME']; break; case 'email': - $l_ban_cell = $user->lang['EMAIL_ADDRESS']; + $l_ban_cell = phpbb::$user->lang['EMAIL_ADDRESS']; break; } diff --git a/phpBB/modules/mcp/mcp_forum.php b/phpBB/modules/mcp/mcp_forum.php index 346d29d34b..d1048a8803 100644 --- a/phpBB/modules/mcp/mcp_forum.php +++ b/phpBB/modules/mcp/mcp_forum.php @@ -21,9 +21,9 @@ if (!defined('IN_PHPBB')) */ function mcp_forum_view($id, $mode, $action, $forum_info) { - global $template, $db, $user, $auth, $module; + global $module; - $user->add_lang(array('viewtopic', 'viewforum')); + phpbb::$user->add_lang(array('viewtopic', 'viewforum')); include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); @@ -105,10 +105,10 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'FORUM_NAME' => $forum_info['forum_name'], 'FORUM_DESCRIPTION' => generate_text_for_display($forum_info['forum_desc'], $forum_info['forum_desc_uid'], $forum_info['forum_desc_bitfield'], $forum_info['forum_desc_options']), - 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), - 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'TOPIC_REPORTED'), + 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), + 'LAST_POST_IMG' => phpbb::$user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'NEWEST_POST_IMG' => phpbb::$user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'S_CAN_REPORT' => $auth->acl_get('m_report', $forum_id), 'S_CAN_DELETE' => $auth->acl_get('m_delete', $forum_id), @@ -130,7 +130,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'PAGINATION' => generate_pagination($url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : ''), $forum_topics, $topics_per_page, $start), 'PAGE_NUMBER' => on_page($forum_topics, $topics_per_page, $start), - 'TOTAL_TOPICS' => ($forum_topics == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $forum_topics), + 'TOTAL_TOPICS' => ($forum_topics == 1) ? phpbb::$user->lang['VIEW_FORUM_TOPIC'] : sprintf(phpbb::$user->lang['VIEW_FORUM_TOPICS'], $forum_topics), )); // Grab icons @@ -140,7 +140,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 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_join = ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . phpbb::$user->data['user_id'] . ')'; $read_tracking_select = ', tt.mark_time'; } else @@ -222,13 +222,13 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&t=' . $row['topic_id'] : ''; $topic_row = array( - 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', - 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), - 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, 'src'), + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? phpbb::$user->img('icon_topic_attach', 'TOTAL_ATTACHMENTS') : '', + 'TOPIC_FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), + 'TOPIC_FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, 'src'), 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', - 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? phpbb::$user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), @@ -243,10 +243,10 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'TOPIC_TYPE' => $topic_type, 'TOPIC_TITLE' => $topic_title, 'REPLIES' => ($auth->acl_get('m_approve', $row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'], - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_TIME' => phpbb::$user->format_date($row['topic_last_post_time']), + 'FIRST_POST_TIME' => phpbb::$user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_VIEW_TIME' => phpbb::$user->format_date($row['topic_last_view_time']), 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && empty($row['topic_moved_id']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, @@ -295,8 +295,6 @@ function mcp_forum_view($id, $mode, $action, $forum_info) */ function mcp_resync_topics($topic_ids) { - global $auth, $db, $template, $user; - if (!sizeof($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); @@ -324,12 +322,12 @@ function mcp_resync_topics($topic_ids) } $db->sql_freeresult($result); - $msg = (sizeof($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS']; + $msg = (sizeof($topic_ids) == 1) ? phpbb::$user->lang['TOPIC_RESYNC_SUCCESS'] : phpbb::$user->lang['TOPICS_RESYNC_SUCCESS']; - $redirect = request_var('redirect', $user->data['session_page']); + $redirect = request_var('redirect', phpbb::$user->data['session_page']); meta_refresh(3, $redirect); - trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + trigger_error($msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); return; } @@ -339,16 +337,14 @@ function mcp_resync_topics($topic_ids) */ function merge_topics($forum_id, $topic_ids, $to_topic_id) { - global $db, $template, $user, $auth; - if (!sizeof($topic_ids)) { - $template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_TOPIC_SELECTED']); return; } if (!$to_topic_id) { - $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_FINAL_TOPIC_SELECTED']); return; } @@ -356,7 +352,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) if (!sizeof($topic_data)) { - $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_FINAL_TOPIC_SELECTED']); return; } @@ -382,7 +378,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) if (!sizeof($post_id_list)) { - $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_POST_SELECTED']); return; } @@ -425,7 +421,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); // Link to the new topic - $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); + $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf(phpbb::$user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); } else { @@ -442,7 +438,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) else { meta_refresh(3, append_sid('viewtopic', "f=$to_forum_id&t=$to_topic_id")); - trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_link); } } diff --git a/phpBB/modules/mcp/mcp_front.php b/phpBB/modules/mcp/mcp_front.php index ad30774e2f..95b12e9a7b 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; + global $module; // Latest 5 unapproved if ($module->loaded('queue')) @@ -108,11 +108,11 @@ function mcp_front_view($id, $mode, $action) 'AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour']), 'U_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour']), - 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], + 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : phpbb::$user->lang['GLOBAL_ANNOUNCEMENT'], 'POST_ID' => $row['post_id'], 'TOPIC_TITLE' => $row['topic_title'], - 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'], - 'POST_TIME' => $user->format_date($row['post_time'])) + 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : phpbb::$user->lang['NO_SUBJECT'], + 'POST_TIME' => phpbb::$user->format_date($row['post_time'])) ); } $db->sql_freeresult($result); @@ -125,14 +125,14 @@ function mcp_front_view($id, $mode, $action) if ($total == 0) { $template->assign_vars(array( - 'L_UNAPPROVED_TOTAL' => $user->lang['UNAPPROVED_POSTS_ZERO_TOTAL'], + 'L_UNAPPROVED_TOTAL' => phpbb::$user->lang['UNAPPROVED_POSTS_ZERO_TOTAL'], 'S_HAS_UNAPPROVED_POSTS' => false) ); } else { $template->assign_vars(array( - 'L_UNAPPROVED_TOTAL' => ($total == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total), + 'L_UNAPPROVED_TOTAL' => ($total == 1) ? phpbb::$user->lang['UNAPPROVED_POST_TOTAL'] : sprintf(phpbb::$user->lang['UNAPPROVED_POSTS_TOTAL'], $total), 'S_HAS_UNAPPROVED_POSTS' => true) ); } @@ -216,11 +216,11 @@ function mcp_front_view($id, $mode, $action) 'AUTHOR_COLOUR' => get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']), 'U_AUTHOR' => get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']), - 'FORUM_NAME' => (!$global_topic) ? $row['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'], + 'FORUM_NAME' => (!$global_topic) ? $row['forum_name'] : phpbb::$user->lang['GLOBAL_ANNOUNCEMENT'], 'TOPIC_TITLE' => $row['topic_title'], - 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'], - 'REPORT_TIME' => $user->format_date($row['report_time']), - 'POST_TIME' => $user->format_date($row['post_time']), + 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : phpbb::$user->lang['NO_SUBJECT'], + 'REPORT_TIME' => phpbb::$user->format_date($row['report_time']), + 'POST_TIME' => phpbb::$user->format_date($row['post_time']), )); } } @@ -228,14 +228,14 @@ function mcp_front_view($id, $mode, $action) if ($total == 0) { $template->assign_vars(array( - 'L_REPORTS_TOTAL' => $user->lang['REPORTS_ZERO_TOTAL'], + 'L_REPORTS_TOTAL' => phpbb::$user->lang['REPORTS_ZERO_TOTAL'], 'S_HAS_REPORTS' => false) ); } else { $template->assign_vars(array( - 'L_REPORTS_TOTAL' => ($total == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total), + 'L_REPORTS_TOTAL' => ($total == 1) ? phpbb::$user->lang['REPORT_TOTAL'] : sprintf(phpbb::$user->lang['REPORTS_TOTAL'], $total), 'S_HAS_REPORTS' => true) ); } @@ -261,7 +261,7 @@ function mcp_front_view($id, $mode, $action) $template->assign_block_vars('log', array( 'USERNAME' => $row['username_full'], 'IP' => $row['ip'], - 'TIME' => $user->format_date($row['time']), + 'TIME' => phpbb::$user->format_date($row['time']), 'ACTION' => $row['action'], 'U_VIEW_TOPIC' => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '', 'U_VIEWLOGS' => (!empty($row['viewlogs'])) ? $row['viewlogs'] : '') diff --git a/phpBB/modules/mcp/mcp_logs.php b/phpBB/modules/mcp/mcp_logs.php index b91a7906b8..8c162d4d31 100644 --- a/phpBB/modules/mcp/mcp_logs.php +++ b/phpBB/modules/mcp/mcp_logs.php @@ -33,9 +33,7 @@ class mcp_logs function main($id, $mode) { - global $auth, $db, $user, $template; - - $user->add_lang('acp/common'); + phpbb::$user->add_lang('acp/common'); $action = request_var('action', array('' => '')); @@ -134,7 +132,7 @@ class mcp_logs } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'f' => $forum_id, 't' => $topic_id, 'start' => $start, @@ -152,8 +150,8 @@ class mcp_logs } // Sorting - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('u' => phpbb::$user->lang['SORT_USERNAME'], 't' => phpbb::$user->lang['SORT_DATE'], 'i' => phpbb::$user->lang['SORT_IP'], 'o' => phpbb::$user->lang['SORT_ACTION']); $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -170,10 +168,10 @@ class mcp_logs $template->assign_vars(array( '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), + 'TOTAL' => ($log_count == 1) ? phpbb::$user->lang['TOTAL_LOG'] : sprintf(phpbb::$user->lang['TOTAL_LOGS'], $log_count), 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, phpbb::$config['topics_per_page'], $start), - 'L_TITLE' => $user->lang['MCP_LOGS'], + 'L_TITLE' => phpbb::$user->lang['MCP_LOGS'], 'U_POST_ACTION' => $this->u_action, 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, @@ -193,14 +191,14 @@ class mcp_logs { if (isset($row[$check]) && $row[$check]) { - $data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>'; + $data[] = '<a href="' . $row[$check] . '">' . phpbb::$user->lang['LOGVIEW_' . strtoupper($check)] . '</a>'; } } $template->assign_block_vars('log', array( 'USERNAME' => $row['username_full'], 'IP' => $row['ip'], - 'DATE' => $user->format_date($row['time']), + 'DATE' => phpbb::$user->format_date($row['time']), 'ACTION' => $row['action'], 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', 'ID' => $row['id'], diff --git a/phpBB/modules/mcp/mcp_main.php b/phpBB/modules/mcp/mcp_main.php index a3d5ae8a46..3fa38c7d1f 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; + global $action; $quickmod = ($mode == 'quickmod') ? true : false; @@ -80,7 +80,7 @@ class mcp_main break; case 'move': - $user->add_lang('viewtopic'); + phpbb::$user->add_lang('viewtopic'); $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); @@ -93,7 +93,7 @@ class mcp_main break; case 'fork': - $user->add_lang('viewtopic'); + phpbb::$user->add_lang('viewtopic'); $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); @@ -106,7 +106,7 @@ class mcp_main break; case 'delete_topic': - $user->add_lang('viewtopic'); + phpbb::$user->add_lang('viewtopic'); $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); @@ -119,7 +119,7 @@ class mcp_main break; case 'delete_post': - $user->add_lang('posting'); + phpbb::$user->add_lang('posting'); $post_ids = (!$quickmod) ? request_var('post_id_list', array(0)) : array(request_var('p', 0)); @@ -137,7 +137,7 @@ class mcp_main case 'front': include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_front.' . PHP_EXT); - $user->add_lang('acp/common'); + phpbb::$user->add_lang('acp/common'); mcp_front_view($id, $mode, $action); @@ -148,7 +148,7 @@ class mcp_main case 'forum_view': include(PHPBB_ROOT_PATH . 'includes/mcp/mcp_forum.' . PHP_EXT); - $user->add_lang('viewforum'); + phpbb::$user->add_lang('viewforum'); $forum_id = request_var('f', 0); @@ -198,8 +198,6 @@ class mcp_main */ function lock_unlock($action, $ids) { - global $auth, $user, $db; - if ($action == 'lock' || $action == 'unlock') { $table = TOPICS_TABLE; @@ -274,7 +272,7 @@ function lock_unlock($action, $ids) else { meta_refresh(2, $redirect); - trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } } @@ -283,8 +281,6 @@ function lock_unlock($action, $ids) */ function change_topic_type($action, $topic_ids) { - global $auth, $user, $db; - // For changing topic types, we only allow operations in one forum. $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('f_announce', 'f_sticky', 'm_'), true); @@ -494,12 +490,10 @@ function change_topic_type($action, $topic_ids) if ($global_involved) { - global $template; - $template->assign_vars(array( 'S_FORUM_SELECT' => make_forum_select(request_var('f', $forum_id), false, false, true, true), 'S_CAN_LEAVE_SHADOW' => false, - 'ADDITIONAL_MSG' => (sizeof($topic_ids) == 1) ? $user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENT'] : $user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENTS']) + 'ADDITIONAL_MSG' => (sizeof($topic_ids) == 1) ? phpbb::$user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENT'] : phpbb::$user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENTS']) ); confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields), 'mcp_move.html'); @@ -520,7 +514,7 @@ function change_topic_type($action, $topic_ids) else { meta_refresh(2, $redirect); - trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } } @@ -529,8 +523,6 @@ function change_topic_type($action, $topic_ids) */ function mcp_move_topic($topic_ids) { - global $auth, $user, $db, $template; - // Here we limit the operation to one forum only $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_move'), true); @@ -556,7 +548,7 @@ function mcp_move_topic($topic_ids) if (!sizeof($forum_data)) { - $additional_msg = $user->lang['FORUM_NOT_EXIST']; + $additional_msg = phpbb::$user->lang['FORUM_NOT_EXIST']; } else { @@ -564,21 +556,21 @@ function mcp_move_topic($topic_ids) if ($forum_data['forum_type'] != FORUM_POST) { - $additional_msg = $user->lang['FORUM_NOT_POSTABLE']; + $additional_msg = phpbb::$user->lang['FORUM_NOT_POSTABLE']; } else if (!$auth->acl_get('f_post', $to_forum_id)) { - $additional_msg = $user->lang['USER_CANNOT_POST']; + $additional_msg = phpbb::$user->lang['USER_CANNOT_POST']; } else if ($forum_id == $to_forum_id) { - $additional_msg = $user->lang['CANNOT_MOVE_SAME_FORUM']; + $additional_msg = phpbb::$user->lang['CANNOT_MOVE_SAME_FORUM']; } } } else if (phpbb_request::is_set_post('confirm')) { - $additional_msg = $user->lang['FORUM_NOT_EXIST']; + $additional_msg = phpbb::$user->lang['FORUM_NOT_EXIST']; } if ($to_forum_id && !$additional_msg && confirm_box(true)) @@ -733,10 +725,10 @@ function mcp_move_topic($topic_ids) { meta_refresh(3, $redirect); - $message = $user->lang[$success_msg]; - $message .= '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f=$forum_id") . '">', '</a>'); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid('viewforum', "f=$to_forum_id") . '">', '</a>'); + $message = phpbb::$user->lang[$success_msg]; + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f=$forum_id") . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid('viewforum', "f=$to_forum_id") . '">', '</a>'); trigger_error($message); } @@ -747,8 +739,6 @@ function mcp_move_topic($topic_ids) */ function mcp_delete_topic($topic_ids) { - global $auth, $user, $db; - if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete'))) { return; @@ -802,7 +792,7 @@ function mcp_delete_topic($topic_ids) else { meta_refresh(3, $redirect); - trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_' . $redirect_message], '<a href="' . $redirect . '">', '</a>')); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_' . $redirect_message], '<a href="' . $redirect . '">', '</a>')); } } @@ -811,8 +801,6 @@ function mcp_delete_topic($topic_ids) */ function mcp_delete_post($post_ids) { - global $auth, $user, $db; - if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_delete'))) { return; @@ -877,9 +865,9 @@ function mcp_delete_post($post_ids) $return_link = array(); if ($affected_topics == 1 && !$deleted_topics && $topic_id) { - $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f=$forum_id&t=$topic_id") . '">', '</a>'); + $return_link[] = sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f=$forum_id&t=$topic_id") . '">', '</a>'); } - $return_link[] = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>'); + $return_link[] = sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>'); if (sizeof($post_ids) == 1) { @@ -887,11 +875,11 @@ function mcp_delete_post($post_ids) { // We deleted the only post of a topic, which in turn has // been removed from the database - $success_msg = $user->lang['TOPIC_DELETED_SUCCESS']; + $success_msg = phpbb::$user->lang['TOPIC_DELETED_SUCCESS']; } else { - $success_msg = $user->lang['POST_DELETED_SUCCESS']; + $success_msg = phpbb::$user->lang['POST_DELETED_SUCCESS']; } } else @@ -899,11 +887,11 @@ function mcp_delete_post($post_ids) if ($deleted_topics) { // Some of topics disappeared - $success_msg = $user->lang['POSTS_DELETED_SUCCESS'] . '<br /><br />' . $user->lang['EMPTY_TOPICS_REMOVED_WARNING']; + $success_msg = phpbb::$user->lang['POSTS_DELETED_SUCCESS'] . '<br /><br />' . phpbb::$user->lang['EMPTY_TOPICS_REMOVED_WARNING']; } else { - $success_msg = $user->lang['POSTS_DELETED_SUCCESS']; + $success_msg = phpbb::$user->lang['POSTS_DELETED_SUCCESS']; } } } @@ -922,7 +910,7 @@ function mcp_delete_post($post_ids) else { meta_refresh(3, $redirect); - trigger_error($success_msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . '<br /><br />' . implode('<br /><br />', $return_link)); + trigger_error($success_msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . '<br /><br />' . implode('<br /><br />', $return_link)); } } @@ -931,8 +919,6 @@ function mcp_delete_post($post_ids) */ function mcp_fork_topic($topic_ids) { - global $auth, $user, $db, $template; - if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) { return; @@ -956,11 +942,11 @@ function mcp_fork_topic($topic_ids) if (!sizeof($topic_ids)) { - $additional_msg = $user->lang['NO_TOPIC_SELECTED']; + $additional_msg = phpbb::$user->lang['NO_TOPIC_SELECTED']; } else if (!sizeof($forum_data)) { - $additional_msg = $user->lang['FORUM_NOT_EXIST']; + $additional_msg = phpbb::$user->lang['FORUM_NOT_EXIST']; } else { @@ -968,17 +954,17 @@ function mcp_fork_topic($topic_ids) if ($forum_data['forum_type'] != FORUM_POST) { - $additional_msg = $user->lang['FORUM_NOT_POSTABLE']; + $additional_msg = phpbb::$user->lang['FORUM_NOT_POSTABLE']; } else if (!$auth->acl_get('f_post', $to_forum_id)) { - $additional_msg = $user->lang['USER_CANNOT_POST']; + $additional_msg = phpbb::$user->lang['USER_CANNOT_POST']; } } } else if (phpbb_request::is_set_post('confirm')) { - $additional_msg = $user->lang['FORUM_NOT_EXIST']; + $additional_msg = phpbb::$user->lang['FORUM_NOT_EXIST']; } if (!$additional_msg && confirm_box(true)) @@ -1206,14 +1192,14 @@ function mcp_fork_topic($topic_ids) { $redirect_url = append_sid('viewforum', 'f=' . $forum_id); meta_refresh(3, $redirect_url); - $return_link = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'); + $return_link = sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'); if ($forum_id != $to_forum_id) { - $return_link .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $to_forum_id) . '">', '</a>'); + $return_link .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $to_forum_id) . '">', '</a>'); } - trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_link); } } diff --git a/phpBB/modules/mcp/mcp_notes.php b/phpBB/modules/mcp/mcp_notes.php index dbd61dfb40..02267aa817 100644 --- a/phpBB/modules/mcp/mcp_notes.php +++ b/phpBB/modules/mcp/mcp_notes.php @@ -33,8 +33,6 @@ class mcp_notes function main($id, $mode) { - global $auth, $db, $user, $template; - $action = request_var('action', array('' => '')); if (is_array($action)) @@ -51,14 +49,14 @@ class mcp_notes 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=mcp&field=username&select_single=true'), 'U_POST_ACTION' => append_sid('mcp', 'i=notes&mode=user_notes'), - 'L_TITLE' => $user->lang['MCP_NOTES'], + 'L_TITLE' => phpbb::$user->lang['MCP_NOTES'], )); $this->tpl_name = 'mcp_notes_front'; break; case 'user_notes': - $user->add_lang('acp/common'); + phpbb::$user->add_lang('acp/common'); $this->mcp_notes_user_view($action); $this->tpl_name = 'mcp_notes_user'; @@ -71,8 +69,6 @@ class mcp_notes */ function mcp_notes_user_view($action) { - global $template, $db, $user, $auth; - $user_id = request_var('u', 0); $username = request_var('username', '', true); $start = request_var('start', 0); @@ -147,7 +143,7 @@ class mcp_notes } $redirect = $this->u_action . '&u=' . $user_id; meta_refresh(3, $redirect); - trigger_error($user->lang[$msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + trigger_error(phpbb::$user->lang[$msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } } @@ -159,16 +155,16 @@ class mcp_notes add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $userrow['username']); add_log('user', $user_id, 'LOG_USER_GENERAL', $usernote); - $msg = $user->lang['USER_FEEDBACK_ADDED']; + $msg = phpbb::$user->lang['USER_FEEDBACK_ADDED']; } else { - $msg = $user->lang['FORM_INVALID']; + $msg = phpbb::$user->lang['FORM_INVALID']; } $redirect = $this->u_action; meta_refresh(3, $redirect); - trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + trigger_error($msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } // Generate the appropriate user information for the user we are looking at @@ -180,8 +176,8 @@ class mcp_notes $rank_title = $rank_img = ''; $avatar_img = get_user_avatar($userrow['user_avatar'], $userrow['user_avatar_type'], $userrow['user_avatar_width'], $userrow['user_avatar_height']); - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_IP'], 'd' => $user->lang['SORT_ACTION']); + $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('a' => phpbb::$user->lang['SORT_USERNAME'], 'b' => phpbb::$user->lang['SORT_DATE'], 'c' => phpbb::$user->lang['SORT_IP'], 'd' => phpbb::$user->lang['SORT_ACTION']); $sort_by_sql = array('a' => 'u.username_clean', 'b' => 'l.log_time', 'c' => 'l.log_ip', 'd' => 'l.log_operation'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -203,7 +199,7 @@ class mcp_notes { $template->assign_block_vars('usernotes', array( 'REPORT_BY' => $row['username_full'], - 'REPORT_AT' => $user->format_date($row['time']), + 'REPORT_AT' => phpbb::$user->format_date($row['time']), 'ACTION' => $row['action'], 'IP' => $row['ip'], 'ID' => $row['id']) @@ -218,16 +214,16 @@ class mcp_notes 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'L_TITLE' => $user->lang['MCP_NOTES_USER'], + 'L_TITLE' => phpbb::$user->lang['MCP_NOTES_USER'], '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), + 'TOTAL_REPORTS' => ($log_count == 1) ? phpbb::$user->lang['LIST_REPORT'] : sprintf(phpbb::$user->lang['LIST_REPORTS'], $log_count), 'USERNAME' => $userrow['username'], 'USER_COLOR' => (!empty($userrow['user_colour'])) ? $userrow['user_colour'] : '', 'RANK_TITLE' => $rank_title, - 'JOINED' => $user->format_date($userrow['user_regdate']), + 'JOINED' => phpbb::$user->format_date($userrow['user_regdate']), 'POSTS' => ($userrow['user_posts']) ? $userrow['user_posts'] : 0, 'WARNINGS' => ($userrow['user_warnings']) ? $userrow['user_warnings'] : 0, diff --git a/phpBB/modules/mcp/mcp_post.php b/phpBB/modules/mcp/mcp_post.php index 8d4a4683cc..33a2336662 100644 --- a/phpBB/modules/mcp/mcp_post.php +++ b/phpBB/modules/mcp/mcp_post.php @@ -21,9 +21,7 @@ if (!defined('IN_PHPBB')) */ function mcp_post_details($id, $mode, $action) { - global $template, $db, $user, $auth; - - $user->add_lang('posting'); + phpbb::$user->add_lang('posting'); $post_id = request_var('p', 0); $start = request_var('start', 0); @@ -52,9 +50,9 @@ function mcp_post_details($id, $mode, $action) include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); $template->assign_vars(array( - 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid('mcp', "i=$id&mode=$mode&p=$post_id") . '">', '</a>'), + 'RETURN_POST' => sprintf(phpbb::$user->lang['RETURN_POST'], '<a href="' . append_sid('mcp', "i=$id&mode=$mode&p=$post_id") . '">', '</a>'), 'U_RETURN_POST' => append_sid('mcp', "i=$id&mode=$mode&p=$post_id"), - 'L_RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), + 'L_RETURN_POST' => sprintf(phpbb::$user->lang['RETURN_POST'], '', ''), 'WHOIS' => user_ipwhois($ip), )); } @@ -200,14 +198,14 @@ function mcp_post_details($id, $mode, $action) 'U_VIEW_POST' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), 'U_VIEW_TOPIC' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'), - 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$post_info['forum_id']}&p=$post_id") . "#p$post_id\">", '</a>'), - 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f={$post_info['forum_id']}&start={$start}") . '">', '</a>'), - 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), - 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), - 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), + 'RETURN_TOPIC' => sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$post_info['forum_id']}&p=$post_id") . "#p$post_id\">", '</a>'), + 'RETURN_FORUM' => sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f={$post_info['forum_id']}&start={$start}") . '">', '</a>'), + 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'POST_REPORTED'), + 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), + 'EDIT_IMG' => phpbb::$user->img('icon_post_edit', 'EDIT_POST'), + 'SEARCH_IMG' => phpbb::$user->img('icon_user_search', 'SEARCH'), 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), @@ -216,7 +214,7 @@ function mcp_post_details($id, $mode, $action) 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], - 'POST_DATE' => $user->format_date($post_info['post_time']), + 'POST_DATE' => phpbb::$user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], @@ -238,7 +236,7 @@ function mcp_post_details($id, $mode, $action) { $template->assign_block_vars('usernotes', array( 'REPORT_BY' => $row['username_full'], - 'REPORT_AT' => $user->format_date($row['time']), + 'REPORT_AT' => phpbb::$user->format_date($row['time']), 'ACTION' => $row['action'], 'ID' => $row['id']) ); @@ -263,20 +261,20 @@ function mcp_post_details($id, $mode, $action) do { // If the reason is defined within the language file, we will use the localized version, else just use the database entry... - if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) + if (isset(phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) { - $row['reson_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; - $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; + $row['reson_description'] = phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; + $row['reason_title'] = phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; } $template->assign_block_vars('reports', array( 'REPORT_ID' => $row['report_id'], 'REASON_TITLE' => $row['reason_title'], 'REASON_DESC' => $row['reason_description'], - 'REPORTER' => ($row['user_id'] != ANONYMOUS) ? $row['username'] : $user->lang['GUEST'], + 'REPORTER' => ($row['user_id'] != ANONYMOUS) ? $row['username'] : phpbb::$user->lang['GUEST'], 'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? append_sid('memberlist', 'mode=viewprofile&u=' . $row['user_id']) : '', 'USER_NOTIFY' => ($row['user_notify']) ? true : false, - 'REPORT_TIME' => $user->format_date($row['report_time']), + 'REPORT_TIME' => phpbb::$user->format_date($row['report_time']), 'REPORT_TEXT' => bbcode_nl2br(trim($row['report_text'])), )); } @@ -333,9 +331,9 @@ function mcp_post_details($id, $mode, $action) foreach ($users_ary as $user_id => $user_row) { $template->assign_block_vars('userrow', array( - 'USERNAME' => ($user_id == ANONYMOUS) ? $user->lang['GUEST'] : $user_row['username'], + 'USERNAME' => ($user_id == ANONYMOUS) ? phpbb::$user->lang['GUEST'] : $user_row['username'], 'NUM_POSTS' => $user_row['postings'], - 'L_POST_S' => ($user_row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], + 'L_POST_S' => ($user_row['postings'] == 1) ? phpbb::$user->lang['POST'] : phpbb::$user->lang['POSTS'], 'U_PROFILE' => ($user_id == ANONYMOUS) ? '' : append_sid('memberlist', 'mode=viewprofile&u=' . $user_id), 'U_SEARCHPOSTS' => append_sid('search', 'author_id=' . $user_id . '&sr=topics')) @@ -364,7 +362,7 @@ function mcp_post_details($id, $mode, $action) 'IP' => $row['poster_ip'], 'HOSTNAME' => $hostname, 'NUM_POSTS' => $row['postings'], - 'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], + 'L_POST_S' => ($row['postings'] == 1) ? phpbb::$user->lang['POST'] : phpbb::$user->lang['POSTS'], 'U_LOOKUP_IP' => ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? '' : "$url&i=$id&mode=post_details&rdns={$row['poster_ip']}#ip", 'U_WHOIS' => append_sid('mcp', "i=$id&mode=$mode&action=whois&p=$post_id&ip={$row['poster_ip']}")) @@ -394,8 +392,6 @@ function mcp_post_details($id, $mode, $action) */ function change_poster(&$post_info, $userdata) { - global $auth, $db; - if (empty($userdata) || $userdata['user_id'] == $post_info['user_id']) { return; diff --git a/phpBB/modules/mcp/mcp_queue.php b/phpBB/modules/mcp/mcp_queue.php index 1d122b8581..6e4e0144d0 100644 --- a/phpBB/modules/mcp/mcp_queue.php +++ b/phpBB/modules/mcp/mcp_queue.php @@ -33,7 +33,6 @@ class mcp_queue function main($id, $mode) { - global $auth, $db, $user, $template; global $action; include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); @@ -74,7 +73,7 @@ class mcp_queue $this->tpl_name = 'mcp_post'; - $user->add_lang(array('posting', 'viewtopic')); + phpbb::$user->add_lang(array('posting', 'viewtopic')); $post_id = request_var('p', 0); $topic_id = request_var('t', 0); @@ -195,14 +194,14 @@ class mcp_queue 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'), - 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid('mcp', 'i=queue' . (($topic_id) ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . "&start=$start\">", '</a>'), - 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'), - 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), - 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), - 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), + 'RETURN_QUEUE' => sprintf(phpbb::$user->lang['RETURN_QUEUE'], '<a href="' . append_sid('mcp', 'i=queue' . (($topic_id) ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . "&start=$start\">", '</a>'), + 'RETURN_POST' => sprintf(phpbb::$user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'), + 'RETURN_TOPIC_SIMPLE' => sprintf(phpbb::$user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), + 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'POST_REPORTED'), + 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), + 'EDIT_IMG' => phpbb::$user->img('icon_post_edit', 'EDIT_POST'), 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), @@ -211,7 +210,7 @@ class mcp_queue 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], - 'POST_DATE' => $user->format_date($post_info['post_time']), + 'POST_DATE' => phpbb::$user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], @@ -223,7 +222,7 @@ class mcp_queue case 'unapproved_topics': case 'unapproved_posts': - $user->add_lang(array('viewtopic', 'viewforum')); + phpbb::$user->add_lang(array('viewtopic', 'viewforum')); $topic_id = request_var('t', 0); $forum_info = array(); @@ -292,7 +291,7 @@ class mcp_queue $global_id = $forum_id; } - $forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>'; + $forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['ALL_FORUMS'] . '</option>'; foreach ($forum_list_approve as $row) { $forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat(' ', $row['padding']) . $row['forum_name'] . '</option>'; @@ -411,7 +410,7 @@ class mcp_queue if (empty($row['post_username'])) { - $row['post_username'] = $user->lang['GUEST']; + $row['post_username'] = phpbb::$user->lang['GUEST']; } $template->assign_block_vars('postrow', array( @@ -426,20 +425,20 @@ class mcp_queue 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_ID' => $row['post_id'], - 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], + 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : phpbb::$user->lang['GLOBAL_ANNOUNCEMENT'], 'POST_SUBJECT' => $row['post_subject'], 'TOPIC_TITLE' => $row['topic_title'], - 'POST_TIME' => $user->format_date($row['post_time'])) + 'POST_TIME' => phpbb::$user->format_date($row['post_time'])) ); } unset($rowset, $forum_names); // Now display the page $template->assign_vars(array( - 'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'], - 'L_EXPLAIN' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'], - 'L_TITLE' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'], - 'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', + 'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? phpbb::$user->lang['DISPLAY_POSTS'] : phpbb::$user->lang['DISPLAY_TOPICS'], + 'L_EXPLAIN' => ($mode == 'unapproved_posts') ? phpbb::$user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : phpbb::$user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'], + 'L_TITLE' => ($mode == 'unapproved_posts') ? phpbb::$user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : phpbb::$user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'], + 'L_ONLY_TOPIC' => ($topic_id) ? sprintf(phpbb::$user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', 'S_FORUM_OPTIONS' => $forum_options, 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')), @@ -448,7 +447,7 @@ class mcp_queue '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), + 'TOTAL' => ($total == 1) ? (($mode == 'unapproved_posts') ? phpbb::$user->lang['VIEW_TOPIC_POST'] : phpbb::$user->lang['VIEW_FORUM_TOPIC']) : sprintf((($mode == 'unapproved_posts') ? phpbb::$user->lang['VIEW_TOPIC_POSTS'] : phpbb::$user->lang['VIEW_FORUM_TOPICS']), $total), )); $this->tpl_name = 'mcp_queue'; @@ -462,8 +461,6 @@ class mcp_queue */ function approve_post($post_id_list, $id, $mode) { - global $db, $template, $user; - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { trigger_error('NOT_AUTHORISED'); @@ -775,10 +772,10 @@ function approve_post($post_id_list, $id, $mode) $add_message = ''; if (sizeof($post_id_list) == 1 && !empty($post_url)) { - $add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'); + $add_message = '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'); } - trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message); } } @@ -787,8 +784,6 @@ function approve_post($post_id_list, $id, $mode) */ function disapprove_post($post_id_list, $id, $mode) { - global $db, $template, $user; - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { trigger_error('NOT_AUTHORISED'); @@ -821,15 +816,15 @@ function disapprove_post($post_id_list, $id, $mode) if (!$row || (!$reason && strtolower($row['reason_title']) == 'other')) { - $additional_msg = $user->lang['NO_REASON_DISAPPROVAL']; + $additional_msg = phpbb::$user->lang['NO_REASON_DISAPPROVAL']; } else { // If the reason is defined within the language file, we will use the localized version, else just use the database entry... - $disapprove_reason = (strtolower($row['reason_title']) != 'other') ? ((isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description']) : ''; + $disapprove_reason = (strtolower($row['reason_title']) != 'other') ? ((isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) ? phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description']) : ''; $disapprove_reason .= ($reason) ? "\n\n" . $reason : ''; - if (isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) + if (isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) { $disapprove_reason_lang = strtoupper($row['reason_title']); } @@ -969,10 +964,10 @@ function disapprove_post($post_id_list, $id, $mode) if (!isset($lang_reasons[$post_data['user_lang']])) { // Assign the current users translation as the default, this is not ideal but getting the board default adds another layer of complexity. - $lang_reasons[$post_data['user_lang']] = $user->lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang]; + $lang_reasons[$post_data['user_lang']] = phpbb::$user->lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang]; // Only load up the language pack if the language is different to the current one - if ($post_data['user_lang'] != $user->lang_name && file_exists(PHPBB_ROOT_PATH . '/language/' . $post_data['user_lang'] . '/mcp.' . PHP_EXT)) + if ($post_data['user_lang'] != phpbb::$user->lang_name && file_exists(PHPBB_ROOT_PATH . '/language/' . $post_data['user_lang'] . '/mcp.' . PHP_EXT)) { // Load up the language pack $lang = array(); @@ -1065,7 +1060,7 @@ function disapprove_post($post_id_list, $id, $mode) else { meta_refresh(3, $redirect); - trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>')); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>')); } } diff --git a/phpBB/modules/mcp/mcp_reports.php b/phpBB/modules/mcp/mcp_reports.php index fc48a24482..f1aba235eb 100644 --- a/phpBB/modules/mcp/mcp_reports.php +++ b/phpBB/modules/mcp/mcp_reports.php @@ -33,7 +33,6 @@ class mcp_reports function main($id, $mode) { - global $auth, $db, $user, $template; global $action; include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); @@ -65,7 +64,7 @@ class mcp_reports { case 'report_details': - $user->add_lang(array('posting', 'viewforum', 'viewtopic')); + phpbb::$user->add_lang(array('posting', 'viewforum', 'viewtopic')); $post_id = request_var('p', 0); @@ -105,10 +104,10 @@ class mcp_reports $post_info = $post_info[$post_id]; $reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']); - if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])])) + if (isset(phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])])) { - $reason['description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])]; - $reason['title'] = $user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]; + $reason['description'] = phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])]; + $reason['title'] = phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]; } if (topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) @@ -204,13 +203,13 @@ class mcp_reports 'U_VIEW_POST' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), 'U_VIEW_TOPIC' => append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), - 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), + 'EDIT_IMG' => phpbb::$user->img('icon_post_edit', 'EDIT_POST'), + 'MINI_POST_IMG' => ($post_unread) ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'), + 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), - 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid('mcp', 'i=reports' . (($post_info['post_reported']) ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start . '&f=' . $post_info['forum_id']) . '">', '</a>'), - 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), - 'REPORT_DATE' => $user->format_date($report['report_time']), + 'RETURN_REPORTS' => sprintf(phpbb::$user->lang['RETURN_REPORTS'], '<a href="' . append_sid('mcp', 'i=reports' . (($post_info['post_reported']) ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start . '&f=' . $post_info['forum_id']) . '">', '</a>'), + 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'POST_REPORTED'), + 'REPORT_DATE' => phpbb::$user->format_date($report['report_time']), 'REPORT_ID' => $report_id, 'REPORT_REASON_TITLE' => $reason['title'], 'REPORT_REASON_DESCRIPTION' => $reason['description'], @@ -227,8 +226,8 @@ class mcp_reports 'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']), 'POST_PREVIEW' => $message, - 'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'], - 'POST_DATE' => $user->format_date($post_info['post_time']), + 'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : phpbb::$user->lang['NO_SUBJECT'], + 'POST_DATE' => phpbb::$user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], @@ -315,7 +314,7 @@ class mcp_reports $forum_list[] = 0; $forum_data = array(); - $forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>'; + $forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['ALL_FORUMS'] . '</option>'; foreach ($forum_list_reports as $row) { $forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat(' ', $row['padding']) . $row['forum_name'] . '</option>'; @@ -398,12 +397,12 @@ class mcp_reports 'REPORTER' => get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), 'U_REPORTER' => get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']), - 'FORUM_NAME' => (!$global_topic) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'], + 'FORUM_NAME' => (!$global_topic) ? $forum_data[$row['forum_id']]['forum_name'] : phpbb::$user->lang['GLOBAL_ANNOUNCEMENT'], 'POST_ID' => $row['post_id'], - 'POST_SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'], - 'POST_TIME' => $user->format_date($row['post_time']), + 'POST_SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : phpbb::$user->lang['NO_SUBJECT'], + 'POST_TIME' => phpbb::$user->format_date($row['post_time']), 'REPORT_ID' => $row['report_id'], - 'REPORT_TIME' => $user->format_date($row['report_time']), + 'REPORT_TIME' => phpbb::$user->format_date($row['report_time']), 'TOPIC_TITLE' => $row['topic_title']) ); } @@ -413,9 +412,9 @@ class mcp_reports // Now display the page $template->assign_vars(array( - 'L_EXPLAIN' => ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN_EXPLAIN'] : $user->lang['MCP_REPORTS_CLOSED_EXPLAIN'], - 'L_TITLE' => ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN'] : $user->lang['MCP_REPORTS_CLOSED'], - 'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', + 'L_EXPLAIN' => ($mode == 'reports') ? phpbb::$user->lang['MCP_REPORTS_OPEN_EXPLAIN'] : phpbb::$user->lang['MCP_REPORTS_CLOSED_EXPLAIN'], + 'L_TITLE' => ($mode == 'reports') ? phpbb::$user->lang['MCP_REPORTS_OPEN'] : phpbb::$user->lang['MCP_REPORTS_CLOSED'], + 'L_ONLY_TOPIC' => ($topic_id) ? sprintf(phpbb::$user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '', 'S_MCP_ACTION' => $this->u_action, 'S_FORUM_OPTIONS' => $forum_options, @@ -425,7 +424,7 @@ class mcp_reports '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), + 'TOTAL_REPORTS' => ($total == 1) ? phpbb::$user->lang['LIST_REPORT'] : sprintf(phpbb::$user->lang['LIST_REPORTS'], $total), ) ); @@ -440,8 +439,6 @@ class mcp_reports */ function close_report($report_id_list, $mode, $action) { - global $db, $template, $user; - $sql = 'SELECT r.post_id FROM ' . REPORTS_TABLE . ' r WHERE ' . $db->sql_in_set('r.report_id', $report_id_list); @@ -459,7 +456,7 @@ function close_report($report_id_list, $mode, $action) trigger_error('NOT_AUTHORISED'); } - if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false) + if ($action == 'delete' && strpos(phpbb::$user->data['session_page'], 'mode=report_details') !== false) { $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=reports'); } @@ -602,7 +599,7 @@ function close_report($report_id_list, $mode, $action) $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($reporter['username']), - 'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']), + 'CLOSER_NAME' => htmlspecialchars_decode(phpbb::$user->data['username']), 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])), 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title']))) ); @@ -625,7 +622,7 @@ function close_report($report_id_list, $mode, $action) } else { - confirm_box(false, $user->lang[strtoupper($action) . '_REPORT' . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); + confirm_box(false, phpbb::$user->lang[strtoupper($action) . '_REPORT' . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); } $redirect = request_var('redirect', 'index.' . PHP_EXT); @@ -641,15 +638,15 @@ function close_report($report_id_list, $mode, $action) $return_forum = ''; if (sizeof($forum_ids == 1)) { - $return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />'; + $return_forum = sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />'; } $return_topic = ''; if (sizeof($topic_ids == 1)) { - $return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . current($topic_ids) . '&f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />'; + $return_topic = sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . current($topic_ids) . '&f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />'; } - trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>')); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf(phpbb::$user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>')); } } diff --git a/phpBB/modules/mcp/mcp_topic.php b/phpBB/modules/mcp/mcp_topic.php index 9da64df6f9..32d5f5f8e6 100644 --- a/phpBB/modules/mcp/mcp_topic.php +++ b/phpBB/modules/mcp/mcp_topic.php @@ -21,11 +21,9 @@ if (!defined('IN_PHPBB')) */ function mcp_topic_view($id, $mode, $action) { - global $template, $db, $user, $auth; - $url = append_sid(PHPBB_ROOT_PATH. 'mcp.' . PHP_EXT . '?' . extra_url()); - $user->add_lang('viewtopic'); + phpbb::$user->add_lang('viewtopic'); $topic_id = request_var('t', 0); $topic_info = get_topic_data(array($topic_id), false, true); @@ -223,13 +221,13 @@ function mcp_topic_view($id, $mode, $action) 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), - 'POST_DATE' => $user->format_date($row['post_time']), + 'POST_DATE' => phpbb::$user->format_date($row['post_time']), 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, 'POST_ID' => $row['post_id'], - 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . $topic_id) . '">', '</a>'), + 'RETURN_TOPIC' => sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . $topic_id) . '">', '</a>'), - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'), 'S_POST_REPORTED' => ($row['post_reported']) ? true : false, 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, @@ -294,14 +292,14 @@ function mcp_topic_view($id, $mode, $action) 'U_VIEW_TOPIC' => append_sid('viewtopic', 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']), 'TO_TOPIC_ID' => $to_topic_id, - 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . append_sid('viewtopic', 'f=' . $to_topic_info['forum_id'] . '&t=' . $to_topic_id) . '">' . $to_topic_info['topic_title'] . '</a>') : '', + 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf(phpbb::$user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . append_sid('viewtopic', 'f=' . $to_topic_info['forum_id'] . '&t=' . $to_topic_id) . '">' . $to_topic_info['topic_title'] . '</a>') : '', 'SPLIT_SUBJECT' => $subject, 'POSTS_PER_PAGE' => $posts_per_page, 'ACTION' => $action, - 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), + 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'POST_REPORTED'), + 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), 'S_MCP_ACTION' => "$url&i=$id&mode=$mode&action=$action&start=$start", 'S_FORUM_SELECT' => ($to_forum_id) ? make_forum_select($to_forum_id, false, false, true, true, true) : make_forum_select($topic_info['forum_id'], false, false, true, true, true), @@ -322,12 +320,12 @@ function mcp_topic_view($id, $mode, $action) 'U_SELECT_TOPIC' => "$url&i=$id&mode=forum_view&action=merge_select" . (($forum_id) ? "&f=$forum_id" : ''), - 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start") . '">', '</a>'), - 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f={$topic_info['forum_id']}&start=$start") . '">', '</a>'), + 'RETURN_TOPIC' => sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', "f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start") . '">', '</a>'), + 'RETURN_FORUM' => sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', "f={$topic_info['forum_id']}&start=$start") . '">', '</a>'), 'PAGE_NUMBER' => on_page($total, $posts_per_page, $start), 'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination(append_sid('mcp', "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir"), $total, $posts_per_page, $start), - 'TOTAL_POSTS' => ($total == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total), + 'TOTAL_POSTS' => ($total == 1) ? phpbb::$user->lang['VIEW_TOPIC_POST'] : sprintf(phpbb::$user->lang['VIEW_TOPIC_POSTS'], $total), )); } @@ -336,15 +334,13 @@ function mcp_topic_view($id, $mode, $action) */ function split_topic($action, $topic_id, $to_forum_id, $subject) { - global $db, $template, $user, $auth; - $post_id_list = request_var('post_id_list', array(0)); $forum_id = request_var('forum_id', 0); $start = request_var('start', 0); if (!sizeof($post_id_list)) { - $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_POST_SELECTED']); return; } @@ -358,7 +354,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) if (!sizeof($post_info)) { - $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_POST_SELECTED']); return; } @@ -368,13 +364,13 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) // Make some tests if (!$subject) { - $template->assign_var('MESSAGE', $user->lang['EMPTY_SUBJECT']); + $template->assign_var('MESSAGE', phpbb::$user->lang['EMPTY_SUBJECT']); return; } if ($to_forum_id <= 0) { - $template->assign_var('MESSAGE', $user->lang['NO_DESTINATION_FORUM']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_DESTINATION_FORUM']); return; } @@ -382,7 +378,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) if (!sizeof($forum_info)) { - $template->assign_var('MESSAGE', $user->lang['USER_CANNOT_POST']); + $template->assign_var('MESSAGE', phpbb::$user->lang['USER_CANNOT_POST']); return; } @@ -390,7 +386,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) if ($forum_info['forum_type'] != FORUM_POST) { - $template->assign_var('MESSAGE', $user->lang['FORUM_NOT_POSTABLE']); + $template->assign_var('MESSAGE', phpbb::$user->lang['FORUM_NOT_POSTABLE']); return; } @@ -503,7 +499,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) 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>'); + $return_link = sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); } else { @@ -520,7 +516,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) else { meta_refresh(3, append_sid('viewtopic', "f=$to_forum_id&t=$to_topic_id")); - trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_link); } } @@ -529,11 +525,9 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) */ function merge_posts($topic_id, $to_topic_id) { - global $db, $template, $user, $auth; - if (!$to_topic_id) { - $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_FINAL_TOPIC_SELECTED']); return; } @@ -541,7 +535,7 @@ function merge_posts($topic_id, $to_topic_id) if (!sizeof($topic_data)) { - $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_FINAL_TOPIC_SELECTED']); return; } @@ -552,7 +546,7 @@ function merge_posts($topic_id, $to_topic_id) if (!sizeof($post_id_list)) { - $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + $template->assign_var('MESSAGE', phpbb::$user->lang['NO_POST_SELECTED']); return; } @@ -595,7 +589,7 @@ function merge_posts($topic_id, $to_topic_id) if ($row) { - $return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $row['forum_id'] . '&t=' . $topic_id) . '">', '</a>'); + $return_link .= sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $row['forum_id'] . '&t=' . $topic_id) . '">', '</a>'); } else { @@ -609,7 +603,7 @@ function merge_posts($topic_id, $to_topic_id) } // Link to the new topic - $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); + $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf(phpbb::$user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); } else { @@ -626,7 +620,7 @@ function merge_posts($topic_id, $to_topic_id) else { meta_refresh(3, append_sid('viewtopic', "f=$to_forum_id&t=$to_topic_id")); - trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); + trigger_error(phpbb::$user->lang[$success_msg] . '<br /><br />' . $return_link); } } diff --git a/phpBB/modules/mcp/mcp_warn.php b/phpBB/modules/mcp/mcp_warn.php index 48515a6c64..70862393df 100644 --- a/phpBB/modules/mcp/mcp_warn.php +++ b/phpBB/modules/mcp/mcp_warn.php @@ -33,8 +33,6 @@ class mcp_warn function main($id, $mode) { - global $auth, $db, $user, $template; - $action = request_var('action', array('' => '')); if (is_array($action)) @@ -75,8 +73,6 @@ class mcp_warn */ function mcp_warn_front_view() { - global $template, $db, $user, $auth; - $template->assign_vars(array( 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=mcp&field=username&select_single=true'), 'U_POST_ACTION' => append_sid('mcp', 'i=warn&mode=warn_user'), @@ -99,7 +95,7 @@ class mcp_warn 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', 'U_USER' => append_sid('memberlist', 'mode=viewprofile&u=' . $row['user_id']), - 'WARNING_TIME' => $user->format_date($row['user_last_warning']), + 'WARNING_TIME' => phpbb::$user->format_date($row['user_last_warning']), 'WARNINGS' => $row['user_warnings'], )); } @@ -121,7 +117,7 @@ class mcp_warn 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', 'U_USER' => append_sid('memberlist', 'mode=viewprofile&u=' . $row['user_id']), - 'WARNING_TIME' => $user->format_date($row['warning_time']), + 'WARNING_TIME' => phpbb::$user->format_date($row['warning_time']), 'WARNINGS' => $row['user_warnings'], )); } @@ -133,17 +129,15 @@ class mcp_warn */ function mcp_warn_list_view($action) { - global $template, $db, $user, $auth; - - $user->add_lang('memberlist'); + phpbb::$user->add_lang('memberlist'); $start = request_var('start', 0); $st = request_var('st', 0); $sk = request_var('sk', 'b'); $sd = request_var('sd', 'd'); - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']); + $limit_days = array(0 => phpbb::$user->lang['ALL_ENTRIES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); + $sort_by_text = array('a' => phpbb::$user->lang['SORT_USERNAME'], 'b' => phpbb::$user->lang['SORT_DATE'], 'c' => phpbb::$user->lang['SORT_WARNINGS']); $sort_by_sql = array('a' => 'username_clean', 'b' => 'user_last_warning', 'c' => 'user_warnings'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -168,7 +162,7 @@ class mcp_warn 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', 'U_USER' => append_sid('memberlist', 'mode=viewprofile&u=' . $row['user_id']), - 'WARNING_TIME' => $user->format_date($row['user_last_warning']), + 'WARNING_TIME' => phpbb::$user->format_date($row['user_last_warning']), 'WARNINGS' => $row['user_warnings'], )); } @@ -182,7 +176,7 @@ class mcp_warn '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), + 'TOTAL_USERS' => ($user_count == 1) ? phpbb::$user->lang['LIST_USER'] : sprintf(phpbb::$user->lang['LIST_USERS'], $user_count), )); } @@ -191,8 +185,6 @@ class mcp_warn */ function mcp_warn_post_view($action) { - global $template, $db, $user, $auth; - $post_id = request_var('p', 0); $forum_id = request_var('f', 0); $notify = phpbb_request::is_set('notify_user'); @@ -218,7 +210,7 @@ class mcp_warn } // Prevent someone from warning themselves - if ($user_row['user_id'] == $user->data['user_id']) + if ($user_row['user_id'] == phpbb::$user->data['user_id']) { trigger_error('CANNOT_WARN_SELF'); } @@ -269,15 +261,15 @@ class mcp_warn if (check_form_key('mcp_warn')) { add_warning($user_row, $warning, $notify, $post_id); - $msg = $user->lang['USER_WARNING_ADDED']; + $msg = phpbb::$user->lang['USER_WARNING_ADDED']; } else { - $msg = $user->lang['FORM_INVALID']; + $msg = phpbb::$user->lang['FORM_INVALID']; } $redirect = append_sid('mcp', "i=notes&mode=user_notes&u=$user_id"); meta_refresh(2, $redirect); - trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + trigger_error($msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } // OK, they didn't submit a warning so lets build the page for them to do so @@ -314,14 +306,14 @@ class mcp_warn 'USERNAME' => $user_row['username'], 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', 'RANK_TITLE' => $rank_title, - 'JOINED' => $user->format_date($user_row['user_regdate']), + 'JOINED' => phpbb::$user->format_date($user_row['user_regdate']), 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $rank_img, - 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . '/viewtopic.' . PHP_EXT . "?f=$forum_id&p=$post_id#p$post_id"), + 'L_WARNING_POST_DEFAULT' => sprintf(phpbb::$user->lang['WARNING_POST_DEFAULT'], generate_board_url() . '/viewtopic.' . PHP_EXT . "?f=$forum_id&p=$post_id#p$post_id"), 'S_CAN_NOTIFY' => $s_can_notify, )); @@ -333,7 +325,6 @@ class mcp_warn function mcp_warn_user_view($action) { global $module; - global $template, $db, $user, $auth; $user_id = request_var('u', 0); $username = request_var('username', '', true); @@ -355,7 +346,7 @@ class mcp_warn } // Prevent someone from warning themselves - if ($user_row['user_id'] == $user->data['user_id']) + if ($user_row['user_id'] == phpbb::$user->data['user_id']) { trigger_error('CANNOT_WARN_SELF'); } @@ -392,15 +383,15 @@ class mcp_warn if (check_form_key('mcp_warn')) { add_warning($user_row, $warning, $notify); - $msg = $user->lang['USER_WARNING_ADDED']; + $msg = phpbb::$user->lang['USER_WARNING_ADDED']; } else { - $msg = $user->lang['FORM_INVALID']; + $msg = phpbb::$user->lang['FORM_INVALID']; } $redirect = append_sid('mcp', "i=notes&mode=user_notes&u=$user_id"); meta_refresh(2, $redirect); - trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + trigger_error($msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } // Generate the appropriate user information for the user we are looking at @@ -419,7 +410,7 @@ class mcp_warn 'USERNAME' => $user_row['username'], 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', 'RANK_TITLE' => $rank_title, - 'JOINED' => $user->format_date($user_row['user_regdate']), + 'JOINED' => phpbb::$user->format_date($user_row['user_regdate']), 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, @@ -438,8 +429,6 @@ class mcp_warn */ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) { - global $template, $db, $user, $auth; - if ($send_pm) { include_once(PHPBB_ROOT_PATH . 'includes/functions_privmsgs.' . PHP_EXT); @@ -454,9 +443,9 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) $message_parser->parse(true, true, true, false, false, true, true); $pm_data = array( - 'from_user_id' => $user->data['user_id'], - 'from_user_ip' => $user->ip, - 'from_username' => $user->data['username'], + 'from_user_id' => phpbb::$user->data['user_id'], + 'from_user_ip' => phpbb::$user->ip, + 'from_username' => phpbb::$user->data['username'], 'enable_sig' => false, 'enable_bbcode' => true, 'enable_smilies' => true, diff --git a/phpBB/modules/ucp/ucp_activate.php b/phpBB/modules/ucp/ucp_activate.php index 7fd265ecf4..967deb6740 100644 --- a/phpBB/modules/ucp/ucp_activate.php +++ b/phpBB/modules/ucp/ucp_activate.php @@ -27,8 +27,6 @@ class ucp_activate function main($id, $mode) { - global $db, $user, $auth, $template; - $user_id = request_var('u', 0); $key = request_var('k', ''); @@ -96,9 +94,9 @@ class ucp_activate $messenger->to($user_row['user_email'], $user_row['username']); $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->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username'])) @@ -121,7 +119,7 @@ class ucp_activate } meta_refresh(3, append_sid('index')); - trigger_error($user->lang[$message]); + trigger_error(phpbb::$user->lang[$message]); } } diff --git a/phpBB/modules/ucp/ucp_attachments.php b/phpBB/modules/ucp/ucp_attachments.php index 0ccc6afba8..97d0e630f9 100644 --- a/phpBB/modules/ucp/ucp_attachments.php +++ b/phpBB/modules/ucp/ucp_attachments.php @@ -27,8 +27,6 @@ class ucp_attachments function main($id, $mode) { - global $template, $user, $db; - $start = request_var('start', 0); $sort_key = request_var('sk', 'a'); $sort_dir = request_var('sd', 'a'); @@ -42,7 +40,7 @@ class ucp_attachments // Validate $delete_ids... $sql = 'SELECT attach_id FROM ' . ATTACHMENTS_TABLE . ' - WHERE poster_id = ' . $user->data['user_id'] . ' + WHERE poster_id = ' . phpbb::$user->data['user_id'] . ' AND is_orphan = 0 AND ' . $db->sql_in_set('attach_id', $delete_ids); $result = $db->sql_query($sql); @@ -76,7 +74,7 @@ class ucp_attachments delete_attachments('attach', $delete_ids); meta_refresh(3, $this->u_action); - $message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = ((sizeof($delete_ids) == 1) ? phpbb::$user->lang['ATTACHMENT_DELETED'] : phpbb::$user->lang['ATTACHMENTS_DELETED']) . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } else @@ -86,10 +84,10 @@ class ucp_attachments } // Select box eventually - $sort_key_text = array('a' => $user->lang['SORT_FILENAME'], 'b' => $user->lang['SORT_COMMENT'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']); + $sort_key_text = array('a' => phpbb::$user->lang['SORT_FILENAME'], 'b' => phpbb::$user->lang['SORT_COMMENT'], 'c' => phpbb::$user->lang['SORT_EXTENSION'], 'd' => phpbb::$user->lang['SORT_SIZE'], 'e' => phpbb::$user->lang['SORT_DOWNLOADS'], 'f' => phpbb::$user->lang['SORT_POST_TIME'], 'g' => phpbb::$user->lang['SORT_TOPIC_TITLE']); $sort_key_sql = array('a' => 'a.real_filename', 'b' => 'a.attach_comment', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title'); - $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + $sort_dir_text = array('a' => phpbb::$user->lang['ASCENDING'], 'd' => phpbb::$user->lang['DESCENDING']); $s_sort_key = ''; foreach ($sort_key_text as $key => $value) @@ -114,7 +112,7 @@ class ucp_attachments $sql = 'SELECT COUNT(attach_id) as num_attachments FROM ' . ATTACHMENTS_TABLE . ' - WHERE poster_id = ' . $user->data['user_id'] . ' + WHERE poster_id = ' . phpbb::$user->data['user_id'] . ' AND is_orphan = 0'; $result = $db->sql_query($sql); $num_attachments = $db->sql_fetchfield('num_attachments'); @@ -124,7 +122,7 @@ class ucp_attachments FROM ' . ATTACHMENTS_TABLE . ' a LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id AND a.in_message = 0) LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id AND a.in_message = 1) - WHERE a.poster_id = ' . $user->data['user_id'] . " + WHERE a.poster_id = ' . phpbb::$user->data['user_id'] . " AND a.is_orphan = 0 ORDER BY $order_by"; $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); @@ -152,7 +150,7 @@ class ucp_attachments 'EXTENSION' => $row['extension'], 'SIZE' => get_formatted_filesize($row['filesize']), 'DOWNLOAD_COUNT' => $row['download_count'], - 'POST_TIME' => $user->format_date($row['filetime']), + 'POST_TIME' => phpbb::$user->format_date($row['filetime']), 'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'], 'ATTACH_ID' => $row['attach_id'], @@ -176,7 +174,7 @@ class ucp_attachments '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'], + 'L_TITLE' => phpbb::$user->lang['UCP_ATTACHMENTS'], 'U_SORT_FILENAME' => $this->u_action . "&sk=a&sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), 'U_SORT_FILE_COMMENT' => $this->u_action . "&sk=b&sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'), diff --git a/phpBB/modules/ucp/ucp_confirm.php b/phpBB/modules/ucp/ucp_confirm.php index d8e4a06b60..321d07ad14 100644 --- a/phpBB/modules/ucp/ucp_confirm.php +++ b/phpBB/modules/ucp/ucp_confirm.php @@ -35,7 +35,6 @@ class ucp_confirm function main($id, $mode) { - global $db, $user; include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT); $captcha = phpbb_captcha_factory::get_instance(phpbb::$config['captcha_plugin']); $captcha->init(request_var('type', 0)); diff --git a/phpBB/modules/ucp/ucp_groups.php b/phpBB/modules/ucp/ucp_groups.php index c605fe00c1..3935ac86c2 100644 --- a/phpBB/modules/ucp/ucp_groups.php +++ b/phpBB/modules/ucp/ucp_groups.php @@ -26,11 +26,9 @@ class ucp_groups function main($id, $mode) { - global $db, $user, $auth, $template; + phpbb::$user->add_lang('groups'); - $user->add_lang('groups'); - - $return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>'); + $return_page = '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>'); $mark_ary = request_var('mark', array(0)); $submit = phpbb_request::variable('submit', false, false, phpbb_request::POST); @@ -54,14 +52,14 @@ class ucp_groups } $sql = 'SELECT group_id, group_name, group_type - FROM ' . GROUPS_TABLE . " - WHERE group_id IN ($group_id, {$user->data['group_id']})"; + FROM ' . GROUPS_TABLE . ' + WHERE group_id IN (' . $group_id . ', ' . phpbb::$user->data['group_id'] . ')'; $result = $db->sql_query($sql); $group_row = array(); while ($row = $db->sql_fetchrow($result)) { - $row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']; $group_row[$row['group_id']] = $row; } $db->sql_freeresult($result); @@ -75,30 +73,30 @@ class ucp_groups { case 'change_default': // User already having this group set as default? - if ($group_id == $user->data['group_id']) + if ($group_id == phpbb::$user->data['group_id']) { - trigger_error($user->lang['ALREADY_DEFAULT_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['ALREADY_DEFAULT_GROUP'] . $return_page); } if (!$auth->acl_get('u_chggrp')) { - trigger_error($user->lang['NOT_AUTHORISED'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_AUTHORISED'] . $return_page); } // User needs to be member of the group in order to make it default - if (!group_memberships($group_id, $user->data['user_id'], true)) + if (!group_memberships($group_id, phpbb::$user->data['user_id'], true)) { - trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } if (confirm_box(true)) { - group_user_attributes('default', $group_id, $user->data['user_id']); + group_user_attributes('default', $group_id, phpbb::$user->data['user_id']); - add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_CHANGE', sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name'])); + add_log('user', phpbb::$user->data['user_id'], 'LOG_USER_GROUP_CHANGE', sprintf(phpbb::$user->lang['USER_GROUP_CHANGE'], $group_row[phpbb::$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name'])); meta_refresh(3, $this->u_action); - trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['CHANGED_DEFAULT_GROUP'] . $return_page); } else { @@ -107,7 +105,7 @@ class ucp_groups 'change_default'=> true ); - confirm_box(false, sprintf($user->lang['GROUP_CHANGE_DEFAULT'], $group_row[$group_id]['group_name']), build_hidden_fields($s_hidden_fields)); + confirm_box(false, sprintf(phpbb::$user->lang['GROUP_CHANGE_DEFAULT'], $group_row[$group_id]['group_name']), build_hidden_fields($s_hidden_fields)); } break; @@ -115,14 +113,14 @@ class ucp_groups case 'resign': // User tries to resign from default group but is not allowed to change it? - if ($group_id == $user->data['group_id'] && !$auth->acl_get('u_chggrp')) + if ($group_id == phpbb::$user->data['group_id'] && !$auth->acl_get('u_chggrp')) { - trigger_error($user->lang['NOT_RESIGN_FROM_DEFAULT_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_RESIGN_FROM_DEFAULT_GROUP'] . $return_page); } - if (!($row = group_memberships($group_id, $user->data['user_id']))) + if (!($row = group_memberships($group_id, phpbb::$user->data['user_id']))) { - trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } list(, $row) = each($row); @@ -135,17 +133,17 @@ class ucp_groups if ($group_type != GROUP_OPEN && $group_type != GROUP_FREE) { - trigger_error($user->lang['CANNOT_RESIGN_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['CANNOT_RESIGN_GROUP'] . $return_page); } if (confirm_box(true)) { - group_user_del($group_id, $user->data['user_id']); + group_user_del($group_id, phpbb::$user->data['user_id']); - add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_RESIGN', $group_row[$group_id]['group_name']); + add_log('user', phpbb::$user->data['user_id'], 'LOG_USER_GROUP_RESIGN', $group_row[$group_id]['group_name']); meta_refresh(3, $this->u_action); - trigger_error($user->lang[($row['user_pending']) ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page); + trigger_error(phpbb::$user->lang[($row['user_pending']) ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page); } else { @@ -166,7 +164,7 @@ class ucp_groups FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u WHERE ug.user_id = u.user_id AND ug.group_id = ' . $group_id . ' - AND ug.user_id = ' . $user->data['user_id']; + AND ug.user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -175,29 +173,29 @@ class ucp_groups { if ($row['user_pending']) { - trigger_error($user->lang['ALREADY_IN_GROUP_PENDING'] . $return_page); + trigger_error(phpbb::$user->lang['ALREADY_IN_GROUP_PENDING'] . $return_page); } - trigger_error($user->lang['ALREADY_IN_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['ALREADY_IN_GROUP'] . $return_page); } // Check permission to join (open group or request) if ($group_row[$group_id]['group_type'] != GROUP_OPEN && $group_row[$group_id]['group_type'] != GROUP_FREE) { - trigger_error($user->lang['CANNOT_JOIN_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['CANNOT_JOIN_GROUP'] . $return_page); } if (confirm_box(true)) { if ($group_row[$group_id]['group_type'] == GROUP_FREE) { - group_user_add($group_id, $user->data['user_id']); + group_user_add($group_id, phpbb::$user->data['user_id']); $email_template = 'group_added'; } else { - group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1); + group_user_add($group_id, phpbb::$user->data['user_id'], false, false, false, 0, 1); $email_template = 'group_request'; } @@ -208,7 +206,7 @@ class ucp_groups $sql = 'SELECT u.username, u.username_clean, u.user_email, u.user_notify_type, u.user_jabber, u.user_lang FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u WHERE ug.user_id = u.user_id - AND ' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? "ug.user_id = {$user->data['user_id']}" : 'ug.group_leader = 1') . " + AND ' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'ug.user_id = ' . phpbb::$user->data['user_id'] : 'ug.group_leader = 1') . " AND ug.group_id = $group_id"; $result = $db->sql_query($sql); @@ -222,7 +220,7 @@ class ucp_groups $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($row['username']), 'GROUP_NAME' => htmlspecialchars_decode($group_row[$group_id]['group_name']), - 'REQUEST_USERNAME' => $user->data['username'], + 'REQUEST_USERNAME' => phpbb::$user->data['username'], 'U_PENDING' => generate_board_url() . '/ucp.' . PHP_EXT . "?i=groups&mode=manage&action=list&g=$group_id", 'U_GROUP' => generate_board_url() . '/memberlist.' . PHP_EXT . "?mode=group&g=$group_id") @@ -234,10 +232,10 @@ class ucp_groups $messenger->save_queue(); - add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), $group_row[$group_id]['group_name']); + add_log('user', phpbb::$user->data['user_id'], 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), $group_row[$group_id]['group_name']); meta_refresh(3, $this->u_action); - trigger_error($user->lang[($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOINED' : 'GROUP_JOINED_PENDING'] . $return_page); + trigger_error(phpbb::$user->lang[($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOINED' : 'GROUP_JOINED_PENDING'] . $return_page); } else { @@ -254,25 +252,25 @@ class ucp_groups case 'demote': - if (!($row = group_memberships($group_id, $user->data['user_id']))) + if (!($row = group_memberships($group_id, phpbb::$user->data['user_id']))) { - trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } list(, $row) = each($row); if (!$row['group_leader']) { - trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } if (confirm_box(true)) { - group_user_attributes('demote', $group_id, $user->data['user_id']); + group_user_attributes('demote', $group_id, phpbb::$user->data['user_id']); - add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_DEMOTE', $group_row[$group_id]['group_name']); + add_log('user', phpbb::$user->data['user_id'], 'LOG_USER_GROUP_DEMOTE', $group_row[$group_id]['group_name']); meta_refresh(3, $this->u_action); - trigger_error($user->lang['USER_GROUP_DEMOTED'] . $return_page); + trigger_error(phpbb::$user->lang['USER_GROUP_DEMOTED'] . $return_page); } else { @@ -291,7 +289,7 @@ class ucp_groups $sql = 'SELECT g.*, ug.group_leader, ug.user_pending FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug - WHERE ug.user_id = ' . $user->data['user_id'] . ' + WHERE ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND g.group_id = ug.group_id ORDER BY g.group_type DESC, g.group_name'; $result = $db->sql_query($sql); @@ -327,15 +325,15 @@ class ucp_groups $template->assign_block_vars($block, array( 'GROUP_ID' => $row['group_id'], - 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], - 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], + 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name'], + 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : phpbb::$user->lang['GROUP_IS_SPECIAL'], 'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true, - 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], + 'GROUP_STATUS' => phpbb::$user->lang['GROUP_IS_' . $group_status], 'GROUP_COLOUR' => $row['group_colour'], 'U_VIEW_GROUP' => append_sid('memberlist', 'mode=group&g=' . $row['group_id']), - 'S_GROUP_DEFAULT' => ($row['group_id'] == $user->data['group_id']) ? true : false) + 'S_GROUP_DEFAULT' => ($row['group_id'] == phpbb::$user->data['group_id']) ? true : false) ); $group_id_ary[] = $row['group_id']; @@ -379,11 +377,11 @@ class ucp_groups $template->assign_block_vars('nonmember', array( 'GROUP_ID' => $row['group_id'], - 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], - 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], + 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name'], + 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : phpbb::$user->lang['GROUP_IS_SPECIAL'], 'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true, 'GROUP_CLOSED' => ($row['group_type'] <> GROUP_CLOSED || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? false : true, - 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], + 'GROUP_STATUS' => phpbb::$user->lang['GROUP_IS_' . $group_status], 'S_CAN_JOIN' => ($row['group_type'] == GROUP_OPEN || $row['group_type'] == GROUP_FREE) ? true : false, 'GROUP_COLOUR' => $row['group_colour'], @@ -425,13 +423,13 @@ class ucp_groups if (!$group_row) { - trigger_error($user->lang['NO_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NO_GROUP'] . $return_page); } // Check if the user is allowed to manage this group if set to founder only. if (!phpbb::$user->is_founder && $group_row['group_founder_manage']) { - trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING); + trigger_error(phpbb::$user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING); } $group_name = $group_row['group_name']; @@ -440,7 +438,7 @@ class ucp_groups $avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . PHPBB_ROOT_PATH . phpbb::$base_config['admin_folder'] . '/images/no_avatar.gif" alt="" />'; $template->assign_vars(array( - 'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name, + 'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_name] : $group_name, 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '', 'GROUP_DESC_DISP' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), @@ -459,22 +457,22 @@ class ucp_groups if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NO_GROUP'] . $return_page); } - if (!($row = group_memberships($group_id, $user->data['user_id']))) + if (!($row = group_memberships($group_id, phpbb::$user->data['user_id']))) { - trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } list(, $row) = each($row); if (!$row['group_leader']) { - trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } $file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false; - $user->add_lang(array('acp/groups', 'acp/common')); + phpbb::$user->add_lang(array('acp/groups', 'acp/common')); $data = $submit_ary = array(); @@ -559,7 +557,7 @@ class ucp_groups { if ($data['width'] > phpbb::$config['avatar_max_width'] || $data['height'] > phpbb::$config['avatar_max_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']); + $error[] = sprintf(phpbb::$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']); } } @@ -569,7 +567,7 @@ class ucp_groups { if ($data['width'] < phpbb::$config['avatar_min_width'] || $data['height'] < phpbb::$config['avatar_min_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']); + $error[] = sprintf(phpbb::$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']); } } } @@ -591,7 +589,7 @@ class ucp_groups if (!check_form_key('ucp_groups')) { - $error[] = $user->lang['FORM_INVALID']; + $error[] = phpbb::$user->lang['FORM_INVALID']; } if (!sizeof($error)) @@ -615,7 +613,7 @@ class ucp_groups phpbb::$acm->destroy_sql(GROUPS_TABLE); $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED'; - trigger_error($user->lang[$message] . $return_page); + trigger_error(phpbb::$user->lang[$message] . $return_page); } } @@ -655,7 +653,7 @@ class ucp_groups ORDER BY rank_title'; $result = $db->sql_query($sql); - $rank_options = '<option value="0"' . ((!$group_rank) ? ' selected="selected"' : '') . '>' . $user->lang['USER_DEFAULT'] . '</option>'; + $rank_options = '<option value="0"' . ((!$group_rank) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['USER_DEFAULT'] . '</option>'; while ($row = $db->sql_fetchrow($result)) { $selected = ($group_rank && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; @@ -714,7 +712,7 @@ class ucp_groups 'U_SWATCH' => append_sid(phpbb::$base_config['admin_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'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], phpbb::$config['avatar_filesize'] / 1024), + 'L_AVATAR_EXPLAIN' => sprintf(phpbb::$user->lang['AVATAR_EXPLAIN'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], phpbb::$config['avatar_filesize'] / 1024), )); break; @@ -723,21 +721,21 @@ class ucp_groups if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NO_GROUP'] . $return_page); } - if (!($row = group_memberships($group_id, $user->data['user_id']))) + if (!($row = group_memberships($group_id, phpbb::$user->data['user_id']))) { - trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } list(, $row) = each($row); if (!$row['group_leader']) { - trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } - $user->add_lang(array('acp/groups', 'acp/common')); + phpbb::$user->add_lang(array('acp/groups', 'acp/common')); $start = request_var('start', 0); // Grab the leaders - always, on every page... @@ -757,7 +755,7 @@ class ucp_groups 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'U_USER_VIEW' => get_username_string('profile', $row['user_id'], $row['username']), 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, - 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', + 'JOINED' => ($row['user_regdate']) ? phpbb::$user->format_date($row['user_regdate']) : ' - ', 'USER_POSTS' => $row['user_posts'], 'USER_ID' => $row['user_id']) ); @@ -812,7 +810,7 @@ class ucp_groups 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'U_USER_VIEW' => get_username_string('profile', $row['user_id'], $row['username']), 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, - 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', + 'JOINED' => ($row['user_regdate']) ? phpbb::$user->format_date($row['user_regdate']) : ' - ', 'USER_POSTS' => $row['user_posts'], 'USER_ID' => $row['user_id']) ); @@ -824,7 +822,7 @@ class ucp_groups foreach ($options as $option => $lang) { - $s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>'; + $s_action_options .= '<option value="' . $option . '">' . phpbb::$user->lang['GROUP_' . $lang] . '</option>'; } $template->assign_vars(array( @@ -843,26 +841,26 @@ class ucp_groups if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NO_GROUP'] . $return_page); } - if (!($row = group_memberships($group_id, $user->data['user_id']))) + if (!($row = group_memberships($group_id, phpbb::$user->data['user_id']))) { - trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } list(, $row) = each($row); if (!$row['group_leader']) { - trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } - $user->add_lang('acp/groups'); + phpbb::$user->add_lang('acp/groups'); // Approve, demote or promote group_user_attributes('approve', $group_id, $mark_ary, false, false); - trigger_error($user->lang['USERS_APPROVED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); + trigger_error(phpbb::$user->lang['USERS_APPROVED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); break; @@ -870,21 +868,21 @@ class ucp_groups if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NO_GROUP'] . $return_page); } - if (!($row = group_memberships($group_id, $user->data['user_id']))) + if (!($row = group_memberships($group_id, phpbb::$user->data['user_id']))) { - trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } list(, $row) = each($row); if (!$row['group_leader']) { - trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } - $group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; if (confirm_box(true)) { @@ -926,15 +924,15 @@ class ucp_groups group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row); } - $user->add_lang('acp/groups'); + phpbb::$user->add_lang('acp/groups'); - trigger_error($user->lang['GROUP_DEFS_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); + trigger_error(phpbb::$user->lang['GROUP_DEFS_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); } else { - $user->add_lang('acp/common'); + phpbb::$user->add_lang('acp/common'); - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'mark' => $mark_ary, 'g' => $group_id, 'i' => $id, @@ -947,40 +945,40 @@ class ucp_groups case 'deleteusers': - $user->add_lang(array('acp/groups', 'acp/common')); + phpbb::$user->add_lang(array('acp/groups', 'acp/common')); - if (!($row = group_memberships($group_id, $user->data['user_id']))) + if (!($row = group_memberships($group_id, phpbb::$user->data['user_id']))) { - trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } list(, $row) = each($row); if (!$row['group_leader']) { - trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } - $group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; if (confirm_box(true)) { if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NO_GROUP'] . $return_page); } $error = group_user_del($group_id, $mark_ary, false, $group_row['group_name']); if ($error) { - trigger_error($user->lang[$error] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); + trigger_error(phpbb::$user->lang[$error] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); } - trigger_error($user->lang['GROUP_USERS_REMOVE'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); + trigger_error(phpbb::$user->lang['GROUP_USERS_REMOVE'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'mark' => $mark_ary, 'g' => $group_id, 'i' => $id, @@ -993,33 +991,33 @@ class ucp_groups case 'addusers': - $user->add_lang(array('acp/groups', 'acp/common')); + phpbb::$user->add_lang(array('acp/groups', 'acp/common')); $names = utf8_normalize_nfc(request_var('usernames', '', true)); if (!$group_id) { - trigger_error($user->lang['NO_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NO_GROUP'] . $return_page); } if (!$names) { - trigger_error($user->lang['NO_USERS'] . $return_page); + trigger_error(phpbb::$user->lang['NO_USERS'] . $return_page); } - if (!($row = group_memberships($group_id, $user->data['user_id']))) + if (!($row = group_memberships($group_id, phpbb::$user->data['user_id']))) { - trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } list(, $row) = each($row); if (!$row['group_leader']) { - trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + trigger_error(phpbb::$user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } $name_ary = array_unique(explode("\n", $names)); - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; $default = request_var('default', 0); @@ -1028,10 +1026,10 @@ class ucp_groups // Add user/s to group if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, 0, 0, $group_row)) { - trigger_error($user->lang[$error] . $return_page); + trigger_error(phpbb::$user->lang[$error] . $return_page); } - trigger_error($user->lang['GROUP_USERS_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); + trigger_error(phpbb::$user->lang['GROUP_USERS_ADDED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); } else { @@ -1043,19 +1041,19 @@ class ucp_groups 'mode' => $mode, 'action' => $action ); - confirm_box(false, sprintf($user->lang['GROUP_CONFIRM_ADD_USER' . ((sizeof($name_ary) == 1) ? '' : 'S')], implode(', ', $name_ary)), build_hidden_fields($s_hidden_fields)); + confirm_box(false, sprintf(phpbb::$user->lang['GROUP_CONFIRM_ADD_USER' . ((sizeof($name_ary) == 1) ? '' : 'S')], implode(', ', $name_ary)), build_hidden_fields($s_hidden_fields)); } - trigger_error($user->lang['NO_USERS_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); + trigger_error(phpbb::$user->lang['NO_USERS_ADDED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&action=list&g=' . $group_id . '">', '</a>')); break; default: - $user->add_lang('acp/common'); + phpbb::$user->add_lang('acp/common'); $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_desc, g.group_desc_uid, g.group_desc_bitfield, g.group_desc_options, g.group_type, ug.group_leader FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug - WHERE ug.user_id = ' . $user->data['user_id'] . ' + WHERE ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND g.group_id = ug.group_id AND ug.group_leader = 1 ORDER BY g.group_type DESC, g.group_name'; @@ -1064,7 +1062,7 @@ class ucp_groups while ($value = $db->sql_fetchrow($result)) { $template->assign_block_vars('leader', array( - 'GROUP_NAME' => ($value['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $value['group_name']] : $value['group_name'], + 'GROUP_NAME' => ($value['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $value['group_name']] : $value['group_name'], 'GROUP_DESC' => generate_text_for_display($value['group_desc'], $value['group_desc_uid'], $value['group_desc_bitfield'], $value['group_desc_options']), 'GROUP_TYPE' => $value['group_type'], 'GROUP_ID' => $value['group_id'], diff --git a/phpBB/modules/ucp/ucp_main.php b/phpBB/modules/ucp/ucp_main.php index 24fc74d8cb..ab0996f87d 100644 --- a/phpBB/modules/ucp/ucp_main.php +++ b/phpBB/modules/ucp/ucp_main.php @@ -33,13 +33,11 @@ class ucp_main function main($id, $mode) { - global $db, $user, $auth, $template; - switch ($mode) { case 'front': - $user->add_lang('memberlist'); + phpbb::$user->add_lang('memberlist'); $sql_from = TOPICS_TABLE . ' t '; $sql_select = ''; @@ -47,18 +45,18 @@ class ucp_main 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'] . ')'; + AND tp.user_id = ' . phpbb::$user->data['user_id'] . ')'; $sql_select .= ', tp.topic_posted'; } 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'] . ')'; + AND tt.user_id = ' . phpbb::$user->data['user_id'] . ')'; $sql_select .= ', tt.mark_time'; } - $topic_type = $user->lang['VIEW_TOPIC_GLOBAL']; + $topic_type = phpbb::$user->lang['VIEW_TOPIC_GLOBAL']; $folder = 'global_read'; $folder_new = 'global_unread'; @@ -138,19 +136,19 @@ class ucp_main 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'FIRST_POST_TIME' => phpbb::$user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_TIME' => phpbb::$user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => phpbb::$user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, - 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), - 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, 'src'), - 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '', + 'TOPIC_FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), + 'TOPIC_FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, 'src'), + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? phpbb::$user->img('icon_topic_attach', '') : '', 'S_USER_POSTED' => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false, 'S_UNREAD' => $unread_topic, @@ -169,29 +167,29 @@ class ucp_main { include_once(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); } - display_user_activity($user->data); + display_user_activity(phpbb::$user->data); } // Do the relevant calculations - $memberdays = max(1, round((time() - $user->data['user_regdate']) / 86400)); - $posts_per_day = $user->data['user_posts'] / $memberdays; - $percentage = (phpbb::$config['num_posts']) ? min(100, ($user->data['user_posts'] / phpbb::$config['num_posts']) * 100) : 0; + $memberdays = max(1, round((time() - phpbb::$user->data['user_regdate']) / 86400)); + $posts_per_day = phpbb::$user->data['user_posts'] / $memberdays; + $percentage = (phpbb::$config['num_posts']) ? min(100, (phpbb::$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'] : '', - 'JOINED' => $user->format_date($user->data['user_regdate']), - 'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit), - 'WARNINGS' => ($user->data['user_warnings']) ? $user->data['user_warnings'] : 0, - 'POSTS' => ($user->data['user_posts']) ? $user->data['user_posts'] : 0, - 'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day), - 'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage), + 'USER_COLOR' => (!empty(phpbb::$user->data['user_colour'])) ? phpbb::$user->data['user_colour'] : '', + 'JOINED' => phpbb::$user->format_date(phpbb::$user->data['user_regdate']), + 'VISITED' => (empty($last_visit)) ? ' - ' : phpbb::$user->format_date($last_visit), + 'WARNINGS' => (phpbb::$user->data['user_warnings']) ? phpbb::$user->data['user_warnings'] : 0, + 'POSTS' => (phpbb::$user->data['user_posts']) ? phpbb::$user->data['user_posts'] : 0, + 'POSTS_DAY' => sprintf(phpbb::$user->lang['POST_DAY'], $posts_per_day), + 'POSTS_PCT' => sprintf(phpbb::$user->lang['POST_PCT'], $percentage), 'OCCUPATION' => (!empty($row['user_occ'])) ? $row['user_occ'] : '', 'INTERESTS' => (!empty($row['user_interests'])) ? $row['user_interests'] : '', // 'S_GROUP_OPTIONS' => $group_options, - 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid('search', 'author_id=' . $user->data['user_id'] . '&sr=posts') : '', + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid('search', 'author_id=' . phpbb::$user->data['user_id'] . '&sr=posts') : '', )); break; @@ -200,7 +198,7 @@ class ucp_main include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); - $user->add_lang('viewforum'); + phpbb::$user->add_lang('viewforum'); add_form_key('ucp_front_subscribed'); @@ -221,7 +219,7 @@ class ucp_main { $sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forums) . ' - AND user_id = ' . $user->data['user_id']; + AND user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); $l_unwatch .= '_FORUMS'; @@ -231,23 +229,23 @@ class ucp_main { $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topics) . ' - AND user_id = ' . $user->data['user_id']; + AND user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); $l_unwatch .= '_TOPICS'; } - $msg = $user->lang['UNWATCHED' . $l_unwatch]; + $msg = phpbb::$user->lang['UNWATCHED' . $l_unwatch]; } else { - $msg = $user->lang['NO_WATCHED_SELECTED']; + $msg = phpbb::$user->lang['NO_WATCHED_SELECTED']; } } else { - $msg = $user->lang['FORM_INVALID']; + $msg = phpbb::$user->lang['FORM_INVALID']; } - $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . append_sid('ucp', "i=$id&mode=subscribed") . '">', '</a>'); + $message = $msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . append_sid('ucp', "i=$id&mode=subscribed") . '">', '</a>'); meta_refresh(3, append_sid('ucp', "i=$id&mode=subscribed")); trigger_error($message); } @@ -267,7 +265,7 @@ class ucp_main FORUMS_TABLE => 'f' ), - 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . ' + 'WHERE' => 'fw.user_id = ' . phpbb::$user->data['user_id'] . ' AND f.forum_id = fw.forum_id AND ' . $db->sql_in_set('f.forum_id', $forbidden_forums, true, true), @@ -279,7 +277,7 @@ class ucp_main $sql_array['LEFT_JOIN'] = array( array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' + 'ON' => 'ft.user_id = ' . phpbb::$user->data['user_id'] . ' AND ft.forum_id = f.forum_id' ) ); @@ -300,11 +298,11 @@ class ucp_main if (phpbb::$config['load_db_lastread']) { - $forum_check = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark']; + $forum_check = (!empty($row['mark_time'])) ? $row['mark_time'] : phpbb::$user->data['user_lastmark']; } else { - $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']; + $forum_check = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + phpbb::$config['board_startdate']) : phpbb::$user->data['user_lastmark']; } $unread_forum = ($row['forum_last_post_time'] > $forum_check) ? true : false; @@ -324,7 +322,7 @@ class ucp_main // Create last post link information, if appropriate if ($row['forum_last_post_id']) { - $last_post_time = $user->format_date($row['forum_last_post_time']); + $last_post_time = phpbb::$user->format_date($row['forum_last_post_time']); $last_post_url = append_sid('viewtopic', "f=$forum_id&p=" . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } else @@ -334,9 +332,9 @@ class ucp_main $template->assign_block_vars('forumrow', array( 'FORUM_ID' => $forum_id, - 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), - 'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, 'src'), - 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . PHPBB_ROOT_PATH . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '', + 'FORUM_FOLDER_IMG' => phpbb::$user->img($folder_image, $folder_alt), + 'FORUM_FOLDER_IMG_SRC' => phpbb::$user->img($folder_image, $folder_alt, 'src'), + 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . PHPBB_ROOT_PATH . $row['forum_image'] . '" alt="' . phpbb::$user->lang[$folder_alt] . '" />' : '', 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? PHPBB_ROOT_PATH . $row['forum_image'] : '', 'FORUM_NAME' => $row['forum_name'], 'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), @@ -385,7 +383,7 @@ class ucp_main include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); - $user->add_lang('viewforum'); + phpbb::$user->add_lang('viewforum'); if (phpbb_request::is_set_post('unbookmark')) { @@ -406,12 +404,12 @@ class ucp_main if (confirm_box(true)) { $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . ' + WHERE user_id = ' . phpbb::$user->data['user_id'] . ' AND ' . $db->sql_in_set('topic_id', $topics); $db->sql_query($sql); meta_refresh(3, $url); - $message = $user->lang['BOOKMARKS_REMOVED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $url . '">', '</a>'); + $message = phpbb::$user->lang['BOOKMARKS_REMOVED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $url . '">', '</a>'); trigger_error($message); } else @@ -431,7 +429,7 @@ class ucp_main $pm_drafts = ($this->p_master->p_name == 'pm') ? true : false; $template->assign_var('S_SHOW_DRAFTS', true); - $user->add_lang('posting'); + phpbb::$user->add_lang('posting'); $edit = phpbb_request::is_set('edit'); $draft_id = phpbb_request::variable('edit', 0); @@ -452,17 +450,17 @@ class ucp_main { $sql = 'DELETE FROM ' . DRAFTS_TABLE . ' WHERE ' . $db->sql_in_set('draft_id', $drafts) . ' - AND user_id = ' . $user->data['user_id']; + AND user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); } - $msg = $user->lang['DRAFTS_DELETED']; + $msg = phpbb::$user->lang['DRAFTS_DELETED']; unset($drafts); } else { - $msg = $user->lang['FORM_INVALID']; + $msg = phpbb::$user->lang['FORM_INVALID']; } - $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = $msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); meta_refresh(3, $this->u_action); trigger_error($message); } @@ -483,22 +481,22 @@ class ucp_main $sql = 'UPDATE ' . DRAFTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $draft_row) . " WHERE draft_id = $draft_id - AND user_id = " . $user->data['user_id']; + AND user_id = " . phpbb::$user->data['user_id']; $db->sql_query($sql); - $message = $user->lang['DRAFT_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = phpbb::$user->lang['DRAFT_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); meta_refresh(3, $this->u_action); trigger_error($message); } else { - $template->assign_var('ERROR', ($draft_message == '') ? $user->lang['EMPTY_DRAFT'] : (($draft_subject == '') ? $user->lang['EMPTY_DRAFT_TITLE'] : '')); + $template->assign_var('ERROR', ($draft_message == '') ? phpbb::$user->lang['EMPTY_DRAFT'] : (($draft_subject == '') ? phpbb::$user->lang['EMPTY_DRAFT_TITLE'] : '')); } } else { - $template->assign_var('ERROR', $user->lang['FORM_INVALID']); + $template->assign_var('ERROR', phpbb::$user->lang['FORM_INVALID']); } } @@ -506,7 +504,7 @@ class ucp_main { $sql = 'SELECT d.*, f.forum_name FROM ' . DRAFTS_TABLE . ' d, ' . FORUMS_TABLE . ' f - WHERE d.user_id = ' . $user->data['user_id'] . ' ' . + WHERE d.user_id = ' . phpbb::$user->data['user_id'] . ' ' . (($edit) ? "AND d.draft_id = $draft_id" : '') . ' AND f.forum_id = d.forum_id ORDER BY d.save_time DESC'; @@ -514,7 +512,7 @@ class ucp_main else { $sql = 'SELECT * FROM ' . DRAFTS_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . ' ' . + WHERE user_id = ' . phpbb::$user->data['user_id'] . ' ' . (($edit) ? "AND draft_id = $draft_id" : '') . ' AND forum_id = 0 AND topic_id = 0 @@ -580,7 +578,7 @@ class ucp_main } $template_row = array( - 'DATE' => $user->format_date($draft['save_time']), + 'DATE' => phpbb::$user->format_date($draft['save_time']), 'DRAFT_MESSAGE' => ($submit) ? $draft_message : $draft['draft_message'], 'DRAFT_SUBJECT' => ($submit) ? $draft_subject : $draft['draft_subject'], 'TITLE' => $title, @@ -613,14 +611,14 @@ class ucp_main $template->assign_vars(array( - 'L_TITLE' => $user->lang['UCP_MAIN_' . strtoupper($mode)], + 'L_TITLE' => phpbb::$user->lang['UCP_MAIN_' . strtoupper($mode)], 'S_DISPLAY_MARK_ALL' => ($mode == 'watched' || ($mode == 'drafts' && !phpbb_request::is_set('edit', phpbb_request::GET))) ? true : false, 'S_HIDDEN_FIELDS' => (isset($s_hidden_fields)) ? $s_hidden_fields : '', 'S_UCP_ACTION' => $this->u_action, - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), - 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'LAST_POST_IMG' => phpbb::$user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'NEWEST_POST_IMG' => phpbb::$user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), )); // Set desired template @@ -633,8 +631,6 @@ class ucp_main */ function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array()) { - global $user, $db, $template, $auth; - $table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE; $start = request_var('start', 0); @@ -647,7 +643,7 @@ class ucp_main ), 'WHERE' => 'i.topic_id = t.topic_id - AND i.user_id = ' . $user->data['user_id'] . ' + AND i.user_id = ' . phpbb::$user->data['user_id'] . ' AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), ); $sql = $db->sql_build_query('SELECT', $sql_array); @@ -660,7 +656,7 @@ class ucp_main $template->assign_vars(array( '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)) + 'TOTAL_TOPICS' => ($topics_count == 1) ? phpbb::$user->lang['VIEW_FORUM_TOPIC'] : sprintf(phpbb::$user->lang['VIEW_FORUM_TOPICS'], $topics_count)) ); } @@ -674,7 +670,7 @@ class ucp_main TOPICS_TABLE => 't' ), - 'WHERE' => 'tw.user_id = ' . $user->data['user_id'] . ' + 'WHERE' => 'tw.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.topic_id = tw.topic_id AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), @@ -693,7 +689,7 @@ class ucp_main BOOKMARKS_TABLE => 'b', ), - 'WHERE' => 'b.user_id = ' . $user->data['user_id'] . ' + 'WHERE' => 'b.user_id = ' . phpbb::$user->data['user_id'] . ' AND ' . $db->sql_in_set('f.forum_id', $forbidden_forum_ary, true, true), 'ORDER_BY' => 't.topic_last_post_time DESC' @@ -707,14 +703,14 @@ class ucp_main 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['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . phpbb::$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 = ' . phpbb::$user->data['user_id']); $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time AS forum_mark_time'; } 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['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . phpbb::$user->data['user_id']); $sql_array['SELECT'] .= ', tp.topic_posted'; } @@ -782,10 +778,10 @@ class ucp_main $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'FIRST_POST_TIME' => phpbb::$user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_TIME' => phpbb::$user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => phpbb::$user->format_date($row['topic_last_view_time']), 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), @@ -807,12 +803,12 @@ class ucp_main 'TOPIC_TYPE' => $topic_type, 'FORUM_NAME' => $row['forum_name'], - 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), - 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, 'src'), + 'TOPIC_FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), + 'TOPIC_FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, 'src'), 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', - 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? phpbb::$user->img('icon_topic_attach', phpbb::$user->lang['TOTAL_ATTACHMENTS']) : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false, diff --git a/phpBB/modules/ucp/ucp_pm.php b/phpBB/modules/ucp/ucp_pm.php index 76992be0df..66170d201a 100644 --- a/phpBB/modules/ucp/ucp_pm.php +++ b/phpBB/modules/ucp/ucp_pm.php @@ -43,9 +43,7 @@ class ucp_pm function main($id, $mode) { - global $user, $template, $auth, $db; - - if (!$user->data['is_registered']) + if (!phpbb::$user->is_registered) { trigger_error('NO_MESSAGE'); } @@ -56,7 +54,7 @@ class ucp_pm trigger_error('PM_DISABLED'); } - $user->add_lang('posting'); + phpbb::$user->add_lang('posting'); $template->assign_var('S_PRIVMSGS', true); // Folder directly specified? @@ -88,22 +86,22 @@ class ucp_pm case 'popup': $l_new_message = ''; - if ($user->data['is_registered']) + if (phpbb::$user->is_registered) { - if ($user->data['user_new_privmsg']) + if (phpbb::$user->data['user_new_privmsg']) { - $l_new_message = ($user->data['user_new_privmsg'] == 1) ? $user->lang['YOU_NEW_PM'] : $user->lang['YOU_NEW_PMS']; + $l_new_message = (phpbb::$user->data['user_new_privmsg'] == 1) ? phpbb::$user->lang['YOU_NEW_PM'] : phpbb::$user->lang['YOU_NEW_PMS']; } else { - $l_new_message = $user->lang['YOU_NO_NEW_PM']; + $l_new_message = phpbb::$user->lang['YOU_NO_NEW_PM']; } } $template->assign_vars(array( 'MESSAGE' => $l_new_message, - 'S_NOT_LOGGED_IN' => ($user->data['user_id'] == ANONYMOUS) ? true : false, - 'CLICK_TO_VIEW' => sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . append_sid('ucp', 'i=pm&folder=inbox') . '" onclick="jump_to_inbox(this.href); return false;">', '</a>'), + 'S_NOT_LOGGED_IN' => phpbb::$user->is_guest, + 'CLICK_TO_VIEW' => sprintf(phpbb::$user->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . append_sid('ucp', 'i=pm&folder=inbox') . '" onclick="jump_to_inbox(this.href); return false;">', '</a>'), 'U_INBOX' => append_sid('ucp', 'i=pm&folder=inbox'), 'UA_INBOX' => append_sid('ucp', 'i=pm&folder=inbox', false)) ); @@ -115,7 +113,7 @@ class ucp_pm case 'compose': $action = request_var('action', 'post'); - get_folder($user->data['user_id']); + get_folder(phpbb::$user->data['user_id']); if (!$auth->acl_get('u_sendpm')) { @@ -130,7 +128,7 @@ class ucp_pm case 'options': set_user_message_limit(); - get_folder($user->data['user_id']); + get_folder(phpbb::$user->data['user_id']); include(PHPBB_ROOT_PATH . 'includes/ucp/ucp_pm_options.' . PHP_EXT); message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions); @@ -140,7 +138,7 @@ class ucp_pm case 'drafts': - get_folder($user->data['user_id']); + get_folder(phpbb::$user->data['user_id']); $this->p_name = 'pm'; // Call another module... please do not try this at home... Hoochie Coochie Man @@ -214,7 +212,7 @@ class ucp_pm $move_msg_ids = phpbb_request::variable('marked_msg_id', array(0), false, phpbb_request::POST); $cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX); - if (move_pm($user->data['user_id'], $user->data['message_limit'], $move_msg_ids, $dest_folder, $cur_folder_id)) + if (move_pm(phpbb::$user->data['user_id'], phpbb::$user->data['message_limit'], $move_msg_ids, $dest_folder, $cur_folder_id)) { // Return to folder view if single message moved if ($action == 'view_message') @@ -229,14 +227,14 @@ class ucp_pm // Message Mark Options if ($submit_mark) { - handle_mark_actions($user->data['user_id'], $mark_option); + handle_mark_actions(phpbb::$user->data['user_id'], $mark_option); } // If new messages arrived, place them into the appropriate folder $num_not_moved = $num_removed = 0; $release = request_var('release', 0); - if ($user->data['user_new_privmsg'] && $action == 'view_folder') + if (phpbb::$user->data['user_new_privmsg'] && $action == 'view_folder') { $return = place_pm_into_folder($global_privmsgs_rules, $release); $num_not_moved = $return['not_moved']; @@ -253,7 +251,7 @@ class ucp_pm FROM ' . PRIVMSGS_TO_TABLE . " WHERE msg_id = $msg_id AND folder_id <> " . PRIVMSGS_NO_BOX . ' - AND user_id = ' . $user->data['user_id']; + AND user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -278,7 +276,7 @@ class ucp_pm FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TABLE . " p2 WHERE p2.msg_id = $msg_id AND t.folder_id = $folder_id - AND t.user_id = " . $user->data['user_id'] . " + AND t.user_id = " . phpbb::$user->data['user_id'] . " AND t.msg_id = p.msg_id AND p.message_time $sql_condition p2.message_time ORDER BY p.message_time $sql_ordering"; @@ -299,7 +297,7 @@ class ucp_pm $sql = 'SELECT t.*, p.*, u.* FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u - WHERE t.user_id = ' . $user->data['user_id'] . " + WHERE t.user_id = ' . phpbb::$user->data['user_id'] . " AND p.author_id = u.user_id AND t.folder_id = $folder_id AND t.msg_id = p.msg_id @@ -314,10 +312,10 @@ class ucp_pm } // Update unread status - update_unread_status($message_row['pm_unread'], $message_row['msg_id'], $user->data['user_id'], $folder_id); + update_unread_status($message_row['pm_unread'], $message_row['msg_id'], phpbb::$user->data['user_id'], $folder_id); } - $folder = get_folder($user->data['user_id'], $folder_id); + $folder = get_folder(phpbb::$user->data['user_id'], $folder_id); $s_folder_options = $s_to_folder_options = ''; foreach ($folder as $f_id => $folder_ary) @@ -337,9 +335,9 @@ class ucp_pm 'CUR_FOLDER_NAME' => $folder_status['folder_name'], 'NUM_NOT_MOVED' => $num_not_moved, 'NUM_REMOVED' => $num_removed, - 'RELEASE_MESSAGE_INFO' => sprintf($user->lang['RELEASE_MESSAGES'], '<a href="' . $this->u_action . '&folder=' . $folder_id . '&release=1">', '</a>'), - 'NOT_MOVED_MESSAGES' => ($num_not_moved == 1) ? $user->lang['NOT_MOVED_MESSAGE'] : sprintf($user->lang['NOT_MOVED_MESSAGES'], $num_not_moved), - 'RULE_REMOVED_MESSAGES' => ($num_removed == 1) ? $user->lang['RULE_REMOVED_MESSAGE'] : sprintf($user->lang['RULE_REMOVED_MESSAGES'], $num_removed), + 'RELEASE_MESSAGE_INFO' => sprintf(phpbb::$user->lang['RELEASE_MESSAGES'], '<a href="' . $this->u_action . '&folder=' . $folder_id . '&release=1">', '</a>'), + 'NOT_MOVED_MESSAGES' => ($num_not_moved == 1) ? phpbb::$user->lang['NOT_MOVED_MESSAGE'] : sprintf(phpbb::$user->lang['NOT_MOVED_MESSAGES'], $num_not_moved), + 'RULE_REMOVED_MESSAGES' => ($num_removed == 1) ? phpbb::$user->lang['RULE_REMOVED_MESSAGE'] : sprintf(phpbb::$user->lang['RULE_REMOVED_MESSAGES'], $num_removed), 'S_FOLDER_OPTIONS' => $s_folder_options, 'S_TO_FOLDER_OPTIONS' => $s_to_folder_options, @@ -396,7 +394,7 @@ class ucp_pm } $template->assign_vars(array( - 'L_TITLE' => $user->lang['UCP_PM_' . strtoupper($mode)], + 'L_TITLE' => phpbb::$user->lang['UCP_PM_' . strtoupper($mode)], 'S_UCP_ACTION' => $this->u_action . ((isset($action)) ? "&action=$action" : '')) ); diff --git a/phpBB/modules/ucp/ucp_pm_compose.php b/phpBB/modules/ucp/ucp_pm_compose.php index cebb3a11dc..6941973fe6 100644 --- a/phpBB/modules/ucp/ucp_pm_compose.php +++ b/phpBB/modules/ucp/ucp_pm_compose.php @@ -22,8 +22,6 @@ if (!defined('IN_PHPBB')) */ function compose_pm($id, $mode, $action) { - global $template, $db, $auth, $user; - // Damn php and globals - i know, this is horrible // Needed for handle_message_list_actions() global $refresh, $submit, $preview; @@ -91,10 +89,10 @@ function compose_pm($id, $mode, $action) $sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON ( g.group_id = ug.group_id - AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND ug.user_pending = 0 ) - WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . phpbb::$user->data['user_id'] . ')'; } $sql .= ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' WHERE ' : ' AND '; @@ -106,7 +104,7 @@ function compose_pm($id, $mode, $action) $group_options = ''; while ($row = $db->sql_fetchrow($result)) { - $group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } $db->sql_freeresult($result); } @@ -158,7 +156,7 @@ function compose_pm($id, $mode, $action) { $sql = 'SELECT t.folder_id, p.*, u.username as quote_username FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u - WHERE t.user_id = ' . $user->data['user_id'] . " + WHERE t.user_id = ' . phpbb::$user->data['user_id'] . " AND p.author_id = u.user_id AND t.msg_id = p.msg_id AND p.msg_id = $msg_id"; @@ -174,7 +172,7 @@ function compose_pm($id, $mode, $action) // check for outbox (not read) status, we do not allow editing if one user already having the message $sql = 'SELECT p.*, t.folder_id FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p - WHERE t.user_id = ' . $user->data['user_id'] . ' + WHERE t.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.folder_id = ' . PRIVMSGS_OUTBOX . " AND t.msg_id = $msg_id AND t.msg_id = p.msg_id"; @@ -193,7 +191,7 @@ function compose_pm($id, $mode, $action) $sql = 'SELECT msg_id, pm_unread, pm_new, author_id, folder_id FROM ' . PRIVMSGS_TO_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . " + WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND msg_id = $msg_id"; break; @@ -229,7 +227,7 @@ function compose_pm($id, $mode, $action) { $sql = 'SELECT p.*, t.folder_id FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p - WHERE t.user_id = ' . $user->data['user_id'] . " + WHERE t.user_id = ' . phpbb::$user->data['user_id'] . " AND t.msg_id = $msg_id AND t.msg_id = p.msg_id"; $result = $db->sql_query($sql); @@ -315,9 +313,9 @@ function compose_pm($id, $mode, $action) $address_list['u'][$post['author_id']] = 'to'; // Now, make sure the user itself is not listed. ;) - if (isset($address_list['u'][$user->data['user_id']])) + if (isset($address_list['u'][phpbb::$user->data['user_id']])) { - unset($address_list['u'][$user->data['user_id']]); + unset($address_list['u'][phpbb::$user->data['user_id']]); } } } @@ -381,7 +379,7 @@ function compose_pm($id, $mode, $action) $message_parser->message = ($action == 'reply') ? '' : $message_text; unset($message_text); - $s_action = append_sid('ucp', "i=$id&mode=$mode&action=$action", true, $user->session_id); + $s_action = append_sid('ucp', "i=$id&mode=$mode&action=$action", true, phpbb::$user->session_id); $s_action .= ($msg_id) ? "&p=$msg_id" : ''; // Delete triggered ? @@ -393,14 +391,14 @@ function compose_pm($id, $mode, $action) // Do we need to confirm ? if (confirm_box(true)) { - delete_pm($user->data['user_id'], $msg_id, $folder_id); + delete_pm(phpbb::$user->data['user_id'], $msg_id, $folder_id); // jump to next message in "history"? nope, not for the moment. But able to be included later. $meta_info = append_sid('ucp', "i=pm&folder=$folder_id"); - $message = $user->lang['MESSAGE_DELETED']; + $message = phpbb::$user->lang['MESSAGE_DELETED']; meta_refresh(3, $meta_info); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>'); trigger_error($message); } else @@ -421,7 +419,7 @@ function compose_pm($id, $mode, $action) // Get maximum number of allowed recipients $sql = 'SELECT MAX(g.group_max_recipients) as max_recipients FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug - WHERE ug.user_id = ' . $user->data['user_id'] . ' + WHERE ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND ug.user_pending = 0 AND ug.group_id = g.group_id'; $result = $db->sql_query($sql); @@ -440,9 +438,9 @@ function compose_pm($id, $mode, $action) $list = (!empty($list['u'])) ? $list['u'] : array(); $list[$post['author_id']] = 'to'; - if (isset($list[$user->data['user_id']])) + if (isset($list[phpbb::$user->data['user_id']])) { - unset($list[$user->data['user_id']]); + unset($list[phpbb::$user->data['user_id']]); } $max_recipients = ($max_recipients < sizeof($list)) ? sizeof($list) : $max_recipients; @@ -457,21 +455,21 @@ function compose_pm($id, $mode, $action) 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']; + $error[] = phpbb::$user->lang['NO_AUTH_GROUP_MESSAGE']; } // Check mass pm to users permission 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); + $error[] = phpbb::$user->lang('TOO_MANY_RECIPIENTS', 1); } // Check for too many recipients if (!empty($address_list['u']) && $max_recipients && sizeof($address_list['u']) > $max_recipients) { $address_list = get_recipients($address_list, $max_recipients); - $error[] = $user->lang('TOO_MANY_RECIPIENTS', $max_recipients); + $error[] = phpbb::$user->lang('TOO_MANY_RECIPIENTS', $max_recipients); } // Always check if the submitted attachment data is valid and belongs to the user. @@ -494,9 +492,9 @@ function compose_pm($id, $mode, $action) if (!in_array($action, array('quote', 'edit', 'delete', 'forward'))) { - $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_sig = (phpbb::$config['allow_sig'] && phpbb::$config['allow_sig_pm'] && $auth->acl_get('u_sig') && phpbb::$user->optionget('attachsig')); + $enable_smilies = (phpbb::$config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && phpbb::$user->optionget('smilies')); + $enable_bbcode = (phpbb::$config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode') && phpbb::$user->optionget('bbcode')); $enable_urls = true; } @@ -509,7 +507,7 @@ function compose_pm($id, $mode, $action) FROM ' . DRAFTS_TABLE . ' WHERE forum_id = 0 AND topic_id = 0 - AND user_id = ' . $user->data['user_id'] . + AND user_id = ' . phpbb::$user->data['user_id'] . (($draft_id) ? " AND draft_id <> $draft_id" : ''); $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); @@ -536,7 +534,7 @@ function compose_pm($id, $mode, $action) if ($save && $auth->acl_get('u_savedrafts')) { $subject = utf8_normalize_nfc(request_var('subject', '', true)); - $subject = (!$subject && $action != 'post') ? $user->lang['NEW_MESSAGE'] : $subject; + $subject = (!$subject && $action != 'post') ? phpbb::$user->lang['NEW_MESSAGE'] : $subject; $message = utf8_normalize_nfc(request_var('message', '', true)); if ($subject && $message) @@ -544,7 +542,7 @@ function compose_pm($id, $mode, $action) if (confirm_box(true)) { $sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'user_id' => $user->data['user_id'], + 'user_id' => phpbb::$user->data['user_id'], 'topic_id' => 0, 'forum_id' => 0, 'save_time' => $current_time, @@ -557,7 +555,7 @@ function compose_pm($id, $mode, $action) $redirect_url = append_sid('ucp', "i=pm&mode=$mode"); meta_refresh(3, $redirect_url); - $message = $user->lang['DRAFT_SAVED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang['DRAFT_SAVED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); } @@ -583,12 +581,12 @@ function compose_pm($id, $mode, $action) { if (utf8_clean_string($subject) === '') { - $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT']; + $error[] = phpbb::$user->lang['EMPTY_MESSAGE_SUBJECT']; } if (utf8_clean_string($message) === '') { - $error[] = $user->lang['TOO_FEW_CHARS']; + $error[] = phpbb::$user->lang['TOO_FEW_CHARS']; } } @@ -603,7 +601,7 @@ function compose_pm($id, $mode, $action) WHERE draft_id = $draft_id AND topic_id = 0 AND forum_id = 0 - AND user_id = " . $user->data['user_id']; + AND user_id = " . phpbb::$user->data['user_id']; $result = $db->sql_query_limit($sql, 1); if ($row = $db->sql_fetchrow($result)) @@ -630,7 +628,7 @@ function compose_pm($id, $mode, $action) { if (($submit || $preview) && !check_form_key('ucp_pm_compose')) { - $error[] = $user->lang['FORM_INVALID']; + $error[] = phpbb::$user->lang['FORM_INVALID']; } $subject = utf8_normalize_nfc(request_var('subject', '', true)); $message_parser->message = utf8_normalize_nfc(request_var('message', '', true)); @@ -673,13 +671,13 @@ function compose_pm($id, $mode, $action) if ($action != 'edit' && !$preview && !$refresh && phpbb::$config['flood_interval'] && !$auth->acl_get('u_ignoreflood')) { // Flood check - $last_post_time = $user->data['user_lastpost_time']; + $last_post_time = phpbb::$user->data['user_lastpost_time']; if ($last_post_time) { if ($last_post_time && ($current_time - $last_post_time) < intval(phpbb::$config['flood_interval'])) { - $error[] = $user->lang['FLOOD_ERROR']; + $error[] = phpbb::$user->lang['FLOOD_ERROR']; } } } @@ -689,12 +687,12 @@ function compose_pm($id, $mode, $action) { if (utf8_clean_string($subject) === '') { - $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT']; + $error[] = phpbb::$user->lang['EMPTY_MESSAGE_SUBJECT']; } if (!sizeof($address_list)) { - $error[] = $user->lang['NO_RECIPIENT']; + $error[] = phpbb::$user->lang['NO_RECIPIENT']; } } @@ -703,9 +701,9 @@ function compose_pm($id, $mode, $action) { $pm_data = array( 'msg_id' => (int) $msg_id, - 'from_user_id' => $user->data['user_id'], - 'from_user_ip' => $user->ip, - 'from_username' => $user->data['username'], + 'from_user_id' => phpbb::$user->data['user_id'], + 'from_user_ip' => phpbb::$user->ip, + 'from_username' => phpbb::$user->data['username'], 'reply_from_root_level' => (isset($post['root_level'])) ? (int) $post['root_level'] : 0, 'reply_from_msg_id' => (int) $msg_id, 'icon_id' => (int) $icon_id, @@ -728,7 +726,7 @@ function compose_pm($id, $mode, $action) $return_folder_url = append_sid('ucp', 'i=pm&folder=outbox'); meta_refresh(3, $return_message_url); - $message = $user->lang['MESSAGE_STORED'] . '<br /><br />' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '<a href="' . $return_message_url . '">', '</a>') . '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $return_folder_url . '">', '</a>', $user->lang['PM_OUTBOX']); + $message = phpbb::$user->lang['MESSAGE_STORED'] . '<br /><br />' . sprintf(phpbb::$user->lang['VIEW_PRIVATE_MESSAGE'], '<a href="' . $return_message_url . '">', '</a>') . '<br /><br />' . sprintf(phpbb::$user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $return_folder_url . '">', '</a>', phpbb::$user->lang['PM_OUTBOX']); trigger_error($message); } @@ -738,12 +736,12 @@ function compose_pm($id, $mode, $action) // Preview if (!sizeof($error) && $preview) { - $user->add_lang('viewtopic'); + phpbb::$user->add_lang('viewtopic'); $preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); - $preview_signature = $user->data['user_sig']; - $preview_signature_uid = $user->data['user_sig_bbcode_uid']; - $preview_signature_bitfield = $user->data['user_sig_bbcode_bitfield']; + $preview_signature = phpbb::$user->data['user_sig']; + $preview_signature_uid = phpbb::$user->data['user_sig_bbcode_uid']; + $preview_signature_bitfield = phpbb::$user->data['user_sig_bbcode_bitfield']; // Signature if ($enable_sig && phpbb::$config['allow_sig'] && $preview_signature) @@ -807,11 +805,11 @@ function compose_pm($id, $mode, $action) $post_id = request_var('p', 0); 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"; + $message_link = "[url=" . generate_board_url() . '/viewtopic.' . PHP_EXT . '?p=' . $post_id . '#p' . $post_id . ']' . phpbb::$user->lang['SUBJECT'] . ': ' . $message_subject . "[/url]\n\n"; } else { - $message_link = $user->lang['SUBJECT'] . ': ' . $message_subject . " (" . generate_board_url() . '/viewtopic.' . PHP_EXT . "?p={$post_id}#p{$post_id})\n\n"; + $message_link = phpbb::$user->lang['SUBJECT'] . ': ' . $message_subject . " (" . generate_board_url() . '/viewtopic.' . PHP_EXT . "?p={$post_id}#p{$post_id})\n\n"; } } else @@ -840,11 +838,11 @@ function compose_pm($id, $mode, $action) } $forward_text = array(); - $forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE']; - $forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject)); - $forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time)); - $forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text); - $forward_text[] = sprintf($user->lang['FWD_TO'], implode(', ', $fwd_to_field['to'])); + $forward_text[] = phpbb::$user->lang['FWD_ORIGINAL_MESSAGE']; + $forward_text[] = sprintf(phpbb::$user->lang['FWD_SUBJECT'], censor_text($message_subject)); + $forward_text[] = sprintf(phpbb::$user->lang['FWD_DATE'], phpbb::$user->format_date($message_time)); + $forward_text[] = sprintf(phpbb::$user->lang['FWD_FROM'], $quote_username_text); + $forward_text[] = sprintf(phpbb::$user->lang['FWD_TO'], implode(', ', $fwd_to_field['to'])); $message_parser->message = implode("\n", $forward_text) . "\n\n[quote="{$quote_username}"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]"; $message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject); @@ -894,10 +892,10 @@ function compose_pm($id, $mode, $action) $sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON ( g.group_id = ug.group_id - AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND ug.user_pending = 0 ) - WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . phpbb::$user->data['user_id'] . ')'; } $sql .= ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' WHERE ' : ' AND '; @@ -919,7 +917,7 @@ function compose_pm($id, $mode, $action) { if ($type == 'g') { - $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['name']] : $row['name']; + $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['name']] : $row['name']; } ${$type}[$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); @@ -976,35 +974,35 @@ function compose_pm($id, $mode, $action) $s_hidden_address_field = build_address_field($address_list); - $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); + $bbcode_checked = (isset($enable_bbcode)) ? !$enable_bbcode : ((phpbb::$config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode')) ? !phpbb::$user->optionget('bbcode') : 1); + $smilies_checked = (isset($enable_smilies)) ? !$enable_smilies : ((phpbb::$config['allow_smilies'] && $auth->acl_get('u_pm_smilies')) ? !phpbb::$user->optionget('smilies') : 1); $urls_checked = (isset($enable_urls)) ? !$enable_urls : 0; $sig_checked = $enable_sig; switch ($action) { case 'post': - $page_title = $user->lang['POST_NEW_PM']; + $page_title = phpbb::$user->lang['POST_NEW_PM']; break; case 'quote': - $page_title = $user->lang['POST_QUOTE_PM']; + $page_title = phpbb::$user->lang['POST_QUOTE_PM']; break; case 'quotepost': - $page_title = $user->lang['POST_PM_POST']; + $page_title = phpbb::$user->lang['POST_PM_POST']; break; case 'reply': - $page_title = $user->lang['POST_REPLY_PM']; + $page_title = phpbb::$user->lang['POST_REPLY_PM']; break; case 'edit': - $page_title = $user->lang['POST_EDIT_PM']; + $page_title = phpbb::$user->lang['POST_EDIT_PM']; break; case 'forward': - $page_title = $user->lang['POST_FORWARD_PM']; + $page_title = phpbb::$user->lang['POST_FORWARD_PM']; break; default: @@ -1021,17 +1019,17 @@ function compose_pm($id, $mode, $action) // 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(phpbb::$config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval(phpbb::$config['max_post_chars'])) : '', + 'L_ICON' => phpbb::$user->lang['PM_ICON'], + 'L_MESSAGE_BODY_EXPLAIN' => (intval(phpbb::$config['max_post_chars'])) ? sprintf(phpbb::$user->lang['MESSAGE_BODY_EXPLAIN'], intval(phpbb::$config['max_post_chars'])) : '', 'SUBJECT' => (isset($message_subject)) ? $message_subject : '', 'MESSAGE' => $message_text, - 'BBCODE_STATUS' => ($bbcode_status) ? 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>'), - 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], - 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], - 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], - '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']), + 'BBCODE_STATUS' => ($bbcode_status) ? sprintf(phpbb::$user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf(phpbb::$user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), + 'IMG_STATUS' => ($img_status) ? phpbb::$user->lang['IMAGES_ARE_ON'] : phpbb::$user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($flash_status) ? phpbb::$user->lang['FLASH_IS_ON'] : phpbb::$user->lang['FLASH_IS_OFF'], + 'SMILIES_STATUS' => ($smilies_status) ? phpbb::$user->lang['SMILIES_ARE_ON'] : phpbb::$user->lang['SMILIES_ARE_OFF'], + 'URL_STATUS' => ($url_status) ? phpbb::$user->lang['URL_IS_ON'] : phpbb::$user->lang['URL_IS_OFF'], + 'MINI_POST_IMG' => phpbb::$user->img('icon_post_target', phpbb::$user->lang['PM']), 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'MAX_RECIPIENTS' => (phpbb::$config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0, @@ -1076,7 +1074,7 @@ function compose_pm($id, $mode, $action) // Message History if ($action == 'reply' || $action == 'quote' || $action == 'forward') { - if (message_history($msg_id, $user->data['user_id'], $post, array(), true)) + if (message_history($msg_id, phpbb::$user->data['user_id'], $post, array(), true)) { $template->assign_var('S_DISPLAY_HISTORY', true); } @@ -1088,8 +1086,6 @@ function compose_pm($id, $mode, $action) */ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove_g, $add_to, $add_bcc) { - global $auth, $db, $user; - // Delete User [TO/BCC] $remove_user_id = request_var('remove_u', array(0 => false)); if ($remove_u && sizeof($remove_user_id)) @@ -1152,7 +1148,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove // If there are users not existing, we will at least print a notice... if (!sizeof($user_id_ary)) { - $error[] = $user->lang['PM_NO_USERS']; + $error[] = phpbb::$user->lang['PM_NO_USERS']; } } @@ -1195,7 +1191,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove // print a notice about users not being added who do not want to receive pms if ($removed) { - $error[] = $user->lang['PM_USERS_REMOVED_NO_PM']; + $error[] = phpbb::$user->lang['PM_USERS_REMOVED_NO_PM']; } } } diff --git a/phpBB/modules/ucp/ucp_pm_options.php b/phpBB/modules/ucp/ucp_pm_options.php index 43e1c8713a..87b122de4c 100644 --- a/phpBB/modules/ucp/ucp_pm_options.php +++ b/phpBB/modules/ucp/ucp_pm_options.php @@ -21,8 +21,6 @@ if (!defined('IN_PHPBB')) */ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions) { - global $user, $template, $auth, $db; - $redirect_url = append_sid('ucp', "i=pm&mode=options"); add_form_key('ucp_pm_options'); @@ -56,12 +54,12 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_full_folder = ' . $set_folder_id . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); - $user->data['user_full_folder'] = $set_folder_id; + phpbb::$user->data['user_full_folder'] = $set_folder_id; - $message = $user->lang['FULL_FOLDER_OPTION_CHANGED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang['FULL_FOLDER_OPTION_CHANGED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); meta_refresh(3, $redirect_url); trigger_error($message); } @@ -80,19 +78,19 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'SELECT folder_name FROM ' . PRIVMSGS_FOLDER_TABLE . " WHERE folder_name = '" . $db->sql_escape($folder_name) . "' - AND user_id = " . $user->data['user_id']; + AND user_id = " . phpbb::$user->data['user_id']; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if ($row) { - trigger_error(sprintf($user->lang['FOLDER_NAME_EXIST'], $folder_name)); + trigger_error(sprintf(phpbb::$user->lang['FOLDER_NAME_EXIST'], $folder_name)); } $sql = 'SELECT COUNT(folder_id) as num_folder FROM ' . PRIVMSGS_FOLDER_TABLE . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $num_folder = (int) $db->sql_fetchfield('num_folder'); $db->sql_freeresult($result); @@ -103,18 +101,18 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit } $sql = 'INSERT INTO ' . PRIVMSGS_FOLDER_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'user_id' => (int) $user->data['user_id'], + 'user_id' => (int) phpbb::$user->data['user_id'], 'folder_name' => $folder_name) ); $db->sql_query($sql); - $msg = $user->lang['FOLDER_ADDED']; + $msg = phpbb::$user->lang['FOLDER_ADDED']; } } else { - $msg = $user->lang['FORM_INVALID']; + $msg = phpbb::$user->lang['FORM_INVALID']; } - $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); + $message = $msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); meta_refresh(3, $redirect_url); trigger_error($message); } @@ -134,8 +132,8 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Select custom folder $sql = 'SELECT folder_name, pm_count - FROM ' . PRIVMSGS_FOLDER_TABLE . " - WHERE user_id = {$user->data['user_id']} + FROM ' . PRIVMSGS_FOLDER_TABLE . ' + WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND folder_id = $rename_folder_id"; $result = $db->sql_query_limit($sql, 1); $folder_row = $db->sql_fetchrow($result); @@ -149,16 +147,16 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . " SET folder_name = '" . $db->sql_escape($new_folder_name) . "' WHERE folder_id = $rename_folder_id - AND user_id = {$user->data['user_id']}"; + AND user_id = " . phpbb::$user->data['user_id']; $db->sql_query($sql); - $msg = $user->lang['FOLDER_RENAMED']; + $msg = phpbb::$user->lang['FOLDER_RENAMED']; } else { - $msg = $user->lang['FORM_INVALID']; + $msg = phpbb::$user->lang['FORM_INVALID']; } - $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); + $message = $msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); meta_refresh(3, $redirect_url); trigger_error($message); @@ -181,8 +179,8 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Select custom folder $sql = 'SELECT folder_name, pm_count - FROM ' . PRIVMSGS_FOLDER_TABLE . " - WHERE user_id = {$user->data['user_id']} + FROM ' . PRIVMSGS_FOLDER_TABLE . ' + WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND folder_id = $remove_folder_id"; $result = $db->sql_query_limit($sql, 1); $folder_row = $db->sql_fetchrow($result); @@ -206,7 +204,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Gather message ids $sql = 'SELECT msg_id FROM ' . PRIVMSGS_TO_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . " + WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND folder_id = $remove_folder_id"; $result = $db->sql_query($sql); @@ -222,36 +220,36 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit { // Move Messages case 1: - $num_moved = move_pm($user->data['user_id'], $user->data['message_limit'], $msg_ids, $move_to, $remove_folder_id); + $num_moved = move_pm(phpbb::$user->data['user_id'], phpbb::$user->data['message_limit'], $msg_ids, $move_to, $remove_folder_id); // Something went wrong, only partially moved? if ($num_moved != $folder_row['pm_count']) { - trigger_error(sprintf($user->lang['MOVE_PM_ERROR'], $num_moved, $folder_row['pm_count'])); + trigger_error(sprintf(phpbb::$user->lang['MOVE_PM_ERROR'], $num_moved, $folder_row['pm_count'])); } break; // Remove Messages case 2: - delete_pm($user->data['user_id'], $msg_ids, $remove_folder_id); + delete_pm(phpbb::$user->data['user_id'], $msg_ids, $remove_folder_id); break; } // Remove folder - $sql = 'DELETE FROM ' . PRIVMSGS_FOLDER_TABLE . " - WHERE user_id = {$user->data['user_id']} + $sql = 'DELETE FROM ' . PRIVMSGS_FOLDER_TABLE . ' + WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND folder_id = $remove_folder_id"; $db->sql_query($sql); // Check full folder option. If the removed folder has been specified as destination switch back to inbox - if ($user->data['user_full_folder'] == $remove_folder_id) + if (phpbb::$user->data['user_full_folder'] == $remove_folder_id) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_full_folder = ' . PRIVMSGS_INBOX . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); - $user->data['user_full_folder'] = PRIVMSGS_INBOX; + phpbb::$user->data['user_full_folder'] = PRIVMSGS_INBOX; } // Now make sure the folder is not used for rules @@ -263,10 +261,10 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $db->sql_query($sql); $meta_info = append_sid('ucp', "i=pm&mode=$mode"); - $message = $user->lang['FOLDER_REMOVED']; + $message = phpbb::$user->lang['FOLDER_REMOVED']; meta_refresh(3, $meta_info); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $meta_info . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $meta_info . '">', '</a>'); trigger_error($message); } else @@ -302,7 +300,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit } $rule_ary = array( - 'user_id' => $user->data['user_id'], + 'user_id' => phpbb::$user->data['user_id'], 'rule_check' => $check_option, 'rule_connection' => $rule_option, 'rule_string' => $rule_string, @@ -330,16 +328,16 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Update users message rules $sql = 'UPDATE ' . USERS_TABLE . ' SET user_message_rules = 1 - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); - $msg = $user->lang['RULE_ADDED']; + $msg = phpbb::$user->lang['RULE_ADDED']; } else { - $msg = $user->lang['FORM_INVALID']; + $msg = phpbb::$user->lang['FORM_INVALID']; } - $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); + $message = $msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); meta_refresh(3, $redirect_url); trigger_error($message); } @@ -359,17 +357,17 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit if (confirm_box(true)) { $sql = 'DELETE FROM ' . PRIVMSGS_RULES_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . " + WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND rule_id = $delete_id"; $db->sql_query($sql); $meta_info = append_sid('ucp', 'i=pm&mode=' . $mode); - $message = $user->lang['RULE_DELETED']; + $message = phpbb::$user->lang['RULE_DELETED']; // Reset user_message_rules if no more assigned $sql = 'SELECT rule_id FROM ' . PRIVMSGS_RULES_TABLE . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -379,12 +377,12 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_message_rules = 0 - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); } meta_refresh(3, $meta_info); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $meta_info . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $meta_info . '">', '</a>'); trigger_error($message); } else @@ -397,20 +395,20 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'SELECT COUNT(msg_id) as num_messages FROM ' . PRIVMSGS_TO_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . ' + WHERE user_id = ' . phpbb::$user->data['user_id'] . ' AND folder_id = ' . PRIVMSGS_INBOX; $result = $db->sql_query($sql); $num_messages = (int) $db->sql_fetchfield('num_messages'); $db->sql_freeresult($result); $folder[PRIVMSGS_INBOX] = array( - 'folder_name' => $user->lang['PM_INBOX'], - 'message_status' => sprintf($user->lang['FOLDER_MESSAGE_STATUS'], $num_messages, $user->data['message_limit']) + 'folder_name' => phpbb::$user->lang['PM_INBOX'], + 'message_status' => sprintf(phpbb::$user->lang['FOLDER_MESSAGE_STATUS'], $num_messages, phpbb::$user->data['message_limit']) ); $sql = 'SELECT folder_id, folder_name, pm_count FROM ' . PRIVMSGS_FOLDER_TABLE . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $num_user_folder = 0; @@ -419,26 +417,26 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $num_user_folder++; $folder[$row['folder_id']] = array( 'folder_name' => $row['folder_name'], - 'message_status' => sprintf($user->lang['FOLDER_MESSAGE_STATUS'], $row['pm_count'], $user->data['message_limit']) + 'message_status' => sprintf(phpbb::$user->lang['FOLDER_MESSAGE_STATUS'], $row['pm_count'], phpbb::$user->data['message_limit']) ); } $db->sql_freeresult($result); $s_full_folder_options = $s_to_folder_options = $s_folder_options = ''; - if ($user->data['user_full_folder'] == FULL_FOLDER_NONE) + if (phpbb::$user->data['user_full_folder'] == FULL_FOLDER_NONE) { // -3 here to let the correct folder id be selected $to_folder_id = phpbb::$config['full_folder_action'] - 3; } else { - $to_folder_id = $user->data['user_full_folder']; + $to_folder_id = phpbb::$user->data['user_full_folder']; } foreach ($folder as $folder_id => $folder_ary) { - $s_full_folder_options .= '<option value="' . $folder_id . '"' . (($user->data['user_full_folder'] == $folder_id) ? ' selected="selected"' : '') . '>' . $folder_ary['folder_name'] . ' (' . $folder_ary['message_status'] . ')</option>'; + $s_full_folder_options .= '<option value="' . $folder_id . '"' . ((phpbb::$user->data['user_full_folder'] == $folder_id) ? ' selected="selected"' : '') . '>' . $folder_ary['folder_name'] . ' (' . $folder_ary['message_status'] . ')</option>'; $s_to_folder_options .= '<option value="' . $folder_id . '"' . (($to_folder_id == $folder_id) ? ' selected="selected"' : '') . '>' . $folder_ary['folder_name'] . ' (' . $folder_ary['message_status'] . ')</option>'; if ($folder_id != PRIVMSGS_INBOX) @@ -447,11 +445,11 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit } } - $s_delete_checked = ($user->data['user_full_folder'] == FULL_FOLDER_DELETE) ? ' checked="checked"' : ''; - $s_hold_checked = ($user->data['user_full_folder'] == FULL_FOLDER_HOLD) ? ' checked="checked"' : ''; - $s_move_checked = ($user->data['user_full_folder'] >= 0) ? ' checked="checked"' : ''; + $s_delete_checked = (phpbb::$user->data['user_full_folder'] == FULL_FOLDER_DELETE) ? ' checked="checked"' : ''; + $s_hold_checked = (phpbb::$user->data['user_full_folder'] == FULL_FOLDER_HOLD) ? ' checked="checked"' : ''; + $s_move_checked = (phpbb::$user->data['user_full_folder'] >= 0) ? ' checked="checked"' : ''; - if ($user->data['user_full_folder'] == FULL_FOLDER_NONE) + if (phpbb::$user->data['user_full_folder'] == FULL_FOLDER_NONE) { switch (phpbb::$config['full_folder_action']) { @@ -475,7 +473,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit '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' => (phpbb::$config['full_folder_action'] == 1) ? $user->lang['DELETE_OLDEST_MESSAGES'] : $user->lang['HOLD_NEW_MESSAGES'], + 'DEFAULT_ACTION' => (phpbb::$config['full_folder_action'] == 1) ? phpbb::$user->lang['DELETE_OLDEST_MESSAGES'] : phpbb::$user->lang['HOLD_NEW_MESSAGES'], 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=ucp&field=rule_string&select_single=true'), )); @@ -483,7 +481,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $rule_lang = $action_lang = $check_lang = array(); // Build all three language arrays - preg_replace('#^((RULE|ACTION|CHECK)_([A-Z0-9_]+))$#e', "\${strtolower('\\2') . '_lang'}[constant('\\1')] = \$user->lang['PM_\\2']['\\3']", array_keys(get_defined_constants())); + preg_replace('#^((RULE|ACTION|CHECK)_([A-Z0-9_]+))$#e', "\${strtolower('\\2') . '_lang'}[constant('\\1')] = phpbb::\$user->lang['PM_\\2']['\\3']", array_keys(get_defined_constants())); /* Rule Ordering: @@ -552,7 +550,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit define_action_option(false, $action_option, $action_lang, $folder); } - show_defined_rules($user->data['user_id'], $check_lang, $rule_lang, $action_lang, $folder); + show_defined_rules(phpbb::$user->data['user_id'], $check_lang, $rule_lang, $action_lang, $folder); } /** @@ -560,8 +558,6 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit */ function define_check_option($hardcoded, $check_option, $check_lang) { - global $template; - $s_check_options = ''; if (!$hardcoded) { @@ -585,8 +581,6 @@ function define_check_option($hardcoded, $check_option, $check_lang) */ function define_action_option($hardcoded, $action_option, $action_lang, $folder) { - global $db, $template, $user; - $l_action = $s_action_options = ''; if ($hardcoded) { @@ -632,8 +626,6 @@ function define_action_option($hardcoded, $action_option, $action_lang, $folder) */ function define_rule_option($hardcoded, $rule_option, $rule_lang, $check_ary) { - global $template; - $s_rule_options = ''; if (!$hardcoded) { @@ -657,8 +649,6 @@ function define_rule_option($hardcoded, $rule_option, $rule_lang, $check_ary) */ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule_conditions) { - global $db, $template, $auth, $user; - $template->assign_vars(array( 'S_COND_DEFINED' => true, 'S_COND_SELECT' => (!$hardcoded && isset($global_rule_conditions[$rule_option])) ? true : false) @@ -748,10 +738,10 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule $sql .= 'LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON ( g.group_id = ug.group_id - AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND ug.user_pending = 0 ) - WHERE (ug.user_id = ' . $user->data['user_id'] . ' OR g.group_type <> ' . GROUP_HIDDEN . ') + WHERE (ug.user_id = ' . phpbb::$user->data['user_id'] . ' OR g.group_type <> ' . GROUP_HIDDEN . ') AND'; } else @@ -769,13 +759,13 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule { if ($rule_group_id && ($row['group_id'] == $rule_group_id)) { - $rule_string = (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']); + $rule_string = (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']); } $s_class = ($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : ''; $s_selected = ($row['group_id'] == $rule_group_id) ? ' selected="selected"' : ''; - $s_group_options .= '<option value="' . $row['group_id'] . '"' . $s_class . $s_selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $s_group_options .= '<option value="' . $row['group_id'] . '"' . $s_class . $s_selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } $db->sql_freeresult($result); @@ -805,8 +795,6 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule */ function show_defined_rules($user_id, $check_lang, $rule_lang, $action_lang, $folder) { - global $db, $template; - $sql = 'SELECT * FROM ' . PRIVMSGS_RULES_TABLE . ' WHERE user_id = ' . $user_id . ' diff --git a/phpBB/modules/ucp/ucp_pm_viewfolder.php b/phpBB/modules/ucp/ucp_pm_viewfolder.php index 7c5c2480c2..2f67da5e7f 100644 --- a/phpBB/modules/ucp/ucp_pm_viewfolder.php +++ b/phpBB/modules/ucp/ucp_pm_viewfolder.php @@ -22,15 +22,13 @@ if (!defined('IN_PHPBB')) */ function view_folder($id, $mode, $folder_id, $folder) { - global $user, $template, $auth, $db; - $submit_export = phpbb_request::is_set_post('submit_export'); - $folder_info = get_pm_from($folder_id, $folder, $user->data['user_id']); + $folder_info = get_pm_from($folder_id, $folder, phpbb::$user->data['user_id']); if (!$submit_export) { - $user->add_lang('viewforum'); + phpbb::$user->add_lang('viewforum'); // Grab icons $icons = phpbb_cache::obtain_icons(); @@ -56,9 +54,9 @@ function view_folder($id, $mode, $folder_id, $folder) foreach ($color_rows as $var) { $template->assign_block_vars('pm_colour_info', array( - 'IMG' => $user->img("pm_{$var}", ''), + 'IMG' => phpbb::$user->img("pm_{$var}", ''), 'CLASS' => "pm_{$var}_colour", - 'LANG' => $user->lang[strtoupper($var) . '_MESSAGE']) + 'LANG' => phpbb::$user->lang[strtoupper($var) . '_MESSAGE']) ); } @@ -67,7 +65,7 @@ function view_folder($id, $mode, $folder_id, $folder) $s_mark_options = ''; foreach ($mark_options as $mark_option) { - $s_mark_options .= '<option value="' . $mark_option . '">' . $user->lang[strtoupper($mark_option)] . '</option>'; + $s_mark_options .= '<option value="' . $mark_option . '">' . phpbb::$user->lang[strtoupper($mark_option)] . '</option>'; } // We do the folder moving options here too, for template authors to use... @@ -82,7 +80,7 @@ function view_folder($id, $mode, $folder_id, $folder) } $s_folder_move_options .= '<option' . (($f_id != PRIVMSGS_INBOX) ? ' class="sep"' : '') . ' value="' . $f_id . '">'; - $s_folder_move_options .= sprintf($user->lang['MOVE_MARKED_TO_FOLDER'], $folder_ary['folder_name']); + $s_folder_move_options .= sprintf(phpbb::$user->lang['MOVE_MARKED_TO_FOLDER'], $folder_ary['folder_name']); $s_folder_move_options .= (($folder_ary['unread_messages']) ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . '</option>'; } } @@ -91,7 +89,7 @@ function view_folder($id, $mode, $folder_id, $folder) // Get friends and foes $sql = 'SELECT * FROM ' . ZEBRA_TABLE . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -126,7 +124,7 @@ function view_folder($id, $mode, $folder_id, $folder) { foreach (array_keys($address[$message_id][$save]) as $ug_id) { - $recipient_list[$save][$ug_id] = array('name' => $user->lang['NA'], 'colour' => ''); + $recipient_list[$save][$ug_id] = array('name' => phpbb::$user->lang['NA'], 'colour' => ''); } } } @@ -157,7 +155,7 @@ function view_folder($id, $mode, $folder_id, $folder) { if ($ug_type == 'g') { - $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['name']] : $row['name']; + $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['name']] : $row['name']; } $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); @@ -224,16 +222,16 @@ function view_folder($id, $mode, $folder_id, $folder) 'FOLDER_ID' => $folder_id, 'MESSAGE_ID' => $message_id, - 'SENT_TIME' => $user->format_date($row['message_time']), + 'SENT_TIME' => phpbb::$user->format_date($row['message_time']), '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="' . 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'] && phpbb::$config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), + 'FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, 'src'), + 'PM_IMG' => ($row_indicator) ? phpbb::$user->img('pm_' . $row_indicator, '') : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && phpbb::$config['allow_pm_attach']) ? phpbb::$user->img('icon_topic_attach', 'TOTAL_ATTACHMENTS') : '', 'S_PM_DELETED' => ($row['pm_deleted']) ? true : false, 'S_AUTHOR_DELETED' => ($row['author_id'] == ANONYMOUS) ? true : false, @@ -283,7 +281,7 @@ function view_folder($id, $mode, $folder_id, $folder) $sql = 'SELECT p.message_text, p.bbcode_uid FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u - WHERE t.user_id = ' . $user->data['user_id'] . " + WHERE t.user_id = ' . phpbb::$user->data['user_id'] . " AND p.author_id = u.user_id AND t.folder_id = $folder_id AND t.msg_id = p.msg_id @@ -327,7 +325,7 @@ function view_folder($id, $mode, $folder_id, $folder) $data[] = array( 'subject' => censor_text($row['message_subject']), 'sender' => $row['username'], - 'date' => $user->format_date($row['message_time']), + 'date' => phpbb::$user->format_date($row['message_time']), 'to' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? $address[$message_id] : '', 'message' => $message_row['message_text'] ); @@ -438,8 +436,6 @@ function view_folder($id, $mode, $folder_id, $folder) */ function get_pm_from($folder_id, $folder, $user_id) { - global $user, $db, $template, $auth; - $start = request_var('start', 0); // Additional vars later, pm ordering is mostly different from post ordering. :/ @@ -448,18 +444,18 @@ function get_pm_from($folder_id, $folder, $user_id) $sort_dir = request_var('sd', 'd'); // PM ordering options - $limit_days = array(0 => $user->lang['ALL_MESSAGES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $limit_days = array(0 => phpbb::$user->lang['ALL_MESSAGES'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); // No sort by Author for sentbox/outbox (already only author available) // Also, sort by msg_id for the time - private messages are not as prone to errors as posts are. if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) { - $sort_by_text = array('t' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_text = array('t' => phpbb::$user->lang['POST_TIME'], 's' => phpbb::$user->lang['SUBJECT']); $sort_by_sql = array('t' => 'p.msg_id', 's' => 'p.message_subject'); } else { - $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_text = array('a' => phpbb::$user->lang['AUTHOR'], 't' => phpbb::$user->lang['POST_TIME'], 's' => phpbb::$user->lang['SUBJECT']); $sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.msg_id', 's' => 'p.message_subject'); } @@ -499,11 +495,11 @@ 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, 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)), + 'TOTAL_MESSAGES' => (($pm_count == 1) ? phpbb::$user->lang['VIEW_PM_MESSAGE'] : sprintf(phpbb::$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'), + 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? phpbb::$user->img('button_topic_locked', 'PM_LOCKED') : phpbb::$user->img('button_pm_new', 'POST_PM'), - 'L_NO_MESSAGES' => (!$auth->acl_get('u_sendpm')) ? $user->lang['POST_PM_LOCKED'] : $user->lang['NO_MESSAGES'], + 'L_NO_MESSAGES' => (!$auth->acl_get('u_sendpm')) ? phpbb::$user->lang['POST_PM_LOCKED'] : phpbb::$user->lang['NO_MESSAGES'], 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, diff --git a/phpBB/modules/ucp/ucp_pm_viewmessage.php b/phpBB/modules/ucp/ucp_pm_viewmessage.php index 793e9078a2..c5f3d6750e 100644 --- a/phpBB/modules/ucp/ucp_pm_viewmessage.php +++ b/phpBB/modules/ucp/ucp_pm_viewmessage.php @@ -23,7 +23,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) { global $user, $template, $auth, $db; - $user->add_lang(array('viewtopic', 'memberlist')); + phpbb::$user->add_lang(array('viewtopic', 'memberlist')); $msg_id = (int) $msg_id; $folder_id = (int) $folder_id; @@ -33,9 +33,9 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) if ($message_row['pm_deleted']) { $meta_info = append_sid('ucp', "i=pm&folder=$folder_id"); - $message = $user->lang['NO_AUTH_READ_REMOVED_MESSAGE']; + $message = phpbb::$user->lang['NO_AUTH_READ_REMOVED_MESSAGE']; - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>'); trigger_error($message); } @@ -81,8 +81,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // Editing information 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']); + $l_edit_time_total = ($message_row['message_edit_count'] == 1) ? phpbb::$user->lang['EDITED_TIME_TOTAL'] : phpbb::$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'], phpbb::$user->format_date($message_row['message_edit_time'], false, true), $message_row['message_edit_count']); } else { @@ -143,7 +143,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $user_info['sig'] = ''; - $signature = ($message_row['enable_sig'] && phpbb::$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') && phpbb::$user->optionget('viewsigs')) ? $user_info['user_sig'] : ''; // End signature parsing, only if needed if ($signature) @@ -176,22 +176,22 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'RANK_TITLE' => $user_info['rank_title'], 'RANK_IMG' => $user_info['rank_image'], 'AUTHOR_AVATAR' => (isset($user_info['avatar'])) ? $user_info['avatar'] : '', - 'AUTHOR_JOINED' => $user->format_date($user_info['user_regdate']), + 'AUTHOR_JOINED' => phpbb::$user->format_date($user_info['user_regdate']), 'AUTHOR_POSTS' => (!empty($user_info['user_posts'])) ? $user_info['user_posts'] : '', 'AUTHOR_FROM' => (!empty($user_info['user_from'])) ? $user_info['user_from'] : '', - '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'])), + 'ONLINE_IMG' => (!phpbb::$config['load_onlinetrack']) ? '' : ((isset($user_info['online']) && $user_info['online']) ? phpbb::$user->img('icon_user_online', 'ONLINE') : phpbb::$user->img('icon_user_offline', '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']), - 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['SEND_EMAIL']), - 'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['POST_QUOTE_PM']), - 'REPLY_IMG' => $user->img('button_pm_reply', $user->lang['POST_REPLY_PM']), - 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['POST_EDIT_PM']), - 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), - - 'SENT_DATE' => $user->format_date($message_row['message_time']), + 'DELETE_IMG' => phpbb::$user->img('icon_post_delete', 'DELETE_MESSAGE'), + 'INFO_IMG' => phpbb::$user->img('icon_post_info', 'VIEW_PM_INFO'), + 'PROFILE_IMG' => phpbb::$user->img('icon_user_profile', 'READ_PROFILE'), + 'EMAIL_IMG' => phpbb::$user->img('icon_contact_email', 'SEND_EMAIL'), + 'QUOTE_IMG' => phpbb::$user->img('icon_post_quote', 'POST_QUOTE_PM'), + 'REPLY_IMG' => phpbb::$user->img('button_pm_reply', 'POST_REPLY_PM'), + 'EDIT_IMG' => phpbb::$user->img('icon_post_edit', 'POST_EDIT_PM'), + 'MINI_POST_IMG' => phpbb::$user->img('icon_post_target', 'PM'), + + 'SENT_DATE' => phpbb::$user->format_date($message_row['message_time']), 'SUBJECT' => $message_row['message_subject'], 'MESSAGE' => $message, 'SIGNATURE' => ($message_row['enable_sig']) ? $signature : '', @@ -237,7 +237,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) if (request_var('view', '') != 'print') { // Message History - if (message_history($msg_id, $user->data['user_id'], $message_row, $folder)) + if (message_history($msg_id, phpbb::$user->data['user_id'], $message_row, $folder)) { $template->assign_var('S_DISPLAY_HISTORY', true); } @@ -293,7 +293,7 @@ function get_user_information($user_id, $user_row) include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); } - $user_row['avatar'] = ($user->optionget('viewavatars')) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : ''; + $user_row['avatar'] = (phpbb::$user->optionget('viewavatars')) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : ''; get_user_rank($user_id, $user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']); diff --git a/phpBB/modules/ucp/ucp_prefs.php b/phpBB/modules/ucp/ucp_prefs.php index 3c4cb354d7..ea4f6db861 100644 --- a/phpBB/modules/ucp/ucp_prefs.php +++ b/phpBB/modules/ucp/ucp_prefs.php @@ -27,8 +27,6 @@ class ucp_prefs function main($id, $mode) { - global $db, $user, $auth, $template; - $submit = phpbb_request::is_set_post('submit'); $error = $data = array(); $s_hidden_fields = ''; @@ -38,22 +36,22 @@ class ucp_prefs case 'personal': add_form_key('ucp_prefs_personal'); $data = array( - 'notifymethod' => request_var('notifymethod', $user->data['user_notify_type']), - 'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true), - 'lang' => basename(request_var('lang', $user->data['user_lang'])), - 'style' => request_var('style', (int) $user->data['user_style']), - 'tz' => request_var('tz', (float) $user->data['user_timezone']), - - 'dst' => request_var('dst', (bool) $user->data['user_dst']), - 'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']), - 'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']), - 'hideonline' => request_var('hideonline', (bool) !$user->data['user_allow_viewonline']), - 'notifypm' => request_var('notifypm', (bool) $user->data['user_notify_pm']), - 'popuppm' => request_var('popuppm', (bool) $user->optionget('popuppm')), - 'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']), + 'notifymethod' => request_var('notifymethod', phpbb::$user->data['user_notify_type']), + 'dateformat' => request_var('dateformat', phpbb::$user->data['user_dateformat'], true), + 'lang' => basename(request_var('lang', phpbb::$user->data['user_lang'])), + 'style' => request_var('style', (int) phpbb::$user->data['user_style']), + 'tz' => request_var('tz', (float) phpbb::$user->data['user_timezone']), + + 'dst' => request_var('dst', (bool) phpbb::$user->data['user_dst']), + 'viewemail' => request_var('viewemail', (bool) phpbb::$user->data['user_allow_viewemail']), + 'massemail' => request_var('massemail', (bool) phpbb::$user->data['user_allow_massemail']), + 'hideonline' => request_var('hideonline', (bool) !phpbb::$user->data['user_allow_viewonline']), + 'notifypm' => request_var('notifypm', (bool) phpbb::$user->data['user_notify_pm']), + 'popuppm' => request_var('popuppm', (bool) phpbb::$user->optionget('popuppm')), + 'allowpm' => request_var('allowpm', (bool) phpbb::$user->data['user_allow_pm']), ); - if ($data['notifymethod'] == NOTIFY_IM && (!phpbb::$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml'))) + if ($data['notifymethod'] == NOTIFY_IM && (!phpbb::$config['jab_enable'] || !phpbb::$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; @@ -76,16 +74,16 @@ class ucp_prefs if (!sizeof($error)) { - $user->optionset('popuppm', $data['popuppm']); + phpbb::$user->optionset('popuppm', $data['popuppm']); $sql_ary = array( 'user_allow_pm' => $data['allowpm'], 'user_allow_viewemail' => $data['viewemail'], 'user_allow_massemail' => $data['massemail'], - 'user_allow_viewonline' => ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : $user->data['user_allow_viewonline'], + 'user_allow_viewonline' => ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : phpbb::$user->data['user_allow_viewonline'], 'user_notify_type' => $data['notifymethod'], 'user_notify_pm' => $data['notifypm'], - 'user_options' => $user->data['user_options'], + 'user_options' => phpbb::$user->data['user_options'], 'user_dst' => $data['dst'], 'user_dateformat' => $data['dateformat'], @@ -96,36 +94,36 @@ class ucp_prefs $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); meta_refresh(3, $this->u_action); - $message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = phpbb::$user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } $dateformat_options = ''; - foreach ($user->lang['dateformats'] as $format => $null) + foreach (phpbb::$user->lang['dateformats'] as $format => $null) { $dateformat_options .= '<option value="' . $format . '"' . (($format == $data['dateformat']) ? ' selected="selected"' : '') . '>'; - $dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : ''); + $dateformat_options .= phpbb::$user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? phpbb::$user->lang['VARIANT_DATE_SEPARATOR'] . phpbb::$user->format_date(time(), $format, true) : ''); $dateformat_options .= '</option>'; } $s_custom = false; $dateformat_options .= '<option value="custom"'; - if (!isset($user->lang['dateformats'][$data['dateformat']])) + if (!isset(phpbb::$user->lang['dateformats'][$data['dateformat']])) { $dateformat_options .= ' selected="selected"'; $s_custom = true; } - $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; + $dateformat_options .= '>' . phpbb::$user->lang['CUSTOM_DATEFORMAT'] . '</option>'; $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', @@ -152,7 +150,7 @@ class ucp_prefs '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' => (phpbb::$config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false) + 'S_SELECT_NOTIFY' => (phpbb::$config['jab_enable'] && phpbb::$user->data['user_jabber'] && @extension_loaded('xml')) ? true : false) ); break; @@ -162,20 +160,20 @@ class ucp_prefs add_form_key('ucp_prefs_view'); $data = array( - 'topic_sk' => request_var('topic_sk', (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'), - 'topic_sd' => request_var('topic_sd', (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'), - 'topic_st' => request_var('topic_st', (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0), - - 'post_sk' => request_var('post_sk', (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'), - 'post_sd' => request_var('post_sd', (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'), - 'post_st' => request_var('post_st', (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0), - - 'images' => request_var('images', (bool) $user->optionget('viewimg')), - 'flash' => request_var('flash', (bool) $user->optionget('viewflash')), - 'smilies' => request_var('smilies', (bool) $user->optionget('viewsmilies')), - 'sigs' => request_var('sigs', (bool) $user->optionget('viewsigs')), - 'avatars' => request_var('avatars', (bool) $user->optionget('viewavatars')), - 'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')), + 'topic_sk' => request_var('topic_sk', (!empty(phpbb::$user->data['user_topic_sortby_type'])) ? phpbb::$user->data['user_topic_sortby_type'] : 't'), + 'topic_sd' => request_var('topic_sd', (!empty(phpbb::$user->data['user_topic_sortby_dir'])) ? phpbb::$user->data['user_topic_sortby_dir'] : 'd'), + 'topic_st' => request_var('topic_st', (!empty(phpbb::$user->data['user_topic_show_days'])) ? phpbb::$user->data['user_topic_show_days'] : 0), + + 'post_sk' => request_var('post_sk', (!empty(phpbb::$user->data['user_post_sortby_type'])) ? phpbb::$user->data['user_post_sortby_type'] : 't'), + 'post_sd' => request_var('post_sd', (!empty(phpbb::$user->data['user_post_sortby_dir'])) ? phpbb::$user->data['user_post_sortby_dir'] : 'a'), + 'post_st' => request_var('post_st', (!empty(phpbb::$user->data['user_post_show_days'])) ? phpbb::$user->data['user_post_show_days'] : 0), + + 'images' => request_var('images', (bool) phpbb::$user->optionget('viewimg')), + 'flash' => request_var('flash', (bool) phpbb::$user->optionget('viewflash')), + 'smilies' => request_var('smilies', (bool) phpbb::$user->optionget('viewsmilies')), + 'sigs' => request_var('sigs', (bool) phpbb::$user->optionget('viewsigs')), + 'avatars' => request_var('avatars', (bool) phpbb::$user->optionget('viewavatars')), + 'wordcensor' => request_var('wordcensor', (bool) phpbb::$user->optionget('viewcensors')), ); if ($submit) @@ -194,19 +192,19 @@ class ucp_prefs if (!sizeof($error)) { - $user->optionset('viewimg', $data['images']); - $user->optionset('viewflash', $data['flash']); - $user->optionset('viewsmilies', $data['smilies']); - $user->optionset('viewsigs', $data['sigs']); - $user->optionset('viewavatars', $data['avatars']); + phpbb::$user->optionset('viewimg', $data['images']); + phpbb::$user->optionset('viewflash', $data['flash']); + phpbb::$user->optionset('viewsmilies', $data['smilies']); + phpbb::$user->optionset('viewsigs', $data['sigs']); + phpbb::$user->optionset('viewavatars', $data['avatars']); if ($auth->acl_get('u_chgcensors')) { - $user->optionset('viewcensors', $data['wordcensor']); + phpbb::$user->optionset('viewcensors', $data['wordcensor']); } $sql_ary = array( - 'user_options' => $user->data['user_options'], + 'user_options' => phpbb::$user->data['user_options'], 'user_topic_sortby_type' => $data['topic_sk'], 'user_post_sortby_type' => $data['post_sk'], 'user_topic_sortby_dir' => $data['topic_sd'], @@ -218,30 +216,30 @@ class ucp_prefs $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); meta_refresh(3, $this->u_action); - $message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = phpbb::$user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } - $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + $sort_dir_text = array('a' => phpbb::$user->lang['ASCENDING'], 'd' => phpbb::$user->lang['DESCENDING']); // Topic ordering options - $limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $limit_topic_days = array(0 => phpbb::$user->lang['ALL_TOPICS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); - $sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); + $sort_by_topic_text = array('a' => phpbb::$user->lang['AUTHOR'], 't' => phpbb::$user->lang['POST_TIME'], 'r' => phpbb::$user->lang['REPLIES'], 's' => phpbb::$user->lang['SUBJECT'], 'v' => phpbb::$user->lang['VIEWS']); $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); // Post ordering options - $limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $limit_post_days = array(0 => phpbb::$user->lang['ALL_POSTS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); - $sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_post_text = array('a' => phpbb::$user->lang['AUTHOR'], 't' => phpbb::$user->lang['POST_TIME'], 's' => phpbb::$user->lang['SUBJECT']); $sort_by_post_sql = array('a' => 'u.username_clean', 't' => 'p.post_id', 's' => 'p.post_subject'); $_options = array('topic', 'post'); @@ -297,10 +295,10 @@ class ucp_prefs case 'post': $data = array( - 'bbcode' => request_var('bbcode', $user->optionget('bbcode')), - 'smilies' => request_var('smilies', $user->optionget('smilies')), - 'sig' => request_var('sig', $user->optionget('attachsig')), - 'notify' => request_var('notify', (bool) $user->data['user_notify']), + 'bbcode' => request_var('bbcode', phpbb::$user->optionget('bbcode')), + 'smilies' => request_var('smilies', phpbb::$user->optionget('smilies')), + 'sig' => request_var('sig', phpbb::$user->optionget('attachsig')), + 'notify' => request_var('notify', (bool) phpbb::$user->data['user_notify']), ); add_form_key('ucp_prefs_post'); @@ -308,28 +306,28 @@ class ucp_prefs { if (check_form_key('ucp_prefs_post')) { - $user->optionset('bbcode', $data['bbcode']); - $user->optionset('smilies', $data['smilies']); - $user->optionset('attachsig', $data['sig']); + phpbb::$user->optionset('bbcode', $data['bbcode']); + phpbb::$user->optionset('smilies', $data['smilies']); + phpbb::$user->optionset('attachsig', $data['sig']); $sql_ary = array( - 'user_options' => $user->data['user_options'], + 'user_options' => phpbb::$user->data['user_options'], 'user_notify' => $data['notify'], ); $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); - $msg = $user->lang['PREFERENCES_UPDATED']; + $msg = phpbb::$user->lang['PREFERENCES_UPDATED']; } else { - $msg = $user->lang['FORM_INVALID']; + $msg = phpbb::$user->lang['FORM_INVALID']; } meta_refresh(3, $this->u_action); - $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = $msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } @@ -343,7 +341,7 @@ class ucp_prefs } $template->assign_vars(array( - 'L_TITLE' => $user->lang['UCP_PREFS_' . strtoupper($mode)], + 'L_TITLE' => phpbb::$user->lang['UCP_PREFS_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $this->u_action) diff --git a/phpBB/modules/ucp/ucp_profile.php b/phpBB/modules/ucp/ucp_profile.php index d95c0fa560..298022e70f 100644 --- a/phpBB/modules/ucp/ucp_profile.php +++ b/phpBB/modules/ucp/ucp_profile.php @@ -29,9 +29,7 @@ class ucp_profile function main($id, $mode) { - global $db, $user, $auth, $template; - - $user->add_lang('posting'); + phpbb::$user->add_lang('posting'); $preview = phpbb_request::variable('preview', false, false, phpbb_request::POST); $submit = phpbb_request::variable('submit', false, false, phpbb_request::POST); @@ -44,8 +42,8 @@ class ucp_profile case 'reg_details': $data = array( - 'username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)), - 'email' => strtolower(request_var('email', $user->data['user_email'])), + 'username' => utf8_normalize_nfc(request_var('username', phpbb::$user->data['username'], true)), + 'email' => strtolower(request_var('email', phpbb::$user->data['user_email'])), 'email_confirm' => strtolower(request_var('email_confirm', '')), 'new_password' => request_var('new_password', '', true), 'cur_password' => request_var('cur_password', '', true), @@ -83,18 +81,18 @@ 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') && phpbb::$config['allow_namechange'])) && !phpbb_check_hash($data['cur_password'], $user->data['user_password'])) + if (($data['new_password'] || ($auth->acl_get('u_chgemail') && $data['email'] != phpbb::$user->data['user_email']) || ($data['username'] != phpbb::$user->data['username'] && $auth->acl_get('u_chgname') && phpbb::$config['allow_namechange'])) && !phpbb_check_hash($data['cur_password'], phpbb::$user->data['user_password'])) { $error[] = 'CUR_PASSWORD_ERROR'; } // Only check the new password against the previous password if there have been no errors - if (!sizeof($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && phpbb_check_hash($data['new_password'], $user->data['user_password'])) + if (!sizeof($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && phpbb_check_hash($data['new_password'], phpbb::$user->data['user_password'])) { $error[] = 'SAME_PASSWORD_ERROR'; } - if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) + if ($auth->acl_get('u_chgemail') && $data['email'] != phpbb::$user->data['user_email'] && $data['email_confirm'] != $data['email']) { $error[] = 'NEW_EMAIL_ERROR'; } @@ -107,33 +105,33 @@ class ucp_profile if (!sizeof($error)) { $sql_ary = array( - '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'], + 'username' => ($auth->acl_get('u_chgname') && phpbb::$config['allow_namechange']) ? $data['username'] : phpbb::$user->data['username'], + 'username_clean' => ($auth->acl_get('u_chgname') && phpbb::$config['allow_namechange']) ? utf8_clean_string($data['username']) : phpbb::$user->data['username_clean'], + 'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : phpbb::$user->data['user_email'], + 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? hexdec(crc32($data['email']) . strlen($data['email'])) : phpbb::$user->data['user_email_hash'], + 'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? phpbb_hash($data['new_password']) : phpbb::$user->data['user_password'], 'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0, ); - if ($auth->acl_get('u_chgname') && phpbb::$config['allow_namechange'] && $data['username'] != $user->data['username']) + if ($auth->acl_get('u_chgname') && phpbb::$config['allow_namechange'] && $data['username'] != phpbb::$user->data['username']) { - add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $data['username']); + add_log('user', phpbb::$user->data['user_id'], 'LOG_USER_UPDATE_NAME', phpbb::$user->data['username'], $data['username']); } - if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !phpbb_check_hash($data['new_password'], $user->data['user_password'])) + if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !phpbb_check_hash($data['new_password'], phpbb::$user->data['user_password'])) { - $user->reset_login_keys(); - add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $data['username']); + phpbb::$user->reset_login_keys(); + add_log('user', phpbb::$user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $data['username']); } - if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) + if ($auth->acl_get('u_chgemail') && $data['email'] != phpbb::$user->data['user_email']) { - add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $data['username'], $user->data['user_email'], $data['email']); + add_log('user', phpbb::$user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $data['username'], phpbb::$user->data['user_email'], $data['email']); } $message = 'PROFILE_UPDATED'; - if (phpbb::$config['email_enable'] && $data['email'] != $user->data['user_email'] && !phpbb::$user->is_founder && (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF || phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN)) + if (phpbb::$config['email_enable'] && $data['email'] != phpbb::$user->data['user_email'] && !phpbb::$user->is_founder && (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF || phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN)) { $message = (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN'; @@ -149,18 +147,18 @@ class ucp_profile $messenger = new messenger(false); $template_file = (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate'; - $messenger->template($template_file, $user->data['user_lang']); + $messenger->template($template_file, phpbb::$user->data['user_lang']); $messenger->to($data['email'], $data['username']); $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->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($data['username']), - 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u={$user->data['user_id']}&k=$user_actkey") + 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . '?mode=activate&u=' . phpbb::$user->data['user_id'] . "&k=$user_actkey") ); $messenger->send(NOTIFY_EMAIL); @@ -192,8 +190,8 @@ class ucp_profile $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($data['username']), - 'U_USER_DETAILS' => "$server_url/memberlist." . PHP_EXT . "?mode=viewprofile&u={$user->data['user_id']}", - 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . "?mode=activate&u={$user->data['user_id']}&k=$user_actkey") + 'U_USER_DETAILS' => "$server_url/memberlist." . PHP_EXT . '?mode=viewprofile&u=' . phpbb::$user->data['user_id'], + 'U_ACTIVATE' => "$server_url/ucp." . PHP_EXT . '?mode=activate&u=' . phpbb::$user->data['user_id'] . "&k=$user_actkey") ); $messenger->send($row['user_notify_type']); @@ -201,7 +199,7 @@ class ucp_profile $db->sql_freeresult($result); } - user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE); + user_active_flip('deactivate', phpbb::$user->data['user_id'], INACTIVE_PROFILE); // Because we want the profile to be reactivated we set user_newpasswd to empty (else the reactivation will fail) $sql_ary['user_actkey'] = $user_actkey; @@ -212,36 +210,36 @@ class ucp_profile { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); } // Need to update config, forum, topic, posting, messages, etc. - if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && phpbb::$config['allow_namechange']) + if ($data['username'] != phpbb::$user->data['username'] && $auth->acl_get('u_chgname') && phpbb::$config['allow_namechange']) { - user_update_name($user->data['username'], $data['username']); + user_update_name(phpbb::$user->data['username'], $data['username']); } // Now, we can remove the user completely (kill the session) - NOT BEFORE!!! if (!empty($sql_ary['user_actkey'])) { meta_refresh(5, append_sid('index')); - $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); + $message = phpbb::$user->lang[$message] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); // Because the user gets deactivated we log him out too, killing his session - $user->session_kill(); + phpbb::$user->session_kill(); } else { meta_refresh(3, $this->u_action); - $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = phpbb::$user->lang[$message] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); } trigger_error($message); } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } $template->assign_vars(array( @@ -253,10 +251,10 @@ class ucp_profile 'NEW_PASSWORD' => $data['new_password'], 'CUR_PASSWORD' => '', - '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']), + 'L_USERNAME_EXPLAIN' => sprintf(phpbb::$user->lang[phpbb::$config['allow_name_chars'] . '_EXPLAIN'], phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), + 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf(phpbb::$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') && phpbb::$config['chg_passforce'] && $user->data['user_passchg'] < time() - (phpbb::$config['chg_passforce'] * 86400)) ? true : false, + 'S_FORCE_PASSWORD' => ($auth->acl_get('u_chgpasswd') && phpbb::$config['chg_passforce'] && phpbb::$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) @@ -272,24 +270,24 @@ class ucp_profile $cp_data = $cp_error = array(); $data = array( - 'icq' => request_var('icq', $user->data['user_icq']), - 'aim' => request_var('aim', $user->data['user_aim']), - 'msn' => request_var('msn', $user->data['user_msnm']), - 'yim' => request_var('yim', $user->data['user_yim']), - 'jabber' => utf8_normalize_nfc(request_var('jabber', $user->data['user_jabber'], true)), - 'website' => request_var('website', $user->data['user_website']), - 'location' => utf8_normalize_nfc(request_var('location', $user->data['user_from'], true)), - 'occupation' => utf8_normalize_nfc(request_var('occupation', $user->data['user_occ'], true)), - 'interests' => utf8_normalize_nfc(request_var('interests', $user->data['user_interests'], true)), + 'icq' => request_var('icq', phpbb::$user->data['user_icq']), + 'aim' => request_var('aim', phpbb::$user->data['user_aim']), + 'msn' => request_var('msn', phpbb::$user->data['user_msnm']), + 'yim' => request_var('yim', phpbb::$user->data['user_yim']), + 'jabber' => utf8_normalize_nfc(request_var('jabber', phpbb::$user->data['user_jabber'], true)), + 'website' => request_var('website', phpbb::$user->data['user_website']), + 'location' => utf8_normalize_nfc(request_var('location', phpbb::$user->data['user_from'], true)), + 'occupation' => utf8_normalize_nfc(request_var('occupation', phpbb::$user->data['user_occ'], true)), + 'interests' => utf8_normalize_nfc(request_var('interests', phpbb::$user->data['user_interests'], true)), ); if (phpbb::$config['allow_birthdays']) { $data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0; - if ($user->data['user_birthday']) + if (phpbb::$user->data['user_birthday']) { - list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user->data['user_birthday']); + list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', phpbb::$user->data['user_birthday']); } $data['bday_day'] = request_var('bday_day', $data['bday_day']); @@ -333,7 +331,7 @@ class ucp_profile $error = validate_data($data, $validate_array); // validate custom profile fields - $cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error); + $cp->submit_cp_field('profile', phpbb::$user->get_iso_lang_id(), $cp_data, $cp_error); if (sizeof($cp_error)) { @@ -347,7 +345,7 @@ class ucp_profile if (!sizeof($error)) { - $data['notify'] = $user->data['user_notify_type']; + $data['notify'] = phpbb::$user->data['user_notify_type']; if (!phpbb::$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')) { @@ -376,7 +374,7 @@ class ucp_profile $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); // Update Custom Fields @@ -384,12 +382,12 @@ class ucp_profile { $sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $cp_data) . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); if (!$db->sql_affectedrows()) { - $cp_data['user_id'] = (int) $user->data['user_id']; + $cp_data['user_id'] = (int) phpbb::$user->data['user_id']; $db->sql_return_on_error(true); @@ -401,12 +399,12 @@ class ucp_profile } meta_refresh(3, $this->u_action); - $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = phpbb::$user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } if (phpbb::$config['allow_birthdays']) @@ -458,9 +456,9 @@ class ucp_profile )); // Get additional profile fields and assign them to the template block var 'profile_fields' - $user->get_profile_fields($user->data['user_id']); + phpbb::$user->get_profile_fields(phpbb::$user->data['user_id']); - $cp->generate_profile_fields('profile', $user->get_iso_lang_id()); + $cp->generate_profile_fields('profile', phpbb::$user->get_iso_lang_id()); break; @@ -474,11 +472,11 @@ class ucp_profile include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); - $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_bbcode = (phpbb::$config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !phpbb::$user->optionget('bbcode'))) ? false : true) : false; + $enable_smilies = (phpbb::$config['allow_sig_smilies']) ? ((request_var('disable_smilies', !phpbb::$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)); + $signature = utf8_normalize_nfc(request_var('signature', (string) phpbb::$user->data['user_sig'], true)); add_form_key('ucp_sig'); @@ -513,16 +511,16 @@ class ucp_profile $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $db->sql_query($sql); - $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = phpbb::$user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } $signature_preview = ''; @@ -533,7 +531,7 @@ class ucp_profile unset($message_parser); } - decode_message($signature, $user->data['user_sig_bbcode_uid']); + decode_message($signature, phpbb::$user->data['user_sig_bbcode_uid']); $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', @@ -544,13 +542,13 @@ class ucp_profile 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', - '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'], + 'BBCODE_STATUS' => (phpbb::$config['allow_sig_bbcode']) ? sprintf(phpbb::$user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf(phpbb::$user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), + 'SMILIES_STATUS' => (phpbb::$config['allow_sig_smilies']) ? phpbb::$user->lang['SMILIES_ARE_ON'] : phpbb::$user->lang['SMILIES_ARE_OFF'], + 'IMG_STATUS' => (phpbb::$config['allow_sig_img']) ? phpbb::$user->lang['IMAGES_ARE_ON'] : phpbb::$user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => (phpbb::$config['allow_sig_flash']) ? phpbb::$user->lang['FLASH_IS_ON'] : phpbb::$user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => (phpbb::$config['allow_sig_links']) ? phpbb::$user->lang['URL_IS_ON'] : phpbb::$user->lang['URL_IS_OFF'], - 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], phpbb::$config['max_sig_chars']), + 'L_SIGNATURE_EXPLAIN' => sprintf(phpbb::$user->lang['SIGNATURE_EXPLAIN'], phpbb::$config['max_sig_chars']), 'S_BBCODE_ALLOWED' => phpbb::$config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => phpbb::$config['allow_sig_smilies'], @@ -583,7 +581,7 @@ class ucp_profile if (avatar_process_user($error)) { meta_refresh(3, $this->u_action); - $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = phpbb::$user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } } @@ -592,19 +590,19 @@ class ucp_profile $error[] = 'FORM_INVALID'; } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); } $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' => get_user_avatar(phpbb::$user->data['user_avatar'], phpbb::$user->data['user_avatar_type'], phpbb::$user->data['user_avatar_width'], phpbb::$user->data['user_avatar_height']), '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'], phpbb::$config['avatar_max_width'], phpbb::$config['avatar_max_height'], phpbb::$config['avatar_filesize'] / 1024), + 'L_AVATAR_EXPLAIN' => sprintf(phpbb::$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') && phpbb::$config['allow_avatar_local']) @@ -616,8 +614,8 @@ class ucp_profile $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']), - 'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']), + 'AVATAR_WIDTH' => request_var('width', phpbb::$user->data['user_avatar_width']), + 'AVATAR_HEIGHT' => request_var('height', phpbb::$user->data['user_avatar_height']), 'S_AVATARS_ENABLED' => $avatars_enabled, 'S_UPLOAD_AVATAR_FILE' => $can_upload, @@ -631,7 +629,7 @@ class ucp_profile } $template->assign_vars(array( - 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], + 'L_TITLE' => phpbb::$user->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $this->u_action) diff --git a/phpBB/modules/ucp/ucp_register.php b/phpBB/modules/ucp/ucp_register.php index 68da529809..9708b24f95 100644 --- a/phpBB/modules/ucp/ucp_register.php +++ b/phpBB/modules/ucp/ucp_register.php @@ -27,8 +27,6 @@ class ucp_register function main($id, $mode) { - global $db, $user, $auth, $template; - // if (phpbb::$config['require_activation'] == USER_ACTIVATION_DISABLE) { @@ -41,7 +39,7 @@ class ucp_register $agreed = phpbb_request::variable('agreed', false, false, phpbb_request::POST) ? 1 : 0; $submit = phpbb_request::is_set_post('submit'); $change_lang = request_var('change_lang', ''); - $user_lang = request_var('lang', $user->lang_name); + $user_lang = request_var('lang', phpbb::$user->lang_name); if ($agreed) { @@ -64,7 +62,7 @@ class ucp_register { $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang); - if (file_exists($user->lang_path . $use_lang . '/')) + if (file_exists(phpbb::$user->lang_path . $use_lang . '/')) { if ($change_lang) { @@ -74,14 +72,14 @@ class ucp_register $agreed = (phpbb_request::is_set_post('change_lang')) ? 0 : $agreed; } - $user->lang_name = $lang = $use_lang; - $user->lang = array(); - $user->add_lang(array('common', 'ucp')); + phpbb::$user->lang_name = $lang = $use_lang; + phpbb::$user->lang = array(); + phpbb::$user->add_lang(array('common', 'ucp')); } else { $change_lang = ''; - $user_lang = $user->lang_name; + $user_lang = phpbb::$user->lang_name; } } @@ -105,7 +103,7 @@ class ucp_register 'username' => utf8_normalize_nfc(request_var('username', '', true)), 'email' => strtolower(request_var('email', '')), 'email_confirm' => strtolower(request_var('email_confirm', '')), - 'lang' => $user->lang_name, + 'lang' => phpbb::$user->lang_name, 'tz' => request_var('tz', (float) phpbb::$config['board_timezone']), )); @@ -118,12 +116,12 @@ class ucp_register 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']); + $coppa_birthday = phpbb::$user->format_date(mktime($now['hours'] + phpbb::$user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), phpbb::$user->lang['DATE_FORMAT']); unset($now); $template->assign_vars(array( - 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), - 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), + 'L_COPPA_NO' => sprintf(phpbb::$user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), + 'L_COPPA_YES' => sprintf(phpbb::$user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), 'U_COPPA_NO' => append_sid('ucp', 'mode=register&coppa=0' . $add_lang), 'U_COPPA_YES' => append_sid('ucp', 'mode=register&coppa=1' . $add_lang), @@ -136,7 +134,7 @@ class ucp_register else { $template->assign_vars(array( - 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], phpbb::$config['sitename'], generate_board_url()), + 'L_TERMS_OF_USE' => sprintf(phpbb::$user->lang['TERMS_OF_USE_CONTENT'], phpbb::$config['sitename'], generate_board_url()), 'S_SHOW_COPPA' => false, 'S_REGISTRATION' => true, @@ -159,7 +157,7 @@ class ucp_register { $timezone = ($is_dst) ? $timezone - 1 : $timezone; - if (!isset($user->lang['tz_zones'][(string) $timezone])) + if (!isset(phpbb::$user->lang['tz_zones'][(string) $timezone])) { $timezone = phpbb::$config['board_timezone']; } @@ -176,7 +174,7 @@ class ucp_register 'password_confirm' => request_var('password_confirm', '', true), 'email' => strtolower(request_var('email', '')), 'email_confirm' => strtolower(request_var('email_confirm', '')), - 'lang' => basename(request_var('lang', $user->lang_name)), + 'lang' => basename(request_var('lang', phpbb::$user->lang_name)), 'tz' => request_var('tz', (float) $timezone), ); @@ -200,10 +198,10 @@ class ucp_register )); if (!check_form_key('ucp_register')) { - $error[] = $user->lang['FORM_INVALID']; + $error[] = phpbb::$user->lang['FORM_INVALID']; } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "phpbb::\$user->lang('\\1')", $error); if (phpbb::$config['enable_confirm']) { @@ -218,31 +216,31 @@ class ucp_register } if (phpbb::$config['max_reg_attempts'] && $captcha->get_attempt_count() > phpbb::$config['max_reg_attempts']) { - $error[] = $user->lang['TOO_MANY_REGISTERS']; + $error[] = phpbb::$user->lang['TOO_MANY_REGISTERS']; } } // DNSBL check if (phpbb::$config['check_dnsbl']) { - if (($dnsbl = $user->check_dnsbl('register')) !== false) + if (($dnsbl = phpbb::$user->check_dnsbl('register')) !== false) { - $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]); + $error[] = sprintf(phpbb::$user->lang['IP_BLACKLISTED'], phpbb::$user->ip, $dnsbl[1]); } } // validate custom profile fields - $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error); + $cp->submit_cp_field('register', phpbb::$user->get_iso_lang_id(), $cp_data, $error); if (!sizeof($error)) { if ($data['new_password'] != $data['password_confirm']) { - $error[] = $user->lang['NEW_PASSWORD_ERROR']; + $error[] = phpbb::$user->lang['NEW_PASSWORD_ERROR']; } if ($data['email'] != $data['email_confirm']) { - $error[] = $user->lang['NEW_EMAIL_ERROR']; + $error[] = phpbb::$user->lang['NEW_EMAIL_ERROR']; } } @@ -299,7 +297,7 @@ class ucp_register 'user_lang' => $data['lang'], 'user_type' => $user_type, 'user_actkey' => $user_actkey, - 'user_ip' => $user->ip, + 'user_ip' => phpbb::$user->ip, 'user_regdate' => time(), 'user_inactive_reason' => $user_inactive_reason, 'user_inactive_time' => $user_inactive_time, @@ -316,22 +314,22 @@ class ucp_register if ($coppa && phpbb::$config['email_enable']) { - $message = $user->lang['ACCOUNT_COPPA']; + $message = phpbb::$user->lang['ACCOUNT_COPPA']; $email_template = 'coppa_welcome_inactive'; } else if (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF && phpbb::$config['email_enable']) { - $message = $user->lang['ACCOUNT_INACTIVE']; + $message = phpbb::$user->lang['ACCOUNT_INACTIVE']; $email_template = 'user_welcome_inactive'; } else if (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN && phpbb::$config['email_enable']) { - $message = $user->lang['ACCOUNT_INACTIVE_ADMIN']; + $message = phpbb::$user->lang['ACCOUNT_INACTIVE_ADMIN']; $email_template = 'admin_welcome_inactive'; } else { - $message = $user->lang['ACCOUNT_ADDED']; + $message = phpbb::$user->lang['ACCOUNT_ADDED']; $email_template = 'user_welcome'; } @@ -346,12 +344,12 @@ class ucp_register $messenger->to($data['email'], $data['username']); $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->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); $messenger->assign_vars(array( - 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], phpbb::$config['sitename'])), + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf(phpbb::$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") @@ -405,7 +403,7 @@ class ucp_register } } - $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); + $message = $message . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); trigger_error($message); } } @@ -437,7 +435,7 @@ class ucp_register } $template->assign_vars(array( - 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars(phpbb::$config['board_contact']) . '">', '</a>'), + 'L_CONFIRM_EXPLAIN' => sprintf(phpbb::$user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars(phpbb::$config['board_contact']) . '">', '</a>'), 'S_CAPTCHA' => $captcha->get_template(), )); } @@ -447,11 +445,11 @@ class ucp_register switch (phpbb::$config['require_activation']) { case USER_ACTIVATION_SELF: - $l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE']; + $l_reg_cond = phpbb::$user->lang['UCP_EMAIL_ACTIVATE']; break; case USER_ACTIVATION_ADMIN: - $l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE']; + $l_reg_cond = phpbb::$user->lang['UCP_ADMIN_ACTIVATE']; break; } @@ -464,8 +462,8 @@ class ucp_register 'EMAIL_CONFIRM' => $data['email_confirm'], 'L_REG_COND' => $l_reg_cond, - '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']), + 'L_USERNAME_EXPLAIN' => sprintf(phpbb::$user->lang[phpbb::$config['allow_name_chars'] . '_EXPLAIN'], phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), + 'L_PASSWORD_EXPLAIN' => sprintf(phpbb::$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']), @@ -476,10 +474,10 @@ class ucp_register ); // - $user->profile_fields = array(); + phpbb::$user->profile_fields = array(); // Generate profile fields -> Template Block Variable profile_fields - $cp->generate_profile_fields('register', $user->get_iso_lang_id()); + $cp->generate_profile_fields('register', phpbb::$user->get_iso_lang_id()); // $this->tpl_name = 'ucp_register'; diff --git a/phpBB/modules/ucp/ucp_remind.php b/phpBB/modules/ucp/ucp_remind.php index 2a921a52b2..378fa49f08 100644 --- a/phpBB/modules/ucp/ucp_remind.php +++ b/phpBB/modules/ucp/ucp_remind.php @@ -27,8 +27,6 @@ class ucp_remind function main($id, $mode) { - global $db, $user, $auth, $template; - $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); $submit = phpbb_request::is_set_post('submit'); @@ -106,7 +104,7 @@ class ucp_remind meta_refresh(3, append_sid('index')); - $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); + $message = phpbb::$user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); trigger_error($message); } diff --git a/phpBB/modules/ucp/ucp_resend.php b/phpBB/modules/ucp/ucp_resend.php index cde79ccabd..ad58fd4c4d 100644 --- a/phpBB/modules/ucp/ucp_resend.php +++ b/phpBB/modules/ucp/ucp_resend.php @@ -27,8 +27,6 @@ class ucp_resend function main($id, $mode) { - global $db, $user, $auth, $template; - $username = request_var('username', '', true); $email = strtolower(request_var('email', '')); $submit = phpbb_request::is_set_post('submit'); @@ -94,12 +92,12 @@ class ucp_resend $messenger->to($user_row['user_email'], $user_row['username']); $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->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip); $messenger->assign_vars(array( - 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], phpbb::$config['sitename'])), + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf(phpbb::$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']}") ); @@ -145,8 +143,8 @@ class ucp_resend meta_refresh(3, append_sid('index')); - $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>'); + $message = (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN) ? phpbb::$user->lang['ACIVATION_EMAIL_SENT_ADMIN'] : phpbb::$user->lang['ACTIVATION_EMAIL_SENT']; + $message .= '<br /><br />' . sprintf(phpbb::$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 060aa7d9a7..9ee73dbc76 100644 --- a/phpBB/modules/ucp/ucp_zebra.php +++ b/phpBB/modules/ucp/ucp_zebra.php @@ -26,8 +26,6 @@ class ucp_zebra function main($id, $mode) { - 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 = ''; @@ -62,7 +60,7 @@ class ucp_zebra // may lead to complaints $sql = 'SELECT z.*, u.username, u.username_clean FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u - WHERE z.user_id = ' . $user->data['user_id'] . ' + WHERE z.user_id = ' . phpbb::$user->data['user_id'] . ' AND u.user_id = z.zebra_id'; $result = $db->sql_query($sql); @@ -86,7 +84,7 @@ class ucp_zebra if (sizeof($data['add']) < $n && $mode == 'foes') { - $error[] = $user->lang['NOT_ADDED_FOES_FRIENDS']; + $error[] = phpbb::$user->lang['NOT_ADDED_FOES_FRIENDS']; } // remove foes from the username array @@ -95,16 +93,16 @@ class ucp_zebra if (sizeof($data['add']) < $n && $mode == 'friends') { - $error[] = $user->lang['NOT_ADDED_FRIENDS_FOES']; + $error[] = phpbb::$user->lang['NOT_ADDED_FRIENDS_FOES']; } // remove the user himself from the username array $n = sizeof($data['add']); - $data['add'] = array_diff($data['add'], array(utf8_clean_string($user->data['username']))); + $data['add'] = array_diff($data['add'], array(utf8_clean_string(phpbb::$user->data['username']))); if (sizeof($data['add']) < $n) { - $error[] = $user->lang['NOT_ADDED_' . $l_mode . '_SELF']; + $error[] = phpbb::$user->lang['NOT_ADDED_' . $l_mode . '_SELF']; } unset($friends, $foes, $n); @@ -126,7 +124,7 @@ class ucp_zebra } else { - $error[] = $user->lang['NOT_ADDED_' . $l_mode . '_ANONYMOUS']; + $error[] = phpbb::$user->lang['NOT_ADDED_' . $l_mode . '_ANONYMOUS']; } } $db->sql_freeresult($result); @@ -149,7 +147,7 @@ class ucp_zebra if (sizeof($perms)) { - $error[] = $user->lang['NOT_ADDED_FOES_MOD_ADMIN']; + $error[] = phpbb::$user->lang['NOT_ADDED_FOES_MOD_ADMIN']; } // This may not be right ... it may yield true when perms equate to deny @@ -165,7 +163,7 @@ class ucp_zebra foreach ($user_id_ary as $zebra_id) { $sql_ary[] = array( - 'user_id' => (int) $user->data['user_id'], + 'user_id' => (int) phpbb::$user->data['user_id'], 'zebra_id' => (int) $zebra_id, $sql_mode => 1 ); @@ -179,7 +177,7 @@ class ucp_zebra } else if (!sizeof($error)) { - $error[] = $user->lang['USER_NOT_FOUND_OR_INACTIVE']; + $error[] = phpbb::$user->lang['USER_NOT_FOUND_OR_INACTIVE']; } } } @@ -189,7 +187,7 @@ class ucp_zebra $data['usernames'] = array_map('intval', $data['usernames']); $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . ' + WHERE user_id = ' . phpbb::$user->data['user_id'] . ' AND ' . $db->sql_in_set('zebra_id', $data['usernames']); $db->sql_query($sql); @@ -199,7 +197,7 @@ class ucp_zebra if ($updated) { meta_refresh(3, $this->u_action); - $message = $user->lang[$l_mode . '_UPDATED'] . '<br />' . implode('<br />', $error) . ((sizeof($error)) ? '<br />' : '') . '<br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + $message = phpbb::$user->lang[$l_mode . '_UPDATED'] . '<br />' . implode('<br />', $error) . ((sizeof($error)) ? '<br />' : '') . '<br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); } else @@ -209,7 +207,7 @@ class ucp_zebra } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + confirm_box(false, phpbb::$user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 'mode' => $mode, 'submit' => true, 'usernames' => $data['usernames'], @@ -222,7 +220,7 @@ class ucp_zebra $sql_and = ($mode == 'friends') ? 'z.friend = 1' : 'z.foe = 1'; $sql = 'SELECT z.*, u.username, u.username_clean FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u - WHERE z.user_id = ' . $user->data['user_id'] . " + WHERE z.user_id = ' . phpbb::$user->data['user_id'] . " AND $sql_and AND u.user_id = z.zebra_id ORDER BY u.username_clean ASC"; @@ -236,7 +234,7 @@ class ucp_zebra $db->sql_freeresult($result); $template->assign_vars(array( - 'L_TITLE' => $user->lang['UCP_ZEBRA_' . $l_mode], + 'L_TITLE' => phpbb::$user->lang['UCP_ZEBRA_' . $l_mode], 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&form=ucp&field=add'), diff --git a/phpBB/posting.php b/phpBB/posting.php index e2484dfd15..7f1b798f9d 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -21,8 +21,8 @@ include(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); // Grab only parameters needed here @@ -45,7 +45,7 @@ $mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var $error = $post_data = array(); $current_time = time(); -if (phpbb::$config['enable_post_confirm'] && !$user->data['is_registered']) +if (phpbb::$config['enable_post_confirm'] && !phpbb::$user->is_registered) { include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_factory.' . PHP_EXT); $captcha = phpbb_captcha_factory::get_instance(phpbb::$config['captcha_plugin']); @@ -92,7 +92,7 @@ switch ($mode) case 'delete': if (!$post_id) { - $user->setup('posting'); + phpbb::$user->setup('posting'); trigger_error('NO_POST'); } @@ -131,19 +131,19 @@ switch ($mode) if (!$sql) { - $user->setup('posting'); + phpbb::$user->setup('posting'); trigger_error('NO_POST_MODE'); } $result = $db->sql_query($sql); $post_data = $db->sql_fetchrow($result); -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); if (!$post_data) { if (!($mode == 'post' || $mode == 'bump' || $mode == 'reply')) { - $user->setup('posting'); + phpbb::$user->setup('posting'); } trigger_error(($mode == 'post' || $mode == 'bump' || $mode == 'reply') ? 'NO_TOPIC' : 'NO_POST'); } @@ -154,7 +154,7 @@ if ($mode == 'popup') return; } -$user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']); +phpbb::$user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']); // Use post_row values in favor of submitted ones... $forum_id = (!empty($post_data['forum_id'])) ? (int) $post_data['forum_id'] : (int) $forum_id; @@ -171,7 +171,7 @@ if ($post_data['forum_password']) } // Check permissions -if ($user->data['is_bot']) +if (phpbb::$user->is_bot) { redirect(append_sid('index')); } @@ -179,12 +179,12 @@ if ($user->data['is_bot']) // Is the user able to read within this forum? if (!$auth->acl_get('f_read', $forum_id)) { - if ($user->data['user_id'] != ANONYMOUS) + if (phpbb::$user->data['user_id'] != ANONYMOUS) { trigger_error('USER_CANNOT_READ'); } - login_box('', $user->lang['LOGIN_EXPLAIN_POST']); + login_box('', phpbb::$user->lang['LOGIN_EXPLAIN_POST']); } // Permission to do the action asked? @@ -220,14 +220,14 @@ switch ($mode) break; case 'edit': - if ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id)) + if (phpbb::$user->is_registered && $auth->acl_gets('f_edit', 'm_edit', $forum_id)) { $is_authed = true; } break; case 'delete': - if ($user->data['is_registered'] && $auth->acl_gets('f_delete', 'm_delete', $forum_id)) + if (phpbb::$user->is_registered && $auth->acl_gets('f_delete', 'm_delete', $forum_id)) { $is_authed = true; } @@ -238,12 +238,12 @@ if (!$is_authed) { $check_auth = ($mode == 'quote') ? 'reply' : $mode; - if ($user->data['is_registered']) + if (phpbb::$user->is_registered) { trigger_error('USER_CANNOT_' . strtoupper($check_auth)); } - login_box('', $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]); + login_box('', phpbb::$user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]); } // Is the user able to post within this forum? @@ -262,7 +262,7 @@ if (($post_data['forum_status'] == ITEM_LOCKED || (isset($post_data['topic_statu // else it depends on editing times, lock status and if we're the correct user if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)) { - if ($user->data['user_id'] != $post_data['poster_id']) + if (phpbb::$user->data['user_id'] != $post_data['poster_id']) { trigger_error('USER_CANNOT_EDIT'); } @@ -302,7 +302,7 @@ if ($mode == 'bump') $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_last_post_time = $current_time, topic_bumped = 1, - topic_bumper = " . $user->data['user_id'] . " + topic_bumper = " . phpbb::$user->data['user_id'] . " WHERE topic_id = $topic_id"; $db->sql_query($sql); @@ -310,7 +310,7 @@ if ($mode == 'bump') $sql = 'UPDATE ' . USERS_TABLE . " SET user_lastpost_time = $current_time - WHERE user_id = " . $user->data['user_id']; + WHERE user_id = " . phpbb::$user->data['user_id']; $db->sql_query($sql); $db->sql_transaction('commit'); @@ -322,8 +322,8 @@ if ($mode == 'bump') $meta_url = append_sid('viewtopic', "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}"; meta_refresh(3, $meta_url); - $message = $user->lang['TOPIC_BUMPED'] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $meta_url . '">', '</a>'); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>'); + $message = phpbb::$user->lang['TOPIC_BUMPED'] . '<br /><br />' . sprintf(phpbb::$user->lang['VIEW_MESSAGE'], '<a href="' . $meta_url . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>'); trigger_error($message); } @@ -340,7 +340,7 @@ if ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == // Determine some vars if (isset($post_data['poster_id']) && $post_data['poster_id'] == ANONYMOUS) { - $post_data['quote_username'] = (!empty($post_data['post_username'])) ? $post_data['post_username'] : $user->lang['GUEST']; + $post_data['quote_username'] = (!empty($post_data['post_username'])) ? $post_data['post_username'] : phpbb::$user->lang['GUEST']; } else { @@ -382,7 +382,7 @@ if (isset($post_data['post_text'])) } // Set some default variables -$uninit = array('post_attachment' => 0, 'poster_id' => $user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0); +$uninit = array('post_attachment' => 0, 'poster_id' => phpbb::$user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0); foreach ($uninit as $var_name => $default_value) { @@ -424,20 +424,20 @@ $post_data['enable_urls'] = $post_data['enable_magic_url']; if ($mode != 'edit') { - $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_sig'] = (phpbb::$config['allow_sig'] && phpbb::$user->optionget('attachsig')) ? true: false; + $post_data['enable_smilies'] = (phpbb::$config['allow_smilies'] && phpbb::$user->optionget('smilies')) ? true : false; + $post_data['enable_bbcode'] = (phpbb::$config['allow_bbcode'] && phpbb::$user->optionget('bbcode')) ? true : false; $post_data['enable_urls'] = true; } $post_data['enable_magic_url'] = $post_data['drafts'] = false; // User own some drafts? -if ($user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) +if (phpbb::$user->is_registered && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) { $sql = 'SELECT draft_id FROM ' . DRAFTS_TABLE . ' - WHERE user_id = ' . $user->data['user_id'] . + WHERE user_id = ' . phpbb::$user->data['user_id'] . (($forum_id) ? ' AND forum_id = ' . (int) $forum_id : '') . (($topic_id) ? ' AND topic_id = ' . (int) $topic_id : '') . (($draft_id) ? " AND draft_id <> $draft_id" : ''); @@ -453,12 +453,12 @@ 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' && phpbb::$config['allow_topic_notify'] && $user->data['is_registered']) +if ($mode != 'post' && phpbb::$config['allow_topic_notify'] && phpbb::$user->is_registered) { $sql = 'SELECT topic_id FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . $topic_id . ' - AND user_id = ' . $user->data['user_id']; + AND user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $post_data['notify_set'] = (int) $db->sql_fetchfield('topic_id'); $db->sql_freeresult($result); @@ -479,7 +479,7 @@ $flash_status = ($bbcode_status && $auth->acl_get('f_flash', $forum_id) && phpbb $quote_status = ($auth->acl_get('f_reply', $forum_id)) ? true : false; // Save Draft -if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) +if ($save && phpbb::$user->is_registered && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) { $subject = utf8_normalize_nfc(request_var('subject', '', true)); $subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject; @@ -490,7 +490,7 @@ if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ( if (confirm_box(true)) { $sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'user_id' => (int) $user->data['user_id'], + 'user_id' => (int) phpbb::$user->data['user_id'], 'topic_id' => (int) $topic_id, 'forum_id' => (int) $forum_id, 'save_time' => (int) $current_time, @@ -503,9 +503,9 @@ if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ( meta_refresh(3, $meta_info); - $message = $user->lang['DRAFT_SAVED'] . '<br /><br />'; - $message .= ($mode != 'post') ? sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $meta_info . '">', '</a>') . '<br /><br />' : ''; - $message .= sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>'); + $message = phpbb::$user->lang['DRAFT_SAVED'] . '<br /><br />'; + $message .= ($mode != 'post') ? sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . $meta_info . '">', '</a>') . '<br /><br />' : ''; + $message .= sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>'); trigger_error($message); } @@ -529,24 +529,24 @@ if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ( { if (utf8_clean_string($subject) === '') { - $error[] = $user->lang['EMPTY_SUBJECT']; + $error[] = phpbb::$user->lang['EMPTY_SUBJECT']; } if (utf8_clean_string($message) === '') { - $error[] = $user->lang['TOO_FEW_CHARS']; + $error[] = phpbb::$user->lang['TOO_FEW_CHARS']; } } unset($subject, $message); } // Load requested Draft -if ($draft_id && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $user->data['is_registered'] && $auth->acl_get('u_savedrafts')) +if ($draft_id && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && phpbb::$user->is_registered && $auth->acl_get('u_savedrafts')) { $sql = 'SELECT draft_subject, draft_message FROM ' . DRAFTS_TABLE . " WHERE draft_id = $draft_id - AND user_id = " . $user->data['user_id']; + AND user_id = " . phpbb::$user->data['user_id']; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -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'] = (!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); + $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') && phpbb::$user->is_registered) ? true : false); - if (phpbb::$config['allow_topic_notify'] && $user->data['is_registered']) + if (phpbb::$config['allow_topic_notify'] && phpbb::$user->is_registered) { $notify = phpbb_request::is_set_post('notify'); } @@ -618,7 +618,7 @@ if ($submit || $preview || $refresh) // Delete Poll if ($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))) + ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == phpbb::$user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))) { if ($submit && check_form_key('posting')) { @@ -711,15 +711,15 @@ if ($submit || $preview || $refresh) // Flood check $last_post_time = 0; - if ($user->data['is_registered']) + if (phpbb::$user->is_registered) { - $last_post_time = $user->data['user_lastpost_time']; + $last_post_time = phpbb::$user->data['user_lastpost_time']; } else { $sql = 'SELECT post_time AS last_post_time FROM ' . POSTS_TABLE . " - WHERE poster_ip = '" . $user->ip . "' + WHERE poster_ip = '" . phpbb::$user->ip . "' AND post_time > " . ($current_time - phpbb::$config['flood_interval']); $result = $db->sql_query_limit($sql, 1); if ($row = $db->sql_fetchrow($result)) @@ -731,23 +731,23 @@ if ($submit || $preview || $refresh) if ($last_post_time && ($current_time - $last_post_time) < intval(phpbb::$config['flood_interval'])) { - $error[] = $user->lang['FLOOD_ERROR']; + $error[] = phpbb::$user->lang['FLOOD_ERROR']; } } // Validate username - if (($post_data['username'] && !$user->data['is_registered']) || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS && $post_data['username'] && $post_data['post_username'] && $post_data['post_username'] != $post_data['username'])) + if (($post_data['username'] && !phpbb::$user->is_registered) || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS && $post_data['username'] && $post_data['post_username'] && $post_data['post_username'] != $post_data['username'])) { include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); if (($result = validate_username($post_data['username'], (!empty($post_data['post_username'])) ? $post_data['post_username'] : '')) !== false) { - $user->add_lang('ucp'); - $error[] = $user->lang[$result . '_USERNAME']; + phpbb::$user->add_lang('ucp'); + $error[] = phpbb::$user->lang[$result . '_USERNAME']; } } - if (phpbb::$config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) + if (phpbb::$config['enable_post_confirm'] && !phpbb::$user->is_registered && in_array($mode, array('quote', 'post', 'reply'))) { $vc_response = $captcha->validate(); if ($vc_response) @@ -763,13 +763,13 @@ if ($submit || $preview || $refresh) // check form if (($submit || $preview) && !check_form_key('posting')) { - $error[] = $user->lang['FORM_INVALID']; + $error[] = phpbb::$user->lang['FORM_INVALID']; } // Parse subject if (!$preview && !$refresh && utf8_clean_string($post_data['post_subject']) === '' && ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id))) { - $error[] = $user->lang['EMPTY_SUBJECT']; + $error[] = phpbb::$user->lang['EMPTY_SUBJECT']; } $post_data['poll_last_vote'] = (isset($post_data['poll_last_vote'])) ? $post_data['poll_last_vote'] : 0; @@ -800,7 +800,7 @@ if ($submit || $preview || $refresh) /* We reset votes, therefore also allow removing options if ($post_data['poll_last_vote'] && ($poll['poll_options_size'] < $orig_poll_options_size)) { - $message_parser->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS']; + $message_parser->warn_msg[] = phpbb::$user->lang['NO_DELETE_POLL_OPTIONS']; }*/ } else @@ -838,7 +838,7 @@ if ($submit || $preview || $refresh) } else { - $error[] = $user->lang['CANNOT_POST_' . str_replace('F_', '', strtoupper($auth_option))]; + $error[] = phpbb::$user->lang['CANNOT_POST_' . str_replace('F_', '', strtoupper($auth_option))]; } } } @@ -851,9 +851,9 @@ if ($submit || $preview || $refresh) // DNSBL check if (phpbb::$config['check_dnsbl'] && !$refresh) { - if (($dnsbl = $user->check_dnsbl('post')) !== false) + if (($dnsbl = phpbb::$user->check_dnsbl('post')) !== false) { - $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]); + $error[] = sprintf(phpbb::$user->lang['IP_BLACKLISTED'], phpbb::$user->ip, $dnsbl[1]); } } @@ -918,7 +918,7 @@ if ($submit || $preview || $refresh) { // Lock/Unlock Topic $change_topic_status = $post_data['topic_status']; - $perm_lock_unlock = ($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; + $perm_lock_unlock = ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && phpbb::$user->is_registered && !empty($post_data['topic_poster']) && phpbb::$user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED)) ? true : false; if ($post_data['topic_status'] == ITEM_LOCKED && !$topic_lock && $perm_lock_unlock) { @@ -937,7 +937,7 @@ if ($submit || $preview || $refresh) AND topic_moved_id = 0"; $db->sql_query($sql); - $user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : ''; + $user_lock = ($auth->acl_get('f_user_lock', $forum_id) && phpbb::$user->is_registered && phpbb::$user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : ''; add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), $post_data['topic_title']); } @@ -972,12 +972,12 @@ if ($submit || $preview || $refresh) 'post_time' => (isset($post_data['post_time'])) ? (int) $post_data['post_time'] : $current_time, 'post_checksum' => (isset($post_data['post_checksum'])) ? (string) $post_data['post_checksum'] : '', 'post_edit_reason' => $post_data['post_edit_reason'], - 'post_edit_user' => ($mode == 'edit') ? $user->data['user_id'] : ((isset($post_data['post_edit_user'])) ? (int) $post_data['post_edit_user'] : 0), + 'post_edit_user' => ($mode == 'edit') ? phpbb::$user->data['user_id'] : ((isset($post_data['post_edit_user'])) ? (int) $post_data['post_edit_user'] : 0), 'forum_parents' => $post_data['forum_parents'], 'forum_name' => $post_data['forum_name'], 'notify' => $notify, 'notify_set' => $post_data['notify_set'], - 'poster_ip' => (isset($post_data['poster_ip'])) ? $post_data['poster_ip'] : $user->ip, + 'poster_ip' => (isset($post_data['poster_ip'])) ? $post_data['poster_ip'] : phpbb::$user->ip, 'post_edit_locked' => (int) $post_data['post_edit_locked'], 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, @@ -996,26 +996,26 @@ 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 (phpbb::$config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) + if (phpbb::$config['enable_post_confirm'] && !phpbb::$user->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 (((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'])) + if (((phpbb::$config['enable_queue_trigger'] && phpbb::$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']; - $message .= (($user->data['user_id'] == ANONYMOUS) ? '' : ' '. $user->lang['POST_APPROVAL_NOTIFY']); + $message = ($mode == 'edit') ? phpbb::$user->lang['POST_EDITED_MOD'] : phpbb::$user->lang['POST_STORED_MOD']; + $message .= ((phpbb::$user->is_guest) ? '' : ' '. phpbb::$user->lang['POST_APPROVAL_NOTIFY']); } else { meta_refresh(3, $redirect_url); $message = ($mode == 'edit') ? 'POST_EDITED' : 'POST_STORED'; - $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang[$message] . '<br /><br />' . sprintf(phpbb::$user->lang['VIEW_MESSAGE'], '<a href="' . $redirect_url . '">', '</a>'); } - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $data['forum_id']) . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $data['forum_id']) . '">', '</a>'); trigger_error($message); } } @@ -1028,9 +1028,9 @@ if (!sizeof($error) && $preview) $preview_message = $message_parser->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies'], false); - $preview_signature = ($mode == 'edit') ? $post_data['user_sig'] : $user->data['user_sig']; - $preview_signature_uid = ($mode == 'edit') ? $post_data['user_sig_bbcode_uid'] : $user->data['user_sig_bbcode_uid']; - $preview_signature_bitfield = ($mode == 'edit') ? $post_data['user_sig_bbcode_bitfield'] : $user->data['user_sig_bbcode_bitfield']; + $preview_signature = ($mode == 'edit') ? $post_data['user_sig'] : phpbb::$user->data['user_sig']; + $preview_signature_uid = ($mode == 'edit') ? $post_data['user_sig_bbcode_uid'] : phpbb::$user->data['user_sig_bbcode_uid']; + $preview_signature_bitfield = ($mode == 'edit') ? $post_data['user_sig_bbcode_bitfield'] : phpbb::$user->data['user_sig_bbcode_bitfield']; // Signature if ($post_data['enable_sig'] && phpbb::$config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id)) @@ -1072,8 +1072,8 @@ if (!sizeof($error) && $preview) 'POLL_QUESTION' => $parse_poll->message, - 'L_POLL_LENGTH' => ($post_data['poll_length']) ? sprintf($user->lang['POLL_RUN_TILL'], $user->format_date($poll_end)) : '', - 'L_MAX_VOTES' => ($post_data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $post_data['poll_max_options'])) + 'L_POLL_LENGTH' => ($post_data['poll_length']) ? sprintf(phpbb::$user->lang['POLL_RUN_TILL'], phpbb::$user->format_date($poll_end)) : '', + 'L_MAX_VOTES' => ($post_data['poll_max_options'] == 1) ? phpbb::$user->lang['MAX_OPTION_SELECT'] : sprintf(phpbb::$user->lang['MAX_OPTIONS_SELECT'], $post_data['poll_max_options'])) ); $parse_poll->message = implode("\n", $post_data['poll_options']); @@ -1179,36 +1179,36 @@ 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'] : ((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); +$bbcode_checked = (isset($post_data['enable_bbcode'])) ? !$post_data['enable_bbcode'] : ((phpbb::$config['allow_bbcode']) ? !phpbb::$user->optionget('bbcode') : 1); +$smilies_checked = (isset($post_data['enable_smilies'])) ? !$post_data['enable_smilies'] : ((phpbb::$config['allow_smilies']) ? !phpbb::$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' && 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); +$notify_set = ($mode != 'edit' && phpbb::$config['allow_topic_notify'] && phpbb::$user->is_registered && !$post_data['notify_set']) ? phpbb::$user->data['user_notify'] : $post_data['notify_set']; +$notify_checked = (isset($notify)) ? $notify : (($mode == 'post') ? phpbb::$user->data['user_notify'] : $notify_set); // Page title & action URL, include session_id for security purpose -$s_action = append_sid('posting', "mode=$mode&f=$forum_id", true, $user->session_id); +$s_action = append_sid('posting', "mode=$mode&f=$forum_id", true, phpbb::$user->session_id); $s_action .= ($topic_id) ? "&t=$topic_id" : ''; $s_action .= ($post_id) ? "&p=$post_id" : ''; switch ($mode) { case 'post': - $page_title = $user->lang['POST_TOPIC']; + $page_title = phpbb::$user->lang['POST_TOPIC']; break; case 'quote': case 'reply': - $page_title = $user->lang['POST_REPLY']; + $page_title = phpbb::$user->lang['POST_REPLY']; break; case 'delete': case 'edit': - $page_title = $user->lang['EDIT_POST']; + $page_title = phpbb::$user->lang['EDIT_POST']; break; } @@ -1218,7 +1218,7 @@ generate_forum_nav($post_data); // Build Forum Rules generate_forum_rules($post_data); -if (phpbb::$config['enable_post_confirm'] && !$user->data['is_registered'] && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) +if (phpbb::$config['enable_post_confirm'] && !phpbb::$user->is_registered && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) { $captcha->reset(); @@ -1245,8 +1245,8 @@ add_form_key('posting'); // Start assigning vars for main posting page ... $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(phpbb::$config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval(phpbb::$config['max_post_chars'])) : '', + 'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? phpbb::$user->lang['POST_ICON'] : phpbb::$user->lang['TOPIC_ICON'], + 'L_MESSAGE_BODY_EXPLAIN' => (intval(phpbb::$config['max_post_chars'])) ? sprintf(phpbb::$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']) : '', @@ -1255,13 +1255,13 @@ $template->assign_vars(array( 'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', 'SUBJECT' => $post_data['post_subject'], 'MESSAGE' => $post_data['post_text'], - 'BBCODE_STATUS' => ($bbcode_status) ? 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>'), - 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], - 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], - 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], - 'URL_STATUS' => ($bbcode_status && $url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], - 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), - 'POST_DATE' => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '', + 'BBCODE_STATUS' => ($bbcode_status) ? sprintf(phpbb::$user->lang['BBCODE_IS_ON'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>') : sprintf(phpbb::$user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid('faq', 'mode=bbcode') . '">', '</a>'), + 'IMG_STATUS' => ($img_status) ? phpbb::$user->lang['IMAGES_ARE_ON'] : phpbb::$user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($flash_status) ? phpbb::$user->lang['FLASH_IS_ON'] : phpbb::$user->lang['FLASH_IS_OFF'], + 'SMILIES_STATUS' => ($smilies_status) ? phpbb::$user->lang['SMILIES_ARE_ON'] : phpbb::$user->lang['SMILIES_ARE_OFF'], + 'URL_STATUS' => ($bbcode_status && $url_status) ? phpbb::$user->lang['URL_IS_ON'] : phpbb::$user->lang['URL_IS_OFF'], + 'MINI_POST_IMG' => phpbb::$user->img('icon_post_target', 'POST'), + 'POST_DATE' => ($post_data['post_time']) ? phpbb::$user->format_date($post_data['post_time']) : '', 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], 'EDIT_REASON' => $post_data['post_edit_reason'], @@ -1274,26 +1274,26 @@ $template->assign_vars(array( 'S_CLOSE_PROGRESS_WINDOW' => phpbb_request::is_set_post('add_file'), 'S_EDIT_POST' => ($mode == 'edit') ? true : false, '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_DISPLAY_USERNAME' => (!phpbb::$user->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() - (phpbb::$config['edit_time'] * 60) || !phpbb::$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'] == phpbb::$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) && phpbb::$config['allow_sig'] && $user->data['is_registered']) ? true : false, + 'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id) && phpbb::$config['allow_sig'] && phpbb::$user->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']) || !phpbb::$config['allow_topic_notify'] || !phpbb::$config['email_enable']) ? false : true, + 'S_NOTIFY_ALLOWED' => (!phpbb::$user->is_registered || ($mode == 'edit' && phpbb::$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_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && phpbb::$user->is_registered && !empty($post_data['topic_poster']) && phpbb::$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"' : '', 'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '', 'S_LINKS_ALLOWED' => $url_status, 'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '', 'S_TYPE_TOGGLE' => $topic_type_toggle, - 'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $mode != 'edit') ? true : false, - 'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $post_data['drafts']) ? true : false, + 'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && phpbb::$user->is_registered && $mode != 'edit') ? true : false, + 'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && phpbb::$user->is_registered && $post_data['drafts']) ? true : false, 'S_FORM_ENCTYPE' => $form_enctype, 'S_BBCODE_IMG' => $img_status, @@ -1315,10 +1315,10 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_ $template->assign_vars(array( 'S_SHOW_POLL_BOX' => true, 'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id)), - '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' => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == phpbb::$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'], phpbb::$config['max_poll_options']), + 'L_POLL_OPTIONS_EXPLAIN' => sprintf(phpbb::$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'] : '', @@ -1359,18 +1359,16 @@ page_footer(); */ function upload_popup($forum_style = 0) { - global $template, $user; + ($forum_style) ? phpbb::$user->setup('posting', $forum_style) : phpbb::$user->setup('posting'); - ($forum_style) ? $user->setup('posting', $forum_style) : $user->setup('posting'); - - page_header($user->lang['PROGRESS_BAR']); + page_header(phpbb::$user->lang['PROGRESS_BAR']); $template->set_filenames(array( 'popup' => 'posting_progress_bar.html') ); $template->assign_vars(array( - 'PROGRESS_BAR' => $user->img('upload_bar', $user->lang['UPLOAD_IN_PROGRESS'])) + 'PROGRESS_BAR' => phpbb::$user->img('upload_bar', 'UPLOAD_IN_PROGRESS')) ); $template->display('popup'); @@ -1384,10 +1382,8 @@ function upload_popup($forum_style = 0) */ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) { - 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() - (phpbb::$config['edit_time'] * 60) || !phpbb::$config['edit_time']))) + if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == phpbb::$user->data['user_id'] && phpbb::$user->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, @@ -1417,18 +1413,18 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_TOPIC', $post_data['topic_title']); $meta_info = append_sid('viewforum', "f=$forum_id"); - $message = $user->lang['POST_DELETED']; + $message = phpbb::$user->lang['POST_DELETED']; } else { add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_POST', $post_data['post_subject']); $meta_info = append_sid('viewtopic', "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; - $message = $user->lang['POST_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $meta_info . '">', '</a>'); + $message = phpbb::$user->lang['POST_DELETED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . $meta_info . '">', '</a>'); } meta_refresh(3, $meta_info); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>'); + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . append_sid('viewforum', 'f=' . $forum_id) . '">', '</a>'); trigger_error($message); } else @@ -1438,12 +1434,12 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data) } // If we are here the user is not able to delete - present the correct error message - if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) + if ($post_data['poster_id'] != phpbb::$user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) { trigger_error('DELETE_OWN_POSTS'); } - if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id']) + if ($post_data['poster_id'] == phpbb::$user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id']) { trigger_error('CANNOT_DELETE_REPLIED'); } diff --git a/phpBB/report.php b/phpBB/report.php index 2d1c25fe87..07179007f4 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -18,15 +18,15 @@ include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); -$user->setup('mcp'); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup('mcp'); $forum_id = request_var('f', 0); $post_id = request_var('p', 0); $reason_id = request_var('reason_id', 0); $report_text = utf8_normalize_nfc(request_var('report_text', '', true)); -$user_notify = ($user->data['is_registered']) ? request_var('notify', 0) : false; +$user_notify = (phpbb::$user->is_registered) ? request_var('notify', 0) : false; $submit = phpbb_request::is_set_post('submit'); @@ -50,7 +50,7 @@ $sql = 'SELECT t.*, p.* AND p.topic_id = t.topic_id"; $result = $db->sql_query($sql); $report_data = $db->sql_fetchrow($result); -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); if (!$report_data) { @@ -65,7 +65,7 @@ $sql = 'SELECT * WHERE forum_id = ' . $forum_id; $result = $db->sql_query($sql); $forum_data = $db->sql_fetchrow($result); -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); if (!$forum_data) { @@ -86,8 +86,8 @@ unset($acl_check_ary); if ($report_data['post_reported']) { - $message = $user->lang['ALREADY_REPORTED']; - $message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang['ALREADY_REPORTED']; + $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); } @@ -109,7 +109,7 @@ if ($submit && $reason_id) $sql_ary = array( 'reason_id' => (int) $reason_id, 'post_id' => $post_id, - 'user_id' => (int) $user->data['user_id'], + 'user_id' => (int) phpbb::$user->data['user_id'], 'user_notify' => (int) $user_notify, 'report_closed' => 0, 'report_time' => (int) time(), @@ -139,7 +139,7 @@ if ($submit && $reason_id) meta_refresh(3, $redirect_url); - $message = $user->lang['POST_REPORTED_SUCCESS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang['POST_REPORTED_SUCCESS'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); } @@ -151,13 +151,13 @@ $template->assign_vars(array( 'S_REPORT_ACTION' => append_sid('report', 'f=' . $forum_id . '&p=' . $post_id), 'S_NOTIFY' => $user_notify, - 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false) + 'S_CAN_NOTIFY' => (phpbb::$user->is_registered) ? true : false) ); generate_forum_nav($forum_data); // Start output of page -page_header($user->lang['REPORT_POST']); +page_header(phpbb::$user->lang['REPORT_POST']); $template->set_filenames(array( 'body' => 'report_body.html') diff --git a/phpBB/search.php b/phpBB/search.php index 70bd468d6a..5a7b690255 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -17,9 +17,9 @@ if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); -$user->setup('search'); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup('search'); // Define initial vars $mode = request_var('mode', ''); @@ -55,17 +55,17 @@ if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !phpbb } // Check search load limit -if ($user->load && phpbb::$config['limit_search_load'] && ($user->load > doubleval(phpbb::$config['limit_search_load']))) +if (phpbb::$user->system['load'] && phpbb::$config['limit_search_load'] && (phpbb::$user->system['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) ? phpbb::$config['search_anonymous_interval'] : phpbb::$config['search_interval']; +$interval = (phpbb::$user->is_guest) ? phpbb::$config['search_anonymous_interval'] : phpbb::$config['search_interval']; if ($interval && !$auth->acl_get('u_ignoreflood')) { - if ($user->data['user_last_search'] > time() - $interval) + if (phpbb::$user->data['user_last_search'] > time() - $interval) { $template->assign_var('S_NO_SEARCH', true); trigger_error('NO_SEARCH_TIME'); @@ -73,8 +73,8 @@ if ($interval && !$auth->acl_get('u_ignoreflood')) } // Define some vars -$limit_days = array(0 => $user->lang['ALL_RESULTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); -$sort_by_text = array('a' => $user->lang['SORT_AUTHOR'], 't' => $user->lang['SORT_TIME'], 'f' => $user->lang['SORT_FORUM'], 'i' => $user->lang['SORT_TOPIC_TITLE'], 's' => $user->lang['SORT_POST_SUBJECT']); +$limit_days = array(0 => phpbb::$user->lang['ALL_RESULTS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); +$sort_by_text = array('a' => phpbb::$user->lang['SORT_AUTHOR'], 't' => phpbb::$user->lang['SORT_TIME'], 'f' => phpbb::$user->lang['SORT_FORUM'], 'i' => phpbb::$user->lang['SORT_TOPIC_TITLE'], 's' => phpbb::$user->lang['SORT_POST_SUBJECT']); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); @@ -87,11 +87,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) // egosearch is an author search if ($search_id == 'egosearch') { - $author_id = $user->data['user_id']; + $author_id = phpbb::$user->data['user_id']; - if ($user->data['user_id'] == ANONYMOUS) + if (phpbb::$user->is_guest) { - login_box('', $user->lang['LOGIN_EXPLAIN_EGOSEARCH']); + login_box('', phpbb::$user->lang['LOGIN_EXPLAIN_EGOSEARCH']); } } @@ -105,7 +105,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { 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'], phpbb::$config['min_search_author_chars'])); + trigger_error(sprintf(phpbb::$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)) . "'"; @@ -153,12 +153,12 @@ if ($keywords || $author || $author_id || $search_id || $submit) $ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true)))); } - $not_in_fid = (sizeof($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : ""; + $not_in_fid = (sizeof($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) phpbb::$user->data['user_id'] . ')' : ""; $sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, fa.user_id FROM ' . FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id - AND fa.session_id = '" . $db->sql_escape($user->session_id) . "') + AND fa.session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "') $not_in_fid ORDER BY f.left_id"; $result = $db->sql_query($sql); @@ -167,7 +167,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $reset_search_forum = true; while ($row = $db->sql_fetchrow($result)) { - if ($row['forum_password'] && $row['user_id'] != $user->data['user_id']) + if ($row['forum_password'] && $row['user_id'] != phpbb::$user->data['user_id']) { $ex_fid_ary[] = (int) $row['forum_id']; continue; @@ -243,8 +243,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $correct_query = $search->split_keywords($keywords, $search_terms); if (!$correct_query || (empty($search->search_query) && !sizeof($author_id_ary) && !$search_id)) { - $ignored = (sizeof($search->common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->common_words)) . '<br />' : ''; - trigger_error($ignored . sprintf($user->lang['NO_KEYWORDS'], $search->word_length['min'], $search->word_length['max'])); + $ignored = (sizeof($search->common_words)) ? sprintf(phpbb::$user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->common_words)) . '<br />' : ''; + trigger_error($ignored . sprintf(phpbb::$user->lang['NO_KEYWORDS'], $search->word_length['min'], $search->word_length['max'])); } } @@ -266,7 +266,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { // Oh holy Bob, bring us some activity... case 'active_topics': - $l_search_title = $user->lang['SEARCH_ACTIVE_TOPICS']; + $l_search_title = phpbb::$user->lang['SEARCH_ACTIVE_TOPICS']; $show_results = 'topics'; $sort_key = 't'; $sort_dir = 'd'; @@ -289,7 +289,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) break; case 'unanswered': - $l_search_title = $user->lang['SEARCH_UNANSWERED']; + $l_search_title = phpbb::$user->lang['SEARCH_UNANSWERED']; $show_results = request_var('sr', 'topics'); $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; $sort_by_sql['t'] = ($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'; @@ -342,7 +342,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) break; case 'newposts': - $l_search_title = $user->lang['SEARCH_NEW']; + $l_search_title = phpbb::$user->lang['SEARCH_NEW']; // force sorting $show_results = (request_var('sr', 'topics') == 'posts') ? 'posts' : 'topics'; $sort_key = 't'; @@ -357,7 +357,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $sql = 'SELECT p.post_id FROM ' . POSTS_TABLE . ' p - WHERE p.post_time > ' . $user->data['user_lastvisit'] . " + WHERE p.post_time > ' . phpbb::$user->data['user_lastvisit'] . " $m_approve_fid_sql " . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; @@ -367,7 +367,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $sql = 'SELECT t.topic_id FROM ' . TOPICS_TABLE . ' t - WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . ' + WHERE t.topic_last_post_time > ' . phpbb::$user->data['user_lastvisit'] . ' AND t.topic_moved_id = 0 ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " @@ -377,7 +377,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) break; case 'egosearch': - $l_search_title = $user->lang['SEARCH_SELF']; + $l_search_title = phpbb::$user->lang['SEARCH_SELF']; break; } } @@ -447,7 +447,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); } - $user->add_lang('viewtopic'); + phpbb::$user->add_lang('viewtopic'); // Grab icons $icons = phpbb_cache::obtain_icons(); @@ -457,11 +457,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) { // limit the number to 1000 for pre-made searches $total_match_count--; - $l_search_matches = sprintf($user->lang['FOUND_MORE_SEARCH_MATCHES'], $total_match_count); + $l_search_matches = sprintf(phpbb::$user->lang['FOUND_MORE_SEARCH_MATCHES'], $total_match_count); } else { - $l_search_matches = ($total_match_count == 1) ? sprintf($user->lang['FOUND_SEARCH_MATCH'], $total_match_count) : sprintf($user->lang['FOUND_SEARCH_MATCHES'], $total_match_count); + $l_search_matches = ($total_match_count == 1) ? sprintf(phpbb::$user->lang['FOUND_SEARCH_MATCH'], $total_match_count) : sprintf(phpbb::$user->lang['FOUND_SEARCH_MATCHES'], $total_match_count); } // define some vars for urls @@ -501,11 +501,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'S_SEARCH_ACTION' => $u_search, 'S_SHOW_TOPICS' => ($show_results == 'posts') ? false : true, - 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), - 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), - 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'GOTO_PAGE_IMG' => phpbb::$user->img('icon_post_target', 'GOTO_PAGE'), + 'NEWEST_POST_IMG' => phpbb::$user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'TOPIC_REPORTED'), + 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), + 'LAST_POST_IMG' => phpbb::$user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'U_SEARCH_WORDS' => $u_search, )); @@ -517,7 +517,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) // @todo Joining this query to the one below? $sql = 'SELECT zebra_id, friend, foe FROM ' . ZEBRA_TABLE . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); $zebra = array(); @@ -541,26 +541,26 @@ if ($keywords || $author || $author_id || $search_id || $submit) ' . (($sort_key == 'a') ? ' LEFT JOIN ' . USERS_TABLE . ' u ON (u.user_id = t.topic_poster) ' : ''); $sql_select = 't.*, f.forum_id, f.forum_name'; - if ($user->data['is_registered']) + if (phpbb::$user->is_registered) { - if (phpbb::$config['load_db_track'] && $author_id !== $user->data['user_id']) + if (phpbb::$config['load_db_track'] && $author_id !== phpbb::$user->data['user_id']) { - $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.user_id = ' . $user->data['user_id'] . ' + $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.topic_id = tp.topic_id)'; $sql_select .= ', tp.topic_posted'; } if (phpbb::$config['load_db_lastread']) { - $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.user_id = ' . $user->data['user_id'] . ' + $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.topic_id = tt.topic_id) - LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' + LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . phpbb::$user->data['user_id'] . ' AND ft.forum_id = f.forum_id)'; $sql_select .= ', tt.mark_time, ft.mark_time as f_mark_time'; } } - if (phpbb::$config['load_anon_lastread'] || ($user->data['is_registered'] && !phpbb::$config['load_db_lastread'])) + if (phpbb::$config['load_anon_lastread'] || (phpbb::$user->data['is_registered'] && !phpbb::$config['load_db_lastread'])) { $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'] && phpbb::$config['load_db_lastread']) + if (!isset($forums[$row['forum_id']]) && phpbb::$user->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'] && phpbb::$config['load_db_lastread']) + if (phpbb::$user->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 (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || phpbb::$user->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']) + if (!phpbb::$user->is_registered) { - $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + phpbb::$config['board_startdate']) : 0; + phpbb::$user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + phpbb::$config['board_startdate']) : 0; } } } @@ -773,7 +773,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($show_results == 'topics') { - if (phpbb::$config['load_db_track'] && $author_id === $user->data['user_id']) + if (phpbb::$config['load_db_track'] && $author_id === phpbb::$user->data['user_id']) { $row['topic_posted'] = 1; } @@ -785,7 +785,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; - $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid('mcp', 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; + $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid('mcp', 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, phpbb::$user->session_id) : ''; $row['topic_title'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#is', '<span class="posthilit">$1</span>', $row['topic_title']); @@ -793,10 +793,10 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'FIRST_POST_TIME' => phpbb::$user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_TIME' => phpbb::$user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => phpbb::$user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), @@ -804,17 +804,17 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'PAGINATION' => topic_generate_pagination($replies, $view_topic_url), 'TOPIC_TYPE' => $topic_type, - 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), - 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, 'src'), - 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], - 'TOPIC_FOLDER_IMG_WIDTH'=> $user->img($folder_img, '', 'width'), - 'TOPIC_FOLDER_IMG_HEIGHT' => $user->img($folder_img, '', 'height'), + 'TOPIC_FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), + 'TOPIC_FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, 'src'), + 'TOPIC_FOLDER_IMG_ALT' => phpbb::$user->lang[$folder_alt], + 'TOPIC_FOLDER_IMG_WIDTH'=> phpbb::$user->img($folder_img, '', 'width'), + 'TOPIC_FOLDER_IMG_HEIGHT' => phpbb::$user->img($folder_img, '', 'height'), 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', - 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', - 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? phpbb::$user->img('icon_topic_attach', phpbb::$user->lang['TOTAL_ATTACHMENTS']) : '', + 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? phpbb::$user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'S_TOPIC_GLOBAL' => (!$forum_id) ? true : false, 'S_TOPIC_TYPE' => $row['topic_type'], @@ -829,7 +829,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_NEWEST_POST' => $view_topic_url . '&view=unread#unread', - 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&mode=reports&t=' . $result_topic_id, true, $user->session_id), + 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&mode=reports&t=' . $result_topic_id, true, phpbb::$user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, ); } @@ -840,7 +840,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $template->assign_block_vars('searchresults', array( 'S_IGNORE_POST' => true, - 'L_IGNORE_POST' => sprintf($user->lang['POST_BY_FOE'], $row['username'], "<a href=\"$u_search&start=$start&p=" . $row['post_id'] . '&view=show#p' . $row['post_id'] . '">', '</a>')) + 'L_IGNORE_POST' => sprintf(phpbb::$user->lang['POST_BY_FOE'], $row['username'], "<a href=\"$u_search&start=$start&p=" . $row['post_id'] . '&view=show#p' . $row['post_id'] . '">', '</a>')) ); continue; @@ -889,7 +889,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_SUBJECT' => $row['post_subject'], - 'POST_DATE' => (!empty($row['post_time'])) ? $user->format_date($row['post_time']) : '', + 'POST_DATE' => (!empty($row['post_time'])) ? phpbb::$user->format_date($row['post_time']) : '', 'MESSAGE' => $row['post_text'] ); } @@ -920,7 +920,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } unset($rowset); - page_header(($l_search_title) ? $l_search_title : $user->lang['SEARCH']); + page_header(($l_search_title) ? $l_search_title : phpbb::$user->lang['SEARCH']); $template->set_filenames(array( 'body' => 'search_results.html') @@ -936,7 +936,7 @@ $s_forums = ''; $sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id, f.forum_password, f.enable_indexing, fa.user_id FROM ' . FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id - AND fa.session_id = '" . $db->sql_escape($user->session_id) . "') + AND fa.session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "') ORDER BY f.left_id ASC"; $result = $db->sql_query($sql); @@ -1016,7 +1016,7 @@ if ($holding) $s_forums .= $holding; } -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); unset($pad_store); if (!$s_forums) @@ -1025,7 +1025,7 @@ if (!$s_forums) } // Number of chars returned -$s_characters = '<option value="-1">' . $user->lang['ALL_AVAILABLE'] . '</option>'; +$s_characters = '<option value="-1">' . phpbb::$user->lang['ALL_AVAILABLE'] . '</option>'; $s_characters .= '<option value="0">0</option>'; $s_characters .= '<option value="25">25</option>'; $s_characters .= '<option value="50">50</option>'; @@ -1084,7 +1084,7 @@ if ($auth->acl_get('a_search')) $template->assign_block_vars('recentsearch', array( 'KEYWORDS' => $keywords, - 'TIME' => $user->format_date($row['search_time']), + 'TIME' => phpbb::$user->format_date($row['search_time']), 'U_KEYWORDS' => append_sid('search', 'keywords=' . urlencode(htmlspecialchars_decode($keywords))) )); @@ -1093,7 +1093,7 @@ if ($auth->acl_get('a_search')) } // Output the basic page -page_header($user->lang['SEARCH']); +page_header(phpbb::$user->lang['SEARCH']); $template->set_filenames(array( 'body' => 'search_body.html') diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 726de2071f..58700b73a0 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -42,29 +42,29 @@ switch ($mode) { case 'activate': $module->load('ucp', 'activate'); - $module->display($user->lang['UCP_ACTIVATE']); + $module->display(phpbb::$user->lang['UCP_ACTIVATE']); redirect(append_sid('index')); break; case 'resend_act': $module->load('ucp', 'resend'); - $module->display($user->lang['UCP_RESEND']); + $module->display(phpbb::$user->lang['UCP_RESEND']); break; case 'sendpassword': $module->load('ucp', 'remind'); - $module->display($user->lang['UCP_REMIND']); + $module->display(phpbb::$user->lang['UCP_REMIND']); break; case 'register': - if ($user->data['is_registered'] || phpbb_request::is_set('not_agreed')) + if (phpbb::$user->is_registered || phpbb_request::is_set('not_agreed')) { redirect(append_sid('index')); } $module->load('ucp', 'register'); - $module->display($user->lang['REGISTER']); + $module->display(phpbb::$user->lang['REGISTER']); break; case 'confirm': @@ -104,9 +104,9 @@ switch ($mode) $message = ($mode == 'terms') ? 'TERMS_OF_USE_CONTENT' : 'PRIVACY_POLICY'; $title = ($mode == 'terms') ? 'TERMS_USE' : 'PRIVACY'; - if (empty($user->lang[$message])) + if (empty(phpbb::$user->lang[$message])) { - if ($user->data['is_registered']) + if (phpbb::$user->is_registered) { redirect(append_sid('index')); } @@ -119,14 +119,14 @@ switch ($mode) ); // Disable online list - page_header($user->lang[$title], false); + page_header(phpbb::$user->lang[$title], false); $template->assign_vars(array( 'S_AGREEMENT' => true, - 'AGREEMENT_TITLE' => $user->lang[$title], - 'AGREEMENT_TEXT' => sprintf($user->lang[$message], phpbb::$config['sitename'], generate_board_url()), + 'AGREEMENT_TITLE' => phpbb::$user->lang[$title], + 'AGREEMENT_TEXT' => sprintf(phpbb::$user->lang[$message], phpbb::$config['sitename'], generate_board_url()), 'U_BACK' => append_sid('ucp', 'mode=login'), - 'L_BACK' => $user->lang['BACK_TO_LOGIN']) + 'L_BACK' => phpbb::$user->lang['BACK_TO_LOGIN']) ); page_footer(); @@ -148,22 +148,22 @@ switch ($mode) // Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_ if (strpos($cookie_name, 'poll_') !== 0) { - $user->set_cookie($cookie_name, '', $set_time); + phpbb::$user->set_cookie($cookie_name, '', $set_time); } } - $user->set_cookie('track', '', $set_time); - $user->set_cookie('u', '', $set_time); - $user->set_cookie('k', '', $set_time); - $user->set_cookie('sid', '', $set_time); + phpbb::$user->set_cookie('track', '', $set_time); + phpbb::$user->set_cookie('u', '', $set_time); + phpbb::$user->set_cookie('k', '', $set_time); + phpbb::$user->set_cookie('sid', '', $set_time); // We destroy the session here, the user will be logged out nevertheless - $user->session_kill(); - $user->session_begin(); + phpbb::$user->session_kill(); + phpbb::$user->session_begin(); meta_refresh(3, append_sid('index')); - $message = $user->lang['COOKIES_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); + $message = phpbb::$user->lang['COOKIES_DELETED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); trigger_error($message); } else @@ -186,7 +186,7 @@ switch ($mode) $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == $user->data['user_id']) + if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == phpbb::$user->data['user_id']) { redirect(append_sid('index')); } @@ -194,42 +194,42 @@ switch ($mode) include(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT); $auth_admin = new auth_admin(); - if (!$auth_admin->ghost_permissions($user_id, $user->data['user_id'])) + if (!$auth_admin->ghost_permissions($user_id, phpbb::$user->data['user_id'])) { redirect(append_sid('index')); } add_log('admin', 'LOG_ACL_TRANSFER_PERMISSIONS', $user_row['username']); - $message = sprintf($user->lang['PERMISSIONS_TRANSFERRED'], $user_row['username']) . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); + $message = sprintf(phpbb::$user->lang['PERMISSIONS_TRANSFERRED'], $user_row['username']) . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); trigger_error($message); break; case 'restore_perm': - if (!$user->data['user_perm_from'] || !$auth->acl_get('a_switchperm')) + if (!phpbb::$user->data['user_perm_from'] || !$auth->acl_get('a_switchperm')) { redirect(append_sid('index')); } - $auth->acl_cache($user->data); + $auth->acl_cache(phpbb::$user->data); $sql = 'UPDATE ' . USERS_TABLE . " SET user_perm_from = 0 - WHERE user_id = " . $user->data['user_id']; + WHERE user_id = " . phpbb::$user->data['user_id']; $db->sql_query($sql); $sql = 'SELECT username FROM ' . USERS_TABLE . ' - WHERE user_id = ' . $user->data['user_perm_from']; + WHERE user_id = ' . phpbb::$user->data['user_perm_from']; $result = $db->sql_query($sql); $username = $db->sql_fetchfield('username'); $db->sql_freeresult($result); add_log('admin', 'LOG_ACL_RESTORE_PERMISSIONS', $username); - $message = $user->lang['PERMISSIONS_RESTORED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); + $message = phpbb::$user->lang['PERMISSIONS_RESTORED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a>'); trigger_error($message); break; @@ -237,14 +237,14 @@ switch ($mode) default: // Only registered users can go beyond this point - if (!$user->data['is_registered']) + if (!phpbb::$user->is_registered) { - if ($user->data['is_bot']) + if (phpbb::$user->is_bot) { redirect(append_sid('index')); } - login_box('', $user->lang['LOGIN_EXPLAIN_UCP']); + login_box('', phpbb::$user->lang['LOGIN_EXPLAIN_UCP']); } // Instantiate module system and generate list of available modules @@ -282,8 +282,6 @@ switch ($mode) */ function _display_friends() { - global $db, $template, $user, $auth; - $update_time = phpbb::$config['load_online_time'] * 60; $sql = $db->sql_build_query('SELECT_DISTINCT', array( @@ -301,7 +299,7 @@ function _display_friends() ) ), - 'WHERE' => 'z.user_id = ' . $user->data['user_id'] . ' + 'WHERE' => 'z.user_id = ' . phpbb::$user->data['user_id'] . ' AND z.friend = 1 AND u.user_id = z.zebra_id', @@ -333,8 +331,6 @@ function _display_friends() */ function _module_zebra($mode, &$module_row) { - global $template; - $template->assign_var('S_ZEBRA_ENABLED', true); if ($mode == 'friends') diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 4186d19f09..60420c97b1 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -18,17 +18,17 @@ include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); // Start session -$user->session_begin(); -$auth->acl($user->data); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); // Start initial var setup $forum_id = request_var('f', 0); $mark_read = request_var('mark', ''); $start = request_var('start', 0); -$default_sort_days = (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0; -$default_sort_key = (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'; -$default_sort_dir = (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'; +$default_sort_days = (!empty(phpbb::$user->data['user_topic_show_days'])) ? phpbb::$user->data['user_topic_show_days'] : 0; +$default_sort_key = (!empty(phpbb::$user->data['user_topic_sortby_type'])) ? phpbb::$user->data['user_topic_sortby_type'] : 't'; +$default_sort_dir = (!empty(phpbb::$user->data['user_topic_sortby_dir'])) ? phpbb::$user->data['user_topic_sortby_dir'] : 'd'; $sort_days = request_var('st', $default_sort_days); $sort_key = request_var('sk', $default_sort_key); @@ -45,16 +45,16 @@ $sql_from = FORUMS_TABLE . ' f'; $lastread_select = ''; // Grab appropriate forum data -if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) +if (phpbb::$config['load_db_lastread'] && phpbb::$user->is_registered) { - $sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' + $sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . phpbb::$user->data['user_id'] . ' AND ft.forum_id = f.forum_id)'; $lastread_select .= ', ft.mark_time'; } -if ($user->data['is_registered']) +if (phpbb::$user->is_registered) { - $sql_from .= ' LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON (fw.forum_id = f.forum_id AND fw.user_id = ' . $user->data['user_id'] . ')'; + $sql_from .= ' LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON (fw.forum_id = f.forum_id AND fw.user_id = ' . phpbb::$user->data['user_id'] . ')'; $lastread_select .= ', fw.notify_status'; } @@ -63,7 +63,7 @@ $sql = "SELECT f.* $lastread_select WHERE f.forum_id = $forum_id"; $result = $db->sql_query($sql); $forum_data = $db->sql_fetchrow($result); -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); if (!$forum_data) { @@ -72,23 +72,23 @@ if (!$forum_data) // Configure style, language, etc. -$user->setup('viewforum', $forum_data['forum_style']); +phpbb::$user->setup('viewforum', $forum_data['forum_style']); // Redirect to login upon emailed notification links -if (phpbb_request::is_set('e', phpbb_request::GET) && !$user->data['is_registered']) +if (phpbb_request::is_set('e', phpbb_request::GET) && !phpbb::$user->is_registered) { - login_box('', $user->lang['LOGIN_NOTIFY_FORUM']); + login_box('', phpbb::$user->lang['LOGIN_NOTIFY_FORUM']); } // Permissions check if (!$auth->acl_gets('f_list', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id))) { - if ($user->data['user_id'] != ANONYMOUS) + if (!phpbb::$user->is_guest) { trigger_error('SORRY_AUTH_READ'); } - login_box('', $user->lang['LOGIN_VIEWFORUM']); + login_box('', phpbb::$user->lang['LOGIN_VIEWFORUM']); } // Forum is passworded ... check whether access has been granted to this @@ -139,7 +139,7 @@ else } // Dump out the page header and load viewforum template -page_header($user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name']); +page_header(phpbb::$user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name']); $template->set_filenames(array( 'body' => 'viewforum_body.html') @@ -181,7 +181,7 @@ if ($mark_read == 'topics') $redirect_url = append_sid('viewforum', 'f=' . $forum_id); meta_refresh(3, $redirect_url); - trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>')); + trigger_error(phpbb::$user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>')); } // Is a forum specific topic count required? @@ -206,16 +206,16 @@ $s_watching_forum = array( 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); + watch_topic_forum('forum', $s_watching_forum, phpbb::$user->data['user_id'], $forum_id, 0, $notify_status); } $s_forum_rules = ''; gen_forum_auth_level('forum', $forum_id, $forum_data['forum_status']); // Topic ordering options -$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); +$limit_days = array(0 => phpbb::$user->lang['ALL_TOPICS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); -$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); +$sort_by_text = array('a' => phpbb::$user->lang['AUTHOR'], 't' => phpbb::$user->lang['POST_TIME'], 'r' => phpbb::$user->lang['REPLIES'], 's' => phpbb::$user->lang['SUBJECT'], 'v' => phpbb::$user->lang['VIEWS']); $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -260,7 +260,7 @@ if ($start < 0 || $start > $topics_count) } // Basic pagewide vars -$post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LOCKED'] : $user->lang['POST_NEW_TOPIC']; +$post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? phpbb::$user->lang['FORUM_LOCKED'] : phpbb::$user->lang['POST_NEW_TOPIC']; // Display active topics? $s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false; @@ -268,27 +268,27 @@ $s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['for $template->assign_vars(array( 'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : '', - 'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', $post_alt) : $user->img('button_topic_new', $post_alt), - 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), - 'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'), - 'FOLDER_NEW_IMG' => $user->img('topic_unread', 'NEW_POSTS'), - 'FOLDER_HOT_IMG' => $user->img('topic_read_hot', 'NO_NEW_POSTS_HOT'), - 'FOLDER_HOT_NEW_IMG' => $user->img('topic_unread_hot', 'NEW_POSTS_HOT'), - 'FOLDER_LOCKED_IMG' => $user->img('topic_read_locked', 'NO_NEW_POSTS_LOCKED'), - 'FOLDER_LOCKED_NEW_IMG' => $user->img('topic_unread_locked', 'NEW_POSTS_LOCKED'), - 'FOLDER_STICKY_IMG' => $user->img('sticky_read', 'POST_STICKY'), - 'FOLDER_STICKY_NEW_IMG' => $user->img('sticky_unread', 'POST_STICKY'), - 'FOLDER_ANNOUNCE_IMG' => $user->img('announce_read', 'POST_ANNOUNCEMENT'), - 'FOLDER_ANNOUNCE_NEW_IMG' => $user->img('announce_unread', 'POST_ANNOUNCEMENT'), - 'FOLDER_MOVED_IMG' => $user->img('topic_moved', 'TOPIC_MOVED'), - 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), - 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), - - 'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'], - - 'S_DISPLAY_POST_INFO' => ($forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, + 'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? phpbb::$user->img('button_topic_locked', $post_alt) : phpbb::$user->img('button_topic_new', $post_alt), + 'NEWEST_POST_IMG' => phpbb::$user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'LAST_POST_IMG' => phpbb::$user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'FOLDER_IMG' => phpbb::$user->img('topic_read', 'NO_NEW_POSTS'), + 'FOLDER_NEW_IMG' => phpbb::$user->img('topic_unread', 'NEW_POSTS'), + 'FOLDER_HOT_IMG' => phpbb::$user->img('topic_read_hot', 'NO_NEW_POSTS_HOT'), + 'FOLDER_HOT_NEW_IMG' => phpbb::$user->img('topic_unread_hot', 'NEW_POSTS_HOT'), + 'FOLDER_LOCKED_IMG' => phpbb::$user->img('topic_read_locked', 'NO_NEW_POSTS_LOCKED'), + 'FOLDER_LOCKED_NEW_IMG' => phpbb::$user->img('topic_unread_locked', 'NEW_POSTS_LOCKED'), + 'FOLDER_STICKY_IMG' => phpbb::$user->img('sticky_read', 'POST_STICKY'), + 'FOLDER_STICKY_NEW_IMG' => phpbb::$user->img('sticky_unread', 'POST_STICKY'), + 'FOLDER_ANNOUNCE_IMG' => phpbb::$user->img('announce_read', 'POST_ANNOUNCEMENT'), + 'FOLDER_ANNOUNCE_NEW_IMG' => phpbb::$user->img('announce_unread', 'POST_ANNOUNCEMENT'), + 'FOLDER_MOVED_IMG' => phpbb::$user->img('topic_moved', 'TOPIC_MOVED'), + 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'TOPIC_REPORTED'), + 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), + 'GOTO_PAGE_IMG' => phpbb::$user->img('icon_post_target', 'GOTO_PAGE'), + + 'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? phpbb::$user->lang['POST_FORUM_LOCKED'] : phpbb::$user->lang['NO_TOPICS'], + + 'S_DISPLAY_POST_INFO' => ($forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || phpbb::$user->is_guest)) ? true : false, 'S_IS_POSTABLE' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, 'S_USER_CAN_POST' => ($auth->acl_get('f_post', $forum_id)) ? true : false, @@ -307,10 +307,10 @@ $template->assign_vars(array( 'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false, 'S_VIEWFORUM' => true, - '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_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid('mcp', "f=$forum_id&i=main&mode=forum_view", true, phpbb::$user->session_id) : '', + 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || phpbb::$user->is_guest) ? 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'] || phpbb::$config['load_anon_lastread']) ? append_sid('viewforum', 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics") : '', + 'U_MARK_TOPICS' => (phpbb::$user->is_registered || phpbb::$config['load_anon_lastread']) ? append_sid('viewforum', 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics") : '', )); // Grab icons @@ -329,22 +329,22 @@ $sql_array = array( $sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1'; -if ($user->data['is_registered']) +if (phpbb::$user->is_registered) { 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['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . phpbb::$user->data['user_id']); $sql_array['SELECT'] .= ', tp.topic_posted'; } 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['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . phpbb::$user->data['user_id']); $sql_array['SELECT'] .= ', tt.mark_time'; if ($s_display_active && sizeof($active_forum_ary)) { - $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(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . phpbb::$user->data['user_id']); $sql_array['SELECT'] .= ', ft.mark_time AS forum_mark_time'; } } @@ -433,7 +433,7 @@ while ($row = $db->sql_fetchrow($result)) { $topic_list[] = (int) $row['topic_id']; } -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); // For storing shadow topics $shadow_topic_list = array(); @@ -526,7 +526,7 @@ 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, 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))) + 'TOTAL_TOPICS' => ($s_display_active) ? false : (($topics_count == 1) ? phpbb::$user->lang['VIEW_FORUM_TOPIC'] : sprintf(phpbb::$user->lang['VIEW_FORUM_TOPICS'], $topics_count))) ); $topic_list = ($store_reverse) ? array_merge($announcement_list, array_reverse($topic_list)) : array_merge($announcement_list, $topic_list); @@ -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'] = (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']]['forum_mark_time'] = (phpbb::$config['load_db_lastread'] && phpbb::$user->is_registered && isset($row['forum_mark_time'])) ? $row['forum_mark_time'] : 0; $topic_forum_list[$row['forum_id']]['topics'][] = $t_id; } - if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && phpbb::$user->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 (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || phpbb::$user->is_registered) { foreach ($topic_forum_list as $f_id => $topic_row) { @@ -568,20 +568,20 @@ if (sizeof($topic_list)) } else { - if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && phpbb::$user->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']; + $mark_time_forum = (!empty($forum_data['mark_time'])) ? $forum_data['mark_time'] : phpbb::$user->data['user_lastmark']; } - else if (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || phpbb::$user->is_registered) { $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, $global_announce_list); - if (!$user->data['is_registered']) + if (!phpbb::$user->is_registered) { - $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + phpbb::$config['board_startdate']) : 0; + phpbb::$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) + phpbb::$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']) : phpbb::$user->data['user_lastmark']; } } @@ -616,7 +616,7 @@ if (sizeof($topic_list)) $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; - $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid('mcp', 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, $user->session_id) : ''; + $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid('mcp', 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, phpbb::$user->session_id) : ''; // Send vars to template $template->assign_block_vars('topicrow', array( @@ -625,10 +625,10 @@ if (sizeof($topic_list)) 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'FIRST_POST_TIME' => phpbb::$user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_TIME' => phpbb::$user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => phpbb::$user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), @@ -639,17 +639,17 @@ if (sizeof($topic_list)) 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, - 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), - 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, 'src'), - 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], - 'TOPIC_FOLDER_IMG_WIDTH'=> $user->img($folder_img, '', 'width'), - 'TOPIC_FOLDER_IMG_HEIGHT' => $user->img($folder_img, '', 'height'), + 'TOPIC_FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), + 'TOPIC_FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, 'src'), + 'TOPIC_FOLDER_IMG_ALT' => phpbb::$user->lang[$folder_alt], + 'TOPIC_FOLDER_IMG_WIDTH'=> phpbb::$user->img($folder_img, '', 'width'), + 'TOPIC_FOLDER_IMG_HEIGHT' => phpbb::$user->img($folder_img, '', 'height'), 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', - 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', - 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? phpbb::$user->img('icon_topic_attach', 'TOTAL_ATTACHMENTS') : '', + 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? phpbb::$user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false, @@ -669,7 +669,7 @@ if (sizeof($topic_list)) 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url, - 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, $user->session_id), + 'U_MCP_REPORT' => append_sid('mcp', 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, phpbb::$user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, 'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test) diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index bab4e0315c..80bf3ce460 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -17,9 +17,9 @@ if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); -$user->setup('memberlist'); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); +phpbb::$user->setup('memberlist'); // Get and set some variables $mode = request_var('mode', ''); @@ -32,15 +32,15 @@ $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')) { - if ($user->data['user_id'] != ANONYMOUS) + if (!phpbb::$user->is_guest) { trigger_error('NO_VIEW_USERS'); } - login_box('', $user->lang['LOGIN_EXPLAIN_VIEWONLINE']); + login_box('', phpbb::$user->lang['LOGIN_EXPLAIN_VIEWONLINE']); } -$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_JOINED'], 'c' => $user->lang['SORT_LOCATION']); +$sort_key_text = array('a' => phpbb::$user->lang['SORT_USERNAME'], 'b' => phpbb::$user->lang['SORT_JOINED'], 'c' => phpbb::$user->lang['SORT_LOCATION']); $sort_key_sql = array('a' => 'u.username_clean', 'b' => 's.session_time', 'c' => 's.session_page'); // Sorting and order @@ -69,7 +69,7 @@ if ($mode == 'whois' && $auth->acl_get('a_') && $session_id) $db->sql_freeresult($result); // Output the page - page_header($user->lang['WHO_IS_ONLINE']); + page_header(phpbb::$user->lang['WHO_IS_ONLINE']); $template->set_filenames(array( 'body' => 'viewonline_whois.html') @@ -90,7 +90,7 @@ while ($row = $db->sql_fetchrow($result)) { $forum_data[$row['forum_id']] = $row; } -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); $guest_counter = 0; @@ -179,7 +179,7 @@ while ($row = $db->sql_fetchrow($result)) } $s_user_hidden = false; - $username_full = get_username_string('full', $row['user_id'], $user->lang['GUEST']); + $username_full = get_username_string('full', $row['user_id'], phpbb::$user->lang['GUEST']); } else { @@ -195,12 +195,12 @@ while ($row = $db->sql_fetchrow($result)) switch ($on_page[1]) { case 'index': - $location = $user->lang['INDEX']; + $location = phpbb::$user->lang['INDEX']; $location_url = append_sid('index'); break; case 'adm/index': - $location = $user->lang['ACP']; + $location = phpbb::$user->lang['ACP']; $location_url = append_sid('index'); break; @@ -217,7 +217,7 @@ while ($row = $db->sql_fetchrow($result)) if ($forum_data[$forum_id]['forum_type'] == FORUM_LINK) { - $location = sprintf($user->lang['READING_LINK'], $forum_data[$forum_id]['forum_name']); + $location = sprintf(phpbb::$user->lang['READING_LINK'], $forum_data[$forum_id]['forum_name']); break; } @@ -231,58 +231,58 @@ while ($row = $db->sql_fetchrow($result)) { case 'reply': case 'quote': - $location = sprintf($user->lang['REPLYING_MESSAGE'], $forum_data[$forum_id]['forum_name']); + $location = sprintf(phpbb::$user->lang['REPLYING_MESSAGE'], $forum_data[$forum_id]['forum_name']); break; default: - $location = sprintf($user->lang['POSTING_MESSAGE'], $forum_data[$forum_id]['forum_name']); + $location = sprintf(phpbb::$user->lang['POSTING_MESSAGE'], $forum_data[$forum_id]['forum_name']); break; } break; case 'viewtopic': - $location = sprintf($user->lang['READING_TOPIC'], $forum_data[$forum_id]['forum_name']); + $location = sprintf(phpbb::$user->lang['READING_TOPIC'], $forum_data[$forum_id]['forum_name']); break; case 'viewforum': - $location = sprintf($user->lang['READING_FORUM'], $forum_data[$forum_id]['forum_name']); + $location = sprintf(phpbb::$user->lang['READING_FORUM'], $forum_data[$forum_id]['forum_name']); break; } } else { - $location = $user->lang['INDEX']; + $location = phpbb::$user->lang['INDEX']; $location_url = append_sid('index'); } break; case 'search': - $location = $user->lang['SEARCHING_FORUMS']; + $location = phpbb::$user->lang['SEARCHING_FORUMS']; $location_url = append_sid('search'); break; case 'faq': - $location = $user->lang['VIEWING_FAQ']; + $location = phpbb::$user->lang['VIEWING_FAQ']; $location_url = append_sid('faq'); break; case 'viewonline': - $location = $user->lang['VIEWING_ONLINE']; + $location = phpbb::$user->lang['VIEWING_ONLINE']; $location_url = append_sid('viewonline'); break; case 'memberlist': - $location = (strpos($row['session_page'], 'mode=viewprofile') !== false) ? $user->lang['VIEWING_MEMBER_PROFILE'] : $user->lang['VIEWING_MEMBERS']; + $location = (strpos($row['session_page'], 'mode=viewprofile') !== false) ? phpbb::$user->lang['VIEWING_MEMBER_PROFILE'] : phpbb::$user->lang['VIEWING_MEMBERS']; $location_url = append_sid('memberlist'); break; case 'mcp': - $location = $user->lang['VIEWING_MCP']; + $location = phpbb::$user->lang['VIEWING_MCP']; $location_url = append_sid('index'); break; case 'ucp': - $location = $user->lang['VIEWING_UCP']; + $location = phpbb::$user->lang['VIEWING_UCP']; // Grab some common modules $url_params = array( @@ -297,7 +297,7 @@ while ($row = $db->sql_fetchrow($result)) { if (strpos($row['session_page'], $param) !== false) { - $location = $user->lang[$lang]; + $location = phpbb::$user->lang[$lang]; break; } } @@ -306,17 +306,17 @@ while ($row = $db->sql_fetchrow($result)) break; case 'download/file': - $location = $user->lang['DOWNLOADING_FILE']; + $location = phpbb::$user->lang['DOWNLOADING_FILE']; $location_url = append_sid('index'); break; case 'report': - $location = $user->lang['REPORTING_POST']; + $location = phpbb::$user->lang['REPORTING_POST']; $location_url = append_sid('index'); break; default: - $location = $user->lang['INDEX']; + $location = phpbb::$user->lang['INDEX']; $location_url = append_sid('index'); break; } @@ -325,7 +325,7 @@ while ($row = $db->sql_fetchrow($result)) 'USERNAME' => $row['username'], 'USERNAME_COLOUR' => $row['user_colour'], 'USERNAME_FULL' => $username_full, - 'LASTUPDATE' => $user->format_date($row['session_time']), + 'LASTUPDATE' => phpbb::$user->format_date($row['session_time']), 'FORUM_LOCATION' => $location, 'USER_IP' => ($auth->acl_get('a_')) ? (($mode == 'lookup' && $session_id == $row['session_id']) ? gethostbyaddr($row['session_ip']) : $row['session_ip']) : '', 'USER_BROWSER' => ($auth->acl_get('a_user')) ? $row['session_browser'] : '', @@ -340,7 +340,7 @@ while ($row = $db->sql_fetchrow($result)) 'S_USER_TYPE' => $row['user_type'], )); } -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); unset($prev_id, $prev_ip); // Generate reg/hidden/guest online text @@ -355,15 +355,15 @@ foreach ($vars_online as $l_prefix => $var_ary) switch ($$var_ary[0]) { case 0: - $$var_ary[1] = $user->lang[$l_prefix . '_USERS_ZERO_ONLINE']; + $$var_ary[1] = phpbb::$user->lang[$l_prefix . '_USERS_ZERO_ONLINE']; break; case 1: - $$var_ary[1] = $user->lang[$l_prefix . '_USER_ONLINE']; + $$var_ary[1] = phpbb::$user->lang[$l_prefix . '_USER_ONLINE']; break; default: - $$var_ary[1] = $user->lang[$l_prefix . '_USERS_ONLINE']; + $$var_ary[1] = phpbb::$user->lang[$l_prefix . '_USERS_ONLINE']; break; } } @@ -386,11 +386,11 @@ else LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON ( g.group_id = ug.group_id - AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND ug.user_pending = 0 ) WHERE g.group_legend = 1 - AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') + AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . phpbb::$user->data['user_id'] . ') ORDER BY g.group_name ASC'; } $result = $db->sql_query($sql); @@ -400,14 +400,14 @@ while ($row = $db->sql_fetchrow($result)) { if ($row['group_name'] == 'BOTS') { - $legend .= (($legend != '') ? ', ' : '') . '<span style="color:#' . $row['group_colour'] . '">' . $user->lang['G_BOTS'] . '</span>'; + $legend .= (($legend != '') ? ', ' : '') . '<span style="color:#' . $row['group_colour'] . '">' . phpbb::$user->lang['G_BOTS'] . '</span>'; } else { - $legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row['group_colour'] . '" href="' . append_sid('memberlist', 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>'; + $legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row['group_colour'] . '" href="' . append_sid('memberlist', 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>'; } } -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); // Refreshing the page every 60 seconds... meta_refresh(60, append_sid('viewonline', "sg=$show_guests&sk=$sort_key&sd=$sort_dir&start=$start")); @@ -425,7 +425,7 @@ $template->assign_vars(array( 'U_SORT_LOCATION' => append_sid('viewonline', 'sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), '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'], + 'L_SWITCH_GUEST_DISPLAY' => ($show_guests) ? phpbb::$user->lang['HIDE_GUESTS'] : phpbb::$user->lang['DISPLAY_GUESTS'], 'S_SWITCH_GUEST_DISPLAY' => (phpbb::$config['load_online_guests']) ? true : false) ); @@ -433,7 +433,7 @@ $template->assign_vars(array( phpbb::$config['load_online'] = false; // Output the page -page_header($user->lang['WHO_IS_ONLINE']); +page_header(phpbb::$user->lang['WHO_IS_ONLINE']); $template->set_filenames(array( 'body' => 'viewonline_body.html') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index cb7d117dd7..b4798474a0 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -19,8 +19,8 @@ include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); // Start session management -$user->session_begin(); -$auth->acl($user->data); +phpbb::$user->session_begin(); +$auth->acl(phpbb::$user->data); // Initial var setup $forum_id = request_var('f', 0); @@ -31,9 +31,9 @@ $voted_id = request_var('vote_id', array('' => 0)); $start = request_var('start', 0); $view = request_var('view', ''); -$default_sort_days = (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0; -$default_sort_key = (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'; -$default_sort_dir = (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'; +$default_sort_days = (!empty(phpbb::$user->data['user_post_show_days'])) ? phpbb::$user->data['user_post_show_days'] : 0; +$default_sort_key = (!empty(phpbb::$user->data['user_post_sortby_type'])) ? phpbb::$user->data['user_post_sortby_type'] : 't'; +$default_sort_dir = (!empty(phpbb::$user->data['user_post_sortby_dir'])) ? phpbb::$user->data['user_post_sortby_dir'] : 'a'; $sort_days = request_var('st', $default_sort_days); $sort_key = request_var('sk', $default_sort_key); @@ -100,7 +100,7 @@ if ($view && !$post_id) if (!$row) { // Setup user environment so we can process lang string - $user->setup('viewtopic'); + phpbb::$user->setup('viewtopic'); trigger_error('NO_TOPIC'); } @@ -122,7 +122,7 @@ if ($view && !$post_id) if (!$row) { - $user->setup('viewtopic'); + phpbb::$user->setup('viewtopic'); // OK, the topic doesn't exist. This error message is not helpful, but technically correct. trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS'); } @@ -141,7 +141,7 @@ if ($view && !$post_id) if (!$row) { - $user->setup('viewtopic'); + phpbb::$user->setup('viewtopic'); trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS'); } else @@ -190,14 +190,14 @@ if ($post_id) // Topics table need to be the last in the chain $sql_array['FROM'][TOPICS_TABLE] = 't'; -if ($user->data['is_registered']) +if (phpbb::$user->is_registered) { $sql_array['SELECT'] .= ', tw.notify_status'; $sql_array['LEFT_JOIN'] = array(); $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(TOPICS_WATCH_TABLE => 'tw'), - 'ON' => 'tw.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tw.topic_id' + 'ON' => 'tw.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.topic_id = tw.topic_id' ); if (phpbb::$config['allow_bookmarks']) @@ -205,7 +205,7 @@ if ($user->data['is_registered']) $sql_array['SELECT'] .= ', bm.topic_id as bookmarked'; $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(BOOKMARKS_TABLE => 'bm'), - 'ON' => 'bm.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = bm.topic_id' + 'ON' => 'bm.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.topic_id = bm.topic_id' ); } @@ -215,12 +215,12 @@ if ($user->data['is_registered']) $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), - 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id' + 'ON' => 'tt.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.topic_id = tt.topic_id' ); $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id' + 'ON' => 'ft.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.forum_id = ft.forum_id' ); } } @@ -257,7 +257,7 @@ $sql_array['WHERE'] .= ')'; $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql); $topic_data = $db->sql_fetchrow($result); -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); if (!$topic_data) { @@ -322,7 +322,7 @@ if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == PO } // Setup look and feel -$user->setup('viewtopic', $topic_data['forum_style']); +phpbb::$user->setup('viewtopic', $topic_data['forum_style']); if (!$topic_data['topic_approved'] && !$auth->acl_get('m_approve', $forum_id)) { @@ -332,12 +332,12 @@ if (!$topic_data['topic_approved'] && !$auth->acl_get('m_approve', $forum_id)) // Start auth check if (!$auth->acl_get('f_read', $forum_id)) { - if ($user->data['user_id'] != ANONYMOUS) + if (!phpbb::$user->is_guest) { trigger_error('SORRY_AUTH_READ'); } - login_box('', $user->lang['LOGIN_VIEWFORUM']); + login_box('', phpbb::$user->lang['LOGIN_VIEWFORUM']); } // Forum is passworded ... check whether access has been granted to this @@ -354,9 +354,9 @@ if (phpbb_request::is_set('e', phpbb_request::GET)) $redirect_url = append_sid('viewtopic', "f=$forum_id&t=$topic_id"); - if ($user->data['user_id'] == ANONYMOUS) + if (phpbb::$user->is_guest) { - login_box($redirect_url . "&p=$post_id&e=$jump_to", $user->lang['LOGIN_NOTIFY_TOPIC']); + login_box($redirect_url . "&p=$post_id&e=$jump_to", phpbb::$user->lang['LOGIN_NOTIFY_TOPIC']); } if ($jump_to > 0) @@ -378,22 +378,22 @@ if (!isset($topic_tracking_info)) $topic_tracking_info = array(); // Get topic tracking info - if (phpbb::$config['load_db_lastread'] && $user->data['is_registered']) + if (phpbb::$config['load_db_lastread'] && phpbb::$user->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 (phpbb::$config['load_anon_lastread'] || $user->data['is_registered']) + else if (phpbb::$config['load_anon_lastread'] || phpbb::$user->is_registered) { $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id); } } // Post ordering options -$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); +$limit_days = array(0 => phpbb::$user->lang['ALL_POSTS'], 1 => phpbb::$user->lang['1_DAY'], 7 => phpbb::$user->lang['7_DAYS'], 14 => phpbb::$user->lang['2_WEEKS'], 30 => phpbb::$user->lang['1_MONTH'], 90 => phpbb::$user->lang['3_MONTHS'], 180 => phpbb::$user->lang['6_MONTHS'], 365 => phpbb::$user->lang['1_YEAR']); -$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); +$sort_by_text = array('a' => phpbb::$user->lang['AUTHOR'], 't' => phpbb::$user->lang['POST_TIME'], 's' => phpbb::$user->lang['SUBJECT']); $sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.post_time', 's' => 'p.post_subject'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -461,43 +461,43 @@ $s_watching_topic = array( 'is_watching' => false, ); -if ((phpbb::$config['email_enable'] || phpbb::$config['jab_enable']) && phpbb::$config['allow_topic_notify'] && $user->data['is_registered']) +if ((phpbb::$config['email_enable'] || phpbb::$config['jab_enable']) && phpbb::$config['allow_topic_notify'] && phpbb::$user->is_registered) { - watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start); + watch_topic_forum('topic', $s_watching_topic, phpbb::$user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start); // Reset forum notification if forum notify is set 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); + watch_topic_forum('forum', $s_watching_forum, phpbb::$user->data['user_id'], $forum_id, 0); } } // Bookmarks -if (phpbb::$config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0)) +if (phpbb::$config['allow_bookmarks'] && phpbb::$user->is_registered && request_var('bookmark', 0)) { if (check_link_hash(request_var('hash', ''), "topic_$topic_id")) { if (!$topic_data['bookmarked']) { $sql = 'INSERT INTO ' . BOOKMARKS_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'user_id' => $user->data['user_id'], + 'user_id' => phpbb::$user->data['user_id'], 'topic_id' => $topic_id, )); $db->sql_query($sql); } else { - $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . " - WHERE user_id = {$user->data['user_id']} - AND topic_id = $topic_id"; + $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . ' + WHERE user_id = ' . phpbb::$user->data['user_id'] . ' + AND topic_id = ' . $topic_id; $db->sql_query($sql); } - $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']) . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + $message = (($topic_data['bookmarked']) ? phpbb::$user->lang['BOOKMARK_REMOVED'] : phpbb::$user->lang['BOOKMARK_ADDED']) . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); } else { - $message = $user->lang['BOOKMARK_ERR'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + $message = phpbb::$user->lang['BOOKMARK_ERR'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); } meta_refresh(3, $viewtopic_url); @@ -522,21 +522,21 @@ $s_forum_rules = ''; gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); // Quick mod tools -$allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; +$allow_change_type = ($auth->acl_get('m_', $forum_id) || (phpbb::$user->is_registered && phpbb::$user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; $topic_mod = ''; -$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '<option value="lock">' . $user->lang['LOCK_TOPIC'] . '</option>' : '<option value="unlock">' . $user->lang['UNLOCK_TOPIC'] . '</option>') : ''; -$topic_mod .= ($auth->acl_get('m_delete', $forum_id)) ? '<option value="delete_topic">' . $user->lang['DELETE_TOPIC'] . '</option>' : ''; -$topic_mod .= ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) ? '<option value="move">' . $user->lang['MOVE_TOPIC'] . '</option>' : ''; -$topic_mod .= ($auth->acl_get('m_split', $forum_id)) ? '<option value="split">' . $user->lang['SPLIT_TOPIC'] . '</option>' : ''; -$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge">' . $user->lang['MERGE_POSTS'] . '</option>' : ''; -$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge_topic">' . $user->lang['MERGE_TOPIC'] . '</option>' : ''; -$topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '<option value="fork">' . $user->lang['FORK_TOPIC'] . '</option>' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '<option value="make_normal">' . $user->lang['MAKE_NORMAL'] . '</option>' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? '<option value="make_sticky">' . $user->lang['MAKE_STICKY'] . '</option>' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) ? '<option value="make_announce">' . $user->lang['MAKE_ANNOUNCE'] . '</option>' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) ? '<option value="make_global">' . $user->lang['MAKE_GLOBAL'] . '</option>' : ''; -$topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '<option value="topic_logs">' . $user->lang['VIEW_TOPIC_LOGS'] . '</option>' : ''; +$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && phpbb::$user->is_registered && phpbb::$user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '<option value="lock">' . phpbb::$user->lang['LOCK_TOPIC'] . '</option>' : '<option value="unlock">' . phpbb::$user->lang['UNLOCK_TOPIC'] . '</option>') : ''; +$topic_mod .= ($auth->acl_get('m_delete', $forum_id)) ? '<option value="delete_topic">' . phpbb::$user->lang['DELETE_TOPIC'] . '</option>' : ''; +$topic_mod .= ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) ? '<option value="move">' . phpbb::$user->lang['MOVE_TOPIC'] . '</option>' : ''; +$topic_mod .= ($auth->acl_get('m_split', $forum_id)) ? '<option value="split">' . phpbb::$user->lang['SPLIT_TOPIC'] . '</option>' : ''; +$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge">' . phpbb::$user->lang['MERGE_POSTS'] . '</option>' : ''; +$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge_topic">' . phpbb::$user->lang['MERGE_TOPIC'] . '</option>' : ''; +$topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '<option value="fork">' . phpbb::$user->lang['FORK_TOPIC'] . '</option>' : ''; +$topic_mod .= ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '<option value="make_normal">' . phpbb::$user->lang['MAKE_NORMAL'] . '</option>' : ''; +$topic_mod .= ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? '<option value="make_sticky">' . phpbb::$user->lang['MAKE_STICKY'] . '</option>' : ''; +$topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) ? '<option value="make_announce">' . phpbb::$user->lang['MAKE_ANNOUNCE'] . '</option>' : ''; +$topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) ? '<option value="make_global">' . phpbb::$user->lang['MAKE_GLOBAL'] . '</option>' : ''; +$topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '<option value="topic_logs">' . phpbb::$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, phpbb::$config['posts_per_page'], $start); @@ -572,31 +572,31 @@ $template->assign_vars(array( 'PAGINATION' => $pagination, '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) : '', + 'TOTAL_POSTS' => ($total_posts == 1) ? phpbb::$user->lang['VIEW_TOPIC_POST'] : sprintf(phpbb::$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, phpbb::$user->session_id) : '', 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '', - 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), - 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), - 'REPLY_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'TOPIC_LOCKED') : $user->img('button_topic_reply', 'REPLY_TO_TOPIC'), - 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'), - 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'), - 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), - 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), - 'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'), - 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), - 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'), - 'WWW_IMG' => $user->img('icon_contact_www', 'VISIT_WEBSITE'), - 'ICQ_IMG' => $user->img('icon_contact_icq', 'ICQ'), - 'AIM_IMG' => $user->img('icon_contact_aim', 'AIM'), - 'MSN_IMG' => $user->img('icon_contact_msnm', 'MSNM'), - 'YIM_IMG' => $user->img('icon_contact_yahoo', 'YIM'), - 'JABBER_IMG' => $user->img('icon_contact_jabber', 'JABBER') , - 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), - 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), - 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'), + 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? phpbb::$user->img('button_topic_locked', 'FORUM_LOCKED') : phpbb::$user->img('button_topic_new', 'POST_NEW_TOPIC'), + 'QUOTE_IMG' => phpbb::$user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), + 'REPLY_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED) ? phpbb::$user->img('button_topic_locked', 'TOPIC_LOCKED') : phpbb::$user->img('button_topic_reply', 'REPLY_TO_TOPIC'), + 'EDIT_IMG' => phpbb::$user->img('icon_post_edit', 'EDIT_POST'), + 'DELETE_IMG' => phpbb::$user->img('icon_post_delete', 'DELETE_POST'), + 'INFO_IMG' => phpbb::$user->img('icon_post_info', 'VIEW_INFO'), + 'PROFILE_IMG' => phpbb::$user->img('icon_user_profile', 'READ_PROFILE'), + 'SEARCH_IMG' => phpbb::$user->img('icon_user_search', 'SEARCH_USER_POSTS'), + 'PM_IMG' => phpbb::$user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), + 'EMAIL_IMG' => phpbb::$user->img('icon_contact_email', 'SEND_EMAIL'), + 'WWW_IMG' => phpbb::$user->img('icon_contact_www', 'VISIT_WEBSITE'), + 'ICQ_IMG' => phpbb::$user->img('icon_contact_icq', 'ICQ'), + 'AIM_IMG' => phpbb::$user->img('icon_contact_aim', 'AIM'), + 'MSN_IMG' => phpbb::$user->img('icon_contact_msnm', 'MSNM'), + 'YIM_IMG' => phpbb::$user->img('icon_contact_yahoo', 'YIM'), + 'JABBER_IMG' => phpbb::$user->img('icon_contact_jabber', 'JABBER') , + 'REPORT_IMG' => phpbb::$user->img('icon_post_report', 'REPORT_POST'), + 'REPORTED_IMG' => phpbb::$user->img('icon_topic_reported', 'POST_REPORTED'), + 'UNAPPROVED_IMG' => phpbb::$user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), + 'WARN_IMG' => phpbb::$user->img('icon_user_warn', 'WARN_USER'), 'S_IS_LOCKED' =>($topic_data['topic_status'] == ITEM_UNLOCKED) ? false : true, 'S_SELECT_SORT_DIR' => $s_sort_dir, @@ -605,14 +605,14 @@ $template->assign_vars(array( 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true, 'S_TOPIC_ACTION' => append_sid('viewtopic', "f=$forum_id&t=$topic_id&start=$start"), 'S_TOPIC_MOD' => ($topic_mod != '') ? '<select name="action" id="quick-mod-select">' . $topic_mod . '</select>' : '', - '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_MOD_ACTION' => append_sid('mcp', "f=$forum_id&t=$topic_id&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, phpbb::$user->session_id), 'S_VIEWTOPIC' => true, '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, - 'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, + 'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || phpbb::$user->is_guest)) ? true : false, + 'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || phpbb::$user->is_guest)) ? true : false, 'U_TOPIC' => "{$server_path}viewtopic." . PHP_EXT . "?f=$forum_id&t=$topic_id", 'U_FORUM' => $server_path, @@ -627,11 +627,11 @@ $template->assign_vars(array( 'L_WATCH_TOPIC' => $s_watching_topic['title'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], - '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_BOOKMARK_TOPIC' => (phpbb::$user->is_registered && phpbb::$config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', + 'L_BOOKMARK_TOPIC' => (phpbb::$user->is_registered && phpbb::$config['allow_bookmarks'] && $topic_data['bookmarked']) ? phpbb::$user->lang['BOOKMARK_TOPIC_REMOVE'] : phpbb::$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") : '', + 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || phpbb::$user->is_guest) ? append_sid('posting', "mode=post&f=$forum_id") : '', + 'U_POST_REPLY_TOPIC' => ($auth->acl_get('f_reply', $forum_id) || phpbb::$user->is_guest) ? append_sid('posting', "mode=reply&f=$forum_id&t=$topic_id") : '', 'U_BUMP_TOPIC' => (bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id'])) ? append_sid('posting', "mode=bump&f=$forum_id&t=$topic_id&hash=" . generate_link_hash("topic_$topic_id")) : '') ); @@ -654,12 +654,12 @@ if (!empty($topic_data['poll_start'])) $db->sql_freeresult($result); $cur_voted_id = array(); - if ($user->data['is_registered']) + if (phpbb::$user->is_registered) { $sql = 'SELECT poll_option_id FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $topic_id . ' - AND vote_user_id = ' . $user->data['user_id']; + AND vote_user_id = ' . phpbb::$user->data['user_id']; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -708,7 +708,7 @@ if (!empty($topic_data['poll_start'])) $message = 'VOTE_CONVERTED'; } - $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'); + $message = phpbb::$user->lang[$message] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); } @@ -725,13 +725,13 @@ if (!empty($topic_data['poll_start'])) AND topic_id = ' . (int) $topic_id; $db->sql_query($sql); - if ($user->data['is_registered']) + if (phpbb::$user->is_registered) { $sql_ary = array( 'topic_id' => (int) $topic_id, 'poll_option_id' => (int) $option, - 'vote_user_id' => (int) $user->data['user_id'], - 'vote_user_ip' => (string) $user->ip, + 'vote_user_id' => (int) phpbb::$user->data['user_id'], + 'vote_user_ip' => (string) phpbb::$user->ip, ); $sql = 'INSERT INTO ' . POLL_VOTES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); @@ -749,20 +749,20 @@ if (!empty($topic_data['poll_start'])) AND topic_id = ' . (int) $topic_id; $db->sql_query($sql); - if ($user->data['is_registered']) + if (phpbb::$user->is_registered) { $sql = 'DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . (int) $topic_id . ' AND poll_option_id = ' . (int) $option . ' - AND vote_user_id = ' . (int) $user->data['user_id']; + AND vote_user_id = ' . (int) phpbb::$user->data['user_id']; $db->sql_query($sql); } } } - if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot']) + if (phpbb::$user->is_guest) { - $user->set_cookie('poll_' . $topic_id, implode(',', $voted_id), time() + 31536000); + phpbb::$user->set_cookie('poll_' . $topic_id, implode(',', $voted_id), time() + 31536000); } $sql = 'UPDATE ' . TOPICS_TABLE . ' @@ -774,7 +774,7 @@ if (!empty($topic_data['poll_start'])) $redirect_url = append_sid('viewtopic', "f=$forum_id&t=$topic_id&start=$start"); meta_refresh(5, $redirect_url); - trigger_error($user->lang['VOTE_SUBMITTED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>')); + trigger_error(phpbb::$user->lang['VOTE_SUBMITTED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>')); } $poll_total = 0; @@ -828,7 +828,7 @@ if (!empty($topic_data['poll_start'])) 'POLL_OPTION_RESULT' => $poll_option['poll_option_total'], 'POLL_OPTION_PERCENT' => $option_pct_txt, 'POLL_OPTION_PCT' => round($option_pct * 100), - 'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, '', round($option_pct * 250)), + 'POLL_OPTION_IMG' => phpbb::$user->img('poll_center', $option_pct_txt, '', round($option_pct * 250)), 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false) ); } @@ -838,11 +838,11 @@ if (!empty($topic_data['poll_start'])) $template->assign_vars(array( 'POLL_QUESTION' => $topic_data['poll_title'], 'TOTAL_VOTES' => $poll_total, - 'POLL_LEFT_CAP_IMG' => $user->img('poll_left'), - 'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'), + 'POLL_LEFT_CAP_IMG' => phpbb::$user->img('poll_left'), + 'POLL_RIGHT_CAP_IMG'=> phpbb::$user->img('poll_right'), - 'L_MAX_VOTES' => ($topic_data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $topic_data['poll_max_options']), - 'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '', + 'L_MAX_VOTES' => ($topic_data['poll_max_options'] == 1) ? phpbb::$user->lang['MAX_OPTION_SELECT'] : sprintf(phpbb::$user->lang['MAX_OPTIONS_SELECT'], $topic_data['poll_max_options']), + 'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf(phpbb::$user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], phpbb::$user->format_date($poll_end)) : '', 'S_HAS_POLL' => true, 'S_CAN_VOTE' => $s_can_vote, @@ -902,7 +902,7 @@ while ($row = $db->sql_fetchrow($result)) $post_list[$i] = $row['post_id']; ($store_reverse) ? $i-- : $i++; } -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); if (!sizeof($post_list)) { @@ -931,7 +931,7 @@ $sql = $db->sql_build_query('SELECT', array( 'LEFT_JOIN' => array( array( 'FROM' => array(ZEBRA_TABLE => 'z'), - 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id' + 'ON' => 'z.user_id = ' . phpbb::$user->data['user_id'] . ' AND z.zebra_id = p.poster_id' ) ), @@ -941,7 +941,7 @@ $sql = $db->sql_build_query('SELECT', array( $result = $db->sql_query($sql); -$now = getdate(time() + $user->timezone + $user->dst - date('Z')); +$now = getdate(time() + phpbb::$user->timezone + phpbb::$user->dst - date('Z')); // Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built @@ -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'] && phpbb::$config['allow_sig'] && $user->optionget('viewsigs')) + if ($row['enable_sig'] && phpbb::$config['allow_sig'] && phpbb::$user->optionget('viewsigs')) { $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['user_sig_bbcode_bitfield']); } @@ -1023,7 +1023,7 @@ while ($row = $db->sql_fetchrow($result)) 'sig_bbcode_bitfield' => '', 'online' => false, - 'avatar' => ($user->optionget('viewavatars')) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', + 'avatar' => (phpbb::$user->optionget('viewavatars')) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', @@ -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'] && phpbb::$config['allow_sig'] && $user->optionget('viewsigs')) + if ($row['user_sig'] && phpbb::$config['allow_sig'] && phpbb::$user->optionget('viewsigs')) { $user_sig = $row['user_sig']; } @@ -1063,7 +1063,7 @@ while ($row = $db->sql_fetchrow($result)) $id_cache[] = $poster_id; $user_cache[$poster_id] = array( - 'joined' => $user->format_date($row['user_regdate']), + 'joined' => phpbb::$user->format_date($row['user_regdate']), 'posts' => $row['user_posts'], 'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0, 'from' => (!empty($row['user_from'])) ? $row['user_from'] : '', @@ -1075,7 +1075,7 @@ while ($row = $db->sql_fetchrow($result)) 'viewonline' => $row['user_allow_viewonline'], 'allow_pm' => $row['user_allow_pm'], - 'avatar' => ($user->optionget('viewavatars')) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', + 'avatar' => (phpbb::$user->optionget('viewavatars')) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', 'age' => '', 'rank_title' => '', @@ -1139,7 +1139,7 @@ while ($row = $db->sql_fetchrow($result)) } } } -$db->sql_freeresult($result); +phpbb::$db->sql_freeresult($result); // Load custom profile fields if (phpbb::$config['load_cpf_viewtopic']) @@ -1335,7 +1335,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) unset($post_storage_list); } - $l_edit_time_total = ($row['post_edit_count'] == 1) ? $user->lang['EDITED_TIME_TOTAL'] : $user->lang['EDITED_TIMES_TOTAL']; + $l_edit_time_total = ($row['post_edit_count'] == 1) ? phpbb::$user->lang['EDITED_TIME_TOTAL'] : phpbb::$user->lang['EDITED_TIMES_TOTAL']; if ($row['post_edit_reason']) { @@ -1349,7 +1349,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $display_username = get_username_string('full', $row['post_edit_user'], $post_edit_list[$row['post_edit_user']]['username'], $post_edit_list[$row['post_edit_user']]['user_colour']); } - $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time'], false, true), $row['post_edit_count']); + $l_edited_by = sprintf($l_edit_time_total, $display_username, phpbb::$user->format_date($row['post_edit_time'], false, true), $row['post_edit_count']); } else { @@ -1368,7 +1368,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $display_username = get_username_string('full', $row['post_edit_user'], $user_cache[$row['post_edit_user']]['username'], $user_cache[$row['post_edit_user']]['user_colour']); } - $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time'], false, true), $row['post_edit_count']); + $l_edited_by = sprintf($l_edit_time_total, $display_username, phpbb::$user->format_date($row['post_edit_time'], false, true), $row['post_edit_count']); } } else @@ -1382,7 +1382,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // It is safe to grab the username from the user cache array, we are at the last // post and only the topic poster and last poster are allowed to bump. // Admins and mods are bound to the above rules too... - $l_bumped_by = '<br /><br />' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'])); + $l_bumped_by = '<br /><br />' . sprintf(phpbb::$user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], phpbb::$user->format_date($topic_data['topic_last_post_time'])); } else { @@ -1422,7 +1422,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POSTER_WARNINGS' => $user_cache[$poster_id]['warnings'], 'POSTER_AGE' => $user_cache[$poster_id]['age'], - 'POST_DATE' => $user->format_date($row['post_time']), + 'POST_DATE' => phpbb::$user->format_date($row['post_time']), 'POST_SUBJECT' => $row['post_subject'], 'MESSAGE' => $message, 'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '', @@ -1430,18 +1430,18 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'EDIT_REASON' => $row['post_edit_reason'], 'BUMPED_MESSAGE' => $l_bumped_by, - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'), 'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '', '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 || !phpbb::$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !phpbb::$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? phpbb::$user->img('icon_user_online', 'ONLINE') : phpbb::$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() - (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_EDIT' => (!phpbb::$user->is_registered) ? '' : (((phpbb::$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() - (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_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid('mcp', "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, phpbb::$user->session_id) : '', + 'U_DELETE' => (!phpbb::$user->is_registered) ? '' : (((phpbb::$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'], @@ -1455,13 +1455,13 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'U_JABBER' => $user_cache[$poster_id]['jabber'], 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid('report', 'f=' . $forum_id . '&p=' . $row['post_id']) : '', - 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid('mcp', 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', - 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid('mcp', 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid('mcp', 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, phpbb::$user->session_id) : '', + 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid('mcp', 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, phpbb::$user->session_id) : '', 'U_MINI_POST' => append_sid('viewtopic', 'p=' . $row['post_id']) . (($topic_data['topic_type'] == POST_GLOBAL) ? '&f=' . $forum_id : '') . '#p' . $row['post_id'], 'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '', 'U_PREV_POST_ID' => $prev_post_id, - 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid('mcp', 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '', - 'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid('mcp', 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid('mcp', 'i=notes&mode=user_notes&u=' . $poster_id, true, phpbb::$user->session_id) : '', + 'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != phpbb::$user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid('mcp', 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, phpbb::$user->session_id) : '', 'POST_ID' => $row['post_id'], 'POSTER_ID' => $poster_id, @@ -1477,7 +1477,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false, 'S_IGNORE_POST' => ($row['hide_post']) ? true : false, - 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '<a href="' . $viewtopic_url . "&p={$row['post_id']}&view=show#p{$row['post_id']}" . '">', '</a>') : '', + 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf(phpbb::$user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '<a href="' . $viewtopic_url . "&p={$row['post_id']}&view=show#p{$row['post_id']}" . '">', '</a>') : '', ); if (isset($cp_row['row']) && sizeof($cp_row['row'])) @@ -1515,7 +1515,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) unset($rowset, $user_cache); // Update topic view and if necessary attachment view counters ... but only for humans and if this is the first 'page view' -if (isset($user->data['session_page']) && !$user->data['is_bot'] && strpos($user->data['session_page'], '&t=' . $topic_id) === false) +if (isset(phpbb::$user->data['session_page']) && !phpbb::$user->is_bot && strpos(phpbb::$user->data['session_page'], '&t=' . $topic_id) === false) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . " @@ -1592,7 +1592,7 @@ if (empty(phpbb_request::variable('f', ''))) } // Output the page -page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title']); +page_header(phpbb::$user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title']); $template->set_filenames(array( 'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') |