Plugin Directory

Changeset 3276806


Ignore:
Timestamp:
04/18/2025 02:48:45 PM (12 months ago)
Author:
wpiron
Message:

Update: errors & warnings regards DB and variables fixes

Location:
iron-security
Files:
6 edited
26 copied

Legend:

Unmodified
Added
Removed
  • iron-security/tags/2.2.9/README.txt

    r3269182 r3276806  
    55Requires at least: 4.7
    66Tested up to: 6.7
    7 Stable tag: 2.2.8
     7Stable tag: 2.2.9
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    111111== Changelog ==
    112112
     113= 2.2.9 =
     114* Fix warnings & Small errors
     115
    113116= 2.2.8 =
    114117* Update
  • iron-security/tags/2.2.9/admin/classes/tracking-access.php

    r3261056 r3276806  
    1212        if ( preg_match( '/^\/wp-admin\/?$/', $request_uri ) || preg_match( '/^\/wp-login\.php$/', $request_uri ) ) {
    1313            global $wpdb;
    14             $table_name = $wpdb->prefix . 'access_log_wpironis';
     14            $table_name = $wpdb->prefix . 'iron_security_logs';
    1515
    1616            $ip_address = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP );
    1717            $country    = $this->get_country_by_ip( $ip_address );
    18 
    19             $url = esc_url_raw( $_SERVER['REQUEST_URI'] );
    20             $time = current_time( 'mysql' );
     18            $url        = esc_url_raw( $_SERVER['REQUEST_URI'] );
     19            $time       = current_time( 'mysql' );
    2120
    2221            if ( $this->is_ip_blocked( $ip_address ) ) {
    23                 $this->log_blocked_attempt( $ip_address, $url );
     22                $this->log_blocked_attempt( $ip_address, $url, $country );
    2423            } else {
    2524                $wpdb->insert(
    2625                    $table_name,
    2726                    array(
    28                         'time'       => $time,
    29                         'ip_address' => $ip_address,
    30                         'country'    => sanitize_text_field( $country ),
    31                         'url'        => $url,
    32                         'status'     => 'attempt'
     27                        'log_type'     => 'access_attempt',
     28                        'user_id'      => null,
     29                        'username'     => null,
     30                        'ip_address'   => $ip_address,
     31                        'message'      => 'Access attempt to: ' . $url,
     32                        'status'       => 'attempt',
     33                        'date_created' => $time,
     34                        'extra_data'   => maybe_serialize( array(
     35                            'country' => $country,
     36                            'url'     => $url,
     37                        ) ),
    3338                    ),
    34                     array(
    35                         '%s', // time
    36                         '%s', // ip_address
    37                         '%s', // country
    38                         '%s', // url
    39                         '%s'  // status
    40                     )
     39                    array( '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s' )
    4140                );
    4241            }
     
    5857    public function wpironis_access_log_results() {
    5958        global $wpdb;
    60         $table_name = $wpdb->prefix . 'access_log_wpironis';
     59        $table_name = $wpdb->prefix . 'iron_security_logs';
    6160
    62         // SQL query to get the IP address, country, count of attempts, and URL, ordered by the highest number of attempts
    6361        $results = $wpdb->get_results( "
    64             SELECT ip_address, country, url, status, COUNT(*) as attempts
    65             FROM $table_name
    66             GROUP BY ip_address, country, url, status
    67             ORDER BY attempts DESC
    68         " );
     62            SELECT ip_address, status, log_type, COUNT(*) as attempts
     63            FROM $table_name
     64            WHERE log_type IN ('access_attempt', 'blocked_attempt')
     65            GROUP BY ip_address, status, log_type
     66            ORDER BY attempts DESC
     67        " );
    6968
    7069        return $results;
    7170    }
    7271
    73     public function log_blocked_attempt( $ip_address, $url ) {
     72    public function log_blocked_attempt( $ip_address, $url, $country = 'Unknown' ) {
    7473        global $wpdb;
    75         $table_name = $wpdb->prefix . 'access_log_wpironis';
    76 
    77         $country = $this->get_country_by_ip( $ip_address );
    78         $time    = current_time( 'mysql' );
     74        $table_name = $wpdb->prefix . 'iron_security_logs';
     75        $time = current_time( 'mysql' );
    7976
    8077        $wpdb->insert(
    8178            $table_name,
    8279            array(
    83                 'time'       => $time,
    84                 'ip_address' => $ip_address,
    85                 'country'    => $country,
    86                 'url'        => $url,
    87                 'status'     => 'blocked'
    88             )
     80                'log_type'     => 'blocked_attempt',
     81                'user_id'      => null,
     82                'username'     => null,
     83                'ip_address'   => $ip_address,
     84                'message'      => 'Blocked access to: ' . $url,
     85                'status'       => 'blocked',
     86                'date_created' => $time,
     87                'extra_data'   => maybe_serialize( array(
     88                    'country' => $country,
     89                    'url'     => $url,
     90                ) ),
     91            ),
     92            array( '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s' )
    8993        );
    9094    }
  • iron-security/tags/2.2.9/iron-security.php

    r3269182 r3276806  
    1717 * Plugin URI:        https://wpiron.com
    1818 * Description:       Iron Security is a powerful WordPress security plugin to protect your site from common threats. Lock down your site with login protection, file security, and HTTP headers — all in one lightweight plugin.
    19  * Version:           2.2.8
     19 * Version:           2.2.9
    2020 * Author:            wpiron
    2121 * Author URI:        https://wpiron.com/
     
    3131}
    3232
    33 define( 'IRON_SECURITY_VERSION', '2.2.8' );
     33define( 'IRON_SECURITY_VERSION', '2.2.9' );
    3434
    3535function wpiisec_activate_iron_security() {
  • iron-security/tags/2.2.9/public/class-iron-security-public.php

    r3261056 r3276806  
    3535
    3636        // Check XML-RPC
    37         $xmlrcapi = $options['wpironis_disable_xmlrpc'];
     37        $xmlrcapi = $options['wpironis_disable_xmlrpc'] ?? null;
    3838
    3939        if ( isset( $xmlrcapi ) && $xmlrcapi === 1 && defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
  • iron-security/trunk/README.txt

    r3269182 r3276806  
    55Requires at least: 4.7
    66Tested up to: 6.7
    7 Stable tag: 2.2.8
     7Stable tag: 2.2.9
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    111111== Changelog ==
    112112
     113= 2.2.9 =
     114* Fix warnings & Small errors
     115
    113116= 2.2.8 =
    114117* Update
  • iron-security/trunk/admin/classes/tracking-access.php

    r3261056 r3276806  
    1212        if ( preg_match( '/^\/wp-admin\/?$/', $request_uri ) || preg_match( '/^\/wp-login\.php$/', $request_uri ) ) {
    1313            global $wpdb;
    14             $table_name = $wpdb->prefix . 'access_log_wpironis';
     14            $table_name = $wpdb->prefix . 'iron_security_logs';
    1515
    1616            $ip_address = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP );
    1717            $country    = $this->get_country_by_ip( $ip_address );
    18 
    19             $url = esc_url_raw( $_SERVER['REQUEST_URI'] );
    20             $time = current_time( 'mysql' );
     18            $url        = esc_url_raw( $_SERVER['REQUEST_URI'] );
     19            $time       = current_time( 'mysql' );
    2120
    2221            if ( $this->is_ip_blocked( $ip_address ) ) {
    23                 $this->log_blocked_attempt( $ip_address, $url );
     22                $this->log_blocked_attempt( $ip_address, $url, $country );
    2423            } else {
    2524                $wpdb->insert(
    2625                    $table_name,
    2726                    array(
    28                         'time'       => $time,
    29                         'ip_address' => $ip_address,
    30                         'country'    => sanitize_text_field( $country ),
    31                         'url'        => $url,
    32                         'status'     => 'attempt'
     27                        'log_type'     => 'access_attempt',
     28                        'user_id'      => null,
     29                        'username'     => null,
     30                        'ip_address'   => $ip_address,
     31                        'message'      => 'Access attempt to: ' . $url,
     32                        'status'       => 'attempt',
     33                        'date_created' => $time,
     34                        'extra_data'   => maybe_serialize( array(
     35                            'country' => $country,
     36                            'url'     => $url,
     37                        ) ),
    3338                    ),
    34                     array(
    35                         '%s', // time
    36                         '%s', // ip_address
    37                         '%s', // country
    38                         '%s', // url
    39                         '%s'  // status
    40                     )
     39                    array( '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s' )
    4140                );
    4241            }
     
    5857    public function wpironis_access_log_results() {
    5958        global $wpdb;
    60         $table_name = $wpdb->prefix . 'access_log_wpironis';
     59        $table_name = $wpdb->prefix . 'iron_security_logs';
    6160
    62         // SQL query to get the IP address, country, count of attempts, and URL, ordered by the highest number of attempts
    6361        $results = $wpdb->get_results( "
    64             SELECT ip_address, country, url, status, COUNT(*) as attempts
    65             FROM $table_name
    66             GROUP BY ip_address, country, url, status
    67             ORDER BY attempts DESC
    68         " );
     62            SELECT ip_address, status, log_type, COUNT(*) as attempts
     63            FROM $table_name
     64            WHERE log_type IN ('access_attempt', 'blocked_attempt')
     65            GROUP BY ip_address, status, log_type
     66            ORDER BY attempts DESC
     67        " );
    6968
    7069        return $results;
    7170    }
    7271
    73     public function log_blocked_attempt( $ip_address, $url ) {
     72    public function log_blocked_attempt( $ip_address, $url, $country = 'Unknown' ) {
    7473        global $wpdb;
    75         $table_name = $wpdb->prefix . 'access_log_wpironis';
    76 
    77         $country = $this->get_country_by_ip( $ip_address );
    78         $time    = current_time( 'mysql' );
     74        $table_name = $wpdb->prefix . 'iron_security_logs';
     75        $time = current_time( 'mysql' );
    7976
    8077        $wpdb->insert(
    8178            $table_name,
    8279            array(
    83                 'time'       => $time,
    84                 'ip_address' => $ip_address,
    85                 'country'    => $country,
    86                 'url'        => $url,
    87                 'status'     => 'blocked'
    88             )
     80                'log_type'     => 'blocked_attempt',
     81                'user_id'      => null,
     82                'username'     => null,
     83                'ip_address'   => $ip_address,
     84                'message'      => 'Blocked access to: ' . $url,
     85                'status'       => 'blocked',
     86                'date_created' => $time,
     87                'extra_data'   => maybe_serialize( array(
     88                    'country' => $country,
     89                    'url'     => $url,
     90                ) ),
     91            ),
     92            array( '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s' )
    8993        );
    9094    }
  • iron-security/trunk/iron-security.php

    r3269182 r3276806  
    1717 * Plugin URI:        https://wpiron.com
    1818 * Description:       Iron Security is a powerful WordPress security plugin to protect your site from common threats. Lock down your site with login protection, file security, and HTTP headers — all in one lightweight plugin.
    19  * Version:           2.2.8
     19 * Version:           2.2.9
    2020 * Author:            wpiron
    2121 * Author URI:        https://wpiron.com/
     
    3131}
    3232
    33 define( 'IRON_SECURITY_VERSION', '2.2.8' );
     33define( 'IRON_SECURITY_VERSION', '2.2.9' );
    3434
    3535function wpiisec_activate_iron_security() {
  • iron-security/trunk/public/class-iron-security-public.php

    r3261056 r3276806  
    3535
    3636        // Check XML-RPC
    37         $xmlrcapi = $options['wpironis_disable_xmlrpc'];
     37        $xmlrcapi = $options['wpironis_disable_xmlrpc'] ?? null;
    3838
    3939        if ( isset( $xmlrcapi ) && $xmlrcapi === 1 && defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
Note: See TracChangeset for help on using the changeset viewer.