示例#1
0
function cpg_akismet_submit_data($variable_array, $type = '')
{
    global $akismet_config;
    $result = cpg_akismet_verify_key();
    if ($result != TRUE) {
        return FALSE;
    }
    if ($type == 'ham') {
        $submit_type = 'submit-ham';
    } elseif ($type == 'spam') {
        $submit_type = 'submit-spam';
    } else {
        $submit_type = 'comment-check';
    }
    $variable_array['blog'] = $akismet_config['blog'];
    $host = $akismet_config['key'] . '.' . $akismet_config['akismet_host'];
    $url = 'http://' . $host . '/' . $akismet_config['akismet_version'] . '/' . $submit_type;
    $result = cpg_akismet_send($variable_array, $host, $url);
    // Akismet sends the a lower-case string "true" back, not to be confused with a boolean!
    // We convert this to a boolean return value.
    if ($result[1] == 'true') {
        return TRUE;
    } else {
        return FALSE;
    }
}
    list($timestamp, $form_token) = getFormToken();
    echo "<input type=\"hidden\" name=\"form_token\" value=\"{$form_token}\" />\n     <input type=\"hidden\" name=\"timestamp\" value=\"{$timestamp}\" /></form>";
    if ($CONFIG['comment_akismet_api_key'] != '') {
        print '<br /><a name="akismet"></a>';
        starttable('-2', $icon_array['info'] . $lang_reviewcom_php['akismet'], 2);
        print <<<EOT
    <tr>
        <td class="tableb" colspan="2">
EOT;
        print sprintf($lang_reviewcom_php['akismet_count'] . '.', '<strong>' . cpg_float2decimal($CONFIG['comment_akismet_counter']) . '</strong>');
        print <<<EOT
        </td>
    </tr>
EOT;
        $test_text = sprintf($lang_reviewcom_php['akismet_test_result'], '<strong>' . $CONFIG['comment_akismet_api_key'] . '</strong>');
        $result = cpg_akismet_verify_key();
        if (stripos($result[0], '404 Not Found') != FALSE) {
            $test_result = $icon_array['cancel'] . $lang_reviewcom_php['not_found'];
            $test_error = $result[0];
        } elseif (stripos($result[1], 'Error') != FALSE) {
            $test_result = $icon_array['stop'] . $lang_reviewcom_php['unknown_error'];
            $test_error = $result[1];
        } elseif ($result == TRUE) {
            $test_result = $icon_array['ok'] . $lang_common['ok'];
            $test_error = '';
        } elseif (stripos($result[0], 'Empty "blog" value') != FALSE) {
            $test_result = $icon_array['stop'] . $lang_reviewcom_php['missing_gallery_url'];
            $test_error = '';
        } elseif ($result[1] == 'invalid') {
            $test_result = $icon_array['stop'] . $lang_reviewcom_php['invalid'];
            $test_error = '';