mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02:00
[ticket/17135] Address review issues but constants
PHPBB-17135
This commit is contained in:
@@ -117,8 +117,8 @@ abstract class base implements messenger_interface
|
||||
service_collection $twig_extensions_collection,
|
||||
lexer $twig_lexer,
|
||||
user $user,
|
||||
$phpbb_root_path,
|
||||
$template_cache_path,
|
||||
string $phpbb_root_path,
|
||||
string $template_cache_path,
|
||||
?manager $ext_manager = null,
|
||||
?log_interface $log = null
|
||||
)
|
||||
@@ -154,6 +154,8 @@ abstract class base implements messenger_interface
|
||||
/**
|
||||
* Sets the use of messenger queue flag
|
||||
*
|
||||
* @param bool $use_queue Flag indicating if cached queue to be used
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_use_queue(bool $use_queue = true): void
|
||||
@@ -426,7 +428,6 @@ abstract class base implements messenger_interface
|
||||
if ($this->use_queue && !empty($this->queue))
|
||||
{
|
||||
$this->queue->save();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -110,9 +110,7 @@ class email extends base
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the use of messenger queue flag
|
||||
*
|
||||
* @return void
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_use_queue(bool $use_queue = true): void
|
||||
{
|
||||
@@ -124,7 +122,7 @@ class email extends base
|
||||
*/
|
||||
public function set_addresses(array $user_row): void
|
||||
{
|
||||
if (isset($user_row['user_email']) && $user_row['user_email'])
|
||||
if (!empty($user_row['user_email']))
|
||||
{
|
||||
$this->to($user_row['user_email'], $user_row['username'] ?: '');
|
||||
}
|
||||
@@ -295,8 +293,8 @@ class email extends base
|
||||
'Return-Path' => new Address($this->config['board_email']),
|
||||
'Sender' => new Address($this->config['board_email']),
|
||||
'X-MSMail-Priority' => self::PRIORITY_MAP[$this->mail_priority],
|
||||
'X-Mailer' => 'phpBB3',
|
||||
'X-MimeOLE' => 'phpBB3',
|
||||
'X-Mailer' => 'phpBB',
|
||||
'X-MimeOLE' => 'phpBB',
|
||||
'X-phpBB-Origin' => 'phpbb://' . str_replace(['http://', 'https://'], ['', ''], generate_board_url()),
|
||||
];
|
||||
|
||||
@@ -472,6 +470,7 @@ class email extends base
|
||||
$this->email->subject($this->subject);
|
||||
$this->email->text($this->msg);
|
||||
|
||||
$break = false;
|
||||
$subject = $this->subject;
|
||||
$msg = $this->msg;
|
||||
$email = $this->email;
|
||||
@@ -479,13 +478,15 @@ class email extends base
|
||||
* Event to send message via external transport
|
||||
*
|
||||
* @event core.notification_message_email
|
||||
* @var bool break Flag indicating if the function return after hook
|
||||
* @var string subject The message subject
|
||||
* @var string msg The message text
|
||||
* @var string email The Symfony Email object
|
||||
* @since 3.2.4-RC1
|
||||
* @changed 4.0.0-a1 Added vars: email. Removed vars: addresses, break
|
||||
* @changed 4.0.0-a1 Added vars: email. Removed vars: addresses
|
||||
*/
|
||||
$vars = [
|
||||
'break',
|
||||
'subject',
|
||||
'msg',
|
||||
'email',
|
||||
@@ -495,6 +496,11 @@ class email extends base
|
||||
|
||||
$this->build_headers();
|
||||
|
||||
if ($break)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Send message ...
|
||||
if (!$this->use_queue)
|
||||
{
|
||||
|
@@ -191,7 +191,7 @@ class jabber extends base
|
||||
*/
|
||||
public function port(int $port = 5222): self
|
||||
{
|
||||
$this->port = ($port) ? $port : 5222;
|
||||
$this->port = ($port > 0) ? $port : 5222;
|
||||
|
||||
// Change port if we use SSL
|
||||
if ($this->port == 5222 && $this->use_ssl)
|
||||
@@ -210,15 +210,15 @@ class jabber extends base
|
||||
*/
|
||||
public function username(string $username = ''): self
|
||||
{
|
||||
if (strpos($username, '@') === false)
|
||||
{
|
||||
$this->username = $username;
|
||||
}
|
||||
else
|
||||
if (str_contains($username, '@'))
|
||||
{
|
||||
$this->jid = explode('@', $username, 2);
|
||||
$this->username = $this->jid[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->username = $username;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -232,7 +232,7 @@ class jabber extends base
|
||||
*/
|
||||
public function server(string $server = ''): self
|
||||
{
|
||||
$this->connect_server = ($server) ? $server : 'localhost';
|
||||
$this->connect_server = $server ?: 'localhost';
|
||||
$this->server = $this->jid[1] ?? $this->connect_server;
|
||||
|
||||
return $this;
|
||||
@@ -407,7 +407,7 @@ class jabber extends base
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Resets all the data (address, template file, etc) to default
|
||||
*/
|
||||
public function reset(): void
|
||||
{
|
||||
@@ -663,7 +663,7 @@ class jabber extends base
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates account registration (based on data used for contructor)
|
||||
* Initiates account registration (based on data used for constructor)
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
@@ -714,7 +714,7 @@ class jabber extends base
|
||||
*/
|
||||
function response(array $xml): bool
|
||||
{
|
||||
if (!is_array($xml) || !count($xml))
|
||||
if (!count($xml))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user