经过测试Flash引用时存在过滤不严格的BUG,现给出以下修正方案:
1、找到include\discuzcode.func.php文件
2、在discuzcode函数中查找
if($allowmediacode && strpos($msglower, '[/flash]') !== FALSE) {
$message = preg_replace("/\[flash\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/is", "<script type="text/javascript" reload="1">document.write(AC_FL_RunContent('width', '550', 'height', '400', 'allowNetworking', 'internal', 'allowScriptAccess', 'never', 'src', '\\1', 'quality', 'high', 'bgcolor', '#ffffff', 'wmode', 'transparent', 'allowfullscreen', 'true'));</script>", $message);
}
换行成
if($allowmediacode && strpos($msglower, '[/flash]') !== FALSE) {
$message = preg_replace("/\[flash\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/ies", "parseflash('\\1')", $message);
}
3、在该文件中增加以下函数代码
function parseflash($url) {
preg_match("/((https?){1}:\/\/|www\.)[^\["']+/i", $url, $matches);
$url = $matches[0];
$code = '';
if($url) {
$code = "<script type="text/javascript" reload="1">document.write(AC_FL_RunContent('width', '550', 'height', '400', 'allowNetworking', 'internal', 'allowScriptAccess', 'never', 'src', '$url', 'quality', 'high', 'bgcolor', '#ffffff', 'wmode', 'transparent', 'allowfullscreen', 'true'));</script>";
}
return $code;
}
修正后可以有效地限制引用的Flash地址
转载于DZ新应用中心
历史资源提醒--必看
该页面资源/教程来自原魔趣吧历史资源转移,因发布历史久远,部分资源/教程可能已失效或无法在最新版程序中安装使用!DZ资源建议在Discuz3.4及以下版本使用,PHP版本建议5.6。资源仅提供做代码研究学习使用!
因改版,部分贴内链接将无法正常跳转,如链接失效或未正常跳转,请利用站内搜索功能搜索资源名称获取对应资源!