Fix: avoid warning and strict mode story

This commit is contained in:
Regis Houssin
2012-07-25 09:09:56 +02:00
parent 8e953a6858
commit e12604cb71
2 changed files with 313 additions and 317 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -27,32 +27,32 @@
/**
* Same function than javascript unescape() function but in PHP.
*
* @param string $sourcetodecode String to decode
* @return
* @param string $source String to decode
* @return String decoded
*/
function jsUnEscape($source)
{
$decodedStr = "";
$pos = 0;
$len = strlen ($source);
$len = strlen($source);
while ($pos < $len) {
$charAt = substr ($source, $pos, 1);
$charAt = substr($source, $pos, 1);
if ($charAt == '%') {
$pos++;
$charAt = substr ($source, $pos, 1);
$charAt = substr($source, $pos, 1);
if ($charAt == 'u') {
// we got a unicode character
$pos++;
$unicodeHexVal = substr ($source, $pos, 4);
$unicode = hexdec ($unicodeHexVal);
$unicodeHexVal = substr($source, $pos, 4);
$unicode = hexdec($unicodeHexVal);
$entity = "&#". $unicode . ';';
$decodedStr .= utf8_encode ($entity);
$decodedStr .= utf8_encode($entity);
$pos += 4;
}
else {
// we have an escaped ascii character
$hexVal = substr ($source, $pos, 2);
$decodedStr .= chr (hexdec ($hexVal));
$hexVal = substr($source, $pos, 2);
$decodedStr .= chr(hexdec ($hexVal));
$pos += 2;
}
} else {