git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3605 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2008-01-28 06:54:05 +00:00
parent 723b9a4545
commit 2c85caaff9
2 changed files with 33 additions and 1 deletions

View file

@ -64,7 +64,7 @@
if(count($object_vars)) {
foreach($object_vars as $key => $val) {
if(in_array($key, array('body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right'))) continue;
$args->{$key} = urldecode($val);
$args->{$key} = utf8RawUrlDecode(utf8RawUrlDecode($val));
}
}

View file

@ -470,4 +470,36 @@
if(function_exists('php_sapi_name') && php_sapi_name()=='cgi') return preg_replace('/index.php/i','',$_SERVER['PATH_INFO']);
return preg_replace('/index.php/i','',$_SERVER['SCRIPT_NAME']);
}
function utf8RawUrlDecode ($source) {
$decodedStr = "";
$pos = 0;
$len = strlen ($source);
while ($pos < $len) {
$charAt = substr ($source, $pos, 1);
if ($charAt == '%') {
$pos++;
$charAt = substr ($source, $pos, 1);
if ($charAt == 'u') {
// we got a unicode character
$pos++;
$unicodeHexVal = substr ($source, $pos, 4);
$unicode = hexdec ($unicodeHexVal);
$entity = "&#". $unicode . ';';
$decodedStr .= utf8_encode ($entity);
$pos += 4;
}
else {
// we have an escaped ascii character
$hexVal = substr ($source, $pos, 2);
$decodedStr .= chr (hexdec ($hexVal));
$pos += 2;
}
} else {
$decodedStr .= $charAt;
$pos++;
}
}
return $decodedStr;
}
?>