|
|
目前已经解决了旧附件显示和下载的问题,大家帮助查一下,如果发现存在哪些问题,可以提出来,以便修正。
现在可能存在的问题,就是那些带有 snap3_(10位数字).xxx 格式的文件和图片附件,在移动分区以后,就会无法下载。
现在还不了解这种附件格式中的10位数字的含义,如果里面带有原来的分论坛号,就那办,现在看上去不象有这个信息。
-----------------------------------------------------------------------------------------------------------
leobbs转换为discuz以后,旧附件会无法查看,需要对旧论坛的附件进行调整。
leobbs附件的文件名有两种需要区别对待的格式:
1. 10位数字为标号:snap3_2343223422.gif/rar :”任意数字或字母组合“ + ”_“ + ”10位数字“ + ”." + "gif|jpg|png|jpeg" 。
例:http://bbs.wuyou.net/forum.php?mod=viewthread&tid=33959&extra=page%3D2%26amp%3Bfilter%3Ddigest&page=1
2. 分论坛号为标号:34_234.gif:“1-2位数字”(分论坛号) + “_” + “多位数字" + [ _ “多位数字” ] + “." + "gif|jpg|png|jpeg"
例:http://bbs.wuyou.net/forum.php?mod=viewthread&tid=24438&extra=page%3D1
其中,论坛对图片和非图片的附件处理方法不同,图片直接显示出来,非图片附件要以下载形式。
这样,就有四种需要区别对待。
曾进行分区调整后的标准格式 非图片附件:http://bbs.wuyou.net/forum.php?mod=viewthread&tid=31996&extra=page%3D1&page=2
曾进行分区调整后的标准格式 图片附件:http://bbs.wuyou.net/forum.php?mod=viewthread&tid=31996&extra=page%3D1&page=23
具体方法如下:(discuzX 3.2)
在/source/function/function_discuzcode.php中
找到以下一行:
for($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) {
$message = str_replace("[\tDISCUZ_CODE_$i\t]", $_G['forum_discuzcode']['codehtml'][$i], $message);
在其上方添加以下代码:-
- //leobbs 转换数据后显示旧图片附件专用 $tid是你主题的最大id
- global $_G;
- $fid = $_G['fid'];
- $tid = $_G['tid'];
- if ($tid < 77038) {
- $lbfilepath = './data/attachment/forum/lbupfile/';
- $message = preg_replace(array(
- "/\[UploadFile=(.{1,20}_\d{10})\.(gif|jpg|png|bmp|jpeg)\]/ies",
- "/\[UploadFile=(\d{1,2})_(.{1,20})\.(gif|jpg|png|bmp|jpeg)\]/ies",
- "/\[UploadFile=(.{1,20}_\d{10})\.(torrent|zip|rar|doc|txt)\]/ies",
- "/\[UploadFile=(\d{1,2})_(.{1,20})\.(torrent|zip|rar|doc|txt)\]/ies"),
- array(
- "'<center><img src="".$lbfilepath.$fid."/\\1.\\2" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'Click here to open new window\';}" onmouseover="if(this.resized) this.style.cursor=\'hand\';" onclick="if(this.resized) {window.open(\'%s\');}"></center><br>'",
- "'<center><img src="".$lbfilepath."\\1/\\1_\\2.\\3" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'Click here to open new window\';}" onmouseover="if(this.resized) this.style.cursor=\'hand\';" onclick="if(this.resized) {window.open(\'%s\');}"></center><br>'",
- "'<a href="".$lbfilepath.$fid."/\\1.\\2" target="_blank" style="color:#0000FF;font-weight:bold">点击下载文件</a>'",
- "'<a href="".$lbfilepath."\\1/\\1_\\2.\\3" target="_blank" style="color:#0000FF;font-weight:bold">点击下载文件</a>'"),$message);
- }
- unset($fid,$tid,$lbfilepath);
- //discuz 3.2 可用
复制代码 |
|