PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.4.13
CloudSecure WP Security v1.4.13
1.4.14 1.4.13 1.4.12 1.4.11 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 / captcha.php
cloudsecure-wp-security / modules / admin Last commit date
captcha.php 2 weeks ago common.php 2 years ago dashboard.php 1 month ago disable-access-system-file.php 9 months ago disable-author-query.php 2 years ago disable-login.php 2 years ago disable-restapi.php 2 weeks ago disable-xmlrpc.php 2 years ago login-log-table.php 4 months ago login-log.php 2 years ago login-notification.php 3 months ago rename-login-page.php 1 month ago restrict-admin-page.php 3 months ago server-error-notification.php 4 months ago server-error-table.php 1 year ago two-factor-authentication-registration.php 3 months ago two-factor-authentication.php 4 months ago unify-messages.php 2 years ago update-notice.php 1 month ago waf-table.php 1 year ago waf.php 1 month ago
captcha.php
173 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class CloudSecureWP_Admin_CAPTCHA extends CloudSecureWP_Admin_Common {
8 private $captcha;
9 private $constant_settings;
10
11 function __construct( array $info, CloudSecureWP_CAPTCHA $captcha ) {
12 parent::__construct( $info );
13 $this->captcha = $captcha;
14 $this->constant_settings = $this->captcha->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->captcha->get_settings();
24
25 if ( ! empty( $_POST ) && check_admin_referer( $this->captcha->get_feature_key() . '_csrf' ) ) {
26
27 foreach ( $this->datas as $key => $val ) {
28
29 switch ( $key ) {
30 case 'captcha':
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 if ( 't' === $tmp ) {
41 $environment_error = $this->captcha->check_modules();
42
43 if ( '' !== $environment_error ) {
44 $this->errors[] = $environment_error;
45 }
46 }
47
48 $this->datas[ $key ] = $tmp;
49 break;
50
51 case 'captcha_login':
52 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
53 if ( ! $this->is_selected( $tmp, $this->constant_settings['captcha_login'] ) ) {
54 $this->errors[] = 'ログインフォームの値が不正です';
55 }
56 $this->datas[ $key ] = $tmp;
57 break;
58
59 case 'captcha_comment':
60 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
61 if ( ! $this->is_selected( $tmp, $this->constant_settings['captcha_comment'] ) ) {
62 $this->errors[] = 'コメントフォームの値が不正です';
63 }
64 $this->datas[ $key ] = $tmp;
65 break;
66
67 case 'captcha_lost_password':
68 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
69 if ( ! $this->is_selected( $tmp, $this->constant_settings['captcha_lost_password'] ) ) {
70 $this->errors[] = 'パスワードリセットフォームフォームの値が不正です';
71 }
72 $this->datas[ $key ] = $tmp;
73 break;
74
75 case 'captcha_register':
76 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
77 if ( ! $this->is_selected( $tmp, $this->constant_settings['captcha_register'] ) ) {
78 $this->errors[] = 'ユーザー登録フォームフォームの値が不正です';
79 }
80 $this->datas[ $key ] = $tmp;
81 break;
82 }
83 }
84
85 if ( empty( $this->errors ) ) {
86 if ( 't' === $this->datas['captcha'] ) {
87 $this->messages[] = '画像認証追加機能が有効になりました。';
88 } else {
89 $this->messages[] = '画像認証追加機能が無効になりました。';
90 }
91
92 $this->captcha->save_settings( $this->datas );
93 }
94 }
95
96 $this->datas = $this->get_checked( $this->datas, array( 'captcha', 'captcha_login', 'captcha_comment', 'captcha_lost_password', 'captcha_register' ) );
97 }
98
99 /**
100 * デスクリプション
101 */
102 protected function admin_description(): void {
103 ?>
104 <nav>
105 <ul class="breadcrumb">
106 <li class="breadcrumb__list"><a href="?page=cloudsecurewp">ダッシュボード</a></li>
107 <li class="breadcrumb__list">画像認証追加</li>
108 </ul>
109 </nav>
110 <div class="title-block mb-12">
111 <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/captcha.php">こちら</a></p>
112 <h1 class="title-block-title">画像認証追加</h1>
113 </div>
114 <div class="title-bottom-text">
115 画像データ上にランダムに表示される文字の�
116 �力を求め、一致しなければ次の画面に進めないようにする機能です。
117 </div>
118 <?php
119 }
120
121
122
123 /**
124 * ページコンテンツ
125 */
126 protected function page(): void {
127 ?>
128 <form method="post">
129 <div class="enabled-or-disabled">
130 <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="captcha" value="t" <?php echo esc_html( $this->datas['captcha_t'] ?? '' ); ?> /><label for="enabled">有効</label>
131 <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="captcha" value="f" <?php echo esc_html( $this->datas['captcha_f'] ?? '' ); ?> /><label for="disabled">無効</label>
132 </div>
133 <div class="box">
134 <div class="box-bottom">
135 <div class="box-row flex-start">
136 <div class="box-row-title not-label">ログインフォーム</div>
137 <div class="box-row-content radio-btns">
138 <input type="radio" class="circle-radio" id="captcha_login-on" name="captcha_login" value="<?php echo esc_attr( $this->constant_settings['captcha_login'][1] ); ?>" <?php echo esc_html( $this->datas[ 'captcha_login_' . $this->constant_settings['captcha_login'][1] ] ?? '' ); ?> /><label for="captcha_login-on">有効</label><br />
139 <input type="radio" class="circle-radio" id="captcha_login-off" name="captcha_login" value="<?php echo esc_attr( $this->constant_settings['captcha_login'][0] ); ?>" <?php echo esc_html( $this->datas[ 'captcha_login_' . $this->constant_settings['captcha_login'][0] ] ?? '' ); ?> /><label for="captcha_login-off">無効</label>
140 </div>
141 </div>
142 <div class="box-row flex-start">
143 <div class="box-row-title not-label">コメントフォーム</div>
144 <div class="box-row-content radio-btns">
145 <input type="radio" id="captcha_comment-on" class="circle-radio" name="captcha_comment" value="<?php echo esc_attr( $this->constant_settings['captcha_comment'][1] ); ?>" <?php echo esc_html( $this->datas[ 'captcha_comment_' . $this->constant_settings['captcha_comment'][1] ] ?? '' ); ?> /><label for="captcha_comment-on">有効</label><br />
146 <input type="radio" id="captcha_comment-off" class="circle-radio" name="captcha_comment" value="<?php echo esc_attr( $this->constant_settings['captcha_comment'][0] ); ?>" <?php echo esc_html( $this->datas[ 'captcha_comment_' . $this->constant_settings['captcha_comment'][0] ] ?? '' ); ?> /><label for="captcha_comment-off">無効</label>
147 </div>
148 </div>
149 <div class="box-row flex-start">
150 <div class="box-row-title not-label">パスワードリセットフォーム</div>
151 <div class="box-row-content radio-btns">
152 <input type="radio" id="captcha_lost_password-on" class="circle-radio" name="captcha_lost_password" value="<?php echo esc_attr( $this->constant_settings['captcha_lost_password'][1] ); ?>" <?php echo esc_html( $this->datas[ 'captcha_lost_password_' . $this->constant_settings['captcha_lost_password'][1] ] ?? '' ); ?> /><label for="captcha_lost_password-on">有効</label><br />
153 <input type="radio" id="captcha_lost_password-off" class="circle-radio" name="captcha_lost_password" value="<?php echo esc_attr( $this->constant_settings['captcha_lost_password'][0] ); ?>" <?php echo esc_html( $this->datas[ 'captcha_lost_password_' . $this->constant_settings['captcha_lost_password'][0] ] ?? '' ); ?> /><label for="captcha_lost_password-off">無効</label>
154 </div>
155 </div>
156 <div class="box-row flex-start">
157 <div class="box-row-title not-label">ユーザー登録フォーム</div>
158 <div class="box-row-content radio-btns">
159 <input type="radio" id="captcha_register-on" class="circle-radio" name="captcha_register" value="<?php echo esc_attr( $this->constant_settings['captcha_register'][1] ); ?>" <?php echo esc_html( $this->datas[ 'captcha_register_' . $this->constant_settings['captcha_register'][1] ] ?? '' ); ?> /><label for="captcha_register-on">有効</label><br />
160 <input type="radio" id="captcha_register-off" class="circle-radio" name="captcha_register" value="<?php echo esc_attr( $this->constant_settings['captcha_register'][0] ); ?>" <?php echo esc_html( $this->datas[ 'captcha_register_' . $this->constant_settings['captcha_register'][0] ] ?? '' ); ?> /><label for="captcha_register-off">無効</label>
161 </div>
162 </div>
163 </div>
164 </div>
165 <div id="submit-btn-area">
166 <?php $this->nonce_wp( $this->captcha->get_feature_key() ); ?>
167 <?php $this->submit_button_wp(); ?>
168 </div>
169 </form>
170 <?php
171 }
172 }
173