<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
class plgJDonationSpamDetect extends JPlugin
{
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
}
function onBeforeStoreDonor() {
require_once JPATH_ROOT.'/components/com_jdonation/helper/helper.php';
$user_ip = DonationHelper::get_ip_address();
$accFrequency = 0;
$access = 'yes';
if(function_exists('curl_version')){
$url = 'http:;
$data = array(
'ip' => $userip,
"badtorexit"
);
$data = http_build_query($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$xmlDatas = simplexml_load_string($result);
if ($xmlDatas->appears == $access && $xmlDatas->frequency >= $accFrequency) {
JError::raiseError( 404, JText::_('Spam detected') );
exit();
}
}
}
}