iQ Block Country - Version 1.1.1

Version Description

  • You can now choose to block individual pages. Leaving other pages open for visitors from blocked countries. You can for instance use this feature to block countries from visiting specific pages due to content rights etc.
  • Source now supports localization. Included is the English and Dutch language. I'd be happy to include other translations if anyone can supply those to me.
Download this release

Release Info

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

Code changes from version 1.1 to 1.1.1

iq-block-country.php CHANGED
@@ -1,8 +1,8 @@
1
- <?php
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
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.
@@ -75,21 +75,22 @@ function iqblockcountry_downloadgeodatabase($version, $displayerror)
75
  $result = $request->request ( $url );
76
  $content = array ();
77
 
78
- if ((in_array ( '403', $result ['response'] )) && (preg_match('/Rate limited exceeded, please try again in 24 hours./', $result['body'] )) ) {
79
  if($displayerror){
80
  ?>
81
- <p>Error occured: Could not download the GeoIP database from <?php echo $url;?><br />
82
- MaxMind has blocked requests from your IP address for 24 hours. Please check again in 24 hours or download this file from your own PC<br />
83
- unzip this file and upload it (via FTP for instance) to:<br /> <strong><?php echo $geofile;?></strong></p>
 
84
  <?php
85
  }
86
  }
87
  elseif ((isset ( $result->errors )) || (! (in_array ( '200', $result ['response'] )))) {
88
  if($displayerror){
89
  ?>
90
- <p>Error occured: Could not download the GeoIP database from <?php echo $url;?><br />
91
- Please download this file from your own PC unzip this file and upload it (via FTP for instance) to:<br />
92
- <strong><?php echo $geofile;?></strong></p>
93
  <?php
94
  }
95
  } else {
@@ -114,18 +115,26 @@ function iqblockcountry_downloadgeodatabase($version, $displayerror)
114
  fclose ( $fp );
115
  update_option('blockcountry_lastupdate' , time());
116
  if($displayerror){
117
- print "<p>Finished downloading</p>";
118
  }
119
  }
120
  if (! (file_exists ( IPV4DBFILE ))) {
121
  if($displayerror){
122
  ?>
123
- <p>Fatal error: GeoIP <?php echo IPV4DBFILE ?> database does not exists. This plugin will not work until the database file is present.</p>
124
  <?php
125
  }
126
  }
127
  }
128
 
 
 
 
 
 
 
 
 
129
  /*
130
  * Get list of countries from Geo Database
131
  */
@@ -271,7 +280,10 @@ if (get_option('blockcountry_blockfrontend'))
271
  add_action ( 'wp_head', 'iqblockcountry_checkCountry', 1 );
272
  }
273
 
 
274
  add_action ( 'admin_menu', 'iqblockcountry_create_menu' );
275
  add_action ( 'admin_init', 'iqblockcountry_checkupdatedb' );
276
 
 
 
277
  ?>
1
+ <?php
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.1
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.
75
  $result = $request->request ( $url );
76
  $content = array ();
77
 
78
+ if (is_array($result) && array_key_exists('response',$result) && (in_array ( '403', $result ['response'] )) && (preg_match('/Rate limited exceeded, please try again in 24 hours./', $result['body'] )) ) {
79
  if($displayerror){
80
  ?>
81
+ <p><?php _e('Error occured: Could not download the GeoIP database from'); ?> <?php echo " " . $url;?><br />
82
+ <?php _e('MaxMind has blocked requests from your IP address for 24 hours. Please check again in 24 hours or download this file from your own PC'); ?><br />
83
+ <?php _e('Unzip this file and upload it (via FTP for instance) to:'); ?>
84
+ <strong> <?php echo $geofile;?></strong></p>
85
  <?php
86
  }
87
  }
88
  elseif ((isset ( $result->errors )) || (! (in_array ( '200', $result ['response'] )))) {
89
  if($displayerror){
90
  ?>
91
+ <p><?php _e('Error occured: Could not download the GeoIP database from'); ?> <?php echo " " . $url;?><br />
92
+ <?php _e('Please download this file from your own PC unzip this file and upload it (via FTP for instance) to:'); ?>
93
+ <strong> <?php echo $geofile;?></strong></p>
94
  <?php
95
  }
96
  } else {
115
  fclose ( $fp );
116
  update_option('blockcountry_lastupdate' , time());
117
  if($displayerror){
118
+ print "<p>" . _e('Finished downloading', 'iqblockcountry') . "</p>";
119
  }
120
  }
121
  if (! (file_exists ( IPV4DBFILE ))) {
122
  if($displayerror){
123
  ?>
124
+ <p><?php echo __('Fatal error: GeoIP') . " " . IPV4DBFILE . " " . __('database does not exists. This plugin will not work until the database file is present.'); ?></p>
125
  <?php
126
  }
127
  }
128
  }
129
 
130
+ /*
131
+ * Localization
132
+ */
133
+ function iqblockcountry_localization()
134
+ {
135
+ load_plugin_textdomain( 'iqblockcountry', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
136
+ }
137
+
138
  /*
139
  * Get list of countries from Geo Database
140
  */
280
  add_action ( 'wp_head', 'iqblockcountry_checkCountry', 1 );
281
  }
282
 
283
+ add_action ( 'admin_init', 'iqblockcountry_localization');
284
  add_action ( 'admin_menu', 'iqblockcountry_create_menu' );
285
  add_action ( 'admin_init', 'iqblockcountry_checkupdatedb' );
286
 
287
+
288
+
289
  ?>
lang/en_EN.mo ADDED
Binary file
lang/en_EN.po ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: iQ Block Country\n"
4
+ "POT-Creation-Date: 2014-01-08 16:23+0100\n"
5
+ "PO-Revision-Date: 2014-01-08 16:23+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: iQ Block Country <info@redeo.nl>\n"
8
+ "Language: English\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.4\n"
13
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
14
+ "X-Poedit-Basepath: ../\n"
15
+ "X-Poedit-SearchPath-0: libs\n"
16
+ "X-Poedit-SearchPath-1: .\n"
17
+
18
+ #: libs/blockcountry-settings.php:78
19
+ msgid ""
20
+ "Check which country belongs to an IP Address according to the current "
21
+ "database."
22
+ msgstr ""
23
+
24
+ #: libs/blockcountry-settings.php:82
25
+ msgid "IP Address to check:"
26
+ msgstr ""
27
+
28
+ #: libs/blockcountry-settings.php:92
29
+ msgid "No country for"
30
+ msgstr ""
31
+
32
+ #: libs/blockcountry-settings.php:92
33
+ msgid "could be found. Or"
34
+ msgstr ""
35
+
36
+ #: libs/blockcountry-settings.php:92
37
+ msgid "is not a valid IPv4 or IPv6 IP address"
38
+ msgstr ""
39
+
40
+ #: libs/blockcountry-settings.php:97
41
+ msgid "IP Adress"
42
+ msgstr ""
43
+
44
+ #: libs/blockcountry-settings.php:97
45
+ msgid "belongs to"
46
+ msgstr ""
47
+
48
+ #: libs/blockcountry-settings.php:100
49
+ msgid "This country is not permitted to visit the frontend of this website."
50
+ msgstr ""
51
+
52
+ #: libs/blockcountry-settings.php:105
53
+ msgid "This country is not permitted to visit the backend of this website."
54
+ msgstr ""
55
+
56
+ #: libs/blockcountry-settings.php:111
57
+ msgid "Check IP address"
58
+ msgstr ""
59
+
60
+ #: libs/blockcountry-settings.php:124
61
+ msgid "The GeoIP database is updated once a month. Last update: "
62
+ msgstr ""
63
+
64
+ #: libs/blockcountry-settings.php:125
65
+ msgid "If you need a manual update please press buttons below to update."
66
+ msgstr ""
67
+
68
+ #: libs/blockcountry-settings.php:131
69
+ msgid "Download new GeoIP IPv4 Database"
70
+ msgstr ""
71
+
72
+ #: libs/blockcountry-settings.php:138
73
+ msgid "Download new GeoIP IPv6 Database"
74
+ msgstr ""
75
+
76
+ #: libs/blockcountry-settings.php:143 libs/blockcountry-settings.php:147
77
+ msgid "Downloading..."
78
+ msgstr ""
79
+
80
+ #: libs/blockcountry-settings.php:155
81
+ msgid "Select which pages are blocked."
82
+ msgstr ""
83
+
84
+ #: libs/blockcountry-settings.php:162
85
+ msgid "Do you want to block individual pages:"
86
+ msgstr ""
87
+
88
+ #: libs/blockcountry-settings.php:163
89
+ msgid "If you do not select this option all pages will be blocked."
90
+ msgstr ""
91
+
92
+ #: libs/blockcountry-settings.php:168
93
+ msgid "Select pages you want to block:"
94
+ msgstr ""
95
+
96
+ #: libs/blockcountry-settings.php:189 libs/blockcountry-settings.php:344
97
+ msgid "Save Changes"
98
+ msgstr ""
99
+
100
+ #: libs/blockcountry-settings.php:205
101
+ msgid "Statistics"
102
+ msgstr ""
103
+
104
+ #: libs/blockcountry-settings.php:208
105
+ msgid "visitors blocked from the backend."
106
+ msgstr ""
107
+
108
+ #: libs/blockcountry-settings.php:210
109
+ msgid "visitors blocked from the frontend."
110
+ msgstr ""
111
+
112
+ #: libs/blockcountry-settings.php:214
113
+ msgid "Basic Options"
114
+ msgstr ""
115
+
116
+ #: libs/blockcountry-settings.php:249
117
+ msgid "Message to display when people are blocked:"
118
+ msgstr ""
119
+
120
+ #: libs/blockcountry-settings.php:259
121
+ msgid "Do not block users that are logged in from visiting frontend website:"
122
+ msgstr ""
123
+
124
+ #: libs/blockcountry-settings.php:265
125
+ msgid "Block users from visiting the frontend of your website:"
126
+ msgstr ""
127
+
128
+ #: libs/blockcountry-settings.php:271
129
+ msgid ""
130
+ "Select the countries that should be blocked from visiting your frontend:"
131
+ msgstr ""
132
+
133
+ #: libs/blockcountry-settings.php:272
134
+ msgid "Use the CTRL key to select multiple countries"
135
+ msgstr ""
136
+
137
+ #: libs/blockcountry-settings.php:288
138
+ msgid "Frontend whitelist IPv4 and/or IPv6 addresses:"
139
+ msgstr ""
140
+
141
+ #: libs/blockcountry-settings.php:288 libs/blockcountry-settings.php:296
142
+ msgid "Use a semicolon (;) to separate IP addresses"
143
+ msgstr ""
144
+
145
+ #: libs/blockcountry-settings.php:296
146
+ msgid "Frontend blacklist IPv4 and/or IPv6 addresses:"
147
+ msgstr ""
148
+
149
+ #: libs/blockcountry-settings.php:304
150
+ msgid "Block users from visiting the backend (administrator) of your website:"
151
+ msgstr ""
152
+
153
+ #: libs/blockcountry-settings.php:311
154
+ msgid "Your IP address is"
155
+ msgstr ""
156
+
157
+ #: libs/blockcountry-settings.php:311
158
+ msgid "The country that is listed for this IP address is"
159
+ msgstr ""
160
+
161
+ #: libs/blockcountry-settings.php:312
162
+ msgid ""
163
+ "Do <strong>NOT</strong> set the 'Block users from visiting the backend "
164
+ "(administrator) of your website' and also select"
165
+ msgstr ""
166
+
167
+ #: libs/blockcountry-settings.php:312
168
+ msgid "below."
169
+ msgstr ""
170
+
171
+ #: libs/blockcountry-settings.php:313
172
+ msgid ""
173
+ "You will NOT be able to login the next time if you DO block your own country "
174
+ "from visiting the backend."
175
+ msgstr ""
176
+
177
+ #: libs/blockcountry-settings.php:318
178
+ msgid "Select the countries that should be blocked from visiting your backend:"
179
+ msgstr ""
180
+
181
+ #: libs/blockcountry-settings.php:319
182
+ msgid "Use the x behind the country to remove a country from this blocklist."
183
+ msgstr ""
184
+
185
+ #: libs/blockcountry-settings.php:336
186
+ msgid "Send headers when user is blocked:"
187
+ msgstr ""
188
+
189
+ #: libs/blockcountry-settings.php:337
190
+ msgid ""
191
+ "Under normal circumstances you should keep this selected! Only if you have "
192
+ "\"Cannot modify header information - headers already sent\" errors or if you "
193
+ "know what you are doing uncheck this."
194
+ msgstr ""
195
+
196
+ #: libs/blockcountry-settings.php:368
197
+ msgid "Last 15 blocked visits"
198
+ msgstr ""
199
+
200
+ #: libs/blockcountry-settings.php:376
201
+ msgid "Date / Time"
202
+ msgstr ""
203
+
204
+ #: libs/blockcountry-settings.php:376 libs/blockcountry-settings.php:408
205
+ msgid "IP Address"
206
+ msgstr ""
207
+
208
+ #: libs/blockcountry-settings.php:376 libs/blockcountry-settings.php:408
209
+ msgid "Hostname"
210
+ msgstr ""
211
+
212
+ #: libs/blockcountry-settings.php:376 libs/blockcountry-settings.php:419
213
+ msgid "URL"
214
+ msgstr ""
215
+
216
+ #: libs/blockcountry-settings.php:376 libs/blockcountry-settings.php:395
217
+ msgid "Country"
218
+ msgstr ""
219
+
220
+ #: libs/blockcountry-settings.php:376
221
+ msgid "Frontend/Backend"
222
+ msgstr ""
223
+
224
+ #: libs/blockcountry-settings.php:386
225
+ msgid "Voorkant"
226
+ msgstr ""
227
+
228
+ #: libs/blockcountry-settings.php:386
229
+ msgid "Achterkant"
230
+ msgstr ""
231
+
232
+ #: libs/blockcountry-settings.php:393
233
+ msgid "Top countries that are blocked"
234
+ msgstr ""
235
+
236
+ #: libs/blockcountry-settings.php:395 libs/blockcountry-settings.php:408
237
+ #: libs/blockcountry-settings.php:419
238
+ msgid "# of blocked attempts"
239
+ msgstr ""
240
+
241
+ #: libs/blockcountry-settings.php:406
242
+ msgid "Top hosts that are blocked"
243
+ msgstr ""
244
+
245
+ #: libs/blockcountry-settings.php:417
246
+ msgid "Top URLs that are blocked"
247
+ msgstr ""
248
+
249
+ #: libs/blockcountry-settings.php:446
250
+ msgid "Home"
251
+ msgstr ""
252
+
253
+ #: libs/blockcountry-settings.php:447
254
+ msgid "Pages"
255
+ msgstr ""
256
+
257
+ #: libs/blockcountry-settings.php:448
258
+ msgid "Tools."
259
+ msgstr ""
260
+
261
+ #: libs/blockcountry-settings.php:449
262
+ msgid "Logging"
263
+ msgstr ""
264
+
265
+ #: libs/blockcountry-settings.php:482
266
+ msgid "GeoIP database does not exists. Trying to download it..."
267
+ msgstr ""
268
+
269
+ #: iq-block-country.php:81 iq-block-country.php:91
270
+ msgid "Error occured: Could not download the GeoIP database from"
271
+ msgstr ""
272
+
273
+ #: iq-block-country.php:82
274
+ msgid ""
275
+ "MaxMind has blocked requests from your IP address for 24 hours. Please check "
276
+ "again in 24 hours or download this file from your own PC"
277
+ msgstr ""
278
+
279
+ #: iq-block-country.php:83
280
+ msgid "Unzip this file and upload it (via FTP for instance) to:"
281
+ msgstr ""
282
+
283
+ #: iq-block-country.php:92
284
+ msgid ""
285
+ "Please download this file from your own PC unzip this file and upload it "
286
+ "(via FTP for instance) to:"
287
+ msgstr ""
288
+
289
+ #: iq-block-country.php:118
290
+ msgid "Finished downloading"
291
+ msgstr ""
292
+
293
+ #: iq-block-country.php:124
294
+ msgid "Fatal error: GeoIP"
295
+ msgstr ""
296
+
297
+ #: iq-block-country.php:124
298
+ msgid ""
299
+ "database does not exists. This plugin will not work until the database file "
300
+ "is present."
301
+ msgstr ""
lang/iqblockcountry-nl_NL.mo ADDED
Binary file
lang/iqblockcountry-nl_NL.po ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: iQ Block Country\n"
4
+ "POT-Creation-Date: 2014-01-08 16:21+0100\n"
5
+ "PO-Revision-Date: 2014-01-08 16:21+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: iQ Block Country <info@redeo.nl>\n"
8
+ "Language: English\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.4\n"
13
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
14
+ "X-Poedit-Basepath: ../\n"
15
+ "X-Poedit-SearchPath-0: libs\n"
16
+ "X-Poedit-SearchPath-1: .\n"
17
+
18
+ #: libs/blockcountry-settings.php:78
19
+ msgid ""
20
+ "Check which country belongs to an IP Address according to the current "
21
+ "database."
22
+ msgstr ""
23
+ "Controleer welk land behoort tot een IP adres volgens de huidige database."
24
+
25
+ #: libs/blockcountry-settings.php:82
26
+ msgid "IP Address to check:"
27
+ msgstr "IP adres om te controleren:"
28
+
29
+ #: libs/blockcountry-settings.php:92
30
+ msgid "No country for"
31
+ msgstr "Geen land voor"
32
+
33
+ #: libs/blockcountry-settings.php:92
34
+ msgid "could be found. Or"
35
+ msgstr "gevonden. Of"
36
+
37
+ #: libs/blockcountry-settings.php:92
38
+ msgid "is not a valid IPv4 or IPv6 IP address"
39
+ msgstr "is geen valide IPv4 of IPv6 ip adres."
40
+
41
+ #: libs/blockcountry-settings.php:97
42
+ msgid "IP Adress"
43
+ msgstr "IP Adres"
44
+
45
+ #: libs/blockcountry-settings.php:97
46
+ msgid "belongs to"
47
+ msgstr "behoort tot"
48
+
49
+ #: libs/blockcountry-settings.php:100
50
+ msgid "This country is not permitted to visit the frontend of this website."
51
+ msgstr ""
52
+ "Dit land wordt niet toegestaan om de voorkant van deze website te bezoeken."
53
+
54
+ #: libs/blockcountry-settings.php:105
55
+ msgid "This country is not permitted to visit the backend of this website."
56
+ msgstr ""
57
+ "Dit land wordt niet toegestaan om de achterkant van deze website te bezoeken."
58
+
59
+ #: libs/blockcountry-settings.php:111
60
+ msgid "Check IP address"
61
+ msgstr "Controleer IP adres"
62
+
63
+ #: libs/blockcountry-settings.php:124
64
+ msgid "The GeoIP database is updated once a month. Last update: "
65
+ msgstr ""
66
+ "De GeoIP database wordt eenmaal per maand bijgewerkt. Laatste keer "
67
+ "bijgewerkt:"
68
+
69
+ #: libs/blockcountry-settings.php:125
70
+ msgid "If you need a manual update please press buttons below to update."
71
+ msgstr "Indien je handmatig wilt bijwerken druk je op de knoppen hier beneden."
72
+
73
+ #: libs/blockcountry-settings.php:131
74
+ msgid "Download new GeoIP IPv4 Database"
75
+ msgstr "Download nieuwe GeoIP IPv4 database"
76
+
77
+ #: libs/blockcountry-settings.php:138
78
+ msgid "Download new GeoIP IPv6 Database"
79
+ msgstr "Download nieuwe GeoIP IPv6 database"
80
+
81
+ #: libs/blockcountry-settings.php:143 libs/blockcountry-settings.php:147
82
+ msgid "Downloading..."
83
+ msgstr "Downloading..."
84
+
85
+ #: libs/blockcountry-settings.php:155
86
+ msgid "Select which pages are blocked."
87
+ msgstr "Selecteer welke pagina's geblokkeerd worden."
88
+
89
+ #: libs/blockcountry-settings.php:162
90
+ msgid "Do you want to block individual pages:"
91
+ msgstr "Wil je individuele pagina's blokkeren:"
92
+
93
+ #: libs/blockcountry-settings.php:163
94
+ msgid "If you do not select this option all pages will be blocked."
95
+ msgstr "Indien je deze optie niet selecteert worden alle pagina's geblokkeerd."
96
+
97
+ #: libs/blockcountry-settings.php:168
98
+ msgid "Select pages you want to block:"
99
+ msgstr "Selecteer welke pagina's je wil blokkeren."
100
+
101
+ #: libs/blockcountry-settings.php:189 libs/blockcountry-settings.php:344
102
+ msgid "Save Changes"
103
+ msgstr "Bewaar wijzigingen"
104
+
105
+ #: libs/blockcountry-settings.php:205
106
+ msgid "Statistics"
107
+ msgstr "Statistieken"
108
+
109
+ #: libs/blockcountry-settings.php:208
110
+ msgid "visitors blocked from the backend."
111
+ msgstr "bezoekers geblokkeerd op de achterkant."
112
+
113
+ #: libs/blockcountry-settings.php:210
114
+ msgid "visitors blocked from the frontend."
115
+ msgstr "bezoekers geblokkeerd op de voorkant."
116
+
117
+ #: libs/blockcountry-settings.php:214
118
+ msgid "Basic Options"
119
+ msgstr "Standaard opties"
120
+
121
+ #: libs/blockcountry-settings.php:249
122
+ msgid "Message to display when people are blocked:"
123
+ msgstr "Welk bericht wil je tonen aan bezoekers welke geblokkeerd worden:"
124
+
125
+ #: libs/blockcountry-settings.php:259
126
+ msgid "Do not block users that are logged in from visiting frontend website:"
127
+ msgstr ""
128
+ "Blokkeer geen gebruikers welke ingelogd zijn van het bezoeken van de "
129
+ "voorkant:"
130
+
131
+ #: libs/blockcountry-settings.php:265
132
+ msgid "Block users from visiting the frontend of your website:"
133
+ msgstr "Blokkeer gebruikers van het bezoeken van de voorkant van je website:"
134
+
135
+ #: libs/blockcountry-settings.php:271
136
+ msgid ""
137
+ "Select the countries that should be blocked from visiting your frontend:"
138
+ msgstr ""
139
+ "Selecteer de landen welke geblokkeerd moeten worden voor het bezoeken van de "
140
+ "voorkant van je website:"
141
+
142
+ #: libs/blockcountry-settings.php:272
143
+ msgid "Use the CTRL key to select multiple countries"
144
+ msgstr "Gebruik de CTRL toets om meerdere landen te selecteren"
145
+
146
+ #: libs/blockcountry-settings.php:288
147
+ msgid "Frontend whitelist IPv4 and/or IPv6 addresses:"
148
+ msgstr ""
149
+ "Whitelist van IPv4 of IPv6 IP adressen voor de voorkant van je website:"
150
+
151
+ #: libs/blockcountry-settings.php:288 libs/blockcountry-settings.php:296
152
+ msgid "Use a semicolon (;) to separate IP addresses"
153
+ msgstr "Gebruik een puntkomma (;) om adressen van elkaar te scheiden"
154
+
155
+ #: libs/blockcountry-settings.php:296
156
+ msgid "Frontend blacklist IPv4 and/or IPv6 addresses:"
157
+ msgstr ""
158
+ "Blacklist van IPv4 of IPv6 IP adressen voor de voorkant van je website:"
159
+
160
+ #: libs/blockcountry-settings.php:304
161
+ msgid "Block users from visiting the backend (administrator) of your website:"
162
+ msgstr ""
163
+ "Blokkeer gebruikers van het bezoeken van de achterkant (administratie "
164
+ "gedeelte) van je website:"
165
+
166
+ #: libs/blockcountry-settings.php:311
167
+ msgid "Your IP address is"
168
+ msgstr "Je IP adres is"
169
+
170
+ #: libs/blockcountry-settings.php:311
171
+ msgid "The country that is listed for this IP address is"
172
+ msgstr "Het land waar dit adres toe behoort is"
173
+
174
+ #: libs/blockcountry-settings.php:312
175
+ msgid ""
176
+ "Do <strong>NOT</strong> set the 'Block users from visiting the backend "
177
+ "(administrator) of your website' and also select"
178
+ msgstr ""
179
+ "Selecteer <strong>NIET</strong> \"Blokkeer gebruikers van het bezoeken van "
180
+ "de achterkant (administratie gedeelte) van je website\" en"
181
+
182
+ #: libs/blockcountry-settings.php:312
183
+ msgid "below."
184
+ msgstr "hier beneden."
185
+
186
+ #: libs/blockcountry-settings.php:313
187
+ msgid ""
188
+ "You will NOT be able to login the next time if you DO block your own country "
189
+ "from visiting the backend."
190
+ msgstr ""
191
+ "Het zal daarna niet meer mogelijk zijn om nog in te loggen als je je eigen "
192
+ "land blokkeert van het bezoeken van de achterkant van je website."
193
+
194
+ #: libs/blockcountry-settings.php:318
195
+ msgid "Select the countries that should be blocked from visiting your backend:"
196
+ msgstr ""
197
+ "Selecteer de landen welke geblokkeerd moeten worden voor het bezoeken van de "
198
+ "achterkant (administratie gedeelte) van je website:"
199
+
200
+ #: libs/blockcountry-settings.php:319
201
+ msgid "Use the x behind the country to remove a country from this blocklist."
202
+ msgstr ""
203
+ "Gebruik de x achter een land om het land te verwijderen uit deze lijst."
204
+
205
+ #: libs/blockcountry-settings.php:336
206
+ msgid "Send headers when user is blocked:"
207
+ msgstr "Stuur headers wanneer een gebruiker is geblokkeerd:"
208
+
209
+ #: libs/blockcountry-settings.php:337
210
+ msgid ""
211
+ "Under normal circumstances you should keep this selected! Only if you have "
212
+ "\"Cannot modify header information - headers already sent\" errors or if you "
213
+ "know what you are doing uncheck this."
214
+ msgstr ""
215
+ "Onder normale omstandigheden dien je deze geselecteerd te houden. Deselteer "
216
+ "deze alleen indien je \"Cannot modify header information - headers already "
217
+ "sent\" foutmeldingen krijgt of indien je weet wat je doet."
218
+
219
+ #: libs/blockcountry-settings.php:368
220
+ msgid "Last 15 blocked visits"
221
+ msgstr "Laatste 15 geblokkeerde bezoekers"
222
+
223
+ #: libs/blockcountry-settings.php:376
224
+ msgid "Date / Time"
225
+ msgstr "Datum / Tijd"
226
+
227
+ #: libs/blockcountry-settings.php:376 libs/blockcountry-settings.php:408
228
+ msgid "IP Address"
229
+ msgstr "IP adres"
230
+
231
+ #: libs/blockcountry-settings.php:376 libs/blockcountry-settings.php:408
232
+ msgid "Hostname"
233
+ msgstr "Hostnaam"
234
+
235
+ #: libs/blockcountry-settings.php:376 libs/blockcountry-settings.php:419
236
+ msgid "URL"
237
+ msgstr "URL"
238
+
239
+ #: libs/blockcountry-settings.php:376 libs/blockcountry-settings.php:395
240
+ msgid "Country"
241
+ msgstr "Land"
242
+
243
+ #: libs/blockcountry-settings.php:376
244
+ msgid "Frontend/Backend"
245
+ msgstr "Voorkant/Achterkant"
246
+
247
+ #: libs/blockcountry-settings.php:386
248
+ msgid "Voorkant"
249
+ msgstr "Voorkant"
250
+
251
+ #: libs/blockcountry-settings.php:386
252
+ msgid "Achterkant"
253
+ msgstr "Achterkant"
254
+
255
+ #: libs/blockcountry-settings.php:393
256
+ msgid "Top countries that are blocked"
257
+ msgstr "Top landen welke zijn geblokkeerd"
258
+
259
+ #: libs/blockcountry-settings.php:395 libs/blockcountry-settings.php:408
260
+ #: libs/blockcountry-settings.php:419
261
+ msgid "# of blocked attempts"
262
+ msgstr "# of geblokkeerde pogingen"
263
+
264
+ #: libs/blockcountry-settings.php:406
265
+ msgid "Top hosts that are blocked"
266
+ msgstr "Top hosts welke geblokkeerd zijn"
267
+
268
+ #: libs/blockcountry-settings.php:417
269
+ msgid "Top URLs that are blocked"
270
+ msgstr "Top URLs welke geblokkeerd zijn"
271
+
272
+ #: libs/blockcountry-settings.php:446
273
+ msgid "Home"
274
+ msgstr "Home"
275
+
276
+ #: libs/blockcountry-settings.php:447
277
+ msgid "Pages"
278
+ msgstr "Pagina's"
279
+
280
+ #: libs/blockcountry-settings.php:448
281
+ msgid "Tools."
282
+ msgstr "Gereedschap"
283
+
284
+ #: libs/blockcountry-settings.php:449
285
+ msgid "Logging"
286
+ msgstr "Statistieken"
287
+
288
+ #: libs/blockcountry-settings.php:482
289
+ msgid "GeoIP database does not exists. Trying to download it..."
290
+ msgstr "GeoIP database bestaat niet. Probeer om nieuwe versie te downloaden"
291
+
292
+ #: iq-block-country.php:81 iq-block-country.php:91
293
+ msgid "Error occured: Could not download the GeoIP database from"
294
+ msgstr "Uh oh: Kon de GeoIP database niet downloaden van"
295
+
296
+ #: iq-block-country.php:82
297
+ msgid ""
298
+ "MaxMind has blocked requests from your IP address for 24 hours. Please check "
299
+ "again in 24 hours or download this file from your own PC"
300
+ msgstr ""
301
+ "MaxMind heeft alle verzoeken vanaf dit IP adres voor 24 uur geblokkeerd. "
302
+ "Controleer nogmaals na 24 uur of download dit bestand via je eigen pc"
303
+
304
+ #: iq-block-country.php:83
305
+ msgid "Unzip this file and upload it (via FTP for instance) to:"
306
+ msgstr "Pak dit bestand uit en upload deze (via FTP bijvoorbeeld) naar:"
307
+
308
+ #: iq-block-country.php:92
309
+ msgid ""
310
+ "Please download this file from your own PC unzip this file and upload it "
311
+ "(via FTP for instance) to:"
312
+ msgstr ""
313
+ "Download dit bestand alsjeblieft naar je eigen PC. Pak het bestand daar uit "
314
+ "en upload deze (bijvoorbeeld via FTP) naar:"
315
+
316
+ #: iq-block-country.php:118
317
+ msgid "Finished downloading"
318
+ msgstr "Klaar met downloaden"
319
+
320
+ #: iq-block-country.php:124
321
+ msgid "Fatal error: GeoIP"
322
+ msgstr "Fatale fout: GeoIP"
323
+
324
+ #: iq-block-country.php:124
325
+ msgid ""
326
+ "database does not exists. This plugin will not work until the database file "
327
+ "is present."
328
+ msgstr ""
329
+ "database bestaat niet. Deze plugin kan niet werken totdat deze database "
330
+ "beschikbaar is."
libs/blockcountry-checks.php CHANGED
@@ -45,6 +45,7 @@ function iqblockcountry_check_ipaddress($ip_address)
45
  function iqblockcountry_check($country,$badcountries,$ip_address)
46
  {
47
  $blocked = FALSE;
 
48
  if (is_array ( $badcountries ) && in_array ( $country, $badcountries )) {
49
  $blocked = TRUE;
50
  }
@@ -68,6 +69,19 @@ function iqblockcountry_check($country,$badcountries,$ip_address)
68
  }
69
  }
70
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  return $blocked;
72
  }
73
 
45
  function iqblockcountry_check($country,$badcountries,$ip_address)
46
  {
47
  $blocked = FALSE;
48
+ $blockedpage = get_option('blockcountry_blockpages');
49
  if (is_array ( $badcountries ) && in_array ( $country, $badcountries )) {
50
  $blocked = TRUE;
51
  }
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
+ {
81
+ $blocked = FALSE;
82
+ }
83
+ }
84
+
85
  return $blocked;
86
  }
87
 
libs/blockcountry-settings.php CHANGED
@@ -28,6 +28,8 @@ function iqblockcountry_register_mysettings()
28
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_blockfrontend' );
29
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_blockbackend' );
30
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_header');
 
 
31
  }
32
 
33
  /*
@@ -65,16 +67,19 @@ function iqblockcountry_uninstall() //deletes all the database entries that the
65
  delete_option('blockcountry_lastupdate');
66
  delete_option('blockcountry_version');
67
  delete_option('blockcountry_header');
 
 
68
  }
69
 
70
 
 
71
  function iqblockcountry_settings_tools() {
72
  ?>
73
- <h3>Check which country belongs to an IP Address according to the current database.</h3>
74
 
75
  <form name="ipcheck" action="#ipcheck" method="post">
76
  <input type="hidden" name="action" value="ipcheck" />
77
- IP Address to check: <input type="text" name="ipaddress" lenth="50" />
78
  <?php
79
  if ( isset($_POST['action']) && $_POST[ 'action' ] == 'ipcheck') {
80
  if (isset($_POST['ipaddress']) && !empty($_POST['ipaddress']))
@@ -84,24 +89,27 @@ function iqblockcountry_settings_tools() {
84
  $countrylist = iqblockcountry_get_countries();
85
  if ($country == "Unknown" || $country == "ipv6" || $country == "")
86
  {
87
- echo "<p>No country for $ip_address could be found. Or $ip_address is not a valid IPv4 or IPv6 IP address</p>";
 
88
  }
89
  else {
90
  $displaycountry = $countrylist[$country];
91
- echo "<p>IP Adress $ip_address belongs to $displaycountry.</p>";
92
  $haystack = get_option('blockcountry_banlist');
93
  if (is_array($haystack) && in_array ( $country, $haystack )) {
94
- print "This country is not permitted to visit the frontend of this website.<br />";
 
95
  }
96
  $haystack = get_option('blockcountry_backendbanlist');
97
  if (is_array($haystack) && in_array ( $country, $haystack )) {
98
- print "This country is not permitted to visit the backend of this website.<br />";
 
99
  }
100
  }
101
  }
102
  }
103
- echo '<div class="submit"><input type="submit" name="test" value="' . __( 'Check IP address', 'iq-block-country' ) . '" /></div>';
104
- wp_nonce_field('iq-block-country');
105
  ?>
106
  </form>
107
 
@@ -113,51 +121,97 @@ function iqblockcountry_settings_tools() {
113
 
114
  $lastupdated = date($dateformat,$time);
115
 
116
- echo "<strong>The GeoIP database is updated once a month. Last update: " . $lastupdated . ".</strong>.<br />
117
- If you need a manual update please press buttons below to update.";
118
  ?>
119
 
120
  <form name="download_geoip" action="#download" method="post">
121
  <input type="hidden" name="action" value="download" />
122
  <?php
123
- echo '<div class="submit"><input type="submit" name="test" value="' . __( 'Download new GeoIP Database', 'iq-block-country' ) . '" /></div>';
124
- wp_nonce_field('iq-block-country');
125
  echo '</form>';
126
  ?>
127
  <form name="download_geoip6" action="#download6" method="post">
128
  <input type="hidden" name="action" value="download6" />
129
  <?php
130
- echo '<div class="submit"><input type="submit" name="test" value="' . __( 'Download new GeoIP IPv6 Database', 'iq-block-country' ) . '" /></div>';
131
- wp_nonce_field('iq-block-country');
132
  echo '</form>';
133
 
134
  if ( isset($_POST['action']) && $_POST[ 'action' ] == 'download') {
135
- echo "Downloading....";
136
  iqblockcountry_downloadgeodatabase('4', true);
137
  }
138
  if ( isset($_POST['action']) && $_POST[ 'action' ] == 'download6') {
139
- echo "Downloading....";
140
  iqblockcountry_downloadgeodatabase('6', true);
141
  }
142
 
143
  }
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  /*
146
  * Settings home
147
  */
148
  function iqblockcountry_settings_home()
149
  {
150
  ?>
151
- <h3>Statistics</h3>
152
 
153
  <?php $blocked = get_option('blockcountry_backendnrblocks'); ?>
154
- <p><?php echo $blocked; ?> visitors blocked from the backend.</p>
155
  <?php $blocked = get_option('blockcountry_frontendnrblocks'); ?>
156
- <p><?php echo $blocked; ?> visitors blocked from the frontend.</p>
157
 
158
  <hr />
159
 
160
- <h3>Basic Options</h3>
161
 
162
  <form method="post" action="options.php">
163
  <?php
@@ -192,7 +246,7 @@ function iqblockcountry_settings_home()
192
  <table class="form-table" cellspacing="2" cellpadding="5" width="100%">
193
 
194
  <tr valign="top">
195
- <th width="30%">Message to display when people are blocked:</th>
196
  <td width="70%">
197
  <?php
198
  $blockmessage = get_option ( 'blockcountry_blockmessage' );
@@ -202,20 +256,20 @@ function iqblockcountry_settings_home()
202
  </td></tr>
203
 
204
  <tr valign="top">
205
- <th width="30%">Do not block users that are logged in from visiting frontend website:</th>
206
  <td width="70%">
207
  <input type="checkbox" name="blockcountry_blocklogin" <?php checked('on', get_option('blockcountry_blocklogin'), true); ?> />
208
  </td></tr>
209
 
210
  <tr valign="top">
211
- <th width="30%">Block users from visiting the frontend of your website:</th>
212
  <td width="70%">
213
  <input type="checkbox" name="blockcountry_blockfrontend" <?php checked('on', get_option('blockcountry_blockfrontend'), true); ?> />
214
  </td></tr>
215
 
216
  <tr valign="top">
217
- <th scope="row" width="30%">Select the countries that should be blocked from visiting your frontend:<br />
218
- Use the CTRL key to select multiple countries</th>
219
  <td width="70%">
220
  <select class="chosen" name="blockcountry_banlist[]" multiple="true" style="width:600px;">
221
  <?php
@@ -231,7 +285,7 @@ function iqblockcountry_settings_home()
231
  </select>
232
  </td></tr>
233
  <tr valign="top">
234
- <th width="30%">Frontend whitelist IPv4 and/or IPv6 addresses:<br />Use a semicolon (;) to separate IP addresses</th>
235
  <td width="70%">
236
  <?php
237
  $frontendwhitelist = get_option ( 'blockcountry_frontendwhitelist' );
@@ -239,7 +293,7 @@ function iqblockcountry_settings_home()
239
  <textarea cols="70" rows="5" name="blockcountry_frontendwhitelist"><?php echo $frontendwhitelist; ?></textarea>
240
  </td></tr>
241
  <tr valign="top">
242
- <th width="30%">Frontend blacklist IPv4 and/or IPv6 IP addresses:<br />Use a semicolon (;) to separate IP addresses</th>
243
  <td width="70%">
244
  <?php
245
  $frontendblacklist = get_option ( 'blockcountry_frontendblacklist' );
@@ -247,22 +301,22 @@ function iqblockcountry_settings_home()
247
  <textarea cols="70" rows="5" name="blockcountry_frontendblacklist"><?php echo $frontendblacklist; ?></textarea>
248
  </td></tr>
249
  <tr valign="top">
250
- <th width="30%">Block users from visiting the backend (administrator) of your website:</th>
251
  <td width="70%">
252
  <input type="checkbox" name="blockcountry_blockbackend" <?php checked('on', get_option('blockcountry_blockbackend'), true); ?> />
253
  </td></tr>
254
  <tr>
255
  <th width="30%"></th>
256
  <th width="70%">
257
- Your IP address is <i><?php echo $ip_address ?></i>. The country that is listed for this IP address is <em><?php echo $displaycountry ?></em>.<br />
258
- Do <strong>NOT</strong> set the 'Block users from visiting the backend (administrator) of your website' and also select <?php echo $displaycountry ?> below.<br />
259
- <strong>You will NOT be able to login the next time if you DO block your own country from visiting the backend.</strong>
260
  </th>
261
  </tr>
262
  </td></tr>
263
  <tr valign="top">
264
- <th scope="row" width="30%">Select the countries that should be blocked from visiting your backend:<br />
265
- Use the x behind the country to remove a country from this blocklist.</th>
266
  <td width="70%">
267
 
268
  <select class="chosen" name="blockcountry_backendbanlist[]" multiple="true" style="width:600px;">
@@ -279,8 +333,8 @@ function iqblockcountry_settings_home()
279
  </select>
280
  </td></tr>
281
  <tr valign="top">
282
- <th width="30%">Send headers when user is blocked:<br />
283
- <em>Under normal circumstances you should keep this selected! Only if you have "Cannot modify header information - headers already sent" errors or if you know what you are doing uncheck this.</em></th>
284
  <td width="70%">
285
  <input type="checkbox" name="blockcountry_header" <?php checked('on', get_option('blockcountry_header'), true); ?> />
286
  </td></tr>
@@ -311,7 +365,7 @@ function iqblockcountry_settings_home()
311
  function iqblockcountry_settings_logging()
312
  {
313
  ?>
314
- <h3>Last 15 blocked visits</h3>
315
  <?php
316
  global $wpdb;
317
 
@@ -319,7 +373,7 @@ function iqblockcountry_settings_logging()
319
  $format = get_option('date_format') . ' ' . get_option('time_format');
320
  $countrylist = iqblockcountry_get_countries();
321
  echo '<table class="widefat">';
322
- echo '<thead><tr><th>Date / time</th><th>IP Address</th><th>Hostname</th><th>URL</th><th>Country</th><th>Frontend/backend</th></tr></thead>';
323
 
324
  foreach ($wpdb->get_results( "SELECT * FROM $table_name ORDER BY datetime DESC LIMIT 15" ) as $row)
325
  {
@@ -329,16 +383,16 @@ function iqblockcountry_settings_logging()
329
  $datetime = strtotime($row->datetime);
330
  $mysqldate = date($format, $datetime);
331
  echo $mysqldate . '</td><td>' . $row->ipaddress . '</td><td>' . gethostbyaddr( $row->ipaddress ) . '</td><td>' . $row->url . '</td><td>' . $countryurl . $countrylist[$row->country] . '<td>';
332
- if ($row->banned == "F") echo "Frontend"; else { echo "Backend"; }
333
  echo "</td></tr></tbody>";
334
  }
335
  echo '</table>';
336
 
337
 
338
  echo '<hr>';
339
- echo '<h3>Top countries that are blocked</h3>';
340
  echo '<table class="widefat">';
341
- echo '<thead><tr><th>Country</th><th># of blocked attempts</th></tr></thead>';
342
 
343
  foreach ($wpdb->get_results( "SELECT count(country) AS count,country FROM $table_name GROUP BY country ORDER BY count(country) DESC LIMIT 15" ) as $row)
344
  {
@@ -349,9 +403,9 @@ function iqblockcountry_settings_logging()
349
  echo '</table>';
350
 
351
  echo '<hr>';
352
- echo '<h3>Top hosts that are blocked</h3>';
353
  echo '<table class="widefat">';
354
- echo '<thead><tr><th>IP Adress</th><th>Hostname</th><th># of blocked attempts</th></tr></thead>';
355
 
356
  foreach ($wpdb->get_results( "SELECT count(ipaddress) AS count,ipaddress FROM $table_name GROUP BY ipaddress ORDER BY count(ipaddress) DESC LIMIT 15" ) as $row)
357
  {
@@ -360,9 +414,9 @@ function iqblockcountry_settings_logging()
360
  echo '</table>';
361
 
362
  echo '<hr>';
363
- echo '<h3>Top URLs that are blocked</h3>';
364
  echo '<table class="widefat">';
365
- echo '<thead><tr><th>URL</th><th># of blocked attempts</th></tr></thead>';
366
 
367
  foreach ($wpdb->get_results( "SELECT count(url) AS count,url FROM $table_name GROUP BY url ORDER BY count(url) DESC LIMIT 15" ) as $row)
368
  {
@@ -389,9 +443,10 @@ function iqblockcountry_settings_page() {
389
  ?>
390
 
391
  <h2 class="nav-tab-wrapper">
392
- <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=home" class="nav-tab <?php echo $active_tab == 'home' ? 'nav-tab-active' : ''; ?>">Home</a>
393
- <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=tools" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>">Tools</a>
394
- <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=logging" class="nav-tab <?php echo $active_tab == 'logging' ? 'nav-tab-active' : ''; ?>">Logging</a>
 
395
  </h2>
396
 
397
 
@@ -408,6 +463,10 @@ function iqblockcountry_settings_page() {
408
  {
409
  iqblockcountry_settings_logging();
410
  }
 
 
 
 
411
  else
412
  {
413
  iqblockcountry_settings_home();
@@ -420,7 +479,7 @@ function iqblockcountry_settings_page() {
420
  if (! (file_exists ( IPV4DBFILE ))) {
421
  ?>
422
  <hr>
423
- <p>GeoIP database does not exists. Trying to download it...</p>
424
  <?php
425
 
426
  iqblockcountry_downloadgeodatabase('4', true);
28
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_blockfrontend' );
29
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_blockbackend' );
30
  register_setting ( 'iqblockcountry-settings-group', 'blockcountry_header');
31
+ register_setting ( 'iqblockcountry-settings-group2', 'blockcountry_blockpages');
32
+ register_setting ( 'iqblockcountry-settings-group2', 'blockcountry_pages');
33
  }
34
 
35
  /*
67
  delete_option('blockcountry_lastupdate');
68
  delete_option('blockcountry_version');
69
  delete_option('blockcountry_header');
70
+ delete_option('blockcountry_blockpages');
71
+ delete_option('blockcountry_pages');
72
  }
73
 
74
 
75
+
76
  function iqblockcountry_settings_tools() {
77
  ?>
78
+ <h3><?php _e('Check which country belongs to an IP Address according to the current database.', 'iqblockcountry'); ?></h3>
79
 
80
  <form name="ipcheck" action="#ipcheck" method="post">
81
  <input type="hidden" name="action" value="ipcheck" />
82
+ <?php _e('IP Address to check:', 'iqblockcountry'); ?> <input type="text" name="ipaddress" lenth="50" />
83
  <?php
84
  if ( isset($_POST['action']) && $_POST[ 'action' ] == 'ipcheck') {
85
  if (isset($_POST['ipaddress']) && !empty($_POST['ipaddress']))
89
  $countrylist = iqblockcountry_get_countries();
90
  if ($country == "Unknown" || $country == "ipv6" || $country == "")
91
  {
92
+ echo "<p>" . __('No country for', 'iqblockcountry') . ' ' . $ip_address . ' ' . __('could be found. Or', 'iqblockcountry') . ' ' . $ip_address . ' ' . __('is not a valid IPv4 or IPv6 IP address', 'iqblockcountry');
93
+ echo "</p>";
94
  }
95
  else {
96
  $displaycountry = $countrylist[$country];
97
+ echo "<p>" . __('IP Adress', 'iqblockcountry') . ' ' . $ip_address . ' ' . __('belongs to', 'iqblockcountry') . ' ' . $displaycountry . ".</p>";
98
  $haystack = get_option('blockcountry_banlist');
99
  if (is_array($haystack) && in_array ( $country, $haystack )) {
100
+ _e('This country is not permitted to visit the frontend of this website.', 'iqblockcountry');
101
+ echo "<br />";
102
  }
103
  $haystack = get_option('blockcountry_backendbanlist');
104
  if (is_array($haystack) && in_array ( $country, $haystack )) {
105
+ _e('This country is not permitted to visit the backend of this website.', 'iqblockcountry');
106
+ echo "<br />";
107
  }
108
  }
109
  }
110
  }
111
+ echo '<div class="submit"><input type="submit" name="test" value="' . __( 'Check IP address', 'iqblockcountry' ) . '" /></div>';
112
+ wp_nonce_field('iqblockcountry');
113
  ?>
114
  </form>
115
 
121
 
122
  $lastupdated = date($dateformat,$time);
123
 
124
+ echo "<strong>"; _e('The GeoIP database is updated once a month. Last update: ', 'iqblockcountry'); echo $lastupdated; echo ".</strong>.<br />";
125
+ _e('If you need a manual update please press buttons below to update.', 'iqblockcountry');
126
  ?>
127
 
128
  <form name="download_geoip" action="#download" method="post">
129
  <input type="hidden" name="action" value="download" />
130
  <?php
131
+ echo '<div class="submit"><input type="submit" name="test" value="' . __( 'Download new GeoIP IPv4 Database', 'iqblockcountry' ) . '" /></div>';
132
+ wp_nonce_field('iqblockcountry');
133
  echo '</form>';
134
  ?>
135
  <form name="download_geoip6" action="#download6" method="post">
136
  <input type="hidden" name="action" value="download6" />
137
  <?php
138
+ echo '<div class="submit"><input type="submit" name="test" value="' . __( 'Download new GeoIP IPv6 Database', 'iqblockcountry' ) . '" /></div>';
139
+ wp_nonce_field('iqblockcountry');
140
  echo '</form>';
141
 
142
  if ( isset($_POST['action']) && $_POST[ 'action' ] == 'download') {
143
+ _e ( 'Downloading...' );
144
  iqblockcountry_downloadgeodatabase('4', true);
145
  }
146
  if ( isset($_POST['action']) && $_POST[ 'action' ] == 'download6') {
147
+ _e ( 'Downloading...' );
148
  iqblockcountry_downloadgeodatabase('6', true);
149
  }
150
 
151
  }
152
 
153
+ function iqblockcountry_settings_pages() {
154
+ ?>
155
+ <h3><?php _e('Select which pages are blocked.', 'iqblockcountry'); ?></h3>
156
+ <form method="post" action="options.php">
157
+ <?php
158
+ settings_fields ( 'iqblockcountry-settings-group2' );
159
+ ?>
160
+ <table class="form-table" cellspacing="2" cellpadding="5" width="100%">
161
+ <tr valign="top">
162
+ <th width="30%"><?php _e('Do you want to block individual pages:', 'iqblockcountry'); ?><br />
163
+ <?php _e('If you do not select this option all pages will be blocked.', 'iqblockcountry'); ?></th>
164
+ <td width="70%">
165
+ <input type="checkbox" name="blockcountry_blockpages" value="on" <?php checked('on', get_option('blockcountry_blockpages'), true); ?> />
166
+ </td></tr>
167
+ <tr valign="top">
168
+ <th width="30%"><?php _e('Select pages you want to block:', 'iqblockcountry'); ?></th>
169
+ <td width="70%">
170
+
171
+ <ul>
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) ) {
178
+ $selected = " checked=\"checked\"";
179
+ } else {
180
+ $selected = "";
181
+ }
182
+ }
183
+ echo "<li><input type=\"checkbox\" " . $selected . " name=\"blockcountry_pages[]\" value=\"" . $page->ID . "\" id=\"" . $page->post_title . "\" /> <label for=\"" . $page->post_title . "\">" . $page->post_title . "</label></li>";
184
+ }
185
+ ?>
186
+ </td></tr>
187
+ <tr><td></td><td>
188
+ <p class="submit"><input type="submit" class="button-primary"
189
+ value="<?php _e ( 'Save Changes' )?>" /></p>
190
+ </td></tr>
191
+ </table>
192
+ </form>
193
+
194
+ <?php
195
+ }
196
+
197
+
198
+
199
  /*
200
  * Settings home
201
  */
202
  function iqblockcountry_settings_home()
203
  {
204
  ?>
205
+ <h3><?php _e('Statistics', 'iqblockcountry'); ?></h3>
206
 
207
  <?php $blocked = get_option('blockcountry_backendnrblocks'); ?>
208
+ <p><?php echo $blocked; ?> <?php _e('visitors blocked from the backend.', 'iqblockcountry'); ?></p>
209
  <?php $blocked = get_option('blockcountry_frontendnrblocks'); ?>
210
+ <p><?php echo $blocked; ?> <?php _e('visitors blocked from the frontend.', 'iqblockcountry'); ?></p>
211
 
212
  <hr />
213
 
214
+ <h3><?php _e('Basic Options', 'iqblockcountry'); ?></h3>
215
 
216
  <form method="post" action="options.php">
217
  <?php
246
  <table class="form-table" cellspacing="2" cellpadding="5" width="100%">
247
 
248
  <tr valign="top">
249
+ <th width="30%"><?php _e('Message to display when people are blocked:', 'iqblockcountry'); ?></th>
250
  <td width="70%">
251
  <?php
252
  $blockmessage = get_option ( 'blockcountry_blockmessage' );
256
  </td></tr>
257
 
258
  <tr valign="top">
259
+ <th width="30%"><?php _e('Do not block users that are logged in from visiting frontend website:', 'iqblockcountry'); ?></th>
260
  <td width="70%">
261
  <input type="checkbox" name="blockcountry_blocklogin" <?php checked('on', get_option('blockcountry_blocklogin'), true); ?> />
262
  </td></tr>
263
 
264
  <tr valign="top">
265
+ <th width="30%"><?php _e('Block users from visiting the frontend of your website:', 'iqblockcountry'); ?></th>
266
  <td width="70%">
267
  <input type="checkbox" name="blockcountry_blockfrontend" <?php checked('on', get_option('blockcountry_blockfrontend'), true); ?> />
268
  </td></tr>
269
 
270
  <tr valign="top">
271
+ <th scope="row" width="30%"><?php _e('Select the countries that should be blocked from visiting your frontend:', 'iqblockcountry'); ?><br />
272
+ <?php _e('Use the CTRL key to select multiple countries', 'iqblockcountry'); ?></th>
273
  <td width="70%">
274
  <select class="chosen" name="blockcountry_banlist[]" multiple="true" style="width:600px;">
275
  <?php
285
  </select>
286
  </td></tr>
287
  <tr valign="top">
288
+ <th width="30%"><?php _e('Frontend whitelist IPv4 and/or IPv6 addresses:', 'iqblockcountry'); ?><br /><?php _e('Use a semicolon (;) to separate IP addresses', 'iqblockcountry'); ?></th>
289
  <td width="70%">
290
  <?php
291
  $frontendwhitelist = get_option ( 'blockcountry_frontendwhitelist' );
293
  <textarea cols="70" rows="5" name="blockcountry_frontendwhitelist"><?php echo $frontendwhitelist; ?></textarea>
294
  </td></tr>
295
  <tr valign="top">
296
+ <th width="30%"><?php _e('Frontend blacklist IPv4 and/or IPv6 addresses:', 'iqblockcountry'); ?><br /><?php _e('Use a semicolon (;) to separate IP addresses', 'iqblockcountry'); ?></th>
297
  <td width="70%">
298
  <?php
299
  $frontendblacklist = get_option ( 'blockcountry_frontendblacklist' );
301
  <textarea cols="70" rows="5" name="blockcountry_frontendblacklist"><?php echo $frontendblacklist; ?></textarea>
302
  </td></tr>
303
  <tr valign="top">
304
+ <th width="30%"><?php _e('Block users from visiting the backend (administrator) of your website:', 'iqblockcountry'); ?></th>
305
  <td width="70%">
306
  <input type="checkbox" name="blockcountry_blockbackend" <?php checked('on', get_option('blockcountry_blockbackend'), true); ?> />
307
  </td></tr>
308
  <tr>
309
  <th width="30%"></th>
310
  <th width="70%">
311
+ <?php _e('Your IP address is', 'iqblockcountry'); ?> <i><?php echo $ip_address ?></i>. <?php _e('The country that is listed for this IP address is', 'iqblockcountry'); ?> <em><?php echo $displaycountry ?></em>.<br />
312
+ <?php _e('Do <strong>NOT</strong> set the \'Block users from visiting the backend (administrator) of your website\' and also select', 'iqblockcountry'); ?> <?php echo $displaycountry ?> <?php _e('below.', 'iqblockcountry'); ?><br />
313
+ <?php echo "<strong>" . __('You will NOT be able to login the next time if you DO block your own country from visiting the backend.', 'iqblockcountry') . "</strong>"; ?>
314
  </th>
315
  </tr>
316
  </td></tr>
317
  <tr valign="top">
318
+ <th scope="row" width="30%"><?php _e('Select the countries that should be blocked from visiting your backend:', 'iqblockcountry'); ?><br />
319
+ <?php _e('Use the x behind the country to remove a country from this blocklist.', 'iqblockcountry'); ?></th>
320
  <td width="70%">
321
 
322
  <select class="chosen" name="blockcountry_backendbanlist[]" multiple="true" style="width:600px;">
333
  </select>
334
  </td></tr>
335
  <tr valign="top">
336
+ <th width="30%"><?php _e('Send headers when user is blocked:', 'iqblockcountry'); ?><br />
337
+ <em><?php _e('Under normal circumstances you should keep this selected! Only if you have "Cannot modify header information - headers already sent" errors or if you know what you are doing uncheck this.', 'iqblockcountry'); ?></em></th>
338
  <td width="70%">
339
  <input type="checkbox" name="blockcountry_header" <?php checked('on', get_option('blockcountry_header'), true); ?> />
340
  </td></tr>
365
  function iqblockcountry_settings_logging()
366
  {
367
  ?>
368
+ <h3><?php _e('Last 15 blocked visits', 'iqblockcountry'); ?></h3>
369
  <?php
370
  global $wpdb;
371
 
373
  $format = get_option('date_format') . ' ' . get_option('time_format');
374
  $countrylist = iqblockcountry_get_countries();
375
  echo '<table class="widefat">';
376
+ echo '<thead><tr><th>' . __('Date / Time', 'iqblockcountry') . '</th><th>' . __('IP Address', 'iqblockcountry') . '</th><th>' . __('Hostname', 'iqblockcountry') . '</th><th>' . __('URL', 'iqblockcountry') . '</th><th>' . __('Country', 'iqblockcountry') . '</th><th>' . __('Frontend/Backend', 'iqblockcountry') . '</th></tr></thead>';
377
 
378
  foreach ($wpdb->get_results( "SELECT * FROM $table_name ORDER BY datetime DESC LIMIT 15" ) as $row)
379
  {
383
  $datetime = strtotime($row->datetime);
384
  $mysqldate = date($format, $datetime);
385
  echo $mysqldate . '</td><td>' . $row->ipaddress . '</td><td>' . gethostbyaddr( $row->ipaddress ) . '</td><td>' . $row->url . '</td><td>' . $countryurl . $countrylist[$row->country] . '<td>';
386
+ if ($row->banned == "F") _e('Voorkant', 'iqblockcountry'); else { _e('Achterkant', 'iqblockcountry'); }
387
  echo "</td></tr></tbody>";
388
  }
389
  echo '</table>';
390
 
391
 
392
  echo '<hr>';
393
+ echo '<h3>' . __('Top countries that are blocked', 'iqblockcountry') . '</h3>';
394
  echo '<table class="widefat">';
395
+ echo '<thead><tr><th>' . __('Country', 'iqblockcountry') . '</th><th>' . __('# of blocked attempts', 'iqblockcountry') . '</th></tr></thead>';
396
 
397
  foreach ($wpdb->get_results( "SELECT count(country) AS count,country FROM $table_name GROUP BY country ORDER BY count(country) DESC LIMIT 15" ) as $row)
398
  {
403
  echo '</table>';
404
 
405
  echo '<hr>';
406
+ echo '<h3>' . __('Top hosts that are blocked', 'iqblockcountry') . '</h3>';
407
  echo '<table class="widefat">';
408
+ echo '<thead><tr><th>' . __('IP Address', 'iqblockcountry') . '</th><th>' . __('Hostname', 'iqblockcountry') . '</th><th>' . __('# of blocked attempts', 'iqblockcountry') . '</th></tr></thead>';
409
 
410
  foreach ($wpdb->get_results( "SELECT count(ipaddress) AS count,ipaddress FROM $table_name GROUP BY ipaddress ORDER BY count(ipaddress) DESC LIMIT 15" ) as $row)
411
  {
414
  echo '</table>';
415
 
416
  echo '<hr>';
417
+ echo '<h3>' . __('Top URLs that are blocked', 'iqblockcountry') . '</h3>';
418
  echo '<table class="widefat">';
419
+ echo '<thead><tr><th>' . __('URL', 'iqblockcountry') . '</th><th>' . __('# of blocked attempts', 'iqblockcountry') . '</th></tr></thead>';
420
 
421
  foreach ($wpdb->get_results( "SELECT count(url) AS count,url FROM $table_name GROUP BY url ORDER BY count(url) DESC LIMIT 15" ) as $row)
422
  {
443
  ?>
444
 
445
  <h2 class="nav-tab-wrapper">
446
+ <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=home" class="nav-tab <?php echo $active_tab == 'home' ? 'nav-tab-active' : ''; ?>"><?php _e('Home', 'iqblockcountry'); ?></a>
447
+ <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=pages" class="nav-tab <?php echo $active_tab == 'pages' ? 'nav-tab-active' : ''; ?>"><?php _e('Pages', 'iqblockcountry'); ?></a>
448
+ <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=tools" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools.', 'iqblockcountry'); ?></a>
449
+ <a href="?page=iq-block-country/libs/blockcountry-settings.php&tab=logging" class="nav-tab <?php echo $active_tab == 'logging' ? 'nav-tab-active' : ''; ?>"><?php _e('Logging', 'iqblockcountry'); ?></a>
450
  </h2>
451
 
452
 
463
  {
464
  iqblockcountry_settings_logging();
465
  }
466
+ elseif ($active_tab == "pages")
467
+ {
468
+ iqblockcountry_settings_pages();
469
+ }
470
  else
471
  {
472
  iqblockcountry_settings_home();
479
  if (! (file_exists ( IPV4DBFILE ))) {
480
  ?>
481
  <hr>
482
+ <p><?php _e('GeoIP database does not exists. Trying to download it...', 'iqblockcountry'); ?></p>
483
  <?php
484
 
485
  iqblockcountry_downloadgeodatabase('4', true);
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
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -74,6 +74,21 @@ You can style the message by using CSS in the textbox. You are also able to incl
74
 
75
  You can also provide a link to another page explaining why they might be banned. Only culprit is that it cannot be a page on the same domain name as people would be banned from that page as well.
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  = Does this plugin also work with IPv6? =
78
 
79
  Since v1.0.7 this plugin supports IPv6. But as IPv6 is still scarce it may not work as well as IPv4.
@@ -148,6 +163,11 @@ If this does not help you out deselect "Send headers when user is blocked". This
148
 
149
  == Changelog ==
150
 
 
 
 
 
 
151
  = 1.1 =
152
 
153
  * Added statistics to the plugin.
@@ -220,6 +240,10 @@ If this does not help you out deselect "Send headers when user is blocked". This
220
 
221
  == Upgrade Notice ==
222
 
 
 
 
 
223
  = 1.1 =
224
 
225
  An additional database table was added for the statistics.
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.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
74
 
75
  You can also provide a link to another page explaining why they might be banned. Only culprit is that it cannot be a page on the same domain name as people would be banned from that page as well.
76
 
77
+ You can use for instance:
78
+
79
+ <style type="text/css">
80
+ body {
81
+ color: red;
82
+ background-color: #ffffff; }
83
+ h1 {
84
+ font-family: Helvetica, Geneva, Arial,
85
+ SunSans-Regular, sans-serif }
86
+ </style>
87
+
88
+ <h1>Go away!</h1>
89
+
90
+ you basicly can use everything as within a normal HTML page. Including images for instance.
91
+
92
  = Does this plugin also work with IPv6? =
93
 
94
  Since v1.0.7 this plugin supports IPv6. But as IPv6 is still scarce it may not work as well as IPv4.
163
 
164
  == Changelog ==
165
 
166
+ = 1.1.1 =
167
+
168
+ * You can now choose to block individual pages. Leaving other pages open for visitors from blocked countries. You can for instance use this feature to block countries from visiting specific pages due to content rights etc.
169
+ * Source now supports localization. Included is the English and Dutch language. I'd be happy to include other translations if anyone can supply those to me.
170
+
171
  = 1.1 =
172
 
173
  * Added statistics to the plugin.
240
 
241
  == Upgrade Notice ==
242
 
243
+ = 1.1.1 =
244
+
245
+ There are no specific upgrade notices other than the those already mentioned in the changelog.
246
+
247
  = 1.1 =
248
 
249
  An additional database table was added for the statistics.