diff options
29 files changed, 204 insertions, 85 deletions
diff --git a/.travis.yml b/.travis.yml index 4f9734a19a..8d0fe27203 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,6 @@ matrix: - php: hhvm env: DB=mysqli allow_failures: - - php: 7.0 - php: hhvm fast_finish: true diff --git a/phpBB/config/default/container/services_notification.yml b/phpBB/config/default/container/services_notification.yml index c842656575..7337dd7904 100644 --- a/phpBB/config/default/container/services_notification.yml +++ b/phpBB/config/default/container/services_notification.yml @@ -9,6 +9,7 @@ services: - @dispatcher - @dbal.conn - @cache + - @language - @user - %tables.notification_types% - %tables.user_notifications% @@ -26,6 +27,7 @@ services: abstract: true arguments: - @dbal.conn + - @language - @user - @auth - %core.root_path% diff --git a/phpBB/config/default/container/tables.yml b/phpBB/config/default/container/tables.yml index c4b5ac2375..ec3bf95d1f 100644 --- a/phpBB/config/default/container/tables.yml +++ b/phpBB/config/default/container/tables.yml @@ -1,28 +1,77 @@ parameters: + tables.acl_groups: %core.table_prefix%acl_groups + tables.acl_options: %core.table_prefix%acl_options + tables.acl_roles: %core.table_prefix%acl_roles + tables.acl_roles_data: %core.table_prefix%acl_roles_data + tables.acl_users: %core.table_prefix%acl_users + tables.attachments: %core.table_prefix%attachments tables.auth_provider_oauth_token_storage: %core.table_prefix%oauth_tokens tables.auth_provider_oauth_account_assoc: %core.table_prefix%oauth_accounts + tables.banlist: %core.table_prefix%banlist tables.bbcodes: %core.table_prefix%bbcodes + tables.bookmarks: %core.table_prefix%bookmarks + tables.bots: %core.table_prefix%bots tables.captcha_qa_questions: %core.table_prefix%captcha_questions tables.captcha_qa_answers: %core.table_prefix%captcha_answers tables.captcha_qa_confirm: %core.table_prefix%qa_confirm tables.config: %core.table_prefix%config tables.config_text: %core.table_prefix%config_text + tables.confirm: %core.table_prefix%confirm + tables.disallow: %core.table_prefix%disallow + tables.drafts: %core.table_prefix%drafts tables.ext: %core.table_prefix%ext + tables.extensions: %core.table_prefix%extensions + tables.extension_groups: %core.table_prefix%extension_groups tables.forums: %core.table_prefix%forums + tables.forums_access: %core.table_prefix%forums_access + tables.forums_track: %core.table_prefix%forums_track + tables.forums_watch: %core.table_prefix%forums_watch + tables.groups: %core.table_prefix%groups + tables.icons: %core.table_prefix%icons + tables.lang: %core.table_prefix%lang tables.log: %core.table_prefix%log + tables.login_attempts: %core.table_prefix%login_attempts tables.migrations: %core.table_prefix%migrations tables.moderator_cache: %core.table_prefix%moderator_cache tables.modules: %core.table_prefix%modules tables.notification_types: %core.table_prefix%notification_types tables.notifications: %core.table_prefix%notifications + tables.poll_options: %core.table_prefix%poll_options + tables.poll_votes: %core.table_prefix%poll_votes + tables.posts: %core.table_prefix%posts + tables.privmsgs: %core.table_prefix%privmsgs + tables.privmsgs_folder: %core.table_prefix%privmsgs_folder + tables.privmsgs_rules: %core.table_prefix%privmsgs_rules + tables.privmsgs_to: %core.table_prefix%privmsgs_to tables.profile_fields: %core.table_prefix%profile_fields tables.profile_fields_data: %core.table_prefix%profile_fields_data tables.profile_fields_options_language: %core.table_prefix%profile_fields_lang tables.profile_fields_language: %core.table_prefix%profile_lang - tables.posts: %core.table_prefix%posts + tables.ranks: %core.table_prefix%ranks + tables.reports: %core.table_prefix%reports + tables.reports_reasons: %core.table_prefix%reports_reasons + tables.search_results: %core.table_prefix%search_results + tables.search_wordlist: %core.table_prefix%search_wordlist + tables.search_wordmatch: %core.table_prefix%search_wordmatch + tables.sessions: %core.table_prefix%sessions + tables.sessions_keys: %core.table_prefix%sessions_keys + tables.sitelist: %core.table_prefix%sitelist tables.smilies: %core.table_prefix%smilies + tables.sphinx: %core.table_prefix%sphinx tables.styles: %core.table_prefix%styles + tables.styles_template: %core.table_prefix%styles_template + tables.styles_template_data: %core.table_prefix%styles_template_data + tables.styles_theme: %core.table_prefix%styles_theme + tables.styles_imageset: %core.table_prefix%styles_imageset + tables.styles_imageset_data: %core.table_prefix%styles_imageset_data + tables.teampage: %core.table_prefix%teampage tables.topics: %core.table_prefix%topics + tables.topics_posted: %core.table_prefix%topics_posted + tables.topics_track: %core.table_prefix%topics_track + tables.topics_watch: %core.table_prefix%topics_watch + tables.user_group: %core.table_prefix%user_group tables.user_notifications: %core.table_prefix%user_notifications tables.users: %core.table_prefix%users + tables.warnings: %core.table_prefix%warnings tables.words: %core.table_prefix%words + tables.zebra: %core.table_prefix%zebra diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b7a5bee3c4..d4f662626e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3624,7 +3624,7 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' USERS_TABLE => 'u', ), 'WHERE' => $db->sql_in_set('u.user_id', $online_users['online_users']), - 'ORDER BY' => 'u.username_clean ASC', + 'ORDER_BY' => 'u.username_clean ASC', ); /** diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index cb4b590196..9fdd16e791 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -72,6 +72,7 @@ class mcp_queue case 'delete': $post_id_list = $request->variable('post_id_list', array(0)); $topic_id_list = $request->variable('topic_id_list', array(0)); + $delete_reason = $request->variable('delete_reason', '', true); if (!empty($post_id_list)) { @@ -80,7 +81,7 @@ class mcp_queue global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx); } - mcp_delete_post($post_id_list, false, '', $action); + mcp_delete_post($post_id_list, false, $delete_reason, $action); } else if (!empty($topic_id_list)) { @@ -89,7 +90,7 @@ class mcp_queue global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx); } - mcp_delete_topic($topic_id_list, false, '', $action); + mcp_delete_topic($topic_id_list, false, $delete_reason, $action); } else { diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index 92c19fd5f7..fc7cc1a0b1 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -928,6 +928,7 @@ class auth function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0) { global $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; + global $phpbb_dispatcher; /* @var $provider_collection \phpbb\auth\provider_collection */ $provider_collection = $phpbb_container->get('auth.provider_collection'); @@ -983,6 +984,24 @@ class auth redirect($url); } + /** + * Event is triggered after checking for valid username and password, and before the actual session creation. + * + * @event core.auth_login_session_create_before + * @var array login Variable containing login array + * @var bool admin Boolean variable whether user is logging into the ACP + * @var string username Username of user to log in + * @var bool autologin Boolean variable signaling whether login is triggered via auto login + * @since 3.1.7-RC1 + */ + $vars = array( + 'login', + 'admin', + 'username', + 'autologin', + ); + extract($phpbb_dispatcher->trigger_event('core.auth_login_session_create_before', compact($vars))); + // If login succeeded, we will log the user in... else we pass the login array through... if ($login['status'] == LOGIN_SUCCESS) { diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 4be678ac91..ea1b800dc5 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -44,6 +44,9 @@ class manager /** @var \phpbb\cache\service */ protected $cache; + /** @var \phpbb\language\language */ + protected $language; + /** @var \phpbb\user */ protected $user; @@ -63,13 +66,14 @@ class manager * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher * @param \phpbb\db\driver\driver_interface $db * @param \phpbb\cache\service $cache + * @param \phpbb\language\language $language * @param \phpbb\user $user * @param string $notification_types_table * @param string $user_notifications_table * * @return \phpbb\notification\manager */ - public function __construct($notification_types, $notification_methods, ContainerInterface $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\user $user, $notification_types_table, $user_notifications_table) + public function __construct($notification_types, $notification_methods, ContainerInterface $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\language\language $language, \phpbb\user $user, $notification_types_table, $user_notifications_table) { $this->notification_types = $notification_types; $this->notification_methods = $notification_methods; @@ -79,6 +83,7 @@ class manager $this->phpbb_dispatcher = $phpbb_dispatcher; $this->db = $db; $this->cache = $cache; + $this->language = $language; $this->user = $user; $this->notification_types_table = $notification_types_table; @@ -111,7 +116,7 @@ class manager if (! $method instanceof \phpbb\notification\method\method_interface) { - throw new \phpbb\notification\exception($this->user->lang('NOTIFICATION_METHOD_INVALID', $method_name)); + throw new \phpbb\notification\exception($this->language->lang('NOTIFICATION_METHOD_INVALID', $method_name)); } else if ($method->is_available()) { @@ -166,7 +171,7 @@ class manager $notification_type_id = false; } - /** @var method_interface $method */ + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->mark_notifications($notification_type_id, $item_id, $user_id, $time, $mark_read); @@ -208,6 +213,7 @@ class manager $notification_type_id = $this->get_notification_type_id($notification_type_name); } + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->mark_notifications_by_parent($notification_type_id, $item_parent_id, $user_id, $time, $mark_read); @@ -263,8 +269,6 @@ class manager return $notified_users; } - $item_id = $this->get_item_type_class($notification_type_name)->get_item_id($data); - // find out which users want to receive this type of notification $notify_users = $this->get_item_type_class($notification_type_name)->find_users_for_notification($data, $options); @@ -317,7 +321,7 @@ class manager $item_id = $this->get_item_type_class($notification_type_name)->get_item_id($data); $user_ids = array(); - $notification_objects = $notification_methods = array(); + $notification_methods = array(); // Never send notifications to the anonymous user! unset($notify_users[ANONYMOUS]); @@ -325,6 +329,7 @@ class manager // Make sure not to send new notifications to users who've already been notified about this item // This may happen when an item was added, but now new users are able to see the item // We remove each user which was already notified by at least one method. + /** @var method\method_interface $method */ foreach ($this->get_subscription_methods_instances() as $method) { $notified_users = $method->get_notified_users($notification_type_id, array('item_id' => $item_id)); @@ -415,6 +420,7 @@ class manager $options['item_id'] = $notification->get_item_id($data); } + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->update_notification($notification, $data, $options); @@ -443,6 +449,7 @@ class manager $notification_type_id = $this->get_notification_type_id($notification_type_name); + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->delete_notifications($notification_type_id, $item_id, $parent_id, $user_id); @@ -462,6 +469,7 @@ class manager foreach ($this->notification_types as $type_name => $data) { + /** @var type\base $type */ $type = $this->get_item_type_class($type_name); if ($type instanceof \phpbb\notification\type\type_interface && $type->is_available()) @@ -497,6 +505,7 @@ class manager { $subscription_methods = array(); + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method_name => $method) { $subscription_methods[$method_name] = array( @@ -539,6 +548,7 @@ class manager { $subscription_methods = array(); + /** @var method\method_interface $method */ foreach ($this->get_subscription_methods_instances() as $method_name => $method) { if ($method->is_available()) @@ -768,6 +778,7 @@ class manager { $notification_type_id = $this->get_notification_type_id($notification_type_name); + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->purge_notifications($notification_type_id); @@ -805,6 +816,7 @@ class manager */ public function prune_notifications($timestamp, $only_read = true) { + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->prune_notifications($timestamp, $only_read); @@ -834,6 +846,8 @@ class manager /** * Helper to get the notifications item type class and set it up * + * @param string $notification_type_name + * @param array $data * @return type\type_interface */ public function get_item_type_class($notification_type_name, $data = array()) @@ -848,6 +862,7 @@ class manager /** * Helper to get the notifications method class and set it up * + * @param string $method_name * @return method\method_interface */ public function get_method_class($method_name) @@ -858,6 +873,7 @@ class manager /** * Helper to load objects (notification types/methods) * + * @param string $object_name * @return method\method_interface|type\type_interface */ protected function load_object($object_name) @@ -950,6 +966,8 @@ class manager $notification_type_id = $this->get_notification_type_id($notification_type_name); $notified_users = array(); + + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $notified_users = $notified_users + $method->get_notified_users($notification_type_id, $options); diff --git a/phpBB/phpbb/notification/method/board.php b/phpBB/phpbb/notification/method/board.php index c45f3a8caa..931b252daa 100644 --- a/phpBB/phpbb/notification/method/board.php +++ b/phpBB/phpbb/notification/method/board.php @@ -266,6 +266,7 @@ class board extends \phpbb\notification\method\base { $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->notifications_table); + /** @var \phpbb\notification\type\type_interface $notification */ foreach ($this->queue as $notification) { $data = $notification->get_insert_array(); diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 61119b9882..8a8e284e13 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -82,6 +82,7 @@ abstract class messenger_base extends \phpbb\notification\method\base $messenger = new \messenger(); // Time to go through the queue and send emails + /** @var \phpbb\notification\type\type_interface $notification */ foreach ($this->queue as $notification) { if ($notification->get_email_template() === false) diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php index b191fa62ae..9f2ae857ef 100644 --- a/phpBB/phpbb/notification/type/admin_activate_user.php +++ b/phpBB/phpbb/notification/type/admin_activate_user.php @@ -130,7 +130,7 @@ class admin_activate_user extends \phpbb\notification\type\base { $username = $this->user_loader->get_username($this->item_id, 'no_profile'); - return $this->user->lang($this->language_key, $username); + return $this->language->lang($this->language_key, $username); } /** diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 31e853d7d9..4aacb1c99e 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -24,6 +24,9 @@ abstract class base implements \phpbb\notification\type\type_interface /** @var \phpbb\db\driver\driver_interface */ protected $db; + /** @var \phpbb\language\language */ + protected $language; + /** @var \phpbb\user */ protected $user; @@ -56,7 +59,7 @@ abstract class base implements \phpbb\notification\type\type_interface protected $notification_type_id; /** - * Indentification data + * Identification data * notification_type_id - ID of the item type (auto generated, from notification types table) * item_id - ID of the item (e.g. post_id, msg_id) * item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc) @@ -71,19 +74,20 @@ abstract class base implements \phpbb\notification\type\type_interface private $data = array(); /** - * Notification Type Base Constructor - * - * @param \phpbb\db\driver\driver_interface $db - * @param \phpbb\user $user - * @param \phpbb\auth\auth $auth - * @param string $phpbb_root_path - * @param string $php_ext - * @param string $user_notifications_table - * @return \phpbb\notification\type\base - */ - public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext, $user_notifications_table) + * Notification Type Base Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\language\language $language + * @param \phpbb\user $user + * @param \phpbb\auth\auth $auth + * @param string $phpbb_root_path + * @param string $php_ext + * @param string $user_notifications_table + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\language\language $language, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext, $user_notifications_table) { $this->db = $db; + $this->language = $language; $this->user = $user; $this->auth = $auth; @@ -192,7 +196,7 @@ abstract class base implements \phpbb\notification\type\type_interface 'notification_time' => time(), 'notification_read' => false, - 'notification_data' => array(), + 'notification_data' => array(), ), $this->data); } @@ -304,6 +308,7 @@ abstract class base implements \phpbb\notification\type\type_interface * URL to unsubscribe to this notification (fall back) * * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item + * @return false */ public function get_unsubscribe_url($method = false) { @@ -371,8 +376,11 @@ abstract class base implements \phpbb\notification\type\type_interface } /** - * Load the special items (fall back) - */ + * Load the special items (fall back) + * + * @param array $data + * @param array $notifications + */ public function load_special($data, $notifications) { return; @@ -389,10 +397,12 @@ abstract class base implements \phpbb\notification\type\type_interface } /** - * Pre create insert array function (fall back) - * - * @return array - */ + * Pre create insert array function (fall back) + * + * @param array $type_data + * @param array $notify_users + * @return array + */ public function pre_create_insert_array($type_data, $notify_users) { return array(); @@ -403,13 +413,13 @@ abstract class base implements \phpbb\notification\type\type_interface */ /** - * Find the users who want to receive notifications (helper) - * - * @param array $user_ids User IDs to check if they want to receive notifications - * (Bool False to check all users besides anonymous and bots (USER_IGNORE)) - * - * @return array - */ + * Find the users who want to receive notifications (helper) + * + * @param array|bool $user_ids User IDs to check if they want to receive notifications + * (Bool False to check all users besides anonymous and bots (USER_IGNORE)) + * @param array $options + * @return array + */ protected function check_user_notification_options($user_ids = false, $options = array()) { $options = array_merge(array( @@ -505,6 +515,8 @@ abstract class base implements \phpbb\notification\type\type_interface { $this->notification_manager->mark_notifications($this->get_type(), (int) $this->item_id, (int) $this->user_id, false, $this->notification_read); } + + return null; } /** diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php index 21338bddb7..2d908eb254 100644 --- a/phpBB/phpbb/notification/type/disapprove_post.php +++ b/phpBB/phpbb/notification/type/disapprove_post.php @@ -73,7 +73,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ public function get_title() { - return $this->user->lang($this->language_key); + return $this->language->lang($this->language_key); } /** @@ -83,7 +83,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('topic_title')) ); @@ -96,7 +96,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ public function get_reason() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('disapprove_reason') ); diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php index 30a23a83fe..c2522fb562 100644 --- a/phpBB/phpbb/notification/type/disapprove_topic.php +++ b/phpBB/phpbb/notification/type/disapprove_topic.php @@ -73,7 +73,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ public function get_title() { - return $this->user->lang($this->language_key); + return $this->language->lang($this->language_key); } /** @@ -83,7 +83,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('topic_title')) ); @@ -96,7 +96,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ public function get_reason() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('disapprove_reason') ); diff --git a/phpBB/phpbb/notification/type/group_request.php b/phpBB/phpbb/notification/type/group_request.php index 8a0027bfec..28a9e73bf9 100644 --- a/phpBB/phpbb/notification/type/group_request.php +++ b/phpBB/phpbb/notification/type/group_request.php @@ -114,7 +114,7 @@ class group_request extends \phpbb\notification\type\base { $username = $this->user_loader->get_username($this->item_id, 'no_profile'); - return $this->user->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name')); + return $this->language->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name')); } /** diff --git a/phpBB/phpbb/notification/type/group_request_approved.php b/phpBB/phpbb/notification/type/group_request_approved.php index dc353f3380..f55d28bafd 100644 --- a/phpBB/phpbb/notification/type/group_request_approved.php +++ b/phpBB/phpbb/notification/type/group_request_approved.php @@ -69,7 +69,7 @@ class group_request_approved extends \phpbb\notification\type\base */ public function get_title() { - return $this->user->lang('NOTIFICATION_GROUP_REQUEST_APPROVED', $this->get_data('group_name')); + return $this->language->lang('NOTIFICATION_GROUP_REQUEST_APPROVED', $this->get_data('group_name')); } /** diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index 2de2dcfa0b..8fb9172911 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -128,7 +128,7 @@ class pm extends \phpbb\notification\type\base { $username = $this->user_loader->get_username($this->get_data('from_user_id'), 'no_profile'); - return $this->user->lang('NOTIFICATION_PM', $username); + return $this->language->lang('NOTIFICATION_PM', $username); } /** @@ -138,7 +138,7 @@ class pm extends \phpbb\notification\type\base */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', $this->get_data('message_subject') ); diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index b16014ff74..b9afc6d70a 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -83,6 +83,7 @@ class post extends \phpbb\notification\type\base * Get the id of the item * * @param array $post The data from the post + * @return int The post id */ static public function get_item_id($post) { @@ -93,6 +94,7 @@ class post extends \phpbb\notification\type\base * Get the id of the parent * * @param array $post The data from the post + * @return int The topic id */ static public function get_item_parent_id($post) { @@ -218,14 +220,14 @@ class post extends \phpbb\notification\type\base if ($trimmed_responders_cnt > 20) { - $usernames[] = $this->user->lang('NOTIFICATION_MANY_OTHERS'); + $usernames[] = $this->language->lang('NOTIFICATION_MANY_OTHERS'); } else if ($trimmed_responders_cnt) { - $usernames[] = $this->user->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt); + $usernames[] = $this->language->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt); } - return $this->user->lang( + return $this->language->lang( $this->language_key, phpbb_generate_string_list($usernames, $this->user), $responders_cnt @@ -239,7 +241,7 @@ class post extends \phpbb\notification\type\base */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('topic_title')) ); @@ -407,6 +409,7 @@ class post extends \phpbb\notification\type\base * Add responders to the notification * * @param mixed $post + * @return array Array of responder data */ public function add_responders($post) { diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 2edf37efc7..684463c8c3 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -106,6 +106,7 @@ class quote extends \phpbb\notification\type\post * Update a notification * * @param array $post Data specific for this type that will be updated + * @return true */ public function update_notifications($post) { diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 4be4705d05..6091919769 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -70,6 +70,7 @@ class report_pm extends \phpbb\notification\type\pm * Get the id of the parent * * @param array $pm The data from the pm + * @return int The report id */ static public function get_item_parent_id($pm) { @@ -144,10 +145,10 @@ class report_pm extends \phpbb\notification\type\pm $user_data = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); return array( - 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), - 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), + 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), + 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), - 'U_VIEW_REPORT' => generate_board_url() . "mcp.{$this->php_ext}?r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details", + 'U_VIEW_REPORT' => generate_board_url() . "mcp.{$this->php_ext}?r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details", ); } @@ -168,11 +169,11 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_title() { - $this->user->add_lang('mcp'); + $this->language->add_lang('mcp'); $username = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -185,7 +186,7 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('message_subject')) ); @@ -200,21 +201,21 @@ class report_pm extends \phpbb\notification\type\pm { if ($this->get_data('report_text')) { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('report_text') ); } - if (isset($this->user->lang[$this->get_data('reason_title')])) + if ($this->language->is_set($this->get_data('reason_title'))) { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', - $this->user->lang[$this->get_data('reason_title')] + $this->language->lang($this->get_data('reason_title')) ); } - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('reason_description') ); diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index f793c7df9a..5e98eb5feb 100644 --- a/phpBB/phpbb/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php @@ -106,7 +106,7 @@ class report_pm_closed extends \phpbb\notification\type\pm { $username = $this->user_loader->get_username($this->get_data('closer_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -119,7 +119,7 @@ class report_pm_closed extends \phpbb\notification\type\pm */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('message_subject')) ); diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index 6eefd53832..84a5241417 100644 --- a/phpBB/phpbb/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php @@ -139,11 +139,11 @@ class report_post extends \phpbb\notification\type\post_in_queue */ public function get_title() { - $this->user->add_lang('mcp'); + $this->language->add_lang('mcp'); $username = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -156,7 +156,7 @@ class report_post extends \phpbb\notification\type\post_in_queue */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('post_subject')) ); @@ -171,21 +171,21 @@ class report_post extends \phpbb\notification\type\post_in_queue { if ($this->get_data('report_text')) { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('report_text') ); } - if (isset($this->user->lang[$this->get_data('reason_title')])) + if ($this->language->is_set($this->get_data('reason_title'))) { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', - $this->user->lang[$this->get_data('reason_title')] + $this->language->lang($this->get_data('reason_title')) ); } - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('reason_description') ); diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index 6327011f2d..165034d57e 100644 --- a/phpBB/phpbb/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php @@ -113,7 +113,7 @@ class report_post_closed extends \phpbb\notification\type\post { $username = $this->user_loader->get_username($this->get_data('closer_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -126,7 +126,7 @@ class report_post_closed extends \phpbb\notification\type\post */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('post_subject')) ); diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 4812e8b5af..671c34fe96 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -83,6 +83,7 @@ class topic extends \phpbb\notification\type\base * Get the id of the item * * @param array $post The data from the post + * @return int The topic id */ static public function get_item_id($post) { @@ -93,6 +94,7 @@ class topic extends \phpbb\notification\type\base * Get the id of the parent * * @param array $post The data from the post + * @return int The forum id */ static public function get_item_parent_id($post) { @@ -154,7 +156,7 @@ class topic extends \phpbb\notification\type\base $username = $this->user_loader->get_username($this->get_data('poster_id'), 'no_profile'); } - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -167,7 +169,7 @@ class topic extends \phpbb\notification\type\base */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('topic_title')) ); @@ -180,7 +182,7 @@ class topic extends \phpbb\notification\type\base */ public function get_forum() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_FORUM', $this->get_data('forum_name') ); diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 7eb501c21a..6de5126ca1 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -667,7 +667,7 @@ fieldset.polls dd div { text-align: right; font-family: Arial, Helvetica, sans-serif; font-weight: bold; - padding: 0 2px; + padding: 2px 2px 0 2px; overflow: visible; min-width: 8px; } diff --git a/tests/mock/notification_type_post.php b/tests/mock/notification_type_post.php index fd2d1b63cd..4116fecf5e 100644 --- a/tests/mock/notification_type_post.php +++ b/tests/mock/notification_type_post.php @@ -21,11 +21,12 @@ if (!defined('IN_PHPBB')) class phpbb_mock_notification_type_post extends \phpbb\notification\type\post { - public function __construct($user_loader, $db, $cache, $user, $auth, $config, $phpbb_root_path, $php_ext, $notification_types_table, $user_notifications_table) + public function __construct($user_loader, $db, $cache, $language, $user, $auth, $config, $phpbb_root_path, $php_ext, $notification_types_table, $user_notifications_table) { $this->user_loader = $user_loader; $this->db = $db; $this->cache = $cache; + $this->language = $language; $this->user = $user; $this->auth = $auth; $this->config = $config; diff --git a/tests/notification/base.php b/tests/notification/base.php index 1295f099f0..b64e25cf8c 100644 --- a/tests/notification/base.php +++ b/tests/notification/base.php @@ -90,6 +90,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case $loader->load('services_notification.yml'); $phpbb_container->set('user_loader', $this->user_loader); $phpbb_container->set('user', $user); + $phpbb_container->set('language', $lang); $phpbb_container->set('config', $this->config); $phpbb_container->set('dbal.conn', $this->db); $phpbb_container->set('auth', $auth); @@ -111,6 +112,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case $this->phpbb_dispatcher, $this->db, $this->cache, + $lang, $this->user, 'phpbb_notification_types', 'phpbb_user_notifications' diff --git a/tests/notification/fixtures/services_notification.yml b/tests/notification/fixtures/services_notification.yml index e0a404b12b..6e68cccff6 100644 --- a/tests/notification/fixtures/services_notification.yml +++ b/tests/notification/fixtures/services_notification.yml @@ -17,6 +17,9 @@ services: dbal.conn: synthetic: true + language: + synthetic: true + auth: synthetic: true diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 72b25abf0a..14ca4499d2 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -54,7 +54,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c { parent::setUp(); - global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $request, $phpEx, $phpbb_root_path, $user_loader; + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader; // Database $this->db = $this->new_dbal(); @@ -91,9 +91,12 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c // Event dispatcher $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + // Language + $lang = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + // User $user = $this->getMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + $lang, '\phpbb\datetime' )); $user->ip = ''; @@ -117,6 +120,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $loader->load('services_notification.yml'); $phpbb_container->set('user_loader', $user_loader); $phpbb_container->set('user', $user); + $phpbb_container->set('language', $lang); $phpbb_container->set('config', $config); $phpbb_container->set('dbal.conn', $db); $phpbb_container->set('auth', $auth); @@ -146,7 +150,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c // Notification Manager $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, $notification_methods_array, - $phpbb_container, $user_loader, $phpbb_dispatcher, $db, $cache, $user, + $phpbb_container, $user_loader, $phpbb_dispatcher, $db, $cache, $lang, $user, NOTIFICATION_TYPES_TABLE, USER_NOTIFICATIONS_TABLE); $phpbb_container->set('notification_manager', $phpbb_notifications); } diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php index d57fbf0485..9f6eb492f6 100644 --- a/tests/notification/user_list_trim_test.php +++ b/tests/notification/user_list_trim_test.php @@ -55,13 +55,13 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->data = array('user_lang' => 'en'); - $user->add_lang('common'); + $lang->add_lang('common'); $user_loader = new phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); $user_loader->load_users(array(2, 3, 4, 5, 6)); $this->notification = new phpbb_mock_notification_type_post( - $user_loader, null, null, $user, null, null, $phpbb_root_path, $phpEx, null, null + $user_loader, null, null, $lang, $user, null, null, $phpbb_root_path, $phpEx, null, null ); } |
