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
5 months 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
login-log.php
104 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | class CloudSecureWP_Admin_Login_Log extends CloudSecureWP_Admin_Common { |
| 8 | private $login_log; |
| 9 | private $login_log_table; |
| 10 | |
| 11 | function __construct( array $info, CloudSecureWP_Login_Log $login_log ) { |
| 12 | parent::__construct( $info ); |
| 13 | |
| 14 | $this->login_log = $login_log; |
| 15 | $this->login_log_table = new CloudSecureWP_Login_Log_Table( $login_log ); |
| 16 | |
| 17 | $this->prepare_view_data(); |
| 18 | $this->render(); |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * 画面表示用のデータを準備 |
| 23 | */ |
| 24 | public function prepare_view_data(): void { |
| 25 | $conditions = array(); |
| 26 | $referer = wp_get_referer(); |
| 27 | |
| 28 | if ( empty( $referer ) ) { |
| 29 | if ( ! empty( $_POST ) && check_admin_referer( $this->login_log->get_feature_key() . '_csrf' ) ) { |
| 30 | if ( ! empty( $_POST['done'] ?? '' ) ) { |
| 31 | |
| 32 | if ( isset( $_POST['condition_status'] ) && ! empty( $_POST['condition_status'] ) ) { |
| 33 | $conditions['condition_status'] = trim( sanitize_text_field( $_POST['condition_status'] ) ); |
| 34 | } |
| 35 | |
| 36 | if ( isset( $_POST['condition_ip'] ) && ! empty( $_POST['condition_ip'] ) ) { |
| 37 | $conditions['condition_ip'] = trim( sanitize_text_field( $_POST['condition_ip'] ) ); |
| 38 | } |
| 39 | |
| 40 | if ( isset( $_POST['condition_ip_other_than'] ) && ! empty( $_POST['condition_ip_other_than'] ) ) { |
| 41 | $conditions['condition_ip_other_than'] = trim( sanitize_text_field( $_POST['condition_ip_other_than'] ) ); |
| 42 | } |
| 43 | |
| 44 | if ( isset( $_POST['condition_method'] ) && ! empty( $_POST['condition_method'] ) ) { |
| 45 | $conditions['condition_method'] = trim( sanitize_text_field( $_POST['condition_method'] ) ); |
| 46 | } |
| 47 | |
| 48 | if ( isset( $_POST['condition_name'] ) && ! empty( $_POST['condition_name'] ) ) { |
| 49 | $conditions['condition_name'] = trim( sanitize_text_field( $_POST['condition_name'] ) ); |
| 50 | } |
| 51 | |
| 52 | if ( isset( $_POST['condition_name_other_than'] ) && ! empty( $_POST['condition_name_other_than'] ) ) { |
| 53 | $conditions['condition_name_other_than'] = trim( sanitize_text_field( $_POST['condition_name_other_than'] ) ); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } elseif ( false !== strpos( $referer, 'page=cloudsecurewp_login_log' ) ) { |
| 58 | $conditions = $this->login_log_table->get_conditions(); |
| 59 | } |
| 60 | |
| 61 | $this->login_log_table->set_condition( $conditions ); |
| 62 | $this->login_log_table->save_conditions(); |
| 63 | $this->login_log_table->prepare_items(); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * デスクリプション |
| 68 | */ |
| 69 | protected function admin_description(): void { |
| 70 | ?> |
| 71 | <nav> |
| 72 | <ul class="breadcrumb"> |
| 73 | <li class="breadcrumb__list"><a href="?page=cloudsecurewp">ダッシュボード</a></li> |
| 74 | <li class="breadcrumb__list">ログイン履歴</li> |
| 75 | </ul> |
| 76 | </nav> |
| 77 | <div class="title-block mb-12"> |
| 78 | <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/login_log.php">こちら</a></p> |
| 79 | <h1 class="title-block-title">ログイン履歴</h1> |
| 80 | </div> |
| 81 | <div class="title-bottom-text"> |
| 82 | 管理画面にログインした履歴を表示します。 |
| 83 | </div> |
| 84 | <?php |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * ページコンテンツ |
| 89 | */ |
| 90 | protected function page(): void { |
| 91 | ?> |
| 92 | |
| 93 | <form name="frm" method="POST"> |
| 94 | <div id="login-log"> |
| 95 | |
| 96 | <?php $this->login_log_table->display(); ?> |
| 97 | </div> |
| 98 | </form> |
| 99 | |
| 100 | <?php |
| 101 | } |
| 102 | } |
| 103 | |
| 104 |