PluginProbe ʕ •ᴥ•ʔ
SiteGuard WP Plugin / 1.7.7
SiteGuard WP Plugin v1.7.7
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 3 years ago siteguard-menu-admin-filter.php 3 years ago siteguard-menu-author-query.php 3 years ago siteguard-menu-captcha.php 3 years ago siteguard-menu-dashboard.php 3 years ago siteguard-menu-fail-once.php 3 years ago siteguard-menu-init.php 3 years ago siteguard-menu-login-alert.php 3 years ago siteguard-menu-login-history.php 3 years ago siteguard-menu-login-lock.php 3 years ago siteguard-menu-protect-xmlrpc.php 3 years ago siteguard-menu-rename-login.php 3 years ago siteguard-menu-same-error.php 3 years ago siteguard-menu-updates-notify.php 3 years ago siteguard-menu-waf-tuning-support.php 3 years ago siteguard-waf-exclude-rule-table.php 3 years ago
siteguard-menu-admin-filter.php
137 lines
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 }
10 function render_page() {
11 global $siteguard_admin_filter, $siteguard_config;
12
13 $opt_val_feature = $siteguard_config->get( self::OPT_NAME_FEATURE );
14 $opt_val_exclude = $this->cvt_camma2ret( $siteguard_config->get( self::OPT_NAME_EXCLUDE ) );
15 if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-admin-filter-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 echo esc_html( $errors->get_error_message() );
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_admin_filter->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 ] && false === SiteGuard_Htaccess::test_htaccess() ) {
41 echo '<div class="error settings-error"><p><strong>';
42 esc_html_e( 'mod_rewrite of .htaccess can not be used', 'siteguard' );
43 echo '</strong></p></div>';
44 $error = true;
45 }
46 if ( false === $error ) {
47 $old_opt_val_feature = $opt_val_feature;
48 $old_opt_val_exclude = $opt_val_exclude;
49 $opt_val_feature = sanitize_text_field( $_POST[ self::OPT_NAME_FEATURE ] );
50 $opt_val_exclude = stripslashes( sanitize_textarea_field( $_POST[ self::OPT_NAME_EXCLUDE ] ) );
51 $siteguard_config->set( self::OPT_NAME_FEATURE, $opt_val_feature );
52 $siteguard_config->set( self::OPT_NAME_EXCLUDE, $this->cvt_ret2camma( $opt_val_exclude ) );
53 $siteguard_config->update();
54 $result = true;
55 if ( '0' === $opt_val_feature ) {
56 $result = $siteguard_admin_filter->feature_off();
57 } else {
58 $result = $siteguard_admin_filter->feature_on( $this->get_ip() );
59 }
60 if ( true === $result ) {
61 $opt_val_exclude = $this->cvt_camma2ret( $opt_val_exclude );
62 ?>
63 <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
64 <?php
65 } else {
66 $opt_val_feature = $old_opt_val_feature;
67 $opt_val_exclude = $old_opt_val_exclude;
68 $siteguard_config->set( self::OPT_NAME_FEATURE, $opt_val_feature );
69 $siteguard_config->set( self::OPT_NAME_EXCLUDE, $this->cvt_ret2camma( $opt_val_exclude ) );
70 $siteguard_config->update();
71 echo '<div class="error settings-error"><p><strong>';
72 esc_html_e( 'ERROR: Failed to .htaccess update.', 'siteguard' );
73 echo '</strong></p></div>';
74 }
75 }
76 }
77
78 echo '<div class="wrap">';
79 echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
80 echo '<h2>' . esc_html__( 'Admin Page IP Filter', 'siteguard' ) . '</h2>';
81 echo '<div class="siteguard-description">'
82 . esc_html__( 'You can find docs about this function on ', 'siteguard' )
83 . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/admin_filter/', 'siteguard' ) )
84 . '" target="_blank">'
85 . esc_html__( 'here', 'siteguard' )
86 . '</a>'
87 . esc_html__( '.', 'siteguard' )
88 . '</div>';
89 ?>
90 <form name="form1" method="post" action="">
91 <table class="form-table">
92 <tr>
93 <th scope="row" colspan="2">
94 <ul class="siteguard-radios">
95 <li>
96 <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' ); ?> >
97 <label for="<?php echo self::OPT_NAME_FEATURE . '_on'; ?>" ><?php echo esc_html_e( 'ON', 'siteguard' ); ?></label>
98 </li>
99 <li>
100 <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' ); ?> >
101 <label for="<?php echo self::OPT_NAME_FEATURE . '_off'; ?>" ><?php echo esc_html_e( 'OFF', 'siteguard' ); ?></label>
102 </li>
103 </ul>
104 <?php
105 $error = siteguard_check_multisite();
106 if ( is_wp_error( $error ) ) {
107 echo '<p class="description">';
108 echo esc_html( $error->get_error_message() );
109 echo '</p>';
110 }
111 echo '<p class="description">';
112 esc_html_e( 'To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard' );
113 echo '</p>';
114 ?>
115 </th>
116 </tr><tr>
117 <th scope="row"><label for="<?php echo self::OPT_NAME_EXCLUDE; ?>"><?php echo esc_html_e( 'Exclude Path', 'siteguard' ); ?></label></th>
118 <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>
119 <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>
120 </tr>
121 </table>
122 <input type="hidden" name="update" value="Y">
123 <div class="siteguard-description">
124 <?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' ); ?>
125 </div>
126 <hr />
127 <?php
128 wp_nonce_field( 'siteguard-menu-admin-filter-submit' );
129 submit_button();
130 ?>
131 </form>
132 </div>
133
134 <?php
135 }
136 }
137