Exemplo n.º 1
0
 public function addToWhitelist()
 {
     $reportId = (int) $_POST['reportId'];
     if (empty($reportId)) {
         $this->JsonResponse->setError('No report-id given.');
         echo $this->JsonResponse->getResponseData();
         exit;
     }
     $Wemahu = new Wemahu\Wemahu();
     $WemahuDatabase = new Wemahu\WordpressDatabase($this->wpdb);
     $Wemahu->setDatabase($WemahuDatabase);
     $WemahuStorage = new Wemahu\Storage();
     $Wemahu->setStorage($WemahuStorage);
     $initResult = $Wemahu->reinit();
     if ($initResult !== true) {
         $this->JsonResponse->setError('Could not init Wemahu.');
         echo $this->JsonResponse->getResponseData();
         exit;
     }
     $addResult = $Wemahu->addToFilecheckWhitelist($reportId);
     if ($addResult !== true) {
         $this->JsonResponse->setError('Could not add item to whitelist.');
         echo $this->JsonResponse->getResponseData();
         exit;
     }
     $this->JsonResponse->setMsg('Item successfully added to whitelist.');
     echo $this->JsonResponse->getResponseData();
     exit;
 }