$email, 'sender_nickname' => '', 'sender_info' => $sender_info, 'js_on' => $checkjs, ), true ); $ct_result = $base_call_result['ct_result']; if ($ct_result->allow===0){ $is_good=false; } } if($is_good){ $ajaxresult=array( 'description' => null, 'cssClass' => 'noon', 'code' => 'success' ); }else{ $ajaxresult=array( 'description' => 'Invalid Email', 'cssClass' => 'error-container', 'code' => 'error' ); } $ajaxresult = json_encode($ajaxresult); print $ajaxresult; wp_die(); } function ct_user_register_ajaxlogin($user_id) { if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit') { $checkjs = apbct_js_test('ct_checkjs', $_POST); $sender_info['post_checkjs_passed'] = $checkjs; if ($checkjs === null){ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE); $sender_info['cookie_checkjs_passed'] = $checkjs; } //Making a call $base_call_result = apbct_base_call( array( 'sender_email' => sanitize_email($_POST['email']), 'sender_nickname' => sanitize_email($_POST['login']), 'sender_info' => $sender_info, 'js_on' => $checkjs, ), true ); $ct_result = $base_call_result['ct_result']; if ($ct_result->allow === 0) { wp_delete_user($user_id); } } return $user_id; } /** * Hook into MailChimp for WordPress `mc4wp_form_errors` filter. * * @param array $errors * @return array */ function ct_mc4wp_ajax_hook( array $errors ) { $result = ct_ajax_hook(); // only return modified errors array when function returned a string value (the message key) if( is_string( $result ) ) { $errors[] = $result; } return $errors; } function ct_ajax_hook($message_obj = false, $additional = false) { global $apbct, $current_user; $message_obj = (array)$message_obj; // Get current_user and set it globaly apbct_wp_set_current_user($current_user instanceof WP_User ? $current_user : apbct_wp_get_current_user() ); // $_REQUEST['action'] to skip. Go out because of not spam data $skip_post = array( 'apbct_js_keys__get', // Our service code 'gmaps_display_info_window', // Geo My WP pop-up windows. 'gmw_ps_display_info_window', // Geo My WP pop-up windows. 'the_champ_user_auth', // Super Socializer 'simbatfa-init-otp', //Two-Factor Auth 'wppb_msf_check_required_fields', //ProfileBuilder skip step checking 'boss_we_login', //Login form 'sidebar_login_process', // Login CF7 'cp_update_style_settings', // Convert Pro. Saving settings 'updraft_savesettings', // UpdraftPlus 'wpdUpdateAutomatically', //Comments update 'upload-attachment', // Skip ulpload attachments 'iwj_update_profile', //Skip profile page checker 'st_partner_create_service', //Skip add hotel via admin 'vp_ajax_vpt_option_save', // https://themeforest.net/item/motor-vehicles-parts-equipments-accessories-wordpress-woocommerce-theme/16829946 'mailster_send_test', //Mailster send test admin 'acf/validate_save_post', //ACF validate post admin 'admin:saveThemeOptions', //Ait-theme admin checking 'save_tourmaster_option', //Tourmaster admin save 'validate_register_email', // Service id #313320 'elementor_pro_forms_send_form', //Elementor Pro 'phone-orders-for-woocommerce', //Phone orders for woocommerce backend 'ihc_check_reg_field_ajax', //Ajax check required fields 'OSTC_lostPassword', //Lost password ajax form 'check_retina_image_availability', //There are too many ajax requests from mobile 'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation. 'edit-comment', // Edit comments by admin ??? that shouldn't happen 'formcraft3_save_form_progress', // FormCraft – Contact Form Builder for WordPress. Save progress. 'wpdmpp_save_settings', // PayPal save settings. 'iwj_login', // Fix for unknown plugin for user #133315 'custom_user_login', // Fix for unknown plugin for user #466875 'wordfence_ls_authenticate', //Fix for wordfence auth 'frm_strp_amount', //Admin stripe form 'wouCheckOnlineUsers', //Skip updraft admin checking users 'et_fb_get_shortcode_from_fb_object', //Skip generate shortcode 'pp_lf_process_login', //Skip login form 'check_email', //Ajax email checking 'dflg_do_sign_in_user', // Unknown plugin 'cartflows_save_cart_abandonment_data', // WooCommerce cartflow 'rcp_process_register_form', // WordPress Membership Plugin – Restrict Content 'give_process_donation', // GiveWP 'apus_ajax_login', // ???? plugin authorization 'bookly_save_customer', //bookly 'postmark_test', //Avocet 'postmark_save', //Avocet 'ck_get_subscriber', //ConvertKit checking the subscriber 'metorik_send_cart', //Metorik skip 'ppom_ajax_validation', // PPOM add to cart validation 'wpforms_form_abandonment', // WPForms. Quiting without submitting 'post_woo_ml_email_cookie', //Woocommerce system 'ig_es_draft_broadcast', //Icegram broadcast ajax 'simplefilelistpro_edit_job', //Simple File List editing current job ); // Skip test if if( !$apbct->settings['general_contact_forms_test'] || // Test disabled !apbct_is_user_enable($apbct->user) || // User is admin, editor, author // (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin (!$apbct->settings['protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0 ) || // Logged in user apbct_exclusions_check__url() || // url exclusions (isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params (isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params isset($_POST['quform_submit']) || //QForms multi-paged form skip // QAEngine Theme fix ( strval(current_action()) != 'et_pre_insert_answer' && ( (isset($message_obj['author']) && intval($message_obj['author']) == 0) || (isset($message_obj['post_author']) && intval($message_obj['post_author']) == 0) ) ) || (isset($_POST['action'], $_POST['arm_action']) && $_POST['action'] == 'arm_shortcode_form_ajax_action' && $_POST['arm_action'] == 'please-login') //arm forms skip login ) { do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST ); return false; } //General post_info for all ajax calls $post_info = array( 'comment_type' => 'feedback_ajax', 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ), // Page URL must be an previous page ); if( \Cleantalk\Variables\Post::get('action') == 'cleantalk_force_ajax_check' ) { $post_info['comment_type'] = 'feedback_ajax_external_form'; } $checkjs = apbct_js_test('ct_checkjs', $_COOKIE); if(isset($_POST['user_login'])) $sender_nickname = $_POST['user_login']; else $sender_nickname = ''; //QAEngine Theme answers if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){ $curr_user = get_user_by('id', $message_obj['author']); if (!$curr_user) $curr_user = get_user_by('id', $message_obj['post_author']); $ct_post_temp['comment'] = $message_obj['post_content']; $ct_post_temp['email'] = $curr_user->data->user_email; $ct_post_temp['name'] = $curr_user->data->user_login; } //CSCF fix if(isset($_POST['action']) && $_POST['action']== 'cscf-submitform'){ $ct_post_temp[] = $message_obj['comment_author']; $ct_post_temp[] = $message_obj['comment_author_email']; $ct_post_temp[] = $message_obj['comment_content']; } //??? fix if(isset($_POST['action'], $_POST['target']) && ($_POST['action']=='request_appointment'||$_POST['action']=='send_message')){ $ct_post_temp=$_POST; $ct_post_temp['target']=1; } //UserPro fix if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register'){ $ct_post_temp = $_POST; $ct_post_temp['shortcode'] = ''; } //Pre-filled form 426869223 if (isset($_POST['action'], $_POST['response-email-address'], $_POST['response-email-sender-address']) && $_POST['action'] == 'contact-owner:send') { unset($_POST['response-email-address']); unset($_POST['response-email-sender-address']); } //Reviewer fix if(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating') { $ct_post_temp['name'] = $_POST['user_name']; $ct_post_temp['email'] = $_POST['user_email']; $ct_post_temp['comment'] = $_POST['comment']; } //Woocommerce checkout if( \Cleantalk\Variables\Post::get( 'action' ) == 'woocommerce_checkout' || \Cleantalk\Variables\Post::get( 'action' ) == 'save_data' ){ $post_info['comment_type'] = 'order'; if( empty( $apbct->settings['wc_checkout_test'] ) ){ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST ); return false; } } //Easy Forms for Mailchimp if( \Cleantalk\Variables\Post::get('action') == 'process_form_submission' ){ $post_info['comment_type'] = 'contact_enquire_wordpress_easy_forms_for_mailchimp'; if( \Cleantalk\Variables\Post::get('form_data') ) { $form_data = explode( '&', urldecode( \Cleantalk\Variables\Post::get('form_data') ) ); $form_data_arr = array(); foreach ( $form_data as $val ) { $form_data_element = explode( '=', $val ); $form_data_arr[$form_data_element[0]] = @$form_data_element[1]; } if( isset( $form_data_arr['EMAIL'] ) ) $ct_post_temp['email'] = $form_data_arr['EMAIL']; if( isset( $form_data_arr['FNAME'] ) ) $ct_post_temp['nickname'] = $form_data_arr['FNAME']; } } if (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){ $ct_post_temp = $_POST; foreach ($ct_post_temp as $key => $value) { if (preg_match('/form_data_\d_name/', $key)) unset($ct_post_temp[$key]); } } $ct_temp_msg_data = isset($ct_post_temp) ? ct_get_fields_any($ct_post_temp) : ct_get_fields_any($_POST); $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : ''); $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : ''); $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : ''); $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true); $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array()); if($subject != '') { $message['subject'] = $subject; } // Skip submission if no data found if ($sender_email === ''|| !$contact_form) { do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST ); return false; } // Mailpoet fix if (isset($message['wysijaData'], $message['wysijaplugin'], $message['task'], $message['controller']) && $message['wysijaplugin'] == 'wysija-newsletters' && $message['controller'] == 'campaigns') { do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST ); return false; } // Mailpoet3 admin skip fix if (isset($_POST['action'], $_POST['method']) && $_POST['action'] == 'mailpoet' && $_POST['method'] =='save') { do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST ); return false; } // WP Foto Vote Fix if (!empty($_FILES)){ foreach($message as $key => $value){ if(strpos($key, 'oje') !== false) { do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST ); return false; } } unset($key ,$value); } /** * @todo Contact form detect */ // Detect contact form an set it's name to $contact_form to use later $contact_form = null; foreach($_POST as $param => $value){ if(strpos($param, 'et_pb_contactform_submit') === 0){ $contact_form = 'contact_form_divi_theme'; $contact_form_additional = str_replace($param, '', $param); } if(strpos($param, 'avia_generated_form') === 0){ $contact_form = 'contact_form_enfold_theme'; $contact_form_additional = str_replace('avia_generated_form', '', $param); } if(!empty($contact_form)) break; } $base_call_result = apbct_base_call( array( 'message' => $message, 'sender_email' => $sender_email, 'sender_nickname' => $sender_nickname, 'sender_info' => array('post_checkjs_passed' => $checkjs), 'post_info' => $post_info, 'js_on' => $checkjs, ) ); $ct_result = $base_call_result['ct_result']; if ($ct_result->allow == 0) { if(isset($_POST['action']) && $_POST['action']=='wpuf_submit_register'){ $result=Array('success'=>false,'error'=>$ct_result->comment); @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); print json_encode($result); die(); } else if(isset($_POST['action']) && $_POST['action']=='mymail_form_submit') { $result=Array('success'=>false,'html'=>$ct_result->comment); @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); print json_encode($result); die(); } else if(isset($_POST['action'], $_POST['task']) && $_POST['action'] == 'wysija_ajax' && $_POST['task'] != 'send_preview' && $_POST['task'] != 'send_test_mail') { $result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment))); //@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); print $_GET['callback'].'('.json_encode($result).');'; die(); } else if(isset($_POST['action']) && $_POST['action']=='cs_registration_validation') { $result=Array("type"=>"error","message"=>$ct_result->comment); print json_encode($result); die(); } else if(isset($_POST['action']) && ($_POST['action']=='request_appointment' || $_POST['action']=='send_message')) { print $ct_result->comment; die(); } else if(isset($_POST['action']) && $_POST['action']=='zn_do_login') { print '