娘亲的,更新的Discuz! X3真是奇葩问题无数啊,今儿又发现个问题就是flv附件视频竟然无法播放了,一直加载中,膜拜~经过查找,在官网的一篇帖子找到了解决办法,贴到下面,感谢大神指点。其实就是一个路径编码的问题。
解决办法如下:修改文件/source/function/function_discuzcode.php
将412-457的函数function parsemedia($params, $url)代码全部替换为如下部分即可:
function parsemedia($params, $url) {
$params = explode(',', $params);
$width = intval($params[1]) > 800 800 : intval($params[1]);
$height = intval($params[2]) > 600 600 : intval($params[2]);
$url = addslashes($url);
if($flv = parseflv($url, $width, $height)) {
return $flv;
}
if(in_array(count($params), array(3, 4))) {
$type = $params[0];
$url = str_replace(array('<', '>'), '', str_replace('"', '"', $url));
switch($type) {
case 'mp3':
case 'wma':
case 'ra':
case 'ram':
case 'wav':
case 'mid':
return parseaudio($url, $width);
case 'rm':
case 'rmvb':
case 'rtsp':
$mediaid = 'media_'.random(3);
return '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'.$width.'" height="'.$height.'"><param name="autostart" value="0" /><param name="src" value="'.$url.'" /><param name="controls" value="imagewindow" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" autostart="0" 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.'" autostart="0" type="audio/x-pn-realaudio-plugin" controls="controlpanel" console="'.$mediaid.'_" width="'.$width.'" height="32"></embed></object>';
case 'flv':
$randomid = 'flv_'.random(3);
return '<span id="'.$randomid.'"></span><script type="text/JavaScript" reload="1">$(''.$randomid.'').innerHTML=AC_FL_RunContent('width', ''.$width.'', 'height', ''.$height.'', 'allowNetworking', 'internal', 'allowScriptAccess', 'never', 'src', ''.STATICURL.'image/common/flvplayer.swf', 'Flashvars', 'file='.rawurlencode($url).'', 'quality', 'high', 'wmode', 'transparent', 'allowfullscreen', 'true');</script>';
case 'swf':
$randomid = 'swf_'.random(3);
return '<span id="'.$randomid.'"></span><script type="text/JavaScript" reload="1">$(''.$randomid.'').innerHTML=AC_FL_RunContent('width', ''.$width.'', 'height', ''.$height.'', 'allowNetworking', 'internal', 'allowScriptAccess', 'never', 'src', ''.$url.'', 'quality', 'high', 'bgcolor', '#ffffff', 'wmode', 'transparent', 'allowfullscreen', 'true');</script>';
case 'asf':
case 'asx':
case 'wmv':
case 'mms':
case 'avi':
case 'mpg':
case 'mpeg':
return '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'" height="'.$height.'"><param name="invokeURLs" value="0"><param name="autostart" value="0" /><param name="url" value="'.$url.'" /><embed src="'.$url.'" autostart="0" type="application/x-mplayer2" width="'.$width.'" height="'.$height.'"></embed></object>';
case 'mov':
return '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'.$width.'" height="'.$height.'"><param name="autostart" value="false" /><param name="src" value="'.$url.'" /><embed src="'.$url.'" autostart="false" type="video/quicktime" controller="true" width="'.$width.'" height="'.$height.'"></embed></object>';
default:
return '<a href="'.$url.'" target="_blank">'.$url.'</a>';
}
}
return;
}
其实对比了下,发现只有图中红色部分有差别,编码~可能是为了防止XSS或者其他什么问题这样处理的吧,但是影响了正常使用可不行,况且论坛是内网的,无妨。
以上内容整理字:https://www.Discuz!.net/thread-3304890-1-1.html#postnum26687712
PS:任何因为修改后导致的问题概不负责~
以上部分是针对620的X3的
升级到801的X3该问题代码替换如下:
function parsemedia($params, $url) {
$params = explode(',', $params);
$width = intval($params[1]) > 800 800 : intval($params[1]);
$height = intval($params[2]) > 600 600 : intval($params[2]);
$url = addslashes($url);
if(!in_array(strtolower(substr($url, 0, 6)), array('https:/', 'https:', 'ftp://', 'rtsp:/', 'mms://')) && !preg_match('/^static//', $url) && !preg_match('/^data//', $url)) {
$url = 'https://'.$url;
}
if($flv = parseflv($url, $width, $height)) {
return $flv;
}
if(in_array(count($params), array(3, 4))) {
$type = $params[0];
$url = str_replace(array('<', '>'), '', str_replace('"', '"', $url));
switch($type) {
case 'mp3':
case 'wma':
case 'ra':
case 'ram':
case 'wav':
case 'mid':
return parseaudio($url, $width);
case 'rm':
case 'rmvb':
case 'rtsp':
$mediaid = 'media_'.random(3);
return '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'.$width.'" height="'.$height.'"><param name="autostart" value="0" /><param name="src" value="'.$url.'" /><param name="controls" value="imagewindow" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" autostart="0" 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.'" autostart="0" type="audio/x-pn-realaudio-plugin" controls="controlpanel" console="'.$mediaid.'_" width="'.$width.'" height="32"></embed></object>';
case 'flv':
$randomid = 'flv_'.random(3);
return '<span id="'.$randomid.'"></span><script type="text/JavaScript" reload="1">$(''.$randomid.'').innerHTML=AC_FL_RunContent('width', ''.$width.'', 'height', ''.$height.'', 'allowNetworking', 'internal', 'allowScriptAccess', 'never', 'src', ''.STATICURL.'image/common/flvplayer.swf', 'Flashvars', 'file='.rawurlencode($url).'', 'quality', 'high', 'wmode', 'transparent', 'allowfullscreen', 'true');</script>';
case 'swf':
$randomid = 'swf_'.random(3);
return '<span id="'.$randomid.'"></span><script type="text/JavaScript" reload="1">$(''.$randomid.'').innerHTML=AC_FL_RunContent('width', ''.$width.'', 'height', ''.$height.'', 'allowNetworking', 'internal', 'allowScriptAccess', 'never', 'src', ''.$url.'', 'quality', 'high', 'bgcolor', '#ffffff', 'wmode', 'transparent', 'allowfullscreen', 'true');</script>';
case 'asf':
case 'asx':
case 'wmv':
case 'mms':
case 'avi':
case 'mpg':
case 'mpeg':
return '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'" height="'.$height.'"><param name="invokeURLs" value="0"><param name="autostart" value="0" /><param name="url" value="'.$url.'" /><embed src="'.$url.'" autostart="0" type="application/x-mplayer2" width="'.$width.'" height="'.$height.'"></embed></object>';
case 'mov':
return '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'.$width.'" height="'.$height.'"><param name="autostart" value="false" /><param name="src" value="'.$url.'" /><embed src="'.$url.'" autostart="false" type="video/quicktime" controller="true" width="'.$width.'" height="'.$height.'"></embed></object>';
default:
return '<a href="'.$url.'" target="_blank">'.$url.'</a>';
}
}
return;
}
20170228补充:如果还无法播放,去这里https://pan.baidu.com/s/1i4DAk9f 下载压缩包,解压后的文件覆盖/static/image/common/目录下同名文件。
如您从本文得到了有价值的信息或帮助,请考虑扫描文末二维码捐赠和鼓励。
如本文对您有用,捐赠和留言 将是对我最好的支持~(捐赠可转为站内积分)
如愿意,请向朋友推荐本站,谢谢。
尊重他人劳动成果。转载请务必附上原文链接,我将感激不尽。
留言