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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] BT发布页1.22[直接显示BT种子详情] For DZ5.5 正式版[2007/05/27]

[复制链接]
wjmwaq 发表于 2007-5-27 19:19:29 | 显示全部楼层 |阅读模式
#############################################
插件名称:BT发布页1.22
适用版本:DZ5.5 正式版 GBK版本
作  者:wjmwaq借助BT发布页1.21版本中的文件,修改出此插件:贴内直接显示BT种子信息
数据升级:无
最后更新:2007/05/27
演  示:
http://bbs.llgoo.com/thread-2193-1-1.html (附件显示注册并且要2点积分,不需要此插件的不要看了)
功能说明:贴内直接显示BT种子信息,版权属于影视帝国
注意事项:必须先安装BT发布页1.21版才能安装此插件。本次修改共修改2个文件,增加一个文件修改文件前请先做好文件备份)

演示:
#############################################


帖子内直接显示种子详细情况安装方法(必须先安装BT发布页1.21版才能安装此插件
BT发布页1.21版:http://bbs.llgoo.com/thread-455-1-1.html
或者https://discuz.dismall.com/thread-461981-1-1.html):

第一步、修改include\attachment.func.php(共2步)
      (1)、查找:
  1. $extension = strtolower(fileext($attach['filename']));
复制代码
下面增加
  1. $extension == 'torrent' ? $attach['isbt'] = 1 : $attach['isbt'] = 0;
复制代码
(2)、查找
  1. include_once template('viewthread_attachlist');
复制代码
上面增加
  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>Peers</H2><PRE>";
  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.       
  37.       function classicoutput($array, $infohash) {
  38.        if (isset($array["info"]["pieces"]))
  39.         $array["info"]["pieces"] = "<i>Checksum data (" . strlen ($array["info"]["pieces"]) / 20 . " pieces)</i>";
  40.       }
  41.       
  42.       function escapeURL($url) {
  43.        $ret = "";
  44.        $i=0;
  45.        while (strlen($url) > $i) {
  46.         $ret .= "%".$url[$i].$url[$i + 1];
  47.         $i+=2;
  48.        }
  49.        return $ret;
  50.       }
  51.       
  52.       function cleaner($array) {
  53.        if (!is_array($array))
  54.         return $array;
  55.        $newarray = array();
  56.        foreach($array as $left => $right) {
  57.         if (is_string($left))
  58.          $newleft = stringcleaner(stripslashes($left));
  59.         else
  60.          $newleft = $left;
  61.          
  62.         if (is_string($right))
  63.          $newright = stringcleaner($right);
  64.         else if (is_array($right))
  65.          $newright = cleaner($right);
  66.         else
  67.          $newright = $right;
  68.       
  69.         $newarray[$newleft] = $newright;
  70.        }
  71.        return $newarray;
  72.       }
  73.       
  74.       function stringcleaner($str) {
  75.        $len = strlen($str);
  76.        for ($i=0; $i < $len; $i ++) {
  77.         if (ord($str[$i]) < 32 || ord($str[$i]) > 128)
  78.          return "<B>".bin2hex($str)."</B>";
  79.        }
  80.        return $str;
  81.       }
  82.     }
  83.    
  84.    $fd = @fopen($btfilename, "rb");
  85.    if (!$fd) {
  86.     showmessage("该附件可能已被删除");
  87.    }
  88.    
  89.    $alltorrent = fread($fd, filesize($btfilename));
  90.    fclose($fd);
  91.    $array = BDecode($alltorrent);
  92.    $infohash = "<I>Not applicable</I>";
  93.    
  94.    if (isset($array["info"]))
  95.     if (is_array($array["info"])) {
  96.      if (function_exists("sha1"))
  97.       $infohash = sha1(BEncode($array["info"]));
  98.      else
  99.       $infohash = "(PHP 4.3.0 or greater is required for hashing)</TT><BR>";
  100.     }
  101.    
  102.    if (isset($array["creation date"])) {
  103.     if (is_numeric($array["creation date"]))
  104.      $data=date("Y 年 m 月 d 日", $array["creation date"]);
  105.     else
  106.      $data=$array["creation date"];
  107.    }
  108.    $info = $array["info"]; // I'll need it
  109.    
  110.    if (isset($info["files"])) {
  111.     foreach ($info["files"] as $file) {
  112.      if (isset($file["path"][1])) {
  113.       $files.=$file["path"][0];
  114.       for ($i=1; isset($file["path"][$i]); $i++)
  115.        $files.="/".$file["path"][$i];
  116.      }
  117.      else {
  118.       $files.=$file["path"][0];
  119.      }
  120.      $files.= "   <font color='blue'>(".sizecount($file["length"]).")</font><BR>";
  121.      $allsize=$allsize+$file["length"];
  122.     }
  123.    }
  124.    else {
  125.     $files=$info["name"]."   <font color='blue'>(".sizecount($info["length"]).")</font>";
  126.     $info["name"]="";
  127.     $allsize=$info["length"];
  128.    }
  129.    $allsize=sizecount($allsize);
  130.    $attach['announce'] = $array["announce"];
  131.    $attach['btdata'] = $data;
  132.    $attach['btname'] = $info["name"];
  133.    $attach['files'] = $files;
  134.    $attach['allsize'] = $allsize;
  135.    //数组初始化
  136.    $array["announce"]='';
  137.    $data='';
  138.    $info["name"]='';
  139.    $files='';
  140.    $allsize='';
  141.   }
复制代码
第二步、修改templates\default\viewthread_attachlist.htm(共1步)
     (1)、查找
  1. <!--{if $attach['description']}-->{$attach[description]}<!--{/if}-->
复制代码
有两个,在第二个下面增加
  1. <!--{if $attach['isbt']}-->
  2.   <br>
  3.   {template bt_publish_info}
  4.   <!--{/if}-->
复制代码
第三步、上传upload.rar中的附件文件到模版目录

[ 本帖最后由 wjmwaq 于 2007-5-27 20:26 编辑 ]

评分

1

查看全部评分

 楼主| wjmwaq 发表于 2007-5-27 19:20:24 | 显示全部楼层
沙发。。。。。。。。
回复

使用道具 举报

小铭铭 发表于 2007-5-27 19:21:30 | 显示全部楼层
地板               
回复

使用道具 举报

 楼主| wjmwaq 发表于 2007-5-27 19:24:59 | 显示全部楼层
这么快就有人下了啊
回复

使用道具 举报

Gadon 发表于 2007-5-27 19:57:07 | 显示全部楼层
好像不错。类似BTCHINA论坛的那种样子的么?
回复

使用道具 举报

Gadon 发表于 2007-5-27 20:03:57 | 显示全部楼层
viewthread_attachlist.htm
搜索的那段字符有两个位置,都添加么?
回复

使用道具 举报

Gadon 发表于 2007-5-27 20:15:31 | 显示全部楼层
昏倒。。我修改了之后。凡是有BT种子附件的帖子都是空白页了。
回复

使用道具 举报

 楼主| wjmwaq 发表于 2007-5-27 20:18:03 | 显示全部楼层
原帖由 Gadon 于 2007-5-27 20:03 发表
viewthread_attachlist.htm
搜索的那段字符有两个位置,都添加么?

在第二个下面加。
回复

使用道具 举报

Gadon 发表于 2007-5-27 20:20:38 | 显示全部楼层
OK了~感谢楼主
我第一次是在两个地方都添加才会报错的。呵呵

[ 本帖最后由 Gadon 于 2007-5-27 20:23 编辑 ]
回复

使用道具 举报

 楼主| wjmwaq 发表于 2007-5-27 20:24:10 | 显示全部楼层
原帖由 Gadon 于 2007-5-27 20:20 发表
幸好有备份。不然就糟糕了。。。


应该不会下像你的问题的,请仔细阅读安装说明,必须要先安装《BT发布页1.21版后才能装这个的》
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-17 14:05 , Processed in 0.423121 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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