PluginProbe
BulletProof Security / 7.1
BulletProof Security v7.1
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.1, at bulletproof-security.php

205 lines 11.1 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.1
9 Author: AITpro Website Security
10 Author URI: https://forum.ait-pro.com/read-me-first/
11 License: GPLv2 or later
12 */
13
14 /* Copyright (C) Edward Alexander | AITpro.com
15
16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version.
20
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
25
26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 */
30
31 // BPS Global variables
32 // 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.
33 // WP_CLI requires that all global variables outside of functions MUST explicitly use the global keyword since WP_CLI loads WP within a function
34 // 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.
35 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;
36
37 define( 'BULLETPROOF_VERSION', '7.1' );
38 $bps_last_version = '7.0';
39 $bps_version = '7.1';
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 // Set BPS footer text after textdomain has been loaded.
93 add_action( 'init', 'bulletproof_security_init_footer_text', 11 );
94
95 function bulletproof_security_init_footer_text() {
96 global $bps_footer, $bps_version;
97
98 $bps_footer = '<div id="AITpro-link">'
99 . __('BulletProof Security ', 'bulletproof-security')
100 . esc_html( $bps_version )
101 . __(' Plugin by ', 'bulletproof-security')
102 . '<a href="' . esc_url( 'https://www.ait-pro.com/' ) . '" target="_blank" title="AITpro Website Security">'
103 . __( 'AITpro Website Security', 'bulletproof-security' )
104 . '</a></div>';
105 }
106
107 // BPS upgrade functions
108 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/functions.php';
109 // MScan Plugin and Theme file hash variables - added to global variables above: $plugin_hashes, $theme_hashes
110 if ( file_exists( WP_CONTENT_DIR . '/bps-backup/plugin-hashes/plugin-hashes.php' ) ) {
111 require_once WP_CONTENT_DIR . '/bps-backup/plugin-hashes/plugin-hashes.php';
112 }
113 if ( file_exists( WP_CONTENT_DIR . '/bps-backup/theme-hashes/theme-hashes.php' ) ) {
114 require_once WP_CONTENT_DIR . '/bps-backup/theme-hashes/theme-hashes.php';
115 }
116 // MScan AJAX functions
117 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/mscan-ajax-functions.php';
118 // BPS HUD Dimiss functions - includes AutoFix AutoSetup checks
119 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/hud-autofix-setup.php';
120 // BPS HUD Dimiss functions - includes AutoFix AutoWhitelist checks
121 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/hud-autofix-whitelist.php';
122 // BPS HUD Dimiss functions - General Error Checks & Misc checks
123 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/hud-dismiss-functions.php';
124 // BPS Zip & Email Log File Cron functions
125 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/zip-email-cron-functions.php';
126 // General functions
127 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/general-functions.php';
128 // BPS Login Security
129 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/login-security.php';
130 // BPS Force Strong Passwords
131 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/force-strong-passwords.php';
132 // BPS DB Backup
133 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/db-security.php';
134 // BPS Hidden Plugin Folders|Files (HPF) Cron
135 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/hidden-plugin-folders-cron.php';
136 // Idle Session Logout (ISL)
137 $BPS_ISL_options = get_option('bulletproof_security_options_idle_session');
138 if ( isset( $BPS_ISL_options['bps_isl'] ) && $BPS_ISL_options['bps_isl'] == 'On' ) {
139 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/idle-session-logout.php';
140 }
141 // PHP Encryption|Decryption class using openssl_decrypt() and openssl_encrypt()
142 // Web hosts may see this file as malicious and block or delete it. So a file_exists check needs to be here.
143 $bpsPro_encrypt_decrypt_class = WP_PLUGIN_DIR . '/bulletproof-security/includes/encrypt-decrypt-class.php';
144 if ( file_exists ( $bpsPro_encrypt_decrypt_class ) ) {
145 require_once WP_PLUGIN_DIR . '/bulletproof-security/includes/encrypt-decrypt-class.php';
146 }
147
148 // If in single site Admin Dashboard
149 if ( is_admin() ) {
150
151 require_once WP_PLUGIN_DIR . '/bulletproof-security/admin/includes/admin.php';
152
153 register_activation_hook(__FILE__, 'bulletproof_security_install');
154 register_deactivation_hook(__FILE__, 'bulletproof_security_deactivation');
155 register_uninstall_hook(__FILE__, 'bulletproof_security_uninstall');
156
157 add_action( 'admin_init', 'bulletproof_security_admin_init' );
158 add_action( 'admin_menu', 'bulletproof_security_admin_menu' );
159 }
160
161 // If in Network Admin Dashboard for BPS Uninstaller
162 if ( is_multisite() && is_network_admin() ) {
163 add_action( 'network_admin_menu', 'bulletproof_security_network_admin_menu' );
164 }
165
166 // "Settings" link on Plugins Options Page
167 function bps_plugin_actlinks( $links, $file ) {
168 static $this_plugin;
169 if ( ! $this_plugin )
170 $this_plugin = plugin_basename(__FILE__);
171 if ( $file == $this_plugin ) {
172 if ( ! is_multisite() ) {
173 $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>';
174 $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', 'bulletproof-security').'</a>';
175 } elseif ( is_multisite() ) {
176 $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>';
177 // The Uninstall Options Form does not work on Network|Multisite so do not show the Uninstall Options link in Action Links
178 //$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>';
179 }
180 }
181 return $links;
182 }
183
184 add_filter( 'plugin_action_links', 'bps_plugin_actlinks', 10, 2 );
185 add_filter( 'network_admin_plugin_action_links', 'bps_plugin_actlinks', 10, 2 );
186
187 // Add links on plugins page
188 function bps_plugin_extra_links( $links, $file ) {
189 static $this_plugin;
190
191 if ( ! current_user_can('install_plugins') )
192 return $links;
193 if ( ! $this_plugin )
194 $this_plugin = plugin_basename(__FILE__);
195 if ( $file == $this_plugin ) {
196 $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', 'bulletproof-security').'</a>';
197 $links[] = '<a href="https://affiliates.ait-pro.com/po/" title="Upgrade to BPS Pro" target="_blank">'.__('Upgrade', 'bulletproof-security').'</a>';
198 $links[] = '<a href="https://www.ait-pro.com/bps-features/" title="BPS Pro Features" target="_blank">'.__('BPS Pro Features', 'bulletproof-security').'</a>';
199 }
200 return $links;
201 }
202
203 add_filter( 'plugin_row_meta', 'bps_plugin_extra_links', 10, 2 );
204
205 ?>