PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.2.4
CloudSecure WP Security v1.2.4
1.4.10 1.4.9 trunk 0.9.0 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.19 1.3.2 1.3.20 1.3.21 1.3.22 1.3.23 1.3.24 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8
cloudsecure-wp-security / modules / admin / disable-login.php
cloudsecure-wp-security / modules / admin Last commit date
captcha.php 2 years ago common.php 2 years ago dashboard.php 2 years ago disable-author-query.php 2 years ago disable-login.php 2 years ago disable-restapi.php 2 years ago disable-xmlrpc.php 2 years ago login-log-table.php 2 years ago login-log.php 2 years ago login-notification.php 2 years ago rename-login-page.php 2 years ago restrict-admin-page.php 2 years ago server-error-notification.php 2 years ago server-error-table.php 2 years ago two-factor-authentication-registration.php 2 years ago two-factor-authentication.php 2 years ago unify-messages.php 2 years ago update-notice.php 2 years ago
disable-login.php
147 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class CloudSecureWP_Admin_Disable_Login extends CloudSecureWP_Admin_Common {
8 private $disable_login;
9 private $constant_settings;
10
11 function __construct( array $info, CloudSecureWP_Disable_Login $disable_login ) {
12 parent::__construct( $info );
13 $this->disable_login = $disable_login;
14 $this->constant_settings = $this->disable_login->get_constant_settings();
15 $this->prepare_view_data();
16 $this->render();
17 }
18
19 /**
20 * 画面表示用のデータを準備
21 */
22 public function prepare_view_data(): void {
23 $this->datas = $this->disable_login->get_settings();
24
25 if ( ! empty( $_POST ) && check_admin_referer( $this->disable_login->get_feature_key() . '_csrf' ) ) {
26
27 foreach ( $this->datas as $key => $val ) {
28
29 switch ( $key ) {
30 case 'disable_login':
31 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
32 if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) {
33 $this->errors[] = '有効・無効の値が不正です';
34 }
35
36 if ( ! $this->check_environment() ) {
37 $tmp = 'f';
38 }
39
40 $this->datas[ $key ] = $tmp;
41 break;
42
43 case 'disable_login_interval':
44 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
45 if ( ! $this->is_selected( $tmp, $this->constant_settings['disable_login_interval'] ) ) {
46 $this->errors[] = '間隔の値が不正です';
47 }
48 $this->datas[ $key ] = $tmp;
49 break;
50
51 case 'disable_login_limit':
52 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
53 if ( ! $this->is_selected( $tmp, $this->constant_settings['disable_login_limit'] ) ) {
54 $this->errors[] = 'ログイン失敗回数の値が不正です';
55 }
56 $this->datas[ $key ] = $tmp;
57 break;
58
59 case 'disable_login_duration':
60 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
61 if ( ! $this->is_selected( $tmp, $this->constant_settings['disable_login_duration'] ) ) {
62 $this->errors[] = 'ログイン無効時間の値が不正です';
63 }
64 $this->datas[ $key ] = $tmp;
65 break;
66 }
67 }
68
69 if ( empty( $this->errors ) ) {
70 if ( 't' === $this->datas['disable_login'] ) {
71 $this->messages[] = 'ログイン無効化機能が有効になりました。';
72 } else {
73 $this->messages[] = 'ログイン無効化機能が無効になりました。';
74 }
75
76 $this->disable_login->save_settings( $this->datas );
77 }
78 }
79
80 $this->datas = $this->get_checked( $this->datas, array( 'disable_login', 'disable_login_interval', 'disable_login_limit', 'disable_login_duration' ) );
81 }
82
83 /**
84 * デスクリプション
85 */
86 protected function admin_description(): void {
87 ?>
88 <div class="title-block mb-12">
89 <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/disable_login.php">こちら</a></p>
90 <h1 class="title-block-title">ログイン無効化</h1>
91 </div>
92 <div class="title-bottom-text">
93 指定した期間�
94 にログイン失敗回数が指定した回数に達した場合、指定した時間ログインを無効化(ブロック)します。
95 </div>
96 <?php
97 }
98
99 /**
100 * ページコンテンツ
101 */
102 protected function page(): void {
103 ?>
104 <form method="post">
105 <div class="enabled-or-disabled">
106 <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="disable_login" value="t" <?php echo esc_html( $this->datas['disable_login_t'] ?? '' ); ?> /><label for="enabled">有効</label>
107 <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="disable_login" value="f" <?php echo esc_html( $this->datas['disable_login_f'] ?? '' ); ?> /><label for="disabled">無効</label>
108 </div>
109 <div class="box">
110 <div class="box-bottom">
111 <div class="box-row flex-start">
112 <div class="box-row-title not-label">間隔</div>
113 <div class="box-row-content radio-btns">
114 <input type="radio" class="circle-radio" id="interval-s" name="disable_login_interval" value="<?php echo esc_attr( $this->constant_settings['disable_login_interval'][0] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_interval_' . $this->constant_settings['disable_login_interval'][0] ] ?? '' ); ?> /><label for="interval-s"><?php echo esc_html( $this->constant_settings['disable_login_interval'][0] ); ?> </label><br />
115 <input type="radio" class="circle-radio" id="interval-m" name="disable_login_interval" value="<?php echo esc_attr( $this->constant_settings['disable_login_interval'][1] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_interval_' . $this->constant_settings['disable_login_interval'][1] ] ?? '' ); ?> /><label for="interval-m"><?php echo esc_html( $this->constant_settings['disable_login_interval'][1] ); ?> </label><br />
116 <input type="radio" class="circle-radio" id="interval-l" name="disable_login_interval" value="<?php echo esc_attr( $this->constant_settings['disable_login_interval'][2] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_interval_' . $this->constant_settings['disable_login_interval'][2] ] ?? '' ); ?> /><label for="interval-l"><?php echo esc_html( $this->constant_settings['disable_login_interval'][2] ); ?> </label>
117 </div>
118 </div>
119 <div class="box-row flex-start">
120 <div class="box-row-title not-label">ログイン失敗回数</div>
121 <div class="box-row-content radio-btns">
122 <input type="radio" id="failure-s" class="circle-radio" name="disable_login_limit" value="<?php echo esc_attr( $this->constant_settings['disable_login_limit'][0] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_limit_' . $this->constant_settings['disable_login_limit'][0] ] ?? '' ); ?> /><label for="failure-s"><?php echo esc_html( $this->constant_settings['disable_login_limit'][0] ); ?> </label><br />
123 <input type="radio" id="failure-m" class="circle-radio" name="disable_login_limit" value="<?php echo esc_attr( $this->constant_settings['disable_login_limit'][1] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_limit_' . $this->constant_settings['disable_login_limit'][1] ] ?? '' ); ?> /><label for="failure-m"><?php echo esc_html( $this->constant_settings['disable_login_limit'][1] ); ?> </label><br />
124 <input type="radio" id="failure-l" class="circle-radio" name="disable_login_limit" value="<?php echo esc_attr( $this->constant_settings['disable_login_limit'][2] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_limit_' . $this->constant_settings['disable_login_limit'][2] ] ?? '' ); ?> /><label for="failure-l"><?php echo esc_html( $this->constant_settings['disable_login_limit'][2] ); ?> </label>
125 </div>
126 </div>
127 <div class="box-row flex-start">
128 <div class="box-row-title not-label">ログイン無効時間</div>
129 <div class="box-row-content radio-btns">
130 <input type="radio" id="invalid-ss" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][0] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][0] ] ?? '' ); ?> /><label for="invalid-ss"><?php echo esc_html( $this->constant_settings['disable_login_duration'][0] ); ?> </label><br />
131 <input type="radio" id="invalid-s" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][1] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][1] ] ?? '' ); ?> /><label for="invalid-s"><?php echo esc_html( $this->constant_settings['disable_login_duration'][1] ); ?> </label><br />
132 <input type="radio" id="invalid-m" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][2] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][2] ] ?? '' ); ?> /><label for="invalid-m"><?php echo esc_html( $this->constant_settings['disable_login_duration'][2] ); ?> </label><br />
133 <input type="radio" id="invalid-l" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][3] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][3] ] ?? '' ); ?> /><label for="invalid-l"><?php echo esc_html( $this->constant_settings['disable_login_duration'][3] ); ?> </label><br />
134 <input type="radio" id="invalid-ll" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][4] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][4] ] ?? '' ); ?> /><label for="invalid-ll"><?php echo esc_html( $this->constant_settings['disable_login_duration'][4] ); ?> </label>
135 </div>
136 </div>
137 </div>
138 </div>
139 <div id="submit-btn-area">
140 <?php $this->nonce_wp( $this->disable_login->get_feature_key() ); ?>
141 <?php $this->submit_button_wp(); ?>
142 </div>
143 </form>
144 <?php
145 }
146 }
147