Fix cache delay param

This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-01-28 21:12:55 +01:00
parent 579b0918df
commit bb261ce017

View file

@ -129,10 +129,11 @@ if (GETPOSTISSET('type')) {
$original_file = str_replace("../", "/", $original_file);
// Cache or not
if (GETPOST("cache", 'aZ09') || image_format_supported($original_file) >= 0) {
$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int, 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.
header('Cache-Control: max-age=3600, public, must-revalidate');
header('Cache-Control: max-age='.((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600').', public, must-revalidate');
header('Pragma: cache'); // This is to avoid having Pragma: no-cache
}