PluginProbe ʕ •ᴥ•ʔ
SiteGuard WP Plugin / 1.0.0
SiteGuard WP Plugin v1.0.0
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-lock.php 11 years ago siteguard-menu-rename-login.php 11 years ago siteguard-menu-same-error.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
112 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 if ( '1' == $_POST[ $opt_name_feature ] && $this->check_module( 'rewrite' ) == false ) {
31 echo '<div class="error settings-error"><p><strong>';
32 esc_html_e( 'To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard' );
33 echo '</strong></p></div>';
34 $error = true;
35 $config->set( $opt_name_feature, '0' );
36 $config->update( );
37 $admin_filter->feature_off( );
38 $opt_val_feature = '0';
39 }
40 if ( false == $this->is_switch_value( $_POST[ $opt_name_feature ] ) ) {
41 echo '<div class="error settings-error"><p><strong>';
42 esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
43 echo '</strong></p></div>';
44 $error = true;
45 }
46 if ( false == $error ) {
47 $opt_val_feature = $_POST[ $opt_name_feature ];
48 $opt_val_exclude = $this->cvt_ret2camma( stripslashes( $_POST[ $opt_name_exclude ] ) );
49 $config->set( $opt_name_feature, $opt_val_feature );
50 $config->set( $opt_name_exclude, $opt_val_exclude );
51 $config->update( );
52 $opt_val_exclude = $this->cvt_camma2ret( $opt_val_exclude );
53 $mark = $admin_filter->get_mark( );
54 if ( '0' == $opt_val_feature ) {
55 $admin_filter->feature_off( );
56 } else {
57 $admin_filter->feature_on( $_SERVER['REMOTE_ADDR'] );
58 }
59 ?>
60 <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
61 <?php
62 }
63 }
64
65 echo '<div class="wrap">';
66 echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
67 echo '<h2>' . esc_html__( 'Admin Page IP Filter', 'siteguard' ) . '</h2>';
68 ?>
69 <form name="form1" method="post" action="">
70 <table class="form-table">
71 <tr>
72 <th scope="row"><?php esc_html_e( 'Enable/Disable', 'siteguard' ) ?></th>
73 <td>
74 <ul class="siteguard-radios">
75 <li>
76 <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' : '' ) ?> >
77 <label for="<?php echo $opt_name_feature.'_on' ?>" ><?php echo esc_html_e( 'ON', 'siteguard' ) ?></label>
78 </li>
79 <li>
80 <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' : '') ?> >
81 <label for="<?php echo $opt_name_feature.'_off' ?>" ><?php echo esc_html_e( 'OFF', 'siteguard' ) ?></label>
82 </li>
83 </ul>
84 <?php
85 echo '<p class="description">';
86 esc_html_e( 'To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard' );
87 echo '</p>';
88 ?>
89 </td>
90 </tr><tr>
91 <th scope="row"><label for="<?php echo $opt_name_exclude ?>"><?php echo esc_html_e( 'Exclude Path', 'siteguard' ) ?></label></th>
92 <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>
93 <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>
94 </tr>
95 </table>
96 <input type="hidden" name="update" value="Y">
97 <div class="siteguard-description">
98 <?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' ); ?>
99 </div>
100 <hr />
101 <?php
102 wp_nonce_field( 'siteguard-menu-admin-filter-submit' );
103 submit_button( );
104 ?>
105 </form>
106 </div>
107
108 <?php
109 }
110 }
111 ?>
112