function antispam_api_cmd_submit_ham in AntiSpam 6
Same name and namespace in other branches
- 7 antispam.module \antispam_api_cmd_submit_ham()
AntiSpam API: Submit Ham
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_ham()
- antispam_content_spam_operation in ./
antispam.module - Mark content as spam or remove the mark.
File
- ./
antispam.module, line 2173
Code
function antispam_api_cmd_submit_ham($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-positives/' . $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-ham');
return isset($response[1]) ? ANTISPAM_API_RESULT_SUCCESS : ANTISPAM_API_RESULT_ERROR;
}
}