发帖子的时候就能看到,还是发个演示图吧:
1、attachment.php
找到
复制内容到剪贴板
代码:
dheader('location:'.$ftp['attachurl'].'/'.$attach['attachment']);替换为
复制内容到剪贴板
代码:
$attach['attachment'] = !preg_match('/^(https?|ftp):\/\//', $attach['attachment']) ? $ftp['attachurl'].'/'.$attach['attachment'] : $attach['attachment'];
dheader('location:'.$attach['attachment']);再找
复制内容到剪贴板
代码:
function getremotefile($file) {
global $authkey, $ftp, $attachdir;
@set_time_limit(0);在下面加入
复制内容到剪贴板
代码:
$file = !preg_match('/^(https?|ftp):\/\//', $file) ? $ftp['attachurl'].'/'.$file : $file;2、include/editpost.inc.php
找到
复制内容到剪贴板
代码:
// debug: update thread caches ?在上面加入
复制内容到剪贴板
代码:
if(is_array($ftpattachurl)) {
$urlexists = FALSE;
foreach($ftpattachurl as $key => $url) {
if($url) {
$urlexists = TRUE;
$name = basename($url);
$db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote)
VALUES ('$tid', '$pid', '$timestamp', '$ftpattachperm[$key]', '$ftpattachprice[$key]', '$name', '$ftpattachdesc[$key]', '', '0', '$url', '0', '0', '$discuz_uid', '0', '1')");
}
}
if($urlexists) {
$db->query("UPDATE {$tablepre}posts SET attachment='1' WHERE pid='$pid'", 'UNBUFFERED');
$db->query("UPDATE {$tablepre}threads SET attachment='1' WHERE tid='$tid'", 'UNBUFFERED');
}
}3、include/newreply.inc.php
找到
复制内容到剪贴板
代码:
updatecredits($discuz_uid, $postattachcredits, count($attachments));
}在下面加入
复制内容到剪贴板
代码:
if(is_array($ftpattachurl)) {
$urlexists = FALSE;
foreach($ftpattachurl as $key => $url) {
if($url) {
$urlexists = TRUE;
$name = basename($url);
$db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote)
VALUES ('$tid', '$pid', '$timestamp', '$ftpattachperm[$key]', '$ftpattachprice[$key]', '$name', '$ftpattachdesc[$key]', '', '0', '$url', '0', '0', '$discuz_uid', '0', '1')");
}
}
if($urlexists) {
$db->query("UPDATE {$tablepre}posts SET attachment='1' WHERE pid='$pid'", 'UNBUFFERED');
$db->query("UPDATE {$tablepre}threads SET attachment='1' WHERE tid='$tid'", 'UNBUFFERED');
}
}4、include/newthread.inc.php
找到
复制内容到剪贴板
代码:
updatecredits($discuz_uid, $postattachcredits, count($attachments));
}在下面加入
复制内容到剪贴板
代码:
if(is_array($ftpattachurl)) {
$urlexists = FALSE;
foreach($ftpattachurl as $key => $url) {
if($url) {
$urlexists = TRUE;
$name = basename($url);
$db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote)
VALUES ('$tid', '$pid', '$timestamp', '$ftpattachperm[$key]', '$ftpattachprice[$key]', '$name', '$ftpattachdesc[$key]', '', '0', '$url', '0', '0', '$discuz_uid', '0', '1')");
}
}
if($urlexists) {
$db->query("UPDATE {$tablepre}posts SET attachment='1' WHERE pid='$pid'", 'UNBUFFERED');
$db->query("UPDATE {$tablepre}threads SET attachment='1' WHERE tid='$tid'", 'UNBUFFERED');
}
}5、模板目录中的post_editor.htm
找到
复制内容到剪贴板
代码:
<th>{lang attachment_new}</th>在下面加入
复制内容到剪贴板
代码:
<td>URL</td>找到
复制内容到剪贴板
代码:
<th>
<input type="file" name="attach[]" />
<span id="localfile[]"></span>
<input type="hidden" name="localid[]" />
</th>在下面加入
复制内容到剪贴板
代码:
<td class="nums"><input type="text" name="ftpattachurl[]" /></td>