请老大修改AL8 附件下載名單 For 6.x为简体版
AL8 附件下載名單 For 6.xAL8 附件下載名單 For 6.0
適用版本: Discuz 6.0, Discuz 6.1, Discuz 6.1F
作者: alan888
演示: [url=http://www.alan888.com/D6/thread-1-1-2.html]http://www.alan888.com/D6/thread-1-1-2.html[/url]
附注:
1. 此插件部份修改源自下帖, 作者: AndyGod
2. 從其他版本升級不用執行下面步驟 (1) 的數據庫升級
3. 下載名單只能顯示於安裝此插件後的下載者, 同時下載次數與顯示下載名單的數量也會有差異
[url]http://www.alan888.com/Discuz/thread-126446-1-7.html[/url]
修改辦法
1. 數據庫升級
[Copy to clipboard] [ - ]CODE:
ALTER TABLE `cdb_attachments` ADD `dl_users` TEXT NOT NULL ;
2. attachment.php
找
[Copy to clipboard] [ - ]CODE:
$db->query("UPDATE {$tablepre}attachments SET downloads=downloads+'1' WHERE aid='$aid'", 'UNBUFFERED');
更換為
[Copy to clipboard] [ - ]CODE:
$query2 = $db->query("SELECT dl_users FROM {$tablepre}attachments WHERE aid='$aid' AND dl_users like '%$discuz_user,%'");
if($db->result($query2, 0)) {
} else {
$db->query("UPDATE {$tablepre}attachments SET downloads=downloads+1 WHERE aid='$aid'", 'UNBUFFERED');
$dl_user = $attach[dl_users].''.$discuz_user.', ';
$dl_user = addslashes($dl_user);
$db->query("UPDATE {$tablepre}attachments SET dl_users='$dl_user' WHERE aid='$aid'");
}
2. misc.php
找
[Copy to clipboard] [ - ]CODE:
} elseif($action == 'customtopics') {
在上面加上
[Copy to clipboard] [ - ]CODE:
} elseif($action == 'viewdluser') {
if(empty($forum['allowview'])) {
if(!$forum['viewperm'] && !$readaccess) {
showmessage('group_nopermission', NULL, 'NOPERM');
} elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) {
showmessage('forum_nopermission', NULL, 'NOPERM');
}
}
if($thread['readperm'] && $thread['readperm'] > $readaccess && !$forum['ismoderator'] && $thread['authorid'] != $discuz_uid) {
showmessage('thread_nopermission', NULL, 'NOPERM');
}
if($forum['password'] && $forum['password'] != $_DCOOKIE['fidpw'.$fid]) {
dheader("Location: {$boardurl}forumdisplay.php?fid=$fid&sid=$sid");
}
$dllistpp = 180; //每頁顯示名單數量
$page = $_GET['page'];
$dl_user = '';
$query = $db->query("SELECT dl_users FROM {$tablepre}attachments WHERE tid=$tid AND aid='$aid'");
$dl_user = $db->result($query, 0);
$dlusername = explode(",", trim($dl_user));
$num = count($dlusername)-1;
$page = max(1, intval($page));
$start_limit = ($page - 1) * $dllistpp;
$multipage = multi($num, $dllistpp, $page, "misc.php?action=viewdluser&tid=$tid&aid=$aid");
$dlusername = @array_slice($dlusername, $start_limit, $dllistpp);
if($dlusername) {
$dllist = $dlid = array();
foreach($dlusername as $dlid) {
$dlid = '<a href="space.php?action=viewpro&username='.rawurlencode(trim($dlid)).'" target="_blank">'.$dlid.'</a>';
$dllist[] = $dlid;
}
}
include template('dluserlist');
3. 修改 discuzcode 模版
找
[Copy to clipboard] [ - ]CODE:
<dl class="t_attachlist">
在上面加上
[Copy to clipboard] [ - ]CODE:
<script type="text/javascript">
function showdllist(aid) {
var obj = document.getElementById('viewdluserframe'+aid);
var url = 'misc.php?action=viewdluser&tid=$attach[tid]&aid='+aid;
showframe(obj, url);
}
function showframe(obj, url) {
if(!obj.innerHTML) {
obj.innerHTML = '<iframe width="100%" align="center" height="30" frameborder="0" scrolling="no" src="'+url+'"></iframe>';
}
if(obj.innerHTML) {
obj.style.display = obj.style.display == '' ? 'none' : '';
}
}
function setframeheight(obj) {
obj.height = obj.contentDocument ? obj.contentDocument.body.scrollHeight + 14 : obj.Document.body.scrollHeight;
}
</script>
找
[Copy to clipboard] [ - ]CODE:
$attach[dateline], {lang downloads}: $attach[downloads]
在下面加上
[Copy to clipboard] [ - ]CODE:
<!--{if $attach[downloads] > 0}-->
<a href="###"><span style="color:{LIGHTTEXT}; font-weight:normal">[下載名單]</span></a>
<!--{/if}-->
找
[Copy to clipboard] [ - ]CODE:
<!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
</dd>
<!--{/if}-->
</dl>
在下面加上
[Copy to clipboard] [ - ]CODE:
<div id="viewdluserframe$attach[aid]" style="width:100%;clear:both;display:none; margin-top:5;"></div>
4. 下載附件 dluserlist 模板解壓後上載至 templates/default 目錄下
5. 往後台 "更新緩存"
~完成~ :o 这个……好像……
我还是路过吧 有空的時候再幫你吧~ 自己找个编码转换器转一下就行了啊,这个应该不难吧。 AL8 附件下载名单 For 6.x
AL8 附件下载名单 For 6.X
适用版本: Discuz 6.0, Discuz 6.1, Discuz 6.1F
作者: alan888
演示: [url=http://www.alan888.com/D6/thread-1-1-2.html]http://www.alan888.com/D6/thread-1-1-2.html[/url]
附注:
1. 此插件部份修改源自AL8Forum, 作者: AndyGod
2. 从其他版本升级不用执行下面步骤 (1) 的数据库升级
3. 下载名单只能显示于安装此插件后的下载者, 同时下载次数与显示下载名单的数量也会有差异
[url=http://www.alan888.com/Discuz/thread-126446-1-7.html]http://www.alan888.com/Discuz/thread-126446-1-7.html[/url]
修改办法
1. 数据库升级[code]ALTER TABLE `cdb_attachments` ADD `dl_users` TEXT NOT NULL ;[/code]2. attachment.php
找[code] $db->query("UPDATE {$tablepre}attachments SET downloads=downloads+'1' WHERE aid='$aid'", 'UNBUFFERED');[/code]更换为[code] $query2 = $db->query("SELECT dl_users FROM {$tablepre}attachments WHERE aid='$aid' AND dl_users like '%$discuz_user,%'");
if($db->result($query2, 0)) {
} else {
$db->query("UPDATE {$tablepre}attachments SET downloads=downloads+1 WHERE aid='$aid'", 'UNBUFFERED');
$dl_user = $attach[dl_users].''.$discuz_user.', ';
$dl_user = addslashes($dl_user);
$db->query("UPDATE {$tablepre}attachments SET dl_users='$dl_user' WHERE aid='$aid'");
}[/code]2. misc.php
找[code]} elseif($action == 'customtopics') {[/code]在上面加上[code]} elseif($action == 'viewdluser') {
if(empty($forum['allowview'])) {
if(!$forum['viewperm'] && !$readaccess) {
showmessage('group_nopermission', NULL, 'NOPERM');
} elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) {
showmessage('forum_nopermission', NULL, 'NOPERM');
}
}
if($thread['readperm'] && $thread['readperm'] > $readaccess && !$forum['ismoderator'] && $thread['authorid'] != $discuz_uid) {
showmessage('thread_nopermission', NULL, 'NOPERM');
}
if($forum['password'] && $forum['password'] != $_DCOOKIE['fidpw'.$fid]) {
dheader("Location: {$boardurl}forumdisplay.php?fid=$fid&sid=$sid");
}
$dllistpp = 180; //每页显示名单数量
$page = $_GET['page'];
$dl_user = '';
$query = $db->query("SELECT dl_users FROM {$tablepre}attachments WHERE tid=$tid AND aid='$aid'");
$dl_user = $db->result($query, 0);
$dlusername = explode(",", trim($dl_user));
$num = count($dlusername)-1;
$page = max(1, intval($page));
$start_limit = ($page - 1) * $dllistpp;
$multipage = multi($num, $dllistpp, $page, "misc.php?action=viewdluser&tid=$tid&aid=$aid");
$dlusername = @array_slice($dlusername, $start_limit, $dllistpp);
if($dlusername) {
$dllist = $dlid = array();
foreach($dlusername as $dlid) {
$dlid = '<a href="space.php?action=viewpro&username='.rawurlencode(trim($dlid)).'" target="_blank">'.$dlid.'</a>';
$dllist[] = $dlid;
}
}
include template('dluserlist');[/code]3. 修改 discuzcode 模版
找[code]<dl class="t_attachlist">[/code]在上面加上[code]<script type="text/javascript">
function showdllist(aid) {
var obj = document.getElementById('viewdluserframe'+aid);
var url = 'misc.php?action=viewdluser&tid=$attach[tid]&aid='+aid;
showframe(obj, url);
}
function showframe(obj, url) {
if(!obj.innerHTML) {
obj.innerHTML = '<iframe width="100%" align="center" height="30" frameborder="0" scrolling="no" src="'+url+'"></iframe>';
}
if(obj.innerHTML) {
obj.style.display = obj.style.display == '' ? 'none' : '';
}
}
function setframeheight(obj) {
obj.height = obj.contentDocument ? obj.contentDocument.body.scrollHeight + 14 : obj.Document.body.scrollHeight;
}
</script>[/code]找[code]$attach[dateline], {lang downloads}: $attach[downloads][/code]在下面加上[code] <!--{if $attach[downloads] > 0}-->
<a href="###"><span style="color:{LIGHTTEXT}; font-weight:normal">[下载名单]</span></a>
<!--{/if}-->[/code]找[code] <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
</dd>
<!--{/if}-->
</dl>[/code]在下面加上[code]<div id="viewdluserframe$attach[aid]" style="width:100%;clear:both;display:none; margin-top:5;"></div>[/code]4. 下载附件 dluserlist 模板解压后上载至 templates/default 目录下
5. 往后台 "更新缓存"
~完成~ 路过飘一下
页:
[1]