[fix] bad encode charset with php <5.4

This commit is contained in:
Knah Tsaeb 2013-08-06 17:13:53 +02:00
parent deee27e794
commit 068f7c5b05

View file

@ -49,7 +49,17 @@ if (get_magic_quotes_gpc()) {
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
$ci = array_map('htmlentities', array_merge($_POST, $_GET));
/* PHP < 5.4 use htmlentities with ISO-8859-1 charset by default
* PHP > 5.4 use htmlentities with UTF-8 charset by default
* see http://php.net/manual/fr/function.htmlentities.php
*
*/
function myHtmlentities($var) {
return htmlentities($var, ENT_QUOTES, 'UTF-8');
}
$ci = array_merge($_POST, $_GET, $_COOKIE);
$ci = array_map('myHtmlentities', $ci);
$_SESSION['bc'] = $ci['bc'];
if (!file_exists($GLOBALS['config']['CONFIG_FILE']) || strlen(file_get_contents($GLOBALS['config']['CONFIG_FILE'])) == 0) {