在SS7中,显示论坛的帖子的时候,如果帖子中有用户插入的 flash 或者多媒体,会无法现实和播放。
下面是临时解决办法
打开 include/bbcode.inc.php 文件,搜到
$discuzcodes['searcharray']['bbcode_regexp'][] ="/\[media=(\w{1,4}),(\d{1,4}),(\d{1,4}),(\d)\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/ies";
if($allowmediacode) {
$discuzcodes['replacearray']['bbcode_regexp'][] = "parsemedia('\\1', \\2, \\3, \\4, '\\5')";
} else {
$discuzcodes['replacearray']['bbcode_regexp'][] ="bbcodeurl('\\5', '<a href=\"%s\"target=\"_blank\">%s</a>')";
}
大概是112行到117行
将这些行修改为
$discuzcodes['searcharray']['bbcode_regexp'][] = "/\[media=([\w,]+)\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/ies";
if($allowmediacode) {
$discuzcodes['replacearray']['bbcode_regexp'][] = "parsemedia('\\1', '\\2')" ;
} else {
$discuzcodes['replacearray']['bbcode_regexp'][] ="bbcodeurl('\\2', '<a href=\"%s\"target=\"_blank\">%s</a>')";
}
$discuzcodes['searcharray']['flash'] = "/\[flash\]\s*([^\[\<\r\n]+?)\s*\[\/flash\]/ies";
$discuzcodes['replacearray']['flash'] = "bbcodeurl('\\1','<a href=\"%s\" target=\"_blank\">Flash: %s</a> ')";
$message = preg_replace($discuzcodes['searcharray']['flash'], $discuzcodes['replacearray']['flash'], $message);
然后在该文件继续搜
function parsemedia($type, $width, $height, $autostart, $url) {
这个函数,将这个函数替换成
function parsemedia($params, $url) {
$params = explode(',', $params);
if(in_array(count($params), array(3, 4))) {
$type = $params[0];
$width = intval($params[1]) > 800 ? 800 : intval($params[1]);
$height = intval($params[2]) > 600 ? 600 : intval($params[2]);
$autostart = isset($params[3])&&$params[3]>0 ? 1 : 0;
$url = str_replace(array('<', '>'), '', str_replace('\\"', '\"', $url));
$mediaid = 'media_'.random(3);
switch($type) {
case 'ra' : return '
classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="'.$width.'"
height="32">
/>
name="controls" value="controlpanel" />
value="'.$mediaid.'_" />
type="audio/x-pn-realaudio-plugin" controls="ControlPanel"
'.($autostart ? 'autostart="true"' : '').' console="'.$mediaid.'_"
width="'.$width.'" height="32">';break;
case 'rm' : return '
classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'.$width.'"
height="'.$height.'">
value="'.$autostart.'" />
/>
name="console" value="'.$mediaid.'_" />
type="audio/x-pn-realaudio-plugin" controls="IMAGEWINDOW"
console="'.$mediaid.'_" width="'.$width.'"
height="'.$height.'">
/>
width="'.$width.'" height="32">
/>
name="console" value="'.$mediaid.'_" />
type="audio/x-pn-realaudio-plugin" controls="ControlPanel"
'.($autostart ? 'autostart="true"' : '').' console="'.$mediaid.'_"
width="'.$width.'" height="32">';break;
case 'wma' : return '
classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'"
height="64">
/>
src="'.$url.'" autostart="'.$autostart.'" type="audio/x-ms-wma"
width="'.$width.'" height="64">';break;
case 'wmv' : return '
classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'"
height="'.$height.'">
value="'.$autostart.'" />
/>
type="video/x-ms-wmv" width="'.$width.'"
height="'.$height.'">';break;
case 'mp3' : return '
classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'"
height="64">
/>
src="'.$url.'" autostart="'.$autostart.'" type="application/x-mplayer2"
width="'.$width.'" height="64">';break;
case 'mov' : return '
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'.$width.'"
height="'.$height.'">
/>
height="'.$height.'" src="'.$url.'" autostart="'.($autostart ? 'true' :
'false').'">';break;
default : return;
}
}
return;
} |