xss defense

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9888 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2011-11-29 08:48:36 +00:00
parent f26ebab5ed
commit 04e69878d0

View file

@ -721,6 +721,7 @@ class Context {
**/
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);