<?php

define('CURSCRIPT', 'forum');

require_once './engine/common.inc.php';

if($forumisclosed){
	showmsg($forumclosedreason);
}

$siteheadtitle=implode(' ',array($forumname,$sitename,$sitekeywords));

$q=$db->query("select * from g_forumcategory");
while($foruminfo=$db->fetch_array($q)){
	if($foruminfo['pid']==0){
		$dbforumgroups[]=$foruminfo;
	}else{
		if($timestamp-$foruminfo['upstatus']>86400){
			$foruminfo['todayposts'] = 0;
		}
		if($foruminfo['lastpost']){
			list($foruminfo['lastpostid'],$foruminfo['lastpost'],$foruminfo['lastauthor'],$foruminfo['lasttime'])=explode("\t",$foruminfo['lastpost']);
		}else{
	    	list($foruminfo['lastpostid'],$foruminfo['lastpost'],$foruminfo['lastauthor'],$foruminfo['lasttime'])=array(0,'','','');
		}
		$dbforums[$foruminfo['pid']][]=$foruminfo;
	}
}
include($templatedir."forums.tpl.php");