} if ($use_self && $credits2 > 0 && ($user['golds'] - $credits2) < 0) { message(-1, '您的' . lang('credits2') . '不足!'); die(); } if ($use_self && $credits3 > 0 && ($user['rmbs'] - $credits3) < 0) { message(-1, '您的' . lang('credits3') . '不足!'); die(); } if ($credits1 != 0 && ($credits1 < $group['reward_from1'] || $credits1 > $group['reward_to1'])) { message(-1, lang('credits1') . '超过限制!系统限制为' . $group['reward_from1'] . '~' . $group['reward_to1']); die(); } if ($credits2 != 0 && ($credits2 < $group['reward_from2'] || $credits2 > $group['reward_to2'])) { message(-1, lang('credits2') . '超过限制!系统限制为' . $group['reward_from2'] . '~' . $group['reward_to2']); die(); } if ($credits3 != 0 && ($credits3 < $group['reward_from3'] || $credits3 > $group['reward_to3'])) { message(-1, lang('credits3') . '超过限制!系统限制为' . $group['reward_from3'] . '~' . $group['reward_to3']); die(); } $update_to_arr = array(); $update_from_arr = array(); if ($credits1 != 0) { $update_to_arr['credits+'] = $credits1; if ($use_self && $credits1 > 0) $update_from_arr['credits-'] = $credits1; } if ($credits2 != 0) { $update_to_arr['golds+'] = $credits2; if ($use_self && $credits2 > 0) $update_from_arr['golds-'] = $credits2; } if ($credits3 != 0) { $update_to_arr['rmbs+'] = $credits3; if ($use_self && $credits3 > 0) $update_from_arr['rmbs-'] = $credits3; } db_update('user', array('uid' => $_thread['uid']), $update_to_arr); if ($use_self) db_update('user', array('uid' => $uid), $update_from_arr); db_insert('reward', array('uid' => $uid, 'time' => $time, 'tid' => $tid, 'credits' => $credits1, 'golds' => $credits2, 'rmbs' => $credits3)); db_insert('user_pay', array('uid' => $uid, 'status' => 1, 'num' => '0', 'type' => 14, 'credit_type' => '1', 'time' => time(), 'code' => $tid .tt_credits_rtn_name($credits1, $credits2, $credits3))); db_insert('user_pay', array('uid' => $_thread['uid'], 'status' => 1, 'num' => '0', 'type' => 15, 'credit_type' => '1', 'time' => time(), 'code' => $tid . tt_credits_rtn_name($credits1, $credits2, $credits3))); message(0, '已投币!'); } } elseif($action=='sReward') { $tid = param(2); include _include(APP_PATH . 'plugin/tt_reward/view/htm/tt_reward_list.htm'); return; } // 发表主题帖 | create new thread if($action == 'create') { user_login_check(); if($method == 'GET') { if(empty($user['email_v']) || $user['email_v'] != '1'){ message(-1,jump('验证邮箱后才能发帖,点击去验证',url('my-email'),2));die; } $fid = param(2, 0); $forum = $fid ? forum_read($fid) : array(); $forumlist_allowthread = forum_list_access_filter($forumlist, $gid, 'allowthread'); $forumarr = xn_json_encode(arrlist_key_values($forumlist_allowthread, 'fid', 'name')); if(empty($forumlist_allowthread)) { message(-1, lang('user_group_insufficient_privilege')); } $header['title'] = lang('create_thread'); $header['mobile_title'] = $fid ? $forum['name'] : ''; $header['mobile_linke'] = url("forum-$fid"); $content_num = 0; $content_num_type = 1; if($group['allowsell']=="1") { $input['content_num_status'] = form_radio_yes_no('content_num_status', 0); } $pnumber=0; $input['readp_status'] = form_radio_yes_no('readp_status', 0); $input['red_type'] = form_select('red_type', array('普通红包','拼手气红包','口令红包')); $input['red_num'] = form_text('red_num', '-1'); $input['red_total_money'] = form_text('red_total_money', '0'); $input['red_command'] = form_text('red_command', '0'); $input['post_red'] =form_radio_yes_no('post_red', 0); $isviponly=0;$isviponlyA=0; $input['VIPonly'] = form_radio_yes_no('VIPonly', 0); $input['VIPonlyA'] = form_radio_yes_no('VIPonlyA', 0); include _include(APP_PATH.'view/htm/post.htm'); } else { $subject = trim(param('subject')); empty($subject) AND message('subject', lang('please_input_subject')); $inputmsg = str_replace(array("

","","

"),"",param('message', '', FALSE)); if( trim(str_replace(" ","",$inputmsg)) == "" ){ message('message', lang('please_input_message')); } $threadtimes = setting_get('threadtimes'); $threadtime = strtotime("-".$threadtimes." seconds"); $threadsCount = db_count('post', array('uid' => $uid,'isfirst'=>1,'create_date'=>array('>'=>$threadtime))); if($threadsCount > 0){ message(-1,'您在'.$threadtimes.'秒内已经发过贴了,休息一下吧~'); exit; } $set = setting_get('tt_credits'); $credits = $set['thread_exp'];$rmbs = $set['thread_rmb'];$golds = $set['thread_gold']; $golds_op = $golds>0?'+':'';$credits_op = $credits>0?'+':'';$rmbs_op = $rmbs>0?'+':''; if(($credits<0&&($user['credits']+$credits<0))||($golds<0&&($user['golds']+$golds<0))||($rmbs<0&&($user['rmbs']+$rmbs<0))) {message(-1,lang('credit_no_enough'));die();} $c_limit =$set['limit'] ; $add_credit=1; if($c_limit!=0) { $todayTime = strtotime(date('Y-m-d',time()))-1; $todayThread = db_count('post',array('create_date' => array('>'=>$todayTime),'uid'=>$uid,'isfirst'=>'1')); if($c_limit<=$todayThread) $add_credit=0; } if(empty($user['email_v']) || $user['email_v'] != '1'){ message(-1,jump('验证邮箱后才能发帖,点击去验证',url('my-email'),2));die; }include_once APP_PATH.'plugin/xn_geetest/model/geetest.fuc.php'; geetestcheck('geetest_thread_create_on'); $fid = param('fid', 0); $forum = forum_read($fid); empty($forum) AND message('fid', lang('forum_not_exists')); $r = forum_access_user($fid, $gid, 'allowthread'); !$r AND message(-1, lang('user_group_insufficient_privilege')); $subject = param('subject'); empty($subject) AND message('subject', lang('please_input_subject')); xn_strlen($subject) > 128 AND message('subject', lang('subject_length_over_limit', array('maxlength'=>128))); $message = param('message', '', FALSE); empty($message) AND message('message', lang('please_input_message')); $doctype = param('doctype', 0); $doctype > 10 AND message(-1, lang('doc_type_not_supported')); xn_strlen($message) > 2028000 AND message('message', lang('message_too_long')); $thread = array ( 'fid'=>$fid, 'uid'=>$uid, 'sid'=>$sid, 'subject'=>$subject, 'message'=>$message, 'time'=>$time, 'longip'=>$longip, 'doctype'=>$doctype, ); $jp=param('jp');$sj=param('sj');$xnjp=param('xnjp');$prizecount=param('prizecount'); $arrlist = db_find_one('thread',array('subject'=>$subject)); if(!empty($arrlist)) { message(-1, '该 标题 已经被使用,请换其他 标题 试试。'); }$set_check = setting_get('tt_check'); if($set_check['user_check']=='1' && $user['OK']!= '1') {message(-1, '您需要等待管理员审核后,才能发表帖子!'); die();}$red_type=param('red_type')+1; $red_num=param('red_num'); $red_total_money=param('red_total_money'); $red_command=param('red_command','0'); if($red_type=='1') $red_total_money*=$red_num; if($red_total_money<0){message(-1,'输入数字不合法!不能为负。');die();} if($red_num>0 && $red_total_money>0){ $set_red = setting_get('tt_redpacket'); if($user[get_credits_name_by_type($set_red['money_type'])] - $red_total_money <0) { message(-1, '您好,您的余额不足,无法发表该红包!点此充值'); die();} if($red_total_money/$red_num < 1.0){ message(-1, '您好,每个红包最低1分,您的输入的金额过少!'); die();} } //$thread['subject']; //$thread['message']; // todo: $tagids = param('tagid', array(0)); $tagcatemap = $forum['tagcatemap']; foreach($forum['tagcatemap'] as $cate) { $defaulttagid = $cate['defaulttagid']; $isforce = $cate['isforce']; $catetags = array_keys($cate['tagmap']); $intersect = array_intersect($catetags, $tagids); // 比较数组交集 // 判断是否强制 if($isforce) { if(empty($intersect)) { message(-1, '请选择'.$cate['name']); } } } $tid = thread_create($thread, $pid); $pid === FALSE AND message(-1, lang('create_post_failed')); $tid === FALSE AND message(-1, lang('create_thread_failed')); $pnumber = param('readp');$pstatus=param('readp_status'); if ($pstatus&& $pnumber>0) {db_update('thread', array('tid' => $tid), array('readp' => $pnumber));}$cjid = setting_get('cjid'); if($uid==$cjid){ db_update('thread',array('tid'=>$tid),array('jp'=>$jp,'sj'=>$sj,'xnjp'=>$xnjp,'prize'=>1,'prizecount'=>$prizecount));} if (!isset($till_rss_setting)) { $till_rss_setting = setting_get('till_rss_setting'); } if ($till_rss_setting['update_on_thread_create']) { if (!isset($forumlist_for_rss)) { $forumlist = forum_list_cache(); $forumlist_for_rss = forum_list_access_filter($forumlist, 0); } till_rss_generate_homepage($forumlist_for_rss, $till_rss_setting['rss_items'], $till_rss_setting['summary_length'], true); till_rss_generate_forums([$forum], $till_rss_setting['rss_items'], $till_rss_setting['summary_length'], true); }if($red_num>0 && $red_total_money>0){ db_update('thread',array('tid'=>$tid),array('red_num'=>$red_num)); db_update('user',array('uid'=>$uid),array(get_credits_name_by_type($set_red['money_type']).'-'=>$red_total_money)); db_insert('thread_red',array('tid'=>$tid,'type'=>$red_type,'total'=>$red_num,'rest'=>$red_num,'total_money'=>$red_total_money,'rest_money'=>$red_total_money,'command'=>$red_command)); db_insert('user_pay',array('uid'=>$uid,'status'=>1,'num'=>$red_total_money,'type'=>10,'credit_type'=>$set_red['money_type'],'time'=>time(),'code'=>red_get_type_by_id($red_type))); }$isviponly=param('VIPonly');$isviponlyA=param('VIPonlyA'); if ($isviponly) db_update('thread', array('tid' => $tid), array('VIPonly' => $isviponly)); if ($isviponlyA) db_update('thread', array('tid' => $tid), array('VIPonlyA' => $isviponlyA)); include_once APP_PATH . 'plugin/ty_relpay' . '/lib/ai.class.php'; $kv = kv_get('ty_relpay'); if (in_array($fid, $kv['used_forum'])) { $liaodashiService = new LiaodashiService(); $ai_content = $liaodashiService->handleRequest($thread); //var_dump($content); if ($ai_content === false || !empty($ai_content)) { $ai_uid = $kv['ai_user_id'] ?? 1; $post = array( 'tid'=>$tid, 'uid'=>$ai_uid, 'create_date'=>time(), 'userip'=>'127.0.0.1', 'isfirst'=>0, 'doctype'=>0, 'quotepid'=>post__read(0), 'message'=>$ai_content, ); $pid = post_create($post, $fid, $gid); } } // todo: /* $tag_cate_id_arr = param('tag_cate_id', array(0)); foreach($tag_cate_id_arr as $tag_cate_id => $tagid) { tag_thread_create($tagid, $tid); } */ $tagids = param('tagid', array(0)); $tagcatemap = $forum['tagcatemap']; foreach($forum['tagcatemap'] as $cate) { $defaulttagid = $cate['defaulttagid']; $isforce = $cate['isforce']; $catetags = array_keys($cate['tagmap']); $intersect = array_intersect($catetags, $tagids); // 比较数组交集 // 判断是否强制 if($isforce) { if(empty($intersect)) { message(-1, '请选择'.$cate['name']); } } // 判断是否默认 if($defaulttagid) { if(empty($intersect)) { array_push($tagids, $defaulttagid); } } } foreach($tagids as $tagid) { $tagid AND tag_thread_create($tagid, $tid); } $r = db_find_one('post',array('pid'=>$pid)); if($r){ $n = preg_match_all("/(?:[^\"]|^)(https?\:\/\/[^\x{4e00}-\x{9fa5}\"\s<]+)/u",$r['message'],$result); if($n>0){ $r['message']=str_replace('[ttDown]http','[ttDown]',$r['message']); $r['message']=str_replace('[',' [',$r['message']); $r['message']=str_replace(']','] ',$r['message']); $newm="\${1}\${2}"; $r['message']=preg_replace("/([^\"]|^)(https?\:\/\/[^\x{4e00}-\x{9fa5}\"\s<]+)/u",$newm,$r['message']); $r['message']=str_replace(' [ ','[',$r['message']); $r['message']=str_replace('] ',']',$r['message']); $r['message']=str_replace('[ttDown]','[ttDown]http',$r['message']); db_update('post',array('pid'=>$pid),array('message'=>$r['message'],'message_fmt'=>$r['message'])); } } if($group['allowsell']=="1") { $content_num_status = param('content_num_status'); $content_num = param('content_num'); if($content_num < 0 ){//判断购买主题货币值小于零 $content_num = 1;//小于零强制写为一 } $content_type = credits_get_content_type_by_name(param('content_type')); if ($content_num_status && $content_num) db_update('thread', array('tid' => $tid), array('content_buy' => $content_num, 'content_buy_type' => $content_type)); } $update_array = array(); if((($add_credit==1)||($add_credit==0&& $credits<0))&&$credits!=0) $update_array['credits+']=$credits; if((($add_credit==1)||($add_credit==0&& $golds<0))&&$golds!=0) $update_array['golds+']=$golds; if((($add_credit==1)||($add_credit==0&& $rmbs<0))&&$rmbs!=0) $update_array['rmbs+']=$rmbs; $uid AND $update_array AND user_update($uid, $update_array); $uid AND $update_array AND $user['gid']>=100 AND user_update_group($uid); $message = ''; isset($update_array['credits+']) AND $message .= lang('credits1').$credits_op.$credits.' ' ; isset($update_array['golds+']) AND $message .= lang('credits2').$golds_op.$golds.' ' ; isset($update_array['rmbs+']) AND $message .= lang('credits3').$rmbs_op.$rmbs ; message(0, lang('create_thread_sucessfully').' '.$message); message(0, lang('create_thread_sucessfully')); } // 帖子详情 | post detail } else { // thread-{tid}-{page}-{keyword}.htm $tid = param(1, 0); $page = param(2, 1); $keyword = param(3); $pagesize = $conf['postlist_pagesize']; //$pagesize = 10; //$page == 1 AND $pagesize++; $thread = thread_read($tid); empty($thread) AND message(-1, lang('thread_not_exists')); $fid = $thread['fid']; $forum = forum_read($fid); empty($forum) AND message(3, lang('forum_not_exists')); $postlist = post_find_by_tid($tid, $page, $pagesize); empty($postlist) AND message(4, lang('post_not_exists')); if($page == 1) { empty($postlist[$thread['firstpid']]) AND message(-1, lang('data_malformation')); $first = $postlist[$thread['firstpid']]; unset($postlist[$thread['firstpid']]); $attachlist = $imagelist = $filelist = array(); // 如果是大站,可以用单独的点击服务,减少 db 压力 // if request is huge, separate it from mysql server thread_inc_views($tid); } else { $first = post_read($thread['firstpid']); } $keywordurl = ''; if($keyword) { $thread['subject'] = post_highlight_keyword($thread['subject'], $keyword); //$first['message'] = post_highlight_keyword($first['subject']); $keywordurl = "-$keyword"; } $allowpost = forum_access_user($fid, $gid, 'allowpost') ? 1 : 0; $allowupdate = forum_access_mod($fid, $gid, 'allowupdate') ? 1 : 0; $allowdelete = forum_access_mod($fid, $gid, 'allowdelete') ? 1 : 0; forum_access_user($fid, $gid, 'allowread') OR message(-1, lang('user_group_insufficient_privilege')); $pagination = pagination(url("thread-$tid-{page}$keywordurl"), $thread['posts'] + 1, $page, $pagesize); $header['title'] = $thread['subject'].'-'.$forum['name'].'-'.$conf['sitename']; //$header['mobile_title'] = lang('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']; } } $gid = isset($user['gid']) ? $user['gid'] : 0; $need_refresh = 0; //回复查看判断 $preg_reply = preg_match_all('/\[foxreply\](.*?)\[\/foxreply\]/i', $first['message_fmt'], $array); if($preg_reply){ $array_count = count($array[0]); $uid ? $html_reply = '' : $html_reply = ''; if($uid){ $replied = db_find_one('post', array('uid'=>$uid, 'tid'=>$thread['tid'])); }else{ $replied = array(); } for($i=0; $i<$array_count; $i++){ $a = $array[0][$i]; $b = ''; if($uid && $replied){ $first['message_fmt'] = str_replace($a, $b, $first['message_fmt']); } if($uid && $gid == 1){ $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; } } } //解析B站链接 $foxmv = preg_match_all('#\[foxmv\]([\s\S]*?)\[\/foxmv\]#', $first['message_fmt'], $foxmv_arr); //$foxmvAV_find = '/http([s]?):\/\/(.*?)\/av(\d+)(.*?)/'; //foxmvBV_find2 = '/http([s]?):\/\/(.*?)\/BV(\w+)(.*?)/'; $foxmvAV = '
'; $foxmvBV = '
'; $first['message_fmt'] = str_replace(array('/?share_source=copy_web', '?share_source=copy_web'), array('', ''), $first['message_fmt']); //$first['message_fmt'] = preg_replace('/http([s]?):\/\/(.*?)\/av(\d+)(.*?)/', $foxmvAV, $first['message_fmt']); //$first['message_fmt'] = preg_replace('/http([s]?):\/\/(.*?)\/BV(\w+)(.*?)/', $foxmvBV, $first['message_fmt']); $first['message_fmt'] = preg_replace('#

\[foxmv]http([s]?):\/\/(.*?)\/av(\d+)(.*?)\[\/foxmv\]<\/p>#',$foxmvAV, $first['message_fmt']); $first['message_fmt'] = preg_replace('#

\[foxmv]http([s]?):\/\/(.*?)\/BV(\w+)(.*?)\[\/foxmv\]<\/p>#',$foxmvBV, $first['message_fmt']); if (isset($haya_post_like_config['open_post']) && $haya_post_like_config['open_post'] == 1 ) { $hot_like_post_size = intval($haya_post_like_config['hot_like_post_size']) + 1; $hot_like_post_low_count = intval($haya_post_like_config['hot_like_post_low_count']); $haya_post_like_post_ids = array(); if (!empty($postlist)) { foreach ($postlist as $haya_post_like_post) { $haya_post_like_post_ids[] = $haya_post_like_post['pid']; } } $haya_post_like_life_time = isset($haya_post_like_config['hot_like_life_time']) ? intval($haya_post_like_config['hot_like_life_time']) : 86400; $haya_post_like_hot_posts = haya_post_like_find_hot_posts_by_tid_cache($thread['tid'], $hot_like_post_size, $hot_like_post_low_count, $haya_post_like_life_time); if (!empty($haya_post_like_hot_posts)) { if (isset($haya_post_like_config['hot_like_isfirst']) && $haya_post_like_config['hot_like_isfirst'] == 1 ) { $hot_like_isfirst = true; } else { $hot_like_isfirst = false; } $haya_post_like_hot_post_isfirst = false; foreach ($haya_post_like_hot_posts as $haya_post_like_hot_post_key => $haya_post_like_hot_post) { if ($haya_post_like_hot_post['isfirst'] == 1 && !$hot_like_isfirst) { unset($haya_post_like_hot_posts[$haya_post_like_hot_post_key]); $haya_post_like_hot_post_isfirst = true; } else { $haya_post_like_post_ids[] = $haya_post_like_hot_post['pid']; // 移除楼层 $haya_post_like_hot_posts[$haya_post_like_hot_post_key]['floor'] = ''; } } if (!$haya_post_like_hot_post_isfirst && (count($haya_post_like_hot_posts)) >= $hot_like_post_size) { array_pop($haya_post_like_hot_posts); } } $haya_post_like_pids = haya_post_like_find_by_pids_and_uid($haya_post_like_post_ids, $uid, count($haya_post_like_post_ids)); } $haya_sign_type = param('type', ''); if (!empty($haya_sign_type)) { if ($haya_sign_type == 'onlyhost') { $thread['posts'] = post_count(array( 'tid' => $thread['tid'], 'isfirst' => 0, 'uid' => $thread['uid'], )); } $pagination = pagination(url("thread-$tid-{page}$keywordurl", array('type' => $haya_sign_type)), $thread['posts'] + 1, $page, $pagesize); } $haya_sign_see_user = param('user', ''); if (!empty($haya_sign_see_user)) { $haya_sign_see_user_id = intval($haya_sign_see_user); if ($postlist) { foreach ($postlist as $haya_post_type_post_key => & $haya_post_type_post) { if ($haya_post_type_post['uid'] != $haya_sign_see_user_id) { unset($postlist[$haya_post_type_post_key]); } } } $pagination = pagination(url("thread-$tid-{page}$keywordurl", array('user' => $haya_sign_see_user_id)), $thread['posts'] + 1, $page, $pagesize); } if($thread['OK']!='1' && $group['see_check']!='1' && $uid!=$thread['uid']) { if($thread['OK']=='0') message(-1, "本帖正在审核中,您无权查看!"); elseif($thread['OK']=='-1') message(-1, "本帖未审核通过,您无权查看!"); elseif($thread['OK']=='-2') message(-1, "本帖正在回收站中,您无权查看!"); die(); } $spay_url = url('thread-sPay-'.$tid); $mycredits_url = url('my-credits'); if($thread['content_buy_type']=='3') {$thread['content_buy']/=1.0;} if($route=='mip') $html_pay='您好,本帖含有付费内容,请您点击下方“查看完整版网页”获取!'; else $html_pay='

'; $preg_pay = preg_match_all('/\[ttPay\](.*?)\[\/ttPay\]/i',$first['message_fmt'],$array); $first['purchased']='1'; $content_pay = db_find_one('paylist', array('tid' => $tid, 'uid' => $uid, 'type' => 1)); $is_set=0; if($thread['content_buy']){ if($preg_pay){ $array_count = count($array[0]); for($i=0;$i<$array_count;$i++){ $a = $array[0][$i]; $b = ''; if($content_pay||$thread['uid']==$uid) $first['message_fmt'] = str_replace($a,$b,$first['message_fmt']); elseif($uid && setting_get('tt_vip')['no_credits_see']=='1' && vip__isvip($user['vip_end'])==1) $first['message_fmt'] = str_replace($a,$b,$first['message_fmt']); else $first['message_fmt'] = str_replace($a,$is_set==0?$html_pay:'',$first['message_fmt']); $is_set=1;$first['purchased']='0'; } } }else{ $first['message_fmt'] = str_replace('[ttPay]','',$first['message_fmt']); $first['message_fmt'] = str_replace('[/ttPay]','',$first['message_fmt']); } $gid=isset($user['gid'])?$user['gid']:'0'; $my_p=$group['readp']; $target_p=$thread['readp']; $need_refresh=0; $set_vip = setting_get('tt_vip'); if($uid && $set_vip['up_read']!='0' && vip__isvip($user['vip_end'])) $my_p += $set_vip['up_read']; if(($gid!=1)&& $my_p<$target_p ){ message(-1, jump(lang('dear_p'), http_referer(), 2));die();} $preg_login = preg_match_all('/\[ttlogin\](.*?)\[\/ttlogin\]/i',$first['message_fmt'],$array); if($preg_login) { $array_count = count($array[0]); $html_hide=''; 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']); } } $preg_reply = preg_match_all('/\[ttreply\](.*?)\[\/ttreply\]/i',$first['message_fmt'],$array); if($preg_reply) { $array_count = count($array[0]); $html_reply =''; if($uid) $replied=db_find_one('post',array('uid'=>$uid,'tid'=>$thread['tid'])); else $replied=array(); for($i=0;$i<$array_count;$i++){ $a = $array[0][$i]; $b = ''; if($uid AND $replied)$first['message_fmt'] = str_replace($a,$b,$first['message_fmt']); if($uid AND isset($gid) AND $gid==1)$first['message_fmt'] = str_replace($a,$b,$first['message_fmt']); elseif($uid && $set_vip['no_reply_see']!='0' && vip__isvip($user['vip_end']) && vip_getlevel($uid)>=$set_vip['no_reply_see']) $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;} } } $set = setting_get('tt_read'); if($set&& $set['old']==1) { $preg_reply2 = preg_match_all('/\[reply\](.*?)\[\/reply\]/i',$first['message_fmt'],$array2); if($preg_reply2) { $array2_count = count($array2[0]); $html_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']); elseif($uid && $set_vip['no_reply_see']!='0' && vip__isvip($user['vip_end']) && vip_getlevel($uid)>=$set_vip['no_reply_see']) $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;} } } } if($thread['red_num']>=0){ $first['message_fmt'].='
'; $load_redpacket_js=1; $red_info = db_find_one('thread_red',array('tid'=>$tid)); } if($thread['VIPonly']) { if (empty($user)) { message(-1, jump("您好,请先登录!", url('my-credits'), 5)); die(); } if ($user['gid'] != 1 && !(vip__isvip($user['vip_end']))) { message(-1, jump("您好,本帖为VIP专属帖子,仅限VIP用户查看,请您开通VIP后查看!", url('my-credits'), 5)); die(); } } include _include(APP_PATH.'view/htm/thread.htm'); } ?>