N°3952 - code hardening

This commit is contained in:
Eric
2021-05-27 09:29:50 +02:00
parent db6e813cba
commit 43daa2ef08
5 changed files with 91 additions and 27 deletions

View File

@@ -147,12 +147,7 @@ header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); // Date in the past
$sOperation = Utils::ReadParam('operation', '');
try
{
$sAuthent = utils::ReadParam('authent', '', false, 'raw_data');
if (!file_exists(APPROOT.'data/setup/authent') || $sAuthent !== file_get_contents(APPROOT.'data/setup/authent'))
{
throw new SecurityException('Setup operations are not allowed outside of the setup');
SetupPage::log_error("Setup operations are not allowed outside of the setup");
}
SetupUtils::CheckSetupToken();
switch($sOperation)
{
@@ -199,7 +194,6 @@ catch(Exception $e)
{
header("HTTP/1.0 500 Internal server error.");
echo "<p>An error happened while processing the installation:</p>\n";
echo '<p>'.$e."</p>\n";
SetupPage::log_error("An error happened while processing the installation: ".$e);
}
@@ -207,7 +201,7 @@ if (function_exists('memory_get_peak_usage'))
{
if ($sOperation == 'file')
{
SetupPage::log_info("loading file '$sFileName', peak memory usage. ".memory_get_peak_usage());
SetupPage::log_info("loading file peak memory usage. ".memory_get_peak_usage());
}
else
{