public static function is_plugin_active($plug_bn, $check_network = TRUE) { /** * Using this because WordPress native' 'is_plugin_active()' function only works in Admin * ex. $plug_bn = 'folder/filename.php'; // Plugin Basename */ if (empty($plug_bn)) { return FALSE; } global $wpss_conf_active_plugins; /* Quick Check */ if (!empty($wpss_conf_active_plugins[$plug_bn])) { return TRUE; } if (TRUE === $check_network && is_multisite()) { if (!empty($wpss_conf_active_network_plugins[$plug_bn])) { return TRUE; } } $wpss_conf_active_plugins = array(); $wpss_conf_active_network_plugins = array(); /* Check known plugin constants and classes */ $plug_cncl = array('autoptimize/autoptimize.php' => array('cn' => 'AUTOPTIMIZE_WP_CONTENT_NAME', 'cl' => 'autoptimizeConfig'), 'commentluv/commentluv.php' => array('cn' => '', 'cl' => 'commentluv'), 'si-contact-form/si-contact-form.php' => array('cn' => 'FSCF_VERSION', 'cl' => 'FSCF_Util'), 'jetpack/jetpack.php' => array('cn' => 'JETPACK__VERSION', 'cl' => 'Jetpack'), 'wp-spamfree/wp-spamfree.php' => array('cn' => '', 'cl' => 'wpSpamFree'), 'bbpress/bbpress.php' => array('cn' => '', 'cl' => 'bbPress'), 'buddypress/bp-loader.php' => array('cn' => 'BP_PLUGIN_DIR', 'cl' => 'BuddyPress'), 'contact-form-7/wp-contact-form-7.php' => array('cn' => 'WPCF7_VERSION', 'cl' => ''), 'gravityforms/gravityforms.php' => array('cn' => 'GF_MIN_WP_VERSION', 'cl' => 'GFForms'), 'mailchimp-for-wp/mailchimp-for-wp.php' => array('cn' => 'MC4WP_LITE_VERSION', 'cl' => 'MC4WP_Lite'), 'ninja-forms/ninja-forms.php' => array('cn' => 'NF_PLUGIN_VERSION', 'cl' => 'Ninja_Forms'), 'w3-total-cache/w3-total-cache.php' => array('cn' => 'W3TC_VERSION', 'cl' => ''), 'wp-fastest-cache/wpFastestCache.php' => array('cn' => 'WPFC_WP_PLUGIN_DIR', 'cl' => 'WpFastestCache'), 'wp-fastest-cache-premium/wpFastestCachePremium.php' => array('cn' => '', 'cl' => ''), 'wp-rocket/wp-rocket.php' => array('cn' => 'WP_ROCKET_VERSION', 'cl' => ''), 'affiliates/affiliates.php' => array('cn' => 'AFFILIATES_CORE_VERSION', 'cl' => ''), 'caldera-forms/caldera-core.php' => array('cn' => 'CFCORE_VER', 'cl' => ''), 'download-manager/download-manager.php' => array('cn' => 'WPDM_Version', 'cl' => ''), 'easy-digital-downloads/easy-digital-downloads.php' => array('cn' => 'EDD_VERSION', 'cl' => 'Easy_Digital_Downloads'), 'ecommerce-product-catalog/ecommerce-product-catalog.php' => array('cn' => 'AL_BASE_PATH', 'cl' => 'eCommerce_Product_Catalog'), 'ecwid-shopping-cart/ecwid-shopping-cart.php' => array('cn' => 'ECWID_PLUGIN_DIR', 'cl' => ''), 'eshop/eshop.php' => array('cn' => 'ESHOP_VERSION', 'cl' => ''), 'events-made-easy/events-manager.php' => array('cn' => 'EME_DB_VERSION', 'cl' => ''), 'events-manager/events-manager.php' => array('cn' => '', 'cl' => ''), 'formidable-paypal/formidable-paypal.php' => array('cn' => '', 'cl' => ''), 'give/give.php' => array('cn' => 'GIVE_VERSION', 'cl' => 'Give'), 'gravity-forms-stripe/gravity-forms-stripe.php' => array('cn' => 'GFP_STRIPE_FILE', 'cl' => ''), 'gravityformsauthorizenet/authorizenet.php' => array('cn' => 'GF_AUTHORIZENET_VERSION', 'cl' => 'GF_AuthorizeNet_Bootstrap'), 'gravityformspayfast/payfast.php' => array('cn' => 'GF_PAYFAST_VERSION', 'cl' => 'GF_PayFast_Bootstrap'), 'gravityformsstripe/stripe.php' => array('cn' => 'GF_STRIPE_VERSION', 'cl' => 'GF_Stripe_Bootstrap'), 'gravityformspaypal/paypal.php' => array('cn' => 'GF_PAYPAL_VERSION', 'cl' => 'GF_PayPal_Bootstrap'), 'ithemes-exchange/init.php' => array('cn' => '', 'cl' => 'IT_Exchange'), 'jigoshop/jigoshop.php' => array('cn' => 'JIGOSHOP_VERSION', 'cl' => ''), 'memberpress/memberpress.php' => array('cn' => 'MEPR_VERSION', 'cl' => ''), 'paid-memberships-pro/paid-memberships-pro.php' => array('cn' => 'PMPRO_VERSION', 'cl' => ''), 's2member/s2member-o.php' => array('cn' => 'WS_PLUGIN__S2MEMBER_VERSION', 'cl' => ''), 'shopp/Shopp.php' => array('cn' => '', 'cl' => 'ShoppLoader'), 'simple-membership/simple-wp-membership.php' => array('cn' => 'SIMPLE_WP_MEMBERSHIP_VER', 'cl' => ''), 'stripe/stripe-checkout.php' => array('cn' => 'SIMPAY_VERSION', 'cl' => ''), 'ultimate-product-catalogue/UPCP_Main.php' => array('cn' => 'UPCP_CD_PLUGIN_PATH', 'cl' => ''), 'usc-e-shop/usc-e-shop.php' => array('cn' => 'USCES_VERSION', 'cl' => ''), 'users-ultra/xoousers.php' => array('cn' => 'xoousers_url', 'cl' => ''), 'wc-vendors/class-wc-vendors.php' => array('cn' => 'wcv_plugin_dir', 'cl' => 'WC_Vendors'), 'woocommerce-paypal-pro-payment-gateway/woo-paypal-pro.php' => array('cn' => 'WC_PP_PRO_ADDON_VERSION', 'cl' => 'WC_Paypal_Pro_Gateway_Addon'), 'woocommerce/woocommerce.php' => array('cn' => 'WOOCOMMERCE_VERSION', 'cl' => 'WooCommerce'), 'wordpress-ecommerce/marketpress.php' => array('cn' => 'MP_LITE', 'cl' => 'MarketPress'), 'wordpress-simple-paypal-shopping-cart/wp_shopping_cart.php' => array('cn' => 'WP_CART_VERSION', 'cl' => ''), 'wp-e-commerce/wp-shopping-cart.php' => array('cn' => 'WPSC_VERSION', 'cl' => 'WP_eCommerce'), 'wp-easycart/wpeasycart.php' => array('cn' => 'EC_CURRENT_VERSION', 'cl' => ''), 'wp-shop-original/wp-shop.php' => array('cn' => 'WPSHOP_DIR', 'cl' => ''), 'wp-ultra-simple-paypal-shopping-cart/wp_ultra_simple_shopping_cart.php' => array('cn' => 'WUSPSC_VERSION', 'cl' => ''), 'wppizza/wppizza.php' => array('cn' => 'WPPIZZA_VERSION', 'cl' => ''), 'yith-woocommerce-stripe/init.php' => array('cn' => 'YITH_WCSTRIPE_VERSION', 'cl' => ''), 'beaver-builder-lite-version/fl-builder.php' => array('cn' => 'FL_BUILDER_VERSION', 'cl' => 'FLBuilder'), 'bb-plugin/fl-builder.php' => array('cn' => 'FL_BUILDER_VERSION', 'cl' => 'FLBuilder'), 'wordfence/wordfence.php' => array('cn' => 'WORDFENCE_VERSION', 'cl' => 'wordfence')); if (!empty($plug_cncl[$plug_bn]['cn']) && defined($plug_cncl[$plug_bn]['cn']) || !empty($plug_cncl[$plug_bn]['cl']) && class_exists($plug_cncl[$plug_bn]['cl'])) { $wpss_conf_active_plugins[$plug_bn] = TRUE; return TRUE; } /* No match yet, so now do standard check */ global $wpss_active_plugins; if (empty($wpss_active_plugins)) { $wpss_active_plugins = rs_wpss_get_active_plugins(); } if (in_array($plug_bn, $wpss_active_plugins, TRUE)) { $wpss_conf_active_plugins[$plug_bn] = TRUE; return TRUE; } if (TRUE === $check_network && is_multisite()) { global $wpss_active_network_plugins; if (empty($wpss_active_network_plugins)) { $wpss_active_network_plugins = rs_wpss_get_active_network_plugins(); } if (in_array($plug_bn, $wpss_active_network_plugins, TRUE)) { $wpss_conf_active_network_plugins[$plug_bn] = TRUE; return TRUE; } } return FALSE; }
function rs_wpss_log_data($wpss_log_data_array, $wpss_log_data_errors, $wpss_log_comment_type = 'comment', $wpss_log_contact_form_data = NULL, $wpss_log_contact_form_id = NULL, $wpss_log_contact_form_mcid = NULL) { /*** * Example: * Comment: rs_wpss_log_data( $commentdata, $wpss_error_code ) * Contact Form: rs_wpss_log_data( $cf_author_data, $wpss_error_code, 'contact form', $wpss_contact_form_msg, $wpss_contact_form_mid, $wpss_contact_form_mcid ); * Registration: rs_wpss_log_data( $register_author_data, $wpss_error_code, 'register' ); * BuddyPress Reg: rs_wpss_log_data( $register_author_data, $wpss_error_code, 'bp-register' ); * WooCommerce Reg: rs_wpss_log_data( $register_author_data, $wpss_error_code, 'wc-register' ); * s2Member Reg: rs_wpss_log_data( $register_author_data, $wpss_error_code, 's2-register' ); * WP-Members Reg: rs_wpss_log_data( $register_author_data, $wpss_error_code, 'wpm-register' ); * Affiliates Reg: rs_wpss_log_data( $register_author_data, $wpss_error_code, 'aff-register' ); * Contact Form 7: rs_wpss_log_data( $form_auth_dat, $wpss_error_code, 'contact form 7', $cf7_serial_post ); * Gravity Forms: rs_wpss_log_data( $form_auth_dat, $wpss_error_code, 'gravity forms', $gf_serial_post ); * Miscellaneous Form: rs_wpss_log_data( $form_auth_dat, $wpss_error_code, 'misc form', $msc_serial_post ); * JetPack Form: rs_wpss_log_data( $form_auth_dat, $wpss_error_code, 'jetpack form', $msc_serial_post ); * Ninja Forms: rs_wpss_log_data( $form_auth_dat, $wpss_error_code, 'ninja forms', $msc_serial_post ); * Mailchimp Signup: rs_wpss_log_data( $form_auth_dat, $wpss_error_code, 'mailchimp form', $msc_serial_post ); ***/ $wpss_log_session_data = rs_wpss_get_log_session_data(); extract($wpss_log_session_data); $noda = '[No Data]'; /* Timer - BEGIN*/ $wpss_time_end = microtime(TRUE); if (empty($wpss_time_init) && !empty($wpss_timestamp_init)) { $wpss_time_init = $wpss_timestamp_init; } if (!empty($wpss_time_init)) { $wpss_time_on_site = rs_wpss_timer($wpss_time_init, $wpss_time_end, TRUE, 2); } else { $wpss_time_on_site = $noda; } if (!empty($wpss_timestamp_init)) { $wpss_site_entry_time = get_date_from_gmt(date('Y-m-d H:i:s', $wpss_timestamp_init), 'Y-m-d (D) H:i:s e'); /* Added 1.7.3 */ } else { $wpss_site_entry_time = $noda; } /* Timer - END */ rs_wpss_log_reset(NULL, FALSE, FALSE, TRUE); /* Create log file if it doesn't exist */ $wpss_log_key = rs_wpss_get_log_key(); $wpss_log_filnm = strpos(WPSS_SERVER_NAME_REV, WPSS_MDBUG_SERVER_NAME_REV) === 0 ? 'temp-comments-log.txt' : 'temp-comments-log-' . $wpss_log_key . '.txt'; $wpss_log_file = WPSS_PLUGIN_DATA_PATH . '/' . $wpss_log_filnm; $wpss_log_max_filesize = 2 * 1048576; /* 2 MB */ if (empty($wpss_log_comment_type)) { $wpss_log_comment_type = 'comment'; } $wpss_log_comment_type_display = rs_wpss_casetrans('upper', $wpss_log_comment_type); $wpss_log_comment_type_ucwords = rs_wpss_casetrans('ucwords', $wpss_log_comment_type); $wpss_log_comment_type_ucwords_ref_disp = preg_replace("~\\sform~i", "", $wpss_log_comment_type_ucwords); $wpss_display_name = $wpss_user_firstname = $wpss_user_lastname = $wpss_user_email = $wpss_user_url = $wpss_user_login = $wpss_user_id = $wpss_rsds = $bclm_off = $bclm_oc = ''; $wpss_user_logged_in = FALSE; if (is_user_logged_in()) { global $current_user; get_currentuserinfo(); $wpss_display_name = $current_user->display_name; $wpss_user_firstname = $current_user->user_firstname; $wpss_user_lastname = $current_user->user_lastname; $wpss_user_email = $current_user->user_email; $wpss_user_url = $current_user->user_url; $wpss_user_login = $current_user->user_login; $wpss_user_id = $current_user->ID; $wpss_user_logged_in = TRUE; } global $spamshield_options; if (empty($spamshield_options)) { $spamshield_options = get_option('spamshield_options'); } rs_wpss_update_session_data($spamshield_options); global $wpss_active_plugins; if (empty($wpss_active_plugins)) { $wpss_active_plugins = rs_wpss_get_active_plugins(); } $wpss_active_plugins_str = implode(', ', $wpss_active_plugins); if (is_multisite()) { global $wpss_active_network_plugins; if (empty($wpss_active_network_plugins)) { $wpss_active_network_plugins = rs_wpss_get_active_network_plugins(); } if (!empty($wpss_active_network_plugins)) { $wpss_active_network_plugins_str = implode(', ', $wpss_active_network_plugins); } } global $wpss_cl_active; if (empty($wpss_cl_active)) { $wpss_cl_active = rs_wpss_is_plugin_active('commentluv/commentluv.php'); } $wpss_plugin_user_agent = rs_wpss_get_plugin_user_agent(); $wpss_php_uname = function_exists('php_uname') ? @php_uname() : PHP_OS . ' ' . @gethostname(); $comment_logging = $spamshield_options['comment_logging']; $comment_logging_start_date = $spamshield_options['comment_logging_start_date']; $comment_logging_all = $spamshield_options['comment_logging_all']; if (!empty($wpss_log_data_array['javascript_page_referrer'])) { $wpss_javascript_page_referrer = $wpss_log_data_array['javascript_page_referrer']; } else { $wpss_javascript_page_referrer = ''; } if (!empty($wpss_log_data_array['jsonst'])) { $wpss_jsonst = $wpss_log_data_array['jsonst']; } else { $wpss_jsonst = ''; } $get_current_time = time(); /* Updated next line in Version 1.1.4.4 - Display local time in logs. Won't match other time logs, because those need to be UTC. */ $get_current_time_display = current_time('timestamp', 0); $reset_interval_hours = 24 * 7; /* Reset interval in hours */ $reset_interval_minutes = 60; /* Reset interval minutes default */ $reset_interval_minutes_override = $reset_interval_minutes; /* Use as override for testing; leave = $reset_interval_minutes when not testing */ if ($reset_interval_minutes_override != $reset_interval_minutes) { $reset_interval_hours = 1; $reset_interval_minutes = $reset_interval_minutes_override; } /* Default is one week */ $reset_interval = 60 * $reset_interval_minutes * $reset_interval_hours; /* seconds * minutes * hours */ if (strpos(WPSS_SERVER_NAME_REV, WPSS_DEBUG_SERVER_NAME_REV) === 0) { $reset_interval = $reset_interval * 4; $wpss_rsds = TRUE; } $time_threshold = $get_current_time - $reset_interval; /* This automatically turns off Blocked Comment Logging Mode if over X amount of time since starting, or filesize exceeds max */ if (!empty($comment_logging_start_date) && $time_threshold > $comment_logging_start_date) { $bclm_off = TRUE; $bclm_oc = 'T'; } elseif (file_exists($wpss_log_file) && filesize($wpss_log_file) >= $wpss_log_max_filesize) { $bclm_off = TRUE; $bclm_oc = 'FS'; } if (!empty($bclm_off) && $time_threshold > $comment_logging_start_date) { $comment_logging = $comment_logging_start_date = $comment_logging_all = 0; /*Turns Blocked Comment Logging Mode off */ $spamshield_options['comment_logging'] = $comment_logging; $spamshield_options['comment_logging_start_date'] = $comment_logging_start_date; $spamshield_options['comment_logging_all'] = $comment_logging_all; update_option('spamshield_options', $spamshield_options); if (!empty($wpss_rsds)) { rs_wpss_append_log_data('Blocked Comment Logging Mode has been disabled. ' . '[' . $bclm_oc . ']', FALSE); } } else { /* LOG DATA */ global $wpss_cache_check; if (empty($wpss_cache_check)) { $wpss_cache_check = rs_wpss_check_cache_status(); } $wpss_log_datum = date('Y-m-d (D) H:i:s', $get_current_time_display); $wpss_log_url = rs_wpss_get_url(); $wpss_is_ajax = rs_wpss_is_ajax_request() ? 'TRUE' : 'FALSE'; $wpss_is_comment = rs_wpss_is_comment_request() ? 'TRUE' : 'FALSE'; $wpss_compat_on = TRUE === WPSS_COMPAT_MODE || defined('WPSS_SOFT_COMPAT_MODE') ? 'ON' : 'OFF'; $wpss_cache_on = $wpss_cache_check['cache_check_status'] === 'ACTIVE' ? 'ON' : 'OFF'; $wpss_log_data = "*************************************************************************************" . WPSS_EOL; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= ":: " . $wpss_log_comment_type_display . " BEGIN ::" . WPSS_EOL; $submitter_ip_address = rs_wpss_get_ip_addr(); $submitter_ip_address_short_l = trim(substr($submitter_ip_address, 0, 6)); $submitter_ip_address_short_r = trim(substr($submitter_ip_address, -6, 2)); $submitter_ip_address_obfuscated = $submitter_ip_address_short_l . '****' . $submitter_ip_address_short_r . '.***'; /* IP / PROXY INFO - BEGIN */ global $wpss_ip_proxy_info; if (empty($wpss_ip_proxy_info)) { $wpss_ip_proxy_info = rs_wpss_ip_proxy_info(); } extract($wpss_ip_proxy_info); /* IP / PROXY INFO - END */ global $wpss_geolocation; if (empty($wpss_geolocation)) { $wpss_geolocation = rs_wpss_wf_geoiploc($ip, TRUE); } $wpss_spamshield_count = rs_wpss_number_format(rs_wpss_count()); if ($wpss_log_comment_type === 'comment' || $wpss_log_comment_type === 'contact form') { $body_content_length = rs_wpss_number_format($wpss_log_data_array['body_content_len']); } else { $body_content_length = ''; } if ($wpss_log_comment_type === 'comment') { $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; /* Comment Post Info */ $comment_author_email = $wpss_log_data_array['comment_author_email']; $comment_types_allowed = ''; if (!empty($wpss_log_data_array['comment_post_comments_open'])) { $comment_post_comments_open = 'Open'; $comment_types_allowed .= 'comments'; } else { $comment_post_comments_open = 'Closed'; } if (!empty($wpss_log_data_array['comment_post_pings_open'])) { $comment_post_pings_open = 'Open'; if (!empty($comment_types_allowed)) { $comment_types_allowed .= ','; } $comment_types_allowed .= 'pingbacks,trackbacks'; } else { $comment_post_pings_open = 'Closed'; } if (empty($comment_types_allowed)) { $comment_types_allowed = 'none, comments closed'; } $comment_post_type_ucw = rs_wpss_casetrans('ucwords', $wpss_log_data_array['comment_post_type']); $wpss_log_data .= "Date/Time: \t\t['" . $wpss_log_datum . "']" . WPSS_EOL; $wpss_log_data .= "Comment Post ID: \t['" . $wpss_log_data_array['comment_post_ID'] . "']" . WPSS_EOL; $wpss_log_data .= "Comment Post Title: \t['" . $wpss_log_data_array['comment_post_title'] . "']" . WPSS_EOL; $wpss_log_data .= "Comment Post URL: \t['" . $wpss_log_data_array['comment_post_url'] . "']" . WPSS_EOL; $wpss_log_data .= "Comment Post Type: \t['" . $wpss_log_data_array['comment_post_type'] . "']" . WPSS_EOL; $wpss_log_data .= $comment_post_type_ucw . " Allows Types:\t['" . $comment_types_allowed . "']" . WPSS_EOL; $wpss_log_data .= "Comment Type: \t\t['"; if (!empty($wpss_log_data_array['comment_type'])) { $wpss_log_data .= $wpss_log_data_array['comment_type']; } else { $wpss_log_data .= "comment"; } $wpss_log_data .= "']"; $wpss_log_data .= WPSS_EOL; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "Comment Author: \t['" . $wpss_log_data_array['comment_author'] . "']" . WPSS_EOL; $wpss_log_data .= "Comment Author Email: \t['" . $comment_author_email . "']" . WPSS_EOL; $wpss_log_data .= "Comment Author URL: \t['" . $wpss_log_data_array['comment_author_url'] . "']" . WPSS_EOL; $wpss_log_data .= "Comment Content: " . WPSS_EOL . "['comment_content_begin']" . WPSS_EOL . $wpss_log_data_array['comment_content'] . WPSS_EOL . "['comment_content_end']" . WPSS_EOL; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "WPSSCID: \t\t['" . $wpss_log_data_array['comment_wpss_cid'] . "']" . WPSS_EOL; /* Added 1.7.7 - WPSS Comment ID */ $wpss_log_data .= "WPSSCCID:\t\t['" . $wpss_log_data_array['comment_wpss_ccid'] . "']" . WPSS_EOL; /* Added 1.7.7 - WPSS Comment Content ID */ } elseif (strpos($wpss_log_comment_type, 'register') !== FALSE) { $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "Date/Time: \t\t['" . $wpss_log_datum . "']" . WPSS_EOL; if (empty($wpss_log_data_array['ID'])) { $wpss_log_data_array['ID'] = '[None]'; } $wpss_log_data .= "User ID: \t\t['" . $wpss_log_data_array['ID'] . "']" . WPSS_EOL; $wpss_log_data .= "User Login: \t\t['" . $wpss_log_data_array['user_login'] . "']" . WPSS_EOL; $wpss_log_data .= "Display Name: \t\t['" . $wpss_log_data_array['display_name'] . "']" . WPSS_EOL; $wpss_log_data .= "First Name: \t\t['" . $wpss_log_data_array['user_firstname'] . "']" . WPSS_EOL; $wpss_log_data .= "Last Name: \t\t['" . $wpss_log_data_array['user_lastname'] . "']" . WPSS_EOL; $wpss_log_data .= "User Email: \t\t['" . $wpss_log_data_array['user_email'] . "']" . WPSS_EOL; if (empty($wpss_log_data_array['user_url'])) { $wpss_log_data_array['user_url'] = '[None]'; } $wpss_log_data .= "User URL: \t\t['" . $wpss_log_data_array['user_url'] . "']" . WPSS_EOL; } elseif ($wpss_log_comment_type === 'contact form') { $wpss_log_contact_form_subject = !empty($_POST['wpss_contact_subject']) ? sanitize_text_field($_POST['wpss_contact_subject']) : ''; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "Date/Time: \t\t['" . $wpss_log_datum . "']" . WPSS_EOL; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "Subject: \t\t['" . $wpss_log_contact_form_subject . "']" . WPSS_EOL; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= $wpss_log_contact_form_data; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "WPSSMID: \t\t['" . $wpss_log_contact_form_id . "']" . WPSS_EOL; /* Added 1.7.7 - WPSS Message ID */ $wpss_log_data .= "WPSSMCID:\t\t['" . $wpss_log_contact_form_mcid . "']" . WPSS_EOL; /* Added 1.7.7 - WPSS Message Content ID */ } elseif (strpos($wpss_log_comment_type, 'form') !== FALSE) { $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "Date/Time: \t\t['" . $wpss_log_datum . "']" . WPSS_EOL; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $form_post_data_arr = unserialize($wpss_log_contact_form_data); $form_post_data_disp = ''; foreach ($form_post_data_arr as $k => $v) { if (is_array($v)) { $v = implode('|', $v); } $form_post_data_disp .= $k . ': ' . trim(stripslashes($v)) . WPSS_EOL; } $wpss_log_data .= $form_post_data_disp; } $wpss_sessions_enabled = isset($_SESSION) ? 'Enabled' : 'Disabled'; /* Sanitized versions for output */ $wpss_http_accept_language = rs_wpss_get_http_accept(FALSE, FALSE, TRUE); $wpss_http_accept = rs_wpss_get_http_accept(); $server_x_req_w = rs_wpss_get_server_x_req_w(); $wpss_http_user_agent = rs_wpss_get_user_agent(); $wpss_http_referer = rs_wpss_get_referrer(); /* Not original ref - Comment Processor Referrer */ $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; if ($wpss_user_logged_in !== FALSE) { $wpss_log_data .= "User ID: \t\t['" . $wpss_user_id . "']" . WPSS_EOL; } $wpss_log_data .= "User-Agent: \t\t['" . $wpss_http_user_agent . "']" . WPSS_EOL; if (!empty($wpss_geolocation)) { $wpss_log_data .= "Location: \t\t['" . $wpss_geolocation . "']" . WPSS_EOL; } $wpss_log_data .= "IP Address: \t\t['" . $ip . "'] ['http://ipaddressdata.com/" . $ip . "']" . WPSS_EOL; $wpss_log_data .= "Reverse DNS: \t\t['" . $reverse_dns . "']" . WPSS_EOL; $wpss_log_data .= "Reverse DNS IP: \t['" . $reverse_dns_ip . "']" . WPSS_EOL; $wpss_log_data .= "FCrDNS Verified: \t['" . $reverse_dns_verification . "']" . WPSS_EOL; /* Forward-confirmed reverse DNS (FCrDNS) */ $wpss_log_data .= "Proxy Info: \t\t['" . $ip_proxy . "']" . WPSS_EOL; $wpss_log_data .= "Proxy Data: \t\t['" . $ip_proxy_data . "']" . WPSS_EOL; $wpss_log_data .= "Proxy Status: \t\t['" . $proxy_status . "']" . WPSS_EOL; if (empty($ip_proxy_via)) { $ip_proxy_via = '[None]'; } $wpss_log_data .= "HTTP_VIA: \t\t['" . $ip_proxy_via . "']" . WPSS_EOL; if (empty($masked_ip)) { $masked_ip = '[None]'; } $wpss_log_data .= "HTTP_X_FORWARDED_FOR: \t['" . $masked_ip . "']" . WPSS_EOL; if (strpos(WPSS_SERVER_NAME_REV, WPSS_DEBUG_SERVER_NAME_REV) === 0 || TRUE === WP_DEBUG && TRUE === WPSS_DEBUG) { if (!empty($http_x_forwarded)) { $wpss_log_data .= "HTTP_X_FORWARDED: \t['" . $http_x_forwarded . "']" . WPSS_EOL; } if (!empty($http_forwarded_for)) { $wpss_log_data .= "HTTP_FORWARDED_FOR: \t['" . $http_forwarded_for . "']" . WPSS_EOL; } if (!empty($http_forwarded)) { $wpss_log_data .= "HTTP_FORWARDED: \t['" . $http_forwarded . "']" . WPSS_EOL; } if (!empty($http_x_real_ip)) { $wpss_log_data .= "HTTP_X_REAL_IP: \t['" . $http_x_real_ip . "']" . WPSS_EOL; } if (!empty($http_x_sucuri_clientip)) { $wpss_log_data .= "HTTP_X_SUCURI_CLIENTIP: ['" . $http_x_sucuri_clientip . "']" . WPSS_EOL; } if (!empty($http_cf_connecting_ip)) { $wpss_log_data .= "HTTP_CF_CONNECTING_IP: \t['" . $http_cf_connecting_ip . "']" . WPSS_EOL; } if (!empty($http_incap_client_ip)) { $wpss_log_data .= "HTTP_INCAP_CLIENT_IP: \t['" . $http_incap_client_ip . "']" . WPSS_EOL; } if (!empty($http_client_ip)) { $wpss_log_data .= "HTTP_CLIENT_IP: \t['" . $http_client_ip . "']" . WPSS_EOL; } } $wpss_log_data .= "HTTP_ACCEPT_LANGUAGE: \t['" . $wpss_http_accept_language . "']" . WPSS_EOL; $wpss_log_data .= "HTTP_ACCEPT: \t\t['" . $wpss_http_accept . "']" . WPSS_EOL; $wpss_log_data .= "HTTP_X_REQUESTED_WITH: \t['" . $server_x_req_w . "']" . WPSS_EOL; $wpss_log_data .= "IS_AJAX: \t\t['" . $wpss_is_ajax . "']" . WPSS_EOL; $wpss_log_data .= "IS_COMMENT: \t\t['" . $wpss_is_comment . "']" . WPSS_EOL; if ($wpss_log_comment_type === 'misc form') { $wpss_http_status = rs_wpss_get_http_status($wpss_log_url); $wpss_log_data .= "HTTP STATUS:\t\t['" . $wpss_http_status . "']" . WPSS_EOL; } $wpss_log_data .= "URL: \t\t\t['" . $wpss_log_url . "']" . WPSS_EOL; $wpss_log_data .= "Form Processor Ref: \t['"; if (!empty($wpss_http_referer)) { $wpss_log_data .= $wpss_http_referer; } else { $wpss_log_data .= '[None]'; } $wpss_log_data .= "']"; $wpss_log_data .= WPSS_EOL; $wpss_log_data .= "JS Page Ref: \t\t['"; if (!empty($wpss_javascript_page_referrer)) { $wpss_log_data .= $wpss_javascript_page_referrer; } else { $wpss_log_data .= '[None]'; } $wpss_log_data .= "']"; $wpss_log_data .= WPSS_EOL; $wpss_log_data .= "JSONST: \t\t['"; if (!empty($wpss_jsonst)) { $wpss_log_data .= $wpss_jsonst; } else { $wpss_log_data .= '[None]'; } $wpss_log_data .= "']"; $wpss_log_data .= WPSS_EOL; /* New Data Section - Begin */ if (strpos(WPSS_SERVER_NAME_REV, WPSS_DEBUG_SERVER_NAME_REV) === 0 || TRUE === WP_DEBUG && TRUE === WPSS_DEBUG) { if (!empty($_SESSION)) { $wpss_log_data_serial_session = serialize($_SESSION); } else { $wpss_log_data_serial_session = ''; } if (!empty($_COOKIE)) { $wpss_log_data_serial_cookie = serialize($_COOKIE); } else { $wpss_log_data_serial_cookie = ''; } if (!empty($_GET)) { $wpss_log_data_serial_get = serialize($_GET); } else { $wpss_log_data_serial_get = ''; } if (!empty($_POST)) { $wpss_log_data_post_raw = $_POST; switch ($wpss_log_comment_type) { case 'comment': unset($wpss_log_data_post_raw['comment']); break; case 'contact form': unset($wpss_log_data_post_raw['wpss_contact_message']); break; } $wpss_log_data_serial_post = serialize($wpss_log_data_post_raw); } else { $wpss_log_data_serial_post = ''; } if (!empty($_SERVER['REQUEST_METHOD'])) { $wpss_server_request_method = $_SERVER['REQUEST_METHOD']; } else { $wpss_server_request_method = ''; } $wpss_mem_used = rs_wpss_wp_memory_used(); if (!empty($_SESSION['user_spamshield_count_' . WPSS_HASH])) { $wpss_user_spamshield_count = $_SESSION['user_spamshield_count_' . WPSS_HASH]; } else { $wpss_user_spamshield_count = 0; } if (!empty($_SESSION['user_spamshield_count_jsck_' . WPSS_HASH])) { $wpss_jsck_spamshield_count = $_SESSION['user_spamshield_count_jsck_' . WPSS_HASH]; } else { $wpss_jsck_spamshield_count = 0; } if (!empty($_SESSION['user_spamshield_count_algo_' . WPSS_HASH])) { $wpss_algo_spamshield_count = $_SESSION['user_spamshield_count_algo_' . WPSS_HASH]; } else { $wpss_algo_spamshield_count = 0; } $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "PHP Session ID: \t['" . $wpss_session_id . "']" . WPSS_EOL; $wpss_log_data .= "PHP Session Cookie: \t['" . $wpss_session_ck . "']" . WPSS_EOL; $wpss_log_data .= "Sess ID/CK Match: \t['" . $wpss_session_verified . "']" . WPSS_EOL; $wpss_log_data .= "Page Hits: \t\t['" . $wpss_page_hits . "']" . WPSS_EOL; $wpss_log_data .= "Last Page Hit: \t\t['" . $wpss_last_page_hit . "']" . WPSS_EOL; $wpss_log_data .= "Hits Per Page: " . WPSS_EOL . "['hits_per_page_begin']" . $wpss_hits_per_page . "['hits_per_page_end']" . WPSS_EOL; $wpss_log_data .= "Original IP: \t\t['" . $wpss_user_ip_init . "']" . WPSS_EOL; $wpss_log_data .= "IP History: \t\t['" . $wpss_ip_history . "']" . WPSS_EOL; $wpss_log_data .= "Time on Site: \t\t['" . $wpss_time_on_site . "']" . WPSS_EOL; $wpss_log_data .= "Site Entry Time: \t['" . $wpss_site_entry_time . "']" . WPSS_EOL; $wpss_log_data .= "Landing Page: \t\t['" . $wpss_referer_init . "']" . WPSS_EOL; /* PHP */ $wpss_log_data .= "Original Referrer: \t['" . $wpss_referer_init_js . "']" . WPSS_EOL; /* JS */ $wpss_log_data .= "Author History:\t\t['" . $wpss_author_history . "']" . WPSS_EOL; $wpss_log_data .= "Email History:\t\t['" . $wpss_author_email_history . "']" . WPSS_EOL; $wpss_log_data .= "URL History: \t\t['" . $wpss_author_url_history . "']" . WPSS_EOL; $wpss_log_data .= "Entries Accepted: \t['" . $wpss_comments_accepted . "']" . WPSS_EOL; $wpss_log_data .= "Entries Denied: \t['" . $wpss_comments_denied . "']" . WPSS_EOL; $wpss_log_data .= "Spam Count: \t\t['" . $wpss_spamshield_count . "']" . WPSS_EOL; $wpss_log_data .= "User Spam Count: \t['" . $wpss_user_spamshield_count . "']" . WPSS_EOL; $wpss_log_data .= "JSCK Spam Count: \t['" . $wpss_jsck_spamshield_count . "']" . WPSS_EOL; $wpss_log_data .= "ALGO Spam Count: \t['" . $wpss_algo_spamshield_count . "']" . WPSS_EOL; $wpss_log_data .= "Current Status: \t['" . $wpss_comments_status_current . "']" . WPSS_EOL; $wpss_log_data .= "REQUEST_METHOD: \t['" . $wpss_server_request_method . "']" . WPSS_EOL; if ($wpss_log_comment_type === 'comment' || $wpss_log_comment_type === 'contact form') { $wpss_log_data .= "Content Length: \t['" . $body_content_length . "']" . WPSS_EOL; } $wpss_log_data .= '$_COOKIE' . " Data:\t\t['" . $wpss_log_data_serial_cookie . "']" . WPSS_EOL; $wpss_log_data .= '$_GET' . " Data: \t\t['" . $wpss_log_data_serial_get . "']" . WPSS_EOL; $wpss_log_data .= 'MOD $_POST' . " Data:\t['" . $wpss_log_data_serial_post . "']" . WPSS_EOL; $wpss_log_data .= "CL Active: \t\t['" . $wpss_cl_active . "']" . WPSS_EOL; $wpss_log_data .= "Mem Used: \t\t['" . $wpss_mem_used . "']" . WPSS_EOL; $wpss_log_data .= "Extra Data: \t\t['" . $wpss_append_log_data . "']" . WPSS_EOL; } /* New Data Section - End */ $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; if (strpos($wpss_log_data_errors, 'No Error') === 0) { /* Changed 1.8 */ $wpss_log_data_errors_count = 0; } else { $wpss_log_data_errors_count = rs_wpss_count_words($wpss_log_data_errors); } if (empty($wpss_log_data_errors)) { $wpss_log_data_errors = 'No Error'; } if ($wpss_log_comment_type === 'comment') { if (empty($wpss_log_data_array['total_time_jsck_filter'])) { $wpss_total_time_jsck_filter = 0; } else { $wpss_total_time_jsck_filter = $wpss_log_data_array['total_time_jsck_filter']; } $wpss_total_time_jsck_filter_disp = rs_wpss_number_format($wpss_total_time_jsck_filter, 6); if (empty($wpss_log_data_array['total_time_content_filter'])) { $wpss_total_time_content_filter = 0; } else { $wpss_total_time_content_filter = $wpss_log_data_array['total_time_content_filter']; } $wpss_total_time_content_filter_disp = rs_wpss_number_format($wpss_total_time_content_filter, 6); $wpss_start_time_comment_processing = $wpss_log_data_array['start_time_comment_processing']; /* Timer End - Comment Processing */ $wpss_end_time_comment_processing = microtime(TRUE); $wpss_total_time_wpss_processing = $wpss_total_time_jsck_filter + $wpss_total_time_content_filter; $wpss_total_time_wpss_processing_disp = rs_wpss_number_format($wpss_total_time_wpss_processing, 6); $wpss_total_time_comment_processing = rs_wpss_timer($wpss_start_time_comment_processing, $wpss_end_time_comment_processing, FALSE, 6, TRUE); $wpss_total_time_comment_proc_disp = rs_wpss_number_format($wpss_total_time_comment_processing, 6); $wpss_total_time_wp_processing = $wpss_total_time_comment_processing - $wpss_total_time_wpss_processing; $wpss_total_time_wp_processing_disp = rs_wpss_number_format($wpss_total_time_wp_processing, 6); if (!empty($wpss_total_time_jsck_filter_disp) || !empty($wpss_total_time_content_filter_disp) || !empty($wpss_total_time_wpss_processing_disp)) { $wpss_log_data .= "JS/C Processing Time: \t['" . $wpss_total_time_jsck_filter_disp . " seconds'] Time for JS/Cookies Layer to test for spam" . WPSS_EOL; $wpss_log_data .= "Algo Processing Time: \t['" . $wpss_total_time_content_filter_disp . " seconds'] Time for Algorithmic Layer to test for spam" . WPSS_EOL; $wpss_log_data .= "WPSS Processing Time: \t['" . $wpss_total_time_wpss_processing_disp . " seconds'] Total time for WP-SpamShield to test for spam" . WPSS_EOL; } if (strpos(WPSS_SERVER_NAME_REV, WPSS_DEBUG_SERVER_NAME_REV) === 0) { $wpss_total_time_part_1 = $wpss_log_data_array['total_time_part_1']; $wpss_total_time_part_1_disp = rs_wpss_number_format($wpss_total_time_part_1, 6); $wpss_proc_data = get_option('spamshield_procdat'); if (empty($wpss_proc_data) || !isset($wpss_proc_data['total_wpss_time']) || !isset($wpss_proc_data['total_comment_proc_time'])) { $wpss_proc_data = array('total_tracked' => 0, 'total_wpss_time' => 0, 'avg_wpss_proc_time' => 0, 'total_comment_proc_time' => 0, 'avg_comment_proc_time' => 0, 'total_wpss_avg_tracked' => 0, 'total_avg_wpss_proc_time' => 0, 'avg2_wpss_proc_time' => 0); } if (!isset($wpss_proc_data['total_wpss_avg_tracked'])) { $wpss_proc_data['total_wpss_avg_tracked'] = 0; } if (!isset($wpss_proc_data['total_avg_wpss_proc_time'])) { $wpss_proc_data['total_avg_wpss_proc_time'] = 0; } if (!isset($wpss_proc_data['avg2_wpss_proc_time'])) { $wpss_proc_data['avg2_wpss_proc_time'] = 0; } $wpss_proc_data_total_tracked = $wpss_proc_data['total_tracked'] + 1; $wpss_proc_data_total_wpss_time = $wpss_proc_data['total_wpss_time'] + $wpss_total_time_wpss_processing; $wpss_proc_data_avg_wpss_proc_time = $wpss_proc_data_total_wpss_time / $wpss_proc_data_total_tracked; $wpss_proc_data_total_comment_proc_time = $wpss_proc_data['total_comment_proc_time'] + $wpss_total_time_comment_processing; $wpss_proc_data_avg_comment_proc_time = $wpss_proc_data_total_comment_proc_time / $wpss_proc_data_total_tracked; $wpss_proc_data_total_wpss_avg_tracked = $wpss_proc_data['total_wpss_avg_tracked'] + 1; $wpss_proc_data_total_avg_wpss_proc_time = $wpss_proc_data['total_avg_wpss_proc_time'] + $wpss_proc_data_avg_wpss_proc_time; $wpss_proc_data_avg2_wpss_proc_time = $wpss_proc_data_total_avg_wpss_proc_time / $wpss_proc_data_total_wpss_avg_tracked; $wpss_proc_data = array('total_tracked' => $wpss_proc_data_total_tracked, 'total_wpss_time' => $wpss_proc_data_total_wpss_time, 'avg_wpss_proc_time' => $wpss_proc_data_avg_wpss_proc_time, 'total_comment_proc_time' => $wpss_proc_data_total_comment_proc_time, 'avg_comment_proc_time' => $wpss_proc_data_avg_comment_proc_time, 'total_wpss_avg_tracked' => $wpss_proc_data_total_wpss_avg_tracked, 'total_avg_wpss_proc_time' => $wpss_proc_data_total_avg_wpss_proc_time, 'avg2_wpss_proc_time' => $wpss_proc_data_avg2_wpss_proc_time); update_option('spamshield_procdat', $wpss_proc_data); $wpss_proc_data_avg_wpss_proc_time_disp = rs_wpss_number_format($wpss_proc_data_avg_wpss_proc_time, 6); $wpss_proc_data_avg2_wpss_proc_time_disp = rs_wpss_number_format($wpss_proc_data_avg2_wpss_proc_time, 6); $wpss_proc_data_avg_comment_proc_time_disp = rs_wpss_number_format($wpss_proc_data_avg_comment_proc_time, 6); $wpss_log_data .= "WP Processing Time:\t['" . $wpss_total_time_wp_processing_disp . " seconds'] Time for other WordPress processes" . WPSS_EOL; $wpss_log_data .= "Total Processing Time: \t['" . $wpss_total_time_comment_proc_disp . " seconds'] Total time for WordPress to process comment" . WPSS_EOL; $wpss_log_data .= "Avg WPSS Proc Time:\t['" . $wpss_proc_data_avg_wpss_proc_time_disp . " seconds'] Average total time for WP-SpamShield to test for spam" . WPSS_EOL; $wpss_log_data .= "FAvg WPSS Proc Time:\t['" . $wpss_proc_data_avg2_wpss_proc_time_disp . " seconds'] Fuzzy Average total WPSS time" . WPSS_EOL; $wpss_log_data .= "Avg Total Proc Time:\t['" . $wpss_proc_data_avg_comment_proc_time_disp . " seconds'] Average total time for WordPress to process comments" . WPSS_EOL; } $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; } $wpss_log_data .= "Failed Tests: \t\t['" . $wpss_log_data_errors_count . "']" . WPSS_EOL; $wpss_log_data .= "Failed Test Codes: \t['" . $wpss_log_data_errors . "']" . WPSS_EOL; $wpss_log_data .= "Spam Count: \t\t['" . $wpss_spamshield_count . "']" . WPSS_EOL; /* Added 1.8 */ $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "Compatibility Mode:\t['" . $wpss_compat_on . "']" . WPSS_EOL; $wpss_log_data .= "Caching:\t\t['" . $wpss_cache_on . "']" . WPSS_EOL; $wpss_log_data .= "Debugging Data:\t\t['PHP MemLimit: " . WPSS_PHP_MEM_LIMIT . "; WP MemLimit: " . WP_MEMORY_LIMIT . "; Sessions: " . $wpss_sessions_enabled . "']" . WPSS_EOL; $wpss_log_data .= "Site Server Name:\t['" . WPSS_SERVER_NAME . "']" . WPSS_EOL; $wpss_log_data .= "Site Server IP:\t\t['" . WPSS_SERVER_ADDR . "']" . WPSS_EOL; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "Active Plugins:\t\t['" . $wpss_active_plugins_str . "']" . WPSS_EOL; if (is_multisite() && !empty($wpss_active_network_plugins)) { $wpss_log_data .= "Active Net Plugins:\t['" . $wpss_active_network_plugins_str . "']" . WPSS_EOL; } $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= $wpss_plugin_user_agent . WPSS_EOL; $wpss_log_data .= $wpss_php_uname . WPSS_EOL; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= ":: " . $wpss_log_comment_type_display . " END ::" . WPSS_EOL; $wpss_log_data .= "-------------------------------------------------------------------------------------" . WPSS_EOL; $wpss_log_data .= "*************************************************************************************" . WPSS_EOL . WPSS_EOL . WPSS_EOL; $wpss_log_fp = @fopen($wpss_log_file, 'a+'); @fwrite($wpss_log_fp, $wpss_log_data); @fclose($wpss_log_fp); } }