* If _nocache or http_x_zt_refresh exist, no cache.

This commit is contained in:
Lufei
2023-06-07 11:06:01 +08:00
parent d992b8c3fd
commit d799091b6a
3 changed files with 8 additions and 4 deletions
+1
View File
@@ -21,6 +21,7 @@ $filter->default->paramValue = 'reg::paramValue';
$filter->default->get['onlybody'] = 'equal::yes';
$filter->default->get['_single'] = 'equal::1';
$filter->default->get['_nocache'] = 'equal::1';
$filter->default->get['tid'] = 'reg::word';
$filter->default->get['HTTP_X_REQUESTED_WITH'] = 'equal::XMLHttpRequest';
+1 -1
View File
@@ -2266,7 +2266,7 @@ class baseRouter
{
$cacheEnable = $this->config->cache->enableFullPage;
/* If caching is not turned on, pages that do not need to be cached, or when searching, they are not cached. */
if(!$cacheEnable || !in_array("{$this->moduleName}|{$this->methodName}", $this->config->cache->fullPages) || stripos($this->server->request_uri, 'search') !== false)
if(!$cacheEnable || !in_array("{$this->moduleName}|{$this->methodName}", $this->config->cache->fullPages) || stripos($this->server->request_uri, 'search') !== false || isset($_GET['_nocache']) || $this->server->http_x_zt_refresh)
{
$this->loadModule();
return helper::removeUTF8Bom(ob_get_clean());
+6 -3
View File
@@ -58,14 +58,17 @@ function resizeBlock(blockID, width, callback)
*
* @param object $panel
* @param function afterRefresh
* @param number forceRefresh
* @access public
* @return void
*/
function refreshBlock($panel, afterRefresh)
function refreshBlock($panel, afterRefresh, forceRefresh = 0)
{
var url = $panel.data('url');
var headers = {};
if(forceRefresh) headers['X-Zt-Refresh'] = forceRefresh;
$panel.addClass('load-indicator loading');
$.ajax({url: url, dataType: 'html'}).done(function(data)
$.ajax({url: url, dataType: 'html', headers: headers}).done(function(data)
{
var $data = $(data);
if($data.hasClass('panel')) $panel.empty().append($data.children());
@@ -284,7 +287,7 @@ $(function()
always: function(){sortMessager.isShow && sortMessager.hide();}
}).on('click', '.refresh-panel', function()
{
refreshBlock($(this).closest('.panel'));
refreshBlock($(this).closest('.panel'), null, 1);
});
});