fix wrong usage of \Froxlor\User::getAll()

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-21 20:56:47 +01:00
parent 370ccbdb74
commit 48ff2e6b6d
2 changed files with 7 additions and 8 deletions

View File

@@ -124,11 +124,10 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
Database::needSqlData(); Database::needSqlData();
$sql_root = Database::getSqlData(); $sql_root = Database::getSqlData();
Database::needRoot(false); Database::needRoot(false);
\Froxlor\User::getAll() = $customer;
$replace_arr = array( $replace_arr = array(
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll()), 'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($customer),
'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll()), // < keep this for compatibility 'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation($customer), // < keep this for compatibility
'DB_NAME' => $username, 'DB_NAME' => $username,
'DB_PASS' => $password, 'DB_PASS' => $password,
'DB_DESC' => $databasedescription, 'DB_DESC' => $databasedescription,
@@ -137,9 +136,9 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
); );
// get template for mail subject // 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 // 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; $_mailerror = false;
$mailerr_msg = ""; $mailerr_msg = "";
@@ -147,7 +146,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
$this->mailer()->Subject = $mail_subject; $this->mailer()->Subject = $mail_subject;
$this->mailer()->AltBody = $mail_body; $this->mailer()->AltBody = $mail_body;
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body)); $this->mailer()->msgHTML(str_replace("\n", "<br />", $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(); $this->mailer()->send();
} catch (\PHPMailer\PHPMailer\Exception $e) { } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage(); $mailerr_msg = $e->errorMessage();
@@ -159,7 +158,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
if ($_mailerror) { if ($_mailerror) {
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg); $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(); $this->mailer()->clearAddresses();

View File

@@ -35,7 +35,7 @@ class IntegrityCheck
*/ */
public function __construct() public function __construct()
{ {
if (! isset(\Froxlor\User::getAll()) || ! is_array(\Froxlor\User::getAll())) { if (! empty(\Froxlor\User::getAll())) {
\Froxlor\User::getAll() = array( \Froxlor\User::getAll() = array(
'loginname' => 'integrity-check' 'loginname' => 'integrity-check'
); );