- 積分
- 164
- 金幣
- 50 個(gè)
- 社區(qū)幣
- 0 元
漸入佳境
- 貢獻(xiàn)
- 1 點(diǎn)
- 金幣
- 50 個(gè)
|
效果如下圖:
1.png (82.06 KB, 下載次數(shù): 53)
下載附件
2022-9-17 10:24 上傳
第一步: 修改方法:
打開文件: \source\include\post\post_newreply.php 查找:
- $return = $modpost->newreply($params);
- $pid = $modpost->pid;
復(fù)制代碼 然后替換為:
- ########### 疊加快速的回復(fù)#######################
- $_insertword = "\n\n[size=2][color=gray][u]{$_G['username']} 于 ".date("Y-m-d H:i:s", time())." 補(bǔ)充以下內(nèi)容[/u]:[/color][/size]\n";//追加內(nèi)容前綴
-
- $_maxlength = 80;//字符數(shù)大于此值則一律不合并,注意1中文=2字符(GBK)或3字符(UTF)
- $_reducesmile = 1;//設(shè)為1=去除表情之后計(jì)算字?jǐn)?shù),0=否
- $_reducequote = 1;//設(shè)為1=去除引用之后計(jì)算字?jǐn)?shù),0=否
- $_reducespace = 1;//設(shè)為1=去除空白換行之后計(jì)算字?jǐn)?shù),0=否
- $_reducefirst = 1;//設(shè)為僅限回復(fù), 0關(guān)閉.
- $_reducetime = 2000;//回復(fù)過多少秒后不再疊加
- $_blackfids = array(53,54,55,61);//版塊FID黑名單,此名單內(nèi)不進(jìn)行合并
- $_whitefids = array();//版塊FID白名單,此名單內(nèi)進(jìn)行合并,黑白名單同時(shí)存在時(shí)白名單無效
- $discuz_uid = $_G['uid'];
- $fid = $_GET['fid'];
- $tid = $_GET['tid'];
-
- //設(shè)置部分結(jié)束
- 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;
- }
- ################################### 疊加回復(fù)處理完成 ################################
復(fù)制代碼 第二步修改方法:
打開文件:\source\module\forum\forum_viewthread.php 查找:
- include template('common/footer_ajax');
復(fù)制代碼 在這一行的上面增加如下代碼(解決疊加時(shí)樓層顯示多個(gè)的問題):
- if($post['tags'] === 'superposition')
- echo '<span id="tyjs"><script type="text/javascript">var rages = '.time().'; $("pid'.$_GET['viewpid'].'").parentNode.outerHTML=""; $("tyjs").outerHTML="";</script></span>';
復(fù)制代碼
|
|