在ss7.0正式版中发现不能正常播放discuz论坛推送的flash和其他视频,只显示一段代码,官方尚无解决方法。我的网站已经解决,可以参考http://www.dxiamen.com/?action-viewthread-tid-473
现在奉上一个转载过来的解决方法
1:论坛 dz7.0
2:社区SS7.0
以上版本请看清楚,版本不同解决方案不同。
不同版本,需要做些许调整。以下针对的是上面制定的版本修改。
A : 修改文件:
SS7.0 、upload/include/bbcode.inc.php
Media 修改内容如下:
1,找到如下内容:
$discuzcodes['searcharray']['bbcode_regexp'][] = "/\[media=(\w{1,4}), 。。。省略到行尾
修改成:
$discuzcodes['searcharray']['bbcode_regexp'][] = "/\[media=(\w{1,4}),(\d{1,4}),(\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/media\]/ies";
2,找到如下内容:
function parsemedia($type, $width, $height, $url) {
中间省略
? ? ? ? }
? ? ? ? return;
}
替换成:
function parsemedia($type, $width, $height, $url) {
? ? ? ? if(in_array($type, array('ra', 'rm', 'wma', 'wmv', 'mp3', 'mov'))) {
? ? ? ? ? ? ? ? $url = str_replace(array('<', '>'), '', str_replace('\\"', '\"', $url));
? ? ? ? ? ? ? ? $mediaid = 'media_'.random(3);
? ? ? ? ? ? ? ? $autostart = 0;
? ? ? ? ? ? ? ? /*return ''.$type.$width.$height.$autostart.$url;*/
? ? ? ? ? ? ? ? switch($type) {
? ? ? ? ? ? ? ? ? ? ? ? case 'ra'? ? ? ? : return '<object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="'.$width.'" height="32"><param name="autostart" value="'.$autostart.'" /><param name="src" value="'.$url.'" /><param name="controls" value="controlpanel" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" type="audio/x-pn-realaudio-plugin" controls="ControlPanel" '.($autostart ? 'autostart="true"' : '').' console="'.$mediaid.'_" width="'.$width.'" height="32"></embed></object>';break;
? ? ? ? ? ? ? ? ? ? ? ? case 'rm'? ? ? ? : return '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'.$width.'" height="'.$height.'"><param name="autostart" value="'.$autostart.'" /><param name="src" value="'.$url.'" /><param name="controls" value="imagewindow" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" type="audio/x-pn-realaudio-plugin" controls="IMAGEWINDOW" console="'.$mediaid.'_" width="'.$width.'" height="'.$height.'"></embed></object><br /><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="'.$width.'" height="32"><param name="src" value="'.$url.'" /><param name="controls" value="controlpanel" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" type="audio/x-pn-realaudio-plugin" controls="ControlPanel" '.($autostart ? 'autostart="true"' : '').' console="'.$mediaid.'_" width="'.$width.'" height="32"></embed></object>';break;
? ? ? ? ? ? ? ? ? ? ? ? case 'wma'? ? ? ? : return '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'" height="64"><param name="autostart" value="'.$autostart.'" /><param name="url" value="'.$url.'" /><embed src="'.$url.'" autostart="'.$autostart.'" type="audio/x-ms-wma" width="'.$width.'" height="64"></embed></object>';break;
? ? ? ? ? ? ? ? ? ? ? ? case 'wmv'? ? ? ? : return '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'" height="'.$height.'"><param name="autostart" value="'.$autostart.'" /><param name="url" value="'.$url.'" /><embed src="'.$url.'" autostart="'.$autostart.'" type="video/x-ms-wmv" width="'.$width.'" height="'.$height.'"></embed></object>';break;
? ? ? ? ? ? ? ? ? ? ? ? case 'mp3'? ? ? ? : return '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'" height="64"><param name="autostart" value="'.$autostart.'" /><param name="url" value="'.$url.'" /><embed src="'.$url.'" autostart="'.$autostart.'" type="application/x-mplayer2" width="'.$width.'" height="64"></embed></object>';break;
? ? ? ? ? ? ? ? ? ? ? ? case 'mov'? ? ? ? : return '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'.$width.'" height="'.$height.'"><param name="autostart" value="'.($autostart ? 'true' : 'false').'" /><param name="src" value="'.$url.'" /><embed controller="true" width="'.$width.'" height="'.$height.'" src="'.$url.'" autostart="'.($autostart ? 'true' : 'false').'"></embed></object>';break;
? ? ? ? ? ? ? ? }
? ? ? ? }
? ? ? ? return;
}
二,Flash播放器代码修改;修改文件同上
注意:您的discuz代码里flash必须修改过,三个参数分别为,url,width,height;顺序不能变。
在文件110行后添加如下代码:
$discuzcodes['searcharray']['bbcode_regexp'][] = "/\[flash=\s*([^\[\<\r\n]+?)\s*\,(\d{1,4})\](\d{1,4})\[\/flash\]/ies";
$discuzcodes['replacearray']['bbcode_regexp'][] = "parseflash('\\1', \\2, \\3)";
复制代码
在文件里添加新方法:
(不懂什么叫方法也没关系,添加到文件底部就可以了)
function parseflash($url, $width, $height) {
$url = str_replace(array('<', '>'), '', str_replace('\\"', '\"', $url));
/*return 'Go to visit BBS';*/
return '<script type="text/javascript">swfObj(\''.$url.'\','.$width.','.$height.');</script>';
}
以下是附件,请直接覆盖原文件即可,有钱的给个金币(我好像很穷啊,呵呵),没钱的就点免费的吧! |
|