已经抱怨fireboard 的bbcode很久了,好多朋友都抱怨过这种情况,在论坛中想用bbcode 贴一些php供大家参考,结果经常贴出来后,却面目全非。就像唐伯虎点秋香里中了面目全非脚一样。
一直怀疑是fireboard 的bbcode有问题,今天有空查了一下原因,却发现跟我的预想不同,问题处在 legacy模式中的函数 mosGetparam ,这个函数代码如下:
function mosGetParam( &$arr, $name, $def=null, $mask=0 )
{
// Static input filters for specific settings
static $noHtmlFilter = null;
static $safeHtmlFilter = null;
$var = JArrayHelper::getValue( $arr, $name, $def, "" );
// If the no trim flag is not set, trim the variable
if (!($mask & 1) && is_string($var)) {
$var = trim($var);
}
// Now we handle input filtering
if ($mask & 2) {
// If the allow html flag is set, apply a safe html filter to the variable
if (is_null($safeHtmlFilter)) {
$safeHtmlFilter = & JFilterInput::getInstance(null, null, 1, 1);
}
$var = $safeHtmlFilter->clean($var, "none");
} elseif ($mask & 4) {
// If the allow raw flag is set, do not modify the variable
$var = $var;
} else {
// Since no allow flags were set, we will apply the most strict filter to the variable
if (is_null($noHtmlFilter)) {
$noHtmlFilter = & JFilterInput::getInstance(/* $tags, $attr, $tag_method, $attr_method, $xss_auto */);
}
$var = $noHtmlFilter->clean($var, "none");
}
return $var;
}
显然为了安全,这个函数对输入的参数进行了过滤,相当于我们Joomla! 1.5中的 inputfilter 吧。而在fireboard 的 fireboad.php 以及post.php中,都有这样的使用的地方:
$message = mosGetParam($_REQUEST, "message");
这样引用自然就会进入最严格的过滤。我们当然可以改为
$message = mosGetParam($_REQUEST, "message", "",4);
就不会发生过滤了,但是这样做的后果就是安全性降低了,还需要后续的手段进行必要的安全过滤。
评论 |
|
|
Powered by !JoomlaComment 3.26
|
3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."
| < 上页 | 下页 > |
|---|











































