PluginProbe
BulletProof Security / 7.0
BulletProof Security v7.0
5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 trunk 0.44 0.44.1 0.45 0.45.1 0.45.2 0.45.3 0.45.4 0.45.5 All 154 releases
bulletproof-security / bulletproof-security.php

bulletproof-security.php in BulletProof Security 7.0, at bulletproof-security.php

190 lines 10.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: BulletProof Security
4 Plugin URI: https://forum.ait-pro.com/read-me-first/
5 Text Domain: bulletproof-security
6 Domain Path: /languages/
7 Description: <strong>Feature Highlights:</strong> Setup Wizard &bull; MScan Malware Scanner &bull; .htaccess Website Security Protection (Firewalls) &bull; Security Logging|HTTP Error Logging &bull; DB Backup &bull; DB Table Prefix Changer &bull; Login Security & Monitoring &bull; JTC-Lite Login Form Bot Lockout Protection &bull; Idle Session Logout (ISL) &bull; Auth Cookie Expiration (ACE) &bull; System Info: Extensive System, Server and Security Status Information &bull; FrontEnd|BackEnd Maintenance Mode &bull; WP Automatic Update Options (BPS MU Tools must-use plugin) &bull; Force Strong Passwords &bull; Email Alerts When New Plugins And Themes Are Available.
8 Version: 7.0
9 Author: AITpro Website Security
10 Author URI: https://forum.ait-pro.com/read-me-first/
11 */
12
13 /* Copyright (C) Edward Alexander | AITpro.com
14
15 This program is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation; either version 2 of the License, or
18 (at your option) any later version.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, write to the Free Software
27 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 */
29
30 // BPS Global variables
31 // 3.4: It is not a mistake or retarded to add the global keyword to global variables outside of functions per PHP.net, but yeah it does appear to be retarded.
32 // WP_CLI requires that all global variables outside of functions MUST explicitly use the global keyword since WP_CLI loads WP within a function
33 // and cannot access the global variables within functions in BPS. Luckily this does not break BPS or WordPress in any way and PHP.net states this is technically not an error.
34 global $bps_last_version, $bps_version, $bps_footer, $aitpro_bullet, $bps_topDiv, $bps_bottomDiv, $bpsPro_remote_addr, $bpsPro_http_client_ip, $bpsPro_http_forwarded, $bpsPro_http_x_forwarded_for, $bpsPro_http_x_cluster_client_ip, $bps_wpcontent_dir, $bps_plugin_dir, $plugin_hashes, $theme_hashes;
35
36 define( 'BULLETPROOF_VERSION', '7.0' );
37 $bps_last_version = '6.9';
38 $bps_version = '7.0';
39 $bps_footer = '<div id="AITpro-link">' . __('BulletProof Security ', 'bulletproof-security') . esc_html($bps_version) . __(' Plugin by ', 'bulletproof-security') . '<a href="'.esc_url('https://www.ait-pro.com/').'" target="_blank" title="AITpro Website Security">' . __( 'AITpro Website Security', 'bulletproof-security') . '</a></div>';
40 $aitpro_bullet = '<img src="'.plugins_url('/bulletproof-security/admin/images/aitpro-bullet.png').'" style="padding:0px 3px 0px 3px;" />';
41 // Top div & bottom div
42 $bps_topDiv = '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
43 $bps_bottomDiv = '</p></div>';
44 $bps_wpcontent_dir = str_replace( ABSPATH, '', WP_CONTENT_DIR );
45 $bps_plugin_dir = str_replace( ABSPATH, '', WP_PLUGIN_DIR );
46
47 // Setup Wizard Options: GDPR Compliance Global Variables
48 $GDPR_Options = get_option('bulletproof_security_options_gdpr');
49
50 if ( isset( $GDPR_Options['bps_gdpr_on_off'] ) && $GDPR_Options['bps_gdpr_on_off'] != 'On' ) {
51
52 $bpsPro_remote_addr = false;
53 if ( array_key_exists('REMOTE_ADDR', $_SERVER) ) {
54 $bpsPro_remote_addr = $_SERVER['REMOTE_ADDR'];
55 }
56 $bpsPro_http_client_ip = false;
57 if ( array_key_exists('HTTP_CLIENT_IP', $_SERVER) ) {
58 $bpsPro_http_client_ip = $_SERVER['HTTP_CLIENT_IP'];
59 }
60 $bpsPro_http_forwarded = false;
61 if ( array_key_exists('HTTP_FORWARDED', $_SERVER) ) {
62 $bpsPro_http_forwarded = $_SERVER['HTTP_FORWARDED'];
63 }
64 $bpsPro_http_x_forwarded_for = false;
65 if ( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) ) {
66 $bpsPro_http_x_forwarded_for = $_SERVER['HTTP_X_FORWARDED_FOR'];
67 }
68 $bpsPro_http_x_cluster_client_ip = false;
69 if ( array_key_exists('HTTP_X_CLUSTER_CLIENT_IP', $_SERVER) ) {
70 $bpsPro_http_x_cluster_client_ip = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
71 }
72
73 } else {
74
75 $bpsPro_remote_addr = 'GDPR Compliance On';
76 $bpsPro_http_client_ip = 'GDPR Compliance On';
77 $bpsPro_http_forwarded = 'GDPR Compliance On';
78 $bpsPro_http_x_forwarded_for = 'GDPR Compliance On';
79 $bpsPro_http_x_cluster_client_ip = 'GDPR Compliance On';
80 }
81
82 // Load BPS Global class - not doing anything with this Class in BPS Free
83 //require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/class.php';
84
85 add_action( 'init', 'bulletproof_security_load_plugin_textdomain' );
86
87 // Load i18n Language Translation
88 function bulletproof_security_load_plugin_textdomain() {
89 load_plugin_textdomain('bulletproof-security', false, dirname(plugin_basename(__FILE__)).'/languages/');
90 }
91
92 // BPS upgrade functions
93 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/functions.php';
94 // MScan Plugin and Theme file hash variables - added to global variables above: $plugin_hashes, $theme_hashes
95 if ( file_exists( WP_CONTENT_DIR . '/bps-backup/plugin-hashes/plugin-hashes.php' ) ) {
96 require_once WP_CONTENT_DIR . '/bps-backup/plugin-hashes/plugin-hashes.php';
97 }
98 if ( file_exists( WP_CONTENT_DIR . '/bps-backup/theme-hashes/theme-hashes.php' ) ) {
99 require_once WP_CONTENT_DIR . '/bps-backup/theme-hashes/theme-hashes.php';
100 }
101 // MScan AJAX functions
102 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/mscan-ajax-functions.php';
103 // BPS HUD Dimiss functions - includes AutoFix AutoSetup checks
104 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/hud-autofix-setup.php';
105 // BPS HUD Dimiss functions - includes AutoFix AutoWhitelist checks
106 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/hud-autofix-whitelist.php';
107 // BPS HUD Dimiss functions - General Error Checks & Misc checks
108 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/hud-dismiss-functions.php';
109 // BPS Zip & Email Log File Cron functions
110 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/zip-email-cron-functions.php';
111 // General functions
112 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/general-functions.php';
113 // BPS Login Security
114 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/login-security.php';
115 // BPS Force Strong Passwords
116 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/force-strong-passwords.php';
117 // BPS DB Backup
118 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/db-security.php';
119 // BPS Hidden Plugin Folders|Files (HPF) Cron
120 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/hidden-plugin-folders-cron.php';
121 // Idle Session Logout (ISL)
122 $BPS_ISL_options = get_option('bulletproof_security_options_idle_session');
123 if ( isset( $BPS_ISL_options['bps_isl'] ) && $BPS_ISL_options['bps_isl'] == 'On' ) {
124 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/idle-session-logout.php';
125 }
126 // PHP Encryption|Decryption class using openssl_decrypt() and openssl_encrypt()
127 // Web hosts may see this file as malicious and block or delete it. So a file_exists check needs to be here.
128 $bpsPro_encrypt_decrypt_class = WP_PLUGIN_DIR . '/bulletproof-security/includes/encrypt-decrypt-class.php';
129 if ( file_exists ( $bpsPro_encrypt_decrypt_class ) ) {
130 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/encrypt-decrypt-class.php';
131 }
132
133 // If in single site Admin Dashboard
134 if ( is_admin() ) {
135
136 require_once WP_PLUGIN_DIR . '/bulletproof-security/admin/includes/admin.php';
137
138 register_activation_hook(__FILE__, 'bulletproof_security_install');
139 register_deactivation_hook(__FILE__, 'bulletproof_security_deactivation');
140 register_uninstall_hook(__FILE__, 'bulletproof_security_uninstall');
141
142 add_action( 'admin_init', 'bulletproof_security_admin_init' );
143 add_action( 'admin_menu', 'bulletproof_security_admin_menu' );
144 }
145
146 // If in Network Admin Dashboard for BPS Uninstaller
147 if ( is_multisite() && is_network_admin() ) {
148 add_action( 'network_admin_menu', 'bulletproof_security_network_admin_menu' );
149 }
150
151 // "Settings" link on Plugins Options Page
152 function bps_plugin_actlinks( $links, $file ) {
153 static $this_plugin;
154 if ( ! $this_plugin )
155 $this_plugin = plugin_basename(__FILE__);
156 if ( $file == $this_plugin ) {
157 if ( ! is_multisite() ) {
158 $links[] = '<br><a href="'.admin_url( 'admin.php?page=bulletproof-security/admin/wizard/wizard.php' ).'" title="'.esc_attr( 'BPS Setup Wizard' ).'">'.__('Setup Wizard', 'bulletproof-security').'</a>';
159 $links[] = '<br><a href="'.admin_url( 'plugins.php?page=bulletproof-security/admin/includes/uninstall.php' ).'" title="'.esc_attr( 'Select an uninstall option for BPS plugin deletion' ).'">'.__('Uninstall Options', 'bulleproof-security').'</a>';
160 } elseif ( is_multisite() ) {
161 $links[] = '<br><a href="'.admin_url( 'admin.php?page=bulletproof-security/admin/wizard/wizard.php' ).'" title="'.esc_attr( 'BPS Setup Wizard' ).'">'.__('Setup Wizard', 'bulletproof-security').'</a>';
162 // The Uninstall Options Form does not work on Network|Multisite so do not show the Uninstall Options link in Action Links
163 //$links[] = '<br><a href="'.network_admin_url( 'plugins.php?page=bulletproof-security/admin/includes/uninstall.php' ).'" title="'.esc_attr( 'Select an uninstall option for BPS plugin deletion' ).'">'.__('Uninstall Options', 'bulleproof-security').'</a>';
164 }
165 }
166 return $links;
167 }
168
169 add_filter( 'plugin_action_links', 'bps_plugin_actlinks', 10, 2 );
170 add_filter( 'network_admin_plugin_action_links', 'bps_plugin_actlinks', 10, 2 );
171
172 // Add links on plugins page
173 function bps_plugin_extra_links( $links, $file ) {
174 static $this_plugin;
175
176 if ( ! current_user_can('install_plugins') )
177 return $links;
178 if ( ! $this_plugin )
179 $this_plugin = plugin_basename(__FILE__);
180 if ( $file == $this_plugin ) {
181 $links[] = '<a href="https://forum.ait-pro.com/forums/topic/plugin-conflicts-actively-blocked-plugins-plugin-compatibility/" title="BulletProof Security Forum" target="_blank">'.__('Forum - Support', 'bulleproof-security').'</a>';
182 $links[] = '<a href="https://affiliates.ait-pro.com/po/" title="Upgrade to BPS Pro" target="_blank">'.__('Upgrade', 'bulleproof-security').'</a>';
183 $links[] = '<a href="https://www.ait-pro.com/bps-features/" title="BPS Pro Features" target="_blank">'.__('BPS Pro Features', 'bulleproof-security').'</a>';
184 }
185 return $links;
186 }
187
188 add_filter( 'plugin_row_meta', 'bps_plugin_extra_links', 10, 2 );
189
190 ?>