diff --git a/lib/SpotDb.php b/lib/SpotDb.php index 89ae65db4..962afe3cd 100755 --- a/lib/SpotDb.php +++ b/lib/SpotDb.php @@ -147,9 +147,9 @@ function isReportMessageIdUnique($messageid) { * Controleer of een user reeds een spamreport heeft geplaatst voor de betreffende spot */ function isReportPlaced($messageid, $userId) { - $tmpResult = $this->_conn->singleQuery("SELECT id FROM reportsposted WHERE inreplyto = '%s' AND ouruserid = '%d'", Array($messageid, $userId)); + $tmpResult = $this->_conn->singleQuery("SELECT id FROM reportsposted WHERE inreplyto = '%s' AND ouruserid = %d", Array($messageid, $userId)); - return (empty($tmpResult)); + return (!empty($tmpResult)); } #isReportPlaced /* diff --git a/lib/SpotPosting.php b/lib/SpotPosting.php index dc5d4bd01..03a74b309 100755 --- a/lib/SpotPosting.php +++ b/lib/SpotPosting.php @@ -178,10 +178,10 @@ public function postSpot($user, $spot, $imageFilename, $nzbFilename) { public function reportSpotAsSpam($user, $report) { $errorList = array(); - #controleer eerst of de user al een report heeft aangemaakt, dan kunnen we gelijk stoppen. - if (!$this->_db->isReportPlaced($report['inreplyto'], $user['userid'])) { + # Controleer eerst of de user al een report heeft aangemaakt, dan kunnen we gelijk stoppen. + if ($this->_db->isReportPlaced($report['inreplyto'], $user['userid'])) { $errorList[] = array('postreport_alreadyreported', array()); - } + } # if # haal de spot op waar dit een reply op is $spotsOverview = new SpotsOverview($this->_db, $this->_settings); diff --git a/lib/SpotTemplateHelper.php b/lib/SpotTemplateHelper.php index b005e20ba..41679d7ec 100755 --- a/lib/SpotTemplateHelper.php +++ b/lib/SpotTemplateHelper.php @@ -997,6 +997,13 @@ function getIndexFilter() { $spotUser = new SpotUserSystem($this->_db, $this->_settings); return $spotUser->getIndexFilter($this->_currentSession['user']['userid']); } # getIndexFilter + + /* + * Controleer of de user al een report heeft aangemaakt + */ + function isReportPlaced($messageId) { + return $this->_db->isReportPlaced($messageId, $this->_currentSession['user']['userid']); + } # isReportPlaced /* * Genereert een random string diff --git a/lib/page/SpotPage_reportpost.php b/lib/page/SpotPage_reportpost.php index 44ed01f9b..8ceea9d54 100755 --- a/lib/page/SpotPage_reportpost.php +++ b/lib/page/SpotPage_reportpost.php @@ -67,11 +67,7 @@ function render() { $formMessages['errors'] = $spotPosting->reportSpotAsSpam($this->_currentSession['user'], $report); if (empty($formMessages['errors'])) { - $postResult = array('result' => 'success', - 'user' => $this->_currentSession['user']['username'], - 'userid' => $spotSigning->calculateUserid($this->_currentSession['user']['publickey']), - 'body' => $report['body'] - ); + $postResult = array('result' => 'success'); } else { $postResult = array('result' => 'failure'); } # else diff --git a/templates/we1rdo/spotinfo.inc.php b/templates/we1rdo/spotinfo.inc.php index 15c973ab6..b5ebc6d5d 100755 --- a/templates/we1rdo/spotinfo.inc.php +++ b/templates/we1rdo/spotinfo.inc.php @@ -63,9 +63,11 @@ )" class=" sabnzbd-button" title="Add NZB to SabNZBd queue (s)"> -allowed(SpotSecurity::spotsec_report_spam, '')) { ?> +allowed(SpotSecurity::spotsec_report_spam, '')) { + if (!$tplHelper->isReportPlaced($spot['messageid'])) { +?> - +