Skip to content

Commit

Permalink
isReportPlaced() werkte net andersom dan de functie aangaf, daarnaast…
Browse files Browse the repository at this point in the history
… toegevoegd dat een spot twee keer reporten al door de UI afgevangen wordt
  • Loading branch information
rota committed Oct 4, 2011
1 parent 49058a1 commit 848f002
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/SpotDb.php
Expand Up @@ -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

/*
Expand Down
6 changes: 3 additions & 3 deletions lib/SpotPosting.php
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions lib/SpotTemplateHelper.php
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions lib/page/SpotPage_reportpost.php
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions templates/we1rdo/spotinfo.inc.php
Expand Up @@ -63,9 +63,11 @@
<?php } else { ?>
<th class="sabnzbd"><a onclick="downloadSabnzbd(<?php echo "'".$spot['id']."','".$spot['sabnzbdurl']."'"; ?>)" class="<?php echo "sab_".$spot['id'].""; ?> sabnzbd-button" title="Add NZB to SabNZBd queue (s)"> </a></th>
<?php } } ?>
<?php if ($tplHelper->allowed(SpotSecurity::spotsec_report_spam, '')) { ?>
<?php if ($tplHelper->allowed(SpotSecurity::spotsec_report_spam, '')) {
if (!$tplHelper->isReportPlaced($spot['messageid'])) {
?>
<th class="spamreport"><a onclick="$('form.postreportform').submit();" class="spamreport-button" title="Rapporteer deze spot als spam"></a> </th>
<?php } ?>
<?php } } ?>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit 848f002

Please sign in to comment.