SiteGuard WP Plugin - Version 1.4.3

Version Description

  • * Fix bug in 1.4.2 "NoticeUse of undefined constant HTTPS"
Download this release

Release Info

Developer jp-secure
Plugin Icon 128x128 SiteGuard WP Plugin
Version 1.4.3
Comparing to
See all releases

Code changes from version 1.2.3 to 1.4.3

Files changed (39) hide show
  1. admin/siteguard-login-history-table.php +172 -6
  2. admin/siteguard-menu-admin-filter.php +58 -40
  3. admin/siteguard-menu-advanced-setting.php +96 -0
  4. admin/siteguard-menu-captcha.php +71 -71
  5. admin/siteguard-menu-dashboard.php +32 -35
  6. admin/siteguard-menu-disable-pingback.php +0 -89
  7. admin/siteguard-menu-fail-once.php +27 -28
  8. admin/siteguard-menu-init.php +65 -19
  9. admin/siteguard-menu-login-alert.php +40 -42
  10. admin/siteguard-menu-login-history.php +85 -0
  11. admin/siteguard-menu-login-lock.php +60 -58
  12. admin/siteguard-menu-protect-xmlrpc.php +178 -0
  13. admin/siteguard-menu-rename-login.php +72 -52
  14. admin/siteguard-menu-same-error.php +24 -25
  15. admin/siteguard-menu-updates-notify.php +59 -59
  16. admin/siteguard-menu-waf-tuning-support.php +67 -41
  17. admin/siteguard-waf-exclude-rule-table.php +10 -9
  18. classes/siteguard-admin-filter.php +72 -23
  19. classes/siteguard-base.php +37 -12
  20. classes/siteguard-captcha.php +79 -52
  21. classes/siteguard-config.php +1 -4
  22. classes/siteguard-disable-pingback.php +7 -9
  23. classes/siteguard-disable-xmlrpc.php +39 -0
  24. classes/siteguard-htaccess.php +73 -35
  25. classes/siteguard-login-alert.php +18 -18
  26. classes/siteguard-login-history.php +97 -12
  27. classes/siteguard-login-lock.php +39 -32
  28. classes/siteguard-rename-login.php +66 -38
  29. classes/siteguard-updates-notify.php +55 -52
  30. classes/siteguard-waf-exclude-rule.php +52 -41
  31. languages/siteguard-ja.mo +0 -0
  32. languages/siteguard-ja.po +115 -26
  33. languages/siteguard.pot +400 -268
  34. readme.txt +45 -13
  35. really-simple-captcha/siteguard-really-simple-captcha.php +74 -47
  36. siteguard.php +119 -78
  37. test/.htaccess +4 -0
  38. test/siteguard-dummy.php +3 -0
  39. uninstall.php +0 -2
admin/siteguard-login-history-table.php CHANGED
@@ -4,6 +4,12 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
4
  }
5
 
6
  class SiteGuard_LoginHistory_Table extends WP_List_Table {
 
 
 
 
 
 
7
 
8
  function __construct( ) {
9
  global $status, $page;
@@ -14,12 +20,44 @@ class SiteGuard_LoginHistory_Table extends WP_List_Table {
14
  'plural' => 'events', //plural name of the listed records
15
  'ajax' => false, //does this table support ajax?
16
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
 
19
  function column_default( $item, $column_name ) {
20
  switch ( $column_name ) {
21
  case 'operation':
22
  return SiteGuard_LoginHistory::convert_operation( $item[ $column_name ] );
 
 
23
  case 'time':
24
  case 'login_name':
25
  case 'ip_address':
@@ -31,11 +69,12 @@ class SiteGuard_LoginHistory_Table extends WP_List_Table {
31
 
32
  function get_columns( ) {
33
  $columns = array(
34
- #'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
35
  'time' => esc_html__( 'Date Time', 'siteguard' ),
36
  'operation' => esc_html__( 'Operation', 'siteguard' ),
37
  'login_name' => esc_html__( 'Login Name', 'siteguard' ),
38
  'ip_address' => esc_html__( 'IP Address', 'siteguard' ),
 
39
  );
40
  return $columns;
41
  }
@@ -46,6 +85,7 @@ class SiteGuard_LoginHistory_Table extends WP_List_Table {
46
  'operation' => array( 'operation', false ), //true means it's already sorted
47
  'login_name' => array( 'login_name', false ),
48
  'ip_address' => array( 'ip_address', false ),
 
49
  );
50
  return $sortable_columns;
51
  }
@@ -64,8 +104,10 @@ class SiteGuard_LoginHistory_Table extends WP_List_Table {
64
  }
65
 
66
  function usort_reorder( $a, $b ) {
67
- $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'id'; //If no sort, default to id
68
- $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'desc'; //If no order, default to desc
 
 
69
  if ( 'id' == $orderby ) {
70
  $result = ( $a > $b ? 1 : ( $a < $b ? -1 : 0 ) );
71
  } else {
@@ -73,9 +115,131 @@ class SiteGuard_LoginHistory_Table extends WP_List_Table {
73
  }
74
  return ( 'asc' == $order ) ? $result : -$result; //Send final sort direction to usort
75
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  function prepare_items( ) {
78
- global $login_history;
79
 
80
  $per_page = 10;
81
 
@@ -87,11 +251,14 @@ class SiteGuard_LoginHistory_Table extends WP_List_Table {
87
 
88
  $this->process_bulk_action( );
89
 
90
- $data = $login_history->get_history( );
91
 
92
  $total_items = count( $data );
93
  $current_page = $this->get_pagenum( );
94
 
 
 
 
95
  if ( $total_items > 0 ) {
96
  usort( $data, array( $this, 'usort_reorder' ) );
97
  $data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
@@ -106,4 +273,3 @@ class SiteGuard_LoginHistory_Table extends WP_List_Table {
106
  ) );
107
  }
108
  }
109
- ?>
4
  }
5
 
6
  class SiteGuard_LoginHistory_Table extends WP_List_Table {
7
+ protected $filter_operation;
8
+ protected $filter_type;
9
+ protected $filter_login_name;
10
+ protected $filter_ip_address;
11
+ protected $filter_login_name_not;
12
+ protected $filter_ip_address_not;
13
 
14
  function __construct( ) {
15
  global $status, $page;
20
  'plural' => 'events', //plural name of the listed records
21
  'ajax' => false, //does this table support ajax?
22
  ) );
23
+ $referer = wp_get_referer( );
24
+ if ( false === strpos( $referer, 'siteguard_login_history' ) ) {
25
+ unset( $_COOKIE['siteguard_log_filter_operation'] );
26
+ unset( $_COOKIE['siteguard_log_filter_type'] );
27
+ unset( $_COOKIE['siteguard_log_filter_login_name'] );
28
+ unset( $_COOKIE['siteguard_log_filter_ip_address'] );
29
+ unset( $_COOKIE['siteguard_log_filter_login_name_not'] );
30
+ unset( $_COOKIE['siteguard_log_filter_ip_address_not'] );
31
+ }
32
+ if ( isset( $_POST['filter_reset'] ) ) {
33
+ $this->filter_operation = SITEGUARD_LOGIN_NOSELECT;
34
+ $this->filter_type = SITEGUARD_LOGIN_TYPE_NOSELECT;
35
+ $this->filter_login_name = '';
36
+ $this->filter_ip_address = '';
37
+ $this->filter_login_name_not = false;
38
+ $this->filter_ip_address_not = false;
39
+ } else {
40
+ $this->filter_operation = $this->get_filter_operation( );
41
+ $this->filter_type = $this->get_filter_type( );
42
+ $this->filter_login_name = $this->get_filter_login_name( );
43
+ $this->filter_ip_address = $this->get_filter_ip_address( );
44
+ $this->filter_login_name_not = $this->get_filter_login_name_not( );
45
+ $this->filter_ip_address_not = $this->get_filter_ip_address_not( );
46
+ }
47
+ if ( '' === $this->filter_login_name ) {
48
+ $this->filter_login_name_not = false;
49
+ }
50
+ if ( '' === $this->filter_ip_address ) {
51
+ $this->filter_ip_address_not = false;
52
+ }
53
  }
54
 
55
  function column_default( $item, $column_name ) {
56
  switch ( $column_name ) {
57
  case 'operation':
58
  return SiteGuard_LoginHistory::convert_operation( $item[ $column_name ] );
59
+ case 'type':
60
+ return SiteGuard_LoginHistory::convert_type( $item[ $column_name ] );
61
  case 'time':
62
  case 'login_name':
63
  case 'ip_address':
69
 
70
  function get_columns( ) {
71
  $columns = array(
72
+ #'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
73
  'time' => esc_html__( 'Date Time', 'siteguard' ),
74
  'operation' => esc_html__( 'Operation', 'siteguard' ),
75
  'login_name' => esc_html__( 'Login Name', 'siteguard' ),
76
  'ip_address' => esc_html__( 'IP Address', 'siteguard' ),
77
+ 'type' => esc_html__( 'Type', 'siteguard' ),
78
  );
79
  return $columns;
80
  }
85
  'operation' => array( 'operation', false ), //true means it's already sorted
86
  'login_name' => array( 'login_name', false ),
87
  'ip_address' => array( 'ip_address', false ),
88
+ 'type' => array( 'type', false ),
89
  );
90
  return $sortable_columns;
91
  }
104
  }
105
 
106
  function usort_reorder( $a, $b ) {
107
+ $orderby_values = array( 'id', 'operation', 'time', 'login_name', 'ip_address', 'type' );
108
+ $order_values = array( 'asc', 'desc' );
109
+ $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? ( in_array( $_REQUEST['orderby'], $orderby_values ) ? $_REQUEST['orderby'] : 'id' ) : 'id'; //If no sort, default to id
110
+ $order = ( ! empty( $_REQUEST['order'] ) ) ? ( in_array( $_REQUEST['order'], $order_values ) ? $_REQUEST['order'] : 'desc' ) : 'desc'; //If no order, default to desc
111
  if ( 'id' == $orderby ) {
112
  $result = ( $a > $b ? 1 : ( $a < $b ? -1 : 0 ) );
113
  } else {
115
  }
116
  return ( 'asc' == $order ) ? $result : -$result; //Send final sort direction to usort
117
  }
118
+ function get_filter_param_normal( $name, $default ) {
119
+ $result = $default;
120
+ if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
121
+ if ( isset( $_POST[ $name ] ) ) {
122
+ $result = $_POST[ $name ];
123
+ }
124
+ } else {
125
+ $cookie_name = 'siteguard_log_' . $name;
126
+ if ( isset( $_COOKIE[ $cookie_name ] ) ) {
127
+ $result = $_COOKIE[ $cookie_name ];
128
+ }
129
+ }
130
+ return $result;
131
+ }
132
+ function get_filter_param_checkbox( $name, $default ) {
133
+ $result = $default;
134
+ if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
135
+ if ( isset( $_POST['filter_action'] ) ) {
136
+ if ( isset( $_POST[ $name ] ) ) {
137
+ $result = true;
138
+ } else {
139
+ $result = false;
140
+ }
141
+ }
142
+ } else {
143
+ $cookie_name = 'siteguard_log_' . $name;
144
+ if ( isset( $_COOKIE[ $cookie_name ] ) ) {
145
+ $result = true;
146
+ } else {
147
+ $result = false;
148
+ }
149
+ }
150
+ return $result;
151
+ }
152
+ function get_filter_operation( ) {
153
+ global $siteguard_login_history;
154
+ $result = $this->get_filter_param_normal( 'filter_operation', SITEGUARD_LOGIN_NOSELECT );
155
+ if ( ! $siteguard_login_history->check_operation( $result ) ) {
156
+ $result = SITEGUARD_LOGIN_NOSELECT;
157
+ }
158
+ return $result;
159
+ }
160
+ function get_filter_type( ) {
161
+ global $siteguard_login_history;
162
+ $result = $this->get_filter_param_normal( 'filter_type', SITEGUARD_LOGIN_TYPE_NOSELECT );
163
+ if ( ! $siteguard_login_history->check_type( $result ) ) {
164
+ $result = SITEGUARD_LOGIN_TYPE_NOSELECT;
165
+ }
166
+ return $result;
167
+ }
168
+ function get_filter_login_name( ) {
169
+ return $this->get_filter_param_normal( 'filter_login_name', '' );
170
+ }
171
+ function get_filter_ip_address( ) {
172
+ return $this->get_filter_param_normal( 'filter_ip_address', '' );
173
+ }
174
+ function get_filter_login_name_not( ) {
175
+ return $this->get_filter_param_checkbox( 'filter_login_name_not', false );
176
+ }
177
+ function get_filter_ip_address_not( ) {
178
+ return $this->get_filter_param_checkbox( 'filter_ip_address_not', false );
179
+ }
180
+ function operation_dropdown( ) {
181
+ ?>
182
+ <select name="filter_operation" id="filter-by-operation">
183
+ <option <?php selected( $this->filter_operation, SITEGUARD_LOGIN_NOSELECT ); ?> value="<?php echo SITEGUARD_LOGIN_NOSELECT ?>"><?php echo esc_html__( 'All Operations', 'siteguard' ); ?></option>
184
+ <option <?php selected( $this->filter_operation, SITEGUARD_LOGIN_SUCCESS ); ?> value="<?php echo SITEGUARD_LOGIN_SUCCESS ?>"><?php echo esc_html__( 'Success', 'siteguard' ); ?></option>
185
+ <option <?php selected( $this->filter_operation, SITEGUARD_LOGIN_FAILED ); ?> value="<?php echo SITEGUARD_LOGIN_FAILED ?>"><?php echo esc_html__( 'Failed', 'siteguard' ); ?></option>
186
+ <option <?php selected( $this->filter_operation, SITEGUARD_LOGIN_FAIL_ONCE ); ?> value="<?php echo SITEGUARD_LOGIN_FAIL_ONCE ?>"><?php echo esc_html__( 'Fail once', 'siteguard' ); ?></option>
187
+ <option <?php selected( $this->filter_operation, SITEGUARD_LOGIN_LOCKED ); ?> value="<?php echo SITEGUARD_LOGIN_LOCKED ?>"><?php echo esc_html__( 'Locked', 'siteguard' ); ?></option>
188
+ </select>
189
+ <?php
190
+ }
191
+ function login_name_input( ) {
192
+ ?>
193
+ <input type="text" name="filter_login_name" id="filter-login-name" size="15" value="<?php echo esc_attr( $this->filter_login_name ); ?>">
194
+ <input type="checkbox" name="filter_login_name_not" id="filter-login-name-not" <?php checked( $this->filter_login_name_not, true ); ?> >
195
+ <label for="filter-login-name-not" ><?php echo esc_html__( 'Other', 'siteguard'); ?></label>
196
+ <?php
197
+ }
198
+ function ip_address_input( ) {
199
+ ?>
200
+ <input type="text" name="filter_ip_address" id="filter-ip-address" size="15" value="<?php echo esc_attr( $this->filter_ip_address ); ?>">
201
+ <input type="checkbox" name="filter_ip_address_not" id="filter-ip-address-not" <?php checked( $this->filter_ip_address_not, true ); ?> >
202
+ <label for="filter-ip-address-not" ><?php echo esc_html__( 'Other', 'siteguard'); ?></label>
203
+ <?php
204
+ }
205
+ function type_dropdown( ) {
206
+ ?>
207
+ <select name="filter_type" id="filter-type">
208
+ <option <?php selected( $this->filter_type, SITEGUARD_LOGIN_TYPE_NOSELECT ); ?> value="<?php echo SITEGUARD_LOGIN_TYPE_NOSELECT ?>"><?php echo esc_html__( 'All Types', 'siteguard' ); ?></option>
209
+ <option <?php selected( $this->filter_type, SITEGUARD_LOGIN_TYPE_NORMAL ); ?> value="<?php echo SITEGUARD_LOGIN_TYPE_NORMAL ?>"><?php echo esc_html__( 'Login Page', 'siteguard' ); ?></option>
210
+ <option <?php selected( $this->filter_type, SITEGUARD_LOGIN_TYPE_XMLRPC ); ?> value="<?php echo SITEGUARD_LOGIN_TYPE_XMLRPC ?>"><?php echo esc_html__( 'XMLRPC', 'siteguard' ); ?></option>
211
+ </select>
212
+ <?php
213
+ }
214
+ function extra_tablenav( $witch ) {
215
+ if ( 'bottom' == $witch ) {
216
+ return;
217
+ }
218
+ ?>
219
+ <div class="alignleft actions bulkactions">
220
+ <table>
221
+ <tr>
222
+ <td><label for="filter-operation"><?php echo esc_html__( 'Operation', 'siteguard') . ':'; ?></label></td>
223
+ <td><?php $this->operation_dropdown( ); ?></td>
224
+ <td width="30px"></td>
225
+ <td><label for="filter-login-name" ><?php echo esc_html__( 'Login Name', 'siteguard' ) . ':'; ?></label></td>
226
+ <td><?php $this->login_name_input( ); ?></td>
227
+ </tr><tr>
228
+ <td><label for="filter-type" ><?php echo esc_html__( 'Type', 'siteguard') . ':'; ?></label></td>
229
+ <td><?php $this->type_dropdown( ); ?></td>
230
+ <td></td>
231
+ <td><label for="filter-ip-address" ><?php echo esc_html__( 'IP Address', 'siteguard' ) . ':'; ?></label></td>
232
+ <td><?php $this->ip_address_input( ); ?></td>
233
+ </tr>
234
+ </table>
235
+ <input type="submit" name="filter_action" id="post-query-submit" class="button" value="<?php echo esc_attr__( 'Filter' ); ?>">
236
+ <input type="submit" name="filter_reset" id="post-query-reset" class="button" value="<?php echo esc_attr__( 'All' ); ?>">
237
+ </div>
238
+ <?php
239
+ }
240
 
241
  function prepare_items( ) {
242
+ global $siteguard_login_history;
243
 
244
  $per_page = 10;
245
 
251
 
252
  $this->process_bulk_action( );
253
 
254
+ $data = $siteguard_login_history->get_history( $this->filter_operation, $this->filter_login_name, $this->filter_ip_address, $this->filter_type, $this->filter_login_name_not, $this->filter_ip_address_not );
255
 
256
  $total_items = count( $data );
257
  $current_page = $this->get_pagenum( );
258
 
259
+ if ( $total_items <= ( ( $current_page - 1 ) * $per_page ) ) {
260
+ $current_page = 1;
261
+ }
262
  if ( $total_items > 0 ) {
263
  usort( $data, array( $this, 'usort_reorder' ) );
264
  $data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
273
  ) );
274
  }
275
  }
 
admin/siteguard-menu-admin-filter.php CHANGED
@@ -1,6 +1,9 @@
1
  <?php
2
 
3
  class SiteGuard_Menu_Admin_Filter extends SiteGuard_Base {
 
 
 
4
  function __construct( ) {
5
  $this->render_page( );
6
  }
@@ -18,54 +21,70 @@ class SiteGuard_Menu_Admin_Filter extends SiteGuard_Base {
18
  return str_replace( "\n", ',', $result );
19
  }
20
  function render_page( ) {
21
- global $admin_filter, $config;
22
-
23
- $opt_name_feature = 'admin_filter_enable';
24
- $opt_name_exclude = 'admin_filter_exclude_path';
25
 
26
- $opt_val_feature = $config->get( $opt_name_feature );
27
- $opt_val_exclude = $this->cvt_camma2ret( $config->get( $opt_name_exclude ) );
28
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-admin-filter-submit' ) ) {
29
  $error = false;
30
- $errors = check_multisite( );
31
  if ( is_wp_error( $errors ) ) {
32
  echo '<div class="error settings-error"><p><strong>';
33
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
34
  echo '</strong></p></div>';
35
  $error = true;
36
  }
37
- if ( false == $error && '1' == $_POST[ $opt_name_feature ] && false == $this->check_module( 'rewrite' ) ) {
38
  echo '<div class="error settings-error"><p><strong>';
39
  esc_html_e( 'To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard' );
40
  echo '</strong></p></div>';
41
  $error = true;
42
- $config->set( $opt_name_feature, '0' );
43
- $config->update( );
44
- $admin_filter->feature_off( );
45
  $opt_val_feature = '0';
46
  }
47
- if ( false == $error && false == $this->is_switch_value( $_POST[ $opt_name_feature ] ) ) {
48
  echo '<div class="error settings-error"><p><strong>';
49
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
50
  echo '</strong></p></div>';
51
  $error = true;
52
  }
53
- if ( false == $error ) {
54
- $opt_val_feature = $_POST[ $opt_name_feature ];
55
- $opt_val_exclude = $this->cvt_ret2camma( stripslashes( $_POST[ $opt_name_exclude ] ) );
56
- $config->set( $opt_name_feature, $opt_val_feature );
57
- $config->set( $opt_name_exclude, $opt_val_exclude );
58
- $config->update( );
59
- $opt_val_exclude = $this->cvt_camma2ret( $opt_val_exclude );
60
- $mark = $admin_filter->get_mark( );
61
- if ( '0' == $opt_val_feature ) {
62
- $admin_filter->feature_off( );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  } else {
64
- $admin_filter->feature_on( $_SERVER['REMOTE_ADDR'] );
 
 
 
 
 
 
 
65
  }
66
- ?>
67
- <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
68
- <?php
69
  }
70
  }
71
 
@@ -74,11 +93,11 @@ class SiteGuard_Menu_Admin_Filter extends SiteGuard_Base {
74
  echo '<h2>' . esc_html__( 'Admin Page IP Filter', 'siteguard' ) . '</h2>';
75
  echo '<div class="siteguard-description">'
76
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
77
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/admin_filter_en.html', 'siteguard' )
78
- . '" target="_blank">'
79
- . esc_html__( 'here', 'siteguard' )
80
- . '</a>'
81
- . esc_html__( '.', 'siteguard' )
82
  . '</div>';
83
  ?>
84
  <form name="form1" method="post" action="">
@@ -87,16 +106,16 @@ class SiteGuard_Menu_Admin_Filter extends SiteGuard_Base {
87
  <th scope="row" colspan="2">
88
  <ul class="siteguard-radios">
89
  <li>
90
- <input type="radio" name="<?php echo $opt_name_feature ?>" id="<?php echo $opt_name_feature.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_feature ? 'checked' : '' ) ?> >
91
- <label for="<?php echo $opt_name_feature.'_on' ?>" ><?php echo esc_html_e( 'ON', 'siteguard' ) ?></label>
92
  </li>
93
  <li>
94
- <input type="radio" name="<?php echo $opt_name_feature ?>" id="<?php echo $opt_name_feature.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_feature ? 'checked' : '') ?> >
95
- <label for="<?php echo $opt_name_feature.'_off' ?>" ><?php echo esc_html_e( 'OFF', 'siteguard' ) ?></label>
96
  </li>
97
  </ul>
98
  <?php
99
- $error = check_multisite( );
100
  if ( is_wp_error( $error ) ) {
101
  echo '<p class="description">';
102
  echo $error->get_error_message( );
@@ -108,14 +127,14 @@ class SiteGuard_Menu_Admin_Filter extends SiteGuard_Base {
108
  ?>
109
  </th>
110
  </tr><tr>
111
- <th scope="row"><label for="<?php echo $opt_name_exclude ?>"><?php echo esc_html_e( 'Exclude Path', 'siteguard' ) ?></label></th>
112
- <td><textarea name="<?php echo $opt_name_exclude ?>" id="<?php echo $opt_name_exclude ?>" col=40 rows=5 ><?php echo esc_textarea( $opt_val_exclude ) ?></textarea>
113
  <p class="description"><?php esc_html_e( 'The path of /wp-admin/ henceforth is specified. To specify more than one, separate them with new line. ', 'siteguard' ) ?></p></td>
114
  </tr>
115
  </table>
116
  <input type="hidden" name="update" value="Y">
117
  <div class="siteguard-description">
118
- <?php esc_html_e( 'It is the function for the protection against the attack to the management page (under /wp-admin/.) To the access from the connection source IP address which does not login to the management page, 404 (Not Found) is returned. At the login, the connection source IP address is recorded and the access to that page is allowed. The connection source IP address which does not login for more than 24 hours is sequentially deleted. The URL (under /wp-admin/) where this function is excluded can be specified.', 'siteguard' ); ?>
119
  </div>
120
  <hr />
121
  <?php
@@ -128,4 +147,3 @@ class SiteGuard_Menu_Admin_Filter extends SiteGuard_Base {
128
  <?php
129
  }
130
  }
131
- ?>
1
  <?php
2
 
3
  class SiteGuard_Menu_Admin_Filter extends SiteGuard_Base {
4
+ const OPT_NAME_FEATURE = 'admin_filter_enable';
5
+ const OPT_NAME_EXCLUDE = 'admin_filter_exclude_path';
6
+
7
  function __construct( ) {
8
  $this->render_page( );
9
  }
21
  return str_replace( "\n", ',', $result );
22
  }
23
  function render_page( ) {
24
+ global $siteguard_admin_filter, $siteguard_config;
 
 
 
25
 
26
+ $opt_val_feature = $siteguard_config->get( self::OPT_NAME_FEATURE );
27
+ $opt_val_exclude = $this->cvt_camma2ret( $siteguard_config->get( self::OPT_NAME_EXCLUDE ) );
28
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-admin-filter-submit' ) ) {
29
  $error = false;
30
+ $errors = siteguard_check_multisite( );
31
  if ( is_wp_error( $errors ) ) {
32
  echo '<div class="error settings-error"><p><strong>';
33
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
34
  echo '</strong></p></div>';
35
  $error = true;
36
  }
37
+ if ( false === $error && '1' === $_POST[ self::OPT_NAME_FEATURE ] && false === $this->check_module( 'rewrite' ) ) {
38
  echo '<div class="error settings-error"><p><strong>';
39
  esc_html_e( 'To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard' );
40
  echo '</strong></p></div>';
41
  $error = true;
42
+ $siteguard_config->set( self::OPT_NAME_FEATURE, '0' );
43
+ $siteguard_config->update( );
44
+ $siteguard_admin_filter->feature_off( );
45
  $opt_val_feature = '0';
46
  }
47
+ if ( false === $error && false === $this->is_switch_value( $_POST[ self::OPT_NAME_FEATURE ] ) ) {
48
  echo '<div class="error settings-error"><p><strong>';
49
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
50
  echo '</strong></p></div>';
51
  $error = true;
52
  }
53
+ if ( false === $error && '1' === $_POST[ self::OPT_NAME_FEATURE ] && false === SiteGuard_Htaccess::test_htaccess( ) ) {
54
+ echo '<div class="error settings-error"><p><strong>';
55
+ esc_html_e( 'mod_rewrite of .htaccess can not be used', 'siteguard' );
56
+ echo '</strong></p></div>';
57
+ $error = true;
58
+ }
59
+ if ( false === $error ) {
60
+ $old_opt_val_feature = $opt_val_feature;
61
+ $old_opt_val_exclude = $opt_val_exclude;
62
+ $opt_val_feature = $_POST[ self::OPT_NAME_FEATURE ];
63
+ $opt_val_exclude = stripslashes( $_POST[ self::OPT_NAME_EXCLUDE ] );
64
+ $siteguard_config->set( self::OPT_NAME_FEATURE, $opt_val_feature );
65
+ $siteguard_config->set( self::OPT_NAME_EXCLUDE, $this->cvt_ret2camma( $opt_val_exclude ) );
66
+ $siteguard_config->update( );
67
+ $result = true;
68
+ if ( '0' === $opt_val_feature ) {
69
+ $result = $siteguard_admin_filter->feature_off( );
70
+ } else {
71
+ $result = $siteguard_admin_filter->feature_on( $this->get_ip( ) );
72
+ }
73
+ if ( true === $result ) {
74
+ $opt_val_exclude = $this->cvt_camma2ret( $opt_val_exclude );
75
+ ?>
76
+ <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
77
+ <?php
78
  } else {
79
+ $opt_val_feature = $old_opt_val_feature;
80
+ $opt_val_exclude = $old_opt_val_exclude;
81
+ $siteguard_config->set( self::OPT_NAME_FEATURE, $opt_val_feature );
82
+ $siteguard_config->set( self::OPT_NAME_EXCLUDE, $this->cvt_ret2camma( $opt_val_exclude ) );
83
+ $siteguard_config->update( );
84
+ echo '<div class="error settings-error"><p><strong>';
85
+ esc_html_e( 'ERROR: Failed to .htaccess update.', 'siteguard' );
86
+ echo '</strong></p></div>';
87
  }
 
 
 
88
  }
89
  }
90
 
93
  echo '<h2>' . esc_html__( 'Admin Page IP Filter', 'siteguard' ) . '</h2>';
94
  echo '<div class="siteguard-description">'
95
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
96
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/admin_filter/', 'siteguard' ) )
97
+ . '" target="_blank">'
98
+ . esc_html__( 'here', 'siteguard' )
99
+ . '</a>'
100
+ . esc_html__( '.', 'siteguard' )
101
  . '</div>';
102
  ?>
103
  <form name="form1" method="post" action="">
106
  <th scope="row" colspan="2">
107
  <ul class="siteguard-radios">
108
  <li>
109
+ <input type="radio" name="<?php echo self::OPT_NAME_FEATURE ?>" id="<?php echo self::OPT_NAME_FEATURE . '_on' ?>" value="1" <?php checked( $opt_val_feature, '1' ) ?> >
110
+ <label for="<?php echo self::OPT_NAME_FEATURE.'_on' ?>" ><?php echo esc_html_e( 'ON', 'siteguard' ) ?></label>
111
  </li>
112
  <li>
113
+ <input type="radio" name="<?php echo self::OPT_NAME_FEATURE ?>" id="<?php echo self::OPT_NAME_FEATURE . '_off' ?>" value="0" <?php checked( $opt_val_feature, '0' ) ?> >
114
+ <label for="<?php echo self::OPT_NAME_FEATURE.'_off' ?>" ><?php echo esc_html_e( 'OFF', 'siteguard' ) ?></label>
115
  </li>
116
  </ul>
117
  <?php
118
+ $error = siteguard_check_multisite( );
119
  if ( is_wp_error( $error ) ) {
120
  echo '<p class="description">';
121
  echo $error->get_error_message( );
127
  ?>
128
  </th>
129
  </tr><tr>
130
+ <th scope="row"><label for="<?php echo self::OPT_NAME_EXCLUDE ?>"><?php echo esc_html_e( 'Exclude Path', 'siteguard' ) ?></label></th>
131
+ <td><textarea name="<?php echo self::OPT_NAME_EXCLUDE ?>" id="<?php echo self::OPT_NAME_EXCLUDE ?>" cols=40 rows=5 ><?php echo esc_textarea( $opt_val_exclude ) ?></textarea>
132
  <p class="description"><?php esc_html_e( 'The path of /wp-admin/ henceforth is specified. To specify more than one, separate them with new line. ', 'siteguard' ) ?></p></td>
133
  </tr>
134
  </table>
135
  <input type="hidden" name="update" value="Y">
136
  <div class="siteguard-description">
137
+ <?php esc_html_e( 'It is the function for the protection against the attack to the management page (under /wp-admin/.) To the access from the connection source IP address which does not login to the management page, 404 (Not Found) is returned. At the login, the connection source IP address is recorded and the access to that page is allowed. The connection source IP address which does not login for more than 24 hours is sequentially deleted. The URL (under /wp-admin/) where this function is excluded can be specified.', 'siteguard' ); ?>
138
  </div>
139
  <hr />
140
  <?php
147
  <?php
148
  }
149
  }
 
admin/siteguard-menu-advanced-setting.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SiteGuard_Menu_Advanced_Setting extends SiteGuard_Base {
4
+ function __construct( ) {
5
+ $this->render_page( );
6
+ }
7
+ function is_ip_mode_value( $value ) {
8
+ $items = array( '0', '1', '2', '3' );
9
+ if ( in_array( $value, $items ) ) {
10
+ return true;
11
+ }
12
+ return false;
13
+ }
14
+ function render_page( ) {
15
+ global $siteguard_config, $siteguard_admin_filter;
16
+
17
+ $ip_mode = $siteguard_config->get( 'ip_mode' );
18
+ if ( empty( $ip_mode ) ) {
19
+ $ip_mode = '0';
20
+ $siteguard_config->set( 'ip_mode', $ip_mode );
21
+ $siteguard_config->update( );
22
+ }
23
+ if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-advanced-setting-submit' ) ) {
24
+ $error = false;
25
+ $errors = siteguard_check_multisite( );
26
+ if ( is_wp_error( $errors ) ) {
27
+ echo '<div class="error settings-error"><p><strong>';
28
+ esc_html_e( $errors->get_error_message( ), 'siteguard' );
29
+ echo '</strong></p></div>';
30
+ $error = true;
31
+ }
32
+ if ( ( false === $error ) && ( false === $this->is_ip_mode_value( $_POST[ 'ip_mode' ] ) ) ) {
33
+ echo '<div class="error settings-error"><p><strong>';
34
+ esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
35
+ echo '</strong></p></div>';
36
+ $error = true;
37
+ }
38
+ if ( false === $error ) {
39
+ $ip_mode = $_POST[ 'ip_mode' ];
40
+ $siteguard_config->set( 'ip_mode', $ip_mode );
41
+ $siteguard_config->update( );
42
+ if ( 1 == $siteguard_config->get( 'admin_filter_enable' ) ) {
43
+ $siteguard_admin_filter->feature_on( $this->get_ip( ) );
44
+ }
45
+ ?>
46
+ <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
47
+ <?php
48
+ }
49
+ }
50
+
51
+ echo '<div class="wrap">';
52
+ echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
53
+ echo '<h2>' . esc_html__( 'Advanced Setting', 'siteguard' ) . '</h2>';
54
+ echo '<div class="siteguard-description">'
55
+ . esc_html__( 'You can find docs about this function on ', 'siteguard' )
56
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/advanced_setting/', 'siteguard' ) )
57
+ . '" target="_blank">'
58
+ . esc_html__( 'here', 'siteguard' )
59
+ . '</a>'
60
+ . esc_html__( '.', 'siteguard' )
61
+ . '</div>';
62
+ ?>
63
+ <form name="form1" method="post" action="">
64
+ <table class="form-table">
65
+ <tr>
66
+ <th scope="row"><?php esc_html_e( 'IP Address Mode', 'siteguard' ); ?></th>
67
+ <td>
68
+ <input type="radio" name="ip_mode" id="ip_mode_ra" value="0" <?php checked( $ip_mode, '0' ) ?> >
69
+ <label for="ip_mode_ra"><?php esc_html_e( 'REMOTE_ADDR', 'siteguard' ) ?></label>
70
+ <br />
71
+ <input type="radio" name="ip_mode" id="ip_mode_xff1" value="1" <?php checked( $ip_mode, '1' ) ?> >
72
+ <label for="ip_mode_xff1"><?php esc_html_e( 'X-Forwarded-For Level:1', 'siteguard' ) ?></label>
73
+ <br />
74
+ <input type="radio" name="ip_mode" id="ip_mode_xff2" value="2" <?php checked( $ip_mode, '2' ) ?> >
75
+ <label for="ip_mode_xff2"><?php esc_html_e( 'X-Forwarded-For Level:2', 'siteguard' ) ?></label>
76
+ <br />
77
+ <input type="radio" name="ip_mode" id="ip_mode_xff3" value="3" <?php checked( $ip_mode, '3' ) ?> >
78
+ <label for="ip_mode_xff3"><?php esc_html_e( 'X-Forwarded-For Level:3', 'siteguard' ) ?></label>
79
+ </td>
80
+ </tr>
81
+ </table>
82
+ <div class="siteguard-description">
83
+ <?php esc_html_e( "Set the method for acquiring the IP address. Normally you should select a remote address. If there is a proxy or load balancer in front of the web server and you can not obtain the client's IP address with remote address, you can obtain the IP address from X-Forwarded-For. Level represents the number from the right end of the value of X-Forwarded-For.", 'siteguard' ) ?>
84
+ </div>
85
+ <input type="hidden" name="update" value="Y">
86
+ <hr />
87
+
88
+ <?php
89
+ wp_nonce_field( 'siteguard-menu-advanced-setting-submit' );
90
+ submit_button();
91
+ ?>
92
+ </form>
93
+ </div>
94
+ <?php
95
+ }
96
+ }
admin/siteguard-menu-captcha.php CHANGED
@@ -1,70 +1,71 @@
1
  <?php
2
 
3
  class SiteGuard_Menu_CAPTCHA extends SiteGuard_Base {
 
 
 
 
 
 
4
  function __construct( ) {
5
  $this->render_page( );
6
  }
7
  function is_captcha_switch_value( $value ) {
8
- if ( '0' == $value || '1' == $value || '2' == $value ) {
 
9
  return true;
10
  }
11
  return false;
12
  }
13
  function render_page( ) {
14
- global $config, $captcha;
15
-
16
- $opt_name_enable = 'captcha_enable';
17
- $opt_name_login = 'captcha_login';
18
- $opt_name_comment = 'captcha_comment';
19
- $opt_name_lostpassword = 'captcha_lostpasswd';
20
- $opt_name_registuser = 'captcha_registuser';
21
 
22
- $opt_val_enable = $config->get( $opt_name_enable );
23
- $opt_val_login = $config->get( $opt_name_login );
24
- $opt_val_comment = $config->get( $opt_name_comment );
25
- $opt_val_lostpassword = $config->get( $opt_name_lostpassword );
26
- $opt_val_registuser = $config->get( $opt_name_registuser );
27
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-captcha-submit' ) ) {
28
  $error = false;
29
- $errors = check_multisite( );
30
  if ( is_wp_error( $errors ) ) {
31
  echo '<div class="error settings-error"><p><strong>';
32
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
33
  echo '</strong></p></div>';
34
  $error = true;
35
  }
36
- if ( false == $error && '1' == $_POST[ $opt_name_enable ] ) {
37
- $ret = $captcha->check_requirements( );
38
  if ( is_wp_error( $ret ) ) {
39
  echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message( ) . '</strong></p></div>';
40
  $error = true;
41
- $config->set( $opt_name_enable, '0' );
42
- $config->update( );
43
  }
44
  }
45
- if ( ( false == $error )
46
- && ( ( false == $this->is_switch_value( $_POST[ $opt_name_enable ] ) )
47
- || ( false == $this->is_captcha_switch_value( $_POST[ $opt_name_login ] ) )
48
- || ( false == $this->is_captcha_switch_value( $_POST[ $opt_name_comment ] ) )
49
- || ( false == $this->is_captcha_switch_value( $_POST[ $opt_name_lostpassword ] ) )
50
- || ( false == $this->is_captcha_switch_value( $_POST[ $opt_name_registuser ] ) ) ) ) {
51
  echo '<div class="error settings-error"><p><strong>';
52
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
53
  echo '</strong></p></div>';
54
  $error = true;
55
  }
56
- if ( false == $error ) {
57
- $opt_val_enable = $_POST[ $opt_name_enable ];
58
- $opt_val_login = $_POST[ $opt_name_login ];
59
- $opt_val_comment = $_POST[ $opt_name_comment ];
60
- $opt_val_lostpassword = $_POST[ $opt_name_lostpassword ];
61
- $opt_val_registuser = $_POST[ $opt_name_registuser ];
62
- $config->set( $opt_name_enable, $opt_val_enable );
63
- $config->set( $opt_name_login, $opt_val_login );
64
- $config->set( $opt_name_comment, $opt_val_comment );
65
- $config->set( $opt_name_lostpassword, $opt_val_lostpassword );
66
- $config->set( $opt_name_registuser, $opt_val_registuser );
67
- $config->update( );
68
  ?>
69
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
70
  <?php
@@ -76,11 +77,11 @@ class SiteGuard_Menu_CAPTCHA extends SiteGuard_Base {
76
  echo '<h2>' . esc_html__( 'CAPTCHA', 'siteguard' ) . '</h2>';
77
  echo '<div class="siteguard-description">'
78
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
79
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/captcha_en.html', 'siteguard' )
80
- . '" target="_blank">'
81
- . esc_html__( 'here', 'siteguard' )
82
- . '</a>'
83
- . esc_html__( '.', 'siteguard' )
84
  . '</div>';
85
  ?>
86
  <form name="form1" method="post" action="">
@@ -89,15 +90,15 @@ class SiteGuard_Menu_CAPTCHA extends SiteGuard_Base {
89
  <th scope="row" colspan="2">
90
  <ul class="siteguard-radios">
91
  <li>
92
- <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_enable ? 'checked' : '') ?> >
93
- <label for="<?php echo $opt_name_enable.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
94
  </li><li>
95
- <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_enable ? 'checked' : '') ?> >
96
- <label for="<?php echo $opt_name_enable.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
97
  </li>
98
  </ul>
99
  <?php
100
- $error = $captcha->check_requirements( );
101
  if ( is_wp_error( $error ) ) {
102
  echo '<p class="description">';
103
  echo $error->get_error_message( );
@@ -108,50 +109,50 @@ class SiteGuard_Menu_CAPTCHA extends SiteGuard_Base {
108
  </tr><tr>
109
  <th scope="row"><?php esc_html_e( 'Login page', 'siteguard' ); ?></th>
110
  <td>
111
- <input type="radio" name="<?php echo $opt_name_login ?>" id="<?php echo $opt_name_login.'_jp' ?>" value="1" <?php echo ( '1' == $opt_val_login ? 'checked' : '') ?> >
112
- <label for="<?php echo $opt_name_login.'_jp' ?>"><?php esc_html_e( 'Hiragana (Japanese)', 'siteguard' ) ?></label>
113
  <br />
114
- <input type="radio" name="<?php echo $opt_name_login ?>" id="<?php echo $opt_name_login.'_en' ?>" value="2" <?php echo ( '2' == $opt_val_login ? 'checked' : '') ?> >
115
- <label for="<?php echo $opt_name_login.'_en' ?>"><?php esc_html_e( 'Alphanumeric', 'siteguard' ) ?></label>
116
  <br />
117
- <input type="radio" name="<?php echo $opt_name_login ?>" id="<?php echo $opt_name_login.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_login ? 'checked' : '') ?> >
118
- <label for="<?php echo $opt_name_login.'_off' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
119
  </td>
120
  </tr><tr>
121
  <th scope="row"><?php esc_html_e( 'Comment page', 'siteguard' ); ?></th>
122
  <td>
123
- <input type="radio" name="<?php echo $opt_name_comment ?>" id="<?php echo $opt_name_comment.'_jp' ?>" value="1" <?php echo ( '1' == $opt_val_comment ? 'checked' : '') ?> >
124
- <label for="<?php echo $opt_name_comment.'_jp' ?>"><?php esc_html_e( 'Hiragana (Japanese)', 'siteguard' ) ?></label>
125
  <br />
126
- <input type="radio" name="<?php echo $opt_name_comment ?>" id="<?php echo $opt_name_comment.'_en' ?>" value="2" <?php echo ( '2' == $opt_val_comment ? 'checked' : '') ?> >
127
- <label for="<?php echo $opt_name_comment.'_en' ?>"><?php esc_html_e( 'Alphanumeric', 'siteguard' ) ?></label>
128
  <br />
129
- <input type="radio" name="<?php echo $opt_name_comment ?>" id="<?php echo $opt_name_comment.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_comment ? 'checked' : '') ?> >
130
- <label for="<?php echo $opt_name_comment.'_off' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
131
  </td>
132
  </tr><tr>
133
  <th scope="row"><?php esc_html_e( 'Lost password page', 'siteguard' ); ?></th>
134
  <td>
135
- <input type="radio" name="<?php echo $opt_name_lostpassword ?>" id="<?php echo $opt_name_lostpassword.'_jp' ?>" value="1" <?php echo ( '1' == $opt_val_lostpassword ? 'checked' : '') ?> >
136
- <label for="<?php echo $opt_name_lostpassword.'_jp' ?>"><?php esc_html_e( 'Hiragana (Japanese)', 'siteguard' ) ?></label>
137
  <br />
138
- <input type="radio" name="<?php echo $opt_name_lostpassword ?>" id="<?php echo $opt_name_lostpassword.'_en' ?>" value="2" <?php echo ( '2' == $opt_val_lostpassword ? 'checked' : '') ?> >
139
- <label for="<?php echo $opt_name_lostpassword.'_en' ?>"><?php esc_html_e( 'Alphanumeric', 'siteguard' ) ?></label>
140
  <br />
141
- <input type="radio" name="<?php echo $opt_name_lostpassword ?>" id="<?php echo $opt_name_lostpassword.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_lostpassword ? 'checked' : '') ?> >
142
- <label for="<?php echo $opt_name_lostpassword.'_off' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
143
  </td>
144
  </tr><tr>
145
  <th scope="row"><?php esc_html_e( 'Registration user page', 'siteguard' ); ?></th>
146
  <td>
147
- <input type="radio" name="<?php echo $opt_name_registuser ?>" id="<?php echo $opt_name_registuser.'_jp' ?>" value="1" <?php echo ( '1' == $opt_val_registuser ? 'checked' : '') ?> >
148
- <label for="<?php echo $opt_name_registuser.'_jp' ?>"><?php esc_html_e( 'Hiragana (Japanese)', 'siteguard' ) ?></label>
149
  <br />
150
- <input type="radio" name="<?php echo $opt_name_registuser ?>" id="<?php echo $opt_name_registuser.'_en' ?>" value="2" <?php echo ( '2' == $opt_val_registuser ? 'checked' : '') ?> >
151
- <label for="<?php echo $opt_name_registuser.'_en' ?>"><?php esc_html_e( 'Alphanumeric', 'siteguard' ) ?></label>
152
  <br />
153
- <input type="radio" name="<?php echo $opt_name_registuser ?>" id="<?php echo $opt_name_registuser.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_registuser ? 'checked' : '') ?> >
154
- <label for="<?php echo $opt_name_registuser.'_off' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
155
  </td>
156
  </tr>
157
  </table>
@@ -170,4 +171,3 @@ class SiteGuard_Menu_CAPTCHA extends SiteGuard_Base {
170
  <?php
171
  }
172
  }
173
- ?>
1
  <?php
2
 
3
  class SiteGuard_Menu_CAPTCHA extends SiteGuard_Base {
4
+ const OPT_NAME_ENABLE = 'captcha_enable';
5
+ const OPT_NAME_LOGIN = 'captcha_login';
6
+ const OPT_NAME_COMMENT = 'captcha_comment';
7
+ const OPT_NAME_LOSTPASSWORD = 'captcha_lostpasswd';
8
+ const OPT_NAME_REGISTUSER = 'captcha_registuser';
9
+
10
  function __construct( ) {
11
  $this->render_page( );
12
  }
13
  function is_captcha_switch_value( $value ) {
14
+ $items = array( '0', '1', '2' );
15
+ if ( in_array( $value, $items ) ) {
16
  return true;
17
  }
18
  return false;
19
  }
20
  function render_page( ) {
21
+ global $siteguard_config, $siteguard_captcha;
 
 
 
 
 
 
22
 
23
+ $opt_val_enable = $siteguard_config->get( self::OPT_NAME_ENABLE );
24
+ $opt_val_login = $siteguard_config->get( self::OPT_NAME_LOGIN );
25
+ $opt_val_comment = $siteguard_config->get( self::OPT_NAME_COMMENT );
26
+ $opt_val_lostpassword = $siteguard_config->get( self::OPT_NAME_LOSTPASSWORD );
27
+ $opt_val_registuser = $siteguard_config->get( self::OPT_NAME_REGISTUSER );
28
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-captcha-submit' ) ) {
29
  $error = false;
30
+ $errors = siteguard_check_multisite( );
31
  if ( is_wp_error( $errors ) ) {
32
  echo '<div class="error settings-error"><p><strong>';
33
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
34
  echo '</strong></p></div>';
35
  $error = true;
36
  }
37
+ if ( false === $error && '1' == $_POST[ self::OPT_NAME_ENABLE ] ) {
38
+ $ret = $siteguard_captcha->check_requirements( );
39
  if ( is_wp_error( $ret ) ) {
40
  echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message( ) . '</strong></p></div>';
41
  $error = true;
42
+ $siteguard_config->set( self::OPT_NAME_ENABLE, '0' );
43
+ $siteguard_config->update( );
44
  }
45
  }
46
+ if ( ( false === $error )
47
+ && ( ( false === $this->is_switch_value( $_POST[ self::OPT_NAME_ENABLE ] ) )
48
+ || ( false === $this->is_captcha_switch_value( $_POST[ self::OPT_NAME_LOGIN ] ) )
49
+ || ( false === $this->is_captcha_switch_value( $_POST[ self::OPT_NAME_COMMENT ] ) )
50
+ || ( false === $this->is_captcha_switch_value( $_POST[ self::OPT_NAME_LOSTPASSWORD ] ) )
51
+ || ( false === $this->is_captcha_switch_value( $_POST[ self::OPT_NAME_REGISTUSER ] ) ) ) ) {
52
  echo '<div class="error settings-error"><p><strong>';
53
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
54
  echo '</strong></p></div>';
55
  $error = true;
56
  }
57
+ if ( false === $error ) {
58
+ $opt_val_enable = $_POST[ self::OPT_NAME_ENABLE ];
59
+ $opt_val_login = $_POST[ self::OPT_NAME_LOGIN ];
60
+ $opt_val_comment = $_POST[ self::OPT_NAME_COMMENT ];
61
+ $opt_val_lostpassword = $_POST[ self::OPT_NAME_LOSTPASSWORD ];
62
+ $opt_val_registuser = $_POST[ self::OPT_NAME_REGISTUSER ];
63
+ $siteguard_config->set( self::OPT_NAME_ENABLE, $opt_val_enable );
64
+ $siteguard_config->set( self::OPT_NAME_LOGIN, $opt_val_login );
65
+ $siteguard_config->set( self::OPT_NAME_COMMENT, $opt_val_comment );
66
+ $siteguard_config->set( self::OPT_NAME_LOSTPASSWORD, $opt_val_lostpassword );
67
+ $siteguard_config->set( self::OPT_NAME_REGISTUSER, $opt_val_registuser );
68
+ $siteguard_config->update( );
69
  ?>
70
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
71
  <?php
77
  echo '<h2>' . esc_html__( 'CAPTCHA', 'siteguard' ) . '</h2>';
78
  echo '<div class="siteguard-description">'
79
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
80
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/captcha/', 'siteguard' ) )
81
+ . '" target="_blank">'
82
+ . esc_html__( 'here', 'siteguard' )
83
+ . '</a>'
84
+ . esc_html__( '.', 'siteguard' )
85
  . '</div>';
86
  ?>
87
  <form name="form1" method="post" action="">
90
  <th scope="row" colspan="2">
91
  <ul class="siteguard-radios">
92
  <li>
93
+ <input type="radio" name="<?php echo self::OPT_NAME_ENABLE ?>" id="<?php echo self::OPT_NAME_ENABLE.'_on' ?>" value="1" <?php checked( $opt_val_enable, '1' ) ?> >
94
+ <label for="<?php echo self::OPT_NAME_ENABLE.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
95
  </li><li>
96
+ <input type="radio" name="<?php echo self::OPT_NAME_ENABLE ?>" id="<?php echo self::OPT_NAME_ENABLE.'_off' ?>" value="0" <?php checked( $opt_val_enable, '0' ) ?> >
97
+ <label for="<?php echo self::OPT_NAME_ENABLE.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
98
  </li>
99
  </ul>
100
  <?php
101
+ $error = $siteguard_captcha->check_requirements( );
102
  if ( is_wp_error( $error ) ) {
103
  echo '<p class="description">';
104
  echo $error->get_error_message( );
109
  </tr><tr>
110
  <th scope="row"><?php esc_html_e( 'Login page', 'siteguard' ); ?></th>
111
  <td>
112
+ <input type="radio" name="<?php echo self::OPT_NAME_LOGIN ?>" id="<?php echo self::OPT_NAME_LOGIN.'_jp' ?>" value="1" <?php checked( $opt_val_login, '1' ) ?> >
113
+ <label for="<?php echo self::OPT_NAME_LOGIN.'_jp' ?>"><?php esc_html_e( 'Hiragana (Japanese)', 'siteguard' ) ?></label>
114
  <br />
115
+ <input type="radio" name="<?php echo self::OPT_NAME_LOGIN ?>" id="<?php echo self::OPT_NAME_LOGIN.'_en' ?>" value="2" <?php checked( $opt_val_login, '2' ) ?> >
116
+ <label for="<?php echo self::OPT_NAME_LOGIN.'_en' ?>"><?php esc_html_e( 'Alphanumeric', 'siteguard' ) ?></label>
117
  <br />
118
+ <input type="radio" name="<?php echo self::OPT_NAME_LOGIN ?>" id="<?php echo self::OPT_NAME_LOGIN.'_off' ?>" value="0" <?php checked( $opt_val_login, '0' ) ?> >
119
+ <label for="<?php echo self::OPT_NAME_LOGIN.'_off' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
120
  </td>
121
  </tr><tr>
122
  <th scope="row"><?php esc_html_e( 'Comment page', 'siteguard' ); ?></th>
123
  <td>
124
+ <input type="radio" name="<?php echo self::OPT_NAME_COMMENT ?>" id="<?php echo self::OPT_NAME_COMMENT.'_jp' ?>" value="1" <?php checked( $opt_val_comment, '1' ) ?> >
125
+ <label for="<?php echo self::OPT_NAME_COMMENT.'_jp' ?>"><?php esc_html_e( 'Hiragana (Japanese)', 'siteguard' ) ?></label>
126
  <br />
127
+ <input type="radio" name="<?php echo self::OPT_NAME_COMMENT ?>" id="<?php echo self::OPT_NAME_COMMENT.'_en' ?>" value="2" <?php checked( $opt_val_comment, '2' ) ?> >
128
+ <label for="<?php echo self::OPT_NAME_COMMENT.'_en' ?>"><?php esc_html_e( 'Alphanumeric', 'siteguard' ) ?></label>
129
  <br />
130
+ <input type="radio" name="<?php echo self::OPT_NAME_COMMENT ?>" id="<?php echo self::OPT_NAME_COMMENT.'_off' ?>" value="0" <?php checked( $opt_val_comment, '0' ) ?> >
131
+ <label for="<?php echo self::OPT_NAME_COMMENT.'_off' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
132
  </td>
133
  </tr><tr>
134
  <th scope="row"><?php esc_html_e( 'Lost password page', 'siteguard' ); ?></th>
135
  <td>
136
+ <input type="radio" name="<?php echo self::OPT_NAME_LOSTPASSWORD ?>" id="<?php echo self::OPT_NAME_LOSTPASSWORD.'_jp' ?>" value="1" <?php checked( $opt_val_lostpassword, '1' ) ?> >
137
+ <label for="<?php echo self::OPT_NAME_LOSTPASSWORD.'_jp' ?>"><?php esc_html_e( 'Hiragana (Japanese)', 'siteguard' ) ?></label>
138
  <br />
139
+ <input type="radio" name="<?php echo self::OPT_NAME_LOSTPASSWORD ?>" id="<?php echo self::OPT_NAME_LOSTPASSWORD.'_en' ?>" value="2" <?php checked( $opt_val_lostpassword, '2' ) ?> >
140
+ <label for="<?php echo self::OPT_NAME_LOSTPASSWORD.'_en' ?>"><?php esc_html_e( 'Alphanumeric', 'siteguard' ) ?></label>
141
  <br />
142
+ <input type="radio" name="<?php echo self::OPT_NAME_LOSTPASSWORD ?>" id="<?php echo self::OPT_NAME_LOSTPASSWORD.'_off' ?>" value="0" <?php checked( $opt_val_lostpassword, '0' ) ?> >
143
+ <label for="<?php echo self::OPT_NAME_LOSTPASSWORD.'_off' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
144
  </td>
145
  </tr><tr>
146
  <th scope="row"><?php esc_html_e( 'Registration user page', 'siteguard' ); ?></th>
147
  <td>
148
+ <input type="radio" name="<?php echo self::OPT_NAME_REGISTUSER ?>" id="<?php echo self::OPT_NAME_REGISTUSER.'_jp' ?>" value="1" <?php checked( $opt_val_registuser, '1' ) ?> >
149
+ <label for="<?php echo self::OPT_NAME_REGISTUSER.'_jp' ?>"><?php esc_html_e( 'Hiragana (Japanese)', 'siteguard' ) ?></label>
150
  <br />
151
+ <input type="radio" name="<?php echo self::OPT_NAME_REGISTUSER ?>" id="<?php echo self::OPT_NAME_REGISTUSER.'_en' ?>" value="2" <?php checked( $opt_val_registuser, '2' ) ?> >
152
+ <label for="<?php echo self::OPT_NAME_REGISTUSER.'_en' ?>"><?php esc_html_e( 'Alphanumeric', 'siteguard' ) ?></label>
153
  <br />
154
+ <input type="radio" name="<?php echo self::OPT_NAME_REGISTUSER ?>" id="<?php echo self::OPT_NAME_REGISTUSER.'_off' ?>" value="0" <?php checked( $opt_val_registuser, '0' ) ?> >
155
+ <label for="<?php echo self::OPT_NAME_REGISTUSER.'_off' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
156
  </td>
157
  </tr>
158
  </table>
171
  <?php
172
  }
173
  }
 
admin/siteguard-menu-dashboard.php CHANGED
@@ -1,35 +1,31 @@
1
  <?php
2
 
3
- require_once( 'siteguard-login-history-table.php' );
4
-
5
  class SiteGuard_Menu_Dashboard extends SiteGuard_Base {
6
- var $wp_list_table;
7
  function __construct( ) {
8
- $this->wp_list_table = new SiteGuard_LoginHistory_Table( );
9
- $this->wp_list_table->prepare_items( );
10
  $this->render_page( );
11
  }
12
  function render_page( ) {
13
- global $config, $login_history;
14
  $img_path = SITEGUARD_URL_PATH . 'images/';
15
- $admin_filter_enable = $config->get( 'admin_filter_enable' );
16
- $renamelogin_enable = $config->get( 'renamelogin_enable' );
17
- $captcha_enable = $config->get( 'captcha_enable' );
18
- $same_error_enable = $config->get( 'same_login_error' );
19
- $loginlock_enable = $config->get( 'loginlock_enable' );
20
- $loginalert_enable = $config->get( 'loginalert_enable' );
21
- $fail_once_enable = $config->get( 'loginlock_fail_once' );
22
- $disable_pingback_enable = $config->get( 'disable_pingback_enable' );
23
- $updates_notify_enable = $config->get( 'updates_notify_enable' );
24
- $waf_exclude_rule_enable = $config->get( 'waf_exclude_rule_enable' );
 
25
  echo '<div class="wrap">';
26
  echo '<img src="' . $img_path . 'sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
27
  echo '<h2>' . esc_html__( 'Dashboard', 'siteguard' ) . "</h2>\n";
28
  echo '<div class="siteguard-description">'
29
  . esc_html__( 'You can find docs, FAQ and more detailed information about SiteGuard WP Plugin on ', 'siteguard' )
30
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/index_en.html', 'siteguard' ) . '" target="_blank">' . esc_html__( 'SiteGuard WP Plugin Page', 'siteguard' ) . '</a>' . esc_html__( '.', 'siteguard' ) . '</div>';
31
  echo '<h3>' . esc_html__( 'Setting status', 'siteguard' ) . "</h3>\n";
32
- $error = check_multisite( );
33
  if ( is_wp_error( $error ) ) {
34
  echo '<p class="description">';
35
  echo $error->get_error_message( );
@@ -38,22 +34,22 @@ class SiteGuard_Menu_Dashboard extends SiteGuard_Base {
38
  ?>
39
  <table class="siteguard-form-table">
40
  <tr>
41
- <th scpoe="row">
42
  <img src=<?php echo '"' . $img_path . ( '1' == $admin_filter_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
43
  <a href="?page=siteguard_admin_filter"><?php esc_html_e( 'Admin Page IP Filter', 'siteguard' ) ?></a></th>
44
  <td><?php esc_html_e( 'The management directory (/wp-admin/) is protected against the connection source which does not login.', 'siteguard' ) ?></td>
45
  </tr><tr>
46
- <th scpoe="row">
47
  <img src=<?php echo '"' . $img_path . ( '1' == $renamelogin_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
48
  <a href="?page=siteguard_rename_login"><?php esc_html_e( 'Rename Login', 'siteguard' ) ?></a></th>
49
  <td><?php esc_html_e( 'The login page name is changed.', 'siteguard' ) ?></td>
50
  </tr><tr>
51
- <th scpoe="row">
52
  <img src=<?php echo '"' . $img_path . ( '1' == $captcha_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
53
  <a href="?page=siteguard_captcha"><?php esc_html_e( 'CAPTCHA', 'siteguard' ) ?></a></th>
54
  <td><?php esc_html_e( 'CAPTCHA is added to the login page or comment post.', 'siteguard' ) ?></td>
55
  </tr><tr>
56
- <th scpoe="row">
57
  <img src=<?php echo '"' . $img_path . ( '1' == $same_error_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
58
  <a href="?page=siteguard_same_error"><?php esc_html_e( 'Same Login Error Message', 'siteguard' ) ?></a></th>
59
  <td><?php esc_html_e( 'Instead of the detailed error message at the login error, the single message is returned.', 'siteguard' ) ?></td>
@@ -73,31 +69,32 @@ class SiteGuard_Menu_Dashboard extends SiteGuard_Base {
73
  <a href="?page=siteguard_fail_once"><?php esc_html_e( 'Fail once', 'siteguard' ) ?></a></th>
74
  <td><?php esc_html_e( 'The first login must fail even if the input is correct.', 'siteguard' ) ?></td>
75
  </tr><tr>
76
- <th scpoe="row">
77
- <img src=<?php echo '"' . $img_path . ( '1' == $disable_pingback_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
78
- <a href="?page=siteguard_disable_pingback"><?php esc_html_e( 'Disable Pingback', 'siteguard' ) ?></a></th>
79
- <td><?php esc_html_e( 'The abuse of pingback is prevented.', 'siteguard' ) ?></td>
80
  </tr><tr>
81
- <th scpoe="row">
82
  <img src=<?php echo '"' . $img_path . ( '1' == $updates_notify_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
83
  <a href="?page=siteguard_updates_notify"><?php esc_html_e( 'Updates Notify', 'siteguard' ) ?></a></th>
84
  <td><?php esc_html_e( 'If WordPress core, plugins, and themes updates are needed , sends email to notify administrators.', 'siteguard' ) ?></td>
85
  </tr><tr>
86
- <th scpoe="row">
87
  <img src=<?php echo '"' . $img_path . ( '1' == $waf_exclude_rule_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
88
  <a href="?page=siteguard_waf_tuning_support"><?php esc_html_e( 'WAF Tuning Support', 'siteguard' ) ?></a></th>
89
  <td><?php esc_html_e( 'The exclude rule for WAF (SiteGuard Lite) is created.', 'siteguard' ) ?></td>
 
 
 
 
 
 
 
 
90
  </tr>
91
  </table>
92
  <hr />
93
- <form name="form1" method="post" action="">
94
- <?php echo '<h3>' . esc_html__( 'Login history', 'siteguard' ) . "</h3>\n"; ?>
95
- <?php $this->wp_list_table->display( ) ?>
96
- <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ) ?>">
97
- </form>
98
  </div>
99
  <?php
100
  }
101
  }
102
-
103
- ?>
1
  <?php
2
 
 
 
3
  class SiteGuard_Menu_Dashboard extends SiteGuard_Base {
 
4
  function __construct( ) {
 
 
5
  $this->render_page( );
6
  }
7
  function render_page( ) {
8
+ global $siteguard_config, $siteguard_login_history;
9
  $img_path = SITEGUARD_URL_PATH . 'images/';
10
+ $admin_filter_enable = $siteguard_config->get( 'admin_filter_enable' );
11
+ $renamelogin_enable = $siteguard_config->get( 'renamelogin_enable' );
12
+ $captcha_enable = $siteguard_config->get( 'captcha_enable' );
13
+ $same_error_enable = $siteguard_config->get( 'same_login_error' );
14
+ $loginlock_enable = $siteguard_config->get( 'loginlock_enable' );
15
+ $loginalert_enable = $siteguard_config->get( 'loginalert_enable' );
16
+ $fail_once_enable = $siteguard_config->get( 'loginlock_fail_once' );
17
+ $disable_xmlrpc_enable = $siteguard_config->get( 'disable_xmlrpc_enable' );
18
+ $disable_pingback_enable = $siteguard_config->get( 'disable_pingback_enable' );
19
+ $updates_notify_enable = $siteguard_config->get( 'updates_notify_enable' );
20
+ $waf_exclude_rule_enable = $siteguard_config->get( 'waf_exclude_rule_enable' );
21
  echo '<div class="wrap">';
22
  echo '<img src="' . $img_path . 'sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
23
  echo '<h2>' . esc_html__( 'Dashboard', 'siteguard' ) . "</h2>\n";
24
  echo '<div class="siteguard-description">'
25
  . esc_html__( 'You can find docs, FAQ and more detailed information about SiteGuard WP Plugin on ', 'siteguard' )
26
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/', 'siteguard' ) ) . '" target="_blank">' . esc_html__( 'SiteGuard WP Plugin Page', 'siteguard' ) . '</a>' . esc_html__( '.', 'siteguard' ) . '</div>';
27
  echo '<h3>' . esc_html__( 'Setting status', 'siteguard' ) . "</h3>\n";
28
+ $error = siteguard_check_multisite( );
29
  if ( is_wp_error( $error ) ) {
30
  echo '<p class="description">';
31
  echo $error->get_error_message( );
34
  ?>
35
  <table class="siteguard-form-table">
36
  <tr>
37
+ <th scope="row">
38
  <img src=<?php echo '"' . $img_path . ( '1' == $admin_filter_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
39
  <a href="?page=siteguard_admin_filter"><?php esc_html_e( 'Admin Page IP Filter', 'siteguard' ) ?></a></th>
40
  <td><?php esc_html_e( 'The management directory (/wp-admin/) is protected against the connection source which does not login.', 'siteguard' ) ?></td>
41
  </tr><tr>
42
+ <th scope="row">
43
  <img src=<?php echo '"' . $img_path . ( '1' == $renamelogin_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
44
  <a href="?page=siteguard_rename_login"><?php esc_html_e( 'Rename Login', 'siteguard' ) ?></a></th>
45
  <td><?php esc_html_e( 'The login page name is changed.', 'siteguard' ) ?></td>
46
  </tr><tr>
47
+ <th scope="row">
48
  <img src=<?php echo '"' . $img_path . ( '1' == $captcha_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
49
  <a href="?page=siteguard_captcha"><?php esc_html_e( 'CAPTCHA', 'siteguard' ) ?></a></th>
50
  <td><?php esc_html_e( 'CAPTCHA is added to the login page or comment post.', 'siteguard' ) ?></td>
51
  </tr><tr>
52
+ <th scope="row">
53
  <img src=<?php echo '"' . $img_path . ( '1' == $same_error_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
54
  <a href="?page=siteguard_same_error"><?php esc_html_e( 'Same Login Error Message', 'siteguard' ) ?></a></th>
55
  <td><?php esc_html_e( 'Instead of the detailed error message at the login error, the single message is returned.', 'siteguard' ) ?></td>
69
  <a href="?page=siteguard_fail_once"><?php esc_html_e( 'Fail once', 'siteguard' ) ?></a></th>
70
  <td><?php esc_html_e( 'The first login must fail even if the input is correct.', 'siteguard' ) ?></td>
71
  </tr><tr>
72
+ <th scope="row">
73
+ <img src=<?php echo '"' . $img_path . ( '1' == $disable_pingback_enable || '1' == $disable_xmlrpc_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
74
+ <a href="?page=siteguard_protect_xmlrpc"><?php esc_html_e( 'Protect XMLRPC', 'siteguard' ) ?></a></th>
75
+ <td><?php esc_html_e( 'The abuse of XMLRPC is prevented.', 'siteguard' ) ?></td>
76
  </tr><tr>
77
+ <th scope="row">
78
  <img src=<?php echo '"' . $img_path . ( '1' == $updates_notify_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
79
  <a href="?page=siteguard_updates_notify"><?php esc_html_e( 'Updates Notify', 'siteguard' ) ?></a></th>
80
  <td><?php esc_html_e( 'If WordPress core, plugins, and themes updates are needed , sends email to notify administrators.', 'siteguard' ) ?></td>
81
  </tr><tr>
82
+ <th scope="row">
83
  <img src=<?php echo '"' . $img_path . ( '1' == $waf_exclude_rule_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"' ) ?>>
84
  <a href="?page=siteguard_waf_tuning_support"><?php esc_html_e( 'WAF Tuning Support', 'siteguard' ) ?></a></th>
85
  <td><?php esc_html_e( 'The exclude rule for WAF (SiteGuard Lite) is created.', 'siteguard' ) ?></td>
86
+ </tr><tr>
87
+ <th scope="row">
88
+ <a href="?page=siteguard_advanced_setting"><?php esc_html_e( 'Advanced Setting', 'siteguard' ) ?></a></th>
89
+ <td><?php esc_html_e( 'Set the method for acquiring the IP address.', 'siteguard' ) ?></td>
90
+ </tr><tr>
91
+ <th scope="row">
92
+ <a href="?page=siteguard_login_history"><?php echo esc_html__( 'Login history', 'siteguard' ) ?></a>
93
+ <td><?php esc_html_e( 'Login history can be referenced.', 'siteguard' ) ?></td>
94
  </tr>
95
  </table>
96
  <hr />
 
 
 
 
 
97
  </div>
98
  <?php
99
  }
100
  }
 
 
admin/siteguard-menu-disable-pingback.php DELETED
@@ -1,89 +0,0 @@
1
- <?php
2
-
3
- class SiteGuard_Menu_Disable_Pingback extends SiteGuard_Base {
4
- function __construct( ) {
5
- $this->render_page( );
6
- }
7
- function render_page( ) {
8
- global $config;
9
-
10
- $opt_name_feature = 'disable_pingback_enable';
11
- $opt_val_feature = $config->get( $opt_name_feature );
12
- if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-disable-pingback-submit' ) ) {
13
- $error = false;
14
- $errors = check_multisite( );
15
- if ( is_wp_error( $errors ) ) {
16
- echo '<div class="error settings-error"><p><strong>';
17
- esc_html_e( $errors->get_error_message( ), 'siteguard' );
18
- echo '</strong></p></div>';
19
- $error = true;
20
- }
21
- if ( false == $error && false == $this->is_switch_value( $_POST[ $opt_name_feature ] ) ) {
22
- echo '<div class="error settings-error"><p><strong>';
23
- esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
24
- echo '</strong></p></div>';
25
- $error = true;
26
- }
27
- if ( false == $error ) {
28
- $opt_val_feature = $_POST[ $opt_name_feature ];
29
- $config->set( $opt_name_feature, $opt_val_feature );
30
- $config->update( );
31
- ?>
32
- <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
33
- <?php
34
- }
35
- }
36
-
37
- echo '<div class="wrap">';
38
- echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
39
- echo '<h2>' . esc_html__( 'Disable Pingback', 'siteguard' ) . '</h2>';
40
- echo '<div class="siteguard-description">'
41
- . esc_html__( 'You can find docs about this function on ', 'siteguard' )
42
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/pingback_en.html', 'siteguard' )
43
- . '" target="_blank">'
44
- . esc_html__( 'here', 'siteguard' )
45
- . '</a>'
46
- . esc_html__( '.', 'siteguard' )
47
- . '</div>';
48
- ?>
49
- <form name="form1" method="post" action="">
50
-
51
- <table class="form-table">
52
- <tr>
53
- <th scope="row" colspan="2">
54
- <ul class="siteguard-radios">
55
- <li>
56
- <input type="radio" name="<?php echo $opt_name_feature ?>" id="<?php echo $opt_name_feature.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_feature ? 'checked' : '') ?> >
57
- <label for="<?php echo $opt_name_feature.'_on' ?>"><?php echo esc_html_e( 'ON', 'siteguard' ) ?></label>
58
- </li><li>
59
- <input type="radio" name="<?php echo $opt_name_feature ?>" id="<?php echo $opt_name_feature.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_feature ? 'checked' : '') ?> >
60
- <label for="<?php echo $opt_name_feature.'_off' ?>"><?php echo esc_html_e( 'OFF', 'siteguard' ) ?></label>
61
- </li>
62
- </ul>
63
- <?php
64
- $error = check_multisite( );
65
- if ( is_wp_error( $error ) ) {
66
- echo '<p class="description">';
67
- echo $error->get_error_message( );
68
- echo '</p>';
69
- }
70
- ?>
71
- </th>
72
- </tr>
73
- </table>
74
- <input type="hidden" name="update" value="Y">
75
- <div class="siteguard-description">
76
- <?php esc_html_e( 'The pingback function is disabled and its abuse is prevented.', 'siteguard' ) ?>
77
- </div>
78
- <hr />
79
- <?php
80
- wp_nonce_field( 'siteguard-menu-disable-pingback-submit' );
81
- submit_button( );
82
- ?>
83
- </form>
84
- </div>
85
- <?php
86
- }
87
- }
88
-
89
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/siteguard-menu-fail-once.php CHANGED
@@ -1,42 +1,42 @@
1
  <?php
2
 
3
  class SiteGuard_Menu_Fail_Once extends SiteGuard_Base {
 
 
 
4
  function __construct( ) {
5
  $this->render_page( );
6
  }
7
  function render_page( ) {
8
- global $config;
9
-
10
- $opt_name_fail_once = 'loginlock_fail_once';
11
- $opt_name_admin_only = 'fail_once_admin_only';
12
 
13
- $opt_val_fail_once = $config->get( $opt_name_fail_once );
14
- $opt_val_admin_only = $config->get( $opt_name_admin_only );
15
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-fail-once-submit' ) ) {
16
  $error = false;
17
- $errors = check_multisite( );
18
  if ( is_wp_error( $errors ) ) {
19
  echo '<div class="error settings-error"><p><strong>';
20
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
21
  echo '</strong></p></div>';
22
  $error = true;
23
  }
24
- if ( false == $error && false == $this->is_switch_value( $_POST[ $opt_name_fail_once ] ) ) {
25
  echo '<div class="error settings-error"><p><strong>';
26
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
27
  echo '</strong></p></div>';
28
  $error = true;
29
  }
30
- if ( false == $error ) {
31
- $opt_val_fail_once = $_POST[ $opt_name_fail_once ];
32
- if ( isset( $_POST[ $opt_name_admin_only ] ) ) {
33
- $opt_val_admin_only = $_POST[ $opt_name_admin_only ];
34
  } else {
35
  $opt_val_admin_only = '0';
36
  }
37
- $config->set( $opt_name_fail_once, $opt_val_fail_once );
38
- $config->set( $opt_name_admin_only, $opt_val_admin_only );
39
- $config->update( );
40
  ?>
41
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
42
  <?php
@@ -48,11 +48,11 @@ class SiteGuard_Menu_Fail_Once extends SiteGuard_Base {
48
  echo '<h2>' . esc_html__( 'Fail once', 'siteguard' ) . '</h2>';
49
  echo '<div class="siteguard-description">'
50
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
51
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/fail_once_en.html', 'siteguard' )
52
- . '" target="_blank">'
53
- . esc_html__( 'here', 'siteguard' )
54
- . '</a>'
55
- . esc_html__( '.', 'siteguard' )
56
  . '</div>';
57
  ?>
58
  <form name="form1" method="post" action="">
@@ -61,15 +61,15 @@ class SiteGuard_Menu_Fail_Once extends SiteGuard_Base {
61
  <th scope="row" colspan="2">
62
  <ul class="siteguard-radios">
63
  <li>
64
- <input type="radio" name="<?php echo $opt_name_fail_once ?>" id="<?php echo $opt_name_fail_once.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_fail_once ? 'checked' : '') ?> >
65
- <label for="<?php echo $opt_name_fail_once.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
66
  </li><li>
67
- <input type="radio" name="<?php echo $opt_name_fail_once ?>" id="<?php echo $opt_name_fail_once.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_fail_once ? 'checked' : '') ?> >
68
- <label for="<?php echo $opt_name_fail_once.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
69
  </li>
70
  </ul>
71
  <?php
72
- $error = check_multisite( );
73
  if ( is_wp_error( $error ) ) {
74
  echo '<p class="description">';
75
  echo $error->get_error_message( );
@@ -81,8 +81,8 @@ class SiteGuard_Menu_Fail_Once extends SiteGuard_Base {
81
  </tr><tr>
82
  <th scope="row"><?php esc_html_e( 'Target user', 'siteguard' ) ?></th>
83
  <td>
84
- <input type="checkbox" name="<?php echo $opt_name_admin_only ?>" id="<?php echo $opt_name_admin_only ?>" value="1" <?php echo ( '1' == $opt_val_admin_only ? 'checked' : '' ) ?> >
85
- <label for="<?php echo $opt_name_admin_only ?>"><?php esc_html_e( 'Admin only', 'siteguard' ) ?></label>
86
  </td>
87
  </tr>
88
  </table>
@@ -103,4 +103,3 @@ class SiteGuard_Menu_Fail_Once extends SiteGuard_Base {
103
  <?php
104
  }
105
  }
106
- ?>
1
  <?php
2
 
3
  class SiteGuard_Menu_Fail_Once extends SiteGuard_Base {
4
+ const OPT_NAME_FAIL_ONCE = 'loginlock_fail_once';
5
+ const OPT_NAME_ADMIN_ONLY = 'fail_once_admin_only';
6
+
7
  function __construct( ) {
8
  $this->render_page( );
9
  }
10
  function render_page( ) {
11
+ global $siteguard_config;
 
 
 
12
 
13
+ $opt_val_fail_once = $siteguard_config->get( self::OPT_NAME_FAIL_ONCE );
14
+ $opt_val_admin_only = $siteguard_config->get( self::OPT_NAME_ADMIN_ONLY );
15
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-fail-once-submit' ) ) {
16
  $error = false;
17
+ $errors = siteguard_check_multisite( );
18
  if ( is_wp_error( $errors ) ) {
19
  echo '<div class="error settings-error"><p><strong>';
20
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
21
  echo '</strong></p></div>';
22
  $error = true;
23
  }
24
+ if ( false === $error && false === $this->is_switch_value( $_POST[ self::OPT_NAME_FAIL_ONCE ] ) ) {
25
  echo '<div class="error settings-error"><p><strong>';
26
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
27
  echo '</strong></p></div>';
28
  $error = true;
29
  }
30
+ if ( false === $error ) {
31
+ $opt_val_fail_once = $_POST[ self::OPT_NAME_FAIL_ONCE ];
32
+ if ( isset( $_POST[ self::OPT_NAME_ADMIN_ONLY ] ) ) {
33
+ $opt_val_admin_only = $_POST[ self::OPT_NAME_ADMIN_ONLY ];
34
  } else {
35
  $opt_val_admin_only = '0';
36
  }
37
+ $siteguard_config->set( self::OPT_NAME_FAIL_ONCE, $opt_val_fail_once );
38
+ $siteguard_config->set( self::OPT_NAME_ADMIN_ONLY, $opt_val_admin_only );
39
+ $siteguard_config->update( );
40
  ?>
41
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
42
  <?php
48
  echo '<h2>' . esc_html__( 'Fail once', 'siteguard' ) . '</h2>';
49
  echo '<div class="siteguard-description">'
50
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
51
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/fail_once/', 'siteguard' ) )
52
+ . '" target="_blank">'
53
+ . esc_html__( 'here', 'siteguard' )
54
+ . '</a>'
55
+ . esc_html__( '.', 'siteguard' )
56
  . '</div>';
57
  ?>
58
  <form name="form1" method="post" action="">
61
  <th scope="row" colspan="2">
62
  <ul class="siteguard-radios">
63
  <li>
64
+ <input type="radio" name="<?php echo self::OPT_NAME_FAIL_ONCE ?>" id="<?php echo self::OPT_NAME_FAIL_ONCE.'_on' ?>" value="1" <?php checked( $opt_val_fail_once, '1' ) ?> >
65
+ <label for="<?php echo self::OPT_NAME_FAIL_ONCE.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
66
  </li><li>
67
+ <input type="radio" name="<?php echo self::OPT_NAME_FAIL_ONCE ?>" id="<?php echo self::OPT_NAME_FAIL_ONCE.'_off' ?>" value="0" <?php checked( $opt_val_fail_once, '0' ) ?> >
68
+ <label for="<?php echo self::OPT_NAME_FAIL_ONCE.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
69
  </li>
70
  </ul>
71
  <?php
72
+ $error = siteguard_check_multisite( );
73
  if ( is_wp_error( $error ) ) {
74
  echo '<p class="description">';
75
  echo $error->get_error_message( );
81
  </tr><tr>
82
  <th scope="row"><?php esc_html_e( 'Target user', 'siteguard' ) ?></th>
83
  <td>
84
+ <input type="checkbox" name="<?php echo self::OPT_NAME_ADMIN_ONLY ?>" id="<?php echo self::OPT_NAME_ADMIN_ONLY ?>" value="1" <?php checked( $opt_val_admin_only, '1' ) ?> >
85
+ <label for="<?php echo self::OPT_NAME_ADMIN_ONLY ?>"><?php esc_html_e( 'Admin only', 'siteguard' ) ?></label>
86
  </td>
87
  </tr>
88
  </table>
103
  <?php
104
  }
105
  }
 
admin/siteguard-menu-init.php CHANGED
@@ -2,33 +2,76 @@
2
  class SiteGuard_Menu_INIT extends SiteGuard_Base {
3
  function __construct( ) {
4
  add_action( 'admin_menu', array( &$this, 'add_pages' ) );
5
- if ( isset( $_GET['page'] ) && false !== strpos( $_GET['page'], 'siteguard' ) ) {
6
- add_action( 'admin_print_styles', array( $this, 'menu_styles' ) );
7
- }
8
  }
9
  function menu_styles( ) {
10
  wp_enqueue_style( 'siteguard-menu', SITEGUARD_URL_PATH . 'css/siteguard-menu.css' );
11
  }
12
  function add_pages( ) {
13
  $icon_path = SITEGUARD_URL_PATH . 'images/plugin-icon.png';
14
- add_menu_page( esc_html__( 'SiteGuard', 'siteguard' ), esc_html__( 'SiteGuard', 'siteguard' ), 'manage_options', 'siteguard', array( $this, 'menu_dashboard' ), $icon_path );
15
- add_submenu_page( 'siteguard', esc_html__( 'Dashboard', 'siteguard' ), esc_html__( 'Dashboard', 'siteguard' ) , 'manage_options', 'siteguard', array( $this, 'menu_dashboard' ) );
16
- add_submenu_page( 'siteguard', esc_html__( 'Admin Page IP Filter', 'siteguard' ), esc_html__( 'Admin Page IP Filter', 'siteguard' ), 'manage_options', 'siteguard_admin_filter', array( $this, 'menu_admin_filter' ) );
17
- add_submenu_page( 'siteguard', esc_html__( 'Rename Login', 'siteguard' ), esc_html__( 'Rename Login', 'siteguard' ), 'manage_options', 'siteguard_rename_login', array( $this, 'menu_rename_login' ) );
18
- add_submenu_page( 'siteguard', esc_html__( 'CAPTCHA', 'siteguard' ), esc_html__( 'CAPTCHA', 'siteguard' ), 'manage_options', 'siteguard_captcha', array( $this, 'menu_captcha' ) );
19
- add_submenu_page( 'siteguard', esc_html__( 'Same Login Error Message', 'siteguard' ), esc_html__( 'Same Login Error Message', 'siteguard' ), 'manage_options', 'siteguard_same_error', array( $this, 'menu_same_error' ) );
20
- add_submenu_page( 'siteguard', esc_html__( 'Login Lock', 'siteguard' ), esc_html__( 'Login Lock', 'siteguard' ), 'manage_options', 'siteguard_login_lock', array( $this, 'menu_login_lock' ) );
21
- add_submenu_page( 'siteguard', esc_html__( 'Login Alert', 'siteguard' ), esc_html__( 'Login Alert', 'siteguard' ), 'manage_options', 'siteguard_login_alert', array( $this, 'menu_login_alert' ) );
22
- add_submenu_page( 'siteguard', esc_html__( 'Fail once', 'siteguard' ), esc_html__( 'Fail once', 'siteguard' ), 'manage_options', 'siteguard_fail_once', array( $this, 'menu_fail_once' ) );
23
- add_submenu_page( 'siteguard', esc_html__( 'Disable Pingback', 'siteguard' ), esc_html__( 'Disable Pingback', 'siteguard' ), 'manage_options', 'siteguard_disable_pingback', array( $this, 'menu_disable_pingback' ) );
24
- add_submenu_page( 'siteguard', esc_html__( 'Updates Notify', 'siteguard' ), esc_html__( 'Updates Notify', 'siteguard' ), 'manage_options', 'siteguard_updates_notify', array( $this, 'menu_updates_notify' ) );
25
- add_submenu_page( 'siteguard', esc_html__( 'WAF Tuning Support', 'siteguard' ), esc_html__( 'WAF Tuning Support', 'siteguard' ), 'manage_options', 'siteguard_waf_tuning_support', array( $this, 'menu_waf_tuning_support' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
 
28
  function menu_dashboard( ) {
29
  include( 'siteguard-menu-dashboard.php' );
30
  $dashboard_menu = new SiteGuard_Menu_Dashboard( );
31
  }
 
 
 
 
32
  function menu_admin_filter( ) {
33
  include( 'siteguard-menu-admin-filter.php' );
34
  $admin_filter_menu = new SiteGuard_Menu_Admin_Filter( );
@@ -57,9 +100,9 @@ class SiteGuard_Menu_INIT extends SiteGuard_Base {
57
  include( 'siteguard-menu-fail-once.php' );
58
  $fail_once_menu = new SiteGuard_Menu_Fail_Once( );
59
  }
60
- function menu_disable_pingback( ) {
61
- include( 'siteguard-menu-disable-pingback.php' );
62
- $disable_pingback_menu = new SiteGuard_Menu_Disable_Pingback( );
63
  }
64
  function menu_updates_notify( ) {
65
  include( 'siteguard-menu-updates-notify.php' );
@@ -69,5 +112,8 @@ class SiteGuard_Menu_INIT extends SiteGuard_Base {
69
  include( 'siteguard-menu-waf-tuning-support.php' );
70
  $waf_tuning_support_menu = new SiteGuard_Menu_WAF_Tuning_Support( );
71
  }
 
 
 
 
72
  }
73
- ?>
2
  class SiteGuard_Menu_INIT extends SiteGuard_Base {
3
  function __construct( ) {
4
  add_action( 'admin_menu', array( &$this, 'add_pages' ) );
 
 
 
5
  }
6
  function menu_styles( ) {
7
  wp_enqueue_style( 'siteguard-menu', SITEGUARD_URL_PATH . 'css/siteguard-menu.css' );
8
  }
9
  function add_pages( ) {
10
  $icon_path = SITEGUARD_URL_PATH . 'images/plugin-icon.png';
11
+ $page = add_menu_page( esc_html__( 'SiteGuard', 'siteguard' ), esc_html__( 'SiteGuard', 'siteguard' ), 'manage_options', 'siteguard', array( $this, 'menu_dashboard' ), $icon_path );
12
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
13
+
14
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Dashboard', 'siteguard' ),
15
+ esc_html__( 'Dashboard', 'siteguard' ) , 'manage_options', 'siteguard', array( $this, 'menu_dashboard' ) );
16
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
17
+
18
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Admin Page IP Filter', 'siteguard' ),
19
+ esc_html__( 'Admin Page IP Filter', 'siteguard' ), 'manage_options', 'siteguard_admin_filter', array( $this, 'menu_admin_filter' ) );
20
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
21
+
22
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Rename Login', 'siteguard' ),
23
+ esc_html__( 'Rename Login', 'siteguard' ), 'manage_options', 'siteguard_rename_login', array( $this, 'menu_rename_login' ) );
24
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
25
+
26
+ $page = add_submenu_page( 'siteguard', esc_html__( 'CAPTCHA', 'siteguard' ),
27
+ esc_html__( 'CAPTCHA', 'siteguard' ), 'manage_options', 'siteguard_captcha', array( $this, 'menu_captcha' ) );
28
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
29
+
30
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Same Login Error Message', 'siteguard' ),
31
+ esc_html__( 'Same Login Error Message', 'siteguard' ), 'manage_options', 'siteguard_same_error', array( $this, 'menu_same_error' ) );
32
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
33
+
34
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Login Lock', 'siteguard' ),
35
+ esc_html__( 'Login Lock', 'siteguard' ), 'manage_options', 'siteguard_login_lock', array( $this, 'menu_login_lock' ) );
36
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
37
+
38
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Login Alert', 'siteguard' ),
39
+ esc_html__( 'Login Alert', 'siteguard' ), 'manage_options', 'siteguard_login_alert', array( $this, 'menu_login_alert' ) );
40
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
41
+
42
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Fail once', 'siteguard' ),
43
+ esc_html__( 'Fail once', 'siteguard' ), 'manage_options', 'siteguard_fail_once', array( $this, 'menu_fail_once' ) );
44
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
45
+
46
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Protect XMLRPC', 'siteguard' ),
47
+ esc_html__( 'Protect XMLRPC', 'siteguard' ), 'manage_options', 'siteguard_protect_xmlrpc', array( $this, 'menu_protect_xmlrpc' ) );
48
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
49
+
50
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Updates Notify', 'siteguard' ),
51
+ esc_html__( 'Updates Notify', 'siteguard' ), 'manage_options', 'siteguard_updates_notify', array( $this, 'menu_updates_notify' ) );
52
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
53
+
54
+ $page = add_submenu_page( 'siteguard', esc_html__( 'WAF Tuning Support', 'siteguard' ),
55
+ esc_html__( 'WAF Tuning Support', 'siteguard' ), 'manage_options', 'siteguard_waf_tuning_support', array( $this, 'menu_waf_tuning_support' ) );
56
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
57
+
58
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Advanced Setting', 'siteguard' ),
59
+ esc_html__( 'Advanced Setting', 'siteguard' ), 'manage_options', 'siteguard_advanced_setting', array( $this, 'menu_advanced_setting' ) );
60
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
61
+
62
+ $page = add_submenu_page( 'siteguard', esc_html__( 'Login history', 'siteguard' ),
63
+ esc_html__( 'Login history', 'siteguard' ), 'manage_options', 'siteguard_login_history', array( $this, 'menu_login_history' ) );
64
+ add_action( 'admin_print_styles-' . $page, array( $this, 'menu_styles' ) );
65
  }
66
 
67
  function menu_dashboard( ) {
68
  include( 'siteguard-menu-dashboard.php' );
69
  $dashboard_menu = new SiteGuard_Menu_Dashboard( );
70
  }
71
+ function menu_login_history( ) {
72
+ // include( 'siteguard-menu-login-history.php' ); -- already included SiteGuard::__construct --
73
+ $login_history_menu = new SiteGuard_Menu_Login_History( );
74
+ }
75
  function menu_admin_filter( ) {
76
  include( 'siteguard-menu-admin-filter.php' );
77
  $admin_filter_menu = new SiteGuard_Menu_Admin_Filter( );
100
  include( 'siteguard-menu-fail-once.php' );
101
  $fail_once_menu = new SiteGuard_Menu_Fail_Once( );
102
  }
103
+ function menu_protect_xmlrpc( ) {
104
+ include( 'siteguard-menu-protect-xmlrpc.php' );
105
+ $protect_xmlrpc_menu = new SiteGuard_Menu_Protect_XMLRPC( );
106
  }
107
  function menu_updates_notify( ) {
108
  include( 'siteguard-menu-updates-notify.php' );
112
  include( 'siteguard-menu-waf-tuning-support.php' );
113
  $waf_tuning_support_menu = new SiteGuard_Menu_WAF_Tuning_Support( );
114
  }
115
+ function menu_advanced_setting( ) {
116
+ include( 'siteguard-menu-advanced-setting.php' );
117
+ $advanced_setting = new SiteGuard_Menu_Advanced_Setting( );
118
+ }
119
  }
 
admin/siteguard-menu-login-alert.php CHANGED
@@ -1,50 +1,50 @@
1
  <?php
2
 
3
  class SiteGuard_Menu_Login_Alert extends SiteGuard_Base {
 
 
 
 
 
4
  function __construct( ) {
5
  $this->render_page( );
6
  }
7
  function render_page( ) {
8
- global $config;
9
-
10
- $opt_name_feature = 'loginalert_enable';
11
- $opt_name_subject = 'loginalert_subject';
12
- $opt_name_body = 'loginalert_body';
13
- $opt_name_admin = 'loginalert_admin_only';
14
 
15
- $opt_val_feature = $config->get( $opt_name_feature );
16
- $opt_val_subject = $config->get( $opt_name_subject );
17
- $opt_val_body = $config->get( $opt_name_body );
18
- $opt_val_admin = $config->get( $opt_name_admin );
19
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-login-alert-submit' ) ) {
20
  $error = false;
21
- $errors = check_multisite( );
22
  if ( is_wp_error( $errors ) ) {
23
  echo '<div class="error settings-error"><p><strong>';
24
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
25
  echo '</strong></p></div>';
26
  $error = true;
27
  }
28
- if ( false == $error && false == $this->is_switch_value( $_POST[ $opt_name_feature ] ) ) {
29
  echo '<div class="error settings-error"><p><strong>';
30
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
31
  echo '</strong></p></div>';
32
  $error = true;
33
  }
34
- if ( false == $error ) {
35
- $opt_val_feature = $_POST[ $opt_name_feature ];
36
- $opt_val_subject = $_POST[ $opt_name_subject ];
37
- $opt_val_body = $_POST[ $opt_name_body ];
38
- if ( isset( $_POST[ $opt_name_admin ] ) ) {
39
- $opt_val_admin = $_POST[ $opt_name_admin ];
40
  } else {
41
  $opt_val_admin = '0';
42
  }
43
- $config->set( $opt_name_feature, $opt_val_feature );
44
- $config->set( $opt_name_subject, $opt_val_subject );
45
- $config->set( $opt_name_body, $opt_val_body );
46
- $config->set( $opt_name_admin, $opt_val_admin );
47
- $config->update( );
48
  ?>
49
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
50
  <?php
@@ -56,11 +56,11 @@ class SiteGuard_Menu_Login_Alert extends SiteGuard_Base {
56
  echo '<h2>' . esc_html__( 'Login Alert', 'siteguard' ) . '</h2>';
57
  echo '<div class="siteguard-description">'
58
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
59
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_alert_en.html', 'siteguard' )
60
- . '" target="_blank">'
61
- . esc_html__( 'here', 'siteguard' )
62
- . '</a>'
63
- . esc_html__( '.', 'siteguard' )
64
  . '</div>';
65
  ?>
66
  <form name="form1" method="post" action="">
@@ -69,15 +69,15 @@ class SiteGuard_Menu_Login_Alert extends SiteGuard_Base {
69
  <th scope="row" colspan="2">
70
  <ul class="siteguard-radios">
71
  <li>
72
- <input type="radio" name="<?php echo $opt_name_feature ?>" id="<?php echo $opt_name_feature.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_feature ? 'checked' : '') ?> >
73
- <label for="<?php echo $opt_name_feature.'_on' ?>"><?php echo esc_html_e( 'ON', 'siteguard' ) ?></label>
74
  </li><li>
75
- <input type="radio" name="<?php echo $opt_name_feature ?>" id="<?php echo $opt_name_feature.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_feature ? 'checked' : '') ?> >
76
- <label for="<?php echo $opt_name_feature.'_off' ?>"><?php echo esc_html_e( 'OFF', 'siteguard' ) ?></label>
77
  </li>
78
  </ul>
79
  <?php
80
- $error = check_multisite( );
81
  if ( is_wp_error( $error ) ) {
82
  echo '<p class="description">';
83
  echo $error->get_error_message( );
@@ -86,26 +86,26 @@ class SiteGuard_Menu_Login_Alert extends SiteGuard_Base {
86
  ?>
87
  </th>
88
  </tr><tr>
89
- <th scope="row"><label for="<?php echo $opt_name_subject ?>"><?php esc_html_e( 'Subject', 'siteguard' ); ?></label></th>
90
  <td>
91
- <input type="text" name="<?php echo $opt_name_subject ?>" id="<?php echo $opt_name_subject ?>" size="50" value="<?php echo esc_attr( $opt_val_subject ) ?>" >
92
  </td>
93
  </tr><tr>
94
- <th scope="row"><label for="<?php echo $opt_name_body ?>"><?php esc_html_e( 'Body', 'siteguard' ); ?></label></th>
95
  <td>
96
- <textarea name="<?php echo $opt_name_body ?>" id="<?php echo $opt_name_body ?>" cols="50" rows="5" ><?php echo esc_textarea( $opt_val_body ) ?></textarea>
97
  </td>
98
  </tr><tr>
99
  <th scope="row"><?php esc_html_e( 'Recipients', 'siteguard' ) ?></th>
100
  <td>
101
- <input type="checkbox" name="<?php echo $opt_name_admin ?>" id="<?php echo $opt_name_admin ?>" value="1" <?php echo ( '1' == $opt_val_admin ? 'checked' : '' ) ?> >
102
- <label for="<?php echo $opt_name_admin ?>"><?php esc_html_e( 'Admin only', 'siteguard' ) ?></label>
103
  </td>
104
  </tr>
105
  </table>
106
  <input type="hidden" name="update" value="Y">
107
  <div class="siteguard-description">
108
- <?php esc_html_e( 'It is the function to make it easier to notice unauthorized login. E-mail will be sent to a login user when logged in. If you receive an e-mail to there is no logged-in idea, please suspect unauthorized login. The subject and the mail body, the following variables can be used. (Site Name:%SITENAME%, User Name:%USERNAME%, DATE:%DATE%, Time:%TIME%, IP Address:%IPADDRESS%, User-Agent:%USERAGENT%, Referer:%REFERER%) Access by the XML-RPC will not be notified.', 'siteguard' ) ?>
109
  </div>
110
  <hr />
111
  <?php
@@ -117,5 +117,3 @@ class SiteGuard_Menu_Login_Alert extends SiteGuard_Base {
117
  <?php
118
  }
119
  }
120
-
121
- ?>
1
  <?php
2
 
3
  class SiteGuard_Menu_Login_Alert extends SiteGuard_Base {
4
+ const OPT_NAME_FEATURE = 'loginalert_enable';
5
+ const OPT_NAME_SUBJECT = 'loginalert_subject';
6
+ const OPT_NAME_BODY = 'loginalert_body';
7
+ const OPT_NAME_ADMIN = 'loginalert_admin_only';
8
+
9
  function __construct( ) {
10
  $this->render_page( );
11
  }
12
  function render_page( ) {
13
+ global $siteguard_config;
 
 
 
 
 
14
 
15
+ $opt_val_feature = $siteguard_config->get( self::OPT_NAME_FEATURE );
16
+ $opt_val_subject = $siteguard_config->get( self::OPT_NAME_SUBJECT );
17
+ $opt_val_body = $siteguard_config->get( self::OPT_NAME_BODY );
18
+ $opt_val_admin = $siteguard_config->get( self::OPT_NAME_ADMIN );
19
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-login-alert-submit' ) ) {
20
  $error = false;
21
+ $errors = siteguard_check_multisite( );
22
  if ( is_wp_error( $errors ) ) {
23
  echo '<div class="error settings-error"><p><strong>';
24
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
25
  echo '</strong></p></div>';
26
  $error = true;
27
  }
28
+ if ( false === $error && false === $this->is_switch_value( $_POST[ self::OPT_NAME_FEATURE ] ) ) {
29
  echo '<div class="error settings-error"><p><strong>';
30
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
31
  echo '</strong></p></div>';
32
  $error = true;
33
  }
34
+ if ( false === $error ) {
35
+ $opt_val_feature = $_POST[ self::OPT_NAME_FEATURE ];
36
+ $opt_val_subject = $_POST[ self::OPT_NAME_SUBJECT ];
37
+ $opt_val_body = $_POST[ self::OPT_NAME_BODY ];
38
+ if ( isset( $_POST[ self::OPT_NAME_ADMIN ] ) ) {
39
+ $opt_val_admin = $_POST[ self::OPT_NAME_ADMIN ];
40
  } else {
41
  $opt_val_admin = '0';
42
  }
43
+ $siteguard_config->set( self::OPT_NAME_FEATURE, $opt_val_feature );
44
+ $siteguard_config->set( self::OPT_NAME_SUBJECT, $opt_val_subject );
45
+ $siteguard_config->set( self::OPT_NAME_BODY, $opt_val_body );
46
+ $siteguard_config->set( self::OPT_NAME_ADMIN, $opt_val_admin );
47
+ $siteguard_config->update( );
48
  ?>
49
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
50
  <?php
56
  echo '<h2>' . esc_html__( 'Login Alert', 'siteguard' ) . '</h2>';
57
  echo '<div class="siteguard-description">'
58
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
59
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_alert/', 'siteguard' ) )
60
+ . '" target="_blank">'
61
+ . esc_html__( 'here', 'siteguard' )
62
+ . '</a>'
63
+ . esc_html__( '.', 'siteguard' )
64
  . '</div>';
65
  ?>
66
  <form name="form1" method="post" action="">
69
  <th scope="row" colspan="2">
70
  <ul class="siteguard-radios">
71
  <li>
72
+ <input type="radio" name="<?php echo self::OPT_NAME_FEATURE ?>" id="<?php echo self::OPT_NAME_FEATURE.'_on' ?>" value="1" <?php checked( $opt_val_feature, '1' ) ?> >
73
+ <label for="<?php echo self::OPT_NAME_FEATURE.'_on' ?>"><?php echo esc_html_e( 'ON', 'siteguard' ) ?></label>
74
  </li><li>
75
+ <input type="radio" name="<?php echo self::OPT_NAME_FEATURE ?>" id="<?php echo self::OPT_NAME_FEATURE.'_off' ?>" value="0" <?php checked( $opt_val_feature, '0' ) ?> >
76
+ <label for="<?php echo self::OPT_NAME_FEATURE.'_off' ?>"><?php echo esc_html_e( 'OFF', 'siteguard' ) ?></label>
77
  </li>
78
  </ul>
79
  <?php
80
+ $error = siteguard_check_multisite( );
81
  if ( is_wp_error( $error ) ) {
82
  echo '<p class="description">';
83
  echo $error->get_error_message( );
86
  ?>
87
  </th>
88
  </tr><tr>
89
+ <th scope="row"><label for="<?php echo self::OPT_NAME_SUBJECT ?>"><?php esc_html_e( 'Subject', 'siteguard' ); ?></label></th>
90
  <td>
91
+ <input type="text" name="<?php echo self::OPT_NAME_SUBJECT ?>" id="<?php echo self::OPT_NAME_SUBJECT ?>" size="50" value="<?php echo esc_attr( $opt_val_subject ) ?>" >
92
  </td>
93
  </tr><tr>
94
+ <th scope="row"><label for="<?php echo self::OPT_NAME_BODY ?>"><?php esc_html_e( 'Body', 'siteguard' ); ?></label></th>
95
  <td>
96
+ <textarea name="<?php echo self::OPT_NAME_BODY ?>" id="<?php echo self::OPT_NAME_BODY ?>" cols="50" rows="5" ><?php echo esc_textarea( $opt_val_body ) ?></textarea>
97
  </td>
98
  </tr><tr>
99
  <th scope="row"><?php esc_html_e( 'Recipients', 'siteguard' ) ?></th>
100
  <td>
101
+ <input type="checkbox" name="<?php echo self::OPT_NAME_ADMIN ?>" id="<?php echo self::OPT_NAME_ADMIN ?>" value="1" <?php checked( $opt_val_admin, '1' ) ?> >
102
+ <label for="<?php echo self::OPT_NAME_ADMIN ?>"><?php esc_html_e( 'Admin only', 'siteguard' ) ?></label>
103
  </td>
104
  </tr>
105
  </table>
106
  <input type="hidden" name="update" value="Y">
107
  <div class="siteguard-description">
108
+ <?php esc_html_e( 'It is the function to make it easier to notice unauthorized login. E-mail will be sent to a login user when logged in. If you receive an e-mail to there is no logged-in idea, please suspect unauthorized login. The subject and the mail body, the following variables can be used. (Site Name:%SITENAME%, User Name:%USERNAME%, DATE:%DATE%, Time:%TIME%, IP Address:%IPADDRESS%, User-Agent:%USERAGENT%, Referer:%REFERER%) Access by the XML-RPC will not be notified.', 'siteguard' ) ?>
109
  </div>
110
  <hr />
111
  <?php
117
  <?php
118
  }
119
  }
 
 
admin/siteguard-menu-login-history.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once( 'siteguard-login-history-table.php' );
4
+
5
+ class SiteGuard_Menu_Login_History extends SiteGuard_Base {
6
+ protected $wp_list_table;
7
+ function __construct( ) {
8
+ $this->wp_list_table = new SiteGuard_LoginHistory_Table( );
9
+ $this->wp_list_table->prepare_items( );
10
+ $this->render_page( );
11
+ }
12
+ function render_page( ) {
13
+ global $siteguard_config, $siteguard_login_history;
14
+ $img_path = SITEGUARD_URL_PATH . 'images/';
15
+ echo '<div class="wrap">';
16
+ echo '<img src="' . $img_path . 'sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
17
+ echo '<h2>' . esc_html__( 'Login history', 'siteguard' ) . "</h2>\n";
18
+ echo '<div class="siteguard-description">'
19
+ . esc_html__( 'You can find docs about this function on ', 'siteguard' )
20
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_history/', 'siteguard' ) ) . '" target="_blank">' . esc_html__( 'SiteGuard WP Plugin Page', 'siteguard' ) . '</a>' . esc_html__( '.', 'siteguard' ) . '</div>';
21
+ $error = siteguard_check_multisite( );
22
+ if ( is_wp_error( $error ) ) {
23
+ echo '<p class="description">';
24
+ echo $error->get_error_message( );
25
+ echo '</p>';
26
+ }
27
+ ?>
28
+ <form name="form1" method="post" action="">
29
+ <?php $this->wp_list_table->display( ) ?>
30
+ <div class="siteguard-description">
31
+ <?php esc_html_e( 'Login history can be referenced. Let\'s see if there are any suspicious history. History, registered 10,000 maximum, will be removed from those old and more than 10,000.', 'siteguard' ) ?>
32
+ </div>
33
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ) ?>">
34
+ </form>
35
+ </div>
36
+ <?php
37
+ }
38
+ static function clear_cookie( ) {
39
+ setcookie( 'siteguard_log_filter_operation', '', time( ) - 1800, '/' );
40
+ setcookie( 'siteguard_log_filter_type', '', time( ) - 1800, '/' );
41
+ setcookie( 'siteguard_log_filter_login_name', '', time( ) - 1800, '/' );
42
+ setcookie( 'siteguard_log_filter_ip_address', '', time( ) - 1800, '/' );
43
+ setcookie( 'siteguard_log_filter_login_name_not', '', time( ) - 1800, '/' );
44
+ setcookie( 'siteguard_log_filter_ip_address_not', '', time( ) - 1800, '/' );
45
+ }
46
+ static function set_cookie( ) {
47
+ if ( ! isset( $_GET['page'] ) ) {
48
+ return;
49
+ }
50
+ if ( 'siteguard_login_history' !== $_GET['page'] ) {
51
+ return;
52
+ }
53
+
54
+ if ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
55
+ $referer = wp_get_referer( );
56
+ if ( false === strpos( $referer, 'siteguard_login_history' ) ) {
57
+ SiteGuard_Menu_Login_History::clear_cookie( );
58
+ }
59
+ return;
60
+ }
61
+ if ( isset( $_POST['filter_reset'] ) ) {
62
+ SiteGuard_Menu_Login_History::clear_cookie( );
63
+ } else {
64
+ if ( isset( $_POST['filter_operation'] ) ) {
65
+ setcookie( 'siteguard_log_filter_operation', $_POST['filter_operation'], time( ) + 60 * 60, '/' );
66
+ }
67
+ if ( isset( $_POST['filter_type'] ) ) {
68
+ setcookie( 'siteguard_log_filter_type', $_POST['filter_type'], time( ) + 60 * 60, '/' );
69
+ }
70
+ if ( isset( $_POST['filter_login_name'] ) ) {
71
+ setcookie( 'siteguard_log_filter_login_name', $_POST['filter_login_name'], time( ) + 60 * 60, '/' );
72
+ }
73
+ if ( isset( $_POST['filter_ip_address'] ) ) {
74
+ setcookie( 'siteguard_log_filter_ip_address', $_POST['filter_ip_address'], time( ) + 60 * 60, '/' );
75
+ }
76
+ if ( isset( $_POST['filter_login_name_not'] ) ) {
77
+ setcookie( 'siteguard_log_filter_login_name_not', $_POST['filter_login_name_not'], time( ) + 60 * 60, '/' );
78
+ }
79
+ if ( isset( $_POST['filter_ip_address_not'] ) ) {
80
+ setcookie( 'siteguard_log_filter_ip_address_not', $_POST['filter_ip_address_not'], time( ) + 60 * 60, '/' );
81
+ }
82
+ }
83
+
84
+ }
85
+ }
admin/siteguard-menu-login-lock.php CHANGED
@@ -1,68 +1,71 @@
1
  <?php
2
 
3
  class SiteGuard_Menu_Login_Lock extends SiteGuard_Base {
 
 
 
 
 
4
  function __construct( ) {
5
  $this->render_page( );
6
  }
7
  function is_interval_value( $value ) {
8
- if ( '1' == $value || '5' == $value || '30' == $value ) {
 
9
  return true;
10
  }
11
  return false;
12
  }
13
  function is_threshold_value( $value ) {
14
- if ( '3' == $value || '10' == $value || '100' == $value ) {
 
15
  return true;
16
  }
17
  return false;
18
  }
19
  function is_locksec_value( $value ) {
20
- if ( '30' == $value || '60' == $value || '300' == $value ) {
 
21
  return true;
22
  }
23
  return false;
24
  }
25
  function render_page( ) {
26
- global $config;
27
-
28
- $opt_name_enable = 'loginlock_enable';
29
- $opt_name_interval = 'loginlock_interval';
30
- $opt_name_threshold = 'loginlock_threshold';
31
- $opt_name_locksec = 'loginlock_locksec';
32
 
33
- $opt_val_enable = $config->get( $opt_name_enable );
34
- $opt_val_interval = $config->get( $opt_name_interval );
35
- $opt_val_threshold = $config->get( $opt_name_threshold );
36
- $opt_val_locksec = $config->get( $opt_name_locksec );
37
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-login-lock-submit' ) ) {
38
  $error = false;
39
- $errors = check_multisite( );
40
  if ( is_wp_error( $errors ) ) {
41
  echo '<div class="error settings-error"><p><strong>';
42
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
43
  echo '</strong></p></div>';
44
  $error = true;
45
  }
46
- if ( ( false == $error )
47
- && ( ( false == $this->is_switch_value( $_POST[ $opt_name_enable ] ) )
48
- || ( false == $this->is_interval_value( $_POST[ $opt_name_interval ] ) )
49
- || ( false == $this->is_threshold_value( $_POST[ $opt_name_threshold ] ) )
50
- || ( false == $this->is_locksec_value( $_POST[ $opt_name_locksec ] ) ) ) ) {
51
  echo '<div class="error settings-error"><p><strong>';
52
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
53
  echo '</strong></p></div>';
54
  $error = true;
55
  }
56
- if ( false == $error ) {
57
- $opt_val_enable = $_POST[ $opt_name_enable ];
58
- $opt_val_interval = $_POST[ $opt_name_interval ];
59
- $opt_val_threshold = $_POST[ $opt_name_threshold ];
60
- $opt_val_locksec = $_POST[ $opt_name_locksec ];
61
- $config->set( $opt_name_enable, $opt_val_enable );
62
- $config->set( $opt_name_interval, $opt_val_interval );
63
- $config->set( $opt_name_threshold, $opt_val_threshold );
64
- $config->set( $opt_name_locksec, $opt_val_locksec );
65
- $config->update( );
66
  ?>
67
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
68
  <?php
@@ -74,11 +77,11 @@ class SiteGuard_Menu_Login_Lock extends SiteGuard_Base {
74
  echo '<h2>' . esc_html__( 'Login Lock', 'siteguard' ) . '</h2>';
75
  echo '<div class="siteguard-description">'
76
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
77
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_lock_en.html', 'siteguard' )
78
- . '" target="_blank">'
79
- . esc_html__( 'here', 'siteguard' )
80
- . '</a>'
81
- . esc_html__( '.', 'siteguard' )
82
  . '</div>';
83
  ?>
84
  <form name="form1" method="post" action="">
@@ -87,15 +90,15 @@ class SiteGuard_Menu_Login_Lock extends SiteGuard_Base {
87
  <th scope="row" colspan="2">
88
  <ul class="siteguard-radios">
89
  <li>
90
- <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_enable ? 'checked' : '') ?> >
91
- <label for="<?php echo $opt_name_enable.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
92
  </li><li>
93
- <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_enable ? 'checked' : '') ?> >
94
- <label for="<?php echo $opt_name_enable.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
95
  </li>
96
  </ul>
97
  <?php
98
- $error = check_multisite( );
99
  if ( is_wp_error( $error ) ) {
100
  echo '<p class="description">';
101
  echo $error->get_error_message( );
@@ -106,38 +109,38 @@ class SiteGuard_Menu_Login_Lock extends SiteGuard_Base {
106
  </tr><tr>
107
  <th scope="row"><?php esc_html_e( 'Interval', 'siteguard' ); ?></th>
108
  <td>
109
- <input type="radio" name="<?php echo $opt_name_interval ?>" id="<?php echo $opt_name_interval.'_1' ?>" value="1" <?php echo ( '1' == $opt_val_interval ? 'checked' : '') ?> >
110
- <label for="<?php echo $opt_name_interval.'_1' ?>"><?php esc_html_e( '1 second', 'siteguard' ) ?></label>
111
  <br />
112
- <input type="radio" name="<?php echo $opt_name_interval ?>" id="<?php echo $opt_name_interval.'_5' ?>" value="5" <?php echo ( '5' == $opt_val_interval ? 'checked' : '') ?> >
113
- <label for="<?php echo $opt_name_interval.'_5' ?>"><?php esc_html_e( '5 seconds', 'siteguard' ) ?></label>
114
  <br />
115
- <input type="radio" name="<?php echo $opt_name_interval ?>" id="<?php echo $opt_name_interval.'_30' ?>" value="30" <?php echo ( '30' == $opt_val_interval ? 'checked' : '') ?> >
116
- <label for="<?php echo $opt_name_interval.'_30' ?>"><?php esc_html_e( '30 seconds', 'siteguard' ) ?></label>
117
  </td>
118
  </tr><tr>
119
  <th scope="row"><?php esc_html_e( 'Threshold', 'siteguard' ); ?></th>
120
  <td>
121
- <input type="radio" name="<?php echo $opt_name_threshold ?>" id="<?php echo $opt_name_threshold.'_3' ?>" value="3" <?php echo ( '3' == $opt_val_threshold ? 'checked' : '') ?> >
122
- <label for="<?php echo $opt_name_threshold.'_3' ?>"><?php esc_html_e( '3 times', 'siteguard' ) ?></label>
123
  <br />
124
- <input type="radio" name="<?php echo $opt_name_threshold ?>" id="<?php echo $opt_name_threshold.'_10' ?>" value="10" <?php echo ( '10' == $opt_val_threshold ? 'checked' : '') ?> >
125
- <label for="<?php echo $opt_name_threshold.'_10' ?>"><?php esc_html_e( '10 times', 'siteguard' ) ?></label>
126
  <br />
127
- <input type="radio" name="<?php echo $opt_name_threshold ?>" id="<?php echo $opt_name_threshold.'_100' ?>" value="100" <?php echo ( '100' == $opt_val_threshold ? 'checked' : '') ?> >
128
- <label for="<?php echo $opt_name_threshold.'_100' ?>"><?php esc_html_e( '100 times', 'siteguard' ) ?></label>
129
  </td>
130
  </tr><tr>
131
  <th scope="row"><?php esc_html_e( 'Lock Time', 'siteguard' ); ?></th>
132
  <td>
133
- <input type="radio" name="<?php echo $opt_name_locksec ?>" id="<?php echo $opt_name_locksec.'_30' ?>" value="30" <?php echo ( '30' == $opt_val_locksec ? 'checked' : '') ?> >
134
- <label for="<?php echo $opt_name_locksec.'_30' ?>"><?php esc_html_e( '30 seconds', 'siteguard' ) ?></label>
135
  <br />
136
- <input type="radio" name="<?php echo $opt_name_locksec ?>" id="<?php echo $opt_name_locksec.'_60' ?>" value="60" <?php echo ( '60' == $opt_val_locksec ? 'checked' : '') ?> >
137
- <label for="<?php echo $opt_name_locksec.'_60' ?>"><?php esc_html_e( '1 minute', 'siteguard' ) ?></label>
138
  <br />
139
- <input type="radio" name="<?php echo $opt_name_locksec ?>" id="<?php echo $opt_name_locksec.'_300' ?>" value="300" <?php echo ( '300' == $opt_val_locksec ? 'checked' : '') ?> >
140
- <label for="<?php echo $opt_name_locksec.'_300' ?>"><?php esc_html_e( '5 minutes', 'siteguard' ) ?></label>
141
  </td>
142
  </tr>
143
  </table>
@@ -158,4 +161,3 @@ class SiteGuard_Menu_Login_Lock extends SiteGuard_Base {
158
  <?php
159
  }
160
  }
161
- ?>
1
  <?php
2
 
3
  class SiteGuard_Menu_Login_Lock extends SiteGuard_Base {
4
+ const OPT_NAME_ENABLE = 'loginlock_enable';
5
+ const OPT_NAME_INTERVAL = 'loginlock_interval';
6
+ const OPT_NAME_THRESHOLD = 'loginlock_threshold';
7
+ const OPT_NAME_LOCKSEC = 'loginlock_locksec';
8
+
9
  function __construct( ) {
10
  $this->render_page( );
11
  }
12
  function is_interval_value( $value ) {
13
+ $items = array( '1', '5', '30' );
14
+ if ( in_array( $value, $items ) ) {
15
  return true;
16
  }
17
  return false;
18
  }
19
  function is_threshold_value( $value ) {
20
+ $items = array( '3', '10', '100' );
21
+ if ( in_array( $value, $items ) ) {
22
  return true;
23
  }
24
  return false;
25
  }
26
  function is_locksec_value( $value ) {
27
+ $items = array( '30', '60', '300' );
28
+ if ( in_array( $value, $items ) ) {
29
  return true;
30
  }
31
  return false;
32
  }
33
  function render_page( ) {
34
+ global $siteguard_config;
 
 
 
 
 
35
 
36
+ $opt_val_enable = $siteguard_config->get( self::OPT_NAME_ENABLE );
37
+ $opt_val_interval = $siteguard_config->get( self::OPT_NAME_INTERVAL );
38
+ $opt_val_threshold = $siteguard_config->get( self::OPT_NAME_THRESHOLD );
39
+ $opt_val_locksec = $siteguard_config->get( self::OPT_NAME_LOCKSEC );
40
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-login-lock-submit' ) ) {
41
  $error = false;
42
+ $errors = siteguard_check_multisite( );
43
  if ( is_wp_error( $errors ) ) {
44
  echo '<div class="error settings-error"><p><strong>';
45
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
46
  echo '</strong></p></div>';
47
  $error = true;
48
  }
49
+ if ( ( false === $error )
50
+ && ( ( false === $this->is_switch_value( $_POST[ self::OPT_NAME_ENABLE ] ) )
51
+ || ( false === $this->is_interval_value( $_POST[ self::OPT_NAME_INTERVAL ] ) )
52
+ || ( false === $this->is_threshold_value( $_POST[ self::OPT_NAME_THRESHOLD ] ) )
53
+ || ( false === $this->is_locksec_value( $_POST[ self::OPT_NAME_LOCKSEC ] ) ) ) ) {
54
  echo '<div class="error settings-error"><p><strong>';
55
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
56
  echo '</strong></p></div>';
57
  $error = true;
58
  }
59
+ if ( false === $error ) {
60
+ $opt_val_enable = $_POST[ self::OPT_NAME_ENABLE ];
61
+ $opt_val_interval = $_POST[ self::OPT_NAME_INTERVAL ];
62
+ $opt_val_threshold = $_POST[ self::OPT_NAME_THRESHOLD ];
63
+ $opt_val_locksec = $_POST[ self::OPT_NAME_LOCKSEC ];
64
+ $siteguard_config->set( self::OPT_NAME_ENABLE, $opt_val_enable );
65
+ $siteguard_config->set( self::OPT_NAME_INTERVAL, $opt_val_interval );
66
+ $siteguard_config->set( self::OPT_NAME_THRESHOLD, $opt_val_threshold );
67
+ $siteguard_config->set( self::OPT_NAME_LOCKSEC, $opt_val_locksec );
68
+ $siteguard_config->update( );
69
  ?>
70
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
71
  <?php
77
  echo '<h2>' . esc_html__( 'Login Lock', 'siteguard' ) . '</h2>';
78
  echo '<div class="siteguard-description">'
79
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
80
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_lock/', 'siteguard' ) )
81
+ . '" target="_blank">'
82
+ . esc_html__( 'here', 'siteguard' )
83
+ . '</a>'
84
+ . esc_html__( '.', 'siteguard' )
85
  . '</div>';
86
  ?>
87
  <form name="form1" method="post" action="">
90
  <th scope="row" colspan="2">
91
  <ul class="siteguard-radios">
92
  <li>
93
+ <input type="radio" name="<?php echo self::OPT_NAME_ENABLE ?>" id="<?php echo self::OPT_NAME_ENABLE.'_on' ?>" value="1" <?php checked( $opt_val_enable, '1' ) ?> >
94
+ <label for="<?php echo self::OPT_NAME_ENABLE.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
95
  </li><li>
96
+ <input type="radio" name="<?php echo self::OPT_NAME_ENABLE ?>" id="<?php echo self::OPT_NAME_ENABLE.'_off' ?>" value="0" <?php checked( $opt_val_enable, '0' ) ?> >
97
+ <label for="<?php echo self::OPT_NAME_ENABLE.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
98
  </li>
99
  </ul>
100
  <?php
101
+ $error = siteguard_check_multisite( );
102
  if ( is_wp_error( $error ) ) {
103
  echo '<p class="description">';
104
  echo $error->get_error_message( );
109
  </tr><tr>
110
  <th scope="row"><?php esc_html_e( 'Interval', 'siteguard' ); ?></th>
111
  <td>
112
+ <input type="radio" name="<?php echo self::OPT_NAME_INTERVAL ?>" id="<?php echo self::OPT_NAME_INTERVAL.'_1' ?>" value="1" <?php checked( $opt_val_interval, '1' ) ?> >
113
+ <label for="<?php echo self::OPT_NAME_INTERVAL.'_1' ?>"><?php esc_html_e( '1 second', 'siteguard' ) ?></label>
114
  <br />
115
+ <input type="radio" name="<?php echo self::OPT_NAME_INTERVAL ?>" id="<?php echo self::OPT_NAME_INTERVAL.'_5' ?>" value="5" <?php checked( $opt_val_interval, '5' ) ?> >
116
+ <label for="<?php echo self::OPT_NAME_INTERVAL.'_5' ?>"><?php esc_html_e( '5 seconds', 'siteguard' ) ?></label>
117
  <br />
118
+ <input type="radio" name="<?php echo self::OPT_NAME_INTERVAL ?>" id="<?php echo self::OPT_NAME_INTERVAL.'_30' ?>" value="30" <?php checked( $opt_val_interval, '30' ) ?> >
119
+ <label for="<?php echo self::OPT_NAME_INTERVAL.'_30' ?>"><?php esc_html_e( '30 seconds', 'siteguard' ) ?></label>
120
  </td>
121
  </tr><tr>
122
  <th scope="row"><?php esc_html_e( 'Threshold', 'siteguard' ); ?></th>
123
  <td>
124
+ <input type="radio" name="<?php echo self::OPT_NAME_THRESHOLD ?>" id="<?php echo self::OPT_NAME_THRESHOLD.'_3' ?>" value="3" <?php checked( $opt_val_threshold, '3' ) ?> >
125
+ <label for="<?php echo self::OPT_NAME_THRESHOLD.'_3' ?>"><?php esc_html_e( '3 times', 'siteguard' ) ?></label>
126
  <br />
127
+ <input type="radio" name="<?php echo self::OPT_NAME_THRESHOLD ?>" id="<?php echo self::OPT_NAME_THRESHOLD.'_10' ?>" value="10" <?php checked( $opt_val_threshold, '10' ) ?> >
128
+ <label for="<?php echo self::OPT_NAME_THRESHOLD.'_10' ?>"><?php esc_html_e( '10 times', 'siteguard' ) ?></label>
129
  <br />
130
+ <input type="radio" name="<?php echo self::OPT_NAME_THRESHOLD ?>" id="<?php echo self::OPT_NAME_THRESHOLD.'_100' ?>" value="100" <?php checked( $opt_val_threshold, '100' ) ?> >
131
+ <label for="<?php echo self::OPT_NAME_THRESHOLD.'_100' ?>"><?php esc_html_e( '100 times', 'siteguard' ) ?></label>
132
  </td>
133
  </tr><tr>
134
  <th scope="row"><?php esc_html_e( 'Lock Time', 'siteguard' ); ?></th>
135
  <td>
136
+ <input type="radio" name="<?php echo self::OPT_NAME_LOCKSEC ?>" id="<?php echo self::OPT_NAME_LOCKSEC.'_30' ?>" value="30" <?php checked( $opt_val_locksec, '30' ) ?> >
137
+ <label for="<?php echo self::OPT_NAME_LOCKSEC.'_30' ?>"><?php esc_html_e( '30 seconds', 'siteguard' ) ?></label>
138
  <br />
139
+ <input type="radio" name="<?php echo self::OPT_NAME_LOCKSEC ?>" id="<?php echo self::OPT_NAME_LOCKSEC.'_60' ?>" value="60" <?php checked( $opt_val_locksec, '60' ) ?> >
140
+ <label for="<?php echo self::OPT_NAME_LOCKSEC.'_60' ?>"><?php esc_html_e( '1 minute', 'siteguard' ) ?></label>
141
  <br />
142
+ <input type="radio" name="<?php echo self::OPT_NAME_LOCKSEC ?>" id="<?php echo self::OPT_NAME_LOCKSEC.'_300' ?>" value="300" <?php checked( $opt_val_locksec, '300' ) ?> >
143
+ <label for="<?php echo self::OPT_NAME_LOCKSEC.'_300' ?>"><?php esc_html_e( '5 minutes', 'siteguard' ) ?></label>
144
  </td>
145
  </tr>
146
  </table>
161
  <?php
162
  }
163
  }
 
admin/siteguard-menu-protect-xmlrpc.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SiteGuard_Menu_Protect_XMLRPC extends SiteGuard_Base {
4
+ const OPT_NAME_FEATURE = 'protect_xmlrpc_enable';
5
+ const OPT_NAME_TYPE = 'protect_xmlrpc_type';
6
+ const OPT_NAME_XMLRPC = 'disable_xmlrpc_enable';
7
+ const OPT_NAME_PINGBACK = 'disable_pingback_enable';
8
+
9
+ protected $opt_val_xmlrpc;
10
+ protected $opt_val_pingback;
11
+ protected $opt_val_feature;
12
+ protected $opt_val_type;
13
+
14
+ function __construct( ) {
15
+ $this->render_page( );
16
+ }
17
+ function is_switch_value( $value ) {
18
+ $items = array( '0', '1' );
19
+ if ( in_array( $value, $items ) ) {
20
+ return true;
21
+ }
22
+ return false;
23
+ }
24
+ function db_to_page( ) {
25
+ if ( '0' === $this->opt_val_xmlrpc ) {
26
+ if ( '0' === $this->opt_val_pingback ) {
27
+ $this->opt_val_feature = '0';
28
+ $this->opt_val_type = '0';
29
+ } else {
30
+ $this->opt_val_feature = '1';
31
+ $this->opt_val_type = '0';
32
+ }
33
+ } else {
34
+ $this->opt_val_feature = '1';
35
+ $this->opt_val_type = '1';
36
+ }
37
+ }
38
+ function page_to_db( ) {
39
+ if ( '0' === $this->opt_val_feature ) {
40
+ $this->opt_val_xmlrpc = '0';
41
+ $this->opt_val_pingback = '0';
42
+ } else {
43
+ if ( '0' === $this->opt_val_type ) {
44
+ $this->opt_val_xmlrpc = '0';
45
+ $this->opt_val_pingback = '1';
46
+ } else {
47
+ $this->opt_val_xmlrpc = '1';
48
+ $this->opt_val_pingback = '0';
49
+ }
50
+ }
51
+ }
52
+ function render_page( ) {
53
+ global $siteguard_config, $siteguard_xmlrpc;
54
+
55
+ $this->opt_val_xmlrpc = $siteguard_config->get( self::OPT_NAME_XMLRPC );
56
+ $this->opt_val_pingback = $siteguard_config->get( self::OPT_NAME_PINGBACK );
57
+
58
+ $this->db_to_page( );
59
+
60
+ if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-protect-xmlrpc-submit' ) ) {
61
+ $error = false;
62
+ $errors = siteguard_check_multisite( );
63
+ if ( is_wp_error( $errors ) ) {
64
+ echo '<div class="error settings-error"><p><strong>';
65
+ esc_html_e( $errors->get_error_message( ), 'siteguard' );
66
+ echo '</strong></p></div>';
67
+ $error = true;
68
+ }
69
+ if ( false === $error
70
+ && ( ( false === $this->is_switch_value( $_POST[ self::OPT_NAME_FEATURE ] ) )
71
+ || ( false === $this->is_switch_value( $_POST[ self::OPT_NAME_TYPE ] ) ) ) ) {
72
+ echo '<div class="error settings-error"><p><strong>';
73
+ esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
74
+ echo '</strong></p></div>';
75
+ $error = true;
76
+ }
77
+ if ( false === $error
78
+ && '1' === $_POST[ self::OPT_NAME_FEATURE ]
79
+ && '1' === $_POST[ self::OPT_NAME_TYPE ]
80
+ && false === SiteGuard_Htaccess::test_htaccess( ) ) {
81
+ echo '<div class="error settings-error"><p><strong>';
82
+ esc_html_e( 'mod_rewrite of .htaccess can not be used', 'siteguard' );
83
+ echo '</strong></p></div>';
84
+ $error = true;
85
+ }
86
+ if ( false === $error ) {
87
+ $old_opt_val_feature = $this->opt_val_feature;
88
+ $old_opt_val_type = $this->opt_val_type;
89
+ $this->opt_val_feature = $_POST[ self::OPT_NAME_FEATURE ];
90
+ $this->opt_val_type = $_POST[ self::OPT_NAME_TYPE ];
91
+ $this->page_to_db( );
92
+ $siteguard_config->set( self::OPT_NAME_XMLRPC, $this->opt_val_xmlrpc );
93
+ $siteguard_config->set( self::OPT_NAME_PINGBACK, $this->opt_val_pingback );
94
+ $siteguard_config->update( );
95
+ $result = true;
96
+ if ( '0' === $this->opt_val_xmlrpc ) {
97
+ $result = $siteguard_xmlrpc->feature_off( );
98
+ } else {
99
+ $result = $siteguard_xmlrpc->feature_on( );
100
+ }
101
+ if ( true === $result ) {
102
+ ?>
103
+ <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
104
+ <?php
105
+ } else {
106
+ $this->opt_val_feature = $old_opt_val_feature;
107
+ $this->opt_val_val_type = $old_opt_val_type;
108
+ $this->page_to_db( );
109
+ $siteguard_config->set( self::OPT_NAME_XMLRPC, $this->opt_val_xmlrpc );
110
+ $siteguard_config->set( self::OPT_NAME_PINGBACK, $this->opt_val_pingback );
111
+ $siteguard_config->update( );
112
+ echo '<div class="error settings-error"><p><strong>';
113
+ esc_html_e( 'ERROR: Failed to .htaccess update.', 'siteguard' );
114
+ echo '</strong></p></div>';
115
+ }
116
+ }
117
+ }
118
+
119
+ echo '<div class="wrap">';
120
+ echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
121
+ echo '<h2>' . esc_html__( 'Protect XMLRPC', 'siteguard' ) . '</h2>';
122
+ echo '<div class="siteguard-description">'
123
+ . esc_html__( 'You can find docs about this function on ', 'siteguard' )
124
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/xmlrpc/', 'siteguard' ) )
125
+ . '" target="_blank">'
126
+ . esc_html__( 'here', 'siteguard' )
127
+ . '</a>'
128
+ . esc_html__( '.', 'siteguard' )
129
+ . '</div>';
130
+ ?>
131
+ <form name="form1" method="post" action="">
132
+
133
+ <table class="form-table">
134
+ <tr>
135
+ <th scope="row" colspan="2">
136
+ <ul class="siteguard-radios">
137
+ <li>
138
+ <input type="radio" name="<?php echo self::OPT_NAME_FEATURE ?>" id="<?php echo self::OPT_NAME_FEATURE.'_on' ?>" value="1" <?php checked( $this->opt_val_feature, '1' ) ?> >
139
+ <label for="<?php echo self::OPT_NAME_FEATURE.'_on' ?>"><?php echo esc_html_e( 'ON', 'siteguard' ) ?></label>
140
+ </li><li>
141
+ <input type="radio" name="<?php echo self::OPT_NAME_FEATURE ?>" id="<?php echo self::OPT_NAME_FEATURE.'_off' ?>" value="0" <?php checked( $this->opt_val_feature, '0' ) ?> >
142
+ <label for="<?php echo self::OPT_NAME_FEATURE.'_off' ?>"><?php echo esc_html_e( 'OFF', 'siteguard' ) ?></label>
143
+ </li>
144
+ </ul>
145
+ <?php
146
+ $error = siteguard_check_multisite( );
147
+ if ( is_wp_error( $error ) ) {
148
+ echo '<p class="description">';
149
+ echo $error->get_error_message( );
150
+ echo '</p>';
151
+ }
152
+ ?>
153
+ </th>
154
+ </tr><tr>
155
+ <th scope="row"><?php esc_html_e( 'Type', 'siteguard' ); ?></th>
156
+ <td>
157
+ <input type="radio" name="<?php echo self::OPT_NAME_TYPE ?>" id="<?php echo self::OPT_NAME_TYPE.'_0' ?>" value="0" <?php checked( $this->opt_val_type, '0' ) ?> >
158
+ <label for="<?php echo self::OPT_NAME_TYPE.'_0' ?>"><?php esc_html_e( 'Disable Pingback', 'siteguard' ) ?></label>
159
+ <br />
160
+ <input type="radio" name="<?php echo self::OPT_NAME_TYPE ?>" id="<?php echo self::OPT_NAME_TYPE.'_1' ?>" value="1" <?php checked( $this->opt_val_type, '1' ) ?> >
161
+ <label for="<?php echo self::OPT_NAME_TYPE.'_1' ?>"><?php esc_html_e( 'Disable XMLRPC', 'siteguard' ) ?></label>
162
+ </td>
163
+ </tr>
164
+ </table>
165
+ <input type="hidden" name="update" value="Y">
166
+ <div class="siteguard-description">
167
+ <?php esc_html_e( 'To disable the Pingback, or disable the entire XMLRPC ( xmlrpc.php ), to prevent abuse. When you disable the whole XMLRPC, you will not be able to use plug-ins and apps that use XMLRPC. If there is trouble, please do not use this function.', 'siteguard' ) ?>
168
+ </div>
169
+ <hr />
170
+ <?php
171
+ wp_nonce_field( 'siteguard-menu-protect-xmlrpc-submit' );
172
+ submit_button( );
173
+ ?>
174
+ </form>
175
+ </div>
176
+ <?php
177
+ }
178
+ }
admin/siteguard-menu-rename-login.php CHANGED
@@ -1,85 +1,107 @@
1
  <?php
2
 
3
  class SiteGuard_Menu_Rename_Login extends SiteGuard_Base {
 
 
 
4
  function __construct( ) {
5
  $this->render_page( );
6
  }
7
  function render_page( ) {
8
- global $rename_login, $config;
9
-
10
- $opt_name_feature = 'renamelogin_enable';
11
- $opt_name_rename_login_path = 'renamelogin_path';
12
 
13
- $opt_val_feature = $config->get( $opt_name_feature );
14
- $opt_val_rename_login_path = $config->get( $opt_name_rename_login_path );
15
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-rename-login-submit' ) ) {
16
  $error = false;
17
- $errors = check_multisite( );
18
  if ( is_wp_error( $errors ) ) {
19
  echo '<div class="error settings-error"><p><strong>';
20
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
21
  echo '</strong></p></div>';
22
  $error = true;
23
  }
24
- if ( false == $error && '1' == $_POST[ $opt_name_feature ] && false == $this->check_module( 'rewrite' ) ) {
25
  echo '<div class="error settings-error"><p><strong>';
26
  esc_html_e( 'To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard' );
27
  echo '</strong></p></div>';
28
  $error = true;
29
- $config->set( $opt_name_feature, '0' );
30
- $config->update( );
31
- $rename_login->feature_off( );
32
  $opt_val_feature = '0';
33
  }
34
- if ( false == $error && false == $this->is_switch_value( $_POST[ $opt_name_feature ] ) ) {
35
  echo '<div class="error settings-error"><p><strong>';
36
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
37
  echo '</strong></p></div>';
38
  $error = true;
39
  }
40
- if ( false == $error && '1' == $_POST[ $opt_name_feature ] ) {
41
- $incompatible_plugin = $rename_login->get_active_incompatible_plugin( );
42
- if ( null != $incompatible_plugin ) {
43
  echo '<div class="error settings-error"><p><strong>';
44
- echo esc_html__( 'This function and Plugin "', 'siteguard' ) . $incompatible_plugin . esc_html__( '" cannot be used at the same time.', 'siteguard' );
45
  echo '</strong></p></div>';
46
  $error = true;
47
- $config->set( $opt_name_feature, '0' );
48
- $config->update( );
49
- $rename_login->feature_off( );
50
  $opt_val_feature = '0';
51
- $opt_val_rename_login_path = stripslashes( $_POST[ $opt_name_rename_login_path ] );
52
  }
53
  }
54
- if ( false == $error && 1 != preg_match( '/^[a-zA-Z0-9_-]+$/', $_POST[ $opt_name_rename_login_path ] ) ) {
55
  echo '<div class="error settings-error"><p><strong>';
56
  esc_html_e( 'It is only an alphanumeric character, a hyphen, and an underbar that can be used for New Login Path.', 'siteguard' );
57
  echo '</strong></p></div>';
58
- $opt_val_rename_login_path = stripslashes( $_POST[ $opt_name_rename_login_path ] );
59
  $error = true;
60
  }
61
- if ( false == $error && 1 == preg_match( '/^(wp-admin|wp-login$|login$)/', $_POST[ $opt_name_rename_login_path ], $matches ) ) {
62
  echo '<div class="error settings-error"><p><strong>';
63
  echo esc_html( $matches[0] ) . esc_html__( ' can not be used for New Login Path.', 'siteguard' );
64
  echo '</strong></p></div>';
65
- $opt_val_rename_login_path = stripslashes( $_POST[ $opt_name_rename_login_path ] );
 
 
 
 
 
 
66
  $error = true;
67
  }
68
- if ( false == $error ) {
69
- $opt_val_feature = $_POST[ $opt_name_feature ];
70
- $opt_val_rename_login_path = $_POST[ $opt_name_rename_login_path ];
71
- $config->set( $opt_name_feature, $opt_val_feature );
72
- $config->set( $opt_name_rename_login_path, $opt_val_rename_login_path );
73
- $config->update( );
74
- if ( '0' == $opt_val_feature ) {
75
- $rename_login->feature_off( );
 
 
 
76
  } else {
77
- $rename_login->feature_on( );
78
- $rename_login->send_notify( );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
- ?>
81
- <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
82
- <?php
83
  }
84
  }
85
 
@@ -88,11 +110,11 @@ class SiteGuard_Menu_Rename_Login extends SiteGuard_Base {
88
  echo '<h2>' . esc_html__( 'Rename Login', 'siteguard' ) . '</h2>';
89
  echo '<div class="siteguard-description">'
90
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
91
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/rename_login_en.html', 'siteguard' )
92
- . '" target="_blank">'
93
- . esc_html__( 'here', 'siteguard' )
94
- . '</a>'
95
- . esc_html__( '.', 'siteguard' )
96
  . '</div>';
97
  ?>
98
  <form name="form1" method="post" action="">
@@ -101,15 +123,15 @@ class SiteGuard_Menu_Rename_Login extends SiteGuard_Base {
101
  <th scope="row" colspan="2">
102
  <ul class="siteguard-radios">
103
  <li>
104
- <input type="radio" name="<?php echo $opt_name_feature ?>" id="<?php echo $opt_name_feature.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_feature ? 'checked' : '') ?> >
105
- <label for="<?php echo $opt_name_feature.'_on' ?>"><?php echo esc_html_e( 'ON', 'siteguard' ) ?></label>
106
  </li><li>
107
- <input type="radio" name="<?php echo $opt_name_feature ?>" id="<?php echo $opt_name_feature.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_feature ? 'checked' : '') ?> >
108
- <label for="<?php echo $opt_name_feature.'_off' ?>"><?php echo esc_html_e( 'OFF', 'siteguard' ) ?></label>
109
  </li>
110
  </ul>
111
  <?php
112
- $error = check_multisite( );
113
  if ( is_wp_error( $error ) ) {
114
  echo '<p class="description">';
115
  echo $error->get_error_message( );
@@ -121,9 +143,9 @@ class SiteGuard_Menu_Rename_Login extends SiteGuard_Base {
121
  ?>
122
  </th>
123
  </tr><tr>
124
- <th scope="row"><label for="<?php echo $opt_name_rename_login_path ?>"><?php esc_html_e( 'New Login Path', 'siteguard' ); ?></label></th>
125
  <td>
126
- <?php echo site_url() . '/' ?><input type="text" name="<?php echo $opt_name_rename_login_path ?>" id="<?php echo $opt_name_rename_login_path ?>" value="<?php echo esc_attr( $opt_val_rename_login_path ) ?>" >
127
  <?php
128
  echo '<p class="description">';
129
  esc_html_e( 'An alphanumeric character, a hyphen, and an underbar can be used.', 'siteguard' );
@@ -134,7 +156,7 @@ class SiteGuard_Menu_Rename_Login extends SiteGuard_Base {
134
  </table>
135
  <input type="hidden" name="update" value="Y">
136
  <div class="siteguard-description">
137
- <?php esc_html_e( 'It is the function to decrease the vulnerability against an illegal login attempt attack such as a brute force attack or a password list attack. The login page name (wp-login.php) is changed. The initial value is “login_&lt;5 random digits&gt;” but it can be changed to a favorite name.', 'siteguard' ) ?>
138
  </div>
139
  <hr />
140
  <?php
@@ -146,5 +168,3 @@ class SiteGuard_Menu_Rename_Login extends SiteGuard_Base {
146
  <?php
147
  }
148
  }
149
-
150
- ?>
1
  <?php
2
 
3
  class SiteGuard_Menu_Rename_Login extends SiteGuard_Base {
4
+ const OPT_NAME_FEATURE = 'renamelogin_enable';
5
+ const OPT_NAME_RENAME_LOGIN_PATH = 'renamelogin_path';
6
+
7
  function __construct( ) {
8
  $this->render_page( );
9
  }
10
  function render_page( ) {
11
+ global $siteguard_rename_login, $siteguard_config;
 
 
 
12
 
13
+ $opt_val_feature = $siteguard_config->get( self::OPT_NAME_FEATURE );
14
+ $opt_val_rename_login_path = $siteguard_config->get( self::OPT_NAME_RENAME_LOGIN_PATH );
15
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-rename-login-submit' ) ) {
16
  $error = false;
17
+ $errors = siteguard_check_multisite( );
18
  if ( is_wp_error( $errors ) ) {
19
  echo '<div class="error settings-error"><p><strong>';
20
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
21
  echo '</strong></p></div>';
22
  $error = true;
23
  }
24
+ if ( false === $error && '1' === $_POST[ self::OPT_NAME_FEATURE ] && false === $this->check_module( 'rewrite' ) ) {
25
  echo '<div class="error settings-error"><p><strong>';
26
  esc_html_e( 'To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard' );
27
  echo '</strong></p></div>';
28
  $error = true;
29
+ $siteguard_config->set( self::OPT_NAME_FEATURE, '0' );
30
+ $siteguard_config->update( );
31
+ $siteguard_rename_login->feature_off( );
32
  $opt_val_feature = '0';
33
  }
34
+ if ( false === $error && false === $this->is_switch_value( $_POST[ self::OPT_NAME_FEATURE ] ) ) {
35
  echo '<div class="error settings-error"><p><strong>';
36
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
37
  echo '</strong></p></div>';
38
  $error = true;
39
  }
40
+ if ( false === $error && '1' === $_POST[ self::OPT_NAME_FEATURE ] ) {
41
+ $incompatible_plugins = $siteguard_rename_login->get_active_incompatible_plugins( );
42
+ if ( null !== $incompatible_plugins ) {
43
  echo '<div class="error settings-error"><p><strong>';
44
+ echo esc_html__( 'This function and Plugin "', 'siteguard' ) . esc_html__( implode( ', ', $incompatible_plugins ) ) . esc_html__( '" cannot be used at the same time.', 'siteguard' );
45
  echo '</strong></p></div>';
46
  $error = true;
47
+ $siteguard_config->set( self::OPT_NAME_FEATURE, '0' );
48
+ $siteguard_config->update( );
49
+ $siteguard_rename_login->feature_off( );
50
  $opt_val_feature = '0';
51
+ $opt_val_rename_login_path = stripslashes( $_POST[ self::OPT_NAME_RENAME_LOGIN_PATH ] );
52
  }
53
  }
54
+ if ( false === $error && 1 != preg_match( '/^[a-zA-Z0-9_-]+$/', $_POST[ self::OPT_NAME_RENAME_LOGIN_PATH ] ) ) {
55
  echo '<div class="error settings-error"><p><strong>';
56
  esc_html_e( 'It is only an alphanumeric character, a hyphen, and an underbar that can be used for New Login Path.', 'siteguard' );
57
  echo '</strong></p></div>';
58
+ $opt_val_rename_login_path = stripslashes( $_POST[ self::OPT_NAME_RENAME_LOGIN_PATH ] );
59
  $error = true;
60
  }
61
+ if ( false === $error && 1 === preg_match( '/^(wp-admin|wp-content|wp-includes|wp-login$|login$)/', $_POST[ self::OPT_NAME_RENAME_LOGIN_PATH ], $matches ) ) {
62
  echo '<div class="error settings-error"><p><strong>';
63
  echo esc_html( $matches[0] ) . esc_html__( ' can not be used for New Login Path.', 'siteguard' );
64
  echo '</strong></p></div>';
65
+ $opt_val_rename_login_path = stripslashes( $_POST[ self::OPT_NAME_RENAME_LOGIN_PATH ] );
66
+ $error = true;
67
+ }
68
+ if ( false === $error && '1' === $_POST[ self::OPT_NAME_FEATURE ] && false === SiteGuard_Htaccess::test_htaccess( ) ) {
69
+ echo '<div class="error settings-error"><p><strong>';
70
+ esc_html_e( 'mod_rewrite of .htaccess can not be used', 'siteguard' );
71
+ echo '</strong></p></div>';
72
  $error = true;
73
  }
74
+ if ( false === $error ) {
75
+ $old_opt_val_feature = $opt_val_feature;
76
+ $old_opt_val_rename_login_path = $opt_val_rename_login_path;
77
+ $opt_val_feature = $_POST[ self::OPT_NAME_FEATURE ];
78
+ $opt_val_rename_login_path = $_POST[ self::OPT_NAME_RENAME_LOGIN_PATH ];
79
+ $siteguard_config->set( self::OPT_NAME_FEATURE, $opt_val_feature );
80
+ $siteguard_config->set( self::OPT_NAME_RENAME_LOGIN_PATH, $opt_val_rename_login_path );
81
+ $siteguard_config->update( );
82
+ $result = true;
83
+ if ( '0' === $opt_val_feature ) {
84
+ $result = $siteguard_rename_login->feature_off( );
85
  } else {
86
+ $result = $siteguard_rename_login->feature_on( );
87
+ if ( true === $result ) {
88
+ $siteguard_rename_login->send_notify( );
89
+ }
90
+ }
91
+ if ( true === $result ) {
92
+ ?>
93
+ <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
94
+ <?php
95
+ } else {
96
+ $siteguard_config->set( self::OPT_NAME_FEATURE, $old_opt_val_feature );
97
+ $siteguard_config->set( self::OPT_NAME_RENAME_LOGIN_PATH, $old_opt_val_rename_login_path );
98
+ $siteguard_config->update( );
99
+ $opt_val_feature = $old_opt_val_feature;
100
+ $opt_val_val_rename_login_path = $old_opt_val_rename_login_path;
101
+ echo '<div class="error settings-error"><p><strong>';
102
+ esc_html_e( 'ERROR: Failed to .htaccess update.', 'siteguard' );
103
+ echo '</strong></p></div>';
104
  }
 
 
 
105
  }
106
  }
107
 
110
  echo '<h2>' . esc_html__( 'Rename Login', 'siteguard' ) . '</h2>';
111
  echo '<div class="siteguard-description">'
112
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
113
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/rename_login/', 'siteguard' ) )
114
+ . '" target="_blank">'
115
+ . esc_html__( 'here', 'siteguard' )
116
+ . '</a>'
117
+ . esc_html__( '.', 'siteguard' )
118
  . '</div>';
119
  ?>
120
  <form name="form1" method="post" action="">
123
  <th scope="row" colspan="2">
124
  <ul class="siteguard-radios">
125
  <li>
126
+ <input type="radio" name="<?php echo self::OPT_NAME_FEATURE ?>" id="<?php echo self::OPT_NAME_FEATURE.'_on' ?>" value="1" <?php checked( $opt_val_feature, '1' ) ?> >
127
+ <label for="<?php echo self::OPT_NAME_FEATURE.'_on' ?>"><?php echo esc_html_e( 'ON', 'siteguard' ) ?></label>
128
  </li><li>
129
+ <input type="radio" name="<?php echo self::OPT_NAME_FEATURE ?>" id="<?php echo self::OPT_NAME_FEATURE.'_off' ?>" value="0" <?php checked( $opt_val_feature, '0' ) ?> >
130
+ <label for="<?php echo self::OPT_NAME_FEATURE.'_off' ?>"><?php echo esc_html_e( 'OFF', 'siteguard' ) ?></label>
131
  </li>
132
  </ul>
133
  <?php
134
+ $error = siteguard_check_multisite( );
135
  if ( is_wp_error( $error ) ) {
136
  echo '<p class="description">';
137
  echo $error->get_error_message( );
143
  ?>
144
  </th>
145
  </tr><tr>
146
+ <th scope="row"><label for="<?php echo self::OPT_NAME_RENAME_LOGIN_PATH ?>"><?php esc_html_e( 'New Login Path', 'siteguard' ); ?></label></th>
147
  <td>
148
+ <?php echo site_url() . '/' ?><input type="text" name="<?php echo self::OPT_NAME_RENAME_LOGIN_PATH ?>" id="<?php echo self::OPT_NAME_RENAME_LOGIN_PATH ?>" value="<?php echo esc_attr( $opt_val_rename_login_path ) ?>" >
149
  <?php
150
  echo '<p class="description">';
151
  esc_html_e( 'An alphanumeric character, a hyphen, and an underbar can be used.', 'siteguard' );
156
  </table>
157
  <input type="hidden" name="update" value="Y">
158
  <div class="siteguard-description">
159
+ <?php esc_html_e( 'It is the function to decrease the vulnerability against an illegal login attempt attack such as a brute force attack or a password list attack. The login page name (wp-login.php) is changed. The initial value is “login_&lt;5 random digits&gt;” but it can be changed to a favorite name.', 'siteguard' ) ?>
160
  </div>
161
  <hr />
162
  <?php
168
  <?php
169
  }
170
  }
 
 
admin/siteguard-menu-same-error.php CHANGED
@@ -1,43 +1,43 @@
1
  <?php
2
 
3
  class SiteGuard_Menu_Same_Error extends SiteGuard_Base {
 
 
4
  function __construct( ) {
5
  $this->render_page( );
6
  }
7
  function render_page( ) {
8
- global $config, $captcha;
9
-
10
- $opt_name_enable = 'same_login_error';
11
 
12
- $opt_val_enable = $config->get( $opt_name_enable );
13
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-same-error-submit' ) ) {
14
  $error = false;
15
- $errors = check_multisite( );
16
  if ( is_wp_error( $errors ) ) {
17
  echo '<div class="error settings-error"><p><strong>';
18
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
19
  echo '</strong></p></div>';
20
  $error = true;
21
  }
22
- if ( false == $error && '1' == $_POST[ $opt_name_enable ] ) {
23
- $ret = $captcha->check_requirements( );
24
  if ( is_wp_error( $ret ) ) {
25
  echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message( ) . '</strong></p></div>';
26
  $error = true;
27
- $config->set( $opt_name_enable, '0' );
28
- $config->update( );
29
  }
30
  }
31
- if ( false == $error && false == $this->is_switch_value( $_POST[ $opt_name_enable ] ) ) {
32
  echo '<div class="error settings-error"><p><strong>';
33
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
34
  echo '</strong></p></div>';
35
  $error = true;
36
  }
37
- if ( false == $error ) {
38
- $opt_val_enable = $_POST[ $opt_name_enable ];
39
- $config->set( $opt_name_enable, $opt_val_enable );
40
- $config->update( );
41
  ?>
42
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
43
  <?php
@@ -49,11 +49,11 @@ class SiteGuard_Menu_Same_Error extends SiteGuard_Base {
49
  echo '<h2>' . esc_html__( 'Same Login Error Message', 'siteguard' ) . '</h2>';
50
  echo '<div class="siteguard-description">'
51
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
52
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/same_error_en.html', 'siteguard' )
53
- . '" target="_blank">'
54
- . esc_html__( 'here', 'siteguard' )
55
- . '</a>'
56
- . esc_html__( '.', 'siteguard' )
57
  . '</div>';
58
  ?>
59
  <form name="form1" method="post" action="">
@@ -62,15 +62,15 @@ class SiteGuard_Menu_Same_Error extends SiteGuard_Base {
62
  <th scope="row" colspan="2">
63
  <ul class="siteguard-radios">
64
  <li>
65
- <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_enable ? 'checked' : '') ?> >
66
- <label for="<?php echo $opt_name_enable.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
67
  </li><li>
68
- <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_enable ? 'checked' : '') ?> >
69
- <label for="<?php echo $opt_name_enable.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
70
  </li>
71
  </ul>
72
  <?php
73
- $error = check_multisite( );
74
  if ( is_wp_error( $error ) ) {
75
  echo '<p class="description">';
76
  echo $error->get_error_message( );
@@ -95,4 +95,3 @@ class SiteGuard_Menu_Same_Error extends SiteGuard_Base {
95
  <?php
96
  }
97
  }
98
- ?>
1
  <?php
2
 
3
  class SiteGuard_Menu_Same_Error extends SiteGuard_Base {
4
+ const OPT_NAME_ENABLE = 'same_login_error';
5
+
6
  function __construct( ) {
7
  $this->render_page( );
8
  }
9
  function render_page( ) {
10
+ global $siteguard_config, $siteguard_captcha;
 
 
11
 
12
+ $opt_val_enable = $siteguard_config->get( self::OPT_NAME_ENABLE );
13
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-same-error-submit' ) ) {
14
  $error = false;
15
+ $errors = siteguard_check_multisite( );
16
  if ( is_wp_error( $errors ) ) {
17
  echo '<div class="error settings-error"><p><strong>';
18
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
19
  echo '</strong></p></div>';
20
  $error = true;
21
  }
22
+ if ( false === $error && '1' === $_POST[ self::OPT_NAME_ENABLE ] ) {
23
+ $ret = $siteguard_captcha->check_requirements( );
24
  if ( is_wp_error( $ret ) ) {
25
  echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message( ) . '</strong></p></div>';
26
  $error = true;
27
+ $siteguard_config->set( self::OPT_NAME_ENABLE, '0' );
28
+ $siteguard_config->update( );
29
  }
30
  }
31
+ if ( false === $error && false === $this->is_switch_value( $_POST[ self::OPT_NAME_ENABLE ] ) ) {
32
  echo '<div class="error settings-error"><p><strong>';
33
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
34
  echo '</strong></p></div>';
35
  $error = true;
36
  }
37
+ if ( false === $error ) {
38
+ $opt_val_enable = $_POST[ self::OPT_NAME_ENABLE ];
39
+ $siteguard_config->set( self::OPT_NAME_ENABLE, $opt_val_enable );
40
+ $siteguard_config->update( );
41
  ?>
42
  <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
43
  <?php
49
  echo '<h2>' . esc_html__( 'Same Login Error Message', 'siteguard' ) . '</h2>';
50
  echo '<div class="siteguard-description">'
51
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
52
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/same_error/', 'siteguard' ) )
53
+ . '" target="_blank">'
54
+ . esc_html__( 'here', 'siteguard' )
55
+ . '</a>'
56
+ . esc_html__( '.', 'siteguard' )
57
  . '</div>';
58
  ?>
59
  <form name="form1" method="post" action="">
62
  <th scope="row" colspan="2">
63
  <ul class="siteguard-radios">
64
  <li>
65
+ <input type="radio" name="<?php echo self::OPT_NAME_ENABLE ?>" id="<?php echo self::OPT_NAME_ENABLE.'_on' ?>" value="1" <?php checked( $opt_val_enable, '1' ) ?> >
66
+ <label for="<?php echo self::OPT_NAME_ENABLE.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
67
  </li><li>
68
+ <input type="radio" name="<?php echo self::OPT_NAME_ENABLE ?>" id="<?php echo self::OPT_NAME_ENABLE.'_off' ?>" value="0" <?php checked( $opt_val_enable, '0' ) ?> >
69
+ <label for="<?php echo self::OPT_NAME_ENABLE.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
70
  </li>
71
  </ul>
72
  <?php
73
+ $error = siteguard_check_multisite( );
74
  if ( is_wp_error( $error ) ) {
75
  echo '<p class="description">';
76
  echo $error->get_error_message( );
95
  <?php
96
  }
97
  }
 
admin/siteguard-menu-updates-notify.php CHANGED
@@ -1,66 +1,67 @@
1
  <?php
2
 
3
  class SiteGuard_Menu_Updates_Notify extends SiteGuard_Base {
 
 
 
 
 
4
  function __construct( ) {
5
  $this->render_page( );
6
  }
7
  function is_notify_value( $value ) {
8
- if ( '0' == $value || '1' == $value || '2' == $value ) {
 
9
  return true;
10
  }
11
  return false;
12
  }
13
  function render_page( ) {
14
- global $config, $updates_notify;
15
-
16
- $opt_name_enable = 'updates_notify_enable';
17
- $opt_name_wpcore = 'notify_wpcore';
18
- $opt_name_plugins = 'notify_plugins';
19
- $opt_name_themes = 'notify_themes';
20
 
21
- $opt_val_enable = $config->get( $opt_name_enable );
22
- $opt_val_wpcore = $config->get( $opt_name_wpcore );
23
- $opt_val_plugins = $config->get( $opt_name_plugins );
24
- $opt_val_themes = $config->get( $opt_name_themes );
25
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-updates-notify-submit' ) ) {
26
  $error = false;
27
- $errors = check_multisite( );
28
  if ( is_wp_error( $errors ) ) {
29
  echo '<div class="error settings-error"><p><strong>';
30
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
31
  echo '</strong></p></div>';
32
  $error = true;
33
  }
34
- if ( ( false == $error )
35
- && ( ( false == $this->is_switch_value( $_POST[ $opt_name_enable ] ) )
36
- || ( false == $this->is_switch_value( $_POST[ $opt_name_wpcore ] ) )
37
- || ( false == $this->is_notify_value( $_POST[ $opt_name_plugins ] ) )
38
- || ( false == $this->is_notify_value( $_POST[ $opt_name_themes ] ) ) ) ) {
39
  echo '<div class="error settings-error"><p><strong>';
40
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
41
  echo '</strong></p></div>';
42
  $error = true;
43
  }
44
- if ( false == $error && '1' == $_POST[ $opt_name_enable ] ) {
45
- $ret = $updates_notify->check_requirements( );
46
  if ( is_wp_error( $ret ) ) {
47
  echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message( ) . '</strong></p></div>';
48
  $error = true;
49
- $config->set( $opt_name_enable, '0' );
50
- $config->update( );
51
  }
52
  }
53
- if ( false == $error ) {
54
- $opt_val_enable = $_POST[ $opt_name_enable ];
55
- $opt_val_wpcore = $_POST[ $opt_name_wpcore ];
56
- $opt_val_plugins = $_POST[ $opt_name_plugins ];
57
- $opt_val_themes = $_POST[ $opt_name_themes ];
58
- $config->set( $opt_name_enable, $opt_val_enable );
59
- $config->set( $opt_name_wpcore, $opt_val_wpcore );
60
- $config->set( $opt_name_plugins, $opt_val_plugins );
61
- $config->set( $opt_name_themes, $opt_val_themes );
62
- $config->update( );
63
- if ( '1' == $opt_val_enable ) {
64
  SiteGuard_UpdatesNotify::feature_on( );
65
  } else {
66
  SiteGuard_UpdatesNotify::feature_off( );
@@ -76,11 +77,11 @@ class SiteGuard_Menu_Updates_Notify extends SiteGuard_Base {
76
  echo '<h2>' . esc_html__( 'Updates Notify', 'siteguard' ) . '</h2>';
77
  echo '<div class="siteguard-description">'
78
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
79
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/updates_notify_en.html', 'siteguard' )
80
- . '" target="_blank">'
81
- . esc_html__( 'here', 'siteguard' )
82
- . '</a>'
83
- . esc_html__( '.', 'siteguard' )
84
  . '</div>';
85
  ?>
86
  <form name="form1" method="post" action="">
@@ -89,15 +90,15 @@ class SiteGuard_Menu_Updates_Notify extends SiteGuard_Base {
89
  <th scope="row" colspan="2">
90
  <ul class="siteguard-radios">
91
  <li>
92
- <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_enable ? 'checked' : '') ?> >
93
- <label for="<?php echo $opt_name_enable.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
94
  </li><li>
95
- <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_enable ? 'checked' : '') ?> >
96
- <label for="<?php echo $opt_name_enable.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
97
  </li>
98
  </ul>
99
  <?php
100
- $error = $updates_notify->check_requirements( );
101
  if ( is_wp_error( $error ) ) {
102
  echo '<p class="description">';
103
  echo $error->get_error_message( );
@@ -108,35 +109,35 @@ class SiteGuard_Menu_Updates_Notify extends SiteGuard_Base {
108
  </tr><tr>
109
  <th scope="row"><?php esc_html_e( 'WordPress updates', 'siteguard' ); ?></th>
110
  <td>
111
- <input type="radio" name="<?php echo $opt_name_wpcore ?>" id="<?php echo $opt_name_wpcore.'_0' ?>" value="0" <?php echo ( '0' == $opt_val_wpcore ? 'checked' : '') ?> >
112
- <label for="<?php echo $opt_name_wpcore.'_0' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
113
  <br />
114
- <input type="radio" name="<?php echo $opt_name_wpcore ?>" id="<?php echo $opt_name_wpcore.'_1' ?>" value="1" <?php echo ( '1' == $opt_val_wpcore ? 'checked' : '') ?> >
115
- <label for="<?php echo $opt_name_wpcore.'_1' ?>"><?php esc_html_e( 'Enable', 'siteguard' ) ?></label>
116
  </td>
117
  </tr><tr>
118
  <th scope="row"><?php esc_html_e( 'Plugins updates', 'siteguard' ); ?></th>
119
  <td>
120
- <input type="radio" name="<?php echo $opt_name_plugins ?>" id="<?php echo $opt_name_plugins.'_0' ?>" value="0" <?php echo ( '0' == $opt_val_plugins ? 'checked' : '') ?> >
121
- <label for="<?php echo $opt_name_plugins.'_0' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
122
  <br />
123
- <input type="radio" name="<?php echo $opt_name_plugins ?>" id="<?php echo $opt_name_plugins.'_1' ?>" value="1" <?php echo ( '1' == $opt_val_plugins ? 'checked' : '') ?> >
124
- <label for="<?php echo $opt_name_plugins.'_1' ?>"><?php esc_html_e( 'All plugins', 'siteguard' ) ?></label>
125
  <br />
126
- <input type="radio" name="<?php echo $opt_name_plugins ?>" id="<?php echo $opt_name_plugins.'_2' ?>" value="2" <?php echo ( '2' == $opt_val_plugins ? 'checked' : '') ?> >
127
- <label for="<?php echo $opt_name_plugins.'_2' ?>"><?php esc_html_e( 'Active plugins only', 'siteguard' ) ?></label>
128
  </td>
129
  </tr><tr>
130
  <th scope="row"><?php esc_html_e( 'Themes updates', 'siteguard' ); ?></th>
131
  <td>
132
- <input type="radio" name="<?php echo $opt_name_themes ?>" id="<?php echo $opt_name_themes.'_0' ?>" value="0" <?php echo ( '0' == $opt_val_themes ? 'checked' : '') ?> >
133
- <label for="<?php echo $opt_name_themes.'_0' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
134
  <br />
135
- <input type="radio" name="<?php echo $opt_name_themes ?>" id="<?php echo $opt_name_themes.'_1' ?>" value="1" <?php echo ( '1' == $opt_val_themes ? 'checked' : '') ?> >
136
- <label for="<?php echo $opt_name_themes.'_1' ?>"><?php esc_html_e( 'All themes', 'siteguard' ) ?></label>
137
  <br />
138
- <input type="radio" name="<?php echo $opt_name_themes ?>" id="<?php echo $opt_name_themes.'_2' ?>" value="2" <?php echo ( '2' == $opt_val_themes ? 'checked' : '') ?> >
139
- <label for="<?php echo $opt_name_themes.'_2' ?>"><?php esc_html_e( 'Active themes only', 'siteguard' ) ?></label>
140
  </td>
141
  </tr>
142
  </table>
@@ -157,4 +158,3 @@ class SiteGuard_Menu_Updates_Notify extends SiteGuard_Base {
157
  <?php
158
  }
159
  }
160
- ?>
1
  <?php
2
 
3
  class SiteGuard_Menu_Updates_Notify extends SiteGuard_Base {
4
+ const OPT_NAME_ENABLE = 'updates_notify_enable';
5
+ const OPT_NAME_WPCORE = 'notify_wpcore';
6
+ const OPT_NAME_PLUGINS = 'notify_plugins';
7
+ const OPT_NAME_THEMES = 'notify_themes';
8
+
9
  function __construct( ) {
10
  $this->render_page( );
11
  }
12
  function is_notify_value( $value ) {
13
+ $items = array( '0', '1', '2' );
14
+ if ( in_array( $value, $items ) ) {
15
  return true;
16
  }
17
  return false;
18
  }
19
  function render_page( ) {
20
+ global $siteguard_config, $siteguard_updates_notify;
 
 
 
 
 
21
 
22
+ $opt_val_enable = $siteguard_config->get( self::OPT_NAME_ENABLE );
23
+ $opt_val_wpcore = $siteguard_config->get( self::OPT_NAME_WPCORE );
24
+ $opt_val_plugins = $siteguard_config->get( self::OPT_NAME_PLUGINS );
25
+ $opt_val_themes = $siteguard_config->get( self::OPT_NAME_THEMES );
26
  if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-updates-notify-submit' ) ) {
27
  $error = false;
28
+ $errors = siteguard_check_multisite( );
29
  if ( is_wp_error( $errors ) ) {
30
  echo '<div class="error settings-error"><p><strong>';
31
  esc_html_e( $errors->get_error_message( ), 'siteguard' );
32
  echo '</strong></p></div>';
33
  $error = true;
34
  }
35
+ if ( ( false === $error )
36
+ && ( ( false === $this->is_switch_value( $_POST[ self::OPT_NAME_ENABLE ] ) )
37
+ || ( false === $this->is_switch_value( $_POST[ self::OPT_NAME_WPCORE ] ) )
38
+ || ( false === $this->is_notify_value( $_POST[ self::OPT_NAME_PLUGINS ] ) )
39
+ || ( false === $this->is_notify_value( $_POST[ self::OPT_NAME_THEMES ] ) ) ) ) {
40
  echo '<div class="error settings-error"><p><strong>';
41
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
42
  echo '</strong></p></div>';
43
  $error = true;
44
  }
45
+ if ( false === $error && '1' === $_POST[ self::OPT_NAME_ENABLE ] ) {
46
+ $ret = $siteguard_updates_notify->check_requirements( );
47
  if ( is_wp_error( $ret ) ) {
48
  echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message( ) . '</strong></p></div>';
49
  $error = true;
50
+ $siteguard_config->set( self::OPT_NAME_ENABLE, '0' );
51
+ $siteguard_config->update( );
52
  }
53
  }
54
+ if ( false === $error ) {
55
+ $opt_val_enable = $_POST[ self::OPT_NAME_ENABLE ];
56
+ $opt_val_wpcore = $_POST[ self::OPT_NAME_WPCORE ];
57
+ $opt_val_plugins = $_POST[ self::OPT_NAME_PLUGINS ];
58
+ $opt_val_themes = $_POST[ self::OPT_NAME_THEMES ];
59
+ $siteguard_config->set( self::OPT_NAME_ENABLE, $opt_val_enable );
60
+ $siteguard_config->set( self::OPT_NAME_WPCORE, $opt_val_wpcore );
61
+ $siteguard_config->set( self::OPT_NAME_PLUGINS, $opt_val_plugins );
62
+ $siteguard_config->set( self::OPT_NAME_THEMES, $opt_val_themes );
63
+ $siteguard_config->update( );
64
+ if ( '1' === $opt_val_enable ) {
65
  SiteGuard_UpdatesNotify::feature_on( );
66
  } else {
67
  SiteGuard_UpdatesNotify::feature_off( );
77
  echo '<h2>' . esc_html__( 'Updates Notify', 'siteguard' ) . '</h2>';
78
  echo '<div class="siteguard-description">'
79
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
80
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/updates_notify/', 'siteguard' ) )
81
+ . '" target="_blank">'
82
+ . esc_html__( 'here', 'siteguard' )
83
+ . '</a>'
84
+ . esc_html__( '.', 'siteguard' )
85
  . '</div>';
86
  ?>
87
  <form name="form1" method="post" action="">
90
  <th scope="row" colspan="2">
91
  <ul class="siteguard-radios">
92
  <li>
93
+ <input type="radio" name="<?php echo self::OPT_NAME_ENABLE ?>" id="<?php echo self::OPT_NAME_ENABLE.'_on' ?>" value="1" <?php checked( $opt_val_enable, '1' ) ?> >
94
+ <label for="<?php echo self::OPT_NAME_ENABLE.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
95
  </li><li>
96
+ <input type="radio" name="<?php echo self::OPT_NAME_ENABLE ?>" id="<?php echo self::OPT_NAME_ENABLE.'_off' ?>" value="0" <?php checked( $opt_val_enable, '0' ) ?> >
97
+ <label for="<?php echo self::OPT_NAME_ENABLE.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
98
  </li>
99
  </ul>
100
  <?php
101
+ $error = $siteguard_updates_notify->check_requirements( );
102
  if ( is_wp_error( $error ) ) {
103
  echo '<p class="description">';
104
  echo $error->get_error_message( );
109
  </tr><tr>
110
  <th scope="row"><?php esc_html_e( 'WordPress updates', 'siteguard' ); ?></th>
111
  <td>
112
+ <input type="radio" name="<?php echo self::OPT_NAME_WPCORE ?>" id="<?php echo self::OPT_NAME_WPCORE.'_0' ?>" value="0" <?php checked( $opt_val_wpcore, '0' ) ?> >
113
+ <label for="<?php echo self::OPT_NAME_WPCORE.'_0' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
114
  <br />
115
+ <input type="radio" name="<?php echo self::OPT_NAME_WPCORE ?>" id="<?php echo self::OPT_NAME_WPCORE.'_1' ?>" value="1" <?php checked( $opt_val_wpcore, '1' ) ?> >
116
+ <label for="<?php echo self::OPT_NAME_WPCORE.'_1' ?>"><?php esc_html_e( 'Enable', 'siteguard' ) ?></label>
117
  </td>
118
  </tr><tr>
119
  <th scope="row"><?php esc_html_e( 'Plugins updates', 'siteguard' ); ?></th>
120
  <td>
121
+ <input type="radio" name="<?php echo self::OPT_NAME_PLUGINS ?>" id="<?php echo self::OPT_NAME_PLUGINS.'_0' ?>" value="0" <?php checked( $opt_val_plugins, '0' ) ?> >
122
+ <label for="<?php echo self::OPT_NAME_PLUGINS.'_0' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
123
  <br />
124
+ <input type="radio" name="<?php echo self::OPT_NAME_PLUGINS ?>" id="<?php echo self::OPT_NAME_PLUGINS.'_1' ?>" value="1" <?php checked( $opt_val_plugins, '1' ) ?> >
125
+ <label for="<?php echo self::OPT_NAME_PLUGINS.'_1' ?>"><?php esc_html_e( 'All plugins', 'siteguard' ) ?></label>
126
  <br />
127
+ <input type="radio" name="<?php echo self::OPT_NAME_PLUGINS ?>" id="<?php echo self::OPT_NAME_PLUGINS.'_2' ?>" value="2" <?php checked( $opt_val_plugins, '2' ) ?> >
128
+ <label for="<?php echo self::OPT_NAME_PLUGINS.'_2' ?>"><?php esc_html_e( 'Active plugins only', 'siteguard' ) ?></label>
129
  </td>
130
  </tr><tr>
131
  <th scope="row"><?php esc_html_e( 'Themes updates', 'siteguard' ); ?></th>
132
  <td>
133
+ <input type="radio" name="<?php echo self::OPT_NAME_THEMES ?>" id="<?php echo self::OPT_NAME_THEMES.'_0' ?>" value="0" <?php checked( $opt_val_themes, '0' ) ?> >
134
+ <label for="<?php echo self::OPT_NAME_THEMES.'_0' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label>
135
  <br />
136
+ <input type="radio" name="<?php echo self::OPT_NAME_THEMES ?>" id="<?php echo self::OPT_NAME_THEMES.'_1' ?>" value="1" <?php checked( $opt_val_themes, '1' ) ?> >
137
+ <label for="<?php echo self::OPT_NAME_THEMES.'_1' ?>"><?php esc_html_e( 'All themes', 'siteguard' ) ?></label>
138
  <br />
139
+ <input type="radio" name="<?php echo self::OPT_NAME_THEMES ?>" id="<?php echo self::OPT_NAME_THEMES.'_2' ?>" value="2" <?php checked( $opt_val_themes, '2' ) ?> >
140
+ <label for="<?php echo self::OPT_NAME_THEMES.'_2' ?>"><?php esc_html_e( 'Active themes only', 'siteguard' ) ?></label>
141
  </td>
142
  </tr>
143
  </table>
158
  <?php
159
  }
160
  }
 
admin/siteguard-menu-waf-tuning-support.php CHANGED
@@ -3,7 +3,7 @@
3
  require_once( 'siteguard-waf-exclude-rule-table.php' );
4
 
5
  class SiteGuard_Menu_WAF_Tuning_Support extends SiteGuard_Base {
6
- var $wp_list_table;
7
  function __construct( ) {
8
  $this->wp_list_table = new SiteGuard_WAF_Exclude_Rule_Table( );
9
  $this->wp_list_table->prepare_items( );
@@ -19,21 +19,26 @@ class SiteGuard_Menu_WAF_Tuning_Support extends SiteGuard_Base {
19
  return $base;
20
  }
21
  }
 
 
 
 
 
22
  function render_page( ) {
23
- global $waf_exclude_rule;
24
  isset( $_GET['action'] ) ? $action = $_GET['action'] : $action = 'list';
25
  if ( 'list' == $action && isset( $_POST['action'] ) ) {
26
  $action = $_POST['action'];
27
  }
28
- if ( 'list' != $action && 'add' != $action && 'edit' != $action && 'delete' != $action ) {
29
  $action = 'list';
30
  }
31
 
32
- $waf_exclude_rule_enable = $waf_exclude_rule->get_enable( );
33
  if ( 'edit' == $action && isset( $_GET['rule'] ) ) {
34
  $offset = 0;
35
  $id = intval( $_GET['rule'] );
36
- $rule = $waf_exclude_rule->get_rule( $id, $offset );
37
  if ( false === $rule ) {
38
  $filename = '';
39
  $sig = '';
@@ -60,21 +65,29 @@ class SiteGuard_Menu_WAF_Tuning_Support extends SiteGuard_Base {
60
  case 'add':
61
  if ( check_admin_referer( 'siteguard-menu-waf-tuning-support-add' ) ) {
62
  $error = false;
63
- $errors = check_multisite( );
64
  if ( is_wp_error( $errors ) ) {
65
  $error = true;
66
  }
67
  if ( true == $error || ! isset( $_POST['filename'] ) || ! isset( $_POST['sig'] ) || ! isset( $_POST['comment'] ) ) {
68
  // error
 
 
 
 
 
 
69
  } else {
70
  $filename = $this->set_filename( stripslashes( $_POST['filename'] ) );
71
  $sig = stripslashes( $_POST['sig'] );
72
  $comment = stripslashes( $_POST['comment'] );
73
 
74
- $errors = $waf_exclude_rule->add_rule( $filename, $sig, $comment );
75
  if ( ! is_wp_error( $errors ) ) {
76
  if ( $waf_exclude_rule_enable ) {
77
- $waf_exclude_rule->feature_on( );
 
 
78
  }
79
  echo '<div class="updated"><p><strong>' . esc_html__( 'New rule created', 'siteguard' ) . '</strong></p></div>';
80
  $action = 'list';
@@ -94,12 +107,13 @@ class SiteGuard_Menu_WAF_Tuning_Support extends SiteGuard_Base {
94
  $filename = $this->set_filename( stripslashes( $_POST['filename'] ) );
95
  $sig = stripslashes( $_POST['sig'] );
96
  $comment = stripslashes( $_POST['comment'] );
97
- $errors = $waf_exclude_rule->set_rule( $id, $filename, $sig, $comment );
98
  if ( ! is_wp_error( $errors ) ) {
99
  if ( $waf_exclude_rule_enable ) {
100
- $waf_exclude_rule->feature_on( );
 
 
101
  }
102
-
103
  echo '<div class="updated"><p><strong>' . esc_html__( 'Rule updated', 'siteguard' ) . '</strong></p></div>';
104
  $action = 'list';
105
  $this->wp_list_table->prepare_items( );
@@ -115,9 +129,11 @@ class SiteGuard_Menu_WAF_Tuning_Support extends SiteGuard_Base {
115
  // error
116
  } else {
117
  $ids = $_POST['rule'];
118
- $waf_exclude_rule->delete_rule( $ids );
119
  if ( $waf_exclude_rule_enable ) {
120
- $waf_exclude_rule->feature_on( );
 
 
121
  }
122
  echo '<div class="updated"><p><strong>' . esc_html__( 'Rule deleted', 'siteguard' ) . '</strong></p></div>';
123
  $action = 'list';
@@ -133,35 +149,47 @@ class SiteGuard_Menu_WAF_Tuning_Support extends SiteGuard_Base {
133
  if ( ! isset( $_POST['waf_exclude_rule_enable'] ) ) {
134
  // error
135
  } else {
136
- $error = false;
137
- $errors = check_multisite( );
138
  if ( is_wp_error( $errors ) ) {
139
  $error = true;
140
  }
141
- if ( false == $error && '1' == $_POST['waf_exclude_rule_enable'] && false == $this->check_module( 'siteguard' ) ) {
142
  echo '<div class="error settings-error"><p><strong>';
143
  esc_html_e( 'To use the WAF exclude rule, WAF ( SiteGuard Lite ) should be installed on Apache.', 'siteguard' );
144
  echo '</strong></p></div>';
145
  $error = true;
146
- $waf_exclude_rule->set_enable( '0' );
147
- $waf_exclude_rule->feature_off( );
 
 
148
  $waf_exclude_rule_enable = '0';
149
  }
150
- if ( false == $error && false == $this->is_switch_value( $_POST['waf_exclude_rule_enable'] ) ) {
151
  echo '<div class="error settings-error"><p><strong>';
152
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
153
  echo '</strong></p></div>';
154
  $error = true;
155
  }
156
- if ( false == $error ) {
 
157
  $waf_exclude_rule_enable = $_POST['waf_exclude_rule_enable'];
158
- $waf_exclude_rule->set_enable( $waf_exclude_rule_enable );
159
  if ( '1' == $waf_exclude_rule_enable ) {
160
- $waf_exclude_rule->feature_on( );
161
- echo '<div class="updated"><p><strong>' . esc_html__( 'Rules applied', 'siteguard' ) . '</strong></p></div>';
 
 
162
  } else {
163
- $waf_exclude_rule->feature_off( );
164
- echo '<div class="updated"><p><strong>' . esc_html__( 'Rules unapplied', 'siteguard' ) . '</strong></p></div>';
 
 
 
 
 
 
 
165
  }
166
  }
167
  }
@@ -198,11 +226,11 @@ class SiteGuard_Menu_WAF_Tuning_Support extends SiteGuard_Base {
198
  echo '<h2>' . esc_html__( 'WAF Tuning Support', 'siteguard' ) . ' <a href="?page=siteguard_waf_tuning_support&action=add" class="add-new-h2">' . esc_html__( 'Add New', 'siteguard' ) . '</a></h2>';
199
  echo '<div class="siteguard-description">'
200
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
201
- . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/waf_tuning_support_en.html', 'siteguard' )
202
- . '" target="_blank">'
203
- . esc_html__( 'here', 'siteguard' )
204
- . '</a>'
205
- . esc_html__( '.', 'siteguard' )
206
  . '</div>';
207
  ?>
208
  <form name="form1" method="post" action="">
@@ -211,15 +239,15 @@ class SiteGuard_Menu_WAF_Tuning_Support extends SiteGuard_Base {
211
  <th scope="row" colspan="2">
212
  <ul class="siteguard-radios">
213
  <li>
214
- <input type="radio" name="waf_exclude_rule_enable" id="waf_exclude_rule_enable_on" value="1" <?php echo ( '1' == $waf_exclude_rule_enable ? 'checked' : '' ) ?> >
215
  <label for="waf_exclude_rule_enable_on"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
216
  </li><li>
217
- <input type="radio" name="waf_exclude_rule_enable" id="waf_exclude_rule_enable_off" value="0" <?php echo ( '0' == $waf_exclude_rule_enable ? 'checked' : '' ) ?> >
218
  <label for="waf_exclude_rule_enable_off"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
219
  </li>
220
  </ul>
221
  <?php
222
- $error = check_multisite( );
223
  if ( is_wp_error( $error ) ) {
224
  echo '<p class="description">';
225
  echo $error->get_error_message( );
@@ -258,27 +286,27 @@ By creating the WAF exclude rule, the WAF protection function can be activated w
258
  <form name="form1" method="post" action="<?php echo esc_url( menu_page_url( 'siteguard_waf_tuning_support', false ) ) ?>">
259
  <table class="form-table">
260
  <tr>
261
- <th scope="row"><label for="sig"><?php echo esc_html_e( 'Signature', 'siteguard' ) ?></label></th>
262
  <td>
263
  <textarea name="sig" id="sig" style="width:350px;" rows="5" ><?php echo esc_html( $sig ) ?></textarea>
264
- <p class="description"><?php esc_html_e( 'The detected signature name or signature ID is specified. To specify more than one, separate them with new line.', 'siteguard' ) ?></p>
265
  </td>
266
  </tr>
267
  <tr>
268
- <th scope="row"><label for="filename"><?php echo esc_html_e( 'Filename (optional)', 'siteguard' ) ?></label></th>
269
  <td>
270
  <input type="text" name="filename" id="filename" value="<?php echo esc_attr( $filename ) ?>" class="regular-text code" >
271
  <p class="description"><?php esc_html_e( 'The target file name is specified. URL ( the part before ? ) can also be pasted.', 'siteguard' ) ?></p>
272
  </td>
273
  </tr>
274
  <tr>
275
- <th scope="row"><label for="comment"><?php echo esc_html_e( 'Comment (optional)', 'siteguard' ) ?></label></th>
276
  <td>
277
  <input type="text" name="comment" id="comment" value="<?php echo esc_attr( $comment ) ?>" class="regular-text" >
278
  </td>
279
  </tr>
280
  </table>
281
-
282
  <hr />
283
  <?php
284
  if ( 'add' == $action ) {
@@ -302,7 +330,7 @@ By creating the WAF exclude rule, the WAF protection function can be activated w
302
  $go_delete = 0;
303
  foreach ( $ids as $id ) {
304
  $offset = 0;
305
- $rule = $waf_exclude_rule->get_rule( $id, $offset );
306
  echo '<input type="hidden" name="rule[]" value="' . esc_attr( $id ) . '" />' . esc_html__( 'Signature', 'siteguard' ) . ' : ' . esc_html__( 'Filename', 'siteguard' ) . ' : ' . esc_html__( 'Comment', 'siteguard' ) . ' [' . esc_html( $rule['sig'] ) . ' : ' . esc_html( $rule['filename'] ) . ' : ' . esc_html( $rule['comment'] ) . "]<br />\n";
307
  $go_delete = 1;
308
  }
@@ -321,5 +349,3 @@ By creating the WAF exclude rule, the WAF protection function can be activated w
321
  <?php
322
  }
323
  }
324
-
325
- ?>
3
  require_once( 'siteguard-waf-exclude-rule-table.php' );
4
 
5
  class SiteGuard_Menu_WAF_Tuning_Support extends SiteGuard_Base {
6
+ protected $wp_list_table;
7
  function __construct( ) {
8
  $this->wp_list_table = new SiteGuard_WAF_Exclude_Rule_Table( );
9
  $this->wp_list_table->prepare_items( );
19
  return $base;
20
  }
21
  }
22
+ function htaccess_error( ) {
23
+ echo '<div class="error settings-error"><p><strong>';
24
+ esc_html_e( 'ERROR: Failed to .htaccess update.', 'siteguard' );
25
+ echo '</strong></p></div>';
26
+ }
27
  function render_page( ) {
28
+ global $siteguard_waf_exclude_rule;
29
  isset( $_GET['action'] ) ? $action = $_GET['action'] : $action = 'list';
30
  if ( 'list' == $action && isset( $_POST['action'] ) ) {
31
  $action = $_POST['action'];
32
  }
33
+ if ( ! in_array( $action, array( 'list', 'add', 'edit', 'delete' ) ) ) {
34
  $action = 'list';
35
  }
36
 
37
+ $waf_exclude_rule_enable = $siteguard_waf_exclude_rule->get_enable( );
38
  if ( 'edit' == $action && isset( $_GET['rule'] ) ) {
39
  $offset = 0;
40
  $id = intval( $_GET['rule'] );
41
+ $rule = $siteguard_waf_exclude_rule->get_rule( $id, $offset );
42
  if ( false === $rule ) {
43
  $filename = '';
44
  $sig = '';
65
  case 'add':
66
  if ( check_admin_referer( 'siteguard-menu-waf-tuning-support-add' ) ) {
67
  $error = false;
68
+ $errors = siteguard_check_multisite( );
69
  if ( is_wp_error( $errors ) ) {
70
  $error = true;
71
  }
72
  if ( true == $error || ! isset( $_POST['filename'] ) || ! isset( $_POST['sig'] ) || ! isset( $_POST['comment'] ) ) {
73
  // error
74
+ if ( true === $error ) {
75
+ siteguard_error_log( 'multisite enabled: ' . __FILENAME__ );
76
+ }
77
+ if ( ! isset( $_POST['sig'] ) ) {
78
+ siteguard_error_log( 'post value sig not set: ' . __FILENAME__ );
79
+ }
80
  } else {
81
  $filename = $this->set_filename( stripslashes( $_POST['filename'] ) );
82
  $sig = stripslashes( $_POST['sig'] );
83
  $comment = stripslashes( $_POST['comment'] );
84
 
85
+ $errors = $siteguard_waf_exclude_rule->add_rule( $filename, $sig, $comment );
86
  if ( ! is_wp_error( $errors ) ) {
87
  if ( $waf_exclude_rule_enable ) {
88
+ if ( false === $siteguard_waf_exclude_rule->feature_on( ) ) {
89
+ $this->htaccess_error( );
90
+ }
91
  }
92
  echo '<div class="updated"><p><strong>' . esc_html__( 'New rule created', 'siteguard' ) . '</strong></p></div>';
93
  $action = 'list';
107
  $filename = $this->set_filename( stripslashes( $_POST['filename'] ) );
108
  $sig = stripslashes( $_POST['sig'] );
109
  $comment = stripslashes( $_POST['comment'] );
110
+ $errors = $siteguard_waf_exclude_rule->update_rule( $id, $filename, $sig, $comment );
111
  if ( ! is_wp_error( $errors ) ) {
112
  if ( $waf_exclude_rule_enable ) {
113
+ if ( false === $siteguard_waf_exclude_rule->feature_on( ) ) {
114
+ $this->htaccess_error( );
115
+ }
116
  }
 
117
  echo '<div class="updated"><p><strong>' . esc_html__( 'Rule updated', 'siteguard' ) . '</strong></p></div>';
118
  $action = 'list';
119
  $this->wp_list_table->prepare_items( );
129
  // error
130
  } else {
131
  $ids = $_POST['rule'];
132
+ $siteguard_waf_exclude_rule->delete_rule( $ids );
133
  if ( $waf_exclude_rule_enable ) {
134
+ if ( false === $siteguard_waf_exclude_rule->feature_on( ) ) {
135
+ $this->htaccess_error( );
136
+ }
137
  }
138
  echo '<div class="updated"><p><strong>' . esc_html__( 'Rule deleted', 'siteguard' ) . '</strong></p></div>';
139
  $action = 'list';
149
  if ( ! isset( $_POST['waf_exclude_rule_enable'] ) ) {
150
  // error
151
  } else {
152
+ $error = false;
153
+ $errors = siteguard_check_multisite( );
154
  if ( is_wp_error( $errors ) ) {
155
  $error = true;
156
  }
157
+ if ( false === $error && '1' === $_POST['waf_exclude_rule_enable'] && false === $this->check_module( 'siteguard' ) ) {
158
  echo '<div class="error settings-error"><p><strong>';
159
  esc_html_e( 'To use the WAF exclude rule, WAF ( SiteGuard Lite ) should be installed on Apache.', 'siteguard' );
160
  echo '</strong></p></div>';
161
  $error = true;
162
+ $siteguard_waf_exclude_rule->set_enable( '0' );
163
+ if ( false === $siteguard_waf_exclude_rule->feature_off( ) ) {
164
+ $this->htaccess_error( );
165
+ }
166
  $waf_exclude_rule_enable = '0';
167
  }
168
+ if ( false === $error && false === $this->is_switch_value( $_POST['waf_exclude_rule_enable'] ) ) {
169
  echo '<div class="error settings-error"><p><strong>';
170
  esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
171
  echo '</strong></p></div>';
172
  $error = true;
173
  }
174
+ if ( false === $error ) {
175
+ $old_waf_exclude_rule_enable = $waf_exclude_rule_enable;
176
  $waf_exclude_rule_enable = $_POST['waf_exclude_rule_enable'];
177
+ $siteguard_waf_exclude_rule->set_enable( $waf_exclude_rule_enable );
178
  if ( '1' == $waf_exclude_rule_enable ) {
179
+ $result = $siteguard_waf_exclude_rule->feature_on( );
180
+ if ( true === $result ) {
181
+ echo '<div class="updated"><p><strong>' . esc_html__( 'Rules applied', 'siteguard' ) . '</strong></p></div>';
182
+ }
183
  } else {
184
+ $result = $siteguard_waf_exclude_rule->feature_off( );
185
+ if ( true === $result ) {
186
+ echo '<div class="updated"><p><strong>' . esc_html__( 'Rules unapplied', 'siteguard' ) . '</strong></p></div>';
187
+ }
188
+ }
189
+ if ( false === $result ) {
190
+ $waf_exclude_rule_enable = $old_waf_exclude_rule_enable;
191
+ $siteguard_waf_exclude_rule->set_enable( $waf_exclude_rule_enable );
192
+ $this->htaccess_error( );
193
  }
194
  }
195
  }
226
  echo '<h2>' . esc_html__( 'WAF Tuning Support', 'siteguard' ) . ' <a href="?page=siteguard_waf_tuning_support&action=add" class="add-new-h2">' . esc_html__( 'Add New', 'siteguard' ) . '</a></h2>';
227
  echo '<div class="siteguard-description">'
228
  . esc_html__( 'You can find docs about this function on ', 'siteguard' )
229
+ . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/waf_tuning_support/', 'siteguard' ) )
230
+ . '" target="_blank">'
231
+ . esc_html__( 'here', 'siteguard' )
232
+ . '</a>'
233
+ . esc_html__( '.', 'siteguard' )
234
  . '</div>';
235
  ?>
236
  <form name="form1" method="post" action="">
239
  <th scope="row" colspan="2">
240
  <ul class="siteguard-radios">
241
  <li>
242
+ <input type="radio" name="waf_exclude_rule_enable" id="waf_exclude_rule_enable_on" value="1" <?php checked( $waf_exclude_rule_enable, '1' ) ?> >
243
  <label for="waf_exclude_rule_enable_on"><?php esc_html_e( 'ON', 'siteguard' ) ?></label>
244
  </li><li>
245
+ <input type="radio" name="waf_exclude_rule_enable" id="waf_exclude_rule_enable_off" value="0" <?php checked( $waf_exclude_rule_enable, '0' ) ?> >
246
  <label for="waf_exclude_rule_enable_off"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label>
247
  </li>
248
  </ul>
249
  <?php
250
+ $error = siteguard_check_multisite( );
251
  if ( is_wp_error( $error ) ) {
252
  echo '<p class="description">';
253
  echo $error->get_error_message( );
286
  <form name="form1" method="post" action="<?php echo esc_url( menu_page_url( 'siteguard_waf_tuning_support', false ) ) ?>">
287
  <table class="form-table">
288
  <tr>
289
+ <th scope="row"><label for="sig"><?php esc_html_e( 'Signature', 'siteguard' ) ?></label></th>
290
  <td>
291
  <textarea name="sig" id="sig" style="width:350px;" rows="5" ><?php echo esc_html( $sig ) ?></textarea>
292
+ <p class="description"><?php esc_html_e( 'The detected signature name or signature ID is specified. To specify more than one, separate them with new line.', 'siteguard' ) ?></p>
293
  </td>
294
  </tr>
295
  <tr>
296
+ <th scope="row"><label for="filename"><?php esc_html_e( 'Filename (optional)', 'siteguard' ) ?></label></th>
297
  <td>
298
  <input type="text" name="filename" id="filename" value="<?php echo esc_attr( $filename ) ?>" class="regular-text code" >
299
  <p class="description"><?php esc_html_e( 'The target file name is specified. URL ( the part before ? ) can also be pasted.', 'siteguard' ) ?></p>
300
  </td>
301
  </tr>
302
  <tr>
303
+ <th scope="row"><label for="comment"><?php esc_html_e( 'Comment (optional)', 'siteguard' ) ?></label></th>
304
  <td>
305
  <input type="text" name="comment" id="comment" value="<?php echo esc_attr( $comment ) ?>" class="regular-text" >
306
  </td>
307
  </tr>
308
  </table>
309
+
310
  <hr />
311
  <?php
312
  if ( 'add' == $action ) {
330
  $go_delete = 0;
331
  foreach ( $ids as $id ) {
332
  $offset = 0;
333
+ $rule = $siteguard_waf_exclude_rule->get_rule( $id, $offset );
334
  echo '<input type="hidden" name="rule[]" value="' . esc_attr( $id ) . '" />' . esc_html__( 'Signature', 'siteguard' ) . ' : ' . esc_html__( 'Filename', 'siteguard' ) . ' : ' . esc_html__( 'Comment', 'siteguard' ) . ' [' . esc_html( $rule['sig'] ) . ' : ' . esc_html( $rule['filename'] ) . ' : ' . esc_html( $rule['comment'] ) . "]<br />\n";
335
  $go_delete = 1;
336
  }
349
  <?php
350
  }
351
  }
 
 
admin/siteguard-waf-exclude-rule-table.php CHANGED
@@ -32,8 +32,8 @@ class SiteGuard_WAF_Exclude_Rule_Table extends WP_List_Table {
32
 
33
  //Build row actions
34
  $actions = array(
35
- 'edit' => sprintf( '<a href="?page=%s&action=%s&rule=%s">%s</a>', esc_html( $_REQUEST['page'] ), 'edit', esc_html( $item['ID'] ), esc_html__( 'Edit' ) ),
36
- 'delete' => sprintf( '<a href="?page=%s&action=%s&rule=%s">%s</a>', esc_html( $_REQUEST['page'] ), 'delete', esc_html( $item['ID'] ), esc_html__( 'Delete' ) ),
37
  );
38
 
39
  //Return the target contents
@@ -47,8 +47,8 @@ class SiteGuard_WAF_Exclude_Rule_Table extends WP_List_Table {
47
  function column_cb( $item ) {
48
  return sprintf(
49
  '<input type="checkbox" name="%1$s[]" value="%2$s" />',
50
- /*$1%s*/ esc_html( $this->_args['singular'] ), //Let's simply repurpose the table's singular label ("rule")
51
- /*$2%s*/ esc_html( $item['ID'] ) //The value of the checkbox should be the record's id
52
  );
53
  }
54
 
@@ -86,14 +86,16 @@ class SiteGuard_WAF_Exclude_Rule_Table extends WP_List_Table {
86
  }
87
 
88
  function usort_reorder( $a, $b ) {
89
- $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'sig'; //If no sort, default to filename
90
- $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; //If no order, default to asc
 
 
91
  $result = strcmp( $a[ $orderby ], $b[ $orderby ] ); //Determine sort order
92
  return ( 'asc' === $order ) ? $result : -$result; //Send final sort direction to usort
93
  }
94
 
95
  function prepare_items( ) {
96
- global $waf_exclude_rule;
97
 
98
  $per_page = 5;
99
 
@@ -105,7 +107,7 @@ class SiteGuard_WAF_Exclude_Rule_Table extends WP_List_Table {
105
 
106
  $this->process_bulk_action( );
107
 
108
- $data = $waf_exclude_rule->get_rules( );
109
 
110
  $total_items = count( $data );
111
  $current_page = $this->get_pagenum( );
@@ -126,4 +128,3 @@ class SiteGuard_WAF_Exclude_Rule_Table extends WP_List_Table {
126
  ) );
127
  }
128
  }
129
- ?>
32
 
33
  //Build row actions
34
  $actions = array(
35
+ 'edit' => '<a href="' . esc_url( sprintf( '?page=%s&action=edit&rule=%s', esc_html( $_REQUEST['page'] ), esc_html( $item['ID'] ) ) ) . '">' . esc_html( __( 'Edit' ) ) . '</a>' ,
36
+ 'delete' => '<a href="' . esc_url( sprintf( '?page=%s&action=delete&rule=%s', esc_html( $_REQUEST['page'] ), esc_html( $item['ID'] ) ) ) . '">' . esc_html( __( 'Delete' ) ) . '</a>',
37
  );
38
 
39
  //Return the target contents
47
  function column_cb( $item ) {
48
  return sprintf(
49
  '<input type="checkbox" name="%1$s[]" value="%2$s" />',
50
+ /*$1%s*/ esc_attr( $this->_args['singular'] ), //Let's simply repurpose the table's singular label ("rule")
51
+ /*$2%s*/ esc_attr( $item['ID'] ) //The value of the checkbox should be the record's id
52
  );
53
  }
54
 
86
  }
87
 
88
  function usort_reorder( $a, $b ) {
89
+ $orderby_values = array( 'sig', 'filename', 'comment' );
90
+ $order_values = array( 'asc', 'desc' );
91
+ $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? ( in_array( $_REQUEST['orderby'], $orderby_values ) ? $_REQUEST['orderby'] : 'sig' ) : 'sig'; //If no sort, default to filename
92
+ $order = ( ! empty( $_REQUEST['order'] ) ) ? ( in_array( $_REQUEST['order'], $order_values ) ? $_REQUEST['order'] : 'asc' ) : 'asc'; //If no order, default to asc
93
  $result = strcmp( $a[ $orderby ], $b[ $orderby ] ); //Determine sort order
94
  return ( 'asc' === $order ) ? $result : -$result; //Send final sort direction to usort
95
  }
96
 
97
  function prepare_items( ) {
98
+ global $siteguard_waf_exclude_rule;
99
 
100
  $per_page = 5;
101
 
107
 
108
  $this->process_bulk_action( );
109
 
110
+ $data = $siteguard_waf_exclude_rule->get_rules( );
111
 
112
  $total_items = count( $data );
113
  $current_page = $this->get_pagenum( );
128
  ) );
129
  }
130
  }
 
classes/siteguard-admin-filter.php CHANGED
@@ -11,7 +11,7 @@ class SiteGuard_AdminFilter extends SiteGuard_Base {
11
  return SiteGuard_AdminFilter::$htaccess_mark;
12
  }
13
  function init( ) {
14
- global $wpdb, $config;
15
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_LOGIN;
16
  $sql = 'CREATE TABLE ' . $table_name . " (
17
  ip_address varchar(40) NOT NULL DEFAULT '',
@@ -23,37 +23,84 @@ class SiteGuard_AdminFilter extends SiteGuard_Base {
23
  CHARACTER SET 'utf8';";
24
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
25
  dbDelta( $sql );
26
- $config->set( 'admin_filter_exclude_path', 'css,images,admin-ajax.php' );
27
- $config->set( 'admin_filter_enable', '0' );
28
- $config->update( );
29
  }
30
  function handler_wp_login( $login, $current_user ) {
31
- global $htaccess, $config;
32
 
33
  if ( '' == $current_user->user_login ) {
34
  return;
35
  }
36
- if ( 1 == $config->get( 'admin_filter_enable' ) ) {
37
- $this->feature_on( $_SERVER['REMOTE_ADDR'] );
38
  }
39
  }
40
  function cvt_exclude( $exclude ) {
41
  return str_replace( ',', '|', $exclude );
42
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  function update_settings( $ip_address ) {
44
- global $wpdb, $config;
45
  $htaccess_str = '';
46
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_LOGIN;
47
- $exclude_paths = preg_split( '/,/', $config->get( 'admin_filter_exclude_path' ) );
48
 
49
  $now_str = current_time( 'mysql' );
50
  $now_bin = strtotime( $now_str );
51
 
52
  $wpdb->query( 'START TRANSACTION' );
53
- $wpdb->query( "DELETE FROM $table_name WHERE status = 1 AND last_login_time < SYSDATE() - INTERVAL 1 DAY;" );
54
  $data = array(
55
  'ip_address' => $ip_address,
56
- 'status' => 1,
57
  'count' => 0,
58
  'last_login_time' => $now_str,
59
  );
@@ -64,7 +111,7 @@ class SiteGuard_AdminFilter extends SiteGuard_Base {
64
  $wpdb->update( $table_name, $data, array( 'ip_address' => $ip_address ) );
65
  }
66
  $parse_url = parse_url( site_url( ) );
67
- if ( false == $parse_url ) {
68
  $base = '/';
69
  } else {
70
  if ( isset( $parse_url['path'] ) ) {
@@ -78,13 +125,14 @@ class SiteGuard_AdminFilter extends SiteGuard_Base {
78
  $htaccess_str .= " RewriteBase $base\n";
79
  $htaccess_str .= " RewriteRule ^404-siteguard - [L]\n";
80
  foreach ( $exclude_paths as $path ) {
81
- $htaccess_str .= ' RewriteRule ^wp-admin/' . trim( $path ) . " - [L]\n";
82
  }
83
- $htaccess_str .= ' RewriteCond %{REMOTE_ADDR} !(127.0.0.1|'. $_SERVER['SERVER_ADDR'] . ")\n";
84
- $results = $wpdb->get_col( "SELECT ip_address FROM $table_name;" );
 
85
  if ( $results ) {
86
  foreach ( $results as $ip ) {
87
- $htaccess_str .= ' RewriteCond %{REMOTE_ADDR} !' . $ip . "\n";
88
  }
89
  }
90
  $htaccess_str .= " RewriteRule ^wp-admin 404-siteguard [L]\n";
@@ -94,16 +142,17 @@ class SiteGuard_AdminFilter extends SiteGuard_Base {
94
 
95
  return $htaccess_str;
96
  }
97
- function feature_on( $ip_addres ) {
98
- global $htaccess, $config;
 
 
 
99
  $mark = $this->get_mark( );
100
- $data = $this->update_settings( $ip_addres );
101
- return $htaccess->update_settings( $mark, $data );
102
  }
103
  static function feature_off( ) {
104
  $mark = SiteGuard_AdminFilter::get_mark( );
105
- SiteGuard_Htaccess::clear_settings( $mark );
106
  }
107
  }
108
-
109
- ?>
11
  return SiteGuard_AdminFilter::$htaccess_mark;
12
  }
13
  function init( ) {
14
+ global $wpdb, $siteguard_config;
15
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_LOGIN;
16
  $sql = 'CREATE TABLE ' . $table_name . " (
17
  ip_address varchar(40) NOT NULL DEFAULT '',
23
  CHARACTER SET 'utf8';";
24
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
25
  dbDelta( $sql );
26
+ $siteguard_config->set( 'admin_filter_exclude_path', 'css,images,admin-ajax.php,load-styles.php' );
27
+ $siteguard_config->set( 'admin_filter_enable', '0' );
28
+ $siteguard_config->update( );
29
  }
30
  function handler_wp_login( $login, $current_user ) {
31
+ global $siteguard_htaccess, $siteguard_config;
32
 
33
  if ( '' == $current_user->user_login ) {
34
  return;
35
  }
36
+ if ( 1 == $siteguard_config->get( 'admin_filter_enable' ) ) {
37
+ $this->feature_on( $this->get_ip( ) );
38
  }
39
  }
40
  function cvt_exclude( $exclude ) {
41
  return str_replace( ',', '|', $exclude );
42
  }
43
+ function cvt_status_for_1_2_5( $ip_address ) {
44
+ global $wpdb;
45
+ $table_name = $wpdb->prefix . SITEGUARD_TABLE_LOGIN;
46
+ $wpdb->update( $table_name, array( 'status' => 0 ), array( 'ip_address' => $ip_address ) );
47
+ }
48
+ function get_ip_mode( ) {
49
+ global $siteguard_config;
50
+ if ( ! is_object( $siteguard_config ) ) {
51
+ $siteguard_config = new SiteGuard_Config( );
52
+ }
53
+ $ip_mode = $siteguard_config->get( 'ip_mode' );
54
+ if ( ! in_array( $ip_mode, SiteGuard_Base::$ip_mode_items ) ) {
55
+ $ip_mode = '0';
56
+ }
57
+ $ip_mode_num = intval( $ip_mode );
58
+
59
+ return $ip_mode_num;
60
+ }
61
+ function get_rewrite_postfix( $ip_mode ) {
62
+ $postfix = '';
63
+ switch ( $ip_mode ) {
64
+ case 2:
65
+ $postfix = '\s*,\s*[^,]+';
66
+ break;
67
+ case 3:
68
+ $postfix = '(\s*,\s*[^,]+){2}';
69
+ break;
70
+ default:
71
+ $postfix = '';
72
+ }
73
+ return $postfix;
74
+ }
75
+ function get_rewrite_pre_cond( $ip_mode ) {
76
+ if ( 0 === $ip_mode ) {
77
+ return '';
78
+ }
79
+ $postfix = $this->get_rewrite_postfix( $ip_mode );
80
+ $result = ' RewriteCond %{HTTP:X-Forwarded-For} [^,]+' . $postfix . "$\n";
81
+ return $result;
82
+ }
83
+ function get_rewrite_cond( $ip, $ip_mode ) {
84
+ if ( 0 === $ip_mode ) {
85
+ return ' RewriteCond %{REMOTE_ADDR} !^' . str_replace( '.', '\.', $ip ) . "$\n";
86
+ }
87
+ $postfix = $this->get_rewrite_postfix( $ip_mode );
88
+ return ' RewriteCond %{HTTP:X-Forwarded-For} !' . str_replace( '.', '\.', $ip ) . $postfix . "$\n";
89
+ }
90
  function update_settings( $ip_address ) {
91
+ global $wpdb, $siteguard_config;
92
  $htaccess_str = '';
93
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_LOGIN;
94
+ $exclude_paths = preg_split( '/,/', $siteguard_config->get( 'admin_filter_exclude_path' ) );
95
 
96
  $now_str = current_time( 'mysql' );
97
  $now_bin = strtotime( $now_str );
98
 
99
  $wpdb->query( 'START TRANSACTION' );
100
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $table_name WHERE status = %d AND last_login_time < SYSDATE() - INTERVAL 1 DAY;", SITEGUARD_LOGIN_SUCCESS ) );
101
  $data = array(
102
  'ip_address' => $ip_address,
103
+ 'status' => SITEGUARD_LOGIN_SUCCESS,
104
  'count' => 0,
105
  'last_login_time' => $now_str,
106
  );
111
  $wpdb->update( $table_name, $data, array( 'ip_address' => $ip_address ) );
112
  }
113
  $parse_url = parse_url( site_url( ) );
114
+ if ( false === $parse_url ) {
115
  $base = '/';
116
  } else {
117
  if ( isset( $parse_url['path'] ) ) {
125
  $htaccess_str .= " RewriteBase $base\n";
126
  $htaccess_str .= " RewriteRule ^404-siteguard - [L]\n";
127
  foreach ( $exclude_paths as $path ) {
128
+ $htaccess_str .= ' RewriteRule ^wp-admin/' . trim( str_replace( '.', '\.', $path ) ) . " - [L]\n";
129
  }
130
+ $ip_mode = $this->get_ip_mode( );
131
+ $htaccess_str .= $this->get_rewrite_pre_cond( $ip_mode );
132
+ $results = $wpdb->get_col( $wpdb->prepare( "SELECT ip_address FROM $table_name WHERE status = %d;", SITEGUARD_LOGIN_SUCCESS ) );
133
  if ( $results ) {
134
  foreach ( $results as $ip ) {
135
+ $htaccess_str .= $this->get_rewrite_cond( $ip, $ip_mode );
136
  }
137
  }
138
  $htaccess_str .= " RewriteRule ^wp-admin 404-siteguard [L]\n";
142
 
143
  return $htaccess_str;
144
  }
145
+ function feature_on( $ip_address ) {
146
+ global $siteguard_htaccess, $siteguard_config;
147
+ if ( false === SiteGuard_Htaccess::check_permission( ) ) {
148
+ return false;
149
+ }
150
  $mark = $this->get_mark( );
151
+ $data = $this->update_settings( $ip_address );
152
+ return $siteguard_htaccess->update_settings( $mark, $data );
153
  }
154
  static function feature_off( ) {
155
  $mark = SiteGuard_AdminFilter::get_mark( );
156
+ return SiteGuard_Htaccess::clear_settings( $mark );
157
  }
158
  }
 
 
classes/siteguard-base.php CHANGED
@@ -17,7 +17,7 @@ function siteguard_error_dump( $title, $obj ) {
17
  siteguard_error_log( "$title: $msg" );
18
  }
19
 
20
- function check_multisite( ) {
21
  if ( ! is_multisite() ) {
22
  return true;
23
  }
@@ -27,10 +27,11 @@ function check_multisite( ) {
27
  }
28
 
29
  class SiteGuard_Base {
 
30
  function __construct() {
31
  }
32
  function is_switch_value( $value ) {
33
- if ( '0' == $value || '1' == $value ) {
34
  return true;
35
  }
36
  return false;
@@ -57,16 +58,40 @@ class SiteGuard_Base {
57
  #}
58
  #return $default;
59
  }
60
- function is_active_plugin( $plugin ) {
61
- if ( function_exists( 'is_plugin_active' ) ) {
62
- return is_plugin_active( $plugin );
63
- } else {
64
- return in_array(
65
- $plugin,
66
- get_option( 'active_plugins' )
67
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
  }
71
-
72
- ?>
17
  siteguard_error_log( "$title: $msg" );
18
  }
19
 
20
+ function siteguard_check_multisite( ) {
21
  if ( ! is_multisite() ) {
22
  return true;
23
  }
27
  }
28
 
29
  class SiteGuard_Base {
30
+ public static $ip_mode_items = array( '0', '1', '2', '3' );
31
  function __construct() {
32
  }
33
  function is_switch_value( $value ) {
34
+ if ( '0' === $value || '1' === $value ) {
35
  return true;
36
  }
37
  return false;
58
  #}
59
  #return $default;
60
  }
61
+
62
+ function get_ip( ) {
63
+ global $siteguard_config;
64
+ $ip_mode = $siteguard_config->get( 'ip_mode' );
65
+ if ( ! in_array( $ip_mode, SiteGuard_Base::$ip_mode_items ) ) {
66
+ $ip_mode = '0';
67
+ $siteguard_config->set( 'ip_mode', $ip_mode );
68
+ $siteguard_config->update( );
69
+ }
70
+ $ip_mode_num = intval( $ip_mode );
71
+ $remote_addr = '127.0.0.1';
72
+ if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
73
+ $remote_addr = $_SERVER['REMOTE_ADDR'];
74
+ }
75
+ if ( '0' === $ip_mode ) {
76
+ return $remote_addr;
77
+ }
78
+ if ( ! isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
79
+ return $remote_addr;
80
+ }
81
+ $xff = $_SERVER['HTTP_X_FORWARDED_FOR'];
82
+ if ( empty( $xff ) ) {
83
+ return $remote_addr;
84
  }
85
+ $ips = explode( ',', $xff );
86
+ $count = count( $ips );
87
+ $idx = $count - $ip_mode_num;
88
+ if ( $idx < 0 ) {
89
+ return $remote_addr;
90
+ }
91
+ $ip = $ips[ $idx ];
92
+ if ( ! filter_var($ip, FILTER_VALIDATE_IP ) ) {
93
+ return $remote_addr;
94
+ }
95
+ return $ip;
96
  }
97
  }
 
 
classes/siteguard-captcha.php CHANGED
@@ -3,47 +3,46 @@
3
  include_once( SITEGUARD_PATH . 'really-simple-captcha/siteguard-really-simple-captcha.php' );
4
 
5
  class SiteGuard_CAPTCHA extends SiteGuard_Base {
6
- var $captcha;
7
- var $prefix;
8
- var $word;
9
 
10
  function __construct( ) {
11
- global $config;
12
- if ( '1' == $config->get( 'captcha_enable' ) && 'xmlrpc.php' != basename( $_SERVER['SCRIPT_NAME'] ) ) {
13
  $this->captcha = new SiteGuardReallySimpleCaptcha( );
14
- $this->captcha->bg = array( 255, 255, 255 );
15
 
16
  add_filter( 'shake_error_codes', array( $this, 'handler_shake_error_codes' ) );
17
 
18
  // for logiin
19
- if ( '0' != $config->get( 'captcha_login' ) ) {
20
  add_filter( 'login_form', array( $this, 'handler_login_form' ) );
21
  add_filter( 'wp_authenticate_user', array( $this, 'handler_wp_authenticate_user' ), 1, 2 );
22
  }
23
  // for lost password
24
- if ( '0' != $config->get( 'captcha_lostpasswd' ) ) {
25
  add_filter( 'lostpassword_form', array( $this, 'handler_lostpassword_form' ) );
26
  add_filter( 'lostpassword_post', array( $this, 'handler_lostpassword_post' ), 1 );
27
  }
28
  // for register user
29
- if ( '0' != $config->get( 'captcha_registuser' ) ) {
30
  add_filter( 'register_form', array( $this, 'handler_register_form' ) );
31
  add_action( 'registration_errors', array( $this, 'handler_registration_errors' ), 10, 3 );
32
  }
33
  // for comment
34
- if ( '0' != $config->get( 'captcha_comment' ) ) {
35
  add_action( 'comment_form_after_fields', array( $this, 'handler_comment_form' ), 1 );
36
  add_action( 'comment_form_logged_in_after', array( $this, 'handler_comment_form' ), 1 );
37
  add_action( 'comment_form', array( $this, 'handler_comment_form' ) );
38
  add_filter( 'preprocess_comment', array( $this, 'handler_process_comment_post' ) );
39
  }
40
  }
41
- if ( '1' == $config->get( 'same_login_error' ) ) {
42
  add_filter( 'login_errors', array( $this, 'handler_login_errors' ) );
43
  }
44
  }
45
  function check_requirements( ) {
46
- $error = check_multisite( );
47
  if ( is_wp_error( $error ) ) {
48
  return $error;
49
  }
@@ -55,6 +54,22 @@ class SiteGuard_CAPTCHA extends SiteGuard_Base {
55
  if ( is_wp_error( $error ) ) {
56
  return $error;
57
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  return true;
59
  }
60
  function check_extensions( ) {
@@ -74,14 +89,7 @@ class SiteGuard_CAPTCHA extends SiteGuard_Base {
74
 
75
  $message = esc_html__( 'In order to enable this function, it is necessary to install expanded modules', 'siteguard' );
76
  $message .= ' ( ';
77
- $count = 0;
78
- foreach ( $error_extensions as $extension ) {
79
- if ( 0 != $count ) {
80
- $message .= ', ';
81
- }
82
- $message .= $extension;
83
- $count ++;
84
- }
85
  $message .= ' ) ';
86
  $message .= esc_html__( 'in the server.', 'siteguard' );
87
 
@@ -90,21 +98,42 @@ class SiteGuard_CAPTCHA extends SiteGuard_Base {
90
  }
91
  function check_image_access( ) {
92
  if ( is_object( $this->captcha ) ) {
93
- $this->captcha->make_tmp_dir( );
94
  } else {
95
  $captcha = new SiteGuardReallySimpleCaptcha( );
96
- $captcha->make_tmp_dir( );
97
  }
98
- $result = wp_remote_get( SITEGUARD_URL_PATH . 'really-simple-captcha/tmp/dummy.png' );
99
- if ( ! is_wp_error( $result ) && 200 === $result['response']['code'] ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  return true;
101
  }
102
- $message = esc_html__( 'In order to enable this function, it is necessary to specify Limit to AllowOverride in httpd.conf.', 'siteguard' );
103
  $error = new WP_Error( 'siteguard_captcha', $message );
104
  return $error;
105
  }
106
  function handler_login_errors( $error ) {
107
- if ( strlen( $error ) > 0 && false === strpos( $error, esc_html__( 'ERROR: LOGIN LOCKED', 'siteguard' ) ) && false === strpos( $error, esc_html__( 'ERROR: Please login entry again', 'siteguard' ) ) ) {
108
  $error = esc_html__( 'ERROR: Please check the input and resend.', 'siteguard' );
109
  }
110
  return $error;
@@ -115,30 +144,30 @@ class SiteGuard_CAPTCHA extends SiteGuard_Base {
115
  }
116
 
117
  function init( ) {
118
- global $config;
119
  $errors = $this->check_requirements( );
120
  if ( ! is_wp_error( $errors ) ) {
121
  $switch = '1';
122
  } else {
123
  $switch = '0';
124
  }
125
- $config->set( 'captcha_enable', $switch );
126
  $language = get_bloginfo( 'language' );
127
  if ( 'ja' == $language ) {
128
  $mode = '1'; // hiragana
129
  } else {
130
  $mode = '2'; // alphanumeric
131
  }
132
- $config->set( 'captcha_login', $mode );
133
- $config->set( 'captcha_comment', $mode );
134
- $config->set( 'captcha_lostpasswd', $mode );
135
- $config->set( 'captcha_registuser', $mode );
136
- if ( true === check_multisite( ) ) {
137
- $config->set( 'same_login_error', '1' );
138
  } else {
139
- $config->set( 'same_login_error', '0' );
140
  }
141
- $config->update( );
142
  }
143
  function get_captcha( ) {
144
  $result = '<p>';
@@ -158,32 +187,32 @@ class SiteGuard_CAPTCHA extends SiteGuard_Base {
158
  echo $this->get_captcha( );
159
  }
160
  function handler_login_form( ) {
161
- global $config;
162
- ( '2' == $config->get( 'captcha_login' ) ) ? $this->captcha->lang_mode = 'en' : $this->captcha->lang_mode = 'jp';
163
  $this->put_captcha( );
164
  }
165
  function handler_comment_form( $post_id ) {
166
- global $config;
167
- if ( defined( 'PUT_COMMENT_FORM' ) ) {
168
  return;
169
  }
170
- ( '2' == $config->get( 'captcha_comment' ) ) ? $this->captcha->lang_mode = 'en' : $this->captcha->lang_mode = 'jp';
171
  $this->put_captcha( );
172
- define( 'PUT_COMMENT_FORM', '1' );
173
  }
174
  function handler_lostpassword_form( ) {
175
- global $config;
176
- ( '2' == $config->get( 'captcha_lostpasswd' ) ) ? $this->captcha->lang_mode = 'en' : $this->captcha->lang_mode = 'jp';
177
  $this->put_captcha( );
178
  }
179
  function handler_register_form( ) {
180
- global $config;
181
- ( '2' == $config->get( 'captcha_registuser' ) ) ? $this->captcha->lang_mode = 'en' : $this->captcha->lang_mode = 'jp';
182
  $this->put_captcha( );
183
  }
184
  function handler_wp_authenticate_user( $user, $password ) {
185
  if ( array_key_exists( 'siteguard_captcha', $_POST ) && array_key_exists( 'siteguard_captcha_prefix', $_POST ) ) {
186
- if ( $this->captcha->check( $_POST['siteguard_captcha_prefix'], $_POST['siteguard_captcha'] ) ) {
187
  return $user;
188
  }
189
  }
@@ -196,7 +225,7 @@ class SiteGuard_CAPTCHA extends SiteGuard_Base {
196
  }
197
  function handler_lostpassword_post( ) {
198
  if ( array_key_exists( 'siteguard_captcha', $_POST ) && array_key_exists( 'siteguard_captcha_prefix', $_POST ) ) {
199
- if ( $this->captcha->check( $_POST['siteguard_captcha_prefix'], $_POST['siteguard_captcha'] ) ) {
200
  return;
201
  }
202
  }
@@ -204,7 +233,7 @@ class SiteGuard_CAPTCHA extends SiteGuard_Base {
204
  }
205
  function handler_registration_errors( $errors, $sanitized_user_login, $user_email ) {
206
  if ( array_key_exists( 'siteguard_captcha', $_POST ) && array_key_exists( 'siteguard_captcha_prefix', $_POST ) ) {
207
- if ( $this->captcha->check( $_POST['siteguard_captcha_prefix'], $_POST['siteguard_captcha'] ) ) {
208
  return $errors;
209
  }
210
  }
@@ -218,7 +247,7 @@ class SiteGuard_CAPTCHA extends SiteGuard_Base {
218
  }
219
  if ( array_key_exists( 'siteguard_captcha', $_POST ) && array_key_exists( 'siteguard_captcha_prefix', $_POST ) ) {
220
  if ( ! empty( $_POST['siteguard_captcha'] ) ) {
221
- if ( $this->captcha->check( $_POST['siteguard_captcha_prefix'], $_POST['siteguard_captcha'] ) ) {
222
  return $comment;
223
  }
224
  }
@@ -226,5 +255,3 @@ class SiteGuard_CAPTCHA extends SiteGuard_Base {
226
  wp_die( esc_html__( 'ERROR: Invalid CAPTCHA.', 'siteguard' ) );
227
  }
228
  }
229
-
230
- ?>
3
  include_once( SITEGUARD_PATH . 'really-simple-captcha/siteguard-really-simple-captcha.php' );
4
 
5
  class SiteGuard_CAPTCHA extends SiteGuard_Base {
6
+ protected $captcha;
7
+ protected $prefix;
8
+ protected $word;
9
 
10
  function __construct( ) {
11
+ global $siteguard_config;
12
+ if ( '1' == $siteguard_config->get( 'captcha_enable' ) && 'xmlrpc.php' != basename( $_SERVER['SCRIPT_NAME'] ) ) {
13
  $this->captcha = new SiteGuardReallySimpleCaptcha( );
 
14
 
15
  add_filter( 'shake_error_codes', array( $this, 'handler_shake_error_codes' ) );
16
 
17
  // for logiin
18
+ if ( '0' !== $siteguard_config->get( 'captcha_login' ) ) {
19
  add_filter( 'login_form', array( $this, 'handler_login_form' ) );
20
  add_filter( 'wp_authenticate_user', array( $this, 'handler_wp_authenticate_user' ), 1, 2 );
21
  }
22
  // for lost password
23
+ if ( '0' !== $siteguard_config->get( 'captcha_lostpasswd' ) ) {
24
  add_filter( 'lostpassword_form', array( $this, 'handler_lostpassword_form' ) );
25
  add_filter( 'lostpassword_post', array( $this, 'handler_lostpassword_post' ), 1 );
26
  }
27
  // for register user
28
+ if ( '0' !== $siteguard_config->get( 'captcha_registuser' ) ) {
29
  add_filter( 'register_form', array( $this, 'handler_register_form' ) );
30
  add_action( 'registration_errors', array( $this, 'handler_registration_errors' ), 10, 3 );
31
  }
32
  // for comment
33
+ if ( '0' !== $siteguard_config->get( 'captcha_comment' ) ) {
34
  add_action( 'comment_form_after_fields', array( $this, 'handler_comment_form' ), 1 );
35
  add_action( 'comment_form_logged_in_after', array( $this, 'handler_comment_form' ), 1 );
36
  add_action( 'comment_form', array( $this, 'handler_comment_form' ) );
37
  add_filter( 'preprocess_comment', array( $this, 'handler_process_comment_post' ) );
38
  }
39
  }
40
+ if ( '1' == $siteguard_config->get( 'same_login_error' ) ) {
41
  add_filter( 'login_errors', array( $this, 'handler_login_errors' ) );
42
  }
43
  }
44
  function check_requirements( ) {
45
+ $error = siteguard_check_multisite( );
46
  if ( is_wp_error( $error ) ) {
47
  return $error;
48
  }
54
  if ( is_wp_error( $error ) ) {
55
  return $error;
56
  }
57
+ $error = $this->check_support_freetype( );
58
+ if ( is_wp_error( $error ) ) {
59
+ return $error;
60
+ }
61
+ $error = $this->check_htaccess( );
62
+ if ( is_wp_error( $error ) ) {
63
+ return $error;
64
+ }
65
+ return true;
66
+ }
67
+ function check_htaccess( ) {
68
+ if ( false === SiteGuard_Htaccess::test_htaccess( ) ) {
69
+ $message = esc_html__( 'mod_rewrite of .htaccess can not be used', 'siteguard' );
70
+ $error = new WP_Error( 'siteguard_captcha', $message );
71
+ return $error;
72
+ }
73
  return true;
74
  }
75
  function check_extensions( ) {
89
 
90
  $message = esc_html__( 'In order to enable this function, it is necessary to install expanded modules', 'siteguard' );
91
  $message .= ' ( ';
92
+ $message .= implode( ', ', $error_extensions );
 
 
 
 
 
 
 
93
  $message .= ' ) ';
94
  $message .= esc_html__( 'in the server.', 'siteguard' );
95
 
98
  }
99
  function check_image_access( ) {
100
  if ( is_object( $this->captcha ) ) {
101
+ $ret = $this->captcha->make_tmp_dir( );
102
  } else {
103
  $captcha = new SiteGuardReallySimpleCaptcha( );
104
+ $ret = $captcha->make_tmp_dir( );
105
  }
106
+ if ( false === $ret ) {
107
+ $message = esc_html__( 'The image file write failed.', 'siteguard' );
108
+ $error = new WP_Error( 'siteguard_captcha', $message );
109
+ return $error;
110
+ }
111
+
112
+ return true;
113
+ # $result = wp_remote_get( SITEGUARD_URL_PATH . 'really-simple-captcha/tmp/dummy.png' );
114
+ # if ( ! is_wp_error( $result ) && 200 === $result['response']['code'] ) {
115
+ # return true;
116
+ # }
117
+
118
+ # $message = esc_html__( 'The image file access failed.', 'siteguard' );
119
+ # if ( is_wp_error( $result ) ) {
120
+ # $error_detail = '( Error: ' . $result->get_error_message( ) . ' )';
121
+ # } else {
122
+ # $error_detail = '( ResponseCode: ' . $result['response']['code'] . ' )';
123
+ # }
124
+ # $error = new WP_Error( 'siteguard_captcha', $message . $error_detail);
125
+ # return $error;
126
+ }
127
+ function check_support_freetype( ) {
128
+ if ( function_exists( 'imagettftext' ) ) {
129
  return true;
130
  }
131
+ $message = esc_html__( 'In order to enable this function, php must be compiled with FreeType support enabled.', 'siteguard' );
132
  $error = new WP_Error( 'siteguard_captcha', $message );
133
  return $error;
134
  }
135
  function handler_login_errors( $error ) {
136
+ if ( strlen( $error ) > 0 && false === strpos( $error, esc_html__( 'ERROR: LOGIN LOCKED', 'siteguard' ) ) ) {
137
  $error = esc_html__( 'ERROR: Please check the input and resend.', 'siteguard' );
138
  }
139
  return $error;
144
  }
145
 
146
  function init( ) {
147
+ global $siteguard_config;
148
  $errors = $this->check_requirements( );
149
  if ( ! is_wp_error( $errors ) ) {
150
  $switch = '1';
151
  } else {
152
  $switch = '0';
153
  }
154
+ $siteguard_config->set( 'captcha_enable', $switch );
155
  $language = get_bloginfo( 'language' );
156
  if ( 'ja' == $language ) {
157
  $mode = '1'; // hiragana
158
  } else {
159
  $mode = '2'; // alphanumeric
160
  }
161
+ $siteguard_config->set( 'captcha_login', $mode );
162
+ $siteguard_config->set( 'captcha_comment', $mode );
163
+ $siteguard_config->set( 'captcha_lostpasswd', $mode );
164
+ $siteguard_config->set( 'captcha_registuser', $mode );
165
+ if ( true === siteguard_check_multisite( ) ) {
166
+ $siteguard_config->set( 'same_login_error', '1' );
167
  } else {
168
+ $siteguard_config->set( 'same_login_error', '0' );
169
  }
170
+ $siteguard_config->update( );
171
  }
172
  function get_captcha( ) {
173
  $result = '<p>';
187
  echo $this->get_captcha( );
188
  }
189
  function handler_login_form( ) {
190
+ global $siteguard_config;
191
+ ( '2' === $siteguard_config->get( 'captcha_login' ) ) ? $this->captcha->set_lang_mode( 'en' ) : $this->captcha->set_lang_mode( 'jp' );
192
  $this->put_captcha( );
193
  }
194
  function handler_comment_form( $post_id ) {
195
+ global $siteguard_config;
196
+ if ( defined( 'SITEGUARD_PUT_COMMENT_FORM' ) ) {
197
  return;
198
  }
199
+ ( '2' === $siteguard_config->get( 'captcha_comment' ) ) ? $this->captcha->set_lang_mode( 'en' ) : $this->captcha->set_lang_mode( 'jp' );
200
  $this->put_captcha( );
201
+ define( 'SITEGUARD_PUT_COMMENT_FORM', '1' );
202
  }
203
  function handler_lostpassword_form( ) {
204
+ global $siteguard_config;
205
+ ( '2' === $siteguard_config->get( 'captcha_lostpasswd' ) ) ? $this->captcha->set_lang_mode( 'en' ) : $this->captcha->set_lang_mode( 'jp' );
206
  $this->put_captcha( );
207
  }
208
  function handler_register_form( ) {
209
+ global $siteguard_config;
210
+ ( '2' == $siteguard_config->get( 'captcha_registuser' ) ) ? $this->captcha->set_lang_mode( 'en' ) : $this->captcha->set_lang_mode( 'jp' );
211
  $this->put_captcha( );
212
  }
213
  function handler_wp_authenticate_user( $user, $password ) {
214
  if ( array_key_exists( 'siteguard_captcha', $_POST ) && array_key_exists( 'siteguard_captcha_prefix', $_POST ) ) {
215
+ if ( $this->captcha->check( $_POST['siteguard_captcha_prefix'], $_POST['siteguard_captcha'], false ) ) {
216
  return $user;
217
  }
218
  }
225
  }
226
  function handler_lostpassword_post( ) {
227
  if ( array_key_exists( 'siteguard_captcha', $_POST ) && array_key_exists( 'siteguard_captcha_prefix', $_POST ) ) {
228
+ if ( $this->captcha->check( $_POST['siteguard_captcha_prefix'], $_POST['siteguard_captcha'], false ) ) {
229
  return;
230
  }
231
  }
233
  }
234
  function handler_registration_errors( $errors, $sanitized_user_login, $user_email ) {
235
  if ( array_key_exists( 'siteguard_captcha', $_POST ) && array_key_exists( 'siteguard_captcha_prefix', $_POST ) ) {
236
+ if ( $this->captcha->check( $_POST['siteguard_captcha_prefix'], $_POST['siteguard_captcha'], false ) ) {
237
  return $errors;
238
  }
239
  }
247
  }
248
  if ( array_key_exists( 'siteguard_captcha', $_POST ) && array_key_exists( 'siteguard_captcha_prefix', $_POST ) ) {
249
  if ( ! empty( $_POST['siteguard_captcha'] ) ) {
250
+ if ( $this->captcha->check( $_POST['siteguard_captcha_prefix'], $_POST['siteguard_captcha'], false ) ) {
251
  return $comment;
252
  }
253
  }
255
  wp_die( esc_html__( 'ERROR: Invalid CAPTCHA.', 'siteguard' ) );
256
  }
257
  }
 
 
classes/siteguard-config.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  class SiteGuard_Config {
4
- var $config;
5
  function __construct() {
6
  $this->config = get_option( 'siteguard_config' );
7
  }
@@ -9,12 +9,9 @@ class SiteGuard_Config {
9
  $this->config[ $key ] = $value;
10
  }
11
  function get( $key ) {
12
- $this->config = get_option( 'siteguard_config' );
13
  return isset( $this->config[ $key ] ) ? $this->config[ $key ] : '';
14
  }
15
  function update( ) {
16
  update_option( 'siteguard_config', $this->config );
17
  }
18
  }
19
-
20
- ?>
1
  <?php
2
 
3
  class SiteGuard_Config {
4
+ protected $config;
5
  function __construct() {
6
  $this->config = get_option( 'siteguard_config' );
7
  }
9
  $this->config[ $key ] = $value;
10
  }
11
  function get( $key ) {
 
12
  return isset( $this->config[ $key ] ) ? $this->config[ $key ] : '';
13
  }
14
  function update( ) {
15
  update_option( 'siteguard_config', $this->config );
16
  }
17
  }
 
 
classes/siteguard-disable-pingback.php CHANGED
@@ -3,19 +3,19 @@
3
  class SiteGuard_Disable_Pingback extends SiteGuard_Base {
4
 
5
  function __construct( ) {
6
- global $config;
7
- if ( '1' == $config->get( 'disable_pingback_enable' ) ) {
8
  add_filter( 'xmlrpc_methods', array( $this, 'handler_xmlrpc_methods' ) );
9
  }
10
  }
11
  function init( ) {
12
- global $config;
13
- if ( true === check_multisite( ) ) {
14
- $config->set( 'disable_pingback_enable', '1' );
15
  } else {
16
- $config->set( 'disable_pingback_enable', '0' );
17
  }
18
- $config->update( );
19
  }
20
  function handler_xmlrpc_methods( $methods ) {
21
  unset( $methods['pingback.ping'] );
@@ -23,5 +23,3 @@ class SiteGuard_Disable_Pingback extends SiteGuard_Base {
23
  return $methods;
24
  }
25
  }
26
-
27
- ?>
3
  class SiteGuard_Disable_Pingback extends SiteGuard_Base {
4
 
5
  function __construct( ) {
6
+ global $siteguard_config;
7
+ if ( '1' == $siteguard_config->get( 'disable_pingback_enable' ) ) {
8
  add_filter( 'xmlrpc_methods', array( $this, 'handler_xmlrpc_methods' ) );
9
  }
10
  }
11
  function init( ) {
12
+ global $siteguard_config;
13
+ if ( true === siteguard_check_multisite( ) ) {
14
+ $siteguard_config->set( 'disable_pingback_enable', '1' );
15
  } else {
16
+ $siteguard_config->set( 'disable_pingback_enable', '0' );
17
  }
18
+ $siteguard_config->update( );
19
  }
20
  function handler_xmlrpc_methods( $methods ) {
21
  unset( $methods['pingback.ping'] );
23
  return $methods;
24
  }
25
  }
 
 
classes/siteguard-disable-xmlrpc.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SiteGuard_Disable_XMLRPC extends SiteGuard_Base {
4
+ public static $htaccess_mark = '#==== SITEGUARD_DISABLE_XMLRPC_SETTINGS';
5
+
6
+ function __construct( ) {
7
+ }
8
+ static function get_mark( ) {
9
+ return SiteGuard_Disable_XMLRPC::$htaccess_mark;
10
+ }
11
+ function init( ) {
12
+ global $siteguard_config;
13
+ $siteguard_config->set( 'disable_xmlrpc_enable', '0' );
14
+ $siteguard_config->update( );
15
+ }
16
+ function update_settings( ) {
17
+ global $siteguard_config;
18
+
19
+ $htaccess_str = "<Files xmlrpc.php>\n";
20
+ $htaccess_str .= " Order allow,deny\n";
21
+ $htaccess_str .= " Deny from all \n";
22
+ $htaccess_str .= "</Files>\n";
23
+
24
+ return $htaccess_str;
25
+ }
26
+ function feature_on( ) {
27
+ global $siteguard_htaccess;
28
+ if ( false === SiteGuard_Htaccess::check_permission( ) ) {
29
+ return false;
30
+ }
31
+ $data = $this->update_settings( );
32
+ $mark = $this->get_mark( );
33
+ return $siteguard_htaccess->update_settings( $mark, $data );
34
+ }
35
+ static function feature_off( ) {
36
+ $mark = SiteGuard_Disable_XMLRPC::get_mark( );
37
+ return SiteGuard_Htaccess::clear_settings( $mark );
38
+ }
39
+ }
classes/siteguard-htaccess.php CHANGED
@@ -1,8 +1,9 @@
1
  <?php
2
 
3
  class SiteGuard_Htaccess extends SiteGuard_Base {
4
- public static $htaccess_mark_start = '#SITEGUARD_PLUGIN_SETTINGS_START';
5
- public static $htaccess_mark_end = '#SITEGUARD_PLUGIN_SETTINGS_END';
 
6
 
7
  function __construct( ) {
8
  }
@@ -12,6 +13,14 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
12
  static function get_tmp_dir( ) {
13
  return SITEGUARD_PATH . 'tmp/';
14
  }
 
 
 
 
 
 
 
 
15
  static function get_htaccess_new_file( ) {
16
  return tempnam( SiteGuard_Htaccess::get_tmp_dir( ), 'htaccess_' );
17
  }
@@ -37,9 +46,9 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
37
  }
38
  static function is_exists_setting( $mark ) {
39
  $result = false;
40
- if ( '' == $mark ) {
41
- $mark_start = SiteGuard_Htaccess::$htaccess_mark_start;
42
- $mark_end = SiteGuard_Htaccess::$htaccess_mark_end;
43
  } else {
44
  $mark_start = $mark . '_START';
45
  $mark_end = $mark . '_END';
@@ -49,7 +58,7 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
49
  return $result;
50
  }
51
  $fr = @fopen( $current_file, 'r' );
52
- if ( null == $fr ) {
53
  return $result;
54
  }
55
  $line_num = 0;
@@ -73,31 +82,66 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
73
 
74
  return $result;
75
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  static function clear_settings( $mark ) {
77
  if ( ! SiteGuard_Htaccess::make_tmp_dir( ) ) {
78
  return false;
79
  }
80
- if ( '' == $mark ) {
81
- $mark_start = SiteGuard_Htaccess::$htaccess_mark_start;
82
- $mark_end = SiteGuard_Htaccess::$htaccess_mark_end;
83
  } else {
84
  $mark_start = $mark . '_START';
85
  $mark_end = $mark . '_END';
86
  }
87
  $flag_settings = false;
88
  $current_file = SiteGuard_Htaccess::get_htaccess_file( );
89
- if ( ! file_exists( $current_file ) ) {
90
- @touch( $current_file );
91
- @chmod( $current_file, 0604 );
92
  }
93
  $fr = @fopen( $current_file, 'r' );
94
- if ( null == $fr ) {
95
  siteguard_error_log( "fopen failed: $current_file" );
96
  return false;
97
  }
98
  $new_file = SiteGuard_Htaccess::get_htaccess_new_file( );
99
  $fw = @fopen( $new_file, 'w' );
100
- if ( null == $fw ) {
101
  siteguard_error_log( "fopen failed: $new_file" );
102
  return false;
103
  }
@@ -106,7 +150,7 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
106
  if ( false !== strpos( $line, $mark_start ) ) {
107
  $flag_settings = true;
108
  }
109
- if ( false == $flag_settings ) {
110
  fputs( $fw, $line, 4096 );
111
  }
112
  if ( true == $flag_settings && false !== strpos( $line, $mark_end ) ) {
@@ -115,7 +159,7 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
115
  }
116
  fclose( $fr );
117
  fclose( $fw );
118
- @chmod( $new_file, 0604 );
119
  if ( ! rename( $new_file, $current_file ) ) {
120
  siteguard_error_log( "rename failed: $new_file $current_file" );
121
  return false;
@@ -136,16 +180,12 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
136
  $mark_wp_start = '# BEGIN WordPress';
137
  $mark_wp_end = '# END WordPress';
138
  $current_file = SiteGuard_Htaccess::get_htaccess_file( );
139
- if ( ! file_exists( $current_file ) ) {
140
- @touch( $current_file );
141
- @chmod( $current_file, 0604 );
142
- }
143
- if ( ! is_readable( $current_file ) ) {
144
- siteguard_error_log( "file not readable: $current_file" );
145
  return false;
146
  }
147
  $fr = @fopen( $current_file, 'r' );
148
- if ( null == $fr ) {
149
  siteguard_error_log( "fopen failed: $current_file" );
150
  return false;
151
  }
@@ -155,7 +195,7 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
155
  return false;
156
  }
157
  $fw = @fopen( $new_file, 'w' );
158
- if ( null == $fw ) {
159
  siteguard_error_log( "fopen failed: $new_file" );
160
  return false;
161
  }
@@ -164,7 +204,7 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
164
 
165
  // Save WordPress settings.
166
  // WordPress settings has to be written after SiteGuard settings.
167
- if ( false == $flag_write && false == $flag_wp_set && false !== strpos( $line, $mark_wp_start ) ) {
168
  $flag_wp = true;
169
  $flag_wp_set = true;
170
  }
@@ -183,34 +223,34 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
183
  $flag_through = false;
184
  continue;
185
  }
186
- if ( false == $flag_write && false !== strpos( $line, SiteGuard_Htaccess::$htaccess_mark_end ) ) {
187
  fwrite( $fw, $mark_start . "\n", strlen( $mark_start ) + 1 );
188
  fwrite( $fw, $data, strlen( $data ) );
189
  fwrite( $fw, $mark_end . "\n", strlen( $mark_end ) + 1 );
190
  $flag_write = true;
191
  }
192
- if ( false == $flag_through && false !== strpos( $line, $mark_end ) ) {
193
  $flag_through = true;
194
  }
195
  if ( $flag_through ) {
196
  fwrite( $fw, $line, strlen( $line ) );
197
- if ( false == $flag_wp && false !== strpos( $line, $mark_wp_start ) ) {
198
  $flag_wp = true;
199
  }
200
  }
201
  }
202
- if ( false == $flag_write ) {
203
- fwrite( $fw, "\n" . SiteGuard_Htaccess::$htaccess_mark_start . "\n", strlen( SiteGuard_Htaccess::$htaccess_mark_start ) + 2 );
204
  fwrite( $fw, $mark_start . "\n", strlen( $mark_start ) + 1 );
205
  fwrite( $fw, $data, strlen( $data ) );
206
  fwrite( $fw, $mark_end . "\n", strlen( $mark_end ) + 1 );
207
- fwrite( $fw, SiteGuard_Htaccess::$htaccess_mark_end . "\n", strlen( SiteGuard_Htaccess::$htaccess_mark_end ) + 1 );
208
  }
209
  if ( '' != $wp_settings ) { // Write saved WordPress Settings
210
  fwrite( $fw, "\n", 1 );
211
  fwrite( $fw, $wp_settings, strlen( $wp_settings ) );
212
  fwrite( $fw, "\n", 1 );
213
- } else if ( false == $flag_wp ) { // Write empty WordPress Settings
214
  fwrite( $fw, "\n", 1 );
215
  fwrite( $fw, $mark_wp_start . "\n", strlen( $mark_wp_start ) + 1 );
216
  fwrite( $fw, $mark_wp_end . "\n", strlen( $mark_wp_end ) + 1 );
@@ -218,7 +258,7 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
218
  }
219
  fclose( $fr );
220
  fclose( $fw );
221
- @chmod( $new_file, 0604 );
222
  if ( ! rename( $new_file, $current_file ) ) {
223
  siteguard_error_log( "rename failed: $new_file $current_file" );
224
  return false;
@@ -226,5 +266,3 @@ class SiteGuard_Htaccess extends SiteGuard_Base {
226
  return true;
227
  }
228
  }
229
-
230
- ?>
1
  <?php
2
 
3
  class SiteGuard_Htaccess extends SiteGuard_Base {
4
+ const HTACCESS_PERMISSION = 0604;
5
+ const HTACCESS_MARK_START = '#SITEGUARD_PLUGIN_SETTINGS_START';
6
+ const HTACCESS_MARK_END = '#SITEGUARD_PLUGIN_SETTINGS_END';
7
 
8
  function __construct( ) {
9
  }
13
  static function get_tmp_dir( ) {
14
  return SITEGUARD_PATH . 'tmp/';
15
  }
16
+ static function test_htaccess( ) {
17
+ return true;
18
+ # $result = wp_remote_get( SITEGUARD_URL_PATH . 'test/siteguard-test.php' );
19
+ # if ( ! is_wp_error( $result ) && 200 === $result['response']['code'] ) {
20
+ # return true;
21
+ # }
22
+ # return false;
23
+ }
24
  static function get_htaccess_new_file( ) {
25
  return tempnam( SiteGuard_Htaccess::get_tmp_dir( ), 'htaccess_' );
26
  }
46
  }
47
  static function is_exists_setting( $mark ) {
48
  $result = false;
49
+ if ( '' === $mark ) {
50
+ $mark_start = self::HTACCESS_MARK_START;
51
+ $mark_end = self::HTACCESS_MARK_END;
52
  } else {
53
  $mark_start = $mark . '_START';
54
  $mark_end = $mark . '_END';
58
  return $result;
59
  }
60
  $fr = @fopen( $current_file, 'r' );
61
+ if ( null === $fr ) {
62
  return $result;
63
  }
64
  $line_num = 0;
82
 
83
  return $result;
84
  }
85
+ static function check_permission( $flag_create = true ) {
86
+ $file = SiteGuard_Htaccess::get_htaccess_file( );
87
+ if ( true === $flag_create ) {
88
+ self::get_apply_permission( $file );
89
+ }
90
+ if ( ! is_readable( $file ) ) {
91
+ siteguard_error_log( "file not readable: $file" );
92
+ return false;
93
+ }
94
+ if ( ! is_writable( $file ) ) {
95
+ siteguard_error_log( "file not writable: $file" );
96
+ return false;
97
+ }
98
+ $path = pathinfo( $file, PATHINFO_DIRNAME );
99
+ if ( ! is_writable( $path ) ) {
100
+ siteguard_error_log( 'directory not writable: ' . path );
101
+ return false;
102
+ }
103
+ return true;
104
+ }
105
+ static function get_apply_permission_itr( $file ) {
106
+ clearstatcache( );
107
+ $perm = intval( substr( sprintf( '%o', fileperms( $file ) ), -4 ), 8 );
108
+ return $perm;
109
+ }
110
+ static function get_apply_permission( $file ) {
111
+ $perm = self::HTACCESS_PERMISSION;
112
+ if ( file_exists( $file ) ) {
113
+ $perm = self::get_apply_permission_itr( $file );
114
+ } else {
115
+ @touch( $file );
116
+ }
117
+ @chmod( $file, $perm );
118
+ return $perm;
119
+ }
120
  static function clear_settings( $mark ) {
121
  if ( ! SiteGuard_Htaccess::make_tmp_dir( ) ) {
122
  return false;
123
  }
124
+ if ( '' === $mark ) {
125
+ $mark_start = self::HTACCESS_MARK_START;
126
+ $mark_end = self::HTACCESS_MARK_END;
127
  } else {
128
  $mark_start = $mark . '_START';
129
  $mark_end = $mark . '_END';
130
  }
131
  $flag_settings = false;
132
  $current_file = SiteGuard_Htaccess::get_htaccess_file( );
133
+ $perm = self::get_apply_permission( $current_file );
134
+ if ( ! self::check_permission( false ) ) {
135
+ return false;
136
  }
137
  $fr = @fopen( $current_file, 'r' );
138
+ if ( null === $fr ) {
139
  siteguard_error_log( "fopen failed: $current_file" );
140
  return false;
141
  }
142
  $new_file = SiteGuard_Htaccess::get_htaccess_new_file( );
143
  $fw = @fopen( $new_file, 'w' );
144
+ if ( null === $fw ) {
145
  siteguard_error_log( "fopen failed: $new_file" );
146
  return false;
147
  }
150
  if ( false !== strpos( $line, $mark_start ) ) {
151
  $flag_settings = true;
152
  }
153
+ if ( false === $flag_settings ) {
154
  fputs( $fw, $line, 4096 );
155
  }
156
  if ( true == $flag_settings && false !== strpos( $line, $mark_end ) ) {
159
  }
160
  fclose( $fr );
161
  fclose( $fw );
162
+ @chmod( $new_file, $perm );
163
  if ( ! rename( $new_file, $current_file ) ) {
164
  siteguard_error_log( "rename failed: $new_file $current_file" );
165
  return false;
180
  $mark_wp_start = '# BEGIN WordPress';
181
  $mark_wp_end = '# END WordPress';
182
  $current_file = SiteGuard_Htaccess::get_htaccess_file( );
183
+ $perm = self::get_apply_permission( $current_file );
184
+ if ( ! self::check_permission( false ) ) {
 
 
 
 
185
  return false;
186
  }
187
  $fr = @fopen( $current_file, 'r' );
188
+ if ( null === $fr ) {
189
  siteguard_error_log( "fopen failed: $current_file" );
190
  return false;
191
  }
195
  return false;
196
  }
197
  $fw = @fopen( $new_file, 'w' );
198
+ if ( null === $fw ) {
199
  siteguard_error_log( "fopen failed: $new_file" );
200
  return false;
201
  }
204
 
205
  // Save WordPress settings.
206
  // WordPress settings has to be written after SiteGuard settings.
207
+ if ( false === $flag_write && false == $flag_wp_set && false !== strpos( $line, $mark_wp_start ) ) {
208
  $flag_wp = true;
209
  $flag_wp_set = true;
210
  }
223
  $flag_through = false;
224
  continue;
225
  }
226
+ if ( false === $flag_write && false !== strpos( $line, self::HTACCESS_MARK_END ) ) {
227
  fwrite( $fw, $mark_start . "\n", strlen( $mark_start ) + 1 );
228
  fwrite( $fw, $data, strlen( $data ) );
229
  fwrite( $fw, $mark_end . "\n", strlen( $mark_end ) + 1 );
230
  $flag_write = true;
231
  }
232
+ if ( false === $flag_through && false !== strpos( $line, $mark_end ) ) {
233
  $flag_through = true;
234
  }
235
  if ( $flag_through ) {
236
  fwrite( $fw, $line, strlen( $line ) );
237
+ if ( false === $flag_wp && false !== strpos( $line, $mark_wp_start ) ) {
238
  $flag_wp = true;
239
  }
240
  }
241
  }
242
+ if ( false === $flag_write ) {
243
+ fwrite( $fw, "\n" . self::HTACCESS_MARK_START . "\n", strlen( self::HTACCESS_MARK_START ) + 2 );
244
  fwrite( $fw, $mark_start . "\n", strlen( $mark_start ) + 1 );
245
  fwrite( $fw, $data, strlen( $data ) );
246
  fwrite( $fw, $mark_end . "\n", strlen( $mark_end ) + 1 );
247
+ fwrite( $fw, self::HTACCESS_MARK_END . "\n", strlen( self::HTACCESS_MARK_END ) + 1 );
248
  }
249
  if ( '' != $wp_settings ) { // Write saved WordPress Settings
250
  fwrite( $fw, "\n", 1 );
251
  fwrite( $fw, $wp_settings, strlen( $wp_settings ) );
252
  fwrite( $fw, "\n", 1 );
253
+ } else if ( false === $flag_wp ) { // Write empty WordPress Settings
254
  fwrite( $fw, "\n", 1 );
255
  fwrite( $fw, $mark_wp_start . "\n", strlen( $mark_wp_start ) + 1 );
256
  fwrite( $fw, $mark_wp_end . "\n", strlen( $mark_wp_end ) + 1 );
258
  }
259
  fclose( $fr );
260
  fclose( $fw );
261
+ @chmod( $new_file, $perm );
262
  if ( ! rename( $new_file, $current_file ) ) {
263
  siteguard_error_log( "rename failed: $new_file $current_file" );
264
  return false;
266
  return true;
267
  }
268
  }
 
 
classes/siteguard-login-alert.php CHANGED
@@ -2,22 +2,22 @@
2
 
3
  class SiteGuard_LoginAlert extends SiteGuard_Base {
4
  function __construct( ) {
5
- global $config;
6
- if ( '1' == $config->get( 'loginalert_enable' ) ) {
7
  add_action( 'wp_login', array( $this, 'handler_wp_login' ), 10, 2 );
8
  }
9
  }
10
  function init( ) {
11
- global $config;
12
- if ( true === check_multisite( ) ) {
13
- $config->set( 'loginalert_enable', '1' );
14
  } else {
15
- $config->set( 'loginalert_enable', '0' );
16
  }
17
- $config->set( 'loginalert_admin_only', '1' );
18
- $config->set( 'loginalert_subject', __( 'New login at %SITENAME%', 'siteguard' ) );
19
- $config->set( 'loginalert_body', __( "%USERNAME% logged in at %DATE% %TIME%\n\n== Login information ==\nIP Address: %IPADDRESS%\nReferer: %REFERER%\nUser-Agent: %USERAGENT%\n\n--\nSiteGuard WP Plugin", 'siteguard' ) );
20
- $config->update( );
21
  }
22
  function replace_valuable( $string, $username ) {
23
  $search = array( '%SITENAME%', '%USERNAME%', '%DATE%', '%TIME%', '%IPADDRESS%', '%USERAGENT%', '%REFERER%' );
@@ -26,31 +26,31 @@ class SiteGuard_LoginAlert extends SiteGuard_Base {
26
  $username,
27
  date( 'Y-m-d', current_time( 'timestamp' ) ),
28
  date( 'H:i:s', current_time( 'timestamp' ) ),
29
- isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : '-',
30
  isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '-',
31
  isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '-',
32
  );
33
  return str_replace( $search, $replace, $string );
34
  }
35
  function handler_wp_login( $username, $user ) {
36
- global $config;
37
 
38
- if ( ( '1' == $config->get( 'loginalert_admin_only' ) ) && ( ! $user->has_cap( 'administrator' ) ) ) {
39
  return;
40
  }
41
 
42
  $user_email = $user->get( 'user_email' );
43
 
44
- $subject = $config->get( 'loginalert_subject' );
45
- $body = $config->get( 'loginalert_body' );
46
 
47
  $subject = $this->replace_valuable( $subject, $username );
48
  $body = $this->replace_valuable( $body, $username );
49
 
50
- @wp_mail( $user_email, esc_html( $subject ), esc_html( $body ) );
 
 
51
 
52
  return;
53
  }
54
  }
55
-
56
- ?>
2
 
3
  class SiteGuard_LoginAlert extends SiteGuard_Base {
4
  function __construct( ) {
5
+ global $siteguard_config;
6
+ if ( '1' == $siteguard_config->get( 'loginalert_enable' ) ) {
7
  add_action( 'wp_login', array( $this, 'handler_wp_login' ), 10, 2 );
8
  }
9
  }
10
  function init( ) {
11
+ global $siteguard_config;
12
+ if ( true === siteguard_check_multisite( ) ) {
13
+ $siteguard_config->set( 'loginalert_enable', '1' );
14
  } else {
15
+ $siteguard_config->set( 'loginalert_enable', '0' );
16
  }
17
+ $siteguard_config->set( 'loginalert_admin_only', '1' );
18
+ $siteguard_config->set( 'loginalert_subject', __( 'New login at %SITENAME%', 'siteguard' ) );
19
+ $siteguard_config->set( 'loginalert_body', __( "%USERNAME% logged in at %DATE% %TIME%\n\n== Login information ==\nIP Address: %IPADDRESS%\nReferer: %REFERER%\nUser-Agent: %USERAGENT%\n\n--\nSiteGuard WP Plugin", 'siteguard' ) );
20
+ $siteguard_config->update( );
21
  }
22
  function replace_valuable( $string, $username ) {
23
  $search = array( '%SITENAME%', '%USERNAME%', '%DATE%', '%TIME%', '%IPADDRESS%', '%USERAGENT%', '%REFERER%' );
26
  $username,
27
  date( 'Y-m-d', current_time( 'timestamp' ) ),
28
  date( 'H:i:s', current_time( 'timestamp' ) ),
29
+ $this->get_ip( ),
30
  isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '-',
31
  isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '-',
32
  );
33
  return str_replace( $search, $replace, $string );
34
  }
35
  function handler_wp_login( $username, $user ) {
36
+ global $siteguard_config;
37
 
38
+ if ( ( '1' == $siteguard_config->get( 'loginalert_admin_only' ) ) && ( ! $user->has_cap( 'administrator' ) ) ) {
39
  return;
40
  }
41
 
42
  $user_email = $user->get( 'user_email' );
43
 
44
+ $subject = $siteguard_config->get( 'loginalert_subject' );
45
+ $body = $siteguard_config->get( 'loginalert_body' );
46
 
47
  $subject = $this->replace_valuable( $subject, $username );
48
  $body = $this->replace_valuable( $body, $username );
49
 
50
+ if ( true !== @wp_mail( $user_email, esc_html( $subject ), esc_html( $body ) ) ) {
51
+ siteguard_error_log( 'Failed send mail. To:' . $user_email . ' Subject:' . esc_html( $subject ) );
52
+ }
53
 
54
  return;
55
  }
56
  }
 
 
classes/siteguard-login-history.php CHANGED
@@ -15,6 +15,9 @@ class SiteGuard_LoginHistory extends SiteGuard_Base {
15
  # 1: Login success
16
  # 2: Fail once
17
  # 3: Login lock
 
 
 
18
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_HISTORY;
19
  $sql = "CREATE TABLE $table_name (
20
  id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -22,29 +25,51 @@ class SiteGuard_LoginHistory extends SiteGuard_Base {
22
  ip_address VARCHAR(40) NOT NULL DEFAULT '',
23
  operation INT NOT NULL DEFAULT 0,
24
  time datetime,
 
25
  UNIQUE KEY id (id)
26
  )
27
  CHARACTER SET 'utf8';";
28
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
29
  dbDelta( $sql );
30
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  function handler_wp_login( $login, $current_user ) {
32
 
33
  if ( '' == $current_user->user_login ) {
34
  return;
35
  }
36
- $this->add_operation( SITEGUARD_LOGIN_SUCCESS, $current_user->user_login );
37
  }
38
  function handler_wp_login_failed( $username ) {
39
- global $loginlock;
40
- $this->add_operation( $loginlock->get_status( ), $username );
41
  }
42
  function handler_xmlrpc_call( $method ) {
43
  $current_user = wp_get_current_user( );
44
  if ( '' == $current_user->user_login ) {
45
  return;
46
  }
47
- $this->add_operation( SITEGUARD_LOGIN_SUCCESS, $current_user->user_login );
48
  }
49
  function is_exist( $user, $operation, $after_sec, $less_sec ) {
50
  global $wpdb;
@@ -54,7 +79,7 @@ class SiteGuard_LoginHistory extends SiteGuard_Base {
54
  }
55
 
56
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_HISTORY;
57
- $ip_address = $_SERVER['REMOTE_ADDR'];
58
  $now = current_time( 'mysql' );
59
  $id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $table_name WHERE ip_address = %s AND login_name = %s AND operation = %d AND time BETWEEN %s - INTERVAL %d SECOND AND %s - INTERVAL %d SECOND; ", $ip_address, $user, $operation, $now, $less_sec, $now, $after_sec ) );
60
  if ( null == $id ) {
@@ -62,7 +87,7 @@ class SiteGuard_LoginHistory extends SiteGuard_Base {
62
  }
63
  return true;
64
  }
65
- function add_operation( $operation, $user_login ) {
66
  global $current_user;
67
  global $wpdb;
68
 
@@ -78,14 +103,15 @@ class SiteGuard_LoginHistory extends SiteGuard_Base {
78
  // delete old event
79
  $id = $wpdb->get_var( "SELECT id FROM $table_name ORDER BY id DESC LIMIT 9999,1;", 0, 0 );
80
  if ( null != $id ) {
81
- $wpdb->query( "DELETE FROM $table_name WHERE id < $id;" );
82
  }
83
- $ip_address = $_SERVER['REMOTE_ADDR'];
84
  $data = array(
85
  'operation' => $operation,
86
  'login_name' => $user,
87
  'ip_address' => $ip_address,
88
  'time' => current_time( 'mysql' ),
 
89
  );
90
  $wpdb->insert( $table_name, $data );
91
 
@@ -111,12 +137,71 @@ class SiteGuard_LoginHistory extends SiteGuard_Base {
111
  }
112
  return $result;
113
  }
114
- function get_history( ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  global $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_HISTORY;
117
- $results = $wpdb->get_results( "SELECT id, operation, login_name, ip_address, time FROM $table_name;", ARRAY_A );
 
 
 
 
 
118
  return $results;
119
  }
120
  }
121
-
122
- ?>
15
  # 1: Login success
16
  # 2: Fail once
17
  # 3: Login lock
18
+ # type
19
+ # 0: login page
20
+ # 1: xmlrpc
21
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_HISTORY;
22
  $sql = "CREATE TABLE $table_name (
23
  id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
25
  ip_address VARCHAR(40) NOT NULL DEFAULT '',
26
  operation INT NOT NULL DEFAULT 0,
27
  time datetime,
28
+ type INT NOT NULL DEFAULT 0,
29
  UNIQUE KEY id (id)
30
  )
31
  CHARACTER SET 'utf8';";
32
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
33
  dbDelta( $sql );
34
  }
35
+ function get_type( ) {
36
+ $type = SITEGUARD_LOGIN_TYPE_NORMAL;
37
+ if ( basename( $_SERVER['SCRIPT_NAME'] ) == 'xmlrpc.php' ) {
38
+ $type = SITEGUARD_LOGIN_TYPE_XMLRPC;
39
+ }
40
+ return $type;
41
+ }
42
+ function check_operation( $operation ) {
43
+ $items = array( SITEGUARD_LOGIN_SUCCESS, SITEGUARD_LOGIN_FAILED, SITEGUARD_LOGIN_FAIL_ONCE, SITEGUARD_LOGIN_LOCKED );
44
+ if ( in_array( $operation, $items ) ) {
45
+ return true;
46
+ }
47
+ return false;
48
+ }
49
+ function check_type( $type ) {
50
+ $items = array( SITEGUARD_LOGIN_TYPE_NORMAL, SITEGUARD_LOGIN_TYPE_XMLRPC );
51
+ if ( in_array( $type, $items ) ) {
52
+ return true;
53
+ }
54
+ return false;
55
+ }
56
  function handler_wp_login( $login, $current_user ) {
57
 
58
  if ( '' == $current_user->user_login ) {
59
  return;
60
  }
61
+ $this->add_operation( SITEGUARD_LOGIN_SUCCESS, $current_user->user_login, $this->get_type( ) );
62
  }
63
  function handler_wp_login_failed( $username ) {
64
+ global $siteguard_loginlock;
65
+ $this->add_operation( $siteguard_loginlock->get_status( ), $username, $this->get_type( ) );
66
  }
67
  function handler_xmlrpc_call( $method ) {
68
  $current_user = wp_get_current_user( );
69
  if ( '' == $current_user->user_login ) {
70
  return;
71
  }
72
+ $this->add_operation( SITEGUARD_LOGIN_SUCCESS, $current_user->user_login, SITEGUARD_LOGIN_TYPE_XMLRPC );
73
  }
74
  function is_exist( $user, $operation, $after_sec, $less_sec ) {
75
  global $wpdb;
79
  }
80
 
81
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_HISTORY;
82
+ $ip_address = $this->get_ip( );
83
  $now = current_time( 'mysql' );
84
  $id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $table_name WHERE ip_address = %s AND login_name = %s AND operation = %d AND time BETWEEN %s - INTERVAL %d SECOND AND %s - INTERVAL %d SECOND; ", $ip_address, $user, $operation, $now, $less_sec, $now, $after_sec ) );
85
  if ( null == $id ) {
87
  }
88
  return true;
89
  }
90
+ function add_operation( $operation, $user_login, $type = SITEGUARD_LOGIN_TYPE_NORMAL ) {
91
  global $current_user;
92
  global $wpdb;
93
 
103
  // delete old event
104
  $id = $wpdb->get_var( "SELECT id FROM $table_name ORDER BY id DESC LIMIT 9999,1;", 0, 0 );
105
  if ( null != $id ) {
106
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $table_name WHERE id <= %d;", $id ) );
107
  }
108
+ $ip_address = $this->get_ip( );
109
  $data = array(
110
  'operation' => $operation,
111
  'login_name' => $user,
112
  'ip_address' => $ip_address,
113
  'time' => current_time( 'mysql' ),
114
+ 'type' => $type,
115
  );
116
  $wpdb->insert( $table_name, $data );
117
 
137
  }
138
  return $result;
139
  }
140
+ static function convert_type( $type ) {
141
+ $result = '';
142
+ switch ( $type ) {
143
+ case SITEGUARD_LOGIN_TYPE_NORMAL:
144
+ $result = esc_html__( 'Login Page', 'siteguard' );
145
+ break;
146
+ case SITEGUARD_LOGIN_TYPE_XMLRPC:
147
+ $result = esc_html__( 'XMLRPC', 'siteguard' );
148
+ break;
149
+ default:
150
+ $result = esc_html__( 'Unknown', 'siteguard' );
151
+ }
152
+ return $result;
153
+ }
154
+ function get_history( $operation, $login_name, $ip_address, $type, $login_name_not, $ip_address_not ) {
155
  global $wpdb;
156
+ $where = '';
157
+ $values = array( );
158
+ if ( true === $this->check_operation( $operation ) ) {
159
+ $where = 'operation = %d';
160
+ array_push( $values, $operation );
161
+ }
162
+ if ( ! empty( $login_name ) ) {
163
+ if ( ! empty( $where ) ) {
164
+ $where .= ' and ';
165
+ }
166
+ if ( true === $login_name_not ) {
167
+ $where .= 'login_name <> %s';
168
+ } else {
169
+ $where .= 'login_name = %s';
170
+ }
171
+ array_push( $values, $login_name );
172
+ }
173
+ if ( ! empty( $ip_address ) ) {
174
+ if ( ! empty( $where ) ) {
175
+ $where .= ' and ';
176
+ }
177
+ if ( true === $ip_address_not ) {
178
+ $where .= 'ip_address <> %s';
179
+ } else {
180
+ $where .= 'ip_address = %s';
181
+ }
182
+ array_push( $values, $ip_address );
183
+
184
+ }
185
+ if ( true === $this->check_type( $type ) ) {
186
+ if ( ! empty( $where ) ) {
187
+ $where .= ' and ';
188
+ }
189
+ $where .= 'type = %d';
190
+ array_push( $values, $type );
191
+ }
192
+ if ( ! empty( $where ) ) {
193
+ $where = 'WHERE ' . $where;
194
+ } else {
195
+ $where = "WHERE operation >= %d";
196
+ array_push( $values, '0' );
197
+ }
198
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_HISTORY;
199
+ $prepare = array( );
200
+ $prepare[] = "SELECT id, operation, login_name, ip_address, time, type FROM $table_name $where";
201
+ foreach ( $values as $v ) {
202
+ $prepare[] = $v;
203
+ }
204
+ $results = $wpdb->get_results( call_user_func_array( array( $wpdb, 'prepare' ), $prepare ), ARRAY_A );
205
  return $results;
206
  }
207
  }
 
 
classes/siteguard-login-lock.php CHANGED
@@ -1,42 +1,43 @@
1
  <?php
2
 
3
  class SiteGuard_LoginLock extends SiteGuard_Base {
4
- var $status = SITEGUARD_LOGIN_FAILED;
 
5
  function __construct( ) {
6
- global $config;
7
- if ( '1' == $config->get( 'loginlock_enable' ) ) {
8
  add_action( 'wp_login_failed', array( $this, 'handler_wp_login_failed' ) );
9
  add_filter( 'authenticate', array( $this, 'handler_authenticate' ), 20, 3 );
10
  }
11
- if ( '1' == $config->get( 'loginlock_fail_once' ) ) {
12
  add_filter( 'wp_authenticate_user', array( $this, 'handler_wp_authenticate_user' ), 99, 2 );
13
  }
14
  }
15
  function init( ) {
16
- global $config;
17
- if ( true === check_multisite( ) ) {
18
- $config->set( 'loginlock_enable', '1' );
19
  } else {
20
- $config->set( 'loginlock_enable', '0' );
21
  }
22
- $config->set( 'loginlock_interval', '5' );
23
- $config->set( 'loginlock_threshold', '3' );
24
- $config->set( 'loginlock_locksec', '60' );
25
- $config->set( 'loginlock_fail_once', '0' );
26
- $config->set( 'fail_once_admin_only', '1' );
27
- $config->update( );
28
  }
29
  function get_status( ) {
30
  return $this->status;
31
  }
32
  function handler_wp_login_failed( $username ) {
33
- global $wpdb, $config, $login_history;
34
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_LOGIN;
35
 
36
- $ip_address = $_SERVER['REMOTE_ADDR'];
37
 
38
  $wpdb->query( 'START TRANSACTION' );
39
- $wpdb->query( "DELETE FROM $table_name WHERE status <> 1 AND last_login_time < SYSDATE() - INTERVAL 1 HOUR;" );
40
  $result = $wpdb->get_row( $wpdb->prepare( "SELECT status, count, last_login_time from $table_name WHERE ip_address = %s", $ip_address ) );
41
  $data = array(
42
  'ip_address' => $ip_address,
@@ -46,27 +47,30 @@ class SiteGuard_LoginLock extends SiteGuard_Base {
46
  );
47
  $now_str = current_time( 'mysql' );
48
  $now_bin = strtotime( $now_str );
49
- if ( null == $result ) {
50
  $data['last_login_time'] = $now_str;
51
  $wpdb->insert( $table_name, $data );
52
  } else {
53
  $data['last_login_time'] = $result->last_login_time;
54
- $interval = intval( $config->get( 'loginlock_interval' ) );
55
  $limit = strtotime( $result->last_login_time ) + $interval;
56
- if ( SITEGUARD_LOGIN_FAILED == $result->status ) {
 
 
 
57
  if ( $now_bin <= $limit ) {
58
  $data['count'] = $result->count + 1;
59
  } else {
60
  $data['count'] = 1;
61
  $data['last_login_time'] = $now_str;
62
  }
63
- if ( $data['count'] >= intval( $config->get( 'loginlock_threshold' ) ) ) {
64
  $data['status'] = SITEGUARD_LOGIN_LOCKED;
65
  $data['last_login_time'] = $now_str;
66
  $this->status = SITEGUARD_LOGIN_LOCKED;
67
  }
68
  $wpdb->update( $table_name, $data, array( 'ip_address' => $ip_address ) );
69
- } else if ( SITEGUARD_LOGIN_FAIL_ONCE == $result->status || ( SITEGUARD_LOGIN_LOCKED == $result->status && $now_bin > strtotime( $result->last_login_time ) + intval( $config->get( 'loginlock_locksec' ) ) ) ) {
70
  $data['status'] = SITEGUARD_LOGIN_FAILED;
71
  $data['count'] = 1;
72
  $data['last_login_time'] = $now_str;
@@ -79,20 +83,20 @@ class SiteGuard_LoginLock extends SiteGuard_Base {
79
  return;
80
  }
81
  function is_locked( $ip_address ) {
82
- global $wpdb, $config;
83
 
84
  $now_bin = strtotime( current_time( 'mysql' ) );
85
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_LOGIN;
86
  $result = $wpdb->get_row( $wpdb->prepare( "SELECT status, last_login_time from $table_name WHERE ip_address = %s", $ip_address ) );
87
- if ( null != $result ) {
88
- if ( SITEGUARD_LOGIN_LOCKED == $result->status && $now_bin <= strtotime( $result->last_login_time ) + intval( $config->get( 'loginlock_locksec' ) ) ) {
89
  return true;
90
  }
91
  }
92
  return false;
93
  }
94
  function handler_authenticate( $user, $username, $password ) {
95
- if ( $this->is_locked( $_SERVER['REMOTE_ADDR'] ) ) {
96
  $new_errors = new WP_Error( );
97
  $new_errors->add( 'siteguard-error', esc_html__( 'ERROR: LOGIN LOCKED', 'siteguard' ) );
98
  $this->status = SITEGUARD_LOGIN_LOCKED;
@@ -100,8 +104,12 @@ class SiteGuard_LoginLock extends SiteGuard_Base {
100
  }
101
  return $user;
102
  }
 
 
 
 
103
  function handler_wp_authenticate_user( $user, $password ) {
104
- global $login_history, $config;
105
 
106
  if ( basename( $_SERVER['SCRIPT_NAME'] ) == 'xmlrpc.php' ) {
107
  return $user;
@@ -114,7 +122,7 @@ class SiteGuard_LoginLock extends SiteGuard_Base {
114
  if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
115
  return $user;
116
  }
117
- if ( '1' == $config->get( 'fail_once_admin_only' ) ) {
118
  if ( ! $user->has_cap( 'administrator' ) ) {
119
  return $user;
120
  }
@@ -122,15 +130,14 @@ class SiteGuard_LoginLock extends SiteGuard_Base {
122
 
123
  $user_login = $user->user_login;
124
 
125
- if ( ! $login_history->is_exist( $user_login, SITEGUARD_LOGIN_FAIL_ONCE, 5/* secs after */, 60/* secs less */ ) ) {
126
  $this->status = SITEGUARD_LOGIN_FAIL_ONCE;
127
 
128
  $new_error = new WP_Error( );
129
- $new_error->add( 'siteguard-error', esc_html__( 'ERROR: Please login entry again', 'siteguard' ) );
 
130
  return $new_error;
131
  }
132
  return $user;
133
  }
134
  }
135
-
136
- ?>
1
  <?php
2
 
3
  class SiteGuard_LoginLock extends SiteGuard_Base {
4
+ const SITEGUARD_FAIL_ONCE_ERROR_CODE = 'siteguard-fail-once';
5
+ protected $status = SITEGUARD_LOGIN_FAILED;
6
  function __construct( ) {
7
+ global $siteguard_config;
8
+ if ( '1' == $siteguard_config->get( 'loginlock_enable' ) ) {
9
  add_action( 'wp_login_failed', array( $this, 'handler_wp_login_failed' ) );
10
  add_filter( 'authenticate', array( $this, 'handler_authenticate' ), 20, 3 );
11
  }
12
+ if ( '1' == $siteguard_config->get( 'loginlock_fail_once' ) ) {
13
  add_filter( 'wp_authenticate_user', array( $this, 'handler_wp_authenticate_user' ), 99, 2 );
14
  }
15
  }
16
  function init( ) {
17
+ global $siteguard_config;
18
+ if ( true === siteguard_check_multisite( ) ) {
19
+ $siteguard_config->set( 'loginlock_enable', '1' );
20
  } else {
21
+ $siteguard_config->set( 'loginlock_enable', '0' );
22
  }
23
+ $siteguard_config->set( 'loginlock_interval', '5' );
24
+ $siteguard_config->set( 'loginlock_threshold', '3' );
25
+ $siteguard_config->set( 'loginlock_locksec', '60' );
26
+ $siteguard_config->set( 'loginlock_fail_once', '0' );
27
+ $siteguard_config->set( 'fail_once_admin_only', '1' );
28
+ $siteguard_config->update( );
29
  }
30
  function get_status( ) {
31
  return $this->status;
32
  }
33
  function handler_wp_login_failed( $username ) {
34
+ global $wpdb, $siteguard_config, $siteguard_login_history;
35
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_LOGIN;
36
 
37
+ $ip_address = $this->get_ip( );
38
 
39
  $wpdb->query( 'START TRANSACTION' );
40
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $table_name WHERE status <> %d AND last_login_time < SYSDATE() - INTERVAL 1 HOUR;", SITEGUARD_LOGIN_SUCCESS ) );
41
  $result = $wpdb->get_row( $wpdb->prepare( "SELECT status, count, last_login_time from $table_name WHERE ip_address = %s", $ip_address ) );
42
  $data = array(
43
  'ip_address' => $ip_address,
47
  );
48
  $now_str = current_time( 'mysql' );
49
  $now_bin = strtotime( $now_str );
50
+ if ( null === $result ) {
51
  $data['last_login_time'] = $now_str;
52
  $wpdb->insert( $table_name, $data );
53
  } else {
54
  $data['last_login_time'] = $result->last_login_time;
55
+ $interval = intval( $siteguard_config->get( 'loginlock_interval' ) );
56
  $limit = strtotime( $result->last_login_time ) + $interval;
57
+ if ( SITEGUARD_LOGIN_SUCCESS == $result->status ) {
58
+ $data['last_login_time'] = $now_str;
59
+ $wpdb->update( $table_name, $data, array( 'ip_address' => $ip_address ) );
60
+ } else if ( SITEGUARD_LOGIN_FAILED == $result->status ) {
61
  if ( $now_bin <= $limit ) {
62
  $data['count'] = $result->count + 1;
63
  } else {
64
  $data['count'] = 1;
65
  $data['last_login_time'] = $now_str;
66
  }
67
+ if ( $data['count'] >= intval( $siteguard_config->get( 'loginlock_threshold' ) ) ) {
68
  $data['status'] = SITEGUARD_LOGIN_LOCKED;
69
  $data['last_login_time'] = $now_str;
70
  $this->status = SITEGUARD_LOGIN_LOCKED;
71
  }
72
  $wpdb->update( $table_name, $data, array( 'ip_address' => $ip_address ) );
73
+ } else if ( SITEGUARD_LOGIN_FAIL_ONCE == $result->status || ( SITEGUARD_LOGIN_LOCKED == $result->status && $now_bin > strtotime( $result->last_login_time ) + intval( $siteguard_config->get( 'loginlock_locksec' ) ) ) ) {
74
  $data['status'] = SITEGUARD_LOGIN_FAILED;
75
  $data['count'] = 1;
76
  $data['last_login_time'] = $now_str;
83
  return;
84
  }
85
  function is_locked( $ip_address ) {
86
+ global $wpdb, $siteguard_config;
87
 
88
  $now_bin = strtotime( current_time( 'mysql' ) );
89
  $table_name = $wpdb->prefix . SITEGUARD_TABLE_LOGIN;
90
  $result = $wpdb->get_row( $wpdb->prepare( "SELECT status, last_login_time from $table_name WHERE ip_address = %s", $ip_address ) );
91
+ if ( null !== $result ) {
92
+ if ( SITEGUARD_LOGIN_LOCKED == $result->status && $now_bin <= strtotime( $result->last_login_time ) + intval( $siteguard_config->get( 'loginlock_locksec' ) ) ) {
93
  return true;
94
  }
95
  }
96
  return false;
97
  }
98
  function handler_authenticate( $user, $username, $password ) {
99
+ if ( $this->is_locked( $this->get_ip( ) ) ) {
100
  $new_errors = new WP_Error( );
101
  $new_errors->add( 'siteguard-error', esc_html__( 'ERROR: LOGIN LOCKED', 'siteguard' ) );
102
  $this->status = SITEGUARD_LOGIN_LOCKED;
104
  }
105
  return $user;
106
  }
107
+ function handler_login_shake( $shake_error_codes ) {
108
+ $shake_error_codes[] = self::SITEGUARD_FAIL_ONCE_ERROR_CODE;
109
+ return $shake_error_codes;
110
+ }
111
  function handler_wp_authenticate_user( $user, $password ) {
112
+ global $siteguard_login_history, $siteguard_config;
113
 
114
  if ( basename( $_SERVER['SCRIPT_NAME'] ) == 'xmlrpc.php' ) {
115
  return $user;
122
  if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
123
  return $user;
124
  }
125
+ if ( '1' == $siteguard_config->get( 'fail_once_admin_only' ) ) {
126
  if ( ! $user->has_cap( 'administrator' ) ) {
127
  return $user;
128
  }
130
 
131
  $user_login = $user->user_login;
132
 
133
+ if ( ! $siteguard_login_history->is_exist( $user_login, SITEGUARD_LOGIN_FAIL_ONCE, 5/* secs after */, 60/* secs less */ ) ) {
134
  $this->status = SITEGUARD_LOGIN_FAIL_ONCE;
135
 
136
  $new_error = new WP_Error( );
137
+ $new_error->add( self::SITEGUARD_FAIL_ONCE_ERROR_CODE, esc_html__( 'ERROR: Please login entry again', 'siteguard' ) );
138
+ add_filter( 'shake_error_codes', array( $this, 'handler_login_shake' ) );
139
  return $new_error;
140
  }
141
  return $user;
142
  }
143
  }
 
 
classes/siteguard-rename-login.php CHANGED
@@ -1,14 +1,20 @@
1
  <?php
2
 
 
 
3
  class SiteGuard_RenameLogin extends SiteGuard_Base {
 
 
 
 
4
  public static $htaccess_mark = '#==== SITEGUARD_RENAME_LOGIN_SETTINGS';
5
 
6
  function __construct( ) {
7
- global $config;
8
- if ( '1' == $config->get( 'renamelogin_enable' ) ) {
9
- if ( null != $this->get_active_incompatible_plugin( ) ) {
10
- $config->set( 'renamelogin_enable', '0' );
11
- $config->update( );
12
  $this->feature_off( );
13
  return;
14
  }
@@ -19,27 +25,37 @@ class SiteGuard_RenameLogin extends SiteGuard_Base {
19
  return SiteGuard_RenameLogin::$htaccess_mark;
20
  }
21
  function init( ) {
22
- global $config;
23
- $config->set( 'renamelogin_path', 'login_' . sprintf( '%05d', mt_rand( 1, 99999 ) ) );
24
- if ( $this->check_module( 'rewrite' ) && null == $this->get_active_incompatible_plugin( ) && true === check_multisite( ) ) {
25
- $config->set( 'renamelogin_enable', '1' );
26
- $config->update( );
27
- $this->feature_on( );
 
 
 
 
 
 
 
 
28
  } else {
29
- $config->set( 'renamelogin_enable', '0' );
30
- $config->update( );
31
  }
32
  }
33
- function get_active_incompatible_plugin( ) {
34
- $incompatible_plugins = array(
35
- 'WordPress HTTPS (SSL)' => 'wordpress-https/wordpress-https.php',
36
- );
37
- foreach ( $incompatible_plugins as $name => $path ) {
38
- if ( $this->is_active_plugin( $path ) ) {
39
- return $name;
40
  }
41
  }
42
- return null;
 
 
 
 
43
  }
44
  function add_filter( ) {
45
  add_filter( 'login_init', array( $this, 'handler_login_init' ), 10, 2 );
@@ -50,8 +66,8 @@ class SiteGuard_RenameLogin extends SiteGuard_Base {
50
  remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
51
  }
52
  function handler_login_init( ) {
53
- global $config;
54
- $new_login_page = $config->get( 'renamelogin_path' );
55
  if ( isset( $_SERVER['REQUEST_URI'] ) ) {
56
  $link = $_SERVER['REQUEST_URI'];
57
  } else {
@@ -68,8 +84,8 @@ class SiteGuard_RenameLogin extends SiteGuard_Base {
68
  }
69
  }
70
  function convert_url( $link ) {
71
- global $config;
72
- $custom_login_url = $config->get( 'renamelogin_path' );
73
  if ( false !== strpos( $link, 'wp-login.php' ) ) {
74
  $result = str_replace( 'wp-login.php', $custom_login_url, $link );
75
  } else {
@@ -86,21 +102,27 @@ class SiteGuard_RenameLogin extends SiteGuard_Base {
86
  return $result;
87
  }
88
  function handler_wp_redirect( $link, $status_code ) {
89
- $result = $this->convert_url( $link );
 
 
 
 
 
 
90
  return $result;
91
  }
92
  function insert_rewrite_rules( $rules ) {
93
- global $config;
94
- $custom_login_url = $config->get( 'renamelogin_path' );
95
  $newrules = array();
96
  $newrules[ $custom_login_url.'(.*)$' ] = 'wp-login.php$1';
97
  return $newrules + $rules;
98
  }
99
  function update_settings( ) {
100
- global $config;
101
- $custom_login_url = $config->get( 'renamelogin_path' );
102
  $parse_url = parse_url( site_url( ) );
103
- if ( false == $parse_url ) {
104
  $base = '/';
105
  } else {
106
  if ( isset( $parse_url['path'] ) ) {
@@ -113,16 +135,21 @@ class SiteGuard_RenameLogin extends SiteGuard_Base {
113
  $htaccess_str = "<IfModule mod_rewrite.c>\n";
114
  $htaccess_str .= " RewriteEngine on\n";
115
  $htaccess_str .= " RewriteBase $base\n";
 
 
116
  $htaccess_str .= " RewriteRule ^$custom_login_url(.*)$ wp-login.php$1 [L]\n";
117
  $htaccess_str .= "</IfModule>\n";
118
 
119
  return $htaccess_str;
120
  }
121
  function feature_on( ) {
122
- global $htaccess;
 
 
 
123
  $data = $this->update_settings( );
124
  $mark = $this->get_mark( );
125
- return $htaccess->update_settings( $mark, $data );
126
  }
127
  static function feature_off( ) {
128
  $mark = SiteGuard_RenameLogin::get_mark( );
@@ -139,17 +166,18 @@ class SiteGuard_RenameLogin extends SiteGuard_Base {
139
  die;
140
  }
141
  function send_notify( ) {
142
- global $config;
143
  $subject = esc_html__( 'WordPress: Login page URL was changed', 'siteguard' );
144
- $body = sprintf( esc_html__( "Please bookmark following of the new login URL.\n\n%s\n\n--\nSiteGuard WP Plugin", 'siteguard' ), site_url( ) . '/' . $config->get( 'renamelogin_path' ) );
145
 
146
  $user_query = new WP_User_Query( array( 'role' => 'Administrator' ) );
147
  if ( ! empty( $user_query->results ) ) {
148
  foreach ( $user_query->results as $user ) {
149
- @wp_mail( $user->get( 'user_email' ), $subject, $body );
 
 
 
150
  }
151
  }
152
  }
153
  }
154
-
155
- ?>
1
  <?php
2
 
3
+ require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
4
+
5
  class SiteGuard_RenameLogin extends SiteGuard_Base {
6
+ protected static $incompatible_plugins = array(
7
+ 'WordPress HTTPS (SSL)' => 'wordpress-https/wordpress-https.php',
8
+ 'qTranslate X' => 'qtranslate-x/qtranslate.php',
9
+ );
10
  public static $htaccess_mark = '#==== SITEGUARD_RENAME_LOGIN_SETTINGS';
11
 
12
  function __construct( ) {
13
+ global $siteguard_config;
14
+ if ( '1' == $siteguard_config->get( 'renamelogin_enable' ) ) {
15
+ if ( null !== $this->get_active_incompatible_plugins( ) ) {
16
+ $siteguard_config->set( 'renamelogin_enable', '0' );
17
+ $siteguard_config->update( );
18
  $this->feature_off( );
19
  return;
20
  }
25
  return SiteGuard_RenameLogin::$htaccess_mark;
26
  }
27
  function init( ) {
28
+ global $siteguard_config;
29
+ $siteguard_config->set( 'renamelogin_path', 'login_' . sprintf( '%05d', mt_rand( 1, 99999 ) ) );
30
+ $siteguard_config->update();
31
+ if ( $this->check_module( 'rewrite' ) &&
32
+ null === $this->get_active_incompatible_plugins( ) &&
33
+ true === siteguard_check_multisite( ) &&
34
+ SiteGuard_Htaccess::test_htaccess( )
35
+ ) {
36
+ $siteguard_config->set( 'renamelogin_enable', '1' );
37
+ $siteguard_config->update( );
38
+ if ( false === $this->feature_on( ) ) {
39
+ $siteguard_config->set( 'renamelogin_enable', '0' );
40
+ $siteguard_config->update( );
41
+ }
42
  } else {
43
+ $siteguard_config->set( 'renamelogin_enable', '0' );
44
+ $siteguard_config->update( );
45
  }
46
  }
47
+ function get_active_incompatible_plugins( ) {
48
+ $result = array();
49
+ foreach ( self::$incompatible_plugins as $name => $path ) {
50
+ if ( is_plugin_active( $path ) ) {
51
+ array_push( $result, $name );
 
 
52
  }
53
  }
54
+ if ( empty( $result ) ) {
55
+ return null;
56
+ } else {
57
+ return $result;
58
+ }
59
  }
60
  function add_filter( ) {
61
  add_filter( 'login_init', array( $this, 'handler_login_init' ), 10, 2 );
66
  remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
67
  }
68
  function handler_login_init( ) {
69
+ global $siteguard_config;
70
+ $new_login_page = $siteguard_config->get( 'renamelogin_path' );
71
  if ( isset( $_SERVER['REQUEST_URI'] ) ) {
72
  $link = $_SERVER['REQUEST_URI'];
73
  } else {
84
  }
85
  }
86
  function convert_url( $link ) {
87
+ global $siteguard_config;
88
+ $custom_login_url = $siteguard_config->get( 'renamelogin_path' );
89
  if ( false !== strpos( $link, 'wp-login.php' ) ) {
90
  $result = str_replace( 'wp-login.php', $custom_login_url, $link );
91
  } else {
102
  return $result;
103
  }
104
  function handler_wp_redirect( $link, $status_code ) {
105
+ if ( ( ( strlen( $link ) <= 5 || 'http:' !== strtolower( substr( $link, 0, 5 ) ) ) && ( strlen( $link ) <= 6 || 'https:' !== strtolower( substr( $link, 0, 6 ) ) ) )
106
+ || ( isset( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) !== 'off' && 'https' === strtolower( substr( $link, 0, strpos( $link, '://') ) ) )
107
+ || ( ( ! isset( $_SERVER['HTTPS'] ) || strtolower( $_SERVER['HTTPS'] ) === 'off' ) && 'http' === strtolower( substr( $link, 0, strpos( $link, '://') ) ) ) ) {
108
+ $result = $this->convert_url( $link );
109
+ } else {
110
+ $result = $link;
111
+ }
112
  return $result;
113
  }
114
  function insert_rewrite_rules( $rules ) {
115
+ global $siteguard_config;
116
+ $custom_login_url = $siteguard_config->get( 'renamelogin_path' );
117
  $newrules = array();
118
  $newrules[ $custom_login_url.'(.*)$' ] = 'wp-login.php$1';
119
  return $newrules + $rules;
120
  }
121
  function update_settings( ) {
122
+ global $siteguard_config;
123
+ $custom_login_url = $siteguard_config->get( 'renamelogin_path' );
124
  $parse_url = parse_url( site_url( ) );
125
+ if ( false === $parse_url ) {
126
  $base = '/';
127
  } else {
128
  if ( isset( $parse_url['path'] ) ) {
135
  $htaccess_str = "<IfModule mod_rewrite.c>\n";
136
  $htaccess_str .= " RewriteEngine on\n";
137
  $htaccess_str .= " RewriteBase $base\n";
138
+ $htaccess_str .= " RewriteRule ^wp-signup\.php 404-siteguard [L]\n";
139
+ $htaccess_str .= " RewriteRule ^wp-activate\.php 404-siteguard [L]\n";
140
  $htaccess_str .= " RewriteRule ^$custom_login_url(.*)$ wp-login.php$1 [L]\n";
141
  $htaccess_str .= "</IfModule>\n";
142
 
143
  return $htaccess_str;
144
  }
145
  function feature_on( ) {
146
+ global $siteguard_htaccess;
147
+ if ( false === SiteGuard_Htaccess::check_permission( ) ) {
148
+ return false;
149
+ }
150
  $data = $this->update_settings( );
151
  $mark = $this->get_mark( );
152
+ return $siteguard_htaccess->update_settings( $mark, $data );
153
  }
154
  static function feature_off( ) {
155
  $mark = SiteGuard_RenameLogin::get_mark( );
166
  die;
167
  }
168
  function send_notify( ) {
169
+ global $siteguard_config;
170
  $subject = esc_html__( 'WordPress: Login page URL was changed', 'siteguard' );
171
+ $body = sprintf( esc_html__( "Please bookmark following of the new login URL.\n\n%s\n\n--\nSiteGuard WP Plugin", 'siteguard' ), site_url( ) . '/' . $siteguard_config->get( 'renamelogin_path' ) );
172
 
173
  $user_query = new WP_User_Query( array( 'role' => 'Administrator' ) );
174
  if ( ! empty( $user_query->results ) ) {
175
  foreach ( $user_query->results as $user ) {
176
+ $user_email = $user->get( 'user_email' );
177
+ if ( true !== @wp_mail( $user_email, $subject, $body ) ) {
178
+ siteguard_error_log( 'Failed send mail. To:' . $user_email . ' Subject:' . esc_html( $subject ) );
179
+ }
180
  }
181
  }
182
  }
183
  }
 
 
classes/siteguard-updates-notify.php CHANGED
@@ -10,25 +10,25 @@ class SiteGuard_UpdatesNotify extends SiteGuard_Base {
10
  }
11
 
12
  public function init( ) {
13
- global $config;
14
- $config->set( 'notify_wpcore', '1' );
15
- $config->set( 'notify_plugins', '2' );
16
- $config->set( 'notify_themes', '2' );
17
- $config->set( 'notified', array( 'core' => '', 'plugin' => array(), 'theme' => array() ) );
18
- $config->set( 'last_check_time', false );
19
  // We need save the configuration before calling self::check_requirements.
20
- $config->update( );
21
  if ( true === self::check_requirements( ) ) {
22
- $config->set( 'updates_notify_enable', '1' );
23
- $config->update( );
24
  self::feature_on( );
25
  } else {
26
- $config->set( 'updates_notify_enable', '0' );
27
- $config->update( );
28
  }
29
  }
30
- public function check_requirements( ) {
31
- $error = check_multisite( );
32
  if ( is_wp_error( $error ) ) {
33
  return $error;
34
  }
@@ -69,23 +69,25 @@ class SiteGuard_UpdatesNotify extends SiteGuard_Base {
69
  wp_schedule_event( time(), 'daily', self::CRON_NAME );
70
  }
71
 
72
- public function feature_off() {
73
  wp_clear_scheduled_hook( self::CRON_NAME ); // clear cron
74
  }
75
 
76
  public function do_update_check() {
77
- global $config;
78
  $message = ''; // start with a blank message
79
- if ( '0' != $config->get( 'notify_wpcore' ) ) { // are we to check for WordPress core?
80
  $core_updated = self::core_update_check( $message ); // check the WP core for updates
 
 
81
  }
82
- if ( '0' != $config->get( 'notify_plugins' ) ) { // are we to check for plugin updates?
83
- $plugins_updated = self::plugins_update_check( $message, $config->get( 'notify_plugins' ) ); // check for plugin updates
84
  } else {
85
  $plugins_updated = false; // no plugin updates
86
  }
87
- if ( '0' != $config->get( 'notify_themes' ) ) { // are we to check for theme updates?
88
- $themes_updated = self::themes_update_check( $message, $config->get( 'notify_themes' ) ); // check for theme updates
89
  } else {
90
  $themes_updated = false; // no theme updates
91
  }
@@ -99,10 +101,10 @@ class SiteGuard_UpdatesNotify extends SiteGuard_Base {
99
  }
100
 
101
  private static function core_update_check( &$message ) {
102
- global $config, $wp_version;
103
  do_action( 'wp_version_check' ); // force WP to check its core for updates
104
  $update_core = get_site_transient( 'update_core' ); // get information of updates
105
- $notified = $config->get( 'notified' );
106
  if ( 'upgrade' == $update_core->updates[0]->response ) { // is WP core update available?
107
  if ( $update_core->updates[0]->current != $notified['core'] ) { // have we already notified about this version?
108
  require_once( ABSPATH . WPINC . '/version.php' ); // Including this because some plugins can mess with the real version stored in the DB.
@@ -110,23 +112,23 @@ class SiteGuard_UpdatesNotify extends SiteGuard_Base {
110
  $old_core_ver = $wp_version; // the old WP core version
111
  $message .= "\n" . sprintf( esc_html__( 'WP-Core: WordPress is out of date. Please update from version %s to %s', 'siteguard' ), $old_core_ver, $new_core_ver ) . "\n";
112
  $notified['core'] = $new_core_ver; // set core version we are notifying about
113
- $config->set( 'notified', $notified );
114
- $config->update( );
115
  return true; // we have updates so return true
116
  } else {
117
  return false; // There are updates but we have already notified in the past.
118
  }
119
  }
120
  $notified['core'] = ''; // no updates lets set this nothing
121
- $config->set( 'notified', $notified );
122
- $config->update( );
123
  return false; // no updates return false
124
  }
125
 
126
  private static function plugins_update_check( &$message, $allOrActive ) {
127
- global $config, $wp_version;
128
  $cur_wp_version = preg_replace( '/-.*$/', '', $wp_version );
129
- $notified = $config->get( 'notified' );
130
  do_action( 'wp_update_plugins' ); // force WP to check plugins for updates
131
  $update_plugins = get_site_transient( 'update_plugins' ); // get information of updates
132
  if ( ! empty( $update_plugins->response ) ) { // any plugin updates available?
@@ -156,23 +158,23 @@ class SiteGuard_UpdatesNotify extends SiteGuard_Base {
156
  $message .= "\t" . sprintf( esc_html__( 'Compatibility: %s', 'siteguard' ), $compat ) . "\n";
157
  $notified['plugin'][ $key ] = $data->new_version; // set plugin version we are notifying about
158
  }
159
- $config->set( 'notified', $notified );
160
- $config->update( );
161
  return true; // we have plugin updates return true
162
  }
163
  } else {
164
  if ( 0 != count( $notified['plugin'] ) ) { // is there any plugin notifications?
165
  $notified['plugin'] = array(); // set plugin notifications to empty as all plugins up-to-date
166
- $config->set( 'notified', $notified );
167
- $config->update( );
168
  }
169
  }
170
  return false; // No plugin updates so return false
171
  }
172
 
173
- private function themes_update_check( &$message, $allOrActive ) {
174
- global $config;
175
- $notified = $config->get( 'notified' );
176
  do_action( 'wp_update_themes' ); // force WP to check for theme updates
177
  $update_themes = get_site_transient( 'update_themes' ); // get information of updates
178
  if ( ! empty( $update_themes->response ) ) { // any theme updates available?
@@ -188,23 +190,23 @@ class SiteGuard_UpdatesNotify extends SiteGuard_Base {
188
  $message .= "\n" . sprintf( esc_html__( 'Theme: %s is out of date. Please update from version %s to %s', 'siteguard' ), $theme_info['Name'], $theme_info['Version'], $data['new_version'] ) . "\n";
189
  $notified['theme'][ $key ] = $data['new_version']; // set theme version we are notifying about
190
  }
191
- $config->set( 'notified', $notified );
192
- $config->update( );
193
  return true; // we have theme updates return true
194
  }
195
  } else {
196
  if ( 0 != count( $notified['theme'] ) ) { // is there any theme notifications?
197
  $notified['theme'] = array(); // set theme notifications to empty as all themes up-to-date
198
- $config->set( 'notified', $notified );
199
- $config->update( );
200
  }
201
  }
202
  return false; // No theme updates so return false
203
  }
204
 
205
- public function check_plugins_against_notified( $plugins_need_update ) {
206
- global $config;
207
- $notified = $config->get( 'notified' );
208
  if ( is_array( $plugins_need_update ) ) {
209
  foreach ( $plugins_need_update as $key => $data ) { // loop through plugins that need update
210
  if ( isset( $notified['plugin'][ $key ] ) ) { // has this plugin been notified before?
@@ -217,9 +219,9 @@ class SiteGuard_UpdatesNotify extends SiteGuard_Base {
217
  return $plugins_need_update;
218
  }
219
 
220
- public function check_themes_against_notified( $themes_need_update ) {
221
- global $config;
222
- $notified = $config->get( 'notified' );
223
  if ( is_array( $themes_need_update ) ) {
224
  foreach ( $themes_need_update as $key => $data ) { // loop through themes that need update
225
  if ( isset( $notified['theme'][ $key ] ) ) { // has this theme been notified before?
@@ -233,21 +235,24 @@ class SiteGuard_UpdatesNotify extends SiteGuard_Base {
233
  }
234
 
235
  public function send_notify( $message ) {
236
- global $config;
237
  $subject = sprintf( esc_html__( 'WordPress: Updates Available @ %s', 'siteguard' ), home_url() );
238
 
239
  $user_query = new WP_User_Query( array( 'role' => 'Administrator' ) );
240
  if ( is_array( $user_query->results ) ) {
241
  foreach ( $user_query->results as $user ) {
242
- @wp_mail( $user->get( 'user_email' ), $subject, $message );
 
 
 
243
  }
244
  }
245
  }
246
 
247
  private function log_last_check_time() {
248
- global $config;
249
- $config->set( 'last_check_time', current_time( 'timestamp' ) );
250
- $config->update( );
251
  }
252
 
253
  private static function get_schedules() {
@@ -267,5 +272,3 @@ class SiteGuard_UpdatesNotify extends SiteGuard_Base {
267
  return $a['interval'] - $b['interval'];
268
  }
269
  }
270
-
271
- ?>
10
  }
11
 
12
  public function init( ) {
13
+ global $siteguard_config;
14
+ $siteguard_config->set( 'notify_wpcore', '1' );
15
+ $siteguard_config->set( 'notify_plugins', '2' );
16
+ $siteguard_config->set( 'notify_themes', '2' );
17
+ $siteguard_config->set( 'notified', array( 'core' => '', 'plugin' => array(), 'theme' => array() ) );
18
+ $siteguard_config->set( 'last_check_time', false );
19
  // We need save the configuration before calling self::check_requirements.
20
+ $siteguard_config->update( );
21
  if ( true === self::check_requirements( ) ) {
22
+ $siteguard_config->set( 'updates_notify_enable', '1' );
23
+ $siteguard_config->update( );
24
  self::feature_on( );
25
  } else {
26
+ $siteguard_config->set( 'updates_notify_enable', '0' );
27
+ $siteguard_config->update( );
28
  }
29
  }
30
+ public static function check_requirements( ) {
31
+ $error = siteguard_check_multisite( );
32
  if ( is_wp_error( $error ) ) {
33
  return $error;
34
  }
69
  wp_schedule_event( time(), 'daily', self::CRON_NAME );
70
  }
71
 
72
+ static public function feature_off() {
73
  wp_clear_scheduled_hook( self::CRON_NAME ); // clear cron
74
  }
75
 
76
  public function do_update_check() {
77
+ global $siteguard_config;
78
  $message = ''; // start with a blank message
79
+ if ( '0' != $siteguard_config->get( 'notify_wpcore' ) ) { // are we to check for WordPress core?
80
  $core_updated = self::core_update_check( $message ); // check the WP core for updates
81
+ } else {
82
+ $core_updated = false; // no core updates
83
  }
84
+ if ( '0' != $siteguard_config->get( 'notify_plugins' ) ) { // are we to check for plugin updates?
85
+ $plugins_updated = self::plugins_update_check( $message, $siteguard_config->get( 'notify_plugins' ) ); // check for plugin updates
86
  } else {
87
  $plugins_updated = false; // no plugin updates
88
  }
89
+ if ( '0' != $siteguard_config->get( 'notify_themes' ) ) { // are we to check for theme updates?
90
+ $themes_updated = self::themes_update_check( $message, $siteguard_config->get( 'notify_themes' ) ); // check for theme updates
91
  } else {
92
  $themes_updated = false; // no theme updates
93
  }
101
  }
102
 
103
  private static function core_update_check( &$message ) {
104
+ global $siteguard_config, $wp_version;
105
  do_action( 'wp_version_check' ); // force WP to check its core for updates
106
  $update_core = get_site_transient( 'update_core' ); // get information of updates
107
+ $notified = $siteguard_config->get( 'notified' );
108
  if ( 'upgrade' == $update_core->updates[0]->response ) { // is WP core update available?
109
  if ( $update_core->updates[0]->current != $notified['core'] ) { // have we already notified about this version?
110
  require_once( ABSPATH . WPINC . '/version.php' ); // Including this because some plugins can mess with the real version stored in the DB.
112
  $old_core_ver = $wp_version; // the old WP core version
113
  $message .= "\n" . sprintf( esc_html__( 'WP-Core: WordPress is out of date. Please update from version %s to %s', 'siteguard' ), $old_core_ver, $new_core_ver ) . "\n";
114
  $notified['core'] = $new_core_ver; // set core version we are notifying about
115
+ $siteguard_config->set( 'notified', $notified );
116
+ $siteguard_config->update( );
117
  return true; // we have updates so return true
118
  } else {
119
  return false; // There are updates but we have already notified in the past.
120
  }
121
  }
122
  $notified['core'] = ''; // no updates lets set this nothing
123
+ $siteguard_config->set( 'notified', $notified );
124
+ $siteguard_config->update( );
125
  return false; // no updates return false
126
  }
127
 
128
  private static function plugins_update_check( &$message, $allOrActive ) {
129
+ global $siteguard_config, $wp_version;
130
  $cur_wp_version = preg_replace( '/-.*$/', '', $wp_version );
131
+ $notified = $siteguard_config->get( 'notified' );
132
  do_action( 'wp_update_plugins' ); // force WP to check plugins for updates
133
  $update_plugins = get_site_transient( 'update_plugins' ); // get information of updates
134
  if ( ! empty( $update_plugins->response ) ) { // any plugin updates available?
158
  $message .= "\t" . sprintf( esc_html__( 'Compatibility: %s', 'siteguard' ), $compat ) . "\n";
159
  $notified['plugin'][ $key ] = $data->new_version; // set plugin version we are notifying about
160
  }
161
+ $siteguard_config->set( 'notified', $notified );
162
+ $siteguard_config->update( );
163
  return true; // we have plugin updates return true
164
  }
165
  } else {
166
  if ( 0 != count( $notified['plugin'] ) ) { // is there any plugin notifications?
167
  $notified['plugin'] = array(); // set plugin notifications to empty as all plugins up-to-date
168
+ $siteguard_config->set( 'notified', $notified );
169
+ $siteguard_config->update( );
170
  }
171
  }
172
  return false; // No plugin updates so return false
173
  }
174
 
175
+ private static function themes_update_check( &$message, $allOrActive ) {
176
+ global $siteguard_config;
177
+ $notified = $siteguard_config->get( 'notified' );
178
  do_action( 'wp_update_themes' ); // force WP to check for theme updates
179
  $update_themes = get_site_transient( 'update_themes' ); // get information of updates
180
  if ( ! empty( $update_themes->response ) ) { // any theme updates available?
190
  $message .= "\n" . sprintf( esc_html__( 'Theme: %s is out of date. Please update from version %s to %s', 'siteguard' ), $theme_info['Name'], $theme_info['Version'], $data['new_version'] ) . "\n";
191
  $notified['theme'][ $key ] = $data['new_version']; // set theme version we are notifying about
192
  }
193
+ $siteguard_config->set( 'notified', $notified );
194
+ $siteguard_config->update( );
195
  return true; // we have theme updates return true
196
  }
197
  } else {
198
  if ( 0 != count( $notified['theme'] ) ) { // is there any theme notifications?
199
  $notified['theme'] = array(); // set theme notifications to empty as all themes up-to-date
200
+ $siteguard_config->set( 'notified', $notified );
201
+ $siteguard_config->update( );
202
  }
203
  }
204
  return false; // No theme updates so return false
205
  }
206
 
207
+ public static function check_plugins_against_notified( $plugins_need_update ) {
208
+ global $siteguard_config;
209
+ $notified = $siteguard_config->get( 'notified' );
210
  if ( is_array( $plugins_need_update ) ) {
211
  foreach ( $plugins_need_update as $key => $data ) { // loop through plugins that need update
212
  if ( isset( $notified['plugin'][ $key ] ) ) { // has this plugin been notified before?
219
  return $plugins_need_update;
220
  }
221
 
222
+ public static function check_themes_against_notified( $themes_need_update ) {
223
+ global $siteguard_config;
224
+ $notified = $siteguard_config->get( 'notified' );
225
  if ( is_array( $themes_need_update ) ) {
226
  foreach ( $themes_need_update as $key => $data ) { // loop through themes that need update
227
  if ( isset( $notified['theme'][ $key ] ) ) { // has this theme been notified before?
235
  }
236
 
237
  public function send_notify( $message ) {
238
+ global $siteguard_config;
239
  $subject = sprintf( esc_html__( 'WordPress: Updates Available @ %s', 'siteguard' ), home_url() );
240
 
241
  $user_query = new WP_User_Query( array( 'role' => 'Administrator' ) );
242
  if ( is_array( $user_query->results ) ) {
243
  foreach ( $user_query->results as $user ) {
244
+ $user_email = $user->get( 'user_email' );
245
+ if ( true !== @wp_mail( $user_email, $subject, $message ) ) {;
246
+ siteguard_error_log( 'Failed send mail. To:' . $user_email . ' Subject:' . esc_html( $subject ) );
247
+ }
248
  }
249
  }
250
  }
251
 
252
  private function log_last_check_time() {
253
+ global $siteguard_config;
254
+ $siteguard_config->set( 'last_check_time', current_time( 'timestamp' ) );
255
+ $siteguard_config->update( );
256
  }
257
 
258
  private static function get_schedules() {
272
  return $a['interval'] - $b['interval'];
273
  }
274
  }
 
 
classes/siteguard-waf-exclude-rule.php CHANGED
@@ -3,31 +3,32 @@
3
  define( 'SITEGUARD_WAF_EXCLUDE_RULE', 'waf_exclude_rule' );
4
 
5
  class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
6
- public static $htaccess_mark = '#==== SITEGUARD_SG_WHITE_LIST_SETTINGS';
7
 
8
  function __construct( ) {
9
  }
10
  static function get_mark( ) {
11
- return SiteGuard_WAF_Exclude_Rule::$htaccess_mark;
12
  }
13
  function init( ) {
14
- global $config;
15
- $config->set( 'waf_exclude_rule_enable', '0' );
16
  $this->clear_rules( );
17
- $config->update( );
18
  }
19
  function get_enable( ) {
20
- global $config;
21
- $enable = $config->get( 'waf_exclude_rule_enable' );
22
  return $enable;
23
  }
24
  function set_enable( $enable ) {
25
- global $config;
26
- if ( '0' != $enable && '1' != $enable ) {
 
27
  return false;
28
  }
29
- $config->set( 'waf_exclude_rule_enable', $enable );
30
- $config->update( );
31
  return true;
32
  }
33
  function cvt_exclude( $exclude ) {
@@ -35,6 +36,9 @@ class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
35
  }
36
  function get_max_id( $rules ) {
37
  $result = 0;
 
 
 
38
  foreach ( $rules as $rule ) {
39
  if ( isset( $rule['ID'] ) && $result < $rule['ID'] ) {
40
  $result = $rule['ID'];
@@ -69,7 +73,7 @@ class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
69
  return true;
70
  }
71
  function add_rule( $filename, $sig, $comment ) {
72
- global $config;
73
 
74
  // check
75
  $errors = $this->input_check( 1, $filename, $sig, $comment );
@@ -78,32 +82,35 @@ class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
78
  }
79
  $sig = str_ireplace( 'SiteGuard_User_ExcludeSig', '', $sig );
80
  $sig = str_replace( ' ', '', $sig );
81
- $rules = $config->get( SITEGUARD_WAF_EXCLUDE_RULE );
82
  $rule = array(
83
  'ID' => $this->get_max_id( $rules ) + 1,
84
  'filename' => $filename,
85
  'sig' => $sig,
86
  'comment' => $comment,
87
  );
 
 
 
88
  array_push( $rules, $rule );
89
- $config->set( SITEGUARD_WAF_EXCLUDE_RULE, $rules );
90
- $config->update( );
91
  return true;
92
  }
93
  function clear_rules( ) {
94
- global $config;
95
  $empty = array();
96
- $config->set( SITEGUARD_WAF_EXCLUDE_RULE, $empty );
97
- $config->update( );
98
  }
99
  function get_rules( ) {
100
- global $config;
101
- $rules = $config->get( SITEGUARD_WAF_EXCLUDE_RULE );
102
  return $rules;
103
  }
104
  function get_rule( $id, &$offset ) {
105
- global $config;
106
- $rules = $config->get( SITEGUARD_WAF_EXCLUDE_RULE );
107
  $idx = 0;
108
  foreach ( $rules as $rule ) {
109
  if ( isset( $rule['ID'] ) && $rule['ID'] == $id ) {
@@ -116,8 +123,11 @@ class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
116
  return false;
117
  }
118
  function delete_rule( $ids ) {
119
- global $config;
120
- $rules = $config->get( SITEGUARD_WAF_EXCLUDE_RULE );
 
 
 
121
  foreach ( $ids as $id ) {
122
  $offset = 0;
123
  $rule = $this->get_rule( $id, $offset );
@@ -125,16 +135,16 @@ class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
125
  continue;
126
  }
127
  array_splice( $rules, $offset, 1 );
128
- $config->set( SITEGUARD_WAF_EXCLUDE_RULE, $rules );
129
  }
130
- $config->update( );
131
  return true;
132
  }
133
- function set_rule_itr( $new_rule ) {
134
- global $config;
135
  $errors = new WP_Error();
136
 
137
- $rules = $config->get( SITEGUARD_WAF_EXCLUDE_RULE );
138
  if ( isset( $new_rule['ID'] ) ) {
139
  $id = $new_rule['ID'];
140
  } else {
@@ -148,11 +158,11 @@ class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
148
  return $errors;
149
  }
150
  array_splice( $rules, $offset, 1, array( $new_rule ) );
151
- $config->set( SITEGUARD_WAF_EXCLUDE_RULE, $rules );
152
- $config->update( );
153
  return true;
154
  }
155
- function set_rule( $id, $filename, $sig, $comment ) {
156
  // check
157
  $errors = $this->input_check( $id, $filename, $sig, $comment );
158
  if ( is_wp_error( $errors ) ) {
@@ -165,7 +175,7 @@ class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
165
  'sig' => $sig,
166
  'comment' => $comment,
167
  );
168
- return $this->set_rule_itr( $new_rule );
169
  }
170
  function cvt_csrf2comma( $signatures ) {
171
  $result = preg_replace( "/(\r\n)+/", "\r\n", $signatures );
@@ -193,10 +203,10 @@ class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
193
  return ' SiteGuard_User_ExcludeSig '. $this->cvt_csrf2comma( $sig_str ) . "\n";
194
  }
195
  function update_settings( ) {
196
- global $config;
197
  $htaccess_str = '';
198
- $rules = $config->get( SITEGUARD_WAF_EXCLUDE_RULE );
199
- if ( '' == $rules ) {
200
  return;
201
  }
202
 
@@ -219,15 +229,16 @@ class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
219
  return $htaccess_str;
220
  }
221
  function feature_on( ) {
222
- global $htaccess;
 
 
 
223
  $data = $this->update_settings( );
224
  $mark = $this->get_mark( );
225
- $htaccess->update_settings( $mark, $data );
226
  }
227
  static function feature_off( ) {
228
  $mark = SiteGuard_WAF_Exclude_Rule::get_mark( );
229
- SiteGuard_Htaccess::clear_settings( $mark );
230
  }
231
  }
232
-
233
- ?>
3
  define( 'SITEGUARD_WAF_EXCLUDE_RULE', 'waf_exclude_rule' );
4
 
5
  class SiteGuard_WAF_Exclude_Rule extends SiteGuard_Base {
6
+ const HTACCESS_MARK = '#==== SITEGUARD_SG_WHITE_LIST_SETTINGS';
7
 
8
  function __construct( ) {
9
  }
10
  static function get_mark( ) {
11
+ return self::HTACCESS_MARK;
12
  }
13
  function init( ) {
14
+ global $siteguard_config;
15
+ $siteguard_config->set( 'waf_exclude_rule_enable', '0' );
16
  $this->clear_rules( );
17
+ $siteguard_config->update( );
18
  }
19
  function get_enable( ) {
20
+ global $siteguard_config;
21
+ $enable = $siteguard_config->get( 'waf_exclude_rule_enable' );
22
  return $enable;
23
  }
24
  function set_enable( $enable ) {
25
+ global $siteguard_config;
26
+ $values = array( '0', '1' );
27
+ if ( ! in_array( $enable, $values ) ) {
28
  return false;
29
  }
30
+ $siteguard_config->set( 'waf_exclude_rule_enable', $enable );
31
+ $siteguard_config->update( );
32
  return true;
33
  }
34
  function cvt_exclude( $exclude ) {
36
  }
37
  function get_max_id( $rules ) {
38
  $result = 0;
39
+ if ( ! is_array( $rules ) ) {
40
+ return $result;
41
+ }
42
  foreach ( $rules as $rule ) {
43
  if ( isset( $rule['ID'] ) && $result < $rule['ID'] ) {
44
  $result = $rule['ID'];
73
  return true;
74
  }
75
  function add_rule( $filename, $sig, $comment ) {
76
+ global $siteguard_config;
77
 
78
  // check
79
  $errors = $this->input_check( 1, $filename, $sig, $comment );
82
  }
83
  $sig = str_ireplace( 'SiteGuard_User_ExcludeSig', '', $sig );
84
  $sig = str_replace( ' ', '', $sig );
85
+ $rules = $siteguard_config->get( SITEGUARD_WAF_EXCLUDE_RULE );
86
  $rule = array(
87
  'ID' => $this->get_max_id( $rules ) + 1,
88
  'filename' => $filename,
89
  'sig' => $sig,
90
  'comment' => $comment,
91
  );
92
+ if ( ! is_array( $rules ) ) {
93
+ $rules = (array) $rules;
94
+ }
95
  array_push( $rules, $rule );
96
+ $siteguard_config->set( SITEGUARD_WAF_EXCLUDE_RULE, $rules );
97
+ $siteguard_config->update( );
98
  return true;
99
  }
100
  function clear_rules( ) {
101
+ global $siteguard_config;
102
  $empty = array();
103
+ $siteguard_config->set( SITEGUARD_WAF_EXCLUDE_RULE, $empty );
104
+ $siteguard_config->update( );
105
  }
106
  function get_rules( ) {
107
+ global $siteguard_config;
108
+ $rules = $siteguard_config->get( SITEGUARD_WAF_EXCLUDE_RULE );
109
  return $rules;
110
  }
111
  function get_rule( $id, &$offset ) {
112
+ global $siteguard_config;
113
+ $rules = $siteguard_config->get( SITEGUARD_WAF_EXCLUDE_RULE );
114
  $idx = 0;
115
  foreach ( $rules as $rule ) {
116
  if ( isset( $rule['ID'] ) && $rule['ID'] == $id ) {
123
  return false;
124
  }
125
  function delete_rule( $ids ) {
126
+ global $siteguard_config;
127
+ $rules = $siteguard_config->get( SITEGUARD_WAF_EXCLUDE_RULE );
128
+ if ( ! is_array( $ids ) ) {
129
+ $ids = (array) $ids;
130
+ }
131
  foreach ( $ids as $id ) {
132
  $offset = 0;
133
  $rule = $this->get_rule( $id, $offset );
135
  continue;
136
  }
137
  array_splice( $rules, $offset, 1 );
138
+ $siteguard_config->set( SITEGUARD_WAF_EXCLUDE_RULE, $rules );
139
  }
140
+ $siteguard_config->update( );
141
  return true;
142
  }
143
+ function update_rule_itr( $new_rule ) {
144
+ global $siteguard_config;
145
  $errors = new WP_Error();
146
 
147
+ $rules = $siteguard_config->get( SITEGUARD_WAF_EXCLUDE_RULE );
148
  if ( isset( $new_rule['ID'] ) ) {
149
  $id = $new_rule['ID'];
150
  } else {
158
  return $errors;
159
  }
160
  array_splice( $rules, $offset, 1, array( $new_rule ) );
161
+ $siteguard_config->set( SITEGUARD_WAF_EXCLUDE_RULE, $rules );
162
+ $siteguard_config->update( );
163
  return true;
164
  }
165
+ function update_rule( $id, $filename, $sig, $comment ) {
166
  // check
167
  $errors = $this->input_check( $id, $filename, $sig, $comment );
168
  if ( is_wp_error( $errors ) ) {
175
  'sig' => $sig,
176
  'comment' => $comment,
177
  );
178
+ return $this->update_rule_itr( $new_rule );
179
  }
180
  function cvt_csrf2comma( $signatures ) {
181
  $result = preg_replace( "/(\r\n)+/", "\r\n", $signatures );
203
  return ' SiteGuard_User_ExcludeSig '. $this->cvt_csrf2comma( $sig_str ) . "\n";
204
  }
205
  function update_settings( ) {
206
+ global $siteguard_config;
207
  $htaccess_str = '';
208
+ $rules = $siteguard_config->get( SITEGUARD_WAF_EXCLUDE_RULE );
209
+ if ( '' === $rules ) {
210
  return;
211
  }
212
 
229
  return $htaccess_str;
230
  }
231
  function feature_on( ) {
232
+ global $siteguard_htaccess;
233
+ if ( false === SiteGuard_Htaccess::check_permission( ) ) {
234
+ return false;
235
+ }
236
  $data = $this->update_settings( );
237
  $mark = $this->get_mark( );
238
+ return $siteguard_htaccess->update_settings( $mark, $data );
239
  }
240
  static function feature_off( ) {
241
  $mark = SiteGuard_WAF_Exclude_Rule::get_mark( );
242
+ return SiteGuard_Htaccess::clear_settings( $mark );
243
  }
244
  }
 
 
languages/siteguard-ja.mo CHANGED
Binary file
languages/siteguard-ja.po CHANGED
@@ -16,6 +16,12 @@ msgstr ""
16
  msgid "Date Time"
17
  msgstr "日時"
18
 
 
 
 
 
 
 
19
  #: admin/siteguard-login-history-table.php:63
20
  msgid "Operation"
21
  msgstr "結果"
@@ -28,6 +34,30 @@ msgstr "ログイン名"
28
  msgid "IP Address"
29
  msgstr "IPアドレス"
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  #: admin/siteguard-menu-admin-filter.php:32
32
  #: admin/siteguard-menu-admin-filter.php:81
33
  #: admin/siteguard-menu-rename-login.php:19
@@ -541,10 +571,24 @@ msgstr ""
541
  " "
542
 
543
  msgid ""
544
- "In order to enable this function, it is necessary to specify Limit to AllowOverride in httpd.conf."
 
 
 
 
 
545
  msgstr ""
546
- "この機能を使用するには、httpd.confのAllowOverrideにLimitを指定する必要があります。"
547
 
 
 
 
 
 
 
 
 
 
548
 
549
  #: admin/siteguard-sg-whitelist-table.php:61
550
  msgid "Directive"
@@ -576,8 +620,8 @@ msgid "E-mail notifies that there was login."
576
  msgstr "ログインがあったことを、メールで通知します。"
577
 
578
  #: admin/siteguard-menu-dashboard.php:52
579
- msgid "The abuse of pingback is prevented."
580
- msgstr "ピンバックの悪用を防ぎます。"
581
 
582
  #: admin/siteguard-menu-dashboard.php:57
583
  msgid "The exclude rule for WAF (SiteGuard Lite) is created."
@@ -600,6 +644,9 @@ msgstr "エラー: 画像認証が間違っています。"
600
  msgid "ERROR: Invalid input value."
601
  msgstr "エラー: 入力値が不正です。"
602
 
 
 
 
603
  #: classes/siteguard-login-history.php:95
604
  msgid "Failed"
605
  msgstr "失敗"
@@ -731,6 +778,42 @@ msgstr "WordPress: 更新通知 @ %s"
731
  msgid "WordPress updates"
732
  msgstr "WordPressの更新"
733
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
734
  msgid ""
735
  "DISABLE_WP_CRON is defined true. This function can't be used."
736
  msgstr ""
@@ -748,38 +831,44 @@ msgstr ""
748
 
749
  #. Plugin URI of the plugin/theme
750
  #: admin/siteguard-menu-dashboard.php
751
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/index_en.html"
752
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/index.html"
 
 
 
 
 
 
753
 
754
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/admin_filter_en.html"
755
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/admin_filter.html"
756
 
757
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/rename_login_en.html"
758
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/rename_login.html"
759
 
760
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/captcha_en.html"
761
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/captcha.html"
762
 
763
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/same_error_en.html"
764
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/same_error.html"
765
 
766
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_lock_en.html"
767
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_lock.html"
768
 
769
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_alert_en.html"
770
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_alert.html"
771
 
772
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/fail_once_en.html"
773
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/fail_once.html"
774
 
775
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/pingback_en.html"
776
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/pingback.html"
777
 
778
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/updates_notify_en.html"
779
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/updates_notify.html"
780
 
781
- msgid "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/waf_tuning_support_en.html"
782
- msgstr "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/waf_tuning_support.html"
783
 
784
  #. Description of the plugin/theme
785
  msgid ""
16
  msgid "Date Time"
17
  msgstr "日時"
18
 
19
+ msgid "Type"
20
+ msgstr "タイプ"
21
+
22
+ msgid "Login Page"
23
+ msgstr "ログインページ"
24
+
25
  #: admin/siteguard-login-history-table.php:63
26
  msgid "Operation"
27
  msgstr "結果"
34
  msgid "IP Address"
35
  msgstr "IPアドレス"
36
 
37
+ msgid "All Operations"
38
+ msgstr "すべての結果"
39
+
40
+ msgid "All Types"
41
+ msgstr "すべてのタイプ"
42
+
43
+ msgid "Other"
44
+ msgstr "以外"
45
+
46
+ msgid "Protect XMLRPC"
47
+ msgstr "XMLRPC防御"
48
+
49
+ msgid "Disable XMLRPC"
50
+ msgstr "XMLRPC無効化"
51
+
52
+ msgid "Login history can be referenced."
53
+ msgstr "ログインの履歴が参照できます。"
54
+
55
+ msgid "Login history can be referenced. Let's see if there are any suspicious history. History, registered 10,000 maximum, will be removed from those old and more than 10,000."
56
+ msgstr "ログインの履歴が参照できます。怪しい履歴がないか確認しましょう。履歴は、最大10,000件記錄され、10,000件を超えると古いものから削除されます。"
57
+
58
+ msgid "To disable the Pingback, or disable the entire XMLRPC ( xmlrpc.php ), to prevent abuse. When you disable the whole XMLRPC, you will not be able to use plug-ins and apps that use XMLRPC. If there is trouble, please do not use this function."
59
+ msgstr "Pingback機能を無効化する、あるいは、XMLRPC全体( xmlrpc.php )を無効化し、悪用を防止します。XMLRPC全体を無効化すると、XMLRPCを使用したプラグインやアプリの使用ができなくなります。支障がある場合には、本機能を使わないでください。"
60
+
61
  #: admin/siteguard-menu-admin-filter.php:32
62
  #: admin/siteguard-menu-admin-filter.php:81
63
  #: admin/siteguard-menu-rename-login.php:19
571
  " "
572
 
573
  msgid ""
574
+ "The image file access failed."
575
+ msgstr ""
576
+ "画像ファイルのアクセスに失敗しました。"
577
+
578
+ msgid ""
579
+ "The image file write failed."
580
  msgstr ""
581
+ "画像ファイルの書き込みに失敗しました。"
582
 
583
+ msgid ""
584
+ "In order to enable this function, php must be compiled with FreeType support enabled."
585
+ msgstr ""
586
+ "この機能を使用するには、phpがFreeTypeサポートを有効にしてコンパイルされている必要があります。"
587
+
588
+ msgid ""
589
+ "mod_rewrite of .htaccess can not be used"
590
+ msgstr ""
591
+ ".htaccessのmod_rewriteが使用できません。"
592
 
593
  #: admin/siteguard-sg-whitelist-table.php:61
594
  msgid "Directive"
620
  msgstr "ログインがあったことを、メールで通知します。"
621
 
622
  #: admin/siteguard-menu-dashboard.php:52
623
+ msgid "The abuse of XMLRPC is prevented."
624
+ msgstr "XMLRPCの悪用を防ぎます。"
625
 
626
  #: admin/siteguard-menu-dashboard.php:57
627
  msgid "The exclude rule for WAF (SiteGuard Lite) is created."
644
  msgid "ERROR: Invalid input value."
645
  msgstr "エラー: 入力値が不正です。"
646
 
647
+ msgid "ERROR: Failed to .htaccess update."
648
+ msgstr "エラー: .htaccessの更新に失敗しました。"
649
+
650
  #: classes/siteguard-login-history.php:95
651
  msgid "Failed"
652
  msgstr "失敗"
778
  msgid "WordPress updates"
779
  msgstr "WordPressの更新"
780
 
781
+ msgid "Advanced Setting"
782
+ msgstr "詳細設定"
783
+
784
+ msgid "IP Address Mode"
785
+ msgstr "IPアドレス取得方法"
786
+
787
+ msgid "REMOTE_ADDR"
788
+ msgstr "リモートアドレス"
789
+
790
+ msgid "X-Forwarded-For Level:1"
791
+ msgstr "X-Forwarded-For レベル:1"
792
+
793
+ msgid "X-Forwarded-For Level:2"
794
+ msgstr "X-Forwarded-For レベル:2"
795
+
796
+ msgid "X-Forwarded-For Level:3"
797
+ msgstr "X-Forwarded-For レベル:3"
798
+
799
+ msgid ""
800
+ "Set the method for acquiring the IP address."
801
+
802
+ msgstr ""
803
+ "IPアドレスの取得方法を設定します。"
804
+
805
+ msgid ""
806
+ "Set the method for acquiring the IP address. Normally you should select a remote address. "
807
+ "If there is a proxy or load balancer in front of the web server and you can not obtain the client's IP address with remote address, "
808
+ "you can obtain the IP address from X-Forwarded-For. "
809
+ "Level represents the number from the right end of the value of X-Forwarded-For."
810
+
811
+ msgstr ""
812
+ "IPアドレスの取得方法を設定します。通常はリモートアドレスを選択してください。"
813
+ "Webサーバーの前段にプロキシーサーバーや、ロードバランサーが存在して、リモートアドレスでクライアントのIPアドレスが取得できない場合は、"
814
+ "X-Forwarded-ForからIPアドレスを取得できます。"
815
+ "レベルは、X-Forwarded-Forの値の右端から何番目かを表します。"
816
+
817
  msgid ""
818
  "DISABLE_WP_CRON is defined true. This function can't be used."
819
  msgstr ""
831
 
832
  #. Plugin URI of the plugin/theme
833
  #: admin/siteguard-menu-dashboard.php
834
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/"
835
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/"
836
+
837
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_history/"
838
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/login_history/"
839
+
840
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/admin_filter/"
841
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/admin_filter/"
842
 
843
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/rename_login/"
844
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/rename_login/"
845
 
846
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/captcha/"
847
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/captcha/"
848
 
849
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/same_error/"
850
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/same_error/"
851
 
852
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_lock/"
853
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/login_lock/"
854
 
855
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_alert/"
856
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/login_alert/"
857
 
858
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/fail_once/"
859
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/fail_once/"
860
 
861
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/xmlrpc/"
862
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/xmlrpc/"
863
 
864
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/updates_notify/"
865
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/updates_notify/"
866
 
867
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/waf_tuning_support/"
868
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/waf_tuning_support/"
869
 
870
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/advanced_setting/"
871
+ msgstr "https://www.jp-secure.com/siteguard_wp_plugin/howto/advanced_setting/"
872
 
873
  #. Description of the plugin/theme
874
  msgid ""
languages/siteguard.pot CHANGED
@@ -1,155 +1,230 @@
1
- # Copyright (C) 2015 SiteGuard WP Plugin
2
  # This file is distributed under the same license as the SiteGuard WP Plugin package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: SiteGuard WP Plugin 1.2.2\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/siteguard\n"
7
- "POT-Creation-Date: 2015-06-05 01:02:54+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: admin/siteguard-login-history-table.php:35
16
  msgid "Date Time"
17
  msgstr ""
18
 
19
- #: admin/siteguard-login-history-table.php:36
 
20
  msgid "Operation"
21
  msgstr ""
22
 
23
- #: admin/siteguard-login-history-table.php:37
 
24
  msgid "Login Name"
25
  msgstr ""
26
 
27
- #: admin/siteguard-login-history-table.php:38
 
28
  msgid "IP Address"
29
  msgstr ""
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  #: admin/siteguard-menu-admin-filter.php:39
32
- #: admin/siteguard-menu-admin-filter.php:100
33
  #: admin/siteguard-menu-rename-login.php:26
34
- #: admin/siteguard-menu-rename-login.php:113
35
  msgid "To use this function, “mod_rewrite” should be loaded on Apache."
36
  msgstr ""
37
 
38
  #: admin/siteguard-menu-admin-filter.php:49
39
- #: admin/siteguard-menu-captcha.php:52
40
- #: admin/siteguard-menu-disable-pingback.php:23
41
- #: admin/siteguard-menu-fail-once.php:26
42
  #: admin/siteguard-menu-login-alert.php:30
43
- #: admin/siteguard-menu-login-lock.php:52
 
44
  #: admin/siteguard-menu-rename-login.php:36
45
  #: admin/siteguard-menu-same-error.php:33
46
- #: admin/siteguard-menu-updates-notify.php:40
47
- #: admin/siteguard-menu-waf-tuning-support.php:152
48
- #: classes/siteguard-waf-exclude-rule.php:48
49
- #: classes/siteguard-waf-exclude-rule.php:141
50
- #: classes/siteguard-waf-exclude-rule.php:147
51
  msgid "ERROR: Invalid input value."
52
  msgstr ""
53
 
54
- #: admin/siteguard-menu-admin-filter.php:67
55
- #: admin/siteguard-menu-captcha.php:69
56
- #: admin/siteguard-menu-disable-pingback.php:32
57
- #: admin/siteguard-menu-fail-once.php:41
 
 
 
 
 
58
  #: admin/siteguard-menu-login-alert.php:49
59
- #: admin/siteguard-menu-login-lock.php:67
60
- #: admin/siteguard-menu-rename-login.php:81
 
61
  #: admin/siteguard-menu-same-error.php:42
62
- #: admin/siteguard-menu-updates-notify.php:69
63
  msgid "Options saved."
64
  msgstr ""
65
 
66
- #: admin/siteguard-menu-admin-filter.php:74
67
- #: admin/siteguard-menu-dashboard.php:37 admin/siteguard-menu-init.php:16
 
 
 
 
 
 
 
 
68
  msgid "Admin Page IP Filter"
69
  msgstr ""
70
 
71
- #: admin/siteguard-menu-admin-filter.php:76
72
- #: admin/siteguard-menu-captcha.php:78
73
- #: admin/siteguard-menu-disable-pingback.php:41
74
- #: admin/siteguard-menu-fail-once.php:50
75
  #: admin/siteguard-menu-login-alert.php:58
76
- #: admin/siteguard-menu-login-lock.php:76
77
- #: admin/siteguard-menu-rename-login.php:90
 
 
78
  #: admin/siteguard-menu-same-error.php:51
79
- #: admin/siteguard-menu-updates-notify.php:78
80
- #: admin/siteguard-menu-waf-tuning-support.php:200
81
  msgid "You can find docs about this function on "
82
  msgstr ""
83
 
84
- #: admin/siteguard-menu-admin-filter.php:77
85
- msgid ""
86
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/admin_filter_en."
87
- "html"
88
  msgstr ""
89
 
90
- #: admin/siteguard-menu-admin-filter.php:79
91
- #: admin/siteguard-menu-captcha.php:81
92
- #: admin/siteguard-menu-disable-pingback.php:44
93
- #: admin/siteguard-menu-fail-once.php:53
94
  #: admin/siteguard-menu-login-alert.php:61
95
- #: admin/siteguard-menu-login-lock.php:79
96
- #: admin/siteguard-menu-rename-login.php:93
 
97
  #: admin/siteguard-menu-same-error.php:54
98
- #: admin/siteguard-menu-updates-notify.php:81
99
- #: admin/siteguard-menu-waf-tuning-support.php:203 siteguard.php:168
100
  msgid "here"
101
  msgstr ""
102
 
103
- #: admin/siteguard-menu-admin-filter.php:81
104
- #: admin/siteguard-menu-captcha.php:83 admin/siteguard-menu-dashboard.php:30
105
- #: admin/siteguard-menu-disable-pingback.php:46
106
  #: admin/siteguard-menu-fail-once.php:55
107
  #: admin/siteguard-menu-login-alert.php:63
108
- #: admin/siteguard-menu-login-lock.php:81
109
- #: admin/siteguard-menu-rename-login.php:95
 
 
110
  #: admin/siteguard-menu-same-error.php:56
111
- #: admin/siteguard-menu-updates-notify.php:83
112
- #: admin/siteguard-menu-waf-tuning-support.php:205
113
  msgid "."
114
  msgstr ""
115
 
116
- #: admin/siteguard-menu-admin-filter.php:91
117
- #: admin/siteguard-menu-captcha.php:93
118
- #: admin/siteguard-menu-disable-pingback.php:57
119
- #: admin/siteguard-menu-fail-once.php:65
120
  #: admin/siteguard-menu-login-alert.php:73
121
- #: admin/siteguard-menu-login-lock.php:91
122
- #: admin/siteguard-menu-rename-login.php:105
 
123
  #: admin/siteguard-menu-same-error.php:66
124
- #: admin/siteguard-menu-updates-notify.php:93
125
- #: admin/siteguard-menu-waf-tuning-support.php:215
126
  msgid "ON"
127
  msgstr ""
128
 
129
- #: admin/siteguard-menu-admin-filter.php:95
130
- #: admin/siteguard-menu-captcha.php:96
131
- #: admin/siteguard-menu-disable-pingback.php:60
132
- #: admin/siteguard-menu-fail-once.php:68
133
  #: admin/siteguard-menu-login-alert.php:76
134
- #: admin/siteguard-menu-login-lock.php:94
135
- #: admin/siteguard-menu-rename-login.php:108
 
136
  #: admin/siteguard-menu-same-error.php:69
137
- #: admin/siteguard-menu-updates-notify.php:96
138
- #: admin/siteguard-menu-waf-tuning-support.php:218
139
  msgid "OFF"
140
  msgstr ""
141
 
142
- #: admin/siteguard-menu-admin-filter.php:105
143
  msgid "Exclude Path"
144
  msgstr ""
145
 
146
- #: admin/siteguard-menu-admin-filter.php:107
147
  msgid ""
148
  "The path of /wp-admin/ henceforth is specified. To specify more than one, "
149
  "separate them with new line. "
150
  msgstr ""
151
 
152
- #: admin/siteguard-menu-admin-filter.php:112
153
  msgid ""
154
  "It is the function for the protection against the attack to the management "
155
  "page (under /wp-admin/.) To the access from the connection source IP address "
@@ -160,51 +235,90 @@ msgid ""
160
  "where this function is excluded can be specified."
161
  msgstr ""
162
 
163
- #: admin/siteguard-menu-captcha.php:76 admin/siteguard-menu-dashboard.php:47
164
- #: admin/siteguard-menu-init.php:18
165
- msgid "CAPTCHA"
 
166
  msgstr ""
167
 
168
- #: admin/siteguard-menu-captcha.php:79
169
  msgid ""
170
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/captcha_en.html"
171
  msgstr ""
172
 
173
- #: admin/siteguard-menu-captcha.php:109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  msgid "Login page"
175
  msgstr ""
176
 
177
- #: admin/siteguard-menu-captcha.php:112 admin/siteguard-menu-captcha.php:124
178
- #: admin/siteguard-menu-captcha.php:136 admin/siteguard-menu-captcha.php:148
179
  msgid "Hiragana (Japanese)"
180
  msgstr ""
181
 
182
- #: admin/siteguard-menu-captcha.php:115 admin/siteguard-menu-captcha.php:127
183
- #: admin/siteguard-menu-captcha.php:139 admin/siteguard-menu-captcha.php:151
184
  msgid "Alphanumeric"
185
  msgstr ""
186
 
187
- #: admin/siteguard-menu-captcha.php:118 admin/siteguard-menu-captcha.php:130
188
- #: admin/siteguard-menu-captcha.php:142 admin/siteguard-menu-captcha.php:154
189
- #: admin/siteguard-menu-updates-notify.php:112
190
- #: admin/siteguard-menu-updates-notify.php:121
191
- #: admin/siteguard-menu-updates-notify.php:133
192
  msgid "Disable"
193
  msgstr ""
194
 
195
- #: admin/siteguard-menu-captcha.php:121
196
  msgid "Comment page"
197
  msgstr ""
198
 
199
- #: admin/siteguard-menu-captcha.php:133
200
  msgid "Lost password page"
201
  msgstr ""
202
 
203
- #: admin/siteguard-menu-captcha.php:145
204
  msgid "Registration user page"
205
  msgstr ""
206
 
207
- #: admin/siteguard-menu-captcha.php:159
208
  msgid ""
209
  "It is the function to decrease the vulnerability against an illegal login "
210
  "attempt attack such as a brute force attack or a password list attack, or to "
@@ -212,148 +326,142 @@ msgid ""
212
  "alphanumeric characters can be selected."
213
  msgstr ""
214
 
215
- #: admin/siteguard-menu-dashboard.php:27 admin/siteguard-menu-init.php:15
 
216
  msgid "Dashboard"
217
  msgstr ""
218
 
219
- #: admin/siteguard-menu-dashboard.php:29
220
  msgid ""
221
  "You can find docs, FAQ and more detailed information about SiteGuard WP "
222
  "Plugin on "
223
  msgstr ""
224
 
225
- #. #-#-#-#-# siteguard.pot (SiteGuard WP Plugin 1.2.2) #-#-#-#-#
226
- #. Plugin URI of the plugin/theme
227
- #: admin/siteguard-menu-dashboard.php:30
228
- msgid ""
229
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/index_en.html"
230
  msgstr ""
231
 
232
- #: admin/siteguard-menu-dashboard.php:30
 
233
  msgid "SiteGuard WP Plugin Page"
234
  msgstr ""
235
 
236
- #: admin/siteguard-menu-dashboard.php:31
237
  msgid "Setting status"
238
  msgstr ""
239
 
240
- #: admin/siteguard-menu-dashboard.php:38
241
  msgid ""
242
  "The management directory (/wp-admin/) is protected against the connection "
243
  "source which does not login."
244
  msgstr ""
245
 
246
- #: admin/siteguard-menu-dashboard.php:42 admin/siteguard-menu-init.php:17
247
- #: admin/siteguard-menu-rename-login.php:88
248
  msgid "Rename Login"
249
  msgstr ""
250
 
251
- #: admin/siteguard-menu-dashboard.php:43
252
  msgid "The login page name is changed."
253
  msgstr ""
254
 
255
- #: admin/siteguard-menu-dashboard.php:48
256
  msgid "CAPTCHA is added to the login page or comment post."
257
  msgstr ""
258
 
259
- #: admin/siteguard-menu-dashboard.php:52 admin/siteguard-menu-init.php:19
260
- #: admin/siteguard-menu-same-error.php:49
261
  msgid "Same Login Error Message"
262
  msgstr ""
263
 
264
- #: admin/siteguard-menu-dashboard.php:53
265
  msgid ""
266
  "Instead of the detailed error message at the login error, the single message "
267
  "is returned."
268
  msgstr ""
269
 
270
- #: admin/siteguard-menu-dashboard.php:57 admin/siteguard-menu-init.php:20
271
- #: admin/siteguard-menu-login-lock.php:74
272
  msgid "Login Lock"
273
  msgstr ""
274
 
275
- #: admin/siteguard-menu-dashboard.php:58
276
  msgid ""
277
  "The connection source which repeats login failure is being locked within a "
278
  "certain period."
279
  msgstr ""
280
 
281
- #: admin/siteguard-menu-dashboard.php:62 admin/siteguard-menu-init.php:21
282
- #: admin/siteguard-menu-login-alert.php:56
283
  msgid "Login Alert"
284
  msgstr ""
285
 
286
- #: admin/siteguard-menu-dashboard.php:63
287
  msgid "E-mail notifies that there was login."
288
  msgstr ""
289
 
290
- #: admin/siteguard-menu-dashboard.php:67 admin/siteguard-menu-fail-once.php:48
291
- #: admin/siteguard-menu-init.php:22 classes/siteguard-login-history.php:104
292
- msgid "Fail once"
293
- msgstr ""
294
-
295
- #: admin/siteguard-menu-dashboard.php:68
296
  msgid "The first login must fail even if the input is correct."
297
  msgstr ""
298
 
299
- #: admin/siteguard-menu-dashboard.php:72
300
- #: admin/siteguard-menu-disable-pingback.php:39
301
- #: admin/siteguard-menu-init.php:23
302
- msgid "Disable Pingback"
303
  msgstr ""
304
 
305
- #: admin/siteguard-menu-dashboard.php:73
306
- msgid "The abuse of pingback is prevented."
307
  msgstr ""
308
 
309
- #: admin/siteguard-menu-dashboard.php:77 admin/siteguard-menu-init.php:24
310
- #: admin/siteguard-menu-updates-notify.php:76
311
  msgid "Updates Notify"
312
  msgstr ""
313
 
314
- #: admin/siteguard-menu-dashboard.php:78
315
  msgid ""
316
  "If WordPress core, plugins, and themes updates are needed , sends email to "
317
  "notify administrators."
318
  msgstr ""
319
 
320
- #: admin/siteguard-menu-dashboard.php:82 admin/siteguard-menu-init.php:25
321
- #: admin/siteguard-menu-waf-tuning-support.php:198
 
322
  msgid "WAF Tuning Support"
323
  msgstr ""
324
 
325
- #: admin/siteguard-menu-dashboard.php:83
326
  msgid "The exclude rule for WAF (SiteGuard Lite) is created."
327
  msgstr ""
328
 
329
- #: admin/siteguard-menu-dashboard.php:88
330
- msgid "Login history"
331
  msgstr ""
332
 
333
- #: admin/siteguard-menu-disable-pingback.php:42
334
- msgid ""
335
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/pingback_en.html"
336
  msgstr ""
337
 
338
- #: admin/siteguard-menu-disable-pingback.php:68
339
- msgid "The pingback function is disabled and its abuse is prevented."
340
  msgstr ""
341
 
342
  #: admin/siteguard-menu-fail-once.php:51
343
- msgid ""
344
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/fail_once_en.html"
345
  msgstr ""
346
 
347
- #: admin/siteguard-menu-fail-once.php:74
348
  msgid "Target user"
349
  msgstr ""
350
 
351
- #: admin/siteguard-menu-fail-once.php:77
352
- #: admin/siteguard-menu-login-alert.php:94
353
  msgid "Admin only"
354
  msgstr ""
355
 
356
- #: admin/siteguard-menu-fail-once.php:83
357
  msgid ""
358
  "It is the function to decrease the vulnerability against a password list "
359
  "attack. Even is the login input is correct, the first login must fail. After "
@@ -362,29 +470,27 @@ msgid ""
362
  "displayed."
363
  msgstr ""
364
 
365
- #: admin/siteguard-menu-init.php:14
366
  msgid "SiteGuard"
367
  msgstr ""
368
 
369
  #: admin/siteguard-menu-login-alert.php:59
370
- msgid ""
371
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_alert_en."
372
- "html"
373
  msgstr ""
374
 
375
- #: admin/siteguard-menu-login-alert.php:81
376
  msgid "Subject"
377
  msgstr ""
378
 
379
- #: admin/siteguard-menu-login-alert.php:86
380
  msgid "Body"
381
  msgstr ""
382
 
383
- #: admin/siteguard-menu-login-alert.php:91
384
  msgid "Recipients"
385
  msgstr ""
386
 
387
- #: admin/siteguard-menu-login-alert.php:100
388
  msgid ""
389
  "It is the function to make it easier to notice unauthorized login. E-mail "
390
  "will be sent to a login user when logged in. If you receive an e-mail to "
@@ -395,57 +501,67 @@ msgid ""
395
  "notified."
396
  msgstr ""
397
 
398
- #: admin/siteguard-menu-login-lock.php:77
 
 
 
 
399
  msgid ""
400
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_lock_en.html"
 
 
401
  msgstr ""
402
 
403
- #: admin/siteguard-menu-login-lock.php:99
 
 
 
 
404
  msgid "Interval"
405
  msgstr ""
406
 
407
- #: admin/siteguard-menu-login-lock.php:102
408
  msgid "1 second"
409
  msgstr ""
410
 
411
- #: admin/siteguard-menu-login-lock.php:105
412
  msgid "5 seconds"
413
  msgstr ""
414
 
415
- #: admin/siteguard-menu-login-lock.php:108
416
- #: admin/siteguard-menu-login-lock.php:126
417
  msgid "30 seconds"
418
  msgstr ""
419
 
420
- #: admin/siteguard-menu-login-lock.php:111
421
  msgid "Threshold"
422
  msgstr ""
423
 
424
- #: admin/siteguard-menu-login-lock.php:114
425
  msgid "3 times"
426
  msgstr ""
427
 
428
- #: admin/siteguard-menu-login-lock.php:117
429
  msgid "10 times"
430
  msgstr ""
431
 
432
- #: admin/siteguard-menu-login-lock.php:120
433
  msgid "100 times"
434
  msgstr ""
435
 
436
- #: admin/siteguard-menu-login-lock.php:123
437
  msgid "Lock Time"
438
  msgstr ""
439
 
440
- #: admin/siteguard-menu-login-lock.php:129
441
  msgid "1 minute"
442
  msgstr ""
443
 
444
- #: admin/siteguard-menu-login-lock.php:132
445
  msgid "5 minutes"
446
  msgstr ""
447
 
448
- #: admin/siteguard-menu-login-lock.php:137
449
  msgid ""
450
  "It is the function to decrease the vulnerability against an illegal login "
451
  "attempt attack such as a brute force attack or a password list attack. "
@@ -455,6 +571,26 @@ msgid ""
455
  "specified time. Each user account is not locked."
456
  msgstr ""
457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  #: admin/siteguard-menu-rename-login.php:44
459
  msgid "This function and Plugin \""
460
  msgstr ""
@@ -473,21 +609,19 @@ msgstr ""
473
  msgid " can not be used for New Login Path."
474
  msgstr ""
475
 
476
- #: admin/siteguard-menu-rename-login.php:91
477
- msgid ""
478
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/rename_login_en."
479
- "html"
480
  msgstr ""
481
 
482
- #: admin/siteguard-menu-rename-login.php:118
483
  msgid "New Login Path"
484
  msgstr ""
485
 
486
- #: admin/siteguard-menu-rename-login.php:123
487
  msgid "An alphanumeric character, a hyphen, and an underbar can be used."
488
  msgstr ""
489
 
490
- #: admin/siteguard-menu-rename-login.php:131
491
  msgid ""
492
  "It is the function to decrease the vulnerability against an illegal login "
493
  "attempt attack such as a brute force attack or a password list attack. The "
@@ -496,11 +630,10 @@ msgid ""
496
  msgstr ""
497
 
498
  #: admin/siteguard-menu-same-error.php:52
499
- msgid ""
500
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/same_error_en.html"
501
  msgstr ""
502
 
503
- #: admin/siteguard-menu-same-error.php:77
504
  msgid ""
505
  "It is the function to decrease the vulnerability against the attack to "
506
  "examine if a user name exists. All error messages about the login should be "
@@ -508,94 +641,91 @@ msgid ""
508
  "username, password, or CAPTCHA is wrong."
509
  msgstr ""
510
 
511
- #: admin/siteguard-menu-updates-notify.php:79
512
- msgid ""
513
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/updates_notify_en."
514
- "html"
515
  msgstr ""
516
 
517
- #: admin/siteguard-menu-updates-notify.php:109
518
  msgid "WordPress updates"
519
  msgstr ""
520
 
521
- #: admin/siteguard-menu-updates-notify.php:115
522
  msgid "Enable"
523
  msgstr ""
524
 
525
- #: admin/siteguard-menu-updates-notify.php:118
526
  msgid "Plugins updates"
527
  msgstr ""
528
 
529
- #: admin/siteguard-menu-updates-notify.php:124
530
  msgid "All plugins"
531
  msgstr ""
532
 
533
- #: admin/siteguard-menu-updates-notify.php:127
534
  msgid "Active plugins only"
535
  msgstr ""
536
 
537
- #: admin/siteguard-menu-updates-notify.php:130
538
  msgid "Themes updates"
539
  msgstr ""
540
 
541
- #: admin/siteguard-menu-updates-notify.php:136
542
  msgid "All themes"
543
  msgstr ""
544
 
545
- #: admin/siteguard-menu-updates-notify.php:139
546
  msgid "Active themes only"
547
  msgstr ""
548
 
549
- #: admin/siteguard-menu-updates-notify.php:144
550
  msgid ""
551
  "Basic of security is that always you use the latest version. If WordPress "
552
  "core, plugins, and themes updates are needed , sends email to notify "
553
  "administrators. Check for updates will be run every 24 hours."
554
  msgstr ""
555
 
556
- #: admin/siteguard-menu-waf-tuning-support.php:79
557
  msgid "New rule created"
558
  msgstr ""
559
 
560
- #: admin/siteguard-menu-waf-tuning-support.php:103
561
  msgid "Rule updated"
562
  msgstr ""
563
 
564
- #: admin/siteguard-menu-waf-tuning-support.php:122
565
  msgid "Rule deleted"
566
  msgstr ""
567
 
568
- #: admin/siteguard-menu-waf-tuning-support.php:143
569
  msgid ""
570
  "To use the WAF exclude rule, WAF ( SiteGuard Lite ) should be installed on "
571
  "Apache."
572
  msgstr ""
573
 
574
- #: admin/siteguard-menu-waf-tuning-support.php:161
575
  msgid "Rules applied"
576
  msgstr ""
577
 
578
- #: admin/siteguard-menu-waf-tuning-support.php:164
579
  msgid "Rules unapplied"
580
  msgstr ""
581
 
582
- #: admin/siteguard-menu-waf-tuning-support.php:198
583
  msgid "Add New"
584
  msgstr ""
585
 
586
- #: admin/siteguard-menu-waf-tuning-support.php:201
587
  msgid ""
588
- "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/"
589
- "waf_tuning_support_en.html"
590
  msgstr ""
591
 
592
- #: admin/siteguard-menu-waf-tuning-support.php:223
593
  msgid ""
594
  "To use the WAF Tuning Support, WAF ( SiteGuard Lite ) should be installed on "
595
  "Apache."
596
  msgstr ""
597
 
598
- #: admin/siteguard-menu-waf-tuning-support.php:232
599
  msgid ""
600
  "It is the function to create the rule to avoid the false detection in "
601
  "WordPress (including 403 error occurrence with normal access,) if WAF "
@@ -607,73 +737,73 @@ msgid ""
607
  "activated while the false detection for the specified function is prevented."
608
  msgstr ""
609
 
610
- #: admin/siteguard-menu-waf-tuning-support.php:239
611
  msgid "Apply rules"
612
  msgstr ""
613
 
614
- #: admin/siteguard-menu-waf-tuning-support.php:247
615
  msgid "WAF Exclude Rule Add"
616
  msgstr ""
617
 
618
- #: admin/siteguard-menu-waf-tuning-support.php:249
619
  msgid "WAF Exclude Rule Edit"
620
  msgstr ""
621
 
622
- #: admin/siteguard-menu-waf-tuning-support.php:255
623
- #: admin/siteguard-menu-waf-tuning-support.php:300
624
  #: admin/siteguard-waf-exclude-rule-table.php:59
625
  msgid "Signature"
626
  msgstr ""
627
 
628
- #: admin/siteguard-menu-waf-tuning-support.php:258
629
  msgid ""
630
  "The detected signature name or signature ID is specified. To specify more "
631
  "than one, separate them with new line."
632
  msgstr ""
633
 
634
- #: admin/siteguard-menu-waf-tuning-support.php:262
635
  msgid "Filename (optional)"
636
  msgstr ""
637
 
638
- #: admin/siteguard-menu-waf-tuning-support.php:265
639
  msgid ""
640
  "The target file name is specified. URL ( the part before ? ) can also be "
641
  "pasted."
642
  msgstr ""
643
 
644
- #: admin/siteguard-menu-waf-tuning-support.php:269
645
  msgid "Comment (optional)"
646
  msgstr ""
647
 
648
- #: admin/siteguard-menu-waf-tuning-support.php:281
649
  msgid "Save"
650
  msgstr ""
651
 
652
- #: admin/siteguard-menu-waf-tuning-support.php:291
653
  msgid "WAF Exclude Rule Delete"
654
  msgstr ""
655
 
656
- #: admin/siteguard-menu-waf-tuning-support.php:295
657
  msgid "You have specified this rule for deletion:"
658
  msgid_plural "You have specified these rules for deletion:"
659
  msgstr[0] ""
660
  msgstr[1] ""
661
 
662
- #: admin/siteguard-menu-waf-tuning-support.php:300
663
  #: admin/siteguard-waf-exclude-rule-table.php:60
664
  msgid "Filename"
665
  msgstr ""
666
 
667
- #: admin/siteguard-menu-waf-tuning-support.php:300
668
  #: admin/siteguard-waf-exclude-rule-table.php:61
669
  msgid "Comment"
670
  msgstr ""
671
 
672
- #: admin/siteguard-menu-waf-tuning-support.php:306
673
  msgid "Confirm Deletion"
674
  msgstr ""
675
 
676
- #: admin/siteguard-menu-waf-tuning-support.php:308
677
  msgid "There are no rules selected for deletion."
678
  msgstr ""
679
 
@@ -690,39 +820,43 @@ msgstr ""
690
  msgid "It does not support the multisite function of WordPress."
691
  msgstr ""
692
 
693
- #: classes/siteguard-captcha.php:75
694
  msgid ""
695
  "In order to enable this function, it is necessary to install expanded modules"
696
  msgstr ""
697
 
698
- #: classes/siteguard-captcha.php:86
699
  msgid "in the server."
700
  msgstr ""
701
 
702
- #: classes/siteguard-captcha.php:102
703
- msgid ""
704
- "In order to enable this function, it is necessary to specify Limit to "
705
- "AllowOverride in httpd.conf."
706
  msgstr ""
707
 
708
- #: classes/siteguard-captcha.php:107 classes/siteguard-login-lock.php:97
709
- msgid "ERROR: LOGIN LOCKED"
710
  msgstr ""
711
 
712
- #: classes/siteguard-captcha.php:107 classes/siteguard-login-lock.php:129
713
- msgid "ERROR: Please login entry again"
 
 
714
  msgstr ""
715
 
716
- #: classes/siteguard-captcha.php:108
 
 
 
 
717
  msgid "ERROR: Please check the input and resend."
718
  msgstr ""
719
 
720
- #: classes/siteguard-captcha.php:147
721
  msgid "Please input characters displayed above."
722
  msgstr ""
723
 
724
- #: classes/siteguard-captcha.php:191 classes/siteguard-captcha.php:195
725
- #: classes/siteguard-captcha.php:212 classes/siteguard-captcha.php:223
726
  msgid "ERROR: Invalid CAPTCHA."
727
  msgstr ""
728
 
@@ -743,27 +877,20 @@ msgid ""
743
  "SiteGuard WP Plugin"
744
  msgstr ""
745
 
746
- #: classes/siteguard-login-history.php:98
747
- msgid "Failed"
748
- msgstr ""
749
-
750
- #: classes/siteguard-login-history.php:101
751
- msgid "Success"
752
- msgstr ""
753
-
754
- #: classes/siteguard-login-history.php:107
755
- msgid "Locked"
756
  msgstr ""
757
 
758
- #: classes/siteguard-login-history.php:110
759
- msgid "Unknown"
760
  msgstr ""
761
 
762
- #: classes/siteguard-rename-login.php:143
763
  msgid "WordPress: Login page URL was changed"
764
  msgstr ""
765
 
766
- #: classes/siteguard-rename-login.php:144
767
  msgid ""
768
  "Please bookmark following of the new login URL.\n"
769
  "\n"
@@ -783,77 +910,77 @@ msgid ""
783
  "access control."
784
  msgstr ""
785
 
786
- #: classes/siteguard-updates-notify.php:93
787
  msgid "There are updates available for your WordPress site:"
788
  msgstr ""
789
 
790
- #: classes/siteguard-updates-notify.php:94
791
  msgid "Please visit %s to update."
792
  msgstr ""
793
 
794
- #: classes/siteguard-updates-notify.php:111
795
  msgid "WP-Core: WordPress is out of date. Please update from version %s to %s"
796
  msgstr ""
797
 
798
- #: classes/siteguard-updates-notify.php:145
799
  msgid "Plugin: %s is out of date. Please update from version %s to %s"
800
  msgstr ""
801
 
802
- #: classes/siteguard-updates-notify.php:146
803
  msgid "Details: %s"
804
  msgstr ""
805
 
806
- #: classes/siteguard-updates-notify.php:147
807
  msgid "Changelog: %s%s"
808
  msgstr ""
809
 
810
- #: classes/siteguard-updates-notify.php:149
811
  msgid "Compatibility with WordPress %1$s: 100%% (according to its author)"
812
  msgstr ""
813
 
814
- #: classes/siteguard-updates-notify.php:152
815
  msgid ""
816
  "Compatibility with WordPress %1$s: %2$d%% (%3$d \"works\" votes out of %4$d "
817
  "total)"
818
  msgstr ""
819
 
820
- #: classes/siteguard-updates-notify.php:154
821
  msgid "Compatibility with WordPress %1$s: Unknown"
822
  msgstr ""
823
 
824
- #: classes/siteguard-updates-notify.php:156
825
  msgid "Compatibility: %s"
826
  msgstr ""
827
 
828
- #: classes/siteguard-updates-notify.php:188
829
  msgid "Theme: %s is out of date. Please update from version %s to %s"
830
  msgstr ""
831
 
832
- #: classes/siteguard-updates-notify.php:237
833
  msgid "WordPress: Updates Available @ %s"
834
  msgstr ""
835
 
836
- #: classes/siteguard-waf-exclude-rule.php:51
837
  msgid "ERROR: Signature is required"
838
  msgstr ""
839
 
840
- #: classes/siteguard-waf-exclude-rule.php:60
841
  msgid "ERROR: Syntax Error in Signature"
842
  msgstr ""
843
 
844
- #: siteguard.php:163
845
  msgid "Login page URL was changed."
846
  msgstr ""
847
 
848
- #: siteguard.php:165
849
  msgid " Please bookmark "
850
  msgstr ""
851
 
852
- #: siteguard.php:166
853
  msgid "new login URL"
854
  msgstr ""
855
 
856
- #: siteguard.php:167
857
  msgid ". Setting change is "
858
  msgstr ""
859
 
@@ -861,6 +988,11 @@ msgstr ""
861
  msgid "SiteGuard WP Plugin"
862
  msgstr ""
863
 
 
 
 
 
 
864
  #. Description of the plugin/theme
865
  msgid ""
866
  "Only installing SiteGuard WP Plugin on WordPress, its security can be "
1
+ # Copyright (C) 2017 SiteGuard WP Plugin
2
  # This file is distributed under the same license as the SiteGuard WP Plugin package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: SiteGuard WP Plugin 1.4.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/siteguard\n"
7
+ "POT-Creation-Date: 2017-07-05 04:39:39+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: admin/siteguard-login-history-table.php:73
16
  msgid "Date Time"
17
  msgstr ""
18
 
19
+ #: admin/siteguard-login-history-table.php:74
20
+ #: admin/siteguard-login-history-table.php:222
21
  msgid "Operation"
22
  msgstr ""
23
 
24
+ #: admin/siteguard-login-history-table.php:75
25
+ #: admin/siteguard-login-history-table.php:225
26
  msgid "Login Name"
27
  msgstr ""
28
 
29
+ #: admin/siteguard-login-history-table.php:76
30
+ #: admin/siteguard-login-history-table.php:231
31
  msgid "IP Address"
32
  msgstr ""
33
 
34
+ #: admin/siteguard-login-history-table.php:77
35
+ #: admin/siteguard-login-history-table.php:228
36
+ #: admin/siteguard-menu-protect-xmlrpc.php:155
37
+ msgid "Type"
38
+ msgstr ""
39
+
40
+ #: admin/siteguard-login-history-table.php:183
41
+ msgid "All Operations"
42
+ msgstr ""
43
+
44
+ #: admin/siteguard-login-history-table.php:184
45
+ #: classes/siteguard-login-history.php:127
46
+ msgid "Success"
47
+ msgstr ""
48
+
49
+ #: admin/siteguard-login-history-table.php:185
50
+ #: classes/siteguard-login-history.php:124
51
+ msgid "Failed"
52
+ msgstr ""
53
+
54
+ #: admin/siteguard-login-history-table.php:186
55
+ #: admin/siteguard-menu-dashboard.php:74 admin/siteguard-menu-fail-once.php:48
56
+ #: admin/siteguard-menu-init.php:42 admin/siteguard-menu-init.php:43
57
+ #: classes/siteguard-login-history.php:130
58
+ msgid "Fail once"
59
+ msgstr ""
60
+
61
+ #: admin/siteguard-login-history-table.php:187
62
+ #: classes/siteguard-login-history.php:133
63
+ msgid "Locked"
64
+ msgstr ""
65
+
66
+ #: admin/siteguard-login-history-table.php:195
67
+ #: admin/siteguard-login-history-table.php:202
68
+ msgid "Other"
69
+ msgstr ""
70
+
71
+ #: admin/siteguard-login-history-table.php:208
72
+ msgid "All Types"
73
+ msgstr ""
74
+
75
+ #: admin/siteguard-login-history-table.php:209
76
+ #: classes/siteguard-login-history.php:144
77
+ msgid "Login Page"
78
+ msgstr ""
79
+
80
+ #: admin/siteguard-login-history-table.php:210
81
+ #: classes/siteguard-login-history.php:147
82
+ msgid "XMLRPC"
83
+ msgstr ""
84
+
85
+ #: admin/siteguard-login-history-table.php:235
86
+ msgid "Filter"
87
+ msgstr ""
88
+
89
+ #: admin/siteguard-login-history-table.php:236
90
+ msgid "All"
91
+ msgstr ""
92
+
93
  #: admin/siteguard-menu-admin-filter.php:39
94
+ #: admin/siteguard-menu-admin-filter.php:125
95
  #: admin/siteguard-menu-rename-login.php:26
96
+ #: admin/siteguard-menu-rename-login.php:141
97
  msgid "To use this function, “mod_rewrite” should be loaded on Apache."
98
  msgstr ""
99
 
100
  #: admin/siteguard-menu-admin-filter.php:49
101
+ #: admin/siteguard-menu-advanced-setting.php:34
102
+ #: admin/siteguard-menu-captcha.php:53 admin/siteguard-menu-fail-once.php:26
 
103
  #: admin/siteguard-menu-login-alert.php:30
104
+ #: admin/siteguard-menu-login-lock.php:55
105
+ #: admin/siteguard-menu-protect-xmlrpc.php:73
106
  #: admin/siteguard-menu-rename-login.php:36
107
  #: admin/siteguard-menu-same-error.php:33
108
+ #: admin/siteguard-menu-updates-notify.php:41
109
+ #: admin/siteguard-menu-waf-tuning-support.php:173
110
+ #: classes/siteguard-waf-exclude-rule.php:52
111
+ #: classes/siteguard-waf-exclude-rule.php:151
112
+ #: classes/siteguard-waf-exclude-rule.php:157
113
  msgid "ERROR: Invalid input value."
114
  msgstr ""
115
 
116
+ #: admin/siteguard-menu-admin-filter.php:55
117
+ #: admin/siteguard-menu-protect-xmlrpc.php:82
118
+ #: admin/siteguard-menu-rename-login.php:70 classes/siteguard-captcha.php:69
119
+ msgid "mod_rewrite of .htaccess can not be used"
120
+ msgstr ""
121
+
122
+ #: admin/siteguard-menu-admin-filter.php:76
123
+ #: admin/siteguard-menu-advanced-setting.php:46
124
+ #: admin/siteguard-menu-captcha.php:70 admin/siteguard-menu-fail-once.php:41
125
  #: admin/siteguard-menu-login-alert.php:49
126
+ #: admin/siteguard-menu-login-lock.php:70
127
+ #: admin/siteguard-menu-protect-xmlrpc.php:103
128
+ #: admin/siteguard-menu-rename-login.php:93
129
  #: admin/siteguard-menu-same-error.php:42
130
+ #: admin/siteguard-menu-updates-notify.php:70
131
  msgid "Options saved."
132
  msgstr ""
133
 
134
+ #: admin/siteguard-menu-admin-filter.php:85
135
+ #: admin/siteguard-menu-protect-xmlrpc.php:113
136
+ #: admin/siteguard-menu-rename-login.php:102
137
+ #: admin/siteguard-menu-waf-tuning-support.php:24
138
+ msgid "ERROR: Failed to .htaccess update."
139
+ msgstr ""
140
+
141
+ #: admin/siteguard-menu-admin-filter.php:93
142
+ #: admin/siteguard-menu-dashboard.php:44 admin/siteguard-menu-init.php:18
143
+ #: admin/siteguard-menu-init.php:19
144
  msgid "Admin Page IP Filter"
145
  msgstr ""
146
 
147
+ #: admin/siteguard-menu-admin-filter.php:95
148
+ #: admin/siteguard-menu-advanced-setting.php:55
149
+ #: admin/siteguard-menu-captcha.php:79 admin/siteguard-menu-fail-once.php:50
 
150
  #: admin/siteguard-menu-login-alert.php:58
151
+ #: admin/siteguard-menu-login-history.php:19
152
+ #: admin/siteguard-menu-login-lock.php:79
153
+ #: admin/siteguard-menu-protect-xmlrpc.php:123
154
+ #: admin/siteguard-menu-rename-login.php:112
155
  #: admin/siteguard-menu-same-error.php:51
156
+ #: admin/siteguard-menu-updates-notify.php:79
157
+ #: admin/siteguard-menu-waf-tuning-support.php:231
158
  msgid "You can find docs about this function on "
159
  msgstr ""
160
 
161
+ #: admin/siteguard-menu-admin-filter.php:96
162
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/admin_filter/"
 
 
163
  msgstr ""
164
 
165
+ #: admin/siteguard-menu-admin-filter.php:98
166
+ #: admin/siteguard-menu-advanced-setting.php:58
167
+ #: admin/siteguard-menu-captcha.php:82 admin/siteguard-menu-fail-once.php:53
 
168
  #: admin/siteguard-menu-login-alert.php:61
169
+ #: admin/siteguard-menu-login-lock.php:82
170
+ #: admin/siteguard-menu-protect-xmlrpc.php:126
171
+ #: admin/siteguard-menu-rename-login.php:115
172
  #: admin/siteguard-menu-same-error.php:54
173
+ #: admin/siteguard-menu-updates-notify.php:82
174
+ #: admin/siteguard-menu-waf-tuning-support.php:234 siteguard.php:190
175
  msgid "here"
176
  msgstr ""
177
 
178
+ #: admin/siteguard-menu-admin-filter.php:100
179
+ #: admin/siteguard-menu-advanced-setting.php:60
180
+ #: admin/siteguard-menu-captcha.php:84 admin/siteguard-menu-dashboard.php:31
181
  #: admin/siteguard-menu-fail-once.php:55
182
  #: admin/siteguard-menu-login-alert.php:63
183
+ #: admin/siteguard-menu-login-history.php:20
184
+ #: admin/siteguard-menu-login-lock.php:84
185
+ #: admin/siteguard-menu-protect-xmlrpc.php:128
186
+ #: admin/siteguard-menu-rename-login.php:117
187
  #: admin/siteguard-menu-same-error.php:56
188
+ #: admin/siteguard-menu-updates-notify.php:84
189
+ #: admin/siteguard-menu-waf-tuning-support.php:236
190
  msgid "."
191
  msgstr ""
192
 
193
+ #: admin/siteguard-menu-admin-filter.php:110
194
+ #: admin/siteguard-menu-captcha.php:94 admin/siteguard-menu-fail-once.php:65
 
 
195
  #: admin/siteguard-menu-login-alert.php:73
196
+ #: admin/siteguard-menu-login-lock.php:94
197
+ #: admin/siteguard-menu-protect-xmlrpc.php:139
198
+ #: admin/siteguard-menu-rename-login.php:127
199
  #: admin/siteguard-menu-same-error.php:66
200
+ #: admin/siteguard-menu-updates-notify.php:94
201
+ #: admin/siteguard-menu-waf-tuning-support.php:246
202
  msgid "ON"
203
  msgstr ""
204
 
205
+ #: admin/siteguard-menu-admin-filter.php:114
206
+ #: admin/siteguard-menu-captcha.php:97 admin/siteguard-menu-fail-once.php:68
 
 
207
  #: admin/siteguard-menu-login-alert.php:76
208
+ #: admin/siteguard-menu-login-lock.php:97
209
+ #: admin/siteguard-menu-protect-xmlrpc.php:142
210
+ #: admin/siteguard-menu-rename-login.php:130
211
  #: admin/siteguard-menu-same-error.php:69
212
+ #: admin/siteguard-menu-updates-notify.php:97
213
+ #: admin/siteguard-menu-waf-tuning-support.php:249
214
  msgid "OFF"
215
  msgstr ""
216
 
217
+ #: admin/siteguard-menu-admin-filter.php:130
218
  msgid "Exclude Path"
219
  msgstr ""
220
 
221
+ #: admin/siteguard-menu-admin-filter.php:132
222
  msgid ""
223
  "The path of /wp-admin/ henceforth is specified. To specify more than one, "
224
  "separate them with new line. "
225
  msgstr ""
226
 
227
+ #: admin/siteguard-menu-admin-filter.php:137
228
  msgid ""
229
  "It is the function for the protection against the attack to the management "
230
  "page (under /wp-admin/.) To the access from the connection source IP address "
235
  "where this function is excluded can be specified."
236
  msgstr ""
237
 
238
+ #: admin/siteguard-menu-advanced-setting.php:53
239
+ #: admin/siteguard-menu-dashboard.php:93 admin/siteguard-menu-init.php:58
240
+ #: admin/siteguard-menu-init.php:59
241
+ msgid "Advanced Setting"
242
  msgstr ""
243
 
244
+ #: admin/siteguard-menu-advanced-setting.php:56
245
  msgid ""
246
+ "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/advanced_setting/"
247
  msgstr ""
248
 
249
+ #: admin/siteguard-menu-advanced-setting.php:66
250
+ msgid "IP Address Mode"
251
+ msgstr ""
252
+
253
+ #: admin/siteguard-menu-advanced-setting.php:69
254
+ msgid "REMOTE_ADDR"
255
+ msgstr ""
256
+
257
+ #: admin/siteguard-menu-advanced-setting.php:72
258
+ msgid "X-Forwarded-For Level:1"
259
+ msgstr ""
260
+
261
+ #: admin/siteguard-menu-advanced-setting.php:75
262
+ msgid "X-Forwarded-For Level:2"
263
+ msgstr ""
264
+
265
+ #: admin/siteguard-menu-advanced-setting.php:78
266
+ msgid "X-Forwarded-For Level:3"
267
+ msgstr ""
268
+
269
+ #: admin/siteguard-menu-advanced-setting.php:83
270
+ msgid ""
271
+ "Set the method for acquiring the IP address. Normally you should select a "
272
+ "remote address. If there is a proxy or load balancer in front of the web "
273
+ "server and you can not obtain the client's IP address with remote address, "
274
+ "you can obtain the IP address from X-Forwarded-For. Level represents the "
275
+ "number from the right end of the value of X-Forwarded-For."
276
+ msgstr ""
277
+
278
+ #: admin/siteguard-menu-captcha.php:77 admin/siteguard-menu-dashboard.php:54
279
+ #: admin/siteguard-menu-init.php:26 admin/siteguard-menu-init.php:27
280
+ msgid "CAPTCHA"
281
+ msgstr ""
282
+
283
+ #: admin/siteguard-menu-captcha.php:80
284
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/captcha/"
285
+ msgstr ""
286
+
287
+ #: admin/siteguard-menu-captcha.php:110
288
  msgid "Login page"
289
  msgstr ""
290
 
291
+ #: admin/siteguard-menu-captcha.php:113 admin/siteguard-menu-captcha.php:125
292
+ #: admin/siteguard-menu-captcha.php:137 admin/siteguard-menu-captcha.php:149
293
  msgid "Hiragana (Japanese)"
294
  msgstr ""
295
 
296
+ #: admin/siteguard-menu-captcha.php:116 admin/siteguard-menu-captcha.php:128
297
+ #: admin/siteguard-menu-captcha.php:140 admin/siteguard-menu-captcha.php:152
298
  msgid "Alphanumeric"
299
  msgstr ""
300
 
301
+ #: admin/siteguard-menu-captcha.php:119 admin/siteguard-menu-captcha.php:131
302
+ #: admin/siteguard-menu-captcha.php:143 admin/siteguard-menu-captcha.php:155
303
+ #: admin/siteguard-menu-updates-notify.php:113
304
+ #: admin/siteguard-menu-updates-notify.php:122
305
+ #: admin/siteguard-menu-updates-notify.php:134
306
  msgid "Disable"
307
  msgstr ""
308
 
309
+ #: admin/siteguard-menu-captcha.php:122
310
  msgid "Comment page"
311
  msgstr ""
312
 
313
+ #: admin/siteguard-menu-captcha.php:134
314
  msgid "Lost password page"
315
  msgstr ""
316
 
317
+ #: admin/siteguard-menu-captcha.php:146
318
  msgid "Registration user page"
319
  msgstr ""
320
 
321
+ #: admin/siteguard-menu-captcha.php:160
322
  msgid ""
323
  "It is the function to decrease the vulnerability against an illegal login "
324
  "attempt attack such as a brute force attack or a password list attack, or to "
326
  "alphanumeric characters can be selected."
327
  msgstr ""
328
 
329
+ #: admin/siteguard-menu-dashboard.php:28 admin/siteguard-menu-init.php:14
330
+ #: admin/siteguard-menu-init.php:15
331
  msgid "Dashboard"
332
  msgstr ""
333
 
334
+ #: admin/siteguard-menu-dashboard.php:30
335
  msgid ""
336
  "You can find docs, FAQ and more detailed information about SiteGuard WP "
337
  "Plugin on "
338
  msgstr ""
339
 
340
+ #: admin/siteguard-menu-dashboard.php:31
341
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/"
 
 
 
342
  msgstr ""
343
 
344
+ #: admin/siteguard-menu-dashboard.php:31
345
+ #: admin/siteguard-menu-login-history.php:20
346
  msgid "SiteGuard WP Plugin Page"
347
  msgstr ""
348
 
349
+ #: admin/siteguard-menu-dashboard.php:32
350
  msgid "Setting status"
351
  msgstr ""
352
 
353
+ #: admin/siteguard-menu-dashboard.php:45
354
  msgid ""
355
  "The management directory (/wp-admin/) is protected against the connection "
356
  "source which does not login."
357
  msgstr ""
358
 
359
+ #: admin/siteguard-menu-dashboard.php:49 admin/siteguard-menu-init.php:22
360
+ #: admin/siteguard-menu-init.php:23 admin/siteguard-menu-rename-login.php:110
361
  msgid "Rename Login"
362
  msgstr ""
363
 
364
+ #: admin/siteguard-menu-dashboard.php:50
365
  msgid "The login page name is changed."
366
  msgstr ""
367
 
368
+ #: admin/siteguard-menu-dashboard.php:55
369
  msgid "CAPTCHA is added to the login page or comment post."
370
  msgstr ""
371
 
372
+ #: admin/siteguard-menu-dashboard.php:59 admin/siteguard-menu-init.php:30
373
+ #: admin/siteguard-menu-init.php:31 admin/siteguard-menu-same-error.php:49
374
  msgid "Same Login Error Message"
375
  msgstr ""
376
 
377
+ #: admin/siteguard-menu-dashboard.php:60
378
  msgid ""
379
  "Instead of the detailed error message at the login error, the single message "
380
  "is returned."
381
  msgstr ""
382
 
383
+ #: admin/siteguard-menu-dashboard.php:64 admin/siteguard-menu-init.php:34
384
+ #: admin/siteguard-menu-init.php:35 admin/siteguard-menu-login-lock.php:77
385
  msgid "Login Lock"
386
  msgstr ""
387
 
388
+ #: admin/siteguard-menu-dashboard.php:65
389
  msgid ""
390
  "The connection source which repeats login failure is being locked within a "
391
  "certain period."
392
  msgstr ""
393
 
394
+ #: admin/siteguard-menu-dashboard.php:69 admin/siteguard-menu-init.php:38
395
+ #: admin/siteguard-menu-init.php:39 admin/siteguard-menu-login-alert.php:56
396
  msgid "Login Alert"
397
  msgstr ""
398
 
399
+ #: admin/siteguard-menu-dashboard.php:70
400
  msgid "E-mail notifies that there was login."
401
  msgstr ""
402
 
403
+ #: admin/siteguard-menu-dashboard.php:75
 
 
 
 
 
404
  msgid "The first login must fail even if the input is correct."
405
  msgstr ""
406
 
407
+ #: admin/siteguard-menu-dashboard.php:79 admin/siteguard-menu-init.php:46
408
+ #: admin/siteguard-menu-init.php:47
409
+ #: admin/siteguard-menu-protect-xmlrpc.php:121
410
+ msgid "Protect XMLRPC"
411
  msgstr ""
412
 
413
+ #: admin/siteguard-menu-dashboard.php:80
414
+ msgid "The abuse of XMLRPC is prevented."
415
  msgstr ""
416
 
417
+ #: admin/siteguard-menu-dashboard.php:84 admin/siteguard-menu-init.php:50
418
+ #: admin/siteguard-menu-init.php:51 admin/siteguard-menu-updates-notify.php:77
419
  msgid "Updates Notify"
420
  msgstr ""
421
 
422
+ #: admin/siteguard-menu-dashboard.php:85
423
  msgid ""
424
  "If WordPress core, plugins, and themes updates are needed , sends email to "
425
  "notify administrators."
426
  msgstr ""
427
 
428
+ #: admin/siteguard-menu-dashboard.php:89 admin/siteguard-menu-init.php:54
429
+ #: admin/siteguard-menu-init.php:55
430
+ #: admin/siteguard-menu-waf-tuning-support.php:229
431
  msgid "WAF Tuning Support"
432
  msgstr ""
433
 
434
+ #: admin/siteguard-menu-dashboard.php:90
435
  msgid "The exclude rule for WAF (SiteGuard Lite) is created."
436
  msgstr ""
437
 
438
+ #: admin/siteguard-menu-dashboard.php:94
439
+ msgid "Set the method for acquiring the IP address."
440
  msgstr ""
441
 
442
+ #: admin/siteguard-menu-dashboard.php:97 admin/siteguard-menu-init.php:62
443
+ #: admin/siteguard-menu-init.php:63 admin/siteguard-menu-login-history.php:17
444
+ msgid "Login history"
445
  msgstr ""
446
 
447
+ #: admin/siteguard-menu-dashboard.php:98
448
+ msgid "Login history can be referenced."
449
  msgstr ""
450
 
451
  #: admin/siteguard-menu-fail-once.php:51
452
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/fail_once/"
 
453
  msgstr ""
454
 
455
+ #: admin/siteguard-menu-fail-once.php:82
456
  msgid "Target user"
457
  msgstr ""
458
 
459
+ #: admin/siteguard-menu-fail-once.php:85
460
+ #: admin/siteguard-menu-login-alert.php:102
461
  msgid "Admin only"
462
  msgstr ""
463
 
464
+ #: admin/siteguard-menu-fail-once.php:91
465
  msgid ""
466
  "It is the function to decrease the vulnerability against a password list "
467
  "attack. Even is the login input is correct, the first login must fail. After "
470
  "displayed."
471
  msgstr ""
472
 
473
+ #: admin/siteguard-menu-init.php:11
474
  msgid "SiteGuard"
475
  msgstr ""
476
 
477
  #: admin/siteguard-menu-login-alert.php:59
478
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_alert/"
 
 
479
  msgstr ""
480
 
481
+ #: admin/siteguard-menu-login-alert.php:89
482
  msgid "Subject"
483
  msgstr ""
484
 
485
+ #: admin/siteguard-menu-login-alert.php:94
486
  msgid "Body"
487
  msgstr ""
488
 
489
+ #: admin/siteguard-menu-login-alert.php:99
490
  msgid "Recipients"
491
  msgstr ""
492
 
493
+ #: admin/siteguard-menu-login-alert.php:108
494
  msgid ""
495
  "It is the function to make it easier to notice unauthorized login. E-mail "
496
  "will be sent to a login user when logged in. If you receive an e-mail to "
501
  "notified."
502
  msgstr ""
503
 
504
+ #: admin/siteguard-menu-login-history.php:20
505
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_history/"
506
+ msgstr ""
507
+
508
+ #: admin/siteguard-menu-login-history.php:31
509
  msgid ""
510
+ "Login history can be referenced. Let's see if there are any suspicious "
511
+ "history. History, registered 10,000 maximum, will be removed from those old "
512
+ "and more than 10,000."
513
  msgstr ""
514
 
515
+ #: admin/siteguard-menu-login-lock.php:80
516
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_lock/"
517
+ msgstr ""
518
+
519
+ #: admin/siteguard-menu-login-lock.php:110
520
  msgid "Interval"
521
  msgstr ""
522
 
523
+ #: admin/siteguard-menu-login-lock.php:113
524
  msgid "1 second"
525
  msgstr ""
526
 
527
+ #: admin/siteguard-menu-login-lock.php:116
528
  msgid "5 seconds"
529
  msgstr ""
530
 
531
+ #: admin/siteguard-menu-login-lock.php:119
532
+ #: admin/siteguard-menu-login-lock.php:137
533
  msgid "30 seconds"
534
  msgstr ""
535
 
536
+ #: admin/siteguard-menu-login-lock.php:122
537
  msgid "Threshold"
538
  msgstr ""
539
 
540
+ #: admin/siteguard-menu-login-lock.php:125
541
  msgid "3 times"
542
  msgstr ""
543
 
544
+ #: admin/siteguard-menu-login-lock.php:128
545
  msgid "10 times"
546
  msgstr ""
547
 
548
+ #: admin/siteguard-menu-login-lock.php:131
549
  msgid "100 times"
550
  msgstr ""
551
 
552
+ #: admin/siteguard-menu-login-lock.php:134
553
  msgid "Lock Time"
554
  msgstr ""
555
 
556
+ #: admin/siteguard-menu-login-lock.php:140
557
  msgid "1 minute"
558
  msgstr ""
559
 
560
+ #: admin/siteguard-menu-login-lock.php:143
561
  msgid "5 minutes"
562
  msgstr ""
563
 
564
+ #: admin/siteguard-menu-login-lock.php:148
565
  msgid ""
566
  "It is the function to decrease the vulnerability against an illegal login "
567
  "attempt attack such as a brute force attack or a password list attack. "
571
  "specified time. Each user account is not locked."
572
  msgstr ""
573
 
574
+ #: admin/siteguard-menu-protect-xmlrpc.php:124
575
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/xmlrpc/"
576
+ msgstr ""
577
+
578
+ #: admin/siteguard-menu-protect-xmlrpc.php:158
579
+ msgid "Disable Pingback"
580
+ msgstr ""
581
+
582
+ #: admin/siteguard-menu-protect-xmlrpc.php:161
583
+ msgid "Disable XMLRPC"
584
+ msgstr ""
585
+
586
+ #: admin/siteguard-menu-protect-xmlrpc.php:167
587
+ msgid ""
588
+ "To disable the Pingback, or disable the entire XMLRPC ( xmlrpc.php ), to "
589
+ "prevent abuse. When you disable the whole XMLRPC, you will not be able to "
590
+ "use plug-ins and apps that use XMLRPC. If there is trouble, please do not "
591
+ "use this function."
592
+ msgstr ""
593
+
594
  #: admin/siteguard-menu-rename-login.php:44
595
  msgid "This function and Plugin \""
596
  msgstr ""
609
  msgid " can not be used for New Login Path."
610
  msgstr ""
611
 
612
+ #: admin/siteguard-menu-rename-login.php:113
613
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/rename_login/"
 
 
614
  msgstr ""
615
 
616
+ #: admin/siteguard-menu-rename-login.php:146
617
  msgid "New Login Path"
618
  msgstr ""
619
 
620
+ #: admin/siteguard-menu-rename-login.php:151
621
  msgid "An alphanumeric character, a hyphen, and an underbar can be used."
622
  msgstr ""
623
 
624
+ #: admin/siteguard-menu-rename-login.php:159
625
  msgid ""
626
  "It is the function to decrease the vulnerability against an illegal login "
627
  "attempt attack such as a brute force attack or a password list attack. The "
630
  msgstr ""
631
 
632
  #: admin/siteguard-menu-same-error.php:52
633
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/same_error/"
 
634
  msgstr ""
635
 
636
+ #: admin/siteguard-menu-same-error.php:85
637
  msgid ""
638
  "It is the function to decrease the vulnerability against the attack to "
639
  "examine if a user name exists. All error messages about the login should be "
641
  "username, password, or CAPTCHA is wrong."
642
  msgstr ""
643
 
644
+ #: admin/siteguard-menu-updates-notify.php:80
645
+ msgid "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/updates_notify/"
 
 
646
  msgstr ""
647
 
648
+ #: admin/siteguard-menu-updates-notify.php:110
649
  msgid "WordPress updates"
650
  msgstr ""
651
 
652
+ #: admin/siteguard-menu-updates-notify.php:116
653
  msgid "Enable"
654
  msgstr ""
655
 
656
+ #: admin/siteguard-menu-updates-notify.php:119
657
  msgid "Plugins updates"
658
  msgstr ""
659
 
660
+ #: admin/siteguard-menu-updates-notify.php:125
661
  msgid "All plugins"
662
  msgstr ""
663
 
664
+ #: admin/siteguard-menu-updates-notify.php:128
665
  msgid "Active plugins only"
666
  msgstr ""
667
 
668
+ #: admin/siteguard-menu-updates-notify.php:131
669
  msgid "Themes updates"
670
  msgstr ""
671
 
672
+ #: admin/siteguard-menu-updates-notify.php:137
673
  msgid "All themes"
674
  msgstr ""
675
 
676
+ #: admin/siteguard-menu-updates-notify.php:140
677
  msgid "Active themes only"
678
  msgstr ""
679
 
680
+ #: admin/siteguard-menu-updates-notify.php:145
681
  msgid ""
682
  "Basic of security is that always you use the latest version. If WordPress "
683
  "core, plugins, and themes updates are needed , sends email to notify "
684
  "administrators. Check for updates will be run every 24 hours."
685
  msgstr ""
686
 
687
+ #: admin/siteguard-menu-waf-tuning-support.php:95
688
  msgid "New rule created"
689
  msgstr ""
690
 
691
+ #: admin/siteguard-menu-waf-tuning-support.php:120
692
  msgid "Rule updated"
693
  msgstr ""
694
 
695
+ #: admin/siteguard-menu-waf-tuning-support.php:141
696
  msgid "Rule deleted"
697
  msgstr ""
698
 
699
+ #: admin/siteguard-menu-waf-tuning-support.php:162
700
  msgid ""
701
  "To use the WAF exclude rule, WAF ( SiteGuard Lite ) should be installed on "
702
  "Apache."
703
  msgstr ""
704
 
705
+ #: admin/siteguard-menu-waf-tuning-support.php:184
706
  msgid "Rules applied"
707
  msgstr ""
708
 
709
+ #: admin/siteguard-menu-waf-tuning-support.php:189
710
  msgid "Rules unapplied"
711
  msgstr ""
712
 
713
+ #: admin/siteguard-menu-waf-tuning-support.php:229
714
  msgid "Add New"
715
  msgstr ""
716
 
717
+ #: admin/siteguard-menu-waf-tuning-support.php:232
718
  msgid ""
719
+ "https://www.jp-secure.com/siteguard_wp_plugin_en/howto/waf_tuning_support/"
 
720
  msgstr ""
721
 
722
+ #: admin/siteguard-menu-waf-tuning-support.php:260
723
  msgid ""
724
  "To use the WAF Tuning Support, WAF ( SiteGuard Lite ) should be installed on "
725
  "Apache."
726
  msgstr ""
727
 
728
+ #: admin/siteguard-menu-waf-tuning-support.php:269
729
  msgid ""
730
  "It is the function to create the rule to avoid the false detection in "
731
  "WordPress (including 403 error occurrence with normal access,) if WAF "
737
  "activated while the false detection for the specified function is prevented."
738
  msgstr ""
739
 
740
+ #: admin/siteguard-menu-waf-tuning-support.php:276
741
  msgid "Apply rules"
742
  msgstr ""
743
 
744
+ #: admin/siteguard-menu-waf-tuning-support.php:284
745
  msgid "WAF Exclude Rule Add"
746
  msgstr ""
747
 
748
+ #: admin/siteguard-menu-waf-tuning-support.php:286
749
  msgid "WAF Exclude Rule Edit"
750
  msgstr ""
751
 
752
+ #: admin/siteguard-menu-waf-tuning-support.php:292
753
+ #: admin/siteguard-menu-waf-tuning-support.php:337
754
  #: admin/siteguard-waf-exclude-rule-table.php:59
755
  msgid "Signature"
756
  msgstr ""
757
 
758
+ #: admin/siteguard-menu-waf-tuning-support.php:295
759
  msgid ""
760
  "The detected signature name or signature ID is specified. To specify more "
761
  "than one, separate them with new line."
762
  msgstr ""
763
 
764
+ #: admin/siteguard-menu-waf-tuning-support.php:299
765
  msgid "Filename (optional)"
766
  msgstr ""
767
 
768
+ #: admin/siteguard-menu-waf-tuning-support.php:302
769
  msgid ""
770
  "The target file name is specified. URL ( the part before ? ) can also be "
771
  "pasted."
772
  msgstr ""
773
 
774
+ #: admin/siteguard-menu-waf-tuning-support.php:306
775
  msgid "Comment (optional)"
776
  msgstr ""
777
 
778
+ #: admin/siteguard-menu-waf-tuning-support.php:318
779
  msgid "Save"
780
  msgstr ""
781
 
782
+ #: admin/siteguard-menu-waf-tuning-support.php:328
783
  msgid "WAF Exclude Rule Delete"
784
  msgstr ""
785
 
786
+ #: admin/siteguard-menu-waf-tuning-support.php:332
787
  msgid "You have specified this rule for deletion:"
788
  msgid_plural "You have specified these rules for deletion:"
789
  msgstr[0] ""
790
  msgstr[1] ""
791
 
792
+ #: admin/siteguard-menu-waf-tuning-support.php:337
793
  #: admin/siteguard-waf-exclude-rule-table.php:60
794
  msgid "Filename"
795
  msgstr ""
796
 
797
+ #: admin/siteguard-menu-waf-tuning-support.php:337
798
  #: admin/siteguard-waf-exclude-rule-table.php:61
799
  msgid "Comment"
800
  msgstr ""
801
 
802
+ #: admin/siteguard-menu-waf-tuning-support.php:343
803
  msgid "Confirm Deletion"
804
  msgstr ""
805
 
806
+ #: admin/siteguard-menu-waf-tuning-support.php:345
807
  msgid "There are no rules selected for deletion."
808
  msgstr ""
809
 
820
  msgid "It does not support the multisite function of WordPress."
821
  msgstr ""
822
 
823
+ #: classes/siteguard-captcha.php:90
824
  msgid ""
825
  "In order to enable this function, it is necessary to install expanded modules"
826
  msgstr ""
827
 
828
+ #: classes/siteguard-captcha.php:94
829
  msgid "in the server."
830
  msgstr ""
831
 
832
+ #: classes/siteguard-captcha.php:107
833
+ msgid "The image file write failed."
 
 
834
  msgstr ""
835
 
836
+ #: classes/siteguard-captcha.php:117
837
+ msgid "The image file access failed."
838
  msgstr ""
839
 
840
+ #: classes/siteguard-captcha.php:130
841
+ msgid ""
842
+ "In order to enable this function, php must be compiled with FreeType support "
843
+ "enabled."
844
  msgstr ""
845
 
846
+ #: classes/siteguard-captcha.php:135 classes/siteguard-login-lock.php:101
847
+ msgid "ERROR: LOGIN LOCKED"
848
+ msgstr ""
849
+
850
+ #: classes/siteguard-captcha.php:136
851
  msgid "ERROR: Please check the input and resend."
852
  msgstr ""
853
 
854
+ #: classes/siteguard-captcha.php:175
855
  msgid "Please input characters displayed above."
856
  msgstr ""
857
 
858
+ #: classes/siteguard-captcha.php:219 classes/siteguard-captcha.php:223
859
+ #: classes/siteguard-captcha.php:240 classes/siteguard-captcha.php:254
860
  msgid "ERROR: Invalid CAPTCHA."
861
  msgstr ""
862
 
877
  "SiteGuard WP Plugin"
878
  msgstr ""
879
 
880
+ #: classes/siteguard-login-history.php:136
881
+ #: classes/siteguard-login-history.php:150
882
+ msgid "Unknown"
 
 
 
 
 
 
 
883
  msgstr ""
884
 
885
+ #: classes/siteguard-login-lock.php:137
886
+ msgid "ERROR: Please login entry again"
887
  msgstr ""
888
 
889
+ #: classes/siteguard-rename-login.php:162
890
  msgid "WordPress: Login page URL was changed"
891
  msgstr ""
892
 
893
+ #: classes/siteguard-rename-login.php:163
894
  msgid ""
895
  "Please bookmark following of the new login URL.\n"
896
  "\n"
910
  "access control."
911
  msgstr ""
912
 
913
+ #: classes/siteguard-updates-notify.php:95
914
  msgid "There are updates available for your WordPress site:"
915
  msgstr ""
916
 
917
+ #: classes/siteguard-updates-notify.php:96
918
  msgid "Please visit %s to update."
919
  msgstr ""
920
 
921
+ #: classes/siteguard-updates-notify.php:113
922
  msgid "WP-Core: WordPress is out of date. Please update from version %s to %s"
923
  msgstr ""
924
 
925
+ #: classes/siteguard-updates-notify.php:147
926
  msgid "Plugin: %s is out of date. Please update from version %s to %s"
927
  msgstr ""
928
 
929
+ #: classes/siteguard-updates-notify.php:148
930
  msgid "Details: %s"
931
  msgstr ""
932
 
933
+ #: classes/siteguard-updates-notify.php:149
934
  msgid "Changelog: %s%s"
935
  msgstr ""
936
 
937
+ #: classes/siteguard-updates-notify.php:151
938
  msgid "Compatibility with WordPress %1$s: 100%% (according to its author)"
939
  msgstr ""
940
 
941
+ #: classes/siteguard-updates-notify.php:154
942
  msgid ""
943
  "Compatibility with WordPress %1$s: %2$d%% (%3$d \"works\" votes out of %4$d "
944
  "total)"
945
  msgstr ""
946
 
947
+ #: classes/siteguard-updates-notify.php:156
948
  msgid "Compatibility with WordPress %1$s: Unknown"
949
  msgstr ""
950
 
951
+ #: classes/siteguard-updates-notify.php:158
952
  msgid "Compatibility: %s"
953
  msgstr ""
954
 
955
+ #: classes/siteguard-updates-notify.php:190
956
  msgid "Theme: %s is out of date. Please update from version %s to %s"
957
  msgstr ""
958
 
959
+ #: classes/siteguard-updates-notify.php:239
960
  msgid "WordPress: Updates Available @ %s"
961
  msgstr ""
962
 
963
+ #: classes/siteguard-waf-exclude-rule.php:55
964
  msgid "ERROR: Signature is required"
965
  msgstr ""
966
 
967
+ #: classes/siteguard-waf-exclude-rule.php:64
968
  msgid "ERROR: Syntax Error in Signature"
969
  msgstr ""
970
 
971
+ #: siteguard.php:185
972
  msgid "Login page URL was changed."
973
  msgstr ""
974
 
975
+ #: siteguard.php:187
976
  msgid " Please bookmark "
977
  msgstr ""
978
 
979
+ #: siteguard.php:188
980
  msgid "new login URL"
981
  msgstr ""
982
 
983
+ #: siteguard.php:189
984
  msgid ". Setting change is "
985
  msgstr ""
986
 
988
  msgid "SiteGuard WP Plugin"
989
  msgstr ""
990
 
991
+ #. Plugin URI of the plugin/theme
992
+ msgid ""
993
+ "http://www.jp-secure.com/cont/products/siteguard_wp_plugin/index_en.html"
994
+ msgstr ""
995
+
996
  #. Description of the plugin/theme
997
  msgid ""
998
  "Only installing SiteGuard WP Plugin on WordPress, its security can be "
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: jp-secure
3
  Donate link: -
4
  Tags: security, waf, brute force, password list, login lock, login alert, captcha, pingback, fail once
5
  Requires at least: 3.9
6
- Tested up to: 4.3
7
- Stable tag: 1.2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,9 +12,9 @@ SiteGurad WP Plugin is the plugin specialized for the protection against the att
12
 
13
  == Description ==
14
 
15
- You can find docs, FAQ and more detailed information on [English Page](http://www.jp-secure.com/cont/products/siteguard_wp_plugin/index_en.html) [Japanese Page](http://www.jp-secure.com/cont/products/siteguard_wp_plugin/index.html).
16
 
17
- Simply install the SiteGuard WP Plugin, WordPress security is improved.
18
  This plugin is a security plugin that specializes in the login attack of brute force, such as protection and management capabilities.
19
 
20
  Notes
@@ -23,9 +23,9 @@ Notes
23
  * It only supports Apache 1.3, 2.x for Web servers.
24
  * To use the CAPTCHA function, the expansion library “mbstring” and “gd” should be installed on php.
25
  * To use the management page filter function and login page change function, “mod_rewrite” should be loaded on Apache.
26
- * To use the WAF Tuning Support, WAF ( SiteGuard Lite ) should be installed on Apache.
27
 
28
- There are the following functions.
29
 
30
  * Admin Page IP Filter
31
 
@@ -40,7 +40,7 @@ The URL (under wp-admin) where this function is excluded can be specified.
40
  It is the function to decrease the vulnerability against an illegal login attempt attack such as a brute force attack or a password list attack.
41
  The login page name (wp-login.php) is changed. The initial value is “login_<5 random digits>” but it can be changed to a favorite name.
42
 
43
- * CAPTCHA
44
 
45
  It is the function to decrease the vulnerability against an illegal login attempt attack such as a brute force attack or a password list attack,
46
  or to receive less comment spam. For the character of CAPTCHA, hiragana and alphanumeric characters can be selected.
@@ -55,12 +55,12 @@ Each user account is not locked.
55
  * Login Alert
56
 
57
  It is the function to make it easier to notice unauthorized login. E-mail will be sent to a login user when logged in.
58
- If you receive an e-mail to there is no logged-in idea, please suspect unauthorized login.
59
 
60
  * Fail Once
61
 
62
  It is the function to decrease the vulnerability against a password list attack. Even is the login input is correct, the first login must fail.
63
- After 5 seconds and later within 60 seconds, another correct login input make login succeed. At the first login failure, the following error message is displayed.
64
 
65
  * Disable Pingback
66
 
@@ -75,7 +75,7 @@ Basic of security is that always you use the latest version. If WordPress core,
75
  It is the function to create the rule to avoid the false detection in WordPress (including 403 error occurrence with normal access,)
76
  if WAF ( SiteGuard Lite ) by JP-Secure is installed on a Web server. WAF prevents the attack from the outside against the Web server,
77
  but for some WordPress or plugin functions, WAF may detect the attack which is actually not attack and block the function.
78
- By creating the WAF exclude rule, the WAF protection function can be activated while the false detection for the specified function is prevented.
79
 
80
  = Translate =
81
 
@@ -98,10 +98,42 @@ If you have created your own language pack, or have an update of an existing one
98
 
99
  == Frequently Asked Questions ==
100
 
101
- [English Page](http://www.jp-secure.com/cont/products/siteguard_wp_plugin/faq_en.html)
102
- [Japanese Page](http://www.jp-secure.com/cont/products/siteguard_wp_plugin/faq.html)
103
 
104
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  = 1.2.3 =
106
  * Fix bug that you can not reply comments from the dashboard, if the CAPTCHA is enabled
107
  * Fix bug that the login page is displayed in '/wp-login' even if the Rename Login is enabled
@@ -117,7 +149,7 @@ If you have created your own language pack, or have an update of an existing one
117
  * Fix bug that sometimes can't login when you enable the Fail once
118
  = 1.1.2 =
119
  * Supported with WP 4.1
120
- * Disabling the Admin IP Filter function by default
121
  = 1.1.1 =
122
  * Fix bug that can not save "Login Alert" settings
123
  * Add the "Login Alert" notification variables, IP Address, User-Agent and Referer
3
  Donate link: -
4
  Tags: security, waf, brute force, password list, login lock, login alert, captcha, pingback, fail once
5
  Requires at least: 3.9
6
+ Tested up to: 4.9
7
+ Stable tag: 1.4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ You can find docs, FAQ and more detailed information on [English Page](https://www.jp-secure.com/siteguard_wp_plugin_en/) [Japanese Page](https://www.jp-secure.com/siteguard_wp_plugin/).
16
 
17
+ Simply install the SiteGuard WP Plugin, WordPress security is improved.
18
  This plugin is a security plugin that specializes in the login attack of brute force, such as protection and management capabilities.
19
 
20
  Notes
23
  * It only supports Apache 1.3, 2.x for Web servers.
24
  * To use the CAPTCHA function, the expansion library “mbstring” and “gd” should be installed on php.
25
  * To use the management page filter function and login page change function, “mod_rewrite” should be loaded on Apache.
26
+ * To use the WAF Tuning Support, WAF ( SiteGuard Lite ) should be installed on Apache.
27
 
28
+ There are the following functions.
29
 
30
  * Admin Page IP Filter
31
 
40
  It is the function to decrease the vulnerability against an illegal login attempt attack such as a brute force attack or a password list attack.
41
  The login page name (wp-login.php) is changed. The initial value is “login_<5 random digits>” but it can be changed to a favorite name.
42
 
43
+ * CAPTCHA
44
 
45
  It is the function to decrease the vulnerability against an illegal login attempt attack such as a brute force attack or a password list attack,
46
  or to receive less comment spam. For the character of CAPTCHA, hiragana and alphanumeric characters can be selected.
55
  * Login Alert
56
 
57
  It is the function to make it easier to notice unauthorized login. E-mail will be sent to a login user when logged in.
58
+ If you receive an e-mail to there is no logged-in idea, please suspect unauthorized login.
59
 
60
  * Fail Once
61
 
62
  It is the function to decrease the vulnerability against a password list attack. Even is the login input is correct, the first login must fail.
63
+ After 5 seconds and later within 60 seconds, another correct login input make login succeed. At the first login failure, the following error message is displayed.
64
 
65
  * Disable Pingback
66
 
75
  It is the function to create the rule to avoid the false detection in WordPress (including 403 error occurrence with normal access,)
76
  if WAF ( SiteGuard Lite ) by JP-Secure is installed on a Web server. WAF prevents the attack from the outside against the Web server,
77
  but for some WordPress or plugin functions, WAF may detect the attack which is actually not attack and block the function.
78
+ By creating the WAF exclude rule, the WAF protection function can be activated while the false detection for the specified function is prevented.
79
 
80
  = Translate =
81
 
98
 
99
  == Frequently Asked Questions ==
100
 
101
+ [English Page](https://www.jp-secure.com/siteguard_wp_plugin_en/faq/)
102
+ [Japanese Page](https://www.jp-secure.com/siteguard_wp_plugin/faq/)
103
 
104
  == Changelog ==
105
+ = 1.4.3 =
106
+ * * Fix bug in 1.4.2 "Notice:Use of undefined constant HTTPS"
107
+ = 1.4.2 =
108
+ * * In the Rename Login function, correct the problem that is redirected to the https renamed login page from the http /wp-login.php
109
+ = 1.4.1 =
110
+ * Fix bug that some functions are disabled
111
+ = 1.4.0 =
112
+ * Enabled to get client IP address from X-Forwarded-For header
113
+ * Strict operation check of each function
114
+ * Change not to use session
115
+ = 1.3.4 =
116
+ * Fix an issue where CAPTCHA might fail in 1.3.3
117
+ = 1.3.3 =
118
+ * Fix bug that fatal error occurs when fails to send mail
119
+ * Inprove the security of the CAPTCHA function
120
+ * Disabling the Rename Login function when qTranslate X plugin is enabled in order to avoid conflicts
121
+ = 1.3.2 =
122
+ * Fix bug that fatal error occurs when fails to send mail
123
+ = 1.3.1 =
124
+ * Fix conflicts with other plugins in a session related
125
+ = 1.3.0 =
126
+ * Add the "Disable XMLRPC" feature
127
+ * In the Login History, add display the login type that indicates whether via login page or xmlrpc
128
+ * Fix that the Fail Once error message to be not the same as the failure
129
+ * Fix that the permission of .htaccess to change from 0644 to 0604
130
+ * Delete the mistaken characters of CAPTCHA
131
+ = 1.2.5 =
132
+ * In the Admin Page IP Filter function, fix bug that can be accessed from the IP address that failed to login to the management page
133
+ * In the Rename Login function, correct the problem that is redirected to the renamed login page from the /wp-signup.php
134
+ = 1.2.4 =
135
+ * Fix bug that there is a case which can acccess management pages from non login client
136
+ * Disabling the several functions when there is no .htaccess write permission
137
  = 1.2.3 =
138
  * Fix bug that you can not reply comments from the dashboard, if the CAPTCHA is enabled
139
  * Fix bug that the login page is displayed in '/wp-login' even if the Rename Login is enabled
149
  * Fix bug that sometimes can't login when you enable the Fail once
150
  = 1.1.2 =
151
  * Supported with WP 4.1
152
+ * Disabling the Admin IP Filter function by default
153
  = 1.1.1 =
154
  * Fix bug that can not save "Login Alert" settings
155
  * Add the "Login Alert" notification variables, IP Address, User-Agent and Referer
really-simple-captcha/siteguard-really-simple-captcha.php CHANGED
@@ -31,45 +31,47 @@ Base-Author URI: http://ideasilo.wordpress.com/
31
  */
32
 
33
  class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
 
 
34
 
35
- public function __construct() {
 
36
 
37
- /* Mode of character set alphabet(en) or hiragana(jp) */
38
- $this->lang_mode = 'jp';
39
 
40
- /* Length of a word in an image */
41
- $this->char_length = 4;
42
 
43
- /* Directory temporary keeping CAPTCHA images and corresponding text files */
44
- $this->tmp_dir = path_join( dirname( __FILE__ ), 'tmp' );
45
 
46
- /* Array of CAPTCHA image size. Width and height */
47
- $this->img_size = array( 72, 24 );
48
 
49
- /* Background color of CAPTCHA image. RGB color 0-255 */
50
- $this->bg = array( 255, 255, 255 );
51
 
52
- /* Foreground (character) color of CAPTCHA image. RGB color 0-255 */
53
- $this->fg = array( 0, 0, 0 );
54
 
55
- /* Coordinates for a text in an image. I don't know the meaning. Just adjust. */
56
- $this->base = array( 6, 18 );
57
 
58
- /* Font size */
59
- $this->font_size = 14;
60
 
61
- /* Width of a character */
 
 
 
 
 
 
62
  $this->font_char_width = 15;
63
-
64
- /* Image type. 'png', 'gif' or 'jpeg' */
65
  $this->img_type = 'png';
66
-
67
- /* Mode of temporary image files */
68
  $this->file_mode = 0444;
69
-
70
- /* Mode of temporary answer text files */
71
  $this->answer_file_mode = 0440;
72
-
73
  }
74
 
75
  /**
@@ -81,7 +83,7 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
81
 
82
  /* Characters available in images */
83
  $chars_en = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
84
- $chars_jp = 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよん';
85
 
86
  $word = '';
87
 
@@ -91,8 +93,9 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
91
  $this->chars = $chars_en;
92
  }
93
 
 
94
  for ( $i = 0; $i < $this->char_length; $i++ ) {
95
- $pos = mt_rand( 0, mb_strlen( $this->chars ) - 1 );
96
  $char = mb_substr( $this->chars, $pos, 1 );
97
  $word .= $char;
98
  }
@@ -173,8 +176,8 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
173
  $filename = null;
174
 
175
  if ( $im = imagecreatetruecolor( $this->img_size[0], $this->img_size[1] ) ) {
176
- $bg = imagecolorallocate( $im, $this->bg[0], $this->bg[1], $this->bg[2] );
177
- $fg = imagecolorallocate( $im, $this->fg[0], $this->fg[1], $this->fg[2] );
178
 
179
  imagefill( $im, 0, 0, $bg );
180
 
@@ -187,7 +190,8 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
187
  $x = $this->base[0] + mt_rand( -2, 2 );
188
 
189
  $gd_info = gd_info( );
190
- for ( $i = 0; $i < mb_strlen( $word ); $i++ ) {
 
191
  $font = $this->fonts[ array_rand( $this->fonts ) ];
192
  $font = $this->normalize_path( $font );
193
  if ( $gd_info['JIS-mapped Japanese Font Support'] ) {
@@ -246,6 +250,8 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
246
 
247
  fwrite( $fh, $code );
248
  fclose( $fh );
 
 
249
  }
250
 
251
  @chmod( $answer_file, $this->answer_file_mode );
@@ -258,7 +264,7 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
258
  * @param string $response CAPTCHA response
259
  * @return bool Return true if the two match, otherwise return false.
260
  */
261
- public function check( $prefix, $response ) {
262
  if ( 0 == strlen( $prefix ) ) {
263
  return false;
264
  }
@@ -275,10 +281,17 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
275
 
276
  $salt = $code[0];
277
  $hash = $code[1];
278
- if ( hash_hmac( 'md5', $response, $salt ) == $hash )
 
 
 
279
  return true;
 
280
  }
281
 
 
 
 
282
  return false;
283
  }
284
 
@@ -311,13 +324,17 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
311
  $dir = trailingslashit( $this->tmp_dir );
312
  $dir = $this->normalize_path( $dir );
313
 
314
- if ( ! @is_dir( $dir ) || ! @is_readable( $dir ) )
 
315
  return false;
 
316
 
317
  $is_win = ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) );
318
 
319
- if ( ! ( $is_win ? win_is_writable( $dir ) : @is_writable( $dir ) ) )
 
320
  return false;
 
321
 
322
  $count = 0;
323
 
@@ -330,7 +347,10 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
330
 
331
  $stat = @stat( $file );
332
  if ( ( $stat['mtime'] + $minutes * 60 ) < time() ) {
333
- @unlink( $file );
 
 
 
334
  $count += 1;
335
  }
336
  }
@@ -347,30 +367,30 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
347
  * @return bool True on successful create, false on failure.
348
  */
349
  public function make_tmp_dir() {
350
- global $config;
351
 
352
  $dir = trailingslashit( $this->tmp_dir );
353
  $dir = $this->normalize_path( $dir );
354
 
355
- if ( ! wp_mkdir_p( $dir ) )
 
356
  return false;
 
357
 
358
  $htaccess_file = $this->normalize_path( $dir . '.htaccess' );
359
 
360
  // add 'Satisfy Any' in .htaccess from version 1.2.0
361
- if ( version_compare( $config->get( 'version' ), '1.2.0' ) < 0 ) {
362
  @unlink( $htaccess_file );
363
  }
364
 
365
  if ( ! file_exists( $htaccess_file ) ) {
366
  if ( $handle = @fopen( $htaccess_file, 'w' ) ) {
367
- fwrite( $handle, 'Order deny,allow' . "\n" );
368
- fwrite( $handle, 'Deny from all' . "\n" );
369
- fwrite( $handle, '<Files ~ "^[0-9A-Za-z]+\\.(jpeg|gif|png)$">' . "\n" );
370
- fwrite( $handle, ' Allow from all' . "\n" );
371
- fwrite( $handle, ' Satisfy Any' . "\n" );
372
- fwrite( $handle, '</Files>' . "\n" );
373
  fclose( $handle );
 
 
374
  }
375
  }
376
 
@@ -378,7 +398,7 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
378
  $dmy_dst_file = $dir . 'dummy.png';
379
 
380
  if ( ! file_exists( $dmy_dst_file ) ) {
381
- copy( $dmy_src_file, $dmy_dst_file );
382
  }
383
 
384
  return true;
@@ -398,6 +418,13 @@ class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
398
  $path = preg_replace( '|/+|', '/', $path );
399
  return $path;
400
  }
401
- }
402
 
403
- ?>
 
 
 
 
 
 
 
 
31
  */
32
 
33
  class SiteGuardReallySimpleCaptcha extends SiteGuard_Base {
34
+ /* Mode of character set alphabet(en) or hiragana(jp) */
35
+ protected $lang_mode;
36
 
37
+ /* Length of a word in an image */
38
+ protected $char_length;
39
 
40
+ /* Directory temporary keeping CAPTCHA images and corresponding text files */
41
+ protected $tmp_dir;
42
 
43
+ /* Array of CAPTCHA image size. Width and height */
44
+ protected $img_size;
45
 
46
+ /* Coordinates for a text in an image. I don't know the meaning. Just adjust. */
47
+ protected $base;
48
 
49
+ /* Font size */
50
+ protected $font_size;
51
 
52
+ /* Width of a character */
53
+ protected $font_char_width;
54
 
55
+ /* Image type. 'png', 'gif' or 'jpeg' */
56
+ protected $img_type;
57
 
58
+ /* Mode of temporary image files */
59
+ protected $file_mode;
60
 
61
+ /* Mode of temporary answer text files */
62
+ protected $answer_file_mode;
63
 
64
+ public function __construct() {
65
+ $this->lang_mode = 'jp';
66
+ $this->char_length = 4;
67
+ $this->tmp_dir = path_join( dirname( __FILE__ ), 'tmp' );
68
+ $this->img_size = array( 72, 24 );
69
+ $this->base = array( 6, 18 );
70
+ $this->font_size = 14;
71
  $this->font_char_width = 15;
 
 
72
  $this->img_type = 'png';
 
 
73
  $this->file_mode = 0444;
 
 
74
  $this->answer_file_mode = 0440;
 
75
  }
76
 
77
  /**
83
 
84
  /* Characters available in images */
85
  $chars_en = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
86
+ $chars_jp = 'あいうえおかきくけこさしすせそたちつてとなにのひふへまみむもやゆよらりん';
87
 
88
  $word = '';
89
 
93
  $this->chars = $chars_en;
94
  }
95
 
96
+ $chars_size = mb_strlen( $this->chars );
97
  for ( $i = 0; $i < $this->char_length; $i++ ) {
98
+ $pos = mt_rand( 0, $chars_size - 1 );
99
  $char = mb_substr( $this->chars, $pos, 1 );
100
  $word .= $char;
101
  }
176
  $filename = null;
177
 
178
  if ( $im = imagecreatetruecolor( $this->img_size[0], $this->img_size[1] ) ) {
179
+ $bg = imagecolorallocate( $im, 255, 255, 255 );
180
+ $fg = imagecolorallocate( $im, 0, 0, 0 );
181
 
182
  imagefill( $im, 0, 0, $bg );
183
 
190
  $x = $this->base[0] + mt_rand( -2, 2 );
191
 
192
  $gd_info = gd_info( );
193
+ $word_size = mb_strlen( $word );
194
+ for ( $i = 0; $i < $word_size; $i++ ) {
195
  $font = $this->fonts[ array_rand( $this->fonts ) ];
196
  $font = $this->normalize_path( $font );
197
  if ( $gd_info['JIS-mapped Japanese Font Support'] ) {
250
 
251
  fwrite( $fh, $code );
252
  fclose( $fh );
253
+ } else {
254
+ siteguard_error_log( 'failed to open file (' . $answer_file . '). : ' . __FILENAME__ );
255
  }
256
 
257
  @chmod( $answer_file, $this->answer_file_mode );
264
  * @param string $response CAPTCHA response
265
  * @return bool Return true if the two match, otherwise return false.
266
  */
267
+ public function check( $prefix, $response, $remove = false ) {
268
  if ( 0 == strlen( $prefix ) ) {
269
  return false;
270
  }
281
 
282
  $salt = $code[0];
283
  $hash = $code[1];
284
+ if ( hash_hmac( 'md5', $response, $salt ) == $hash ) {
285
+ if ( $remove ) {
286
+ $this->remove( $prefix );
287
+ }
288
  return true;
289
+ }
290
  }
291
 
292
+ if ( $remove ) {
293
+ $this->remove( $prefix );
294
+ }
295
  return false;
296
  }
297
 
324
  $dir = trailingslashit( $this->tmp_dir );
325
  $dir = $this->normalize_path( $dir );
326
 
327
+ if ( ! @is_dir( $dir ) || ! @is_readable( $dir ) ) {
328
+ siteguard_error_log( $dir . ' is not directory or readable. :' . __FILENAME__ );
329
  return false;
330
+ }
331
 
332
  $is_win = ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) );
333
 
334
+ if ( ! ( $is_win ? win_is_writable( $dir ) : @is_writable( $dir ) ) ) {
335
+ siteguard_error_log( $dir . ' is not writable. :' . __FILENAME__ );
336
  return false;
337
+ }
338
 
339
  $count = 0;
340
 
347
 
348
  $stat = @stat( $file );
349
  if ( ( $stat['mtime'] + $minutes * 60 ) < time() ) {
350
+ if ( ! @unlink( $file ) ) {
351
+ @chmod( $file, 0644 );
352
+ @unlink( $file );
353
+ }
354
  $count += 1;
355
  }
356
  }
367
  * @return bool True on successful create, false on failure.
368
  */
369
  public function make_tmp_dir() {
370
+ global $siteguard_config;
371
 
372
  $dir = trailingslashit( $this->tmp_dir );
373
  $dir = $this->normalize_path( $dir );
374
 
375
+ if ( ! wp_mkdir_p( $dir ) ) {
376
+ siteguard_error_log( 'failed to make directory (' . $dir . '). :' . __FILENAME__ );
377
  return false;
378
+ }
379
 
380
  $htaccess_file = $this->normalize_path( $dir . '.htaccess' );
381
 
382
  // add 'Satisfy Any' in .htaccess from version 1.2.0
383
+ if ( version_compare( $siteguard_config->get( 'version' ), '1.2.0' ) < 0 ) {
384
  @unlink( $htaccess_file );
385
  }
386
 
387
  if ( ! file_exists( $htaccess_file ) ) {
388
  if ( $handle = @fopen( $htaccess_file, 'w' ) ) {
389
+ fwrite( $handle, 'RewriteEngine On' . "\n" );
390
+ fwrite( $handle, 'RewriteRule \.txt - [F]' . "\n" );
 
 
 
 
391
  fclose( $handle );
392
+ } else {
393
+ siteguard_error_log( 'failed to open file (' . $htaccess_file . '). :' . __FILENAME__ );
394
  }
395
  }
396
 
398
  $dmy_dst_file = $dir . 'dummy.png';
399
 
400
  if ( ! file_exists( $dmy_dst_file ) ) {
401
+ return @copy( $dmy_src_file, $dmy_dst_file );
402
  }
403
 
404
  return true;
418
  $path = preg_replace( '|/+|', '/', $path );
419
  return $path;
420
  }
 
421
 
422
+ /**
423
+ * set $this->lang_mode
424
+ */
425
+ public function set_lang_mode( $mode ) {
426
+ if ( 'jp' === $mode || 'en' === $mode ) {
427
+ $this->lang_mode = $mode;
428
+ }
429
+ }
430
+ }
siteguard.php CHANGED
@@ -7,7 +7,7 @@ Author: JP-Secure
7
  Author URI: http://www.jp-secure.com/eng/
8
  Text Domain: siteguard
9
  Domain Path: /languages/
10
- Version: 1.2.3
11
  */
12
 
13
  /* Copyright 2014 JP-Secure Inc
@@ -30,16 +30,22 @@ if ( ! defined( 'ABSPATH' ) ) {
30
  exit;
31
  }
32
 
33
- define( 'SITEGUARD_VERSION', '1.2.3' );
 
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' );
@@ -49,37 +55,40 @@ 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',
@@ -87,26 +96,28 @@ function siteguard_activate( ) {
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
  }
@@ -114,21 +125,26 @@ 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',
@@ -137,28 +153,45 @@ class SiteGuard extends SiteGuard_Base {
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;">';
@@ -167,40 +200,48 @@ class SiteGuard extends SiteGuard_Base {
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
- ?>
7
  Author URI: http://www.jp-secure.com/eng/
8
  Text Domain: siteguard
9
  Domain Path: /languages/
10
+ Version: 1.4.3
11
  */
12
 
13
  /* Copyright 2014 JP-Secure Inc
30
  exit;
31
  }
32
 
33
+ $data = get_file_data( __FILE__, array( 'version' => 'Version' ) );
34
+ define( 'SITEGUARD_VERSION', $data['version'] );
35
 
36
  define( 'SITEGUARD_PATH', plugin_dir_path( __FILE__ ) );
37
  define( 'SITEGUARD_URL_PATH', plugin_dir_url( __FILE__ ) );
38
 
39
+ define( 'SITEGUARD_LOGIN_NOSELECT', 4 );
40
  define( 'SITEGUARD_LOGIN_SUCCESS', 0 );
41
  define( 'SITEGUARD_LOGIN_FAILED', 1 );
42
  define( 'SITEGUARD_LOGIN_FAIL_ONCE', 2 );
43
  define( 'SITEGUARD_LOGIN_LOCKED', 3 );
44
 
45
+ define( 'SITEGUARD_LOGIN_TYPE_NOSELECT', 2 );
46
+ define( 'SITEGUARD_LOGIN_TYPE_NORMAL', 0 );
47
+ define( 'SITEGUARD_LOGIN_TYPE_XMLRPC', 1 );
48
+
49
  require_once( 'classes/siteguard-base.php' );
50
  require_once( 'classes/siteguard-config.php' );
51
  require_once( 'classes/siteguard-htaccess.php' );
55
  require_once( 'classes/siteguard-login-lock.php' );
56
  require_once( 'classes/siteguard-login-alert.php' );
57
  require_once( 'classes/siteguard-captcha.php' );
58
+ require_once( 'classes/siteguard-disable-xmlrpc.php' );
59
  require_once( 'classes/siteguard-disable-pingback.php' );
60
  require_once( 'classes/siteguard-waf-exclude-rule.php' );
61
  require_once( 'classes/siteguard-updates-notify.php' );
62
  require_once( 'admin/siteguard-menu-init.php' );
63
 
64
+ global $siteguard_htaccess;
65
+ global $siteguard_config;
66
+ global $siteguard_admin_filter;
67
+ global $siteguard_rename_login;
68
+ global $siteguard_loginlock;
69
+ global $siteguard_loginalert;
70
+ global $siteguard_captcha;
71
+ global $siteguard_login_history;
72
+ global $siteguard_xmlrpc;
73
+ global $siteguard_pingback;
74
+ global $siteguard_waf_exclude_rule;
75
+ global $siteguard_updates_notify;
76
+
77
+ $siteguard_htaccess = new SiteGuard_Htaccess( );
78
+ $siteguard_config = new SiteGuard_Config( );
79
+ $siteguard_admin_filter = new SiteGuard_AdminFilter( );
80
+ $siteguard_rename_login = new SiteGuard_RenameLogin( );
81
+ $siteguard_loginlock = new SiteGuard_LoginLock( );
82
+ $siteguard_loginalert = new SiteGuard_LoginAlert( );
83
+ $siteguard_login_history = new SiteGuard_LoginHistory( );
84
+ $siteguard_captcha = new SiteGuard_CAPTCHA( );
85
+ $siteguard_xmlrpc = new SiteGuard_Disable_XMLRPC( );
86
+ $siteguard_pingback = new SiteGuard_Disable_Pingback( );
87
+ $siteguard_waf_exclude_rule = new SiteGuard_WAF_Exclude_Rule( );
88
+ $siteguard_updates_notify = new SiteGuard_UpdatesNotify( );
89
 
90
  function siteguard_activate( ) {
91
+ global $siteguard_config, $siteguard_admin_filter, $siteguard_rename_login, $siteguard_login_history, $siteguard_captcha, $siteguard_loginlock, $siteguard_loginalert, $siteguard_xmlrpc, $siteguard_pingback, $siteguard_waf_exclude_rule, $siteguard_updates_notify;
92
 
93
  load_plugin_textdomain(
94
  'siteguard',
96
  dirname( plugin_basename( __FILE__ ) ) . '/languages'
97
  );
98
 
99
+ $siteguard_config->set( 'show_admin_notices', '0' );
100
+ $siteguard_config->update( );
101
+ $siteguard_admin_filter->init();
102
+ $siteguard_rename_login->init();
103
+ $siteguard_login_history->init();
104
+ $siteguard_captcha->init();
105
+ $siteguard_loginlock->init();
106
+ $siteguard_loginalert->init();
107
+ $siteguard_xmlrpc->init();
108
+ $siteguard_pingback->init();
109
+ $siteguard_waf_exclude_rule->init();
110
+ $siteguard_updates_notify->init();
111
  }
112
  register_activation_hook( __FILE__, 'siteguard_activate' );
113
 
114
  function siteguard_deactivate( ) {
115
+ global $siteguard_config;
116
+ $siteguard_config->set( 'show_admin_notices', '0' );
117
+ $siteguard_config->update( );
118
  SiteGuard_RenameLogin::feature_off( );
119
  SiteGuard_AdminFilter::feature_off( );
120
+ SiteGuard_Disable_XMLRPC::feature_off( );
121
  SiteGuard_WAF_Exclude_Rule::feature_off( );
122
  SiteGuard_UpdatesNotify::feature_off( );
123
  }
125
 
126
 
127
  class SiteGuard extends SiteGuard_Base {
128
+ protected $menu_init;
129
  function __construct( ) {
130
+ global $siteguard_config;
131
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
132
  $this->htaccess_check( );
133
  if ( is_admin( ) ) {
134
+ include ( 'admin/siteguard-menu-login-history.php' );
135
  $this->menu_init = new SiteGuard_Menu_Init( );
136
+ add_action( 'init', array( $this, 'set_cookie' ) );
137
  add_action( 'admin_init', array( $this, 'upgrade' ) );
138
+ if ( '0' === $siteguard_config->get( 'show_admin_notices' ) && '1' === $siteguard_config->get( 'renamelogin_enable' ) ) {
139
  add_action( 'admin_notices', array( $this, 'admin_notices' ) );
140
+ $siteguard_config->set( 'show_admin_notices', '1' );
141
+ $siteguard_config->update( );
142
  }
143
  }
144
  }
145
+ function set_cookie( ) {
146
+ SiteGuard_Menu_Login_History::set_cookie( );
147
+ }
148
  function plugins_loaded( ) {
149
  load_plugin_textdomain(
150
  'siteguard',
153
  );
154
  }
155
  function htaccess_check( ) {
156
+ global $siteguard_config;
157
+
158
+ $can_use_htaccess = true;
159
+ if ( false === SiteGuard_Htaccess::test_htaccess( ) ) {
160
+ $can_use_htaccess = false;
161
+ }
162
+ if ( '1' === $siteguard_config->get( 'admin_filter_enable' ) ) {
163
+ if ( false === $can_use_htaccess || ! SiteGuard_Htaccess::is_exists_setting( SiteGuard_AdminFilter::get_mark( ) ) ) {
164
+ $siteguard_config->set( 'admin_filter_enable', '0' );
165
+ $siteguard_config->update( );
166
+ }
167
+ }
168
+ if ( '1' === $siteguard_config->get( 'renamelogin_enable' ) ) {
169
+ if ( false === $can_use_htaccess || ! SiteGuard_Htaccess::is_exists_setting( SiteGuard_RenameLogin::get_mark( ) ) ) {
170
+ $siteguard_config->set( 'renamelogin_enable', '0' );
171
+ $siteguard_config->update( );
172
  }
173
  }
174
+ if ( '1' === $siteguard_config->get( 'disable_xmlrpc_enable' ) ) {
175
+ if ( false === $can_use_htaccess || ! SiteGuard_Htaccess::is_exists_setting( SiteGuard_Disable_XMLRPC::get_mark( ) ) ) {
176
+ $siteguard_config->set( 'disable_xmlrpc_enable', '0' );
177
+ $siteguard_config->update( );
178
  }
179
  }
180
+ if ( '1' === $siteguard_config->get( 'waf_exclude_rule_enable' ) ) {
181
+ if ( false === $can_use_htaccess || ! SiteGuard_Htaccess::is_exists_setting( SiteGuard_WAF_Exclude_Rule::get_mark( ) ) ) {
182
+ $siteguard_config->set( 'waf_exclude_rule_enable', '0' );
183
+ $siteguard_config->update( );
184
+ }
185
+ }
186
+ if ( '1' === $siteguard_config->get( 'captcha_enable' ) ) {
187
+ if ( false === $can_use_htaccess) {
188
+ $siteguard_config->set( 'captcha_enable', '0' );
189
+ $siteguard_config->update( );
190
  }
191
  }
192
  }
193
  function admin_notices( ) {
194
+ global $siteguard_rename_login;
195
  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;">';
196
  echo esc_html__( 'Login page URL was changed.', 'siteguard' ) . '</span>';
197
  echo '<span style="color:#eee;">';
200
  echo esc_html__( '. Setting change is ', 'siteguard' ) . '<a style="color:#fff;text-decoration:underline;" href="' . esc_url( menu_page_url( 'siteguard_rename_login', false ) ) . '">';
201
  echo esc_html__( 'here', 'siteguard' ) . '</a>';
202
  echo '.</span></p></div>';
203
+ $siteguard_rename_login->send_notify( );
204
  }
205
  function upgrade( ) {
206
+ global $siteguard_config, $siteguard_rename_login, $siteguard_admin_filter, $siteguard_loginalert, $siteguard_updates_notify, $siteguard_login_history, $siteguard_xmlrpc;
207
  $upgrade_ok = true;
208
+ $old_version = $siteguard_config->get( 'version' );
209
+ if ( '' === $old_version ) {
210
  $old_version = '0.0.0';
211
  }
 
 
 
 
 
 
 
212
  if ( version_compare( $old_version, '1.0.6' ) < 0 ) {
213
+ if ( '1' === $siteguard_config->get( 'admin_filter_enable' ) ) {
214
+ if ( true !== $siteguard_admin_filter->feature_on( $this->get_ip( ) ) ) {
215
+ siteguard_error_log( 'Failed to update at admin_filter from ' . $old_version . ' to ' . SITEGUARD_VERSION . '.' );
216
  $upgrade_ok = false;
217
  }
218
  }
219
  }
220
  if ( version_compare( $old_version, '1.1.1' ) < 0 ) {
221
+ $siteguard_loginalert->init();
222
  }
223
  if ( version_compare( $old_version, '1.2.0' ) < 0 ) {
224
+ $siteguard_updates_notify->init();
225
+ }
226
+ if ( version_compare( $old_version, '1.2.5' ) < 0 ) {
227
+ if ( '1' === $siteguard_config->get( 'admin_filter_enable' ) ) {
228
+ $siteguard_admin_filter->cvt_status_for_1_2_5( $this->get_ip( ) );
229
+ }
230
+ if ( '1' === $siteguard_config->get( 'renamelogin_enable' ) ) {
231
+ if ( true !== $siteguard_rename_login->feature_on( ) ) {
232
+ siteguard_error_log( 'Failed to update at rename_login from ' . $old_version . ' to ' . SITEGUARD_VERSION . '.' );
233
+ $upgrade_ok = false;
234
+ }
235
+ }
236
+ }
237
+ if ( $upgrade_ok && SITEGUARD_VERSION !== $old_version ) {
238
+ $siteguard_config->set( 'version', SITEGUARD_VERSION );
239
+ $siteguard_config->update( );
240
  }
241
+ if ( version_compare( $old_version, '1.3.0' ) < 0 ) {
242
+ $siteguard_login_history->init( );
243
+ $siteguard_xmlrpc->init( );
244
  }
245
  }
246
  }
247
  $siteguard = new SiteGuard;
 
test/.htaccess ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <IfModule mod_rewrite.c>
2
+ RewriteEngine on
3
+ RewriteRule ^siteguard-test\.php$ siteguard-dummy.php [L]
4
+ </IfModule>
test/siteguard-dummy.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ echo 'dummy page.';
3
+ ?>
uninstall.php CHANGED
@@ -17,5 +17,3 @@ function delete_siteguard_plugin( ) {
17
  }
18
 
19
  delete_siteguard_plugin( );
20
-
21
- ?>
17
  }
18
 
19
  delete_siteguard_plugin( );