コード例 #1
0
 /**
  * Update reported resource (via ajax)
  */
 public function updatereportedAction()
 {
     $report_id = (int) $this->getRequest()->getParam('report_id');
     $mark_reported = (int) $this->getRequest()->getParam('mark_reported');
     $Reports = new Application_Model_Reports();
     $report = $Reports->getReport($report_id);
     $ret = false;
     if ($mark_reported == 1) {
         switch ($report['resource_type']) {
             case 'post':
                 // posts
                 $Posts = new Application_Model_Posts();
                 $ret = $Posts->markHidden($report['resource_id']);
                 break;
             case 'user':
             case 'group':
             case 'page':
                 // profiles
                 $Profiles = new Application_Model_Profiles();
                 $ret = $Profiles->markHidden($report['resource_id']);
                 break;
             case 'message':
                 // messages
                 $Messages = new Application_Model_Messages();
                 $ret = $Messages->markHidden($report['resource_id']);
                 break;
             case 'comment':
                 // comments
                 $Comments = new Application_Model_Comments();
                 $ret = $Comments->deleteComment($report['resource_id']);
                 break;
             case 'image':
                 // images
                 $Images = new Application_Model_Images();
                 $ret = $Images->deleteImage($report['resource_id'], 'posts');
                 $Reports->clearReports($report['resource_id'], 'image');
                 break;
             default:
                 break;
         }
     }
     $Reports->updateReport($report_id, $mark_reported);
     $this->getHelper('json')->sendJson($ret);
 }