在编辑器中上传一张图片,插入多次后编辑器里会显示多次,但发布后帖子里只显示一次
修改文件source/function/function_attachment.php
查找
foreach($findattach[$pid] as $AId => $find) { $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1); $postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']); }
替换为
foreach($findattach[$pid] as $aid => $find) { //$postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1); //$postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']); preg_match_all($find, $postlist[$pid]['message'], $sameattach); foreach($sameattach[0] as $key => $value){ $tempattach = $postlist[$pid]['attachments'][$aid]['aid']; if(count($sameattach[0]) > 1 && $key > 0) { $postlist[$pid]['attachments'][$aid]['aid'] = $postlist[$pid]['attachments'][$aid]['aid'].'_'.$key; $GLOBALS['aimgs'][$pid][] = $postlist[$pid]['attachments'][$aid]['aid']; } $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1); $postlist[$pid]['attachments'][$aid]['aid'] = $tempattach; } }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)