From f29b12e35397ef4a4996ea7d212f0ab5a7a1dba6 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 9 Jul 2015 14:28:34 +0200 Subject: [ticket/11444] Cleanup method constructors PHPBB3-11444 --- phpBB/phpbb/notification/method/messenger_base.php | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/notification/method/messenger_base.php') diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index bde4573117..74a1811155 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -19,6 +19,29 @@ namespace phpbb\notification\method; */ abstract class messenger_base extends \phpbb\notification\method\base { + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** + * Notification Method Board Constructor + * + * @param \phpbb\user_loader $user_loader + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\user_loader $user_loader, $phpbb_root_path, $php_ext) + { + $this->user_loader = $user_loader; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + /** * Notify using phpBB messenger * @@ -57,7 +80,6 @@ abstract class messenger_base extends \phpbb\notification\method\base include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); } $messenger = new \messenger(); - $board_url = generate_board_url(); // Time to go through the queue and send emails foreach ($this->queue as $notification) -- cgit v1.2.1 From b64a37d451132dcf7ef5fc3d6e700a6fb6decd90 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 13 Oct 2015 23:40:52 -0700 Subject: [ticket/14237] Use $language class for notifications PHPBB3-14237 --- phpBB/phpbb/notification/method/messenger_base.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/phpbb/notification/method/messenger_base.php') 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) -- cgit v1.2.1 From ec2d983ab1864affc6fd5718fc2faede488301dd Mon Sep 17 00:00:00 2001 From: kasimi Date: Thu, 24 Aug 2017 10:36:54 +0200 Subject: [ticket/15328] Disable checkbox if notification method isn't supported PHPBB3-15328 --- phpBB/phpbb/notification/method/messenger_base.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'phpBB/phpbb/notification/method/messenger_base.php') diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 1f5525accc..7c99085a95 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -42,6 +42,19 @@ abstract class messenger_base extends \phpbb\notification\method\base $this->php_ext = $php_ext; } + /** + * Is this method available for the user? + * This is checked on the notifications options + * + * @param \phpbb\notification\type\type_interface $notification_type An optional instance of a notification type. This method returns false + * only if the type is provided and if it doesn't provide an email template. + * @return bool + */ + public function is_available(\phpbb\notification\type\type_interface $notification_type = null) + { + return $notification_type === null || $notification_type->get_email_template() !== false; + } + /** * Notify using phpBB messenger * -- cgit v1.2.1 From edd1ce74436c399f407e667b0b81b329a57a6f15 Mon Sep 17 00:00:00 2001 From: kasimi Date: Thu, 7 Sep 2017 13:30:39 +0200 Subject: [ticket/15328] Use type_interface PHPBB3-15328 --- phpBB/phpbb/notification/method/messenger_base.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/notification/method/messenger_base.php') diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 7c99085a95..32e79aa936 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -13,6 +13,8 @@ namespace phpbb\notification\method; +use phpbb\notification\type\type_interface; + /** * Abstract notification method handling email and jabber notifications * using the phpBB messenger. @@ -46,11 +48,11 @@ abstract class messenger_base extends \phpbb\notification\method\base * Is this method available for the user? * This is checked on the notifications options * - * @param \phpbb\notification\type\type_interface $notification_type An optional instance of a notification type. This method returns false - * only if the type is provided and if it doesn't provide an email template. + * @param type_interface $notification_type An optional instance of a notification type. This method returns false + * only if the type is provided and if it doesn't provide an email template. * @return bool */ - public function is_available(\phpbb\notification\type\type_interface $notification_type = null) + public function is_available(type_interface $notification_type = null) { return $notification_type === null || $notification_type->get_email_template() !== false; } -- cgit v1.2.1 From 76982b430f8417c5930905f96ea42cd4c34ca6d7 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Thu, 26 Jul 2018 15:42:44 +0200 Subject: [ticket/11453] Improve performance of notification.method.messenger_base PHPBB3-11453 --- phpBB/phpbb/notification/method/messenger_base.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/notification/method/messenger_base.php') diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 32e79aa936..f82017b70e 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -87,7 +87,7 @@ abstract class messenger_base extends \phpbb\notification\method\base $banned_users = phpbb_get_banned_user_ids($user_ids); // Load all the users we need - $this->user_loader->load_users($user_ids); + $this->user_loader->load_users(array_diff($user_ids, $banned_users), array(USER_IGNORE)); // Load the messenger if (!class_exists('messenger')) @@ -107,7 +107,7 @@ abstract class messenger_base extends \phpbb\notification\method\base $user = $this->user_loader->get_user($notification->user_id); - if ($user['user_type'] == USER_IGNORE || ($user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL) || in_array($notification->user_id, $banned_users)) + if ($user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL) { continue; } -- cgit v1.2.1