<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class SinkAction extends BbsAction
{
    public function run()
    {
        $tid = $this->getTid();
        $thread = $this->getExistsThread($tid);
        $allows = $this->getAllows($thread);
        !$allows['sink'] && $this->NoPermission();

        $this->confirm('sink', $thread);
        
        $lastpost = $thread['lastpost'] - 7*24*360000;
        $this->db()->update(Threads::table())->value(array('lastpost'=>$lastpost))->where('id='.$tid)->q();
        
        iforward($this->getController()->url('system',array('s'=>'bbs','a'=>'thread','tid'=>$tid)));
    }
}