tatus'=>0)); } // 引入模型文件 include_once _include(APP_PATH.'plugin/tt_ranklist/model/ranklist.func.php'); // 更新任务进度 $result = ranklist_update($uid,$fid);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))); }$forum_structure_r = $forumlist[$fid]['structure']; $forum_structure= explode('|',$forum_structure_r); $forum_structure_count = count($forum_structure); $update_array = array(); $update_array['tid']= $tid; for($i=0;$i<$forum_structure_count;$i++) $update_array['c'.($i+1)] = param('ini_'.($i+1),'-'); db_insert('thread_structure',$update_array);// 引入任务相关函数 include_once _include(APP_PATH.'plugin/tt_task/model/task.func.php'); // 更新发帖任务进度 $tasklist = task_find(array('available' => 1)); // 先检查是否有未完成的新手任务 $has_unfinished_novice_task = false; foreach($tasklist as $task) { if($task['type'] == 1) { // 新手任务 $condition = json_decode($task['condition'], true); if(!empty($condition) && isset($condition['type']) && $condition['type'] == 'post_thread') { $log = task_log_read($uid, $task['tid']); if(empty($log) || $log['status'] == 0) { $has_unfinished_novice_task = true; if(empty($log)) { task_log_create(array( 'uid' => $uid, 'tid' => $task['tid'], 'status' => 0, 'progress' => 1, 'start_date' => time(), 'complete_date' => 0 )); } else { task_log_update($uid, $task['tid'], array( 'progress+' => 1 )); } // 检查任务是否完成 task_check($uid, $task['tid']); break; } } } } // 如果没有未完成的新手任务,处理日常任务和成就任务 if(!$has_unfinished_novice_task) { foreach($tasklist as $task) { if($task['type'] == 2 || $task['type'] == 3) { // 日常任务或成就任务 $condition = json_decode($task['condition'], true); if(!empty($condition) && isset($condition['type']) && $condition['type'] == 'post_thread') { $log = task_log_read($uid, $task['tid']); // 对于日常任务,检查是否需要重置 if($task['type'] == 2 && !empty($log) && $log['status'] == 1) { // 检查完成时间是否是今天 if(date('Y-m-d', $log['complete_date']) != date('Y-m-d', time())) { // 不是今天完成的,重置任务状态 task_log_update($uid, $task['tid'], array( 'status' => 0, 'progress' => 0, 'complete_date' => 0 )); $log['status'] = 0; $log['progress'] = 0; } } if(empty($log)) { task_log_create(array( 'uid' => $uid, 'tid' => $task['tid'], 'status' => 0, 'progress' => 1, 'start_date' => time(), 'complete_date' => 0 )); } else if($log['status'] == 0 || $task['type'] == 3) { // 成就任务即使完成也继续记录 task_log_update($uid, $task['tid'], array( 'progress+' => 1 )); } // 检查任务是否完成 task_check($uid, $task['tid']); } } } } // 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); } unset($_SESSION['vcode']); unset($_SESSION['vcode_initpw_ok']); // 对 id 进行处理 if($is_vote==1) { $create_time = $time;//创建时间 $finish_time = $create_time+$vote_days*86400;//结束时间 $arr = array( 'tid'=>$tid, 'uid'=>$uid, 'create_time'=>$create_time, 'finish_time'=>$finish_time, 'type'=> $vote_type, 'max'=>$vote_max, 'subject'=>$vote_subject, ); //投票主题信息 $r = xn_vote_create($arr);//创建抽奖帖 $xn_vote = db_find_one('xn_vote',array('tid'=>$tid)); $vote_id = $xn_vote['vote_id']; foreach($vote_content_arr as $v) { $arr_optoin = array( 'vote_id' => $vote_id, 'tid' => $tid, 'content' => $v, ); xn_vote_info_create($arr_optoin); } //创建投票选项 thread_update($tid, array('is_vote'=>1));//修改帖子状态为投票帖 } 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++; /** * 定制请加QQ 1218894030 */ function isMobile() { // 如果有HTTP_X_WAP_PROFILE则一定是移动设备 if (isset ($_SERVER['HTTP_X_WAP_PROFILE'])) return true; // 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息 if (isset ($_SERVER['HTTP_VIA'])) { // 找不到为flase,否则为true return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false; } // 脑残法,判断手机发送的客户端标志,兼容性有待提高 if (isset ($_SERVER['HTTP_USER_AGENT'])) { $clientkeywords = array('nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu', 'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini', 'operamobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile'); // 从HTTP_USER_AGENT中查找手机浏览器的关键字 if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) return true; } // 协议法,因为有可能不准确,放到最后判断 if (isset ($_SERVER['HTTP_ACCEPT'])) { // 如果只支持wml并且不支持html那一定是移动设备 // 如果支持wml和html但是wml在html之前则是移动设备 if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) { return true; } } return false; } $thread = thread_read($tid); if (empty($thread)) { header("HTTP/1.1 404 Not Found"); $tpl = isMobile() ? 'm_404.html' : '404.html'; $imgid = mt_rand(1, 3); include _include(APP_PATH . 'plugin/nciaer_404/view/' . $tpl); die; } $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; $preg_lightbox = preg_match_all('//i',$first['message_fmt'],$preg_lightbox_result); if($preg_lightbox){ for($i=0;$i' ; $first['message_fmt'] = str_replace($from,$to,$first['message_fmt']); } } $first['message'] = fox_insertlink_to_html($first['message']); $first['message_fmt'] = fox_insertlink_to_html($first['message_fmt']); 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); } 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)); } 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); if($thread['content_buy_type']=='3') {$thread['content_buy']/=100.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']); 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']); } if($thread['red_num']>=0){ $first['message_fmt'].='
'; $load_redpacket_js=1; $red_info = db_find_one('thread_red',array('tid'=>$tid)); } preg_match("/\[storevod\](.*?)\[\/storevod\]/i", $first['message_fmt'], $vod_url); $storevod = strip_tags(array_value($vod_url, 1)); preg_match("/\[storehttp\](.*?)\[\/storehttp\]/i", $first['message_fmt'], $http_url); $storehttp = strip_tags(array_value($http_url, 1)); $first['message_fmt'] = preg_replace("@\[store(.*?)\](.*?)\[/store(.*?)\]@is", '', $first['message_fmt']); $first['message_fmt'] = preg_replace("/

<\/p>/", '', $first['message_fmt']); $first['message_fmt'] = preg_replace("/

<\/p>/", '', $first['message_fmt']); include _include(APP_PATH.'view/htm/thread.htm'); } ?>