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-author-query.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-author-query.php
167 lines
1 <?php
2
3 class SiteGuard_Menu_Author_Query extends SiteGuard_Base {
4 const OPT_NAME_FEATURE = 'block_author_query_enable';
5 const OPT_NAME_RESTAPI = 'disable_restapi_enable';
6 const OPT_NAME_EXCLUDE = 'disable_restapi_exclude';
7
8 function __construct() {
9 $this->render_page();
10 }
11 function render_page() {
12 global $siteguard_config, $siteguard_author_query;
13
14 $opt_val_feature = $siteguard_config->get( self::OPT_NAME_FEATURE );
15 $opt_val_restapi = $siteguard_config->get( self::OPT_NAME_RESTAPI );
16 $opt_val_exclude = $this->cvt_camma2ret( $siteguard_config->get( self::OPT_NAME_EXCLUDE ) );
17 if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-block-author-query-submit' ) ) {
18 $error = false;
19 $errors = siteguard_check_multisite();
20 if ( is_wp_error( $errors ) ) {
21 echo '<div class="error settings-error"><p><strong>';
22 echo esc_html( $errors->get_error_message() );
23 echo '</strong></p></div>';
24 $error = true;
25 }
26 if ( false === $error && false === $this->is_switch_value( $_POST[ self::OPT_NAME_FEATURE ] ) ) {
27 echo '<div class="error settings-error"><p><strong>';
28 esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
29 echo '</strong></p></div>';
30 $error = true;
31 }
32 if ( false === $error ) {
33 $old_opt_val_feature = $opt_val_feature;
34 $old_opt_val_restapi = $opt_val_restapi;
35 $old_opt_val_exclude = $opt_val_exclude;
36 $opt_val_feature = sanitize_text_field( $_POST[ self::OPT_NAME_FEATURE ] );
37 if ( isset( $_POST[ self::OPT_NAME_RESTAPI ] ) ) {
38 $opt_val_restapi = '1';
39 } else {
40 $opt_val_restapi = '0';
41 }
42 $opt_val_exclude = stripslashes( sanitize_textarea_field( $_POST[ self::OPT_NAME_EXCLUDE ] ) );
43 $siteguard_config->set( self::OPT_NAME_FEATURE, $opt_val_feature );
44 $siteguard_config->set( self::OPT_NAME_RESTAPI, $opt_val_restapi );
45 $siteguard_config->set( self::OPT_NAME_EXCLUDE, $this->cvt_ret2camma( $opt_val_exclude ) );
46 $siteguard_config->update();
47 $result = true;
48 if ( true === $result ) {
49 $opt_val_exclude = $this->cvt_camma2ret( $opt_val_exclude );
50 ?>
51 <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
52 <?php
53 } else {
54 $opt_val_feature = $old_opt_val_feature;
55 $opt_val_restapi = $old_opt_val_restapi;
56 $opt_val_exclude = $old_opt_val_exclude;
57 $siteguard_config->set( self::OPT_NAME_FEATURE, $opt_val_feature );
58 $siteguard_config->set( self::OPT_NAME_RESTAPI, $opt_val_restapi );
59 $siteguard_config->set( self::OPT_NAME_EXCLUDE, $this->cvt_ret2camma( $opt_val_exclude ) );
60 $siteguard_config->update();
61 echo '<div class="error settings-error"><p><strong>';
62 esc_html_e( 'ERROR: Failed to .htaccess update.', 'siteguard' );
63 echo '</strong></p></div>';
64 }
65 }
66 }
67
68 echo '<div class="wrap">';
69 echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
70 echo '<h2>' . esc_html__( 'Block Author Query', 'siteguard' ) . '</h2>';
71 echo '<div class="siteguard-description">'
72 . esc_html__( 'You can find docs about this function on ', 'siteguard' )
73 . '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/author_query/', 'siteguard' ) )
74 . '" target="_blank">'
75 . esc_html__( 'here', 'siteguard' )
76 . '</a>'
77 . esc_html__( '.', 'siteguard' )
78 . '</div>';
79 ?>
80 <form name="form1" method="post" action="">
81
82 <table class="form-table">
83 <tr>
84 <th scope="row" colspan="2">
85 <ul class="siteguard-radios">
86 <li>
87 <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' ); ?> >
88 <label for="<?php echo self::OPT_NAME_FEATURE . '_on'; ?>"><?php echo esc_html_e( 'ON', 'siteguard' ); ?></label>
89 </li><li>
90 <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' ); ?> >
91 <label for="<?php echo self::OPT_NAME_FEATURE . '_off'; ?>"><?php echo esc_html_e( 'OFF', 'siteguard' ); ?></label>
92 </li>
93 </ul>
94 <?php
95 $error = siteguard_check_multisite();
96 if ( is_wp_error( $error ) ) {
97 echo '<p class="description">';
98 echo esc_html( $error->get_error_message() );
99 echo '</p>';
100 }
101 ?>
102 </th>
103 </tr><tr>
104 <th scope="row"><?php esc_html_e( 'Option', 'siteguard' ); ?></th>
105 <td>
106 <input type="checkbox" name="<?php echo self::OPT_NAME_RESTAPI; ?>" id="<?php echo self::OPT_NAME_RESTAPI; ?>" value="1" <?php checked( $opt_val_restapi, '1' ); ?> >
107 <label for="<?php echo self::OPT_NAME_RESTAPI; ?>"><?php esc_html_e( 'Disable REST API', 'siteguard' ); ?></label>
108 </td>
109
110 </tr>
111 </tr><tr>
112 <th scope="row"><label for="<?php echo self::OPT_NAME_EXCLUDE; ?>"><?php echo esc_html_e( 'Exclude Plugins', 'siteguard' ); ?></label></th>
113 <td><textarea name="<?php echo self::OPT_NAME_EXCLUDE; ?>" id="<?php echo self::OPT_NAME_EXCLUDE; ?>" class="siteguard-box-300" cols=40 rows=10 ><?php echo esc_textarea( $opt_val_exclude ); ?></textarea>
114 <p class="description"><?php esc_html_e( 'Please specify the plugin. To specify more than one, separate them with new line. ', 'siteguard' ); ?></p></br>
115 <script>
116 function add_value(){
117 const crlf = String.fromCharCode(13) + String.fromCharCode(10)
118 const plugins = document.form1.plugins;
119 const excludes = document.form1.disable_restapi_exclude;
120 const num = plugins.selectedIndex;
121 const sel = plugins.options[num]
122 const str = sel.value;
123 if(num > -1){
124 excludes.value = excludes.value + crlf + str;
125 plugins.removeChild(sel);
126 }
127 }
128 </script>
129 <select name="plugins" class="siteguard-box-300" size="15">
130 <?php
131 $val_excludes = explode( "\r\n", $opt_val_exclude );
132 include_once ABSPATH . 'wp-admin/includes/plugin.php';
133 $plugins = get_plugins();
134 if ( ! empty( $plugins ) ) {
135 foreach ( $plugins as $path => $plugin ) {
136 if ( is_plugin_active( $path ) ) {
137 $text_domain = $plugin['TextDomain'];
138 if ( ! in_array( $text_domain, $val_excludes ) && 'siteguard' != $text_domain ) {
139 ?>
140 <option value="<?php esc_attr_e( $text_domain ); ?>"><?php echo esc_html( $text_domain ); ?></option>
141 <?php
142 }
143 }
144 }
145 }
146 ?>
147 </select>
148 <input type="button" value="<?php esc_html_e( 'Add Exclude Plugin', 'siteguard' ); ?>" onclick="add_value()" />
149 <p class="description"><?php esc_html_e( 'This is a list of valid plugins. You can select it and add it to the exclude plugins.', 'siteguard' ); ?></p></br>
150 </td>
151 </tr>
152 </table>
153 <input type="hidden" name="update" value="Y">
154 <div class="siteguard-description">
155 <?php esc_html_e( 'Prevents leakage of user names due to "/?author=<number>" access. You can also disable the REST API to prevent username leaks via the REST API. If there are plugins that do not work due to the REST API being disabled, please add the plugin name to the excluded plugins. You can add the plugin name from the list of enabled plugin names.', 'siteguard' ); ?>
156 </div>
157 <hr />
158 <?php
159 wp_nonce_field( 'siteguard-menu-block-author-query-submit' );
160 submit_button();
161 ?>
162 </form>
163 </div>
164 <?php
165 }
166 }
167