diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 8b94c3ec7d8..b48135bbb07 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Océbo * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 7c278c91f82..4ab10223c88 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -122,30 +122,27 @@ else if (@is_writable("/")) define('SYSLOG_FILE','/dolibarr_install.log'); define('SYSLOG_FILE_NO_ERROR',1); -// Forcage du parametrage PHP magic_quots_gpc (Sinon il faudrait a chaque POST, conditionner +// Forcage du parametrage PHP magic_quotes_gpc et nettoyage des parametres +// (Sinon il faudrait a chaque POST, conditionner // la lecture de variable par stripslashes selon etat de get_magic_quotes). // En mode off (recommande il faut juste faire addslashes au moment d'un insert/update. function stripslashes_deep($value) { return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value)); } -if(eregi('PHP/6', $_SERVER['SERVER_SOFTWARE'])) -{ - // magic_quotes_* plus prise en compte dans PHP6 -} -else +//if (! eregi('PHP/6', $_SERVER['SERVER_SOFTWARE'])) +if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* plus pris en compte dans PHP6 { if (get_magic_quotes_gpc()) { - $_GET = array_map('stripslashes_deep', $_GET); - $_POST = array_map('stripslashes_deep', $_POST); - $_COOKIE = array_map('stripslashes_deep', $_COOKIE); + $_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); } - // Defini objet langs $langs = new Translate('../langs',$conf); $langs->setDefaultLang('auto'); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 423808c1752..f0c03b2a3aa 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -33,17 +33,21 @@ // (Sinon il faudrait a chaque POST, conditionner // la lecture de variable par stripslashes selon etat de get_magic_quotes). // En mode off (recommande il faut juste faire addslashes au moment d'un insert/update. -@set_magic_quotes_runtime(0); function stripslashes_deep($value) { return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value)); } -if (get_magic_quotes_gpc()) +//if (! eregi('PHP/6', $_SERVER['SERVER_SOFTWARE'])) +if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* plus pris en compte dans PHP6 { - $_GET = array_map('stripslashes_deep', $_GET); - $_POST = array_map('stripslashes_deep', $_POST); - $_COOKIE = array_map('stripslashes_deep', $_COOKIE); - $_REQUEST = array_map('stripslashes_deep', $_REQUEST); + 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); } // Filtre les GET et POST pour supprimer les SQL INJECTION