From 89b4f6f0b1812190e47fea50dfa7c9fb40e1b31f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2005 22:27:20 +0000 Subject: [PATCH] =?UTF-8?q?Compatibilit=E9=20du=20code=20en=20magic=5Fquot?= =?UTF-8?q?es=5Fgpc=20a=20on=20comme=20a=20off?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/main.inc.php | 18 ++++++++++++++++++ htdocs/master.inc.php | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8cad6e6c3fd..7f4eedade0f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -33,6 +33,24 @@ // est positionnée. A appeler avant tout. if (isset($_SERVER['DOL_TUNING'])) $micro_start_time=microtime(true); + +// Forcage du parametrage PHP magic_quots_gpc (Sinon il faudrait a chaque POST, conditionner +// la lecture de variable par stripslashes selon etat de get_magic_quotes). +// En mode off (recommandé), il faut juste fait addslashes au moment d'un insert/update. +function stripslashes_deep($value) +{ + return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value)); +} +if (get_magic_quotes_gpc()) +{ + $_GET = array_map('stripslashes_deep', $_GET); + $_POST = array_map('stripslashes_deep', $_POST); + $_COOKIE = array_map('stripslashes_deep', $_COOKIE); + $_REQUEST = array_map('stripslashes_deep', $_REQUEST); +} +@set_magic_quotes_runtime(0); + + require_once("master.inc.php"); diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index a4e1fc5f3b3..3f9c88f0265 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -34,7 +34,7 @@ define('DOL_VERSION','2.0.0-alpha2'); // La fonction clearstatcache ne doit pas etre appelé de manière globale car ralenti. -// Elle doit etre appelée uniquement par les pages qui ont besoin d'absence de cache, +// Elle doit etre appelée uniquement par les pages qui ont besoin d'un cache fichier vidé, // comme par exemple document.php //clearstatcache();