1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/17135] Fix code review issues

PHPBB-17135
This commit is contained in:
rxu
2024-06-23 13:26:43 +07:00
parent 51fae82718
commit 499464e1d3
24 changed files with 353 additions and 1782 deletions

View File

@@ -39,6 +39,9 @@ class activate extends command
/** @var log_interface */
protected $log;
/** @var service_collection */
protected $messenger;
/** @var manager */
protected $notifications;
@@ -59,9 +62,6 @@ class activate extends command
*/
protected $php_ext;
/** @var service_collection */
protected $messenger;
/**
* Construct method
*
@@ -69,22 +69,22 @@ class activate extends command
* @param config $config
* @param language $language
* @param log_interface $log
* @param service_collection $messenger
* @param manager $notifications
* @param user_loader $user_loader
* @param string $phpbb_root_path
* @param string $php_ext
* @param service_collection $messenger
*/
public function __construct(user $user, config $config, language $language, log_interface $log, manager $notifications, user_loader $user_loader, $phpbb_root_path, $php_ext, service_collection $messenger)
public function __construct(user $user, config $config, language $language, log_interface $log, service_collection $messenger, manager $notifications, user_loader $user_loader, $phpbb_root_path, $php_ext)
{
$this->config = $config;
$this->language = $language;
$this->log = $log;
$this->messenger = $messenger;
$this->notifications = $notifications;
$this->user_loader = $user_loader;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->messenger = $messenger;
$this->language->add_lang('acp/users');
parent::__construct($user);
@@ -200,15 +200,15 @@ class activate extends command
if ($input->getOption('send-email'))
{
$email = $this->messenger->offsetGet('messenger.method.email');
$email->set_use_queue(false);
$email->template('admin_welcome_activated', $user_row['user_lang']);
$email->set_addresses($user_row);
$email->anti_abuse_headers($this->config, $this->user);
$email->assign_vars([
$email_method = $this->messenger->offsetGet('messenger.method.email');
$email_method->set_use_queue(false);
$email_method->template('admin_welcome_activated', $user_row['user_lang']);
$email_method->set_addresses($user_row);
$email_method->anti_abuse_headers($this->config, $this->user);
$email_method->assign_vars([
'USERNAME' => html_entity_decode($user_row['username'], ENT_COMPAT),
]);
$email->send();
$email_method->send();
}
}
}

View File

@@ -43,6 +43,9 @@ class add extends command
/** @var language */
protected $language;
/** @var service_collection */
protected $messenger;
/** @var manager */
protected $password_manager;
@@ -60,9 +63,6 @@ class add extends command
*/
protected $php_ext;
/** @var service_collection */
protected $messenger;
/**
* Construct method
*
@@ -70,20 +70,20 @@ class add extends command
* @param driver_interface $db
* @param config $config
* @param language $language
* @param service_collection $messenger
* @param manager $password_manager
* @param string $phpbb_root_path
* @param string $php_ext
* @param service_collection $messenger
*/
public function __construct(user $user, driver_interface $db, config $config, language $language, manager $password_manager, $phpbb_root_path, $php_ext, service_collection $messenger)
public function __construct(user $user, driver_interface $db, config $config, language $language, service_collection $messenger, manager $password_manager, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->config = $config;
$this->language = $language;
$this->messenger = $messenger;
$this->password_manager = $password_manager;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->messenger = $messenger;
$this->language->add_lang('ucp');
parent::__construct($user);
@@ -313,18 +313,18 @@ class add extends command
$user_actkey = $this->get_activation_key($user_id);
$email = $this->messenger->offsetGet('messenger.method.email');
$email->set_use_queue(false);
$email->template($email_template, $this->user->lang_name);
$email->to($this->data['email'], $this->data['username']);
$email->anti_abuse_headers($this->config, $this->user);
$email->assign_vars([
$email_method = $this->messenger->offsetGet('messenger.method.email');
$email_method->set_use_queue(false);
$email_method->template($email_template, $this->user->lang_name);
$email_method->to($this->data['email'], $this->data['username']);
$email_method->anti_abuse_headers($this->config, $this->user);
$email_method->assign_vars([
'WELCOME_MSG' => html_entity_decode($this->language->lang('WELCOME_SUBJECT', $this->config['sitename']), ENT_COMPAT),
'USERNAME' => html_entity_decode($this->data['username'], ENT_COMPAT),
'PASSWORD' => html_entity_decode($this->data['new_password'], ENT_COMPAT),
'U_ACTIVATE' => generate_board_url() . "/ucp.{$this->php_ext}?mode=activate&u=$user_id&k=$user_actkey",
]);
$email->send();
$email_method->send();
}
/**