iQ Block Country - Version 1.1.28

Version Description

  • Bugfix: Altered mysql_get_client_info check as in some setups this gave a fatal error.
  • New: Added Wordpress Jetpack as search engine. You can allow Jetpack to communicate with your site if you have Jetpack installed.
  • New: Added option to allow admin-ajax.php visits if you use backend blocking.
Download this release

Release Info

Developer iqpascal
Plugin Icon 128x128 iQ Block Country
Version 1.1.28
Comparing to
See all releases

Code changes from version 1.1.27 to 1.1.28

iq-block-country.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: iQ Block Country
4
  Plugin URI: https://www.webence.nl/plugins/iq-block-country-the-wordpress-plugin-that-blocks-countries-for-you/
5
- Version: 1.1.27
6
  Author: Pascal
7
  Author URI: http://www.webence.nl/
8
  Description: Block visitors from visiting your website and backend website based on which country their IP address is from. The Maxmind GeoIP lite database is used for looking up from which country an ip address is from.
@@ -228,7 +228,7 @@ define("GEOIPAPIURL","http://geoip.webence.nl/geoipapi.php");
228
  define("GEOIPAPIURLUS","http://us.geoip.webence.nl/geoipapi.php");
229
  define("GEOIPAPICHECKURL","http://geoip.webence.nl/geoipapi-keycheck.php");
230
  define("ADMINAPICHECKURL","http://tracking.webence.nl/adminapi-keycheck.php");
231
- define("VERSION","1.1.27");
232
  define("DBVERSION","121");
233
  define("PLUGINPATH",plugin_dir_path( __FILE__ ));
234
 
2
  /*
3
  Plugin Name: iQ Block Country
4
  Plugin URI: https://www.webence.nl/plugins/iq-block-country-the-wordpress-plugin-that-blocks-countries-for-you/
5
+ Version: 1.1.28
6
  Author: Pascal
7
  Author URI: http://www.webence.nl/
8
  Description: Block visitors from visiting your website and backend website based on which country their IP address is from. The Maxmind GeoIP lite database is used for looking up from which country an ip address is from.
228
  define("GEOIPAPIURLUS","http://us.geoip.webence.nl/geoipapi.php");
229
  define("GEOIPAPICHECKURL","http://geoip.webence.nl/geoipapi-keycheck.php");
230
  define("ADMINAPICHECKURL","http://tracking.webence.nl/adminapi-keycheck.php");
231
+ define("VERSION","1.1.28");
232
  define("DBVERSION","121");
233
  define("PLUGINPATH",plugin_dir_path( __FILE__ ));
234
 
libs/blockcountry-checks.php CHANGED
@@ -151,6 +151,10 @@ function iqblockcountry_check($country,$badcountries,$ip_address)
151
  if (is_array ( $backendwhitelistip ) && in_array ( $ip_address, $backendwhitelistip)) {
152
  $blocked = FALSE;
153
  }
 
 
 
 
154
  }
155
 
156
  global $post;
@@ -418,5 +422,18 @@ function iqblockcountry_is_admin() {
418
  $pos = strpos( $_SERVER['REQUEST_URI'], '/wp-admin/' );
419
  if ($pos !== false) { $found = TRUE; }
420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  return $found;
422
  }
151
  if (is_array ( $backendwhitelistip ) && in_array ( $ip_address, $backendwhitelistip)) {
152
  $blocked = FALSE;
153
  }
154
+ if (iqblockcountry_is_adminajax() && get_option('blockcountry_adminajax'))
155
+ {
156
+ $blocked = FALSE;
157
+ }
158
  }
159
 
160
  global $post;
422
  $pos = strpos( $_SERVER['REQUEST_URI'], '/wp-admin/' );
423
  if ($pos !== false) { $found = TRUE; }
424
 
425
+ return $found;
426
+ }
427
+
428
+ /*
429
+ * Check if page is within admin-ajax url.
430
+ */
431
+ function iqblockcountry_is_adminajax() {
432
+ $found = FALSE;
433
+
434
+
435
+ $pos = strpos( $_SERVER['REQUEST_URI'], '/wp-admin/admin-ajax.php' );
436
+ if ($pos !== false) { $found = TRUE; }
437
+
438
  return $found;
439
  }
libs/blockcountry-search-engines.php CHANGED
@@ -11,6 +11,7 @@ $searchengines = array(
11
  "Google" => "googlebot",
12
  "Google Ads" => "AdsBot-Google",
13
  "Google Page Speed Insight" => "Google Page Speed Insight",
 
14
  "MSN" => "msnbot",
15
  "TinEye" => "tineye-bot",
16
  "Twitter" => "twitterbot",
11
  "Google" => "googlebot",
12
  "Google Ads" => "AdsBot-Google",
13
  "Google Page Speed Insight" => "Google Page Speed Insight",
14
+ "Jetpack" => "Jetpack by WordPress.com",
15
  "MSN" => "msnbot",
16
  "TinEye" => "tineye-bot",
17
  "Twitter" => "twitterbot",
libs/blockcountry-settings.php CHANGED
@@ -122,6 +122,7 @@ function iqblockcountry_register_mysettings()
122
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_debuglogging');
123
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_accessibility');
124
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_logging');
 
125
  register_setting ( 'iqblockcountry-settings-group-backend', 'blockcountry_blockbackend' );
126
  register_setting ( 'iqblockcountry-settings-group-backend', 'blockcountry_backendbanlist' );
127
  register_setting ( 'iqblockcountry-settings-group-backend', 'blockcountry_backendbanlist_inverse' );
@@ -156,7 +157,7 @@ function iqblockcountry_get_options_arr() {
156
  'blockcountry_blockpages','blockcountry_pages','blockcountry_blockcategories','blockcountry_categories','blockcountry_tracking',
157
  'blockcountry_blockhome','blockcountry_nrstatistics','blockcountry_geoapikey','blockcountry_geoapilocation','blockcountry_apikey',
158
  'blockcountry_redirect','blockcountry_redirect_url','blockcountry_allowse','blockcountry_debuglogging','blockcountry_buffer',
159
- 'blockcountry_accessibility','blockcountry_logging','blockcountry_blockposttypes','blockcountry_posttypes','blockcountry_blocksearch');
160
  return apply_filters( 'iqblockcountry_options', $optarr );
161
  }
162
 
@@ -224,6 +225,7 @@ function iqblockcountry_uninstall() //deletes all the database entries that the
224
  delete_option('blockcountry_blockposttypes');
225
  delete_option('blockcountry_posttypes');
226
  delete_option('blockcountry_blocksearch');
 
227
  }
228
 
229
 
@@ -349,7 +351,7 @@ function iqblockcountry_settings_tools() {
349
  <h3><?php _e('Database Information', 'iq-block-country'); ?></h3>
350
  <table class="widefat">
351
  <tbody><tr><td><?php _e( 'MySQL Database Version', 'iq-block-country' ); ?>: <?php $sqlversion = $wpdb->get_var( "SELECT VERSION() AS version" ); ?><strong><?php echo $sqlversion; ?></strong></td></tr></tbody>
352
- <tbody><tr><td><?php _e( 'MySQL Client Version', 'iq-block-country' ); ?>: <strong><?php echo mysql_get_client_info(); ?></strong></td></tr></tbody>
353
  <tbody><tr><td><?php _e( 'Database Host', 'iq-block-country' ); ?>: <strong><?php echo DB_HOST; ?></strong></td></tr></tbody>
354
  <?php $mysqlinfo = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
355
  if ( is_array( $mysqlinfo ) ) {
@@ -1229,7 +1231,16 @@ if (is_file ( IPV4DBFILE ) && (!get_option('blockcountry_geoapikey'))) {
1229
  <td width="70%">
1230
  <input type="checkbox" name="blockcountry_logging" <?php checked('on', get_option('blockcountry_logging'), true); ?> />
1231
  </td></tr>
1232
-
 
 
 
 
 
 
 
 
 
1233
 
1234
  <tr valign="top">
1235
  <th width="30%"><?php _e('Number of rows on statistics page:', 'iq-block-country'); ?><br />
122
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_debuglogging');
123
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_accessibility');
124
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_logging');
125
+ register_setting ( 'iqblockcountry-settings-group', 'blockcountry_adminajax');
126
  register_setting ( 'iqblockcountry-settings-group-backend', 'blockcountry_blockbackend' );
127
  register_setting ( 'iqblockcountry-settings-group-backend', 'blockcountry_backendbanlist' );
128
  register_setting ( 'iqblockcountry-settings-group-backend', 'blockcountry_backendbanlist_inverse' );
157
  'blockcountry_blockpages','blockcountry_pages','blockcountry_blockcategories','blockcountry_categories','blockcountry_tracking',
158
  'blockcountry_blockhome','blockcountry_nrstatistics','blockcountry_geoapikey','blockcountry_geoapilocation','blockcountry_apikey',
159
  'blockcountry_redirect','blockcountry_redirect_url','blockcountry_allowse','blockcountry_debuglogging','blockcountry_buffer',
160
+ 'blockcountry_accessibility','blockcountry_logging','blockcountry_blockposttypes','blockcountry_posttypes','blockcountry_blocksearch','blockcountry_adminajax');
161
  return apply_filters( 'iqblockcountry_options', $optarr );
162
  }
163
 
225
  delete_option('blockcountry_blockposttypes');
226
  delete_option('blockcountry_posttypes');
227
  delete_option('blockcountry_blocksearch');
228
+ delete_option('blockcountry_adminajax');
229
  }
230
 
231
 
351
  <h3><?php _e('Database Information', 'iq-block-country'); ?></h3>
352
  <table class="widefat">
353
  <tbody><tr><td><?php _e( 'MySQL Database Version', 'iq-block-country' ); ?>: <?php $sqlversion = $wpdb->get_var( "SELECT VERSION() AS version" ); ?><strong><?php echo $sqlversion; ?></strong></td></tr></tbody>
354
+ <tbody><tr><td><?php _e( 'MySQL Client Version', 'iq-block-country' ); ?>: <strong><?php echo $wpdb->db_version(); ?></strong></td></tr></tbody>
355
  <tbody><tr><td><?php _e( 'Database Host', 'iq-block-country' ); ?>: <strong><?php echo DB_HOST; ?></strong></td></tr></tbody>
356
  <?php $mysqlinfo = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
357
  if ( is_array( $mysqlinfo ) ) {
1231
  <td width="70%">
1232
  <input type="checkbox" name="blockcountry_logging" <?php checked('on', get_option('blockcountry_logging'), true); ?> />
1233
  </td></tr>
1234
+
1235
+ <tr valign="top">
1236
+ <th width="30%"><?php _e('Do not block admin-ajax.php:', 'iq-block-country'); ?><br />
1237
+ <em><?php _e('Check this box if you use a plugin that uses admin-ajax.php.', 'iq-block-country'); ?></em></th>
1238
+ <td width="70%">
1239
+ <input type="checkbox" name="blockcountry_adminajax" <?php checked('on', get_option('blockcountry_adminajax'), true); ?> />
1240
+ </td></tr>
1241
+
1242
+
1243
+
1244
 
1245
  <tr valign="top">
1246
  <th width="30%"><?php _e('Number of rows on statistics page:', 'iq-block-country'); ?><br />
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.webence.nl/plugins/donate
4
  Tags: spam, block, country, comments, ban, geo, geo blocking, geo ip, block country, block countries, ban countries, ban country, blacklist, whitelist, security
5
  Requires at least: 3.5.2
6
  Tested up to: 4.4.1
7
- Stable tag: 1.1.27
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -190,9 +190,21 @@ This should fix your problem.
190
 
191
  Please note that your wp_options table may be called differently depending on your installation choices.
192
 
 
 
 
 
 
 
193
 
194
  == Changelog ==
195
 
 
 
 
 
 
 
196
  = 1.1.27 =
197
 
198
  * Bugfix: Fixed small bug
4
  Tags: spam, block, country, comments, ban, geo, geo blocking, geo ip, block country, block countries, ban countries, ban country, blacklist, whitelist, security
5
  Requires at least: 3.5.2
6
  Tested up to: 4.4.1
7
+ Stable tag: 1.1.28
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
190
 
191
  Please note that your wp_options table may be called differently depending on your installation choices.
192
 
193
+ = Jetpack does not work anymore with your plugin! =
194
+
195
+ Jetpack uses xmlrpc.php to communicate with your site. xmlrpc.php is considered as a backend url and therefore blocked if needed.
196
+
197
+ You can allow Jetpack by selecting "Jetpack by wordpress.com" as a search engine on the search engines tab.
198
+
199
 
200
  == Changelog ==
201
 
202
+ = 1.1.28 =
203
+
204
+ * Bugfix: Altered mysql_get_client_info check as in some setups this gave a fatal error.
205
+ * New: Added Wordpress Jetpack as search engine. You can allow Jetpack to communicate with your site if you have Jetpack installed.
206
+ * New: Added option to allow admin-ajax.php visits if you use backend blocking.
207
+
208
  = 1.1.27 =
209
 
210
  * Bugfix: Fixed small bug