iQ Block Country - Version 1.1.40

Version Description

  • Bugfix: Fix for bug in not blocking/allowing post types.
  • New: Moved GeoIP API to secure https
  • New: Logging DB optimization (Thanks to Arjen Lentz)
  • Change: Changed support option from forum to mail.
Download this release

Release Info

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

Code changes from version 1.1.38 to 1.1.40

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.38
6
  Author: Pascal
7
  Author URI: https://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.
@@ -229,15 +229,15 @@ define("IPV6DB","http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.
229
  define("IPV4DB","http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz"); // Used to display download location.
230
  define("IPV4DBFILE",$upload_dir['basedir'] . "/GeoIP.dat");
231
  define("IPV6DBFILE",$upload_dir['basedir'] . "/GeoIPv6.dat");
232
- define("TRACKINGURL","http://tracking.webence.nl/iq-block-country-tracking.php");
233
- define("BANLISTRETRIEVEURL","http://tracking.webence.nl/iq-block-country-retrieve.php");
234
- define("GEOIPAPIURL","http://eu.geoip.webence.nl/geoipapi.php");
235
- define("GEOIPAPIURLUS","http://us.geoip.webence.nl/geoipapi.php");
236
- define("GEOIPAPIURLASIA","http://asia.geoip.webence.nl/geoipapi.php");
237
- define("GEOIPAPICHECKURL","http://eu.geoip.webence.nl/geoipapi-keycheck.php");
238
- define("ADMINAPICHECKURL","http://tracking.webence.nl/adminapi-keycheck.php");
239
- define("VERSION","1.1.34");
240
- define("DBVERSION","121");
241
  define("PLUGINPATH",plugin_dir_path( __FILE__ ));
242
 
243
 
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.40
6
  Author: Pascal
7
  Author URI: https://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.
229
  define("IPV4DB","http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz"); // Used to display download location.
230
  define("IPV4DBFILE",$upload_dir['basedir'] . "/GeoIP.dat");
231
  define("IPV6DBFILE",$upload_dir['basedir'] . "/GeoIPv6.dat");
232
+ define("TRACKINGURL","https://tracking.webence.nl/iq-block-country-tracking.php");
233
+ define("BANLISTRETRIEVEURL","https://tracking.webence.nl/iq-block-country-retrieve.php");
234
+ define("GEOIPAPIURL","https://eu.geoip.webence.nl/geoipapi.php");
235
+ define("GEOIPAPIURLUS","https://us.geoip.webence.nl/geoipapi.php");
236
+ define("GEOIPAPIURLASIA","https://asia.geoip.webence.nl/geoipapi.php");
237
+ define("GEOIPAPICHECKURL","https://eu.geoip.webence.nl/geoipapi-keycheck.php");
238
+ define("ADMINAPICHECKURL","https://tracking.webence.nl/adminapi-keycheck.php");
239
+ define("VERSION","1.1.40");
240
+ define("DBVERSION","122");
241
  define("PLUGINPATH",plugin_dir_path( __FILE__ ));
242
 
243
 
libs/blockcountry-checks.php CHANGED
@@ -106,6 +106,7 @@ function iqblockcountry_check($country,$badcountries,$ip_address)
106
  $blocktags = get_option('blockcountry_blocktags');
107
  $blockedposttypes = get_option('blockcountry_blockposttypes');
108
  $blockedtag = get_option('blockcountry_blocktag');
 
109
 
110
  $frontendblacklistip = array(); $frontendblacklist = get_option ( 'blockcountry_frontendblacklist' );
111
  $frontendwhitelistip = array(); $frontendwhitelist = get_option ( 'blockcountry_frontendwhitelist' );
@@ -175,18 +176,20 @@ function iqblockcountry_check($country,$badcountries,$ip_address)
175
  }
176
  }
177
 
178
- global $post;
179
-
180
  if ($blockedposttypes == "on")
181
  {
182
  $blockedposttypes = get_option('blockcountry_posttypes');
183
- if (is_array($blockedposttypes) && in_array(get_post_type( $post->ID ), $blockedposttypes) && ((is_array ( $badcountries ) && in_array ( $country, $badcountries ) || (is_array ( $frontendblacklistip ) && in_array ( $ip_address, $frontendblacklistip)))))
184
  {
185
  $blocked = TRUE;
186
  if (is_array ( $frontendwhitelistip ) && in_array ( $ip_address, $frontendwhitelistip)) {
187
  $blocked = FALSE;
188
  }
189
  }
 
 
 
 
190
  }
191
 
192
  if (is_page() && $blockedpage == "on")
@@ -206,10 +209,9 @@ function iqblockcountry_check($country,$badcountries,$ip_address)
206
  }
207
  if (is_single() && $blockedcategory == "on")
208
  {
209
- global $post;
210
  $blockedcategories = get_option('blockcountry_categories');
211
  if (!is_array($blockedcategories)) { $blockedcategories = array(); }
212
- $post_categories = wp_get_post_categories( $post->ID );
213
  $flagged = FALSE;
214
  foreach ($post_categories as $key => $value)
215
  {
@@ -230,10 +232,9 @@ function iqblockcountry_check($country,$badcountries,$ip_address)
230
  if (is_single() && $blocktags == "on")
231
  {
232
  $previousblock = $blocked;
233
- global $post;
234
  $blockedtags = get_option('blockcountry_tags');
235
  if (!is_array($blockedtags)) { $blockedtags = array(); }
236
- $post_tags = get_the_tags($post->ID);
237
  if (empty($post_tags)) { $post_tags = array();}
238
  $flagged = FALSE;
239
  foreach ($post_tags as $tag)
106
  $blocktags = get_option('blockcountry_blocktags');
107
  $blockedposttypes = get_option('blockcountry_blockposttypes');
108
  $blockedtag = get_option('blockcountry_blocktag');
109
+ $postid = get_the_ID();
110
 
111
  $frontendblacklistip = array(); $frontendblacklist = get_option ( 'blockcountry_frontendblacklist' );
112
  $frontendwhitelistip = array(); $frontendwhitelist = get_option ( 'blockcountry_frontendwhitelist' );
176
  }
177
  }
178
 
 
 
179
  if ($blockedposttypes == "on")
180
  {
181
  $blockedposttypes = get_option('blockcountry_posttypes');
182
+ if (is_array($blockedposttypes) && in_array(get_post_type( $postid ), $blockedposttypes) && ((is_array ( $badcountries ) && in_array ( $country, $badcountries ) || (is_array ( $frontendblacklistip ) && in_array ( $ip_address, $frontendblacklistip)))))
183
  {
184
  $blocked = TRUE;
185
  if (is_array ( $frontendwhitelistip ) && in_array ( $ip_address, $frontendwhitelistip)) {
186
  $blocked = FALSE;
187
  }
188
  }
189
+ else
190
+ {
191
+ $blocked = FALSE;
192
+ }
193
  }
194
 
195
  if (is_page() && $blockedpage == "on")
209
  }
210
  if (is_single() && $blockedcategory == "on")
211
  {
 
212
  $blockedcategories = get_option('blockcountry_categories');
213
  if (!is_array($blockedcategories)) { $blockedcategories = array(); }
214
+ $post_categories = wp_get_post_categories( $postid );
215
  $flagged = FALSE;
216
  foreach ($post_categories as $key => $value)
217
  {
232
  if (is_single() && $blocktags == "on")
233
  {
234
  $previousblock = $blocked;
 
235
  $blockedtags = get_option('blockcountry_tags');
236
  if (!is_array($blockedtags)) { $blockedtags = array(); }
237
+ $post_tags = get_the_tags($postid);
238
  if (empty($post_tags)) { $post_tags = array();}
239
  $flagged = FALSE;
240
  foreach ($post_tags as $tag)
libs/blockcountry-logging.php CHANGED
@@ -12,7 +12,8 @@ function iqblockcountry_install_db() {
12
  country tinytext NOT NULL,
13
  url varchar(250) DEFAULT '/' NOT NULL,
14
  banned enum('F','B','A','T') NOT NULL,
15
- UNIQUE KEY id (id)
 
16
  );";
17
 
18
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
12
  country tinytext NOT NULL,
13
  url varchar(250) DEFAULT '/' NOT NULL,
14
  banned enum('F','B','A','T') NOT NULL,
15
+ UNIQUE KEY id (id),
16
+ KEY `datetime` (`datetime`)
17
  );";
18
 
19
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
libs/blockcountry-settings.php CHANGED
@@ -1656,7 +1656,7 @@ function iqblockcountry_settings_page() {
1656
 
1657
  ?>
1658
 
1659
- <p>If you need assistance with this plugin please go to the <a href="https://www.webence.nl/support/">support forum</a></p>
1660
 
1661
  <p>This product uses GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com/">http://www.maxmind.com/</a>.</p>
1662
 
1656
 
1657
  ?>
1658
 
1659
+ <p>If you need assistance with this plugin please send an email to <a href="mailto:support@webence.nl">support@webence.nl</a></p>
1660
 
1661
  <p>This product uses GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com/">http://www.maxmind.com/</a>.</p>
1662
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: iqpascal
3
  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.6.1
7
- Stable tag: 1.1.38
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -215,6 +215,13 @@ As the basic rule is to block all and every post you have to configure this in a
215
 
216
  == Changelog ==
217
 
 
 
 
 
 
 
 
218
  = 1.1.38 =
219
 
220
  * Bugfix: Only shows warning of incompatible caching plugin if frontend blocking is on.
3
  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.7.3
7
+ Stable tag: 1.1.40
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
215
 
216
  == Changelog ==
217
 
218
+ = 1.1.40 =
219
+
220
+ * Bugfix: Fix for bug in not blocking/allowing post types.
221
+ * New: Moved GeoIP API to secure https
222
+ * New: Logging DB optimization (Thanks to Arjen Lentz)
223
+ * Change: Changed support option from forum to mail.
224
+
225
  = 1.1.38 =
226
 
227
  * Bugfix: Only shows warning of incompatible caching plugin if frontend blocking is on.