史萊姆論壇

史萊姆論壇 (http://forum.slime.com.tw/)
-   論壇程式討論區 (http://forum.slime.com.tw/f79.html)
-   -   在快速回覆中上傳附件 (http://forum.slime.com.tw/thread151925.html)

貝斯特 2005-06-21 03:05 PM

在快速回覆中上傳附件
 
這個套件修改後可以在快速回覆中管理或上傳附件,
修改也很簡單,只需幾分鐘的時間就可以完成了,效果請看附件的圖片。

###### 安裝資訊 ######
需修改的檔案: 1
需修改的模板: 1
需新增的模板: 2
(套件修改時間: 2-5 分鐘)
##################

編輯檔案 showthread.php

###### 搜尋: ######

PHP代碼:
'bbcodecache',



##### 在下面加上: ######

PHP代碼:
'attachmentcache',



###### 搜尋: ######

PHP代碼:
'showthread_quickreply',



##### 在下面加上: ######

PHP代碼:
'showthread_attachment',
'showthread_attachmentbit',



##### 搜尋: ######

PHP代碼:
// *********************************************************************************
// build quick reply if appropriate
if ($SHOWQUICKREPLY)



在上面加上:

PHP代碼:
// get attachment options
require_once('./includes/functions_file.php');
$attachtypes = unserialize($datastore['attachmentcache']);
$inimaxattach = fetch_max_attachment_size();

$maxattachsize = vb_number_format($inimaxattach, 1, true);
$attachcount = 0;
if ($forumperms & CANPOSTATTACHMENT AND $bbuserinfo['userid'])
{
if (!$posthash OR !$poststarttime)
{
$poststarttime = TIMENOW;
$posthash = md5($poststarttime . $bbuserinfo['userid'] . $bbuserinfo['salt']);
}
else
{
$currentattaches = $DB_site->query("
SELECT filename, filesize
FROM " . TABLE_PREFIX . "attachment
WHERE posthash = '" . addslashes($newpost['posthash']) . "'
AND userid = $bbuserinfo[userid]
");

while ($attach = $DB_site->fetch_array($currentattaches))
{
$attach['extension'] = strtolower(file_extension($attach['filename']));
$attach['filename'] = htmlspecialchars_uni($attach['filename']);
$attach['filesize'] = vb_number_format($attach['filesize'], 1, true);
$show['attachmentlist'] = true;
eval('$attachments .= "' . fetch_template('showthread_attachmentbit') . '";');
}
}
$attachurl = "f=$foruminfo[forumid]";
eval('$showthread_attachmentoption = "' . fetch_template('showthread_attachment') . '";');
}
else
{
$showthread_attachmentoption = '';
}



---------------------------------------------------


########## 模板編輯 ############

編輯 showthread_quickreply 模板

##### 搜尋 #####

HTML代碼:
<label for="qr_quickreply"><input type="checkbox" name="quickreply" value="1" id="qr_quickreply" accesskey="w" tabindex="4" />$vbphrase[quote_message_in_reply]</label> </div> </fieldset> </td> </tr>

##### 在下面加上 #####

HTML代碼:
<!--- showthread quickreply attachement ---> <tr> <td align="$stylevar[left]">
$showthread_attachmentoption
</td> </tr> <!--- showthread quickreply attachement --->

#-----------------------

##### 搜尋 #####

HTML代碼:
<input type="submit" class="button" value="$vbphrase[post_quick_reply]" accesskey="s" title="(Alt + S)" name="sbutton" tabindex="2" onclick="this.form.clickedelm.value=this.value" />

##### 在上面加上 #####

HTML代碼:
<input type="hidden" name="posthash" value="$posthash" /> <input type="hidden" name="poststarttime" value="$poststarttime" />

########## 新增模板 ############

1. showthread_attachment

HTML代碼:
<fieldset class="fieldset"> <legend>$vbphrase[attach_files]</legend> <div style="padding:$stylevar[formspacer]px"> <div style="margin-bottom:$stylevar[formspacer]px"> <div>$vbphrase[valid_file_extensions]: $attachtypes[extensions]</div> </div> <div style="margin-bottom:$stylevar[formspacer]px" id="attachlist"> <if condition="$show['attachmentlist']">
$attachments
</if> </div> <div> <script type="text/javascript"> <!--
document.write('<input type="button" class="button" tabindex="1" style="font-weight:normal" value="$vbphrase[manage_attachments]" title="$vbphrase[add_edit_files_attached]" onclick="manageattachments(\'newattachment.php?$session[sessionurl]$attachurl&amp;poststarttime=$poststarttime&amp;posthash=$posthash\', 480, 480, \'$postid\')" />');
//--> </script> <noscript> <a href="newattachment.php?$session[sessionurl]$attachurl&amp;poststarttime=$poststarttime&amp;posthash=$posthash" target="manageattach" title="$vbphrase[add_edit_files_attached]" tabindex="1"><strong>$vbphrase[manage_attachments]</strong></a> </noscript> </div> </div> </fieldset>

2. showthread_attachmentbit

HTML代碼:
<div style="margin:2px"><img class="inlineimg" src="$stylevar[imgdir_attach]/$attach[extension].gif" alt="$attach[filename]" border="0" /> <a href="attachment.php?$session[sessionurl]attachmentid=$attach[attachmentid]&amp;stc=1" target="_blank">$attach[filename]</a> ($attach[filesize])</div>

###### 套件修改完成 #######


所有時間均為台北時間。現在的時間是 07:18 AM

Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2025, Jelsoft Enterprises Ltd.

『服務條款』

* 有問題不知道該怎麼解決嗎?請聯絡本站的系統管理員 *


SEO by vBSEO 3.6.1