<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * 删除高级贴
 *
 * @author yzxh24
 */
class DeleteAction extends BaseAction
{
    public function run()
    {
        //put your code here
        if(Yii::app()->request->isPostRequest)
		{
			// we only allow deletion via POST request
            $post = BookPostReplys::model()->findByPk(Yii::app()->request->getQuery('id'));
			$post->delete();

			// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
			if(!isset($_GET['ajax']))
            {
				$this->getController()->redirect(array('index'));
            }
		}
		else
        {
			throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
        }
    }
}