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
server-error-notification.php
119 lines
| 1 | <?php |
| 2 | |
| 3 | class CloudSecureWP_Admin_Server_Error_Notification extends CloudSecureWP_Admin_Common { |
| 4 | private $server_error_notification; |
| 5 | |
| 6 | function __construct( array $info, CloudSecureWP_Server_Error_Notification $server_error_notification ) { |
| 7 | parent::__construct( $info ); |
| 8 | $this->server_error_notification = $server_error_notification; |
| 9 | $this->prepare_view_data(); |
| 10 | $this->render(); |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * 画面表示用のデータを準備 |
| 15 | */ |
| 16 | public function prepare_view_data(): void { |
| 17 | $this->datas = $this->server_error_notification->get_settings(); |
| 18 | |
| 19 | if ( ! empty( $_POST ) && check_admin_referer( $this->server_error_notification->get_feature_key() . '_csrf' ) ) { |
| 20 | |
| 21 | foreach ( $this->datas as $key => $val ) { |
| 22 | |
| 23 | if ( $key === 'server_error_notification' ) { |
| 24 | $tmp = sanitize_text_field( $_POST[ $key ] ?? '' ); |
| 25 | if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) { |
| 26 | $this->errors[] = '有効・無効の値が不正です'; |
| 27 | } |
| 28 | |
| 29 | if ( ! $this->check_environment() ) { |
| 30 | $tmp = 'f'; |
| 31 | } |
| 32 | |
| 33 | $this->datas[ $key ] = $tmp; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | if ( empty( $this->errors ) ) { |
| 38 | if ( 't' === $this->datas['server_error_notification'] ) { |
| 39 | $this->messages[] = 'サーバーエラー通知機能が有効になりました。'; |
| 40 | } else { |
| 41 | $this->messages[] = 'サーバーエラー通知機能が無効になりました。'; |
| 42 | } |
| 43 | |
| 44 | $enable_email_server_error_notification = sanitize_text_field( $_POST['enable_email_server_error_notification'] ?? 'f' ); |
| 45 | update_option( 'cloudsecurewp_enable_email_server_error_notification', $enable_email_server_error_notification ); |
| 46 | |
| 47 | $this->server_error_notification->save_settings( $this->datas ); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | $this->datas = $this->get_checked( $this->datas, array( 'server_error_notification' ) ); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * デスクリプション |
| 56 | */ |
| 57 | protected function admin_description(): void { |
| 58 | ?> |
| 59 | <div class="title-block mb-12"> |
| 60 | <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/server_error_notification.php">こちら</a></p> |
| 61 | <h1 class="title-block-title">サーバーエラー通知</h1> |
| 62 | </div> |
| 63 | <div class="title-bottom-text"> |
| 64 | サーバーエラー「HTTPステータスコード500(Internal Server Error)」が発生したとき、エラーの履歴を記録し、管理� |
| 65 | にメールで通知します。<br /> |
| 66 | <strong>※機能を有効にした場合のみ、エラーの履歴を記録します。</strong><br /> |
| 67 | 1時間以� |
| 68 | に同じタイプのエラーが発生した場合、エラーの履歴は記録しますが、メールでの通知は行いません。 |
| 69 | </div> |
| 70 | <?php |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * ページコンテンツ |
| 75 | */ |
| 76 | protected function page(): void { |
| 77 | ?> |
| 78 | <form method="post"> |
| 79 | <div class="enabled-or-disabled"> |
| 80 | <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="server_error_notification" value="t" <?php echo esc_html( $this->datas['server_error_notification_t'] ?? '' ); ?> /><label for="enabled">有効</label> |
| 81 | <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="server_error_notification" value="f" <?php echo esc_html( $this->datas['server_error_notification_f'] ?? '' ); ?> /><label for="disabled">無効</label> |
| 82 | </div> |
| 83 | <div class="box"> |
| 84 | <div class="box-bottom"> |
| 85 | <div class="box-row flex-start"> |
| 86 | <div class="box-row-title not-label"> |
| 87 | 通知 |
| 88 | </div> |
| 89 | <div class="box-row-content "> |
| 90 | <input id="enable_email_server_error_notification" class="checkbox" type="checkbox" name="enable_email_server_error_notification" value="t" <?php checked( get_option( 'cloudsecurewp_enable_email_server_error_notification', 't' ), 't' ); ?> /><label for="enable_email_server_error_notification">メールで通知する</label> |
| 91 | </div> |
| 92 | </div> |
| 93 | </div> |
| 94 | </div> |
| 95 | <div id="submit-btn-area"> |
| 96 | <?php $this->nonce_wp( $this->server_error_notification->get_feature_key() ); ?> |
| 97 | <?php $this->submit_button_wp(); ?> |
| 98 | </div> |
| 99 | </form> |
| 100 | <style> |
| 101 | th.column-created_at { |
| 102 | width: 180px; |
| 103 | } |
| 104 | |
| 105 | th.column-type { |
| 106 | width: 200px; |
| 107 | } |
| 108 | |
| 109 | th.column-line { |
| 110 | width: 64px; |
| 111 | } |
| 112 | </style> |
| 113 | <?php |
| 114 | $server_error_table = new CloudSecureWP_Server_Error_Table( $this->server_error_notification ); |
| 115 | $server_error_table->prepare_items(); |
| 116 | $server_error_table->display(); |
| 117 | } |
| 118 | } |
| 119 |