function antispam_api_cmd_submit_spam in AntiSpam 6
Same name and namespace in other branches
- 7 antispam.module \antispam_api_cmd_submit_spam()
AntiSpam API: Submit Spam
Parameters
$content_type: string 'node' or 'comment':
$content: object $node or $comment:
Return value
integer See constants ANTISPAM_API_RESULT_xxx.
1 call to antispam_api_cmd_submit_spam()
- antispam_content_spam_operation in ./
antispam.module - Mark content as spam or remove the mark.
File
- ./
antispam.module, line 2135
Code
function antispam_api_cmd_submit_spam($content_type, $content) {
if (!variable_get('antispam_connection_enabled', 1)) {
return ANTISPAM_API_RESULT_ERROR;
}
$provider = antispam_get_service_provider();
$comment_data = antispam_prepare_comment_data($content_type, $content, $provider);
$api_host = antispam_get_api_host($provider);
$api_key = antispam_get_api_key($provider);
if (empty($api_key)) {
return ANTISPAM_API_RESULT_ERROR;
}
if ($provider == DEFENSIO_SERVICE) {
// DEFENSIO
$query_string = _antispam_api_build_query_string($comment_data);
$response = _antispam_api_http_post($query_string, $api_host, '/blog/' . DEFENSIO_API_VERSION . '/report-false-negatives/' . $api_key . '.yaml');
if (!isset($response[1])) {
return ANTISPAM_API_RESULT_ERROR;
}
return _antispam_parse_yaml_response($response[1], 'status') == 'success' ? ANTISPAM_API_RESULT_SUCCESS : ANTISPAM_API_RESULT_ERROR;
}
else {
// AKISMET, TYPEPAD
$query_string = _antispam_api_build_query_string($comment_data);
$host = $api_key . '.' . $api_host;
$response = _antispam_api_http_post($query_string, $host, '/' . AKISMET_API_VERSION . '/submit-spam');
return isset($response[1]) ? ANTISPAM_API_RESULT_SUCCESS : ANTISPAM_API_RESULT_ERROR;
}
}