我不是作者,我也不会写程序
不过最近迷上了Discuz而已
看到有人在问这个插件
所以把我的装法写出来
有错误欢迎指正
演示地址:http://www.bbpub.com/viewthread.php?tid=595
普通附件下载效果:
BT种子详情显示效果:
本贴参考以下几贴综合而成:
BT发布页1.3 for Discuz 6.1(开源版):https://discuz.dismall.com/viewthread.php?tid=1001896&highlight=BT%B7%A2%B2%BC%D2%B3
附件美化+下载名单+BT种子显示详细资源信息+迅雷快车专用链:https://discuz.dismall.com/viewthread.php?tid=784646&highlight=%CF%C2%D4%D8%C3%FB%B5%A5
Discuz!6.1迅雷专用链改法:https://discuz.dismall.com/viewthread.php?tid=935002&highlight=%D1%B8%C0%D7
======================================
1.修改viewthread.htm
======================================
找到
- <h4>{lang attachment}</h4>
复制代码 过滤掉或者删除掉,如下...
- <!-- <h4>{lang attachment}</h4> // End -->
复制代码 找到以下代码:
- <script type="text/javascript" src="include/javascript/viewthread.js"></script>
- <script type="text/javascript">zoomstatus = parseInt($zoomstatus);</script>
复制代码 在这个后面加上以下代码:
- <script src='http://pstatic.xunlei.com/js/webThunderDetect.js'></script>
- <script src='http://pstatic.xunlei.com/js/base64.js'></script>
- <script src='http://pstatic.xunlei.com/js/thunderForumLinker.js'></script>
- <script language="javascript">
- var thunderPid="43383";//这里改为你自己的联盟号
- function outPutThunder()
- {
- var thunderCh=unescape("%u8FC5%u96F7%u4E13%u7528%u9AD8%u901F%u4E0B%u8F7D");var arg=arguments; var til=""; if(arg[0]=="undefined") return; if(arg[1]!="undefined") til=arg[1]; var th_Pid=""; if(arg[3])th_Pid=arg[3];else if(!isNaN(thunderPid) && thunderPid!="") th_Pid=thunderPid; else return; var th_href=arg[0]; if(th_href.indexOf("://")<=0){if(th_href.substr(0,1)!="/"){var a=document.location.href;th_href=a.substr(0,a.lastIndexOf("/")+1)+th_href;}else{th_href="http://"+document.location.host+th_href;}}
- var tagEx=arguments[2]?arguments[2]:'';
- var thunderURL=ThunderEncode(th_href);
- var thunderRes="";
- var thunderName=thunderCh+(til?("_"+til):"");
- document.write("<a href="#" thunderHref=""+thunderURL+"" thunderPid=""+th_Pid+"" thunderType="08" thunderResTitle=""+thunderRes+"" onClick="return OnDownloadClick_Simple(this,2);" oncontextmenu="ThunderNetwork_SetHref(this);" title=""+thunderCh+"" "+tagEx+">"+thunderName+"<\/a>");
- }
- </script>
复制代码 ======================================
2. 修改attachment.func.php
======================================
查找- $extension = strtolower(fileext($attach['filename']));
复制代码 在其下面添加- $extension == 'torrent' ? $attach['isbt'] = 1 : $attach['isbt'] = 0;
复制代码 接着 查找- $attach['dateline'] = gmdate("$dateformat $timeformat", $attach['dateline'] + $timeoffset * 3600);
复制代码 在其下面添加再查找- $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
复制代码 在其下面添加- }
- //$postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
复制代码 ======================================
3. 修改discuzcode.htm
======================================
找到- global $attachrefcheck, $extcredits, $creditstrans, $ftp, $thumbstatus;
复制代码 共有两处,都需要修改
在分号前面加上“, $groupid, $adminid, $discuz_uid”,如下...-
- global $attachrefcheck, $extcredits, $creditstrans, $ftp, $thumbstatus, $groupid, $adminid, $discuz_uid;
复制代码 找到-
- <dt>
- $attach[attachicon]
- <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
- <em>($attach[attachsize])</em>
- </dt>// End -->
- <dd>
- <p>
- <!-- $attach[dateline], {lang downloads}: $attach[downloads]
复制代码 将其替换成-
- <div class="mainbox">
- <h4>附件下载 <!--{if in_array($groupid, array('19','20','21' && $adminid)) || $discuz_uid == $attach['uid']}-->[<a href="misc.php?action=viewattachdownloadlog&aid=$attach[aid]" target="_blank"><em>下载名单</em></a>]<!--{/if}--></h4>
-
-
- <table border="0" cellspacing="0" cellpadding="0">
- <tbody><tr>
- <th width="76"> <img src="images/sn-post/icon_5.gif"/> 附件名称:</th>
- <td width="376">$attach['filename']
- </td>
- </tr>
- <tr>
- <th> <img src="images/sn-post/icon_5.gif"/> 附件大小:</th>
- <td>$attach[attachsize]</td>
- </tr>
-
- <tr>
- <th> <img src="images/sn-post/icon_5.gif"/> 上传时间:</th>
- <td>$attach[dateline]</td>
- </tr>
- <tr>
- <th> <img src="images/sn-post/icon_5.gif"/> 下载次数:</th>
- <td>$attach[downloads]</td>
- </tr>
- <tr>
- <th> <img src="images/sn-post/icon_5.gif"/> 下载地址:</th>
- <td><a href="attachment.php?aid=$attach[aid]" target="_blank"><img src="images/attachicons/ptxz.gif" border="0" alt="以普通方式下载 $attach[filename] 文件" /> </a>
- <script language="javascript">
- var ss=window.location.protocol;
- var s=window.location.host;
- var thunder=ss+"//"+s + "/attachment.php?aid=$attach[aid]&k=$k&t=$timestamp";
- var thunder_url = thunder;
- var thunder_pid = "43383";//这里改为你自己的联盟号
- var restitle = "";
- document.write('<a href="#" thunderHref="' + ThunderEncode(thunder_url) + '" thunderPid="' + thunder_pid + '" thunderResTitle="' + restitle + '" onClick="return OnDownloadClick_Simple(this,2)" oncontextmenu="ThunderNetwork_SetHref(this)"><img src="images/attachicons/xlxz.gif" border="0" alt="迅雷高速下载$attach[filename]" /></a> ');
- </script>
- </td>
- </tr>
- </table>
- </div>
- <!--<dt>
- $attach[attachicon]
- <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
- <em>($attach[attachsize])</em>
- </dt>// End -->
- <dd>
- <p>
- <!-- $attach[dateline], {lang downloads}: $attach[downloads] // End -->
复制代码 找到-
- $attach[attachicon] <span style="white-space: nowrap" id="attach_$attach[aid]" onmouseover="showMenu(this.id)"><a href="attachment.php?aid=$attach[aid]" target="_blank"><strong>$attach[filename]</strong></a> ($attach[attachsize])</span>
- <div class="t_attach" id="attach_$attach[aid]_menu" style="position: absolute; display: none">$attach[attachicon] <a href="attachment.php?aid=$attach[aid]" target="_blank"><strong>$attach[filename]</strong></a> ($attach[attachsize])
- <!--{if $attach['description']}-->$attach[description]
- <!--{/if}-->
- {lang downloads}: $attach[downloads]
复制代码 后面增加-
- <!--{if in_array($groupid, array('19','20','21' && $adminid)) || $discuz_uid == $attach['uid']}-->
- [<a href="misc.php?action=viewattachdownloadlog&aid=$attach[aid]" target="_blank">下载名单</a>]
- <!--{/if}-->
- <!--{if fileext($attach[filename]) == 'torrent'}-->
- [<a href="track.php?aid=$attach[aid]" target="_blank" ><font color="brown">查看资源</font></a>]
- <!--{/if}-->
复制代码 查找
- <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
复制代码 一共有7处,查找最后一个,也就是第七处下面的下面添加- <!--{if $attach['isbt']}--><dt>
- <div class="ad_text" title=" $attach[filename] —— BT种子信息">
- <table cellspacing="0" cellpadding="0" width="100%" border=0>
- <tbody>
- <tr><td class="nums" align="center">服务器名:</td><td>$attach[announce]</td></tr>
- <tr><td class="nums" align="center">建立日期:</td><td>$attach[btdata]</td></tr>
- <!--{if $attach[btname]}--><tr><td class="nums" align="center">目 录:</td><td>$attach[btname]</td></tr><!--{/if}-->
- <tr><td class="nums" align="center">文 件:</td><td>$attach[files]</td></tr>
- <tr><td class="nums" align="center">合计大小:</td><td><b style="color:red">$attach[allsize]</b></td></tr>
- </tbody>
- </table>
- </div>
- </dt><!--{/if}-->
复制代码 =======================================
4.修改misc.php
=======================================
找到-
- include template('attachpay_view');
复制代码 后面增加- //img downloadlog begin
- } elseif($action == 'viewattachdownloadlog') {
- $loglist = array();
- $query = $db->query("SELECT a.*, m.username FROM {$tablepre}attachdownloadlog a
- LEFT JOIN {$tablepre}members m USING (uid)
- WHERE aid='$aid' ORDER BY dateline");
- while($log = $db->fetch_array($query)) {
- $log['dateline'] = gmdate("$dateformat $timeformat", $log['dateline'] + $timeoffset * 3600);
- $log['lastdateline'] = gmdate("$dateformat $timeformat", $log['lastdateline'] + $timeoffset * 3600);
- $loglist[] = $log;
- }
- $numquery = $db->query("select count(*) as rncts from {$tablepre}attachdownloadlog WHERE aid='$aid'");
- $data = @mysql_fetch_array($numquery);
- $times = $data[rncts];
- include template('attachdownloads_log');
- //img downloadlog end
复制代码 ============================================
5.修改attchment.php
============================================
找到-
- $db->query("UPDATE {$tablepre}attachments SET downloads=downloads+'1' WHERE aid='$aid'", 'UNBUFFERED');
复制代码 后面增加
- //img downloadlog begin
- $query2 = $db->query("SELECT * FROM {$tablepre}attachdownloadlog WHERE uid='$discuz_uid' AND aid='$aid'");
- $row = $db->num_rows($query2);
- if($row) {
- $db->query("UPDATE {$tablepre}attachdownloadlog SET times=times+'1', lastdateline='$timestamp' WHERE uid='$discuz_uid' AND aid='$aid'", 'UNBUFFERED');
- }else{
- $db->query("INSERT INTO {$tablepre}attachdownloadlog (uid, aid, authorid, times, dateline, lastdateline)
- VALUES ('$discuz_uid', '$aid', '$attach[uid]', '1', '$timestamp', '$timestamp')");
- }
- //img downloadlog end
复制代码
============================================
6.运行download_log_sql_install.php或者直接操作数据库增加下表
============================================
-
- DROP TABLE IF EXISTS `cdb_attachdownloadlog`;
- CREATE TABLE IF NOT EXISTS `cdb_attachdownloadlog` (
- `uid` mediumint(8) unsigned NOT NULL default '0',
- `aid` mediumint(8) unsigned NOT NULL default '0',
- `authorid` mediumint(8) unsigned NOT NULL default '0',
- `times` mediumint(8) unsigned NOT NULL default '0',
- `dateline` int(10) unsigned NOT NULL default '0',
- `lastdateline` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`aid`,`uid`),
- KEY `uid` (`uid`),
- KEY `authorid` (`authorid`)
- );
复制代码
相关的图片或者文件都放压缩包里,上传文件至论坛根目录!就搞定了...
[ 本帖最后由 hoocoo 于 2008-8-18 01:11 编辑 ] |