mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-01 20:42:19 +08:00
Small fixes
This commit is contained in:
parent
60b449b9f8
commit
195d13dc0d
6 changed files with 64 additions and 32 deletions
|
@ -466,7 +466,7 @@ class Http
|
|||
{
|
||||
$aAddOptions[CURLOPT_HTTPHEADER] = $aOptions[CURLOPT_HTTPHEADER];
|
||||
}
|
||||
|
||||
|
||||
\curl_setopt_array($oCurl, $aAddOptions);
|
||||
|
||||
do
|
||||
|
@ -510,7 +510,7 @@ class Http
|
|||
|
||||
return null === $sNewUrl ? $sUrl : $sNewUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sUrl
|
||||
* @param resource $rFile
|
||||
|
@ -540,7 +540,7 @@ class Http
|
|||
{
|
||||
$oLogger->Write('cURL: input resource invalid.', \MailSo\Log\Enumerations\Type::WARNING);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -590,10 +590,10 @@ class Http
|
|||
\curl_setopt_array($oCurl, $aOptions);
|
||||
|
||||
$bResult = \curl_exec($oCurl);
|
||||
|
||||
|
||||
$iCode = (int) \curl_getinfo($oCurl, CURLINFO_HTTP_CODE);
|
||||
$sContentType = (string) \curl_getinfo($oCurl, CURLINFO_CONTENT_TYPE);
|
||||
|
||||
|
||||
if ($oLogger)
|
||||
{
|
||||
$oLogger->Write('cUrl: Request result: '.($bResult ? 'true' : 'false').' (Status: '.$iCode.', ContentType: '.$sContentType.')');
|
||||
|
@ -607,7 +607,7 @@ class Http
|
|||
{
|
||||
\curl_close($oCurl);
|
||||
}
|
||||
|
||||
|
||||
return $bResult;
|
||||
}
|
||||
|
||||
|
@ -634,7 +634,7 @@ class Http
|
|||
\rewind($rMemFile);
|
||||
return \stream_get_contents($rMemFile);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -677,13 +677,43 @@ class Http
|
|||
return $bResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @staticvar bool $bCache
|
||||
*/
|
||||
public function ServerNoCache()
|
||||
{
|
||||
@\header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
@\header('Last-Modified: '.\gmdate('D, d M Y H:i:s').' GMT');
|
||||
@\header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||
@\header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
@\header('Pragma: no-cache');
|
||||
static $bCache = false;
|
||||
if (false === $bCache)
|
||||
{
|
||||
$bCache = true;
|
||||
@\header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
@\header('Last-Modified: '.\gmdate('D, d M Y H:i:s').' GMT');
|
||||
@\header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||
@\header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
@\header('Pragma: no-cache');
|
||||
@\header('X-RainLoop-Cache: no');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @staticvar bool $bCache
|
||||
* @param string $sEtag
|
||||
* @param int $iLastModified
|
||||
* @param int $iExpires
|
||||
*/
|
||||
public function ServerUseCache($sEtag, $iLastModified, $iExpires)
|
||||
{
|
||||
static $bCache = false;
|
||||
if (false === $bCache)
|
||||
{
|
||||
$bCache = true;
|
||||
@\header('Cache-Control: private', true);
|
||||
@\header('ETag: '.$sEtag, true);
|
||||
@\header('Last-Modified: '.\gmdate('D, d M Y H:i:s', $iLastModified).' UTC', true);
|
||||
@\header('Expires: '.\gmdate('D, j M Y H:i:s', $iExpires).' UTC', true);
|
||||
@\header('Connection: close');
|
||||
@\header('X-RainLoop-Cache: yes');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6414,14 +6414,9 @@ class Actions
|
|||
$bResult = false;
|
||||
if (!empty($sKey) && ($bForce || $this->Config()->Get('cache', 'enable', true) && $this->Config()->Get('cache', 'http', true)))
|
||||
{
|
||||
$iLast = 1382478804;
|
||||
$iExpires = 2002478804;
|
||||
|
||||
header('Cache-Control: private', true);
|
||||
header('ETag: '.\md5('Etag:'.\md5($sKey.\md5($this->Config()->Get('cache', 'index', '')))), true);
|
||||
header('Last-Modified: '.\gmdate('D, d M Y H:i:s', $iLast).' UTC', true);
|
||||
header('Expires: '.\gmdate('D, j M Y H:i:s', $iExpires).' UTC', true);
|
||||
header('Connection: close');
|
||||
$this->oHttp->ServerUseCache(
|
||||
\md5('Etag:'.\md5($sKey.\md5($this->Config()->Get('cache', 'index', '')))),
|
||||
1382478804, 2002478804);
|
||||
|
||||
$bResult = true;
|
||||
}
|
||||
|
|
|
@ -98,6 +98,11 @@ class Service
|
|||
$bAdmin = true;
|
||||
}
|
||||
|
||||
if ($this->oHttp->IsPost())
|
||||
{
|
||||
$this->oHttp->ServerNoCache();
|
||||
}
|
||||
|
||||
if ($bAdmin && !$this->oActions->Config()->Get('security', 'allow_admin_panel', true))
|
||||
{
|
||||
echo $this->oActions->ErrorTemplates('Access Denied.',
|
||||
|
@ -127,7 +132,7 @@ class Service
|
|||
{
|
||||
@header('Content-Type: text/html; charset=utf-8');
|
||||
$this->oHttp->ServerNoCache();
|
||||
|
||||
|
||||
$aTemplateParameters = $this->indexTemplateParameters($bAdmin);
|
||||
|
||||
$sCacheFileName = '';
|
||||
|
|
|
@ -196,6 +196,7 @@ class ServiceActions
|
|||
$this->Plugins()->RunHook('filter.ajax-response', array($sAction, &$aResponseItem));
|
||||
|
||||
@\header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
$sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger());
|
||||
|
||||
$sObResult = @\ob_get_clean();
|
||||
|
@ -1115,7 +1116,7 @@ class ServiceActions
|
|||
$sResult = empty($sLangJs) ? 'null' : '{'.\substr($sLangJs, 0, -1).'}';
|
||||
|
||||
return
|
||||
($bWrapByScriptTag ? '<script type="text/javascript" data-cfasync="false">' : '').
|
||||
($bWrapByScriptTag ? '<script data-cfasync="false">' : '').
|
||||
'window.rainloopI18N='.$sResult.';'.$sMoment.
|
||||
($bWrapByScriptTag ? '</script>' : '')
|
||||
;
|
||||
|
@ -1130,7 +1131,7 @@ class ServiceActions
|
|||
private function compileAppData($aAppData, $bWrapByScriptTag = true)
|
||||
{
|
||||
return
|
||||
($bWrapByScriptTag ? '<script type="text/javascript" data-cfasync="false">' : '').
|
||||
($bWrapByScriptTag ? '<script data-cfasync="false">' : '').
|
||||
'window.rainloopAppData='.\json_encode($aAppData).';'.
|
||||
'if(window.__rlah_set){__rlah_set()};'.
|
||||
($bWrapByScriptTag ? '</script>' : '')
|
||||
|
|
|
@ -400,7 +400,7 @@ class Social
|
|||
@\header('Content-Type: text/html; charset=utf-8');
|
||||
$sCallBackType = $bLogin ? '_login' : '';
|
||||
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_google'.$sCallBackType.'_service';
|
||||
$sResult = '<script type="text/javascript" data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
|
||||
}
|
||||
|
||||
|
@ -520,11 +520,12 @@ class Social
|
|||
else
|
||||
{
|
||||
$this->oHttp->ServerNoCache();
|
||||
|
||||
@\header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
$sCallBackType = $bLogin ? '_login' : '';
|
||||
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_facebook'.$sCallBackType.'_service';
|
||||
$sResult = '<script type="text/javascript" data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
|
||||
}
|
||||
|
||||
|
@ -720,7 +721,7 @@ class Social
|
|||
@\header('Content-Type: text/html; charset=utf-8');
|
||||
$sCallBackType = $bLogin ? '_login' : '';
|
||||
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_twitter'.$sCallBackType.'_service';
|
||||
$sResult = '<script type="text/javascript" data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
|
||||
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<!--[if lte IE 8]>
|
||||
<meta http-equiv="refresh" content="0; URL=./?/BadBrowser" />
|
||||
<![endif]-->
|
||||
<script type="text/javascript" data-cfasync="false">
|
||||
<script data-cfasync="false">
|
||||
if (!window.navigator || !window.navigator.cookieEnabled) {
|
||||
window.document.location.replace('./?/NoCookie');
|
||||
}
|
||||
|
@ -24,11 +24,11 @@
|
|||
<link rel="apple-touch-icon" href="{{BaseAppAppleTouchFile}}" type="image/png" />
|
||||
<link type="text/css" rel="stylesheet" href="{{BaseAppMainCssLink}}" />
|
||||
<link type="text/css" rel="stylesheet" id="rlThemeLink" />
|
||||
<script type="text/javascript" data-cfasync="false" src="{{BaseAppBootScriptLink}}"></script>
|
||||
<script type="text/javascript" data-cfasync="false">
|
||||
<script data-cfasync="false" src="{{BaseAppBootScriptLink}}"></script>
|
||||
<script data-cfasync="false">
|
||||
__includeScr('{{BaseAppDataScriptLink}}' + (window.__rlah ? window.__rlah() || '0' : '0') + '/' + window.Math.random().toString().substr(2) + '/');
|
||||
</script>
|
||||
<script type="text/javascript" data-cfasync="false">
|
||||
<script data-cfasync="false">
|
||||
if (window.rainloopAppData && window.rainloopAppData['NewThemeLink']) {
|
||||
window.document.getElementById('rlThemeLink').href = window.rainloopAppData['NewThemeLink'];
|
||||
}
|
||||
|
@ -44,7 +44,7 @@
|
|||
<div class="e-bounce bounce3"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" data-cfasync="false">
|
||||
<script data-cfasync="false">
|
||||
var oE = window.document.getElementById('rl-loading');
|
||||
if (oE && oE.style) {
|
||||
oE.style.opacity = 0;
|
||||
|
@ -69,7 +69,7 @@
|
|||
</div>
|
||||
<div id="rl-templates"></div>
|
||||
<div id="rl-hidden"></div>
|
||||
<script type="text/javascript" data-cfasync="false">
|
||||
<script data-cfasync="false">
|
||||
|
||||
if (window.$LAB && window.rainloopAppData && window.rainloopAppData['TemplatesLink'] && window.rainloopAppData['LangLink'])
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue