Fix refreshing of captcha broken if a cache-control set by server

This commit is contained in:
Laurent Destailleur 2018-01-24 13:40:39 +01:00
parent 6e906ac0e3
commit fbeb66fedd
2 changed files with 7 additions and 2 deletions

View File

@ -59,7 +59,7 @@ if (empty($img))
}
// Define mime type
top_httphead('image/png');
top_httphead('image/png', 1);
$background_color = imagecolorallocate($img, 250, 250, 250);
$ecriture_color = imagecolorallocate($img, 0, 0, 0);

View File

@ -1047,9 +1047,10 @@ if (! function_exists("llxHeader"))
* Show HTTP header
*
* @param string $contenttype Content type. For example, 'text/html'
* @param int $forcenocache Force disabling of cache for the page
* @return void
*/
function top_httphead($contenttype='text/html')
function top_httphead($contenttype='text/html', $forcenocache=0)
{
global $conf;
@ -1066,6 +1067,10 @@ function top_httphead($contenttype='text/html')
// default-src https://cdn.example.net; object-src 'none'
header("Content-Security-Policy: ".$conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY);
}
if ($forcenocache)
{
header("Cache-Control: no-cache, no-store, must-revalidate, max-age=0");
}
}
/**