<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class NewAction extends ForumAction
{
    public function run()
    {
        $bookpost = BookPost::single();
        if ($bookpost->isCanPost($this->id()))
        {
            $action = S::gp('a', 'P', 2);
            $data = array(
                'uid' => $this->uid(),
                'username' => $this->userName(),
                'message' => S::gp('message', 'P'),
                'action' => $action,
            );
            $bookpost->create($this->id(), $data);
        }
    
        $bookpost->updateUser($this->uid(), $this->userName());
        
        iforward($this->getController()->url('system',array('s'=>'forum','id'=>$this->id())));
    }
}