'render_tab1', 'tab2' => 'render_tab2', 'tab3' => 'render_tab3', ); function __construct() { $this->render_menu_page(); } function set_menu_tabs() { $this->menu_tabs = array( 'tab1' => __('Comment SPAM', 'all-in-one-wp-security-and-firewall'), 'tab2' => __('Comment SPAM IP Monitoring', 'all-in-one-wp-security-and-firewall'), 'tab3' => __('BuddyPress', 'all-in-one-wp-security-and-firewall'), ); } function get_current_tab() { $tab_keys = array_keys($this->menu_tabs); $tab = isset( $_GET['tab'] ) ? sanitize_text_field($_GET['tab']) : $tab_keys[0]; return $tab; } /* * Renders our tabs of this menu as nav items */ function render_menu_tabs() { $current_tab = $this->get_current_tab(); echo ''; } /* * The menu rendering goes here */ function render_menu_page() { echo '
'; echo '

'.__('SPAM Prevention','all-in-one-wp-security-and-firewall').'

';//Interface title $this->set_menu_tabs(); $tab = $this->get_current_tab(); $this->render_menu_tabs(); ?>
menu_tabs); call_user_func(array(&$this, $this->menu_tabs_handler[$tab])); ?>
debug_logger->log_debug("Nonce check failed on save comment spam settings!",4); die("Nonce check failed on save comment spam settings!"); } //Save settings $random_20_digit_string = AIOWPSecurity_Utility::generate_alpha_numeric_random_string(20); //Generate random 20 char string for use during captcha encode/decode $aio_wp_security->configs->set_value('aiowps_captcha_secret_key', $random_20_digit_string); $aio_wp_security->configs->set_value('aiowps_enable_comment_captcha',isset($_POST["aiowps_enable_comment_captcha"])?'1':''); $aio_wp_security->configs->set_value('aiowps_enable_spambot_blocking',isset($_POST["aiowps_enable_spambot_blocking"])?'1':''); //Commit the config settings $aio_wp_security->configs->save_config(); //Recalculate points after the feature status/options have been altered $aiowps_feature_mgr->check_feature_status_and_recalculate_points(); //Now let's write the applicable rules to the .htaccess file $res = AIOWPSecurity_Utility_Htaccess::write_to_htaccess(); if ($res) { $this->show_msg_updated(__('Settings were successfully saved', 'all-in-one-wp-security-and-firewall')); } else { $this->show_msg_error(__('Could not write to the .htaccess file. Please check the file permissions.', 'all-in-one-wp-security-and-firewall')); } } ?>

'.__('This feature will add a simple math captcha field in the WordPress comments form.', 'all-in-one-wp-security-and-firewall'). '
'.__('Adding a captcha field in the comment form is a simple way of greatly reducing SPAM comments from bots without using .htaccess rules.', 'all-in-one-wp-security-and-firewall').'

'; ?>
output_feature_details_badge("comment-form-captcha"); ?>
: configs->get_value('aiowps_enable_comment_captcha')=='1') echo ' checked="checked"'; ?> value="1"/>

'.__('A large portion of WordPress blog comment SPAM is mainly produced by automated bots and not necessarily by humans. ', 'all-in-one-wp-security-and-firewall'). '
'.__('This feature will greatly minimize the useless and unecessary traffic and load on your server resulting from SPAM comments by blocking all comment requests which do not originate from your domain.', 'all-in-one-wp-security-and-firewall'). '
'.__('In other words, if the comment was not submitted by a human who physically submitted the comment on your site, the request will be blocked.', 'all-in-one-wp-security-and-firewall').'

'; ?>
output_feature_details_badge("block-spambots"); if (AIOWPSecurity_Utility::is_multisite_install() && get_current_blog_id() != 1) { //Hide config settings if MS and not main site AIOWPSecurity_Utility::display_multisite_message(); } else { ?>
: configs->get_value('aiowps_enable_spambot_blocking')=='1') echo ' checked="checked"'; ?> value="1"/> +
'.__('This feature will implement a firewall rule to block all comment attempts which do not originate from your domain.', 'all-in-one-wp-security-and-firewall').'

'; echo '

'.__('A legitimate comment is one which is submitted by a human who physically fills out the comment form and clicks the submit button. For such events, the HTTP_REFERRER is always set to your own domain.', 'all-in-one-wp-security-and-firewall').'

'; echo '

'.__('A comment submitted by a spambot is done by directly calling the comments.php file, which usually means that the HTTP_REFERRER value is not your domain and often times empty.', 'all-in-one-wp-security-and-firewall').'

'; echo '

'.__('This feature will check and block comment requests which are not referred by your domain thus greatly reducing your overall blog SPAM and PHP requests done by the server to process these comments.', 'all-in-one-wp-security-and-firewall').'

'; ?>
debug_logger->log_debug("Nonce check failed on auto block SPAM IPs options save!",4); die("Nonce check failed on auto block SPAM IPs options save!"); } $spam_ip_min_comments = sanitize_text_field($_POST['aiowps_spam_ip_min_comments_block']); if(!is_numeric($spam_ip_min_comments)) { $error .= '
'.__('You entered a non numeric value for the minimum number of spam comments field. It has been set to the default value.','all-in-one-wp-security-and-firewall'); $spam_ip_min_comments = '3';//Set it to the default value for this field }elseif(empty($spam_ip_min_comments)){ $error .= '
'.__('You must enter an integer greater than zero for minimum number of spam comments field. It has been set to the default value.','all-in-one-wp-security-and-firewall'); $spam_ip_min_comments = '3';//Set it to the default value for this field } if($error) { $this->show_msg_error(__('Attention!','all-in-one-wp-security-and-firewall').$error); } //Save all the form values to the options $aio_wp_security->configs->set_value('aiowps_enable_autoblock_spam_ip',isset($_POST["aiowps_enable_autoblock_spam_ip"])?'1':''); $aio_wp_security->configs->set_value('aiowps_spam_ip_min_comments_block',absint($spam_ip_min_comments)); $aio_wp_security->configs->save_config(); //Recalculate points after the feature status/options have been altered $aiowps_feature_mgr->check_feature_status_and_recalculate_points(); $this->show_msg_settings_updated(); } if (isset($_POST['aiowps_ip_spam_comment_search'])) { $error = ''; $nonce=$_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'aiowpsec-spammer-ip-list-nonce')) { $aio_wp_security->debug_logger->log_debug("Nonce check failed for list SPAM comment IPs!",4); die(__('Nonce check failed for list SPAM comment IPs!','all-in-one-wp-security-and-firewall')); } $min_comments_per_ip = sanitize_text_field($_POST['aiowps_spam_ip_min_comments']); if(!is_numeric($min_comments_per_ip)) { $error .= '
'.__('You entered a non numeric value for the minimum SPAM comments per IP field. It has been set to the default value.','all-in-one-wp-security-and-firewall'); $min_comments_per_ip = '5';//Set it to the default value for this field } if($error) { $this->show_msg_error(__('Attention!','all-in-one-wp-security-and-firewall').$error); } //Save all the form values to the options $aio_wp_security->configs->set_value('aiowps_spam_ip_min_comments',absint($min_comments_per_ip)); $aio_wp_security->configs->save_config(); $info_msg_string = sprintf( __('Displaying results for IP addresses which have posted a minimum of %s SPAM comments', 'all-in-one-wp-security-and-firewall'), $min_comments_per_ip); $this->show_msg_updated($info_msg_string); } if(isset($_REQUEST['action'])) //Do list table form row action tasks { if($_REQUEST['action'] == 'block_spammer_ip') { //The "block" link was clicked for a row in the list table $spammer_ip_list->block_spammer_ip_records(strip_tags($_REQUEST['spammer_ip'])); } } ?>

configs->get_value('aiowps_enable_autoblock_spam_ip')=='1' && !class_exists('Akismet')){ $akismet_link = 'Akismet'; $info_msg = sprintf( __('This feature has detected that %s is not active. It is highly recommended that you activate the Akismet plugin to make the most of this feature.', 'all-in-one-wp-security-and-firewall'), $akismet_link); echo '

'.$info_msg.'

'; } ?>
'.__('This feature allows you to automatically and permanently block IP addresses which have exceeded a certain number of comments labelled as SPAM.', 'all-in-one-wp-security-and-firewall').'

'. '

'.__('Comments are usually labelled as SPAM either by the Akismet plugin or manually by the WP administrator when they mark a comment as "spam" from the WordPress Comments menu.', 'all-in-one-wp-security-and-firewall').'

'. '

'.__('NOTE: This feature does NOT use the .htaccess file to permanently block the IP addresses so it should be compatible with all web servers running WordPress.', 'all-in-one-wp-security-and-firewall').'

'; ?>
configs->get_value('aiowps_spam_ip_min_comments_block'); if(!empty($min_block_comments)){ global $wpdb; $sql = $wpdb->prepare('SELECT * FROM '.AIOWPSEC_TBL_PERM_BLOCK.' WHERE block_reason=%s', 'spam'); $total_res = $wpdb->get_results($sql); ?>
'.__('You currently have no IP addresses permanently blocked due to SPAM.', 'all-in-one-wp-security-and-firewall').'

'; }else{ $total_count = count($total_res); $todays_blocked_count = 0; foreach($total_res as $blocked_item){ $now = date_i18n( 'Y-m-d H:i:s' ); $now_date_time = new DateTime($now); $blocked_date = new DateTime($blocked_item->blocked_date); if($blocked_date->format('Y-m-d') == $now_date_time->format('Y-m-d')) { //there was an IP added to permanent block list today ++$todays_blocked_count; } } echo '

'.__('Spammer IPs Added To Permanent Block List Today: ', 'all-in-one-wp-security-and-firewall').$todays_blocked_count.'

'. '

'.__('All Time Total: ', 'all-in-one-wp-security-and-firewall').$total_count.'

'. '

'.__('View Blocked IPs','all-in-one-wp-security-and-firewall').'

'; } ?>
output_feature_details_badge("auto-block-spam-ip"); ?>
: configs->get_value('aiowps_enable_autoblock_spam_ip')=='1') echo ' checked="checked"'; ?> value="1"/>
: +
'.__('Example 1: Setting this value to "1" will block ALL IP addresses which were used to submit at least one SPAM comment.', 'all-in-one-wp-security-and-firewall').'

'; echo '

'.__('Example 2: Setting this value to "5" will block only those IP addresses which were used to submit 5 SPAM comments or more on your site.', 'all-in-one-wp-security-and-firewall').'

'; ?>

'.__('This section displays a list of the IP addresses of the people or bots who have left SPAM comments on your site.', 'all-in-one-wp-security-and-firewall').'
'.__('This information can be handy for identifying the most persistent IP addresses or ranges used by spammers.', 'all-in-one-wp-security-and-firewall').'
'.__('By inspecting the IP address data coming from spammers you will be in a better position to determine which addresses or address ranges you should block by adding them to your blacklist.', 'all-in-one-wp-security-and-firewall').'
'.__('To add one or more of the IP addresses displayed in the table below to your blacklist, simply click the "Block" link for the individual row or select more than one address using the checkboxes and then choose the "block" option from the Bulk Actions dropdown list and click the "Apply" button.', 'all-in-one-wp-security-and-firewall').'

'; ?>
: +
'.__('Example 1: Setting this value to "0" or "1" will list ALL IP addresses which were used to submit SPAM comments.', 'all-in-one-wp-security-and-firewall').'

'; echo '

'.__('Example 2: Setting this value to "5" will list only those IP addresses which were used to submit 5 SPAM comments or more on your site.', 'all-in-one-wp-security-and-firewall').'

'; ?>

'; echo '

'.__('The plugin has detected that you are using a Multi-Site WordPress installation.', 'all-in-one-wp-security-and-firewall').'

'.__('Only the "superadmin" can block IP addresses from the main site.', 'all-in-one-wp-security-and-firewall').'

'.__('Take note of the IP addresses you want blocked and ask the superadmin to add these to the blacklist using the "Blacklist Manager" on the main site.', 'all-in-one-wp-security-and-firewall').'

'; echo '
'; } //Fetch, prepare, sort, and filter our data... $spammer_ip_list->prepare_items(); //echo "put table of locked entries here"; ?>
display(); ?>
debug_logger->log_debug("Nonce check failed on save comment spam settings!",4); die("Nonce check failed on save comment spam settings!"); } //Save settings $aio_wp_security->configs->set_value('aiowps_enable_bp_register_captcha',isset($_POST["aiowps_enable_bp_register_captcha"])?'1':''); //Commit the config settings $aio_wp_security->configs->save_config(); //Recalculate points after the feature status/options have been altered $aiowps_feature_mgr->check_feature_status_and_recalculate_points(); $this->show_msg_updated(__('Settings were successfully saved', 'all-in-one-wp-security-and-firewall')); } ?>

'.__('This feature will add a simple math captcha field in the BuddyPress registration form.', 'all-in-one-wp-security-and-firewall'). '
'.__('Adding a captcha field in the registration form is a simple way of greatly reducing SPAM signups from bots without using .htaccess rules.', 'all-in-one-wp-security-and-firewall').'

'; ?>
output_feature_details_badge("bp-register-captcha"); ?>
: configs->get_value('aiowps_enable_bp_register_captcha')=='1') echo ' checked="checked"'; ?> value="1"/>
show_msg_error(__('BuddyPress is not active! In order to use this feature you will need to have BuddyPress installed and activated.', 'all-in-one-wp-security-and-firewall')); } } } //end class