From b77854e421f43c434e8dc17fa2845e0633be3bfd Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 18 Oct 2022 19:22:36 +0200 Subject: [PATCH] Some small code improvements --- .../app/libraries/RainLoop/Actions/UserAuth.php | 14 +++++++++----- .../app/libraries/RainLoop/ServiceActions.php | 15 +++++++++------ .../app/templates/Views/User/MailMessageView.html | 2 +- snappymail/v/0.0.0/setup.php | 2 ++ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php index 0b2c3cc3a..7030da219 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php @@ -83,12 +83,16 @@ trait UserAuth } } - $sDefDomain = \trim($this->Config()->Get('login', 'default_domain', '')); - if (!\str_contains($sEmail, '@') && \strlen($sDefDomain)) { - $this->Logger()->Write('Default domain "' . $sDefDomain . '" was used. (' . $sEmail . ' > ' . $sEmail . '@' . $sDefDomain . ')', - \LOG_INFO, 'LOGIN'); + if (!\str_contains($sEmail, '@')) { + $sDefDomain = \trim($this->Config()->Get('login', 'default_domain', '')); + if (\strlen($sDefDomain)) { + $this->Logger()->Write('Default domain "' . $sDefDomain . '" was used. (' . $sEmail . ' > ' . $sEmail . '@' . $sDefDomain . ')', + \LOG_INFO, 'LOGIN'); - $sEmail .= '@' . $sDefDomain; + $sEmail .= '@' . $sDefDomain; + } else { + $this->Logger()->Write('Default domain not configured.', \LOG_INFO, 'LOGIN'); + } } } diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index 94911fa17..a8965939e 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -836,14 +836,17 @@ class ServiceActions { \header('Content-Type: application/javascript; charset=utf-8'); $this->oHttp->ServerNoCache(); + try { + $sResult = 'rl.initData(' + . Utils::jsonEncode($this->oActions->AppData($bAdmin)) + . ');'; - $sResult = 'rl.initData(' - .Utils::jsonEncode($this->oActions->AppData($bAdmin)) - .');'; + $this->Logger()->Write($sResult, \LOG_INFO, 'APPDATA'); - $this->Logger()->Write($sResult, \LOG_INFO, 'APPDATA'); - - return $sResult; + return $sResult; + } catch (\Throwable $e) { + return 'alert(' . \json_encode('ERROR: ' . $e->getMessage()) . ');'; + } } public function compileTemplates(bool $bAdmin = false) : string diff --git a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html index 022f7d160..3d446091f 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html @@ -196,7 +196,7 @@ :
- + 🏷
  • diff --git a/snappymail/v/0.0.0/setup.php b/snappymail/v/0.0.0/setup.php index b80ca7d18..725da827f 100644 --- a/snappymail/v/0.0.0/setup.php +++ b/snappymail/v/0.0.0/setup.php @@ -39,6 +39,8 @@ if (defined('APP_VERSION')) 'json' => function_exists('json_decode'), 'libxml' => function_exists('libxml_use_internal_errors'), 'dom' => class_exists('DOMDocument') + // https://github.com/the-djmaze/snappymail/issues/392 +// 'phar' => class_exists('PharData') ); if (in_array(false, $aRequirements))