PluginProbe ʕ •ᴥ•ʔ
SiteGuard WP Plugin / 1.2.2
SiteGuard WP Plugin v1.2.2
1.8.7 1.8.6 1.8.6-beta1 1.8.6-beta2 1.8.4 1.8.5 1.8.3 1.8.2 1.8.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.4.3 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.11 1.7.12 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.0-beta1 1.8.0-beta2 1.8.0-beta3 1.8.0-beta4
siteguard / admin / siteguard-menu-admin-filter.php
siteguard / admin Last commit date
siteguard-login-history-table.php 11 years ago siteguard-menu-admin-filter.php 11 years ago siteguard-menu-captcha.php 11 years ago siteguard-menu-dashboard.php 11 years ago siteguard-menu-disable-pingback.php 11 years ago siteguard-menu-fail-once.php 11 years ago siteguard-menu-init.php 11 years ago siteguard-menu-login-alert.php 11 years ago siteguard-menu-login-lock.php 11 years ago siteguard-menu-rename-login.php 11 years ago siteguard-menu-same-error.php 11 years ago siteguard-menu-updates-notify.php 11 years ago siteguard-menu-waf-tuning-support.php 11 years ago siteguard-waf-exclude-rule-table.php 11 years ago
siteguard-menu-admin-filter.php
132 lines
1 <?php
2
3 class SiteGuard_Menu_Admin_Filter extends SiteGuard_Base {
4 function __construct( ) {
5 $this->render_page( );
6 }
7 function cvt_camma2ret( $exclude ) {
8 $result = str_replace( ' ', '', $exclude );
9 return str_replace( ',', "\r\n", $result );
10 }
11 function cvt_ret2camma( $exclude ) {
12 $result = str_replace( ' ', '', $exclude );
13 $result = str_replace( ',', '', $result );
14 $result = preg_replace( '/(\r\n){2,}/', "\r\n", $result );
15 $result = preg_replace( '/\r\n$/', '', $result );
16 $result = str_replace( "\r\n", ',', $result );
17 $result = str_replace( "\r", ',', $result );
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
72 echo '<div class="wrap">';
73 echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
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="">
85 <table class="form-table">
86 <tr>
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( );
103 echo '</p>';
104 }
105 echo '<p class="description">';
106 esc_html_e( 'To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard' );
107 echo '</p>';
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
122 wp_nonce_field( 'siteguard-menu-admin-filter-submit' );
123 submit_button( );
124 ?>
125 </form>
126 </div>
127
128 <?php
129 }
130 }
131 ?>
132