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

        $this->confirm('lock', $thread);
        $this->db()->update(Threads::table())->value(array('islock'=>1))->where('id='.$tid)->q();
        
        $message[] = '操作成功';
        $message[] = '返回'.ilink('帖子',$this->getController()->url('system',array('s'=>'bbs','a'=>'thread','tid'=>$tid))).'.'.ilink('版块',$this->getController()->url('system',array('s'=>'bbs','a'=>'forum','fid'=>$thread['fid'])));
        $this->showMessage($message);
    }
}