diff options
34 files changed, 513 insertions, 61 deletions
diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 07718846cc..cebd2e9632 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -127,6 +127,7 @@ <!-- ENDIF --> </dl> <!-- ENDIF --> + <!-- EVENT acp_profile_step_one_lang_after --> </fieldset> <fieldset class="quick"> diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 4ad6b6afa5..a7ecf8ff7b 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -62,7 +62,126 @@ phpbb.addAjaxCallback('row_delete', function(res) { } }); +/** + * Handler for submitting permissions form in chunks + * This call will submit permissions forms in chunks of 5 fieldsets. + */ +function submitPermissions() { + var $form = $('form#set-permissions'), + fieldsetList = $form.find('fieldset[id^=perm]'), + formDataSets = [], + $submitAllButton = $form.find('input[type=submit][name^=action]')[0], + $submitButton = $form.find('input[type=submit][data-clicked=true]')[0]; + + // Set proper start values for handling refresh of page + var permissionSubmitSize = 0, + permissionRequestCount = 0, + forumIds = [], + permissionSubmitFailed = false; + + if ($submitAllButton !== $submitButton) { + fieldsetList = $form.find('fieldset#' + $submitButton.closest('fieldset.permissions').id); + } + + $.each(fieldsetList, function (key, value) { + if (key % 5 === 0) { + formDataSets[Math.floor(key / 5)] = $form.find('fieldset#' + value.id).serialize(); + } else { + formDataSets[Math.floor(key / 5)] += '&' + $form.find('fieldset#' + value.id).serialize(); + } + }); + + permissionSubmitSize = formDataSets.length; + + // Add each forum ID to forum ID list to preserve selected forums + $.each($form.find('input[type=hidden][name^=forum_id]'), function (key, value) { + if (value.name.match(/^forum_id\[([0-9]+)\]$/)) { + forumIds.push(value.value); + } + }); + + /** + * Handler for submitted permissions form chunk + * + * @param {object} res Object returned by AJAX call + */ + function handlePermissionReturn(res) { + permissionRequestCount++; + var $dark = $('#darkenwrapper'); + + if (res.S_USER_WARNING) { + phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + permissionSubmitFailed = true; + } else if (!permissionSubmitFailed && res.S_USER_NOTICE) { + // Display success message at the end of submitting the form + if (permissionRequestCount >= permissionSubmitSize) { + var $alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + var $alertBoxLink = $alert.find('p.alert_text > a'); + + // Create form to submit instead of normal "Back to previous page" link + if ($alertBoxLink) { + // Remove forum_id[] from URL + $alertBoxLink.attr('href', $alertBoxLink.attr('href').replace(/(&forum_id\[\]=[0-9]+)/g, '')); + var previousPageForm = '<form action="' + $alertBoxLink.attr('href') + '" method="post">'; + $.each(forumIds, function (key, value) { + previousPageForm += '<input type="text" name="forum_id[]" value="' + value + '" />'; + }); + previousPageForm += '</form>'; + + $alertBoxLink.on('click', function (e) { + var $previousPageForm = $(previousPageForm); + $('body').append($previousPageForm); + e.preventDefault(); + $previousPageForm.submit(); + }); + } + + // Do not allow closing alert + $dark.off('click'); + $alert.find('.alert_close').hide(); + + if (typeof res.REFRESH_DATA !== 'undefined') { + setTimeout(function () { + // Create forum to submit using POST. This will prevent + // exceeding the maximum length of URLs + var form = '<form action="' + res.REFRESH_DATA.url.replace(/(&forum_id\[\]=[0-9]+)/g, '') + '" method="post">'; + $.each(forumIds, function (key, value) { + form += '<input type="text" name="forum_id[]" value="' + value + '" />'; + }); + form += '</form>'; + $form = $(form); + $('body').append($form); + + // Hide the alert even if we refresh the page, in case the user + // presses the back button. + $dark.fadeOut(phpbb.alertTime, function () { + if (typeof $alert !== 'undefined') { + $alert.hide(); + } + }); + + // Submit form + $form.submit(); + }, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds + } + } + } + } + // Create AJAX request for each form data set + $.each(formDataSets, function (key, formData) { + $.ajax({ + url: $form.action, + type: 'POST', + data: formData + '&' + $submitAllButton.name + '=' + encodeURIComponent($submitAllButton.value) + + '&creation_time=' + $form.find('input[type=hidden][name=creation_time]')[0].value + + '&form_token=' + $form.find('input[type=hidden][name=form_token]')[0].value + + '&' + $form.children('input[type=hidden]').serialize(), + success: handlePermissionReturn, + error: handlePermissionReturn + }); + }); +} $('[data-ajax]').each(function() { var $this = $(this), @@ -83,6 +202,18 @@ $('[data-ajax]').each(function() { */ $(function() { phpbb.resizeTextArea($('textarea:not(.no-auto-resize)'), {minHeight: 75}); + + var $setPermissionsForm = $('form#set-permissions'); + if ($setPermissionsForm.length) { + $setPermissionsForm.on('submit', function (e) { + submitPermissions(); + e.preventDefault(); + }); + $setPermissionsForm.find('input[type=submit]').click(function() { + $('input[type=submit]', $(this).parents($('form#set-permissions'))).removeAttr('data-clicked'); + $(this).attr('data-clicked', true); + }); + } }); diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..12a8a3dfeb 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -369,6 +369,13 @@ acp_profile_contact_before * Since: 3.1.6-RC1 * Purpose: Add extra options to custom profile field configuration in the ACP +acp_profile_step_one_lang_after +=== +* Locations: + + adm/style/acp_profile.html +* Since: 3.1.11-RC1 +* Purpose: Add extra lang specific options to custom profile field step one configuration in the ACP + acp_prune_forums_append === * Locations: @@ -814,6 +821,14 @@ mcp_forum_actions_after * Since: 3.1.11-RC1 * Purpose: Add some information after actions fieldset +mcp_forum_actions_append +=== +* Locations: + + styles/prosilver/template/mcp_forum.html + + styles/subsilver2/template/mcp_forum.html +* Since: 3.1.11-RC1 +* Purpose: Add additional options to actions select + mcp_forum_actions_before === * Locations: @@ -2009,6 +2024,14 @@ ucp_main_front_user_activity_after * Since: 3.1.6-RC1 * Purpose: Add content right after the user activity info viewing UCP front page +ucp_main_front_user_activity_append +=== +* Locations: + + styles/prosilver/template/ucp_main_front.html + + styles/subsilver2/template/ucp_main_front.html +* Since: 3.1.11-RC1 +* Purpose: Add content after last user activity info viewing UCP front page + ucp_main_front_user_activity_before === * Locations: @@ -2017,6 +2040,14 @@ ucp_main_front_user_activity_before * Since: 3.1.6-RC1 * Purpose: Add content right before the user activity info viewing UCP front page +ucp_main_front_user_activity_prepend +=== +* Locations: + + styles/prosilver/template/ucp_main_front.html + + styles/subsilver2/template/ucp_main_front.html +* Since: 3.1.11-RC1 +* Purpose: Add content before first user activity info viewing UCP front page + ucp_pm_history_post_buttons_after === * Locations: @@ -2113,6 +2144,13 @@ ucp_pm_viewmessage_custom_fields_before * Purpose: Add data before the custom fields on the user profile when viewing a private message +ucp_pm_viewmessage_options_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.11-RC1 +* Purpose: Add content right before display options + ucp_pm_viewmessage_post_buttons_after === * Locations: @@ -2271,6 +2309,14 @@ ucp_profile_register_details_after * Since: 3.1.4-RC1 * Purpose: Add options in profile page fieldset - after confirm password field. +ucp_register_buttons_before +=== +* Locations: + + styles/prosilver/template/ucp_register.html + + styles/subsilver2/template/ucp_register.html +* Since: 3.1.11-RC1 +* Purpose: Add content before buttons in registration form. + ucp_register_credentials_before === * Locations: diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 660afb4e93..62e75a2db7 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -755,6 +755,7 @@ class acp_permissions $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_id, $forum_id); + meta_refresh(5, $this->u_action); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } @@ -825,10 +826,12 @@ class acp_permissions if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids)); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids))); } else { + meta_refresh(5, $this->u_action); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } } @@ -899,10 +902,12 @@ class acp_permissions if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id)); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id))); } else { + meta_refresh(5, $this->u_action); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } } diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 2012d3c513..9e6cc49522 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -752,6 +752,10 @@ class acp_profile $s_one_need_edit = true; } + if (!isset($this->type_collection[$row['field_type']])) + { + continue; + } $profile_field = $this->type_collection[$row['field_type']]; $template->assign_block_vars('fields', array( 'FIELD_IDENT' => $row['field_ident'], diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 4881dde6f5..b49a8b80c0 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1554,6 +1554,23 @@ function phpbb_get_user_rank($user_data, $user_posts) } } + /** + * Modify a user's rank before displaying + * + * @event core.get_user_rank_after + * @var array user_data Array with user's data + * @var int user_posts User_posts to change + * @var array user_rank_data User rank data + * @since 3.1.11-RC1 + */ + + $vars = array( + 'user_data', + 'user_posts', + 'user_rank_data', + ); + extract($phpbb_dispatcher->trigger_event('core.get_user_rank_after', compact($vars))); + return $user_rank_data; } diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 1639eb1a4c..4aad1746d5 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -889,9 +889,16 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) SET pm_unread = 0 WHERE msg_id = $msg_id AND user_id = $user_id - AND folder_id = $folder_id"; + AND folder_id = $folder_id + AND pm_unread = 1"; $db->sql_query($sql); + // If the message is already marked as read, we just skip the rest to avoid negative PM count + if (!$db->sql_affectedrows()) + { + return; + } + $sql = 'UPDATE ' . USERS_TABLE . " SET user_unread_privmsg = user_unread_privmsg - 1 WHERE user_id = $user_id"; diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index b2441aed1b..599bd5d918 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -463,7 +463,7 @@ function change_topic_type($action, $topic_ids) */ function mcp_move_topic($topic_ids) { - global $auth, $user, $db, $template, $phpbb_log, $request; + global $auth, $user, $db, $template, $phpbb_log, $request, $phpbb_dispatcher; global $phpEx, $phpbb_root_path; // Here we limit the operation to one forum only @@ -625,6 +625,18 @@ function mcp_move_topic($topic_ids) 'poll_last_vote' => (int) $row['poll_last_vote'] ); + /** + * Perform actions before shadow topic is created. + * + * @event core.mcp_main_modify_shadow_sql + * @var array shadow SQL array to be used by $db->sql_build_array + * @since 3.1.11-RC1 + */ + $vars = array( + 'shadow', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars))); + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); // Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts @@ -1281,6 +1293,18 @@ function mcp_fork_topic($topic_ids) 'poll_vote_change' => (int) $topic_row['poll_vote_change'], ); + /** + * Perform actions before forked topic is created. + * + * @event core.mcp_main_modify_fork_sql + * @var array sql_ary SQL array to be used by $db->sql_build_array + * @since 3.1.11-RC1 + */ + $vars = array( + 'sql_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_sql', compact($vars))); + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); $new_topic_id = $db->sql_nextid(); $new_topic_id_list[$topic_id] = $new_topic_id; diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 19acd9ecb9..3ae7876a72 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -397,7 +397,7 @@ function view_folder($id, $mode, $folder_id, $folder) */ function get_pm_from($folder_id, $folder, $user_id) { - global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx; + global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $phpbb_dispatcher; $start = request_var('start', 0); @@ -461,7 +461,7 @@ function get_pm_from($folder_id, $folder, $user_id) $start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count); $pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start); - $template->assign_vars(array( + $template_vars = array( 'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count), 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'), @@ -475,7 +475,33 @@ function get_pm_from($folder_id, $folder, $user_id) 'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose') : '', 'S_PM_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id" . (($start !== 0) ? "&start=$start" : '')), - )); + ); + + /** + * Modify template variables before they are assigned + * + * @event core.ucp_pm_view_folder_get_pm_from_template + * @var int folder_id Folder ID + * @var array folder Folder data + * @var int user_id User ID + * @var string base_url Pagination base URL + * @var int start Pagination start + * @var int pm_count Count of PMs + * @var array template_vars Template variables to be assigned + * @since 3.1.11-RC1 + */ + $vars = array( + 'folder_id', + 'folder', + 'user_id', + 'base_url', + 'start', + 'pm_count', + 'template_vars', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_template', compact($vars))); + + $template->assign_vars($template_vars); // Grab all pm data $rowset = $pm_list = array(); @@ -509,15 +535,38 @@ function get_pm_from($folder_id, $folder, $user_id) $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; } - $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported - FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u - WHERE t.user_id = $user_id + $sql_ary = array( + 'SELECT' => 't.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported', + 'FROM' => array( + PRIVMSGS_TO_TABLE => 't', + PRIVMSGS_TABLE => 'p', + USERS_TABLE => 'u', + ), + 'WHERE' => "t.user_id = $user_id AND p.author_id = u.user_id AND $folder_sql AND t.msg_id = p.msg_id - $sql_limit_time - ORDER BY $sql_sort_order"; - $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + $sql_limit_time", + 'ORDER' => $sql_sort_order, + ); + + /** + * Modify SQL before it is executed + * + * @event core.ucp_pm_view_folder_get_pm_from_sql + * @var array sql_ary SQL array + * @var int sql_limit SQL limit + * @var int sql_start SQL start + * @since 3.1.11-RC1 + */ + $vars = array( + 'sql_ary', + 'sql_limit', + 'sql_start', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_sql', compact($vars))); + + $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $sql_limit, $sql_start); $pm_reported = array(); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 0be1930f1a..4a3d8133b3 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -633,10 +633,19 @@ class ucp_profile 'user_avatar_height' => $result['avatar_height'], ); + /** + * Trigger events on successfull avatar change + * + * @event core.ucp_profile_avatar_sql + * @var array result Array with data to be stored in DB + * @since 3.1.11-RC1 + */ + $vars = array('result'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_avatar_sql', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $result) . ' WHERE user_id = ' . (int) $user->data['user_id']; - $db->sql_query($sql); meta_refresh(3, $this->u_action); diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 3426af95d0..52ed410b04 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -45,6 +45,28 @@ class ucp_register $change_lang = request_var('change_lang', ''); $user_lang = request_var('lang', $user->lang_name); + /** + * Add UCP register data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_requests_after + * @var bool coppa Is set coppa + * @var bool agreed Did user agree to coppa? + * @var bool submit Is set post submit? + * @var string change_lang Change language request + * @var string user_lang User language request + * @since 3.1.11-RC1 + */ + $vars = array( + 'coppa', + 'agreed', + 'submit', + 'change_lang', + 'user_lang', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_requests_after', compact($vars))); + if ($agreed) { add_form_key('ucp_register'); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 415bf0e84d..29d4199528 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -30,7 +30,7 @@ class ucp_remind function main($id, $mode) { global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $template, $phpbb_container; + global $db, $user, $auth, $template, $phpbb_container, $phpbb_dispatcher; if (!$config['allow_password_reset']) { @@ -43,10 +43,30 @@ class ucp_remind if ($submit) { - $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason - FROM ' . USERS_TABLE . " - WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' - AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $sql_array = array( + 'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason', + 'FROM' => array(USERS_TABLE => 'u'), + 'WHERE' => "user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' + AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" + ); + + /** + * Change SQL query for fetching user data + * + * @event core.ucp_remind_modify_select_sql + * @var string email User's email from the form + * @var string username User's username from the form + * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, WHERE + * @since 3.1.11-RC1 + */ + $vars = array( + 'email', + 'username', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_remind_modify_select_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php new file mode 100644 index 0000000000..7e486aca7c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php @@ -0,0 +1,46 @@ +<?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\v31x; + +class increase_size_of_emotion extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v3110', + ); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'smilies' => array( + 'emotion' => array('VCHAR_UNI', ''), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'smilies' => array( + 'emotion' => array('VCHAR_UNI:50', ''), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index a64d88fe39..34e2910a33 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -118,8 +118,9 @@ class metadata_manager return $this->metadata; break; + case 'version': case 'name': - return ($this->validate('name')) ? $this->metadata['name'] : false; + return ($this->validate($element)) ? $this->metadata[$element] : false; break; case 'display-name': diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 094ff78abe..8f199cd931 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -893,9 +893,29 @@ class log implements \phpbb\log\log_interface $forum_auth = array('f_read' => array(), 'm_' => array()); $topic_ids = array_unique($topic_ids); - $sql = 'SELECT topic_id, forum_id - FROM ' . TOPICS_TABLE . ' - WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids)); + $sql_ary = array( + 'SELECT' => 'topic_id, forum_id', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'WHERE' => $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids)), + ); + + /** + * Allow modifying SQL query before topic data is retrieved. + * + * @event core.phpbb_log_get_topic_auth_sql_before + * @var array topic_ids Array with unique topic IDs + * @var array sql_ary SQL array + * @since 3.1.11-RC1 + */ + $vars = array( + 'topic_ids', + 'sql_ary', + ); + extract($this->dispatcher->trigger_event('core.phpbb_log_get_topic_auth_sql_before', compact($vars))); + + $sql = $this->db->sql_build_query('SELECT', $sql_ary); $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index cc32984ac6..fc39623c5c 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -141,6 +141,8 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_email_template_variables() { + $user_data = $this->user_loader->get_user($this->get_data('reporter_id')); + return array( 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index 7f6267ed32..04d681cea6 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -266,7 +266,7 @@ class plupload if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0) { $resize = sprintf( - 'resize: {width: %d, height: %d, quality: 100},', + 'resize: {width: %d, height: %d, quality: 85},', (int) $this->config['img_max_width'], (int) $this->config['img_max_height'] ); diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index ec770f9467..93b9e4b893 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -134,6 +134,14 @@ interface type_interface public function get_field_ident($field_data); /** + * Get the localized name of the field + * + * @param string $field_name Unlocalized name of this field + * @return string Localized name of the field + */ + public function get_field_name($field_name); + + /** * Get the column type for the database * * @return string Returns the database column type diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php index a8432eaae5..8710c8c603 100644 --- a/phpBB/phpbb/profilefields/type/type_string.php +++ b/phpBB/phpbb/profilefields/type/type_string.php @@ -63,7 +63,7 @@ class type_string extends type_string_common $options = array( 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_length" value="' . $field_data['field_length'] . '" />'), 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_minlen" value="' . $field_data['field_minlen'] . '" />'), - 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0 max="99999"" name="field_maxlen" value="' . $field_data['field_maxlen'] . '" />'), + 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_maxlen" value="' . $field_data['field_maxlen'] . '" />'), 3 => array('TITLE' => $this->user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options($field_data) . '</select>'), ); diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 311da92a95..ec9b53328f 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -132,9 +132,10 @@ phpbb.markNotifications = function($popup, unreadCount) { // Update the unread count. $('strong', '#notification_list_button').html(unreadCount); - // Remove the Mark all read link & notification count if there are no unread notifications. + // Remove the Mark all read link and hide notification count if there are no unread notifications. if (!unreadCount) { - $('#mark_all_notifications, #notification_list_button > strong').remove(); + $('#mark_all_notifications').remove(); + $('#notification_list_button > strong').addClass('hidden'); } // Update page title diff --git a/phpBB/styles/prosilver/template/jumpbox.html b/phpBB/styles/prosilver/template/jumpbox.html index 3096d08318..fcd8ddbc1e 100644 --- a/phpBB/styles/prosilver/template/jumpbox.html +++ b/phpBB/styles/prosilver/template/jumpbox.html @@ -1,32 +1,34 @@ -<!-- IF S_VIEWTOPIC --> - <p class="jumpbox-return"><a href="{U_VIEW_FORUM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO_FORUM}</a></p> -<!-- ELSEIF S_VIEWFORUM --> - <p class="jumpbox-return"><a href="{U_INDEX}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO_INDEX}</a></p> -<!-- ELSEIF SEARCH_TOPIC --> - <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO_TOPIC}</a></p> -<!-- ELSEIF S_SEARCH_ACTION --> - <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_GO_TO_SEARCH_ADV}</a></p> -<!-- ENDIF --> +<div class="action-bar actions-jump"> + <!-- IF S_VIEWTOPIC --> + <p class="jumpbox-return"><a href="{U_VIEW_FORUM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO_FORUM}</a></p> + <!-- ELSEIF S_VIEWFORUM --> + <p class="jumpbox-return"><a href="{U_INDEX}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO_INDEX}</a></p> + <!-- ELSEIF SEARCH_TOPIC --> + <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO_TOPIC}</a></p> + <!-- ELSEIF S_SEARCH_ACTION --> + <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_GO_TO_SEARCH_ADV}</a></p> + <!-- ENDIF --> -<!-- IF S_DISPLAY_JUMPBOX --> + <!-- IF S_DISPLAY_JUMPBOX --> - <div class="dropdown-container dropdown-container-{S_CONTENT_FLOW_END}<!-- IF not S_IN_MCP --> dropdown-up<!-- ENDIF --> dropdown-{S_CONTENT_FLOW_BEGIN} dropdown-button-control" id="jumpbox"> - <span title="<!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->" class="dropdown-trigger button dropdown-select"> - <!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF --> - </span> - <div class="dropdown hidden"> - <div class="pointer"><div class="pointer-inner"></div></div> - <ul class="dropdown-contents"> - <!-- BEGIN jumpbox_forums --> - <!-- IF jumpbox_forums.FORUM_ID neq -1 --> - <li><!-- BEGIN level --> <!-- END level --><a href="{jumpbox_forums.LINK}">{jumpbox_forums.FORUM_NAME}</a></li> - <!-- ENDIF --> - <!-- END jumpbox_forums --> - </ul> + <div class="dropdown-container dropdown-container-{S_CONTENT_FLOW_END}<!-- IF not S_IN_MCP --> dropdown-up<!-- ENDIF --> dropdown-{S_CONTENT_FLOW_BEGIN} dropdown-button-control" id="jumpbox"> + <span title="<!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->" class="dropdown-trigger button dropdown-select"> + <!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF --> + </span> + <div class="dropdown hidden"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents"> + <!-- BEGIN jumpbox_forums --> + <!-- IF jumpbox_forums.FORUM_ID neq -1 --> + <li><!-- BEGIN level --> <!-- END level --><a href="{jumpbox_forums.LINK}">{jumpbox_forums.FORUM_NAME}</a></li> + <!-- ENDIF --> + <!-- END jumpbox_forums --> + </ul> + </div> </div> - </div> -<!-- ELSE --> - <br /><br /> -<!-- ENDIF --> + <!-- ELSE --> + </br></br> + <!-- ENDIF --> +</div> diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index 5858a2c801..4c037f56ae 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -138,6 +138,7 @@ <option value="make_announce">{L_MAKE_ANNOUNCE}</option> <option value="make_global">{L_MAKE_GLOBAL}</option> <!-- ENDIF --> + <!-- EVENT mcp_forum_actions_append --> </select> <input class="button2" type="submit" value="{L_SUBMIT}" /> <div><a href="#" onclick="marklist('mcp', 'topic_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'topic_id_list', false); return false;">{L_UNMARK_ALL}</a></div> diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html index e5f354a943..bdfb5fb87d 100644 --- a/phpBB/styles/prosilver/template/navbar_header.html +++ b/phpBB/styles/prosilver/template/navbar_header.html @@ -72,12 +72,12 @@ </li> <!-- IF S_DISPLAY_PM --> <li class="small-icon icon-pm rightside" data-skip-responsive="true"> - <a href="{U_PRIVATEMSGS}" role="menuitem"><span>{L_PRIVATE_MESSAGES} </span><!-- IF PRIVATE_MESSAGE_COUNT --><strong class="badge">{PRIVATE_MESSAGE_COUNT}</strong><!-- ENDIF --></a> + <a href="{U_PRIVATEMSGS}" role="menuitem"><span>{L_PRIVATE_MESSAGES} </span><strong class="badge<!-- IF not PRIVATE_MESSAGE_COUNT --> hidden<!-- ENDIF -->">{PRIVATE_MESSAGE_COUNT}</strong></a> </li> <!-- ENDIF --> <!-- IF S_NOTIFICATIONS_DISPLAY --> <li class="small-icon icon-notification dropdown-container dropdown-{S_CONTENT_FLOW_END} rightside" data-skip-responsive="true"> - <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger"><span>{L_NOTIFICATIONS} </span><!-- IF NOTIFICATIONS_COUNT --><strong class="badge">{NOTIFICATIONS_COUNT}</strong><!-- ENDIF --></a> + <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger"><span>{L_NOTIFICATIONS} </span><strong class="badge<!-- IF not NOTIFICATIONS_COUNT --> hidden<!-- ENDIF -->">{NOTIFICATIONS_COUNT}</strong></a> <!-- INCLUDE notification_dropdown.html --> </li> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index 7bc8d40078..056ea300d8 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -55,12 +55,14 @@ <!-- EVENT ucp_main_front_user_activity_before --> <dl class="details"> + <!-- EVENT ucp_main_front_user_activity_prepend --> <dt>{L_JOINED}{L_COLON}</dt> <dd>{JOINED}</dd> <dt>{L_LAST_ACTIVE}{L_COLON}</dt> <dd>{LAST_VISIT_YOU}</dd> <dt>{L_TOTAL_POSTS}{L_COLON}</dt> <dd><!-- IF POSTS_PCT -->{POSTS}<!-- IF S_DISPLAY_SEARCH --> | <strong><a href="{U_SEARCH_USER}">{L_SEARCH_YOUR_POSTS}</a></strong><!-- ENDIF --><br />({POSTS_DAY} / {POSTS_PCT})<!-- ELSE -->{POSTS}<!-- ENDIF --></dd> <!-- IF ACTIVE_FORUM != '' --><dt>{L_ACTIVE_IN_FORUM}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></strong><br />({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})</dd><!-- ENDIF --> <!-- IF ACTIVE_TOPIC != '' --><dt>{L_ACTIVE_IN_TOPIC}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></strong><br />({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})</dd><!-- ENDIF --> <!-- IF WARNINGS --><dt>{L_YOUR_WARNINGS}{L_COLON}</dt> <dd class="error">{WARNING_IMG} [{WARNINGS}]</dd><!-- ENDIF --> + <!-- EVENT ucp_main_front_user_activity_append --> </dl> <!-- EVENT ucp_main_front_user_activity_after --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index d92b90a045..009a9bf975 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -146,6 +146,7 @@ </div> </div> +<!-- EVENT ucp_pm_viewmessage_options_before --> <!-- IF S_VIEW_MESSAGE --> <fieldset class="display-options"> <!-- IF U_PREVIOUS_PM --><a href="{U_PREVIOUS_PM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_VIEW_PREVIOUS_PM}</a><!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 655c0fc48c..38413addba 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -79,8 +79,6 @@ <!-- ENDIF --> <!-- IF S_COPPA --> - - <div class="panel"> <div class="inner"> @@ -91,6 +89,8 @@ </div> <!-- ENDIF --> +<!-- EVENT ucp_register_buttons_before --> + <div class="panel"> <div class="inner"> diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 9c2f33f7a9..0ac7a45a23 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -137,7 +137,9 @@ p.right { } p.jumpbox-return { - margin-top: 1em; + margin-top: 10px; + margin-bottom: 0; + float: left; } b, strong { @@ -1267,6 +1269,10 @@ ul.linklist:after, padding: 4px 6px; } +.badge.hidden { + display: none; +} + /* Navbar specific list items ----------------------------------------*/ diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 92a7db81d9..e7c0e177a6 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -515,7 +515,7 @@ blockquote .codebox { max-height: 200px; white-space: normal; padding-top: 5px; - font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono; + font: 0.9em Monaco, "Andale Mono","Courier New", Courier, monospace; line-height: 1.3em; margin: 2px 0; } diff --git a/phpBB/styles/subsilver2/template/mcp_forum.html b/phpBB/styles/subsilver2/template/mcp_forum.html index d905910c22..12447b2b1e 100644 --- a/phpBB/styles/subsilver2/template/mcp_forum.html +++ b/phpBB/styles/subsilver2/template/mcp_forum.html @@ -77,6 +77,7 @@ <option value="make_announce">{L_MAKE_ANNOUNCE}</option> <option value="make_global">{L_MAKE_GLOBAL}</option> <!-- ENDIF --> + <!-- EVENT mcp_forum_actions_append --> </select> <input class="btnmain" type="submit" value="{L_SUBMIT}" /> </td> diff --git a/phpBB/styles/subsilver2/template/ucp_main_front.html b/phpBB/styles/subsilver2/template/ucp_main_front.html index 7fc906a126..485a58b7ab 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_front.html +++ b/phpBB/styles/subsilver2/template/ucp_main_front.html @@ -38,6 +38,7 @@ <!-- EVENT ucp_main_front_user_activity_before --> <td class="row1" colspan="3"> <table width="100%" cellspacing="1" cellpadding="4"> + <!-- EVENT ucp_main_front_user_activity_prepend --> <tr> <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="genmed">{L_JOINED}{L_COLON} </b></td> <td width="100%"><b class="gen">{JOINED}</b></td> @@ -62,6 +63,7 @@ <td class="genmed">{WARNING_IMG} [ <b>{WARNINGS}</b> ]</td> </tr> <!-- ENDIF --> + <!-- EVENT ucp_main_front_user_activity_append --> </table> </td> <!-- EVENT ucp_main_front_user_activity_after --> diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index 9b9e164df4..db26f51ebd 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -91,6 +91,8 @@ </tr> <!-- ENDIF --> +<!-- EVENT ucp_register_buttons_before --> + <tr> <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" id="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> </tr> diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 780e43e09b..dc656b8fad 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -495,6 +495,28 @@ if ($config['allow_topic_notify']) } } +/** +* Event to modify highlight. +* +* @event core.viewtopic_highlight_modify +* @var string highlight String to be highlighted +* @var string highlight_match Highlight string to be used in preg_replace +* @var array topic_data Topic data +* @var int start Pagination start +* @var int total_posts Number of posts +* @var string viewtopic_url Current viewtopic URL +* @since 3.1.11-RC1 +*/ +$vars = array( + 'highlight', + 'highlight_match', + 'topic_data', + 'start', + 'total_posts', + 'viewtopic_url', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_highlight_modify', compact($vars))); + // Bookmarks if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0)) { @@ -1294,7 +1316,6 @@ while ($row = $db->sql_fetchrow($result)) 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', - 'sig' => '', 'pm' => '', 'email' => '', 'jabber' => '', diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index d4c61cc062..f21d73817a 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -82,6 +82,7 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case // Get form token $link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri(); $crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); - $this->assertCount(0, $crawler->filter('#notification_list_button strong')); + $this->assertCount(1, $crawler->filter('#notification_list_button strong.badge.hidden')); + $this->assertEquals("0", $crawler->filter('#notification_list_button strong.badge.hidden')->text()); } } diff --git a/tests/plupload/plupload_test.php b/tests/plupload/plupload_test.php index 2f47bf2b39..c3fa2b9bad 100644 --- a/tests/plupload/plupload_test.php +++ b/tests/plupload/plupload_test.php @@ -24,7 +24,7 @@ class phpbb_plupload_test extends phpbb_test_case array( 130, 150, - 'resize: {width: 130, height: 150, quality: 100},' + 'resize: {width: 130, height: 150, quality: 85},' ), ); } |