function ct_get_fields_any(&$email, &$message, &$nickname, &$subject, &$contact, $arr)
{
    $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)) {
            $contact = false;
        }
    }
    foreach ($arr as $key => $value) {
        if (!is_array($value) && !is_object($value) && @get_class($value) != 'WP_User') {
            if (in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) {
                $contact = false;
            }
            if ($email === '' && @preg_match("/^\\S+@\\S+\\.\\S+\$/", $value)) {
                $email = $value;
            } else {
                if ($nickname === '' && ct_get_data_from_submit($value, 'name')) {
                    $nickname = $value;
                } else {
                    if ($subject === '' && ct_get_data_from_submit($value, 'subject')) {
                        $subject = $value;
                    } else {
                        @($message .= "{$value}\n");
                    }
                }
            }
        } else {
            if (!is_object($value) && @get_class($value) != 'WP_User') {
                ct_get_fields_any($email, $message, $nickname, $subject, $contact, $value);
            }
        }
    }
}
/**
 * General test for any contact form
 */
function ct_contact_form_validate()
{
    global $pagenow, $cleantalk_executed, $cleantalk_url_exclusions;
    if ($cleantalk_executed) {
        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($pagenow) && $pagenow == 'wp-login.php' || isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action'] == 'lostpassword' || 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() || ct_check_array_keys($_POST)) {
        return null;
    }
    @header("CtConditions: Pased");
    $_POST = ct_filter_array($_POST);
    $checkjs = js_test('ct_checkjs', $_COOKIE, true);
    $post_info['comment_type'] = 'feedback_general_contact_form';
    $post_info = json_encode($post_info);
    if ($post_info === false) {
        $post_info = '';
    }
    $sender_email = '';
    $sender_nickname = '';
    $subject = '';
    $message = '';
    $contact_form = true;
    ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
    // Skip submission if no data found
    if ($sender_email === '' || !$contact_form) {
        return false;
    }
    $cleantalk_executed = true;
    if (isset($_POST['TellAFriend_Link'])) {
        $tmp = $_POST['TellAFriend_Link'];
        unset($_POST['TellAFriend_Link']);
    }
    $ct_base_call_result = ct_base_call(array('message' => $subject . "\n\n" . $message, 'example' => null, 'sender_email' => $sender_email, 'sender_nickname' => $sender_nickname, 'post_info' => $post_info, 'sender_info' => get_sender_info(), 'checkjs' => $checkjs));
    if (isset($_POST['TellAFriend_Link'])) {
        $_POST['TellAFriend_Link'] = $tmp;
    }
    $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 {
                if (isset($_POST['TellAFriend_email'])) {
                    echo $ct_result->comment;
                    die;
                } else {
                    ct_die(null, null);
                }
            }
        } else {
            echo $ct_result->comment;
        }
        exit;
    }
    return null;
}
/**
 * General test for any contact form
 */
function ct_contact_form_validate()
{
    global $pagenow, $cleantalk_executed, $cleantalk_url_exclusions, $ct_options, $ct_data;
    $ct_options = ct_get_options();
    $ct_data = ct_get_data();
    if ($cleantalk_executed) {
        return null;
    }
    if (isset($cleantalk_url_exclusions)) {
        $ct_cnt = sizeof($cleantalk_url_exclusions);
    } else {
        $ct_cnt = 0;
    }
    //@header("CtExclusions: ".$ct_cnt);
    cleantalk_debug("CtExclusions", $ct_cnt);
    if (@sizeof($_POST) == 0 || isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password']) || isset($pagenow) && $pagenow == 'wp-login.php' || isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action'] == 'lostpassword' || 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 || strpos($_SERVER['REQUEST_URI'], '/login/') !== false || isset($_GET['ptype']) && $_GET['ptype'] == 'login' || check_url_exclusions() || ct_check_array_keys($_POST) || isset($_POST['ct_checkjs_register_form']) || isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) || @intval($ct_options['general_contact_forms_test']) == 0 || isset($_POST['bbp_topic_content']) || isset($_POST['bbp_reply_content']) || isset($_COOKIE[LOGGED_IN_COOKIE]) || isset($_POST['fscf_submitted']) || strpos($_SERVER['REQUEST_URI'], '/wc-api/') !== false) {
        return null;
    }
    //@header("CtConditions: Passed");
    cleantalk_debug("CtConditions", "Passed");
    $_POST = ct_filter_array($_POST);
    //@header("CtFilterArray: Passed");
    cleantalk_debug("CtFilterArray", "Passed");
    $checkjs = js_test('ct_checkjs', $_COOKIE, true);
    $post_info['comment_type'] = 'feedback_general_contact_form';
    $post_info = json_encode($post_info);
    if ($post_info === false) {
        $post_info = '';
    }
    $sender_email = '';
    $sender_nickname = '';
    $subject = '';
    $message = '';
    $contact_form = true;
    @ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
    //@header("CtGetFieldsAny: Passed");
    cleantalk_debug("CtGetFieldsAny", "Passed");
    //@header("CtSenderEmail: $sender_email");
    cleantalk_debug("CtSenderEmail", $sender_email);
    if ($contact_form) {
        //@header("CtContactForm: true");
        cleantalk_debug("CtContactForm", "true");
    } else {
        //@header("CtContactForm: false");
        cleantalk_debug("CtContactForm", "false");
    }
    // Skip submission if no data found
    if ($sender_email === '' || !$contact_form) {
        return false;
    }
    $cleantalk_executed = true;
    if (isset($_POST['TellAFriend_Link'])) {
        $tmp = $_POST['TellAFriend_Link'];
        unset($_POST['TellAFriend_Link']);
    }
    //@header("CtBaseCallBefore: 1");
    cleantalk_debug("CtBaseCallBefore", "1");
    $ct_base_call_result = ct_base_call(array('message' => $subject . "\n\n" . $message, 'example' => null, 'sender_email' => $sender_email, 'sender_nickname' => $sender_nickname, 'post_info' => $post_info, 'sender_info' => get_sender_info(), 'checkjs' => $checkjs));
    //@header("CtBaseCall: Executed");
    cleantalk_debug("CtBaseCall", "Executed");
    if (isset($_POST['TellAFriend_Link'])) {
        $_POST['TellAFriend_Link'] = $tmp;
    }
    $ct = $ct_base_call_result['ct'];
    $ct_result = $ct_base_call_result['ct_result'];
    if ($ct_result->allow == 0) {
        //@header("CtResult: Not Allow");
        cleantalk_debug("CtResult", "Not Allow");
        if (!(defined('DOING_AJAX') && DOING_AJAX)) {
            //@header("AJAX: No");
            cleantalk_debug("AJAX", "No");
            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 {
                if (isset($_POST['TellAFriend_email'])) {
                    echo $ct_result->comment;
                    die;
                } else {
                    ct_die(null, null);
                }
            }
        } else {
            //@header("AJAX: Yes");
            cleantalk_debug("AJAX", "Yes");
            echo $ct_result->comment;
        }
        exit;
    }
    //@header("CtResult: Allow");
    cleantalk_debug("CtResult", "Allow");
    return null;
}