diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Base/Http.php b/rainloop/v/0.0.0/app/libraries/MailSo/Base/Http.php index 6e9c5d311..c6eb9994d 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Base/Http.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Base/Http.php @@ -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'); + } } /** diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index b7d79cb63..dcdd96f09 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -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; } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php index 1d07881e9..a744c51ed 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php @@ -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 = ''; diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index d5b017bc3..871afd2ac 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -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 ? '' : '') ; @@ -1130,7 +1131,7 @@ class ServiceActions private function compileAppData($aAppData, $bWrapByScriptTag = true) { return - ($bWrapByScriptTag ? '' : '') diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Social.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Social.php index 5bc28b247..1e922adfe 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Social.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Social.php @@ -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 = ''; } @@ -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 = ''; } @@ -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 = ''; } diff --git a/rainloop/v/0.0.0/app/templates/Index.html b/rainloop/v/0.0.0/app/templates/Index.html index d53c8b567..4dd7a6279 100644 --- a/rainloop/v/0.0.0/app/templates/Index.html +++ b/rainloop/v/0.0.0/app/templates/Index.html @@ -11,7 +11,7 @@ - - + -