PluginProbe ʕ •ᴥ•ʔ
SiteGuard WP Plugin / 1.8.7
SiteGuard WP Plugin v1.8.7
1.8.7 1.8.6 1.8.6-beta1 1.8.6-beta2 1.8.4 1.8.5 1.8.3 1.8.2 1.8.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.4.3 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.11 1.7.12 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.0-beta1 1.8.0-beta2 1.8.0-beta3 1.8.0-beta4
siteguard / admin / siteguard-menu-login-alert.php
siteguard / admin Last commit date
siteguard-login-history-table.php 1 month ago siteguard-menu-admin-filter.php 4 weeks ago siteguard-menu-author-query.php 2 weeks ago siteguard-menu-captcha.php 4 weeks ago siteguard-menu-dashboard.php 4 weeks ago siteguard-menu-fail-once.php 4 weeks ago siteguard-menu-init.php 1 month ago siteguard-menu-login-alert.php 4 weeks ago siteguard-menu-login-history.php 4 weeks ago siteguard-menu-login-lock.php 4 weeks ago siteguard-menu-protect-xmlrpc.php 4 weeks ago siteguard-menu-rename-login.php 2 weeks ago siteguard-menu-same-error.php 4 weeks ago siteguard-menu-updates-notify.php 4 weeks ago siteguard-menu-waf-tuning-support.php 4 weeks ago siteguard-waf-exclude-rule-table.php 1 month ago
siteguard-menu-login-alert.php
123 lines
1 <?php
2
3 class SiteGuard_Menu_Login_Alert extends SiteGuard_Base {
4 const OPT_NAME_FEATURE = 'loginalert_enable';
5 const OPT_NAME_SUBJECT = 'loginalert_subject';
6 const OPT_NAME_BODY = 'loginalert_body';
7 const OPT_NAME_ADMIN = 'loginalert_admin_only';
8
9 function __construct() {
10 $this->render_page();
11 }
12 function render_page() {
13 global $siteguard_config;
14
15 $opt_val_feature = $siteguard_config->get( self::OPT_NAME_FEATURE );
16 $opt_val_subject = $siteguard_config->get( self::OPT_NAME_SUBJECT );
17 $opt_val_body = $siteguard_config->get( self::OPT_NAME_BODY );
18 $opt_val_admin = $siteguard_config->get( self::OPT_NAME_ADMIN );
19 if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-login-alert-submit' ) ) {
20 $error = false;
21 $errors = siteguard_check_multisite();
22 if ( is_wp_error( $errors ) ) {
23 echo '<div class="error settings-error"><p><strong>';
24 echo esc_html( $errors->get_error_message() );
25 echo '</strong></p></div>';
26 $error = true;
27 }
28 if ( false === $error && false === $this->is_switch_value( $_POST[ self::OPT_NAME_FEATURE ] ) ) {
29 echo '<div class="error settings-error"><p><strong>';
30 esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
31 echo '</strong></p></div>';
32 $error = true;
33 }
34 if ( false === $error ) {
35 $opt_val_feature = sanitize_text_field( $_POST[ self::OPT_NAME_FEATURE ] );
36 $opt_val_subject = sanitize_text_field( $_POST[ self::OPT_NAME_SUBJECT ] );
37 $opt_val_body = $_POST[ self::OPT_NAME_BODY ];
38 $opt_val_body = str_replace( '%DA', 'PERCENT_DA', $opt_val_body );
39 $opt_val_body = sanitize_textarea_field( $opt_val_body );
40 $opt_val_body = str_replace( 'PERCENT_DA', '%DA', $opt_val_body );
41 if ( isset( $_POST[ self::OPT_NAME_ADMIN ] ) ) {
42 $opt_val_admin = '1';
43 } else {
44 $opt_val_admin = '0';
45 }
46 $siteguard_config->set( self::OPT_NAME_FEATURE, $opt_val_feature );
47 $siteguard_config->set( self::OPT_NAME_SUBJECT, $opt_val_subject );
48 $siteguard_config->set( self::OPT_NAME_BODY, $opt_val_body );
49 $siteguard_config->set( self::OPT_NAME_ADMIN, $opt_val_admin );
50 $siteguard_config->update();
51 ?>
52 <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
53 <?php
54 }
55 }
56
57 echo '<div class="wrap">';
58 echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
59 echo '<h2>' . esc_html__( 'Login Alert', 'siteguard' ) . '</h2>';
60 $documentation_link = '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/login_alert/', 'siteguard' ) ) . '" target="_blank">' . esc_html__( 'online documentation', 'siteguard' ) . '</a>';
61 echo '<div class="siteguard-description">'
62 . sprintf(
63 /* translators: %1$s: Link to the online documentation. */
64 esc_html__( 'See the %1$s.', 'siteguard' ),
65 $documentation_link
66 )
67 . '</div>';
68 ?>
69 <form name="form1" method="post" action="">
70 <table class="form-table">
71 <tr>
72 <th scope="row" colspan="2">
73 <ul class="siteguard-radios">
74 <li>
75 <input type="radio" name="<?php echo self::OPT_NAME_FEATURE; ?>" id="<?php echo self::OPT_NAME_FEATURE . '_on'; ?>" value="1" <?php checked( $opt_val_feature, '1' ); ?> >
76 <label for="<?php echo self::OPT_NAME_FEATURE . '_on'; ?>"><?php echo esc_html_e( 'ON', 'siteguard' ); ?></label>
77 </li><li>
78 <input type="radio" name="<?php echo self::OPT_NAME_FEATURE; ?>" id="<?php echo self::OPT_NAME_FEATURE . '_off'; ?>" value="0" <?php checked( $opt_val_feature, '0' ); ?> >
79 <label for="<?php echo self::OPT_NAME_FEATURE . '_off'; ?>"><?php echo esc_html_e( 'OFF', 'siteguard' ); ?></label>
80 </li>
81 </ul>
82 <?php
83 $error = siteguard_check_multisite();
84 if ( is_wp_error( $error ) ) {
85 echo '<p class="description">';
86 echo esc_html( $error->get_error_message() );
87 echo '</p>';
88 }
89 ?>
90 </th>
91 </tr><tr>
92 <th scope="row"><label for="<?php echo self::OPT_NAME_SUBJECT; ?>"><?php esc_html_e( 'Subject', 'siteguard' ); ?></label></th>
93 <td>
94 <input type="text" name="<?php echo self::OPT_NAME_SUBJECT; ?>" id="<?php echo self::OPT_NAME_SUBJECT; ?>" size="50" value="<?php echo esc_attr( $opt_val_subject ); ?>" >
95 </td>
96 </tr><tr>
97 <th scope="row"><label for="<?php echo self::OPT_NAME_BODY; ?>"><?php esc_html_e( 'Body', 'siteguard' ); ?></label></th>
98 <td>
99 <textarea name="<?php echo self::OPT_NAME_BODY; ?>" id="<?php echo self::OPT_NAME_BODY; ?>" cols="50" rows="5" ><?php echo esc_textarea( $opt_val_body ); ?></textarea>
100 </td>
101 </tr><tr>
102 <th scope="row"><?php esc_html_e( 'Recipients', 'siteguard' ); ?></th>
103 <td>
104 <input type="checkbox" name="<?php echo self::OPT_NAME_ADMIN; ?>" id="<?php echo self::OPT_NAME_ADMIN; ?>" value="1" <?php checked( $opt_val_admin, '1' ); ?> >
105 <label for="<?php echo self::OPT_NAME_ADMIN; ?>"><?php esc_html_e( 'Admin only', 'siteguard' ); ?></label>
106 </td>
107 </tr>
108 </table>
109 <input type="hidden" name="update" value="Y">
110 <div class="siteguard-description">
111 <?php esc_html_e( 'Sends an email notification when a user logs in, helping you notice unauthorized logins. If you receive a login alert for a login you do not recognize, check the account immediately. The subject and body can use these variables: Site Name:%SITENAME%, User Name:%USERNAME%, Date:%DATE%, Time:%TIME%, IP Address:%IPADDRESS%, User-Agent:%USERAGENT%, Referer:%REFERER%. XML-RPC logins are not reported.', 'siteguard' ); ?>
112 </div>
113 <hr />
114 <?php
115 wp_nonce_field( 'siteguard-menu-login-alert-submit' );
116 submit_button();
117 ?>
118 </form>
119 </div>
120 <?php
121 }
122 }
123