From 48ff2e6b6d5e6f9e4043888164efbee478da37b1 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 21 Dec 2018 20:56:47 +0100 Subject: [PATCH] fix wrong usage of \Froxlor\User::getAll() Signed-off-by: Michael Kaufmann --- lib/Froxlor/Api/Commands/Mysqls.php | 13 ++++++------- lib/Froxlor/Database/IntegrityCheck.php | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Froxlor/Api/Commands/Mysqls.php b/lib/Froxlor/Api/Commands/Mysqls.php index 695ec036..ec478a7f 100644 --- a/lib/Froxlor/Api/Commands/Mysqls.php +++ b/lib/Froxlor/Api/Commands/Mysqls.php @@ -124,11 +124,10 @@ 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(\Froxlor\User::getAll()), - 'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll()), // < keep this for compatibility + 'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($customer), + 'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation($customer), // < keep this for compatibility 'DB_NAME' => $username, 'DB_PASS' => $password, 'DB_DESC' => $databasedescription, @@ -137,9 +136,9 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt ); // get template for mail subject - $mail_subject = $this->getMailTemplate(\Froxlor\User::getAll(), 'mails', 'new_database_by_customer_subject', $replace_arr, $this->lng['mails']['new_database_by_customer']['subject']); + $mail_subject = $this->getMailTemplate($customer, '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(\Froxlor\User::getAll(), 'mails', 'new_database_by_customer_mailbody', $replace_arr, $this->lng['mails']['new_database_by_customer']['mailbody']); + $mail_body = $this->getMailTemplate($customer, 'mails', 'new_database_by_customer_mailbody', $replace_arr, $this->lng['mails']['new_database_by_customer']['mailbody']); $_mailerror = false; $mailerr_msg = ""; @@ -147,7 +146,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(\Froxlor\User::getAll()['email'], \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll())); + $this->mailer()->addAddress($customer['email'], \Froxlor\User::getCorrectUserSalutation($customer)); $this->mailer()->send(); } catch (\PHPMailer\PHPMailer\Exception $e) { $mailerr_msg = $e->errorMessage(); @@ -159,7 +158,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', \Froxlor\User::getAll()['email'], true); + \Froxlor\UI\Response::standard_error('errorsendingmail', $customer['email'], true); } $this->mailer()->clearAddresses(); diff --git a/lib/Froxlor/Database/IntegrityCheck.php b/lib/Froxlor/Database/IntegrityCheck.php index 1937551a..3df0730b 100644 --- a/lib/Froxlor/Database/IntegrityCheck.php +++ b/lib/Froxlor/Database/IntegrityCheck.php @@ -35,7 +35,7 @@ class IntegrityCheck */ public function __construct() { - if (! isset(\Froxlor\User::getAll()) || ! is_array(\Froxlor\User::getAll())) { + if (! empty(\Froxlor\User::getAll())) { \Froxlor\User::getAll() = array( 'loginname' => 'integrity-check' );