From c800e89414c297e8e68c06719906fd55d7d6979f Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sat, 22 Dec 2018 08:15:31 +0100 Subject: [PATCH] Revert "fix wrong usage of \Froxlor\User::getAll()" This reverts commit 48ff2e6b6d5e6f9e4043888164efbee478da37b1. --- lib/Froxlor/Api/Commands/Mysqls.php | 13 +++++++------ lib/Froxlor/Database/IntegrityCheck.php | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Froxlor/Api/Commands/Mysqls.php b/lib/Froxlor/Api/Commands/Mysqls.php index ec478a7f..695ec036 100644 --- a/lib/Froxlor/Api/Commands/Mysqls.php +++ b/lib/Froxlor/Api/Commands/Mysqls.php @@ -124,10 +124,11 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt Database::needSqlData(); $sql_root = Database::getSqlData(); Database::needRoot(false); + \Froxlor\User::getAll() = $customer; $replace_arr = array( - 'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($customer), - 'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation($customer), // < keep this for compatibility + 'SALUTATION' => \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll()), + 'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll()), // < keep this for compatibility 'DB_NAME' => $username, 'DB_PASS' => $password, 'DB_DESC' => $databasedescription, @@ -136,9 +137,9 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt ); // get template for mail subject - $mail_subject = $this->getMailTemplate($customer, 'mails', 'new_database_by_customer_subject', $replace_arr, $this->lng['mails']['new_database_by_customer']['subject']); + $mail_subject = $this->getMailTemplate(\Froxlor\User::getAll(), 'mails', 'new_database_by_customer_subject', $replace_arr, $this->lng['mails']['new_database_by_customer']['subject']); // get template for mail body - $mail_body = $this->getMailTemplate($customer, 'mails', 'new_database_by_customer_mailbody', $replace_arr, $this->lng['mails']['new_database_by_customer']['mailbody']); + $mail_body = $this->getMailTemplate(\Froxlor\User::getAll(), 'mails', 'new_database_by_customer_mailbody', $replace_arr, $this->lng['mails']['new_database_by_customer']['mailbody']); $_mailerror = false; $mailerr_msg = ""; @@ -146,7 +147,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt $this->mailer()->Subject = $mail_subject; $this->mailer()->AltBody = $mail_body; $this->mailer()->msgHTML(str_replace("\n", "
", $mail_body)); - $this->mailer()->addAddress($customer['email'], \Froxlor\User::getCorrectUserSalutation($customer)); + $this->mailer()->addAddress(\Froxlor\User::getAll()['email'], \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll())); $this->mailer()->send(); } catch (\PHPMailer\PHPMailer\Exception $e) { $mailerr_msg = $e->errorMessage(); @@ -158,7 +159,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt if ($_mailerror) { $this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg); - \Froxlor\UI\Response::standard_error('errorsendingmail', $customer['email'], true); + \Froxlor\UI\Response::standard_error('errorsendingmail', \Froxlor\User::getAll()['email'], true); } $this->mailer()->clearAddresses(); diff --git a/lib/Froxlor/Database/IntegrityCheck.php b/lib/Froxlor/Database/IntegrityCheck.php index 3df0730b..1937551a 100644 --- a/lib/Froxlor/Database/IntegrityCheck.php +++ b/lib/Froxlor/Database/IntegrityCheck.php @@ -35,7 +35,7 @@ class IntegrityCheck */ public function __construct() { - if (! empty(\Froxlor\User::getAll())) { + if (! isset(\Froxlor\User::getAll()) || ! is_array(\Froxlor\User::getAll())) { \Froxlor\User::getAll() = array( 'loginname' => 'integrity-check' );