PluginProbe ʕ •ᴥ•ʔ
SiteGuard WP Plugin / 1.2.2
SiteGuard WP Plugin v1.2.2
1.8.7 1.8.6 1.8.6-beta1 1.8.6-beta2 1.8.4 1.8.5 1.8.3 1.8.2 1.8.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.4.3 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.11 1.7.12 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.0-beta1 1.8.0-beta2 1.8.0-beta3 1.8.0-beta4
siteguard / siteguard.php
siteguard Last commit date
admin 11 years ago classes 11 years ago css 11 years ago images 11 years ago languages 11 years ago really-simple-captcha 11 years ago license.txt 11 years ago readme.txt 11 years ago siteguard.php 11 years ago uninstall.php 11 years ago
siteguard.php
207 lines
1 <?php
2 /*
3 Plugin Name: SiteGuard WP Plugin
4 Plugin URI: http://www.jp-secure.com/cont/products/siteguard_wp_plugin/index_en.html
5 Description: Only installing SiteGuard WP Plugin on WordPress, its security can be improved. SiteGurad WP Plugin is the plugin specialized for the protection against the attack to the management page and login. It also have the function to create the exclude rule for WAF (SiteGuard Lite, to use it, WAF should be installed on the Web server.)
6 Author: JP-Secure
7 Author URI: http://www.jp-secure.com/eng/
8 Text Domain: siteguard
9 Domain Path: /languages/
10 Version: 1.2.2
11 */
12
13 /* Copyright 2014 JP-Secure Inc
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, version 2, as
17 published by the Free Software Foundation.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28
29 if ( ! defined( 'ABSPATH' ) ) {
30 exit;
31 }
32
33 define( 'SITEGUARD_VERSION', '1.2.2' );
34
35 define( 'SITEGUARD_PATH', plugin_dir_path( __FILE__ ) );
36 define( 'SITEGUARD_URL_PATH', plugin_dir_url( __FILE__ ) );
37
38 define( 'SITEGUARD_LOGIN_SUCCESS', 0 );
39 define( 'SITEGUARD_LOGIN_FAILED', 1 );
40 define( 'SITEGUARD_LOGIN_FAIL_ONCE', 2 );
41 define( 'SITEGUARD_LOGIN_LOCKED', 3 );
42
43 require_once( 'classes/siteguard-base.php' );
44 require_once( 'classes/siteguard-config.php' );
45 require_once( 'classes/siteguard-htaccess.php' );
46 require_once( 'classes/siteguard-admin-filter.php' );
47 require_once( 'classes/siteguard-rename-login.php' );
48 require_once( 'classes/siteguard-login-history.php' );
49 require_once( 'classes/siteguard-login-lock.php' );
50 require_once( 'classes/siteguard-login-alert.php' );
51 require_once( 'classes/siteguard-captcha.php' );
52 require_once( 'classes/siteguard-disable-pingback.php' );
53 require_once( 'classes/siteguard-waf-exclude-rule.php' );
54 require_once( 'classes/siteguard-updates-notify.php' );
55 require_once( 'admin/siteguard-menu-init.php' );
56
57 global $htaccess;
58 global $config;
59 global $admin_filter;
60 global $rename_login;
61 global $loginlock;
62 global $loginalert;
63 global $captcha;
64 global $login_history;
65 global $pingback;
66 global $waf_exclude_rule;
67 global $updates_notify;
68
69 $htaccess = new SiteGuard_Htaccess( );
70 $config = new SiteGuard_Config( );
71 $admin_filter = new SiteGuard_AdminFilter( );
72 $rename_login = new SiteGuard_RenameLogin( );
73 $loginlock = new SiteGuard_LoginLock( );
74 $loginalert = new SiteGuard_LoginAlert( );
75 $login_history = new SiteGuard_LoginHistory( );
76 $captcha = new SiteGuard_CAPTCHA( );
77 $pingback = new SiteGuard_Disable_Pingback( );
78 $waf_exclude_rule = new SiteGuard_WAF_Exclude_Rule( );
79 $updates_notify = new SiteGuard_UpdatesNotify( );
80
81 function siteguard_activate( ) {
82 global $config, $admin_filter, $rename_login, $login_history, $captcha, $loginlock, $loginalert, $pingback, $waf_exclude_rule, $updates_notify;
83
84 load_plugin_textdomain(
85 'siteguard',
86 false,
87 dirname( plugin_basename( __FILE__ ) ) . '/languages'
88 );
89
90 $config->set( 'show_admin_notices', '0' );
91 $config->update( );
92 $admin_filter->init();
93 $rename_login->init();
94 $login_history->init();
95 $captcha->init();
96 $loginlock->init();
97 $loginalert->init();
98 $pingback->init();
99 $waf_exclude_rule->init();
100 $updates_notify->init();
101 }
102 register_activation_hook( __FILE__, 'siteguard_activate' );
103
104 function siteguard_deactivate( ) {
105 global $config;
106 $config->set( 'show_admin_notices', '0' );
107 $config->update( );
108 SiteGuard_RenameLogin::feature_off( );
109 SiteGuard_AdminFilter::feature_off( );
110 SiteGuard_WAF_Exclude_Rule::feature_off( );
111 SiteGuard_UpdatesNotify::feature_off( );
112 }
113 register_deactivation_hook( __FILE__, 'siteguard_deactivate' );
114
115
116 class SiteGuard extends SiteGuard_Base {
117 var $menu_init;
118 function __construct( ) {
119 global $config;
120 add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
121 $this->htaccess_check( );
122 if ( is_admin( ) ) {
123 $this->menu_init = new SiteGuard_Menu_Init( );
124 add_action( 'admin_init', array( $this, 'upgrade' ) );
125 if ( '0' === $config->get( 'show_admin_notices' ) && '1' == $config->get( 'renamelogin_enable' ) ) {
126 add_action( 'admin_notices', array( $this, 'admin_notices' ) );
127 $config->set( 'show_admin_notices', '1' );
128 $config->update( );
129 }
130 }
131 }
132 function plugins_loaded( ) {
133 load_plugin_textdomain(
134 'siteguard',
135 false,
136 dirname( plugin_basename( __FILE__ ) ) . '/languages'
137 );
138 }
139 function htaccess_check( ) {
140 global $config;
141 if ( '1' == $config->get( 'admin_filter_enable' ) ) {
142 if ( ! SiteGuard_Htaccess::is_exists_setting( SiteGuard_AdminFilter::get_mark( ) ) ) {
143 $config->set( 'admin_filter_enable', '0' );
144 $config->update( );
145 }
146 }
147 if ( '1' == $config->get( 'renamelogin_enable' ) ) {
148 if ( ! SiteGuard_Htaccess::is_exists_setting( SiteGuard_RenameLogin::get_mark( ) ) ) {
149 $config->set( 'renamelogin_enable', '0' );
150 $config->update( );
151 }
152 }
153 if ( '1' == $config->get( 'waf_exclude_rule_enable' ) ) {
154 if ( ! SiteGuard_Htaccess::is_exists_setting( SiteGuard_WAF_Exclude_Rule::get_mark( ) ) ) {
155 $config->set( 'waf_exclude_rule_enable', '0' );
156 $config->update( );
157 }
158 }
159 }
160 function admin_notices( ) {
161 global $rename_login;
162 echo '<div class="updated" style="background-color:#719f1d;"><p><span style="border: 4px solid #def1b8;padding: 4px 4px;color:#fff;font-weight:bold;background-color:#038bc3;">';
163 echo esc_html__( 'Login page URL was changed.', 'siteguard' ) . '</span>';
164 echo '<span style="color:#eee;">';
165 echo esc_html__( ' Please bookmark ', 'siteguard' ) . '<a style="color:#fff;text-decoration:underline;" href="' . esc_url( wp_login_url( ) ) . '">';
166 echo esc_html__( 'new login URL', 'siteguard' ) . '</a>';
167 echo esc_html__( '. Setting change is ', 'siteguard' ) . '<a style="color:#fff;text-decoration:underline;" href="' . esc_url( menu_page_url( 'siteguard_rename_login', false ) ) . '">';
168 echo esc_html__( 'here', 'siteguard' ) . '</a>';
169 echo '.</span></p></div>';
170 $rename_login->send_notify( );
171 }
172 function upgrade( ) {
173 global $config, $rename_login, $admin_filter, $loginalert, $updates_notify;
174 $upgrade_ok = true;
175 $old_version = $config->get( 'version' );
176 if ( '' == $old_version ) {
177 $old_version = '0.0.0';
178 }
179 if ( version_compare( $old_version, '1.0.3' ) < 0 ) {
180 if ( '1' == $config->get( 'renamelogin_enable' ) ) {
181 if ( true != $rename_login->feature_on( ) ) {
182 $upgrade_ok = false;
183 }
184 }
185 }
186 if ( version_compare( $old_version, '1.0.6' ) < 0 ) {
187 if ( '1' == $config->get( 'admin_filter_enable' ) ) {
188 if ( true != $admin_filter->feature_on( $_SERVER['REMOTE_ADDR'] ) ) {
189 $upgrade_ok = false;
190 }
191 }
192 }
193 if ( version_compare( $old_version, '1.1.1' ) < 0 ) {
194 $loginalert->init();
195 }
196 if ( version_compare( $old_version, '1.2.0' ) < 0 ) {
197 $updates_notify->init();
198 }
199 if ( $upgrade_ok && SITEGUARD_VERSION != $old_version ) {
200 $config->set( 'version', SITEGUARD_VERSION );
201 $config->update( );
202 }
203 }
204 }
205 $siteguard = new SiteGuard;
206 ?>
207