Almost all JSON properties to JavaScript camelCase

This commit is contained in:
the-djmaze 2023-01-24 18:58:25 +01:00
parent 7a53cae32f
commit f080a302b1
50 changed files with 501 additions and 562 deletions

View file

@ -10,9 +10,9 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Avatars',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '1.7',
RELEASE = '2023-01-05',
REQUIRED = '2.23.0',
VERSION = '1.8',
RELEASE = '2023-01-23',
REQUIRED = '2.25.0',
CATEGORY = 'Contacts',
LICENSE = 'MIT',
DESCRIPTION = 'Show graphic of sender in message and messages list (supports BIMI, Gravatar and identicon, Contacts is still TODO)';
@ -54,23 +54,23 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
private function JsonAvatar($message) : ?string
{
$mFrom = empty($message['From'][0]) ? null : $message['From'][0];
$mFrom = empty($message['from'][0]) ? null : $message['from'][0];
if ($mFrom instanceof \MailSo\Mime\Email) {
$mFrom = $mFrom->jsonSerialize();
}
if (\is_array($mFrom)) {
if ('pass' == $mFrom['DkimStatus'] && $this->Config()->Get('plugin', 'service', true)) {
if ('pass' == $mFrom['dkimStatus'] && $this->Config()->Get('plugin', 'service', true)) {
// 'data:image/png;base64,[a-zA-Z0-9+/=]'
return static::getServiceIcon($mFrom['Email']);
return static::getServiceIcon($mFrom['email']);
}
if (!$this->Config()->Get('plugin', 'delay', true)
&& ($this->Config()->Get('plugin', 'gravatar', false)
|| ($this->Config()->Get('plugin', 'bimi', false) && 'pass' == $mFrom['DkimStatus'])
|| ($this->Config()->Get('plugin', 'bimi', false) && 'pass' == $mFrom['dkimStatus'])
|| !$this->Config()->Get('plugin', 'service', true)
)
) try {
// Base64Url
return \SnappyMail\Crypt::EncryptUrlSafe($mFrom['Email']);
return \SnappyMail\Crypt::EncryptUrlSafe($mFrom['email']);
} catch (\Throwable $e) {
\SnappyMail\Log::error('Crypt', $e->getMessage());
}

View file

@ -5,7 +5,7 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
const
NAME = 'Demo Account Extension',
CATEGORY = 'Login',
REQUIRED = '2.23',
REQUIRED = '2.25',
DESCRIPTION = 'Extension to enable a demo account';
/**
@ -59,9 +59,9 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
}
else if ('DoFolderCreate' === $sMethodName || 'DoFolderRename' === $sMethodName) {
// Block spam https://github.com/the-djmaze/snappymail/issues/371
$latin = transliterator_transliterate('Any-Latin; Latin-ASCII; Lower()', $aActionParams['Folder']);
$latin = transliterator_transliterate('Any-Latin; Latin-ASCII; Lower()', $aActionParams['folder']);
if (false !== \strpos($latin, 'nigger')) {
\error_log("blocked {$sMethodName} {$aActionParams['Folder']}");
\error_log("blocked {$sMethodName} {$aActionParams['folder']}");
exit;
}
}

View file

@ -9,9 +9,9 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'MailboxDetect',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '2.1',
RELEASE = '2022-12-15',
REQUIRED = '2.23.1',
VERSION = '2.2',
RELEASE = '2023-01-23',
REQUIRED = '2.25.0',
CATEGORY = 'General',
LICENSE = 'MIT',
DESCRIPTION = 'Autodetect system folders and/or create them when needed';
@ -66,21 +66,21 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
$aMap = $this->systemFoldersNames($oAccount);
$sDelimiter = '';
foreach ($aResponse['Result']['@Collection'] as $i => $folder) {
$sDelimiter || ($sDelimiter = $folder['Delimiter']);
$sDelimiter || ($sDelimiter = $folder['delimiter']);
if ($folder['role']) {
$roles[$folder['role']] = true;
} else if (\in_array('\\sentmail', $folder['Flags'])) {
} else if (\in_array('\\sentmail', $folder['flags'])) {
$found['sent'][] = $i;
} else if (\in_array('\\spam', $folder['Flags'])) {
} else if (\in_array('\\spam', $folder['flags'])) {
$found['junk'][] = $i;
} else if (\in_array('\\bin', $folder['Flags'])) {
} else if (\in_array('\\bin', $folder['flags'])) {
$found['trash'][] = $i;
} else if (\in_array('\\starred', $folder['Flags'])) {
} else if (\in_array('\\starred', $folder['flags'])) {
$found['flagged'][] = $i;
} else {
// Kolab
$kolab = $folder['Metadata'][MetadataKeys::KOLAB_CTYPE]
?? $folder['Metadata'][MetadataKeys::KOLAB_CTYPE_SHARED]
$kolab = $folder['metadata'][MetadataKeys::KOLAB_CTYPE]
?? $folder['metadata'][MetadataKeys::KOLAB_CTYPE_SHARED]
?? '';
if ('mail.inbox' === $kolab) {
$found['inbox'][] = $i;
@ -94,9 +94,9 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
$found['trash'][] = $i;
} else {
$iFolderType = 0;
if (isset($aMap[$folder['FullName']])) {
$iFolderType = $aMap[$folder['FullName']];
} else if (isset($aMap[$folder['name']]) || isset($aMap["INBOX{$folder['Delimiter']}{$folder['name']}"])) {
if (isset($aMap[$folder['fullName']])) {
$iFolderType = $aMap[$folder['fullName']];
} else if (isset($aMap[$folder['name']]) || isset($aMap["INBOX{$folder['delimiter']}{$folder['name']}"])) {
$iFolderType = $aMap[$folder['name']];
}
if ($iFolderType && isset($types[$iFolderType])) {

View file

@ -4,11 +4,11 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Nextcloud',
VERSION = '2.15',
RELEASE = '2023-01-17',
VERSION = '2.16',
RELEASE = '2023-01-23',
CATEGORY = 'Integrations',
DESCRIPTION = 'Integrate with Nextcloud v20+',
REQUIRED = '2.24.6';
REQUIRED = '2.25.0';
public function Init() : void
{
@ -89,7 +89,7 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
'filename' => '',
'success' => false
];
if ($sSaveFolder && !empty($aValues['Folder']) && !empty($aValues['Uid'])) {
if ($sSaveFolder && !empty($aValues['folder']) && !empty($aValues['uid'])) {
$oActions = \RainLoop\Api::Actions();
$oMailClient = $oActions->MailClient();
if (!$oMailClient->IsLoggined()) {
@ -113,9 +113,9 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
$aResult['success'] = $oFiles->file_put_contents($sFilename, $rResource);
}
},
(string) $aValues['Folder'],
(int) $aValues['Uid'],
isset($aValues['MimeIndex']) ? (string) $aValues['MimeIndex'] : ''
(string) $aValues['folder'],
(int) $aValues['uid'],
isset($aValues['mimeIndex']) ? (string) $aValues['mimeIndex'] : ''
);
}
@ -132,8 +132,8 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
$oFiles->is_dir($sSaveFolder) || $oFiles->mkdir($sSaveFolder);
$data->result = true;
foreach ($data->items as $aItem) {
$sSavedFileName = isset($aItem['FileName']) ? $aItem['FileName'] : 'file.dat';
$sSavedFileHash = !empty($aItem['FileHash']) ? $aItem['FileHash'] : '';
$sSavedFileName = isset($aItem['fileName']) ? $aItem['fileName'] : 'file.dat';
$sSavedFileHash = !empty($aItem['fileHash']) ? $aItem['fileHash'] : '';
if (!empty($sSavedFileHash)) {
$fFile = $data->filesProvider->GetFile($data->account, $sSavedFileHash, 'rb');
if (\is_resource($fFile)) {
@ -150,7 +150,7 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
}
foreach ($data->items as $aItem) {
$sFileHash = (string) (isset($aItem['FileHash']) ? $aItem['FileHash'] : '');
$sFileHash = (string) (isset($aItem['fileHash']) ? $aItem['fileHash'] : '');
if (!empty($sFileHash)) {
$data->filesProvider->Clear($data->account, $sFileHash);
}