aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_extensions.php22
-rw-r--r--phpBB/includes/functions.php11
-rw-r--r--phpBB/includes/functions_acp.php2
-rw-r--r--phpBB/includes/functions_content.php26
-rw-r--r--phpBB/includes/mcp/mcp_queue.php82
-rw-r--r--phpBB/includes/mcp/mcp_warn.php122
-rw-r--r--phpBB/includes/message_parser.php12
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php2
8 files changed, 223 insertions, 56 deletions
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index 21a1909ac1..1fb2d2df26 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -26,16 +26,18 @@ class acp_extensions
private $config;
private $template;
private $user;
+ private $log;
function main()
{
// Start the page
- global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx;
+ global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx, $phpbb_log;
$this->db = $db;
$this->config = $config;
$this->template = $template;
$this->user = $user;
+ $this->log = $phpbb_log;
$user->add_lang(array('install', 'acp/extensions', 'migrator'));
@@ -123,6 +125,11 @@ class acp_extensions
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
+ if ($phpbb_extension_manager->enabled($ext_name))
+ {
+ redirect($this->u_action);
+ }
+
try
{
while ($phpbb_extension_manager->enable_step($ext_name))
@@ -135,6 +142,7 @@ class acp_extensions
meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name));
}
}
+ $this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE', time(), array($ext_name));
}
catch (\phpbb\db\migration\exception $e)
{
@@ -164,6 +172,11 @@ class acp_extensions
break;
case 'disable':
+ if (!$phpbb_extension_manager->enabled($ext_name))
+ {
+ redirect($this->u_action);
+ }
+
while ($phpbb_extension_manager->disable_step($ext_name))
{
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
@@ -174,6 +187,7 @@ class acp_extensions
meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name));
}
}
+ $this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name));
$this->tpl_name = 'acp_ext_disable';
@@ -197,6 +211,11 @@ class acp_extensions
break;
case 'delete_data':
+ if ($phpbb_extension_manager->enabled($ext_name))
+ {
+ redirect($this->u_action);
+ }
+
try
{
while ($phpbb_extension_manager->purge_step($ext_name))
@@ -209,6 +228,7 @@ class acp_extensions
meta_refresh(0, $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name));
}
}
+ $this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_PURGE', time(), array($ext_name));
}
catch (\phpbb\db\migration\exception $e)
{
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index a0e2a46f54..d613c87728 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -4974,7 +4974,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/",
'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'],
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'],
- 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.js?assets_version=" . $config['assets_version'],
+ 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.min.js?assets_version=" . $config['assets_version'],
'S_ALLOW_CDN' => !empty($config['allow_cdn']),
'T_THEME_NAME' => rawurlencode($user->style['style_path']),
@@ -5095,7 +5095,7 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler =
// Call cron-type script
$call_cron = false;
- if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'])
+ if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'] && !$cache->get('cron.lock_check'))
{
$call_cron = true;
$time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time();
@@ -5116,7 +5116,8 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler =
// Call cron job?
if ($call_cron)
{
- global $cron;
+ global $phpbb_container;
+ $cron = $phpbb_container->get('cron.manager');
$task = $cron->find_one_ready_task();
if ($task)
@@ -5124,6 +5125,10 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler =
$url = $task->get_url();
$template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="cron" />');
}
+ else
+ {
+ $cache->put('cron.lock_check', true, 300);
+ }
}
if ($display_template)
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 1c4d6966da..9a82ef7ea7 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -176,7 +176,7 @@ function adm_page_footer($copyright_html = true)
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
'S_COPYRIGHT_HTML' => $copyright_html,
'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group'),
- 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.js",
+ 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.min.js",
'S_ALLOW_CDN' => !empty($config['allow_cdn']),
'VERSION' => $config['version'])
);
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index d56f02dd09..01d540620a 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -1348,7 +1348,8 @@ function get_username_string($mode, $user_id, $username, $username_colour = '',
// Return colour
if ($mode == 'colour')
{
- return $username_colour;
+ $username_string = $username_colour;
+ break;
}
// no break;
@@ -1368,7 +1369,8 @@ function get_username_string($mode, $user_id, $username, $username_colour = '',
// Return username
if ($mode == 'username')
{
- return $username;
+ $username_string = $username;
+ break;
}
// no break;
@@ -1389,19 +1391,23 @@ function get_username_string($mode, $user_id, $username, $username_colour = '',
// Return profile
if ($mode == 'profile')
{
- return $profile_url;
+ $username_string = $profile_url;
+ break;
}
// no break;
}
-
- if (($mode == 'full' && !$profile_url) || $mode == 'no_profile')
- {
- $username_string = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']);
- }
- else
+
+ if (!isset($username_string))
{
- $username_string = str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']);
+ if (($mode == 'full' && !$profile_url) || $mode == 'no_profile')
+ {
+ $username_string = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']);
+ }
+ else
+ {
+ $username_string = str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']);
+ }
}
/**
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index a71bc997e9..5f96d5952b 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -578,6 +578,7 @@ class mcp_queue
$redirect = reapply_sid($redirect);
$success_msg = $post_url = '';
$approve_log = array();
+ $num_topics = 0;
$s_hidden_fields = build_hidden_fields(array(
'i' => $id,
@@ -634,11 +635,6 @@ class mcp_queue
$phpbb_content_visibility->set_post_visibility(ITEM_APPROVED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '', isset($topic_data['first_post']), isset($topic_data['last_post']));
}
- if (sizeof($post_info) >= 1)
- {
- $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS';
- }
-
foreach ($approve_log as $log_data)
{
add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_POST_' . strtoupper($action) . 'D', $log_data['post_subject']);
@@ -656,21 +652,32 @@ class mcp_queue
if (!$post_data['topic_posts_approved'])
{
$phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']);
+
+ if ($post_data['post_visibility'] == ITEM_UNAPPROVED)
+ {
+ $phpbb_notifications->add_notifications(array('topic'), $post_data);
+ }
+ if ($post_data['post_visibility'] != ITEM_APPROVED)
+ {
+ $num_topics++;
+ }
}
- $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
-
- // Only add notifications, if we are not reapproving post
- // When the topic was already approved, but was edited and
- // now needs re-approval, we don't want to notify the users
- // again.
- if ($post_data['post_visibility'] == ITEM_UNAPPROVED)
+ else
{
- $phpbb_notifications->add_notifications(array(
- 'quote',
- 'bookmark',
- 'post',
- ), $post_data);
+ // Only add notifications, if we are not reapproving post
+ // When the topic was already approved, but was edited and
+ // now needs re-approval, we don't want to notify the users
+ // again.
+ if ($post_data['post_visibility'] == ITEM_UNAPPROVED)
+ {
+ $phpbb_notifications->add_notifications(array(
+ 'bookmark',
+ 'post',
+ ), $post_data);
+ }
}
+ $phpbb_notifications->add_notifications(array('quote'), $post_data);
+ $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
$phpbb_notifications->mark_notifications_read(array(
'quote',
@@ -686,11 +693,27 @@ class mcp_queue
continue;
}
- $phpbb_notifications->add_notifications('approve_post', $post_data);
+ if (!$post_data['topic_posts_approved'])
+ {
+ $phpbb_notifications->add_notifications('approve_post', $post_data);
+ }
+ else
+ {
+ $phpbb_notifications->add_notifications('approve_topic', $post_data);
+ }
}
}
}
+ if ($num_topics >= 1)
+ {
+ $success_msg = ($num_topics == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS';
+ }
+ else
+ {
+ $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS';
+ }
+
meta_refresh(3, $redirect);
$message = $user->lang[$success_msg];
@@ -721,14 +744,14 @@ class mcp_queue
{
foreach ($post_info as $post_data)
{
- if ($post_data['poster_id'] == ANONYMOUS)
+ if (!$post_data['topic_posts_approved'])
{
- continue;
+ $num_topics++;
}
- else
+
+ if (!$show_notify && $post_data['poster_id'] != ANONYMOUS)
{
$show_notify = true;
- break;
}
}
}
@@ -738,7 +761,18 @@ class mcp_queue
'S_' . strtoupper($action) => true,
));
- confirm_box(false, strtoupper($action) . '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
+ // Create the confirm box message
+ $action_msg = strtoupper($action);
+ $num_posts = sizeof($post_id_list) - $num_topics;
+ if ($num_topics > 0 && $num_posts <= 0)
+ {
+ $action_msg .= '_TOPIC' . (($num_topics == 1) ? '' : 'S');
+ }
+ else
+ {
+ $action_msg .= '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S');
+ }
+ confirm_box(false, $action_msg, $s_hidden_fields, 'mcp_approve.html');
}
redirect($redirect);
@@ -834,7 +868,7 @@ class mcp_queue
'post_subject' => $topic_data['topic_title'],
'post_time' => $topic_data['topic_time'],
'poster_id' => $topic_data['topic_poster'],
- 'username' => $topic_data['topic_first_poster_name'],
+ 'post_username' => $topic_data['topic_first_poster_name'],
));
$phpbb_notifications->delete_notifications('topic_in_queue', $topic_id);
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index 4275182d26..ea6277ae2c 100644
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -187,7 +187,7 @@ class mcp_warn
function mcp_warn_post_view($action)
{
global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth;
+ global $template, $db, $user, $auth, $phpbb_dispatcher;
$post_id = request_var('p', 0);
$forum_id = request_var('f', 0);
@@ -264,16 +264,65 @@ class mcp_warn
{
if (check_form_key('mcp_warn'))
{
- add_warning($user_row, $warning, $notify, $post_id);
- $msg = $user->lang['USER_WARNING_ADDED'];
+ $s_mcp_warn_post = true;
+
+ /**
+ * Event for before warning a user for a post.
+ *
+ * @event core.mcp_warn_post_before
+ * @var array user_row The entire user row
+ * @var string warning The warning message
+ * @var bool notify If true, we notify the user for the warning
+ * @var int post_id The post id for which the warning is added
+ * @var bool s_mcp_warn_post If true, we add the warning else we omit it
+ * @since 3.1.0-b4
+ */
+ $vars = array(
+ 'user_row',
+ 'warning',
+ 'notify',
+ 'post_id',
+ 's_mcp_warn_post',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_warn_post_before', compact($vars)));
+
+ if ($s_mcp_warn_post)
+ {
+ add_warning($user_row, $warning, $notify, $post_id);
+ $message = $user->lang['USER_WARNING_ADDED'];
+
+ /**
+ * Event for after warning a user for a post.
+ *
+ * @event core.mcp_warn_post_after
+ * @var array user_row The entire user row
+ * @var string warning The warning message
+ * @var bool notify If true, the user was notified for the warning
+ * @var int post_id The post id for which the warning is added
+ * @var string message Message displayed to the moderator
+ * @since 3.1.0-b4
+ */
+ $vars = array(
+ 'user_row',
+ 'warning',
+ 'notify',
+ 'post_id',
+ 'message',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_warn_post_after', compact($vars)));
+ }
}
else
{
- $msg = $user->lang['FORM_INVALID'];
+ $message = $user->lang['FORM_INVALID'];
+ }
+
+ if (!empty($message))
+ {
+ $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&amp;mode=user_notes&amp;u=$user_id");
+ meta_refresh(2, $redirect);
+ trigger_error($message . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
}
- $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&amp;mode=user_notes&amp;u=$user_id");
- meta_refresh(2, $redirect);
- trigger_error($msg . '<br /><br />' . sprintf($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
@@ -318,7 +367,7 @@ class mcp_warn
function mcp_warn_user_view($action)
{
global $phpEx, $phpbb_root_path, $config, $module;
- global $template, $db, $user, $auth;
+ global $template, $db, $user, $auth, $phpbb_dispatcher;
$user_id = request_var('u', 0);
$username = request_var('username', '', true);
@@ -376,16 +425,61 @@ class mcp_warn
{
if (check_form_key('mcp_warn'))
{
- add_warning($user_row, $warning, $notify);
- $msg = $user->lang['USER_WARNING_ADDED'];
+ $s_mcp_warn_user = true;
+
+ /**
+ * Event for before warning a user from MCP.
+ *
+ * @event core.mcp_warn_user_before
+ * @var array user_row The entire user row
+ * @var string warning The warning message
+ * @var bool notify If true, we notify the user for the warning
+ * @var bool s_mcp_warn_user If true, we add the warning else we omit it
+ * @since 3.1.0-b4
+ */
+ $vars = array(
+ 'user_row',
+ 'warning',
+ 'notify',
+ 's_mcp_warn_user',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_before', compact($vars)));
+
+ if ($s_mcp_warn_user)
+ {
+ add_warning($user_row, $warning, $notify);
+ $message = $user->lang['USER_WARNING_ADDED'];
+
+ /**
+ * Event for after warning a user from MCP.
+ *
+ * @event core.mcp_warn_user_after
+ * @var array user_row The entire user row
+ * @var string warning The warning message
+ * @var bool notify If true, the user was notified for the warning
+ * @var string message Message displayed to the moderator
+ * @since 3.1.0-b4
+ */
+ $vars = array(
+ 'user_row',
+ 'warning',
+ 'notify',
+ 'message',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_after', compact($vars)));
+ }
}
else
{
- $msg = $user->lang['FORM_INVALID'];
+ $message = $user->lang['FORM_INVALID'];
+ }
+
+ if (!empty($message))
+ {
+ $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&amp;mode=user_notes&amp;u=$user_id");
+ meta_refresh(2, $redirect);
+ trigger_error($message . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
}
- $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&amp;mode=user_notes&amp;u=$user_id");
- meta_refresh(2, $redirect);
- trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
}
// Generate the appropriate user information for the user we are looking at
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 901bafbb2e..8bf50b0ca3 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -776,8 +776,16 @@ class bbcode_firstpass extends bbcode
// the buffer holds a valid opening tag
if ($config['max_quote_depth'] && sizeof($close_tags) >= $config['max_quote_depth'])
{
- // there are too many nested quotes
- $error_ary['quote_depth'] = $user->lang('QUOTE_DEPTH_EXCEEDED', (int) $config['max_quote_depth']);
+ if ($config['max_quote_depth'] == 1)
+ {
+ // Depth 1 - no nesting is allowed
+ $error_ary['quote_depth'] = $user->lang('QUOTE_NO_NESTING');
+ }
+ else
+ {
+ // There are too many nested quotes
+ $error_ary['quote_depth'] = $user->lang('QUOTE_DEPTH_EXCEEDED', (int) $config['max_quote_depth']);
+ }
$out .= $buffer . $tok;
$tok = '[]';
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 16b3ca8573..3a3343f199 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -492,7 +492,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
if ($message_attachment && !$submit && !$refresh && !$preview && $action == 'edit')
{
// Do not change to SELECT *
- $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename
+ $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename, filesize
FROM ' . ATTACHMENTS_TABLE . "
WHERE post_msg_id = $msg_id
AND in_message = 1