Ejemplo n.º 1
0
 /**
  * 举报
  */
 public function actionReport()
 {
     $this->checkLogin();
     $data = array();
     $type = zmf::filterInput($_POST['t'], 't', 1);
     $url = zmf::filterInput($_POST['u'], 't', 1);
     $desc = zmf::filterInput($_POST['desc'], 't', 1);
     $sid = zmf::filterInput($_POST['k']);
     $allowType = array('posts', 'attachments', 'comments', 'question', 'answer', 'poipost', 'poitips');
     if (!in_array($type, $allowType)) {
         //Forbidden::updateTimes();
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if (!isset($sid) or !is_numeric($sid)) {
         $this->jsonOutPut(0, Yii::t('default', 'selectreporttarget'));
     }
     $data['uid'] = zmf::uid();
     $data['logid'] = $sid;
     $data['classify'] = $type;
     $data['url'] = $url;
     $data['desc'] = $desc;
     $data['ip'] = ip2long(Yii::app()->request->userHostAddress);
     $data['status'] = Posts::STATUS_STAYCHECK;
     $data['cTime'] = zmf::now();
     $fm = new Reports();
     $fm->attributes = $data;
     if ($fm->validate()) {
         if ($fm->save()) {
             $this->jsonOutPut(1, Yii::t('default', 'reportsuccess'));
         }
     } else {
         $this->jsonOutPut(0, Yii::t('default', 'unkownerror'));
     }
 }