Merge branch 'master' of github.com:the-djmaze/snappymail

This commit is contained in:
the-djmaze 2022-10-29 01:28:21 +02:00
commit 3c57f39ae0
5 changed files with 24 additions and 18 deletions

View file

@ -1,5 +1,5 @@
{ {
"KOLAB": { "KOLAB": {
"CONTACTS_FOLDER": "Contacts Folder" "CONTACTS_FOLDER": "联系人文件夹"
} }
} }

View file

@ -73,8 +73,8 @@ const
const const
e = responseList.item(i), e = responseList.item(i),
elem = { elem = {
name: getDavElementByTagName(e, 'href').textContent name: decodeURIComponent(getDavElementByTagName(e, 'href').textContent
.replace(pathRegex, '').replace(/\/$/, ''), .replace(pathRegex, '').replace(/\/$/, '')),
isFile: false isFile: false
}; };
if (getDavElementsByTagName(getDavElementByTagName(e, 'resourcetype'), 'collection').length) { if (getDavElementsByTagName(getDavElementByTagName(e, 'resourcetype'), 'collection').length) {

View file

@ -0,0 +1,8 @@
[NEXTCLOUD]
SAVE_ATTACHMENTS = "保存到 Nextcloud"
SAVE_EML = "以 .eml 文件保存到 Nextcloud"
SAVE_ICS = "添加到日历"
SELECT_FOLDER = "选择文件夹"
SELECT_FILES = "选择文件"
ATTACH_FILES = "添加 Nextcloud 文件"
SELECT_CALENDAR = "选择日历"

View file

@ -129,7 +129,7 @@ class Http
public function GetHost(bool $bWithRemoteUserData = false, bool $bWithoutWWW = true, bool $bWithoutPort = false) : string public function GetHost(bool $bWithRemoteUserData = false, bool $bWithoutWWW = true, bool $bWithoutPort = false) : string
{ {
$sHost = $this->GetServer('HTTP_HOST', ''); $sHost = $this->GetServer('HTTP_HOST', '');
if (0 === \strlen($sHost)) if (!\strlen($sHost))
{ {
$sName = $this->GetServer('SERVER_NAME'); $sName = $this->GetServer('SERVER_NAME');
$iPort = (int) $this->GetServer('SERVER_PORT', 80); $iPort = (int) $this->GetServer('SERVER_PORT', 80);
@ -150,7 +150,7 @@ class Http
if ($bWithoutPort) if ($bWithoutPort)
{ {
$sHost = \preg_replace('/:[\d]+$/', '', $sHost); $sHost = \preg_replace('/:\d+$/', '', $sHost);
} }
return $sHost; return $sHost;

View file

@ -35,18 +35,18 @@ trait UserAuth
if (!\str_contains($sEmail, '@')) { if (!\str_contains($sEmail, '@')) {
$this->Logger()->Write('The email address "' . $sEmail . '" is not complete', \LOG_INFO, 'LOGIN'); $this->Logger()->Write('The email address "' . $sEmail . '" is not complete', \LOG_INFO, 'LOGIN');
$bAdded = false;
if ($this->Config()->Get('login', 'determine_user_domain', false)) { if ($this->Config()->Get('login', 'determine_user_domain', false)) {
$sUserHost = \trim($this->Http()->GetHost(false, true, true)); $sUserHost = \trim($this->Http()->GetHost(false, true, true));
$this->Logger()->Write('Determined user domain: ' . $sUserHost, \LOG_INFO, 'LOGIN'); $this->Logger()->Write('Determined user domain: ' . $sUserHost, \LOG_INFO, 'LOGIN');
$bAdded = false;
$iLimit = 14;
$aDomainParts = \explode('.', $sUserHost); $aDomainParts = \explode('.', $sUserHost);
$iLimit = \min(\count($aDomainParts), 14);
$oDomainProvider = $this->DomainProvider(); $oDomainProvider = $this->DomainProvider();
while (\count($aDomainParts) && 0 < $iLimit) { while (0 < $iLimit--) {
$sLine = \trim(\implode('.', $aDomainParts), '. '); $sLine = \implode('.', $aDomainParts);
$oDomain = $oDomainProvider->Load($sLine, false); $oDomain = $oDomainProvider->Load($sLine, false);
if ($oDomain) { if ($oDomain) {
@ -61,20 +61,18 @@ trait UserAuth
} }
\array_shift($aDomainParts); \array_shift($aDomainParts);
$iLimit--;
} }
if (!$bAdded) { if (!$bAdded) {
$sLine = $sUserHost; $oDomain = $oDomainProvider->Load($sUserHost, true);
$oDomain = $oDomainProvider->Load($sLine, true); if ($oDomain) {
if ($oDomain && $oDomain) {
$bAdded = true; $bAdded = true;
$this->Logger()->Write('Check "' . $sLine . '" with wildcard: OK (' . $sEmail . ' > ' . $sEmail . '@' . $sLine . ')', $this->Logger()->Write('Check "' . $sUserHost . '" with wildcard: OK (' . $sEmail . ' > ' . $sEmail . '@' . $sUserHost . ')',
\LOG_INFO, 'LOGIN'); \LOG_INFO, 'LOGIN');
$sEmail .= '@' . $sLine; $sEmail .= '@' . $sUserHost;
} else { } else {
$this->Logger()->Write('Check "' . $sLine . '" with wildcard: NO', \LOG_INFO, 'LOGIN'); $this->Logger()->Write('Check "' . $sUserHost . '" with wildcard: NO', \LOG_INFO, 'LOGIN');
} }
} }
@ -83,7 +81,7 @@ trait UserAuth
} }
} }
if (!\str_contains($sEmail, '@')) { if (!$bAdded) {
$sDefDomain = \trim($this->Config()->Get('login', 'default_domain', '')); $sDefDomain = \trim($this->Config()->Get('login', 'default_domain', ''));
if (\strlen($sDefDomain)) { if (\strlen($sDefDomain)) {
if ('HTTP_HOST' === $sDefDomain || 'SERVER_NAME' === $sDefDomain) { if ('HTTP_HOST' === $sDefDomain || 'SERVER_NAME' === $sDefDomain) {