mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
1.10 beta
This commit is contained in:
parent
116de6fd45
commit
ecf23a4f6d
27 changed files with 259 additions and 158 deletions
|
|
@ -2357,30 +2357,30 @@ END;
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $sData
|
||||
* @param string $sKey
|
||||
* @param string $sData
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function Hmac($sData, $sKey)
|
||||
{
|
||||
if (\function_exists('hash_hmac'))
|
||||
* @return string
|
||||
*/
|
||||
public static function Hmac($sData, $sKey)
|
||||
{
|
||||
if (\function_exists('hash_hmac'))
|
||||
{
|
||||
return \hash_hmac('md5', $sData, $sKey);
|
||||
}
|
||||
return \hash_hmac('md5', $sData, $sKey);
|
||||
}
|
||||
|
||||
$iLen = 64;
|
||||
if ($iLen < \strlen($sKey))
|
||||
$iLen = 64;
|
||||
if ($iLen < \strlen($sKey))
|
||||
{
|
||||
$sKey = \pack('H*', \md5($sKey));
|
||||
}
|
||||
$sKey = \pack('H*', \md5($sKey));
|
||||
}
|
||||
|
||||
$sKey = \str_pad($sKey, $iLen, \chr(0x00));
|
||||
$sIpad = \str_pad('', $iLen, \chr(0x36));
|
||||
$sOpad = \str_pad('', $iLen, \chr(0x5c));
|
||||
$sKey = \str_pad($sKey, $iLen, \chr(0x00));
|
||||
$sIpad = \str_pad('', $iLen, \chr(0x36));
|
||||
$sOpad = \str_pad('', $iLen, \chr(0x5c));
|
||||
|
||||
return \md5(($sKey ^ $sOpad).\pack('H*', \md5(($sKey ^ $sIpad).$sData)));
|
||||
}
|
||||
return \md5(($sKey ^ $sOpad).\pack('H*', \md5(($sKey ^ $sIpad).$sData)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDomain
|
||||
|
|
|
|||
|
|
@ -172,6 +172,16 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function _xor($string, $string2)
|
||||
{
|
||||
$result = '';
|
||||
$size = strlen($string);
|
||||
for ($i=0; $i<$size; $i++) {
|
||||
$result .= chr(ord($string[$i]) ^ ord($string2[$i]));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sLogin
|
||||
* @param string $sPassword
|
||||
|
|
@ -204,7 +214,6 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
|
||||
try
|
||||
{
|
||||
$bUseAuthCramMd5IfSupported = false; // TODO
|
||||
if ($bUseAuthCramMd5IfSupported && $this->IsSupported('AUTH=CRAM-MD5'))
|
||||
{
|
||||
$this->SendRequest('AUTHENTICATE', array('CRAM-MD5'));
|
||||
|
|
@ -222,10 +231,20 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
}
|
||||
}
|
||||
|
||||
if ($oContinuationResponse && false)
|
||||
if ($oContinuationResponse && !empty($oContinuationResponse->ResponseList[1]))
|
||||
{
|
||||
// TODO
|
||||
$this->Logger()->WriteDump($aResponse);
|
||||
$sTiken = @\base64_decode($oContinuationResponse->ResponseList[1]);
|
||||
$this->oLogger->Write('tiket: '.$sTiken);
|
||||
|
||||
$sToken = \base64_encode($sLogin.' '.\MailSo\Base\Utils::Hmac($sPassword, $sTiken));
|
||||
|
||||
if ($this->oLogger)
|
||||
{
|
||||
$this->oLogger->AddSecret($sToken);
|
||||
}
|
||||
|
||||
$this->sendRaw($sToken, true, '*******');
|
||||
$this->parseResponseWithValidation();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -234,6 +253,12 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->writeLogException(
|
||||
new \MailSo\Imap\Exceptions\LoginException(),
|
||||
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||
}
|
||||
}
|
||||
else if ($bUseAuthPlainIfSupported && $this->IsSupported('AUTH=PLAIN'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1716,10 +1716,6 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
|||
$sLanguageAdmin = $oConfig->Get('webmail', 'language_admin', 'en');
|
||||
$sTheme = $oConfig->Get('webmail', 'theme', 'Default');
|
||||
|
||||
$aResult['Themes'] = $this->GetThemes($bMobile);
|
||||
$aResult['Languages'] = $this->GetLanguages(false);
|
||||
$aResult['LanguagesAdmin'] = $this->GetLanguages(true);
|
||||
|
||||
$aResult['AllowLanguagesOnSettings'] = (bool) $oConfig->Get('webmail', 'allow_languages_on_settings', true);
|
||||
$aResult['AllowLanguagesOnLogin'] = (bool) $oConfig->Get('login', 'allow_languages_on_login', true);
|
||||
$aResult['AttachmentLimit'] = ((int) $oConfig->Get('webmail', 'attachment_size_limit', 10)) * 1024 * 1024;
|
||||
|
|
@ -8960,7 +8956,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
|||
}
|
||||
|
||||
return \in_array($sTheme, $this->GetThemes($bMobile)) ?
|
||||
$sTheme : $this->Config()->Get('themes', 'default', 'Default');
|
||||
$sTheme : $this->Config()->Get('themes', 'default', $bMobile ? 'Mobile' : 'Default');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -9039,17 +9035,21 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetThemes($bMobile = false)
|
||||
public function GetThemes($bMobile = false, $bIncludeMobile = true)
|
||||
{
|
||||
if ($bMobile)
|
||||
{
|
||||
return array('Mobile');
|
||||
}
|
||||
|
||||
static $aCache = null;
|
||||
if (\is_array($aCache))
|
||||
static $aCache = array('full' => null, 'mobile' => null);
|
||||
if ($bIncludeMobile && \is_array($aCache['full']))
|
||||
{
|
||||
return $aCache;
|
||||
return $aCache['full'];
|
||||
}
|
||||
else if ($bIncludeMobile && \is_array($aCache['mobile']))
|
||||
{
|
||||
return $aCache['mobile'];
|
||||
}
|
||||
|
||||
$bClear = false;
|
||||
|
|
@ -9065,21 +9065,18 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
|||
{
|
||||
if ('.' !== $sFile{0} && \is_dir($sDir.'/'.$sFile) && \file_exists($sDir.'/'.$sFile.'/styles.less'))
|
||||
{
|
||||
if ('Default' !== $sFile && 'Clear' !== $sFile)
|
||||
if ('Default' === $sFile)
|
||||
{
|
||||
$bDefault = true;
|
||||
}
|
||||
else if ('Clear' === $sFile)
|
||||
{
|
||||
$bClear = true;
|
||||
}
|
||||
else if ($bIncludeMobile || 'Mobile' !== $sFile)
|
||||
{
|
||||
$sList[] = $sFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ('Default' === $sFile)
|
||||
{
|
||||
$bDefault = true;
|
||||
}
|
||||
else if ('Clear' === $sFile)
|
||||
{
|
||||
$bClear = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@closedir($rDirH);
|
||||
|
|
@ -9117,7 +9114,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
|||
\array_push($sList, 'Clear');
|
||||
}
|
||||
|
||||
$aCache = $sList;
|
||||
$aCache[$bIncludeMobile ? 'full' : 'mobile'] = $sList;
|
||||
return $sList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -288,9 +288,10 @@ Enables caching in the system'),
|
|||
),
|
||||
|
||||
'labs' => array(
|
||||
'ignore_folders_subscription' => array(false,
|
||||
'allow_mobile_version' => array(true,
|
||||
'Experimental settings. Handle with care.
|
||||
'),
|
||||
'ignore_folders_subscription' => array(false),
|
||||
'check_new_password_strength' => array(true),
|
||||
'update_channel' => array('stable'),
|
||||
'allow_gravatar' => array(true),
|
||||
|
|
|
|||
|
|
@ -151,10 +151,16 @@ class Service
|
|||
}
|
||||
}
|
||||
|
||||
$oMobileDetect = new \Detection\MobileDetect();
|
||||
$bMobileDevice = $oMobileDetect->isMobile() && !$oMobileDetect->isTablet();
|
||||
$bMobile = false;
|
||||
$bMobileDevice = false;
|
||||
|
||||
$bMobile = (0 < \count($aPaths) && !empty($aPaths[0]) && 'mobile' === \strtolower($aPaths[0]));
|
||||
if ($this->oActions->Config()->Get('labs', 'allow_mobile_version', false))
|
||||
{
|
||||
$oMobileDetect = new \Detection\MobileDetect();
|
||||
$bMobileDevice = $oMobileDetect->isMobile() && !$oMobileDetect->isTablet();
|
||||
|
||||
$bMobile = (0 < \count($aPaths) && !empty($aPaths[0]) && 'mobile' === \strtolower($aPaths[0]));
|
||||
}
|
||||
|
||||
if ($bIndex && !$bMobile)
|
||||
{
|
||||
|
|
@ -310,6 +316,9 @@ class Service
|
|||
'folderSpecLimit' => (int) $oConfig->Get('labs', 'folders_spec_limit', 50),
|
||||
'faviconStatus' => (bool) $oConfig->Get('labs', 'favicon_status', true),
|
||||
'listPermanentFiltered' => '' !== \trim(\RainLoop\Api::Config()->Get('labs', 'imap_message_list_permanent_filter', '')),
|
||||
'themes' => $this->oActions->GetThemes($bMobile, false),
|
||||
'languages' => $this->oActions->GetLanguages(false),
|
||||
'languagesAdmin' => $this->oActions->GetLanguages(true),
|
||||
'attachmentsActions' => $aAttachmentsActions,
|
||||
'rsaPublicKey' => $sRsaPublicKey
|
||||
), $bAdmin ? array(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue