本帖最后由 superliujie 于 2011-11-1 11:16 编辑
说明:此方法不是我原创,只是我有此问题,在网上查到,本地测试成功,分享给大家。(注意:修改程序前,先备份原程序文件。)
地址:http://hi.baidu.com/1downs/blog/item/2635da8b6a4c2acffc1f105a.html
内容:20111010的补丁包中\function_post.php文件中的如下这段代码会导致编辑帖子更新其中一个附件后,导致该帖的其他附件不能使用,请官方予以修复。
临时方案:该文件的该部分恢复老版本即可
- if($attachupdate) {
- $query = DB::query("SELECT pid, aid, attachment, thumb, remote FROM ".DB::table(getattachtablebytid($tid))." WHERE aid IN (".dimplode(array_keys($attachupdate)).")");
- while($attach = DB::fetch($query)) {
- if($attach['pid'] == $pid) {
- dunlink($attach);
- }
- }
- $uaids = dimplode($attachupdate);
- $query = DB::query("SELECT aid, width, filename, filesize, attachment, isimage, thumb, remote FROM ".DB::table('forum_attachment_unused')." WHERE aid IN ($uaids)$uidadd");
- DB::query("DELETE FROM ".DB::table('forum_attachment_unused')." WHERE aid IN ($uaids)$uidadd");
- $attachupdate = array_flip($attachupdate);
- while($attach = DB::fetch($query)) {
- $update = $attach;
- $update['dateline'] = TIMESTAMP;
- $update['remote'] = 0;
- unset($update['aid']);
- if($attach['isimage'] && $_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
- $image->Watermark($_G['setting']['attachdir'].'/forum/'.$attach['attachment'], '', 'forum');
- $update['filesize'] = $image->imginfo['size'];
- }
- DB::update(getattachtablebytid($tid), $update, "aid='".$attachupdate[$attach['aid']]."'");
- ftpupload(array($attachupdate[$attach['aid']]), $uid);
- }
- }
复制代码
------------------------------------要解决可以修改为:-------------------------------------------------
- if($attachupdate) {
- $query = DB::query("SELECT pid, aid, attachment, thumb, remote FROM ".DB::table(getattachtablebytid($tid))." WHERE aid IN (".dimplode(array_keys($attachupdate)).")");
- while($attach = DB::fetch($query)) {
- if(array_key_exists($attach['aid'], $attachupdate) && $attachupdate[$attach['aid']]) {
- dunlink($attach);
- }
- }
- $uaids = dimplode($attachupdate);
- $query = DB::query("SELECT aid, width, filename, filesize, attachment, isimage, thumb, remote FROM ".DB::table('forum_attachment_unused')." WHERE aid IN ($uaids)$uidadd");
- DB::query("DELETE FROM ".DB::table('forum_attachment_unused')." WHERE aid IN ($uaids)$uidadd");
- $attachupdate = array_flip($attachupdate);
- while($attach = DB::fetch($query)) {
- $update = $attach;
- $update['dateline'] = TIMESTAMP;
- $update['remote'] = 0;
- unset($update['aid']);
- if($attach['isimage'] && $_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
- $image->Watermark($_G['setting']['attachdir'].'/forum/'.$attach['attachment'], '', 'forum');
- $update['filesize'] = $image->imginfo['size'];
- }
- DB::update(getattachtablebytid($tid), $update, "aid='".$attachupdate[$attach['aid']]."'");
- ftpupload(array($attachupdate[$attach['aid']]), $uid);
- }
- }
复制代码
|