0) { $sql_select .= ',a.ifconvert,a.author,a.startdate,a.enddate,a.subject,a.content'; $sql_ljoin .= 'LEFT JOIN pw_announce a ON fd.aid=a.aid'; } $foruminfo = $db->get_one("SELECT f.*,fe.creditset,fe.forumset,fe.commend,fd.topic,fd.top1,fd.top2,fd.lastpost,fd.aids,fd.aidcache $sql_select FROM pw_forumdata fd LEFT JOIN pw_forums f ON fd.fid=f.fid LEFT JOIN pw_forumsextra fe ON fd.fid=fe.fid $sql_ljoin WHERE fd.fid='$fid'"); if ($foruminfo['startdate']<=$timestamp && (!$foruminfo['enddate'] || $foruminfo['enddate']>=$timestamp)) { $foruminfo['aid'] = $forum[$fid]['aid']; } else { $foruminfo['aid'] = 0; } $foruminfo['type']=='category' && ObHeader("index.php?cateid=$fid"); $forumset = unserialize($foruminfo['forumset']); $forumset['link'] && ObHeader($forumset['link']); $forumset['newtime'] && $db_newtime = $forumset['newtime']; $searchadd = $thread_children = $thread_online = $fastpost = $updatetop = $urladd = ''; !$foruminfo && Showmsg('data_error'); wind_forumcheck($foruminfo); $forumname = strip_tags($foruminfo['name']); list($guidename,$forumtitle) = getforumtitle(forumindex($foruminfo['fup'])); $db_metakeyword = str_replace(array('|',' - '),',',$forumtitle).'phpwind'; $foruminfo['keywords'] && $db_metakeyword = "$db_metakeyword,$foruminfo[keywords]"; $foruminfo['descrip'] && $db_metadescrip = strip_tags($foruminfo['descrip']); require_once(R_P.'require/header.php'); $ajaxcheck = $groupid == 3 ? 1 : 0; if (CkInArray($windid,$manager)) { $admincheck = 1; $ajaxcheck = 1; } elseif (admincheck($foruminfo['forumadmin'],$foruminfo['fupadmin'],$windid)) { $admincheck = 1; $ajaxcheck = 1; } elseif ($groupid!=5 && ($SYSTEM['tpctype'] || $SYSTEM['check'] || $SYSTEM['typeadmin'] || $SYSTEM['delatc'] || $SYSTEM['moveatc'] || $SYSTEM['copyatc'] || $SYSTEM['topped'])) { $admincheck = 1; } else { $admincheck = 0; } !$windid && $admincheck = 0; if (!$ajaxcheck && !$foruminfo['allowvisit']) { list($db_moneyname,,$db_rvrcname,,$db_creditname,) = explode("\t",$db_credits); forum_creditcheck(); } /* require_once(R_P.'require/credit.php'); if($fid==116) { $cur = UserCredit($winduid,3)<50 && Showmsg("XYZ小于50者无法进入本版"); } UserCredit($winduid,rvrc)调取威望值 */ if (!$ajaxcheck && $forumset['forumsell']) { forum_sell($fid); } InitGP(array('page','type','search','orderway','asc','special')); if ($foruminfo['forumadmin']) { $forumadmin = explode(",",$foruminfo['forumadmin']); foreach ($forumadmin as $key => $value) { if ($value) { if (!$db_adminshow) { if ($key==10) {$admin_T['admin'].='...'; break;} $admin_T['admin'].="$value "; } else { $admin_T['admin'].=""; } } } $admin_T['admin'] = ' '.$admin_T['admin']; } else { $admin_T = array(); } if ($forumset['commend']) { $foruminfo['commend'] = unserialize($foruminfo['commend']); if ($forumset['commendtime'] && $timestamp-$forumset['ifcommend']>$forumset['commendtime']) { updatecommend($fid,$forumset); } } /*** 版块浏览记录 ***/ $threadlog = str_replace(",$fid,",',',GetCookie('threadlog')); $threadlog.= ($threadlog ? '' : ',').$fid.','; substr_count($threadlog,',')>11 && $threadlog = preg_replace("/[\d]+\,/i",'',$threadlog,3); Cookie('threadlog',$threadlog); Update_ol(); list($msg_guide,$forumlist) = headguide($guidename); unset($forum,$guidename,$foruminfo['forumset']); $db_maxpage && $page > $db_maxpage && $page = $db_maxpage; (int)$page<1 && $page = 1; $ifsort = 0; $NT_A = $NT_C = array(); if ($page==1) { $tempnotice = array('NT_A' => $notice_A,'NT_C' => $notice_C[$cateid]); foreach ($tempnotice as $key => $value) { if (!empty($value)) { $ifsort = 1; foreach ($value as $v) { if (empty(${$key}) && $v['startdate']<=$timestamp && (!$v['enddate'] || $v['enddate']>=$timestamp)) { $v['rawauthor'] = rawurlencode($v['author']); $v['startdate'] = get_date($v['startdate']); !$v['url'] && $v['url'] = "notice.php?fid=$v[fid]#$v[aid]"; ${$key} = $v; } } } } } unset($notice_A,$notice_C); if ($foruminfo['aid']) { require_once(R_P.'require/bbscode.php'); $foruminfo['rawauthor'] = rawurlencode($foruminfo['author']); $foruminfo['startdate'] = get_date($foruminfo['startdate']); $foruminfo['content'] = convert(str_replace(array("\n","\r\n"),'
',$foruminfo['content']),$db_windpost,2); } if (strpos($_COOKIE['deploy'],"\t".thread."\t")===false) { $thread_img = 'fold'; $cate_thread = ''; } else { $thread_img = 'open'; $cate_thread = 'display:none;'; } $forumdb = $t_typedb = array(); if ($foruminfo['childid']) { require_once(R_P."require/thread_child.php"); } if ($admincheck) { InitGP(array('managemode','concle')); !$managemode && $managemode = GetCookie('managemode'); if ($concle == 1) { $concle = 2; $managemode = 1; Cookie("managemode","1",0); } elseif ($concle == 2) { $concle = 1; $managemode = ''; Cookie("managemode","",0); } elseif (!$managemode) { $concle = 1; } elseif ($managemode) { $concle = 2; } $trd_adminhide = "
"; } else { $trd_adminhide = ''; } $t_db = $foruminfo['t_type']; $t_db && $t_typedb = array_unique(explode("\t",$t_db)); $t_per= (int)$t_typedb[0]; unset($t_typedb[0],$foruminfo['t_type']);/* 0 */ if ($t_db && is_numeric($type) && isset($t_typedb[$type])) { $searchadd = " AND type='$type' AND ifcheck='1'"; $urladd .= "&type=$type"; $rs = $db->get_one("SELECT COUNT(*) AS count FROM pw_threads WHERE fid='$fid' $searchadd"); $count = $rs['count']; } elseif (is_numeric($special)) { $searchadd = " AND special='$special' AND ifcheck='1'"; $urladd .= "&special=$special"; $rs = $db->get_one("SELECT COUNT(*) AS count FROM pw_threads WHERE fid='$fid' $searchadd"); $count = $rs['count']; } elseif ($search=='digest') { $searchadd = " AND digest>'0' AND ifcheck='1'"; $urladd .= "&search=$search"; $rs = $db->get_one("SELECT COUNT(*) AS count FROM pw_threads WHERE fid='$fid' $searchadd"); $count = $rs['count']; } elseif ($search=='check') { if ($admincheck) { $searchadd = " AND ifcheck='0'"; } else { $searchadd = " AND authorid='$winduid' AND ifcheck='0'"; } $urladd .= "&search=$search"; $rs = $db->get_one("SELECT COUNT(*) AS count FROM pw_threads WHERE fid='$fid' $searchadd"); $count = $rs['count']; } elseif (is_numeric($search)) { $searchadd = " AND lastpost>='".($timestamp - $search*84600)."' AND ifcheck='1'"; $urladd .= "&search=$search"; $rs = $db->get_one("SELECT COUNT(*) AS count FROM pw_threads WHERE fid='$fid' $searchadd"); $count = $rs['count']; } else { $searchadd = " AND ifcheck='1'"; $count = $foruminfo['topic']; } if ($winddb['t_num']) { $db_perpage = $winddb['t_num']; } elseif ($forumset['threadnum']) { $db_perpage = $forumset['threadnum']; } if ($winddb['p_num']) { $db_readperpage = $winddb['p_num']; } elseif ($forumset['readnum']) { $db_readperpage = $forumset['readnum']; } if ($db_topped) { $sql = "fid='$fid' AND topped<2"; $topadd = 'topped'; $count += $foruminfo['top1']; } else { $sql = "fid='$fid'"; $topadd = 'topped'; } $tpcdb = $ordersel = $ascsel = array(); if ($gp_alloworder) { if (!in_array($orderway,array('lastpost','postdate','hits','replies'))) { $orderway = $forumset['orderway'] ? $forumset['orderway'] : 'lastpost'; } else { $urladd .= "&orderway=$orderway"; } $ordersel[$orderway]='selected'; if (!in_array($asc,array('DESC','ASC'))) { $asc = $forumset['asc'] ? $forumset['asc'] : 'DESC'; } else { $urladd .= "&asc=$asc"; } $ascsel[$asc]='selected'; } else { $asc = $forumset['asc'] ? $forumset['asc'] : 'DESC'; $orderway = $forumset['orderway'] ? $forumset['orderway'] : 'lastpost'; } $numofpage = ceil($count/$db_perpage); $numofpage < 1 && $numofpage = 1; if ($page>$numofpage) { $page = $numofpage; } $start_limit = ($page-1) * $db_perpage; $totalpage = min($numofpage,$db_maxpage); $pages = numofpage($count,$page,$numofpage,"thread.php?fid=$fid{$urladd}&",$db_maxpage); $attachtype = array('1'=>'img','2'=>'txt','3'=>'zip','4'=>'rar','5'=>'rar'); $fcache = 0; if ($db_fcachenum && $page<$db_fcachenum && empty($urladd)) { $fcachetime = @filemtime(D_P."data/bbscache/fcache_{$fid}_{$page}.php"); $lastpost = explode("\t",$foruminfo['lastpost']); if (!file_exists(D_P."data/bbscache/fcache_{$fid}_{$page}.php") || $lastpost[2]>$fcachetime && $timestamp-$fcachetime>$db_fcachetime) { $fcache = 1; } else { $fcache = 2; } } $threaddb = array(); if ($fcache < 2) { $R = 0; if ($db_topped) { $rows = $foruminfo['top1'] + $foruminfo['top2']; if ($start_limit < $rows) { $L = min($rows-$start_limit,$db_perpage); $limit = "LIMIT $start_limit,$L"; $limit2 = $L == $db_perpage ? '' : "LIMIT 0,".($db_perpage-$L); $toppeddb = array(); include_once(D_P."data/bbscache/toppeddb.php"); $toptids = $toppeddb['3'][1] ? $toppeddb['3'][1] : '-99'; if ($toppeddb['2'][$cateid][1]) { $toptids .= ','.$toppeddb['2'][$cateid][1]; } $query = $db->query("SELECT * FROM pw_threads WHERE tid IN($toptids) AND topped>1 ORDER BY topped DESC,lastpost DESC $limit"); while ($rt = $db->fetch_array($query)) { $tpcdb[] = $rt; } $db->free_result($query); unset($toptids,$L,$limit,$toppeddb); } else { list($st,$lt,$asc,$R) = getstart($start_limit-$rows,$asc,$count); $limit2 = "LIMIT $st,$lt"; } unset($rows); } else { list($st,$lt,$asc,$R) = getstart($start_limit,$asc,$count); $limit2 = "LIMIT $st,$lt"; } if ($limit2) { $topadd && $topadd .= $R ? ' ASC,' : ' DESC,'; $query = $db->query("SELECT * FROM pw_threads WHERE $sql $searchadd ORDER BY $topadd $orderway $asc $limit2"); while ($thread = $db->fetch_array($query)) { $tpcdb[] = $thread; } $db->free_result($query); } $R && $tpcdb = array_reverse($tpcdb); $rewids = ''; foreach ($tpcdb as $key => $thread) { $foruminfo['allowhtm']==1 && $htmurl=$db_htmdir.'/'.$fid.'/'.date('ym',$thread['postdate']).'/'.$thread['tid'].'.html'; if($winduid==$thread[black]){ $thread['tpcurl']=""; }else{ $thread['tpcurl']="read.php?tid=$thread[tid]".($page>1 ? "&fpage=$page" : ''); } if ($managemode==1) { $thread['tpcurl'].='&toread=1'; } elseif (!$foruminfo['cms'] && $foruminfo['allowhtm']==1 && file_exists(R_P.$htmurl)) { $thread['tpcurl']="$htmurl"; } $forumset['cutnums'] && $thread['subject'] = substrs($thread['subject'],$forumset['cutnums']); if ($thread['toolfield']) { list($t,$e) = explode(',',$thread['toolfield']); $sqladd = ''; if ($t && $t<$timestamp) { $sqladd .= ",toolinfo='',topped='0'";$t=''; $thread['topped']>1 && $updatetop=1; } if ($e && $e<$timestamp) { $sqladd .= ",titlefont=''";$thread['titlefont']='';$e=''; } if ($sqladd) { $thread['toolfield'] = $t.($e ? ','.$e : ''); $db->update("UPDATE pw_threads SET toolfield='$thread[toolfield]' $sqladd WHERE tid='$thread[tid]'"); } } /* 锁定帖子标题变灰色 if(($thread['locked']==1 || $thread['locked']==2) && !$thread[topped] && $fid!=131&& $fid!=5&& $fid!=78)$thread[subject]="$thread[subject]"; else */ if($winduid==$thread[black]){ $thread[subject]=""; } if ($thread['titlefont']){ $titledetail = explode("~",$thread['titlefont']); if ($titledetail[0]) $thread['subject'] = "$thread[subject]"; if ($titledetail[1]) $thread['subject'] = "$thread[subject]"; if ($titledetail[2]) $thread['subject'] = "$thread[subject]"; if ($titledetail[3]) $thread['subject'] = "$thread[subject]"; if ($titledetail[6]&&$fid=='29') $thread['subject'] = "$thread[subject]"; //斑竹回复 } if ($thread['ifmark']) { //博彩区红黑自动统计 if($fid=="110"){ $thread['ifmark'] = $thread['ifmark']>0 ? " 【本盘黑/计:+$thread[ifmark] 】 " : " 【本盘红/计: $thread[ifmark] 】 "; } else { $thread['ifmark'] = $thread['ifmark']>0 ? " ( +$thread[ifmark] ) " : " ( $thread[ifmark] ) "; } } else { unset($thread['ifmark']); } if ($thread['special']==1) { $p_status = $thread['locked']%3 == 0 ? 'vote' : 'votelock'; } elseif ($thread['locked']%3<>0) { $p_status = $thread['locked']%3 == 1 ? 'topiclock' : 'topicclose'; } else { $p_status = $thread['ifmagic'] ? 'magic' : ($thread['replies']>=10 ? 'topichot' : 'topicnew'); } $thread['inspect'] && $thread['inspect'] = explode("\t",$thread['inspect']); $thread['status'] = ""; $thread['topped'] && $ifsort=1; $thread['ispage'] = ''; if ($thread['replies']+1>$db_readperpage) { if (($thread['replies']+1)%$db_readperpage==0) { $numofpage = ($thread['replies']+1)/$db_readperpage; } else { $numofpage = floor(($thread['replies']+1)/$db_readperpage)+1; } $thread['ispage']=' '; $thread['ispage'].=" "; for($j=1; $j<=$numofpage; $j++) { if ($j==6 && $j+1<$numofpage) { if($winduid==$thread[black]){ $thread['ispage'].=" "; }else{ $thread['ispage'].=" .. $numofpage"; } break; } if($winduid==$thread[black]){ $thread['ispage'].=" "; }else{ $thread['ispage'].=" $j"; } } $thread['ispage'].=' '; } $thread['postdate'] = get_date($thread['postdate'],'Y-m-d'); $postdetail = explode(",",$thread['lastpost']); if ($thread['ifupload']) { $atype = $attachtype[$thread['ifupload']]; $thread['titleadd']=" "; } else { $thread['titleadd']=""; } $thread['lstptime'] = get_date($thread['lastpost']); if ($admincheck) { if ($thread['fid']==$fid) { $thread['adminbox']=""; } else { $thread['adminbox']=""; } } if ($db_threademotion) { if ($thread['icon']=="R"||!$thread['icon']) { $thread['useriocn']=''; } else { $thread['useriocn']=" "; } } if ($thread['anonymous'] /*&& !$SYSTEM['viewhide']*/ ) { $thread['author'] = $db_anonymousname; $thread['authorid'] = 0; } //增加多彩用户名颜色 include_once(D_P.'hack/authorstyle/data/authorstyledb.php'); $name = $thread['author']; $mystyle = $db->get_one("SELECT mystyle FROM pw_members WHERE username='$name'"); if($mystyle[mystyle]) { $mystyle[mystyle] = explode(',',$mystyle[mystyle]); } else { $mystyle[mystyle] = ''; } //游客不可见真正ID if($groupid=='guest'){$thread['author']= "游客请登陆";$thread['authorid'] = 0;} $thread[lastposter]="by:".$thread[lastposter]; $thread[replies]=$thread[replies]."/".$thread[hits]; if($winduid==$thread[black]){ $thread['author']= "";$thread['authorid'] = 0; $thread[status]= ""; $thread['tid']= ""; $thread[useriocn]= ""; $thread[replies]= ""; $thread[hits]= ""; $thread[postdate]= ""; $thread['type']= ""; $thread[lstptime]= ""; $thread[lastposter] = ""; $thread[lastpost]= 0; } if ($thread['special'] == 3 && $thread['state'] < 1) { $rewids .= ($rewids ? ',' : '').$thread['tid']; } $threaddb[$thread['tid']] = $thread; } if ($rewids) { $query = $db->query("SELECT tid,cbval,caval FROM pw_reward WHERE tid IN($rewids)"); while ($rt = $db->fetch_array($query)) { $threaddb[$rt['tid']]['rewcredit'] = $rt['cbval'] + $rt['caval']; } } //Start Here帖子排行榜 if ($db_ifsort&2 && $foruminfo['password']==''&& $foruminfo['quanxian']=='' && $foruminfo['allowvisit']=='' && $foruminfo['f_type']!='hidden' && !$forumset['forumsell']) { require_once(R_P.'require/sort.php'); sort_post($threaddb); } //End Here if ($updatetop) { require_once(R_P.'require/updateforum.php'); updatetop(); } if ($fcache == 1) { writeover(D_P."data/bbscache/fcache_{$fid}_{$page}.php", ""); } unset($tpcdb,$query,$topadd,$searchadd,$sql,$limit2,$p_status,$updatetop,$R); } else { include_once(D_P."data/bbscache/fcache_{$fid}_{$page}.php"); if ($page == 1 && !$ifsort) { foreach ($threaddb as $key => $value) { $value['topped'] && $ifsort = 1; break; } } } if ($db_threadshowpost==1 && $groupid!='guest') { $psot_sta = $titletop1 = ''; $fastpost = 'fastpost'; $t_exits = 0; if ($t_typedb) { foreach ($t_typedb as $value) { if ($value) $t_exits = 1; } } $db_forcetype = $t_exits && $t_per=='2' && !$admincheck ? 1 : 0; // 是否需要强制主题分类 } $db_menuinit .= ",'td_post' : 'menu_post','td_post1' : 'menu_post'"; //allowtype onoff if ($foruminfo['allowtype'] && (($foruminfo['allowtype'] & 1) || ($foruminfo['allowtype'] & 2 && $gp_allownewvote) || ($foruminfo['allowtype'] & 4 && $gp_allowactive) || ($foruminfo['allowtype'] & 8 && $_G['allowreward'])|| ($foruminfo['allowtype'] & 16))) { $N_allowtypeopen = true; } else { $N_allowtypeopen = false; } require_once PrintEot('thread'); $noticecache = 900; $foruminfo['enddate'] && $foruminfo['enddate']<=$timestamp && $foruminfo['aidcache'] = $timestamp-$noticecache; if ($foruminfo['aidcache'] && $timestamp-$foruminfo['aidcache']>$noticecache-1 && ($foruminfo['startdate']>$timestamp || ($foruminfo['enddate'] && ($foruminfo['enddate']<=$timestamp || $foruminfo['aids'])))) { $foruminfo['aid'] && $foruminfo['aids'] .= ",$foruminfo[aid]"; require_once(R_P.'require/updatenotice.php'); updatecache_i($fid,$foruminfo['aids']); } footer(); function getstart($start,$asc,$count) { global $db_perpage,$page,$numofpage; $limit = $db_perpage; if ($page>20 && $page>ceil($numofpage/2)) { $asc = $asc=='DESC' ? 'ASC' : 'DESC'; $start = $count-$page*$db_perpage; if ($start < 0) { $limit = $db_perpage+$start; $start = 0; } return array($start,$limit,$asc,1); } else { return array($start,$limit,$asc,0); } } ?>