diff options
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 1 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 7 | ||||
-rw-r--r-- | phpBB/install/schemas/schema_data.sql | 1 | ||||
-rw-r--r-- | phpBB/language/en/acp/board.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/v32x/load_user_activity_limit.php | 36 | ||||
-rw-r--r-- | phpBB/phpbb/user.php | 31 | ||||
-rw-r--r-- | phpBB/posting.php | 5 |
7 files changed, 77 insertions, 6 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 9b5078b941..e044384c9f 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -353,6 +353,7 @@ class acp_board 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_user_activity_limit' => array('lang' => 'LOAD_USER_ACTIVITY_LIMIT', 'validate' => 'int:0:99999999', 'type' => 'number:0:99999999', 'explain' => true), 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_cdn' => array('lang' => 'ALLOW_CDN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_live_searches' => array('lang' => 'ALLOW_LIVE_SEARCHES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index c8b5ec8b1a..32bee14eef 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1165,12 +1165,13 @@ function display_reasons($reason_id = 0) */ function display_user_activity(&$userdata_ary) { - global $auth, $template, $db, $user; + global $auth, $template, $db, $user, $config; global $phpbb_root_path, $phpEx; global $phpbb_container, $phpbb_dispatcher; - // Do not display user activity for users having more than 5000 posts... - if ($userdata_ary['user_posts'] > 5000) + // Do not display user activity for users having too many posts... + $limit = $config['load_user_activity_limit']; + if ($userdata_ary['user_posts'] > $limit && $limit != 0) { return; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 998cf17c3d..263200d8ff 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -197,6 +197,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_search', '1') INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_tplcompile', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_unreads_search', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_user_activity', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_user_activity_limit', '5000'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_autologin_time', '0'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 4db8a02405..e6c56a5bbb 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -398,6 +398,8 @@ $lang = array_merge($lang, array( 'LOAD_CPF_VIEWTOPIC' => 'Display custom profile fields on topic pages', 'LOAD_USER_ACTIVITY' => 'Show user’s activity', 'LOAD_USER_ACTIVITY_EXPLAIN' => 'Displays active topic/forum in user profiles and user control panel. It is recommended to disable this on boards with more than one million posts.', + 'LOAD_USER_ACTIVITY_LIMIT' => 'User’s activity post limit', + 'LOAD_USER_ACTIVITY_LIMIT_EXPLAIN' => 'The active topic/forum won’t be shown for users having more than this number of posts. Set to 0 to disable the limit.', 'READ_NOTIFICATION_EXPIRE_DAYS' => 'Read Notification Expiration', 'READ_NOTIFICATION_EXPIRE_DAYS_EXPLAIN' => 'Number of days that will elapse before a read notification will automatically be deleted. Set this value to 0 to make notifications permanent.', 'RECOMPILE_STYLES' => 'Recompile stale style components', diff --git a/phpBB/phpbb/db/migration/data/v32x/load_user_activity_limit.php b/phpBB/phpbb/db/migration/data/v32x/load_user_activity_limit.php new file mode 100644 index 0000000000..71bb6c00bf --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/load_user_activity_limit.php @@ -0,0 +1,36 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class load_user_activity_limit extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\v320', + ); + } + + public function effectively_installed() + { + return isset($this->config['load_user_activity_limit']); + } + + public function update_data() + { + return array( + array('config.add', array('load_user_activity_limit', '5000')), + ); + } +} diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 305510851c..d4097f53ee 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -588,6 +588,7 @@ class user extends \phpbb\session */ function format_date($gmepoch, $format = false, $forcedate = false) { + global $phpbb_dispatcher; static $utc; if (!isset($utc)) @@ -595,10 +596,34 @@ class user extends \phpbb\session $utc = new \DateTimeZone('UTC'); } - $time = new $this->datetime($this, '@' . (int) $gmepoch, $utc); - $time->setTimezone($this->timezone); + $format_date_override = false; + $function_arguments = func_get_args(); + /** + * Execute code and/or override format_date() + * + * To override the format_date() function generated value + * set $format_date_override to new return value + * + * @event core.user_format_date_override + * @var DateTimeZone utc Is DateTimeZone in UTC + * @var array function_arguments is array comprising a function's argument list + * @var string format_date_override Shall we return custom format (string) or not (false) + * @since 3.2.1-RC1 + */ + $vars = array('utc', 'function_arguments', 'format_date_override'); + extract($phpbb_dispatcher->trigger_event('core.user_format_date_override', compact($vars))); - return $time->format($format, $forcedate); + if (!$format_date_override) + { + $time = new $this->datetime($this, '@' . (int) $gmepoch, $utc); + $time->setTimezone($this->timezone); + + return $time->format($format, $forcedate); + } + else + { + return $format_date_override; + } } /** diff --git a/phpBB/posting.php b/phpBB/posting.php index 0b6b9c5969..df2ef0d13c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1192,6 +1192,11 @@ if ($submit || $preview || $refresh) { // We have a poll but the editing user is not permitted to create/edit it. // So we just keep the original poll-data. + // Decode the poll title and options text fisrt. + $original_poll_data['poll_title'] = $bbcode_utils->unparse($original_poll_data['poll_title']); + $original_poll_data['poll_option_text'] = $bbcode_utils->unparse($original_poll_data['poll_option_text']); + $original_poll_data['poll_options'] = explode("\n", $original_poll_data['poll_option_text']); + $poll = array_merge($original_poll_data, array( 'enable_bbcode' => $post_data['enable_bbcode'], 'enable_urls' => $post_data['enable_urls'], |