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

 找回密码
 立即注册
搜索

[发布] Discuz x3可用的电驴(电骡)emule,附完整的修改后文件

[复制链接]
adds 发表于 2013-5-19 19:46:03 | 显示全部楼层 |阅读模式
本帖最后由 adds 于 2013-6-28 12:08 编辑

本文件编辑于2013.6.24,附件为discuz x3.0 6.20的GBK版本默认模板,其他请参考修改说明。已经由adds亲测可用。

修改说明:
=====================
1, 编辑 source/function/function_discuzcode.php 找到这几行:
if($allowbbcode) {
if(strpos($msglower, 'ed2k://') !== FALSE) {
$message = preg_replace("/ed2k:\/\/(.+?)\//e", "parseed2k('\\1')", $message);
}
}
修改为:
if($allowbbcode) {
if(strpos($msglower, 'ed2k://') !== FALSE) {
$message = preg_replace("/\s*\[emule\](.+?)\[\/emule\]\s*/ies", "emu('\\1')", $message);
}
}
2, 在这个文件末尾 ?> 之前增加下面的函数:

///电驴
function emu($code) {
$code = htmlspecialchars(str_replace('\\"', '"', preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $code)));
$view = '';$total = 0;
$searcharray = explode("\n",$code);
$view = "<div class=\"emulejuse\"><center><h5>eMule专用下载链接,您必须安装电驴、迅雷、快车、旋风等下载软件才能点击下载</h5></center><table align=center id=\"emuletable\">";
foreach($searcharray as $emule) {
if($emule!='' && eregi("^ed2k:\/\/",$emule)){
$emule = dhtmlspecialchars(trim($emule));
$emule_array = explode("|",$emule);
$total += $emule_array[3];
$totalper = esizecount($emule_array[3]);
$view.="<tr><td width=\"80%\"><input type=\"checkbox\"name=\"em$codecount\"value=\"$emule\"onclick=\"em_size('em$codecount');\" checked=\"checked\"><span class=\"smalltextjuse\"><a href=\"$emule\"><script language=\"javascript\">document.write(unescape(decodeURIComponent(\"$emule_array[2]\")));</script></a></span></td><td align=\"right\"><span class=\"smalltextjuse\">$totalper</span></td></tr>";
} else {
$view.="<tr><td colspan=\"2\" class=\"smalltxt\" align=\"center\">下载地址连接错误</td></tr>";
}
}
$total=esizecount($total);
$view.="<tr><td align=\"left\" width=\"80%\"><input type=\"checkbox\"id=\"checkall_em$codecount\"onclick=\"echeckAll('em$codecount',this.checked)\" checked=\"checked\"/><label for=\"checkall_em$codecount\">全选</label><input type=\"button\" value=\"下载选中的文件\" onclick=\"download('em$codecount',0,1)\"><input type=\"button\" value=\"复制选中的链接\" onclick=\"ed2kcopy('em$codecount')\"><div id=\"ed2kcopy_em$codecount\" style=\"position:absolute;height:0px;width:0px;overflow:hidden;\"></div></td><td class=\"smalltxt\" align=\"right\" id=\"size_em$codecount\"><font color=\"red\"><b>$total</b></font></td></tr></table></div><script language=\"javascript\" type=\"text/javascript\" src=\"static/js/emule.js\"></script>";
return $view;
}

function esizecount($filesize) {
if($filesize >= 1099511627776) {
$filesize = round($filesize / 1099511627776 * 100) / 100 . ' TB';
} elseif($filesize >= 1073741824) {
$filesize = round($filesize / 1073741824 * 100) / 100 . ' GB';
} elseif($filesize >= 1048576) {
$filesize = round($filesize / 1048576 * 100) / 100 . ' MB';
} elseif($filesize >= 1024) {
$filesize = round($filesize / 1024 * 100) / 100 . ' KB';
} else {
$filesize = $filesize . ' Bytes';
}
return $filesize;
}

3, 修改模版增加CSS定义. 默认模版的主CSS文件在: template/default/common/common.css 在模版文件尾部增加下面的行:

/********* emule ********/
.emulejuse {
color: #333;
background-color: #e4eaf2;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 3px;
border-top-style: dashed;
border-right-style: dashed;
border-bottom-style: dashed;
border-left-style: solid;
border-top-color: #000;
border-right-color: #000;
border-bottom-color: #000;
border-left-color: #8394B2;
font-size: 11.5px;padding: 1px;
line-height: 1.4em;
width:auto;
margin-top: 6px;
margin-right: auto;
margin-bottom: 6px;
margin-left: auto;
}

.emulejuse h5 {
font-size: 14px;
font-weight: bold;
color: #000;
display: block;
line-height: 1.6em;
margin: 0px;
padding-top: 3px;
padding-right: 0px;
padding-bottom: 3px;
padding-left: 0px;
}

.smalltextjuse {
font-size: 11.5px;
line-height: 1.4em;
}

#emuletable {
width: 100%;
background-color: #EEF2F7;line-height: 1.8em;
border-top: #F4F4F4 1px solid;
border-left: #F4F4F4 1px solid;
}

#emuletable td {
border-right: #F4F4F4 1px solid;
border-bottom: #F4F4F4 1px solid;
}
4, 上传emulejs.js到 static/js/ , 上传bb_emule.gif到static/image/common/
5, 进入后台添加编辑器按钮:
后台–>界面–>编辑器设置–>Discuz! 代码
新增标签:emule
图标文件:bb_emule.gif
例  子:[emule][/emule]
解  释:电驴下载
参数个数:1
参数提示语:
请输入eMule[电骡]的链接地址:
嵌套次数:1
至此, 大功告成
======================

自己会修改请按上面修改吧,不会修改的可以下载附件,含有图标文件,支持一下吧。

emule.fordzX3.0.524.zip

37.54 KB, 下载次数: 143

emule.fordzX3.0.6.20.zip

37.53 KB, 下载次数: 145

回复

使用道具 举报

1314学习网 发表于 2013-5-19 22:01:15 | 显示全部楼层
前排看看怎么样
回复

使用道具 举报

可爱的轩轩 发表于 2013-5-20 09:51:22 | 显示全部楼层
做什么用的?
回复

使用道具 举报

我就爱翡翠 发表于 2013-5-20 10:42:57 | 显示全部楼层
好久都没用过电驴了
回复

使用道具 举报

 楼主| adds 发表于 2013-5-26 21:32:44 | 显示全部楼层
兄弟的小站在用,有更新了第一时间更新。
回复

使用道具 举报

上帝de眼泪 发表于 2013-7-9 10:51:33 | 显示全部楼层
抄袭本人的
回复

使用道具 举报

╰侬鎵爾孩 发表于 2014-6-9 14:11:13 | 显示全部楼层
adds 发表于 2013-5-26 21:32
兄弟的小站在用,有更新了第一时间更新。

楼主可以帮忙设置下么?谢谢了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 15:21 , Processed in 0.125295 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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