<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class MonthAction extends ForumAction
{
    public function run()
    {
        $month = S::gp('time','G');
        if (!is_numeric($month) || 6 != strlen($month) || !preg_match('/^20(\d){4}/i', $month))
        {
            throw new iSystemException('错误请求');
        }
        
        $sql = "SELECT BM.forumname,BM.bookid,BM.level,BH.mcount AS monthmcount,BH.posts AS monthposts FROM ".BookForumMonth::table()." AS BH LEFT JOIN ".BookForum::table()." AS BM ON BM.bookid = BH.forumid WHERE BH.`date` = '$month'";
        $forums = $this->db()->setQueryString($sql)->find();
        
        $this->getController()->render('month', array(
        		'forums' => $forums,
                'month' => $month,
            )
        );
    }
}