예제 #1
0
 public function actionDelanswerfile($id)
 {
     $this->flushUploadDir();
     $file = HoleAnswerFiles::model()->findByPk((int) $id);
     if (!$file) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     if ($file->answer->request->user_id != Yii::app()->user->id && !Yii::app()->user->isModer && $file->answer->request->hole->STATE != 'gibddre') {
         throw new CHttpException(403, 'Доступ запрещен.');
     }
     $file->delete();
     if (!isset($_GET['ajax'])) {
         $this->redirect(array('view', 'id' => $file->answer->request->hole->ID));
     }
 }