1010
1111namespace phpbb \teamsecurity \event ;
1212
13+ use phpbb \config \config ;
14+ use phpbb \language \language ;
15+ use phpbb \log \log ;
16+ use phpbb \messenger \method \email ;
17+ use phpbb \user ;
1318use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
1419
1520/**
1621 * Event listener
1722 */
1823class listener implements EventSubscriberInterface
1924{
20- /** @var \phpbb\config\ config */
25+ /** @var config */
2126 protected $ config ;
2227
23- /** @var \phpbb\language\language */
28+ /** @var email */
29+ protected $ email_method ;
30+
31+ /** @var language */
2432 protected $ language ;
2533
26- /** @var \phpbb\log\ log */
34+ /** @var log */
2735 protected $ log ;
2836
29- /** @var \phpbb\ user */
37+ /** @var user */
3038 protected $ user ;
3139
3240 /** @var string phpBB root path */
@@ -38,17 +46,19 @@ class listener implements EventSubscriberInterface
3846 /**
3947 * Constructor
4048 *
41- * @param \phpbb\config\config $config Config object
42- * @param \phpbb\language\language $language Language object
43- * @param \phpbb\log\log $log The phpBB log system
44- * @param \phpbb\user $user User object
49+ * @param config $config Config object
50+ * @param email $email_method Email method
51+ * @param language $language Language object
52+ * @param log $log The phpBB log system
53+ * @param user $user User object
4554 * @param string $phpbb_root_path phpBB root path
4655 * @param string $phpEx phpEx
4756 * @access public
4857 */
49- public function __construct (\ phpbb \ config \ config $ config , \ phpbb \ language \ language $ language , \ phpbb \ log \ log $ log , \ phpbb \ user $ user , $ phpbb_root_path , $ phpEx )
58+ public function __construct (config $ config , email $ email_method , language $ language , log $ log , user $ user , string $ phpbb_root_path , string $ phpEx )
5059 {
5160 $ this ->config = $ config ;
61+ $ this ->email_method = $ email_method ;
5262 $ this ->language = $ language ;
5363 $ this ->log = $ log ;
5464 $ this ->user = $ user ;
@@ -283,16 +293,11 @@ protected function in_watch_group($user_id)
283293 */
284294 protected function send_message ($ message_data , $ template , $ cc_user = '' )
285295 {
286- if (!class_exists ('messenger ' ))
287- {
288- include $ this ->phpbb_root_path . 'includes/functions_messenger. ' . $ this ->php_ext ;
289- }
290-
291- $ messenger = new \messenger (false );
292- $ messenger ->template ('@phpbb_teamsecurity/ ' . $ template );
293- $ messenger ->to (!empty ($ this ->config ['sec_contact ' ]) ? $ this ->config ['sec_contact ' ] : $ this ->config ['board_contact ' ], $ this ->config ['board_contact_name ' ]);
294- $ messenger ->cc ($ cc_user );
295- $ messenger ->assign_vars ($ message_data );
296- $ messenger ->send ();
296+ $ this ->email_method ->set_use_queue (false );
297+ $ this ->email_method ->template ('@phpbb_teamsecurity/ ' . $ template );
298+ $ this ->email_method ->to (!empty ($ this ->config ['sec_contact ' ]) ? $ this ->config ['sec_contact ' ] : $ this ->config ['board_contact ' ], $ this ->config ['board_contact_name ' ]);
299+ $ this ->email_method ->cc ($ cc_user );
300+ $ this ->email_method ->assign_vars ($ message_data );
301+ $ this ->email_method ->send ();
297302 }
298303}
0 commit comments