From bb261ce017b220eb3f30fa17872083dc8929f2a3 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 28 Jan 2025 21:12:55 +0100 Subject: [PATCH] Fix cache delay param --- htdocs/website/samples/wrapper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index eadc7c68a53..51c6c2500bb 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -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 }