aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_attachments.php14
-rw-r--r--phpBB/includes/acp/acp_board.php2
-rw-r--r--phpBB/includes/acp/acp_extensions.php18
-rw-r--r--phpBB/includes/acp/acp_users.php19
-rw-r--r--phpBB/includes/functions.php2
-rw-r--r--phpBB/includes/functions_content.php12
-rw-r--r--phpBB/includes/functions_messenger.php12
-rw-r--r--phpBB/includes/functions_posting.php42
-rw-r--r--phpBB/includes/functions_user.php2
-rw-r--r--phpBB/includes/mcp/mcp_forum.php30
10 files changed, 130 insertions, 23 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 816387967a..e4650455c4 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -42,7 +42,7 @@ class acp_attachments
function main($id, $mode)
{
- global $db, $user, $auth, $template, $cache, $phpbb_container;
+ global $db, $user, $auth, $template, $cache, $phpbb_container, $phpbb_dispatcher;
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
$this->id = $id;
@@ -162,6 +162,18 @@ class acp_attachments
)
);
+ /**
+ * Event to add and/or modify acp_attachement configurations
+ *
+ * @event core.acp_attachments_config_edit_add
+ * @var array display_vars Array of config values to display and process
+ * @var string mode Mode of the config page we are displaying
+ * @var boolean submit Do we display the form or process the submission
+ * @since 3.1.11-RC1
+ */
+ $vars = array('display_vars', 'mode', 'submit');
+ extract($phpbb_dispatcher->trigger_event('core.acp_attachments_config_edit_add', compact($vars)));
+
$this->new_config = $config;
$cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : $this->new_config;
$error = array();
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index e004d2e81f..c8f6f426c6 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -1017,7 +1017,7 @@ class acp_board
$user->timezone = $old_tz;
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\" />";
+ <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"64\" />";
}
/**
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index f97711d69d..5a2ded91e2 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -34,7 +34,7 @@ class acp_extensions
function main()
{
// Start the page
- global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx, $phpbb_log, $cache;
+ global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx, $phpbb_log, $cache, $phpbb_dispatcher;
$this->db = $db;
$this->config = $config;
@@ -43,6 +43,7 @@ class acp_extensions
$this->cache = $cache;
$this->request = $request;
$this->log = $phpbb_log;
+ $this->phpbb_dispatcher = $phpbb_dispatcher;
$user->add_lang(array('install', 'acp/extensions', 'migrator'));
@@ -55,6 +56,21 @@ class acp_extensions
$safe_time_limit = (ini_get('max_execution_time') / 2);
$start_time = time();
+ /**
+ * Event to run a specific action on extension
+ *
+ * @event core.acp_extensions_run_action
+ * @var string action Action to run
+ * @var string u_action Url we are at
+ * @var string ext_name Extension name from request
+ * @var int safe_time_limit Safe limit of execution time
+ * @var int start_time Start time
+ * @since 3.1.11-RC1
+ */
+ $u_action = $this->u_action;
+ $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time');
+ extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action', compact($vars)));
+
// Cancel action
if ($request->is_set_post('cancel'))
{
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 1e453e88ad..cd44800af8 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -373,11 +373,6 @@ class acp_users
if ($user_row['user_type'] == USER_NORMAL)
{
user_active_flip('deactivate', $user_id, INACTIVE_REMIND);
-
- $sql = 'UPDATE ' . USERS_TABLE . "
- SET user_actkey = '" . $db->sql_escape($user_actkey) . "'
- WHERE user_id = $user_id";
- $db->sql_query($sql);
}
else
{
@@ -386,8 +381,18 @@ class acp_users
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
- $user_actkey = (string) $db->sql_fetchfield('user_actkey');
+ $user_activation_key = (string) $db->sql_fetchfield('user_actkey');
$db->sql_freeresult($result);
+
+ $user_actkey = empty($user_activation_key) ? $user_actkey : $user_activation_key;
+ }
+
+ if ($user_row['user_type'] == USER_NORMAL || empty($user_activation_key))
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_actkey = '" . $db->sql_escape($user_actkey) . "'
+ WHERE user_id = $user_id";
+ $db->sql_query($sql);
}
$messenger = new messenger(false);
@@ -1924,7 +1929,7 @@ class acp_users
'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"',
- 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),
+ 'L_AVATAR_EXPLAIN' => $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),
'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled),
));
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index a152d9b620..ba448f3125 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2776,7 +2776,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
$u_action .= ((strpos($u_action, '?') === false) ? '?' : '&amp;') . 'confirm_key=' . $confirm_key;
$template->assign_vars(array(
- 'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title],
+ 'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang($title, 1),
'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'],
'YES_VALUE' => $user->lang['YES'],
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 8e60804d6e..8858d1a307 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -980,7 +980,7 @@ function bbcode_nl2br($text)
*/
function smiley_text($text, $force_option = false)
{
- global $config, $user, $phpbb_path_helper;
+ global $config, $user, $phpbb_path_helper, $phpbb_dispatcher;
if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies'))
{
@@ -989,6 +989,16 @@ function smiley_text($text, $force_option = false)
else
{
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path();
+
+ /**
+ * Event to override the root_path for smilies
+ *
+ * @event core.smiley_text_root_path
+ * @var string root_path root_path for smilies
+ * @since 3.1.11-RC1
+ */
+ $vars = array('root_path');
+ extract($phpbb_dispatcher->trigger_event('core.smiley_text_root_path', compact($vars)));
return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);
}
}
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 9b3ca14101..f141637fb9 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -438,7 +438,7 @@ class messenger
*/
function build_header($to, $cc, $bcc)
{
- global $config;
+ global $config, $phpbb_dispatcher;
// We could use keys here, but we won't do this for 3.0.x to retain backwards compatibility
$headers = array();
@@ -470,6 +470,16 @@ class messenger
$headers[] = 'X-MimeOLE: phpBB3';
$headers[] = 'X-phpBB-Origin: phpbb://' . str_replace(array('http://', 'https://'), array('', ''), generate_board_url());
+ /**
+ * Event to modify email header entries
+ *
+ * @event core.modify_email_headers
+ * @var array headers Array containing email header entries
+ * @since 3.1.11-RC1
+ */
+ $vars = array('headers');
+ extract($phpbb_dispatcher->trigger_event('core.modify_email_headers', compact($vars)));
+
if (sizeof($this->extra_headers))
{
$headers = array_merge($headers, $this->extra_headers);
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 57c68d4935..30f5ba91ef 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -119,6 +119,15 @@ function generate_smilies($mode, $forum_id)
foreach ($smilies as $row)
{
+ /**
+ * Modify smiley root path before populating smiley list
+ *
+ * @event core.generate_smilies_before
+ * @var string root_path root_path for smilies
+ * @since 3.1.11-RC1
+ */
+ $vars = array('root_path');
+ extract($phpbb_dispatcher->trigger_event('core.generate_smilies_before', compact($vars)));
$template->assign_block_vars('smiley', array(
'SMILEY_CODE' => $row['code'],
'A_SMILEY_CODE' => addslashes($row['code']),
@@ -1074,7 +1083,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
}
$sql_ary = array(
- 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe',
+ 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe, uu.username as post_delete_username, uu.user_colour as post_delete_user_colour',
'FROM' => array(
USERS_TABLE => 'u',
@@ -1086,6 +1095,10 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
'FROM' => array(ZEBRA_TABLE => 'z'),
'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id',
),
+ array(
+ 'FROM' => array(USERS_TABLE => 'uu'),
+ 'ON' => 'uu.user_id = p.post_delete_user',
+ ),
),
'WHERE' => $db->sql_in_set('p.post_id', $post_list) . '
@@ -1194,6 +1207,31 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$post_anchor = ($mode == 'post_review') ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id'];
$u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f=$forum_id&amp;t=$topic_id&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}");
+ $l_deleted_message = '';
+ if ($row['post_visibility'] == ITEM_DELETED)
+ {
+ $display_postername = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']);
+
+ // User having deleted the post also being the post author?
+ if (!$row['post_delete_user'] || $row['post_delete_user'] == $poster_id)
+ {
+ $display_username = $display_postername;
+ }
+ else
+ {
+ $display_username = get_username_string('full', $row['post_delete_user'], $row['post_delete_username'], $row['post_delete_user_colour']);
+ }
+
+ if ($row['post_delete_reason'])
+ {
+ $l_deleted_message = $user->lang('POST_DELETED_BY_REASON', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true), $row['post_delete_reason']);
+ }
+ else
+ {
+ $l_deleted_message = $user->lang('POST_DELETED_BY', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true));
+ }
+ }
+
$post_row = array(
'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
@@ -1204,6 +1242,8 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
'S_FRIEND' => ($row['friend']) ? true : false,
'S_IGNORE_POST' => ($row['foe']) ? true : false,
'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "<a href=\"{$u_show_post}\" onclick=\"phpbb.toggleDisplay('{$post_anchor}', 1); return false;\">", '</a>') : '',
+ 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false,
+ 'L_DELETE_POST' => $l_deleted_message,
'POST_SUBJECT' => $post_subject,
'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']),
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index b82abe0c5e..0b39339c7f 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -2279,7 +2279,7 @@ function phpbb_avatar_explanation_string()
{
global $config, $user;
- return $user->lang('AVATAR_EXPLAIN',
+ return $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN',
$user->lang('PIXELS', (int) $config['avatar_max_width']),
$user->lang('PIXELS', (int) $config['avatar_max_height']),
round($config['avatar_filesize'] / 1024));
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 7df712f65f..e4c0640ec7 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -396,7 +396,7 @@ function mcp_resync_topics($topic_ids)
*/
function merge_topics($forum_id, $topic_ids, $to_topic_id)
{
- global $db, $template, $user, $phpEx, $phpbb_root_path, $auth;
+ global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_dispatcher;
if (!sizeof($topic_ids))
{
@@ -411,9 +411,9 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$sync_topics = array_merge($topic_ids, array($to_topic_id));
- $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge');
+ $all_topic_data = phpbb_get_topic_data($sync_topics, 'm_merge');
- if (!sizeof($topic_data) || empty($topic_data[$to_topic_id]))
+ if (!sizeof($all_topic_data) || empty($all_topic_data[$to_topic_id]))
{
$template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
return;
@@ -421,13 +421,13 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$sync_forums = array();
$topic_views = 0;
- foreach ($topic_data as $data)
+ foreach ($all_topic_data as $data)
{
$sync_forums[$data['forum_id']] = $data['forum_id'];
- $topic_views += $data['topic_views'];
+ $topic_views = max($topic_views, $data['topic_views']);
}
- $topic_data = $topic_data[$to_topic_id];
+ $to_topic_data = $all_topic_data[$to_topic_id];
$post_id_list = request_var('post_id_list', array(0));
$start = request_var('start', 0);
@@ -475,10 +475,10 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
if (confirm_box(true))
{
- $to_forum_id = $topic_data['forum_id'];
+ $to_forum_id = $to_topic_data['forum_id'];
move_posts($post_id_list, $to_topic_id, false);
- add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);
+ add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $to_topic_data['topic_title']);
// Update topic views count
$sql = 'UPDATE ' . TOPICS_TABLE . '
@@ -511,6 +511,20 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");
$redirect = reapply_sid($redirect);
+ /**
+ * Perform additional actions after merging topics.
+ *
+ * @event core.mcp_forum_merge_topics_after
+ * @var array all_topic_data The data from all topics involved in the merge
+ * @var int to_topic_id The ID of the topic into which the rest are merged
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'all_topic_data',
+ 'to_topic_id',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_forum_merge_topics_after', compact($vars)));
+
meta_refresh(3, $redirect);
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
}