<?php

/**
 *      [Discuz!] (C)2009-2012 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *      方易生活网http://www.98fy.com 联系QQ：860869898
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

$date_am = dgmdate($_G['timestamp'], 'Y-m-d');
$date_pm = dgmdate($_G['timestamp'], 'H') < 12 ? dgmdate($_G['timestamp'] - 86400, 'Y-m-d') : $date_am;
$ampm = dgmdate($_G['timestamp'], 'H') < 12 ? 'am' : 'pm';

$usernum = DB::result_first("SELECT count(*) FROM ".DB::table('common_member'));

$onlinenum = DB::result_first("SELECT count(*) FROM ".DB::table('common_session'));
loadcache(array('onlinerecord'));
$onlineinfo = explode("\t", $_G['cache']['onlinerecord']);

$home_mz=array();$query=DB::query("SELECT doid,uid,username,message,dateline FROM ".DB::table('home_doing')." ORDER BY doid desc limit 4");while($item=DB::fetch($query))$home_mz[]=$item;

$sql = "SELECT * FROM ".DB::table('forum_forum')." WHERE status IN ('1','2') ORDER BY type, displayorder";
$query = DB::query($sql);
while($forum = DB::fetch($query)) {
	if($forum['type'] != 'group') {
		$todayposts += $forum['todayposts'];
		if($forum['type'] == 'forum' && isset($catlist[$forum['fup']])) {
			$catlist[$forum['fup']]['forums'][] = $forum['fid'];
			$catlist[$forum['fup']]['posts'] += $forum['posts'];
			$forumlist[$forum['fid']] = $forum;
		} elseif(isset($forumlist[$forum['fup']])) {
			$catlist[$forumlist[$forum['fup']]['fup']]['posts'] += $forum['posts'];
		}
	} else {
		$catlist[$forum['fid']] = $forum;
	}
}
?>