From 7e26f64e4936689f3b47f6d0924ee24fd49cbe9f Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 29 Sep 2021 10:10:48 +0200 Subject: [PATCH] add an additional static method Api\Mail\Smtp::mailbox_address() as PHP 8.0 does not allow to call a non-static method static, even if $this is (conditionally) not used --- api/src/Mail/Smtp.php | 19 ++++++++++++++++--- api/src/Mail/Smtp/Sql.php | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/api/src/Mail/Smtp.php b/api/src/Mail/Smtp.php index 9748bfa154..0a207c6041 100644 --- a/api/src/Mail/Smtp.php +++ b/api/src/Mail/Smtp.php @@ -233,10 +233,23 @@ class Smtp * default use $this->loginType * @return string */ - /*static*/ public function mailbox_addr($account,$domain=null,$mail_login_type=null) + public function mailbox_addr($account, $domain=null, $mail_login_type=null) + { + return self::mailbox_address($account, $domain ?? $this->defaultDomain, $mail_login_type ?? $this->loginType); + } + + /** + * Build mailbox address for given account and mail_addr_type + * + * If $account is an array (with values for keys account_(id|lid|email), it does NOT call accounts class + * + * @param int|array $account account_id or whole account array with values for keys + * @param string $domain domain + * @param string $mail_login_type=null standard(uid), vmailmgr(uid@domain), email or uidNumber + * @return string + */ + static public function mailbox_address($account, string $domain, string $mail_login_type=null) { - if (is_null($domain)) $domain = $this->defaultDomain; - if (is_null($mail_login_type)) $mail_login_type = $this->loginType; switch($mail_login_type) { diff --git a/api/src/Mail/Smtp/Sql.php b/api/src/Mail/Smtp/Sql.php index a750244350..83a443cf83 100644 --- a/api/src/Mail/Smtp/Sql.php +++ b/api/src/Mail/Smtp/Sql.php @@ -340,7 +340,7 @@ class Sql extends Mail\Smtp } } - // let interesed parties know account was update + // let interested parties know account was update Api\Hooks::process(array( 'location' => 'mailaccount_userdata_updated', 'account_id' => $_uidnumber,