issue 2156, fixed a bug. display warning message on sitemap

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3@10915 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-07-19 08:48:02 +00:00
parent 1830ff3d0d
commit f0c2168f5d
4 changed files with 42 additions and 15 deletions

View file

@ -728,19 +728,42 @@ class Context {
* @return filtered value
**/
function _filterRequestVar($key, $val, $do_stripslashes = 1) {
if( ($key == 'page' || $key == 'cpage' || substr($key,-3)=='srl')) return !preg_match('/^[0-9,]+$/',$val)?(int)$val:$val;
if($key == 'mid' || $key == 'vid' || $key == 'search_keyword') return htmlspecialchars($val);
if(is_array($val) && count($val) ) {
foreach($val as $k => $v) {
if($do_stripslashes && version_compare(PHP_VERSION, '5.9.0', '<') && get_magic_quotes_gpc()) $v = stripslashes($v);
$v = trim($v);
$val[$k] = $v;
}
} else {
if($do_stripslashes && version_compare(PHP_VERSION, '5.9.0', '<') && get_magic_quotes_gpc()) $val = stripslashes($val);
$val = trim($val);
$isArray = TRUE;
if(!is_array($val))
{
$isArray = FALSE;
$val = array($val);
}
foreach($val as $k => $v)
{
if($key === 'page' || $key === 'cpage' || substr($key, -3) === 'srl')
{
$val[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int)$v : $v;
}
elseif($key === 'mid' || $key === 'vid' || $key === 'search_keyword')
{
$val[$k] = htmlspecialchars($v);
}
else
{
if($do_stripslashes && version_compare(PHP_VERSION, '5.9.0', '<') && get_magic_quotes_gpc())
{
$v = stripslashes($v);
}
$val[$k] = trim($v);
}
}
if($isArray)
{
return $val;
}
else
{
return $val[0];
}
return $val;
}
/**