Skip to content

Commit

Permalink
Tools::checkSpam()
Browse files Browse the repository at this point in the history
Signed-off-by: Jessica González <suki@missallsunday.com>
  • Loading branch information
MissAllSunday committed Mar 21, 2017
1 parent 4a47ec1 commit 8796fdb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/Services/Tools.php
Expand Up @@ -380,4 +380,22 @@ function timeElapsed($ptime)
}
}
}

function checkSpam($data = [])
{
if (empty($data))
return false;

$request = \Web::instance()->request('http://api.stopforumspam.org/api?'. http_build_query($data) .'&json');

if (!$request || empty($request['body']))
return false;

$r = json_decode($request['body']);

if ($r->username->appears || $r->email->appears || $r->ip->appears)
return true;

return false;
}
}

0 comments on commit 8796fdb

Please sign in to comment.