Small fixes

This commit is contained in:
RainLoop Team 2014-10-02 00:19:03 +04:00
parent 60b449b9f8
commit 195d13dc0d
6 changed files with 64 additions and 32 deletions

View file

@ -677,13 +677,43 @@ class Http
return $bResult; return $bResult;
} }
/**
* @staticvar bool $bCache
*/
public function ServerNoCache() public function ServerNoCache()
{ {
@\header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); static $bCache = false;
@\header('Last-Modified: '.\gmdate('D, d M Y H:i:s').' GMT'); if (false === $bCache)
@\header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); {
@\header('Cache-Control: post-check=0, pre-check=0', false); $bCache = true;
@\header('Pragma: no-cache'); @\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');
}
} }
/** /**

View file

@ -6414,14 +6414,9 @@ class Actions
$bResult = false; $bResult = false;
if (!empty($sKey) && ($bForce || $this->Config()->Get('cache', 'enable', true) && $this->Config()->Get('cache', 'http', true))) if (!empty($sKey) && ($bForce || $this->Config()->Get('cache', 'enable', true) && $this->Config()->Get('cache', 'http', true)))
{ {
$iLast = 1382478804; $this->oHttp->ServerUseCache(
$iExpires = 2002478804; \md5('Etag:'.\md5($sKey.\md5($this->Config()->Get('cache', 'index', '')))),
1382478804, 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');
$bResult = true; $bResult = true;
} }

View file

@ -98,6 +98,11 @@ class Service
$bAdmin = true; $bAdmin = true;
} }
if ($this->oHttp->IsPost())
{
$this->oHttp->ServerNoCache();
}
if ($bAdmin && !$this->oActions->Config()->Get('security', 'allow_admin_panel', true)) if ($bAdmin && !$this->oActions->Config()->Get('security', 'allow_admin_panel', true))
{ {
echo $this->oActions->ErrorTemplates('Access Denied.', echo $this->oActions->ErrorTemplates('Access Denied.',

View file

@ -196,6 +196,7 @@ class ServiceActions
$this->Plugins()->RunHook('filter.ajax-response', array($sAction, &$aResponseItem)); $this->Plugins()->RunHook('filter.ajax-response', array($sAction, &$aResponseItem));
@\header('Content-Type: application/json; charset=utf-8'); @\header('Content-Type: application/json; charset=utf-8');
$sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger()); $sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger());
$sObResult = @\ob_get_clean(); $sObResult = @\ob_get_clean();
@ -1115,7 +1116,7 @@ class ServiceActions
$sResult = empty($sLangJs) ? 'null' : '{'.\substr($sLangJs, 0, -1).'}'; $sResult = empty($sLangJs) ? 'null' : '{'.\substr($sLangJs, 0, -1).'}';
return return
($bWrapByScriptTag ? '<script type="text/javascript" data-cfasync="false">' : ''). ($bWrapByScriptTag ? '<script data-cfasync="false">' : '').
'window.rainloopI18N='.$sResult.';'.$sMoment. 'window.rainloopI18N='.$sResult.';'.$sMoment.
($bWrapByScriptTag ? '</script>' : '') ($bWrapByScriptTag ? '</script>' : '')
; ;
@ -1130,7 +1131,7 @@ class ServiceActions
private function compileAppData($aAppData, $bWrapByScriptTag = true) private function compileAppData($aAppData, $bWrapByScriptTag = true)
{ {
return return
($bWrapByScriptTag ? '<script type="text/javascript" data-cfasync="false">' : ''). ($bWrapByScriptTag ? '<script data-cfasync="false">' : '').
'window.rainloopAppData='.\json_encode($aAppData).';'. 'window.rainloopAppData='.\json_encode($aAppData).';'.
'if(window.__rlah_set){__rlah_set()};'. 'if(window.__rlah_set){__rlah_set()};'.
($bWrapByScriptTag ? '</script>' : '') ($bWrapByScriptTag ? '</script>' : '')

View file

@ -400,7 +400,7 @@ class Social
@\header('Content-Type: text/html; charset=utf-8'); @\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : ''; $sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_google'.$sCallBackType.'_service'; $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>'; $sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
} }
@ -520,11 +520,12 @@ class Social
else else
{ {
$this->oHttp->ServerNoCache(); $this->oHttp->ServerNoCache();
@\header('Content-Type: text/html; charset=utf-8'); @\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : ''; $sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_facebook'.$sCallBackType.'_service'; $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>'; $sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
} }
@ -720,7 +721,7 @@ class Social
@\header('Content-Type: text/html; charset=utf-8'); @\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : ''; $sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_twitter'.$sCallBackType.'_service'; $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>'; $sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
} }

View file

@ -11,7 +11,7 @@
<!--[if lte IE 8]> <!--[if lte IE 8]>
<meta http-equiv="refresh" content="0; URL=./?/BadBrowser" /> <meta http-equiv="refresh" content="0; URL=./?/BadBrowser" />
<![endif]--> <![endif]-->
<script type="text/javascript" data-cfasync="false"> <script data-cfasync="false">
if (!window.navigator || !window.navigator.cookieEnabled) { if (!window.navigator || !window.navigator.cookieEnabled) {
window.document.location.replace('./?/NoCookie'); window.document.location.replace('./?/NoCookie');
} }
@ -24,11 +24,11 @@
<link rel="apple-touch-icon" href="{{BaseAppAppleTouchFile}}" type="image/png" /> <link rel="apple-touch-icon" href="{{BaseAppAppleTouchFile}}" type="image/png" />
<link type="text/css" rel="stylesheet" href="{{BaseAppMainCssLink}}" /> <link type="text/css" rel="stylesheet" href="{{BaseAppMainCssLink}}" />
<link type="text/css" rel="stylesheet" id="rlThemeLink" /> <link type="text/css" rel="stylesheet" id="rlThemeLink" />
<script type="text/javascript" data-cfasync="false" src="{{BaseAppBootScriptLink}}"></script> <script data-cfasync="false" src="{{BaseAppBootScriptLink}}"></script>
<script type="text/javascript" data-cfasync="false"> <script data-cfasync="false">
__includeScr('{{BaseAppDataScriptLink}}' + (window.__rlah ? window.__rlah() || '0' : '0') + '/' + window.Math.random().toString().substr(2) + '/'); __includeScr('{{BaseAppDataScriptLink}}' + (window.__rlah ? window.__rlah() || '0' : '0') + '/' + window.Math.random().toString().substr(2) + '/');
</script> </script>
<script type="text/javascript" data-cfasync="false"> <script data-cfasync="false">
if (window.rainloopAppData && window.rainloopAppData['NewThemeLink']) { if (window.rainloopAppData && window.rainloopAppData['NewThemeLink']) {
window.document.getElementById('rlThemeLink').href = window.rainloopAppData['NewThemeLink']; window.document.getElementById('rlThemeLink').href = window.rainloopAppData['NewThemeLink'];
} }
@ -44,7 +44,7 @@
<div class="e-bounce bounce3"></div> <div class="e-bounce bounce3"></div>
</div> </div>
</div> </div>
<script type="text/javascript" data-cfasync="false"> <script data-cfasync="false">
var oE = window.document.getElementById('rl-loading'); var oE = window.document.getElementById('rl-loading');
if (oE && oE.style) { if (oE && oE.style) {
oE.style.opacity = 0; oE.style.opacity = 0;
@ -69,7 +69,7 @@
</div> </div>
<div id="rl-templates"></div> <div id="rl-templates"></div>
<div id="rl-hidden"></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']) if (window.$LAB && window.rainloopAppData && window.rainloopAppData['TemplatesLink'] && window.rainloopAppData['LangLink'])
{ {