diff options
24 files changed, 339 insertions, 39 deletions
diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 8feb12a423..ccc39ea76d 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -44,7 +44,7 @@ <tbody> <!-- IF .enabled --> <tr> - <td class="row3" colspan="4"><strong>{L_EXTENSIONS_ENABLED}</strong></td> + <td class="row3" colspan="4"><strong>{L_EXTENSIONS_ENABLED}</strong><!-- EVENT acp_ext_list_enabled_title_after --></td> </tr> <!-- BEGIN enabled --> <tr class="ext_enabled row-highlight"> @@ -69,7 +69,7 @@ <!-- IF .disabled --> <tr> - <td class="row3" colspan="4"><strong>{L_EXTENSIONS_DISABLED}</strong></td> + <td class="row3" colspan="4"><strong>{L_EXTENSIONS_DISABLED}</strong><!-- EVENT acp_ext_list_disabled_title_after --></td> </tr> <!-- BEGIN disabled --> <tr class="ext_disabled row-highlight"> diff --git a/phpBB/config/default/container/services_auth.yml b/phpBB/config/default/container/services_auth.yml index ee6f7ef448..ed8dc90a74 100644 --- a/phpBB/config/default/container/services_auth.yml +++ b/phpBB/config/default/container/services_auth.yml @@ -63,6 +63,7 @@ services: - '@auth.provider.oauth.service_collection' - '%tables.users%' - '@service_container' + - '@dispatcher' - '%core.root_path%' - '%core.php_ext%' tags: diff --git a/phpBB/docs/CREDITS.txt b/phpBB/docs/CREDITS.txt index 471e6b3c88..26ff8fcc80 100644 --- a/phpBB/docs/CREDITS.txt +++ b/phpBB/docs/CREDITS.txt @@ -27,7 +27,6 @@ phpBB Lead Developer: Marc (Marc Alexander) phpBB Developers: bantu (Andreas Fischer) CHItA (Máté Bartus) Elsensee (Oliver Schramm) - nickvergessen (Joas Schilling) Nicofuma (Tristan Darricau) prototech (Cesar Gallegos) @@ -60,6 +59,7 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010] igorw (Igor Wiedler) [08/2010 - 02/2013] imkingdavid (David King) [11/2012 - 06/2014] kellanved (Henry Sudhof) [04/2007 - 03/2011] + nickvergessen (Joas Schilling)[04/2010 - 12/2015] Oleg (Oleg Pudeyev) [01/2011 - 05/2013] rxu (Ruslan Uzdenov) [04/2010 - 12/2012] TerraFrost (Jim Wigginton) [04/2009 - 01/2011] diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 39ef193f4d..a939c6ff7e 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -58,6 +58,18 @@ acp_email_options_after * Since: 3.1.2-RC1 * Purpose: Add settings to mass email form +acp_ext_list_disabled_title_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.11-RC1 +* Purpose: Add text after disabled extensions section title. + +acp_ext_list_enabled_title_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.11-RC1 +* Purpose: Add text after enabled extensions section title. + acp_forums_custom_settings === * Location: adm/style/acp_forums.html diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 07ec6713a0..3cfe5de293 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -48,7 +48,7 @@ class acp_attachments function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $phpbb_container, $phpbb_filesystem; + global $db, $user, $auth, $template, $cache, $phpbb_container, $phpbb_filesystem, $phpbb_dispatcher; global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log, $request; $this->id = $id; @@ -170,6 +170,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->variable('config', array('' => '')) : $this->new_config; $error = array(); diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index f730e7cfbe..fc7f3bb56a 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -371,11 +371,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 { @@ -384,8 +379,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); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 48d30a9341..3a2004396c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -924,7 +924,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', @@ -936,6 +936,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) . ' @@ -1042,6 +1046,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&t=$topic_id&p={$row['post_id']}&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']), @@ -1052,6 +1081,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/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index bc42b0660c..c8e1e46209 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -404,7 +404,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, $phpbb_log, $request; + global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher; if (!sizeof($topic_ids)) { @@ -419,9 +419,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; @@ -429,13 +429,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->variable('post_id_list', array(0)); $start = $request->variable('start', 0); @@ -483,14 +483,14 @@ 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); $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array( 'forum_id' => $to_forum_id, 'topic_id' => $to_topic_id, - $topic_data['topic_title'] + $to_topic_data['topic_title'] )); // Update topic views count @@ -524,6 +524,20 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&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); } diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index 04729d8453..fdc5f57df0 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -105,6 +105,13 @@ class oauth extends \phpbb\auth\provider\base protected $phpbb_container; /** + * phpBB event dispatcher + * + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** * phpBB root path * * @var string @@ -132,10 +139,11 @@ class oauth extends \phpbb\auth\provider\base * @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface * @param string $users_table * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container + * @param \phpbb\event\dispatcher_interface $dispatcher phpBB event dispatcher * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_state_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_state_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, \phpbb\event\dispatcher_interface $dispatcher, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; @@ -148,6 +156,7 @@ class oauth extends \phpbb\auth\provider\base $this->service_providers = $service_providers; $this->users_table = $users_table; $this->phpbb_container = $phpbb_container; + $this->dispatcher = $dispatcher; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; } @@ -248,6 +257,18 @@ class oauth extends \phpbb\auth\provider\base // Update token storage to store the user_id $storage->set_user_id($row['user_id']); + /** + * Event is triggered after user is successfuly logged in via OAuth. + * + * @event core.auth_oauth_login_after + * @var array row User row + * @since 3.1.11-RC1 + */ + $vars = array( + 'row', + ); + extract($this->dispatcher->trigger_event('core.auth_oauth_login_after', compact($vars))); + // The user is now authenticated and can be logged in return array( 'status' => LOGIN_SUCCESS, @@ -569,6 +590,18 @@ class oauth extends \phpbb\auth\provider\base $sql = 'INSERT INTO ' . $this->auth_provider_oauth_token_account_assoc . ' ' . $this->db->sql_build_array('INSERT', $data); $this->db->sql_query($sql); + + /** + * Event is triggered after user links account. + * + * @event core.auth_oauth_link_after + * @var array data User row + * @since 3.1.11-RC1 + */ + $vars = array( + 'data', + ); + extract($this->dispatcher->trigger_event('core.auth_oauth_link_after', compact($vars))); } /** diff --git a/phpBB/phpbb/console/command/reparser/reparse.php b/phpBB/phpbb/console/command/reparser/reparse.php index b10bd56a58..cebeee0919 100644 --- a/phpBB/phpbb/console/command/reparser/reparse.php +++ b/phpBB/phpbb/console/command/reparser/reparse.php @@ -208,7 +208,7 @@ class reparse extends \phpbb\console\command\command $size = $this->get_option('range-size'); // range-max has no default value, it must be computed for each reparser - if ($max == null) + if ($max === null) { $max = $reparser->get_max_id(); } diff --git a/phpBB/phpbb/cron/task/text_reparser/reparser.php b/phpBB/phpbb/cron/task/text_reparser/reparser.php index aa644de827..7099128efd 100644 --- a/phpBB/phpbb/cron/task/text_reparser/reparser.php +++ b/phpBB/phpbb/cron/task/text_reparser/reparser.php @@ -99,7 +99,7 @@ class reparser extends \phpbb\cron\task\base $this->reparser_manager->get_resume_data($this->reparser_name); } - if (empty($this->resume_data['range-max']) || $this->resume_data['range-max'] >= $this->resume_data['range-min']) + if (!isset($this->resume_data['range-max']) || $this->resume_data['range-max'] >= $this->resume_data['range-min']) { return true; } @@ -147,9 +147,9 @@ class reparser extends \phpbb\cron\task\base */ $reparser = $this->reparsers[$this->reparser_name]; - $min = !empty($this->resume_data['range-min']) ? $this->resume_data['range-min'] : self::MIN; - $current = !empty($this->resume_data['range-max']) ? $this->resume_data['range-max'] : $reparser->get_max_id(); - $size = !empty($this->resume_data['range-size']) ? $this->resume_data['range-size'] : self::SIZE; + $min = isset($this->resume_data['range-min']) ? $this->resume_data['range-min'] : self::MIN; + $current = isset($this->resume_data['range-max']) ? $this->resume_data['range-max'] : $reparser->get_max_id(); + $size = isset($this->resume_data['range-size']) ? $this->resume_data['range-size'] : self::SIZE; if ($current >= $min) { diff --git a/phpBB/phpbb/db/migration/data/v31x/remove_duplicate_migrations.php b/phpBB/phpbb/db/migration/data/v31x/remove_duplicate_migrations.php new file mode 100644 index 0000000000..417d569a09 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/remove_duplicate_migrations.php @@ -0,0 +1,77 @@ +<?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 remove_duplicate_migrations extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v3110'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'deduplicate_entries'))), + ); + } + + public function deduplicate_entries() + { + $migration_state = array(); + $duplicate_migrations = array(); + + $sql = "SELECT * + FROM " . $this->table_prefix . 'migrations'; + $result = $this->db->sql_query($sql); + + if (!$this->db->get_sql_error_triggered()) + { + while ($migration = $this->db->sql_fetchrow($result)) + { + $migration_state[$migration['migration_name']] = $migration; + + $migration_state[$migration['migration_name']]['migration_depends_on'] = unserialize($migration['migration_depends_on']); + } + } + + $this->db->sql_freeresult($result); + + foreach ($migration_state as $name => $migration) + { + $prepended_name = ($name[0] == '\\' ? '' : '\\') . $name; + $prefixless_name = $name[0] == '\\' ? substr($name, 1) : $name; + + if ($prepended_name != $name && isset($migration_state[$prepended_name]) && $migration_state[$prepended_name]['migration_depends_on'] == $migration_state[$name]['migration_depends_on']) + { + $duplicate_migrations[] = $name; + unset($migration_state[$prepended_name]); + } + else if ($prefixless_name != $name && isset($migration_state[$prefixless_name]) && $migration_state[$prefixless_name]['migration_depends_on'] == $migration_state[$name]['migration_depends_on']) + { + $duplicate_migrations[] = $prefixless_name; + unset($migration_state[$prefixless_name]); + } + } + + if (count($duplicate_migrations)) + { + $sql = 'DELETE + FROM ' . $this->table_prefix . 'migrations + WHERE ' . $this->db->sql_in_set('migration_name', $duplicate_migrations); + $this->db->sql_query($sql); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/text_reparser.php b/phpBB/phpbb/db/migration/data/v320/text_reparser.php index ea614feb40..03c5d39fe4 100644 --- a/phpBB/phpbb/db/migration/data/v320/text_reparser.php +++ b/phpBB/phpbb/db/migration/data/v320/text_reparser.php @@ -13,6 +13,9 @@ namespace phpbb\db\migration\data\v320; +use phpbb\textreparser\manager; +use phpbb\textreparser\reparser_interface; + class text_reparser extends \phpbb\db\migration\container_aware_migration { static public function depends_on() @@ -48,7 +51,19 @@ class text_reparser extends \phpbb\db\migration\container_aware_migration public function reparse($resume_data) { - // Somtimes a cron job is too much + /** @var manager $reparser_manager */ + $reparser_manager = $this->container->get('text_reparser.manager'); + + /** @var reparser_interface[] $reparsers */ + $reparsers = $this->container->get('text_reparser_collection'); + + // Initialize all reparsers + foreach ($reparsers as $name => $reparser) + { + $reparser_manager->update_resume_data($name, 1, $reparser->get_max_id(), 100); + } + + // Sometimes a cron job is too much $limit = 100; $fast_reparsers = array( 'text_reparser.contact_admin_info', @@ -65,7 +80,7 @@ class text_reparser extends \phpbb\db\migration\container_aware_migration ); } - $fast_reparsers_size = sizeof($fast_reparsers); + $fast_reparsers_size = count($fast_reparsers); $processed_records = 0; while ($processed_records < $limit && $resume_data['reparser'] < $fast_reparsers_size) { @@ -87,7 +102,6 @@ class text_reparser extends \phpbb\db\migration\container_aware_migration if ($start === 1) { // Prevent CLI command from running these reparsers again - $reparser_manager = $this->container->get('text_reparser.manager'); $reparser_manager->update_resume_data($fast_reparsers[$resume_data['reparser']], 1, 0, $limit); $resume_data['reparser']++; diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 86cb45df6f..d7d7f18d2b 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -243,6 +243,34 @@ class migrator } /** + * Get a valid migration name from the migration state array in case the + * supplied name is not in the migration state list. + * + * @param string $name Migration name + * @return string Migration name + */ + protected function get_valid_name($name) + { + // Try falling back to a valid migration name with or without leading backslash + if (!isset($this->migration_state[$name])) + { + $prepended_name = ($name[0] == '\\' ? '' : '\\') . $name; + $prefixless_name = $name[0] == '\\' ? substr($name, 1) : $name; + + if (isset($this->migration_state[$prepended_name])) + { + $name = $prepended_name; + } + else if (isset($this->migration_state[$prefixless_name])) + { + $name = $prefixless_name; + } + } + + return $name; + } + + /** * Effectively runs a single update step from the next migration to be applied. * * @return null @@ -251,6 +279,8 @@ class migrator { foreach ($this->migrations as $name) { + $name = $this->get_valid_name($name); + if (!isset($this->migration_state[$name]) || !$this->migration_state[$name]['migration_schema_done'] || !$this->migration_state[$name]['migration_data_done']) @@ -306,6 +336,9 @@ class migrator foreach ($state['migration_depends_on'] as $depend) { + $depend = $this->get_valid_name($depend); + + // Test all possible namings before throwing exception if ($this->unfulfillable($depend) !== false) { throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $depend); @@ -829,6 +862,8 @@ class migrator */ public function unfulfillable($name) { + $name = $this->get_valid_name($name); + if (isset($this->migration_state[$name]) || isset($this->fulfillable_migrations[$name])) { return false; @@ -844,6 +879,7 @@ class migrator foreach ($depends as $depend) { + $depend = $this->get_valid_name($depend); $unfulfillable = $this->unfulfillable($depend); if ($unfulfillable !== false) { diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 6091919769..239805204c 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -52,7 +52,7 @@ class report_pm extends \phpbb\notification\type\pm * * @var string Permission name */ - protected $permission = 'm_report'; + protected $permission = 'm_pm_report'; /** * Notification option data (for outputting to the user) diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index aec6b0bbe6..3888d26785 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -132,9 +132,9 @@ phpbb.markNotifications = function($popup, unreadCount) { // Update the unread count. $('strong', '#notification_list_button').html(unreadCount); - // Remove the Mark all read link if there are no unread notifications. + // Remove the Mark all read link & notification count if there are no unread notifications. if (!unreadCount) { - $('#mark_all_notifications').remove(); + $('#mark_all_notifications, #notification_list_button > strong').remove(); } // Update page title diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html index 7925bd6362..ab6eb0805b 100644 --- a/phpBB/styles/prosilver/template/navbar_header.html +++ b/phpBB/styles/prosilver/template/navbar_header.html @@ -145,14 +145,14 @@ <!-- IF S_DISPLAY_PM --> <li class="rightside" data-skip-responsive="true"> <a href="{U_PRIVATEMSGS}" role="menuitem"> - <i class="icon fa-inbox fa-fw" aria-hidden="true"></i><span><span>{L_PRIVATE_MESSAGES} [</span><strong>{PRIVATE_MESSAGE_COUNT}</strong><span>]</span></span> + <i class="icon fa-inbox fa-fw" aria-hidden="true"></i><span><span>{L_PRIVATE_MESSAGES} <!-- IF PRIVATE_MESSAGE_COUNT --><strong class="badge">{PRIVATE_MESSAGE_COUNT}</strong><!-- ENDIF --></span> </a> </li> <!-- ENDIF --> <!-- IF S_NOTIFICATIONS_DISPLAY --> <li class="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"> - <i class="icon fa-bell fa-fw" aria-hidden="true"></i><span><span>{L_NOTIFICATIONS} [</span><strong>{NOTIFICATIONS_COUNT}</strong><span>]</span></span> + <i class="icon fa-bell fa-fw" aria-hidden="true"></i><span><span>{L_NOTIFICATIONS} <!-- IF NOTIFICATIONS_COUNT --><strong class="badge">{NOTIFICATIONS_COUNT}</strong><!-- ENDIF --></span> </a> <!-- INCLUDE notification_dropdown.html --> </li> diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 3d7856d27a..857c686774 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -16,6 +16,10 @@ <div class="post bg3 post-ignore"> <div class="inner"> {topic_review_row.L_IGNORE_POST} + <!-- ELSE IF topic_review_row.S_POST_DELETED --> + <div class="post bg3 post-ignore"> + <div class="inner"> + {topic_review_row.L_DELETE_POST} <!-- ELSE --> <div class="post <!-- IF topic_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF topic_review_row.POST_ID == REPORTED_POST_ID --> reported<!-- ENDIF -->"> <div class="inner"> diff --git a/phpBB/styles/prosilver/template/ucp_main_subscribed.html b/phpBB/styles/prosilver/template/ucp_main_subscribed.html index 3bd1d5ca14..d8de7fd093 100644 --- a/phpBB/styles/prosilver/template/ucp_main_subscribed.html +++ b/phpBB/styles/prosilver/template/ucp_main_subscribed.html @@ -30,7 +30,7 @@ {forumrow.FORUM_DESC} <!-- IF forumrow.LAST_POST_TIME --> <div class="responsive-show" style="display: none;"> - {L_LAST_POST} {L_POST_BY_AUTHOR} {forumrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}">{forumrow.LAST_POST_TIME}</a> + {L_LAST_POST} {L_POST_BY_AUTHOR} {forumrow.LAST_POST_AUTHOR_FULL} « <a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_TIME}</a> </div> <!-- ENDIF --> </div> diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index d76fd0852a..cf21ac216b 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -1168,3 +1168,8 @@ input.disabled { li.notification-reported strong, li.notification-disapproved strong { color: #D31141; } + +.badge { + background-color: #D31141; + color: #ffffff; +} diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index e800c63294..8368fc158c 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -1205,6 +1205,22 @@ ul.linklist:after, margin-left: 58px; } +.badge { + border-radius: 10px; + opacity: 0.8; + text-align: center; + white-space: nowrap; + font-size: 10px; + line-height: 1; + float: right; + display: inline-block; + margin-left: 3px; + vertical-align: baseline; + position: relative; + top: 3px; + padding: 4px 6px; +} + /* Navbar specific list items ----------------------------------------*/ @@ -1216,10 +1232,6 @@ ul.linklist:after, display: none; } -.linklist.compact .rightside > a strong { - padding-left: 2px; -} - .dropdown-page-jump .dropdown { top: 20px; } diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index 5c6b87d50b..8751de8016 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -82,6 +82,6 @@ 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->assertEquals(0, $crawler->filter('#notification_list_button strong')->text()); + $this->assertCount(0, $crawler->filter('#notification_list_button strong')); } } diff --git a/tests/functional/user_password_reset_test.php b/tests/functional/user_password_reset_test.php index f9406f0eb5..3da78407cf 100644 --- a/tests/functional/user_password_reset_test.php +++ b/tests/functional/user_password_reset_test.php @@ -113,6 +113,49 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca $this->assertContains($this->lang('LOGIN_ERROR_PASSWORD', '', ''), $crawler->filter('html')->text()); } + /** + * @depends test_login + */ + public function test_acivateAfterDeactivate() + { + // User is active, actkey should not exist + $this->get_user_data(); + $this->assertEmpty($this->user_data['user_actkey']); + + $this->login(); + $this->admin_login(); + $this->add_lang('acp/users'); + + // Go to user account page + $crawler = self::request('GET', 'adm/index.php?i=acp_users&mode=overview&sid=' . $this->sid); + $this->assertContainsLang('FIND_USERNAME', $crawler->filter('html')->text()); + + $form = $crawler->selectButton('Submit')->form(); + $crawler = self::submit($form, array('username' => 'reset-password-test-user')); + + // Deactivate account and go back to overview of current user + $this->assertContainsLang('USER_TOOLS', $crawler->filter('html')->text()); + $form = $crawler->filter('input[name=update]')->selectButton('Submit')->form(); + $crawler = self::submit($form, array('action' => 'active')); + + $this->assertContainsLang('USER_ADMIN_DEACTIVED', $crawler->filter('html')->text()); + $link = $crawler->selectLink('Back to previous page')->link(); + $crawler = self::request('GET', preg_replace('#(.+)(adm/index.php.+)#', '$2', $link->getUri())); + + // Ensure again that actkey is empty after deactivation + $this->get_user_data(); + $this->assertEmpty($this->user_data['user_actkey']); + + // Force reactivation of account and check that act key is not empty anymore + $this->assertContainsLang('USER_TOOLS', $crawler->filter('html')->text()); + $form = $crawler->filter('input[name=update]')->selectButton('Submit')->form(); + $crawler = self::submit($form, array('action' => 'reactivate')); + $this->assertContainsLang('FORCE_REACTIVATION_SUCCESS', $crawler->filter('html')->text()); + + $this->get_user_data(); + $this->assertNotEmpty($this->user_data['user_actkey']); + } + protected function get_user_data() { $db = $this->get_db(); diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php index 480b5fc5e1..db9b6e0c90 100644 --- a/tests/functions/user_delete_test.php +++ b/tests/functions/user_delete_test.php @@ -72,6 +72,7 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case $oauth_provider_collection, 'phpbb_users', $phpbb_container, + $phpbb_dispatcher, $this->phpbb_root_path, $this->php_ext ); |