<?php
define('SCR','index');
$wind_in = 'hm';
require_once('global.php');
include_once(D_P.'data/bbscache/cache_index.php');
$notice = $index_whosonline = '';
if($groupid!='guest'){
list(,$faceurl,,)=showfacedesign($winddb['icon'],0);
$lastlodate=get_date($winddb['lastvisit'],'Y-m-d');
$level=$ltitle[$groupid];
}
unset($lneed,$lpic);
InitGP(array('cateid','online'));
$threadcate = '';
$forumdb = $catedb = $showsub = array();
if($db_forumdir){
require_once(R_P.'require/dirname.php');
} elseif(is_numeric($cateid)){
$cateinfo=$db->get_one_mem("SELECT style FROM hd_forums WHERE fid='$cateid'");
if(!empty($cateinfo['style']) && file_exists(D_P."data/style/$cateinfo[style].php")){
$skin=$cateinfo['style'];
}
$threadcate=" AND (f.fid='$cateid' OR f.fup='$cateid')";
}
require_once(R_P.'require/header.php');
$cmsadd = $db_showcms ? '' : "AND f.cms!='1'";
$topics = $article = $tposts = $c_htm = 0;
$newpic = (int)GetCookie('newpic');
$filename = D_P.'data/bbscache/cache_sssort.php';
$cateid = (int)$cateid;
$fidname = D_P.'data/bbscache/cache_sssort_'.$cateid.'.php';
$iscateid = $cateid?filemtime($fidname)>$timestamp-600:"1=1";
if(file_exists($filename) && filemtime($filename)>$timestamp-600 && $iscateid){
include_once($filename);
$cateid && include_once($fidname);
}else{
$query = $db->query("SELECT f.fid,f.childid,f.fup,f.type,f.logo,f.name, f.descrip,f.forumadmin,f.across,f.allowhtm,f.password,f.allowvisit,f.f_type,f.cms,f.showsub,f.viewordersx,fd.tpost,fd.topic,fd.article,fd.subtopic,fd.top1,fd.lastpost FROM hd_forums f LEFT JOIN hd_forumdata fd USING(fid) WHERE f.ifsub='0' $cmsadd $threadcate ORDER BY f.viewordersx,f.vieworder");
while($forums = $db->fetch_array($query)){
if($forums['type']==='category'){
if(strpos($_COOKIE['deploy'],"\t".$forums['fid']."\t")===false){
$forums['deploy_img']='fold';
} else{
$forums['deploy_img']='open';
$forums['tbody_style']='display:none;';
}
if($forums['forumadmin']){
$forumadmin=explode(",",$forums['forumadmin']);
foreach($forumadmin as $key => $value){
if($value){
if($key==10){$forums['admin'].='...'; break;}
$forums['admin'].="<a href=profile.php?action=show&username=".rawurlencode($value)." class=cfont>$value</a> ";
}
}
}
$catedb[]=$forums;
} elseif($forums['type']==='forum'){
if($forums['showsub'] && $forums['childid']){
$showsub[$forums['fid']]='';
}
$forums['topics']=$forums['topic']+$forums['subtopic'];
if($db_topped){
$forums['topics']+=$forums['top1'];
$forums['article']+=$forums['top1'];
}
$article+=$forums['article'];
$topics+=$forums['topics'];
$tposts+=$forums['tpost'];
if(empty($forums['password']) && (empty($forums['allowvisit']) || allowcheck($forums['allowvisit'],$groupid,$winddb['groups'],$forums['fid'],$winddb['visit']))){
list($f_a,$forums['au'],$f_c,$forums['ft'])=explode("\t",$forums['lastpost']);
preg_match_all("/\?tid=([0-9]+)&/",$forums['ft'],$out);
$forums['ft']= "r".$out[1][0]."/";
$forums['pic'] = $newpic<$f_c && ($f_c+$db_newtime>$timestamp) ? 'new' : 'old';
$forums['newtitle']=get_date($f_c);
$forums['t']=substrs($f_a,26);
} else{
if($forums['f_type']==='hidden' && $groupid != 3){
continue;
}
$forums['pic']="lock";
}
$forums['allowhtm']==1 && $c_htm=1;
if($db_indexfmlogo==2){
$forums['llogo']=$forums['logo']!='' ? "<img align=\"left\" src=\"$forums[logo]\" style=\"padding-right:5px\">":'';
} elseif($db_indexfmlogo==1){
$forumlogofile="$stylepath/forumlogo/$forums[fid].gif";
file_exists("$imgdir/$forumlogofile") && $forums['llogo']="<img align=\"left\" src=\"$imgpath/$forumlogofile\" style=\"padding-right:5px\">";
}
if($forums['forumadmin']){
$forumadmin=explode(",",$forums['forumadmin']);
foreach($forumadmin as $key => $value){
if($value){
if(!$db_adminshow){
$forums['admin'].="<a href=\"profile.php?action=show&username=".rawurlencode($value)."\">$value</a> ";
} else{
$forums['admin'].="<option value=\"$value\">$value</option>";
}
}
}
}
$forumdb[$forums['fup']][]=$forums;
}
}
$config = "<?php\r\n";
$config .= "\$article='$article';\r\n";
$config .= "\$topics='$topics';\r\n";
$config .= "\$tposts='$tposts';\r\n";
$config .= "?>";
!$cateid && writeover($filename,$config);
if($catedb){
writeover($fidname,"<?php\r\n\$catedb=".hd_var_export($catedb,1).";\r\n\$forumdb=".hd_var_export($forumdb,1)."\r\n?>");
}
$db->free_result($query);
unset($forums);
}
/**
* View sub
**/
if(!empty($showsub)){
include_once(D_P.'data/bbscache/forum_cache.php');
foreach($forum as $key=>$val){
$fup=$val['fup'];
if(isset($showsub[$fup]) && $val['f_type']!='hidden'){
$showsub[$fup] .= $showsub[$fup] ? ' | <a href="f'.$val['fid'].'/">'.$val['name'].'</a>' : '<a href="f'.$val['fid'].'/">'.$val['name'].'</a>';
}
}
}
/**
* Share union
*/
if($db_indexmqshare && $sharelink[1]){
$sharelink[1]="<marquee scrolldelay=\"100\" scrollamount=\"4\" onmouseout=\"if (document.all!=null){this.start()}\" onmouseover=\"if (document.all!=null){this.stop()}\" behavior=\"alternate\">$sharelink[1]</marquee>";
}
if(strpos($_COOKIE['deploy'],"\t".info."\t")===false){
$cate_img ='fold';
$cate_info='';
} else{
$cate_img ='open';
$cate_info='display:none;';
}
if(strpos($_COOKIE['deploy'],"\t".notice."\t")===false){
$notice_img = 'fold';
$cate_notice= '';
} else{
$notice_img = 'open';
$cate_notice= 'display:none;';
}
/**
* online users
*/
/*Update_ol();
if(empty($db_online)){
@include_once(D_P.'data/bbscache/olcache.php');
}
empty($online) && $online = GetCookie('online');
if($online=='yes' || $db_indexonline && $online!='no'){
if(empty($db_online) && $guestinbbs+$userinbbs>2000 && $windid!=$manager){
$online = 'no';
} else{
include_once Pcv(R_P.'require/online_'.$db_online.'.php');
}
} elseif($db_online){
$userinbbs = $guestinbbs = 0;
$query = $db->query_memcache("SELECT uid!=0 as ifuser,COUNT(*) AS count FROM hd_online GROUP BY uid='0'");
while($rt = $db->fetch_array($query))
foreach($query as $rt)
{
if($rt['ifuser']) $userinbbs=$rt['count']; else $guestinbbs=$rt['count'];
}
}
Cookie('online',$online);
*/
@extract($db->get_one_mem("SELECT * FROM hd_bbsinfo WHERE id=1"));
$rawnewuser=rawurlencode($newmember);
if(($timestamp-$tdtime)>85600){
if($db_hostweb == 1 && !$cateid && $groupid != 'guest'){
$db->update("UPDATE hd_bbsinfo SET yposts='$tposts', tdtcontrol='$tdtime' WHERE id=1");
$db->update("UPDATE hd_forumdata SET tpost=0 WHERE tpost<>'0'");
}
}
/**
* update posts hits
*/
if($c_htm || $db_hithour){
$db_hithour==0 && $db_hithour=4;
$hit_wtime=$hit_control*$db_hithour;
if($hit_wtime>24)$hit_wtime=0;
$hitsize=@filesize(D_P."data/bbscache/hits.txt");
if(($timestamp-$hit_tdtime)>$hit_wtime*3600 || $hitsize>1024){
require_once(R_P.'require/hitupdate.php');
}
}
if($higholnum<$usertotal){
$db->update("UPDATE hd_bbsinfo SET higholnum='$usertotal',higholtime='$timestamp' WHERE id=1");
$higholnum=$usertotal;
}
if($hposts<$tposts){
$db->update("UPDATE hd_bbsinfo SET hposts='$tposts' WHERE id=1");
$hposts=$tposts;
}
$mostinbbstime=get_date($higholtime);
if($db_onlinelmt!=0 && $usertotal>=$db_onlinelmt && !$ol_offset){
Cookie('ol_offset','',0);
Showmsg('most_online');
}
list($db_moneyname,$db_moneyunit,$db_rvrcname,$db_rvrcunit,$db_creditname,$db_creditunit)=explode("\t",$db_credits);
if($plantime && $timestamp>$plantime){
require_once(R_P.'require/task.php');
}
function hd_var_export($input,$f = 1,$t = null) {
$output = '';
if(is_array($input)){
$output .= "array(\r\n";
foreach($input as $key => $value){
$output .= $t."\t".hd_var_export($key,$f,$t."\t").' => '.hd_var_export($value,$f,$t."\t");
$output .= ",\r\n";
}
$output .= $t.')';
} elseif(is_string($input)){
$output .= $f ? "'".str_replace(array("\\","'"),array("\\\\","\'"),$input)."'" : "'$input'";
} elseif(is_int($input) || is_double($input)){
$output .= "'".(string)$input."'";
} elseif(is_bool($input)){
$output .= $input ? 'true' : 'false';
} else{
$output .= 'NULL';
}
return $output;
}
require_once PrintEot('index');footer();
?>