/home/altere25/infinet.finance/wp-content/plugins/ninjafirewall/lib
Edit: /home/altere25/infinet.finance/wp-content/plugins/ninjafirewall/lib/event_notifications.php (19428B)
' . __('Event Notifications', 'ninjafirewall') . '
';
// Saved ?
if ( isset( $_POST['nfw_options']) ) {
if ( empty($_POST['nfwnonce']) || ! wp_verify_nonce($_POST['nfwnonce'], 'events_save') ) {
wp_nonce_ays('events_save');
}
nf_sub_event_save();
echo '
' . esc_html__('Your changes have been saved.', 'ninjafirewall') . '
';
$nfw_options = nfw_get_option( 'nfw_options' );
}
if (! isset( $nfw_options['a_0'] ) ) {
$nfw_options['a_0'] = 1;
}
?>
0, 1 => 0, 2 => 0, 3 => 0, 5 => 0);
$glob = glob($log_file . "*.php");
if ( is_array($glob)) {
// Parse each log :
foreach($glob as $file) {
// Stat the file; if it's older than 24 hours,
// we don't waste our time to parse it:
$log_stat = stat($file);
if ( $log_stat['mtime'] < $previous_day ) {
continue;
}
$log_lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($log_lines as $line) {
if ( preg_match( '/^\[(\d{10})\]\s+\[.+?\]\s+\[.+?\]\s+\[#\d{7}\]\s+\[\d+\]\s+\[([1235])\]\s+\[/', $line, $match) ) {
// Fetch last 24 hours only :
if ( $match[1] > $previous_day && $match[1] < $previous_day + 86400 ) {
++$logstats[$match[2]];
if ( strpos($line, 'Brute-force attack detected') !== FALSE ) {
++$logstats[0];
}
}
}
}
}
}
return $logstats;
}
// ---------------------------------------------------------------------
function nf_daily_report_email( $logstats ) {
$subject = __('[NinjaFirewall] Daily Activity Report', 'ninjafirewall');
if ( is_multisite() ) {
$url = network_home_url('/');
} else {
$url = home_url('/');
}
if ( preg_match( '`^https?://(.+)/`', $url, $match ) ) {
$subject .= " for {$match[1]}";
}
$message = "\n". sprintf( __('Daily activity report for: %s', 'ninjafirewall'), $url) . "\n";
$message .= __('Date Range Processed: Yesterday', 'ninjafirewall') .", ". ucfirst( date('F j, Y',strtotime("-1 days")) ) ."\n\n";
$message.= __('Blocked threats:', 'ninjafirewall') .' '.
($logstats[1] + $logstats[2] + $logstats[3]) .
' ('. __('critical:', 'ninjafirewall') .' '. $logstats[3] .', '.
__('high:', 'ninjafirewall') .' '. $logstats[2] .', '.
__('medium:', 'ninjafirewall') .' '. $logstats[1] . ")\n";
$message.= __('Blocked brute-force attacks:', 'ninjafirewall') .' '. $logstats[0] ."\n\n";
$message.= __('This notification can be turned off from NinjaFirewall "Event Notifications" page.', 'ninjafirewall') ."\n\n";
$message .= NF_PG_SIGNATURE ."\n\n";
$message .= NF_PG_MORESEC;
nfw_mail( $subject, $message, 'unsubscribe' );
}
// ---------------------------------------------------------------------
// EOF