captcha.php
1 year ago
common.php
1 year ago
dashboard.php
1 year ago
disable-access-system-file.php
1 year 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
2 years 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
1 year ago
disable-access-system-file.php
97 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | class CloudSecureWP_Admin_Disable_Access_System_File extends CloudSecureWP_Admin_Common { |
| 8 | private $disable_access_system_file; |
| 9 | |
| 10 | function __construct( array $info, CloudSecureWP_Disable_Access_System_File $disable_access_system_file ) { |
| 11 | parent::__construct( $info ); |
| 12 | $this->disable_access_system_file = $disable_access_system_file; |
| 13 | $this->prepare_view_data(); |
| 14 | $this->render(); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * 画面表示用のデータを準備 |
| 19 | */ |
| 20 | public function prepare_view_data(): void { |
| 21 | $this->datas = $this->disable_access_system_file->get_settings(); |
| 22 | |
| 23 | if ( ! empty( $_POST ) && check_admin_referer( $this->disable_access_system_file->get_feature_key() . '_csrf' ) ) { |
| 24 | |
| 25 | foreach ( $this->datas as $key => $val ) { |
| 26 | |
| 27 | switch ( $key ) { |
| 28 | case 'disable_access_system_file': |
| 29 | $tmp = sanitize_text_field( $_POST[ $key ] ?? '' ); |
| 30 | |
| 31 | if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) { |
| 32 | $this->errors[] = '有効・無効の値が不正です'; |
| 33 | } |
| 34 | |
| 35 | if ( ! $this->check_environment() ) { |
| 36 | $tmp = 'f'; |
| 37 | } |
| 38 | |
| 39 | $this->datas[ $key ] = $tmp; |
| 40 | break; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | if ( empty( $this->errors ) ) { |
| 45 | if ( 't' === $this->datas['disable_access_system_file'] ) { |
| 46 | $this->messages[] = '設定ファイルアクセス防止機能が有効になりました。'; |
| 47 | } else { |
| 48 | $this->messages[] = '設定ファイルアクセス防止機能が無効になりました。'; |
| 49 | } |
| 50 | |
| 51 | $this->disable_access_system_file->save_settings( $this->datas ); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | $this->datas = $this->get_checked( $this->datas, array( 'disable_access_system_file' ) ); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * デスクリプション |
| 60 | */ |
| 61 | protected function admin_description(): void { |
| 62 | ?> |
| 63 | <nav> |
| 64 | <ul class="breadcrumb"> |
| 65 | <li class="breadcrumb__list"><a href="?page=cloudsecurewp">ダッシュボード</a></li> |
| 66 | <li class="breadcrumb__list">設定ファイルアクセス防止</li> |
| 67 | </ul> |
| 68 | </nav> |
| 69 | <div class="title-block mb-12"> |
| 70 | <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/disable_access_system_file.php">こちら</a></p> |
| 71 | <h1 class="title-block-title">設定ファイルアクセス防止</h1> |
| 72 | </div> |
| 73 | <div class="title-bottom-text"> |
| 74 | 「wp-config.php」等の設定ファイルへのアクセスを検知すると、403エラー(Foribidden)を返します。 |
| 75 | </div> |
| 76 | <?php |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * ページコンテンツ |
| 81 | */ |
| 82 | protected function page(): void { |
| 83 | ?> |
| 84 | <form method="post"> |
| 85 | <div class="enabled-or-disabled"> |
| 86 | <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="disable_access_system_file" value="t" <?php echo esc_html( $this->datas['disable_access_system_file_t'] ?? '' ); ?> /><label for="enabled">有効</label> |
| 87 | <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="disable_access_system_file" value="f" <?php echo esc_html( $this->datas['disable_access_system_file_f'] ?? '' ); ?> /><label for="disabled">無効</label> |
| 88 | </div> |
| 89 | <div id="submit-btn-area"> |
| 90 | <?php $this->nonce_wp( $this->disable_access_system_file->get_feature_key() ); ?> |
| 91 | <?php $this->submit_button_wp(); ?> |
| 92 | </div> |
| 93 | </form> |
| 94 | <?php |
| 95 | } |
| 96 | } |
| 97 |