mirror of
https://gh.wpcy.net/https://github.com/webguyio/stop-spammers-classic.git
synced 2026-07-14 21:16:59 +08:00
264 lines
No EOL
10 KiB
PHP
264 lines
No EOL
10 KiB
PHP
<?php
|
|
|
|
if ( !defined( 'ABSPATH' ) ) {
|
|
status_header( 404 );
|
|
exit;
|
|
}
|
|
|
|
if ( !current_user_can( 'manage_options' ) ) {
|
|
die( 'Access Blocked' );
|
|
}
|
|
|
|
ss_fix_post_vars();
|
|
$stats = ss_get_stats();
|
|
extract( $stats );
|
|
$now = gmdate( 'Y/m/d H:i:s', time() + ( get_option( 'gmt_offset' ) * 3600 ) );
|
|
$options = ss_get_options();
|
|
extract( $options );
|
|
$stats = ss_get_stats();
|
|
extract( $stats );
|
|
$trash = SS_PLUGIN_URL . 'images/trash.png';
|
|
$tdown = SS_PLUGIN_URL . 'images/tdown.png';
|
|
$tup = SS_PLUGIN_URL . 'images/tup.png'; // fix this
|
|
$whois = SS_PLUGIN_URL . 'images/whois.png'; // fix this
|
|
$chkcloudflare = 'Y'; // force back to on - always fix Cloudflare if the plugin is not present and Cloudflare detected
|
|
$nonce = '';
|
|
$ajaxurl = admin_url( 'admin-ajax.php' );
|
|
|
|
// update options
|
|
if ( array_key_exists( 'ss_stop_spammers_control', $_POST ) ) {
|
|
$nonce = sanitize_text_field( wp_unslash( $_POST['ss_stop_spammers_control'] ) );
|
|
}
|
|
|
|
if ( !empty( $nonce ) && wp_verify_nonce( $nonce, 'ss_stopspam_update' ) ) {
|
|
if ( array_key_exists( 'ss_stop_clear_wlreq', $_POST ) ) {
|
|
$wlrequests = array();
|
|
$stats['wlrequests'] = $wlrequests;
|
|
ss_set_stats( $stats );
|
|
}
|
|
if ( array_key_exists( 'wlist', $_POST ) && !array_key_exists( 'ss_stop_clear_wlreq', $_POST ) ) {
|
|
$raw_input = sanitize_textarea_field( wp_unslash( $_POST['wlist'] ) );
|
|
$wlist = preg_split( '/\s+/', $raw_input, -1, PREG_SPLIT_NO_EMPTY );
|
|
$wlist = array_map( 'sanitize_text_field', $wlist );
|
|
$wlist = array_filter( $wlist );
|
|
$options['wlist'] = $wlist;
|
|
}
|
|
if ( !array_key_exists( 'ss_stop_clear_wlreq', $_POST ) ) {
|
|
$optionlist = array(
|
|
'chkgoogle',
|
|
'chkaws',
|
|
'chkwluserid',
|
|
'chkpaypal',
|
|
'chkstripe',
|
|
'chkauthorizenet',
|
|
'chkbraintree',
|
|
'chkrecurly',
|
|
'chksquare',
|
|
'chkgenallowlist',
|
|
'chkmiscallowlist',
|
|
'chkyahoomerchant'
|
|
);
|
|
foreach ( $optionlist as $check ) {
|
|
$v = 'N';
|
|
if ( array_key_exists( $check, $_POST ) ) {
|
|
$v = sanitize_text_field( wp_unslash( $_POST[$check] ) );
|
|
if ( $v != 'Y' ) {
|
|
$v = 'N';
|
|
}
|
|
}
|
|
$options[$check] = $v;
|
|
}
|
|
ss_set_options( $options );
|
|
}
|
|
extract( $options ); // extract again to get the new options
|
|
$msg = '<div class="notice notice-success is-dismissible"><p>Options Updated</p></div>';
|
|
}
|
|
|
|
$nonce = wp_create_nonce( 'ss_stopspam_update' );
|
|
|
|
?>
|
|
|
|
<div id="ss-plugin" class="wrap">
|
|
<h1 class="ss_head"><img src="<?php echo esc_url( plugin_dir_url( dirname( __FILE__ ) ) . 'images/stop-spammers-icon.png' ); ?>" class="ss_icon">Allow Requests & Lists</h1>
|
|
<?php if ( !empty( $msg ) ) {
|
|
echo wp_kses_post( $msg );
|
|
} ?>
|
|
<br>
|
|
<br>
|
|
<div class="mainsection">Allow List Requests
|
|
<sup class="ss_sup"><a href="https://github.com/webguyio/stop-spammers/wiki/Docs:-Allow-Requests-&-Lists#allow-requests" target="_blank">?</a></sup>
|
|
</div>
|
|
<?php
|
|
if ( count( $wlrequests ) == 0 ) {
|
|
echo '<p><strong>There are currently no pending requests.</strong></p>';
|
|
} else { ?>
|
|
<form method="post" action="">
|
|
<input type="hidden" name="ss_stop_spammers_control" value="<?php echo esc_html( $nonce ); ?>">
|
|
<input type="hidden" name="ss_stop_clear_wlreq" value="true">
|
|
<p class="submit"><input class="button-primary" value="Clear the Requests" type="submit"></p>
|
|
</form>
|
|
<table id="sstable" name="sstable" cellspacing="2">
|
|
<thead>
|
|
<tr style="background-color:#4aa863;color:white;text-align:center;text-transform:uppercase;font-weight:600">
|
|
<th><?php echo 'Time'; ?></th>
|
|
<th><?php echo 'IP'; ?></th>
|
|
<th><?php echo 'Email'; ?></th>
|
|
<th><?php echo 'Reason'; ?></th>
|
|
<th><?php echo 'Message'; ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="wlreq">
|
|
<?php
|
|
$allowed_html = array(
|
|
'table' => array(
|
|
'id' => array(),
|
|
'name' => array(),
|
|
'cellspacing' => array(),
|
|
),
|
|
'thead' => array(),
|
|
'tr' => array(
|
|
'class' => array(),
|
|
'style' => array(),
|
|
),
|
|
'th' => array(
|
|
'style' => array(),
|
|
),
|
|
'tbody' => array(
|
|
'id' => array(),
|
|
),
|
|
'td' => array(
|
|
'class' => array(),
|
|
'style' => array(),
|
|
),
|
|
'a' => array(
|
|
'href' => array(),
|
|
'onclick' => array(),
|
|
'title' => array(),
|
|
'alt' => array(),
|
|
),
|
|
'img' => array(
|
|
'class' => array(),
|
|
'src' => array(),
|
|
'alt' => array(),
|
|
),
|
|
);
|
|
$show = '';
|
|
$cont = 'wlreqs';
|
|
// wlrequs has an array of arrays
|
|
// time, ip, email, author, reason, info, sname
|
|
// time, ip, email, author, reason, info, sname
|
|
// use the be_load to get badips
|
|
$options = ss_get_options();
|
|
$stats = ss_get_stats();
|
|
$show = be_load( 'ss_get_alreq', 'x', $stats, $options );
|
|
echo wp_kses( $show, $allowed_html );
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<?php } ?>
|
|
<form method="post" action="">
|
|
<input type="hidden" name="action" value="update">
|
|
<input type="hidden" name="ss_stop_spammers_control" value="<?php echo esc_html( $nonce ); ?>">
|
|
<div class="mainsection">Personalized Allow List
|
|
<sup class="ss_sup"><a href="https://github.com/webguyio/stop-spammers/wiki/Docs:-Allow-Requests-&-Lists#personalized-allow-list" target="_blank">?</a></sup>
|
|
</div>
|
|
<?php echo '
|
|
<p>Put IP addresses or emails here that you don\'t want blocked.
|
|
One email or IP to a line. You can use wild cards here for
|
|
emails. These are checked first so they override any blocking.</p>
|
|
'; ?>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkwluserid">
|
|
<input class="ss_toggle" type="checkbox" id="chkwluserid" name="chkwluserid" value="Y" <?php if ( $chkwluserid == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Enable Allow by Username (not recommended)</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<textarea name="wlist" cols="40" rows="8"><?php
|
|
echo esc_textarea( implode( "\n", $wlist ) );
|
|
?></textarea>
|
|
<br>
|
|
<div class="mainsection">Allow Options
|
|
<sup class="ss_sup"><a href="https://github.com/webguyio/stop-spammers/wiki/Docs:-Allow-Requests-&-Lists#allow-options" target="_blank">?</a></sup>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkgoogle">
|
|
<input class="ss_toggle" type="checkbox" id="chkgoogle" name="chkgoogle" value="Y" <?php if ( $chkgoogle == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Google (keep enabled under most circumstances)</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkgenallowlist">
|
|
<input class="ss_toggle" type="checkbox" id="chkgenallowlist" name="chkgenallowlist" value="Y" <?php if ( $chkgenallowlist == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Generated Allow List</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkmiscallowlist">
|
|
<input class="ss_toggle" type="checkbox" id="chkmiscallowlist" name="chkmiscallowlist" value="Y" <?php if ( $chkmiscallowlist == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Other Allow Lists</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkpaypal">
|
|
<input class="ss_toggle" type="checkbox" id="chkpaypal" name="chkpaypal" value="Y" <?php if ( $chkpaypal == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Allow PayPal</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkstripe">
|
|
<input class="ss_toggle" type="checkbox" id="chkstripe" name="chkstripe" value="Y" <?php if ( $chkstripe == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Allow Stripe</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkauthorizenet">
|
|
<input class="ss_toggle" type="checkbox" id="chkauthorizenet" name="chkauthorizenet" value="Y" <?php if ( $chkauthorizenet == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Allow Authorize.Net</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkbraintree">
|
|
<input class="ss_toggle" type="checkbox" id="chkbraintree" name="chkbraintree" value="Y" <?php if ( $chkbraintree == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Allow Braintree</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkrecurly">
|
|
<input class="ss_toggle" type="checkbox" id="chkrecurly" name="chkrecurly" value="Y" <?php if ( $chkrecurly == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Allow Recurly</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chksquare">
|
|
<input class="ss_toggle" type="checkbox" id="chksquare" name="chksquare" value="Y" <?php if ( $chksquare == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Allow Square</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkyahoomerchant">
|
|
<input class="ss_toggle" type="checkbox" id="chkyahoomerchant" name="chkyahoomerchant" value="Y" <?php if ( $chkyahoomerchant == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Allow Yahoo Merchant</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<div class="checkbox switcher">
|
|
<label id="ss_subhead" for="chkaws">
|
|
<input class="ss_toggle" type="checkbox" id="chkaws" name="chkaws" value="Y" <?php if ( $chkaws == 'Y' ) { echo 'checked="checked"'; } ?>><span><small></small></span>
|
|
<small><span style="font-size:16px!important">Allow Amazon Cloud</span></small>
|
|
</label>
|
|
</div>
|
|
<br>
|
|
<p class="submit"><input class="button-primary" value="Save Changes" type="submit"></p>
|
|
</form>
|
|
</div>
|