From 64820546d758b34720888311d0abffcf95609436 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 13:40:40 -0500 Subject: [ticket/11103] Move notification files to includes/notification/ PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 92 ++++++++++++++++++++ phpBB/includes/notification/method/email.php | 104 +++++++++++++++++++++++ phpBB/includes/notification/method/interface.php | 27 ++++++ phpBB/includes/notification/method/jabber.php | 62 ++++++++++++++ 4 files changed, 285 insertions(+) create mode 100644 phpBB/includes/notification/method/base.php create mode 100644 phpBB/includes/notification/method/email.php create mode 100644 phpBB/includes/notification/method/interface.php create mode 100644 phpBB/includes/notification/method/jabber.php (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php new file mode 100644 index 0000000000..b502d3afd0 --- /dev/null +++ b/phpBB/includes/notification/method/base.php @@ -0,0 +1,92 @@ +phpbb_container = $phpbb_container; + + // Service + $this->service = $phpbb_container->get('notifications'); + + // Some common things we're going to use + $this->db = $phpbb_container->get('dbal.conn'); + $this->user = $phpbb_container->get('user'); + + $this->phpbb_root_path = $phpbb_container->getParameter('core.root_path'); + $this->php_ext = $phpbb_container->getParameter('core.php_ext'); + } + + /** + * Add a notification to the queue + * + * @param phpbb_notification_type_interface $notification + */ + public function add_to_queue(phpbb_notification_type_interface $notification) + { + $this->queue[] = $notification; + } + + /** + * Empty the queue + */ + protected function empty_queue() + { + $this->queue = array(); + } +} diff --git a/phpBB/includes/notification/method/email.php b/phpBB/includes/notification/method/email.php new file mode 100644 index 0000000000..1b6b44d137 --- /dev/null +++ b/phpBB/includes/notification/method/email.php @@ -0,0 +1,104 @@ +queue)) + { + return; + } + + // Load all users we want to notify (we need their email address) + $user_ids = $users = array(); + foreach ($this->queue as $notification) + { + $user_ids[] = $notification->user_id; + } + + // We do not send emails to banned users + if (!function_exists('phpbb_get_banned_user_ids')) + { + include($this->phpbb_container->getParameter('core.root_path') . 'includes/functions_user.' . $this->phpbb_container->getParameter('core.php_ext')); + } + $banned_users = phpbb_get_banned_user_ids($user_ids); + + // Load all the users we need + $this->service->load_users($user_ids); + + // Load the messenger + if (!class_exists('messenger')) + { + 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) + { + $user = $this->service->get_user($notification->user_id); + + if ($user['user_type'] == USER_IGNORE || in_array($notification->user_id, $banned_users)) + { + continue; + } + + $messenger->template($notification->email_template, $user['user_lang']); + + $messenger->to($user['user_email'], $user['username']); + + $messenger->assign_vars(array_merge(array( + 'USERNAME' => $user['username'], + + 'U_NOTIFICATION_SETTINGS' => generate_board_url() . '/ucp.' . $this->php_ext . '?i=ucp_notifications', + ), $notification->get_email_template_variables())); + + $messenger->send($this->notify_method); + } + + // Save the queue in the messenger class (has to be called or these emails could be lost?) + $messenger->save_queue(); + + // We're done, empty the queue + $this->empty_queue(); + } +} diff --git a/phpBB/includes/notification/method/interface.php b/phpBB/includes/notification/method/interface.php new file mode 100644 index 0000000000..4b990ec9fa --- /dev/null +++ b/phpBB/includes/notification/method/interface.php @@ -0,0 +1,27 @@ +global_available() && $this->phpbb_container->get('user')->data['jabber']); + } + + /** + * Is this method available at all? + * This is checked before notifications are sent + */ + public function global_available() + { + $config = $this->phpbb_container->get('config'); + + return ($config['jab_enable'] && @extension_loaded('xml')); + } + + public function notify() + { + if (!$this->global_available()) + { + return; + } + + return parent::notify(); + } +} -- cgit v1.2.1 From cea94d89848a806f449610ddb2a7df7b7eec1328 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 14:27:43 -0500 Subject: [ticket/11103] Use dependency injection instead of phpbb_container PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 30 ++++++++++----------------- phpBB/includes/notification/method/email.php | 6 +++--- phpBB/includes/notification/method/jabber.php | 6 ++---- 3 files changed, 16 insertions(+), 26 deletions(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index b502d3afd0..ced85e2582 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -23,12 +23,7 @@ if (!defined('IN_PHPBB')) */ abstract class phpbb_notification_method_base implements phpbb_notification_method_interface { - protected $phpbb_container; - protected $service; - protected $db; - protected $user; - protected $phpbb_root_path; - protected $php_ext; + protected $notification_manager, $db, $cache, $template, $extension_manager, $user, $auth, $config, $phpbb_root_path, $php_ext = null; /** * Desired notifications @@ -56,20 +51,17 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(ContainerBuilder $phpbb_container) + public function __construct(dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, phpbb_user $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { - // phpBB Container - $this->phpbb_container = $phpbb_container; - - // Service - $this->service = $phpbb_container->get('notifications'); - - // Some common things we're going to use - $this->db = $phpbb_container->get('dbal.conn'); - $this->user = $phpbb_container->get('user'); - - $this->phpbb_root_path = $phpbb_container->getParameter('core.root_path'); - $this->php_ext = $phpbb_container->getParameter('core.php_ext'); + $this->db = $db; + $this->cache = $cache; + $this->template = $template; + $this->extension_manager = $extension_manager; + $this->user = $user; + $this->auth = $auth; + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; } /** diff --git a/phpBB/includes/notification/method/email.php b/phpBB/includes/notification/method/email.php index 1b6b44d137..c2e272aca1 100644 --- a/phpBB/includes/notification/method/email.php +++ b/phpBB/includes/notification/method/email.php @@ -57,12 +57,12 @@ class phpbb_notification_method_email extends phpbb_notification_method_base // We do not send emails to banned users if (!function_exists('phpbb_get_banned_user_ids')) { - include($this->phpbb_container->getParameter('core.root_path') . 'includes/functions_user.' . $this->phpbb_container->getParameter('core.php_ext')); + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); } $banned_users = phpbb_get_banned_user_ids($user_ids); // Load all the users we need - $this->service->load_users($user_ids); + $this->notification_manager->load_users($user_ids); // Load the messenger if (!class_exists('messenger')) @@ -75,7 +75,7 @@ class phpbb_notification_method_email extends phpbb_notification_method_base // Time to go through the queue and send emails foreach ($this->queue as $notification) { - $user = $this->service->get_user($notification->user_id); + $user = $this->notification_manager->get_user($notification->user_id); if ($user['user_type'] == USER_IGNORE || in_array($notification->user_id, $banned_users)) { diff --git a/phpBB/includes/notification/method/jabber.php b/phpBB/includes/notification/method/jabber.php index 9232d8fc45..664e387d61 100644 --- a/phpBB/includes/notification/method/jabber.php +++ b/phpBB/includes/notification/method/jabber.php @@ -36,7 +36,7 @@ class phpbb_notification_method_jabber extends phpbb_notification_method_email */ public function is_available() { - return ($this->global_available() && $this->phpbb_container->get('user')->data['jabber']); + return ($this->global_available() && $this->user->data['jabber']); } /** @@ -45,9 +45,7 @@ class phpbb_notification_method_jabber extends phpbb_notification_method_email */ public function global_available() { - $config = $this->phpbb_container->get('config'); - - return ($config['jab_enable'] && @extension_loaded('xml')); + return ($this->config['jab_enable'] && @extension_loaded('xml')); } public function notify() -- cgit v1.2.1 From ff136cc96a62147bc7468b716b86a30f12754e77 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 15:21:07 -0500 Subject: [ticket/11103] Do not use Symfony\...\ContainerBuilder; It's no longer needed PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index ced85e2582..d95a65fa72 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -7,7 +7,6 @@ * */ -use Symfony\Component\DependencyInjection\ContainerBuilder; /** * @ignore -- cgit v1.2.1 From ceb56da965f12245bca6b735cb71f3bbaf505307 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 21:39:17 -0500 Subject: [ticket/11103] Fixing a few bugs from the previous changes PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index d95a65fa72..9f1db6d9f5 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -50,8 +50,9 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, phpbb_user $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) + public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, phpbb_user $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { + $this->notification_manager = $notification_manager; $this->db = $db; $this->cache = $cache; $this->template = $template; -- cgit v1.2.1 From 3f2e3ad633930744e1ed92cc529ca473ccfa09e0 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Oct 2012 00:07:48 -0500 Subject: [ticket/11103] Working on test case Fixing extension type/method naming scheme so they can be autoloaded. Other bugs PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 9f1db6d9f5..6410b1f519 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -50,7 +50,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, phpbb_user $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) + public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { $this->notification_manager = $notification_manager; $this->db = $db; -- cgit v1.2.1 From 2d69707a88fdb618730243cbe65ebc055cf68bae Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Oct 2012 00:23:14 -0500 Subject: [ticket/11103] Remove extra line break in the header Was introduced with ff136cc96a62147bc7468b716b86a30f12754e77 PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 6410b1f519..5457ca99b2 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -7,7 +7,6 @@ * */ - /** * @ignore */ -- cgit v1.2.1 From eb07b3ad9cfb37fd2943088170e380bff2db94a3 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 18 Oct 2012 18:45:43 -0500 Subject: [ticket/11103] Expand class vars and use docblocks for phpBB classes PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 47 +++++++++++++++++------------ 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 5457ca99b2..88ec2674be 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -21,26 +21,35 @@ if (!defined('IN_PHPBB')) */ abstract class phpbb_notification_method_base implements phpbb_notification_method_interface { - protected $notification_manager, $db, $cache, $template, $extension_manager, $user, $auth, $config, $phpbb_root_path, $php_ext = null; + /** @var phpbb_notification_manager */ + protected $notification_manager = null; - /** - * Desired notifications - * unique by (type, type_id, user_id, method) - * if multiple methods are desired, multiple rows will exist. - * - * method of "none" will over-ride any other options - * - * item_type - * item_id - * user_id - * method - * none (will never receive notifications) - * standard (listed in notifications window - * popup? - * email - * jabber - * sms? - */ + /** @var dbal */ + protected $db = null; + + /** @var phpbb_cache_service */ + protected $cache = null; + + /** @var phpbb_template */ + protected $template = null; + + /** @var phpbb_extension_manager */ + protected $extension_manager = null; + + /** @var phpbb_user */ + protected $user = null; + + /** @var phpbb_auth */ + protected $auth = null; + + /** @var phpbb_config */ + protected $config = null; + + /** @var string */ + protected $phpbb_root_path = null; + + /** @var string */ + protected $php_ext = null; /** * Queue of messages to be sent -- cgit v1.2.1 From f96dac335287f2fd51ff6628facbc8b6af6a517f Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 18 Oct 2012 19:13:47 -0500 Subject: [ticket/11103] Interface docblocks PHPBB3-11103 --- phpBB/includes/notification/method/email.php | 3 +++ phpBB/includes/notification/method/interface.php | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/email.php b/phpBB/includes/notification/method/email.php index c2e272aca1..e902ea1e85 100644 --- a/phpBB/includes/notification/method/email.php +++ b/phpBB/includes/notification/method/email.php @@ -40,6 +40,9 @@ class phpbb_notification_method_email extends phpbb_notification_method_base return true; } + /** + * Parse the queue and notify the users + */ public function notify() { if (!sizeof($this->queue)) diff --git a/phpBB/includes/notification/method/interface.php b/phpBB/includes/notification/method/interface.php index 4b990ec9fa..f5c210a2fc 100644 --- a/phpBB/includes/notification/method/interface.php +++ b/phpBB/includes/notification/method/interface.php @@ -21,7 +21,26 @@ if (!defined('IN_PHPBB')) */ interface phpbb_notification_method_interface { + /** + * Is this method available for the user? + * This is checked on the notifications options + */ public function is_available(); + /** + * Add a notification to the queue + * + * @param phpbb_notification_type_interface $notification + */ + public function add_to_queue(phpbb_notification_type_interface $notification); + + /** + * Empty the queue + */ + protected function empty_queue(); + + /** + * Parse the queue and notify the users + */ public function notify(); } -- cgit v1.2.1 From 0ac9079d1c4e32ae04bb7b5da55fa030279ec9b5 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 20 Oct 2012 18:55:13 -0500 Subject: [ticket/11103] Replace $email_template with get_email_template() PHPBB3-11103 --- phpBB/includes/notification/method/email.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/email.php b/phpBB/includes/notification/method/email.php index e902ea1e85..df7edb13e7 100644 --- a/phpBB/includes/notification/method/email.php +++ b/phpBB/includes/notification/method/email.php @@ -78,6 +78,11 @@ class phpbb_notification_method_email extends phpbb_notification_method_base // Time to go through the queue and send emails foreach ($this->queue as $notification) { + if ($notification->get_email_template() === false) + { + continue; + } + $user = $this->notification_manager->get_user($notification->user_id); if ($user['user_type'] == USER_IGNORE || in_array($notification->user_id, $banned_users)) @@ -85,7 +90,7 @@ class phpbb_notification_method_email extends phpbb_notification_method_base continue; } - $messenger->template($notification->email_template, $user['user_lang']); + $messenger->template($notification->get_email_template(), $user['user_lang']); $messenger->to($user['user_email'], $user['username']); -- cgit v1.2.1 From 52bb4a1bd60dfcaad99d1ac181d8a0372db9cc2b Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 20 Oct 2012 19:00:37 -0500 Subject: [ticket/11103] Do not have empty queue in the interface This is not needed as it is not public. PHPBB3-11103 --- phpBB/includes/notification/method/interface.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/interface.php b/phpBB/includes/notification/method/interface.php index f5c210a2fc..3c6c757d5c 100644 --- a/phpBB/includes/notification/method/interface.php +++ b/phpBB/includes/notification/method/interface.php @@ -34,11 +34,6 @@ interface phpbb_notification_method_interface */ public function add_to_queue(phpbb_notification_type_interface $notification); - /** - * Empty the queue - */ - protected function empty_queue(); - /** * Parse the queue and notify the users */ -- cgit v1.2.1 From f09ee162528d931aabc3f216410d02d3a072c21d Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 9 Nov 2012 07:40:08 -0600 Subject: [ticket/11103] Use phpBB Container to load types/methods PHPBB3-11103 --- phpBB/includes/notification/method/email.php | 10 ++++++++++ phpBB/includes/notification/method/interface.php | 7 +++++++ phpBB/includes/notification/method/jabber.php | 10 ++++++++++ 3 files changed, 27 insertions(+) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/email.php b/phpBB/includes/notification/method/email.php index df7edb13e7..a47284bc61 100644 --- a/phpBB/includes/notification/method/email.php +++ b/phpBB/includes/notification/method/email.php @@ -23,6 +23,16 @@ if (!defined('IN_PHPBB')) */ class phpbb_notification_method_email extends phpbb_notification_method_base { + /** + * Get notification method name + * + * @return string + */ + public function get_type() + { + return 'email'; + } + /** * Notify method (since jabber gets sent through the same messenger, we let the jabber class inherit from this to reduce code duplication) * diff --git a/phpBB/includes/notification/method/interface.php b/phpBB/includes/notification/method/interface.php index 3c6c757d5c..ef875942cc 100644 --- a/phpBB/includes/notification/method/interface.php +++ b/phpBB/includes/notification/method/interface.php @@ -21,6 +21,13 @@ if (!defined('IN_PHPBB')) */ interface phpbb_notification_method_interface { + /** + * Get notification method name + * + * @return string + */ + public function get_type(); + /** * Is this method available for the user? * This is checked on the notifications options diff --git a/phpBB/includes/notification/method/jabber.php b/phpBB/includes/notification/method/jabber.php index 664e387d61..fc43d8d4b9 100644 --- a/phpBB/includes/notification/method/jabber.php +++ b/phpBB/includes/notification/method/jabber.php @@ -23,6 +23,16 @@ if (!defined('IN_PHPBB')) */ class phpbb_notification_method_jabber extends phpbb_notification_method_email { + /** + * Get notification method name + * + * @return string + */ + public function get_type() + { + return 'jabber'; + } + /** * Notify method (since jabber gets sent through the same messenger, we let the jabber class inherit from this to reduce code duplication) * -- cgit v1.2.1 From 7948aaa78ed7e543a0773ee1a858ef45f5e5a5bf Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Sun, 11 Nov 2012 11:41:18 -0600 Subject: [ticket/11103] Make jabber use short/ email template files PHPBB3-11103 --- phpBB/includes/notification/method/email.php | 9 ++++++++- phpBB/includes/notification/method/jabber.php | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/email.php b/phpBB/includes/notification/method/email.php index a47284bc61..2ff30b177f 100644 --- a/phpBB/includes/notification/method/email.php +++ b/phpBB/includes/notification/method/email.php @@ -40,6 +40,13 @@ class phpbb_notification_method_email extends phpbb_notification_method_base */ protected $notify_method = NOTIFY_EMAIL; + /** + * Base directory to prepend to the email template name + * + * @var string + */ + protected $email_template_base_dir = ''; + /** * Is this method available for the user? * This is checked on the notifications options @@ -100,7 +107,7 @@ class phpbb_notification_method_email extends phpbb_notification_method_base continue; } - $messenger->template($notification->get_email_template(), $user['user_lang']); + $messenger->template($this->email_template_base_dir . $notification->get_email_template(), $user['user_lang']); $messenger->to($user['user_email'], $user['username']); diff --git a/phpBB/includes/notification/method/jabber.php b/phpBB/includes/notification/method/jabber.php index fc43d8d4b9..e3eb571fbc 100644 --- a/phpBB/includes/notification/method/jabber.php +++ b/phpBB/includes/notification/method/jabber.php @@ -40,6 +40,13 @@ class phpbb_notification_method_jabber extends phpbb_notification_method_email */ protected $notify_method = NOTIFY_IM; + /** + * Base directory to prepend to the email template name + * + * @var string + */ + protected $email_template_base_dir = 'short/'; + /** * Is this method available for the user? * This is checked on the notifications options -- cgit v1.2.1 From 2afb8b9df873c3f9572a32ab7a62ea8ba8d8a45b Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 20 Nov 2012 18:14:48 -0600 Subject: [ticket/11103] Create user loader class, update for DIC Create a very basic user loader class to handle querying/storing user data in a centralized location. Use DIC collection service for notification types/methods. Cleanup unused dependencies. Fix some other issues. PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 14 ++++++++++---- phpBB/includes/notification/method/email.php | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 88ec2674be..3f85d62a09 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -24,6 +24,9 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth /** @var phpbb_notification_manager */ protected $notification_manager = null; + /** @var phpbb_user_loader */ + protected $user_loader = null; + /** @var dbal */ protected $db = null; @@ -58,13 +61,11 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) + public function __construct(phpbb_user_loader $user_loader, dbal $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { - $this->notification_manager = $notification_manager; + $this->user_loader = $user_loader; $this->db = $db; $this->cache = $cache; - $this->template = $template; - $this->extension_manager = $extension_manager; $this->user = $user; $this->auth = $auth; $this->config = $config; @@ -72,6 +73,11 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth $this->php_ext = $php_ext; } + public function set_notification_manager(phpbb_notification_manager $notification_manager) + { + $this->notification_manager = $notification_manager; + } + /** * Add a notification to the queue * diff --git a/phpBB/includes/notification/method/email.php b/phpBB/includes/notification/method/email.php index 2ff30b177f..429dfda2ba 100644 --- a/phpBB/includes/notification/method/email.php +++ b/phpBB/includes/notification/method/email.php @@ -82,7 +82,7 @@ class phpbb_notification_method_email extends phpbb_notification_method_base $banned_users = phpbb_get_banned_user_ids($user_ids); // Load all the users we need - $this->notification_manager->load_users($user_ids); + $this->user_loader->load_users($user_ids); // Load the messenger if (!class_exists('messenger')) @@ -100,7 +100,7 @@ class phpbb_notification_method_email extends phpbb_notification_method_base continue; } - $user = $this->notification_manager->get_user($notification->user_id); + $user = $this->user_loader->get_user($notification->user_id); if ($user['user_type'] == USER_IGNORE || in_array($notification->user_id, $banned_users)) { -- cgit v1.2.1 From ddd874ba76366cebe3cc30df6daa1974e29f34d1 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 19:46:32 -0600 Subject: [ticket/11103] dbal -> phpbb_db_driver PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 3f85d62a09..f37e7e7845 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -27,7 +27,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth /** @var phpbb_user_loader */ protected $user_loader = null; - /** @var dbal */ + /** @var phpbb_db_driver */ protected $db = null; /** @var phpbb_cache_service */ @@ -61,7 +61,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(phpbb_user_loader $user_loader, dbal $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) + public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { $this->user_loader = $user_loader; $this->db = $db; -- cgit v1.2.1 From 07282a30ae077825ea81a4e26839ac0473dc97b7 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 15 Jan 2013 12:10:07 -0600 Subject: [ticket/11103] Fix some various issues, better comments PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 40 +++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index f37e7e7845..c4c0a64ae0 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -22,37 +22,37 @@ if (!defined('IN_PHPBB')) abstract class phpbb_notification_method_base implements phpbb_notification_method_interface { /** @var phpbb_notification_manager */ - protected $notification_manager = null; + protected $notification_manager; /** @var phpbb_user_loader */ - protected $user_loader = null; + protected $user_loader; /** @var phpbb_db_driver */ - protected $db = null; + protected $db; /** @var phpbb_cache_service */ - protected $cache = null; + protected $cache; /** @var phpbb_template */ - protected $template = null; + protected $template; /** @var phpbb_extension_manager */ - protected $extension_manager = null; + protected $extension_manager; /** @var phpbb_user */ - protected $user = null; + protected $user; /** @var phpbb_auth */ - protected $auth = null; + protected $auth; /** @var phpbb_config */ - protected $config = null; + protected $config; /** @var string */ - protected $phpbb_root_path = null; + protected $phpbb_root_path; /** @var string */ - protected $php_ext = null; + protected $php_ext; /** * Queue of messages to be sent @@ -61,6 +61,19 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); + /** + * Notification Method Base Constructor + * + * @param phpbb_user_loader $user_loader + * @param phpbb_db_driver $db + * @param phpbb_cache_driver_interface $cache + * @param mixed $user + * @param phpbb_auth $auth + * @param phpbb_config $config + * @param mixed $phpbb_root_path + * @param mixed $php_ext + * @return phpbb_notification_method_base + */ public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { $this->user_loader = $user_loader; @@ -73,6 +86,11 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth $this->php_ext = $php_ext; } + /** + * Set notification manager (required) + * + * @param phpbb_notification_manager $notification_manager + */ public function set_notification_manager(phpbb_notification_manager $notification_manager) { $this->notification_manager = $notification_manager; -- cgit v1.2.1 From bd499425522a61ddd617e9ac4cfed9a7859bf949 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 15 Jan 2013 12:54:39 -0600 Subject: [ticket/11103] Correcting constructor comments PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/notification/method') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index c4c0a64ae0..22418c9be8 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -67,11 +67,11 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth * @param phpbb_user_loader $user_loader * @param phpbb_db_driver $db * @param phpbb_cache_driver_interface $cache - * @param mixed $user + * @param phpbb_user $user * @param phpbb_auth $auth * @param phpbb_config $config - * @param mixed $phpbb_root_path - * @param mixed $php_ext + * @param string $phpbb_root_path + * @param string $php_ext * @return phpbb_notification_method_base */ public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) -- cgit v1.2.1