stop-spammers-classic/classes/ss_get_alreq.php
2026-05-11 03:50:05 -06:00

66 lines
No EOL
3.5 KiB
PHP

<?php
// this does the get for the tbody in Allow Requests
if ( !defined( 'ABSPATH' ) ) {
status_header( 404 );
exit;
}
class ss_get_alreq {
public function process( $ip, &$stats = array(), &$options = array(), &$post = array() ) {
extract( $stats );
extract( $options );
$trash = SS_PLUGIN_URL . 'images/trash.png';
$tdown = SS_PLUGIN_URL . 'images/tdown.png';
$tup = SS_PLUGIN_URL . 'images/tup.png';
$whois = SS_PLUGIN_URL . 'images/whois.png';
$ajaxurl = admin_url( 'admin-ajax.php' );
$show = '';
$nwlrequests = array();
// sfs_debug_msg( 'wlrequests ' . print_r( $wlrequests, true ) );
foreach ( $wlrequests as $key => $value ) {
$sw = true;
if ( !empty( $ip ) && $ip != 'x' ) {
if ( $key == $ip ) {
// sfs_debug_msg( "wlreq matched '$ip'" );
$sw = false;
}
if ( $ip == trim( $value[0] ) ) { // match IP
// sfs_debug_msg( "wlreq val 0 '$value[0]'" );
$sw = false;
}
if ( $ip == trim( $value[1] ) ) { // match email
// sfs_debug_msg( "wlreq val 1 '$value[1]'" );
$sw = false;
}
}
$container = 'wlreq';
if ( $sw ) {
$nwlrequests[$key] = $value;
$show .= "<tr style=\"background-color:white\">";
$trsh = "<a href=\"\" onclick=\"sfs_ajax_process('" . esc_js( $key ) . "','wlreq','delete_wl_row','$ajaxurl');return false;\" title=\"Delete row\" alt=\"Delete row\" ><img src=\"$trash\" class=\"icon-action\"></a>";
$addtoblock = "<a href=\"\" onclick=\"sfs_ajax_process('" . esc_js( $value[0] ) . "','$container','add_black','$ajaxurl');return false;\" title=\"Add " . esc_attr( $value[0] ) . " to Block List\" alt=\"Add " . esc_attr( $value[0] ) . " to Block List\" ><img src=\"$tdown\" class=\"icon-action\"></a>";
$addtoallow = "<a href=\"\" onclick=\"sfs_ajax_process('" . esc_js( $value[0] ) . "','$container','add_white','$ajaxurl', '" . esc_js( $value[1] ) . "');return false;\" title=\"Add " . esc_attr( $value[0] ) . " to Allow List\" alt=\"Add " . esc_attr( $value[0] ) . " to Allow List\" ><img src=\"$tup\" class=\"icon-action\"></a>";
$show .= "<td>" . esc_html( $key ) . " $trsh $addtoblock $addtoallow</td>";
$who = "<br><a title=\"Look up WHOIS\" target=\"_stopspam\" href=\"https://whois.domaintools.com/" . esc_attr( $value[0] ) . "\"><img src=\"$whois\" class=\"icon-action\"></a> ";
$trsh = "<a href=\"\" onclick=\"sfs_ajax_process('" . esc_js( $value[0] ) . "','wlreq','delete_wlip','$ajaxurl');return false;\" title=\"Delete all " . esc_attr( $value[0] ) . "\" alt=\"Delete all " . esc_attr( $value[0] ) . "\" ><img src=\"$trash\" class=\"icon-action\"></a>";
$show .= "<td>" . esc_html( $value[0] ) . " $who $trsh</td>";
$trsh = "<a href=\"\" onclick=\"sfs_ajax_process('" . esc_js( $value[1] ) . "','wlreq','delete_wlem','$ajaxurl');return false;\" title=\"Delete all " . esc_attr( $value[1] ) . "\" alt=\"Delete all " . esc_attr( $value[1] ) . "\" ><img src=\"$trash\" class=\"icon-action\"></a>";
$show .= "<td><a target=\"_stopspam\" href=\"mailto:" . esc_attr( $value[1] ) . "?subject=Website Access\">" . esc_html( $value[1] ) . " $trsh</td>";
$show .= "<td>" . esc_html( $value[3] ) . "</td>";
$show .= "<td>" . esc_html( $value[4] ) . "</td>";
$show .= "<tr>";
}
}
$stats['wlrequests'] = $nwlrequests;
// sfs_debug_msg( 'nwlrequests ' . print_r( $nwlrequests, true ) );
if ( array_key_exists( 'addon', $post ) ) {
ss_set_stats( $stats, $post['addon'] );
} else {
ss_set_stats( $stats );
}
return $show;
}
}
?>