Skip to content

Commit

Permalink
removing some cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
wopsononock committed Feb 4, 2022
1 parent e347ad5 commit b1c5232
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions AkismetPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,26 +413,11 @@ function _sendPayload($data, $flag = false) {
return false;
}
// build the Akismet HTTP request
$requestBody = '';
foreach ($data as $k => $v) {
if (!empty($v)) {
$requestBody .= '&'.$k.'='.urlencode($v);
}
}
$requestBody = ltrim($requestBody, '&');
$host = $akismetKey.'.rest.akismet.com';
$port = 443;
$path = '/1.1/' . ($flag ? 'submit-spam' : 'comment-check');
$versionDao =& DAORegistry::getDAO('VersionDAO');
$dbVersion =& $versionDao->getCurrentVersion();
$ua = $dbVersion->getProduct().' '.$dbVersion->getVersionString().' | Akismet/3.1.7';
$httpRequest = "POST {$path} HTTP/1.0\r\n";
$httpRequest .= "Host: {$host}\r\n";
$httpRequest .= "Content-Type: application/x-www-form-urlencoded\r\n";
$httpRequest .= "Content-Length: ".strlen($requestBody)."\r\n";
$httpRequest .= "User-Agent: {$ua}\r\n";
$httpRequest .= "\r\n{$requestBody}";
$response = $errno = $errstr = $headers = $content = '';
$httpClient = Application::get()->getHttpClient();
try {$response = $httpClient->request(
'POST',
Expand All @@ -448,9 +433,6 @@ function _sendPayload($data, $flag = false) {
$content='';
error_log($e->getMessage());
}



return ((!$flag && $content === 'true') || ($flag && $content === 'Thanks for making the web a better place.'));
}

Expand Down

0 comments on commit b1c5232

Please sign in to comment.