ang('thread_detail'); $header['mobile_title'] = $forum['name'];; $header['mobile_link'] = url("forum-$fid"); $header['keywords'] = ''; $header['description'] = $thread['subject']; $_SESSION['fid'] = $fid; if($page == 1 && $first['user']['gid'] == 7){ if($user['gid'] == 1){ $first['message_fmt'] = $first['message_fmt_fox']; } } $haya_post_info_param = array(); if (isset($haya_post_info_config['show_post_sort']) && $haya_post_info_config['show_post_sort'] == 1 ) { $haya_post_info_post_default_sort = isset($haya_post_info_config['post_default_sort']) ? trim($haya_post_info_config['post_default_sort']) : ''; $haya_post_info_orderby = param('sort', $haya_post_info_post_default_sort); if (!empty($haya_post_info_orderby)) { $haya_post_info_param = array_merge($haya_post_info_param, array('sort' => trim($haya_post_info_orderby))); } } if ((isset($haya_post_info_config['show_see_him']) && $haya_post_info_config['show_see_him'] == 1) || (isset($haya_post_info_config['show_see_first_floor']) && $haya_post_info_config['show_see_first_floor'] == 1) ) { $haya_post_info_see_user = param('user', ''); if (!empty($haya_post_info_see_user)) { $haya_post_info_see_user_id = intval($haya_post_info_see_user); $thread['posts'] = post_count(array( 'tid' => $thread['tid'], 'isfirst' => 0, 'uid' => $haya_post_info_see_user_id, )); $haya_post_info_param = array_merge($haya_post_info_param, array('user' => $haya_post_info_see_user_id)); } } if (!empty($haya_post_info_param)) { $pagination = pagination(url("thread-$tid-{page}$keywordurl", $haya_post_info_param), $thread['posts'] + 1, $page, $pagesize); } $gid=isset($user['gid'])?$user['gid']:'0'; $my_p=$group['readp']; $target_p=$thread['readp']; $need_refresh=0; if(($gid!=1)&& $my_p<$target_p ){ message(-1, jump(lang('dear_p'), http_referer(), 2));die();} // 改进:剥离嵌套在短代码外的 HTML 标签(如 [ttlogin]) // 同时也剥离标签内部可能存在的
(兼容部分编辑器的换行行为) for($k=0;$k<3;$k++) { $first['message_fmt'] = preg_replace('#<(?Pa|span|strong|b|i|u|em|font)[^>]*>\s*(?:)?\s*(\[/?(?:ttlogin|reply)\])\s*(?:)?\s*#is', '$2', $first['message_fmt']); } // 改进:优化正则匹配逻辑,增强鲁棒性 $preg_login = preg_match_all('/(?:]*>)?\s*\[ttlogin\]\s*(?:<\/p>)?(.*?)(?:]*>)?\s*\[\/ttlogin\]\s*(?:<\/p>)?/is',$first['message_fmt'],$array); if($preg_login) { $array_count = count($array[0]); $html_hide='
'.lang('dear_guest2').' '.lang('login').' '.lang('or_').' '.lang('register').'
'; for($i=0;$i<$array_count;$i++){ $a = $array[0][$i]; $b = ''; if($uid)$first['message_fmt'] = str_replace($a,$b,$first['message_fmt']); else $first['message_fmt'] = str_replace($a,$html_hide,$first['message_fmt']); } } $set = setting_get('tt_read'); if($set&& $set['old']==1) { $preg_reply2 = preg_match_all('/(?:]*>)?\s*\[reply\]\s*(?:<\/p>)?(.*?)(?:]*>)?\s*\[\/reply\]\s*(?:<\/p>)?/is',$first['message_fmt'],$array2); if($preg_reply2) { $array2_count = count($array2[0]); $html_reply ='
'.lang('dear_reply').'
'; if($uid) $replied=db_find_one('post',array('uid'=>$uid,'tid'=>$thread['tid'])); else $replied=array(); for($i=0;$i<$array2_count;$i++){ $a = $array2[0][$i]; $b = ''; if($uid AND $replied)$first['message_fmt'] = str_replace($a,$b,$first['message_fmt']); else {$first['message_fmt'] = str_replace($a,$html_reply,$first['message_fmt']);$need_refresh=1;} } } } include _include(APP_PATH.'view/htm/thread.htm'); } ?>