Fix var for cachedelay

This commit is contained in:
ldestailleur 2025-03-04 21:23:23 +01:00
parent bcd1f49bc4
commit c35550d89c

View file

@ -132,10 +132,10 @@ $original_file = str_replace("../", "/", $original_file);
$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int (delay in second of the cache if < 999999, or a timestamp), or a hash
if ($cachestring || image_format_supported($original_file) >= 0) {
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
$delaycache = GETPOSTINT('cachedelay') ? GETPOSTINT('cachedelay') : ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600');
header('Cache-Control: max-age='.$delaycache.', public, must-revalidate');
$cachedelay = GETPOSTINT('cachedelay') ? GETPOSTINT('cachedelay') : ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600');
header('Cache-Control: max-age='.$cachedelay.', public, must-revalidate');
header('Pragma: cache'); // This is to avoid having Pragma: no-cache
header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server
header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $cachedelay).' GMT'); // This is to avoid to have Expires set by proxy or web server
}
$refname = basename(dirname($original_file)."/");