Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

附件美化+下载名单+BT详情+迅雷快车链接 for DZ 6.1

[复制链接]
hoocoo 发表于 2008-8-14 21:25:28 | 显示全部楼层 |阅读模式
插件发布
插件名称: 附件美化+下载名单+BT种子显示详细资源信息+迅雷专用链
插件来源:
适用版本: Discuz! 6.1
语言编码: GBK简体 
最后更新时间:
插件作者: 不清楚
插件简介: 附件美化+下载名单+BT种子显示详细资源信息+迅雷快车专用链
我不是作者,我也不会写程序
不过最近迷上了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
======================================

找到

  1. <h4>{lang attachment}</h4>
复制代码
过滤掉或者删除掉,如下...

  1. <!-- <h4>{lang attachment}</h4> // End -->
复制代码
找到以下代码:

  1. <script type="text/javascript" src="include/javascript/viewthread.js"></script>
  2. <script type="text/javascript">zoomstatus = parseInt($zoomstatus);</script>
复制代码
在这个后面加上以下代码:

  1. <script src='http://pstatic.xunlei.com/js/webThunderDetect.js'></script>
  2. <script src='http://pstatic.xunlei.com/js/base64.js'></script>
  3. <script src='http://pstatic.xunlei.com/js/thunderForumLinker.js'></script>
  4. <script language="javascript">
  5. var thunderPid="43383";//这里改为你自己的联盟号
  6. function outPutThunder()
  7. {
  8. 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;}}

  9. var tagEx=arguments[2]?arguments[2]:'';
  10. var thunderURL=ThunderEncode(th_href);
  11. var thunderRes="";
  12. var thunderName=thunderCh+(til?("_"+til):"");

  13. 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>");
  14. }
  15. </script>
复制代码
======================================
2. 修改attachment.func.php
======================================

查找
  1. $extension = strtolower(fileext($attach['filename']));
复制代码
在其下面添加
  1. $extension == 'torrent' ? $attach['isbt'] = 1 : $attach['isbt'] = 0;
复制代码
接着 查找
  1. $attach['dateline'] = gmdate("$dateformat $timeformat", $attach['dateline'] + $timeoffset * 3600);
复制代码
在其下面添加
  1. if ($attach['isbt']) {
  2. $attach_num++;
  3. $btfilename="./".$attach['url']."/".$attach['attachment'];
  4. if ($attach_num ==1)
  5. {
  6. require_once DISCUZ_ROOT.'./plugins/bt_publish_page/BDecode.php';
  7. require_once DISCUZ_ROOT.'./plugins/bt_publish_page/BEncode.php';
  8. function announceoutput($array) {
  9. if (!isset($array["peers"][0])) {
  10. echo "Not a tracker announce block. Falling back on classic.<BR><BR>";
  11. classicoutput($array, "(Not checked)");
  12. exit;
  13. }
  14. echo "<H2>Client configuration options</H2>";
  15. echo "<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2> ";
  16. foreach ($array as $left => $right) {
  17. if ($left == "peers")
  18. continue;
  19. if (is_array($right))
  20. $myright = "<I>Error</I>";
  21. else
  22. $myright = $right;
  23. echo "<TR><TD ALIGN=RIGHT>".$left."</TD><TD>".$myright."</TD></TR>\n";
  24. }
  25. echo "</TABLE><BR><H2>eers</H2><RE>";
  26. foreach ($array["peers"] as $data) {
  27. if (!is_array($data)) // special case: [0] == true means empty list
  28. {
  29. echo "(Empty results)\n";
  30. break;
  31. }
  32. echo bin2hex($data["peer id"])." at ".$data["ip"].":".$data["port"]."\n";
  33. }
  34. echo "</PRE>";
  35. }

  36. function classicoutput($array, $infohash) {
  37. if (isset($array["info"]["pieces"]))
  38. $array["info"]["pieces"] = "<i>Checksum data (" . strlen ($array["info"]["pieces"]) / 20 . " pieces)</i>";
  39. }

  40. function escapeURL($url) {
  41. $ret = "";
  42. $i=0;
  43. while (strlen($url) > $i) {
  44. $ret .= "%".$url[$i].$url[$i + 1];
  45. $i+=2;
  46. }
  47. return $ret;
  48. }

  49. function cleaner($array) {
  50. if (!is_array($array))
  51. return $array;
  52. $newarray = array();
  53. foreach($array as $left => $right) {
  54. if (is_string($left))
  55. $newleft = stringcleaner(stripslashes($left));
  56. else
  57. $newleft = $left;

  58. if (is_string($right))
  59. $newright = stringcleaner($right);
  60. else if (is_array($right))
  61. $newright = cleaner($right);
  62. else
  63. $newright = $right;

  64. $newarray[$newleft] = $newright;
  65. }
  66. return $newarray;
  67. }

  68. function stringcleaner($str) {
  69. $len = strlen($str);
  70. for ($i=0; $i < $len; $i ++) {
  71. if (ord($str[$i]) < 32 || ord($str[$i]) > 128)
  72. return "<B>".bin2hex($str)."</B>";
  73. }
  74. return $str;
  75. }
  76. }

  77. $fd = @fopen($btfilename, "rb");
  78. if (!$fd) {
  79. showmessage("该附件可能已被删除");
  80. }

  81. $alltorrent = fread($fd, filesize($btfilename));
  82. fclose($fd);
  83. $array = BDecode($alltorrent);
  84. $infohash = "<I>Not applicable</I>";

  85. if (isset($array["info"]))
  86. if (is_array($array["info"])) {
  87. if (function_exists("sha1"))
  88. $infohash = sha1(BEncode($array["info"]));
  89. else
  90. $infohash = "(PHP 4.3.0 or greater is required for hashing)</TT><BR>";
  91. }

  92. if (isset($array["creation date"])) {
  93. if (is_numeric($array["creation date"]))
  94. $data=date("Y 年 m 月 d 日", $array["creation date"]);
  95. else
  96. $data=$array["creation date"];
  97. }
  98. $info = $array["info"]; // I'll need it

  99. if (isset($info["files"])) {
  100. foreach ($info["files"] as $file) {
  101. if (isset($file["path"][1])) {
  102. $files.=$file["path"][0];
  103. for ($i=1; isset($file["path"][$i]); $i++)
  104. $files.="/".$file["path"][$i];
  105. }
  106. else {
  107. $files.=$file["path"][0];
  108. }
  109. $files.= "   <font color='blue'>(".sizecount($file["length"]).")</font><BR>";
  110. $allsize=$allsize+$file["length"];
  111. }
  112. }
  113. else {
  114. $files=$info["name"]."   <font color='blue'>(".sizecount($info["length"]).")</font>";
  115. $info["name"]="";
  116. $allsize=$info["length"];
  117. }
  118. $allsize=sizecount($allsize);

  119. $attach['announce'] = $array["announce"];
  120. $attach['btdata'] = $data;
  121. $attach['btname'] = $info["name"];
  122. $attach['files'] = $files;
  123. $attach['allsize'] = $allsize;
  124. //数组初始化
  125. $array["announce"]='';
  126. $data='';
  127. $info["name"]='';
  128. $files='';
  129. $allsize='';

  130. $postlist[$attach['pid']]['attachments'][$attach['aid']][$attach['announce']][$attach['btdata']][$attach['btname']][$attach['files']][$attach['allsize']] = $attach;
  131. }
  132. else
  133. {
复制代码
再查找
  1. $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
复制代码
在其下面添加
  1. }
  2. //$postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
复制代码
======================================
3. 修改discuzcode.htm
======================================

找到
  1. global $attachrefcheck, $extcredits, $creditstrans, $ftp, $thumbstatus;
复制代码
共有两处,都需要修改
在分号前面加上“, $groupid, $adminid, $discuz_uid”,如下...

  1. global $attachrefcheck, $extcredits, $creditstrans, $ftp, $thumbstatus, $groupid, $adminid, $discuz_uid;
复制代码
找到

  1. <dt>
  2.                          $attach[attachicon]
  3.                         <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
  4.                         <em>($attach[attachsize])</em>
  5.                 </dt>// End -->
  6.                 <dd>
  7.                         <p>
  8.                                 <!-- $attach[dateline], {lang downloads}: $attach[downloads]
复制代码
将其替换成

  1. <div class="mainbox">
  2.         <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>
  3.                                          
  4.                                 
  5.         <table border="0" cellspacing="0" cellpadding="0">
  6.                                 <tbody><tr>
  7.                         <th width="76">  <img src="images/sn-post/icon_5.gif"/>  附件名称:</th>
  8.                         <td width="376">$attach['filename']
  9. </td>
  10.                 </tr>
  11.                                         <tr>
  12.                         <th>  <img src="images/sn-post/icon_5.gif"/>  附件大小:</th>
  13.                         <td>$attach[attachsize]</td>
  14.                                         </tr>
  15.                                        
  16.                 <tr>
  17.                         <th>  <img src="images/sn-post/icon_5.gif"/>  上传时间:</th>
  18.                         <td>$attach[dateline]</td>
  19.                 </tr>
  20.         <tr>
  21.                         <th>  <img src="images/sn-post/icon_5.gif"/>  下载次数:</th>
  22.                         <td>$attach[downloads]</td>
  23.                 </tr>        
  24.          <tr>
  25.                         <th>  <img src="images/sn-post/icon_5.gif"/>  下载地址:</th>
  26.                         <td><a href="attachment.php?aid=$attach[aid]" target="_blank"><img src="images/attachicons/ptxz.gif" border="0" alt="以普通方式下载 $attach[filename] 文件" /> </a>
  27. <script language="javascript">
  28. var ss=window.location.protocol;
  29. var s=window.location.host;
  30. var thunder=ss+"//"+s + "/attachment.php?aid=$attach[aid]&k=$k&t=$timestamp";
  31. var thunder_url = thunder;
  32. var thunder_pid = "43383";//这里改为你自己的联盟号
  33. var restitle = "";
  34. 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> ');
  35. </script>
  36. </td>
  37.                 </tr>        
  38. </table>
  39. </div>
  40.                 <!--<dt>
  41.                          $attach[attachicon]
  42.                         <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
  43.                         <em>($attach[attachsize])</em>
  44.                 </dt>// End -->
  45.                 <dd>
  46.                         <p>
  47.                                 <!-- $attach[dateline], {lang downloads}: $attach[downloads] // End -->

复制代码
找到

  1. $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>
  2.                         <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])

  3.                         <!--{if $attach['description']}-->$attach[description]
  4. <!--{/if}-->
  5.                         {lang downloads}: $attach[downloads]
复制代码
后面增加

  1. <!--{if in_array($groupid, array('19','20','21' && $adminid)) || $discuz_uid == $attach['uid']}-->
  2.                                          [<a href="misc.php?action=viewattachdownloadlog&aid=$attach[aid]" target="_blank">下载名单</a>]
  3.                                 <!--{/if}-->
  4. <!--{if fileext($attach[filename]) == 'torrent'}-->
  5. [<a href="track.php?aid=$attach[aid]" target="_blank" ><font color="brown">查看资源</font></a>]
  6. <!--{/if}-->
复制代码
查找

  1. <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
复制代码
一共有7处,查找最后一个,也就是第七处下面的

  1. </dd>
复制代码
下面添加
  1. <!--{if $attach['isbt']}--><dt>
  2. <div class="ad_text" title=" $attach[filename] —— BT种子信息">
  3. <table cellspacing="0" cellpadding="0" width="100%" border=0>
  4. <tbody>
  5. <tr><td class="nums" align="center">服务器名:</td><td>$attach[announce]</td></tr>
  6. <tr><td class="nums" align="center">建立日期:</td><td>$attach[btdata]</td></tr>
  7. <!--{if $attach[btname]}--><tr><td class="nums" align="center">目  录:</td><td>$attach[btname]</td></tr><!--{/if}-->
  8. <tr><td class="nums" align="center">文  件:</td><td>$attach[files]</td></tr>
  9. <tr><td class="nums" align="center">合计大小:</td><td><b style="color:red">$attach[allsize]</b></td></tr>
  10. </tbody>
  11. </table>
  12. </div>
  13. </dt><!--{/if}-->
复制代码
=======================================
4.修改misc.php
=======================================

找到

  1. include template('attachpay_view');
复制代码
后面增加
  1. //img downloadlog begin
  2. } elseif($action == 'viewattachdownloadlog') {
  3.         $loglist = array();
  4.         $query = $db->query("SELECT a.*, m.username FROM {$tablepre}attachdownloadlog a
  5.                 LEFT JOIN {$tablepre}members m USING (uid)
  6.                 WHERE aid='$aid' ORDER BY dateline");
  7.         while($log = $db->fetch_array($query)) {
  8.                 $log['dateline'] = gmdate("$dateformat $timeformat", $log['dateline'] + $timeoffset * 3600);
  9.                 $log['lastdateline'] = gmdate("$dateformat $timeformat", $log['lastdateline'] + $timeoffset * 3600);
  10.                 $loglist[] = $log;
  11.         }
  12.         $numquery = $db->query("select count(*) as rncts from {$tablepre}attachdownloadlog WHERE aid='$aid'");
  13.         $data = @mysql_fetch_array($numquery);
  14.         $times = $data[rncts];
  15.         include template('attachdownloads_log');
  16. //img downloadlog end

复制代码
============================================
5.修改attchment.php
============================================
找到

  1. $db->query("UPDATE {$tablepre}attachments SET downloads=downloads+'1' WHERE aid='$aid'", 'UNBUFFERED');
复制代码
后面增加

  1. //img downloadlog begin
  2.   $query2 = $db->query("SELECT * FROM {$tablepre}attachdownloadlog WHERE uid='$discuz_uid' AND aid='$aid'");
  3.   $row = $db->num_rows($query2);
  4.   if($row) {
  5.    $db->query("UPDATE {$tablepre}attachdownloadlog SET times=times+'1', lastdateline='$timestamp' WHERE uid='$discuz_uid' AND aid='$aid'", 'UNBUFFERED');
  6.   }else{
  7.    $db->query("INSERT INTO {$tablepre}attachdownloadlog (uid, aid, authorid, times, dateline, lastdateline)
  8.    VALUES ('$discuz_uid', '$aid', '$attach[uid]', '1', '$timestamp', '$timestamp')");
  9.   }
  10. //img downloadlog end
复制代码

============================================
6.运行download_log_sql_install.php或者直接操作数据库增加下表
============================================



  1. DROP TABLE IF EXISTS `cdb_attachdownloadlog`;
  2. CREATE TABLE IF NOT EXISTS `cdb_attachdownloadlog` (
  3.   `uid` mediumint(8) unsigned NOT NULL default '0',
  4.   `aid` mediumint(8) unsigned NOT NULL default '0',
  5.   `authorid` mediumint(8) unsigned NOT NULL default '0',
  6.   `times` mediumint(8) unsigned NOT NULL default '0',
  7.   `dateline` int(10) unsigned NOT NULL default '0',
  8.   `lastdateline` int(10) unsigned NOT NULL default '0',
  9.   PRIMARY KEY  (`aid`,`uid`),
  10.   KEY `uid` (`uid`),
  11.   KEY `authorid` (`authorid`)
  12. );
复制代码


相关的图片或者文件都放压缩包里,上传文件至论坛根目录!就搞定了...

[ 本帖最后由 hoocoo 于 2008-8-18 01:11 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
 楼主| hoocoo 发表于 2008-8-14 21:26:04 | 显示全部楼层
发个贴真麻烦
搞了大半个小时

[ 本帖最后由 hoocoo 于 2008-8-14 21:34 编辑 ]

评分

1

查看全部评分

回复

使用道具 举报

移花接木 发表于 2008-8-14 21:45:57 | 显示全部楼层
搬个凳子来坐坐.!
回复

使用道具 举报

booko2006 发表于 2008-8-14 21:47:47 | 显示全部楼层
发贴,帮嫩顶顶~~
回复

使用道具 举报

liuchunlin 发表于 2008-8-14 22:02:13 | 显示全部楼层
,哈哈

[ 本帖最后由 liuchunlin 于 2008-8-14 22:04 编辑 ]
回复

使用道具 举报

 楼主| hoocoo 发表于 2008-8-14 22:04:44 | 显示全部楼层
你就想我的站被关
我不知道把那些东东改掉啊

哈哈
回复

使用道具 举报

米蘭的小鐵匠 发表于 2008-8-14 22:11:19 | 显示全部楼层

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

 楼主| hoocoo 发表于 2008-8-14 22:16:39 | 显示全部楼层
你那个种子信息还得点击查看
我这个是直接显示出种子信息的
回复

使用道具 举报

米蘭的小鐵匠 发表于 2008-8-14 23:24:11 | 显示全部楼层
要美观要和谐...
回复

使用道具 举报

windfy 发表于 2008-8-15 00:16:15 | 显示全部楼层
和6.0的改法一样吗?
你的这个能应用到6.0上吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-3-29 01:43 , Processed in 0.126236 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表