第一步: 修改方法:
打开文件: \source\include\post\post_newreply.php
查找:
$return = $modpost->newreply($params);
$pid = $modpost->pid;
然后替换为:
########### 叠加快速的回复#######################
$_insertword = "\n\n{$_G['username']} 于 ".date("Y-m-d H:i:s", time())." 补充以下内容:\n";//追加内容前缀
$_maxlength = 80;//字符数大于此值则一律不合并,注意1中文=2字符(GBK)或3字符(UTF)
$_reducesmile = 1;//设为1=去除表情之后计算字数,0=否
$_reducequote = 1;//设为1=去除引用之后计算字数,0=否
$_reducespace = 1;//设为1=去除空白换行之后计算字数,0=否
$_reducefirst = 1;//设为仅限回复, 0关闭.
$_reducetime = 2000;//回复过多少秒后不再叠加
$_blackfids = array(53,54,55,61);//版块FID黑名单,此名单内不进行合并
$_whitefids = array();//版块FID白名单,此名单内进行合并,黑白名单同时存在时白名单无效
$discuz_uid = $_G['uid'];
$fid = $_GET['fid'];
$tid = $_GET['tid'];
//设置部分结束
if($_blackfids && $_whitefids) unset($_whitefids);
$temp = $message;
if(is_array($smilies))if($_reducesmile) foreach($smilies as $sm) {
$temp = str_replace($sm['code'], '', $temp);
}
if($_reducequote) $temp = preg_replace("/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is", '', $temp);
if($_reducespace) $temp = preg_replace("/\s/is", '', $temp);
$temp = trim($temp);
$length = strlen($temp);
unset($temp);
if($length <= $_maxlength && (!$_blackfids || !in_array($fid, $_blackfids)) && (!$_whitefids || in_array($fid, $_whitefids))) {
$tablename = DB::table('forum_post');
$q = DB::fetch_all("SELECT `authorid`, `pid`,`first`,`dateline` FROM $tablename WHERE tid='$tid' AND invisible='0' ORDER BY pid DESC LIMIT 1");
$q = $q[0];
if($_reducefirst && $q['first']==1)
$discuz_uid = 0;
if(($q['dateline']+$_reducetime) <= time())
$discuz_uid = 0;
if($q['authorid'] == $discuz_uid && !$attachment && !$isanonymous) {
$message = $_insertword . $message;
DB::query("UPDATE $tablename SET `smileyoff` = '0', `bbcodeoff` = '0',`tags`='superposition', `message` = CONCAT(message, '$message') WHERE pid='{$q['pid']}'");
$pid = ($q['pid']+0);
$modpost->pid = $pid;
$return = 'post_reply_succeed';
$modpost->param('showmsgparam', array('fid'=>$_GET['fid'], 'tid'=>$_GET['tid'],'pid'=>$pid, 'from'=>'','sechash'=>''));
$page = getstatus($modpost->thread['status'], 4) ? 1 : @ceil(($modpost->thread['special'] ? $modpost->thread['replies'] + 1 : $modpost->thread['replies'] + 2) / getglobal('ppp'));
$modpost->param('page', $page);
}
}
if(!$pid){
$return = $modpost->newreply($params);
$pid = $modpost->pid;
}
################################### 叠加回复处理完成 ################################
第二步修改方法:
打开文件: \source\module\forum\forum_viewthread.php
查找:
include template('common/footer_ajax');
在这一行的上面增加如下代码(解决叠加时楼层显示多个的问题):
if($post['tags'] === 'superposition')
echo '<span id="tyjs"><script type="text/javascript">var rages = '.time().'; $("pid'.$_GET['viewpid'].'").parentNode.outerHTML=""; $("tyjs").outerHTML="";</script></span>';