久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线
Discuz! 官方交流社區
標題:
X3系列通用:連續回帖自動合并到同一樓層,小hack~!
[打印本頁]
作者:
建筑資源吧
時間:
2022-9-17 10:24
標題:
X3系列通用:連續回帖自動合并到同一樓層,小hack~!
效果如下圖:
(, 下載次數: 56)
上傳
點擊文件名下載附件
第一步: 修改方法:
打開文件: \source\include\post\post_newreply.php 查找:
$return = $modpost->newreply($params);
$pid = $modpost->pid;
復制代碼
然后替換為:
########### 疊加快速的回復#######################
$_insertword = "\n\n[size=2][color=gray][u]{$_G['username']} 于 ".date("Y-m-d H:i:s", time())." 補充以下內容[/u]:[/color][/size]\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>';
復制代碼
歡迎光臨 Discuz! 官方交流社區 (http://www.9999xn.com/)
Powered by Discuz! W1.0