PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.3.22
CloudSecure WP Security v1.3.22
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 1 year ago common.php 1 year ago dashboard.php 1 year ago disable-access-system-file.php 7 months ago disable-author-query.php 1 year ago disable-login.php 1 year ago disable-restapi.php 1 year ago disable-xmlrpc.php 1 year ago login-log-table.php 1 year ago login-log.php 1 year ago login-notification.php 1 year ago rename-login-page.php 1 year ago restrict-admin-page.php 1 year ago server-error-notification.php 1 year ago server-error-table.php 1 year ago two-factor-authentication-registration.php 2 years ago two-factor-authentication.php 1 year ago unify-messages.php 1 year ago update-notice.php 1 year ago waf-table.php 1 year ago waf.php 7 months ago
captcha.php
174 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 ( '$tmp' === $tmp ) {
41 $environment_error = $this->captcha->check_modules();
42
43 if ( '' !== $environment_error ) {
44 $this->errors[] = $environment_error;
45 $tmp = 'f';
46 }
47 }
48
49 $this->datas[ $key ] = $tmp;
50 break;
51
52 case 'captcha_login':
53 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
54 if ( ! $this->is_selected( $tmp, $this->constant_settings['captcha_login'] ) ) {
55 $this->errors[] = 'ログインフォームの値が不正です';
56 }
57 $this->datas[ $key ] = $tmp;
58 break;
59
60 case 'captcha_comment':
61 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
62 if ( ! $this->is_selected( $tmp, $this->constant_settings['captcha_comment'] ) ) {
63 $this->errors[] = 'コメントフォームの値が不正です';
64 }
65 $this->datas[ $key ] = $tmp;
66 break;
67
68 case 'captcha_lost_password':
69 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
70 if ( ! $this->is_selected( $tmp, $this->constant_settings['captcha_lost_password'] ) ) {
71 $this->errors[] = 'パスワードリセットフォームフォームの値が不正です';
72 }
73 $this->datas[ $key ] = $tmp;
74 break;
75
76 case 'captcha_register':
77 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
78 if ( ! $this->is_selected( $tmp, $this->constant_settings['captcha_register'] ) ) {
79 $this->errors[] = 'ユーザー登録フォームフォームの値が不正です';
80 }
81 $this->datas[ $key ] = $tmp;
82 break;
83 }
84 }
85
86 if ( empty( $this->errors ) ) {
87 if ( 't' === $this->datas['captcha'] ) {
88 $this->messages[] = '画像認証追加機能が有効になりました。';
89 } else {
90 $this->messages[] = '画像認証追加機能が無効になりました。';
91 }
92
93 $this->captcha->save_settings( $this->datas );
94 }
95 }
96
97 $this->datas = $this->get_checked( $this->datas, array( 'captcha', 'captcha_login', 'captcha_comment', 'captcha_lost_password', 'captcha_register' ) );
98 }
99
100 /**
101 * デスクリプション
102 */
103 protected function admin_description(): void {
104 ?>
105 <nav>
106 <ul class="breadcrumb">
107 <li class="breadcrumb__list"><a href="?page=cloudsecurewp">ダッシュボード</a></li>
108 <li class="breadcrumb__list">画像認証追加</li>
109 </ul>
110 </nav>
111 <div class="title-block mb-12">
112 <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>
113 <h1 class="title-block-title">画像認証追加</h1>
114 </div>
115 <div class="title-bottom-text">
116 画像データ上にランダムに表示される文字の�
117 �力を求め、一致しなければ次の画面に進めないようにする機能です。
118 </div>
119 <?php
120 }
121
122
123
124 /**
125 * ページコンテンツ
126 */
127 protected function page(): void {
128 ?>
129 <form method="post">
130 <div class="enabled-or-disabled">
131 <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>
132 <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>
133 </div>
134 <div class="box">
135 <div class="box-bottom">
136 <div class="box-row flex-start">
137 <div class="box-row-title not-label">ログインフォーム</div>
138 <div class="box-row-content radio-btns">
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"><?php echo esc_html( $this->constant_settings['captcha_login'][0] ); ?> 無効</label><br />
140 <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"><?php echo esc_html( $this->constant_settings['captcha_login'][1] ); ?> 有効</label>
141 </div>
142 </div>
143 <div class="box-row flex-start">
144 <div class="box-row-title not-label">コメントフォーム</div>
145 <div class="box-row-content radio-btns">
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"><?php echo esc_html( $this->constant_settings['captcha_comment'][0] ); ?> 無効</label><br />
147 <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"><?php echo esc_html( $this->constant_settings['captcha_comment'][1] ); ?> 有効</label><br />
148 </div>
149 </div>
150 <div class="box-row flex-start">
151 <div class="box-row-title not-label">パスワードリセットフォーム</div>
152 <div class="box-row-content radio-btns">
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"><?php echo esc_html( $this->constant_settings['captcha_lost_password'][0] ); ?> 無効</label><br />
154 <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"><?php echo esc_html( $this->constant_settings['captcha_lost_password'][1] ); ?> 有効</label>
155 </div>
156 </div>
157 <div class="box-row flex-start">
158 <div class="box-row-title not-label">ユーザー登録フォーム</div>
159 <div class="box-row-content radio-btns">
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"><?php echo esc_html( $this->constant_settings['captcha_register'][0] ); ?> 無効</label><br />
161 <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"><?php echo esc_html( $this->constant_settings['captcha_register'][1] ); ?> 有効</label><br />
162 </div>
163 </div>
164 </div>
165 </div>
166 <div id="submit-btn-area">
167 <?php $this->nonce_wp( $this->captcha->get_feature_key() ); ?>
168 <?php $this->submit_button_wp(); ?>
169 </div>
170 </form>
171 <?php
172 }
173 }
174