public function addToBlacklist() { $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->reportMalware($reportId); if ($addResult !== true) { $this->JsonResponse->setError('Could not send malware-report.'); echo $this->JsonResponse->getResponseData(); exit; } $this->JsonResponse->setMsg('Item successfully reported as malware. Thanks for your help.'); echo $this->JsonResponse->getResponseData(); exit; }