久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

返回列表 發帖
查看: 2435|回復: 0

X3系列通用:連續回帖自動合并到同一樓層,小hack~!

17

主題

77

回帖

156

積分

漸入佳境

貢獻
1 點
金幣
50 個
樓主
發表于 2022-9-17 10:24:48 | 只看樓主 |只看大圖 |倒序瀏覽 |閱讀模式
效果如下圖:

第一步: 修改方法:
打開文件: \source\include\post\post_newreply.php 查找:
  1. $return = $modpost->newreply($params);
  2. $pid = $modpost->pid;
復制代碼
然后替換為:
  1.     ########### 疊加快速的回復#######################
  2.     $_insertword = "\n\n[size=2][color=gray][u]{$_G['username']} 于 ".date("Y-m-d H:i:s", time())." 補充以下內容[/u]:[/color][/size]\n";//追加內容前綴
  3.    
  4.     $_maxlength = 80;//字符數大于此值則一律不合并,注意1中文=2字符(GBK)或3字符(UTF)
  5.     $_reducesmile = 1;//設為1=去除表情之后計算字數,0=否
  6.     $_reducequote = 1;//設為1=去除引用之后計算字數,0=否
  7.     $_reducespace = 1;//設為1=去除空白換行之后計算字數,0=否
  8.     $_reducefirst = 1;//設為僅限回復, 0關閉.
  9.     $_reducetime  = 2000;//回復過多少秒后不再疊加
  10.     $_blackfids = array(53,54,55,61);//版塊FID黑名單,此名單內不進行合并
  11.     $_whitefids = array();//版塊FID白名單,此名單內進行合并,黑白名單同時存在時白名單無效
  12.     $discuz_uid = $_G['uid'];
  13.     $fid = $_GET['fid'];
  14.     $tid = $_GET['tid'];
  15.    
  16.     //設置部分結束
  17.     if($_blackfids && $_whitefids) unset($_whitefids);
  18.    
  19.     $temp = $message;
  20.     if(is_array($smilies))if($_reducesmile) foreach($smilies as $sm) {
  21.             $temp = str_replace($sm['code'], '', $temp);        
  22.     }
  23.     if($_reducequote) $temp = preg_replace("/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is", '', $temp);
  24.     if($_reducespace) $temp = preg_replace("/\s/is", '', $temp);
  25.     $temp = trim($temp);
  26.     $length = strlen($temp);
  27.     unset($temp);
  28.    
  29.     if($length <= $_maxlength && (!$_blackfids || !in_array($fid, $_blackfids)) && (!$_whitefids || in_array($fid, $_whitefids))) {
  30.             $tablename = DB::table('forum_post');
  31.             
  32.             $q =  DB::fetch_all("SELECT `authorid`, `pid`,`first`,`dateline` FROM $tablename WHERE tid='$tid' AND invisible='0' ORDER BY pid DESC LIMIT 1");
  33.             $q = $q[0];
  34.             if($_reducefirst && $q['first']==1)
  35.                 $discuz_uid = 0;
  36.             if(($q['dateline']+$_reducetime) <= time())
  37.                 $discuz_uid = 0;
  38.             
  39.             if($q['authorid'] == $discuz_uid && !$attachment && !$isanonymous) {
  40.                 $message = $_insertword . $message;
  41.                 DB::query("UPDATE $tablename SET `smileyoff` = '0', `bbcodeoff` = '0',`tags`='superposition', `message` = CONCAT(message, '$message') WHERE pid='{$q['pid']}'");
  42.                 $pid  = ($q['pid']+0);
  43.                 $modpost->pid  = $pid;
  44.                 $return = 'post_reply_succeed';
  45.                 $modpost->param('showmsgparam', array('fid'=>$_GET['fid'], 'tid'=>$_GET['tid'],'pid'=>$pid, 'from'=>'','sechash'=>''));
  46.                 $page = getstatus($modpost->thread['status'], 4) ? 1 : @ceil(($modpost->thread['special'] ? $modpost->thread['replies'] + 1 : $modpost->thread['replies'] + 2) / getglobal('ppp'));
  47.                 $modpost->param('page', $page);
  48.             }
  49.     }
  50.    
  51.     if(!$pid){
  52.                $return = $modpost->newreply($params);
  53.             $pid = $modpost->pid;
  54.     }
  55.     ################################### 疊加回復處理完成 ################################
復制代碼
第二步修改方法:
打開文件:\source\module\forum\forum_viewthread.php 查找:
  1. include template('common/footer_ajax');
復制代碼
在這一行的上面增加如下代碼(解決疊加時樓層顯示多個的問題):
  1.     if($post['tags'] === 'superposition')
  2.     echo '<span id="tyjs"><script type="text/javascript">var rages = '.time().'; $("pid'.$_GET['viewpid'].'").parentNode.outerHTML=""; $("tyjs").outerHTML="";</script></span>';
復制代碼


回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

  • 關注公眾號
  • 有償服務微信
  • 有償服務QQ

手機版|小黑屋|Discuz! 官方交流社區 ( 皖ICP備16010102號 |皖公網安備34010302002376號 )|網站地圖|star

GMT+8, 2025-7-3 05:10 , Processed in 0.171561 second(s), 10 queries , Redis On.

Powered by Discuz! W1.0 Licensed

Cpoyright © 2001-2025 Discuz! Team.

關燈 在本版發帖
有償服務QQ
有償服務微信
返回頂部
快速回復 返回頂部 返回列表