Slimstat Analytics - Version 4.1.3.2

Version Description

  • [Fix] A bug was preventing the tracker from correctly determining the country code of a given IP address
Download this release

Release Info

Developer coolmann
Plugin Icon 128x128 Slimstat Analytics
Version 4.1.3.2
Comparing to
See all releases

Code changes from version 4.1.3.1 to 4.1.3.2

admin/view/wp-slimstat-db.php CHANGED
@@ -307,11 +307,11 @@ class wp_slimstat_db {
307
  case 'strtotime':
308
  $custom_date = strtotime( $a_filter[ 3 ], date_i18n( 'U' ) );
309
 
310
- $filters_normalized[ 'date' ][ 'minute' ] = date( 'i', $custom_date );
311
- $filters_normalized[ 'date' ][ 'hour' ] = date( 'H', $custom_date );
312
- $filters_normalized[ 'date' ][ 'day' ] = date( 'j', $custom_date );
313
- $filters_normalized[ 'date' ][ 'month' ] = date( 'n', $custom_date );
314
- $filters_normalized[ 'date' ][ 'year' ] = date( 'Y', $custom_date );
315
  break;
316
 
317
  case 'minute':
@@ -326,25 +326,25 @@ class wp_slimstat_db {
326
  // Try to apply strtotime to value
327
  switch( $a_filter[ 1 ] ) {
328
  case 'minute':
329
- $filters_normalized[ 'date' ][ 'minute' ] = date( 'i', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) );
330
  $filters_normalized[ 'date' ][ 'is_past' ] = true;
331
  break;
332
 
333
  case 'hour':
334
- $filters_normalized[ 'date' ][ 'hour' ] = date( 'H', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) );
335
  $filters_normalized[ 'date' ][ 'is_past' ] = true;
336
  break;
337
 
338
  case 'day':
339
- $filters_normalized[ 'date' ][ 'day' ] = date( 'j', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) );
340
  break;
341
 
342
  case 'month':
343
- $filters_normalized[ 'date' ][ 'month' ] = date( 'n', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) );
344
  break;
345
 
346
  case 'year':
347
- $filters_normalized[ 'date' ][ 'year' ] = date( 'Y', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) );
348
  break;
349
 
350
  default:
307
  case 'strtotime':
308
  $custom_date = strtotime( $a_filter[ 3 ], date_i18n( 'U' ) );
309
 
310
+ $filters_normalized[ 'date' ][ 'minute' ] = intval( date( 'i', $custom_date ) );
311
+ $filters_normalized[ 'date' ][ 'hour' ] = intval( date( 'H', $custom_date ) );
312
+ $filters_normalized[ 'date' ][ 'day' ] = intval( date( 'j', $custom_date ) );
313
+ $filters_normalized[ 'date' ][ 'month' ] = intval( date( 'n', $custom_date ) );
314
+ $filters_normalized[ 'date' ][ 'year' ] = intval( date( 'Y', $custom_date ) );
315
  break;
316
 
317
  case 'minute':
326
  // Try to apply strtotime to value
327
  switch( $a_filter[ 1 ] ) {
328
  case 'minute':
329
+ $filters_normalized[ 'date' ][ 'minute' ] = intval( date( 'i', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) ) );
330
  $filters_normalized[ 'date' ][ 'is_past' ] = true;
331
  break;
332
 
333
  case 'hour':
334
+ $filters_normalized[ 'date' ][ 'hour' ] = intval( date( 'H', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) ) );
335
  $filters_normalized[ 'date' ][ 'is_past' ] = true;
336
  break;
337
 
338
  case 'day':
339
+ $filters_normalized[ 'date' ][ 'day' ] = intval( date( 'j', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) ) );
340
  break;
341
 
342
  case 'month':
343
+ $filters_normalized[ 'date' ][ 'month' ] = intval( date( 'n', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) ) );
344
  break;
345
 
346
  case 'year':
347
+ $filters_normalized[ 'date' ][ 'year' ] = intval( date( 'Y', strtotime( $a_filter[ 3 ], date_i18n( 'U' ) ) ) );
348
  break;
349
 
350
  default:
admin/wp-slimstat-admin.php CHANGED
@@ -506,7 +506,8 @@ class wp_slimstat_admin{
506
  // Change column type to add IPv6 support
507
  $my_wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD ip_temp VARCHAR(39) DEFAULT NULL AFTER id, ADD other_ip_temp VARCHAR(39) DEFAULT NULL AFTER id" );
508
  $my_wpdb->query( "UPDATE {$GLOBALS['wpdb']->prefix}slim_stats SET ip_temp = INET_NTOA(ip), other_ip_temp = INET_NTOA(other_ip)" );
509
- $my_wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats DROP COLUMN ip, DROP COLUMN other_ip" );
 
510
  $my_wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats CHANGE ip_temp ip VARCHAR(39) DEFAULT NULL AFTER id" );
511
  $my_wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats CHANGE other_ip_temp other_ip VARCHAR(39) DEFAULT NULL AFTER ip" );
512
  }
506
  // Change column type to add IPv6 support
507
  $my_wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats ADD ip_temp VARCHAR(39) DEFAULT NULL AFTER id, ADD other_ip_temp VARCHAR(39) DEFAULT NULL AFTER id" );
508
  $my_wpdb->query( "UPDATE {$GLOBALS['wpdb']->prefix}slim_stats SET ip_temp = INET_NTOA(ip), other_ip_temp = INET_NTOA(other_ip)" );
509
+ $my_wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats CHANGE ip ip_num INT UNSIGNED DEFAULT 0" );
510
+ $my_wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats CHANGE other_ip other_ip_num INT UNSIGNED DEFAULT 0" );
511
  $my_wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats CHANGE ip_temp ip VARCHAR(39) DEFAULT NULL AFTER id" );
512
  $my_wpdb->query( "ALTER TABLE {$GLOBALS['wpdb']->prefix}slim_stats CHANGE other_ip_temp other_ip VARCHAR(39) DEFAULT NULL AFTER ip" );
513
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: analytics, tracking, reports, analyze, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
- Stable tag: 4.1.3.1
8
 
9
  == Description ==
10
  [youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
@@ -59,6 +59,9 @@ Our knowledge base is available on our [support center](http://docs.wp-slimstat.
59
 
60
  == Changelog ==
61
 
 
 
 
62
  = 4.1.3.1 =
63
  * [update] Our shortcode now supports an offset for the counters, that allows you to indicate any previous visits not tracked by Slimstat.
64
  * [Update] Session cookie now considers multiple users logged into WordPress using the same browser within the session limit (very rare situation, but apparently not impossible).
4
  Tags: analytics, tracking, reports, analyze, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
+ Stable tag: 4.1.3.2
8
 
9
  == Description ==
10
  [youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
59
 
60
  == Changelog ==
61
 
62
+ = 4.1.3.2 =
63
+ * [Fix] A bug was preventing the tracker from correctly determining the country code of a given IP address
64
+
65
  = 4.1.3.1 =
66
  * [update] Our shortcode now supports an offset for the counters, that allows you to indicate any previous visits not tracked by Slimstat.
67
  * [Update] Session cookie now considers multiple users logged into WordPress using the same browser within the session limit (very rare situation, but apparently not impossible).
wp-slimstat.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Slimstat
4
  Plugin URI: http://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
- Version: 4.1.3.1
7
  Author: Camu
8
  Author URI: http://www.wp-slimstat.com/
9
  */
@@ -11,7 +11,7 @@ Author URI: http://www.wp-slimstat.com/
11
  if ( !empty( wp_slimstat::$options ) ) return true;
12
 
13
  class wp_slimstat {
14
- public static $version = '4.1.3.1';
15
  public static $options = array();
16
 
17
  public static $wpdb = '';
@@ -539,7 +539,7 @@ class wp_slimstat {
539
  * Searches for the country code associated to a given IP address
540
  */
541
  public static function get_country( $_ip_address = '0.0.0.0' ){
542
- $float_ipnum = (float)sprintf( "%u", $_ip_address );
543
  $country_output = 'xx';
544
 
545
  // Is this a RFC1918 (local) IP?
@@ -581,7 +581,7 @@ class wp_slimstat {
581
  }
582
  }
583
 
584
- if ( !empty( $_ip_address ) & ( 1 << $depth ) ) {
585
  if ($x[1] >= 16776960 && !empty($country_codes[$x[1] - 16776960])) {
586
  $country_output = $country_codes[$x[1] - 16776960];
587
  break;
3
  Plugin Name: WP Slimstat
4
  Plugin URI: http://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
+ Version: 4.1.3.2
7
  Author: Camu
8
  Author URI: http://www.wp-slimstat.com/
9
  */
11
  if ( !empty( wp_slimstat::$options ) ) return true;
12
 
13
  class wp_slimstat {
14
+ public static $version = '4.1.3.2';
15
  public static $options = array();
16
 
17
  public static $wpdb = '';
539
  * Searches for the country code associated to a given IP address
540
  */
541
  public static function get_country( $_ip_address = '0.0.0.0' ){
542
+ $float_ipnum = (float) sprintf( "%u", bindec( self::_dtr_pton( $_ip_address ) ) );
543
  $country_output = 'xx';
544
 
545
  // Is this a RFC1918 (local) IP?
581
  }
582
  }
583
 
584
+ if ( $float_ipnum & ( 1 << $depth ) ) {
585
  if ($x[1] >= 16776960 && !empty($country_codes[$x[1] - 16776960])) {
586
  $country_output = $country_codes[$x[1] - 16776960];
587
  break;