<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class ViewAction extends ForumAction
{
    public function run()
    {
        $tid = S::gp('tid','G',2);
    	$stick = $this->db()->select()->from(BookStick::table())->where(array('id'=>$tid))->find(true);
    
        if (preg_match_all('/\[fid=(\d+)](.*?)\[\/fid\]/i', $stick['content'], $matches))
        {
            if (!empty($matches[1]))
            {
                $stick['content'] = preg_replace('/\[fid=(\d+)\](.*?)\[\/fid\]/i', ilink("$2", url('system',array('s'=>'forum','id'=>"$1"))), $stick['content']);
            }
        }
        
        $this->getController()->render('view',array(
                'bookid' => $this->id(),
                'stick' => $stick,
            )
        );
    }
}