[*] BO: Add an option to htaccess generator to disable mod_security (some rules reject ajax file upload)

This commit is contained in:
Rémi Gaillard
2013-02-12 11:35:10 +01:00
parent d6f21bd9f9
commit f5cf54ef3b
2 changed files with 18 additions and 2 deletions
+7 -1
View File
@@ -1492,7 +1492,7 @@ class ToolsCore
return Tools::getHttpHost();
}
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false)
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null)
{
if (defined('PS_INSTALLATION_IN_PROGRESS'))
return true;
@@ -1505,6 +1505,9 @@ class ToolsCore
if (is_null($disable_multiviews))
$disable_multiviews = (int)Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS');
if ($disable_modsec === null)
$disable_modsec = (int)Configuration::get('PS_HTACCESS_DISABLE_MODSEC');
// Check current content of .htaccess and save all code outside of prestashop comments
$specific_before = $specific_after = '';
if (file_exists($path))
@@ -1567,6 +1570,9 @@ class ToolsCore
if ($disable_multiviews)
fwrite($write_fd, "\n# Disable Multiviews\nOptions -Multiviews\n\n");
if ($disable_modsec)
fwrite($write_fd, "<IfModule mod_security.c>\nSecFilterEngine Off\nSecFilterScanPOST Off\n</IfModule>");
fwrite($write_fd, "RewriteEngine on\n");
if (!$medias)