/**
 * General test for any post data
 */
function ct_contact_form_validate_postdata()
{
    global $pagenow, $cleantalk_executed, $cleantalk_url_exclusions;
    if ($cleantalk_executed) {
        return null;
    }
    if (defined('DOING_AJAX') && DOING_AJAX) {
        return null;
    }
    if (isset($cleantalk_url_exclusions)) {
        $ct_cnt = sizeof($cleantalk_url_exclusions);
    } else {
        $ct_cnt = 0;
    }
    @header("CtExclusions: " . $ct_cnt);
    if ($_SERVER['REQUEST_METHOD'] != 'POST' || isset($_POST['log']) && isset($_POST['pwd']) && isset($pagenow) && $pagenow == 'wp-login.php' || isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action'] == 'lostpassword' || ct_check_array_keys($_POST) || (isset($pagenow) && $pagenow == 'wp-cron.php' || strpos($_SERVER['REQUEST_URI'], '/checkout/') !== false) || strpos($_SERVER['REQUEST_URI'], '/wp-admin/') !== false || strpos($_SERVER['REQUEST_URI'], 'wp-login.php') !== false || strpos($_SERVER['REQUEST_URI'], 'wp-comments-post.php') !== false || @strpos($_SERVER['HTTP_REFERER'], '/wp-admin/') !== false || check_url_exclusions()) {
        return null;
    }
    $_POST = ct_filter_array($_POST);
    $checkjs = js_test('ct_checkjs', $_COOKIE, true);
    $post_info['comment_type'] = 'feedback_general_postdata';
    $post_info = json_encode($post_info);
    if ($post_info === false) {
        $post_info = '';
    }
    $message = '';
    ct_get_fields_any_postdata($message, $_POST);
    if (strlen(trim($message)) < 10) {
        return null;
    }
    $skip_params = array('ipn_track_id', 'txn_type', 'payment_status');
    foreach ($skip_params as $key => $value) {
        if (@array_key_exists($value, $_GET) || @array_key_exists($value, $_POST)) {
            return null;
        }
    }
    $ct_base_call_result = ct_base_call(array('message' => $message, 'example' => null, 'sender_email' => '', 'sender_nickname' => '', 'post_info' => $post_info, 'sender_info' => get_sender_info(), 'checkjs' => $checkjs));
    $cleantalk_executed = true;
    $ct = $ct_base_call_result['ct'];
    $ct_result = $ct_base_call_result['ct_result'];
    if ($ct_result->allow == 0) {
        if (!(defined('DOING_AJAX') && DOING_AJAX)) {
            global $ct_comment;
            $ct_comment = $ct_result->comment;
            if (isset($_POST['cma-action']) && $_POST['cma-action'] == 'add') {
                $result = array('success' => 0, 'thread_id' => null, 'messages' => array($ct_result->comment));
                header("Content-Type: application/json");
                print json_encode($result);
                die;
            } else {
                ct_die(null, null);
            }
        } else {
            echo $ct_result->comment;
        }
        exit;
    }
    return null;
}
function ct_get_fields_any_postdata(&$message, $arr)
{
    $skip_params = array('ipn_track_id', 'txn_type', 'payment_status');
    foreach ($arr as $key => $value) {
        if (!is_array($value)) {
            if (in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) {
                //$contact = false;
            } else {
                $message .= "{$value}\n";
            }
        } else {
            ct_get_fields_any_postdata($message, $value);
        }
    }
}