iQ Block Country - Version 1.1.3

Version Description

  • Fixed error that when using the option to block individual pages all visitors would be blocked. (Thanks to apostlepoe for reporting)
Download this release

Release Info

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

Code changes from version 1.1.2 to 1.1.3

iq-block-country.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: iQ Block Country
4
  Plugin URI: http://www.redeo.nl/2013/12/iq-block-country-wordpress-plugin-blocks-countries/
5
- Version: 1.1.2
6
  Author: Pascal
7
  Author URI: http://www.redeo.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.
2
  /*
3
  Plugin Name: iQ Block Country
4
  Plugin URI: http://www.redeo.nl/2013/12/iq-block-country-wordpress-plugin-blocks-countries/
5
+ Version: 1.1.3
6
  Author: Pascal
7
  Author URI: http://www.redeo.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.
libs/blockcountry-checks.php CHANGED
@@ -49,32 +49,38 @@ function iqblockcountry_check($country,$badcountries,$ip_address)
49
  if (is_array ( $badcountries ) && in_array ( $country, $badcountries )) {
50
  $blocked = TRUE;
51
  }
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  if (!iqblockcountry_is_login_page() )
54
  {
55
- $frontendwhitelist = get_option ( 'blockcountry_frontendwhitelist' );
56
- if (preg_match('/;/',$frontendwhitelist))
57
- {
58
- $arr = explode(";", $frontendwhitelist);
59
- if (is_array ( $arr ) && in_array ( $ip_address, $arr)) {
60
  $blocked = FALSE;
61
  }
62
- }
63
- $frontendblacklist = get_option ( 'blockcountry_frontendblacklist' );
64
- if (preg_match('/;/',$frontendblacklist))
65
- {
66
- $arr = explode(";", $frontendblacklist);
67
- if (is_array ( $arr ) && in_array ( $ip_address, $arr)) {
68
  $blocked = TRUE;
69
  }
70
- }
71
  }
72
  if (is_page() && $blockedpage == "on")
73
  {
74
  $blockedpages = get_option('blockcountry_pages');
75
- if (is_page($blockedpages))
 
76
  {
77
  $blocked = TRUE;
 
 
 
78
  }
79
  else
80
  {
49
  if (is_array ( $badcountries ) && in_array ( $country, $badcountries )) {
50
  $blocked = TRUE;
51
  }
52
+ $frontendblacklist = get_option ( 'blockcountry_frontendblacklist' );
53
+ $frontendblacklistip = array();
54
+ if (preg_match('/;/',$frontendblacklist))
55
+ {
56
+ $frontendblacklistip = explode(";", $frontendblacklist);
57
+ }
58
+ $frontendwhitelistip = array();
59
+ $frontendwhitelist = get_option ( 'blockcountry_frontendwhitelist' );
60
+ if (preg_match('/;/',$frontendwhitelist))
61
+ {
62
+ $frontendwhitelistip = explode(";", $frontendwhitelist);
63
+ }
64
 
65
  if (!iqblockcountry_is_login_page() )
66
  {
67
+ if (is_array ( $frontendwhitelistip ) && in_array ( $ip_address, $frontendwhitelistip)) {
 
 
 
 
68
  $blocked = FALSE;
69
  }
70
+ if (is_array ( $frontendblacklistip ) && in_array ( $ip_address, $frontendblacklistip)) {
 
 
 
 
 
71
  $blocked = TRUE;
72
  }
 
73
  }
74
  if (is_page() && $blockedpage == "on")
75
  {
76
  $blockedpages = get_option('blockcountry_pages');
77
+ $frontendblacklist = get_option ( 'blockcountry_frontendblacklist' );
78
+ if (is_page($blockedpages) && !empty($blockedpages) && ((is_array ( $badcountries ) && in_array ( $country, $badcountries ) || (is_array ( $frontendblacklistip ) && in_array ( $ip_address, $frontendblacklistip)))))
79
  {
80
  $blocked = TRUE;
81
+ if (is_array ( $frontendwhitelistip ) && in_array ( $ip_address, $frontendwhitelistip)) {
82
+ $blocked = FALSE;
83
+ }
84
  }
85
  else
86
  {
libs/blockcountry-settings.php CHANGED
@@ -172,6 +172,7 @@ function iqblockcountry_settings_pages() {
172
  <?php
173
  $selectedpages = get_option('blockcountry_pages');
174
  $pages = get_pages();
 
175
  foreach ( $pages as $page ) {
176
  if (is_array($selectedpages)) {
177
  if ( in_array( $page->ID,$selectedpages) ) {
172
  <?php
173
  $selectedpages = get_option('blockcountry_pages');
174
  $pages = get_pages();
175
+ $selected = "";
176
  foreach ( $pages as $page ) {
177
  if (is_array($selectedpages)) {
178
  if ( in_array( $page->ID,$selectedpages) ) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.unicef.org/
4
  Tags: spam, block, countries, country, comments, ban, geo, geo blocking, geo ip, block country, block countries, ban countries, ban country, blacklist, whitelist
5
  Requires at least: 3.5.2
6
  Tested up to: 3.8
7
- Stable tag: 1.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -163,6 +163,10 @@ If this does not help you out deselect "Send headers when user is blocked". This
163
 
164
  == Changelog ==
165
 
 
 
 
 
166
  = 1.1.2 =
167
 
168
  * Fixed localization error. (Thanks to Lisa for reporting)
@@ -244,56 +248,6 @@ If this does not help you out deselect "Send headers when user is blocked". This
244
 
245
  == Upgrade Notice ==
246
 
247
- = 1.1.1 =
248
-
249
- There are no specific upgrade notices other than the those already mentioned in the changelog.
250
-
251
- = 1.1 =
252
-
253
- An additional database table was added for the statistics.
254
-
255
- = 1.0.12 =
256
-
257
- None. If you wish to fill up the blacklist or whitelist option fill those boxes.
258
-
259
- = 1.0.11 =
260
-
261
- None.
262
-
263
- = 1.0.10 =
264
-
265
- When upgrading from v1.0.8 or v1.0.9 the current value of your block list is copied to the block list of your backend site.
266
-
267
- = 1.0.9 =
268
-
269
- See upgrade notice from 1.0.8 if you upgrade from a release prior to 1.0.8.
270
-
271
- = 1.0.8 =
272
-
273
- This plugin adds some new checkbox settings so you can choose if you want to block users from your frontend website, your backend website or both. By default only the frontend site is blocked. If you wish to alter this behaviour go to your settings page.
274
-
275
- = 1.0.7 =
276
-
277
- You can now use the "Do not block users who are logged in" checkbox if you like. Also if you need IPv6 support you need to press the "Download new GeoIP IPv6 database".
278
-
279
- = 1.0.5 =
280
-
281
- None, this is just a minor update
282
-
283
- = 1.0.4 =
284
-
285
- None, this is just a minor update.
286
-
287
- = 1.0.3 =
288
-
289
- This baby should just upgrade fine. You may want to deactivate and reactivate this plugin to make (pretty) sure this plugin is loaded first. This especially recommended if you have problems with 'headers already sent' notices.
290
-
291
- = 1.0.2 =
292
-
293
- PHP 5.2 or higher is now required.
294
-
295
- Just upgrade if you have PHP 5.2 or higher.
296
-
297
- = 1.0.1 =
298
 
299
- Critical upgrade for this plugin to work as it was missing a necessary file.
4
  Tags: spam, block, countries, country, comments, ban, geo, geo blocking, geo ip, block country, block countries, ban countries, ban country, blacklist, whitelist
5
  Requires at least: 3.5.2
6
  Tested up to: 3.8
7
+ Stable tag: 1.1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
163
 
164
  == Changelog ==
165
 
166
+ = 1.1.3 =
167
+
168
+ * Fixed error that when using the option to block individual pages all visitors would be blocked. (Thanks to apostlepoe for reporting)
169
+
170
  = 1.1.2 =
171
 
172
  * Fixed localization error. (Thanks to Lisa for reporting)
248
 
249
  == Upgrade Notice ==
250
 
251
+ = 1.1.3 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
 
253
+ * 1.1.3 Fix for page blocking problem. No further upgrade notices.