diff options
Diffstat (limited to 'phpBB/includes/notifications/method')
-rw-r--r-- | phpBB/includes/notifications/method/base.php | 25 | ||||
-rw-r--r-- | phpBB/includes/notifications/method/email.php | 14 |
2 files changed, 27 insertions, 12 deletions
diff --git a/phpBB/includes/notifications/method/base.php b/phpBB/includes/notifications/method/base.php index 98c06509c6..3ed9d3f33c 100644 --- a/phpBB/includes/notifications/method/base.php +++ b/phpBB/includes/notifications/method/base.php @@ -24,23 +24,46 @@ if (!defined('IN_PHPBB')) abstract class phpbb_notifications_method_base implements phpbb_notifications_method_interface { protected $phpbb_container; + protected $service; protected $db; protected $user; protected $phpbb_root_path; protected $php_ext; /** + * 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? + */ + + /** * Queue of messages to be sent * * @var array */ protected $queue = array(); - public function __construct(ContainerBuilder $phpbb_container, $data = array()) + public function __construct(ContainerBuilder $phpbb_container) { // 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'); diff --git a/phpBB/includes/notifications/method/email.php b/phpBB/includes/notifications/method/email.php index 2b80b5bf3a..50df9a6c56 100644 --- a/phpBB/includes/notifications/method/email.php +++ b/phpBB/includes/notifications/method/email.php @@ -59,14 +59,8 @@ class phpbb_notifications_method_email extends phpbb_notifications_method_base } $banned_users = phpbb_get_banned_user_ids($user_ids); - $sql = 'SELECT * FROM ' . USERS_TABLE . ' - WHERE ' . $this->db->sql_in_set('user_id', $user_ids); - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - $users[$row['user_id']] = $row; - } - $this->db->sql_freeresult($result); + // Load all the users we need + $this->service->load_users($user_ids); // Load the messenger if (!class_exists('messenger')) @@ -84,9 +78,7 @@ class phpbb_notifications_method_email extends phpbb_notifications_method_base continue; } - $notification->users($users); - - $user = $notification->get_user($notification->user_id); + $user = $this->service->get_user($notification->user_id); $messenger->template('privmsg_notify', $user['user_lang']); |