IP Geo Block - Version 3.0.14

Version Description

  • Fix issue: Fix wrong handling of anonymized IPv6 on clicking a link or applying bulk actions.
  • Fix issue: Fix the issue that added a server's country code which was not in "Whitelist of country code" but its IP address was in "Whitelist of extra IP addresses prior to country code" on activation. (forum topic)
  • Fix issue: Fix the issue of "Fatal error: Call to undefined function" which caused 500 Internal error on admin screen under a certain condition.
  • Fix issue: Fix the issue of undefined symbol for openssl in PHP 5.3.5 and under.
  • New feature: Introduce an emergency login link in "Plugins settings" section.
  • New feature: Introduce a new filter hook ip-geo-block-dns to specify the primary and secondary domain name resolvers.
  • New feature: Introduce a new filter hook ip-geo-block-logs. (forum topic)
  • New feature: Introduce a new drop-in file drop-in-admin.php in Geolocation API library folder.
  • Improvement: Provide help links on "Settings" tab.
  • Improvement: Sort out some related items in the section on "Settings" tab.
  • Improvement: All the http had been replaced to https if possible.
Download this release

Release Info

Developer tokkonopapa
Plugin Icon 128x128 IP Geo Block
Version 3.0.14
Comparing to
See all releases

Code changes from version 3.0.12.1 to 3.0.14

Files changed (120) hide show
  1. README.txt +78 -56
  2. admin/class-ip-geo-block-admin.php +95 -59
  3. admin/css/admin-icons.css +90 -34
  4. admin/css/admin-icons.min.css +7 -2
  5. admin/css/admin.css +89 -74
  6. admin/css/admin.min.css +1 -1
  7. admin/css/cidr.min.css +1 -1
  8. admin/css/fonts/icomoon.eot +0 -0
  9. admin/css/fonts/icomoon.svg +2 -7
  10. admin/css/fonts/icomoon.ttf +0 -0
  11. admin/css/fonts/icomoon.woff +0 -0
  12. admin/datatables/css/datatables-all.css +218 -181
  13. admin/datatables/css/datatables-all.min.css +5 -3
  14. admin/datatables/js/dataTables.responsive.js +3 -3
  15. admin/datatables/js/datatables-all.js +13 -13
  16. admin/datatables/js/datatables-all.min.js +1 -1
  17. admin/datatables/js/jquery.dataTables.js +10 -10
  18. admin/datatables/js/jquery.dataTables.min.js +1 -1
  19. admin/datatables/license.txt +1 -1
  20. admin/images/ajax-loader-snake.gif +0 -0
  21. admin/includes/class-admin-ajax.php +39 -27
  22. admin/includes/class-admin-rewrite.php +3 -3
  23. admin/includes/tab-accesslog.php +14 -20
  24. admin/includes/tab-attribution.php +4 -9
  25. admin/includes/tab-geolocation.php +17 -20
  26. admin/includes/tab-network.php +3 -5
  27. admin/includes/tab-settings.php +460 -513
  28. admin/includes/tab-statistics.php +29 -40
  29. admin/js/admin.js +63 -28
  30. admin/js/admin.min.js +6 -6
  31. admin/js/whois.js +2 -2
  32. admin/js/whois.min.js +1 -1
  33. classes/class-ip-geo-block-actv.php +1 -1
  34. classes/class-ip-geo-block-apis.php +20 -20
  35. classes/class-ip-geo-block-cron.php +5 -5
  36. classes/class-ip-geo-block-file.php +2 -2
  37. classes/class-ip-geo-block-lkup.php +30 -35
  38. classes/class-ip-geo-block-load.php +1 -1
  39. classes/class-ip-geo-block-logs.php +326 -108
  40. classes/class-ip-geo-block-opts.php +30 -18
  41. classes/class-ip-geo-block-util.php +173 -101
  42. classes/class-ip-geo-block.php +36 -32
  43. includes/Net/DNS2.php +1 -1
  44. includes/Net/DNS2/BitMap.php +0 -254
  45. includes/Net/DNS2/Cache.php +0 -311
  46. includes/Net/DNS2/Cache/File.php +0 -247
  47. includes/Net/DNS2/Cache/Shm.php +0 -318
  48. includes/Net/DNS2/PrivateKey.php +0 -424
  49. includes/Net/DNS2/RR/A.php +0 -156
  50. includes/Net/DNS2/RR/AAAA.php +0 -177
  51. includes/Net/DNS2/RR/AFSDB.php +0 -174
  52. includes/Net/DNS2/RR/ANY.php +0 -129
  53. includes/Net/DNS2/RR/APL.php +0 -343
  54. includes/Net/DNS2/RR/ATMA.php +0 -210
  55. includes/Net/DNS2/RR/AVC.php +0 -75
  56. includes/Net/DNS2/RR/CAA.php +0 -179
  57. includes/Net/DNS2/RR/CDNSKEY.php +0 -77
  58. includes/Net/DNS2/RR/CDS.php +0 -77
  59. includes/Net/DNS2/RR/CERT.php +0 -292
  60. includes/Net/DNS2/RR/CSYNC.php +0 -203
  61. includes/Net/DNS2/RR/DHCID.php +0 -207
  62. includes/Net/DNS2/RR/DLV.php +0 -75
  63. includes/Net/DNS2/RR/DNAME.php +0 -153
  64. includes/Net/DNS2/RR/DNSKEY.php +0 -198
  65. includes/Net/DNS2/RR/DS.php +0 -209
  66. includes/Net/DNS2/RR/EID.php +0 -130
  67. includes/Net/DNS2/RR/EUI48.php +0 -187
  68. includes/Net/DNS2/RR/EUI64.php +0 -188
  69. includes/Net/DNS2/RR/HINFO.php +0 -175
  70. includes/Net/DNS2/RR/HIP.php +0 -287
  71. includes/Net/DNS2/RR/IPSECKEY.php +0 -386
  72. includes/Net/DNS2/RR/ISDN.php +0 -190
  73. includes/Net/DNS2/RR/KEY.php +0 -85
  74. includes/Net/DNS2/RR/KX.php +0 -179
  75. includes/Net/DNS2/RR/L32.php +0 -180
  76. includes/Net/DNS2/RR/L64.php +0 -187
  77. includes/Net/DNS2/RR/LOC.php +0 -440
  78. includes/Net/DNS2/RR/LP.php +0 -177
  79. includes/Net/DNS2/RR/MX.php +0 -175
  80. includes/Net/DNS2/RR/NAPTR.php +0 -231
  81. includes/Net/DNS2/RR/NID.php +0 -187
  82. includes/Net/DNS2/RR/NIMLOC.php +0 -130
  83. includes/Net/DNS2/RR/NS.php +0 -153
  84. includes/Net/DNS2/RR/NSAP.php +0 -262
  85. includes/Net/DNS2/RR/NSEC.php +0 -184
  86. includes/Net/DNS2/RR/NSEC3.php +0 -310
  87. includes/Net/DNS2/RR/NSEC3PARAM.php +0 -220
  88. includes/Net/DNS2/RR/OPENPGPKEY.php +0 -159
  89. includes/Net/DNS2/RR/PX.php +0 -186
  90. includes/Net/DNS2/RR/RP.php +0 -167
  91. includes/Net/DNS2/RR/RRSIG.php +0 -329
  92. includes/Net/DNS2/RR/RT.php +0 -175
  93. includes/Net/DNS2/RR/SMIMEA.php +0 -75
  94. includes/Net/DNS2/RR/SPF.php +0 -75
  95. includes/Net/DNS2/RR/SRV.php +0 -186
  96. includes/Net/DNS2/RR/SSHFP.php +0 -250
  97. includes/Net/DNS2/RR/TA.php +0 -75
  98. includes/Net/DNS2/RR/TALINK.php +0 -171
  99. includes/Net/DNS2/RR/TKEY.php +0 -307
  100. includes/Net/DNS2/RR/TLSA.php +0 -194
  101. includes/Net/DNS2/RR/TXT.php +0 -177
  102. includes/Net/DNS2/RR/URI.php +0 -183
  103. includes/Net/DNS2/RR/WKS.php +0 -235
  104. includes/Net/DNS2/RR/X25.php +0 -160
  105. includes/Net/DNS2/Updater.php +0 -654
  106. includes/Net/IPv4.php +0 -0
  107. includes/random_compat/LICENSE +22 -0
  108. includes/random_compat/byte_safe_strings.php +195 -0
  109. includes/random_compat/cast_to_int.php +77 -0
  110. includes/random_compat/error_polyfill.php +49 -0
  111. includes/random_compat/random.php +225 -0
  112. includes/random_compat/random_bytes_com_dotnet.php +91 -0
  113. includes/random_compat/random_bytes_dev_urandom.php +172 -0
  114. includes/random_compat/random_bytes_libsodium.php +91 -0
  115. includes/random_compat/random_bytes_libsodium_legacy.php +93 -0
  116. includes/random_compat/random_bytes_mcrypt.php +79 -0
  117. includes/random_compat/random_int.php +204 -0
  118. ip-geo-block.php +4 -4
  119. languages/ip-geo-block-ja.mo +0 -0
  120. languages/ip-geo-block-ja.po +448 -457
README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: tokkonopapa
3
  Donate link:
4
  Tags: security, firewall, brute force, vulnerability, login, wp-admin, admin, ajax, xmlrpc, comment, pingback, trackback, spam, IP address, geo, geolocation, buddypress, bbPress
5
  Requires at least: 3.7
6
- Tested up to: 4.9.6
7
- Stable tag: 3.0.12.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.txt
10
 
@@ -33,7 +33,7 @@ After several days of installation, you'll be supprised to find many malicious o
33
  In order to prevent hacking through the login form and XML-RPC by brute-force and the reverse-brute-force attacks, the number of login attempts will be limited per IP address even from the permitted countries.
34
 
35
  * **Minimize server load against brute-force attacks:**
36
- You can configure this plugin as a [Must Use Plugins](https://codex.wordpress.org/Must_Use_Plugins "Must Use Plugins « WordPress Codex") so that this plugin can be loaded prior to regular plugins. It can massively [reduce the load on server](http://www.ipgeoblock.com/codex/validation-timing.html "Validation timing | IP Geo Block").
37
 
38
  * **Prevent malicious down/uploading:**
39
  A malicious request such as exposing `wp-config.php` or uploading malwares via vulnerable plugins/themes can be blocked.
@@ -48,8 +48,8 @@ After several days of installation, you'll be supprised to find many malicious o
48
  When you click an external hyperlink on admin screens, http referrer will be eliminated to hide a footprint of your site.
49
 
50
  * **Multiple source of IP Geolocation databases:**
51
- [MaxMind GeoLite2 free databases](http://www.maxmind.com "MaxMind - IP Geolocation and Online Fraud Prevention") (it requires PHP 5.4.0+) and [IP2Location LITE databases](http://www.ip2location.com/ "IP Address Geolocation to Identify Website Visitor's Geographical Location") can be installed in this plugin. Also free Geolocation REST APIs and whois information can be available for audit purposes.
52
- Father more, [dedicated API class libraries](http://www.ipgeoblock.com/article/api-class-library.html "CloudFlare & CloudFront API class library | IP Geo Block") can be installed for CloudFlare and CloudFront as a reverse proxy service.
53
 
54
  * **Customizing response:**
55
  HTTP response code can be selectable as `403 Forbidden` to deny access pages, `404 Not Found` to hide pages or even `200 OK` to redirect to the top page.
@@ -59,27 +59,27 @@ After several days of installation, you'll be supprised to find many malicious o
59
  Validation logs for useful information to audit attack patterns can be manageable.
60
 
61
  * **Cooperation with full spec security plugin:**
62
- This plugin is lite enough to be able to cooperate with other full spec security plugin such as [Wordfence Security](https://wordpress.org/plugins/wordfence/ "Wordfence Security — WordPress Plugins"). See [this report](http://www.ipgeoblock.com/codex/page-speed-performance.html "Page speed performance | IP Geo Block") about page speed performance.
63
 
64
  * **Extendability:**
65
- You can customize the behavior of this plugin via `add_filter()` with [pre-defined filter hook](http://www.ipgeoblock.com/codex/ "Codex | IP Geo Block"). See various use cases in [samples.php](https://github.com/tokkonopapa/WordPress-IP-Geo-Block/blob/master/ip-geo-block/samples.php "WordPress-IP-Geo-Block/samples.php at master - tokkonopapa/WordPress-IP-Geo-Block - GitHub") bundled within this package.
66
  You can also get the extension [IP Geo Allow](https://github.com/ddur/WordPress-IP-Geo-Allow "GitHub - ddur/WordPress-IP-Geo-Allow: WordPress Plugin Exension for WordPress-IP-Geo-Block Plugin") by [Dragan](https://github.com/ddur "ddur (Dragan) - GitHub"). It makes admin screens strictly private with more flexible way than specifying IP addresses.
67
 
68
  * **Self blocking prevention and easy rescue:**
69
- Website owners do not prefer themselves to be blocked. This plugin prevents such a sad thing unless you force it. And futhermore, if such a situation occurs, you can [rescue yourself](http://www.ipgeoblock.com/codex/what-should-i-do-when-i-m-locked-out.html "What should I do when I'm locked out? | IP Geo Block") easily.
70
 
71
  * **Clean uninstallation:**
72
  Nothing is left in your precious mySQL database after uninstallation. So you can feel free to install and activate to make a trial of this plugin's functionality.
73
 
74
  = Attribution =
75
 
76
- This package includes GeoLite2 library distributed by MaxMind, available from [MaxMind](http://www.maxmind.com "MaxMind - IP Geolocation and Online Fraud Prevention") (it requires PHP 5.4.0+), and also includes IP2Location open source libraries available from [IP2Location](http://www.ip2location.com "IP Address Geolocation to Identify Website Visitor's Geographical Location").
77
 
78
  Also thanks for providing the following great services and REST APIs for free.
79
 
80
  * [https://ipdata.co/](https://ipdata.co/ "ipdata.co - IP Geolocation and Threat Data API") (IPv4, IPv6 / free)
81
  * [https://ipinfo.io/](https://ipinfo.io/ "IP Address API and Data Solutions") (IPv4, IPv6 / free)
82
- * [http://geoip.nekudo.com/](http://geoip.nekudo.com/ "Free IP GeoLocation/GeoIp API - geoip.nekudo.com") (IPv4, IPv6 / free)
83
  * [http://geoiplookup.net/](http://geoiplookup.net/ "What Is My IP Address | GeoIP Lookup") (IPv4, IPv6 / free)
84
  * [http://ip-api.com/](http://ip-api.com/ "IP-API.com - Free Geolocation API") (IPv4, IPv6 / free for non-commercial use)
85
  * [https://ipinfodb.com/](https://ipinfodb.com/ "Free IP Geolocation Tools and API| IPInfoDB") (IPv4, IPv6 / free for registered user, need API key)
@@ -89,7 +89,7 @@ Also thanks for providing the following great services and REST APIs for free.
89
 
90
  Development of this plugin is promoted at [WordPress-IP-Geo-Block](https://github.com/tokkonopapa/WordPress-IP-Geo-Block "tokkonopapa/WordPress-IP-Geo-Block - GitHub") and class libraries to handle geo-location database are developed separately as "add-in"s at [WordPress-IP-Geo-API](https://github.com/tokkonopapa/WordPress-IP-Geo-API "tokkonopapa/WordPress-IP-Geo-API - GitHub").
91
 
92
- All contributions will always be welcome. Or visit my [development blog](http://www.ipgeoblock.com/ "IP Geo Block").
93
 
94
  == Installation ==
95
 
@@ -101,7 +101,7 @@ All contributions will always be welcome. Or visit my [development blog](http://
101
  4. Activate the plugin on the Plugin dashboard
102
  5. Try 'Best for Back-end' button for easy setup at the bottom of this plugin's setting page.
103
 
104
- Please refer to [the document](http://www.ipgeoblock.com/codex/ "Codex | IP Geo Block")
105
  or following descriptions for your best setup.
106
 
107
  = Validation rule settings =
@@ -110,10 +110,10 @@ or following descriptions for your best setup.
110
  Choose either `White list` (recommended) or `Black list` to specify the countries from which you want to pass or block.
111
 
112
  * **Whitelist/Blacklist of country code**
113
- Specify the country code with two letters (see [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements "ISO 3166-1 alpha-2 - Wikipedia, the free encyclopedia")). Each of them should be separated by comma.
114
 
115
  * **Use Autonomous System Number (ASN)**
116
- It enables you to use "AS number" in the whitelist and blacklist of extra IP addresses to specify a group of IP networks.
117
 
118
  * **Whitelist/Blacklist of extra IP addresses prior to country code**
119
  The list of extra IP addresses prior to the validation of country code. [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing "Classless Inter-Domain Routing - Wikipedia, the free encyclopedia") and [AS number](https://en.wikipedia.org/wiki/Autonomous_system_(Internet) "Autonomous system (Internet) - Wikipedia") are also acceptable to specify the range.
@@ -128,7 +128,7 @@ or following descriptions for your best setup.
128
  It restricts the file types on upload to block malware and backdoor via both back-end and front-end.
129
 
130
  * **Response code**
131
- Choose one of the [response code](http://tools.ietf.org/html/rfc2616#section-10 "RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1") to be sent when it blocks a comment.
132
  The 2xx code will lead to your top page, the 3xx code will redirect to [Black Hole Server](http://blackhole.webpagetest.org/), the 4xx code will lead to WordPress error page, and the 5xx will pretend an server error.
133
 
134
  * **Max number of failed login attempts per IP address**
@@ -186,7 +186,7 @@ or following descriptions for your best setup.
186
  = Geolocation API settings =
187
 
188
  * **API selection and key settings**
189
- If you wish to use `IPInfoDB`, you should register at [their site](http://ipinfodb.com/ "IPInfoDB | Free IP Address Geolocation Tools") to get a free API key and set it into the textfield. And `ip-api.com` and `Smart-IP.net` require non-commercial use.
190
 
191
  = Local database settings settings =
192
 
@@ -242,7 +242,7 @@ or following descriptions for your best setup.
242
 
243
  = Does the site using this plugin comply with GDPR? =
244
 
245
- Using this plugin itself should not be the problem, because from version 3.0.11 IP addresses in logs and cache of this plugin are encrypted by default in preparation for personal data breach. It also not only provides a way to manually erase them but also has the functionality to remove them when those are exceeded a certain amount/time. The option "Privacy friendly" helps you to restrict sending the ip address to the 3rd parties such as geolocation APIs and whois service equipped in this plugin. However, these functions are part of the requirements that GDPR requires and do not guarantee that the site is compliant with GDPR. Refer to [3.0.11 release note](http://www.ipgeoblock.com/changelog/release-3.0.11.html) for details.
246
 
247
  = Does this plugin support multisite? =
248
 
@@ -273,17 +273,17 @@ Other plugins adopting `mod_rewrite` (e.g. WP Fastest Cache) or `advanced-cache.
273
 
274
  Thus your site would have less risk against the exploiting via vulnerable plugins and themes.
275
 
276
- For more details, please refer to some documents at "[Blocking on front-end](http://www.ipgeoblock.com/codex/#blocking-on-front-end 'Codex | IP Geo Block')".
277
 
278
  = I still have access from blacklisted country. Does it work correctly? =
279
 
280
  Absolutely, YES.
281
 
282
- Sometimes, a Wordfence Security user would report this type of claim when he/she found some accesses in its Live traffic view. But please don't worry. Before WordPress runs, Wordfence cleverly filters out malicious requests to your site using <a href="http://php.net/manual/en/ini.core.php#ini.auto-prepend-file" title="PHP: Description of core php.ini directives - Manual">auto_prepend_file</a> directive to include PHP based Web Application Firewall. Then this plugin validates the rest of the requests that pass over Wordfence because those were not in WAF rules, especially you enables "**Prevent Zero-day Exploit**".
283
 
284
  It would also possibly be caused by the accuracy of country code in the geolocation databases. Actually, there is a case that a same IP address has different country code.
285
 
286
- For more detail, please refer to "[I still have access from blacklisted country.](http://www.ipgeoblock.com/codex/access-from-blacklisted-country.html 'I still have access from blacklisted country. | IP Geo Block')".
287
 
288
  = How can I test this plugin works? =
289
 
@@ -293,7 +293,7 @@ Another one is to use [http header browser addon](https://www.google.com/search?
293
 
294
  You can add an IP address to the `X-Forwarded-For` header to emulate the access behind the proxy. In this case, you should add `HTTP_X_FORWARDED_FOR` into the "**$_SERVER keys for extra IPs**" on "**Settings**" tab.
295
 
296
- See more details at "[How to test prevention of attacks](http://www.ipgeoblock.com/codex/#how-to-test-prevention-of-attacks 'Codex | IP Geo Block')".
297
 
298
  = I'm locked out! What shall I do? =
299
 
@@ -319,7 +319,7 @@ After saving and uploading it to `/wp-content/plugins/ip-geo-block/` on your ser
319
 
320
  Remember that you should upload the original one after re-configuration to deactivate this feature.
321
 
322
- [This document](http://www.ipgeoblock.com/codex/what-should-i-do-when-i-m-locked-out.html "What should I do when I'm locked out? | IP Geo Block") can also help you.
323
 
324
  = Do I have to turn on all the selection to enhance security? =
325
 
@@ -337,7 +337,7 @@ Yes. Roughly speaking, the strategy of this plugin has been constructed as follo
337
  - **Bad signatures in query**
338
  It blocks the request which has not been covered in the above three.
339
 
340
- Please try "**Best for Back-end**" button at the bottom of this plugin's setting page for easy setup. And also see more details in "[The best practice of target settings](http://www.ipgeoblock.com/codex/the-best-practice-for-target-settings.html 'The best practice of target settings | IP Geo Block')".
341
 
342
  = Does this plugin validate all the requests? =
343
 
@@ -347,17 +347,17 @@ But there're exceptions: When you enable "**Force to load WP core**" for **Plugi
347
 
348
  = How to resolve "Sorry, your request cannot be accepted."? =
349
 
350
- If you encounter this message, please refer to [this document](http://www.ipgeoblock.com/codex/you-are-not-allowed-to-access.html "Why &ldquo;Sorry, your request cannot be accepted&rdquo; ? | IP Geo Block") to resolve your blocking issue.
351
 
352
  If you can't solve your issue, please let me know about it on the [support forum](https://wordpress.org/support/plugin/ip-geo-block/ "View: Plugin Support &laquo; WordPress.org Forums"). Your logs in this plugin and "**Installation information**" at "**Plugin settings**" will be a great help to resolve the issue.
353
 
354
  = How can I fix "Unable to write" error? =
355
 
356
- When you enable "**Force to load WP core**" options, this plugin will try to configure `.htaccess` in your `/wp-content/plugins/` and `/wp-content/themes/` directory in order to protect your site against the malicous attacks to the [OMG plugins and themes](http://www.ipgeoblock.com/article/exposure-of-wp-config-php.html "Prevent exposure of wp-config.php | IP Geo Block").
357
 
358
  But some servers doesn't give read / write permission against `.htaccess` to WordPress. In this case, you can configure `.htaccess` files by your own hand instead of enabling "**Force to load WP core**" options.
359
 
360
- Please refer to "[How can I fix permission troubles?](http://www.ipgeoblock.com/codex/how-can-i-fix-permission-troubles.html 'How can I fix permission troubles? | IP Geo Block')" in order to fix this error.
361
 
362
  == Other Notes ==
363
 
@@ -382,11 +382,33 @@ Please refer to "[How can I fix permission troubles?](http://www.ipgeoblock.com/
382
 
383
  == Changelog ==
384
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  = 3.0.12.1 =
386
- * **Issue fix:** Unexpected blocking cause by an extra slash at the end of `$_SERVER['DOCUMENT_ROOT']` that might be added by server's configuration. ([forum topic](https://wordpress.org/support/topic/wpwebinar/ "Topic: WPWebinar &#124; WordPress.org"))
387
- * **Issue fix:** [Human friendly error page](http://www.ipgeoblock.com/codex/customizing-the-response.html#human-friendly-error-page) now works properly. ([forum topic](https://wordpress.org/support/topic/problem-with-permalinks-51/ "Topic: Problem with Permalinks &#124; WordPress.org"))
388
- * **Issue fix:** Fix the conflict with WP hide & Security Enhancer. ([forum topic](https://wordpress.org/support/topic/problem-with-permalinks-51/ "Topic: Problem with Permalinks &#124; WordPress.org"))
389
- * **Issue fix:** Hotfix [WordPress File Delete to Code Execution](https://blog.ripstech.com/2018/wordpress-file-delete-to-code-execution/ "WARNING: WordPress File Delete to Code Execution") by RIPS Technologies.
390
 
391
  = 3.0.12 =
392
  * **Improvement:** Enhance "Privacy and record settings" where "Expiration time [sec] for Logs" can be specified.
@@ -398,7 +420,7 @@ Please refer to "[How can I fix permission troubles?](http://www.ipgeoblock.com/
398
  * **Improvement:** Update geolocation APIs and add a new one.
399
  * **Improvement:** Change the JavaScript compressor from Google Closure Compiler to UglifyJS 2 to prevent "Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined" in a certain environment.
400
  * **Fix:** Fix the issue that blocking occurred immediately instead of displaying the login page again when login failed, even the number of times did not exceed the limit.
401
- * See [3.0.11 release note](http://www.ipgeoblock.com/changelog/release-3.0.11.html) for some details.
402
 
403
  = 3.0.10.4 =
404
  * **Fix:** JavaScript error caused by bad handling form tag without method property. This error was happened with Wordfence Live Traffic.
@@ -438,7 +460,7 @@ If you still find the error "/plugins/ip-geo-block/classes/class-ip-geo-block-lo
438
  * **Maintenance:** Change the priority order of local geolocation databases.
439
  * **Bug fix:** Fix the issue that the target action for login form on settings tab could not unchecked on saving changes.
440
  * **Bug fix:** Fix some other minor bugs.
441
- * See [3.0.9 release note](http://www.ipgeoblock.com/changelog/release-3.0.9.html "3.0.9 Release Note | IP Geo Block") for some details.
442
 
443
  = 3.0.8 =
444
  * **Improvement:** Use both Maxmind Legacy and GeoLite2 databases parallely.
@@ -471,14 +493,14 @@ Sorry for frequent update but the following bug should be fixed.
471
  * **Bug fix:** Fix the bug using php short open tag on "Logs" tab.
472
  * **Bug fix:** Fix the bug related to absolute path in filesystem on windows system.
473
  * **Bug fix:** Fix the issue that "Auto updating (once a month)" could not be disabled.
474
- * See [3.0.6 release note](http://www.ipgeoblock.com/changelog/release-3.0.6.html "3.0.6 Release Note | IP Geo Block") for some details.
475
 
476
  = 3.0.5 =
477
  * **New feature:** Add "Live update" mode on "Logs" tab.
478
  * **Improvement:** List all the IP addresses in cache are now displayed and manageable on "Statistics" tab.
479
  * **Improvement:** Add "Either blocked or passed" as a new condition for recording logs. It enables to verify the requests "passed" from the blacklisted countries or the countries not in the whitelist.
480
  * **Improvement:** Add two new filter hooks to utilize Google APIs from native domain in China.
481
- * See [3.0.5 release note](http://www.ipgeoblock.com/changelog/release-3.0.5.html "3.0.5 Release Note | IP Geo Block") for some details.
482
 
483
  = 3.0.4.6 =
484
  * **Bug fix:** Fix the issue that the emergent functionality didn't work when the number of login attempts reached to the limit.
@@ -521,7 +543,7 @@ Thank you all for taking your time again since last update.
521
  * **Improvement:** Inhibit to embed a special nonce into links when WP-ZEP is disabled at each target. This may improve compatibility with some plugins and themes.
522
  * **Bug fix:** Fix the issue of verifying file upload. It could not handle multiple files. ([@](https://wordpress.org/support/topic/incompatible-with-awesome-support-plugin/#post-9403708 "Topic: incompatible with Awesome Support plugin &laquo; WordPress.org Forums"))
523
  * **Bug fix:** Fix the issue of illegal click event handling on anchor tag without href. ([@](https://wordpress.org/support/topic/pagebuilder-broken-by-ipgeoblock-v3-0-3-4/ "Topic: Pagebuilder broken by IPGeoblock v3.0.3.4 &laquo; WordPress.org Forums"))
524
- * See [3.0.4 release note](http://www.ipgeoblock.com/changelog/release-3.0.4.html "3.0.4 Release Note | IP Geo Block") for some details.
525
 
526
  = 3.0.3.4 =
527
  * **Improvement:** Some minor refactoring for the future release.
@@ -564,7 +586,7 @@ This is a maintenance release addressing various internal improvement.
564
  * **Improvement:** Better handling of server and private IP address.
565
  * **Bug fix:** Fix the bug of "Export/Import settings". **Please export json file again if you hold it as backup purpose** because some of settings data might be incompatible.
566
  * **Bug fix:** Fix the bug of "Password Reset" caused by miss-spelling "resetpasss".
567
- * See some details at [release 3.0.3](http://www.ipgeoblock.com/changelog/release-3.0.3.html "3.0.3 Release Note | IP Geo Block").
568
 
569
  = 3.0.2.2 =
570
  * **Improvement:** Change the behavior of "Referrer Suppressor" not to open a new window on public facing pages.
@@ -588,8 +610,8 @@ This is a maintenance release addressing some issues.
588
  * **New feature:** Add "Exceptions" for "Admin ajax/post" to specify the name of action which causes undesired blocking (typically on the public facing pages).
589
  * **Improvement:** Add "Disable" to "Max number of failed login attempts per IP address" to avoid conflict with other similar plugin.
590
  * **Improvement:** Update geolocation database libraries to 1.1.7 for better compatibility on some platform.
591
- * **Trial feature:** Add custom action hook `ip-geo-block-send-response`. This is useful to control firewall via [fail2ban](http://www.fail2ban.org/ "Fail2ban") like [WP fail2ban](https://wordpress.org/plugins/wp-fail2ban/ "WP fail2ban - WordPress Plugins").
592
- * See some details at [release 3.0.2](http://www.ipgeoblock.com/changelog/release-3.0.2.html "3.0.2 Release Note | IP Geo Block").
593
 
594
  = 3.0.1.2 =
595
  * **Bug fix:** Fix the blocking issue in some environments when upgrading from 2.2.9.1 to 3.0.0.
@@ -617,7 +639,7 @@ This is a maintenance release addressing some issues.
617
  * **Improvement:** Better compatibility with some plugins, themes and widgets.
618
  * **Improvement:** Deferred execution of SQL command to improve the response.
619
  * **Improvement:** Make the response compatible with WP original when it is requested by GET method.
620
- * See some details at [release 3.0.0](http://www.ipgeoblock.com/changelog/release-3.0.0.html "3.0.0 Release Note | IP Geo Block").
621
 
622
  = 2.2.9.1 =
623
  * **Bug fix:** Blocking Wordfence scanning. ([@](https://wordpress.org/support/topic/wordfence-conflict-2/ "WordFence Conflict"))
@@ -630,7 +652,7 @@ This is a maintenance release addressing some issues.
630
  * **New feature:** A new option that makes this plugin configured as a "Must-use plugin". It can massively reduce the server load especially against brute-force attacks because it initiates this plugin prior to other typical plugins.
631
  * **Improvement:** Validation of a certain signature against XSS is internally added to "Bad signature in query" by default.
632
  * **Improvement:** Improved compatibility with PHP 7 (Thanks to [FireMyst](https://wordpress.org/support/topic/plans-for-php-7-compatiblity/ "Topic: Plans for PHP 7 compatiblity? &laquo; WordPress.org Forums")).
633
- * Find details in [2.2.9 Release Note](http://www.ipgeoblock.com/changelog/release-2.2.9.html "2.2.9 Release Note").
634
 
635
  = 2.2.8.2 =
636
  * **Bug fix:** Fixed the mismatched internal version number.
@@ -643,19 +665,19 @@ This is a maintenance release addressing some issues.
643
  * **Bug fix:** Fixed the issue of stripping some required characters for Google maps API key.
644
  * **New feature:** Whois database Lookup for IP address on search tab.
645
  * **Update:** Updated geolocation API libraries and services.
646
- * Find more details in [2.2.8 Release Note](http://www.ipgeoblock.com/changelog/release-2.2.8.html "2.2.8 Release Note").
647
 
648
  = 2.2.7 =
649
  * **Bug fix:** Fix inadequate validation of "**Bad signatures in query**".
650
  * **Improvement:** Add fallback for Google Maps API key ([@](https://wordpress.org/support/topic/226-problem-with-search-resp-google-maps "WordPress &#8250; Support &raquo; [2.2.6] Problem with SEARCH resp. Google Maps")) and corruption of "Bad signatures" ([@](https://wordpress.org/support/topic/226-problem-with-bad-signatures-in-query "WordPress &#8250; Support &raquo; [2.2.6] Problem with &quot;Bad signatures in query&quot;")).
651
  * **Update:** Update geolocation service api.
652
- * Find details about Google Maps API in [2.2.7 Release Note](http://www.ipgeoblock.com/changelog/release-2.2.7.html "2.2.7 Release Note").
653
 
654
  = 2.2.6 =
655
  * **New feature:** Add saving csv file of logs in "Logs" tab.
656
  * **New feature:** Add filter hook `ip-geo-block-record-log` to control over the conditions of recording in more detail.
657
  * **Bug fix:** Fixed the issue that "Exceptions" for Plugins/Themes area does not work properly. Please confirm your settings again.
658
- * See details at [release 2.2.6](http://www.ipgeoblock.com/changelog/release-2.2.6.html "2.2.6 Release Note").
659
 
660
  = 2.2.5 =
661
  * **New feature:** On the settings page, you can specify the pliugin or theme which would cause undesired blocking in order to exclude it from the validation target without embedding any codes into `functions.php`.
@@ -680,7 +702,7 @@ Sorry for frequent updating.
680
  * **Improvement:** Made the logout url compatible with [Rename wp-login.php](https://wordpress.org/plugins/rename-wp-login/).
681
  * **Improvement:** Made condition of validation more strictly at admin diagnosis to prevent unnecessary notice of self blocking. ([@](https://wordpress.org/support/topic/youll-be-blocked-after-you-log-out-notice-doesnt-disappear "[resolved] &quot;You'll be blocked after you log out&quot; notice doesn't disappear"))
682
  * **Improvement:** Improved some of UI. ([@](https://wordpress.org/support/topic/possible-to-select-which-countries-are-blocked "[resolved] Possible to select which countries are blocked?"), [@](https://wordpress.org/support/topic/ip-geo-block-black-list "IP Geo Block Black List"))
683
- * See some details at [release 2.2.4](http://www.ipgeoblock.com/changelog/release-2.2.4.html "2.2.4 Release Note").
684
 
685
  = 2.2.3.1 =
686
  * **Bug fix:** Fixed the issue that disabled validation target was still blocked by country. ([@](https://wordpress.org/support/topic/logs-whitelist-comments-still-blocked "[resolved] logs whitelist comments still blocked?"))
@@ -694,7 +716,7 @@ Sorry for frequent updating.
694
  * **Improvement:** Prevent self blocking caused by irrelevant signature. ([@](https://wordpress.org/support/topic/works-too-well-blocked-my-wp-admin-myself "[resolved] Works too well - Blocked my wp-admin myself"))
695
  * **Bug fix:** Fixed the issue of conflicting with certain plugins due to the irrelevant handling of js event. ([@](https://wordpress.org/support/topic/cannot-edit-pages-when-ip-geo-block-is-enabled "[resolved] Cannot edit pages when ip-geo-block is enabled."))
696
  * **New feature:** Add "Blocked per day" graph for the daily statistics.
697
- * See some details at [2.2.3 release note](http://www.ipgeoblock.com/changelog/release-2.2.3.html "2.2.3 Release Note").
698
 
699
  = 2.2.2.3 =
700
  Sorry for frequent update again but the following obvious bugs should be fixed.
@@ -716,14 +738,14 @@ Sorry for frequent update.
716
  * **Improvement:** In the previous version, the statistical data was recorded into `wp_options`. It caused the uncertainty of recording especially in case of burst attacks. Now the data will be recorded in an independent table to improve this issue.
717
  * **Bug fix:** Fixed conflict with NextGEN Gallary Pro. Thanks to [bodowewer](https://wordpress.org/support/profile/bodowewer).
718
  * **Bug fix:** Fixed some filter hooks that did not work as intended.
719
- * See more details at [2.2.2 release note](http://www.ipgeoblock.com/changelog/release-2.2.2.html "2.2.2 Release Note").
720
 
721
  = 2.2.1.1 =
722
  * **Bug fix:** Fixed "open_basedir restriction" issue caused by `file_exists()`.
723
 
724
  = 2.2.1 =
725
  * **Enhancement:** In previous version, local geolocation databases will always be removed and downloaded again at every upgrading. Now, the class library for Maxmind and IP2Location have become independent of this plugin and you can put them outside this plugin in order to cut the above useless process. The library can be available from [WordPress-IP-Geo-API](https://github.com/tokkonopapa/WordPress-IP-Geo-API).
726
- * **Deprecated:** Cooperation with IP2Location plugins such as [IP2Location Tags](http://wordpress.org/plugins/ip2location-tags/ "WordPress - IP2Location Tags - WordPress Plugins"), [IP2Location Variables](http://wordpress.org/plugins/ip2location-variables/ "WordPress - IP2Location Variables - WordPress Plugins"), [IP2Location Country Blocker](http://wordpress.org/plugins/ip2location-country-blocker/ "WordPress - IP2Location Country Blocker - WordPress Plugins") is out of use. Instead of it, free [IP2Location LITE databases for IPv4 and IPv6](http://lite.ip2location.com/ "Free IP Geolocation Database") will be downloaded.
727
  * **Improvement:** Improved connectivity with Jetpack.
728
  * **Improvement:** Improved immediacy of downloading databases at upgrading.
729
  * **Improvement:** Replaced a terminated RESTful API service with a new stuff.
@@ -743,7 +765,7 @@ Sorry for frequent update.
743
  * **New feature:** Malicious signatures to prevent disclosing the important files via vulnerable plugins or themes. A malicious request to try to expose `wp-config.php` or `passwd` can be blocked.
744
  * **New feature:** Add privacy considerations related to IP address. Add **Anonymize IP address** at **Record settings**.
745
  * **Bug fix:** Fix the issue that spaces in **Text message on comment form** are deleted.
746
- * See details at [2.2.0 release note](http://www.ipgeoblock.com/changelog/release-2.2.0.html "2.2.0 Release Note").
747
 
748
  = 2.1.5.1 =
749
  * **Bug fix:** Fixed the issue that the Blacklist did not work properly. Thanks to TJayYay for reporting this issue at [support forum](https://wordpress.org/support/topic/hackers-from-country-in-blocked-list-of-countries-trying-to-login "WordPress &rsaquo; Support &raquo; Hackers from country in Blocked List of Countries trying to login").
@@ -753,13 +775,13 @@ Sorry for frequent update.
753
  * **New feature:** Add pie chart to display statistics of "Blocked by country".
754
  * **Enhancement:** WP-ZEP is reinforced against CSRF.
755
  * **Bug fix:** Fix illegal handling of the fragment in a link.
756
- * See details at [2.1.5 release note](http://www.ipgeoblock.com/changelog/release-2.1.5.html "2.1.5 Release Note").
757
 
758
  = 2.1.4 =
759
  * **Bug fix:** Fix the issue that this plugin broke functionality of a certain plugin. Thanks to **opsec** for reporting this issue at [support forum](https://wordpress.org/support/topic/blocks-saves-in-types-or-any-plugins-from-wp-typescom "WordPress &rsaquo; Support &raquo; Blocks saves in Types or any plugins from wp-types.com").
760
  * **Improvement:** Add checking process for validation rule to prevent being blocked itself. Thanks to **internationals** for proposing at [support forum](https://wordpress.org/support/topic/locked-out-due-to-eu-vs-country "WordPress &rsaquo; Support &raquo; Locked out due to EU vs. Country")
761
  * **Improvement:** Arrage the order of setting sections to focus the goal of this plugin.
762
- * See details at [2.1.4 release note](http://www.ipgeoblock.com/changelog/release-2.1.4.html "2.1.4 Release Note").
763
 
764
  = 2.1.3 =
765
  * **New feature:** Add "show" / "hide" at each section on the "Settings" tab.
@@ -768,7 +790,7 @@ Sorry for frequent update.
768
  * **Improvement:** Improved the compatibility with Autoptimize.
769
  * **Bug fix:** Fix the issue related to showing featured themes on dashboard.
770
  * **Bug fix:** Fix minor bug in `rewrite.php` for the advanced use case.
771
- * See details at [2.1.3 release note](http://www.ipgeoblock.com/changelog/release-2.1.3.html "2.1.3 Release Note").
772
 
773
  = 2.1.2 =
774
  This is a maintenance release.
@@ -779,16 +801,16 @@ This is a maintenance release.
779
  * **Improvement:** Hide checking the existence of log db behind the symbol `IP_GEO_BLOCK_DEBUG` to reduce 1 query on admin screen.
780
  * **Improvement:** Add alternative functions of BCMath extension to avoid `PHP Fatal error: Call to undefined function` in `IP2Location.php` when IPv6 is specified.
781
  * **Improvement:** Use MaxMind database at the activating process not to be locked out by means of inconsistency of database at the activation and after.
782
- * See more details at [2.1.2 release note](http://www.ipgeoblock.com/changelog/release-2.1.2.html "2.1.2 Release Note").
783
 
784
  = 2.1.1 =
785
  * **New feature:** Added `Block by country (register, lost password)` at `Login form` on `Settings` tab in order to accept the registered users as membership from anywhere but block the request of new user ragistration and lost password by the country code. Is't suitable for BuddyPress and bbPress.
786
  * **Improvement:** Added showing the custom error page for http response code 4xx and 5xx. For example the `403.php` in the theme template directory or in the child theme directory is used if it exists. And new filter hooks `ip-geo-block-(comment|xmlrpc|login|admin)-(status|reason)` are available to customize the response code and reason for human.
787
  * **Obsoleted:** Obsoleted the filter hooks `ip-geo-block-(admin-actions|admin-pages|wp-content)`. Alternatively new filter hooks `ip-geo-block-bypass-(admins|plugins|themes)` are added to bypass WP-ZEP.
788
- * Find out more details in the [2.1.1 release note](http://www.ipgeoblock.com/changelog/release-2.1.1.html "2.1.1 Release Note").
789
 
790
  = 2.1.0 =
791
- * **New feature:** Expanded the operating range of ZP-ZEP, that includes admin area, plugins area, themes area. Now it can prevent a direct malicios attack to the file in plugins and themes area. Please go to the "Validation Settings" on "Settings" tab and check it. Also check my article in "[Analysis of Attack Vector against WP Plugins](http://www.ipgeoblock.com/article/analysis-attack-vector.html)".
792
  * **Bug fix:** Fixed the issue that action hook `ip-geo-block-backup-dir` did not work correctly because the order of argument was mismatched.
793
  * **Bug fix:** Fixed the issue that a record including utf8 4 bytes character in its columns was not logged into DB in WordPress 4.2.
794
  * **Improvement:** Fixed the issue that Referrer Suppressor do nothing with a new element which is added into DOM after DOM ready. The event handler is now delegated at the `body`.
@@ -798,7 +820,7 @@ This is a maintenance release.
798
  * Added re-creating DB table for validation logs in case of accidentally failed at activation process.
799
  * The time of day is shown with local time by adding GMT offset based on the time zone setting.
800
  * Optimized resource loading and settings to avoid redundancy.
801
- * See details at [this plugin's blog](http://www.ipgeoblock.com/changelog/release-2.0.8.html "2.0.8 Release Note").
802
 
803
  = 2.0.7 =
804
  * Avoid JavaScript error which occurs if an anchor link has no `href`.
@@ -820,7 +842,7 @@ This is a maintenance release.
820
  * Also added the filter hook `ip-geo-block-admin-actions` for safe actions on back-end.
821
 
822
  = 2.0.2 =
823
- * **New feature:** Include `wp-admin/admin-post.php` as a validation target in the `Admin area`. This feature is to protect against a vulnerability such as [Analysis of the Fancybox-For-WordPress Vulnerability](http://blog.sucuri.net/2015/02/analysis-of-the-fancybox-for-wordpress-vulnerability.html) on Sucuri Blog.
824
  * Added a sample code snippet as a use case for 'Give ajax permission in case of safe actions on front facing page'. See Example 10 in `sample.php`.
825
 
826
  = 2.0.1 =
3
  Donate link:
4
  Tags: security, firewall, brute force, vulnerability, login, wp-admin, admin, ajax, xmlrpc, comment, pingback, trackback, spam, IP address, geo, geolocation, buddypress, bbPress
5
  Requires at least: 3.7
6
+ Tested up to: 4.9.8
7
+ Stable tag: 3.0.14
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.txt
10
 
33
  In order to prevent hacking through the login form and XML-RPC by brute-force and the reverse-brute-force attacks, the number of login attempts will be limited per IP address even from the permitted countries.
34
 
35
  * **Minimize server load against brute-force attacks:**
36
+ You can configure this plugin as a [Must Use Plugins](https://codex.wordpress.org/Must_Use_Plugins "Must Use Plugins &laquo; WordPress Codex") so that this plugin can be loaded prior to regular plugins. It can massively [reduce the load on server](https://www.ipgeoblock.com/codex/validation-timing.html "Validation timing | IP Geo Block").
37
 
38
  * **Prevent malicious down/uploading:**
39
  A malicious request such as exposing `wp-config.php` or uploading malwares via vulnerable plugins/themes can be blocked.
48
  When you click an external hyperlink on admin screens, http referrer will be eliminated to hide a footprint of your site.
49
 
50
  * **Multiple source of IP Geolocation databases:**
51
+ [MaxMind GeoLite2 free databases](https://www.maxmind.com "MaxMind - IP Geolocation and Online Fraud Prevention") (it requires PHP 5.4.0+) and [IP2Location LITE databases](https://www.ip2location.com/ "IP Address Geolocation to Identify Website Visitor's Geographical Location") can be installed in this plugin. Also free Geolocation REST APIs and whois information can be available for audit purposes.
52
+ Father more, [dedicated API class libraries](https://www.ipgeoblock.com/article/api-class-library.html "CloudFlare & CloudFront API class library | IP Geo Block") can be installed for CloudFlare and CloudFront as a reverse proxy service.
53
 
54
  * **Customizing response:**
55
  HTTP response code can be selectable as `403 Forbidden` to deny access pages, `404 Not Found` to hide pages or even `200 OK` to redirect to the top page.
59
  Validation logs for useful information to audit attack patterns can be manageable.
60
 
61
  * **Cooperation with full spec security plugin:**
62
+ This plugin is lite enough to be able to cooperate with other full spec security plugin such as [Wordfence Security](https://wordpress.org/plugins/wordfence/ "Wordfence Security &mdash; WordPress Plugins"). See [this report](https://www.ipgeoblock.com/codex/page-speed-performance.html "Page speed performance | IP Geo Block") about page speed performance.
63
 
64
  * **Extendability:**
65
+ You can customize the behavior of this plugin via `add_filter()` with [pre-defined filter hook](https://www.ipgeoblock.com/codex/ "Codex | IP Geo Block"). See various use cases in [samples.php](https://github.com/tokkonopapa/WordPress-IP-Geo-Block/blob/master/ip-geo-block/samples.php "WordPress-IP-Geo-Block/samples.php at master - tokkonopapa/WordPress-IP-Geo-Block - GitHub") bundled within this package.
66
  You can also get the extension [IP Geo Allow](https://github.com/ddur/WordPress-IP-Geo-Allow "GitHub - ddur/WordPress-IP-Geo-Allow: WordPress Plugin Exension for WordPress-IP-Geo-Block Plugin") by [Dragan](https://github.com/ddur "ddur (Dragan) - GitHub"). It makes admin screens strictly private with more flexible way than specifying IP addresses.
67
 
68
  * **Self blocking prevention and easy rescue:**
69
+ Website owners do not prefer themselves to be blocked. This plugin prevents such a sad thing unless you force it. And futhermore, if such a situation occurs, you can [rescue yourself](https://www.ipgeoblock.com/codex/what-should-i-do-when-i-m-locked-out.html "What should I do when I'm locked out? | IP Geo Block") easily.
70
 
71
  * **Clean uninstallation:**
72
  Nothing is left in your precious mySQL database after uninstallation. So you can feel free to install and activate to make a trial of this plugin's functionality.
73
 
74
  = Attribution =
75
 
76
+ This package includes GeoLite2 library distributed by MaxMind, available from [MaxMind](https://www.maxmind.com "MaxMind - IP Geolocation and Online Fraud Prevention") (it requires PHP 5.4.0+), and also includes IP2Location open source libraries available from [IP2Location](https://www.ip2location.com "IP Address Geolocation to Identify Website Visitor's Geographical Location").
77
 
78
  Also thanks for providing the following great services and REST APIs for free.
79
 
80
  * [https://ipdata.co/](https://ipdata.co/ "ipdata.co - IP Geolocation and Threat Data API") (IPv4, IPv6 / free)
81
  * [https://ipinfo.io/](https://ipinfo.io/ "IP Address API and Data Solutions") (IPv4, IPv6 / free)
82
+ * [https://geoip.nekudo.com/](https://geoip.nekudo.com/ "Free IP GeoLocation/GeoIp API - geoip.nekudo.com") (IPv4, IPv6 / free)
83
  * [http://geoiplookup.net/](http://geoiplookup.net/ "What Is My IP Address | GeoIP Lookup") (IPv4, IPv6 / free)
84
  * [http://ip-api.com/](http://ip-api.com/ "IP-API.com - Free Geolocation API") (IPv4, IPv6 / free for non-commercial use)
85
  * [https://ipinfodb.com/](https://ipinfodb.com/ "Free IP Geolocation Tools and API| IPInfoDB") (IPv4, IPv6 / free for registered user, need API key)
89
 
90
  Development of this plugin is promoted at [WordPress-IP-Geo-Block](https://github.com/tokkonopapa/WordPress-IP-Geo-Block "tokkonopapa/WordPress-IP-Geo-Block - GitHub") and class libraries to handle geo-location database are developed separately as "add-in"s at [WordPress-IP-Geo-API](https://github.com/tokkonopapa/WordPress-IP-Geo-API "tokkonopapa/WordPress-IP-Geo-API - GitHub").
91
 
92
+ All contributions will always be welcome. Or visit my [development blog](https://www.ipgeoblock.com/ "IP Geo Block").
93
 
94
  == Installation ==
95
 
101
  4. Activate the plugin on the Plugin dashboard
102
  5. Try 'Best for Back-end' button for easy setup at the bottom of this plugin's setting page.
103
 
104
+ Please refer to [the document](https://www.ipgeoblock.com/codex/ "Codex | IP Geo Block")
105
  or following descriptions for your best setup.
106
 
107
  = Validation rule settings =
110
  Choose either `White list` (recommended) or `Black list` to specify the countries from which you want to pass or block.
111
 
112
  * **Whitelist/Blacklist of country code**
113
+ Specify the country code with two letters (see [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements "ISO 3166-1 alpha-2 - Wikipedia, the free encyclopedia")). Each of them should be separated by comma.
114
 
115
  * **Use Autonomous System Number (ASN)**
116
+ It enables you to use "AS number" in the whitelist and blacklist of extra IP addresses to specify a group of IP networks.
117
 
118
  * **Whitelist/Blacklist of extra IP addresses prior to country code**
119
  The list of extra IP addresses prior to the validation of country code. [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing "Classless Inter-Domain Routing - Wikipedia, the free encyclopedia") and [AS number](https://en.wikipedia.org/wiki/Autonomous_system_(Internet) "Autonomous system (Internet) - Wikipedia") are also acceptable to specify the range.
128
  It restricts the file types on upload to block malware and backdoor via both back-end and front-end.
129
 
130
  * **Response code**
131
+ Choose one of the [response code](https://tools.ietf.org/html/rfc2616#section-10 "RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1") to be sent when it blocks a comment.
132
  The 2xx code will lead to your top page, the 3xx code will redirect to [Black Hole Server](http://blackhole.webpagetest.org/), the 4xx code will lead to WordPress error page, and the 5xx will pretend an server error.
133
 
134
  * **Max number of failed login attempts per IP address**
186
  = Geolocation API settings =
187
 
188
  * **API selection and key settings**
189
+ If you wish to use `IPInfoDB`, you should register at [their site](https://ipinfodb.com/ "IPInfoDB | Free IP Address Geolocation Tools") to get a free API key and set it into the textfield. And `ip-api.com` and `Smart-IP.net` require non-commercial use.
190
 
191
  = Local database settings settings =
192
 
242
 
243
  = Does the site using this plugin comply with GDPR? =
244
 
245
+ Using this plugin itself should not be the problem, because from version 3.0.11 IP addresses in logs and cache of this plugin are encrypted by default in preparation for personal data breach. It also not only provides a way to manually erase them but also has the functionality to remove them when those are exceeded a certain amount/time. The option "Privacy friendly" helps you to restrict sending the ip address to the 3rd parties such as geolocation APIs and whois service equipped in this plugin. However, these functions are part of the requirements that GDPR requires and do not guarantee that the site is compliant with GDPR. Refer to [3.0.11 release note](https://www.ipgeoblock.com/changelog/release-3.0.11.html) for details.
246
 
247
  = Does this plugin support multisite? =
248
 
273
 
274
  Thus your site would have less risk against the exploiting via vulnerable plugins and themes.
275
 
276
+ For more details, please refer to some documents at "[Blocking on front-end](https://www.ipgeoblock.com/codex/#blocking-on-front-end 'Codex | IP Geo Block')".
277
 
278
  = I still have access from blacklisted country. Does it work correctly? =
279
 
280
  Absolutely, YES.
281
 
282
+ Sometimes, a Wordfence Security user would report this type of claim when he/she found some accesses in its Live traffic view. But please don't worry. Before WordPress runs, Wordfence cleverly filters out malicious requests to your site using <a href="https://php.net/manual/en/ini.core.php#ini.auto-prepend-file" title="PHP: Description of core php.ini directives - Manual">auto_prepend_file</a> directive to include PHP based Web Application Firewall. Then this plugin validates the rest of the requests that pass over Wordfence because those were not in WAF rules, especially you enables "**Prevent Zero-day Exploit**".
283
 
284
  It would also possibly be caused by the accuracy of country code in the geolocation databases. Actually, there is a case that a same IP address has different country code.
285
 
286
+ For more detail, please refer to "[I still have access from blacklisted country.](https://www.ipgeoblock.com/codex/access-from-blacklisted-country.html 'I still have access from blacklisted country. | IP Geo Block')".
287
 
288
  = How can I test this plugin works? =
289
 
293
 
294
  You can add an IP address to the `X-Forwarded-For` header to emulate the access behind the proxy. In this case, you should add `HTTP_X_FORWARDED_FOR` into the "**$_SERVER keys for extra IPs**" on "**Settings**" tab.
295
 
296
+ See more details at "[How to test prevention of attacks](https://www.ipgeoblock.com/codex/#how-to-test-prevention-of-attacks 'Codex | IP Geo Block')".
297
 
298
  = I'm locked out! What shall I do? =
299
 
319
 
320
  Remember that you should upload the original one after re-configuration to deactivate this feature.
321
 
322
+ [This document](https://www.ipgeoblock.com/codex/what-should-i-do-when-i-m-locked-out.html "What should I do when I'm locked out? | IP Geo Block") can also help you.
323
 
324
  = Do I have to turn on all the selection to enhance security? =
325
 
337
  - **Bad signatures in query**
338
  It blocks the request which has not been covered in the above three.
339
 
340
+ Please try "**Best for Back-end**" button at the bottom of this plugin's setting page for easy setup. And also see more details in "[The best practice of target settings](https://www.ipgeoblock.com/codex/the-best-practice-for-target-settings.html 'The best practice of target settings | IP Geo Block')".
341
 
342
  = Does this plugin validate all the requests? =
343
 
347
 
348
  = How to resolve "Sorry, your request cannot be accepted."? =
349
 
350
+ If you encounter this message, please refer to [this document](https://www.ipgeoblock.com/codex/you-are-not-allowed-to-access.html "Why &ldquo;Sorry, your request cannot be accepted&rdquo; ? | IP Geo Block") to resolve your blocking issue.
351
 
352
  If you can't solve your issue, please let me know about it on the [support forum](https://wordpress.org/support/plugin/ip-geo-block/ "View: Plugin Support &laquo; WordPress.org Forums"). Your logs in this plugin and "**Installation information**" at "**Plugin settings**" will be a great help to resolve the issue.
353
 
354
  = How can I fix "Unable to write" error? =
355
 
356
+ When you enable "**Force to load WP core**" options, this plugin will try to configure `.htaccess` in your `/wp-content/plugins/` and `/wp-content/themes/` directory in order to protect your site against the malicous attacks to the [OMG plugins and themes](https://www.ipgeoblock.com/article/exposure-of-wp-config-php.html "Prevent exposure of wp-config.php | IP Geo Block").
357
 
358
  But some servers doesn't give read / write permission against `.htaccess` to WordPress. In this case, you can configure `.htaccess` files by your own hand instead of enabling "**Force to load WP core**" options.
359
 
360
+ Please refer to "[How can I fix permission troubles?](https://www.ipgeoblock.com/codex/how-can-i-fix-permission-troubles.html 'How can I fix permission troubles? | IP Geo Block')" in order to fix this error.
361
 
362
  == Other Notes ==
363
 
382
 
383
  == Changelog ==
384
 
385
+ = 3.0.14 =
386
+ * **Fix issue:** Fix wrong handling of anonymized IPv6 on clicking a link or applying bulk actions.
387
+ * **Fix issue:** Fix the issue that added a server's country code which was not in "Whitelist of country code" but its IP address was in "Whitelist of extra IP addresses prior to country code" on activation. ([forum topic](https://wordpress.org/support/topic/possible-bug-disabling-enabling-adds-us-to-whitelist-country-code/ "Topic: Possible bug: disabling/enabling adds &#8220;,US&#8221; to whitelist country code &#124; WordPress.org"))
388
+ * **Fix issue:** Fix the issue of "Fatal error: Call to undefined function" which caused 500 Internal error on admin screen under a certain condition.
389
+ * **Fix issue:** Fix the issue of undefined symbol for openssl in PHP 5.3.5 and under.
390
+ * **New feature:** Introduce an emergency login link in "Plugins settings" section.
391
+ * **New feature:** Introduce a new filter hook [`ip-geo-block-dns`](https://www.ipgeoblock.com/codex/ip-geo-block-dns.html "ip-geo-block-dns | IP Geo Block") to specify the primary and secondary domain name resolvers.
392
+ * **New feature:** Introduce a new filter hook `ip-geo-block-logs`. ([forum topic](https://wordpress.org/support/topic/request-log-filtering/ "Topic: Request: Log filtering &#124; WordPress.org"))
393
+ * **New feature:** Introduce a new drop-in file `drop-in-admin.php` in Geolocation API library folder.
394
+ * **Improvement:** Provide help links on "Settings" tab.
395
+ * **Improvement:** Sort out some related items in the section on "Settings" tab.
396
+ * **Improvement:** All the http had been replaced to https if possible.
397
+
398
+ = 3.0.13 =
399
+ * **Deprecate:** Remove the hotfix in 3.0.12.1 because of [WordPress 4.9.7 Security and Maintenance Release](https://wordpress.org/news/2018/07/wordpress-4-9-7-security-and-maintenance-release/ "WordPress 4.9.7 Security and Maintenance Release").
400
+ * **Fix issue:** Local databases settings will be updated when Geolocation API folder can not be found on activation. ([forum topic](https://wordpress.org/support/topic/local-database-settings-wrong-after-server-move/ "Topic: Local Database settings wrong after server move &#124; WordPress.org"))
401
+ * **Fix issue:** Fix the issue of "ip_geo_block_cache doesn't exist" at activation on clean installation.
402
+ * **Fix issue:** Fix the issue that "Remove entries by IP address" did not work when "Anonymize IP address" in "Privacy and record settings" section was enabled.
403
+ * **Fix issue:** Ipdata.co became to require API key for registered user to make up to 1500 requests daily.
404
+ * **Improvement:** AES256 is applied to encrypt IP address if the algorithm is available. (PHP 5.3.3+)
405
+ * **Improvement:** Add "Do not send IP address to external APIs" apart from "Anonymize IP address" in "Privacy and record settings" section.
406
+
407
  = 3.0.12.1 =
408
+ * **Fix issue:** Unexpected blocking cause by an extra slash at the end of `$_SERVER['DOCUMENT_ROOT']` that might be added by server's configuration. ([forum topic](https://wordpress.org/support/topic/wpwebinar/ "Topic: WPWebinar &#124; WordPress.org"))
409
+ * **Fix issue:** [Human friendly error page](https://www.ipgeoblock.com/codex/customizing-the-response.html#human-friendly-error-page) now works properly. ([forum topic](https://wordpress.org/support/topic/problem-with-permalinks-51/ "Topic: Problem with Permalinks &#124; WordPress.org"))
410
+ * **Fix issue:** Fix the conflict with WP hide & Security Enhancer. ([forum topic](https://wordpress.org/support/topic/problem-with-permalinks-51/ "Topic: Problem with Permalinks &#124; WordPress.org"))
411
+ * **Fix issue:** Hotfix [WordPress File Delete to Code Execution](https://blog.ripstech.com/2018/wordpress-file-delete-to-code-execution/ "WARNING: WordPress File Delete to Code Execution") by RIPS Technologies.
412
 
413
  = 3.0.12 =
414
  * **Improvement:** Enhance "Privacy and record settings" where "Expiration time [sec] for Logs" can be specified.
420
  * **Improvement:** Update geolocation APIs and add a new one.
421
  * **Improvement:** Change the JavaScript compressor from Google Closure Compiler to UglifyJS 2 to prevent "Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined" in a certain environment.
422
  * **Fix:** Fix the issue that blocking occurred immediately instead of displaying the login page again when login failed, even the number of times did not exceed the limit.
423
+ * See [3.0.11 release note](https://www.ipgeoblock.com/changelog/release-3.0.11.html) for some details.
424
 
425
  = 3.0.10.4 =
426
  * **Fix:** JavaScript error caused by bad handling form tag without method property. This error was happened with Wordfence Live Traffic.
460
  * **Maintenance:** Change the priority order of local geolocation databases.
461
  * **Bug fix:** Fix the issue that the target action for login form on settings tab could not unchecked on saving changes.
462
  * **Bug fix:** Fix some other minor bugs.
463
+ * See [3.0.9 release note](https://www.ipgeoblock.com/changelog/release-3.0.9.html "3.0.9 Release Note | IP Geo Block") for some details.
464
 
465
  = 3.0.8 =
466
  * **Improvement:** Use both Maxmind Legacy and GeoLite2 databases parallely.
493
  * **Bug fix:** Fix the bug using php short open tag on "Logs" tab.
494
  * **Bug fix:** Fix the bug related to absolute path in filesystem on windows system.
495
  * **Bug fix:** Fix the issue that "Auto updating (once a month)" could not be disabled.
496
+ * See [3.0.6 release note](https://www.ipgeoblock.com/changelog/release-3.0.6.html "3.0.6 Release Note | IP Geo Block") for some details.
497
 
498
  = 3.0.5 =
499
  * **New feature:** Add "Live update" mode on "Logs" tab.
500
  * **Improvement:** List all the IP addresses in cache are now displayed and manageable on "Statistics" tab.
501
  * **Improvement:** Add "Either blocked or passed" as a new condition for recording logs. It enables to verify the requests "passed" from the blacklisted countries or the countries not in the whitelist.
502
  * **Improvement:** Add two new filter hooks to utilize Google APIs from native domain in China.
503
+ * See [3.0.5 release note](https://www.ipgeoblock.com/changelog/release-3.0.5.html "3.0.5 Release Note | IP Geo Block") for some details.
504
 
505
  = 3.0.4.6 =
506
  * **Bug fix:** Fix the issue that the emergent functionality didn't work when the number of login attempts reached to the limit.
543
  * **Improvement:** Inhibit to embed a special nonce into links when WP-ZEP is disabled at each target. This may improve compatibility with some plugins and themes.
544
  * **Bug fix:** Fix the issue of verifying file upload. It could not handle multiple files. ([@](https://wordpress.org/support/topic/incompatible-with-awesome-support-plugin/#post-9403708 "Topic: incompatible with Awesome Support plugin &laquo; WordPress.org Forums"))
545
  * **Bug fix:** Fix the issue of illegal click event handling on anchor tag without href. ([@](https://wordpress.org/support/topic/pagebuilder-broken-by-ipgeoblock-v3-0-3-4/ "Topic: Pagebuilder broken by IPGeoblock v3.0.3.4 &laquo; WordPress.org Forums"))
546
+ * See [3.0.4 release note](https://www.ipgeoblock.com/changelog/release-3.0.4.html "3.0.4 Release Note | IP Geo Block") for some details.
547
 
548
  = 3.0.3.4 =
549
  * **Improvement:** Some minor refactoring for the future release.
586
  * **Improvement:** Better handling of server and private IP address.
587
  * **Bug fix:** Fix the bug of "Export/Import settings". **Please export json file again if you hold it as backup purpose** because some of settings data might be incompatible.
588
  * **Bug fix:** Fix the bug of "Password Reset" caused by miss-spelling "resetpasss".
589
+ * See some details at [release 3.0.3](https://www.ipgeoblock.com/changelog/release-3.0.3.html "3.0.3 Release Note | IP Geo Block").
590
 
591
  = 3.0.2.2 =
592
  * **Improvement:** Change the behavior of "Referrer Suppressor" not to open a new window on public facing pages.
610
  * **New feature:** Add "Exceptions" for "Admin ajax/post" to specify the name of action which causes undesired blocking (typically on the public facing pages).
611
  * **Improvement:** Add "Disable" to "Max number of failed login attempts per IP address" to avoid conflict with other similar plugin.
612
  * **Improvement:** Update geolocation database libraries to 1.1.7 for better compatibility on some platform.
613
+ * **Trial feature:** Add custom action hook `ip-geo-block-send-response`. This is useful to control firewall via [fail2ban](https://www.fail2ban.org/ "Fail2ban") like [WP fail2ban](https://wordpress.org/plugins/wp-fail2ban/ "WP fail2ban - WordPress Plugins").
614
+ * See some details at [release 3.0.2](https://www.ipgeoblock.com/changelog/release-3.0.2.html "3.0.2 Release Note | IP Geo Block").
615
 
616
  = 3.0.1.2 =
617
  * **Bug fix:** Fix the blocking issue in some environments when upgrading from 2.2.9.1 to 3.0.0.
639
  * **Improvement:** Better compatibility with some plugins, themes and widgets.
640
  * **Improvement:** Deferred execution of SQL command to improve the response.
641
  * **Improvement:** Make the response compatible with WP original when it is requested by GET method.
642
+ * See some details at [release 3.0.0](https://www.ipgeoblock.com/changelog/release-3.0.0.html "3.0.0 Release Note | IP Geo Block").
643
 
644
  = 2.2.9.1 =
645
  * **Bug fix:** Blocking Wordfence scanning. ([@](https://wordpress.org/support/topic/wordfence-conflict-2/ "WordFence Conflict"))
652
  * **New feature:** A new option that makes this plugin configured as a "Must-use plugin". It can massively reduce the server load especially against brute-force attacks because it initiates this plugin prior to other typical plugins.
653
  * **Improvement:** Validation of a certain signature against XSS is internally added to "Bad signature in query" by default.
654
  * **Improvement:** Improved compatibility with PHP 7 (Thanks to [FireMyst](https://wordpress.org/support/topic/plans-for-php-7-compatiblity/ "Topic: Plans for PHP 7 compatiblity? &laquo; WordPress.org Forums")).
655
+ * Find details in [2.2.9 Release Note](https://www.ipgeoblock.com/changelog/release-2.2.9.html "2.2.9 Release Note").
656
 
657
  = 2.2.8.2 =
658
  * **Bug fix:** Fixed the mismatched internal version number.
665
  * **Bug fix:** Fixed the issue of stripping some required characters for Google maps API key.
666
  * **New feature:** Whois database Lookup for IP address on search tab.
667
  * **Update:** Updated geolocation API libraries and services.
668
+ * Find more details in [2.2.8 Release Note](https://www.ipgeoblock.com/changelog/release-2.2.8.html "2.2.8 Release Note").
669
 
670
  = 2.2.7 =
671
  * **Bug fix:** Fix inadequate validation of "**Bad signatures in query**".
672
  * **Improvement:** Add fallback for Google Maps API key ([@](https://wordpress.org/support/topic/226-problem-with-search-resp-google-maps "WordPress &#8250; Support &raquo; [2.2.6] Problem with SEARCH resp. Google Maps")) and corruption of "Bad signatures" ([@](https://wordpress.org/support/topic/226-problem-with-bad-signatures-in-query "WordPress &#8250; Support &raquo; [2.2.6] Problem with &quot;Bad signatures in query&quot;")).
673
  * **Update:** Update geolocation service api.
674
+ * Find details about Google Maps API in [2.2.7 Release Note](https://www.ipgeoblock.com/changelog/release-2.2.7.html "2.2.7 Release Note").
675
 
676
  = 2.2.6 =
677
  * **New feature:** Add saving csv file of logs in "Logs" tab.
678
  * **New feature:** Add filter hook `ip-geo-block-record-log` to control over the conditions of recording in more detail.
679
  * **Bug fix:** Fixed the issue that "Exceptions" for Plugins/Themes area does not work properly. Please confirm your settings again.
680
+ * See details at [release 2.2.6](https://www.ipgeoblock.com/changelog/release-2.2.6.html "2.2.6 Release Note").
681
 
682
  = 2.2.5 =
683
  * **New feature:** On the settings page, you can specify the pliugin or theme which would cause undesired blocking in order to exclude it from the validation target without embedding any codes into `functions.php`.
702
  * **Improvement:** Made the logout url compatible with [Rename wp-login.php](https://wordpress.org/plugins/rename-wp-login/).
703
  * **Improvement:** Made condition of validation more strictly at admin diagnosis to prevent unnecessary notice of self blocking. ([@](https://wordpress.org/support/topic/youll-be-blocked-after-you-log-out-notice-doesnt-disappear "[resolved] &quot;You'll be blocked after you log out&quot; notice doesn't disappear"))
704
  * **Improvement:** Improved some of UI. ([@](https://wordpress.org/support/topic/possible-to-select-which-countries-are-blocked "[resolved] Possible to select which countries are blocked?"), [@](https://wordpress.org/support/topic/ip-geo-block-black-list "IP Geo Block Black List"))
705
+ * See some details at [release 2.2.4](https://www.ipgeoblock.com/changelog/release-2.2.4.html "2.2.4 Release Note").
706
 
707
  = 2.2.3.1 =
708
  * **Bug fix:** Fixed the issue that disabled validation target was still blocked by country. ([@](https://wordpress.org/support/topic/logs-whitelist-comments-still-blocked "[resolved] logs whitelist comments still blocked?"))
716
  * **Improvement:** Prevent self blocking caused by irrelevant signature. ([@](https://wordpress.org/support/topic/works-too-well-blocked-my-wp-admin-myself "[resolved] Works too well - Blocked my wp-admin myself"))
717
  * **Bug fix:** Fixed the issue of conflicting with certain plugins due to the irrelevant handling of js event. ([@](https://wordpress.org/support/topic/cannot-edit-pages-when-ip-geo-block-is-enabled "[resolved] Cannot edit pages when ip-geo-block is enabled."))
718
  * **New feature:** Add "Blocked per day" graph for the daily statistics.
719
+ * See some details at [2.2.3 release note](https://www.ipgeoblock.com/changelog/release-2.2.3.html "2.2.3 Release Note").
720
 
721
  = 2.2.2.3 =
722
  Sorry for frequent update again but the following obvious bugs should be fixed.
738
  * **Improvement:** In the previous version, the statistical data was recorded into `wp_options`. It caused the uncertainty of recording especially in case of burst attacks. Now the data will be recorded in an independent table to improve this issue.
739
  * **Bug fix:** Fixed conflict with NextGEN Gallary Pro. Thanks to [bodowewer](https://wordpress.org/support/profile/bodowewer).
740
  * **Bug fix:** Fixed some filter hooks that did not work as intended.
741
+ * See more details at [2.2.2 release note](https://www.ipgeoblock.com/changelog/release-2.2.2.html "2.2.2 Release Note").
742
 
743
  = 2.2.1.1 =
744
  * **Bug fix:** Fixed "open_basedir restriction" issue caused by `file_exists()`.
745
 
746
  = 2.2.1 =
747
  * **Enhancement:** In previous version, local geolocation databases will always be removed and downloaded again at every upgrading. Now, the class library for Maxmind and IP2Location have become independent of this plugin and you can put them outside this plugin in order to cut the above useless process. The library can be available from [WordPress-IP-Geo-API](https://github.com/tokkonopapa/WordPress-IP-Geo-API).
748
+ * **Deprecated:** Cooperation with IP2Location plugins such as [IP2Location Tags](https://wordpress.org/plugins/ip2location-tags/ "WordPress - IP2Location Tags - WordPress Plugins"), [IP2Location Variables](https://wordpress.org/plugins/ip2location-variables/ "WordPress - IP2Location Variables - WordPress Plugins"), [IP2Location Country Blocker](https://wordpress.org/plugins/ip2location-country-blocker/ "WordPress - IP2Location Country Blocker - WordPress Plugins") is out of use. Instead of it, free [IP2Location LITE databases for IPv4 and IPv6](https://lite.ip2location.com/ "Free IP Geolocation Database") will be downloaded.
749
  * **Improvement:** Improved connectivity with Jetpack.
750
  * **Improvement:** Improved immediacy of downloading databases at upgrading.
751
  * **Improvement:** Replaced a terminated RESTful API service with a new stuff.
765
  * **New feature:** Malicious signatures to prevent disclosing the important files via vulnerable plugins or themes. A malicious request to try to expose `wp-config.php` or `passwd` can be blocked.
766
  * **New feature:** Add privacy considerations related to IP address. Add **Anonymize IP address** at **Record settings**.
767
  * **Bug fix:** Fix the issue that spaces in **Text message on comment form** are deleted.
768
+ * See details at [2.2.0 release note](https://www.ipgeoblock.com/changelog/release-2.2.0.html "2.2.0 Release Note").
769
 
770
  = 2.1.5.1 =
771
  * **Bug fix:** Fixed the issue that the Blacklist did not work properly. Thanks to TJayYay for reporting this issue at [support forum](https://wordpress.org/support/topic/hackers-from-country-in-blocked-list-of-countries-trying-to-login "WordPress &rsaquo; Support &raquo; Hackers from country in Blocked List of Countries trying to login").
775
  * **New feature:** Add pie chart to display statistics of "Blocked by country".
776
  * **Enhancement:** WP-ZEP is reinforced against CSRF.
777
  * **Bug fix:** Fix illegal handling of the fragment in a link.
778
+ * See details at [2.1.5 release note](https://www.ipgeoblock.com/changelog/release-2.1.5.html "2.1.5 Release Note").
779
 
780
  = 2.1.4 =
781
  * **Bug fix:** Fix the issue that this plugin broke functionality of a certain plugin. Thanks to **opsec** for reporting this issue at [support forum](https://wordpress.org/support/topic/blocks-saves-in-types-or-any-plugins-from-wp-typescom "WordPress &rsaquo; Support &raquo; Blocks saves in Types or any plugins from wp-types.com").
782
  * **Improvement:** Add checking process for validation rule to prevent being blocked itself. Thanks to **internationals** for proposing at [support forum](https://wordpress.org/support/topic/locked-out-due-to-eu-vs-country "WordPress &rsaquo; Support &raquo; Locked out due to EU vs. Country")
783
  * **Improvement:** Arrage the order of setting sections to focus the goal of this plugin.
784
+ * See details at [2.1.4 release note](https://www.ipgeoblock.com/changelog/release-2.1.4.html "2.1.4 Release Note").
785
 
786
  = 2.1.3 =
787
  * **New feature:** Add "show" / "hide" at each section on the "Settings" tab.
790
  * **Improvement:** Improved the compatibility with Autoptimize.
791
  * **Bug fix:** Fix the issue related to showing featured themes on dashboard.
792
  * **Bug fix:** Fix minor bug in `rewrite.php` for the advanced use case.
793
+ * See details at [2.1.3 release note](https://www.ipgeoblock.com/changelog/release-2.1.3.html "2.1.3 Release Note").
794
 
795
  = 2.1.2 =
796
  This is a maintenance release.
801
  * **Improvement:** Hide checking the existence of log db behind the symbol `IP_GEO_BLOCK_DEBUG` to reduce 1 query on admin screen.
802
  * **Improvement:** Add alternative functions of BCMath extension to avoid `PHP Fatal error: Call to undefined function` in `IP2Location.php` when IPv6 is specified.
803
  * **Improvement:** Use MaxMind database at the activating process not to be locked out by means of inconsistency of database at the activation and after.
804
+ * See more details at [2.1.2 release note](https://www.ipgeoblock.com/changelog/release-2.1.2.html "2.1.2 Release Note").
805
 
806
  = 2.1.1 =
807
  * **New feature:** Added `Block by country (register, lost password)` at `Login form` on `Settings` tab in order to accept the registered users as membership from anywhere but block the request of new user ragistration and lost password by the country code. Is't suitable for BuddyPress and bbPress.
808
  * **Improvement:** Added showing the custom error page for http response code 4xx and 5xx. For example the `403.php` in the theme template directory or in the child theme directory is used if it exists. And new filter hooks `ip-geo-block-(comment|xmlrpc|login|admin)-(status|reason)` are available to customize the response code and reason for human.
809
  * **Obsoleted:** Obsoleted the filter hooks `ip-geo-block-(admin-actions|admin-pages|wp-content)`. Alternatively new filter hooks `ip-geo-block-bypass-(admins|plugins|themes)` are added to bypass WP-ZEP.
810
+ * Find out more details in the [2.1.1 release note](https://www.ipgeoblock.com/changelog/release-2.1.1.html "2.1.1 Release Note").
811
 
812
  = 2.1.0 =
813
+ * **New feature:** Expanded the operating range of ZP-ZEP, that includes admin area, plugins area, themes area. Now it can prevent a direct malicios attack to the file in plugins and themes area. Please go to the "Validation Settings" on "Settings" tab and check it. Also check my article in "[Analysis of Attack Vector against WP Plugins](https://www.ipgeoblock.com/article/analysis-attack-vector.html)".
814
  * **Bug fix:** Fixed the issue that action hook `ip-geo-block-backup-dir` did not work correctly because the order of argument was mismatched.
815
  * **Bug fix:** Fixed the issue that a record including utf8 4 bytes character in its columns was not logged into DB in WordPress 4.2.
816
  * **Improvement:** Fixed the issue that Referrer Suppressor do nothing with a new element which is added into DOM after DOM ready. The event handler is now delegated at the `body`.
820
  * Added re-creating DB table for validation logs in case of accidentally failed at activation process.
821
  * The time of day is shown with local time by adding GMT offset based on the time zone setting.
822
  * Optimized resource loading and settings to avoid redundancy.
823
+ * See details at [this plugin's blog](https://www.ipgeoblock.com/changelog/release-2.0.8.html "2.0.8 Release Note").
824
 
825
  = 2.0.7 =
826
  * Avoid JavaScript error which occurs if an anchor link has no `href`.
842
  * Also added the filter hook `ip-geo-block-admin-actions` for safe actions on back-end.
843
 
844
  = 2.0.2 =
845
+ * **New feature:** Include `wp-admin/admin-post.php` as a validation target in the `Admin area`. This feature is to protect against a vulnerability such as [Analysis of the Fancybox-For-WordPress Vulnerability](https://blog.sucuri.net/2015/02/analysis-of-the-fancybox-for-wordpress-vulnerability.html) on Sucuri Blog.
846
  * Added a sample code snippet as a use case for 'Give ajax permission in case of safe actions on front facing page'. See Example 10 in `sample.php`.
847
 
848
  = 2.0.1 =
admin/class-ip-geo-block-admin.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
  define( 'IP_GEO_BLOCK_NETWORK', FALSE );
@@ -39,6 +39,9 @@ class IP_Geo_Block_Admin {
39
  // Load plugin text domain and add body class
40
  add_action( 'init', array( $this, 'admin_init' ) );
41
 
 
 
 
42
  // Setup a nonce to validate authentication.
43
  add_filter( 'wp_redirect', array( $this, 'add_redirect_nonce' ), 10, 2 );
44
  }
@@ -56,6 +59,10 @@ class IP_Geo_Block_Admin {
56
  *
57
  */
58
  public function admin_init() {
 
 
 
 
59
  // Add the options page and menu item.
60
  add_action( 'admin_menu', array( $this, 'setup_admin_page' ) );
61
  add_action( 'admin_post_ip_geo_block', array( $this, 'admin_ajax_callback' ) );
@@ -108,6 +115,7 @@ class IP_Geo_Block_Admin {
108
  $urls = array( wp_login_url() );
109
 
110
  // avoid multiple redirection caused by WP hide 1.4.9.1
 
111
  if ( is_plugin_active( 'wp-hide-security-enhancer/wp-hide.php' ) )
112
  $urls[] = 'options-permalink.php';
113
 
@@ -158,17 +166,14 @@ class IP_Geo_Block_Admin {
158
  */
159
  public function create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
160
  defined( 'IP_GEO_BLOCK_DEBUG' ) and IP_GEO_BLOCK_DEBUG and assert( is_main_site(), 'Not main blog.' );
161
-
162
  require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-actv.php';
163
 
164
- // Get option of main blog.
165
- $settings = IP_Geo_Block::get_option();
166
-
167
  // Switch to the new blog and initialize.
168
  switch_to_blog( $blog_id );
169
  IP_Geo_Block_Activate::activate_blog();
170
 
171
  // Copy option from main blog.
 
172
  if ( $this->is_network && $settings['network_wide'] )
173
  update_option( IP_Geo_Block::OPTION_NAME, $settings );
174
 
@@ -249,10 +254,12 @@ class IP_Geo_Block_Admin {
249
  $dependency, IP_Geo_Block::VERSION, $footer
250
  );
251
  }
 
252
  wp_enqueue_script( IP_Geo_Block::PLUGIN_NAME . '-whois-js',
253
  plugins_url( $release ? 'js/whois.min.js' : 'js/whois.js', __FILE__ ),
254
  $dependency, IP_Geo_Block::VERSION, $footer
255
  );
 
256
  }
257
 
258
  // css for option page
@@ -280,19 +287,18 @@ class IP_Geo_Block_Admin {
280
  'url' => admin_url( 'admin-ajax.php' ),
281
  'nonce' => IP_Geo_Block_Util::create_nonce( $this->get_ajax_action() ),
282
  'msg' => array(
283
- /* [ 0] */ __( 'Import settings ?', 'ip-geo-block' ),
284
- /* [ 1] */ __( 'Create table ?', 'ip-geo-block' ),
285
- /* [ 2] */ __( 'Delete table ?', 'ip-geo-block' ),
286
- /* [ 3] */ __( 'Clear statistics ?', 'ip-geo-block' ),
287
- /* [ 4] */ __( 'Clear cache ?', 'ip-geo-block' ),
288
- /* [ 5] */ __( 'Clear logs ?', 'ip-geo-block' ),
289
- /* [ 6] */ __( 'ajax for logged-in user', 'ip-geo-block' ),
290
- /* [ 7] */ __( 'ajax for non logged-in user', 'ip-geo-block' ),
291
- /* [ 8] */ __( '[Found: %d]', 'ip-geo-block' ),
292
- /* [ 9] */ __( 'Find and verify `%s` on &#8220;Logs&#8221; tab.', 'ip-geo-block' ),
293
- /* [10] */ __( 'This feature is available with HTML5 compliant browsers.', 'ip-geo-block' ),
294
- /* [11] */ __( 'The selected row cannot be found in the visible area.', 'ip-geo-block' ),
295
- /* [12] */ __( 'An error occurred while executing the ajax command `%s`.', 'ip-geo-block' ),
296
  ),
297
  'i18n' => array(
298
  /* [ 0] */ '<div class="ip-geo-block-loading"></div>',
@@ -355,6 +361,17 @@ class IP_Geo_Block_Admin {
355
  );
356
  }
357
 
 
 
 
 
 
 
 
 
 
 
 
358
  /**
359
  * Show global notice.
360
  *
@@ -405,9 +422,7 @@ class IP_Geo_Block_Admin {
405
  * Register the administration menu into the WordPress Dashboard menu.
406
  *
407
  */
408
- private function add_plugin_admin_menu() {
409
- $settings = IP_Geo_Block::get_option();
410
-
411
  // Network wide or not
412
  $admin_menu = ( 'admin_menu' === current_filter() ); // @since: 2.5 `admin_menu` or `network_admin_menu`
413
 
@@ -454,6 +469,7 @@ class IP_Geo_Block_Admin {
454
  array( $this, 'display_plugin_admin_page' )
455
  //, 'dashicons-admin-site' // or 'data:image/svg+xml;base64...'
456
  );
 
457
  if ( $settings['network_wide'] ) {
458
  add_submenu_page(
459
  IP_Geo_Block::PLUGIN_NAME,
@@ -464,6 +480,7 @@ class IP_Geo_Block_Admin {
464
  array( $this, 'display_plugin_admin_page' )
465
  );
466
  }
 
467
  add_submenu_page(
468
  IP_Geo_Block::PLUGIN_NAME,
469
  __( 'IP Geo Block', 'ip-geo-block' ),
@@ -489,8 +506,7 @@ class IP_Geo_Block_Admin {
489
  * Diagnosis of admin settings.
490
  *
491
  */
492
- private function diagnose_admin_screen() {
493
- $settings = IP_Geo_Block::get_option();
494
  $updating = get_transient( IP_Geo_Block::CRON_NAME );
495
  $adminurl = $this->dashboard_url( $this->is_network && $settings['network_wide'] );
496
 
@@ -530,8 +546,9 @@ class IP_Geo_Block_Admin {
530
  self::add_admin_notice( 'error',
531
  __( 'Once you logout, you will be unable to login again because the number of login attempts reaches the limit.', 'ip-geo-block' ) . ' ' .
532
  sprintf(
533
- __( 'Please execute "<strong>Clear cache</strong>" on <a href="%s">Statistics tab</a> to prevent locking yourself out.', 'ip-geo-block' ),
534
- esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => 1 ), $adminurl ) )
 
535
  )
536
  );
537
  break;
@@ -555,7 +572,6 @@ class IP_Geo_Block_Admin {
555
  )
556
  )
557
  );
558
- break;
559
  }
560
  }
561
  if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
@@ -567,6 +583,16 @@ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
567
  }
568
  }
569
  endif;
 
 
 
 
 
 
 
 
 
 
570
  // Check activation of IP Geo Allow
571
  if ( $settings['validation']['timing'] && is_plugin_active( 'ip-geo-allow/index.php' ) ) {
572
  self::add_admin_notice( 'error',
@@ -580,12 +606,14 @@ endif;
580
  *
581
  */
582
  public function setup_admin_page() {
 
 
583
  // Register the administration menu.
584
- $this->add_plugin_admin_menu();
585
 
586
  // Avoid multiple validation.
587
- if ( 'POST' !== $_SERVER['REQUEST_METHOD'] )
588
- $this->diagnose_admin_screen();
589
 
590
  // Register settings page only if it is needed.
591
  if ( ( isset( $_GET ['page' ] ) && IP_Geo_Block::PLUGIN_NAME === $_GET ['page' ] ) ||
@@ -729,7 +757,7 @@ endif;
729
  <p class="ip-geo-block-navi-link">[ <a id="ip-geo-block-toggle-sections" href="#!"><?php _e( 'Toggle all', 'ip-geo-block' ); ?></a> ]
730
  <?php if ( 4 === $tab ) { /* Logs tab */ ?>
731
  <input id="ip-geo-block-live-update" type="checkbox"<?php checked( isset( $cookie[4][1] ) && 'o' === $cookie[4][1] ); disabled( $settings['validation']['reclogs'] && extension_loaded( 'pdo_sqlite' ), FALSE ); ?> /><label for="ip-geo-block-live-update">
732
- <dfn title="<?php _e( 'Independent of &#8220;Statistics and Logs settings&#8221;, you can see all the requests validated by this plugin in almost real time.', 'ip-geo-block' ); ?>"><?php _e( 'Live update', 'ip-geo-block' ); ?></dfn>
733
  </label>
734
  <?php } elseif (5 === $tab ) { /* Site List tab */ ?>
735
  <input id="ip-geo-block-open-new" type="checkbox"<?php checked( isset( $cookie[5][1] ) && 'o' === $cookie[5][1] );?> /><label for="ip-geo-block-open-new">
@@ -757,7 +785,7 @@ endif;
757
  }
758
  echo '<p>', implode( '<br />', $tab ), "</p>\n";
759
  echo '<p>', __( 'Thanks for providing these great services for free.', 'ip-geo-block' ), "<br />\n";
760
- echo __( '(Most browsers will redirect you to each site <a href="http://www.ipgeoblock.com/etc/referer.html" title="Referer Checker">without referrer when you click the link</a>.)', 'ip-geo-block' ), "</p>\n";
761
  } ?>
762
  <?php if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ) {
763
  echo '<p>', get_num_queries(), ' queries. ', timer_stop(0), ' seconds. ', memory_get_usage(), " bytes.</p>\n";
@@ -919,10 +947,10 @@ endif;
919
  *
920
  * @param array $input The values to be validated.
921
  *
922
- * @link http://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data
923
- * @link http://codex.wordpress.org/Function_Reference/sanitize_option
924
- * @link http://codex.wordpress.org/Function_Reference/sanitize_text_field
925
- * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/sanitize_option_$option
926
  * @link https://core.trac.wordpress.org/browser/trunk/src/wp-includes/formatting.php
927
  */
928
  public function sanitize_options( $input ) {
@@ -1076,7 +1104,7 @@ endif;
1076
  // Initialize not on the form (mainly unchecked checkbox)
1077
  public function preprocess_options( $output, $default ) {
1078
  // initialize checkboxes not in the form (added after 2.0.0, just in case)
1079
- foreach ( array( 'providers', 'save_statistics', 'cache_hold', 'anonymize', 'network_wide', 'clean_uninstall' ) as $key ) {
1080
  $output[ $key ] = is_array( $default[ $key ] ) ? array() : 0;
1081
  }
1082
 
@@ -1103,6 +1131,9 @@ endif;
1103
  $output['public'][ $key ] = is_array( $default['public'][ $key ] ) ? array() : FALSE;
1104
  }
1105
 
 
 
 
1106
  // 3.0.4 AS number, 3.0.6 Auto updating of DB files, 3.0.8 Geolite2
1107
  $output['Maxmind']['use_asn'] = $output['Geolite2']['use_asn'] = $output['update']['auto'] = FALSE;
1108
 
@@ -1201,14 +1232,19 @@ endif;
1201
  IP_Geo_Block_Cron::stop_update_db();
1202
  }
1203
 
 
 
 
 
 
1204
  return $output;
1205
  }
1206
 
1207
  /**
1208
  * A fallback function of array_replace_recursive() before PHP 5.3.
1209
  *
1210
- * @link http://php.net/manual/en/function.array-replace-recursive.php#92574
1211
- * @link http://php.net/manual/en/function.array-replace-recursive.php#109390
1212
  */
1213
  public function array_replace_recursive() {
1214
  if ( function_exists( 'array_replace_recursive' ) ) {
@@ -1377,16 +1413,16 @@ endif;
1377
  /**
1378
  * Ajax callback function
1379
  *
1380
- * @link http://codex.wordpress.org/AJAX_in_Plugins
1381
- * @link http://codex.wordpress.org/Function_Reference/check_ajax_referer
1382
- * @link http://core.trac.wordpress.org/browser/trunk/wp-admin/admin-ajax.php
1383
  */
1384
  public function admin_ajax_callback() {
 
 
1385
  // Check request origin, nonce, capability.
1386
  $this->check_admin_post( TRUE );
1387
 
1388
- require_once IP_GEO_BLOCK_PATH . 'admin/includes/class-admin-ajax.php';
1389
-
1390
  // `$which` and `$cmd` should be restricted by whitelist in each function
1391
  $settings = IP_Geo_Block::get_option();
1392
  $which = isset( $_POST['which'] ) ? $_POST['which'] : NULL;
@@ -1461,6 +1497,14 @@ endif;
1461
  }
1462
  break;
1463
 
 
 
 
 
 
 
 
 
1464
  case 'show-info': // Show system and debug information
1465
  $res = IP_Geo_Block_Admin_Ajax::get_wp_info();
1466
  break;
@@ -1501,9 +1545,9 @@ endif;
1501
  foreach ( array_unique( (array)$which[ $src ] ) as $val ) {
1502
  // replace anonymized IP address with CIDR (IPv4:256, IPv6:4096)
1503
  $val = preg_replace(
1504
- array( '/\.\*\*\*.*$/', '/\*\*\*.*$/' ),
1505
- array( '.0/24', '000/116' ),
1506
- $val
1507
  );
1508
  if ( ( filter_var( preg_replace( '/\/\d+$/', '', $val ), FILTER_VALIDATE_IP ) || preg_match( '/^AS\d+$/', $val ) ) &&
1509
  ( FALSE === strpos( $settings['extra_ips'][ $dst ], $val ) ) ) {
@@ -1516,9 +1560,7 @@ endif;
1516
  else
1517
  update_option( IP_Geo_Block::OPTION_NAME, $settings );
1518
 
1519
- $res = array(
1520
- 'page' => 'options-general.php?page=' . IP_Geo_Block::PLUGIN_NAME,
1521
- );
1522
  break;
1523
 
1524
  case 'restore-network': // Restore blocked per target in logs
@@ -1555,17 +1597,11 @@ endif;
1555
  $res = IP_Geo_Block_Admin_Ajax::find_exceptions( $cmd );
1556
  break;
1557
 
1558
- case 'create-table':
1559
- case 'delete-table':
1560
  // Need to define `IP_GEO_BLOCK_DEBUG` to true
1561
- if ( 'create-table' === $cmd )
1562
- IP_Geo_Block_Logs::create_tables();
1563
- else
1564
- IP_Geo_Block_Logs::delete_tables();
1565
-
1566
- $res = array(
1567
- 'page' => 'options-general.php?page=' . IP_Geo_Block::PLUGIN_NAME,
1568
- );
1569
  break;
1570
  }
1571
 
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
  define( 'IP_GEO_BLOCK_NETWORK', FALSE );
39
  // Load plugin text domain and add body class
40
  add_action( 'init', array( $this, 'admin_init' ) );
41
 
42
+ // Add suggest text for inclusion in the site's privacy policy. @since 4.9.6
43
+ // add_action( 'admin_init', array( $this, 'add_privacy_policy' ) );
44
+
45
  // Setup a nonce to validate authentication.
46
  add_filter( 'wp_redirect', array( $this, 'add_redirect_nonce' ), 10, 2 );
47
  }
59
  *
60
  */
61
  public function admin_init() {
62
+ // include drop in for admin if it exists
63
+ $settings = IP_Geo_Block::get_option();
64
+ file_exists( $file = IP_Geo_Block_Util::unslashit( $settings['api_dir'] ) . '/drop-in-admin.php' ) and include( $file );
65
+
66
  // Add the options page and menu item.
67
  add_action( 'admin_menu', array( $this, 'setup_admin_page' ) );
68
  add_action( 'admin_post_ip_geo_block', array( $this, 'admin_ajax_callback' ) );
115
  $urls = array( wp_login_url() );
116
 
117
  // avoid multiple redirection caused by WP hide 1.4.9.1
118
+ require_once ABSPATH . 'wp-admin/includes/plugin.php'; // is_plugin_active_for_network() @since 3.0.0
119
  if ( is_plugin_active( 'wp-hide-security-enhancer/wp-hide.php' ) )
120
  $urls[] = 'options-permalink.php';
121
 
166
  */
167
  public function create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
168
  defined( 'IP_GEO_BLOCK_DEBUG' ) and IP_GEO_BLOCK_DEBUG and assert( is_main_site(), 'Not main blog.' );
 
169
  require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-actv.php';
170
 
 
 
 
171
  // Switch to the new blog and initialize.
172
  switch_to_blog( $blog_id );
173
  IP_Geo_Block_Activate::activate_blog();
174
 
175
  // Copy option from main blog.
176
+ $settings = IP_Geo_Block::get_option();
177
  if ( $this->is_network && $settings['network_wide'] )
178
  update_option( IP_Geo_Block::OPTION_NAME, $settings );
179
 
254
  $dependency, IP_Geo_Block::VERSION, $footer
255
  );
256
  }
257
+
258
  wp_enqueue_script( IP_Geo_Block::PLUGIN_NAME . '-whois-js',
259
  plugins_url( $release ? 'js/whois.min.js' : 'js/whois.js', __FILE__ ),
260
  $dependency, IP_Geo_Block::VERSION, $footer
261
  );
262
+ break;
263
  }
264
 
265
  // css for option page
287
  'url' => admin_url( 'admin-ajax.php' ),
288
  'nonce' => IP_Geo_Block_Util::create_nonce( $this->get_ajax_action() ),
289
  'msg' => array(
290
+ /* [ 0] */ __( 'Are you sure ?', 'ip-geo-block' ),
291
+ /* [ 1] */ __( 'Open a new window', 'ip-geo-block' ),
292
+ /* [ 2] */ __( 'Generate new link', 'ip-geo-block' ),
293
+ /* [ 3] */ __( 'Delete current link', 'ip-geo-block' ),
294
+ /* [ 4] */ __( 'Please add the following link to favorites / bookmarks in your browser : ', 'ip-geo-block' ),
295
+ /* [ 5] */ __( 'ajax for logged-in user', 'ip-geo-block' ),
296
+ /* [ 6] */ __( 'ajax for non logged-in user', 'ip-geo-block' ),
297
+ /* [ 7] */ __( '[Found: %d]', 'ip-geo-block' ),
298
+ /* [ 8] */ __( 'Find and verify `%s` on &#8220;Logs&#8221; tab.', 'ip-geo-block' ),
299
+ /* [ 9] */ __( 'This feature is available with HTML5 compliant browsers.', 'ip-geo-block' ),
300
+ /* [10] */ __( 'The selected row cannot be found in the visible area.', 'ip-geo-block' ),
301
+ /* [11] */ __( 'An error occurred while executing the ajax command `%s`.', 'ip-geo-block' ),
 
302
  ),
303
  'i18n' => array(
304
  /* [ 0] */ '<div class="ip-geo-block-loading"></div>',
361
  );
362
  }
363
 
364
+ /**
365
+ * Add suggest text for inclusion in the site's privacy policy. @since 4.9.6
366
+ *
367
+ * /wp-admin/tools.php?wp-privacy-policy-guide
368
+ * https://developer.wordpress.org/plugins/privacy/privacy-related-options-hooks-and-capabilities/
369
+ */
370
+ public function add_privacy_policy() {
371
+ if ( function_exists( 'wp_add_privacy_policy_content' ) )
372
+ wp_add_privacy_policy_content( 'IP Geo Block', __( 'suggested text.', 'ip-geo-block' ) );
373
+ }
374
+
375
  /**
376
  * Show global notice.
377
  *
422
  * Register the administration menu into the WordPress Dashboard menu.
423
  *
424
  */
425
+ private function add_plugin_admin_menu( $settings ) {
 
 
426
  // Network wide or not
427
  $admin_menu = ( 'admin_menu' === current_filter() ); // @since: 2.5 `admin_menu` or `network_admin_menu`
428
 
469
  array( $this, 'display_plugin_admin_page' )
470
  //, 'dashicons-admin-site' // or 'data:image/svg+xml;base64...'
471
  );
472
+
473
  if ( $settings['network_wide'] ) {
474
  add_submenu_page(
475
  IP_Geo_Block::PLUGIN_NAME,
480
  array( $this, 'display_plugin_admin_page' )
481
  );
482
  }
483
+
484
  add_submenu_page(
485
  IP_Geo_Block::PLUGIN_NAME,
486
  __( 'IP Geo Block', 'ip-geo-block' ),
506
  * Diagnosis of admin settings.
507
  *
508
  */
509
+ private function diagnose_admin_screen( $settings ) {
 
510
  $updating = get_transient( IP_Geo_Block::CRON_NAME );
511
  $adminurl = $this->dashboard_url( $this->is_network && $settings['network_wide'] );
512
 
546
  self::add_admin_notice( 'error',
547
  __( 'Once you logout, you will be unable to login again because the number of login attempts reaches the limit.', 'ip-geo-block' ) . ' ' .
548
  sprintf(
549
+ __( 'Please remove your IP address in &#8220;%1$sStatistics in IP address cache%2$s&#8221; on &#8220;%3$sStatistics%4$s&#8221; tab to prevent locking yourself out.', 'ip-geo-block' ),
550
+ '<strong><a href="' . esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => 1, 'sec' => 2 ), $adminurl ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-2' ) . '">', '</a></strong>',
551
+ '<strong>', '</strong>'
552
  )
553
  );
554
  break;
572
  )
573
  )
574
  );
 
575
  }
576
  }
577
  if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
583
  }
584
  }
585
  endif;
586
+ // Check consistency of emergency login link
587
+ if ( $settings['login_link']['link'] && ! IP_Geo_Block_Util::verify_link( $settings['login_link']['link'], $settings['login_link']['hash'] ) ) {
588
+ self::add_admin_notice( 'error',
589
+ sprintf(
590
+ __( 'Emergency login link is outdated. Please delete it once and generate again at &#8220;%sPlugin settings%s&#8221; section. Also do not forget to update favorites / bookmarks in your browser.', 'ip-geo-block' ),
591
+ '<strong><a href="' . esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => 0, 'sec' => 7 ), $adminurl ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-7' ) . '">', '</a></strong>'
592
+ )
593
+ );
594
+ }
595
+
596
  // Check activation of IP Geo Allow
597
  if ( $settings['validation']['timing'] && is_plugin_active( 'ip-geo-allow/index.php' ) ) {
598
  self::add_admin_notice( 'error',
606
  *
607
  */
608
  public function setup_admin_page() {
609
+ $settings = IP_Geo_Block::get_option();
610
+
611
  // Register the administration menu.
612
+ $this->add_plugin_admin_menu( $settings );
613
 
614
  // Avoid multiple validation.
615
+ if ( 'GET' === $_SERVER['REQUEST_METHOD'] )
616
+ $this->diagnose_admin_screen( $settings );
617
 
618
  // Register settings page only if it is needed.
619
  if ( ( isset( $_GET ['page' ] ) && IP_Geo_Block::PLUGIN_NAME === $_GET ['page' ] ) ||
757
  <p class="ip-geo-block-navi-link">[ <a id="ip-geo-block-toggle-sections" href="#!"><?php _e( 'Toggle all', 'ip-geo-block' ); ?></a> ]
758
  <?php if ( 4 === $tab ) { /* Logs tab */ ?>
759
  <input id="ip-geo-block-live-update" type="checkbox"<?php checked( isset( $cookie[4][1] ) && 'o' === $cookie[4][1] ); disabled( $settings['validation']['reclogs'] && extension_loaded( 'pdo_sqlite' ), FALSE ); ?> /><label for="ip-geo-block-live-update">
760
+ <dfn title="<?php _e( 'Independent of &#8220;Privacy and record settings&#8221;, you can see all the requests validated by this plugin in almost real time.', 'ip-geo-block' ); ?>"><?php _e( 'Live update', 'ip-geo-block' ); ?></dfn>
761
  </label>
762
  <?php } elseif (5 === $tab ) { /* Site List tab */ ?>
763
  <input id="ip-geo-block-open-new" type="checkbox"<?php checked( isset( $cookie[5][1] ) && 'o' === $cookie[5][1] );?> /><label for="ip-geo-block-open-new">
785
  }
786
  echo '<p>', implode( '<br />', $tab ), "</p>\n";
787
  echo '<p>', __( 'Thanks for providing these great services for free.', 'ip-geo-block' ), "<br />\n";
788
+ echo __( '(Most browsers will redirect you to each site <a href="https://www.ipgeoblock.com/etc/referer.html" title="Referer Checker">without referrer when you click the link</a>.)', 'ip-geo-block' ), "</p>\n";
789
  } ?>
790
  <?php if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ) {
791
  echo '<p>', get_num_queries(), ' queries. ', timer_stop(0), ' seconds. ', memory_get_usage(), " bytes.</p>\n";
947
  *
948
  * @param array $input The values to be validated.
949
  *
950
+ * @link https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data
951
+ * @link https://codex.wordpress.org/Function_Reference/sanitize_option
952
+ * @link https://codex.wordpress.org/Function_Reference/sanitize_text_field
953
+ * @link https://codex.wordpress.org/Plugin_API/Filter_Reference/sanitize_option_$option
954
  * @link https://core.trac.wordpress.org/browser/trunk/src/wp-includes/formatting.php
955
  */
956
  public function sanitize_options( $input ) {
1104
  // Initialize not on the form (mainly unchecked checkbox)
1105
  public function preprocess_options( $output, $default ) {
1106
  // initialize checkboxes not in the form (added after 2.0.0, just in case)
1107
+ foreach ( array( 'providers', 'save_statistics', 'cache_hold', 'anonymize', 'restrict_api', 'network_wide', 'clean_uninstall' ) as $key ) {
1108
  $output[ $key ] = is_array( $default[ $key ] ) ? array() : 0;
1109
  }
1110
 
1131
  $output['public'][ $key ] = is_array( $default['public'][ $key ] ) ? array() : FALSE;
1132
  }
1133
 
1134
+ // disabled in case IP address cache is disabled
1135
+ empty( $output['cache_hold'] ) and $output['login_fails'] = -1;
1136
+
1137
  // 3.0.4 AS number, 3.0.6 Auto updating of DB files, 3.0.8 Geolite2
1138
  $output['Maxmind']['use_asn'] = $output['Geolite2']['use_asn'] = $output['update']['auto'] = FALSE;
1139
 
1232
  IP_Geo_Block_Cron::stop_update_db();
1233
  }
1234
 
1235
+ // expiration time [days]
1236
+ if ( version_compare( $output['version'], '3.0.13' ) < 0 )
1237
+ $output['validation']['explogs'] /= DAY_IN_SECONDS;
1238
+ $output['validation']['explogs'] = min( 365, max( 1, (int)$output['validation']['explogs'] ) );
1239
+
1240
  return $output;
1241
  }
1242
 
1243
  /**
1244
  * A fallback function of array_replace_recursive() before PHP 5.3.
1245
  *
1246
+ * @link https://php.net/manual/en/function.array-replace-recursive.php#92574
1247
+ * @link https://php.net/manual/en/function.array-replace-recursive.php#109390
1248
  */
1249
  public function array_replace_recursive() {
1250
  if ( function_exists( 'array_replace_recursive' ) ) {
1413
  /**
1414
  * Ajax callback function
1415
  *
1416
+ * @link https://codex.wordpress.org/AJAX_in_Plugins
1417
+ * @link https://codex.wordpress.org/Function_Reference/check_ajax_referer
1418
+ * @link https://core.trac.wordpress.org/browser/trunk/wp-admin/admin-ajax.php
1419
  */
1420
  public function admin_ajax_callback() {
1421
+ require_once IP_GEO_BLOCK_PATH . 'admin/includes/class-admin-ajax.php';
1422
+
1423
  // Check request origin, nonce, capability.
1424
  $this->check_admin_post( TRUE );
1425
 
 
 
1426
  // `$which` and `$cmd` should be restricted by whitelist in each function
1427
  $settings = IP_Geo_Block::get_option();
1428
  $which = isset( $_POST['which'] ) ? $_POST['which'] : NULL;
1497
  }
1498
  break;
1499
 
1500
+ case 'generate-link': // Generate new link
1501
+ $res = array( 'link' => IP_Geo_Block_Util::generate_link() );
1502
+ break;
1503
+
1504
+ case 'delete-link': // Delete existing link
1505
+ IP_Geo_Block_Util::delete_link();
1506
+ break;
1507
+
1508
  case 'show-info': // Show system and debug information
1509
  $res = IP_Geo_Block_Admin_Ajax::get_wp_info();
1510
  break;
1545
  foreach ( array_unique( (array)$which[ $src ] ) as $val ) {
1546
  // replace anonymized IP address with CIDR (IPv4:256, IPv6:4096)
1547
  $val = preg_replace(
1548
+ array( '/\.\*\*\*$/', '/:\w*\*\*\*$/', '/(::.*)::\/116$/' ),
1549
+ array( '.0/24', '::/116', '$1/116' ),
1550
+ trim( $val )
1551
  );
1552
  if ( ( filter_var( preg_replace( '/\/\d+$/', '', $val ), FILTER_VALIDATE_IP ) || preg_match( '/^AS\d+$/', $val ) ) &&
1553
  ( FALSE === strpos( $settings['extra_ips'][ $dst ], $val ) ) ) {
1560
  else
1561
  update_option( IP_Geo_Block::OPTION_NAME, $settings );
1562
 
1563
+ $res = array( 'page' => 'options-general.php?page=' . IP_Geo_Block::PLUGIN_NAME );
 
 
1564
  break;
1565
 
1566
  case 'restore-network': // Restore blocked per target in logs
1597
  $res = IP_Geo_Block_Admin_Ajax::find_exceptions( $cmd );
1598
  break;
1599
 
1600
+ case 'init-table':
 
1601
  // Need to define `IP_GEO_BLOCK_DEBUG` to true
1602
+ IP_Geo_Block_Logs::delete_tables();
1603
+ IP_Geo_Block_Logs::create_tables();
1604
+ $res = array( 'page' => 'options-general.php?page=' . IP_Geo_Block::PLUGIN_NAME );
 
 
 
 
 
1605
  break;
1606
  }
1607
 
admin/css/admin-icons.css CHANGED
@@ -1,54 +1,110 @@
1
- /*! IP Geo Block admin icons */
 
 
 
 
 
2
  @font-face {
3
- font-family: 'icomoon';
4
- src: url('fonts/icomoon.eot?astkh8');
5
- src: url('fonts/icomoon.eot?astkh8#iefix') format('embedded-opentype'),
6
- url('fonts/icomoon.ttf?astkh8') format('truetype'),
7
- url('fonts/icomoon.woff?astkh8') format('woff'),
8
- url('fonts/icomoon.svg?astkh8#icomoon') format('svg');
9
- font-weight: normal;
10
- font-style: normal;
11
  }
12
 
13
  [class^="ip-geo-block-icon-"], [class*=" ip-geo-block-icon-"] {
14
- /* use !important to prevent issues with browser extensions that change fonts */
15
- font-family: 'icomoon' !important;
16
- speak: none;
17
- font-style: normal;
18
- font-weight: normal;
19
- font-variant: normal;
20
- text-transform: none;
21
- line-height: 1;
22
- /* Better Font Rendering =========== */
23
- -webkit-font-smoothing: antialiased;
24
- -moz-osx-font-smoothing: grayscale;
 
25
  }
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  .ip-geo-block-icon-play:before {
28
- content: "\ea1c";
29
  }
30
  .ip-geo-block-icon-pause:before {
31
- content: "\ea1d";
32
  }
33
  .ip-geo-block-icon-stop:before {
34
- content: "\ea1e";
 
 
 
 
 
 
35
  }
36
- .ip-geo-block-icon-warn:before {
37
- content: "\ea07";
38
- color: #c43322;
39
  }
40
 
41
  #toplevel_page_ip-geo-block .dashicons-admin-generic:before {
42
  font-family: 'icomoon';
43
- content: "\e9c9";
44
  font-size: 18px;
45
  margin-left: 2px;
46
  }
47
- /*#toplevel_page_ip-geo-block .dashicons-admin-generic:after {
 
48
  font-family: 'icomoon';
49
- content: "\e9b4";
50
- font-size: 10px;
51
- position: absolute;
52
- top: 1.4em;
53
- left: 2em;
54
- }*/
1
+ /*! IP Geo Block admin icons
2
+ * This package includes the following icon font.
3
+ * IcoMoon - Free / Designer: Keyamoon / License: GPL / CC BY 4.0
4
+ * Zondicons / Designer: Steve Schoger / License: CC BY 4.0
5
+ * Material Icons / Designer: Google / License: Apache License 2.0
6
+ */
7
  @font-face {
8
+ font-family: 'icomoon';
9
+ src: url('fonts/icomoon.eot?119jp3');
10
+ src: url('fonts/icomoon.eot?119jp3#iefix') format('embedded-opentype'),
11
+ url('fonts/icomoon.ttf?119jp3') format('truetype'),
12
+ url('fonts/icomoon.woff?119jp3') format('woff'),
13
+ url('fonts/icomoon.svg?119jp3#icomoon') format('svg');
14
+ font-weight: normal;
15
+ font-style: normal;
16
  }
17
 
18
  [class^="ip-geo-block-icon-"], [class*=" ip-geo-block-icon-"] {
19
+ /* use !important to prevent issues with browser extensions that change fonts */
20
+ font-family: 'icomoon' !important;
21
+ speak: none;
22
+ font-style: normal;
23
+ font-weight: normal;
24
+ font-variant: normal;
25
+ text-transform: none;
26
+ line-height: 1;
27
+
28
+ /* Better Font Rendering =========== */
29
+ -webkit-font-smoothing: antialiased;
30
+ -moz-osx-font-smoothing: grayscale;
31
  }
32
 
33
+ .ip-geo-block-icon-calc {
34
+ margin-top: 0.2em !important;
35
+ }
36
+ .ip-geo-block-icon-calc:before {
37
+ content: "\e901";
38
+ }
39
+ .ip-geo-block-icon-vpn_lock:before {
40
+ content: "\e62f";
41
+ }
42
+ .ip-geo-block-icon-search:before {
43
+ content: "\e986";
44
+ }
45
+ .ip-geo-block-icon-key:before {
46
+ content: "\e98d";
47
+ }
48
+ .ip-geo-block-icon-lock:before {
49
+ content: "\e98f";
50
+ }
51
+ .ip-geo-block-icon-unlocked:before {
52
+ content: "\e990";
53
+ }
54
+ .ip-geo-block-icon-cogs:before {
55
+ content: "\e995";
56
+ }
57
+ .ip-geo-block-icon-pie-chart:before {
58
+ content: "\e99a";
59
+ }
60
+ .ip-geo-block-icon-stats-dots:before {
61
+ content: "\e99b";
62
+ }
63
+ .ip-geo-block-icon-stats-bars:before {
64
+ content: "\e99c";
65
+ }
66
+ .ip-geo-block-icon-stats-bars2:before {
67
+ content: "\e99d";
68
+ }
69
+ .ip-geo-block-icon-switch:before {
70
+ content: "\e9b6";
71
+ }
72
+ .ip-geo-block-icon-sphere:before {
73
+ content: "\e9c9";
74
+ }
75
+ .ip-geo-block-icon-earth:before {
76
+ content: "\e9ca";
77
+ }
78
  .ip-geo-block-icon-play:before {
79
+ content: "\ea1c";
80
  }
81
  .ip-geo-block-icon-pause:before {
82
+ content: "\ea1d";
83
  }
84
  .ip-geo-block-icon-stop:before {
85
+ content: "\ea1e";
86
+ }
87
+ .ip-geo-block-icon-eject:before {
88
+ content: "\ea25";
89
+ }
90
+ .ip-geo-block-icon-new-tab:before {
91
+ content: "\ea7e";
92
  }
93
+ .ip-geo-block-icon-warning:before {
94
+ content: "\e900";
 
95
  }
96
 
97
  #toplevel_page_ip-geo-block .dashicons-admin-generic:before {
98
  font-family: 'icomoon';
99
+ content: "\e62f";
100
  font-size: 18px;
101
  margin-left: 2px;
102
  }
103
+ /*
104
+ #toplevel_page_ip-geo-block .dashicons-admin-generic:before {
105
  font-family: 'icomoon';
106
+ content: "\e9c9";
107
+ font-size: 18px;
108
+ margin-left: 2px;
109
+ }
110
+ */
 
admin/css/admin-icons.min.css CHANGED
@@ -1,2 +1,7 @@
1
- /*! IP Geo Block admin icons */
2
- @font-face{font-family:icomoon;src:url(fonts/icomoon.eot?astkh8);src:url(fonts/icomoon.eot?astkh8#iefix) format('embedded-opentype'),url(fonts/icomoon.ttf?astkh8) format('truetype'),url(fonts/icomoon.woff?astkh8) format('woff'),url(fonts/icomoon.svg?astkh8#icomoon) format('svg');font-weight:400;font-style:normal}[class*=" ip-geo-block-icon-"],[class^=ip-geo-block-icon-]{font-family:icomoon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ip-geo-block-icon-play:before{content:"\ea1c"}.ip-geo-block-icon-pause:before{content:"\ea1d"}.ip-geo-block-icon-stop:before{content:"\ea1e"}.ip-geo-block-icon-warn:before{content:"\ea07";color:#c43322}#toplevel_page_ip-geo-block .dashicons-admin-generic:before{font-family:icomoon;content:"\e9c9";font-size:18px;margin-left:2px}
 
 
 
 
 
1
+ /*! IP Geo Block admin icons
2
+ * This package includes the following icon font.
3
+ * IcoMoon - Free / Designer: Keyamoon / License: GPL / CC BY 4.0
4
+ * Zondicons / Designer: Steve Schoger / License: CC BY 4.0
5
+ * Material Icons / Designer: Google / License: Apache License 2.0
6
+ */
7
+ @font-face{font-family:icomoon;src:url(fonts/icomoon.eot?119jp3);src:url(fonts/icomoon.eot?119jp3#iefix) format('embedded-opentype'),url(fonts/icomoon.ttf?119jp3) format('truetype'),url(fonts/icomoon.woff?119jp3) format('woff'),url(fonts/icomoon.svg?119jp3#icomoon) format('svg');font-weight:400;font-style:normal}[class*=" ip-geo-block-icon-"],[class^=ip-geo-block-icon-]{font-family:icomoon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ip-geo-block-icon-calc{margin-top:.2em!important}.ip-geo-block-icon-calc:before{content:"\e901"}.ip-geo-block-icon-vpn_lock:before{content:"\e62f"}.ip-geo-block-icon-search:before{content:"\e986"}.ip-geo-block-icon-key:before{content:"\e98d"}.ip-geo-block-icon-lock:before{content:"\e98f"}.ip-geo-block-icon-unlocked:before{content:"\e990"}.ip-geo-block-icon-cogs:before{content:"\e995"}.ip-geo-block-icon-pie-chart:before{content:"\e99a"}.ip-geo-block-icon-stats-dots:before{content:"\e99b"}.ip-geo-block-icon-stats-bars:before{content:"\e99c"}.ip-geo-block-icon-stats-bars2:before{content:"\e99d"}.ip-geo-block-icon-switch:before{content:"\e9b6"}.ip-geo-block-icon-sphere:before{content:"\e9c9"}.ip-geo-block-icon-earth:before{content:"\e9ca"}.ip-geo-block-icon-play:before{content:"\ea1c"}.ip-geo-block-icon-pause:before{content:"\ea1d"}.ip-geo-block-icon-stop:before{content:"\ea1e"}.ip-geo-block-icon-eject:before{content:"\ea25"}.ip-geo-block-icon-new-tab:before{content:"\ea7e"}.ip-geo-block-icon-warning:before{content:"\e900"}#toplevel_page_ip-geo-block .dashicons-admin-generic:before{font-family:icomoon;content:"\e62f";font-size:18px;margin-left:2px}
admin/css/admin.css CHANGED
@@ -213,22 +213,32 @@ input[id*="ip_geo_block_settings_providers"] + label {
213
  color: #2786C2;
214
  display: inline-block;
215
  }
 
 
 
 
 
 
 
 
 
 
216
 
217
  /* Loading image */
218
  .ip-geo-block-loading,
219
  #ip-geo-block-live-loading {
 
 
220
  background-size: 16px 16px;
221
  background-position: center center;
222
  background-repeat: no-repeat;
223
- height: 16px;
224
- width: 16px;
225
  margin-left: 1em;
226
  margin-top: 0.2em;
227
  display: inline-block;
228
  vertical-align: top;
229
  }
230
  .ip-geo-block-loading {
231
- background-image: url(data:image/gif;base64,R0lGODlhEAAQAPIGAAAAAMLCwkJCQpKSkmJiYoKCgv///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCgAGACwAAAAAEAAQAAADM2i63P4wyklrC0IEKgAQnAdOmGYFBLExwboQWcG2rlHEwTDQLUsUOd2mBxkUCgNKa+dIAAAh+QQJCgAGACwAAAIACgAOAAADLWgWIqHQCABEVLPe1R4MBOFFRFNsRUNsYDFewTC8iixvQ1EMyxjEvyBLODQkAAAh+QQJCgAGACwAAAAACgAOAAADLWi6IRJrCQCECoU0ag1xxeBARuEQ0UUU5DUM7fK+qTEUYR0EcM3Ev51uB7wAEwAh+QQJCgAGACwAAAAADgAKAAADLWi6URQrLiJEkSaM0eqrkLFtAVEEAgAIylAUQ5SuSqCFNZjhWG3zmB8wOJQkAAAh+QQJCgAGACwCAAAADgAKAAADK2hqMRMrLuekCnCU8gqBDCZ2glBcYkSUxIJJgQdaUVDOtAAAAr3oPN/llgAAIfkECQoABgAsBgAAAAoADgAAAytoEdauiz0Yx5BQFTvN2EMXWNgUFETZFIJQdERLiGgZtKohAIDQ7T0RrpEAACH5BAkKAAYALAYAAgAKAA4AAAMqaKoR+609Fie1K4zhZiibNRSg1XAQUXQPIQgE835voQgAIARqh+ummSUBACH5BAUKAAYALAIABgAOAAoAAAMsaLpsES2+F9mEddEgBFbBMGACAAiMOCrlGRBFWBQD2L0dYYjfUuQZEKynSAAAOw==);
232
  }
233
 
234
  /* Google Map infomation window */
@@ -333,16 +343,6 @@ table.ip-geo-block-table td:first-child {
333
  word-break: normal;
334
  white-space: pre;
335
  }
336
- #ip-geo-block-preferred {
337
- color: #fff;
338
- background: #00838f !important;
339
- border-color: #00707a !important;
340
- text-shadow: none; /* for WordPress 3.7.21 */
341
- }
342
- #ip-geo-block-preferred:hover {
343
- background-color: #00919e !important;
344
- border-color: #00525a !important;
345
- }
346
  #ip-geo-block-back-to-top {
347
  margin:0;
348
  text-align:right;
@@ -359,7 +359,7 @@ table.ip-geo-block-table td:first-child {
359
 
360
  /* Icons */
361
  dfn ~ .ip-geo-block-icon {
362
- margin-left: 0.6em;
363
  }
364
  .ip-geo-block-icon {
365
  position: relative;
@@ -383,9 +383,6 @@ dfn ~ .ip-geo-block-icon {
383
  background-position: center center;
384
  background-repeat: no-repeat;
385
  }
386
- .ip-geo-block-icon-cidr span {
387
- vertical-align: text-top;
388
- }
389
  .ip-geo-block-icon-cycle span {
390
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAh1BMVEUAda2otLp+rsSHprWHr8IBd7EpfKRGhaNajqeUqrRymKuKoq5yo7prlKgAcqoVe6w8gqQmgq5Tj6wIdqsVdKIshrEMea1Uhp+Anqw0hawDdq4gfKhljqE7hqoLdKYbgbM4jLQygKUGeK8CdawQd6gVeKcad6NKkrSerrZAj7UAc6sAc6rc3NySrVGQAAAALXRSTlP//////////////////////////////////////////////////////////wCl7wv9AAACOklEQVR4Ae2W15rzKgxF9xTZzhTX9B7S/gN6/9ebYqzzGZsw/S7LV3FZgCSIwD/kQ8FVcBU8xatZUczy8luC/ABNOn0DSHEsvyZ4PgLatNCYR3efFxyhTQ8g+qQgJxgv2JefERzJXATRh4LHOUwAHD4S7OGEztRJaN86hAUxtaNWDUf/bRdDBbQMWVDAO8jn89WUhag1MeyCAh6hHofyrliLgZKggDMYgzF3eVAwFq0uCZq5KY0TezjIHDDzC0qqmkwe2ctGDOQVLMkgu+F3/rGXwb4xIPcJ6P3JgkM8wFjmfcFAWfeKQywaAz33BJVuHsUcAt09gVbuLDThAJkdR687ggLmf4gDJLIGV7BydtB8yn3u+fbtuj/LS7G9wZAd1AKK+yxJ1x+aBmibTtgCcEHGHsh0wdbOgNLek4L7lI5BigY8nWuZUQ3qGEXes9JzOKGJztPaGtLslu3lIXJirdxCWkASHGDTMqg7V1DKPplygDG61YJukLHjEErGSXqCSos6xNSOgzP3BDmsQBcchNwkoV8oiNnPA78zIefUgCdJeGIfE7LmFWXsFTCFdzTJ/RlfEMRiSGnFXXbkC7AIeqcKDu4ynseozeouKJiSEYBDwkJyIC1nRUjgblkNWp/e/1vXc2gjoAoLksYgjrrFMi0oDgjEEIDij1scBXMJSH6DAj6RNl7o8MkuLak8Co15/Pk+MRmT0xilQJV/sdWNKg2kTaeroudvNNsDjmejYjSL+e6v2/2r4Cp4BXNajr0H7hRfAAAAAElFTkSuQmCC);
391
  }
@@ -539,33 +536,33 @@ input#ip_geo_block_settings_behavior_time {
539
  /*------------------------------------------------------------
540
  * Customizing based on jquery.dataTables.css
541
  *------------------------------------------------------------*/
542
- table.dataTable {
543
  clear: none !important;
544
  }
545
- table.dataTable th,
546
- table.dataTable td {
547
  text-align: right;
548
  }
549
- table.dataTable th:nth-child(n+2),
550
- table.dataTable td:nth-child(n+2) {
551
  padding-left: 0 !important;
552
  }
553
- table.dataTable th {
554
  white-space: nowrap;
555
  }
556
- table.dataTable > thead > tr {
557
  line-height: 1.8em;
558
  }
559
- table.dataTable > tbody > tr {
560
  cursor: pointer;
561
  }
562
- table.dataTable > thead > tr > th,
563
- table.dataTable > thead > tr > td,
564
- table.dataTable.no-footer {
565
  border-bottom: 1px solid #ddd;
566
  }
567
- table.dataTable thead th,
568
- table.dataTable thead td {
569
  padding: 10px 16px;
570
  }
571
  /* country code */
@@ -575,18 +572,18 @@ table.dataTable thead td {
575
  }
576
 
577
  /* Scroll bar */
578
- .dataTables_wrapper.no-footer .dataTables_scrollBody {
579
  border-bottom: 1px solid #ddd;
580
  }
581
 
582
  /* Size of column */
583
- table.dataTable.nowrap td,
584
- table.dataTable > tbody > tr > td span {
585
  white-space: normal !important;
586
  word-wrap: break-word !important;
587
  word-break: break-all !important;
588
  }
589
- table.dataTable > tbody > tr > td span {
590
  display: inline-block;
591
  }
592
 
@@ -594,36 +591,36 @@ table.dataTable > tbody > tr > td span {
594
  .ip-geo-block-settings-folding input[type="checkbox"] {
595
  margin-right: 0.5em;
596
  }
597
- table.dataTable input[type="checkbox"] {
598
  max-height: 16px;
599
  max-width: 16px;
600
  margin: 0;
601
  }
602
- table.dataTable > thead > tr > th:first-child,
603
- table.dataTable > tbody > tr > td:first-child {
604
  padding: 8px 4px 8px 1.4em;
605
  text-align: left;
606
  }
607
 
608
  /* No data available in table */
609
- table.dataTable > tbody > tr > td.dataTables_empty,
610
  table.collapsed > tbody > tr > td.dataTables_empty:first-child::before {
611
  border: none;
612
  text-align: center;
613
  }
614
 
615
  /* Checkbox column */
616
- table.dataTable thead > tr > th:first-child.sorting_asc {
617
  background-image: none !important;
618
  }
619
- table.dataTable.display tbody tr.even > .sorting_1,
620
- table.dataTable.display tbody tr.odd > .sorting_1,
621
- table.dataTable.display tbody tr:hover > .sorting_1 {
622
  background-color: inherit !important;
623
  }
624
 
625
  /* Collapsed */
626
- table.dataTable.collapsed > tbody > tr > td:first-child {
627
  padding: 8px 4px 8px 8px !important;
628
  }
629
  table.collapsed > tbody > tr > td:first-child::before,
@@ -671,21 +668,21 @@ table.collapsed > tbody > tr.child > td.child > ul li span.dtr-data {
671
  }
672
 
673
  /* Pagenation */
674
- .dataTables_wrapper .dataTables_paginate {
675
  float: none;
676
  text-align: center;
677
  margin-bottom: 1em;
678
  }
679
- .dataTables_wrapper .dataTables_paginate span.ellipsis,
680
- .dataTables_wrapper .dataTables_paginate a.paginate_button,
681
- .dataTables_wrapper .dataTables_paginate a.paginate_button:hover,
682
- .dataTables_wrapper .dataTables_paginate a.paginate_button:active,
683
- .dataTables_wrapper .dataTables_paginate a.paginate_button.current,
684
- .dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover,
685
- .dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,
686
- .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,
687
- .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,
688
- .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active {
689
  min-width: 2em;
690
  background: inherit;
691
  border-color: #ddd;
@@ -699,37 +696,37 @@ table.collapsed > tbody > tr.child > td.child > ul li span.dtr-data {
699
  display: inline-block;
700
  text-decoration: none;
701
  }
702
- .dataTables_wrapper .dataTables_paginate > a.paginate_button:first-child,
703
- .dataTables_wrapper .dataTables_paginate:hover > a.paginate_button:first-child,
704
- .dataTables_wrapper .dataTables_paginate:active > a.paginate_button:first-child {
705
  border-left-width: 1px;
706
  border-bottom-left-radius: 4px;
707
  border-top-left-radius: 4px;
708
  }
709
- .dataTables_wrapper .dataTables_paginate > a.paginate_button:last-child,
710
- .dataTables_wrapper .dataTables_paginate:hover > a.paginate_button:last-child,
711
- .dataTables_wrapper .dataTables_paginate:active > a.paginate_button:last-child {
712
  border-bottom-right-radius: 4px;
713
  border-top-right-radius: 4px;
714
  }
715
- .dataTables_wrapper .dataTables_paginate a.paginate_button {
716
  color: #0073aa !important;
717
  }
718
- .dataTables_wrapper .dataTables_paginate a.paginate_button:hover {
719
  color: #0096dd !important;
720
  background-color: #fff;
721
  }
722
- .dataTables_wrapper .dataTables_paginate span.ellipsis,
723
- .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,
724
- .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,
725
- .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active {
726
  cursor: default;
727
  color: #999 !important;
728
  background-color: transparent;
729
  }
730
- .dataTables_wrapper .dataTables_paginate a.paginate_button.current,
731
- .dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover,
732
- .dataTables_wrapper .dataTables_paginate a.paginate_button.current:active {
733
  cursor: default;
734
  color: #444 !important;
735
  background-color: #fff !important;
@@ -770,10 +767,10 @@ table.collapsed > tbody > tr.child > td.child > ul li span.dtr-data {
770
  }
771
 
772
  /* Transition for new row */
773
- table.dataTable.display tbody tr.ip-geo-block-passed {
774
  background-color: #edf6ff !important;
775
  }
776
- table.dataTable.display tbody tr.ip-geo-block-blocked {
777
  background-color: #ffefef !important;
778
  }
779
  .ip-geo-block-new-passed {
@@ -866,7 +863,7 @@ mark {
866
  display: block;
867
  height: 1em;
868
  width: 1em;
869
- background: radial-gradient(#0073aa, #72777c);
870
  border-radius: 50%;
871
  position: absolute;
872
  top: 0;
@@ -898,8 +895,8 @@ mark {
898
  transform: rotate(180deg);
899
  }
900
  .ip-geo-block-live-timer > div:last-child:before {
901
- /* older webkit seems buggy with zero so use 0.00001 */
902
- transform: rotate(0.00001deg);
903
  animation: 30s spin-timer linear 30s forwards;
904
  }
905
  @keyframes spin-timer {
@@ -907,6 +904,24 @@ mark {
907
  100% {transform: rotate(180deg);}
908
  }
909
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
910
  :placeholder-shown { color: #888; }
911
  ::-webkit-input-placeholder { color: #888; } /* Google Chrome, Safari, Opera 15+, Android, iOS */
912
  :-moz-placeholder { color: #888; opacity: 1; } /* Firefox 18- */
213
  color: #2786C2;
214
  display: inline-block;
215
  }
216
+ .ip-geo-block-primary {
217
+ color: #fff !important;;
218
+ background: #00838f !important;
219
+ border-color: #00707a !important;
220
+ text-shadow: none; /* for WordPress 3.7.21 */
221
+ }
222
+ .ip-geo-block-primary:hover {
223
+ background-color: #00919e !important;
224
+ border-color: #00525a !important;
225
+ }
226
 
227
  /* Loading image */
228
  .ip-geo-block-loading,
229
  #ip-geo-block-live-loading {
230
+ height: 16px;
231
+ width: 16px;
232
  background-size: 16px 16px;
233
  background-position: center center;
234
  background-repeat: no-repeat;
 
 
235
  margin-left: 1em;
236
  margin-top: 0.2em;
237
  display: inline-block;
238
  vertical-align: top;
239
  }
240
  .ip-geo-block-loading {
241
+ background-image: url(data:image/gif;base64,R0lGODlhEAAQAPYCAKqqqsbGxlZWVsrKyvr6+ubm5tDQ0K6urmZmZmJiYuzs7IaGhvT09JycnLq6us7Ozurq6o6OjtbW1tra2vDw8CgoKCYmJvz8/NLS0kJCQlJSUqysrPLy8vb29pqamra2tm5ubujo6Kampvj4+IiIiMjIyEhISNzc3OLi4rKysj4+PlBQULi4uJKSkmRkZODg4KKiou7u7iQkJB4eHlpaWhISErCwsHh4eMDAwDIyMi4uLqSkpIKCgr6+vt7e3n5+fggICJCQkAwMDEpKSmBgYHZ2dhgYGBYWFnx8fF5eXk5OTiIiIjAwMIyMjISEhDQ0NJaWltTU1AQEBBwcHGpqaoqKiuTk5CoqKlhYWAoKCtjY2Hp6ehAQEJ6ensLCwkxMTJSUlCwsLAYGBnR0dDg4OFxcXLy8vKCgoA4ODsTExMzMzDw8PERERDY2NqioqHJycrS0tGhoaBQUFEZGRjo6OkBAQICAgHBwcFRUVCAgIGxsbP///wAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCgACACwAAAAAEAAQAEAHjIACgoOEhYJsbTGGghcPGIJRbFNNhgQKCheDDkllDQYMHSc4MAcvhTB0aFliggQjmYNEFQ6LAh0+VoIwbFW1GGamhCgfUE5NbgMKtQYLc0a1gjsyR3E2IYwMFASDYDJvtRRWFIJ1TMq1ElqCICpetQoBEoInVCsAhhI2XhyEPUgIIG7waALlwAloCAMBACH5BAkKAAIALAEAAQAOAA4AAAeDgAKCEmBYYRVKJAaCjAcrVzIzRjVoTw2MKRk5Ww4KECkuWTWCE0Rrl4yCTow7bAupsBcCW19psKkjBEQaFLeMHBwINBy+ggoxVQkPxSMFMXBUMMUQPhRWVUU9tyFRLwQCA048cCcjIyFaJQYxjA8NEVBnAClmahCwEANwbjYBJwyMAgEAIfkECQoABQAsAQABAA4ADgAAB4OABYInO29DbC5QUYKMZiBfbCptTBUmIow4LgJBaTExZkVLFTAFKD8JB4yMQUZrBixUXaqqVFwkUG8Ys4wpQiZOWwy7ghBiRk08HcOqblUTy4wlLWbLBCMFCgBdurMjFMoFE24ADxAXFwwKITEEjD5mH2YBDxI+IdeqHCcGAxgv7IwCAQAh+QQJCgAAACwBAAEADgAOAAAHhYAAglYfTVQJSCITgowDVSAISQJKJgkpjA8LWyIGHBQBJCoZBwAQDU44jIxdTxoSAxEfqqpbFWApUCezjA5LWCJdI7uCClNXGyLCwxBHFl4HBcMAKVxfEx8Y0glZCxwlOCjDUkwPACElAygMghftAB6MClpRJygQFB0EuyMKBQUKDPQxCgQAIfkECQoAAAAsAQABAA4ADgAAB4SAAIIKahstTQ0OVoKMJzYeLVU8W29OXowvBztePh0dUTtxVD0AHDgHEoyMKWVvPj4sBqqqLUoiGDgQs4wBJmNqARe7gjEqXxgPwsMxbWw+UQzDAGY6LjEnusNjFmAEBVbRs00zc1EAHRAKHYw2CHIyO4wEHAwjgmJCZDC7F8psC7IEBQIAIfkECQoARwAsAQABAA4ADgAAB4OAR4IMPgMfNg4PCoKMEA84LCkAMB47GIwxBiUTEAQjKD0REQ9HBD4YIYyMATwtBRQnqaqMG0UOEC8ds4wYIEEQBbuMHC4gMYvCRxw0CAwcF8kBGj8EHdDCJCYiRxfXsw0qCROqRDYQECw3ORkpqjpAQjVGMxYrB7MPC0MyFQItEowCAQAh+QQJCgACACwBAAEADgAOAAAHgIACghcUVhIYEigMgowjEC8nUQ8BOGkojAQxITEdAhcxEh9wPoIMFCOMjBMAKTEXHaipjGldDxcEsqkvUAe5sh1NLb6pHTxNbGK9vlE3DU5ZLsNnIA4GbTVVuQcJdpdnS0Z3LAoxXhF4LjiMMBl5FjptKiZ6ZrJRLUkqbCAwJ4yBACH5BAUKAAEALAEAAQAOAA4AAAd/gAGCARcjHDExHASDjAQdHAoFLy8Ugw2MgiMKWhIKAQ9MYpiCEA8YHQtZCaOCJ14vX2g2rAEKZgMyNRC0BCksFUa7rCMANgIzH7QvZw4tMmO0DlAPUV9hHqNeVTC7G2tkTmkUHA8iSFUGgzZlGSYaNC4gTWqYEzA3SQhVH1aDgQA7);
242
  }
243
 
244
  /* Google Map infomation window */
343
  word-break: normal;
344
  white-space: pre;
345
  }
 
 
 
 
 
 
 
 
 
 
346
  #ip-geo-block-back-to-top {
347
  margin:0;
348
  text-align:right;
359
 
360
  /* Icons */
361
  dfn ~ .ip-geo-block-icon {
362
+ margin-left: 0.4em;
363
  }
364
  .ip-geo-block-icon {
365
  position: relative;
383
  background-position: center center;
384
  background-repeat: no-repeat;
385
  }
 
 
 
386
  .ip-geo-block-icon-cycle span {
387
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAh1BMVEUAda2otLp+rsSHprWHr8IBd7EpfKRGhaNajqeUqrRymKuKoq5yo7prlKgAcqoVe6w8gqQmgq5Tj6wIdqsVdKIshrEMea1Uhp+Anqw0hawDdq4gfKhljqE7hqoLdKYbgbM4jLQygKUGeK8CdawQd6gVeKcad6NKkrSerrZAj7UAc6sAc6rc3NySrVGQAAAALXRSTlP//////////////////////////////////////////////////////////wCl7wv9AAACOklEQVR4Ae2W15rzKgxF9xTZzhTX9B7S/gN6/9ebYqzzGZsw/S7LV3FZgCSIwD/kQ8FVcBU8xatZUczy8luC/ABNOn0DSHEsvyZ4PgLatNCYR3efFxyhTQ8g+qQgJxgv2JefERzJXATRh4LHOUwAHD4S7OGEztRJaN86hAUxtaNWDUf/bRdDBbQMWVDAO8jn89WUhag1MeyCAh6hHofyrliLgZKggDMYgzF3eVAwFq0uCZq5KY0TezjIHDDzC0qqmkwe2ctGDOQVLMkgu+F3/rGXwb4xIPcJ6P3JgkM8wFjmfcFAWfeKQywaAz33BJVuHsUcAt09gVbuLDThAJkdR687ggLmf4gDJLIGV7BydtB8yn3u+fbtuj/LS7G9wZAd1AKK+yxJ1x+aBmibTtgCcEHGHsh0wdbOgNLek4L7lI5BigY8nWuZUQ3qGEXes9JzOKGJztPaGtLslu3lIXJirdxCWkASHGDTMqg7V1DKPplygDG61YJukLHjEErGSXqCSos6xNSOgzP3BDmsQBcchNwkoV8oiNnPA78zIefUgCdJeGIfE7LmFWXsFTCFdzTJ/RlfEMRiSGnFXXbkC7AIeqcKDu4ynseozeouKJiSEYBDwkJyIC1nRUjgblkNWp/e/1vXc2gjoAoLksYgjrrFMi0oDgjEEIDij1scBXMJSH6DAj6RNl7o8MkuLak8Co15/Pk+MRmT0xilQJV/sdWNKg2kTaeroudvNNsDjmejYjSL+e6v2/2r4Cp4BXNajr0H7hRfAAAAAElFTkSuQmCC);
388
  }
536
  /*------------------------------------------------------------
537
  * Customizing based on jquery.dataTables.css
538
  *------------------------------------------------------------*/
539
+ table.ip-geo-block-dataTable {
540
  clear: none !important;
541
  }
542
+ table.ip-geo-block-dataTable th,
543
+ table.ip-geo-block-dataTable td {
544
  text-align: right;
545
  }
546
+ table.ip-geo-block-dataTable th:nth-child(n+2),
547
+ table.ip-geo-block-dataTable td:nth-child(n+2) {
548
  padding-left: 0 !important;
549
  }
550
+ table.ip-geo-block-dataTable th {
551
  white-space: nowrap;
552
  }
553
+ table.ip-geo-block-dataTable > thead > tr {
554
  line-height: 1.8em;
555
  }
556
+ table.ip-geo-block-dataTable > tbody > tr {
557
  cursor: pointer;
558
  }
559
+ table.ip-geo-block-dataTable > thead > tr > th,
560
+ table.ip-geo-block-dataTable > thead > tr > td,
561
+ table.ip-geo-block-dataTable.no-footer {
562
  border-bottom: 1px solid #ddd;
563
  }
564
+ table.ip-geo-block-dataTable thead th,
565
+ table.ip-geo-block-dataTable thead td {
566
  padding: 10px 16px;
567
  }
568
  /* country code */
572
  }
573
 
574
  /* Scroll bar */
575
+ div[class*="ip-geo-block"] .dataTables_wrapper.no-footer .dataTables_scrollBody {
576
  border-bottom: 1px solid #ddd;
577
  }
578
 
579
  /* Size of column */
580
+ table.ip-geo-block-dataTable.nowrap td,
581
+ table.ip-geo-block-dataTable > tbody > tr > td span {
582
  white-space: normal !important;
583
  word-wrap: break-word !important;
584
  word-break: break-all !important;
585
  }
586
+ table.ip-geo-block-dataTable > tbody > tr > td span {
587
  display: inline-block;
588
  }
589
 
591
  .ip-geo-block-settings-folding input[type="checkbox"] {
592
  margin-right: 0.5em;
593
  }
594
+ table.ip-geo-block-dataTable input[type="checkbox"] {
595
  max-height: 16px;
596
  max-width: 16px;
597
  margin: 0;
598
  }
599
+ table.ip-geo-block-dataTable > thead > tr > th:first-child,
600
+ table.ip-geo-block-dataTable > tbody > tr > td:first-child {
601
  padding: 8px 4px 8px 1.4em;
602
  text-align: left;
603
  }
604
 
605
  /* No data available in table */
606
+ table.ip-geo-block-dataTable > tbody > tr > td.dataTables_empty,
607
  table.collapsed > tbody > tr > td.dataTables_empty:first-child::before {
608
  border: none;
609
  text-align: center;
610
  }
611
 
612
  /* Checkbox column */
613
+ table.ip-geo-block-dataTable thead > tr > th:first-child.sorting_asc {
614
  background-image: none !important;
615
  }
616
+ table.ip-geo-block-dataTable.display tbody tr.even > .sorting_1,
617
+ table.ip-geo-block-dataTable.display tbody tr.odd > .sorting_1,
618
+ table.ip-geo-block-dataTable.display tbody tr:hover > .sorting_1 {
619
  background-color: inherit !important;
620
  }
621
 
622
  /* Collapsed */
623
+ table.ip-geo-block-dataTable.collapsed > tbody > tr > td:first-child {
624
  padding: 8px 4px 8px 8px !important;
625
  }
626
  table.collapsed > tbody > tr > td:first-child::before,
668
  }
669
 
670
  /* Pagenation */
671
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate {
672
  float: none;
673
  text-align: center;
674
  margin-bottom: 1em;
675
  }
676
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate span.ellipsis,
677
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button,
678
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button:hover,
679
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button:active,
680
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.current,
681
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover,
682
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,
683
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,
684
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,
685
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active {
686
  min-width: 2em;
687
  background: inherit;
688
  border-color: #ddd;
696
  display: inline-block;
697
  text-decoration: none;
698
  }
699
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate > a.paginate_button:first-child,
700
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate:hover > a.paginate_button:first-child,
701
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate:active > a.paginate_button:first-child {
702
  border-left-width: 1px;
703
  border-bottom-left-radius: 4px;
704
  border-top-left-radius: 4px;
705
  }
706
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate > a.paginate_button:last-child,
707
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate:hover > a.paginate_button:last-child,
708
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate:active > a.paginate_button:last-child {
709
  border-bottom-right-radius: 4px;
710
  border-top-right-radius: 4px;
711
  }
712
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button {
713
  color: #0073aa !important;
714
  }
715
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button:hover {
716
  color: #0096dd !important;
717
  background-color: #fff;
718
  }
719
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate span.ellipsis,
720
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,
721
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,
722
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active {
723
  cursor: default;
724
  color: #999 !important;
725
  background-color: transparent;
726
  }
727
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.current,
728
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover,
729
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate a.paginate_button.current:active {
730
  cursor: default;
731
  color: #444 !important;
732
  background-color: #fff !important;
767
  }
768
 
769
  /* Transition for new row */
770
+ table.ip-geo-block-dataTable.display tbody tr.ip-geo-block-passed {
771
  background-color: #edf6ff !important;
772
  }
773
+ table.ip-geo-block-dataTable.display tbody tr.ip-geo-block-blocked {
774
  background-color: #ffefef !important;
775
  }
776
  .ip-geo-block-new-passed {
863
  display: block;
864
  height: 1em;
865
  width: 1em;
866
+ background: #0073aa;
867
  border-radius: 50%;
868
  position: absolute;
869
  top: 0;
895
  transform: rotate(180deg);
896
  }
897
  .ip-geo-block-live-timer > div:last-child:before {
898
+ /* older webkit seems buggy with zero so use 0.00001 if you notice something strange */
899
+ transform: rotate(0deg);
900
  animation: 30s spin-timer linear 30s forwards;
901
  }
902
  @keyframes spin-timer {
904
  100% {transform: rotate(180deg);}
905
  }
906
 
907
+ /* sub items in settings */
908
+ .ip-geo-block-subitem {
909
+ margin-left: 1.7em
910
+ }
911
+ .ip-geo-block-subitem:before {
912
+ content: "\00bb"; /* &raquo; */
913
+ position: absolute;
914
+ left: 2em;
915
+ }
916
+ .ip-geo-block-subitem dfn {
917
+ vertical-align: middle;
918
+ }
919
+ .ip-geo-block-subitem-parent th,
920
+ .ip-geo-block-subitem-parent td {
921
+ padding-top: 0;
922
+ }
923
+
924
+ /* placeholder */
925
  :placeholder-shown { color: #888; }
926
  ::-webkit-input-placeholder { color: #888; } /* Google Chrome, Safari, Opera 15+, Android, iOS */
927
  :-moz-placeholder { color: #888; opacity: 1; } /* Firefox 18- */
admin/css/admin.min.css CHANGED
@@ -3,4 +3,4 @@
3
  * Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
  * This software is released under the MIT License.
5
  */
6
- dfn{cursor:help;border-bottom:1px dotted #888}.ip-geo-block-icon,svg a,table.dataTable>tbody>tr{cursor:pointer}fieldset,legend{padding:0;margin:0;border:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}fieldset{min-width:0}legend{display:block;line-height:inherit;width:100%}.panel-body,label{display:inline-block}label{max-width:100%}.panel{border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);-moz-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#f5f5f5}#ip-geo-block-back-to-top a,#ip-geo-block-toggle-sections,.ip-geo-block-help-link a{box-shadow:none}.panel-heading{float:left!important;background:#fff}.panel-default>.panel-heading{border-color:inherit}.panel-body{width:100%;padding:0 1em;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.panel-body:after,.panel-body:before{content:" ";display:table}.panel-body:after{clear:both}.ip-geo-block-navi-link{text-align:left}.ip-geo-block-help-link{float:right;font-size:90%;font-weight:400}fieldset label{vertical-align:text-middle}fieldset input[type=checkbox]{margin:1px 2px 0}fieldset.ip-geo-block-field{margin:1em 0}fieldset.ip-geo-block-field h2,fieldset.ip-geo-block-field h3{padding:0;margin:0;font-size:14px!important}fieldset.ip-geo-block-field h4{margin:.75em 0 .5em}fieldset.ip-geo-block-field legend.panel-heading{padding:10px}fieldset.ip-geo-block-field .ip-geo-block-dropdown,fieldset.ip-geo-block-field .ip-geo-block-dropup{cursor:pointer;position:relative;padding-left:1em}fieldset.ip-geo-block-field .ip-geo-block-dropdown:before,fieldset.ip-geo-block-field .ip-geo-block-dropup:before{content:'';height:0;width:0;border:.4em solid transparent;position:absolute}fieldset.ip-geo-block-field .ip-geo-block-dropup:before{border-left:.4em solid #555;left:2px;top:18%}fieldset.ip-geo-block-field .ip-geo-block-dropdown:before{border-top:.4em solid #555;left:-2px;top:38%}fieldset.ip-geo-block-field .form-table .ip-geo-block-dropdown,fieldset.ip-geo-block-field .form-table .ip-geo-block-dropup{margin-top:.75em}fieldset.ip-geo-block-field ul.ip-geo-block-dropup:before{top:.25em}fieldset.ip-geo-block-field ul.ip-geo-block-dropdown:before{top:.5em}fieldset.ip-geo-block-field table.form-table{margin:0 0 .5em;width:100%}textarea.regular-text{width:25em}fieldset.ip-geo-block-field input.regular-text,fieldset.ip-geo-block-field textarea.regular-text{font-size:95%}input[id*=ip_geo_block_settings_rewrite_]+label{margin-left:.25em}input[id*=ip_geo_block_settings_providers]+label{min-width:7em}.ip-geo-block-settings-folding{margin:.5em 0}.ip-geo-block-settings-folding ul{margin-bottom:0}.ip-geo-block-settings-folding li{margin:.5em 0}.folding-disable{pointer-events:none;opacity:.5}.folding-inactive{opacity:.5;font-style:oblique!important}.ip-geo-block-float li{display:inline-block;width:18em;margin-top:0}.ip-geo-block-checked{list-style-type:disc}.ip-geo-block-ip-addr{display:inline-block;padding-top:5px}.ip-geo-block-hide{display:none}.ip-geo-block-sup{margin-left:.2em;display:inline-block}.ip-geo-block-note{margin-top:1em;list-style:disc inside}.ip-geo-block-note li{text-indent:-1em;padding-left:1em}.ip-geo-block-border{border-top:inherit}.ip-geo-block-notice{color:#dd3d36}.ip-geo-block-title{width:100px;display:inline-block}.ip-geo-block-result{color:#2786C2;display:inline-block}#ip-geo-block-live-loading,.ip-geo-block-loading{background-size:16px 16px;background-position:center center;background-repeat:no-repeat;height:16px;width:16px;margin-left:1em;margin-top:.2em;display:inline-block;vertical-align:top}.ip-geo-block-loading{background-image:url(data:image/gif;base64,R0lGODlhEAAQAPIGAAAAAMLCwkJCQpKSkmJiYoKCgv///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCgAGACwAAAAAEAAQAAADM2i63P4wyklrC0IEKgAQnAdOmGYFBLExwboQWcG2rlHEwTDQLUsUOd2mBxkUCgNKa+dIAAAh+QQJCgAGACwAAAIACgAOAAADLWgWIqHQCABEVLPe1R4MBOFFRFNsRUNsYDFewTC8iixvQ1EMyxjEvyBLODQkAAAh+QQJCgAGACwAAAAACgAOAAADLWi6IRJrCQCECoU0ag1xxeBARuEQ0UUU5DUM7fK+qTEUYR0EcM3Ev51uB7wAEwAh+QQJCgAGACwAAAAADgAKAAADLWi6URQrLiJEkSaM0eqrkLFtAVEEAgAIylAUQ5SuSqCFNZjhWG3zmB8wOJQkAAAh+QQJCgAGACwCAAAADgAKAAADK2hqMRMrLuekCnCU8gqBDCZ2glBcYkSUxIJJgQdaUVDOtAAAAr3oPN/llgAAIfkECQoABgAsBgAAAAoADgAAAytoEdauiz0Yx5BQFTvN2EMXWNgUFETZFIJQdERLiGgZtKohAIDQ7T0RrpEAACH5BAkKAAYALAYAAgAKAA4AAAMqaKoR+609Fie1K4zhZiibNRSg1XAQUXQPIQgE835voQgAIARqh+ummSUBACH5BAUKAAYALAIABgAOAAoAAAMsaLpsES2+F9mEddEgBFbBMGACAAiMOCrlGRBFWBQD2L0dYYjfUuQZEKynSAAAOw==)}#ip-geo-block-map{height:400px;margin:1em auto}.gm-style-iw{width:18em;height:auto!important;height:100%;min-height:100%:}.gm-style-iw ul{margin:.1em}.gm-style-iw li{margin:.2em}svg a:hover>text{fill:#0096dd}svg a>text{fill:#0073aa;text-decoration:underline}table.ip-geo-block-statistics-table{float:right}table.ip-geo-block-statistics-table td,table.ip-geo-block-statistics-table th{width:12em;margin:0;padding:.2em;text-align:right;line-height:1.5em;word-wrap:break-word}table.ip-geo-block-statistics-table tr:nth-child(even){background-color:#eee}table.ip-geo-block-table{margin:1em 0;white-space:normal;word-wrap:break-word;word-break:break-all}table.ip-geo-block-table td:first-child{min-width:4.3em}@media screen and (max-width:782px){#ip-geo-block-whois .panel-body{padding:0 .5em}}#ip-geo-block-scan-code{vertical-align:middle}#ip-geo-block-code-list{display:none;margin-bottom:0}#ip-geo-block-chart-countries{height:200px}#ip-geo-block-chart-daily{height:240px}#ip_geo_block_settings_validation_mimetype+label{padding-top:.25em}#ip_geo_block_settings_validation_mimetype+label+ul{margin-top:.7em}#ip_geo_block_settings_create_user{margin-bottom:.5em}#ip-geo-block-wp-info textarea{margin-top:.5em;overflow:auto;width:100%;word-wrap:normal;word-break:normal;white-space:pre}#ip-geo-block-preferred{color:#fff;background:#00838f!important;border-color:#00707a!important;text-shadow:none}#ip-geo-block-preferred:hover{background-color:#00919e!important;border-color:#00525a!important}.ip-geo-block-icon,.ip-geo-block-list-exceptions a.ip-geo-block-icon{background-color:transparent;box-shadow:none;text-decoration:none;outline:0}#ip-geo-block-back-to-top{margin:0;text-align:right}#ip-geo-block-live-update,#ip-geo-block-open-new{margin-left:1em}.ip-geo-block-menu-link{font-size:13px!important}dfn~.ip-geo-block-icon{margin-left:.6em}.ip-geo-block-icon{position:relative}.ip-geo-block-icon:active{top:1px}.ip-geo-block-icon span{height:16px;width:16px;margin:0;border:none;display:inline-block;vertical-align:middle;background-size:16px 16px;background-position:center center;background-repeat:no-repeat}.ip-geo-block-icon-cidr span{vertical-align:text-top}.ip-geo-block-icon-cycle span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAh1BMVEUAda2otLp+rsSHprWHr8IBd7EpfKRGhaNajqeUqrRymKuKoq5yo7prlKgAcqoVe6w8gqQmgq5Tj6wIdqsVdKIshrEMea1Uhp+Anqw0hawDdq4gfKhljqE7hqoLdKYbgbM4jLQygKUGeK8CdawQd6gVeKcad6NKkrSerrZAj7UAc6sAc6rc3NySrVGQAAAALXRSTlP//////////////////////////////////////////////////////////wCl7wv9AAACOklEQVR4Ae2W15rzKgxF9xTZzhTX9B7S/gN6/9ebYqzzGZsw/S7LV3FZgCSIwD/kQ8FVcBU8xatZUczy8luC/ABNOn0DSHEsvyZ4PgLatNCYR3efFxyhTQ8g+qQgJxgv2JefERzJXATRh4LHOUwAHD4S7OGEztRJaN86hAUxtaNWDUf/bRdDBbQMWVDAO8jn89WUhag1MeyCAh6hHofyrliLgZKggDMYgzF3eVAwFq0uCZq5KY0TezjIHDDzC0qqmkwe2ctGDOQVLMkgu+F3/rGXwb4xIPcJ6P3JgkM8wFjmfcFAWfeKQywaAz33BJVuHsUcAt09gVbuLDThAJkdR687ggLmf4gDJLIGV7BydtB8yn3u+fbtuj/LS7G9wZAd1AKK+yxJ1x+aBmibTtgCcEHGHsh0wdbOgNLek4L7lI5BigY8nWuZUQ3qGEXes9JzOKGJztPaGtLslu3lIXJirdxCWkASHGDTMqg7V1DKPplygDG61YJukLHjEErGSXqCSos6xNSOgzP3BDmsQBcchNwkoV8oiNnPA78zIefUgCdJeGIfE7LmFWXsFTCFdzTJ/RlfEMRiSGnFXXbkC7AIeqcKDu4ynseozeouKJiSEYBDwkJyIC1nRUjgblkNWp/e/1vXc2gjoAoLksYgjrrFMi0oDgjEEIDij1scBXMJSH6DAj6RNl7o8MkuLak8Co15/Pk+MRmT0xilQJV/sdWNKg2kTaeroudvNNsDjmejYjSL+e6v2/2r4Cp4BXNajr0H7hRfAAAAAElFTkSuQmCC)}.ip-geo-block-icon-lock span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3Ny3y9Zzq8dRmb7M1dlXnsIFdK0AcawAcqwphrYAcKvZ29wAb6oJd680jrqlw9MBcqxmo8MUfbJLl75eoMI7kbzX2ttqp8VSmL1YnL8NeK+Tu89DlL1ImMEOebBNmL4OkqMoAAAAAXRSTlMAQObYZgAAAPlJREFUeAG9kAWyhTAQBIPOsCzufv9TPnf4Ll0CSbpmxXwNy3Yc23rz2fV8kPA99433AIQIiGDTCD0lojiOQPXCDSFJIbF16CMWItkQMkF+inZzSLYhFKLl+a9UKTZaqJTZJYtarZuo40chrv9CqJTN+behVi+Cm7RdDgRld6AMgLxrE/dxBz0BEjwBEmD/uIsWPAOAF9A+CE56ufSryr8oqfOYcBbQJ8YkES7COkFOYzTypqCDOTDo2wljaEw4vp1APYyWKd8WMBozylvCpcvmXeHQ5fCegHia4s1FgZcIVeVFeFx1M4MvYG4eBHdYWufC+addBtf8E3vdjBNhWnVQqAAAAABJRU5ErkJggg==)}.ip-geo-block-icon-unlock span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3NyzydRzq8dRmb7I09hYnsEFdK0AcawAcqzP1toqhrYAcKvZ29wAb6oMeK8zjbqrxtQBcazBz9Zko8MVfbLF0thMmL07kbtpp8WjwtJSmL1YnL+Tu89DlL1JmMEPebBFV++UAAAAAXRSTlMAQObYZgAAAONJREFUeAG9kAWChDAMAIMmJaTFXf7/ynXflvMbnE5j8DU8Pwh8D1yEUYxEGEchWFEJEjEflESBhTQSQm2MRpIotQhZTmgKgMIg5ZlFKBmrGg7UFXJpEQKW8qIKN7YeikJdBJI2BTtXwfyx0L3XoPphvBEliNU49OoxqEa6g4cTST/OYshvi3hV8+FxSNfluG3jqxG8C6h7gF6jU+AODnTsFGSCA5O4I8wpQDq7I5CUAKWQW+AZYOYtoQPoGDeECWDaioBmWQxeBduoWURso+5WpBdw7R4ENTVDcGE435tJwT+xB+vMEnZRNB0YAAAAAElFTkSuQmCC)}.ip-geo-block-icon-find span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3NzS19rD0NWHtMpGk7kYfbAGda0Req+WtcTT1temwM4AcasAcqwAc6wAcKydvMt1pr8Ab6pqpcLX2doggrKoxdNYm7yzw8u/y9HO1tkKdq4th7Td3t6DrcLL0taxyNPGe/YhAAAAAXRSTlMAQObYZgAAARVJREFUeAGtkkeiwyAMRP2xDfxoRjElvd3/lOkNUlZ5u0GPruan/Bnz96Xadr21rvP/7+ujXsAjom78rj4ApCoERIipqfGB1H7wPmYhw1DXjZI6nOel1oJhVAmdUP0tTEDkVC4AYvqIbaDOCqFV6vwRF0tIeYoo6J/X7ICuPAJl9ZynwiIfB5DXxZlRChulbh8xZci0EHZK3TziJFDL504rEOZ+iR5cVj82DoS7XtSshLJpKqaB0Dg3ZjcsQWKaKiF1gVQlITwh/bw2pgKeEeURhE29yKSzUFF03p1V7Wqj2Y7GfrY9X/NirJsPxKsxfBLSSs5GmH8yjAWPSNd8Yoez4f4/G1nIsksqFtGK1i9e39o0P+EAqaoRLlQ+r94AAAAASUVORK5CYII=)}.ip-geo-block-icon-alert span,span.ip-geo-block-icon-alert{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAkFBMVEXc3Nzc2trWl5DHRDTFOyvOgXfc1tXCLBrEMiHEMyLNcmfaxMLDMSDDLx7bu7jRiYHDLhzDMB/LX1PaxsTDLh3YtrHMY1bWmpPJVknSjYXUkYnZuLTMZVnENCPWlI3QhXzENiXXrqrDLRzXsa3Oal7Pe3Hc2NjVn5nNbmPayMbbwb7ay8rUj4fc09Lbw8Db0dDBbRUDAAAAAXRSTlMAQObYZgAAAPVJREFUeAG9ktXWwyAQBonC12brFvff5f2frr4nBredK2DnTFS8Gst2XM8XZmypIGeWcT4PFABaGIXlClfWG1NiC4Ubu705oKRcY32wTAHl2MdTYEqEK8hIiHgHSnSJeaogMyEWO4BijZCvwII2MS9UJ2BXTh+hQidoEttboBOwq3WBnkCNpQlA2iyAhol2hRu71n97p4fw0Z9/ugoPHCfFA+o/iLfCkyBglRJdICBas7uuey+R56fF14wNanj+/QjwY3aX23cBFn6EiHmHNT/ICYxystv/wJy4UHWGlN2cuPB72tFqAq3dP/Hk3zs0E5LZVryGC/hqGNnUa0SVAAAAAElFTkSuQmCC);vertical-align:bottom}table.form-table th .ip-geo-block-cycle span{vertical-align:text-bottom}.ip-geo-block-list{margin-top:0;margin-bottom:.7em}@media screen and (min-width:782px){ul.ip-geo-block-list .code{width:15em}}.ip-geo-block-list-exceptions label{display:inline-block}.ip-geo-block-list-exceptions dfn{border:none}.dataTables_wrapper.no-footer .dataTables_scrollBody,table.dataTable.no-footer,table.dataTable>thead>tr>td,table.dataTable>thead>tr>th{border-bottom:1px solid #ddd}.ip-geo-block-list-exceptions span.dashicons{font-size:14px}.ip-geo-block-list-exceptions a.ip-geo-block-icon{margin-left:.3em}.form-table td p.ip-geo-block-desc,.form-table td p.ip-geo-block-find-desc{color:#666;font-size:13px!important;margin:4px 0 .5em .5em}.ip-geo-block-find-desc{display:none}.ip-geo-block-admin-post{color:#c43322;margin-left:.25em}.ip-geo-block-warn{color:#c43322;font-weight:700}input#ip_geo_block_settings_behavior_time,input#ip_geo_block_settings_behavior_view{width:3.5em}.ip-geo-block-top-list{display:inline-table;list-style-position:outside;margin:0 2em .5em 1.75em}.ip-geo-block-top-list h4{margin:1em 0}.ip-geo-block-top-list li code{background:0 0}.ip-geo-block-network{margin-bottom:1em}.ip-geo-block-container{margin:0 auto;padding:0 1em;position:relative;width:100%}.ip-geo-block-row{display:flex;flex-direction:column;align-items:flex-start;align-items:stretch;padding:0;width:100%}.ip-geo-block-row .ip-geo-block-column{display:block;flex:1 1 auto;align-self:flex-start;margin-left:0;max-width:100%;width:100%}.ip-geo-block-row .ip-geo-block-column.column-20{flex:0 0 20%;max-width:20%}.ip-geo-block-row .ip-geo-block-column.column-25{flex:0 0 25%;max-width:25%}.ip-geo-block-row .ip-geo-block-column.column-33{flex:0 0 33.3333%;max-width:33.3333%}.ip-geo-block-row .ip-geo-block-column.column-50{flex:0 0 50%;max-width:50%}@media (min-width:40rem){.ip-geo-block-row{flex-direction:row;margin-left:-2em;width:calc(100% + 2em)}.ip-geo-block-row .ip-geo-block-column{margin-bottom:inherit;padding:0 1em}}table.dataTable{clear:none!important}table.dataTable td,table.dataTable th{text-align:right}table.dataTable td:nth-child(n+2),table.dataTable th:nth-child(n+2){padding-left:0!important}table.dataTable th{white-space:nowrap}table.dataTable>thead>tr{line-height:1.8em}table.dataTable thead td,table.dataTable thead th{padding:10px 16px}#ip-geo-block-statistics-cache td:nth-child(3),#ip-geo-block-validation-logs td:nth-child(4){min-width:1.6em}table.dataTable.nowrap td,table.dataTable>tbody>tr>td span{white-space:normal!important;word-wrap:break-word!important;word-break:break-all!important}table.dataTable>tbody>tr>td span{display:inline-block}.ip-geo-block-settings-folding input[type=checkbox]{margin-right:.5em}table.dataTable input[type=checkbox]{max-height:16px;max-width:16px;margin:0}table.dataTable>tbody>tr>td:first-child,table.dataTable>thead>tr>th:first-child{padding:8px 4px 8px 1.4em;text-align:left}table.collapsed>tbody>tr>td.dataTables_empty:first-child::before,table.dataTable>tbody>tr>td.dataTables_empty{border:none;text-align:center}table.dataTable thead>tr>th:first-child.sorting_asc{background-image:none!important}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.display tbody tr:hover>.sorting_1{background-color:inherit!important}table.dataTable.collapsed>tbody>tr>td:first-child{padding:8px 4px 8px 8px!important}table.collapsed>tbody>tr.parent>td:first-child::before,table.collapsed>tbody>tr>td:first-child::before{content:'';height:0;width:0;display:inline-block;border-radius:0;border:5px solid transparent;box-shadow:none;position:relative;background-color:transparent}table.collapsed>tbody>tr>td:first-child::before{border-left:5px solid #555;top:1px;left:-2px}table.collapsed>tbody>tr.parent>td:first-child::before{border-top:5px solid #555;top:4px;left:-4px}table.collapsed>tbody>tr.child>td:first-child::before{border:none}table.collapsed>tbody>tr.child>td.child>ul li{border:none;padding:0;margin:0;line-height:1.8em}table.collapsed>tbody>tr.child>td.child>ul li span.dtr-data,table.collapsed>tbody>tr.child>td.child>ul li span.dtr-title{font-size:13px!important;display:block;white-space:normal;word-wrap:break-word;word-break:break-all}table.collapsed>tbody>tr.child>td.child>ul li span.dtr-data{margin-left:1.25em;margin-right:.3em}.dataTables_wrapper .dataTables_paginate{float:none;text-align:center;margin-bottom:1em}.dataTables_wrapper .dataTables_paginate a.paginate_button,.dataTables_wrapper .dataTables_paginate a.paginate_button.current,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate a.paginate_button:active,.dataTables_wrapper .dataTables_paginate a.paginate_button:hover,.dataTables_wrapper .dataTables_paginate span.ellipsis{min-width:2em;background:inherit;border-color:#ddd;border-radius:0;border-image:none;border-style:solid;border-width:1px 1px 1px 0;box-shadow:none;margin:.5em 0 0;padding:.25em 0;display:inline-block;text-decoration:none}#ip-geo-block-1 #ip-geo-block-section-2 .panel-body,#ip-geo-block-4 #ip-geo-block-section-0 .panel-body,mark{padding:0}.dataTables_wrapper .dataTables_paginate:active>a.paginate_button:first-child,.dataTables_wrapper .dataTables_paginate:hover>a.paginate_button:first-child,.dataTables_wrapper .dataTables_paginate>a.paginate_button:first-child{border-left-width:1px;border-bottom-left-radius:4px;border-top-left-radius:4px}.dataTables_wrapper .dataTables_paginate:active>a.paginate_button:last-child,.dataTables_wrapper .dataTables_paginate:hover>a.paginate_button:last-child,.dataTables_wrapper .dataTables_paginate>a.paginate_button:last-child{border-bottom-right-radius:4px;border-top-right-radius:4px}.dataTables_wrapper .dataTables_paginate a.paginate_button{color:#0073aa!important}.dataTables_wrapper .dataTables_paginate a.paginate_button:hover{color:#0096dd!important;background-color:#fff}.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate span.ellipsis{cursor:default;color:#999!important;background-color:transparent}.dataTables_wrapper .dataTables_paginate a.paginate_button.current,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover{cursor:default;color:#444!important;background-color:#fff!important}#ip-geo-block-1 #ip-geo-block-section-2 table.form-table,#ip-geo-block-4 #ip-geo-block-section-0 table.form-table{margin-left:1em;max-width:95%}#ip-geo-block-live-log,#ip-geo-block-select-duration,#ip-geo-block-select-layout,#ip-geo-block-select-target{margin:0}#ip-geo-block-select-duration li,#ip-geo-block-select-layout li,#ip-geo-block-select-target li{float:left;margin-right:1.5em}#ip-geo-block-select-duration li label,#ip-geo-block-select-target li label{cursor:pointer}#ip_geo_block_settings_search_filter{width:16em;padding-top:3px}table.dataTable.display tbody tr.ip-geo-block-passed{background-color:#edf6ff!important}table.dataTable.display tbody tr.ip-geo-block-blocked{background-color:#ffefef!important}.ip-geo-block-new-passed{animation:ip-geo-block-flash-passed 1s ease-out 0s 1 normal both running}.ip-geo-block-new-blocked{animation:ip-geo-block-flash-blocked 1s ease-out 0s 1 normal both running}@keyframes ip-geo-block-flash-passed{0%{background-color:gold}100%{background-color:#edf6ff}}@keyframes ip-geo-block-flash-blocked{0%{background-color:gold}100%{background-color:#ffefef}}mark{background:gold}#ip-geo-block-live-log li{float:left;margin-right:3em}#ip-geo-block-live-log li:last-child{margin-right:0}#ip-geo-block-live-log li input[type=radio]{visibility:hidden;position:absolute}#ip-geo-block-live-log li input[type=radio]+label{display:inline-block;margin:-2px -2px 0;padding:4px 12px;font-size:14px;line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #ccc;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);border-bottom-color:#b3b3b3;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}#ip-geo-block-live-log li input[type=radio]:checked+label{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);background-color:#e0e0e0}.ip-geo-block-live-timer{height:1em;width:1em;margin:0;position:relative;top:0;left:0}.ip-geo-block-live-timer:before{content:"";display:block;height:1em;width:1em;background:radial-gradient(#0073aa,#72777c);border-radius:50%;position:absolute;top:0;left:0}.ip-geo-block-live-timer:after{display:none}.ip-geo-block-live-timer>div{position:absolute;width:1em;height:1em;clip:rect(0,1em,1em,.5em)}.ip-geo-block-live-timer>div:before{content:" ";position:absolute;width:1em;height:1em;border-radius:.5em;clip:rect(0,.5em,1em,0);background-color:#f1f1f1;transform:rotate(0)}.ip-geo-block-live-timer>div:first-child:before{animation:30s spin-timer linear forwards}.ip-geo-block-live-timer>div:last-child{transform:rotate(180deg)}.ip-geo-block-live-timer>div:last-child:before{transform:rotate(.00001deg);animation:30s spin-timer linear 30s forwards}@keyframes spin-timer{0%{transform:rotate(0)}100%{transform:rotate(180deg)}}:placeholder-shown{color:#888}::-webkit-input-placeholder{color:#888}:-moz-placeholder{color:#888;opacity:1}::-moz-placeholder{color:#888;opacity:1}:-ms-input-placeholder{color:#888}
3
  * Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
  * This software is released under the MIT License.
5
  */
6
+ dfn{cursor:help;border-bottom:1px dotted #888}.ip-geo-block-icon,svg a,table.ip-geo-block-dataTable>tbody>tr{cursor:pointer}fieldset,legend{padding:0;margin:0;border:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}fieldset{min-width:0}legend{display:block;line-height:inherit;width:100%}.panel-body,label{display:inline-block}label{max-width:100%}.panel{border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);-moz-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#f5f5f5}.panel-heading{float:left!important;background:#fff}.panel-default>.panel-heading{border-color:inherit}.panel-body{width:100%;padding:0 1em;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.panel-body:after,.panel-body:before{content:" ";display:table}.panel-body:after{clear:both}.ip-geo-block-navi-link{text-align:left}.ip-geo-block-help-link{float:right;font-size:90%;font-weight:400}.ip-geo-block-help-link a{box-shadow:none}fieldset label{vertical-align:text-middle}fieldset input[type=checkbox]{margin:1px 2px 0}fieldset.ip-geo-block-field{margin:1em 0}fieldset.ip-geo-block-field h2,fieldset.ip-geo-block-field h3{padding:0;margin:0;font-size:14px!important}fieldset.ip-geo-block-field h4{margin:.75em 0 .5em}fieldset.ip-geo-block-field legend.panel-heading{padding:10px}fieldset.ip-geo-block-field .ip-geo-block-dropdown,fieldset.ip-geo-block-field .ip-geo-block-dropup{cursor:pointer;position:relative;padding-left:1em}fieldset.ip-geo-block-field .ip-geo-block-dropdown:before,fieldset.ip-geo-block-field .ip-geo-block-dropup:before{content:'';height:0;width:0;border:.4em solid transparent;position:absolute}fieldset.ip-geo-block-field .ip-geo-block-dropup:before{border-left:.4em solid #555;left:2px;top:18%}fieldset.ip-geo-block-field .ip-geo-block-dropdown:before{border-top:.4em solid #555;left:-2px;top:38%}fieldset.ip-geo-block-field .form-table .ip-geo-block-dropdown,fieldset.ip-geo-block-field .form-table .ip-geo-block-dropup{margin-top:.75em}fieldset.ip-geo-block-field ul.ip-geo-block-dropup:before{top:.25em}fieldset.ip-geo-block-field ul.ip-geo-block-dropdown:before{top:.5em}fieldset.ip-geo-block-field table.form-table{margin:0 0 .5em;width:100%}textarea.regular-text{width:25em}fieldset.ip-geo-block-field input.regular-text,fieldset.ip-geo-block-field textarea.regular-text{font-size:95%}input[id*=ip_geo_block_settings_rewrite_]+label{margin-left:.25em}input[id*=ip_geo_block_settings_providers]+label{min-width:7em}.ip-geo-block-settings-folding{margin:.5em 0}.ip-geo-block-settings-folding ul{margin-bottom:0}.ip-geo-block-settings-folding li{margin:.5em 0}.folding-disable{pointer-events:none;opacity:.5}.folding-inactive{opacity:.5;font-style:oblique!important}.ip-geo-block-float li{display:inline-block;width:18em;margin-top:0}.ip-geo-block-checked{list-style-type:disc}.ip-geo-block-ip-addr{display:inline-block;padding-top:5px}.ip-geo-block-hide{display:none}.ip-geo-block-sup{margin-left:.2em;display:inline-block}.ip-geo-block-note{margin-top:1em;list-style:disc inside}.ip-geo-block-note li{text-indent:-1em;padding-left:1em}.ip-geo-block-border{border-top:inherit}.ip-geo-block-notice{color:#dd3d36}.ip-geo-block-title{width:100px;display:inline-block}.ip-geo-block-result{color:#2786C2;display:inline-block}.ip-geo-block-primary{color:#fff!important;background:#00838f!important;border-color:#00707a!important;text-shadow:none}#ip-geo-block-live-loading,.ip-geo-block-icon span,.ip-geo-block-loading{background-size:16px 16px;background-position:center center;background-repeat:no-repeat}.ip-geo-block-primary:hover{background-color:#00919e!important;border-color:#00525a!important}#ip-geo-block-live-loading,.ip-geo-block-loading{height:16px;width:16px;margin-left:1em;margin-top:.2em;display:inline-block;vertical-align:top}.ip-geo-block-loading{background-image:url(data:image/gif;base64,R0lGODlhEAAQAPYCAKqqqsbGxlZWVsrKyvr6+ubm5tDQ0K6urmZmZmJiYuzs7IaGhvT09JycnLq6us7Ozurq6o6OjtbW1tra2vDw8CgoKCYmJvz8/NLS0kJCQlJSUqysrPLy8vb29pqamra2tm5ubujo6Kampvj4+IiIiMjIyEhISNzc3OLi4rKysj4+PlBQULi4uJKSkmRkZODg4KKiou7u7iQkJB4eHlpaWhISErCwsHh4eMDAwDIyMi4uLqSkpIKCgr6+vt7e3n5+fggICJCQkAwMDEpKSmBgYHZ2dhgYGBYWFnx8fF5eXk5OTiIiIjAwMIyMjISEhDQ0NJaWltTU1AQEBBwcHGpqaoqKiuTk5CoqKlhYWAoKCtjY2Hp6ehAQEJ6ensLCwkxMTJSUlCwsLAYGBnR0dDg4OFxcXLy8vKCgoA4ODsTExMzMzDw8PERERDY2NqioqHJycrS0tGhoaBQUFEZGRjo6OkBAQICAgHBwcFRUVCAgIGxsbP///wAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCgACACwAAAAAEAAQAEAHjIACgoOEhYJsbTGGghcPGIJRbFNNhgQKCheDDkllDQYMHSc4MAcvhTB0aFliggQjmYNEFQ6LAh0+VoIwbFW1GGamhCgfUE5NbgMKtQYLc0a1gjsyR3E2IYwMFASDYDJvtRRWFIJ1TMq1ElqCICpetQoBEoInVCsAhhI2XhyEPUgIIG7waALlwAloCAMBACH5BAkKAAIALAEAAQAOAA4AAAeDgAKCEmBYYRVKJAaCjAcrVzIzRjVoTw2MKRk5Ww4KECkuWTWCE0Rrl4yCTow7bAupsBcCW19psKkjBEQaFLeMHBwINBy+ggoxVQkPxSMFMXBUMMUQPhRWVUU9tyFRLwQCA048cCcjIyFaJQYxjA8NEVBnAClmahCwEANwbjYBJwyMAgEAIfkECQoABQAsAQABAA4ADgAAB4OABYInO29DbC5QUYKMZiBfbCptTBUmIow4LgJBaTExZkVLFTAFKD8JB4yMQUZrBixUXaqqVFwkUG8Ys4wpQiZOWwy7ghBiRk08HcOqblUTy4wlLWbLBCMFCgBdurMjFMoFE24ADxAXFwwKITEEjD5mH2YBDxI+IdeqHCcGAxgv7IwCAQAh+QQJCgAAACwBAAEADgAOAAAHhYAAglYfTVQJSCITgowDVSAISQJKJgkpjA8LWyIGHBQBJCoZBwAQDU44jIxdTxoSAxEfqqpbFWApUCezjA5LWCJdI7uCClNXGyLCwxBHFl4HBcMAKVxfEx8Y0glZCxwlOCjDUkwPACElAygMghftAB6MClpRJygQFB0EuyMKBQUKDPQxCgQAIfkECQoAAAAsAQABAA4ADgAAB4SAAIIKahstTQ0OVoKMJzYeLVU8W29OXowvBztePh0dUTtxVD0AHDgHEoyMKWVvPj4sBqqqLUoiGDgQs4wBJmNqARe7gjEqXxgPwsMxbWw+UQzDAGY6LjEnusNjFmAEBVbRs00zc1EAHRAKHYw2CHIyO4wEHAwjgmJCZDC7F8psC7IEBQIAIfkECQoARwAsAQABAA4ADgAAB4OAR4IMPgMfNg4PCoKMEA84LCkAMB47GIwxBiUTEAQjKD0REQ9HBD4YIYyMATwtBRQnqaqMG0UOEC8ds4wYIEEQBbuMHC4gMYvCRxw0CAwcF8kBGj8EHdDCJCYiRxfXsw0qCROqRDYQECw3ORkpqjpAQjVGMxYrB7MPC0MyFQItEowCAQAh+QQJCgACACwBAAEADgAOAAAHgIACghcUVhIYEigMgowjEC8nUQ8BOGkojAQxITEdAhcxEh9wPoIMFCOMjBMAKTEXHaipjGldDxcEsqkvUAe5sh1NLb6pHTxNbGK9vlE3DU5ZLsNnIA4GbTVVuQcJdpdnS0Z3LAoxXhF4LjiMMBl5FjptKiZ6ZrJRLUkqbCAwJ4yBACH5BAUKAAEALAEAAQAOAA4AAAd/gAGCARcjHDExHASDjAQdHAoFLy8Ugw2MgiMKWhIKAQ9MYpiCEA8YHQtZCaOCJ14vX2g2rAEKZgMyNRC0BCksFUa7rCMANgIzH7QvZw4tMmO0DlAPUV9hHqNeVTC7G2tkTmkUHA8iSFUGgzZlGSYaNC4gTWqYEzA3SQhVH1aDgQA7)}#ip-geo-block-map{height:400px;margin:1em auto}.gm-style-iw{width:18em;height:auto!important;height:100%;min-height:100%:}.gm-style-iw ul{margin:.1em}.gm-style-iw li{margin:.2em}svg a:hover>text{fill:#0096dd}svg a>text{fill:#0073aa;text-decoration:underline}table.ip-geo-block-statistics-table{float:right}table.ip-geo-block-statistics-table td,table.ip-geo-block-statistics-table th{width:12em;margin:0;padding:.2em;text-align:right;line-height:1.5em;word-wrap:break-word}table.ip-geo-block-statistics-table tr:nth-child(even){background-color:#eee}.ip-geo-block-icon,.ip-geo-block-list-exceptions a.ip-geo-block-icon{background-color:transparent;box-shadow:none;text-decoration:none;outline:0}table.ip-geo-block-table{margin:1em 0;white-space:normal;word-wrap:break-word;word-break:break-all}table.ip-geo-block-table td:first-child{min-width:4.3em}@media screen and (max-width:782px){#ip-geo-block-whois .panel-body{padding:0 .5em}}#ip-geo-block-scan-code{vertical-align:middle}#ip-geo-block-code-list{display:none;margin-bottom:0}#ip-geo-block-chart-countries{height:200px}#ip-geo-block-chart-daily{height:240px}#ip_geo_block_settings_validation_mimetype+label{padding-top:.25em}#ip_geo_block_settings_validation_mimetype+label+ul{margin-top:.7em}#ip_geo_block_settings_create_user{margin-bottom:.5em}#ip-geo-block-back-to-top a,#ip-geo-block-toggle-sections{box-shadow:none}#ip-geo-block-wp-info textarea{margin-top:.5em;overflow:auto;width:100%;word-wrap:normal;word-break:normal;white-space:pre}#ip-geo-block-back-to-top{margin:0;text-align:right}#ip-geo-block-live-update,#ip-geo-block-open-new{margin-left:1em}.ip-geo-block-menu-link{font-size:13px!important}dfn~.ip-geo-block-icon{margin-left:.4em}.ip-geo-block-icon{position:relative}.ip-geo-block-icon:active{top:1px}.ip-geo-block-icon span{height:16px;width:16px;margin:0;border:none;display:inline-block;vertical-align:middle}.ip-geo-block-icon-cycle span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAh1BMVEUAda2otLp+rsSHprWHr8IBd7EpfKRGhaNajqeUqrRymKuKoq5yo7prlKgAcqoVe6w8gqQmgq5Tj6wIdqsVdKIshrEMea1Uhp+Anqw0hawDdq4gfKhljqE7hqoLdKYbgbM4jLQygKUGeK8CdawQd6gVeKcad6NKkrSerrZAj7UAc6sAc6rc3NySrVGQAAAALXRSTlP//////////////////////////////////////////////////////////wCl7wv9AAACOklEQVR4Ae2W15rzKgxF9xTZzhTX9B7S/gN6/9ebYqzzGZsw/S7LV3FZgCSIwD/kQ8FVcBU8xatZUczy8luC/ABNOn0DSHEsvyZ4PgLatNCYR3efFxyhTQ8g+qQgJxgv2JefERzJXATRh4LHOUwAHD4S7OGEztRJaN86hAUxtaNWDUf/bRdDBbQMWVDAO8jn89WUhag1MeyCAh6hHofyrliLgZKggDMYgzF3eVAwFq0uCZq5KY0TezjIHDDzC0qqmkwe2ctGDOQVLMkgu+F3/rGXwb4xIPcJ6P3JgkM8wFjmfcFAWfeKQywaAz33BJVuHsUcAt09gVbuLDThAJkdR687ggLmf4gDJLIGV7BydtB8yn3u+fbtuj/LS7G9wZAd1AKK+yxJ1x+aBmibTtgCcEHGHsh0wdbOgNLek4L7lI5BigY8nWuZUQ3qGEXes9JzOKGJztPaGtLslu3lIXJirdxCWkASHGDTMqg7V1DKPplygDG61YJukLHjEErGSXqCSos6xNSOgzP3BDmsQBcchNwkoV8oiNnPA78zIefUgCdJeGIfE7LmFWXsFTCFdzTJ/RlfEMRiSGnFXXbkC7AIeqcKDu4ynseozeouKJiSEYBDwkJyIC1nRUjgblkNWp/e/1vXc2gjoAoLksYgjrrFMi0oDgjEEIDij1scBXMJSH6DAj6RNl7o8MkuLak8Co15/Pk+MRmT0xilQJV/sdWNKg2kTaeroudvNNsDjmejYjSL+e6v2/2r4Cp4BXNajr0H7hRfAAAAAElFTkSuQmCC)}.ip-geo-block-icon-lock span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3Ny3y9Zzq8dRmb7M1dlXnsIFdK0AcawAcqwphrYAcKvZ29wAb6oJd680jrqlw9MBcqxmo8MUfbJLl75eoMI7kbzX2ttqp8VSmL1YnL8NeK+Tu89DlL1ImMEOebBNmL4OkqMoAAAAAXRSTlMAQObYZgAAAPlJREFUeAG9kAWyhTAQBIPOsCzufv9TPnf4Ll0CSbpmxXwNy3Yc23rz2fV8kPA99433AIQIiGDTCD0lojiOQPXCDSFJIbF16CMWItkQMkF+inZzSLYhFKLl+a9UKTZaqJTZJYtarZuo40chrv9CqJTN+behVi+Cm7RdDgRld6AMgLxrE/dxBz0BEjwBEmD/uIsWPAOAF9A+CE56ufSryr8oqfOYcBbQJ8YkES7COkFOYzTypqCDOTDo2wljaEw4vp1APYyWKd8WMBozylvCpcvmXeHQ5fCegHia4s1FgZcIVeVFeFx1M4MvYG4eBHdYWufC+addBtf8E3vdjBNhWnVQqAAAAABJRU5ErkJggg==)}.ip-geo-block-icon-unlock span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3NyzydRzq8dRmb7I09hYnsEFdK0AcawAcqzP1toqhrYAcKvZ29wAb6oMeK8zjbqrxtQBcazBz9Zko8MVfbLF0thMmL07kbtpp8WjwtJSmL1YnL+Tu89DlL1JmMEPebBFV++UAAAAAXRSTlMAQObYZgAAAONJREFUeAG9kAWChDAMAIMmJaTFXf7/ynXflvMbnE5j8DU8Pwh8D1yEUYxEGEchWFEJEjEflESBhTQSQm2MRpIotQhZTmgKgMIg5ZlFKBmrGg7UFXJpEQKW8qIKN7YeikJdBJI2BTtXwfyx0L3XoPphvBEliNU49OoxqEa6g4cTST/OYshvi3hV8+FxSNfluG3jqxG8C6h7gF6jU+AODnTsFGSCA5O4I8wpQDq7I5CUAKWQW+AZYOYtoQPoGDeECWDaioBmWQxeBduoWURso+5WpBdw7R4ENTVDcGE435tJwT+xB+vMEnZRNB0YAAAAAElFTkSuQmCC)}.ip-geo-block-icon-find span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3NzS19rD0NWHtMpGk7kYfbAGda0Req+WtcTT1temwM4AcasAcqwAc6wAcKydvMt1pr8Ab6pqpcLX2doggrKoxdNYm7yzw8u/y9HO1tkKdq4th7Td3t6DrcLL0taxyNPGe/YhAAAAAXRSTlMAQObYZgAAARVJREFUeAGtkkeiwyAMRP2xDfxoRjElvd3/lOkNUlZ5u0GPruan/Bnz96Xadr21rvP/7+ujXsAjom78rj4ApCoERIipqfGB1H7wPmYhw1DXjZI6nOel1oJhVAmdUP0tTEDkVC4AYvqIbaDOCqFV6vwRF0tIeYoo6J/X7ICuPAJl9ZynwiIfB5DXxZlRChulbh8xZci0EHZK3TziJFDL504rEOZ+iR5cVj82DoS7XtSshLJpKqaB0Dg3ZjcsQWKaKiF1gVQlITwh/bw2pgKeEeURhE29yKSzUFF03p1V7Wqj2Y7GfrY9X/NirJsPxKsxfBLSSs5GmH8yjAWPSNd8Yoez4f4/G1nIsksqFtGK1i9e39o0P+EAqaoRLlQ+r94AAAAASUVORK5CYII=)}.ip-geo-block-icon-alert span,span.ip-geo-block-icon-alert{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAkFBMVEXc3Nzc2trWl5DHRDTFOyvOgXfc1tXCLBrEMiHEMyLNcmfaxMLDMSDDLx7bu7jRiYHDLhzDMB/LX1PaxsTDLh3YtrHMY1bWmpPJVknSjYXUkYnZuLTMZVnENCPWlI3QhXzENiXXrqrDLRzXsa3Oal7Pe3Hc2NjVn5nNbmPayMbbwb7ay8rUj4fc09Lbw8Db0dDBbRUDAAAAAXRSTlMAQObYZgAAAPVJREFUeAG9ktXWwyAQBonC12brFvff5f2frr4nBredK2DnTFS8Gst2XM8XZmypIGeWcT4PFABaGIXlClfWG1NiC4Ubu705oKRcY32wTAHl2MdTYEqEK8hIiHgHSnSJeaogMyEWO4BijZCvwII2MS9UJ2BXTh+hQidoEttboBOwq3WBnkCNpQlA2iyAhol2hRu71n97p4fw0Z9/ugoPHCfFA+o/iLfCkyBglRJdICBas7uuey+R56fF14wNanj+/QjwY3aX23cBFn6EiHmHNT/ICYxystv/wJy4UHWGlN2cuPB72tFqAq3dP/Hk3zs0E5LZVryGC/hqGNnUa0SVAAAAAElFTkSuQmCC);vertical-align:bottom}table.form-table th .ip-geo-block-cycle span{vertical-align:text-bottom}.ip-geo-block-list{margin-top:0;margin-bottom:.7em}@media screen and (min-width:782px){ul.ip-geo-block-list .code{width:15em}}.ip-geo-block-list-exceptions label{display:inline-block}.ip-geo-block-list-exceptions dfn{border:none}div[class*=ip-geo-block] .dataTables_wrapper.no-footer .dataTables_scrollBody,table.ip-geo-block-dataTable.no-footer,table.ip-geo-block-dataTable>thead>tr>td,table.ip-geo-block-dataTable>thead>tr>th{border-bottom:1px solid #ddd}.ip-geo-block-list-exceptions span.dashicons{font-size:14px}.ip-geo-block-list-exceptions a.ip-geo-block-icon{margin-left:.3em}.form-table td p.ip-geo-block-desc,.form-table td p.ip-geo-block-find-desc{color:#666;font-size:13px!important;margin:4px 0 .5em .5em}.ip-geo-block-find-desc{display:none}.ip-geo-block-admin-post{color:#c43322;margin-left:.25em}.ip-geo-block-warn{color:#c43322;font-weight:700}input#ip_geo_block_settings_behavior_time,input#ip_geo_block_settings_behavior_view{width:3.5em}.ip-geo-block-top-list{display:inline-table;list-style-position:outside;margin:0 2em .5em 1.75em}.ip-geo-block-top-list h4{margin:1em 0}.ip-geo-block-top-list li code{background:0 0}.ip-geo-block-network{margin-bottom:1em}.ip-geo-block-container{margin:0 auto;padding:0 1em;position:relative;width:100%}.ip-geo-block-row{display:flex;flex-direction:column;align-items:flex-start;align-items:stretch;padding:0;width:100%}.ip-geo-block-row .ip-geo-block-column{display:block;flex:1 1 auto;align-self:flex-start;margin-left:0;max-width:100%;width:100%}.ip-geo-block-row .ip-geo-block-column.column-20{flex:0 0 20%;max-width:20%}.ip-geo-block-row .ip-geo-block-column.column-25{flex:0 0 25%;max-width:25%}.ip-geo-block-row .ip-geo-block-column.column-33{flex:0 0 33.3333%;max-width:33.3333%}.ip-geo-block-row .ip-geo-block-column.column-50{flex:0 0 50%;max-width:50%}@media (min-width:40rem){.ip-geo-block-row{flex-direction:row;margin-left:-2em;width:calc(100% + 2em)}.ip-geo-block-row .ip-geo-block-column{margin-bottom:inherit;padding:0 1em}}table.ip-geo-block-dataTable{clear:none!important}table.ip-geo-block-dataTable td,table.ip-geo-block-dataTable th{text-align:right}table.ip-geo-block-dataTable td:nth-child(n+2),table.ip-geo-block-dataTable th:nth-child(n+2){padding-left:0!important}table.ip-geo-block-dataTable th{white-space:nowrap}table.ip-geo-block-dataTable>thead>tr{line-height:1.8em}table.ip-geo-block-dataTable thead td,table.ip-geo-block-dataTable thead th{padding:10px 16px}#ip-geo-block-statistics-cache td:nth-child(3),#ip-geo-block-validation-logs td:nth-child(4){min-width:1.6em}table.ip-geo-block-dataTable.nowrap td,table.ip-geo-block-dataTable>tbody>tr>td span{white-space:normal!important;word-wrap:break-word!important;word-break:break-all!important}table.ip-geo-block-dataTable>tbody>tr>td span{display:inline-block}.ip-geo-block-settings-folding input[type=checkbox]{margin-right:.5em}table.ip-geo-block-dataTable input[type=checkbox]{max-height:16px;max-width:16px;margin:0}table.ip-geo-block-dataTable>tbody>tr>td:first-child,table.ip-geo-block-dataTable>thead>tr>th:first-child{padding:8px 4px 8px 1.4em;text-align:left}table.collapsed>tbody>tr>td.dataTables_empty:first-child::before,table.ip-geo-block-dataTable>tbody>tr>td.dataTables_empty{border:none;text-align:center}table.ip-geo-block-dataTable thead>tr>th:first-child.sorting_asc{background-image:none!important}table.ip-geo-block-dataTable.display tbody tr.even>.sorting_1,table.ip-geo-block-dataTable.display tbody tr.odd>.sorting_1,table.ip-geo-block-dataTable.display tbody tr:hover>.sorting_1{background-color:inherit!important}table.ip-geo-block-dataTable.collapsed>tbody>tr>td:first-child{padding:8px 4px 8px 8px!important}table.collapsed>tbody>tr.parent>td:first-child::before,table.collapsed>tbody>tr>td:first-child::before{content:'';height:0;width:0;display:inline-block;border-radius:0;border:5px solid transparent;box-shadow:none;position:relative;background-color:transparent}table.collapsed>tbody>tr>td:first-child::before{border-left:5px solid #555;top:1px;left:-2px}table.collapsed>tbody>tr.parent>td:first-child::before{border-top:5px solid #555;top:4px;left:-4px}table.collapsed>tbody>tr.child>td:first-child::before{border:none}table.collapsed>tbody>tr.child>td.child>ul li{border:none;padding:0;margin:0;line-height:1.8em}table.collapsed>tbody>tr.child>td.child>ul li span.dtr-data,table.collapsed>tbody>tr.child>td.child>ul li span.dtr-title{font-size:13px!important;display:block;white-space:normal;word-wrap:break-word;word-break:break-all}table.collapsed>tbody>tr.child>td.child>ul li span.dtr-data{margin-left:1.25em;margin-right:.3em}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate{float:none;text-align:center;margin-bottom:1em}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.current,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button:active,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button:hover,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate span.ellipsis{min-width:2em;background:inherit;border-color:#ddd;border-radius:0;border-image:none;border-style:solid;border-width:1px 1px 1px 0;box-shadow:none;margin:.5em 0 0;padding:.25em 0;display:inline-block;text-decoration:none}#ip-geo-block-1 #ip-geo-block-section-2 .panel-body,#ip-geo-block-4 #ip-geo-block-section-0 .panel-body,mark{padding:0}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate:active>a.paginate_button:first-child,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate:hover>a.paginate_button:first-child,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate>a.paginate_button:first-child{border-left-width:1px;border-bottom-left-radius:4px;border-top-left-radius:4px}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate:active>a.paginate_button:last-child,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate:hover>a.paginate_button:last-child,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate>a.paginate_button:last-child{border-bottom-right-radius:4px;border-top-right-radius:4px}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button{color:#0073aa!important}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button:hover{color:#0096dd!important;background-color:#fff}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate span.ellipsis{cursor:default;color:#999!important;background-color:transparent}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.current,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover{cursor:default;color:#444!important;background-color:#fff!important}#ip-geo-block-1 #ip-geo-block-section-2 table.form-table,#ip-geo-block-4 #ip-geo-block-section-0 table.form-table{margin-left:1em;max-width:95%}#ip-geo-block-live-log,#ip-geo-block-select-duration,#ip-geo-block-select-layout,#ip-geo-block-select-target{margin:0}#ip-geo-block-select-duration li,#ip-geo-block-select-layout li,#ip-geo-block-select-target li{float:left;margin-right:1.5em}#ip-geo-block-select-duration li label,#ip-geo-block-select-target li label{cursor:pointer}#ip_geo_block_settings_search_filter{width:16em;padding-top:3px}table.ip-geo-block-dataTable.display tbody tr.ip-geo-block-passed{background-color:#edf6ff!important}table.ip-geo-block-dataTable.display tbody tr.ip-geo-block-blocked{background-color:#ffefef!important}.ip-geo-block-new-passed{animation:ip-geo-block-flash-passed 1s ease-out 0s 1 normal both running}.ip-geo-block-new-blocked{animation:ip-geo-block-flash-blocked 1s ease-out 0s 1 normal both running}@keyframes ip-geo-block-flash-passed{0%{background-color:gold}100%{background-color:#edf6ff}}@keyframes ip-geo-block-flash-blocked{0%{background-color:gold}100%{background-color:#ffefef}}mark{background:gold}#ip-geo-block-live-log li{float:left;margin-right:3em}#ip-geo-block-live-log li:last-child{margin-right:0}#ip-geo-block-live-log li input[type=radio]{visibility:hidden;position:absolute}#ip-geo-block-live-log li input[type=radio]+label{display:inline-block;margin:-2px -2px 0;padding:4px 12px;font-size:14px;line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #ccc;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);border-bottom-color:#b3b3b3;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}#ip-geo-block-live-log li input[type=radio]:checked+label{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);background-color:#e0e0e0}.ip-geo-block-live-timer{height:1em;width:1em;margin:0;position:relative;top:0;left:0}.ip-geo-block-live-timer:before{content:"";display:block;height:1em;width:1em;background:#0073aa;border-radius:50%;position:absolute;top:0;left:0}.ip-geo-block-live-timer:after{display:none}.ip-geo-block-live-timer>div{position:absolute;width:1em;height:1em;clip:rect(0,1em,1em,.5em)}.ip-geo-block-live-timer>div:before{content:" ";position:absolute;width:1em;height:1em;border-radius:.5em;clip:rect(0,.5em,1em,0);background-color:#f1f1f1;transform:rotate(0)}.ip-geo-block-live-timer>div:first-child:before{animation:30s spin-timer linear forwards}.ip-geo-block-live-timer>div:last-child{transform:rotate(180deg)}.ip-geo-block-live-timer>div:last-child:before{transform:rotate(0);animation:30s spin-timer linear 30s forwards}@keyframes spin-timer{0%{transform:rotate(0)}100%{transform:rotate(180deg)}}.ip-geo-block-subitem{margin-left:1.7em}.ip-geo-block-subitem:before{content:"\00bb";position:absolute;left:2em}.ip-geo-block-subitem dfn{vertical-align:middle}.ip-geo-block-subitem-parent td,.ip-geo-block-subitem-parent th{padding-top:0}:placeholder-shown{color:#888}::-webkit-input-placeholder{color:#888}:-moz-placeholder{color:#888;opacity:1}::-moz-placeholder{color:#888;opacity:1}:-ms-input-placeholder{color:#888}
admin/css/cidr.min.css CHANGED
@@ -1 +1 @@
1
- *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:8xp;font-size:14px;line-height:1.4}#g,textarea{border:1px solid #ccc;font-size:12px;font-family:Consolas,Monaco,monospace}.container{margin:0;padding:0}.clr:after,.col:after,.container:after,.row:after{content:"";display:table;clear:both}.row{padding-bottom:0}#g,fieldset{padding:.5rem}.col{display:block;float:left;width:100%}.span_2{width:8.33333333333%}.span_11{width:45.8333333333%}.span_24,textarea{width:100%}fieldset{border:none;margin:0}textarea{height:4.5rem;resize:horizontal}legend input[type=button]{margin-left:.5rem;vertical-align:middle}#j,#i{display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;justify-content:center;align-items:center}#j{padding:0 .5rem}ul#h{padding:1.5rem 0 0;list-style:none}ul#h li{width:100%;margin:.1rem 0;display:inline-block}ul#h li input{padding:0}#g{text-align:center}
1
+ *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:8xp;font-size:14px;line-height:1.4}#g,textarea{border:1px solid #ccc;font-size:12px;font-family:Consolas,Monaco,monospace}.container{margin:0;padding:0}.clr:after,.col:after,.container:after,.row:after{content:"";display:table;clear:both}.row{padding-bottom:0}#g,fieldset{padding:.5rem}.col{display:block;float:left;width:100%}.span_2{width:8.33333333333%}.span_11{width:45.8333333333%}.span_24,textarea{width:100%}fieldset{border:none;margin:0}textarea{height:4.5rem;resize:horizontal}legend input[type=button]{margin-left:.5rem;vertical-align:middle}#j,#i{display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;justify-content:center;align-items:center}#j{padding:0 .5rem}ul#h{padding:1.5rem 0 0;list-style:none}ul#h li{width:100%;margin:.1rem 0;display:inline-block}ul#h li input{padding:0}#g{height:3em;text-align:center}
admin/css/fonts/icomoon.eot CHANGED
Binary file
admin/css/fonts/icomoon.svg CHANGED
@@ -7,12 +7,9 @@
7
  <font-face units-per-em="1024" ascent="960" descent="-64" />
8
  <missing-glyph horiz-adv-x="1024" />
9
  <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
 
10
  <glyph unicode="&#xe900;" glyph-name="warning" d="M1010.432 121.248l-383.968 768c-21.664 43.36-65.952 70.752-114.464 70.752s-92.8-27.392-114.464-70.752l-383.968-768c-19.84-39.68-17.728-86.816 5.6-124.576 23.328-37.696 64.512-60.672 108.864-60.672h767.904c44.384 0 85.568 22.976 108.864 60.672 23.328 37.76 25.44 84.896 5.632 124.576zM575.936 96c0-17.696-14.304-32-32-32h-64c-17.696 0-32 14.304-32 32v64c0 17.696 14.304 32 32 32h64c17.696 0 32-14.304 32-32v-64zM575.936 352c0-17.696-14.304-32-32-32h-64c-17.696 0-32 14.304-32 32v320c0 17.664 14.304 32 32 32h64c17.696 0 32-14.336 32-32v-320z" />
11
- <glyph unicode="&#xe933;" glyph-name="folder-download" d="M576 704l-128 128h-448v-832h1024v704h-448zM512 96l-224 224h160v256h128v-256h160l-224-224z" />
12
- <glyph unicode="&#xe948;" glyph-name="location2" d="M512 960c-176.732 0-320-143.268-320-320 0-320 320-704 320-704s320 384 320 704c0 176.732-143.27 320-320 320zM512 444c-108.248 0-196 87.752-196 196s87.752 196 196 196 196-87.752 196-196-87.752-196-196-196zM388 640c0 68.483 55.517 124 124 124s124-55.517 124-124c0-68.483-55.517-124-124-124s-124 55.517-124 124z" />
13
- <glyph unicode="&#xe94b;" glyph-name="map" d="M0 768l320 128v-768l-320-128zM384 928l320-192v-736l-320 160zM768 736l256 192v-768l-256-192z" />
14
- <glyph unicode="&#xe964;" glyph-name="database" d="M512 960c-282.77 0-512-71.634-512-160v-128c0-88.366 229.23-160 512-160s512 71.634 512 160v128c0 88.366-229.23 160-512 160zM512 416c-282.77 0-512 71.634-512 160v-192c0-88.366 229.23-160 512-160s512 71.634 512 160v192c0-88.366-229.23-160-512-160zM512 128c-282.77 0-512 71.634-512 160v-192c0-88.366 229.23-160 512-160s512 71.634 512 160v192c0-88.366-229.23-160-512-160z" />
15
- <glyph unicode="&#xe985;" glyph-name="binoculars" d="M64 960h384v-64h-384zM576 960h384v-64h-384zM952 640h-56v256h-256v-256h-256v256h-256v-256h-56c-39.6 0-72-32.4-72-72v-560c0-39.6 32.4-72 72-72h304c39.6 0 72 32.4 72 72v376h128v-376c0-39.6 32.4-72 72-72h304c39.6 0 72 32.4 72 72v560c0 39.6-32.4 72-72 72zM348 0h-248c-19.8 0-36 14.4-36 32s16.2 32 36 32h248c19.8 0 36-14.4 36-32s-16.2-32-36-32zM544 448h-64c-17.6 0-32 14.4-32 32s14.4 32 32 32h64c17.6 0 32-14.4 32-32s-14.4-32-32-32zM924 0h-248c-19.8 0-36 14.4-36 32s16.2 32 36 32h248c19.8 0 36-14.4 36-32s-16.2-32-36-32z" />
16
  <glyph unicode="&#xe986;" glyph-name="search" d="M992.262 88.604l-242.552 206.294c-25.074 22.566-51.89 32.926-73.552 31.926 57.256 67.068 91.842 154.078 91.842 249.176 0 212.078-171.922 384-384 384-212.076 0-384-171.922-384-384s171.922-384 384-384c95.098 0 182.108 34.586 249.176 91.844-1-21.662 9.36-48.478 31.926-73.552l206.294-242.552c35.322-39.246 93.022-42.554 128.22-7.356s31.892 92.898-7.354 128.22zM384 320c-141.384 0-256 114.616-256 256s114.616 256 256 256 256-114.616 256-256-114.614-256-256-256z" />
17
  <glyph unicode="&#xe98d;" glyph-name="key" d="M704 960c-176.73 0-320-143.268-320-320 0-20.026 1.858-39.616 5.376-58.624l-389.376-389.376v-192c0-35.346 28.654-64 64-64h64v64h128v128h128v128h128l83.042 83.042c34.010-12.316 70.696-19.042 108.958-19.042 176.73 0 320 143.268 320 320s-143.27 320-320 320zM799.874 639.874c-53.020 0-96 42.98-96 96s42.98 96 96 96 96-42.98 96-96-42.98-96-96-96z" />
18
  <glyph unicode="&#xe98f;" glyph-name="lock" d="M592 512h-16v192c0 105.87-86.13 192-192 192h-128c-105.87 0-192-86.13-192-192v-192h-16c-26.4 0-48-21.6-48-48v-480c0-26.4 21.6-48 48-48h544c26.4 0 48 21.6 48 48v480c0 26.4-21.6 48-48 48zM192 704c0 35.29 28.71 64 64 64h128c35.29 0 64-28.71 64-64v-192h-256v192z" />
@@ -22,9 +19,7 @@
22
  <glyph unicode="&#xe99b;" glyph-name="stats-dots" d="M128 64h896v-128h-1024v1024h128zM288 128c-53.020 0-96 42.98-96 96s42.98 96 96 96c2.828 0 5.622-0.148 8.388-0.386l103.192 171.986c-9.84 15.070-15.58 33.062-15.58 52.402 0 53.020 42.98 96 96 96s96-42.98 96-96c0-19.342-5.74-37.332-15.58-52.402l103.192-171.986c2.766 0.238 5.56 0.386 8.388 0.386 2.136 0 4.248-0.094 6.35-0.23l170.356 298.122c-10.536 15.408-16.706 34.036-16.706 54.11 0 53.020 42.98 96 96 96s96-42.98 96-96c0-53.020-42.98-96-96-96-2.14 0-4.248 0.094-6.35 0.232l-170.356-298.124c10.536-15.406 16.706-34.036 16.706-54.11 0-53.020-42.98-96-96-96s-96 42.98-96 96c0 19.34 5.74 37.332 15.578 52.402l-103.19 171.984c-2.766-0.238-5.56-0.386-8.388-0.386s-5.622 0.146-8.388 0.386l-103.192-171.986c9.84-15.068 15.58-33.060 15.58-52.4 0-53.020-42.98-96-96-96z" />
23
  <glyph unicode="&#xe99c;" glyph-name="stats-bars" d="M0 128h1024v-128h-1024zM128 384h128v-192h-128zM320 640h128v-448h-128zM512 448h128v-256h-128zM704 832h128v-640h-128z" />
24
  <glyph unicode="&#xe99d;" glyph-name="stats-bars2" d="M288 576h-192c-17.6 0-32-14.4-32-32v-576c0-17.6 14.4-32 32-32h192c17.6 0 32 14.4 32 32v576c0 17.6-14.4 32-32 32zM288 0h-192v256h192v-256zM608 704h-192c-17.6 0-32-14.4-32-32v-704c0-17.6 14.4-32 32-32h192c17.6 0 32 14.4 32 32v704c0 17.6-14.4 32-32 32zM608 0h-192v320h192v-320zM928 832h-192c-17.6 0-32-14.4-32-32v-832c0-17.6 14.4-32 32-32h192c17.6 0 32 14.4 32 32v832c0 17.6-14.4 32-32 32zM928 0h-192v384h192v-384z" />
25
- <glyph unicode="&#xe9b4;" glyph-name="shield" d="M960 960l-448-128-448 128c0 0-4.5-51.698 0-128l448-140.090 448 140.090c4.498 76.302 0 128 0 128zM72.19 764.894c23.986-250.696 113.49-672.234 439.81-828.894 326.32 156.66 415.824 578.198 439.81 828.894l-439.81-165.358-439.81 165.358z" />
26
  <glyph unicode="&#xe9b6;" glyph-name="switch" d="M640 813.412v-135.958c36.206-15.804 69.5-38.408 98.274-67.18 60.442-60.44 93.726-140.8 93.726-226.274s-33.286-165.834-93.726-226.274c-60.44-60.44-140.798-93.726-226.274-93.726s-165.834 33.286-226.274 93.726c-60.44 60.44-93.726 140.8-93.726 226.274s33.286 165.834 93.726 226.274c28.774 28.774 62.068 51.378 98.274 67.182v135.956c-185.048-55.080-320-226.472-320-429.412 0-247.424 200.578-448 448-448 247.424 0 448 200.576 448 448 0 202.94-134.95 374.332-320 429.412zM448 960h128v-512h-128z" />
27
- <glyph unicode="&#xe9b7;" glyph-name="power-cord" d="M1024 677.5l-90.506 90.5-178.746-178.752-101.5 101.502 178.75 178.75-90.5 90.5-178.75-178.75-114.748 114.75-86.626-86.624 512.002-512 86.624 86.622-114.752 114.752 178.752 178.75zM794.040 286.21l-443.824 443.824c-95.818-114.904-204.52-292.454-129.396-445.216l-132.248-132.248c-31.112-31.114-31.112-82.024 0-113.136l14.858-14.858c31.114-31.114 82.026-31.114 113.138 0l132.246 132.244c152.764-75.132 330.318 33.566 445.226 129.39z" />
28
  <glyph unicode="&#xe9c9;" glyph-name="sphere" d="M480 896c-265.096 0-480-214.904-480-480 0-265.098 214.904-480 480-480 265.098 0 480 214.902 480 480 0 265.096-214.902 480-480 480zM751.59 256c8.58 40.454 13.996 83.392 15.758 128h127.446c-3.336-44.196-13.624-87.114-30.68-128h-112.524zM208.41 576c-8.58-40.454-13.996-83.392-15.758-128h-127.444c3.336 44.194 13.622 87.114 30.678 128h112.524zM686.036 576c9.614-40.962 15.398-83.854 17.28-128h-191.316v128h174.036zM512 640v187.338c14.59-4.246 29.044-11.37 43.228-21.37 26.582-18.74 52.012-47.608 73.54-83.486 14.882-24.802 27.752-52.416 38.496-82.484h-155.264zM331.232 722.484c21.528 35.878 46.956 64.748 73.54 83.486 14.182 10 28.638 17.124 43.228 21.37v-187.34h-155.264c10.746 30.066 23.616 57.68 38.496 82.484zM448 576v-128h-191.314c1.88 44.146 7.666 87.038 17.278 128h174.036zM95.888 256c-17.056 40.886-27.342 83.804-30.678 128h127.444c1.762-44.608 7.178-87.546 15.758-128h-112.524zM256.686 384h191.314v-128h-174.036c-9.612 40.96-15.398 83.854-17.278 128zM448 192v-187.34c-14.588 4.246-29.044 11.372-43.228 21.37-26.584 18.74-52.014 47.61-73.54 83.486-14.882 24.804-27.75 52.418-38.498 82.484h155.266zM628.768 109.516c-21.528-35.876-46.958-64.746-73.54-83.486-14.184-9.998-28.638-17.124-43.228-21.37v187.34h155.266c-10.746-30.066-23.616-57.68-38.498-82.484zM512 256v128h191.314c-1.88-44.146-7.666-87.040-17.28-128h-174.034zM767.348 448c-1.762 44.608-7.178 87.546-15.758 128h112.524c17.056-40.886 27.344-83.806 30.68-128h-127.446zM830.658 640h-95.9c-18.638 58.762-44.376 110.294-75.316 151.428 42.536-20.34 81.058-47.616 114.714-81.272 21.48-21.478 40.362-44.938 56.502-70.156zM185.844 710.156c33.658 33.658 72.18 60.932 114.714 81.272-30.942-41.134-56.676-92.666-75.316-151.428h-95.898c16.138 25.218 35.022 48.678 56.5 70.156zM129.344 192h95.898c18.64-58.762 44.376-110.294 75.318-151.43-42.536 20.34-81.058 47.616-114.714 81.274-21.48 21.478-40.364 44.938-56.502 70.156zM774.156 121.844c-33.656-33.658-72.18-60.934-114.714-81.274 30.942 41.134 56.678 92.668 75.316 151.43h95.9c-16.14-25.218-35.022-48.678-56.502-70.156z" />
29
  <glyph unicode="&#xe9ca;" glyph-name="earth" d="M512 960c-282.77 0-512-229.23-512-512s229.23-512 512-512 512 229.23 512 512-229.23 512-512 512zM512-0.002c-62.958 0-122.872 13.012-177.23 36.452l233.148 262.29c5.206 5.858 8.082 13.422 8.082 21.26v96c0 17.674-14.326 32-32 32-112.99 0-232.204 117.462-233.374 118.626-6 6.002-14.14 9.374-22.626 9.374h-128c-17.672 0-32-14.328-32-32v-192c0-12.122 6.848-23.202 17.69-28.622l110.31-55.156v-187.886c-116.052 80.956-192 215.432-192 367.664 0 68.714 15.49 133.806 43.138 192h116.862c8.488 0 16.626 3.372 22.628 9.372l128 128c6 6.002 9.372 14.14 9.372 22.628v77.412c40.562 12.074 83.518 18.588 128 18.588 70.406 0 137.004-16.26 196.282-45.2-4.144-3.502-8.176-7.164-12.046-11.036-36.266-36.264-56.236-84.478-56.236-135.764s19.97-99.5 56.236-135.764c36.434-36.432 85.218-56.264 135.634-56.26 3.166 0 6.342 0.080 9.518 0.236 13.814-51.802 38.752-186.656-8.404-372.334-0.444-1.744-0.696-3.488-0.842-5.224-81.324-83.080-194.7-134.656-320.142-134.656z" />
30
  <glyph unicode="&#xea1c;" glyph-name="play3" d="M192 832l640-384-640-384z" />
7
  <font-face units-per-em="1024" ascent="960" descent="-64" />
8
  <missing-glyph horiz-adv-x="1024" />
9
  <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
+ <glyph unicode="&#xe62f;" glyph-name="vpn_lock" d="M426 44.667v84c-46 0-84 38-84 84v44l-206 204c-6-24-8-50-8-76 0-174 130-320 298-340zM808 426.667h86c2-14 2-28 2-42 0-236-190-428-426-428s-428 192-428 428 192 426 428 426c44 0 88-8 128-20v-108c0-46-40-86-86-86h-86v-84c0-24-18-44-42-44h-86v-84h256c24 0 44-20 44-44v-128h42c38 0 70-24 82-58 56 60 88 142 88 230 0 14 0 28-2 42zM904 768.667v20c0 40-32 74-72 74s-72-34-72-74v-20h144zM938 768.667c24 0 44-20 44-44v-170c0-24-20-42-44-42h-212c-24 0-44 18-44 42v170c0 24 20 44 44 44v20c0 58 48 108 106 108s106-50 106-108v-20z" />
11
  <glyph unicode="&#xe900;" glyph-name="warning" d="M1010.432 121.248l-383.968 768c-21.664 43.36-65.952 70.752-114.464 70.752s-92.8-27.392-114.464-70.752l-383.968-768c-19.84-39.68-17.728-86.816 5.6-124.576 23.328-37.696 64.512-60.672 108.864-60.672h767.904c44.384 0 85.568 22.976 108.864 60.672 23.328 37.76 25.44 84.896 5.632 124.576zM575.936 96c0-17.696-14.304-32-32-32h-64c-17.696 0-32 14.304-32 32v64c0 17.696 14.304 32 32 32h64c17.696 0 32-14.304 32-32v-64zM575.936 352c0-17.696-14.304-32-32-32h-64c-17.696 0-32 14.304-32 32v320c0 17.664 14.304 32 32 32h64c17.696 0 32-14.336 32-32v-320z" />
12
+ <glyph unicode="&#xe901;" glyph-name="calculator" d="M102.4 870.4c0 56.32 46.080 102.4 102.4 102.4h614.4c56.554 0 102.4-45.846 102.4-102.4v0-819.2c0-56.554-45.846-102.4-102.4-102.4v0h-614.4c-56.554 0-102.4 45.846-102.4 102.4v0 819.2zM256 819.2v-102.4h512v102.4h-512zM256 614.4v-102.4h102.4v102.4h-102.4zM460.8 614.4v-102.4h102.4v102.4h-102.4zM665.6 614.4v-102.4h102.4v102.4h-102.4zM256 409.6v-102.4h102.4v102.4h-102.4zM460.8 409.6v-102.4h102.4v102.4h-102.4zM665.6 409.6v-307.2h102.4v307.2h-102.4zM256 204.8v-102.4h102.4v102.4h-102.4zM460.8 204.8v-102.4h102.4v102.4h-102.4z" />
 
 
 
 
13
  <glyph unicode="&#xe986;" glyph-name="search" d="M992.262 88.604l-242.552 206.294c-25.074 22.566-51.89 32.926-73.552 31.926 57.256 67.068 91.842 154.078 91.842 249.176 0 212.078-171.922 384-384 384-212.076 0-384-171.922-384-384s171.922-384 384-384c95.098 0 182.108 34.586 249.176 91.844-1-21.662 9.36-48.478 31.926-73.552l206.294-242.552c35.322-39.246 93.022-42.554 128.22-7.356s31.892 92.898-7.354 128.22zM384 320c-141.384 0-256 114.616-256 256s114.616 256 256 256 256-114.616 256-256-114.614-256-256-256z" />
14
  <glyph unicode="&#xe98d;" glyph-name="key" d="M704 960c-176.73 0-320-143.268-320-320 0-20.026 1.858-39.616 5.376-58.624l-389.376-389.376v-192c0-35.346 28.654-64 64-64h64v64h128v128h128v128h128l83.042 83.042c34.010-12.316 70.696-19.042 108.958-19.042 176.73 0 320 143.268 320 320s-143.27 320-320 320zM799.874 639.874c-53.020 0-96 42.98-96 96s42.98 96 96 96 96-42.98 96-96-42.98-96-96-96z" />
15
  <glyph unicode="&#xe98f;" glyph-name="lock" d="M592 512h-16v192c0 105.87-86.13 192-192 192h-128c-105.87 0-192-86.13-192-192v-192h-16c-26.4 0-48-21.6-48-48v-480c0-26.4 21.6-48 48-48h544c26.4 0 48 21.6 48 48v480c0 26.4-21.6 48-48 48zM192 704c0 35.29 28.71 64 64 64h128c35.29 0 64-28.71 64-64v-192h-256v192z" />
19
  <glyph unicode="&#xe99b;" glyph-name="stats-dots" d="M128 64h896v-128h-1024v1024h128zM288 128c-53.020 0-96 42.98-96 96s42.98 96 96 96c2.828 0 5.622-0.148 8.388-0.386l103.192 171.986c-9.84 15.070-15.58 33.062-15.58 52.402 0 53.020 42.98 96 96 96s96-42.98 96-96c0-19.342-5.74-37.332-15.58-52.402l103.192-171.986c2.766 0.238 5.56 0.386 8.388 0.386 2.136 0 4.248-0.094 6.35-0.23l170.356 298.122c-10.536 15.408-16.706 34.036-16.706 54.11 0 53.020 42.98 96 96 96s96-42.98 96-96c0-53.020-42.98-96-96-96-2.14 0-4.248 0.094-6.35 0.232l-170.356-298.124c10.536-15.406 16.706-34.036 16.706-54.11 0-53.020-42.98-96-96-96s-96 42.98-96 96c0 19.34 5.74 37.332 15.578 52.402l-103.19 171.984c-2.766-0.238-5.56-0.386-8.388-0.386s-5.622 0.146-8.388 0.386l-103.192-171.986c9.84-15.068 15.58-33.060 15.58-52.4 0-53.020-42.98-96-96-96z" />
20
  <glyph unicode="&#xe99c;" glyph-name="stats-bars" d="M0 128h1024v-128h-1024zM128 384h128v-192h-128zM320 640h128v-448h-128zM512 448h128v-256h-128zM704 832h128v-640h-128z" />
21
  <glyph unicode="&#xe99d;" glyph-name="stats-bars2" d="M288 576h-192c-17.6 0-32-14.4-32-32v-576c0-17.6 14.4-32 32-32h192c17.6 0 32 14.4 32 32v576c0 17.6-14.4 32-32 32zM288 0h-192v256h192v-256zM608 704h-192c-17.6 0-32-14.4-32-32v-704c0-17.6 14.4-32 32-32h192c17.6 0 32 14.4 32 32v704c0 17.6-14.4 32-32 32zM608 0h-192v320h192v-320zM928 832h-192c-17.6 0-32-14.4-32-32v-832c0-17.6 14.4-32 32-32h192c17.6 0 32 14.4 32 32v832c0 17.6-14.4 32-32 32zM928 0h-192v384h192v-384z" />
 
22
  <glyph unicode="&#xe9b6;" glyph-name="switch" d="M640 813.412v-135.958c36.206-15.804 69.5-38.408 98.274-67.18 60.442-60.44 93.726-140.8 93.726-226.274s-33.286-165.834-93.726-226.274c-60.44-60.44-140.798-93.726-226.274-93.726s-165.834 33.286-226.274 93.726c-60.44 60.44-93.726 140.8-93.726 226.274s33.286 165.834 93.726 226.274c28.774 28.774 62.068 51.378 98.274 67.182v135.956c-185.048-55.080-320-226.472-320-429.412 0-247.424 200.578-448 448-448 247.424 0 448 200.576 448 448 0 202.94-134.95 374.332-320 429.412zM448 960h128v-512h-128z" />
 
23
  <glyph unicode="&#xe9c9;" glyph-name="sphere" d="M480 896c-265.096 0-480-214.904-480-480 0-265.098 214.904-480 480-480 265.098 0 480 214.902 480 480 0 265.096-214.902 480-480 480zM751.59 256c8.58 40.454 13.996 83.392 15.758 128h127.446c-3.336-44.196-13.624-87.114-30.68-128h-112.524zM208.41 576c-8.58-40.454-13.996-83.392-15.758-128h-127.444c3.336 44.194 13.622 87.114 30.678 128h112.524zM686.036 576c9.614-40.962 15.398-83.854 17.28-128h-191.316v128h174.036zM512 640v187.338c14.59-4.246 29.044-11.37 43.228-21.37 26.582-18.74 52.012-47.608 73.54-83.486 14.882-24.802 27.752-52.416 38.496-82.484h-155.264zM331.232 722.484c21.528 35.878 46.956 64.748 73.54 83.486 14.182 10 28.638 17.124 43.228 21.37v-187.34h-155.264c10.746 30.066 23.616 57.68 38.496 82.484zM448 576v-128h-191.314c1.88 44.146 7.666 87.038 17.278 128h174.036zM95.888 256c-17.056 40.886-27.342 83.804-30.678 128h127.444c1.762-44.608 7.178-87.546 15.758-128h-112.524zM256.686 384h191.314v-128h-174.036c-9.612 40.96-15.398 83.854-17.278 128zM448 192v-187.34c-14.588 4.246-29.044 11.372-43.228 21.37-26.584 18.74-52.014 47.61-73.54 83.486-14.882 24.804-27.75 52.418-38.498 82.484h155.266zM628.768 109.516c-21.528-35.876-46.958-64.746-73.54-83.486-14.184-9.998-28.638-17.124-43.228-21.37v187.34h155.266c-10.746-30.066-23.616-57.68-38.498-82.484zM512 256v128h191.314c-1.88-44.146-7.666-87.040-17.28-128h-174.034zM767.348 448c-1.762 44.608-7.178 87.546-15.758 128h112.524c17.056-40.886 27.344-83.806 30.68-128h-127.446zM830.658 640h-95.9c-18.638 58.762-44.376 110.294-75.316 151.428 42.536-20.34 81.058-47.616 114.714-81.272 21.48-21.478 40.362-44.938 56.502-70.156zM185.844 710.156c33.658 33.658 72.18 60.932 114.714 81.272-30.942-41.134-56.676-92.666-75.316-151.428h-95.898c16.138 25.218 35.022 48.678 56.5 70.156zM129.344 192h95.898c18.64-58.762 44.376-110.294 75.318-151.43-42.536 20.34-81.058 47.616-114.714 81.274-21.48 21.478-40.364 44.938-56.502 70.156zM774.156 121.844c-33.656-33.658-72.18-60.934-114.714-81.274 30.942 41.134 56.678 92.668 75.316 151.43h95.9c-16.14-25.218-35.022-48.678-56.502-70.156z" />
24
  <glyph unicode="&#xe9ca;" glyph-name="earth" d="M512 960c-282.77 0-512-229.23-512-512s229.23-512 512-512 512 229.23 512 512-229.23 512-512 512zM512-0.002c-62.958 0-122.872 13.012-177.23 36.452l233.148 262.29c5.206 5.858 8.082 13.422 8.082 21.26v96c0 17.674-14.326 32-32 32-112.99 0-232.204 117.462-233.374 118.626-6 6.002-14.14 9.374-22.626 9.374h-128c-17.672 0-32-14.328-32-32v-192c0-12.122 6.848-23.202 17.69-28.622l110.31-55.156v-187.886c-116.052 80.956-192 215.432-192 367.664 0 68.714 15.49 133.806 43.138 192h116.862c8.488 0 16.626 3.372 22.628 9.372l128 128c6 6.002 9.372 14.14 9.372 22.628v77.412c40.562 12.074 83.518 18.588 128 18.588 70.406 0 137.004-16.26 196.282-45.2-4.144-3.502-8.176-7.164-12.046-11.036-36.266-36.264-56.236-84.478-56.236-135.764s19.97-99.5 56.236-135.764c36.434-36.432 85.218-56.264 135.634-56.26 3.166 0 6.342 0.080 9.518 0.236 13.814-51.802 38.752-186.656-8.404-372.334-0.444-1.744-0.696-3.488-0.842-5.224-81.324-83.080-194.7-134.656-320.142-134.656z" />
25
  <glyph unicode="&#xea1c;" glyph-name="play3" d="M192 832l640-384-640-384z" />
admin/css/fonts/icomoon.ttf CHANGED
Binary file
admin/css/fonts/icomoon.woff CHANGED
Binary file
admin/datatables/css/datatables-all.css CHANGED
@@ -1,8 +1,8 @@
1
  /*! DataTables 1.10.16
2
  * 2008-2017 SpryMedia Ltd - datatables.net/license
3
  */
4
-
5
- table.dataTable {
6
  width: 100%;
7
  margin: 0 auto;
8
  clear: both;
@@ -15,285 +15,315 @@ table.dataTable {
15
  * Body styles
16
  */
17
  }
18
- table.dataTable thead th,
19
- table.dataTable tfoot th {
20
  font-weight: bold;
21
  }
22
- table.dataTable thead th,
23
- table.dataTable thead td {
24
  padding: 10px 18px;
25
  border-bottom: 1px solid #111;
26
  }
27
- table.dataTable thead th:active,
28
- table.dataTable thead td:active {
29
  outline: none;
30
  }
31
- table.dataTable tfoot th,
32
- table.dataTable tfoot td {
33
  padding: 10px 18px 6px 18px;
34
  border-top: 1px solid #111;
35
  }
36
- table.dataTable thead .sorting,
37
- table.dataTable thead .sorting_asc,
38
- table.dataTable thead .sorting_desc,
39
- table.dataTable thead .sorting_asc_disabled,
40
- table.dataTable thead .sorting_desc_disabled {
41
  cursor: pointer;
42
  *cursor: hand;
43
  background-repeat: no-repeat;
44
  background-position: center right;
45
  }
46
- table.dataTable thead .sorting {
47
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAAN0lEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpaQBhPES8gE/z0ElI9M9MA1+gAAD5jWGc4eZ87AAAAABJRU5ErkJggg==); /*url("../images/sort_both.png");*/
48
  }
49
- table.dataTable thead .sorting_asc {
50
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAdUlEQVR4AWO4QyKgWMONG3eWrrh76xbRGtZvulPTdHfzVuI0nDl7p7XrblXD3Y7eu+fPE6FhwWKgaihasuIuAQ2Hj95pbENoqG+9e/QYbg3Xr9+ZPB2iFIGmzrp78yYODdt3gvxa24yCgCK79pAcD8NEw6gGAPv5+lejjyPQAAAAAElFTkSuQmCC); /*url("../images/sort_asc.png");*/
51
  }
52
- table.dataTable thead .sorting_desc {
53
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAcklEQVR4AWO4QyIY2hpGNezac6em6W5tMwoCimzfiUPDzZt3ps66W9WAgiZPv3v9Om4nHT12p74Vobqx7e7ho4T8sGQFQsOCxXcJe/r8+TsdvSDVrV13z5wlLpQ2bwX5fv0mooP11q07S1fcvXFjACMOAM7v+leNDkNAAAAAAElFTkSuQmCC); /*url("../images/sort_desc.png");*/
54
  }
55
- table.dataTable thead .sorting_asc_disabled {
56
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALklEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpZsDAJ6RRA0YNAAAd2DjFaOCLnQAAAABJRU5ErkJggg==); /*url("../images/sort_asc_disabled.png");*/
57
  }
58
- table.dataTable thead .sorting_desc_disabled {
59
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALUlEQVR4AWO4c+cORZjqBowaMGrAf0KYlgYQNoToMMClma4GMKBrpqsB9E9IAFTzOMWpD7f6AAAAAElFTkSuQmCC); /*url("../images/sort_desc_disabled.png");*/
60
  }
61
- table.dataTable tbody tr {
62
  background-color: #ffffff;
63
  }
64
- table.dataTable tbody tr.selected {
65
  background-color: #B0BED9;
66
  }
67
- table.dataTable tbody th,
68
- table.dataTable tbody td {
69
  padding: 8px 10px;
70
  }
71
- table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td {
 
 
 
72
  border-top: 1px solid #ddd;
73
  }
74
- table.dataTable.row-border tbody tr:first-child th,
75
- table.dataTable.row-border tbody tr:first-child td, table.dataTable.display tbody tr:first-child th,
76
- table.dataTable.display tbody tr:first-child td {
 
77
  border-top: none;
78
  }
79
- table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td {
 
80
  border-top: 1px solid #ddd;
81
  border-right: 1px solid #ddd;
82
  }
83
- table.dataTable.cell-border tbody tr th:first-child,
84
- table.dataTable.cell-border tbody tr td:first-child {
85
  border-left: 1px solid #ddd;
86
  }
87
- table.dataTable.cell-border tbody tr:first-child th,
88
- table.dataTable.cell-border tbody tr:first-child td {
89
  border-top: none;
90
  }
91
- table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd {
 
92
  background-color: #f9f9f9;
93
  }
94
- table.dataTable.stripe tbody tr.odd.selected, table.dataTable.display tbody tr.odd.selected {
 
95
  background-color: #acbad4;
96
  }
97
- table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover {
 
98
  background-color: #f6f6f6;
99
  }
100
- table.dataTable.hover tbody tr:hover.selected, table.dataTable.display tbody tr:hover.selected {
 
101
  background-color: #aab7d1;
102
  }
103
- table.dataTable.order-column tbody tr > .sorting_1,
104
- table.dataTable.order-column tbody tr > .sorting_2,
105
- table.dataTable.order-column tbody tr > .sorting_3, table.dataTable.display tbody tr > .sorting_1,
106
- table.dataTable.display tbody tr > .sorting_2,
107
- table.dataTable.display tbody tr > .sorting_3 {
 
108
  background-color: #fafafa;
109
  }
110
- table.dataTable.order-column tbody tr.selected > .sorting_1,
111
- table.dataTable.order-column tbody tr.selected > .sorting_2,
112
- table.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTable.display tbody tr.selected > .sorting_1,
113
- table.dataTable.display tbody tr.selected > .sorting_2,
114
- table.dataTable.display tbody tr.selected > .sorting_3 {
 
115
  background-color: #acbad5;
116
  }
117
- table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 {
 
118
  background-color: #f1f1f1;
119
  }
120
- table.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 {
 
121
  background-color: #f3f3f3;
122
  }
123
- table.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 {
 
124
  background-color: whitesmoke;
125
  }
126
- table.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 {
 
127
  background-color: #a6b4cd;
128
  }
129
- table.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 {
 
130
  background-color: #a8b5cf;
131
  }
132
- table.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 {
 
133
  background-color: #a9b7d1;
134
  }
135
- table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 {
 
136
  background-color: #fafafa;
137
  }
138
- table.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-column.stripe tbody tr.even > .sorting_2 {
 
139
  background-color: #fcfcfc;
140
  }
141
- table.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-column.stripe tbody tr.even > .sorting_3 {
 
142
  background-color: #fefefe;
143
  }
144
- table.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 {
 
145
  background-color: #acbad5;
146
  }
147
- table.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 {
 
148
  background-color: #aebcd6;
149
  }
150
- table.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 {
 
151
  background-color: #afbdd8;
152
  }
153
- table.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1 {
 
154
  background-color: #eaeaea;
155
  }
156
- table.dataTable.display tbody tr:hover > .sorting_2, table.dataTable.order-column.hover tbody tr:hover > .sorting_2 {
 
157
  background-color: #ececec;
158
  }
159
- table.dataTable.display tbody tr:hover > .sorting_3, table.dataTable.order-column.hover tbody tr:hover > .sorting_3 {
 
160
  background-color: #efefef;
161
  }
162
- table.dataTable.display tbody tr:hover.selected > .sorting_1, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 {
 
163
  background-color: #a2aec7;
164
  }
165
- table.dataTable.display tbody tr:hover.selected > .sorting_2, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 {
 
166
  background-color: #a3b0c9;
167
  }
168
- table.dataTable.display tbody tr:hover.selected > .sorting_3, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 {
 
169
  background-color: #a5b2cb;
170
  }
171
- table.dataTable.no-footer {
172
  border-bottom: 1px solid #111;
173
  }
174
- table.dataTable.nowrap th, table.dataTable.nowrap td {
 
175
  white-space: nowrap;
176
  }
177
- table.dataTable.compact thead th,
178
- table.dataTable.compact thead td {
179
  padding: 4px 17px 4px 4px;
180
  }
181
- table.dataTable.compact tfoot th,
182
- table.dataTable.compact tfoot td {
183
  padding: 4px;
184
  }
185
- table.dataTable.compact tbody th,
186
- table.dataTable.compact tbody td {
187
  padding: 4px;
188
  }
189
- table.dataTable th.dt-left,
190
- table.dataTable td.dt-left {
191
  text-align: left;
192
  }
193
- table.dataTable th.dt-center,
194
- table.dataTable td.dt-center,
195
- table.dataTable td.dataTables_empty {
196
  text-align: center;
197
  }
198
- table.dataTable th.dt-right,
199
- table.dataTable td.dt-right {
200
  text-align: right;
201
  }
202
- table.dataTable th.dt-justify,
203
- table.dataTable td.dt-justify {
204
  text-align: justify;
205
  }
206
- table.dataTable th.dt-nowrap,
207
- table.dataTable td.dt-nowrap {
208
  white-space: nowrap;
209
  }
210
- table.dataTable thead th.dt-head-left,
211
- table.dataTable thead td.dt-head-left,
212
- table.dataTable tfoot th.dt-head-left,
213
- table.dataTable tfoot td.dt-head-left {
214
  text-align: left;
215
  }
216
- table.dataTable thead th.dt-head-center,
217
- table.dataTable thead td.dt-head-center,
218
- table.dataTable tfoot th.dt-head-center,
219
- table.dataTable tfoot td.dt-head-center {
220
  text-align: center;
221
  }
222
- table.dataTable thead th.dt-head-right,
223
- table.dataTable thead td.dt-head-right,
224
- table.dataTable tfoot th.dt-head-right,
225
- table.dataTable tfoot td.dt-head-right {
226
  text-align: right;
227
  }
228
- table.dataTable thead th.dt-head-justify,
229
- table.dataTable thead td.dt-head-justify,
230
- table.dataTable tfoot th.dt-head-justify,
231
- table.dataTable tfoot td.dt-head-justify {
232
  text-align: justify;
233
  }
234
- table.dataTable thead th.dt-head-nowrap,
235
- table.dataTable thead td.dt-head-nowrap,
236
- table.dataTable tfoot th.dt-head-nowrap,
237
- table.dataTable tfoot td.dt-head-nowrap {
238
  white-space: nowrap;
239
  }
240
- table.dataTable tbody th.dt-body-left,
241
- table.dataTable tbody td.dt-body-left {
242
  text-align: left;
243
  }
244
- table.dataTable tbody th.dt-body-center,
245
- table.dataTable tbody td.dt-body-center {
246
  text-align: center;
247
  }
248
- table.dataTable tbody th.dt-body-right,
249
- table.dataTable tbody td.dt-body-right {
250
  text-align: right;
251
  }
252
- table.dataTable tbody th.dt-body-justify,
253
- table.dataTable tbody td.dt-body-justify {
254
  text-align: justify;
255
  }
256
- table.dataTable tbody th.dt-body-nowrap,
257
- table.dataTable tbody td.dt-body-nowrap {
258
  white-space: nowrap;
259
  }
260
 
261
- table.dataTable,
262
- table.dataTable th,
263
- table.dataTable td {
264
  box-sizing: content-box;
265
  }
266
 
267
  /*
268
  * Control feature layout
269
  */
270
- .dataTables_wrapper {
271
  position: relative;
272
  clear: both;
273
  *zoom: 1;
274
  zoom: 1;
275
  }
276
- .dataTables_wrapper .dataTables_length {
277
  float: left;
278
  }
279
- .dataTables_wrapper .dataTables_filter {
280
  float: right;
281
  text-align: right;
282
  }
283
- .dataTables_wrapper .dataTables_filter input {
284
  margin-left: 0.5em;
285
  }
286
- .dataTables_wrapper .dataTables_info {
287
  clear: both;
288
  float: left;
289
  padding-top: 0.755em;
290
  }
291
- .dataTables_wrapper .dataTables_paginate {
292
  float: right;
293
  text-align: right;
294
  padding-top: 0.25em;
295
  }
296
- .dataTables_wrapper .dataTables_paginate .paginate_button {
297
  box-sizing: border-box;
298
  display: inline-block;
299
  min-width: 1.5em;
@@ -307,7 +337,8 @@ table.dataTable td {
307
  border: 1px solid transparent;
308
  border-radius: 2px;
309
  }
310
- .dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
 
311
  color: #333 !important;
312
  border: 1px solid #979797;
313
  background-color: white;
@@ -324,14 +355,16 @@ table.dataTable td {
324
  background: linear-gradient(to bottom, white 0%, #dcdcdc 100%);
325
  /* W3C */
326
  }
327
- .dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
 
 
328
  cursor: default;
329
  color: #666 !important;
330
  border: 1px solid transparent;
331
  background: transparent;
332
  box-shadow: none;
333
  }
334
- .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
335
  color: white !important;
336
  border: 1px solid #111;
337
  background-color: #585858;
@@ -348,7 +381,7 @@ table.dataTable td {
348
  background: linear-gradient(to bottom, #585858 0%, #111 100%);
349
  /* W3C */
350
  }
351
- .dataTables_wrapper .dataTables_paginate .paginate_button:active {
352
  outline: none;
353
  background-color: #2b2b2b;
354
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));
@@ -365,10 +398,10 @@ table.dataTable td {
365
  /* W3C */
366
  box-shadow: inset 0 0 3px #111;
367
  }
368
- .dataTables_wrapper .dataTables_paginate .ellipsis {
369
  padding: 0 1em;
370
  }
371
- .dataTables_wrapper .dataTables_processing {
372
  position: absolute;
373
  top: 50%;
374
  left: 50%;
@@ -387,39 +420,43 @@ table.dataTable td {
387
  background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
388
  background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
389
  }
390
- .dataTables_wrapper .dataTables_length,
391
- .dataTables_wrapper .dataTables_filter,
392
- .dataTables_wrapper .dataTables_info,
393
- .dataTables_wrapper .dataTables_processing,
394
- .dataTables_wrapper .dataTables_paginate {
395
  color: #333;
396
  }
397
- .dataTables_wrapper .dataTables_scroll {
398
  clear: both;
399
  }
400
- .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody {
401
  *margin-top: -1px;
402
  -webkit-overflow-scrolling: touch;
403
  }
404
- .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td {
 
 
 
405
  vertical-align: middle;
406
  }
407
- .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th > div.dataTables_sizing,
408
- .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td > div.dataTables_sizing, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_sizing,
409
- .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td > div.dataTables_sizing {
 
410
  height: 0;
411
  overflow: hidden;
412
  margin: 0 !important;
413
  padding: 0 !important;
414
  }
415
- .dataTables_wrapper.no-footer .dataTables_scrollBody {
416
  border-bottom: 1px solid #111;
417
  }
418
- .dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,
419
- .dataTables_wrapper.no-footer div.dataTables_scrollBody > table {
420
  border-bottom: none;
421
  }
422
- .dataTables_wrapper:after {
423
  visibility: hidden;
424
  display: block;
425
  content: "";
@@ -428,22 +465,22 @@ table.dataTable td {
428
  }
429
 
430
  @media screen and (max-width: 767px) {
431
- .dataTables_wrapper .dataTables_info,
432
- .dataTables_wrapper .dataTables_paginate {
433
  float: none;
434
  text-align: center;
435
  }
436
- .dataTables_wrapper .dataTables_paginate {
437
  margin-top: 0.5em;
438
  }
439
  }
440
  @media screen and (max-width: 640px) {
441
- .dataTables_wrapper .dataTables_length,
442
- .dataTables_wrapper .dataTables_filter {
443
  float: none;
444
  text-align: center;
445
  }
446
- .dataTables_wrapper .dataTables_filter {
447
  margin-top: 0.5em;
448
  }
449
  }
@@ -452,24 +489,24 @@ table.dataTable td {
452
  * 2014-2016 SpryMedia Ltd - datatables.net/license
453
  */
454
 
455
- table.dataTable.dtr-inline.collapsed > tbody > tr > td.child,
456
- table.dataTable.dtr-inline.collapsed > tbody > tr > th.child,
457
- table.dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty {
458
  cursor: default !important;
459
  }
460
- table.dataTable.dtr-inline.collapsed > tbody > tr > td.child:before,
461
- table.dataTable.dtr-inline.collapsed > tbody > tr > th.child:before,
462
- table.dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty:before {
463
  display: none !important;
464
  }
465
- table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child,
466
- table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child {
467
  position: relative;
468
  padding-left: 30px;
469
  cursor: pointer;
470
  }
471
- table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before,
472
- table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before {
473
  top: 9px;
474
  left: 4px;
475
  height: 14px;
@@ -487,20 +524,20 @@ table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before {
487
  content: '+';
488
  background-color: #31b131;
489
  }
490
- table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before,
491
- table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before {
492
  content: '-';
493
  background-color: #d33333;
494
  }
495
- table.dataTable.dtr-inline.collapsed > tbody > tr.child td:before {
496
  display: none;
497
  }
498
- table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child,
499
- table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child {
500
  padding-left: 27px;
501
  }
502
- table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child:before,
503
- table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child:before {
504
  top: 5px;
505
  left: 4px;
506
  height: 14px;
@@ -509,13 +546,13 @@ table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child:befor
509
  line-height: 14px;
510
  text-indent: 3px;
511
  }
512
- table.dataTable.dtr-column > tbody > tr > td.control,
513
- table.dataTable.dtr-column > tbody > tr > th.control {
514
  position: relative;
515
  cursor: pointer;
516
  }
517
- table.dataTable.dtr-column > tbody > tr > td.control:before,
518
- table.dataTable.dtr-column > tbody > tr > th.control:before {
519
  top: 50%;
520
  left: 50%;
521
  height: 16px;
@@ -535,34 +572,34 @@ table.dataTable.dtr-column > tbody > tr > th.control:before {
535
  content: '+';
536
  background-color: #31b131;
537
  }
538
- table.dataTable.dtr-column > tbody > tr.parent td.control:before,
539
- table.dataTable.dtr-column > tbody > tr.parent th.control:before {
540
  content: '-';
541
  background-color: #d33333;
542
  }
543
- table.dataTable > tbody > tr.child {
544
  padding: 0.5em 1em;
545
  }
546
- table.dataTable > tbody > tr.child:hover {
547
  background: transparent !important;
548
  }
549
- table.dataTable > tbody > tr.child ul.dtr-details {
550
  display: inline-block;
551
  list-style-type: none;
552
  margin: 0;
553
  padding: 0;
554
  }
555
- table.dataTable > tbody > tr.child ul.dtr-details li {
556
  border-bottom: 1px solid #efefef;
557
  padding: 0.5em 0;
558
  }
559
- table.dataTable > tbody > tr.child ul.dtr-details li:first-child {
560
  padding-top: 0;
561
  }
562
- table.dataTable > tbody > tr.child ul.dtr-details li:last-child {
563
  border-bottom: none;
564
  }
565
- table.dataTable > tbody > tr.child span.dtr-title {
566
  display: inline-block;
567
  min-width: 75px;
568
  font-weight: bold;
1
  /*! DataTables 1.10.16
2
  * 2008-2017 SpryMedia Ltd - datatables.net/license
3
  */
4
+
5
+ table.ip-geo-block-dataTable {
6
  width: 100%;
7
  margin: 0 auto;
8
  clear: both;
15
  * Body styles
16
  */
17
  }
18
+ table.ip-geo-block-dataTable thead th,
19
+ table.ip-geo-block-dataTable tfoot th {
20
  font-weight: bold;
21
  }
22
+ table.ip-geo-block-dataTable thead th,
23
+ table.ip-geo-block-dataTable thead td {
24
  padding: 10px 18px;
25
  border-bottom: 1px solid #111;
26
  }
27
+ table.ip-geo-block-dataTable thead th:active,
28
+ table.ip-geo-block-dataTable thead td:active {
29
  outline: none;
30
  }
31
+ table.ip-geo-block-dataTable tfoot th,
32
+ table.ip-geo-block-dataTable tfoot td {
33
  padding: 10px 18px 6px 18px;
34
  border-top: 1px solid #111;
35
  }
36
+ table.ip-geo-block-dataTable thead .sorting,
37
+ table.ip-geo-block-dataTable thead .sorting_asc,
38
+ table.ip-geo-block-dataTable thead .sorting_desc,
39
+ table.ip-geo-block-dataTable thead .sorting_asc_disabled,
40
+ table.ip-geo-block-dataTable thead .sorting_desc_disabled {
41
  cursor: pointer;
42
  *cursor: hand;
43
  background-repeat: no-repeat;
44
  background-position: center right;
45
  }
46
+ table.ip-geo-block-dataTable thead .sorting {
47
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAAN0lEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpaQBhPES8gE/z0ElI9M9MA1+gAAD5jWGc4eZ87AAAAABJRU5ErkJggg==); /*url("../images/sort_both.png");*/
48
  }
49
+ table.ip-geo-block-dataTable thead .sorting_asc {
50
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAdUlEQVR4AWO4QyKgWMONG3eWrrh76xbRGtZvulPTdHfzVuI0nDl7p7XrblXD3Y7eu+fPE6FhwWKgaihasuIuAQ2Hj95pbENoqG+9e/QYbg3Xr9+ZPB2iFIGmzrp78yYODdt3gvxa24yCgCK79pAcD8NEw6gGAPv5+lejjyPQAAAAAElFTkSuQmCC); /*url("../images/sort_asc.png");*/
51
  }
52
+ table.ip-geo-block-dataTable thead .sorting_desc {
53
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAcklEQVR4AWO4QyIY2hpGNezac6em6W5tMwoCimzfiUPDzZt3ps66W9WAgiZPv3v9Om4nHT12p74Vobqx7e7ho4T8sGQFQsOCxXcJe/r8+TsdvSDVrV13z5wlLpQ2bwX5fv0mooP11q07S1fcvXFjACMOAM7v+leNDkNAAAAAAElFTkSuQmCC); /*url("../images/sort_desc.png");*/
54
  }
55
+ table.ip-geo-block-dataTable thead .sorting_asc_disabled {
56
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALklEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpZsDAJ6RRA0YNAAAd2DjFaOCLnQAAAABJRU5ErkJggg==); /*url("../images/sort_asc_disabled.png");*/
57
  }
58
+ table.ip-geo-block-dataTable thead .sorting_desc_disabled {
59
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALUlEQVR4AWO4c+cORZjqBowaMGrAf0KYlgYQNoToMMClma4GMKBrpqsB9E9IAFTzOMWpD7f6AAAAAElFTkSuQmCC); /*url("../images/sort_desc_disabled.png");*/
60
  }
61
+ table.ip-geo-block-dataTable tbody tr {
62
  background-color: #ffffff;
63
  }
64
+ table.ip-geo-block-dataTable tbody tr.selected {
65
  background-color: #B0BED9;
66
  }
67
+ table.ip-geo-block-dataTable tbody th,
68
+ table.ip-geo-block-dataTable tbody td {
69
  padding: 8px 10px;
70
  }
71
+ table.ip-geo-block-dataTable.row-border tbody th,
72
+ table.ip-geo-block-dataTable.row-border tbody td,
73
+ table.ip-geo-block-dataTable.display tbody th,
74
+ table.ip-geo-block-dataTable.display tbody td {
75
  border-top: 1px solid #ddd;
76
  }
77
+ table.ip-geo-block-dataTable.row-border tbody tr:first-child th,
78
+ table.ip-geo-block-dataTable.row-border tbody tr:first-child td,
79
+ table.ip-geo-block-dataTable.display tbody tr:first-child th,
80
+ table.ip-geo-block-dataTable.display tbody tr:first-child td {
81
  border-top: none;
82
  }
83
+ table.ip-geo-block-dataTable.cell-border tbody th,
84
+ table.ip-geo-block-dataTable.cell-border tbody td {
85
  border-top: 1px solid #ddd;
86
  border-right: 1px solid #ddd;
87
  }
88
+ table.ip-geo-block-dataTable.cell-border tbody tr th:first-child,
89
+ table.ip-geo-block-dataTable.cell-border tbody tr td:first-child {
90
  border-left: 1px solid #ddd;
91
  }
92
+ table.ip-geo-block-dataTable.cell-border tbody tr:first-child th,
93
+ table.ip-geo-block-dataTable.cell-border tbody tr:first-child td {
94
  border-top: none;
95
  }
96
+ table.ip-geo-block-dataTable.stripe tbody tr.odd,
97
+ table.ip-geo-block-dataTable.display tbody tr.odd {
98
  background-color: #f9f9f9;
99
  }
100
+ table.ip-geo-block-dataTable.stripe tbody tr.odd.selected,
101
+ table.ip-geo-block-dataTable.display tbody tr.odd.selected {
102
  background-color: #acbad4;
103
  }
104
+ table.ip-geo-block-dataTable.hover tbody tr:hover,
105
+ table.ip-geo-block-dataTable.display tbody tr:hover {
106
  background-color: #f6f6f6;
107
  }
108
+ table.ip-geo-block-dataTable.hover tbody tr:hover.selected,
109
+ table.ip-geo-block-dataTable.display tbody tr:hover.selected {
110
  background-color: #aab7d1;
111
  }
112
+ table.ip-geo-block-dataTable.order-column tbody tr > .sorting_1,
113
+ table.ip-geo-block-dataTable.order-column tbody tr > .sorting_2,
114
+ table.ip-geo-block-dataTable.order-column tbody tr > .sorting_3,
115
+ table.ip-geo-block-dataTable.display tbody tr > .sorting_1,
116
+ table.ip-geo-block-dataTable.display tbody tr > .sorting_2,
117
+ table.ip-geo-block-dataTable.display tbody tr > .sorting_3 {
118
  background-color: #fafafa;
119
  }
120
+ table.ip-geo-block-dataTable.order-column tbody tr.selected > .sorting_1,
121
+ table.ip-geo-block-dataTable.order-column tbody tr.selected > .sorting_2,
122
+ table.ip-geo-block-dataTable.order-column tbody tr.selected > .sorting_3,
123
+ table.ip-geo-block-dataTable.display tbody tr.selected > .sorting_1,
124
+ table.ip-geo-block-dataTable.display tbody tr.selected > .sorting_2,
125
+ table.ip-geo-block-dataTable.display tbody tr.selected > .sorting_3 {
126
  background-color: #acbad5;
127
  }
128
+ table.ip-geo-block-dataTable.display tbody tr.odd > .sorting_1,
129
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd > .sorting_1 {
130
  background-color: #f1f1f1;
131
  }
132
+ table.ip-geo-block-dataTable.display tbody tr.odd > .sorting_2,
133
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd > .sorting_2 {
134
  background-color: #f3f3f3;
135
  }
136
+ table.ip-geo-block-dataTable.display tbody tr.odd > .sorting_3,
137
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd > .sorting_3 {
138
  background-color: whitesmoke;
139
  }
140
+ table.ip-geo-block-dataTable.display tbody tr.odd.selected > .sorting_1,
141
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 {
142
  background-color: #a6b4cd;
143
  }
144
+ table.ip-geo-block-dataTable.display tbody tr.odd.selected > .sorting_2,
145
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 {
146
  background-color: #a8b5cf;
147
  }
148
+ table.ip-geo-block-dataTable.display tbody tr.odd.selected > .sorting_3,
149
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 {
150
  background-color: #a9b7d1;
151
  }
152
+ table.ip-geo-block-dataTable.display tbody tr.even > .sorting_1,
153
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.even > .sorting_1 {
154
  background-color: #fafafa;
155
  }
156
+ table.ip-geo-block-dataTable.display tbody tr.even > .sorting_2,
157
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.even > .sorting_2 {
158
  background-color: #fcfcfc;
159
  }
160
+ table.ip-geo-block-dataTable.display tbody tr.even > .sorting_3,
161
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.even > .sorting_3 {
162
  background-color: #fefefe;
163
  }
164
+ table.ip-geo-block-dataTable.display tbody tr.even.selected > .sorting_1,
165
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 {
166
  background-color: #acbad5;
167
  }
168
+ table.ip-geo-block-dataTable.display tbody tr.even.selected > .sorting_2,
169
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 {
170
  background-color: #aebcd6;
171
  }
172
+ table.ip-geo-block-dataTable.display tbody tr.even.selected > .sorting_3,
173
+ table.ip-geo-block-dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 {
174
  background-color: #afbdd8;
175
  }
176
+ table.ip-geo-block-dataTable.display tbody tr:hover > .sorting_1,
177
+ table.ip-geo-block-dataTable.order-column.hover tbody tr:hover > .sorting_1 {
178
  background-color: #eaeaea;
179
  }
180
+ table.ip-geo-block-dataTable.display tbody tr:hover > .sorting_2,
181
+ table.ip-geo-block-dataTable.order-column.hover tbody tr:hover > .sorting_2 {
182
  background-color: #ececec;
183
  }
184
+ table.ip-geo-block-dataTable.display tbody tr:hover > .sorting_3,
185
+ table.ip-geo-block-dataTable.order-column.hover tbody tr:hover > .sorting_3 {
186
  background-color: #efefef;
187
  }
188
+ table.ip-geo-block-dataTable.display tbody tr:hover.selected > .sorting_1,
189
+ table.ip-geo-block-dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 {
190
  background-color: #a2aec7;
191
  }
192
+ table.ip-geo-block-dataTable.display tbody tr:hover.selected > .sorting_2,
193
+ table.ip-geo-block-dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 {
194
  background-color: #a3b0c9;
195
  }
196
+ table.ip-geo-block-dataTable.display tbody tr:hover.selected > .sorting_3,
197
+ table.ip-geo-block-dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 {
198
  background-color: #a5b2cb;
199
  }
200
+ table.ip-geo-block-dataTable.no-footer {
201
  border-bottom: 1px solid #111;
202
  }
203
+ table.ip-geo-block-dataTable.nowrap th,
204
+ table.ip-geo-block-dataTable.nowrap td {
205
  white-space: nowrap;
206
  }
207
+ table.ip-geo-block-dataTable.compact thead th,
208
+ table.ip-geo-block-dataTable.compact thead td {
209
  padding: 4px 17px 4px 4px;
210
  }
211
+ table.ip-geo-block-dataTable.compact tfoot th,
212
+ table.ip-geo-block-dataTable.compact tfoot td {
213
  padding: 4px;
214
  }
215
+ table.ip-geo-block-dataTable.compact tbody th,
216
+ table.ip-geo-block-dataTable.compact tbody td {
217
  padding: 4px;
218
  }
219
+ table.ip-geo-block-dataTable th.dt-left,
220
+ table.ip-geo-block-dataTable td.dt-left {
221
  text-align: left;
222
  }
223
+ table.ip-geo-block-dataTable th.dt-center,
224
+ table.ip-geo-block-dataTable td.dt-center,
225
+ table.ip-geo-block-dataTable td.dataTables_empty {
226
  text-align: center;
227
  }
228
+ table.ip-geo-block-dataTable th.dt-right,
229
+ table.ip-geo-block-dataTable td.dt-right {
230
  text-align: right;
231
  }
232
+ table.ip-geo-block-dataTable th.dt-justify,
233
+ table.ip-geo-block-dataTable td.dt-justify {
234
  text-align: justify;
235
  }
236
+ table.ip-geo-block-dataTable th.dt-nowrap,
237
+ table.ip-geo-block-dataTable td.dt-nowrap {
238
  white-space: nowrap;
239
  }
240
+ table.ip-geo-block-dataTable thead th.dt-head-left,
241
+ table.ip-geo-block-dataTable thead td.dt-head-left,
242
+ table.ip-geo-block-dataTable tfoot th.dt-head-left,
243
+ table.ip-geo-block-dataTable tfoot td.dt-head-left {
244
  text-align: left;
245
  }
246
+ table.ip-geo-block-dataTable thead th.dt-head-center,
247
+ table.ip-geo-block-dataTable thead td.dt-head-center,
248
+ table.ip-geo-block-dataTable tfoot th.dt-head-center,
249
+ table.ip-geo-block-dataTable tfoot td.dt-head-center {
250
  text-align: center;
251
  }
252
+ table.ip-geo-block-dataTable thead th.dt-head-right,
253
+ table.ip-geo-block-dataTable thead td.dt-head-right,
254
+ table.ip-geo-block-dataTable tfoot th.dt-head-right,
255
+ table.ip-geo-block-dataTable tfoot td.dt-head-right {
256
  text-align: right;
257
  }
258
+ table.ip-geo-block-dataTable thead th.dt-head-justify,
259
+ table.ip-geo-block-dataTable thead td.dt-head-justify,
260
+ table.ip-geo-block-dataTable tfoot th.dt-head-justify,
261
+ table.ip-geo-block-dataTable tfoot td.dt-head-justify {
262
  text-align: justify;
263
  }
264
+ table.ip-geo-block-dataTable thead th.dt-head-nowrap,
265
+ table.ip-geo-block-dataTable thead td.dt-head-nowrap,
266
+ table.ip-geo-block-dataTable tfoot th.dt-head-nowrap,
267
+ table.ip-geo-block-dataTable tfoot td.dt-head-nowrap {
268
  white-space: nowrap;
269
  }
270
+ table.ip-geo-block-dataTable tbody th.dt-body-left,
271
+ table.ip-geo-block-dataTable tbody td.dt-body-left {
272
  text-align: left;
273
  }
274
+ table.ip-geo-block-dataTable tbody th.dt-body-center,
275
+ table.ip-geo-block-dataTable tbody td.dt-body-center {
276
  text-align: center;
277
  }
278
+ table.ip-geo-block-dataTable tbody th.dt-body-right,
279
+ table.ip-geo-block-dataTable tbody td.dt-body-right {
280
  text-align: right;
281
  }
282
+ table.ip-geo-block-dataTable tbody th.dt-body-justify,
283
+ table.ip-geo-block-dataTable tbody td.dt-body-justify {
284
  text-align: justify;
285
  }
286
+ table.ip-geo-block-dataTable tbody th.dt-body-nowrap,
287
+ table.ip-geo-block-dataTable tbody td.dt-body-nowrap {
288
  white-space: nowrap;
289
  }
290
 
291
+ table.ip-geo-block-dataTable,
292
+ table.ip-geo-block-dataTable th,
293
+ table.ip-geo-block-dataTable td {
294
  box-sizing: content-box;
295
  }
296
 
297
  /*
298
  * Control feature layout
299
  */
300
+ div[class*="ip-geo-block"] .dataTables_wrapper {
301
  position: relative;
302
  clear: both;
303
  *zoom: 1;
304
  zoom: 1;
305
  }
306
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_length {
307
  float: left;
308
  }
309
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter {
310
  float: right;
311
  text-align: right;
312
  }
313
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter input {
314
  margin-left: 0.5em;
315
  }
316
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_info {
317
  clear: both;
318
  float: left;
319
  padding-top: 0.755em;
320
  }
321
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate {
322
  float: right;
323
  text-align: right;
324
  padding-top: 0.25em;
325
  }
326
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button {
327
  box-sizing: border-box;
328
  display: inline-block;
329
  min-width: 1.5em;
337
  border: 1px solid transparent;
338
  border-radius: 2px;
339
  }
340
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
341
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
342
  color: #333 !important;
343
  border: 1px solid #979797;
344
  background-color: white;
355
  background: linear-gradient(to bottom, white 0%, #dcdcdc 100%);
356
  /* W3C */
357
  }
358
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
359
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
360
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
361
  cursor: default;
362
  color: #666 !important;
363
  border: 1px solid transparent;
364
  background: transparent;
365
  box-shadow: none;
366
  }
367
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
368
  color: white !important;
369
  border: 1px solid #111;
370
  background-color: #585858;
381
  background: linear-gradient(to bottom, #585858 0%, #111 100%);
382
  /* W3C */
383
  }
384
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .paginate_button:active {
385
  outline: none;
386
  background-color: #2b2b2b;
387
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));
398
  /* W3C */
399
  box-shadow: inset 0 0 3px #111;
400
  }
401
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate .ellipsis {
402
  padding: 0 1em;
403
  }
404
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_processing {
405
  position: absolute;
406
  top: 50%;
407
  left: 50%;
420
  background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
421
  background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
422
  }
423
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_length,
424
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter,
425
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_info,
426
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_processing,
427
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate {
428
  color: #333;
429
  }
430
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll {
431
  clear: both;
432
  }
433
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody {
434
  *margin-top: -1px;
435
  -webkit-overflow-scrolling: touch;
436
  }
437
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th,
438
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td,
439
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th,
440
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td {
441
  vertical-align: middle;
442
  }
443
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th > div.dataTables_sizing,
444
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td > div.dataTables_sizing,
445
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_sizing,
446
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td > div.dataTables_sizing {
447
  height: 0;
448
  overflow: hidden;
449
  margin: 0 !important;
450
  padding: 0 !important;
451
  }
452
+ div[class*="ip-geo-block"] .dataTables_wrapper.no-footer .dataTables_scrollBody {
453
  border-bottom: 1px solid #111;
454
  }
455
+ div[class*="ip-geo-block"] .dataTables_wrapper.no-footer div.dataTables_scrollHead table.ip-geo-block-dataTable,
456
+ div[class*="ip-geo-block"] .dataTables_wrapper.no-footer div.dataTables_scrollBody > table {
457
  border-bottom: none;
458
  }
459
+ div[class*="ip-geo-block"] .dataTables_wrapper:after {
460
  visibility: hidden;
461
  display: block;
462
  content: "";
465
  }
466
 
467
  @media screen and (max-width: 767px) {
468
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_info,
469
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate {
470
  float: none;
471
  text-align: center;
472
  }
473
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_paginate {
474
  margin-top: 0.5em;
475
  }
476
  }
477
  @media screen and (max-width: 640px) {
478
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_length,
479
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter {
480
  float: none;
481
  text-align: center;
482
  }
483
+ div[class*="ip-geo-block"] .dataTables_wrapper .dataTables_filter {
484
  margin-top: 0.5em;
485
  }
486
  }
489
  * 2014-2016 SpryMedia Ltd - datatables.net/license
490
  */
491
 
492
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td.child,
493
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > th.child,
494
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty {
495
  cursor: default !important;
496
  }
497
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td.child:before,
498
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > th.child:before,
499
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td.dataTables_empty:before {
500
  display: none !important;
501
  }
502
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td:first-child,
503
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > th:first-child {
504
  position: relative;
505
  padding-left: 30px;
506
  cursor: pointer;
507
  }
508
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before,
509
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before {
510
  top: 9px;
511
  left: 4px;
512
  height: 14px;
524
  content: '+';
525
  background-color: #31b131;
526
  }
527
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before,
528
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before {
529
  content: '-';
530
  background-color: #d33333;
531
  }
532
+ table.ip-geo-block-dataTable.dtr-inline.collapsed > tbody > tr.child td:before {
533
  display: none;
534
  }
535
+ table.ip-geo-block-dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child,
536
+ table.ip-geo-block-dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child {
537
  padding-left: 27px;
538
  }
539
+ table.ip-geo-block-dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child:before,
540
+ table.ip-geo-block-dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child:before {
541
  top: 5px;
542
  left: 4px;
543
  height: 14px;
546
  line-height: 14px;
547
  text-indent: 3px;
548
  }
549
+ table.ip-geo-block-dataTable.dtr-column > tbody > tr > td.control,
550
+ table.ip-geo-block-dataTable.dtr-column > tbody > tr > th.control {
551
  position: relative;
552
  cursor: pointer;
553
  }
554
+ table.ip-geo-block-dataTable.dtr-column > tbody > tr > td.control:before,
555
+ table.ip-geo-block-dataTable.dtr-column > tbody > tr > th.control:before {
556
  top: 50%;
557
  left: 50%;
558
  height: 16px;
572
  content: '+';
573
  background-color: #31b131;
574
  }
575
+ table.ip-geo-block-dataTable.dtr-column > tbody > tr.parent td.control:before,
576
+ table.ip-geo-block-dataTable.dtr-column > tbody > tr.parent th.control:before {
577
  content: '-';
578
  background-color: #d33333;
579
  }
580
+ table.ip-geo-block-dataTable > tbody > tr.child {
581
  padding: 0.5em 1em;
582
  }
583
+ table.ip-geo-block-dataTable > tbody > tr.child:hover {
584
  background: transparent !important;
585
  }
586
+ table.ip-geo-block-dataTable > tbody > tr.child ul.dtr-details {
587
  display: inline-block;
588
  list-style-type: none;
589
  margin: 0;
590
  padding: 0;
591
  }
592
+ table.ip-geo-block-dataTable > tbody > tr.child ul.dtr-details li {
593
  border-bottom: 1px solid #efefef;
594
  padding: 0.5em 0;
595
  }
596
+ table.ip-geo-block-dataTable > tbody > tr.child ul.dtr-details li:first-child {
597
  padding-top: 0;
598
  }
599
+ table.ip-geo-block-dataTable > tbody > tr.child ul.dtr-details li:last-child {
600
  border-bottom: none;
601
  }
602
+ table.ip-geo-block-dataTable > tbody > tr.child span.dtr-title {
603
  display: inline-block;
604
  min-width: 75px;
605
  font-weight: bold;
admin/datatables/css/datatables-all.min.css CHANGED
@@ -1,13 +1,15 @@
1
  /*! DataTables 1.10.16
2
  * 2008-2017 SpryMedia Ltd - datatables.net/license
3
  */
4
- table.dataTable{width:100%;margin:0 auto;clear:both;border-collapse:separate;border-spacing:0}table.dataTable thead th,table.dataTable tfoot th{font-weight:bold}table.dataTable thead th,table.dataTable thead td{padding:10px 18px;border-bottom:1px solid #111}table.dataTable thead th:active,table.dataTable thead td:active{outline:none}table.dataTable tfoot th,table.dataTable tfoot td{padding:10px 18px 6px 18px;border-top:1px solid #111}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;*cursor:hand;background-repeat:no-repeat;background-position:center right}table.dataTable thead .sorting{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAAN0lEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpaQBhPES8gE/z0ElI9M9MA1+gAAD5jWGc4eZ87AAAAABJRU5ErkJggg==)}table.dataTable thead .sorting_asc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAdUlEQVR4AWO4QyKgWMONG3eWrrh76xbRGtZvulPTdHfzVuI0nDl7p7XrblXD3Y7eu+fPE6FhwWKgaihasuIuAQ2Hj95pbENoqG+9e/QYbg3Xr9+ZPB2iFIGmzrp78yYODdt3gvxa24yCgCK79pAcD8NEw6gGAPv5+lejjyPQAAAAAElFTkSuQmCC)}table.dataTable thead .sorting_desc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAcklEQVR4AWO4QyIY2hpGNezac6em6W5tMwoCimzfiUPDzZt3ps66W9WAgiZPv3v9Om4nHT12p74Vobqx7e7ho4T8sGQFQsOCxXcJe/r8+TsdvSDVrV13z5wlLpQ2bwX5fv0mooP11q07S1fcvXFjACMOAM7v+leNDkNAAAAAAElFTkSuQmCC)}table.dataTable thead .sorting_asc_disabled{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALklEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpZsDAJ6RRA0YNAAAd2DjFaOCLnQAAAABJRU5ErkJggg==)}table.dataTable thead .sorting_desc_disabled{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALUlEQVR4AWO4c+cORZjqBowaMGrAf0KYlgYQNoToMMClma4GMKBrpqsB9E9IAFTzOMWpD7f6AAAAAElFTkSuQmCC)}table.dataTable tbody tr{background-color:#ffffff}table.dataTable tbody tr.selected{background-color:#B0BED9}table.dataTable tbody th,table.dataTable tbody td{padding:8px 10px}table.dataTable.row-border tbody th,table.dataTable.row-border tbody td,table.dataTable.display tbody th,table.dataTable.display tbody td{border-top:1px solid #ddd}table.dataTable.row-border tbody tr:first-child th,table.dataTable.row-border tbody tr:first-child td,table.dataTable.display tbody tr:first-child th,table.dataTable.display tbody tr:first-child td{border-top:none}table.dataTable.cell-border tbody th,table.dataTable.cell-border tbody td{border-top:1px solid #ddd;border-right:1px solid #ddd}table.dataTable.cell-border tbody tr th:first-child,table.dataTable.cell-border tbody tr td:first-child{border-left:1px solid #ddd}table.dataTable.cell-border tbody tr:first-child th,table.dataTable.cell-border tbody tr:first-child td{border-top:none}table.dataTable.stripe tbody tr.odd,table.dataTable.display tbody tr.odd{background-color:#f9f9f9}table.dataTable.stripe tbody tr.odd.selected,table.dataTable.display tbody tr.odd.selected{background-color:#acbad4}table.dataTable.hover tbody tr:hover,table.dataTable.display tbody tr:hover{background-color:#f6f6f6}table.dataTable.hover tbody tr:hover.selected,table.dataTable.display tbody tr:hover.selected{background-color:#aab7d1}table.dataTable.order-column tbody tr>.sorting_1,table.dataTable.order-column tbody tr>.sorting_2,table.dataTable.order-column tbody tr>.sorting_3,table.dataTable.display tbody tr>.sorting_1,table.dataTable.display tbody tr>.sorting_2,table.dataTable.display tbody tr>.sorting_3{background-color:#fafafa}table.dataTable.order-column tbody tr.selected>.sorting_1,table.dataTable.order-column tbody tr.selected>.sorting_2,table.dataTable.order-column tbody tr.selected>.sorting_3,table.dataTable.display tbody tr.selected>.sorting_1,table.dataTable.display tbody tr.selected>.sorting_2,table.dataTable.display tbody tr.selected>.sorting_3{background-color:#acbad5}table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd>.sorting_1{background-color:#f1f1f1}table.dataTable.display tbody tr.odd>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd>.sorting_2{background-color:#f3f3f3}table.dataTable.display tbody tr.odd>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd>.sorting_3{background-color:whitesmoke}table.dataTable.display tbody tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.dataTable.display tbody tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.dataTable.display tbody tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.order-column.stripe tbody tr.even>.sorting_1{background-color:#fafafa}table.dataTable.display tbody tr.even>.sorting_2,table.dataTable.order-column.stripe tbody tr.even>.sorting_2{background-color:#fcfcfc}table.dataTable.display tbody tr.even>.sorting_3,table.dataTable.order-column.stripe tbody tr.even>.sorting_3{background-color:#fefefe}table.dataTable.display tbody tr.even.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_1{background-color:#acbad5}table.dataTable.display tbody tr.even.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_2{background-color:#aebcd6}table.dataTable.display tbody tr.even.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_3{background-color:#afbdd8}table.dataTable.display tbody tr:hover>.sorting_1,table.dataTable.order-column.hover tbody tr:hover>.sorting_1{background-color:#eaeaea}table.dataTable.display tbody tr:hover>.sorting_2,table.dataTable.order-column.hover tbody tr:hover>.sorting_2{background-color:#ececec}table.dataTable.display tbody tr:hover>.sorting_3,table.dataTable.order-column.hover tbody tr:hover>.sorting_3{background-color:#efefef}table.dataTable.display tbody tr:hover.selected>.sorting_1,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{background-color:#a2aec7}table.dataTable.display tbody tr:hover.selected>.sorting_2,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{background-color:#a3b0c9}table.dataTable.display tbody tr:hover.selected>.sorting_3,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{background-color:#a5b2cb}table.dataTable.no-footer{border-bottom:1px solid #111}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}table.dataTable.compact thead th,table.dataTable.compact thead td{padding:4px 17px 4px 4px}table.dataTable.compact tfoot th,table.dataTable.compact tfoot td{padding:4px}table.dataTable.compact tbody th,table.dataTable.compact tbody td{padding:4px}table.dataTable th.dt-left,table.dataTable td.dt-left{text-align:left}table.dataTable th.dt-center,table.dataTable td.dt-center,table.dataTable td.dataTables_empty{text-align:center}table.dataTable th.dt-right,table.dataTable td.dt-right{text-align:right}table.dataTable th.dt-justify,table.dataTable td.dt-justify{text-align:justify}table.dataTable th.dt-nowrap,table.dataTable td.dt-nowrap{white-space:nowrap}table.dataTable thead th.dt-head-left,table.dataTable thead td.dt-head-left,table.dataTable tfoot th.dt-head-left,table.dataTable tfoot td.dt-head-left{text-align:left}table.dataTable thead th.dt-head-center,table.dataTable thead td.dt-head-center,table.dataTable tfoot th.dt-head-center,table.dataTable tfoot td.dt-head-center{text-align:center}table.dataTable thead th.dt-head-right,table.dataTable thead td.dt-head-right,table.dataTable tfoot th.dt-head-right,table.dataTable tfoot td.dt-head-right{text-align:right}table.dataTable thead th.dt-head-justify,table.dataTable thead td.dt-head-justify,table.dataTable tfoot th.dt-head-justify,table.dataTable tfoot td.dt-head-justify{text-align:justify}table.dataTable thead th.dt-head-nowrap,table.dataTable thead td.dt-head-nowrap,table.dataTable tfoot th.dt-head-nowrap,table.dataTable tfoot td.dt-head-nowrap{white-space:nowrap}table.dataTable tbody th.dt-body-left,table.dataTable tbody td.dt-body-left{text-align:left}table.dataTable tbody th.dt-body-center,table.dataTable tbody td.dt-body-center{text-align:center}table.dataTable tbody th.dt-body-right,table.dataTable tbody td.dt-body-right{text-align:right}table.dataTable tbody th.dt-body-justify,table.dataTable tbody td.dt-body-justify{text-align:justify}table.dataTable tbody th.dt-body-nowrap,table.dataTable tbody td.dt-body-nowrap{white-space:nowrap}table.dataTable,table.dataTable th,table.dataTable td{box-sizing:content-box}.dataTables_wrapper{position:relative;clear:both;*zoom:1;zoom:1}.dataTables_wrapper .dataTables_length{float:left}.dataTables_wrapper .dataTables_filter{float:right;text-align:right}.dataTables_wrapper .dataTables_filter input{margin-left:0.5em}.dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:0.755em}.dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:0.25em}.dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:0.5em 1em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;color:#333 !important;border:1px solid transparent;border-radius:2px}.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:#333 !important;border:1px solid #979797;background-color:white;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(100%, #dcdcdc));background:-webkit-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-moz-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-ms-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-o-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:linear-gradient(to bottom, #fff 0%, #dcdcdc 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active{cursor:default;color:#666 !important;border:1px solid transparent;background:transparent;box-shadow:none}.dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:white !important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));background:-webkit-linear-gradient(top, #585858 0%, #111 100%);background:-moz-linear-gradient(top, #585858 0%, #111 100%);background:-ms-linear-gradient(top, #585858 0%, #111 100%);background:-o-linear-gradient(top, #585858 0%, #111 100%);background:linear-gradient(to bottom, #585858 0%, #111 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:none;background-color:#2b2b2b;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));background:-webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);box-shadow:inset 0 0 3px #111}.dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}.dataTables_wrapper .dataTables_processing{position:absolute;top:50%;left:50%;width:100%;height:40px;margin-left:-50%;margin-top:-25px;padding-top:20px;text-align:center;font-size:1.2em;background-color:white;background:-webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0)));background:-webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%)}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:#333}.dataTables_wrapper .dataTables_scroll{clear:both}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td{vertical-align:middle}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td>div.dataTables_sizing{height:0;overflow:hidden;margin:0 !important;padding:0 !important}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid #111}.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,.dataTables_wrapper.no-footer div.dataTables_scrollBody>table{border-bottom:none}.dataTables_wrapper:after{visibility:hidden;display:block;content:"";clear:both;height:0}@media screen and (max-width: 767px){.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_paginate{float:none;text-align:center}.dataTables_wrapper .dataTables_paginate{margin-top:0.5em}}@media screen and (max-width: 640px){.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none;text-align:center}.dataTables_wrapper .dataTables_filter{margin-top:0.5em}}
 
5
  /*! Responsive 2.1.1
6
  * 2014-2016 SpryMedia Ltd - datatables.net/license
7
  */
8
- table.dataTable.dtr-inline.collapsed>tbody>tr>td.child,table.dataTable.dtr-inline.collapsed>tbody>tr>th.child,table.dataTable.dtr-inline.collapsed>tbody>tr>td.dataTables_empty{cursor:default !important}table.dataTable.dtr-inline.collapsed>tbody>tr>td.child:before,table.dataTable.dtr-inline.collapsed>tbody>tr>th.child:before,table.dataTable.dtr-inline.collapsed>tbody>tr>td.dataTables_empty:before{display:none !important}table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child,table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child{position:relative;padding-left:30px;cursor:pointer}table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before,table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child:before{top:9px;left:4px;height:14px;width:14px;display:block;position:absolute;color:white;border:2px solid white;border-radius:14px;box-shadow:0 0 3px #444;box-sizing:content-box;text-align:center;font-family:'Courier New', Courier, monospace;line-height:14px;content:'+';background-color:#31b131}table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before,table.dataTable.dtr-inline.collapsed>tbody>tr.parent>th:first-child:before{content:'-';background-color:#d33333}table.dataTable.dtr-inline.collapsed>tbody>tr.child td:before{display:none}table.dataTable.dtr-inline.collapsed.compact>tbody>tr>td:first-child,table.dataTable.dtr-inline.collapsed.compact>tbody>tr>th:first-child{padding-left:27px}table.dataTable.dtr-inline.collapsed.compact>tbody>tr>td:first-child:before,table.dataTable.dtr-inline.collapsed.compact>tbody>tr>th:first-child:before{top:5px;left:4px;height:14px;width:14px;border-radius:14px;line-height:14px;text-indent:3px}table.dataTable.dtr-column>tbody>tr>td.control,table.dataTable.dtr-column>tbody>tr>th.control{position:relative;cursor:pointer}table.dataTable.dtr-column>tbody>tr>td.control:before,table.dataTable.dtr-column>tbody>tr>th.control:before{top:50%;left:50%;height:16px;width:16px;margin-top:-10px;margin-left:-10px;display:block;position:absolute;color:white;border:2px solid white;border-radius:14px;box-shadow:0 0 3px #444;box-sizing:content-box;text-align:center;font-family:'Courier New', Courier, monospace;line-height:14px;content:'+';background-color:#31b131}table.dataTable.dtr-column>tbody>tr.parent td.control:before,table.dataTable.dtr-column>tbody>tr.parent th.control:before{content:'-';background-color:#d33333}table.dataTable>tbody>tr.child{padding:0.5em 1em}table.dataTable>tbody>tr.child:hover{background:transparent !important}table.dataTable>tbody>tr.child ul.dtr-details{display:inline-block;list-style-type:none;margin:0;padding:0}table.dataTable>tbody>tr.child ul.dtr-details li{border-bottom:1px solid #efefef;padding:0.5em 0}table.dataTable>tbody>tr.child ul.dtr-details li:first-child{padding-top:0}table.dataTable>tbody>tr.child ul.dtr-details li:last-child{border-bottom:none}table.dataTable>tbody>tr.child span.dtr-title{display:inline-block;min-width:75px;font-weight:bold}div.dtr-modal{position:fixed;box-sizing:border-box;top:0;left:0;height:100%;width:100%;z-index:100;padding:10em 1em}div.dtr-modal div.dtr-modal-display{position:absolute;top:0;left:0;bottom:0;right:0;width:50%;height:50%;overflow:auto;margin:auto;z-index:102;overflow:auto;background-color:#f5f5f7;border:1px solid black;border-radius:0.5em;box-shadow:0 12px 30px rgba(0,0,0,0.6)}div.dtr-modal div.dtr-modal-content{position:relative;padding:1em}div.dtr-modal div.dtr-modal-close{position:absolute;top:6px;right:6px;width:22px;height:22px;border:1px solid #eaeaea;background-color:#f9f9f9;text-align:center;border-radius:3px;cursor:pointer;z-index:12}div.dtr-modal div.dtr-modal-close:hover{background-color:#eaeaea}div.dtr-modal div.dtr-modal-background{position:fixed;top:0;left:0;right:0;bottom:0;z-index:101;background:rgba(0,0,0,0.6)}@media screen and (max-width: 767px){div.dtr-modal div.dtr-modal-display{width:95%}}
 
9
  /*! datatables.mark.js v2.0.1
10
  * Copyright (c) 2016-2017 Julian Motz
11
  * https://github.com/julmot/datatables.mark.js/blob/master/LICENSE
12
  */
13
- mark{background:orange;color:black;}
1
  /*! DataTables 1.10.16
2
  * 2008-2017 SpryMedia Ltd - datatables.net/license
3
  */
4
+ table.ip-geo-block-dataTable tbody td.dt-body-nowrap,table.ip-geo-block-dataTable tbody th.dt-body-nowrap,table.ip-geo-block-dataTable td.dt-nowrap,table.ip-geo-block-dataTable tfoot td.dt-head-nowrap,table.ip-geo-block-dataTable tfoot th.dt-head-nowrap,table.ip-geo-block-dataTable th.dt-nowrap,table.ip-geo-block-dataTable thead td.dt-head-nowrap,table.ip-geo-block-dataTable thead th.dt-head-nowrap,table.ip-geo-block-dataTable.nowrap td,table.ip-geo-block-dataTable.nowrap th{white-space:nowrap}table.ip-geo-block-dataTable{width:100%;margin:0 auto;clear:both;border-collapse:separate;border-spacing:0}table.ip-geo-block-dataTable tfoot th,table.ip-geo-block-dataTable thead th{font-weight:700}table.ip-geo-block-dataTable thead td,table.ip-geo-block-dataTable thead th{padding:10px 18px;border-bottom:1px solid #111}table.ip-geo-block-dataTable thead td:active,table.ip-geo-block-dataTable thead th:active{outline:0}table.ip-geo-block-dataTable tfoot td,table.ip-geo-block-dataTable tfoot th{padding:10px 18px 6px;border-top:1px solid #111}table.ip-geo-block-dataTable thead .sorting,table.ip-geo-block-dataTable thead .sorting_asc,table.ip-geo-block-dataTable thead .sorting_asc_disabled,table.ip-geo-block-dataTable thead .sorting_desc,table.ip-geo-block-dataTable thead .sorting_desc_disabled{cursor:pointer;background-repeat:no-repeat;background-position:center right}table.ip-geo-block-dataTable thead .sorting{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAAN0lEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpaQBhPES8gE/z0ElI9M9MA1+gAAD5jWGc4eZ87AAAAABJRU5ErkJggg==)}table.ip-geo-block-dataTable thead .sorting_asc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAdUlEQVR4AWO4QyKgWMONG3eWrrh76xbRGtZvulPTdHfzVuI0nDl7p7XrblXD3Y7eu+fPE6FhwWKgaihasuIuAQ2Hj95pbENoqG+9e/QYbg3Xr9+ZPB2iFIGmzrp78yYODdt3gvxa24yCgCK79pAcD8NEw6gGAPv5+lejjyPQAAAAAElFTkSuQmCC)}table.ip-geo-block-dataTable thead .sorting_desc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAIAAAAWBRqYAAAABnRSTlMA3ADcANwpVcdiAAAAcklEQVR4AWO4QyIY2hpGNezac6em6W5tMwoCimzfiUPDzZt3ps66W9WAgiZPv3v9Om4nHT12p74Vobqx7e7ho4T8sGQFQsOCxXcJe/r8+TsdvSDVrV13z5wlLpQ2bwX5fv0mooP11q07S1fcvXFjACMOAM7v+leNDkNAAAAAAElFTkSuQmCC)}table.ip-geo-block-dataTable thead .sorting_asc_disabled{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALklEQVR4AWO4c+cORZhmBvyH4QEx4D86pqsB/3Fjwgb8J4RpZsDAJ6RRA0YNAAAd2DjFaOCLnQAAAABJRU5ErkJggg==)}table.ip-geo-block-dataTable thead .sorting_desc_disabled{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAATCAYAAACZZ43PAAAALUlEQVR4AWO4c+cORZjqBowaMGrAf0KYlgYQNoToMMClma4GMKBrpqsB9E9IAFTzOMWpD7f6AAAAAElFTkSuQmCC)}table.ip-geo-block-dataTable tbody tr{background-color:#fff}table.ip-geo-block-dataTable tbody tr.selected{background-color:#B0BED9}table.ip-geo-block-dataTable tbody td,table.ip-geo-block-dataTable tbody th{padding:8px 10px}table.ip-geo-block-dataTable.display tbody td,table.ip-geo-block-dataTable.display tbody th,table.ip-geo-block-dataTable.row-border tbody td,table.ip-geo-block-dataTable.row-border tbody th{border-top:1px solid #ddd}table.ip-geo-block-dataTable.display tbody tr:first-child td,table.ip-geo-block-dataTable.display tbody tr:first-child th,table.ip-geo-block-dataTable.row-border tbody tr:first-child td,table.ip-geo-block-dataTable.row-border tbody tr:first-child th{border-top:none}table.ip-geo-block-dataTable.cell-border tbody td,table.ip-geo-block-dataTable.cell-border tbody th{border-top:1px solid #ddd;border-right:1px solid #ddd}table.ip-geo-block-dataTable.cell-border tbody tr td:first-child,table.ip-geo-block-dataTable.cell-border tbody tr th:first-child{border-left:1px solid #ddd}table.ip-geo-block-dataTable.cell-border tbody tr:first-child td,table.ip-geo-block-dataTable.cell-border tbody tr:first-child th{border-top:none}table.ip-geo-block-dataTable.display tbody tr.odd,table.ip-geo-block-dataTable.stripe tbody tr.odd{background-color:#f9f9f9}table.ip-geo-block-dataTable.display tbody tr.odd.selected,table.ip-geo-block-dataTable.stripe tbody tr.odd.selected{background-color:#acbad4}table.ip-geo-block-dataTable.display tbody tr:hover,table.ip-geo-block-dataTable.hover tbody tr:hover{background-color:#f6f6f6}table.ip-geo-block-dataTable.display tbody tr:hover.selected,table.ip-geo-block-dataTable.hover tbody tr:hover.selected{background-color:#aab7d1}table.ip-geo-block-dataTable.display tbody tr>.sorting_1,table.ip-geo-block-dataTable.display tbody tr>.sorting_2,table.ip-geo-block-dataTable.display tbody tr>.sorting_3,table.ip-geo-block-dataTable.order-column tbody tr>.sorting_1,table.ip-geo-block-dataTable.order-column tbody tr>.sorting_2,table.ip-geo-block-dataTable.order-column tbody tr>.sorting_3{background-color:#fafafa}table.ip-geo-block-dataTable.display tbody tr.selected>.sorting_1,table.ip-geo-block-dataTable.display tbody tr.selected>.sorting_2,table.ip-geo-block-dataTable.display tbody tr.selected>.sorting_3,table.ip-geo-block-dataTable.order-column tbody tr.selected>.sorting_1,table.ip-geo-block-dataTable.order-column tbody tr.selected>.sorting_2,table.ip-geo-block-dataTable.order-column tbody tr.selected>.sorting_3{background-color:#acbad5}table.ip-geo-block-dataTable.display tbody tr.odd>.sorting_1,table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd>.sorting_1{background-color:#f1f1f1}table.ip-geo-block-dataTable.display tbody tr.odd>.sorting_2,table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd>.sorting_2{background-color:#f3f3f3}table.ip-geo-block-dataTable.display tbody tr.odd>.sorting_3,table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd>.sorting_3{background-color:#f5f5f5}table.ip-geo-block-dataTable.display tbody tr.odd.selected>.sorting_1,table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.ip-geo-block-dataTable.display tbody tr.odd.selected>.sorting_2,table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.ip-geo-block-dataTable.display tbody tr.odd.selected>.sorting_3,table.ip-geo-block-dataTable.order-column.stripe tbody tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.ip-geo-block-dataTable.display tbody tr.even>.sorting_1,table.ip-geo-block-dataTable.order-column.stripe tbody tr.even>.sorting_1{background-color:#fafafa}table.ip-geo-block-dataTable.display tbody tr.even>.sorting_2,table.ip-geo-block-dataTable.order-column.stripe tbody tr.even>.sorting_2{background-color:#fcfcfc}table.ip-geo-block-dataTable.display tbody tr.even>.sorting_3,table.ip-geo-block-dataTable.order-column.stripe tbody tr.even>.sorting_3{background-color:#fefefe}table.ip-geo-block-dataTable.display tbody tr.even.selected>.sorting_1,table.ip-geo-block-dataTable.order-column.stripe tbody tr.even.selected>.sorting_1{background-color:#acbad5}table.ip-geo-block-dataTable.display tbody tr.even.selected>.sorting_2,table.ip-geo-block-dataTable.order-column.stripe tbody tr.even.selected>.sorting_2{background-color:#aebcd6}table.ip-geo-block-dataTable.display tbody tr.even.selected>.sorting_3,table.ip-geo-block-dataTable.order-column.stripe tbody tr.even.selected>.sorting_3{background-color:#afbdd8}table.ip-geo-block-dataTable.display tbody tr:hover>.sorting_1,table.ip-geo-block-dataTable.order-column.hover tbody tr:hover>.sorting_1{background-color:#eaeaea}table.ip-geo-block-dataTable.display tbody tr:hover>.sorting_2,table.ip-geo-block-dataTable.order-column.hover tbody tr:hover>.sorting_2{background-color:#ececec}table.ip-geo-block-dataTable.display tbody tr:hover>.sorting_3,table.ip-geo-block-dataTable.order-column.hover tbody tr:hover>.sorting_3{background-color:#efefef}table.ip-geo-block-dataTable.display tbody tr:hover.selected>.sorting_1,table.ip-geo-block-dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{background-color:#a2aec7}table.ip-geo-block-dataTable.display tbody tr:hover.selected>.sorting_2,table.ip-geo-block-dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{background-color:#a3b0c9}table.ip-geo-block-dataTable.display tbody tr:hover.selected>.sorting_3,table.ip-geo-block-dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{background-color:#a5b2cb}table.ip-geo-block-dataTable.no-footer{border-bottom:1px solid #111}table.ip-geo-block-dataTable.compact thead td,table.ip-geo-block-dataTable.compact thead th{padding:4px 17px 4px 4px}table.ip-geo-block-dataTable.compact tbody td,table.ip-geo-block-dataTable.compact tbody th,table.ip-geo-block-dataTable.compact tfoot td,table.ip-geo-block-dataTable.compact tfoot th{padding:4px}table.ip-geo-block-dataTable td.dt-left,table.ip-geo-block-dataTable th.dt-left{text-align:left}table.ip-geo-block-dataTable td.dataTables_empty,table.ip-geo-block-dataTable td.dt-center,table.ip-geo-block-dataTable th.dt-center{text-align:center}table.ip-geo-block-dataTable td.dt-right,table.ip-geo-block-dataTable th.dt-right{text-align:right}table.ip-geo-block-dataTable td.dt-justify,table.ip-geo-block-dataTable th.dt-justify{text-align:justify}table.ip-geo-block-dataTable tfoot td.dt-head-left,table.ip-geo-block-dataTable tfoot th.dt-head-left,table.ip-geo-block-dataTable thead td.dt-head-left,table.ip-geo-block-dataTable thead th.dt-head-left{text-align:left}table.ip-geo-block-dataTable tfoot td.dt-head-center,table.ip-geo-block-dataTable tfoot th.dt-head-center,table.ip-geo-block-dataTable thead td.dt-head-center,table.ip-geo-block-dataTable thead th.dt-head-center{text-align:center}table.ip-geo-block-dataTable tfoot td.dt-head-right,table.ip-geo-block-dataTable tfoot th.dt-head-right,table.ip-geo-block-dataTable thead td.dt-head-right,table.ip-geo-block-dataTable thead th.dt-head-right{text-align:right}table.ip-geo-block-dataTable tfoot td.dt-head-justify,table.ip-geo-block-dataTable tfoot th.dt-head-justify,table.ip-geo-block-dataTable thead td.dt-head-justify,table.ip-geo-block-dataTable thead th.dt-head-justify{text-align:justify}table.ip-geo-block-dataTable tbody td.dt-body-left,table.ip-geo-block-dataTable tbody th.dt-body-left{text-align:left}table.ip-geo-block-dataTable tbody td.dt-body-center,table.ip-geo-block-dataTable tbody th.dt-body-center{text-align:center}table.ip-geo-block-dataTable tbody td.dt-body-right,table.ip-geo-block-dataTable tbody th.dt-body-right{text-align:right}table.ip-geo-block-dataTable tbody td.dt-body-justify,table.ip-geo-block-dataTable tbody th.dt-body-justify{text-align:justify}table.ip-geo-block-dataTable,table.ip-geo-block-dataTable td,table.ip-geo-block-dataTable th{box-sizing:content-box}div[class*=ip-geo-block] .dataTables_wrapper{position:relative;clear:both;zoom:1}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_length{float:left}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_filter{float:right;text-align:right}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_filter input{margin-left:.5em}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:.755em}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:.25em}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:.5em 1em;margin-left:2px;text-align:center;text-decoration:none!important;cursor:pointer;color:#333!important;border:1px solid transparent;border-radius:2px}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate .paginate_button.current,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:#333!important;border:1px solid #979797;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(100%,#dcdcdc));background:-webkit-linear-gradient(top,#fff 0,#dcdcdc 100%);background:-moz-linear-gradient(top,#fff 0,#dcdcdc 100%);background:-ms-linear-gradient(top,#fff 0,#dcdcdc 100%);background:-o-linear-gradient(top,#fff 0,#dcdcdc 100%);background:linear-gradient(to bottom,#fff 0,#dcdcdc 100%)}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover{cursor:default;color:#666!important;border:1px solid transparent;background:0 0;box-shadow:none}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:#fff!important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#585858),color-stop(100%,#111));background:-webkit-linear-gradient(top,#585858 0,#111 100%);background:-moz-linear-gradient(top,#585858 0,#111 100%);background:-ms-linear-gradient(top,#585858 0,#111 100%);background:-o-linear-gradient(top,#585858 0,#111 100%);background:linear-gradient(to bottom,#585858 0,#111 100%)}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:0;background-color:#2b2b2b;background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#2b2b2b),color-stop(100%,#0c0c0c));background:-webkit-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:-moz-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:-ms-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:-o-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:linear-gradient(to bottom,#2b2b2b 0,#0c0c0c 100%);box-shadow:inset 0 0 3px #111}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_processing{position:absolute;top:50%;left:50%;width:100%;height:40px;margin-left:-50%;margin-top:-25px;padding-top:20px;text-align:center;font-size:1.2em;background-color:#fff;background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(25%,rgba(255,255,255,.9)),color-stop(75%,rgba(255,255,255,.9)),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,.9) 25%,rgba(255,255,255,.9) 75%,rgba(255,255,255,0) 100%);background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,.9) 25%,rgba(255,255,255,.9) 75%,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,.9) 25%,rgba(255,255,255,.9) 75%,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,.9) 25%,rgba(255,255,255,.9) 75%,rgba(255,255,255,0) 100%);background:linear-gradient(to right,rgba(255,255,255,0) 0,rgba(255,255,255,.9) 25%,rgba(255,255,255,.9) 75%,rgba(255,255,255,0) 100%)}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_filter,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_info,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_length,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_processing{color:#333}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll{clear:both}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{-webkit-overflow-scrolling:touch}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th{vertical-align:middle}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td>div.dataTables_sizing,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th>div.dataTables_sizing,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td>div.dataTables_sizing,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th>div.dataTables_sizing{height:0;overflow:hidden;margin:0!important;padding:0!important}div[class*=ip-geo-block] .dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid #111}div[class*=ip-geo-block] .dataTables_wrapper.no-footer div.dataTables_scrollBody>table,div[class*=ip-geo-block] .dataTables_wrapper.no-footer div.dataTables_scrollHead table.ip-geo-block-dataTable{border-bottom:none}div[class*=ip-geo-block] .dataTables_wrapper:after{visibility:hidden;display:block;content:"";clear:both;height:0}@media screen and (max-width:767px){div[class*=ip-geo-block] .dataTables_wrapper .dataTables_info,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate{float:none;text-align:center}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_paginate{margin-top:.5em}}@media screen and (max-width:640px){div[class*=ip-geo-block] .dataTables_wrapper .dataTables_filter,div[class*=ip-geo-block] .dataTables_wrapper .dataTables_length{float:none;text-align:center}div[class*=ip-geo-block] .dataTables_wrapper .dataTables_filter{margin-top:.5em}}
5
+
6
  /*! Responsive 2.1.1
7
  * 2014-2016 SpryMedia Ltd - datatables.net/license
8
  */
9
+ table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>td.child,table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>td.dataTables_empty,table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>th.child{cursor:default!important}table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>td.child:before,table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>td.dataTables_empty:before,table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>th.child:before{display:none!important}table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>td:first-child,table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>th:first-child{position:relative;padding-left:30px;cursor:pointer}table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before,table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr>th:first-child:before{top:9px;left:4px;height:14px;width:14px;display:block;position:absolute;color:#fff;border:2px solid #fff;border-radius:14px;box-shadow:0 0 3px #444;box-sizing:content-box;text-align:center;font-family:'Courier New',Courier,monospace;line-height:14px;content:'+';background-color:#31b131}table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before,table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr.parent>th:first-child:before{content:'-';background-color:#d33333}table.ip-geo-block-dataTable.dtr-inline.collapsed>tbody>tr.child td:before{display:none}table.ip-geo-block-dataTable.dtr-inline.collapsed.compact>tbody>tr>td:first-child,table.ip-geo-block-dataTable.dtr-inline.collapsed.compact>tbody>tr>th:first-child{padding-left:27px}table.ip-geo-block-dataTable.dtr-inline.collapsed.compact>tbody>tr>td:first-child:before,table.ip-geo-block-dataTable.dtr-inline.collapsed.compact>tbody>tr>th:first-child:before{top:5px;left:4px;height:14px;width:14px;border-radius:14px;line-height:14px;text-indent:3px}table.ip-geo-block-dataTable.dtr-column>tbody>tr>td.control,table.ip-geo-block-dataTable.dtr-column>tbody>tr>th.control{position:relative;cursor:pointer}table.ip-geo-block-dataTable.dtr-column>tbody>tr>td.control:before,table.ip-geo-block-dataTable.dtr-column>tbody>tr>th.control:before{top:50%;left:50%;height:16px;width:16px;margin-top:-10px;margin-left:-10px;display:block;position:absolute;color:#fff;border:2px solid #fff;border-radius:14px;box-shadow:0 0 3px #444;box-sizing:content-box;text-align:center;font-family:'Courier New',Courier,monospace;line-height:14px;content:'+';background-color:#31b131}table.ip-geo-block-dataTable.dtr-column>tbody>tr.parent td.control:before,table.ip-geo-block-dataTable.dtr-column>tbody>tr.parent th.control:before{content:'-';background-color:#d33333}table.ip-geo-block-dataTable>tbody>tr.child{padding:.5em 1em}table.ip-geo-block-dataTable>tbody>tr.child:hover{background:0 0!important}table.ip-geo-block-dataTable>tbody>tr.child ul.dtr-details{display:inline-block;list-style-type:none;margin:0;padding:0}table.ip-geo-block-dataTable>tbody>tr.child ul.dtr-details li{border-bottom:1px solid #efefef;padding:.5em 0}table.ip-geo-block-dataTable>tbody>tr.child ul.dtr-details li:first-child{padding-top:0}table.ip-geo-block-dataTable>tbody>tr.child ul.dtr-details li:last-child{border-bottom:none}table.ip-geo-block-dataTable>tbody>tr.child span.dtr-title{display:inline-block;min-width:75px;font-weight:700}div.dtr-modal{position:fixed;box-sizing:border-box;top:0;left:0;height:100%;width:100%;z-index:100;padding:10em 1em}div.dtr-modal div.dtr-modal-display{position:absolute;top:0;left:0;bottom:0;right:0;width:50%;height:50%;margin:auto;z-index:102;overflow:auto;background-color:#f5f5f7;border:1px solid #000;border-radius:.5em;box-shadow:0 12px 30px rgba(0,0,0,.6)}div.dtr-modal div.dtr-modal-content{position:relative;padding:1em}div.dtr-modal div.dtr-modal-close{position:absolute;top:6px;right:6px;width:22px;height:22px;border:1px solid #eaeaea;background-color:#f9f9f9;text-align:center;border-radius:3px;cursor:pointer;z-index:12}div.dtr-modal div.dtr-modal-close:hover{background-color:#eaeaea}div.dtr-modal div.dtr-modal-background{position:fixed;top:0;left:0;right:0;bottom:0;z-index:101;background:rgba(0,0,0,.6)}@media screen and (max-width:767px){div.dtr-modal div.dtr-modal-display{width:95%}}
10
+
11
  /*! datatables.mark.js v2.0.1
12
  * Copyright (c) 2016-2017 Julian Motz
13
  * https://github.com/julmot/datatables.mark.js/blob/master/LICENSE
14
  */
15
+ mark{background:orange;color:#000}
admin/datatables/js/dataTables.responsive.js CHANGED
@@ -12,13 +12,13 @@
12
  * @copyright Copyright 2014-2016 SpryMedia Ltd.
13
  *
14
  * This source file is free software, available under the following license:
15
- * MIT license - http://datatables.net/license/mit
16
  *
17
  * This source file is distributed in the hope that it will be useful, but
18
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
20
  *
21
- * For details please refer to: http://www.datatables.net
22
  */
23
  (function( factory ){
24
  if ( typeof define === 'function' && define.amd ) {
@@ -152,7 +152,7 @@ $.extend( Responsive.prototype, {
152
  // resize
153
  $(window).on( 'resize.dtr orientationchange.dtr', DataTable.util.throttle( function () {
154
  // iOS has a bug whereby resize can fire when only scrolling
155
- // See: http://stackoverflow.com/questions/8898412
156
  var width = $(window).width();
157
 
158
  if ( width !== oldWindowWidth ) {
12
  * @copyright Copyright 2014-2016 SpryMedia Ltd.
13
  *
14
  * This source file is free software, available under the following license:
15
+ * MIT license - https://datatables.net/license/mit
16
  *
17
  * This source file is distributed in the hope that it will be useful, but
18
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
20
  *
21
+ * For details please refer to: https://www.datatables.net
22
  */
23
  (function( factory ){
24
  if ( typeof define === 'function' && define.amd ) {
152
  // resize
153
  $(window).on( 'resize.dtr orientationchange.dtr', DataTable.util.throttle( function () {
154
  // iOS has a bug whereby resize can fire when only scrolling
155
+ // See: https://stackoverflow.com/questions/8898412
156
  var width = $(window).width();
157
 
158
  if ( width !== oldWindowWidth ) {
admin/datatables/js/datatables-all.js CHANGED
@@ -12,13 +12,13 @@
12
  * @copyright Copyright 2008-2017 SpryMedia Ltd.
13
  *
14
  * This source file is free software, available under the following license:
15
- * MIT license - http://datatables.net/license
16
  *
17
  * This source file is distributed in the hope that it will be useful, but
18
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
20
  *
21
- * For details please refer to: http://www.datatables.net
22
  */
23
 
24
  /*jslint evil: true, undef: true, browser: true */
@@ -64,7 +64,7 @@
64
  * flexible tool, based upon the foundations of progressive enhancement,
65
  * which will add advanced interaction controls to any HTML table. For a
66
  * full list of features please refer to
67
- * [DataTables.net](href="http://datatables.net).
68
  *
69
  * Note that the `DataTable` object is not a global variable but is aliased
70
  * to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may
@@ -1345,7 +1345,7 @@
1345
  // Escape regular expression special characters
1346
  var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' );
1347
 
1348
- // http://en.wikipedia.org/wiki/Foreign_exchange_market
1349
  // - \u20BD - Russian ruble.
1350
  // - \u20a9 - South Korean Won
1351
  // - \u20BA - Turkish Lira
@@ -4509,7 +4509,7 @@
4509
  // If it looks like there is an HTML entity in the string,
4510
  // attempt to decode it so sorting works as expected. Note that
4511
  // we could use a single line of jQuery to do this, but the DOM
4512
- // method used here is much faster http://jsperf.com/html-decode
4513
  if ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {
4514
  __filter_div.innerHTML = cellData;
4515
  cellData = __filter_div_textContent ?
@@ -6443,7 +6443,7 @@
6443
 
6444
  if ( tn ) {
6445
  msg += '. For more information about this error, please see '+
6446
- 'http://datatables.net/tn/'+tn;
6447
  }
6448
 
6449
  if ( ! level ) {
@@ -9408,7 +9408,7 @@
9408
  /**
9409
  * Version string for plug-ins to check compatibility. Allowed format is
9410
  * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
9411
- * only for non-release builds. See http://semver.org/ for more information.
9412
  * @member
9413
  * @type string
9414
  * @default Version number
@@ -9981,7 +9981,7 @@
9981
  * --------
9982
  *
9983
  * As an object, the parameters in the object are passed to
9984
- * [jQuery.ajax](http://api.jquery.com/jQuery.ajax/) allowing fine control
9985
  * of the Ajax request. DataTables has a number of default parameters which
9986
  * you can override using this option. Please refer to the jQuery
9987
  * documentation for a full description of the options available, although
@@ -11688,7 +11688,7 @@
11688
  * $(document).ready( function() {
11689
  * $('#example').dataTable( {
11690
  * "language": {
11691
- * "url": "http://www.sprymedia.co.uk/dataTables/lang.txt"
11692
  * }
11693
  * } );
11694
  * } );
@@ -14747,7 +14747,7 @@
14747
  // string
14748
  "string-pre": function ( a ) {
14749
  // This is a little complex, but faster than always calling toString,
14750
- // http://jsperf.com/tostring-v-check
14751
  return _empty(a) ?
14752
  '' :
14753
  typeof a === 'string' ?
@@ -15256,13 +15256,13 @@
15256
  * @copyright Copyright 2014-2016 SpryMedia Ltd.
15257
  *
15258
  * This source file is free software, available under the following license:
15259
- * MIT license - http://datatables.net/license/mit
15260
  *
15261
  * This source file is distributed in the hope that it will be useful, but
15262
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15263
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
15264
  *
15265
- * For details please refer to: http://www.datatables.net
15266
  */
15267
  (function( factory ){
15268
  if ( typeof define === 'function' && define.amd ) {
@@ -15396,7 +15396,7 @@ $.extend( Responsive.prototype, {
15396
  // resize
15397
  $(window).on( 'resize.dtr orientationchange.dtr', DataTable.util.throttle( function () {
15398
  // iOS has a bug whereby resize can fire when only scrolling
15399
- // See: http://stackoverflow.com/questions/8898412
15400
  var width = $(window).width();
15401
 
15402
  if ( width !== oldWindowWidth ) {
12
  * @copyright Copyright 2008-2017 SpryMedia Ltd.
13
  *
14
  * This source file is free software, available under the following license:
15
+ * MIT license - https://datatables.net/license
16
  *
17
  * This source file is distributed in the hope that it will be useful, but
18
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
20
  *
21
+ * For details please refer to: https://www.datatables.net
22
  */
23
 
24
  /*jslint evil: true, undef: true, browser: true */
64
  * flexible tool, based upon the foundations of progressive enhancement,
65
  * which will add advanced interaction controls to any HTML table. For a
66
  * full list of features please refer to
67
+ * [DataTables.net](href="https://datatables.net).
68
  *
69
  * Note that the `DataTable` object is not a global variable but is aliased
70
  * to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may
1345
  // Escape regular expression special characters
1346
  var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' );
1347
 
1348
+ // https://en.wikipedia.org/wiki/Foreign_exchange_market
1349
  // - \u20BD - Russian ruble.
1350
  // - \u20a9 - South Korean Won
1351
  // - \u20BA - Turkish Lira
4509
  // If it looks like there is an HTML entity in the string,
4510
  // attempt to decode it so sorting works as expected. Note that
4511
  // we could use a single line of jQuery to do this, but the DOM
4512
+ // method used here is much faster https://jsperf.com/html-decode
4513
  if ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {
4514
  __filter_div.innerHTML = cellData;
4515
  cellData = __filter_div_textContent ?
6443
 
6444
  if ( tn ) {
6445
  msg += '. For more information about this error, please see '+
6446
+ 'https://datatables.net/tn/'+tn;
6447
  }
6448
 
6449
  if ( ! level ) {
9408
  /**
9409
  * Version string for plug-ins to check compatibility. Allowed format is
9410
  * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
9411
+ * only for non-release builds. See https://semver.org/ for more information.
9412
  * @member
9413
  * @type string
9414
  * @default Version number
9981
  * --------
9982
  *
9983
  * As an object, the parameters in the object are passed to
9984
+ * [jQuery.ajax](https://api.jquery.com/jQuery.ajax/) allowing fine control
9985
  * of the Ajax request. DataTables has a number of default parameters which
9986
  * you can override using this option. Please refer to the jQuery
9987
  * documentation for a full description of the options available, although
11688
  * $(document).ready( function() {
11689
  * $('#example').dataTable( {
11690
  * "language": {
11691
+ * "url": "https://www.sprymedia.co.uk/dataTables/lang.txt"
11692
  * }
11693
  * } );
11694
  * } );
14747
  // string
14748
  "string-pre": function ( a ) {
14749
  // This is a little complex, but faster than always calling toString,
14750
+ // https://jsperf.com/tostring-v-check
14751
  return _empty(a) ?
14752
  '' :
14753
  typeof a === 'string' ?
15256
  * @copyright Copyright 2014-2016 SpryMedia Ltd.
15257
  *
15258
  * This source file is free software, available under the following license:
15259
+ * MIT license - https://datatables.net/license/mit
15260
  *
15261
  * This source file is distributed in the hope that it will be useful, but
15262
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15263
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
15264
  *
15265
+ * For details please refer to: https://www.datatables.net
15266
  */
15267
  (function( factory ){
15268
  if ( typeof define === 'function' && define.amd ) {
15396
  // resize
15397
  $(window).on( 'resize.dtr orientationchange.dtr', DataTable.util.throttle( function () {
15398
  // iOS has a bug whereby resize can fire when only scrolling
15399
+ // See: https://stackoverflow.com/questions/8898412
15400
  var width = $(window).width();
15401
 
15402
  if ( width !== oldWindowWidth ) {
admin/datatables/js/datatables-all.min.js CHANGED
@@ -71,7 +71,7 @@ function wa(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=V(a),e=a.oFeatures,f
71
  c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function xa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:zb(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:zb(a.aoPreSearchCols[d])}})};r(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,
72
  b)}}function Ib(a,b,c){var d,e,f=a.aoColumns,b=function(b){if(b&&b.time){var g=r(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===h.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g)&&!(b.columns&&f.length!==b.columns.length))){a.oLoadedState=h.extend(!0,{},b);b.start!==k&&(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==k&&(a._iDisplayLength=b.length);b.order!==k&&(a.aaSorting=[],h.each(b.order,function(b,c){a.aaSorting.push(c[0]>=f.length?[0,c[1]]:c)}));b.search!==
73
  k&&h.extend(a.oPreviousSearch,Ab(b.search));if(b.columns){d=0;for(e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==k&&(f[d].bVisible=g.visible),g.search!==k&&h.extend(a.aoPreSearchCols[d],Ab(g.search))}r(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=a.fnStateLoadCallback.call(a.oInstance,a,b);g!==k&&b(g)}else c()}function ya(a){var b=m.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function J(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+
74
- " - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+d);if(b)E.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&r(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function F(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?F(a,b,d[0],d[1]):F(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Jb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],
75
  h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==e&&h.isArray(d)?d.slice():d);return a}function Va(a,b,c){h(a).on("click.DT",b,function(b){a.blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function r(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+
76
  ".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Ra(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Ma(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ha(a,b){var c=[],c=Kb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,
77
  c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function cb(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Wa)},"html-num":function(b){return za(b,a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Wa)}},function(b,c){x.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(x.type.search[b+a]=x.type.search.html)})}function Lb(a){return function(){var b=
71
  c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function xa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:zb(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:zb(a.aoPreSearchCols[d])}})};r(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,
72
  b)}}function Ib(a,b,c){var d,e,f=a.aoColumns,b=function(b){if(b&&b.time){var g=r(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===h.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g)&&!(b.columns&&f.length!==b.columns.length))){a.oLoadedState=h.extend(!0,{},b);b.start!==k&&(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==k&&(a._iDisplayLength=b.length);b.order!==k&&(a.aaSorting=[],h.each(b.order,function(b,c){a.aaSorting.push(c[0]>=f.length?[0,c[1]]:c)}));b.search!==
73
  k&&h.extend(a.oPreviousSearch,Ab(b.search));if(b.columns){d=0;for(e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==k&&(f[d].bVisible=g.visible),g.search!==k&&h.extend(a.aoPreSearchCols[d],Ab(g.search))}r(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=a.fnStateLoadCallback.call(a.oInstance,a,b);g!==k&&b(g)}else c()}function ya(a){var b=m.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function J(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+
74
+ " - ":"")+c;d&&(c+=". For more information about this error, please see https://datatables.net/tn/"+d);if(b)E.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&r(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function F(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?F(a,b,d[0],d[1]):F(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Jb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],
75
  h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==e&&h.isArray(d)?d.slice():d);return a}function Va(a,b,c){h(a).on("click.DT",b,function(b){a.blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function r(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+
76
  ".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Ra(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Ma(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ha(a,b){var c=[],c=Kb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,
77
  c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function cb(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Wa)},"html-num":function(b){return za(b,a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Wa)}},function(b,c){x.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(x.type.search[b+a]=x.type.search.html)})}function Lb(a){return function(){var b=
admin/datatables/js/jquery.dataTables.js CHANGED
@@ -12,13 +12,13 @@
12
  * @copyright Copyright 2008-2017 SpryMedia Ltd.
13
  *
14
  * This source file is free software, available under the following license:
15
- * MIT license - http://datatables.net/license
16
  *
17
  * This source file is distributed in the hope that it will be useful, but
18
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
20
  *
21
- * For details please refer to: http://www.datatables.net
22
  */
23
 
24
  /*jslint evil: true, undef: true, browser: true */
@@ -64,7 +64,7 @@
64
  * flexible tool, based upon the foundations of progressive enhancement,
65
  * which will add advanced interaction controls to any HTML table. For a
66
  * full list of features please refer to
67
- * [DataTables.net](href="http://datatables.net).
68
  *
69
  * Note that the `DataTable` object is not a global variable but is aliased
70
  * to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may
@@ -1345,7 +1345,7 @@
1345
  // Escape regular expression special characters
1346
  var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' );
1347
 
1348
- // http://en.wikipedia.org/wiki/Foreign_exchange_market
1349
  // - \u20BD - Russian ruble.
1350
  // - \u20a9 - South Korean Won
1351
  // - \u20BA - Turkish Lira
@@ -4509,7 +4509,7 @@
4509
  // If it looks like there is an HTML entity in the string,
4510
  // attempt to decode it so sorting works as expected. Note that
4511
  // we could use a single line of jQuery to do this, but the DOM
4512
- // method used here is much faster http://jsperf.com/html-decode
4513
  if ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {
4514
  __filter_div.innerHTML = cellData;
4515
  cellData = __filter_div_textContent ?
@@ -6443,7 +6443,7 @@
6443
 
6444
  if ( tn ) {
6445
  msg += '. For more information about this error, please see '+
6446
- 'http://datatables.net/tn/'+tn;
6447
  }
6448
 
6449
  if ( ! level ) {
@@ -9408,7 +9408,7 @@
9408
  /**
9409
  * Version string for plug-ins to check compatibility. Allowed format is
9410
  * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
9411
- * only for non-release builds. See http://semver.org/ for more information.
9412
  * @member
9413
  * @type string
9414
  * @default Version number
@@ -9981,7 +9981,7 @@
9981
  * --------
9982
  *
9983
  * As an object, the parameters in the object are passed to
9984
- * [jQuery.ajax](http://api.jquery.com/jQuery.ajax/) allowing fine control
9985
  * of the Ajax request. DataTables has a number of default parameters which
9986
  * you can override using this option. Please refer to the jQuery
9987
  * documentation for a full description of the options available, although
@@ -11688,7 +11688,7 @@
11688
  * $(document).ready( function() {
11689
  * $('#example').dataTable( {
11690
  * "language": {
11691
- * "url": "http://www.sprymedia.co.uk/dataTables/lang.txt"
11692
  * }
11693
  * } );
11694
  * } );
@@ -14747,7 +14747,7 @@
14747
  // string
14748
  "string-pre": function ( a ) {
14749
  // This is a little complex, but faster than always calling toString,
14750
- // http://jsperf.com/tostring-v-check
14751
  return _empty(a) ?
14752
  '' :
14753
  typeof a === 'string' ?
12
  * @copyright Copyright 2008-2017 SpryMedia Ltd.
13
  *
14
  * This source file is free software, available under the following license:
15
+ * MIT license - https://datatables.net/license
16
  *
17
  * This source file is distributed in the hope that it will be useful, but
18
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
20
  *
21
+ * For details please refer to: https://www.datatables.net
22
  */
23
 
24
  /*jslint evil: true, undef: true, browser: true */
64
  * flexible tool, based upon the foundations of progressive enhancement,
65
  * which will add advanced interaction controls to any HTML table. For a
66
  * full list of features please refer to
67
+ * [DataTables.net](href="https://datatables.net).
68
  *
69
  * Note that the `DataTable` object is not a global variable but is aliased
70
  * to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may
1345
  // Escape regular expression special characters
1346
  var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' );
1347
 
1348
+ // https://en.wikipedia.org/wiki/Foreign_exchange_market
1349
  // - \u20BD - Russian ruble.
1350
  // - \u20a9 - South Korean Won
1351
  // - \u20BA - Turkish Lira
4509
  // If it looks like there is an HTML entity in the string,
4510
  // attempt to decode it so sorting works as expected. Note that
4511
  // we could use a single line of jQuery to do this, but the DOM
4512
+ // method used here is much faster https://jsperf.com/html-decode
4513
  if ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {
4514
  __filter_div.innerHTML = cellData;
4515
  cellData = __filter_div_textContent ?
6443
 
6444
  if ( tn ) {
6445
  msg += '. For more information about this error, please see '+
6446
+ 'https://datatables.net/tn/'+tn;
6447
  }
6448
 
6449
  if ( ! level ) {
9408
  /**
9409
  * Version string for plug-ins to check compatibility. Allowed format is
9410
  * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
9411
+ * only for non-release builds. See https://semver.org/ for more information.
9412
  * @member
9413
  * @type string
9414
  * @default Version number
9981
  * --------
9982
  *
9983
  * As an object, the parameters in the object are passed to
9984
+ * [jQuery.ajax](https://api.jquery.com/jQuery.ajax/) allowing fine control
9985
  * of the Ajax request. DataTables has a number of default parameters which
9986
  * you can override using this option. Please refer to the jQuery
9987
  * documentation for a full description of the options available, although
11688
  * $(document).ready( function() {
11689
  * $('#example').dataTable( {
11690
  * "language": {
11691
+ * "url": "https://www.sprymedia.co.uk/dataTables/lang.txt"
11692
  * }
11693
  * } );
11694
  * } );
14747
  // string
14748
  "string-pre": function ( a ) {
14749
  // This is a little complex, but faster than always calling toString,
14750
+ // https://jsperf.com/tostring-v-check
14751
  return _empty(a) ?
14752
  '' :
14753
  typeof a === 'string' ?
admin/datatables/js/jquery.dataTables.min.js CHANGED
@@ -71,7 +71,7 @@ function wa(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=V(a),e=a.oFeatures,f
71
  c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function xa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:zb(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:zb(a.aoPreSearchCols[d])}})};r(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,
72
  b)}}function Ib(a,b,c){var d,e,f=a.aoColumns,b=function(b){if(b&&b.time){var g=r(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===h.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g)&&!(b.columns&&f.length!==b.columns.length))){a.oLoadedState=h.extend(!0,{},b);b.start!==k&&(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==k&&(a._iDisplayLength=b.length);b.order!==k&&(a.aaSorting=[],h.each(b.order,function(b,c){a.aaSorting.push(c[0]>=f.length?[0,c[1]]:c)}));b.search!==
73
  k&&h.extend(a.oPreviousSearch,Ab(b.search));if(b.columns){d=0;for(e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==k&&(f[d].bVisible=g.visible),g.search!==k&&h.extend(a.aoPreSearchCols[d],Ab(g.search))}r(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=a.fnStateLoadCallback.call(a.oInstance,a,b);g!==k&&b(g)}else c()}function ya(a){var b=m.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function J(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+
74
- " - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+d);if(b)E.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&r(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function F(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?F(a,b,d[0],d[1]):F(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Jb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],
75
  h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==e&&h.isArray(d)?d.slice():d);return a}function Va(a,b,c){h(a).on("click.DT",b,function(b){a.blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function r(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+
76
  ".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Ra(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Ma(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ha(a,b){var c=[],c=Kb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,
77
  c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function cb(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Wa)},"html-num":function(b){return za(b,a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Wa)}},function(b,c){x.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(x.type.search[b+a]=x.type.search.html)})}function Lb(a){return function(){var b=
71
  c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function xa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:zb(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:zb(a.aoPreSearchCols[d])}})};r(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,
72
  b)}}function Ib(a,b,c){var d,e,f=a.aoColumns,b=function(b){if(b&&b.time){var g=r(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===h.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g)&&!(b.columns&&f.length!==b.columns.length))){a.oLoadedState=h.extend(!0,{},b);b.start!==k&&(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==k&&(a._iDisplayLength=b.length);b.order!==k&&(a.aaSorting=[],h.each(b.order,function(b,c){a.aaSorting.push(c[0]>=f.length?[0,c[1]]:c)}));b.search!==
73
  k&&h.extend(a.oPreviousSearch,Ab(b.search));if(b.columns){d=0;for(e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==k&&(f[d].bVisible=g.visible),g.search!==k&&h.extend(a.aoPreSearchCols[d],Ab(g.search))}r(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=a.fnStateLoadCallback.call(a.oInstance,a,b);g!==k&&b(g)}else c()}function ya(a){var b=m.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function J(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+
74
+ " - ":"")+c;d&&(c+=". For more information about this error, please see https://datatables.net/tn/"+d);if(b)E.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&r(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function F(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?F(a,b,d[0],d[1]):F(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Jb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],
75
  h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==e&&h.isArray(d)?d.slice():d);return a}function Va(a,b,c){h(a).on("click.DT",b,function(b){a.blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function r(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+
76
  ".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Ra(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Ma(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ha(a,b){var c=[],c=Kb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,
77
  c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function cb(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Wa)},"html-num":function(b){return za(b,a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Wa)}},function(b,c){x.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(x.type.search[b+a]=x.type.search.html)})}function Lb(a){return function(){var b=
admin/datatables/license.txt CHANGED
@@ -1,5 +1,5 @@
1
  Copyright (c) 2008-2015 SpryMedia Limited
2
- http://datatables.net
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
1
  Copyright (c) 2008-2015 SpryMedia Limited
2
+ https://datatables.net
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
  of this software and associated documentation files (the "Software"), to deal
admin/images/ajax-loader-snake.gif ADDED
Binary file
admin/includes/class-admin-ajax.php CHANGED
@@ -90,11 +90,7 @@ class IP_Geo_Block_Admin_Ajax {
90
  $insert_value = array( $insert_value );
91
 
92
  $position = is_null( $position ) ? count( $base_array ) : intval( $position );
93
-
94
- $base_array = array_merge(
95
- array_splice( $base_array, 0, $position ),
96
- $insert_value, $base_array
97
- );
98
  }
99
 
100
  /**
@@ -120,7 +116,8 @@ class IP_Geo_Block_Admin_Ajax {
120
  ) ) . PHP_EOL;
121
 
122
  foreach ( IP_Geo_Block_Logs::restore_logs( $which ) as $data ) {
123
- $hook = array_shift( $data );
 
124
  self::array_insert( $data, $hook, 3 );
125
  $data[0] = IP_Geo_Block_Util::localdate( $data[0], 'Y-m-d H:i:s' );
126
  $data[7] = str_replace( ',', '‚', $data[7] ); // &#044; --> &#130;
@@ -149,11 +146,12 @@ class IP_Geo_Block_Admin_Ajax {
149
  $res = array();
150
 
151
  foreach ( $rows as $row ) {
 
152
  $row = array_map( 'esc_html', $row );
153
 
154
- if ( $options['anonymize'] ) {
155
- $row[2] = IP_Geo_Block_Util::anonymize_ip( $row[2] );
156
- $row[8] = IP_Geo_Block_Util::anonymize_ip( $row[8] );
157
  }
158
 
159
  $res[] = array(
@@ -181,7 +179,9 @@ class IP_Geo_Block_Admin_Ajax {
181
  * @param string $which 'comment', 'xmlrpc', 'login', 'admin' or 'public'
182
  */
183
  public static function restore_logs( $which ) {
184
- return array( 'data' => self::format_logs( IP_Geo_Block_Logs::restore_logs( $which ) ) ); // DataTables requires `data`
 
 
185
  }
186
 
187
  /**
@@ -248,8 +248,8 @@ class IP_Geo_Block_Admin_Ajax {
248
 
249
  foreach ( IP_Geo_Block_Logs::restore_cache() as $key => $val ) {
250
  if ( $anonymize ) {
251
- $key = IP_Geo_Block_Util::anonymize_ip( $key );
252
- $val['host'] = IP_Geo_Block_Util::anonymize_ip( $val['host'] );
253
  }
254
 
255
  $csv .= implode( ',', array(
@@ -284,8 +284,8 @@ class IP_Geo_Block_Admin_Ajax {
284
 
285
  foreach ( IP_Geo_Block_Logs::restore_cache() as $key => $val ) {
286
  if ( $anonymize ) {
287
- $key = IP_Geo_Block_Util::anonymize_ip( $key );
288
- $val['host'] = IP_Geo_Block_Util::anonymize_ip( $val['host'] );
289
  }
290
 
291
  $res[] = array(
@@ -428,7 +428,6 @@ endif; // TEST_RESTORE_NETWORK
428
 
429
  // Convert json to setting data
430
  $input = self::json_to_settings( $json );
431
- unset( $input['version'] );
432
 
433
  // Integrate posted data into current settings because if can be a part of hole data
434
  $input = $parent->array_replace_recursive(
@@ -512,6 +511,7 @@ endif; // TEST_RESTORE_NETWORK
512
  '[extra_ips][white_list]',
513
  '[extra_ips][black_list]',
514
  '[anonymize]',
 
515
  '[signature]',
516
  '[login_fails]',
517
  '[response_code]',
@@ -564,6 +564,7 @@ endif; // TEST_RESTORE_NETWORK
564
  '[public][simulate]', // 3.0.0
565
  '[public][dnslkup]', // 3.0.3
566
  '[public][response_code]', // 3.0.3
 
567
  '[public][redirect_uri]', // 3.0.3
568
  '[public][behavior]', // 3.0.10
569
  '[behavior][time]', // 3.0.10
@@ -703,8 +704,8 @@ endif; // TEST_RESTORE_NETWORK
703
  }
704
 
705
  // Fallback function for PHP 5.3 and under
706
- // @link http://qiita.com/keromichan16/items/5ff45a77fb0d48e046cc
707
- // @link http://stackoverflow.com/questions/16498286/why-does-the-php-json-encode-function-convert-utf-8-strings-to-hexadecimal-entit/
708
  private static function json_unescaped_unicode( $input ) {
709
  return preg_replace_callback(
710
  '/(?:\\\\u[0-9a-zA-Z]{4})++/',
@@ -766,7 +767,6 @@ endif; // TEST_RESTORE_NETWORK
766
  $result += array( $matches[1] => $which );
767
  }
768
  }
769
- break;
770
  }
771
 
772
  return $result;
@@ -777,25 +777,22 @@ endif; // TEST_RESTORE_NETWORK
777
  *
778
  */
779
  public static function find_exceptions( $target ) {
780
- $res = array();
781
-
782
  switch ( $target ) {
783
  case 'find-admin':
 
784
  foreach ( array( 'action', 'page' ) as $which ) {
785
  $res += self::get_blocked_queries( $which );
786
  }
787
- break;
788
 
789
  case 'find-plugins':
790
- $res = self::get_blocked_queries( 'plugins' );
791
- break;
792
 
793
  case 'find-themes':
794
- $res = self::get_blocked_queries( 'themes' );
795
- break;
796
  }
797
 
798
- return $res;
799
  }
800
 
801
  /**
@@ -812,9 +809,23 @@ endif; // TEST_RESTORE_NETWORK
812
  $val = IP_Geo_Block_Lkup::gethostbyaddr( '8.8.8.8' );
813
  $key = microtime( TRUE ) - $key;
814
 
 
 
 
 
 
 
 
 
 
 
 
 
 
815
  // Server, PHP, WordPress
816
  $res = array(
817
  'Server:' => $_SERVER['SERVER_SOFTWARE'],
 
818
  'PHP:' => PHP_VERSION,
819
  'PHP SAPI:' => php_sapi_name(),
820
  'WordPress:' => $GLOBALS['wp_version'],
@@ -826,7 +837,8 @@ endif; // TEST_RESTORE_NETWORK
826
  'ZipArchive:' => class_exists( 'ZipArchive', FALSE ) ? 'yes' : 'no',
827
  'PECL phar:' => class_exists( 'PharData', FALSE ) ? 'yes' : 'no',
828
  'BC Math:' => (extension_loaded('gmp') ? 'gmp ' : '') . (function_exists('bcadd') ? 'yes' : 'no'),
829
- 'mb_strcut:' => function_exists( 'mb_strcut' ) ? 'yes' : 'no',
 
830
  'SQLite(PDO):' => extension_loaded( 'pdo_sqlite' ) ? 'yes' : 'no',
831
  'DNS lookup:' => ('8.8.8.8' !== $val ? 'available' : 'n/a') . sprintf( ' [%.1f msec]', $key * 1000.0 ),
832
  'User agent:' => $_SERVER['HTTP_USER_AGENT'],
90
  $insert_value = array( $insert_value );
91
 
92
  $position = is_null( $position ) ? count( $base_array ) : intval( $position );
93
+ $base_array = array_merge( array_splice( $base_array, 0, $position ), $insert_value, $base_array );
 
 
 
 
94
  }
95
 
96
  /**
116
  ) ) . PHP_EOL;
117
 
118
  foreach ( IP_Geo_Block_Logs::restore_logs( $which ) as $data ) {
119
+ $hook = array_shift( $data ); // remove `No`
120
+ $hook = array_shift( $data ); // extract `hook`
121
  self::array_insert( $data, $hook, 3 );
122
  $data[0] = IP_Geo_Block_Util::localdate( $data[0], 'Y-m-d H:i:s' );
123
  $data[7] = str_replace( ',', '‚', $data[7] ); // &#044; --> &#130;
146
  $res = array();
147
 
148
  foreach ( $rows as $row ) {
149
+ array_shift( $row ); // remove `No`
150
  $row = array_map( 'esc_html', $row );
151
 
152
+ if ( $options['anonymize'] && FALSE === strpos( $row[2], '***' ) ) {
153
+ $row[2] = IP_Geo_Block_Util::anonymize_ip( $row[2], TRUE );
154
+ $row[8] = IP_Geo_Block_Util::anonymize_ip( $row[8], FALSE );
155
  }
156
 
157
  $res[] = array(
179
  * @param string $which 'comment', 'xmlrpc', 'login', 'admin' or 'public'
180
  */
181
  public static function restore_logs( $which ) {
182
+ return array( 'data' => self::format_logs(
183
+ apply_filters( IP_Geo_Block::PLUGIN_NAME . '-logs', IP_Geo_Block_Logs::restore_logs( $which ) )
184
+ ) ); // DataTables requires `data`
185
  }
186
 
187
  /**
248
 
249
  foreach ( IP_Geo_Block_Logs::restore_cache() as $key => $val ) {
250
  if ( $anonymize ) {
251
+ $key = IP_Geo_Block_Util::anonymize_ip( $key, TRUE );
252
+ $val['host'] = IP_Geo_Block_Util::anonymize_ip( $val['host'], FALSE );
253
  }
254
 
255
  $csv .= implode( ',', array(
284
 
285
  foreach ( IP_Geo_Block_Logs::restore_cache() as $key => $val ) {
286
  if ( $anonymize ) {
287
+ $key = IP_Geo_Block_Util::anonymize_ip( $key, TRUE );
288
+ $val['host'] = IP_Geo_Block_Util::anonymize_ip( $val['host'], FALSE );
289
  }
290
 
291
  $res[] = array(
428
 
429
  // Convert json to setting data
430
  $input = self::json_to_settings( $json );
 
431
 
432
  // Integrate posted data into current settings because if can be a part of hole data
433
  $input = $parent->array_replace_recursive(
511
  '[extra_ips][white_list]',
512
  '[extra_ips][black_list]',
513
  '[anonymize]',
514
+ '[restrict_api]', // 3.0.13
515
  '[signature]',
516
  '[login_fails]',
517
  '[response_code]',
564
  '[public][simulate]', // 3.0.0
565
  '[public][dnslkup]', // 3.0.3
566
  '[public][response_code]', // 3.0.3
567
+ '[public][response_msg]', // 3.0.3
568
  '[public][redirect_uri]', // 3.0.3
569
  '[public][behavior]', // 3.0.10
570
  '[behavior][time]', // 3.0.10
704
  }
705
 
706
  // Fallback function for PHP 5.3 and under
707
+ // @link https://qiita.com/keromichan16/items/5ff45a77fb0d48e046cc
708
+ // @link https://stackoverflow.com/questions/16498286/why-does-the-php-json-encode-function-convert-utf-8-strings-to-hexadecimal-entit/
709
  private static function json_unescaped_unicode( $input ) {
710
  return preg_replace_callback(
711
  '/(?:\\\\u[0-9a-zA-Z]{4})++/',
767
  $result += array( $matches[1] => $which );
768
  }
769
  }
 
770
  }
771
 
772
  return $result;
777
  *
778
  */
779
  public static function find_exceptions( $target ) {
 
 
780
  switch ( $target ) {
781
  case 'find-admin':
782
+ $res = array();
783
  foreach ( array( 'action', 'page' ) as $which ) {
784
  $res += self::get_blocked_queries( $which );
785
  }
786
+ return $res;
787
 
788
  case 'find-plugins':
789
+ return self::get_blocked_queries( 'plugins' );
 
790
 
791
  case 'find-themes':
792
+ return self::get_blocked_queries( 'themes' );
 
793
  }
794
 
795
+ return array();
796
  }
797
 
798
  /**
809
  $val = IP_Geo_Block_Lkup::gethostbyaddr( '8.8.8.8' );
810
  $key = microtime( TRUE ) - $key;
811
 
812
+ // MySQL (supress WordPress error: Unknown system variable 'block_encryption_mode')
813
+ $buf = @ini_set( 'output_buffering', 0 );
814
+ $dsp = @ini_set( 'display_errors', 0 );
815
+ $log = @ini_set( 'error_log', '/' . 'dev' . '/' . 'null' );
816
+ $err = @error_reporting( 0 );
817
+ global $wpdb;
818
+ $ver = $wpdb->get_var( 'SELECT @@GLOBAL.version' );
819
+ $bem = $wpdb->get_var( 'SELECT @@GLOBAL.block_encryption_mode' ); // `aes-128-ecb` @since MySQL 5.6.17
820
+ @ini_set( 'output_buffering', $buf );
821
+ @ini_set( 'display_errors', $dsp );
822
+ @ini_set( 'error_log', $log );
823
+ @error_reporting( $err );
824
+
825
  // Server, PHP, WordPress
826
  $res = array(
827
  'Server:' => $_SERVER['SERVER_SOFTWARE'],
828
+ 'MySQL:' => $ver . ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG && $bem ? ' (' . $bem . ')' : '' ),
829
  'PHP:' => PHP_VERSION,
830
  'PHP SAPI:' => php_sapi_name(),
831
  'WordPress:' => $GLOBALS['wp_version'],
837
  'ZipArchive:' => class_exists( 'ZipArchive', FALSE ) ? 'yes' : 'no',
838
  'PECL phar:' => class_exists( 'PharData', FALSE ) ? 'yes' : 'no',
839
  'BC Math:' => (extension_loaded('gmp') ? 'gmp ' : '') . (function_exists('bcadd') ? 'yes' : 'no'),
840
+ 'mb_strcut:' => function_exists( 'mb_strcut' ) ? 'yes' : 'no', // @since PHP 4.0.6
841
+ 'OpenSSL:' => defined( 'OPENSSL_RAW_DATA' ) ? 'yes' : 'no', // @since PHP 5.3.3
842
  'SQLite(PDO):' => extension_loaded( 'pdo_sqlite' ) ? 'yes' : 'no',
843
  'DNS lookup:' => ('8.8.8.8' !== $val ? 'available' : 'n/a') . sprintf( ' [%.1f msec]', $key * 1000.0 ),
844
  'User agent:' => $_SERVER['HTTP_USER_AGENT'],
admin/includes/class-admin-rewrite.php CHANGED
@@ -67,7 +67,7 @@ class IP_Geo_Block_Admin_Rewrite {
67
  );
68
 
69
  private function __construct() {
70
- // http://stackoverflow.com/questions/25017381/setting-php-document-root-on-webserver
71
  $this->doc_root = str_replace( DIRECTORY_SEPARATOR, '/', str_replace( $_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME'] ) );
72
  $this->base_uri = str_replace( $this->doc_root, '', str_replace( DIRECTORY_SEPARATOR, '/', IP_GEO_BLOCK_PATH ) );
73
 
@@ -166,7 +166,7 @@ class IP_Geo_Block_Admin_Rewrite {
166
  if ( ! $fs->is_readable( $file ) ) {
167
  return new WP_Error( 'Error',
168
  sprintf( __( 'Unable to read <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $file ) . ' ' .
169
- sprintf( __( 'Or please refer to %s to set it manually.', 'ip-geo-block' ), '<a href="http://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How to fix permission troubles? | IP Geo Block">How to fix permission troubles?</a>' )
170
  );
171
  }
172
  }
@@ -192,7 +192,7 @@ class IP_Geo_Block_Admin_Rewrite {
192
  if ( ! $file || FALSE === $fs->put_contents( $file, implode( PHP_EOL, $content ) ) ) {
193
  $this->show_message(
194
  sprintf( __( 'Unable to write <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $file ) . ' ' .
195
- sprintf( __( 'Or please refer to %s to set it manually.', 'ip-geo-block' ), '<a href="http://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How to fix permission troubles? | IP Geo Block">How to fix permission troubles?</a>' )
196
  );
197
  return FALSE;
198
  }
67
  );
68
 
69
  private function __construct() {
70
+ // https://stackoverflow.com/questions/25017381/setting-php-document-root-on-webserver
71
  $this->doc_root = str_replace( DIRECTORY_SEPARATOR, '/', str_replace( $_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME'] ) );
72
  $this->base_uri = str_replace( $this->doc_root, '', str_replace( DIRECTORY_SEPARATOR, '/', IP_GEO_BLOCK_PATH ) );
73
 
166
  if ( ! $fs->is_readable( $file ) ) {
167
  return new WP_Error( 'Error',
168
  sprintf( __( 'Unable to read <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $file ) . ' ' .
169
+ sprintf( __( 'Or please refer to %s to set it manually.', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How to fix permission troubles? | IP Geo Block">How to fix permission troubles?</a>' )
170
  );
171
  }
172
  }
192
  if ( ! $file || FALSE === $fs->put_contents( $file, implode( PHP_EOL, $content ) ) ) {
193
  $this->show_message(
194
  sprintf( __( 'Unable to write <code>%s</code>. Please check the permission.', 'ip-geo-block' ), $file ) . ' ' .
195
+ sprintf( __( 'Or please refer to %s to set it manually.', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How to fix permission troubles? | IP Geo Block">How to fix permission troubles?</a>' )
196
  );
197
  return FALSE;
198
  }
admin/includes/tab-accesslog.php CHANGED
@@ -16,7 +16,7 @@ class IP_Geo_Block_Admin_Tab {
16
  *----------------------------------------*/
17
  add_settings_section(
18
  $section = $plugin_slug . '-logs',
19
- array( __( 'Validation logs', 'ip-geo-block' ), '<a href="http://www.ipgeoblock.com/codex/record-settings-and-logs.html" title="Record settings and logs | IP Geo Block">' . __( 'Help', 'ip-geo-block' ) . '</a>' ),
20
  ( $options['validation']['reclogs'] ?
21
  array( __CLASS__, 'validation_logs' ) :
22
  array( __CLASS__, 'warn_accesslog' )
@@ -33,9 +33,8 @@ if ( $options['validation']['reclogs'] ):
33
  $html .= '</ul>';
34
 
35
  // Live update
36
- $field = 'live-log';
37
  add_settings_field(
38
- $option_name.'_'.$field,
39
  __( 'Live update', 'ip-geo-block' ) . '<div id="ip-geo-block-live-loading"><div></div><div></div></div>',
40
  array( $context, 'callback_field' ),
41
  $option_slug,
@@ -43,7 +42,7 @@ if ( $options['validation']['reclogs'] ):
43
  array(
44
  'type' => 'html',
45
  'option' => $option_name,
46
- 'field' => $field,
47
  'value' => $html,
48
  'class' => isset( $cookie[ $tab ][1] ) && $cookie[ $tab ][1] === 'o' ? '' : 'ip-geo-block-hide',
49
  )
@@ -65,9 +64,8 @@ if ( $options['validation']['reclogs'] ):
65
  }
66
 
67
  // Select target
68
- $field = 'select_target';
69
  add_settings_field(
70
- $option_name.'_'.$field,
71
  __( 'Select target', 'ip-geo-block' ),
72
  array( $context, 'callback_field' ),
73
  $option_slug,
@@ -75,15 +73,14 @@ if ( $options['validation']['reclogs'] ):
75
  array(
76
  'type' => 'html',
77
  'option' => $option_name,
78
- 'field' => $field,
79
  'value' => '<ul id="' . $plugin_slug . '-select-target">' . $html . '</ul>',
80
  )
81
  );
82
 
83
  // Search in logs
84
- $field = 'search_filter';
85
  add_settings_field(
86
- $option_name.'_'.$field,
87
  __( 'Search in logs', 'ip-geo-block' ),
88
  array( $context, 'callback_field' ),
89
  $option_slug,
@@ -91,16 +88,15 @@ if ( $options['validation']['reclogs'] ):
91
  array(
92
  'type' => 'text',
93
  'option' => $option_name,
94
- 'field' => $field,
95
  'value' => isset( $_GET['s'] ) ? esc_html( $_GET['s'] ) : '', // preset filter
96
  'after' => '<a class="button button-secondary" id="ip-geo-block-reset-filter" title="' . __( 'Reset', 'ip-geo-block' ) . '" href="#!">'. __( 'Reset', 'ip-geo-block' ) . '</a>',
97
  )
98
  );
99
 
100
  // Bulk action
101
- $field = 'bulk_action';
102
  add_settings_field(
103
- $option_name.'_'.$field,
104
  __( 'Bulk action', 'ip-geo-block' ),
105
  array( $context, 'callback_field' ),
106
  $option_slug,
@@ -108,7 +104,7 @@ if ( $options['validation']['reclogs'] ):
108
  array(
109
  'type' => 'select',
110
  'option' => $option_name,
111
- 'field' => $field,
112
  'value' => 0,
113
  'list' => array(
114
  0 => NULL,
@@ -123,9 +119,8 @@ if ( $options['validation']['reclogs'] ):
123
  );
124
 
125
  // Clear logs
126
- $field = 'clear_all';
127
  add_settings_field(
128
- $option_name.'_'.$field,
129
  __( 'Clear logs', 'ip-geo-block' ),
130
  array( $context, 'callback_field' ),
131
  $option_slug,
@@ -133,7 +128,7 @@ if ( $options['validation']['reclogs'] ):
133
  array(
134
  'type' => 'button',
135
  'option' => $option_name,
136
- 'field' => $field,
137
  'value' => __( 'Clear all', 'ip-geo-block' ),
138
  'after' => '<div id="'.$plugin_slug.'-logs"></div>',
139
  'class' => empty( $cookie[ $tab ][1] ) || $cookie[ $tab ][1] !== 'o' ? '' : 'ip-geo-block-hide',
@@ -141,9 +136,8 @@ if ( $options['validation']['reclogs'] ):
141
  );
142
 
143
  // Export logs
144
- $field = 'export_logs';
145
  add_settings_field(
146
- $option_name.'_'.$field,
147
  __( 'Export logs', 'ip-geo-block' ),
148
  array( $context, 'callback_field' ),
149
  $option_slug,
@@ -165,13 +159,13 @@ endif; // $options['validation']['reclogs']
165
  *
166
  */
167
  public static function validation_logs() {
168
- echo '<table id="', IP_Geo_Block::PLUGIN_NAME, '-validation-logs" class="dataTable display" cellspacing="0" width="100%">', "\n", '<thead></thead><tbody></tbody></table>', "\n";
169
  }
170
 
171
  public static function warn_accesslog() {
172
  $context = IP_Geo_Block_Admin::get_instance();
173
  $url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
174
- echo '<p style="padding:0 1em">', sprintf( __( '[ %sRecord &#8220;Logs&#8221;%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
175
  echo '<p style="padding:0 1em">', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
176
  }
177
 
16
  *----------------------------------------*/
17
  add_settings_section(
18
  $section = $plugin_slug . '-logs',
19
+ array( __( 'Validation logs', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/record-settings-and-logs.html" title="Validation logs | IP Geo Block">' . __( 'Help', 'ip-geo-block' ) . '</a>' ),
20
  ( $options['validation']['reclogs'] ?
21
  array( __CLASS__, 'validation_logs' ) :
22
  array( __CLASS__, 'warn_accesslog' )
33
  $html .= '</ul>';
34
 
35
  // Live update
 
36
  add_settings_field(
37
+ $option_name.'_live-log',
38
  __( 'Live update', 'ip-geo-block' ) . '<div id="ip-geo-block-live-loading"><div></div><div></div></div>',
39
  array( $context, 'callback_field' ),
40
  $option_slug,
42
  array(
43
  'type' => 'html',
44
  'option' => $option_name,
45
+ 'field' => 'live-log',
46
  'value' => $html,
47
  'class' => isset( $cookie[ $tab ][1] ) && $cookie[ $tab ][1] === 'o' ? '' : 'ip-geo-block-hide',
48
  )
64
  }
65
 
66
  // Select target
 
67
  add_settings_field(
68
+ $option_name.'_select_target',
69
  __( 'Select target', 'ip-geo-block' ),
70
  array( $context, 'callback_field' ),
71
  $option_slug,
73
  array(
74
  'type' => 'html',
75
  'option' => $option_name,
76
+ 'field' => 'select_target',
77
  'value' => '<ul id="' . $plugin_slug . '-select-target">' . $html . '</ul>',
78
  )
79
  );
80
 
81
  // Search in logs
 
82
  add_settings_field(
83
+ $option_name.'_search_filter',
84
  __( 'Search in logs', 'ip-geo-block' ),
85
  array( $context, 'callback_field' ),
86
  $option_slug,
88
  array(
89
  'type' => 'text',
90
  'option' => $option_name,
91
+ 'field' => 'search_filter',
92
  'value' => isset( $_GET['s'] ) ? esc_html( $_GET['s'] ) : '', // preset filter
93
  'after' => '<a class="button button-secondary" id="ip-geo-block-reset-filter" title="' . __( 'Reset', 'ip-geo-block' ) . '" href="#!">'. __( 'Reset', 'ip-geo-block' ) . '</a>',
94
  )
95
  );
96
 
97
  // Bulk action
 
98
  add_settings_field(
99
+ $option_name.'_bulk_action',
100
  __( 'Bulk action', 'ip-geo-block' ),
101
  array( $context, 'callback_field' ),
102
  $option_slug,
104
  array(
105
  'type' => 'select',
106
  'option' => $option_name,
107
+ 'field' => 'bulk_action',
108
  'value' => 0,
109
  'list' => array(
110
  0 => NULL,
119
  );
120
 
121
  // Clear logs
 
122
  add_settings_field(
123
+ $option_name.'_clear_all',
124
  __( 'Clear logs', 'ip-geo-block' ),
125
  array( $context, 'callback_field' ),
126
  $option_slug,
128
  array(
129
  'type' => 'button',
130
  'option' => $option_name,
131
+ 'field' => 'clear_all',
132
  'value' => __( 'Clear all', 'ip-geo-block' ),
133
  'after' => '<div id="'.$plugin_slug.'-logs"></div>',
134
  'class' => empty( $cookie[ $tab ][1] ) || $cookie[ $tab ][1] !== 'o' ? '' : 'ip-geo-block-hide',
136
  );
137
 
138
  // Export logs
 
139
  add_settings_field(
140
+ $option_name.'_export_logs',
141
  __( 'Export logs', 'ip-geo-block' ),
142
  array( $context, 'callback_field' ),
143
  $option_slug,
159
  *
160
  */
161
  public static function validation_logs() {
162
+ echo '<table id="', IP_Geo_Block::PLUGIN_NAME, '-validation-logs" class="', IP_Geo_Block::PLUGIN_NAME, '-dataTable display" cellspacing="0" width="100%">', "\n", '<thead></thead><tbody></tbody></table>', "\n";
163
  }
164
 
165
  public static function warn_accesslog() {
166
  $context = IP_Geo_Block_Admin::get_instance();
167
  $url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
168
+ echo '<p style="padding:0 1em">', sprintf( __( '[ %sRecord &#8220;Validation logs&#8221;%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
169
  echo '<p style="padding:0 1em">', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
170
  }
171
 
admin/includes/tab-attribution.php CHANGED
@@ -8,21 +8,16 @@ class IP_Geo_Block_Admin_Tab {
8
  $option_name = IP_Geo_Block::OPTION_NAME
9
  );
10
 
11
- $section = IP_Geo_Block::PLUGIN_NAME . '-attribution';
12
- $field = 'attribution';
13
-
14
  add_settings_section(
15
- $section,
16
  __( 'Attribution links', 'ip-geo-block' ),
17
  NULL,
18
  $option_slug
19
  );
20
 
21
- $providers = IP_Geo_Block_Provider::get_providers( 'link' );
22
-
23
- foreach ( $providers as $provider => $key ) {
24
  add_settings_field(
25
- $option_name.'_'.$field.'_'.$provider,
26
  $provider,
27
  array( $context, 'callback_field' ),
28
  $option_slug,
@@ -30,7 +25,7 @@ class IP_Geo_Block_Admin_Tab {
30
  array(
31
  'type' => 'html',
32
  'option' => $option_name,
33
- 'field' => $field,
34
  'value' => $key,
35
  )
36
  );
8
  $option_name = IP_Geo_Block::OPTION_NAME
9
  );
10
 
 
 
 
11
  add_settings_section(
12
+ $section = IP_Geo_Block::PLUGIN_NAME . '-attribution',
13
  __( 'Attribution links', 'ip-geo-block' ),
14
  NULL,
15
  $option_slug
16
  );
17
 
18
+ foreach ( IP_Geo_Block_Provider::get_providers( 'link' ) as $provider => $key ) {
 
 
19
  add_settings_field(
20
+ $option_name.'_attribution_'.$provider,
21
  $provider,
22
  array( $context, 'callback_field' ),
23
  $option_slug,
25
  array(
26
  'type' => 'html',
27
  'option' => $option_name,
28
+ 'field' => 'attribution',
29
  'value' => $key,
30
  )
31
  );
admin/includes/tab-geolocation.php CHANGED
@@ -35,18 +35,17 @@ class IP_Geo_Block_Admin_Tab {
35
  $cookie = $context->get_cookie();
36
  $cookie = empty( $cookie[ $tab ] ) ? 0 : (int)end( $cookie[ $tab ] );
37
 
38
- $field = 'service';
39
  $provider = array_keys( $providers );
40
  add_settings_field(
41
- $option_name.'_'.$field,
42
- __( 'Geolocation service', 'ip-geo-block' ),
43
  array( $context, 'callback_field' ),
44
  $option_slug,
45
  $section,
46
  array(
47
  'type' => 'select',
48
  'option' => $option_name,
49
- 'field' => $field,
50
  'value' => $provider[ $cookie ],
51
  'list' => $list,
52
  )
@@ -55,18 +54,17 @@ class IP_Geo_Block_Admin_Tab {
55
  // preset IP address
56
  if ( isset( $_GET['s'] ) ) {
57
  $list = preg_replace(
58
- array( '/\.\*\*\*.*$/', '/\*\*\*.*$/' ),
59
- array( '.0', '000' ),
60
- $_GET['s']
61
- ); // Anonymize IP address
62
  $list = filter_var( $list, FILTER_VALIDATE_IP ) ? $list : '';
63
  } else {
64
  $list = '';
65
  }
66
 
67
- $field = 'ip_address';
68
  add_settings_field(
69
- $option_name.'_'.$field,
70
  __( 'IP address', 'ip-geo-block' ),
71
  array( $context, 'callback_field' ),
72
  $option_slug,
@@ -74,38 +72,37 @@ class IP_Geo_Block_Admin_Tab {
74
  array(
75
  'type' => 'text',
76
  'option' => $option_name,
77
- 'field' => $field,
78
  'value' => $list,
79
  )
80
  );
81
 
82
  // Anonymize IP address
83
- $field = 'anonymize';
84
  add_settings_field(
85
- $option_name.'_'.$field,
86
- __( '<dfn title="IP address is always encrypted on recording in cache and logs. Moreover, this option makes the IP address anonymous and restricted on sending to the 3rd parties such as geolocation APIs or whois service.">Anonymize IP address and restrict 3rd party APIs</dfn>', 'ip-geo-block' ),
87
  array( $context, 'callback_field' ),
88
  $option_slug,
89
  $section,
90
  array(
91
  'type' => 'checkbox',
92
  'option' => $option_name,
93
- 'field' => $field,
94
- 'value' => ! empty( $options[ $field ] ) ? TRUE : FALSE,
95
  )
96
  );
97
 
98
- $field = 'get_location';
99
  add_settings_field(
100
- $option_name.'_'.$field,
101
- __( 'Find geolocation', 'ip-geo-block' ),
102
  array( $context, 'callback_field' ),
103
  $option_slug,
104
  $section,
105
  array(
106
  'type' => 'button',
107
  'option' => $option_name,
108
- 'field' => $field,
109
  'value' => __( 'Search now', 'ip-geo-block' ),
110
  'after' => '<div id="ip-geo-block-loading"></div>',
111
  )
35
  $cookie = $context->get_cookie();
36
  $cookie = empty( $cookie[ $tab ] ) ? 0 : (int)end( $cookie[ $tab ] );
37
 
 
38
  $provider = array_keys( $providers );
39
  add_settings_field(
40
+ $option_name.'_service',
41
+ __( 'Geolocation API', 'ip-geo-block' ),
42
  array( $context, 'callback_field' ),
43
  $option_slug,
44
  $section,
45
  array(
46
  'type' => 'select',
47
  'option' => $option_name,
48
+ 'field' => 'service',
49
  'value' => $provider[ $cookie ],
50
  'list' => $list,
51
  )
54
  // preset IP address
55
  if ( isset( $_GET['s'] ) ) {
56
  $list = preg_replace(
57
+ array( '/\.\*+$/', '/:\w*\*+$/', '/(::.*)::$/' ),
58
+ array( '.0', '::', '$1' ),
59
+ trim( $_GET['s'] )
60
+ ); // de-anonymize if `***` exists
61
  $list = filter_var( $list, FILTER_VALIDATE_IP ) ? $list : '';
62
  } else {
63
  $list = '';
64
  }
65
 
 
66
  add_settings_field(
67
+ $option_name.'_ip_address',
68
  __( 'IP address', 'ip-geo-block' ),
69
  array( $context, 'callback_field' ),
70
  $option_slug,
72
  array(
73
  'type' => 'text',
74
  'option' => $option_name,
75
+ 'field' => 'ip_address',
76
  'value' => $list,
77
  )
78
  );
79
 
80
  // Anonymize IP address
 
81
  add_settings_field(
82
+ $option_name.'_anonymize',
83
+ __( '<dfn title="IP address is always encrypted on recording in Cache and Logs. Moreover, this option replaces the end of IP address with &#8220;***&#8221; to make it anonymous.">Anonymize IP address</dfn>', 'ip-geo-block' ),
84
  array( $context, 'callback_field' ),
85
  $option_slug,
86
  $section,
87
  array(
88
  'type' => 'checkbox',
89
  'option' => $option_name,
90
+ 'field' => 'anonymize',
91
+ 'value' => ( ! empty( $options['anonymize'] ) || ! empty( $options['restrict_api'] ) ) ? TRUE : FALSE,
92
  )
93
  );
94
 
95
+ // Search geolocation
96
  add_settings_field(
97
+ $option_name.'_get_location',
98
+ __( 'Search geolocation', 'ip-geo-block' ),
99
  array( $context, 'callback_field' ),
100
  $option_slug,
101
  $section,
102
  array(
103
  'type' => 'button',
104
  'option' => $option_name,
105
+ 'field' => 'get_location',
106
  'value' => __( 'Search now', 'ip-geo-block' ),
107
  'after' => '<div id="ip-geo-block-loading"></div>',
108
  )
admin/includes/tab-network.php CHANGED
@@ -56,9 +56,8 @@ class IP_Geo_Block_Admin_Tab {
56
  $html .= '">' . __( 'Apply', 'ip-geo-block' ) . '</a></li>';
57
  $html .= '</ul>';
58
 
59
- $field = 'chart-size';
60
  add_settings_field(
61
- $option_name.'_'.$field,
62
  __( 'Chart display layout', 'ip-geo-block' ),
63
  array( $context, 'callback_field' ),
64
  $option_slug,
@@ -86,9 +85,8 @@ class IP_Geo_Block_Admin_Tab {
86
  . ($key == self::$controls['time'] ? ' checked="checked"' : '') . ' />' . $val . '</label></li>' . "\n";
87
  }
88
 
89
- $field = 'select_duration';
90
  add_settings_field(
91
- $option_name.'_'.$field,
92
  __( 'Duration to retrieve', 'ip-geo-block' ),
93
  array( $context, 'callback_field' ),
94
  $option_slug,
@@ -111,7 +109,7 @@ class IP_Geo_Block_Admin_Tab {
111
  if ( self::$controls['warn'] ) {
112
  $context = IP_Geo_Block_Admin::get_instance();
113
  $url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 5 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-5' );
114
- echo '<p style="padding:0 1em">', sprintf( __( '[ %sRecord &#8220;Logs&#8221;%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '"><strong>', '</strong></a>' ), '</p>', "\n";
115
  echo '<p style="padding:0 1em">', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
116
  }
117
 
56
  $html .= '">' . __( 'Apply', 'ip-geo-block' ) . '</a></li>';
57
  $html .= '</ul>';
58
 
 
59
  add_settings_field(
60
+ $option_name.'_chart-size',
61
  __( 'Chart display layout', 'ip-geo-block' ),
62
  array( $context, 'callback_field' ),
63
  $option_slug,
85
  . ($key == self::$controls['time'] ? ' checked="checked"' : '') . ' />' . $val . '</label></li>' . "\n";
86
  }
87
 
 
88
  add_settings_field(
89
+ $option_name.'_select_duration',
90
  __( 'Duration to retrieve', 'ip-geo-block' ),
91
  array( $context, 'callback_field' ),
92
  $option_slug,
109
  if ( self::$controls['warn'] ) {
110
  $context = IP_Geo_Block_Admin::get_instance();
111
  $url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 5 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-5' );
112
+ echo '<p style="padding:0 1em">', sprintf( __( '[ %sRecord &#8220;Validation logs&#8221;%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '"><strong>', '</strong></a>' ), '</p>', "\n";
113
  echo '<p style="padding:0 1em">', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
114
  }
115
 
admin/includes/tab-settings.php CHANGED
@@ -9,9 +9,20 @@ class IP_Geo_Block_Admin_Tab {
9
  $options = IP_Geo_Block::get_option();
10
  $plugin_slug = IP_Geo_Block::PLUGIN_NAME; // 'ip-geo-block'
11
 
 
 
 
 
 
 
 
 
 
 
 
12
  /**
13
  * Register a setting and its sanitization callback.
14
- * @link http://codex.wordpress.org/Function_Reference/register_setting
15
  *
16
  * register_setting( $option_group, $option_name, $sanitize_callback );
17
  * @param string $option_group A settings group name.
@@ -27,7 +38,7 @@ class IP_Geo_Block_Admin_Tab {
27
 
28
  /**
29
  * Add new section to a new page inside the existing page.
30
- * @link http://codex.wordpress.org/Function_Reference/add_settings_section
31
  *
32
  * add_settings_section( $id, $title, $callback, $page );
33
  * @param string $id String for use in the 'id' attribute of tags.
@@ -41,14 +52,14 @@ class IP_Geo_Block_Admin_Tab {
41
  *----------------------------------------*/
42
  add_settings_section(
43
  $section = $plugin_slug . '-validation-rule',
44
- __( 'Validation rule settings', 'ip-geo-block' ),
45
  NULL,
46
  $option_slug
47
  );
48
 
49
  /**
50
  * Register a settings field to the settings page and section.
51
- * @link http://codex.wordpress.org/Function_Reference/add_settings_field
52
  *
53
  * add_settings_field( $id, $title, $callback, $page, $section, $args );
54
  * @param string $id String for use in the 'id' attribute of tags.
@@ -61,9 +72,8 @@ class IP_Geo_Block_Admin_Tab {
61
  // Get the country code of client
62
  $key = IP_Geo_Block::get_geolocation( $val = IP_Geo_Block::get_ip_address( $options ) );
63
 
64
- $field = 'ip_client';
65
  add_settings_field(
66
- $option_name.'_'.$field,
67
  __( '<dfn title="You can confirm the appropriate Geolocation APIs and country code by referring &#8220;Scan country code&#8221;.">Your IP address / Country</dfn>', 'ip-geo-block' ),
68
  array( $context, 'callback_field' ),
69
  $option_slug,
@@ -71,9 +81,9 @@ class IP_Geo_Block_Admin_Tab {
71
  array(
72
  'type' => 'html',
73
  'option' => $option_name,
74
- 'field' => $field,
75
  'value' => '<span class="ip-geo-block-ip-addr">' . esc_html( $key['ip'] . ' / ' . ( $key['code'] && isset( $key['provider'] ) ? $key['code'] . ' (' . $key['provider'] . ')' : __( 'UNKNOWN', 'ip-geo-block' ) ) ) . '</span>',
76
- 'after' => '&nbsp;<a class="button button-secondary" id="ip-geo-block-scan-' . $field . '" title="' . __( 'Scan all the APIs you selected at Geolocation API settings', 'ip-geo-block' ) . '" href="#!">' . __( 'Scan country code', 'ip-geo-block' ) . '</a><div id="ip-geo-block-scanning-' . $field . '"></div>',
77
  )
78
  );
79
 
@@ -81,9 +91,8 @@ if ( $key = IP_Geo_Block_Util::get_server_ip() && $key !== $val && ! IP_Geo_Bloc
81
  // Get the country code of server
82
  $key = IP_Geo_Block::get_geolocation( $_SERVER['SERVER_ADDR'] );
83
 
84
- $field = 'ip_server';
85
  add_settings_field(
86
- $option_name.'_'.$field,
87
  __( '<dfn title="You can confirm the appropriate Geolocation APIs and country code by referring &#8220;Scan country code&#8221;.">Server IP address / Country</dfn>', 'ip-geo-block' ),
88
  array( $context, 'callback_field' ),
89
  $option_slug,
@@ -91,9 +100,9 @@ if ( $key = IP_Geo_Block_Util::get_server_ip() && $key !== $val && ! IP_Geo_Bloc
91
  array(
92
  'type' => 'html',
93
  'option' => $option_name,
94
- 'field' => $field,
95
  'value' => '<span class="ip-geo-block-ip-addr">' . esc_html( $key['ip'] . ' / ' . ( $key['code'] && isset( $key['provider'] ) ? $key['code'] . ' (' . $key['provider'] . ')' : __( 'UNKNOWN', 'ip-geo-block' ) ) ) . '</span>',
96
- 'after' => '&nbsp;<a class="button button-secondary" id="ip-geo-block-scan-' . $field . '" title="' . __( 'Scan all the APIs you selected at Geolocation API settings', 'ip-geo-block' ) . '" href="#!">' . __( 'Scan country code', 'ip-geo-block' ) . '</a><div id="ip-geo-block-scanning-' . $field . '"></div>',
97
  )
98
  );
99
  endif;
@@ -107,23 +116,13 @@ endif;
107
 
108
  $rule_desc = array(
109
  __( 'Please select either &#8220;Whitelist&#8221; or &#8220;Blacklist&#8221;.', 'ip-geo-block' ),
110
- __( '<dfn title="&#8220;Block by country&#8221; will be bypassed in case of empty. The special code &#8220;XX&#8221; is assigned as private IP address including localhost. And &#8220;ZZ&#8221; is for unknown IP address (i.e. not in the geolocation databases). Please use &#8220;YY&#8221; if you need the code that does not correspond to any of the countries.">Whitelist of country code</dfn>', 'ip-geo-block' ) . '<br />(<a rel="noreferrer" href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" title="ISO 3166-1 alpha-2 - Wikipedia, the free encyclopedia">ISO 3166-1 alpha-2</a>)',
111
- __( '<dfn title="&#8220;Block by country&#8221; will be bypassed in case of empty. The special code &#8220;XX&#8221; is assigned as private IP address including localhost. And &#8220;ZZ&#8221; is for unknown IP address (i.e. not in the geolocation databases). Please use &#8220;YY&#8221; if you need the code that does not correspond to any of the countries.">Blacklist of country code</dfn>', 'ip-geo-block' ) . '<br />(<a rel="noreferrer" href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" title="ISO 3166-1 alpha-2 - Wikipedia, the free encyclopedia">ISO 3166-1 alpha-2</a>)',
112
- );
113
-
114
- $comma = array(
115
- '<span class="ip-geo-block-sup">' . __( '(comma separated)', 'ip-geo-block' ) . '</span>',
116
- '<span class="ip-geo-block-sup">' . __( '(comma or RET separated)', 'ip-geo-block' ) . '</span>',
117
- '<span title="' . __( 'Toggle selection', 'ip-geo-block' ) . '"></span>',
118
- '<span title="' . __( 'Find blocked requests in &#8220;Logs&#8220;', 'ip-geo-block' ) . '"></span>',
119
- __( 'Before adding as &#8220;Exception&#8221;, please click on &#8220;<a class="ip-geo-block-icon ip-geo-block-icon-alert" title="This button is just a sample."><span></span></a>&#8221; button (if exists) attached to the following list to confirm that the blocked request is not malicious.', 'ip-geo-block' ),
120
- __( 'Open CIDR calculator for IPv4 / IPv6.', 'ip-geo-block' ),
121
  );
122
 
123
  // Matching rule
124
- $field = 'matching_rule';
125
  add_settings_field(
126
- $option_name.'_'.$field,
127
  '<dfn title="' . $rule_desc[0] . '">' . __( 'Matching rule', 'ip-geo-block' ) . '</dfn>',
128
  array( $context, 'callback_field' ),
129
  $option_slug,
@@ -131,8 +130,8 @@ endif;
131
  array(
132
  'type' => 'select',
133
  'option' => $option_name,
134
- 'field' => $field,
135
- 'value' => $options[ $field ],
136
  'list' => $rule,
137
  'desc' => array(
138
  -1 => $rule_desc[0],
@@ -144,9 +143,8 @@ endif;
144
  );
145
 
146
  // Country code for matching rule (ISO 3166-1 alpha-2)
147
- $field = 'white_list';
148
  add_settings_field(
149
- $option_name.'_'.$field,
150
  $rule_desc[1],
151
  array( $context, 'callback_field' ),
152
  $option_slug,
@@ -154,16 +152,15 @@ endif;
154
  array(
155
  'type' => 'text',
156
  'option' => $option_name,
157
- 'field' => $field,
158
- 'value' => $options[ $field ],
159
- 'after' => $comma[0],
160
  'class' => $options['matching_rule'] == 0 ? '' : 'ip-geo-block-hide',
161
  )
162
  );
163
 
164
- $field = 'black_list';
165
  add_settings_field(
166
- $option_name.'_'.$field,
167
  $rule_desc[2],
168
  array( $context, 'callback_field' ),
169
  $option_slug,
@@ -171,18 +168,16 @@ endif;
171
  array(
172
  'type' => 'text',
173
  'option' => $option_name,
174
- 'field' => $field,
175
- 'value' => $options[ $field ],
176
- 'after' => $comma[0],
177
  'class' => $options['matching_rule'] == 1 ? '' : 'ip-geo-block-hide',
178
  )
179
  );
180
 
181
  // Use AS number
182
- $field = 'Maxmind';
183
- $key = 'use_asn';
184
  add_settings_field(
185
- $option_name.'_'.$field.'_'.$key,
186
  __( '<dfn title="It enables utilizing &#8220;AS number&#8221; in the &#8220;Whitelist/Blacklist of extra IP addresses&#8221; to specify a group of IP networks.">Use Autonomous System Number</dfn>', 'ip-geo-block' ) .
187
  ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)',
188
  array( $context, 'callback_field' ),
@@ -191,63 +186,58 @@ endif;
191
  array(
192
  'type' => 'checkbox',
193
  'option' => $option_name,
194
- 'field' => $field,
195
- 'sub-field' => $key,
196
- 'value' => 1 === (int)$options[ $field ][ $key ],
197
- 'after' => '<p class="ip-geo-block-desc">' . sprintf( __( 'Some useful tools to find ASN are introduced in &#8220;%s&#8221;.', 'ip-geo-block' ), '<a rel="noreferrer" href="http://www.ipgeoblock.com/codex/utilizing-asnumber.html" title="Utilizing AS number | IP Geo Block">Utilizing AS number</a>' ) . '</p>',
198
  )
199
  );
200
 
201
  // White list of extra IP addresses prior to country code (CIDR, ASN)
202
- $field = 'extra_ips';
203
- $key = 'white_list';
204
  add_settings_field(
205
- $option_name.'_'.$field.'_'.$key,
206
  __( '<dfn title="e.g. &#8220;192.0.64.0/18&#8221; for Jetpack server, &#8220;69.46.36.0/27&#8221; for WordFence server or &#8220;AS32934&#8221; for Facebook.">Whitelist of extra IP addresses prior to country code</dfn>', 'ip-geo-block' ) .
207
  ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" title="Classless Inter-Domain Routing - Wikipedia">CIDR</a>' .
208
  ', <a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)' .
209
- '<a class="ip-geo-block-icon ip-geo-block-icon-cidr" title="' . $comma[5] . '"><span class="dashicons dashicons-sos"></span></a>',
210
  array( $context, 'callback_field' ),
211
  $option_slug,
212
  $section,
213
  array(
214
  'type' => 'textarea',
215
  'option' => $option_name,
216
- 'field' => $field,
217
- 'sub-field' => $key,
218
- 'value' => $options[ $field ][ $key ],
219
  'placeholder' => '192.168.0.0/16,2001:db8::/96,AS1234',
220
- 'after' => $comma[1],
221
  )
222
  );
223
 
224
  // Black list of extra IP addresses prior to country code (CIDR, ASN)
225
- $key = 'black_list';
226
  add_settings_field(
227
- $option_name.'_'.$field.'_'.$key,
228
  __( '<dfn title="Server level access control is recommended (e.g. .htaccess).">Blacklist of extra IP addresses prior to country code</dfn>', 'ip-geo-block' ) .
229
  ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" title="Classless Inter-Domain Routing - Wikipedia">CIDR</a>' .
230
  ', <a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)' .
231
- '<a class="ip-geo-block-icon ip-geo-block-icon-cidr" title="' . $comma[5] . '"><span class="dashicons dashicons-sos"></span></a>',
232
  array( $context, 'callback_field' ),
233
  $option_slug,
234
  $section,
235
  array(
236
  'type' => 'textarea',
237
  'option' => $option_name,
238
- 'field' => $field,
239
- 'sub-field' => $key,
240
- 'value' => $options[ $field ][ $key ],
241
  'placeholder' => '192.168.0.0/16,2001:db8::/96,AS1234',
242
- 'after' => $comma[1],
243
  )
244
  );
245
 
246
  // $_SERVER keys to retrieve extra IP addresses
247
- $field = 'validation';
248
- $key = 'proxy';
249
  add_settings_field(
250
- $option_name.'_'.$field.'_'.$key,
251
  __( '<dfn title="If your server is placed behind the proxy server or the load balancing server, you need to put the appropriate key such as &#8220;HTTP_X_FORWARDED_FOR&#8221;, &#8220;HTTP_X_REAL_IP&#8221; or something like that to retrieve the client IP address.">$_SERVER keys to retrieve extra IP addresses</dfn>', 'ip-geo-block' ),
252
  array( $context, 'callback_field' ),
253
  $option_slug,
@@ -255,18 +245,17 @@ endif;
255
  array(
256
  'type' => 'text',
257
  'option' => $option_name,
258
- 'field' => $field,
259
- 'sub-field' => $key,
260
- 'value' => $options[ $field ][ $key ],
261
  'placeholder' => IP_Geo_Block_Util::get_proxy_var(),
262
- 'after' => $comma[0],
263
  )
264
  );
265
 
266
  // Bad signatures
267
- $field = 'signature';
268
  add_settings_field(
269
- $option_name.'_'.$field,
270
  __( '<dfn title="It validates malicious signatures independently of &#8220;Block by country&#8221; and &#8220;Prevent Zero-day Exploit&#8221; for the target &#8220;Admin area&#8221;, &#8220;Admin ajax/post&#8221;, &#8220;Plugins area&#8221; and &#8220;Themes area&#8221;.">Bad signatures in query</dfn> <nobr>(<a class="ip-geo-block-icon ip-geo-block-icon-cycle" id="ip-geo-block-decode" title="When you find ugly character string in the text area, please click to restore."><span></span></a>)</nobr>', 'ip-geo-block' ),
271
  array( $context, 'callback_field' ),
272
  $option_slug,
@@ -274,14 +263,14 @@ endif;
274
  array(
275
  'type' => 'textarea',
276
  'option' => $option_name,
277
- 'field' => $field,
278
- 'value' => $options[ $field ],
279
- 'after' => $comma[1],
280
  )
281
  );
282
 
283
  // Prevent malicious upload - white list of file extention and MIME type
284
- $list = '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Select allowed MIME type.">Whitelist of allowed MIME type</dfn>', 'ip-geo-block' ) . "<a class=\"ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide\">" . $comma[2] . "</a>\n<li class=\"ip-geo-block-hide\"><ul class=\"ip-geo-block-float\">\n";
285
 
286
  // get_allowed_mime_types() in wp-includes/functions.php @since 2.8.6
287
  foreach ( IP_Geo_Block_Util::get_allowed_mime_types() as $key => $val ) {
@@ -296,14 +285,12 @@ endif;
296
  $list .= "</ul></li></ul>\n";
297
 
298
  // Verify capability
299
- $list .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the capabilities to be verified. Depending on the particular type of uploader, certain capability may be required. Default is &#8220;upload_files&#8221; for Administrator, Editor and Author. This verification will be skipped if empty.">Capabilities to be verified</dfn>', 'ip-geo-block' ) . '&nbsp;<span class="ip-geo-block-desc">' . __( '(&thinsp;See &#8220;<a rel="noreferrer" href="https://codex.wordpress.org/Roles_and_Capabilities" title="Roles and Capabilities &laquo; WordPress Codex">Roles and Capabilities</a>&#8221;&thinsp;)', 'ip-geo-block' ) . '</span>' . "\n";
300
- $list .= '<li class="ip-geo-block-hide"><ul><li><input type="text" id="ip_geo_block_settings_mimetype_capability" name="ip_geo_block_settings[mimetype][capability]" class="regular-text code" placeholder="upload_files" value="' . esc_attr( implode( ',', $options['mimetype']['capability'] ) ) . '" />' . $comma[0] . '</li></ul></li></ul>';
301
 
302
  // Prevent malicious file uploading
303
- $field = 'validation';
304
- $key = 'mimetype';
305
  add_settings_field(
306
- $option_name.'_'.$field.'_'.$key,
307
  __( '<dfn title="It restricts the file types on upload in order to block malware and backdoor via both back-end and front-end. Please consider to select &#8220;mu-plugins&#8221; (ip-geo-block-mu.php) at &#8220;Validation timing&#8221; so that other staff would not fetch the uploaded files before this validation.">Prevent malicious file uploading</dfn>', 'ip-geo-block' ),
308
  array( $context, 'callback_field' ),
309
  $option_slug,
@@ -311,9 +298,9 @@ endif;
311
  array(
312
  'type' => 'select',
313
  'option' => $option_name,
314
- 'field' => $field,
315
- 'sub-field' => $key,
316
- 'value' => $options[ $field ][ $key ],
317
  'list' => array(
318
  0 => __( 'Disable', 'ip-geo-block' ),
319
  1 => __( 'Verify file extension and MIME type', 'ip-geo-block' ),
@@ -324,18 +311,17 @@ endif;
324
  );
325
 
326
  // Response code (RFC 2616)
327
- $field = 'response_code';
328
  add_settings_field(
329
- $option_name.'_'.$field,
330
- sprintf( __( '<dfn title="You can put your original 403.php and so on into your theme directory.">Response code</dfn> %s', 'ip-geo-block' ), '(<a rel="noreferrer" href="http://tools.ietf.org/html/rfc2616#section-10" title="RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1">RFC 2616</a>)' ),
331
  array( $context, 'callback_field' ),
332
  $option_slug,
333
  $section,
334
  array(
335
  'type' => 'select',
336
  'option' => $option_name,
337
- 'field' => $field,
338
- 'value' => $options[ $field ],
339
  'list' => array(
340
  200 => '200 OK',
341
  301 => '301 Moved Permanently',
@@ -354,9 +340,8 @@ endif;
354
  );
355
 
356
  // Redirect URI
357
- $field = 'redirect_uri';
358
  add_settings_field(
359
- $option_name.'_'.$field,
360
  __( '<dfn title="Specify the URL for response code 2xx and 3xx. If it is pointed to a public facing page, visitors would not be blocked on the page to prevent loop of redirection even when you enable [Block by country] in [Front-end target settings] section. Empty URL is altered to your home.">Redirect URL</dfn>', 'ip-geo-block' ),
361
  array( $context, 'callback_field' ),
362
  $option_slug,
@@ -364,17 +349,16 @@ endif;
364
  array(
365
  'type' => 'text',
366
  'option' => $option_name,
367
- 'field' => $field,
368
- 'value' => $options[ $field ],
369
  'class' => $options['response_code'] < 400 ? '' : 'ip-geo-block-hide',
370
  'placeholder' => '/about/',
371
  )
372
  );
373
 
374
  // Response message
375
- $field = 'response_msg';
376
  add_settings_field(
377
- $option_name.'_'.$field,
378
  __( '<dfn title="Specify the message for response code 4xx and 5xx.">Response message</dfn>', 'ip-geo-block' ),
379
  array( $context, 'callback_field' ),
380
  $option_slug,
@@ -382,44 +366,17 @@ endif;
382
  array(
383
  'type' => 'text',
384
  'option' => $option_name,
385
- 'field' => $field,
386
- 'value' => $options[ $field ],
387
  'class' => $options['response_code'] >= 400 ? '' : 'ip-geo-block-hide',
388
  )
389
  );
390
 
391
- // Max number of failed login attempts per IP address
392
- $field = 'login_fails';
393
- add_settings_field(
394
- $option_name.'_'.$field,
395
- __( '<dfn title="This is applied to &#8220;XML-RPC&#8221; and &#8220;Login form&#8221;. Lockout period is defined as expiration time at &#8220;Privacy and record settings&#8221;.">Max number of failed login attempts per IP address</dfn>', 'ip-geo-block' ),
396
- array( $context, 'callback_field' ),
397
- $option_slug,
398
- $section,
399
- array(
400
- 'type' => 'select',
401
- 'option' => $option_name,
402
- 'field' => $field,
403
- 'value' => $options[ $field ],
404
- 'list' => array(
405
- -1 => 'Disable',
406
- 0 => 0,
407
- 1 => 1,
408
- 3 => 3,
409
- 5 => 5,
410
- 7 => 7,
411
- 10 => 10,
412
- ),
413
- )
414
- );
415
-
416
  // Validation timing
417
- $field = 'validation';
418
- $key = 'timing';
419
- $options[ $field ][ $key ] = IP_Geo_Block_Opts::get_validation_timing();
420
 
421
  add_settings_field(
422
- $option_name.'_'.$field.'_'.$key,
423
  '<dfn title="' . __( 'Select when to run the validation.', 'ip-geo-block' ) . '">' . __( 'Validation timing', 'ip-geo-block' ) . '</dfn>',
424
  array( $context, 'callback_field' ),
425
  $option_slug,
@@ -427,16 +384,16 @@ endif;
427
  array(
428
  'type' => 'select',
429
  'option' => $option_name,
430
- 'field' => $field,
431
- 'sub-field' => $key,
432
- 'value' => $options[ $field ][ $key ],
433
  'list' => array(
434
  0 => __( '&#8220;init&#8221; action hook', 'ip-geo-block' ),
435
  1 => __( '&#8220;mu-plugins&#8221; (ip-geo-block-mu.php)', 'ip-geo-block' ),
436
  ),
437
  'desc' => array(
438
  0 => __( 'Validate at &#8220;init&#8221; action hook in the same manner as typical plugins.', 'ip-geo-block' ),
439
- 1 => __( 'Validate at an earlier phase than other typical plugins. It can reduce load on server but has <a rel=\'noreferrer\' href=\'http://www.ipgeoblock.com/codex/validation-timing.html\' title=\'Validation timing | IP Geo Block\'>some restrictions</a>.', 'ip-geo-block' ),
440
  ),
441
  )
442
  );
@@ -446,7 +403,7 @@ endif;
446
  *----------------------------------------*/
447
  add_settings_section(
448
  $section = $plugin_slug . '-validation-target',
449
- __( 'Back-end target settings', 'ip-geo-block' ),
450
  array( __CLASS__, 'note_target' ),
451
  $option_slug
452
  );
@@ -463,38 +420,62 @@ endif;
463
  );
464
 
465
  // Comment post
466
- $field = 'validation';
467
- $key = 'comment';
468
  add_settings_field(
469
- $option_name.'_'.$field.'_'.$key,
470
- $target[ $key ],
471
  array( $context, 'callback_field' ),
472
  $option_slug,
473
  $section,
474
  array(
475
  'type' => 'checkbox',
476
  'option' => $option_name,
477
- 'field' => $field,
478
- 'sub-field' => $key,
479
- 'value' => $options[ $field ][ $key ],
480
  'text' => __( 'Block by country', 'ip-geo-block' ),
481
  )
482
  );
483
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  // XML-RPC
485
- $key = 'xmlrpc';
486
  add_settings_field(
487
- $option_name.'_'.$field.'_'.$key,
488
- $target[ $key ],
489
  array( $context, 'callback_field' ),
490
  $option_slug,
491
  $section,
492
  array(
493
  'type' => 'select',
494
  'option' => $option_name,
495
- 'field' => $field,
496
- 'sub-field' => $key,
497
- 'value' => $options[ $field ][ $key ],
498
  'list' => array(
499
  0 => __( 'Disable', 'ip-geo-block' ),
500
  1 => __( 'Block by country', 'ip-geo-block' ),
@@ -517,21 +498,20 @@ endif;
517
  }
518
 
519
  // Login form
520
- $key = 'login';
521
  add_settings_field(
522
- $option_name.'_'.$field.'_'.$key,
523
- $target[ $key ],
524
  array( $context, 'callback_field' ),
525
  $option_slug,
526
  $section,
527
  array(
528
  'type' => 'checkbox',
529
  'option' => $option_name,
530
- 'field' => $field,
531
- 'sub-field' => $key,
532
- 'value' => $options[ $field ][ $key ],
533
  'text' => __( 'Block by country', 'ip-geo-block' ),
534
- 'after' => '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual action as a blocking target.">Target actions</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $comma[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n" . $list . "</ul></li></ul>\n",
535
  )
536
  );
537
 
@@ -545,20 +525,44 @@ endif;
545
  2 => __( 'Regardless of the country code, it will block a malicious request related to the services only for the dashboard.', 'ip-geo-block' ),
546
  );
547
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
548
  // Admin area
549
- $key = 'admin';
550
  add_settings_field(
551
- $option_name.'_'.$field.'_'.$key,
552
- $target[ $key ],
553
  array( $context, 'callback_field' ),
554
  $option_slug,
555
  $section,
556
  array(
557
  'type' => 'checkboxes',
558
  'option' => $option_name,
559
- 'field' => $field,
560
- 'sub-field' => $key,
561
- 'value' => $options[ $field ][ $key ],
562
  'list' => $list,
563
  'desc' => $desc,
564
  )
@@ -583,13 +587,11 @@ endif;
583
  . '</li>' . "\n";
584
  }
585
 
586
- $path = IP_Geo_Block::get_wp_path();
587
-
588
  // Admin ajax/post
589
- $key = 'ajax';
590
- $val = esc_html( substr( $path['admin'], 1 ) );
591
  add_settings_field(
592
- $option_name.'_'.$field.'_'.$key,
593
  sprintf( $dfn, $val.'admin-(ajax|post).php', __( 'Admin ajax/post', 'ip-geo-block' ) ),
594
  array( $context, 'callback_field' ),
595
  $option_slug,
@@ -597,19 +599,19 @@ endif;
597
  array(
598
  'type' => 'checkboxes',
599
  'option' => $option_name,
600
- 'field' => $field,
601
- 'sub-field' => $key,
602
- 'value' => $options[ $field ][ $key ],
603
  'list' => $list,
604
  'desc' => $desc,
605
  'after' =>
606
  '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . "\n" .
607
  ' <dfn title="' . __( 'Specify the action name (&#8220;action=&hellip;&#8221;) or the page name (&#8220;page=&hellip;&#8221;) to prevent unintended blocking caused by &#8220;Block by country&#8221; (for non logged-in user) and &#8220;Prevent Zero-day Exploit&#8221; (for logged-in user).', 'ip-geo-block' ) . '">' . __( 'Exceptions', 'ip-geo-block' ) . "</dfn>\n" .
608
- ' <a class="ip-geo-block-hide ip-geo-block-icon ip-geo-block-icon-unlock"><span title="' . __( 'Toggle with non logged-in user', 'ip-geo-block' ) . '"></span></a><a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide" data-target="admin">' . $comma[2] . '</a><a class="ip-geo-block-icon ip-geo-block-icon-find ip-geo-block-hide" data-target="admin">' . $comma[3] . "</a>\n" .
609
  ' <li class="ip-geo-block-hide">' . "\n" .
610
- ' <input class="regular-text code" id="ip_geo_block_settings_exception_admin" name="ip_geo_block_settings[exception][admin]" type="text" value="' . esc_attr( implode( ',', $options['exception']['admin'] ) ) . '">' . $comma[0] . "\n" .
611
  ' <h4>' . __( 'Candidate actions/pages', 'ip-geo-block' ) . "</h4>\n" .
612
- ' <p class="ip-geo-block-find-desc">' . $comma[4] . '<span id="ip-geo-block-find-admin"></span></p>' . "\n" .
613
  ' </li>' . "\n" .
614
  ' <li class="ip-geo-block-hide">' . "\n" .
615
  ' <ul class="ip-geo-block-list-exceptions" id="ip-geo-block-list-admin">' . "\n" .
@@ -624,8 +626,9 @@ endif;
624
  $desc = array(
625
  __( 'Regardless of the country code, it will block a malicious request to <code>%s&ctdot;/*.php</code>.', 'ip-geo-block' ),
626
  __( 'Select the item which causes unintended blocking in order to exclude from the validation target. Grayed item indicates &#8220;INACTIVE&#8221;.', 'ip-geo-block' ),
627
- __( 'It configures &#8220;%s&#8221; to validate a request to the PHP file which does not load WordPress core. Make sure to deny direct access to the hidden files beginning with a dot by the server\'s configuration.', 'ip-geo-block' ),
628
  __( 'Sorry, but your server type is not supported.', 'ip-geo-block' ),
 
629
  );
630
 
631
  // Set rewrite condition
@@ -653,19 +656,18 @@ endif;
653
  }
654
 
655
  // Plugins area
656
- $key = 'plugins';
657
- $val = esc_html( $path[ $key ] );
658
- $tmp = '<input type="checkbox" id="ip_geo_block_settings_rewrite_' . $key
659
- . '" name="ip_geo_block_settings[rewrite][' . $key . ']" '
660
- . ' value="1"' . checked( $options['rewrite'][ $key ], TRUE, FALSE )
661
- . disabled( $options['rewrite'][ $key ], -1, FALSE ) . ' />'
662
- . '<label for="ip_geo_block_settings_rewrite_' . $key . '"><dfn title="'
663
  . ( $config ? sprintf( $desc[2], $val . $config ) : $desc[3] )
664
  . '">' . __( 'Force to load WP core', 'ip-geo-block' )
665
  . '</dfn></label><br />';
666
 
667
  add_settings_field(
668
- $option_name.'_'.$field.'_'.$key,
669
  sprintf( $dfn, $val.'&hellip;/*.php', __( 'Plugins area', 'ip-geo-block' ) ),
670
  array( $context, 'callback_field' ),
671
  $option_slug,
@@ -673,9 +675,9 @@ endif;
673
  array(
674
  'type' => 'select',
675
  'option' => $option_name,
676
- 'field' => $field,
677
- 'sub-field' => $key,
678
- 'value' => $options[ $field ][ $key ],
679
  'list' => $list,
680
  'desc' => array(
681
  2 => sprintf( $desc[0], $val ),
@@ -683,9 +685,9 @@ endif;
683
  'after' => $tmp .
684
  '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . "\n" .
685
  ' <dfn title="' . $desc[1] . '">' . __( 'Exceptions', 'ip-geo-block' ) . "</dfn>\n" .
686
- ' <a class="ip-geo-block-hide ip-geo-block-icon ip-geo-block-icon-cycle">' . $comma[2] . '</a><a class="ip-geo-block-icon ip-geo-block-icon-find ip-geo-block-hide" data-target="plugins">' . $comma[3] . "</a>\n" .
687
  ' <li class="ip-geo-block-hide">' . "\n" .
688
- ' <p class="ip-geo-block-find-desc">' . $comma[4] . '<span id="ip-geo-block-find-plugins"></span></p>' . "\n" .
689
  ' </li>' . "\n" .
690
  ' <li class="ip-geo-block-hide">' . "\n" .
691
  ' <ul class="ip-geo-block-list-exceptions" id="ip-geo-block-list-plugins">' . "\n" .
@@ -714,19 +716,18 @@ endif;
714
  }
715
 
716
  // Themes area
717
- $key = 'themes';
718
- $val = esc_html( $path[ $key ] );
719
- $tmp = '<input type="checkbox" id="ip_geo_block_settings_rewrite_' . $key
720
- . '" name="ip_geo_block_settings[rewrite][' . $key . ']" '
721
- . ' value="1"' . checked( $options['rewrite'][ $key ], TRUE, FALSE )
722
- . disabled( $options['rewrite'][ $key ], -1, FALSE ) . ' />'
723
- . '<label for="ip_geo_block_settings_rewrite_' . $key . '"><dfn title="'
724
  . ( $config ? sprintf( $desc[2], $val . $config ) : $desc[3] )
725
  . '">' . __( 'Force to load WP core', 'ip-geo-block' )
726
  . '</dfn></label><br />';
727
 
728
  add_settings_field(
729
- $option_name.'_'.$field.'_'.$key,
730
  sprintf( $dfn, $val.'&hellip;/*.php', __( 'Themes area', 'ip-geo-block' ) ),
731
  array( $context, 'callback_field' ),
732
  $option_slug,
@@ -734,9 +735,9 @@ endif;
734
  array(
735
  'type' => 'select',
736
  'option' => $option_name,
737
- 'field' => $field,
738
- 'sub-field' => $key,
739
- 'value' => $options[ $field ][ $key ],
740
  'list' => $list,
741
  'desc' => array(
742
  2 => sprintf( $desc[0], $val ),
@@ -744,9 +745,9 @@ endif;
744
  'after' => $tmp .
745
  '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . "\n" .
746
  ' <dfn title="' . $desc[1] . '">' . __( 'Exceptions', 'ip-geo-block' ) . "</dfn>\n" .
747
- ' <a class="ip-geo-block-hide ip-geo-block-icon ip-geo-block-icon-cycle">' . $comma[2] . '</a><a class="ip-geo-block-icon ip-geo-block-icon-find ip-geo-block-hide" data-target="themes">' . $comma[3] . "</a>\n" .
748
  ' <li class="ip-geo-block-hide">' . "\n" .
749
- ' <p class="ip-geo-block-find-desc">' . $comma[4] . '<span id="ip-geo-block-find-themes"></span></p>' . "\n" .
750
  ' </li>' . "\n" .
751
  ' <li class="ip-geo-block-hide">' . "\n" .
752
  ' <ul class="ip-geo-block-list-exceptions" id="ip-geo-block-list-themes">' . "\n" .
@@ -762,37 +763,31 @@ endif;
762
  *----------------------------------------*/
763
  add_settings_section(
764
  $section = $plugin_slug . '-public',
765
- array( __( 'Front-end target settings', 'ip-geo-block' ), '<a href="http://www.ipgeoblock.com/codex/overview.html" title="Overview | IP Geo Block">' . __( 'Help', 'ip-geo-block' ) . '</a>'),
766
  array( __CLASS__, 'note_public' ),
767
  $option_slug
768
  );
769
 
770
  // Public facing pages
771
- $key = 'public';
772
  add_settings_field(
773
- $option_name.'_'.$field.'_'.$key,
774
- $target[ $key ],
775
  array( $context, 'callback_field' ),
776
  $option_slug,
777
  $section,
778
  array(
779
  'type' => 'checkbox',
780
  'option' => $option_name,
781
- 'field' => $field,
782
- 'sub-field' => $key,
783
- 'value' => $options[ $field ][ $key ],
784
  'text' => __( 'Block by country', 'ip-geo-block' ),
785
  )
786
  );
787
 
788
- // Default for matching rule on front-end
789
- $rule[-1] = __( 'Follow &#8220;Validation rule settings&#8221;', 'ip-geo-block' );
790
-
791
  // Matching rule
792
- $field = 'public';
793
- $key = 'matching_rule';
794
  add_settings_field(
795
- $option_name.'_'.$field.'_'.$key,
796
  '<dfn title="' . $rule_desc[0] . '">' . __( 'Matching rule', 'ip-geo-block' ) . '</dfn>',
797
  array( $context, 'callback_field' ),
798
  $option_slug,
@@ -800,17 +795,16 @@ endif;
800
  array(
801
  'type' => 'select',
802
  'option' => $option_name,
803
- 'field' => $field,
804
- 'sub-field' => $key,
805
- 'value' => $options[ $field ][ $key ],
806
- 'list' => $rule,
807
  )
808
  );
809
 
810
  // Country code for matching rule (ISO 3166-1 alpha-2)
811
- $key = 'white_list';
812
  add_settings_field(
813
- $option_name.'_'.$field.'_'.$key,
814
  $rule_desc[1],
815
  array( $context, 'callback_field' ),
816
  $option_slug,
@@ -818,17 +812,16 @@ endif;
818
  array(
819
  'type' => 'text',
820
  'option' => $option_name,
821
- 'field' => $field,
822
- 'sub-field' => $key,
823
- 'value' => $options[ $field ][ $key ],
824
- 'after' => $comma[0],
825
- 'class' => $options[ $field ]['matching_rule'] == 0 ? '' : 'ip-geo-block-hide',
826
  )
827
  );
828
 
829
- $key = 'black_list';
830
  add_settings_field(
831
- $option_name.'_'.$field.'_'.$key,
832
  $rule_desc[2],
833
  array( $context, 'callback_field' ),
834
  $option_slug,
@@ -836,28 +829,27 @@ endif;
836
  array(
837
  'type' => 'text',
838
  'option' => $option_name,
839
- 'field' => $field,
840
- 'sub-field' => $key,
841
- 'value' => $options[ $field ][ $key ],
842
- 'after' => $comma[0],
843
- 'class' => $options[ $field ]['matching_rule'] == 1 ? '' : 'ip-geo-block-hide',
844
  )
845
  );
846
 
847
  // Response code (RFC 2616)
848
- $key = 'response_code';
849
  add_settings_field(
850
- $option_name.'_'.$field.'_'.$key,
851
- sprintf( __( '<dfn title="You can configure a different response code from the Back-end. This is useful to prevent violation against your affiliate program.">Response code</dfn> %s', 'ip-geo-block' ), '(<a rel="noreferrer" href="http://tools.ietf.org/html/rfc2616#section-10" title="RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1">RFC 2616</a>)' ),
852
  array( $context, 'callback_field' ),
853
  $option_slug,
854
  $section,
855
  array(
856
  'type' => 'select',
857
  'option' => $option_name,
858
- 'field' => $field,
859
- 'sub-field' => $key,
860
- 'value' => $options[ $field ][ $key ],
861
  'list' => array(
862
  200 => '200 OK',
863
  301 => '301 Moved Permanently',
@@ -872,14 +864,13 @@ endif;
872
  500 => '500 Internal Server Error',
873
  503 => '503 Service Unavailable',
874
  ),
875
- 'class' => $options[ $field ]['matching_rule'] == -1 ? 'ip-geo-block-hide' :'',
876
  )
877
  );
878
 
879
  // Redirect URI
880
- $key = 'redirect_uri';
881
  add_settings_field(
882
- $option_name.'_'.$field.'_'.$key,
883
  __( '<dfn title="Specify the URL for response code 2xx and 3xx. If it is pointed to a public facing page, visitors would not be blocked on the page to prevent loop of redirection even when you enable [Block by country] in [Front-end target settings] section. Empty URL is altered to your home.">Redirect URL</dfn>', 'ip-geo-block' ),
884
  array( $context, 'callback_field' ),
885
  $option_slug,
@@ -887,18 +878,17 @@ endif;
887
  array(
888
  'type' => 'text',
889
  'option' => $option_name,
890
- 'field' => $field,
891
- 'sub-field' => $key,
892
- 'value' => $options[ $field ][ $key ],
893
- 'class' => $options[ $field ]['matching_rule'] != -1 && $options[ $field ]['response_code'] < 400 ? '' : 'ip-geo-block-hide',
894
  'placeholder' => '/about/',
895
  )
896
  );
897
 
898
  // Response message
899
- $key = 'response_msg';
900
  add_settings_field(
901
- $option_name.'_'.$field.'_'.$key,
902
  __( '<dfn title="Specify the message for response code 4xx and 5xx.">Response message</dfn>', 'ip-geo-block' ),
903
  array( $context, 'callback_field' ),
904
  $option_slug,
@@ -906,65 +896,64 @@ endif;
906
  array(
907
  'type' => 'text',
908
  'option' => $option_name,
909
- 'field' => $field,
910
- 'sub-field' => $key,
911
- 'value' => $options[ $field ][ $key ],
912
- 'class' => $options[ $field ]['matching_rule'] != -1 && $options[ $field ]['response_code'] >= 400 ? '' : 'ip-geo-block-hide',
913
  )
914
  );
915
 
916
  // List of page
917
- $exception = '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual page as a blocking target.">Page</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $comma[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n";
918
  $tmp = get_pages();
919
  if ( ! empty( $tmp ) ) {
920
  foreach ( $tmp as $key ) {
921
  $val = esc_attr( $key->post_name );
922
- $exception .= '<li><input type="checkbox" id="ip_geo_block_settings_public_target_pages_' . $val . '" name="ip_geo_block_settings[public][target_pages][' . $val . ']" value="1"' . checked( isset( $options[ $field ]['target_pages'][ $val ] ), TRUE, FALSE ) . ' />';
923
  $exception .= '<label for="ip_geo_block_settings_public_target_pages_' . $val . '">' . esc_html( $key->post_title ) . '</label></li>' . "\n";
924
  }
925
  }
926
  $exception .= '</ul></li></ul>' . "\n";
927
 
928
  // List of post type
929
- $exception .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual post type on a single page as a blocking target.">Post type</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $comma[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n";
930
  $tmp = get_post_types( array( 'public' => TRUE ) );
931
  if ( ! empty( $tmp ) ) {
932
  foreach ( $tmp as $key ) {
933
  $val = esc_attr( $key );
934
- $exception .= '<li><input type="checkbox" id="ip_geo_block_settings_public_target_posts_' . $val . '" name="ip_geo_block_settings[public][target_posts][' . $val . ']" value="1"' . checked( isset( $options[ $field ]['target_posts'][ $val ] ), TRUE, FALSE ) . ' />';
935
  $exception .= '<label for="ip_geo_block_settings_public_target_posts_' . $val . '">' . esc_html( $key ) . '</label></li>' . "\n";
936
  }
937
  }
938
  $exception .= '</ul></li></ul>' . "\n";
939
 
940
  // List of category
941
- $exception .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual category on a single page or archive page as a blocking target.">Category</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $comma[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n";
942
  $tmp = get_categories( array( 'hide_empty' => FALSE ) );
943
  if ( ! empty( $tmp ) ) {
944
  foreach ( $tmp as $key ) {
945
  $val = esc_attr( $key->slug );
946
- $exception .= '<li><input type="checkbox" id="ip_geo_block_settings_public_target_cates_' . $val . '" name="ip_geo_block_settings[public][target_cates][' . $val . ']" value="1"' . checked( isset( $options[ $field ]['target_cates'][ $val ] ), TRUE, FALSE ) . ' />';
947
  $exception .= '<label for="ip_geo_block_settings_public_target_cates_' . $val . '">' . esc_html( $key->name ) . '</label></li>' . "\n";
948
  }
949
  }
950
  $exception .= '</ul></li></ul>' . "\n";
951
 
952
  // List of tag
953
- $exception .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual tag on a single page or archive page as a blocking target.">Tag</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $comma[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n";
954
  $tmp = get_tags( array( 'hide_empty' => FALSE ) );
955
  if ( ! empty( $tmp ) ) {
956
  foreach ( $tmp as $key ) {
957
  $val = esc_attr( $key->slug );
958
- $exception .= '<li><input type="checkbox" id="ip_geo_block_settings_public_target_tags_' . $val . '" name="ip_geo_block_settings[public][target_tags][' . $val . ']" value="1"' . checked( isset( $options[ $field ]['target_tags'][ $val ] ), TRUE, FALSE ) . ' />';
959
  $exception .= '<label for="ip_geo_block_settings_public_target_tags_' . $val . '">' . esc_html( $key->name ) . '</label></li>' . "\n";
960
  }
961
  }
962
  $exception .= '</ul></li></ul>' . "\n";
963
 
964
  // Validation target
965
- $key = 'target_rule';
966
  add_settings_field(
967
- $option_name.'_'.$field.'_'.$key,
968
  '<dfn title="' . __( 'Specify the validation target on front-end.', 'ip-geo-block' ) . '">' . __( 'Validation target', 'ip-geo-block' ) . '</dfn>',
969
  array( $context, 'callback_field' ),
970
  $option_slug,
@@ -972,9 +961,9 @@ endif;
972
  array(
973
  'type' => 'select',
974
  'option' => $option_name,
975
- 'field' => $field,
976
- 'sub-field' => $key,
977
- 'value' => $options[ $field ][ $key ],
978
  'list' => array(
979
  0 => __( 'All requests', 'ip-geo-block' ),
980
  1 => __( 'Specify the targets', 'ip-geo-block' ),
@@ -986,18 +975,36 @@ endif;
986
  )
987
  );
988
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
989
  // Badly-behaved bots and crawlers
990
  $exception = '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the frequency of request for certain period of time.">Blocking condition</dfn>', 'ip-geo-block' ) . "\n<li class=\"ip-geo-block-hide\"><ul>\n<li>";
991
  $exception .= sprintf(
992
  __( 'More than %1$s page view (PV) in %2$s seconds', 'ip-geo-block' ),
993
- '<input type="number" id="ip_geo_block_settings_behavior_view" name="ip_geo_block_settings[behavior][view]" class="regular-text code" value="' . (int)$options['behavior']['view'] . '" placeholder="10" min="1" max="99" maxlength="3" />',
994
- '<input type="number" id="ip_geo_block_settings_behavior_time" name="ip_geo_block_settings[behavior][time]" class="regular-text code" value="' . (int)$options['behavior']['time'] . '" placeholder="12" min="1" max="99" maxlength="3" /> '
995
  );
996
  $exception .= "</li>\n</ul></li></ul>\n";
997
 
998
- $key = 'behavior';
999
  add_settings_field(
1000
- $option_name.'_'.$field.'_'.$key,
1001
  __( '<dfn title="It will validate the frequency of request.">Block badly-behaved bots and crawlers</dfn>', 'ip-geo-block' ),
1002
  array( $context, 'callback_field' ),
1003
  $option_slug,
@@ -1005,17 +1012,16 @@ endif;
1005
  array(
1006
  'type' => 'checkbox',
1007
  'option' => $option_name,
1008
- 'field' => $field,
1009
- 'sub-field' => $key,
1010
- 'value' => $options[ $field ][ $key ],
1011
  'after' => $exception,
1012
  )
1013
  );
1014
 
1015
  // UA string and qualification
1016
- $key = 'ua_list';
1017
  add_settings_field(
1018
- $option_name.'_'.$field.'_'.$key,
1019
  '<dfn title="' . __( 'A part of user agent string and a qualification connected with a separator that indicates an applicable rule and can be &#8220;:&#8221; (pass) or &#8220;#&#8221; (block). A &#8220;qualification&#8221; can be &#8220;DNS&#8221;, &#8220;FEED&#8221;, country code or IP address with CIDR. A negative operator &#8220;!&#8221; can be placed just before a &#8220;qualification&#8221;.', 'ip-geo-block' ) . '">' . __( 'UA string and qualification', 'ip-geo-block' ) . '</dfn>',
1020
  array( $context, 'callback_field' ),
1021
  $option_slug,
@@ -1023,97 +1029,122 @@ endif;
1023
  array(
1024
  'type' => 'textarea',
1025
  'option' => $option_name,
1026
- 'field' => $field,
1027
- 'sub-field' => $key,
1028
- 'value' => $options[ $field ][ $key ],
1029
- 'after' => $comma[1],
1030
  )
1031
  );
1032
 
1033
- if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1034
- // Excluded action
1035
- $key = 'exception';
1036
  add_settings_field(
1037
- $option_name.'_'.$key.'_'.$field,
1038
- '<dfn title="' . __( 'Specify the name of actions as exception that is invariably blocked.', 'ip-geo-block' ) . '">' . __( 'Excluded actions', 'ip-geo-block' ) . '</dfn>',
1039
  array( $context, 'callback_field' ),
1040
  $option_slug,
1041
  $section,
1042
  array(
1043
- 'type' => 'text',
1044
  'option' => $option_name,
1045
- 'field' => $key,
1046
- 'sub-field' => $field,
1047
- 'value' => implode( ',', $options[ $key ][ $field ] ),
1048
- 'after' => $comma[0],
1049
  )
1050
  );
1051
- endif;
1052
 
1053
- // DNS reverse lookup
1054
- $key = 'dnslkup';
1055
  add_settings_field(
1056
- $option_name.'_'.$field.'_'.$key,
1057
- '<dfn title="' . __( 'It enables to verify the host by reverse DNS lookup which would spend some server resources. If it is disabled, &#8220;HOST&#8221; and &#8220;HOST=&hellip;&#8221;in &#8220;UA string and qualification&#8221; will always return &#8220;true&#8221;.', 'ip-geo-block' ) . '">' . __( 'DNS reverse lookup', 'ip-geo-block' ) . '</dfn>',
1058
  array( $context, 'callback_field' ),
1059
  $option_slug,
1060
  $section,
1061
  array(
1062
  'type' => 'checkbox',
1063
  'option' => $option_name,
1064
- 'field' => $field,
1065
- 'sub-field' => $key,
1066
- 'value' => $options[ $field ][ $key ],
1067
  )
1068
  );
1069
 
1070
- // Simulation mode
1071
- $key = 'simulate';
 
 
 
 
 
 
 
 
 
1072
  add_settings_field(
1073
- $option_name.'_'.$field.'_'.$key,
1074
- '<dfn title="' . __( 'It enables to simulate validation without deployment. The results can be found at &#8220;Public facing pages&#8221; in Logs.', 'ip-geo-block' ) . '">' . __( 'Simulation mode', 'ip-geo-block' ) . '</dfn>',
1075
  array( $context, 'callback_field' ),
1076
  $option_slug,
1077
  $section,
1078
  array(
1079
  'type' => 'checkbox',
1080
  'option' => $option_name,
1081
- 'field' => $field,
1082
- 'sub-field' => $key,
1083
- 'value' => $options[ $field ][ $key ],
1084
  )
1085
  );
1086
 
1087
- /*----------------------------------------*
1088
- * Privacy and record settings
1089
- *----------------------------------------*/
1090
- add_settings_section(
1091
- $section = $plugin_slug . '-recording',
1092
- __( 'Privacy and record settings', 'ip-geo-block' ),
1093
- array( __CLASS__, 'note_record' ),
1094
- $option_slug
 
 
 
 
 
1095
  );
1096
 
1097
- // Anonymize IP address and restrict 3rd party APIs
1098
- $field = 'anonymize';
1099
  add_settings_field(
1100
- $option_name.'_'.$field,
1101
- __( '<dfn title="IP address is always encrypted on recording in cache and logs. Moreover, this option makes the IP address anonymous and restricted on sending to the 3rd parties such as geolocation APIs or whois service.">Anonymize IP address and restrict 3rd party APIs</dfn>', 'ip-geo-block' ),
1102
  array( $context, 'callback_field' ),
1103
  $option_slug,
1104
  $section,
1105
  array(
1106
  'type' => 'checkbox',
1107
  'option' => $option_name,
1108
- 'field' => $field,
1109
- 'value' => ! empty( $options[ $field ] ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1110
  )
1111
  );
 
1112
 
1113
  // Record IP address cache
1114
- $field = 'cache_hold';
1115
  add_settings_field(
1116
- $option_name.'_'.$field,
1117
  __( '<dfn title="This option enables to record the IP address, country code and failure counter of login attempts into the cache on database to minimize the impact on site speed.">Record &#8220;IP address cache&#8221;</dfn>', 'ip-geo-block' ),
1118
  array( $context, 'callback_field' ),
1119
  $option_slug,
@@ -1121,41 +1152,40 @@ endif;
1121
  array(
1122
  'type' => 'checkbox',
1123
  'option' => $option_name,
1124
- 'field' => $field,
1125
- 'value' => $options[ $field ],
1126
  )
1127
  );
1128
 
1129
- // Expiration time [sec] for IP address cache
1130
- $field = 'cache_time';
1131
  add_settings_field(
1132
- $option_name.'_'.$field,
1133
- sprintf( __( '<dfn title="If user authentication fails consecutively %d times, subsequent login will also be prohibited for this and garbage collection period.">Expiration time [sec] for &#8220;IP address cache&#8221;</dfn>', 'ip-geo-block' ), (int)$options['login_fails'] ),
1134
  array( $context, 'callback_field' ),
1135
  $option_slug,
1136
  $section,
1137
  array(
1138
  'type' => 'text',
1139
  'option' => $option_name,
1140
- 'field' => $field,
1141
- 'value' => $options[ $field ],
 
1142
  )
1143
  );
1144
 
1145
- // Record "Logs"
1146
- $field = 'validation';
1147
  add_settings_field(
1148
- $option_name.'_'.$field.'_reclogs',
1149
- __( '<dfn title="This option enables to record the validation logs including IP addresses.">Record &#8220;Logs&#8221;</dfn>', 'ip-geo-block' ),
1150
  array( $context, 'callback_field' ),
1151
  $option_slug,
1152
  $section,
1153
  array(
1154
  'type' => 'select',
1155
  'option' => $option_name,
1156
- 'field' => $field,
1157
  'sub-field' => 'reclogs',
1158
- 'value' => $options[ $field ]['reclogs'],
1159
  'list' => array(
1160
  0 => __( 'Disable', 'ip-geo-block' ),
1161
  1 => __( 'When blocked', 'ip-geo-block' ),
@@ -1168,71 +1198,73 @@ endif;
1168
  )
1169
  );
1170
 
1171
- // $_POST keys to be recorded with their values in "Logs"
1172
  add_settings_field(
1173
- $option_name.'_'.$field.'_postkey',
1174
- __( '<dfn title="e.g. action, comment, log, pwd, FILES">$_POST keys to be recorded with their values in &#8220;Logs&#8221;</dfn>', 'ip-geo-block' ),
1175
  array( $context, 'callback_field' ),
1176
  $option_slug,
1177
  $section,
1178
  array(
1179
  'type' => 'text',
1180
  'option' => $option_name,
1181
- 'field' => $field,
1182
- 'sub-field' => 'postkey',
1183
- 'value' => $options[ $field ]['postkey'],
1184
- 'after' => $comma[0],
1185
  )
1186
  );
1187
 
1188
- $key = 'explogs';
1189
  add_settings_field(
1190
- $option_name.'_'.$field.'_'.$key,
1191
- sprintf( __( '<dfn title="The maximum number of entries in the logs is also limited to %d.">Expiration time [sec] for &#8220;Logs&#8221;</dfn>', 'ip-geo-block' ), $options[ $field ]['maxlogs'] ),
1192
  array( $context, 'callback_field' ),
1193
  $option_slug,
1194
  $section,
1195
  array(
1196
  'type' => 'text',
1197
  'option' => $option_name,
1198
- 'field' => $field,
1199
- 'sub-field' => $key,
1200
- 'value' => $options[ $field ][ $key ],
 
 
1201
  )
1202
  );
1203
 
1204
  if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1205
- // Maximum entries of Logs
1206
- $key = 'maxlogs';
1207
  add_settings_field(
1208
- $option_name.'_'.$field.'_'.$key,
1209
- __( 'Maximum entries of &#8220;Logs&#8221;', 'ip-geo-block' ),
1210
  array( $context, 'callback_field' ),
1211
  $option_slug,
1212
  $section,
1213
  array(
1214
  'type' => 'text',
1215
  'option' => $option_name,
1216
- 'field' => $field,
1217
- 'sub-field' => $key,
1218
- 'value' => $options[ $field ][ $key ],
 
1219
  )
1220
  );
1221
 
1222
  // Live update
1223
- $field = 'live_update';
1224
  add_settings_field(
1225
- $option_name.'_'.$field,
1226
- __( '<dfn title="Select SQLite database source.">Database source of SQLite for &#8220;Live update&#8221;</dfn>', 'ip-geo-block' ),
1227
  array( $context, 'callback_field' ),
1228
  $option_slug,
1229
  $section,
1230
  array(
1231
  'type' => 'select',
1232
  'option' => $option_name,
1233
- 'field' => $field,
1234
  'sub-field' => 'in_memory',
1235
- 'value' => extension_loaded( 'pdo_sqlite' ) ? $options[ $field ]['in_memory'] : -1,
 
1236
  'list' => array(
1237
  -1 => NULL,
1238
  0 => __( 'Ordinary file', 'ip-geo-block' ),
@@ -1247,19 +1279,19 @@ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1247
  );
1248
 
1249
  // Reset data source of live log
1250
- $field = 'reset_live';
1251
  add_settings_field(
1252
- $option_name.'_'.$field,
1253
- __( 'Reset database source of &#8220;Live update&#8221;', 'ip-geo-block' ),
1254
  array( $context, 'callback_field' ),
1255
  $option_slug,
1256
  $section,
1257
  array(
1258
  'type' => 'button',
1259
  'option' => $option_name,
1260
- 'field' => $field,
1261
  'value' => __( 'Reset now', 'ip-geo-block' ),
1262
  'after' => '<div id="ip-geo-block-reset-live"></div>',
 
1263
  )
1264
  );
1265
  endif;
@@ -1268,62 +1300,25 @@ endif;
1268
  $tmp = wp_next_scheduled( IP_Geo_Block::CACHE_NAME );
1269
  $tmp = $tmp ? IP_Geo_Block_Util::localdate( $tmp ) : '<span class="ip-geo-block-warn">' . __( 'Task could not be found in WP-Cron. Please try to deactivate this plugin once and activate again.', 'ip-geo-block' ). '</span>';
1270
 
1271
- // Cleanup interval [sec] for Logs and IP address cache
1272
- $field = 'cache_time_gc';
1273
  add_settings_field(
1274
- $option_name.'_'.$field,
1275
- __( '<dfn title="This option enables to schedule the WP-Cron event to remove the expired entries in ip address cache and logs.">Cleanup interval [sec] for &#8220;IP address cache&#8221; and &#8220;Logs&#8221;</dfn>', 'ip-geo-block' ),
1276
  array( $context, 'callback_field' ),
1277
  $option_slug,
1278
  $section,
1279
  array(
1280
  'type' => 'text',
1281
  'option' => $option_name,
1282
- 'field' => $field,
1283
- 'value' => $options[ $field ],
1284
  'after' => '<p class="ip-geo-block-desc">' . sprintf( __( 'Next schedule: %s', 'ip-geo-block'), $tmp ) . '</p>',
1285
  )
1286
  );
1287
 
1288
- // Record "Statistics"
1289
- $field = 'save_statistics';
1290
- add_settings_field(
1291
- $option_name.'_'.$field,
1292
- __( '<dfn title="This option enables to record the number blocked countries and the number of blocked requests per day.">Record &#8220;Statistics&#8221;</dfn>', 'ip-geo-block' ),
1293
- array( $context, 'callback_field' ),
1294
- $option_slug,
1295
- $section,
1296
- array(
1297
- 'type' => 'checkbox',
1298
- 'option' => $option_name,
1299
- 'field' => $field,
1300
- 'value' => $options[ $field ],
1301
- )
1302
- );
1303
-
1304
- if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1305
- $field = 'validation';
1306
- $key = 'recdays';
1307
- add_settings_field(
1308
- $option_name.'_'.$field.'_'.$key,
1309
- __( 'Maximum period for &#8220;Statistics&#8221; [day]', 'ip-geo-block' ),
1310
- array( $context, 'callback_field' ),
1311
- $option_slug,
1312
- $section,
1313
- array(
1314
- 'type' => 'text',
1315
- 'option' => $option_name,
1316
- 'field' => $field,
1317
- 'sub-field' => $key,
1318
- 'value' => $options[ $field ][ $key ],
1319
- )
1320
- );
1321
- endif;
1322
-
1323
  // Remove all settings and records at uninstallation
1324
- $field = 'clean_uninstall';
1325
  add_settings_field(
1326
- $option_name.'_'.$field,
1327
  __( 'Remove all settings and records at uninstallation', 'ip-geo-block' ),
1328
  array( $context, 'callback_field' ),
1329
  $option_slug,
@@ -1331,8 +1326,8 @@ endif;
1331
  array(
1332
  'type' => 'checkbox',
1333
  'option' => $option_name,
1334
- 'field' => $field,
1335
- 'value' => $options[ $field ],
1336
  )
1337
  );
1338
 
@@ -1341,7 +1336,7 @@ endif;
1341
  *----------------------------------------*/
1342
  add_settings_section(
1343
  $section = $plugin_slug . '-provider',
1344
- __( 'Geolocation API settings', 'ip-geo-block' ),
1345
  array( __CLASS__, 'note_services' ),
1346
  $option_slug
1347
  );
@@ -1350,8 +1345,8 @@ endif;
1350
  $provider = IP_Geo_Block_Provider::get_providers( 'key' ); // all available providers
1351
  $providers = IP_Geo_Block_Provider::get_addons( $options['providers'] ); // only local
1352
 
1353
- // Disable 3rd parties API in case of 'anonymize'
1354
- if ( $options['anonymize'] ) {
1355
  foreach ( array_keys( $provider ) as $key ) {
1356
  if ( ! in_array( $key, $providers, TRUE ) )
1357
  $provider[ $key ] = is_string( $provider[ $key ] ) ? '-1' : -1;
@@ -1359,18 +1354,17 @@ endif;
1359
  }
1360
 
1361
  // API selection and key settings
1362
- $field = 'providers';
1363
  add_settings_field(
1364
- $option_name.'_'.$field,
1365
- __( '<dfn title="IP address cache and local database are scanned at the top priority.">API selection and key settings</dfn>', 'ip-geo-block' ),
1366
  array( $context, 'callback_field' ),
1367
  $option_slug,
1368
  $section,
1369
  array(
1370
  'type' => 'check-provider',
1371
  'option' => $option_name,
1372
- 'field' => $field,
1373
- 'value' => $options[ $field ],
1374
  'local' => $providers,
1375
  'providers' => $provider,
1376
  'titles' => IP_Geo_Block_Provider::get_providers( 'type' ),
@@ -1379,9 +1373,8 @@ endif;
1379
 
1380
  if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1381
  // Timeout for network API
1382
- $field = 'timeout';
1383
  add_settings_field(
1384
- $option_name.'_'.$field,
1385
  __( 'Timeout for network API [sec]', 'ip-geo-block' ),
1386
  array( $context, 'callback_field' ),
1387
  $option_slug,
@@ -1389,8 +1382,8 @@ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1389
  array(
1390
  'type' => 'text',
1391
  'option' => $option_name,
1392
- 'field' => $field,
1393
- 'value' => $options[ $field ],
1394
  )
1395
  );
1396
  endif;
@@ -1400,14 +1393,14 @@ endif;
1400
  *----------------------------------------*/
1401
  if ( empty( $providers ) ) {
1402
  $context->add_admin_notice( 'error', sprintf(
1403
- __( 'Can not find geolocation API libraries in <code>%s</code>. It seems to have failed downloading <a rel="noreferrer" href="https://github.com/tokkonopapa/WordPress-IP-Geo-API/archive/master.zip" title="Download the contents of tokkonopapa/WordPress-IP-Geo-API as a zip file">ZIP file</a> from <a rel="noreferrer" href="https://github.com/tokkonopapa/WordPress-IP-Geo-API" title="tokkonopapa/WordPress-IP-Geo-API - GitHub">WordPress-IP-Geo-API</a>. Please install <code>ip-geo-api</code> with write permission according to <a rel="noreferrer" href="http://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How can I fix permission troubles? | IP Geo Block">this instruction</a>.', 'ip-geo-block' ),
1404
  apply_filters( 'ip-geo-block-api-dir', basename( WP_CONTENT_DIR ) )
1405
  ) );
1406
  }
1407
 
1408
  add_settings_section(
1409
  $section = $plugin_slug . '-database',
1410
- array( __( 'Local database settings', 'ip-geo-block' ), '<a href="http://www.ipgeoblock.com/codex/geolocation-api-library.html" title="Geolocation API library | IP Geo Block">' . __( 'Help', 'ip-geo-block' ) . '</a>'),
1411
  array( __CLASS__, 'note_database' ),
1412
  $option_slug
1413
  );
@@ -1442,9 +1435,8 @@ endif;
1442
  $tmp = $tmp ? IP_Geo_Block_Util::localdate( $tmp ) : '<span class="ip-geo-block-warn">' . __( 'Task could not be found in WP-Cron. Please try to deactivate this plugin once and activate again.', 'ip-geo-block' ). '</span>';
1443
 
1444
  // Auto updating (once a month)
1445
- $field = 'update';
1446
  add_settings_field(
1447
- $option_name.'_'.$field.'_auto',
1448
  __( 'Auto updating (once a month)', 'ip-geo-block' ),
1449
  array( $context, 'callback_field' ),
1450
  $option_slug,
@@ -1452,17 +1444,17 @@ endif;
1452
  array(
1453
  'type' => 'checkbox',
1454
  'option' => $option_name,
1455
- 'field' => $field,
1456
  'sub-field' => 'auto',
1457
- 'value' => $options[ $field ]['auto'],
1458
  'disabled' => empty( $providers ),
1459
- 'after' => $options[ $field ]['auto'] ? '<p class="ip-geo-block-desc">' . sprintf( __( 'Next schedule: %s', 'ip-geo-block'), $tmp ) . '</p>' : '',
1460
  )
1461
  );
1462
 
1463
  // Download database
1464
  add_settings_field(
1465
- $option_name.'_'.$field.'_download',
1466
  __( 'Download database', 'ip-geo-block' ),
1467
  array( $context, 'callback_field' ),
1468
  $option_slug,
@@ -1470,56 +1462,19 @@ endif;
1470
  array(
1471
  'type' => 'button',
1472
  'option' => $option_name,
1473
- 'field' => $field,
1474
  'value' => __( 'Download now', 'ip-geo-block' ),
1475
  'disabled' => empty( $providers ),
1476
  'after' => '<div id="ip-geo-block-download"></div>',
1477
  )
1478
  );
1479
 
1480
- /*----------------------------------------*
1481
- * Submission settings
1482
- *----------------------------------------*/
1483
- add_settings_section(
1484
- $section = $plugin_slug . '-submission',
1485
- __( 'Submission settings', 'ip-geo-block' ),
1486
- NULL,
1487
- $option_slug
1488
- );
1489
-
1490
- $val = $GLOBALS['allowedtags'];
1491
- unset( $val['blockquote'] );
1492
-
1493
- // Message on comment form
1494
- $field = 'comment';
1495
- add_settings_field(
1496
- $option_name.'_'.$field,
1497
- '<dfn title="' . __( 'The whole will be wrapped by &lt;p&gt; tag. Allowed tags: ', 'ip-geo-block' ) . implode( ', ', array_keys( $val ) ) . '">' . __( 'Message on comment form', 'ip-geo-block' ) . '</dfn>',
1498
- array( $context, 'callback_field' ),
1499
- $option_slug,
1500
- $section,
1501
- array(
1502
- 'type' => 'select-text',
1503
- 'option' => $option_name,
1504
- 'field' => $field,
1505
- 'sub-field' => 'pos',
1506
- 'txt-field' => 'msg',
1507
- 'value' => $options[ $field ]['pos'],
1508
- 'list' => array(
1509
- 0 => __( 'None', 'ip-geo-block' ),
1510
- 1 => __( 'Top', 'ip-geo-block' ),
1511
- 2 => __( 'Bottom', 'ip-geo-block' ),
1512
- ),
1513
- 'text' => $options[ $field ]['msg'], // escaped by esc_attr() at 'text'
1514
- )
1515
- );
1516
-
1517
  /*----------------------------------------*
1518
  * Plugin settings
1519
  *----------------------------------------*/
1520
  add_settings_section(
1521
  $section = $plugin_slug . '-others',
1522
- __( 'Plugin settings', 'ip-geo-block' ),
1523
  NULL,
1524
  $option_slug
1525
  );
@@ -1529,9 +1484,8 @@ if ( IP_GEO_BLOCK_NETWORK ):
1529
  add_action( 'network_admin_edit_' . IP_Geo_Block::PLUGIN_NAME, array( $context, 'validate_network_settings' ) );
1530
 
1531
  // Network wide configuration
1532
- $field = 'network_wide';
1533
  add_settings_field(
1534
- $option_name.'_'.$field,
1535
  __( '<dfn title="Synchronize all settings over the network wide.">Network wide settings</dfn>', 'ip-geo-block' ),
1536
  array( $context, 'callback_field' ),
1537
  $option_slug,
@@ -1539,19 +1493,34 @@ if ( IP_GEO_BLOCK_NETWORK ):
1539
  array(
1540
  'type' => 'checkbox',
1541
  'option' => $option_name,
1542
- 'field' => $field,
1543
- 'value' => $options[ $field ],
1544
  'disabled' => ! current_user_can( 'manage_network_options' ),
1545
  )
1546
  );
1547
  }
1548
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1549
  // Google Maps API key
1550
- $field = 'api_key';
1551
- $key = 'GoogleMap';
1552
- if ( 'default' !== $options[ $field ][ $key ] or defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ) {
1553
  add_settings_field(
1554
- $option_name.'_'.$field,
1555
  __( '<dfn title="Valid key for Google Maps JavaScript API">Google Maps API key</dfn>', 'ip-geo-block' ),
1556
  array( $context, 'callback_field' ),
1557
  $option_slug,
@@ -1559,96 +1528,74 @@ endif;
1559
  array(
1560
  'type' => 'text',
1561
  'option' => $option_name,
1562
- 'field' => $field,
1563
- 'sub-field' => $key,
1564
- 'value' => $options[ $field ][ $key ],
1565
  )
1566
  );
1567
  }
1568
 
1569
- $desc = __( 'You need to click the &#8220;Save Changes&#8221; button for imported settings to take effect.', 'ip-geo-block' );
1570
-
1571
  // Export / Import settings
1572
- $field = 'export-import';
1573
  add_settings_field(
1574
- $option_name.'_'.$field,
1575
- sprintf( '<dfn title="%s">' . __( 'Export / Import settings', 'ip-geo-block' ) . '</dfn>', $desc ),
1576
  array( $context, 'callback_field' ),
1577
  $option_slug,
1578
  $section,
1579
  array(
1580
  'type' => 'none',
1581
  'before' =>
1582
- '<a class="button button-secondary" id="ip-geo-block-export" title="' . __( 'Export to the local file', 'ip-geo-block' ) . '" href="#!">'. __( 'Export settings', 'ip-geo-block' ) . '</a>&nbsp;' .
1583
- '<a class="button button-secondary" id="ip-geo-block-import" title="' . __( 'Import from the local file', 'ip-geo-block' ) . '" href="#!">'. __( 'Import settings', 'ip-geo-block' ) . '</a>',
1584
  'after' => '<div id="ip-geo-block-export-import"></div>',
1585
  )
1586
  );
1587
 
1588
  // Pre-defined settings
1589
- $field = 'pre-defined';
1590
  add_settings_field(
1591
- $option_name.'_'.$field,
1592
- sprintf( '<dfn title="%s">' . __( 'Import pre-defined settings', 'ip-geo-block' ) . '</dfn>', $desc ),
1593
  array( $context, 'callback_field' ),
1594
  $option_slug,
1595
  $section,
1596
  array(
1597
  'type' => 'none',
1598
  'before' =>
1599
- '<a class="button button-secondary" id="ip-geo-block-default" title="' . __( 'Import the default settings to revert to the &#8220;Right after installing&#8221; state', 'ip-geo-block' ) . '" href="#!">' . __( 'Default settings', 'ip-geo-block' ) . '</a>&nbsp;' .
1600
- '<a class="button button-secondary" id="ip-geo-block-preferred" title="' . __( 'Import the preferred settings mainly by enabling Zero-day Exploit Prevention for the &#8220;Back-end target settings&#8221;', 'ip-geo-block' ) . '" href="#!">' . __( 'Best for Back-end', 'ip-geo-block' ) . '</a>',
1601
  'after' => '<div id="ip-geo-block-pre-defined"></div>',
1602
  )
1603
  );
1604
 
1605
  if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1606
- // Manipulate DB table for validation logs
1607
- $field = 'delete_table';
1608
- add_settings_field(
1609
- $option_name.'_'.$field,
1610
- __( 'Delete DB tables for this plugin', 'ip-geo-block' ),
1611
- array( $context, 'callback_field' ),
1612
- $option_slug,
1613
- $section,
1614
- array(
1615
- 'type' => 'button',
1616
- 'option' => $option_name,
1617
- 'field' => $field,
1618
- 'value' => __( 'Delete now', 'ip-geo-block' ),
1619
- 'after' => '<div id="ip-geo-block-delete-table"></div>',
1620
- )
1621
- );
1622
-
1623
- $field = 'create_table';
1624
  add_settings_field(
1625
- $option_name.'_'.$field,
1626
- __( 'Create DB tables for this plugin', 'ip-geo-block' ),
1627
  array( $context, 'callback_field' ),
1628
  $option_slug,
1629
  $section,
1630
  array(
1631
  'type' => 'button',
1632
  'option' => $option_name,
1633
- 'field' => $field,
1634
- 'value' => __( 'Create now', 'ip-geo-block' ),
1635
- 'after' => '<div id="ip-geo-block-create-table"></div>',
1636
  )
1637
  );
1638
  endif;
1639
 
1640
  // Diagnostic information
1641
- $field = 'show-info';
1642
  add_settings_field(
1643
- $option_name.'_'.$field,
1644
- __( '<dfn title="When an unexpected blocking has occurred, please press the button to find the blocked request in the dumped information which may help to solve the issue.">Diagnostic information</dfn><br />[ <a rel="noreferrer" href="https://wordpress.org/support/plugin/ip-geo-block" title="WordPress &#8250; Support &raquo; IP Geo Block">support forum</a> ]', 'ip-geo-block' ),
1645
  array( $context, 'callback_field' ),
1646
  $option_slug,
1647
  $section,
1648
  array(
1649
  'type' => 'none',
1650
  'before' =>
1651
- '<a class="button button-secondary" id="ip-geo-block-show-info" title="' . __( 'Please copy &amp; paste when submitting your issue to support forum.', 'ip-geo-block' ) . '" href="#!">' . __( 'Show information', 'ip-geo-block' ) . '</a>&nbsp;',
1652
  'after' => '<div id="ip-geo-block-wp-info"></div>',
1653
  )
1654
  );
@@ -1664,16 +1611,16 @@ endif;
1664
  public static function note_target() {
1665
  echo
1666
  '<ul class="ip-geo-block-note">', "\n",
1667
- '<li>', __( 'To enhance the protection ability, please refer to &#8220;<a rel="noreferrer" href="http://www.ipgeoblock.com/codex/the-best-practice-for-target-settings.html" title="The best practice for target settings | IP Geo Block">The best practice for target settings</a>&#8221;.', 'ip-geo-block' ), '</li>', "\n",
1668
- '<li>', __( 'If you have any troubles with these, please check FAQ at <a rel="noreferrer" href="https://wordpress.org/plugins/ip-geo-block/faq/" title="IP Geo Block &mdash; WordPress Plugins">WordPress.org</a> and <a rel="noreferrer" href="http://www.ipgeoblock.com/codex/#faq" title="Codex | IP Geo Block">Codex</a>.', 'ip-geo-block' ), '</li>', "\n",
1669
  '</ul>', "\n";
1670
  }
1671
 
1672
  public static function note_services() {
1673
  echo
1674
  '<ul class="ip-geo-block-note">', "\n",
1675
- '<li>', __( 'While Geolite2&thinsp;/&thinsp;Maxmind and IP2Location will fetch the local databases, others will pass an IP address to the 3rd parties\' API via HTTP.', 'ip-geo-block' ), '</li>', "\n",
1676
- '<li>', __( 'Please select the appropriate APIs to fit the privacy law&thinsp;/&thinsp;regulation in your country&thinsp;/&thinsp;region.', 'ip-geo-block' ), '</li>', "\n",
1677
  '</ul>', "\n";
1678
  }
1679
 
@@ -1690,15 +1637,15 @@ endif;
1690
  public static function note_public() {
1691
  echo
1692
  '<ul class="ip-geo-block-note">', "\n",
1693
- '<li>', __( 'Please refer to the document &#8220;<a rel="noreferrer" href="http://www.ipgeoblock.com/codex/#blocking-on-front-end" title="Codex | IP Geo Block">Blocking on front-end</a>&#8221; for details, including restrictions on cache plugin.', 'ip-geo-block' ), '</li>', "\n",
1694
- '<li>', __( 'If you find any issues or have something to suggest, please feel free to open an issue at <a rel="noreferrer" href="https://wordpress.org/support/plugin/ip-geo-block" title="WordPress &#8250; Support &raquo; IP Geo Block">support forum</a>.', 'ip-geo-block' ), '</li>', "\n",
1695
  '</ul>', "\n";
1696
  }
1697
 
1698
- public static function note_record() {
1699
  echo
1700
  '<ul class="ip-geo-block-note">', "\n",
1701
- '<li>', __( 'Please refer to the document &#8220;<a rel="noreferrer" href="http://www.ipgeoblock.com/codex/record-settings-and-logs.html" title="Codex | IP Geo Block">Record settings and logs</a>&#8221; for details.', 'ip-geo-block' ), '</li>', "\n",
1702
  '</ul>', "\n";
1703
  }
1704
 
9
  $options = IP_Geo_Block::get_option();
10
  $plugin_slug = IP_Geo_Block::PLUGIN_NAME; // 'ip-geo-block'
11
 
12
+ // common descriptions
13
+ $common = array(
14
+ '<span class="ip-geo-block-sup">' . __( '(comma separated)', 'ip-geo-block' ) . '</span>',
15
+ '<span class="ip-geo-block-sup">' . __( '(comma or RET separated)', 'ip-geo-block' ) . '</span>',
16
+ '<span title="' . __( 'Toggle selection', 'ip-geo-block' ) . '"></span>',
17
+ '<span title="' . __( 'Find blocked requests in &#8220;Logs&#8220;', 'ip-geo-block' ) . '"></span>',
18
+ __( 'Help', 'ip-geo-block' ),
19
+ __( 'Before adding as &#8220;Exception&#8221;, please click on &#8220;<a class="ip-geo-block-icon ip-geo-block-icon-alert" title="This button is just a sample."><span></span></a>&#8221; button (if exists) attached to the following list to confirm that the blocked request is not malicious.', 'ip-geo-block' ),
20
+ __( 'Open CIDR calculator for IPv4 / IPv6.', 'ip-geo-block' ),
21
+ );
22
+
23
  /**
24
  * Register a setting and its sanitization callback.
25
+ * @link https://codex.wordpress.org/Function_Reference/register_setting
26
  *
27
  * register_setting( $option_group, $option_name, $sanitize_callback );
28
  * @param string $option_group A settings group name.
38
 
39
  /**
40
  * Add new section to a new page inside the existing page.
41
+ * @link https://codex.wordpress.org/Function_Reference/add_settings_section
42
  *
43
  * add_settings_section( $id, $title, $callback, $page );
44
  * @param string $id String for use in the 'id' attribute of tags.
52
  *----------------------------------------*/
53
  add_settings_section(
54
  $section = $plugin_slug . '-validation-rule',
55
+ array( __( 'Validation rule settings', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/validation-rule-settings.html" title="Validation rule settings | IP Geo Block">' . $common[4] . '</a>' ),
56
  NULL,
57
  $option_slug
58
  );
59
 
60
  /**
61
  * Register a settings field to the settings page and section.
62
+ * @link https://codex.wordpress.org/Function_Reference/add_settings_field
63
  *
64
  * add_settings_field( $id, $title, $callback, $page, $section, $args );
65
  * @param string $id String for use in the 'id' attribute of tags.
72
  // Get the country code of client
73
  $key = IP_Geo_Block::get_geolocation( $val = IP_Geo_Block::get_ip_address( $options ) );
74
 
 
75
  add_settings_field(
76
+ $option_name.'_ip_client',
77
  __( '<dfn title="You can confirm the appropriate Geolocation APIs and country code by referring &#8220;Scan country code&#8221;.">Your IP address / Country</dfn>', 'ip-geo-block' ),
78
  array( $context, 'callback_field' ),
79
  $option_slug,
81
  array(
82
  'type' => 'html',
83
  'option' => $option_name,
84
+ 'field' => 'ip_client',
85
  'value' => '<span class="ip-geo-block-ip-addr">' . esc_html( $key['ip'] . ' / ' . ( $key['code'] && isset( $key['provider'] ) ? $key['code'] . ' (' . $key['provider'] . ')' : __( 'UNKNOWN', 'ip-geo-block' ) ) ) . '</span>',
86
+ 'after' => '&nbsp;<a class="button-secondary" id="ip-geo-block-scan-ip_client" title="' . __( 'Scan all the APIs you selected at Geolocation API settings', 'ip-geo-block' ) . '" href="#!">' . __( 'Scan country code', 'ip-geo-block' ) . '</a><div id="ip-geo-block-scanning-ip_client"></div>',
87
  )
88
  );
89
 
91
  // Get the country code of server
92
  $key = IP_Geo_Block::get_geolocation( $_SERVER['SERVER_ADDR'] );
93
 
 
94
  add_settings_field(
95
+ $option_name.'_ip_server',
96
  __( '<dfn title="You can confirm the appropriate Geolocation APIs and country code by referring &#8220;Scan country code&#8221;.">Server IP address / Country</dfn>', 'ip-geo-block' ),
97
  array( $context, 'callback_field' ),
98
  $option_slug,
100
  array(
101
  'type' => 'html',
102
  'option' => $option_name,
103
+ 'field' => 'ip_server',
104
  'value' => '<span class="ip-geo-block-ip-addr">' . esc_html( $key['ip'] . ' / ' . ( $key['code'] && isset( $key['provider'] ) ? $key['code'] . ' (' . $key['provider'] . ')' : __( 'UNKNOWN', 'ip-geo-block' ) ) ) . '</span>',
105
+ 'after' => '&nbsp;<a class="button-secondary" id="ip-geo-block-scan-ip_server" title="' . __( 'Scan all the APIs you selected at Geolocation API settings', 'ip-geo-block' ) . '" href="#!">' . __( 'Scan country code', 'ip-geo-block' ) . '</a><div id="ip-geo-block-scanning-ip_server"></div>',
106
  )
107
  );
108
  endif;
116
 
117
  $rule_desc = array(
118
  __( 'Please select either &#8220;Whitelist&#8221; or &#8220;Blacklist&#8221;.', 'ip-geo-block' ),
119
+ __( '<dfn title="&#8220;Block by country&#8221; will be bypassed in case of empty. The special code &#8220;XX&#8221; is assigned as private IP address including localhost. And &#8220;ZZ&#8221; is for unknown IP address (i.e. not in the geolocation databases). Please use &#8220;YY&#8221; if you need the code that does not correspond to any of the countries.">Whitelist of country code</dfn>', 'ip-geo-block' ) . '<br />(<a rel="noreferrer" href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" title="ISO 3166-1 alpha-2 - Wikipedia, the free encyclopedia">ISO 3166-1 alpha-2</a>)',
120
+ __( '<dfn title="&#8220;Block by country&#8221; will be bypassed in case of empty. The special code &#8220;XX&#8221; is assigned as private IP address including localhost. And &#8220;ZZ&#8221; is for unknown IP address (i.e. not in the geolocation databases). Please use &#8220;YY&#8221; if you need the code that does not correspond to any of the countries.">Blacklist of country code</dfn>', 'ip-geo-block' ) . '<br />(<a rel="noreferrer" href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" title="ISO 3166-1 alpha-2 - Wikipedia, the free encyclopedia">ISO 3166-1 alpha-2</a>)',
 
 
 
 
 
 
 
 
 
121
  );
122
 
123
  // Matching rule
 
124
  add_settings_field(
125
+ $option_name.'_matching_rule',
126
  '<dfn title="' . $rule_desc[0] . '">' . __( 'Matching rule', 'ip-geo-block' ) . '</dfn>',
127
  array( $context, 'callback_field' ),
128
  $option_slug,
130
  array(
131
  'type' => 'select',
132
  'option' => $option_name,
133
+ 'field' => 'matching_rule',
134
+ 'value' => $options['matching_rule'],
135
  'list' => $rule,
136
  'desc' => array(
137
  -1 => $rule_desc[0],
143
  );
144
 
145
  // Country code for matching rule (ISO 3166-1 alpha-2)
 
146
  add_settings_field(
147
+ $option_name.'_white_list',
148
  $rule_desc[1],
149
  array( $context, 'callback_field' ),
150
  $option_slug,
152
  array(
153
  'type' => 'text',
154
  'option' => $option_name,
155
+ 'field' => 'white_list',
156
+ 'value' => $options['white_list'],
157
+ 'after' => $common[0],
158
  'class' => $options['matching_rule'] == 0 ? '' : 'ip-geo-block-hide',
159
  )
160
  );
161
 
 
162
  add_settings_field(
163
+ $option_name.'_black_list',
164
  $rule_desc[2],
165
  array( $context, 'callback_field' ),
166
  $option_slug,
168
  array(
169
  'type' => 'text',
170
  'option' => $option_name,
171
+ 'field' => 'black_list',
172
+ 'value' => $options['black_list'],
173
+ 'after' => $common[0],
174
  'class' => $options['matching_rule'] == 1 ? '' : 'ip-geo-block-hide',
175
  )
176
  );
177
 
178
  // Use AS number
 
 
179
  add_settings_field(
180
+ $option_name.'_Maxmind_use_asn',
181
  __( '<dfn title="It enables utilizing &#8220;AS number&#8221; in the &#8220;Whitelist/Blacklist of extra IP addresses&#8221; to specify a group of IP networks.">Use Autonomous System Number</dfn>', 'ip-geo-block' ) .
182
  ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)',
183
  array( $context, 'callback_field' ),
186
  array(
187
  'type' => 'checkbox',
188
  'option' => $option_name,
189
+ 'field' => 'Maxmind',
190
+ 'sub-field' => 'use_asn',
191
+ 'value' => 1 === (int)$options['Maxmind']['use_asn'],
192
+ 'after' => '<p class="ip-geo-block-desc">' . sprintf( __( 'Some useful tools to find ASN are introduced in &#8220;%s&#8221;.', 'ip-geo-block' ), '<a rel="noreferrer" href="https://www.ipgeoblock.com/codex/utilizing-asnumber.html" title="Utilizing AS number | IP Geo Block">Utilizing AS number</a>' ) . '</p>',
193
  )
194
  );
195
 
196
  // White list of extra IP addresses prior to country code (CIDR, ASN)
 
 
197
  add_settings_field(
198
+ $option_name.'_extra_ips_white_list',
199
  __( '<dfn title="e.g. &#8220;192.0.64.0/18&#8221; for Jetpack server, &#8220;69.46.36.0/27&#8221; for WordFence server or &#8220;AS32934&#8221; for Facebook.">Whitelist of extra IP addresses prior to country code</dfn>', 'ip-geo-block' ) .
200
  ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" title="Classless Inter-Domain Routing - Wikipedia">CIDR</a>' .
201
  ', <a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)' .
202
+ '<a class="ip-geo-block-icon ip-geo-block-icon-cidr" title="' . $common[6] . '"><span class="ip-geo-block-icon-calc"></span></a>',
203
  array( $context, 'callback_field' ),
204
  $option_slug,
205
  $section,
206
  array(
207
  'type' => 'textarea',
208
  'option' => $option_name,
209
+ 'field' => 'extra_ips',
210
+ 'sub-field' => 'white_list',
211
+ 'value' => $options['extra_ips']['white_list'],
212
  'placeholder' => '192.168.0.0/16,2001:db8::/96,AS1234',
213
+ 'after' => $common[1],
214
  )
215
  );
216
 
217
  // Black list of extra IP addresses prior to country code (CIDR, ASN)
 
218
  add_settings_field(
219
+ $option_name.'_extra_ips_black_list',
220
  __( '<dfn title="Server level access control is recommended (e.g. .htaccess).">Blacklist of extra IP addresses prior to country code</dfn>', 'ip-geo-block' ) .
221
  ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" title="Classless Inter-Domain Routing - Wikipedia">CIDR</a>' .
222
  ', <a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)' .
223
+ '<a class="ip-geo-block-icon ip-geo-block-icon-cidr" title="' . $common[6] . '"><span class="ip-geo-block-icon ip-geo-block-icon-calc"></span></a>',
224
  array( $context, 'callback_field' ),
225
  $option_slug,
226
  $section,
227
  array(
228
  'type' => 'textarea',
229
  'option' => $option_name,
230
+ 'field' => 'extra_ips',
231
+ 'sub-field' => 'black_list',
232
+ 'value' => $options['extra_ips']['black_list'],
233
  'placeholder' => '192.168.0.0/16,2001:db8::/96,AS1234',
234
+ 'after' => $common[1],
235
  )
236
  );
237
 
238
  // $_SERVER keys to retrieve extra IP addresses
 
 
239
  add_settings_field(
240
+ $option_name.'_validation_proxy',
241
  __( '<dfn title="If your server is placed behind the proxy server or the load balancing server, you need to put the appropriate key such as &#8220;HTTP_X_FORWARDED_FOR&#8221;, &#8220;HTTP_X_REAL_IP&#8221; or something like that to retrieve the client IP address.">$_SERVER keys to retrieve extra IP addresses</dfn>', 'ip-geo-block' ),
242
  array( $context, 'callback_field' ),
243
  $option_slug,
245
  array(
246
  'type' => 'text',
247
  'option' => $option_name,
248
+ 'field' => 'validation',
249
+ 'sub-field' => 'proxy',
250
+ 'value' => $options['validation']['proxy'],
251
  'placeholder' => IP_Geo_Block_Util::get_proxy_var(),
252
+ 'after' => $common[0],
253
  )
254
  );
255
 
256
  // Bad signatures
 
257
  add_settings_field(
258
+ $option_name.'_signature',
259
  __( '<dfn title="It validates malicious signatures independently of &#8220;Block by country&#8221; and &#8220;Prevent Zero-day Exploit&#8221; for the target &#8220;Admin area&#8221;, &#8220;Admin ajax/post&#8221;, &#8220;Plugins area&#8221; and &#8220;Themes area&#8221;.">Bad signatures in query</dfn> <nobr>(<a class="ip-geo-block-icon ip-geo-block-icon-cycle" id="ip-geo-block-decode" title="When you find ugly character string in the text area, please click to restore."><span></span></a>)</nobr>', 'ip-geo-block' ),
260
  array( $context, 'callback_field' ),
261
  $option_slug,
263
  array(
264
  'type' => 'textarea',
265
  'option' => $option_name,
266
+ 'field' => 'signature',
267
+ 'value' => $options['signature'],
268
+ 'after' => $common[1],
269
  )
270
  );
271
 
272
  // Prevent malicious upload - white list of file extention and MIME type
273
+ $list = '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Select allowed MIME type.">Whitelist of allowed MIME type</dfn>', 'ip-geo-block' ) . "<a class=\"ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide\">" . $common[2] . "</a>\n<li class=\"ip-geo-block-hide\"><ul class=\"ip-geo-block-float\">\n";
274
 
275
  // get_allowed_mime_types() in wp-includes/functions.php @since 2.8.6
276
  foreach ( IP_Geo_Block_Util::get_allowed_mime_types() as $key => $val ) {
285
  $list .= "</ul></li></ul>\n";
286
 
287
  // Verify capability
288
+ $list .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the capabilities to be verified. Depending on the particular type of uploader, certain capability may be required. Default is &#8220;upload_files&#8221; for Administrator, Editor and Author. This verification will be skipped if empty.">Capabilities to be verified</dfn>', 'ip-geo-block' ) . '&nbsp;<span class="ip-geo-block-desc">' . __( '( See &#8220;<a rel="noreferrer" href="https://codex.wordpress.org/Roles_and_Capabilities" title="Roles and Capabilities &laquo; WordPress Codex">Roles and Capabilities</a>&#8221; )', 'ip-geo-block' ) . '</span>' . "\n";
289
+ $list .= '<li class="ip-geo-block-hide"><ul><li><input type="text" id="ip_geo_block_settings_mimetype_capability" name="ip_geo_block_settings[mimetype][capability]" class="regular-text code" placeholder="upload_files" value="' . esc_attr( implode( ',', $options['mimetype']['capability'] ) ) . '" />' . $common[0] . '</li></ul></li></ul>';
290
 
291
  // Prevent malicious file uploading
 
 
292
  add_settings_field(
293
+ $option_name.'_validation_mimetype',
294
  __( '<dfn title="It restricts the file types on upload in order to block malware and backdoor via both back-end and front-end. Please consider to select &#8220;mu-plugins&#8221; (ip-geo-block-mu.php) at &#8220;Validation timing&#8221; so that other staff would not fetch the uploaded files before this validation.">Prevent malicious file uploading</dfn>', 'ip-geo-block' ),
295
  array( $context, 'callback_field' ),
296
  $option_slug,
298
  array(
299
  'type' => 'select',
300
  'option' => $option_name,
301
+ 'field' => 'validation',
302
+ 'sub-field' => 'mimetype',
303
+ 'value' => $options['validation']['mimetype'],
304
  'list' => array(
305
  0 => __( 'Disable', 'ip-geo-block' ),
306
  1 => __( 'Verify file extension and MIME type', 'ip-geo-block' ),
311
  );
312
 
313
  // Response code (RFC 2616)
 
314
  add_settings_field(
315
+ $option_name.'_response_code',
316
+ sprintf( __( '<dfn title="You can put your original 403.php and so on into your theme directory.">Response code</dfn> %s', 'ip-geo-block' ), '(<a rel="noreferrer" href="https://tools.ietf.org/html/rfc2616#section-10" title="RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1">RFC 2616</a>)' ),
317
  array( $context, 'callback_field' ),
318
  $option_slug,
319
  $section,
320
  array(
321
  'type' => 'select',
322
  'option' => $option_name,
323
+ 'field' => 'response_code',
324
+ 'value' => $options['response_code'],
325
  'list' => array(
326
  200 => '200 OK',
327
  301 => '301 Moved Permanently',
340
  );
341
 
342
  // Redirect URI
 
343
  add_settings_field(
344
+ $option_name.'_redirect_uri',
345
  __( '<dfn title="Specify the URL for response code 2xx and 3xx. If it is pointed to a public facing page, visitors would not be blocked on the page to prevent loop of redirection even when you enable [Block by country] in [Front-end target settings] section. Empty URL is altered to your home.">Redirect URL</dfn>', 'ip-geo-block' ),
346
  array( $context, 'callback_field' ),
347
  $option_slug,
349
  array(
350
  'type' => 'text',
351
  'option' => $option_name,
352
+ 'field' => 'redirect_uri',
353
+ 'value' => $options['redirect_uri'],
354
  'class' => $options['response_code'] < 400 ? '' : 'ip-geo-block-hide',
355
  'placeholder' => '/about/',
356
  )
357
  );
358
 
359
  // Response message
 
360
  add_settings_field(
361
+ $option_name.'_response_msg',
362
  __( '<dfn title="Specify the message for response code 4xx and 5xx.">Response message</dfn>', 'ip-geo-block' ),
363
  array( $context, 'callback_field' ),
364
  $option_slug,
366
  array(
367
  'type' => 'text',
368
  'option' => $option_name,
369
+ 'field' => 'response_msg',
370
+ 'value' => $options['response_msg'],
371
  'class' => $options['response_code'] >= 400 ? '' : 'ip-geo-block-hide',
372
  )
373
  );
374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  // Validation timing
376
+ $options['validation']['timing'] = IP_Geo_Block_Opts::get_validation_timing();
 
 
377
 
378
  add_settings_field(
379
+ $option_name.'_validation_timing',
380
  '<dfn title="' . __( 'Select when to run the validation.', 'ip-geo-block' ) . '">' . __( 'Validation timing', 'ip-geo-block' ) . '</dfn>',
381
  array( $context, 'callback_field' ),
382
  $option_slug,
384
  array(
385
  'type' => 'select',
386
  'option' => $option_name,
387
+ 'field' => 'validation',
388
+ 'sub-field' => 'timing',
389
+ 'value' => $options['validation']['timing'],
390
  'list' => array(
391
  0 => __( '&#8220;init&#8221; action hook', 'ip-geo-block' ),
392
  1 => __( '&#8220;mu-plugins&#8221; (ip-geo-block-mu.php)', 'ip-geo-block' ),
393
  ),
394
  'desc' => array(
395
  0 => __( 'Validate at &#8220;init&#8221; action hook in the same manner as typical plugins.', 'ip-geo-block' ),
396
+ 1 => __( 'Validate at an earlier phase than other typical plugins. It can reduce load on server but has <a rel=\'noreferrer\' href=\'https://www.ipgeoblock.com/codex/validation-timing.html\' title=\'Validation timing | IP Geo Block\'>some restrictions</a>.', 'ip-geo-block' ),
397
  ),
398
  )
399
  );
403
  *----------------------------------------*/
404
  add_settings_section(
405
  $section = $plugin_slug . '-validation-target',
406
+ array( __( 'Back-end target settings', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/back-end-target-settings.html" title="Back-end target settings | IP Geo Block">' . $common[4] . '</a>' ),
407
  array( __CLASS__, 'note_target' ),
408
  $option_slug
409
  );
420
  );
421
 
422
  // Comment post
 
 
423
  add_settings_field(
424
+ $option_name.'_validation_comment',
425
+ $target['comment'],
426
  array( $context, 'callback_field' ),
427
  $option_slug,
428
  $section,
429
  array(
430
  'type' => 'checkbox',
431
  'option' => $option_name,
432
+ 'field' => 'validation',
433
+ 'sub-field' => 'comment',
434
+ 'value' => $options['validation']['comment'],
435
  'text' => __( 'Block by country', 'ip-geo-block' ),
436
  )
437
  );
438
 
439
+ $val = $GLOBALS['allowedtags'];
440
+ unset( $val['blockquote'] );
441
+
442
+ // Message on comment form
443
+ add_settings_field(
444
+ $option_name.'_comment',
445
+ '<div class="ip-geo-block-subitem"><dfn title="' . __( 'The whole will be wrapped by &lt;p&gt; tag. Allowed tags: ', 'ip-geo-block' ) . implode( ', ', array_keys( $val ) ) . '">' . __( 'Message on comment form', 'ip-geo-block' ) . '</dfn></div>',
446
+ array( $context, 'callback_field' ),
447
+ $option_slug,
448
+ $section,
449
+ array(
450
+ 'type' => 'select-text',
451
+ 'option' => $option_name,
452
+ 'field' => 'comment',
453
+ 'sub-field' => 'pos',
454
+ 'txt-field' => 'msg',
455
+ 'value' => $options['comment']['pos'],
456
+ 'class' => 'ip-geo-block-subitem-parent',
457
+ 'list' => array(
458
+ 0 => __( 'None', 'ip-geo-block' ),
459
+ 1 => __( 'Top', 'ip-geo-block' ),
460
+ 2 => __( 'Bottom', 'ip-geo-block' ),
461
+ ),
462
+ 'text' => $options['comment']['msg'], // escaped by esc_attr() at 'text'
463
+ )
464
+ );
465
+
466
  // XML-RPC
 
467
  add_settings_field(
468
+ $option_name.'_validation_xmlrpc',
469
+ $target['xmlrpc'],
470
  array( $context, 'callback_field' ),
471
  $option_slug,
472
  $section,
473
  array(
474
  'type' => 'select',
475
  'option' => $option_name,
476
+ 'field' => 'validation',
477
+ 'sub-field' => 'xmlrpc',
478
+ 'value' => $options['validation']['xmlrpc'],
479
  'list' => array(
480
  0 => __( 'Disable', 'ip-geo-block' ),
481
  1 => __( 'Block by country', 'ip-geo-block' ),
498
  }
499
 
500
  // Login form
 
501
  add_settings_field(
502
+ $option_name.'_validation_login',
503
+ $target['login'],
504
  array( $context, 'callback_field' ),
505
  $option_slug,
506
  $section,
507
  array(
508
  'type' => 'checkbox',
509
  'option' => $option_name,
510
+ 'field' => 'validation',
511
+ 'sub-field' => 'login',
512
+ 'value' => $options['validation']['login'],
513
  'text' => __( 'Block by country', 'ip-geo-block' ),
514
+ 'after' => '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual action as a blocking target.">Target actions</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $common[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n" . $list . "</ul></li></ul>\n",
515
  )
516
  );
517
 
525
  2 => __( 'Regardless of the country code, it will block a malicious request related to the services only for the dashboard.', 'ip-geo-block' ),
526
  );
527
 
528
+ // Max failed login attempts per IP address
529
+ add_settings_field(
530
+ $option_name.'_login_fails',
531
+ '<div class="ip-geo-block-subitem"><dfn title="' . __( 'This is applied to &#8220;XML-RPC&#8221; and &#8220;Login form&#8221; when &#8220;IP address cache&#8221; in &#8220;Privacy and record settings&#8221; section is enabled. Lockout period is the same as expiration time of the cache.', 'ip-geo-block' ) . '">' . __( 'Max failed login attempts per IP address', 'ip-geo-block' ) . '</dfn></div>',
532
+ array( $context, 'callback_field' ),
533
+ $option_slug,
534
+ $section,
535
+ array(
536
+ 'type' => 'select',
537
+ 'option' => $option_name,
538
+ 'field' => 'login_fails',
539
+ 'value' => $options['login_fails'],
540
+ 'class' => 'ip-geo-block-subitem-parent',
541
+ 'list' => array(
542
+ -1 => 'Disable',
543
+ 0 => 0,
544
+ 1 => 1,
545
+ 3 => 3,
546
+ 5 => 5,
547
+ 7 => 7,
548
+ 10 => 10,
549
+ ),
550
+ )
551
+ );
552
+
553
  // Admin area
 
554
  add_settings_field(
555
+ $option_name.'_validation_admin',
556
+ $target['admin'],
557
  array( $context, 'callback_field' ),
558
  $option_slug,
559
  $section,
560
  array(
561
  'type' => 'checkboxes',
562
  'option' => $option_name,
563
+ 'field' => 'validation',
564
+ 'sub-field' => 'admin',
565
+ 'value' => $options['validation']['admin'],
566
  'list' => $list,
567
  'desc' => $desc,
568
  )
587
  . '</li>' . "\n";
588
  }
589
 
 
 
590
  // Admin ajax/post
591
+ $path = IP_Geo_Block::get_wp_path();
592
+ $val = esc_html( substr( $path['admin'], 1 ) );
593
  add_settings_field(
594
+ $option_name.'_validation_ajax',
595
  sprintf( $dfn, $val.'admin-(ajax|post).php', __( 'Admin ajax/post', 'ip-geo-block' ) ),
596
  array( $context, 'callback_field' ),
597
  $option_slug,
599
  array(
600
  'type' => 'checkboxes',
601
  'option' => $option_name,
602
+ 'field' => 'validation',
603
+ 'sub-field' => 'ajax',
604
+ 'value' => $options['validation']['ajax'],
605
  'list' => $list,
606
  'desc' => $desc,
607
  'after' =>
608
  '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . "\n" .
609
  ' <dfn title="' . __( 'Specify the action name (&#8220;action=&hellip;&#8221;) or the page name (&#8220;page=&hellip;&#8221;) to prevent unintended blocking caused by &#8220;Block by country&#8221; (for non logged-in user) and &#8220;Prevent Zero-day Exploit&#8221; (for logged-in user).', 'ip-geo-block' ) . '">' . __( 'Exceptions', 'ip-geo-block' ) . "</dfn>\n" .
610
+ ' <a class="ip-geo-block-hide ip-geo-block-icon ip-geo-block-icon-unlock"><span title="' . __( 'Toggle with non logged-in user', 'ip-geo-block' ) . '"></span></a><a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide" data-target="admin">' . $common[2] . '</a><a class="ip-geo-block-icon ip-geo-block-icon-find ip-geo-block-hide" data-target="admin">' . $common[3] . "</a>\n" .
611
  ' <li class="ip-geo-block-hide">' . "\n" .
612
+ ' <input class="regular-text code" id="ip_geo_block_settings_exception_admin" name="ip_geo_block_settings[exception][admin]" type="text" value="' . esc_attr( implode( ',', $options['exception']['admin'] ) ) . '">' . $common[0] . "\n" .
613
  ' <h4>' . __( 'Candidate actions/pages', 'ip-geo-block' ) . "</h4>\n" .
614
+ ' <p class="ip-geo-block-find-desc">' . $common[5] . '<span id="ip-geo-block-find-admin"></span></p>' . "\n" .
615
  ' </li>' . "\n" .
616
  ' <li class="ip-geo-block-hide">' . "\n" .
617
  ' <ul class="ip-geo-block-list-exceptions" id="ip-geo-block-list-admin">' . "\n" .
626
  $desc = array(
627
  __( 'Regardless of the country code, it will block a malicious request to <code>%s&ctdot;/*.php</code>.', 'ip-geo-block' ),
628
  __( 'Select the item which causes unintended blocking in order to exclude from the validation target. Grayed item indicates &#8220;INACTIVE&#8221;.', 'ip-geo-block' ),
629
+ __( 'It configures &#8220;%s&#8221; to validate a direct request to the PHP file which does not load WordPress core. Make sure to deny direct access to the hidden files beginning with a dot by the server\'s configuration.', 'ip-geo-block' ),
630
  __( 'Sorry, but your server type is not supported.', 'ip-geo-block' ),
631
+ __( 'You need to click &#8220;Save Changes&#8221; button for imported settings to take effect.', 'ip-geo-block' ),
632
  );
633
 
634
  // Set rewrite condition
656
  }
657
 
658
  // Plugins area
659
+ $val = esc_html( $path['plugins'] );
660
+ $tmp = '<input type="checkbox" id="ip_geo_block_settings_rewrite_plugins'
661
+ . '" name="ip_geo_block_settings[rewrite][plugins]" '
662
+ . ' value="1"' . checked( $options['rewrite']['plugins'], TRUE, FALSE )
663
+ . disabled( $options['rewrite']['plugins'], -1, FALSE ) . ' />'
664
+ . '<label for="ip_geo_block_settings_rewrite_plugins"><dfn title="'
 
665
  . ( $config ? sprintf( $desc[2], $val . $config ) : $desc[3] )
666
  . '">' . __( 'Force to load WP core', 'ip-geo-block' )
667
  . '</dfn></label><br />';
668
 
669
  add_settings_field(
670
+ $option_name.'_validation_plugins',
671
  sprintf( $dfn, $val.'&hellip;/*.php', __( 'Plugins area', 'ip-geo-block' ) ),
672
  array( $context, 'callback_field' ),
673
  $option_slug,
675
  array(
676
  'type' => 'select',
677
  'option' => $option_name,
678
+ 'field' => 'validation',
679
+ 'sub-field' => 'plugins',
680
+ 'value' => $options['validation']['plugins'],
681
  'list' => $list,
682
  'desc' => array(
683
  2 => sprintf( $desc[0], $val ),
685
  'after' => $tmp .
686
  '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . "\n" .
687
  ' <dfn title="' . $desc[1] . '">' . __( 'Exceptions', 'ip-geo-block' ) . "</dfn>\n" .
688
+ ' <a class="ip-geo-block-hide ip-geo-block-icon ip-geo-block-icon-cycle">' . $common[2] . '</a><a class="ip-geo-block-icon ip-geo-block-icon-find ip-geo-block-hide" data-target="plugins">' . $common[3] . "</a>\n" .
689
  ' <li class="ip-geo-block-hide">' . "\n" .
690
+ ' <p class="ip-geo-block-find-desc">' . $common[5] . '<span id="ip-geo-block-find-plugins"></span></p>' . "\n" .
691
  ' </li>' . "\n" .
692
  ' <li class="ip-geo-block-hide">' . "\n" .
693
  ' <ul class="ip-geo-block-list-exceptions" id="ip-geo-block-list-plugins">' . "\n" .
716
  }
717
 
718
  // Themes area
719
+ $val = esc_html( $path['themes'] );
720
+ $tmp = '<input type="checkbox" id="ip_geo_block_settings_rewrite_themes'
721
+ . '" name="ip_geo_block_settings[rewrite][themes]" '
722
+ . ' value="1"' . checked( $options['rewrite']['themes'], TRUE, FALSE )
723
+ . disabled( $options['rewrite']['themes'], -1, FALSE ) . ' />'
724
+ . '<label for="ip_geo_block_settings_rewrite_themes"><dfn title="'
 
725
  . ( $config ? sprintf( $desc[2], $val . $config ) : $desc[3] )
726
  . '">' . __( 'Force to load WP core', 'ip-geo-block' )
727
  . '</dfn></label><br />';
728
 
729
  add_settings_field(
730
+ $option_name.'_validation_themes',
731
  sprintf( $dfn, $val.'&hellip;/*.php', __( 'Themes area', 'ip-geo-block' ) ),
732
  array( $context, 'callback_field' ),
733
  $option_slug,
735
  array(
736
  'type' => 'select',
737
  'option' => $option_name,
738
+ 'field' => 'validation',
739
+ 'sub-field' => 'themes',
740
+ 'value' => $options['validation']['themes'],
741
  'list' => $list,
742
  'desc' => array(
743
  2 => sprintf( $desc[0], $val ),
745
  'after' => $tmp .
746
  '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . "\n" .
747
  ' <dfn title="' . $desc[1] . '">' . __( 'Exceptions', 'ip-geo-block' ) . "</dfn>\n" .
748
+ ' <a class="ip-geo-block-hide ip-geo-block-icon ip-geo-block-icon-cycle">' . $common[2] . '</a><a class="ip-geo-block-icon ip-geo-block-icon-find ip-geo-block-hide" data-target="themes">' . $common[3] . "</a>\n" .
749
  ' <li class="ip-geo-block-hide">' . "\n" .
750
+ ' <p class="ip-geo-block-find-desc">' . $common[5] . '<span id="ip-geo-block-find-themes"></span></p>' . "\n" .
751
  ' </li>' . "\n" .
752
  ' <li class="ip-geo-block-hide">' . "\n" .
753
  ' <ul class="ip-geo-block-list-exceptions" id="ip-geo-block-list-themes">' . "\n" .
763
  *----------------------------------------*/
764
  add_settings_section(
765
  $section = $plugin_slug . '-public',
766
+ array( __( 'Front-end target settings', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/front-end-target-settings.html" title="Front-end target settings | IP Geo Block">' . $common[4] . '</a>' ),
767
  array( __CLASS__, 'note_public' ),
768
  $option_slug
769
  );
770
 
771
  // Public facing pages
 
772
  add_settings_field(
773
+ $option_name.'_validation_public',
774
+ $target['public'],
775
  array( $context, 'callback_field' ),
776
  $option_slug,
777
  $section,
778
  array(
779
  'type' => 'checkbox',
780
  'option' => $option_name,
781
+ 'field' => 'validation',
782
+ 'sub-field' => 'public',
783
+ 'value' => $options['validation']['public'],
784
  'text' => __( 'Block by country', 'ip-geo-block' ),
785
  )
786
  );
787
 
 
 
 
788
  // Matching rule
 
 
789
  add_settings_field(
790
+ $option_name.'_public_matching_rule',
791
  '<dfn title="' . $rule_desc[0] . '">' . __( 'Matching rule', 'ip-geo-block' ) . '</dfn>',
792
  array( $context, 'callback_field' ),
793
  $option_slug,
795
  array(
796
  'type' => 'select',
797
  'option' => $option_name,
798
+ 'field' => 'public',
799
+ 'sub-field' => 'matching_rule',
800
+ 'value' => $options['public']['matching_rule'],
801
+ 'list' => array( -1 => __( 'Follow &#8220;Validation rule settings&#8221;', 'ip-geo-block' ) ) + $rule,
802
  )
803
  );
804
 
805
  // Country code for matching rule (ISO 3166-1 alpha-2)
 
806
  add_settings_field(
807
+ $option_name.'_public_white_list',
808
  $rule_desc[1],
809
  array( $context, 'callback_field' ),
810
  $option_slug,
812
  array(
813
  'type' => 'text',
814
  'option' => $option_name,
815
+ 'field' => 'public',
816
+ 'sub-field' => 'white_list',
817
+ 'value' => $options['public']['white_list'],
818
+ 'after' => $common[0],
819
+ 'class' => $options['public']['matching_rule'] == 0 ? '' : 'ip-geo-block-hide',
820
  )
821
  );
822
 
 
823
  add_settings_field(
824
+ $option_name.'_public_black_list',
825
  $rule_desc[2],
826
  array( $context, 'callback_field' ),
827
  $option_slug,
829
  array(
830
  'type' => 'text',
831
  'option' => $option_name,
832
+ 'field' => 'public',
833
+ 'sub-field' => 'black_list',
834
+ 'value' => $options['public']['black_list'],
835
+ 'after' => $common[0],
836
+ 'class' => $options['public']['matching_rule'] == 1 ? '' : 'ip-geo-block-hide',
837
  )
838
  );
839
 
840
  // Response code (RFC 2616)
 
841
  add_settings_field(
842
+ $option_name.'_public_response_code',
843
+ sprintf( __( '<dfn title="You can configure a different response code from the Back-end. This is useful to prevent violation against your affiliate program.">Response code</dfn> %s', 'ip-geo-block' ), '(<a rel="noreferrer" href="https://tools.ietf.org/html/rfc2616#section-10" title="RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1">RFC 2616</a>)' ),
844
  array( $context, 'callback_field' ),
845
  $option_slug,
846
  $section,
847
  array(
848
  'type' => 'select',
849
  'option' => $option_name,
850
+ 'field' => 'public',
851
+ 'sub-field' => 'response_code',
852
+ 'value' => $options['public']['response_code'],
853
  'list' => array(
854
  200 => '200 OK',
855
  301 => '301 Moved Permanently',
864
  500 => '500 Internal Server Error',
865
  503 => '503 Service Unavailable',
866
  ),
867
+ 'class' => $options['public']['matching_rule'] == -1 ? 'ip-geo-block-hide' :'',
868
  )
869
  );
870
 
871
  // Redirect URI
 
872
  add_settings_field(
873
+ $option_name.'_public_redirect_uri',
874
  __( '<dfn title="Specify the URL for response code 2xx and 3xx. If it is pointed to a public facing page, visitors would not be blocked on the page to prevent loop of redirection even when you enable [Block by country] in [Front-end target settings] section. Empty URL is altered to your home.">Redirect URL</dfn>', 'ip-geo-block' ),
875
  array( $context, 'callback_field' ),
876
  $option_slug,
878
  array(
879
  'type' => 'text',
880
  'option' => $option_name,
881
+ 'field' => 'public',
882
+ 'sub-field' => 'redirect_uri',
883
+ 'value' => $options['public']['redirect_uri' ],
884
+ 'class' => $options['public']['matching_rule'] != -1 && $options['public']['response_code'] < 400 ? '' : 'ip-geo-block-hide',
885
  'placeholder' => '/about/',
886
  )
887
  );
888
 
889
  // Response message
 
890
  add_settings_field(
891
+ $option_name.'_public_response_msg',
892
  __( '<dfn title="Specify the message for response code 4xx and 5xx.">Response message</dfn>', 'ip-geo-block' ),
893
  array( $context, 'callback_field' ),
894
  $option_slug,
896
  array(
897
  'type' => 'text',
898
  'option' => $option_name,
899
+ 'field' => 'public',
900
+ 'sub-field' => 'response_msg',
901
+ 'value' => $options['public']['response_msg' ],
902
+ 'class' => $options['public']['matching_rule'] != -1 && $options['public']['response_code'] >= 400 ? '' : 'ip-geo-block-hide',
903
  )
904
  );
905
 
906
  // List of page
907
+ $exception = '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual page as a blocking target.">Page</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $common[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n";
908
  $tmp = get_pages();
909
  if ( ! empty( $tmp ) ) {
910
  foreach ( $tmp as $key ) {
911
  $val = esc_attr( $key->post_name );
912
+ $exception .= '<li><input type="checkbox" id="ip_geo_block_settings_public_target_pages_' . $val . '" name="ip_geo_block_settings[public][target_pages][' . $val . ']" value="1"' . checked( isset( $options['public']['target_pages'][ $val ] ), TRUE, FALSE ) . ' />';
913
  $exception .= '<label for="ip_geo_block_settings_public_target_pages_' . $val . '">' . esc_html( $key->post_title ) . '</label></li>' . "\n";
914
  }
915
  }
916
  $exception .= '</ul></li></ul>' . "\n";
917
 
918
  // List of post type
919
+ $exception .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual post type on a single page as a blocking target.">Post type</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $common[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n";
920
  $tmp = get_post_types( array( 'public' => TRUE ) );
921
  if ( ! empty( $tmp ) ) {
922
  foreach ( $tmp as $key ) {
923
  $val = esc_attr( $key );
924
+ $exception .= '<li><input type="checkbox" id="ip_geo_block_settings_public_target_posts_' . $val . '" name="ip_geo_block_settings[public][target_posts][' . $val . ']" value="1"' . checked( isset( $options['public']['target_posts'][ $val ] ), TRUE, FALSE ) . ' />';
925
  $exception .= '<label for="ip_geo_block_settings_public_target_posts_' . $val . '">' . esc_html( $key ) . '</label></li>' . "\n";
926
  }
927
  }
928
  $exception .= '</ul></li></ul>' . "\n";
929
 
930
  // List of category
931
+ $exception .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual category on a single page or archive page as a blocking target.">Category</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $common[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n";
932
  $tmp = get_categories( array( 'hide_empty' => FALSE ) );
933
  if ( ! empty( $tmp ) ) {
934
  foreach ( $tmp as $key ) {
935
  $val = esc_attr( $key->slug );
936
+ $exception .= '<li><input type="checkbox" id="ip_geo_block_settings_public_target_cates_' . $val . '" name="ip_geo_block_settings[public][target_cates][' . $val . ']" value="1"' . checked( isset( $options['public']['target_cates'][ $val ] ), TRUE, FALSE ) . ' />';
937
  $exception .= '<label for="ip_geo_block_settings_public_target_cates_' . $val . '">' . esc_html( $key->name ) . '</label></li>' . "\n";
938
  }
939
  }
940
  $exception .= '</ul></li></ul>' . "\n";
941
 
942
  // List of tag
943
+ $exception .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the individual tag on a single page or archive page as a blocking target.">Tag</dfn>', 'ip-geo-block' ) . '<a class="ip-geo-block-icon ip-geo-block-icon-cycle ip-geo-block-hide">' . $common[2] . '</a>' . "\n<li class=\"ip-geo-block-hide\"><ul>\n";
944
  $tmp = get_tags( array( 'hide_empty' => FALSE ) );
945
  if ( ! empty( $tmp ) ) {
946
  foreach ( $tmp as $key ) {
947
  $val = esc_attr( $key->slug );
948
+ $exception .= '<li><input type="checkbox" id="ip_geo_block_settings_public_target_tags_' . $val . '" name="ip_geo_block_settings[public][target_tags][' . $val . ']" value="1"' . checked( isset( $options['public']['target_tags'][ $val ] ), TRUE, FALSE ) . ' />';
949
  $exception .= '<label for="ip_geo_block_settings_public_target_tags_' . $val . '">' . esc_html( $key->name ) . '</label></li>' . "\n";
950
  }
951
  }
952
  $exception .= '</ul></li></ul>' . "\n";
953
 
954
  // Validation target
 
955
  add_settings_field(
956
+ $option_name.'_public_target_rule',
957
  '<dfn title="' . __( 'Specify the validation target on front-end.', 'ip-geo-block' ) . '">' . __( 'Validation target', 'ip-geo-block' ) . '</dfn>',
958
  array( $context, 'callback_field' ),
959
  $option_slug,
961
  array(
962
  'type' => 'select',
963
  'option' => $option_name,
964
+ 'field' => 'public',
965
+ 'sub-field' => 'target_rule',
966
+ 'value' => $options['public']['target_rule'],
967
  'list' => array(
968
  0 => __( 'All requests', 'ip-geo-block' ),
969
  1 => __( 'Specify the targets', 'ip-geo-block' ),
975
  )
976
  );
977
 
978
+ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
979
+ // Excluded action
980
+ add_settings_field(
981
+ $option_name.'_exception_public',
982
+ '<dfn title="' . __( 'Specify the name of actions as exception that is invariably blocked.', 'ip-geo-block' ) . '">' . __( 'Excluded actions', 'ip-geo-block' ) . '</dfn>',
983
+ array( $context, 'callback_field' ),
984
+ $option_slug,
985
+ $section,
986
+ array(
987
+ 'type' => 'text',
988
+ 'option' => $option_name,
989
+ 'field' => 'exception',
990
+ 'sub-field' => 'public',
991
+ 'value' => implode( ',', $options['exception']['public'] ),
992
+ 'after' => $common[0],
993
+ )
994
+ );
995
+ endif;
996
+
997
  // Badly-behaved bots and crawlers
998
  $exception = '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the frequency of request for certain period of time.">Blocking condition</dfn>', 'ip-geo-block' ) . "\n<li class=\"ip-geo-block-hide\"><ul>\n<li>";
999
  $exception .= sprintf(
1000
  __( 'More than %1$s page view (PV) in %2$s seconds', 'ip-geo-block' ),
1001
+ '<input type="number" id="ip_geo_block_settings_behavior_view" name="ip_geo_block_settings[behavior][view]" class="regular-text code" value="' . (int)$options['behavior']['view'] . '" placeholder="7" min="1" max="99" maxlength="3" />',
1002
+ '<input type="number" id="ip_geo_block_settings_behavior_time" name="ip_geo_block_settings[behavior][time]" class="regular-text code" value="' . (int)$options['behavior']['time'] . '" placeholder="5" min="1" max="99" maxlength="3" /> '
1003
  );
1004
  $exception .= "</li>\n</ul></li></ul>\n";
1005
 
 
1006
  add_settings_field(
1007
+ $option_name.'_public_behavior',
1008
  __( '<dfn title="It will validate the frequency of request.">Block badly-behaved bots and crawlers</dfn>', 'ip-geo-block' ),
1009
  array( $context, 'callback_field' ),
1010
  $option_slug,
1012
  array(
1013
  'type' => 'checkbox',
1014
  'option' => $option_name,
1015
+ 'field' => 'public',
1016
+ 'sub-field' => 'behavior',
1017
+ 'value' => $options['public']['behavior'],
1018
  'after' => $exception,
1019
  )
1020
  );
1021
 
1022
  // UA string and qualification
 
1023
  add_settings_field(
1024
+ $option_name.'_public_ua_list',
1025
  '<dfn title="' . __( 'A part of user agent string and a qualification connected with a separator that indicates an applicable rule and can be &#8220;:&#8221; (pass) or &#8220;#&#8221; (block). A &#8220;qualification&#8221; can be &#8220;DNS&#8221;, &#8220;FEED&#8221;, country code or IP address with CIDR. A negative operator &#8220;!&#8221; can be placed just before a &#8220;qualification&#8221;.', 'ip-geo-block' ) . '">' . __( 'UA string and qualification', 'ip-geo-block' ) . '</dfn>',
1026
  array( $context, 'callback_field' ),
1027
  $option_slug,
1029
  array(
1030
  'type' => 'textarea',
1031
  'option' => $option_name,
1032
+ 'field' => 'public',
1033
+ 'sub-field' => 'ua_list',
1034
+ 'value' => $options['public']['ua_list'],
1035
+ 'after' => $common[1],
1036
  )
1037
  );
1038
 
1039
+ // Reverse DNS lookup
 
 
1040
  add_settings_field(
1041
+ $option_name.'_public_dnslkup',
1042
+ '<div class="ip-geo-block-subitem"><dfn title="' . __( 'It enables to verify the host by reverse DNS lookup which would spend some server resources. If it is disabled, &#8220;HOST&#8221; and &#8220;HOST=&hellip;&#8221;in &#8220;UA string and qualification&#8221; will always return &#8220;true&#8221;.', 'ip-geo-block' ) . '">' . __( 'Reverse DNS lookup', 'ip-geo-block' ) . '</dfn></div>',
1043
  array( $context, 'callback_field' ),
1044
  $option_slug,
1045
  $section,
1046
  array(
1047
+ 'type' => 'checkbox',
1048
  'option' => $option_name,
1049
+ 'field' => 'public',
1050
+ 'sub-field' => 'dnslkup',
1051
+ 'value' => $options['public']['dnslkup'],
1052
+ 'class' => 'ip-geo-block-subitem-parent',
1053
  )
1054
  );
 
1055
 
1056
+ // Simulation mode
 
1057
  add_settings_field(
1058
+ $option_name.'_public_simulate',
1059
+ '<dfn title="' . __( 'It enables to simulate validation without deployment. The results can be found as &#8220;public&#8221; in Logs.', 'ip-geo-block' ) . '">' . __( 'Simulation mode', 'ip-geo-block' ) . '</dfn>',
1060
  array( $context, 'callback_field' ),
1061
  $option_slug,
1062
  $section,
1063
  array(
1064
  'type' => 'checkbox',
1065
  'option' => $option_name,
1066
+ 'field' => 'public',
1067
+ 'sub-field' => 'simulate',
1068
+ 'value' => $options['public']['simulate'],
1069
  )
1070
  );
1071
 
1072
+ /*----------------------------------------*
1073
+ * Privacy and record settings
1074
+ *----------------------------------------*/
1075
+ add_settings_section(
1076
+ $section = $plugin_slug . '-recording',
1077
+ array( __( 'Privacy and record settings', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/privacy-and-record-settings.html" title="Privacy and record settings | IP Geo Block">' . $common[4] . '</a>' ),
1078
+ array( __CLASS__, 'note_privacy' ),
1079
+ $option_slug
1080
+ );
1081
+
1082
+ // Anonymize IP address
1083
  add_settings_field(
1084
+ $option_name.'_anonymize',
1085
+ __( '<dfn title="IP address is always encrypted on recording in Cache and Logs. Moreover, this option replaces the end of IP address with &#8220;***&#8221; to make it anonymous.">Anonymize IP address</dfn>', 'ip-geo-block' ),
1086
  array( $context, 'callback_field' ),
1087
  $option_slug,
1088
  $section,
1089
  array(
1090
  'type' => 'checkbox',
1091
  'option' => $option_name,
1092
+ 'field' => 'anonymize',
1093
+ 'value' => ! empty( $options['anonymize'] ),
 
1094
  )
1095
  );
1096
 
1097
+ // Do not send IP address to external APIs
1098
+ add_settings_field(
1099
+ $option_name.'_restrict_api',
1100
+ __( '<dfn title="This option restricts not to send IP address to the external Geolocation APIs.">Do not send IP address to external APIs</dfn>', 'ip-geo-block' ),
1101
+ array( $context, 'callback_field' ),
1102
+ $option_slug,
1103
+ $section,
1104
+ array(
1105
+ 'type' => 'checkbox',
1106
+ 'option' => $option_name,
1107
+ 'field' => 'restrict_api',
1108
+ 'value' => ! empty( $options['restrict_api'] ),
1109
+ )
1110
  );
1111
 
1112
+ // Record Statistics of validation
 
1113
  add_settings_field(
1114
+ $option_name.'_save_statistics',
1115
+ __( '<dfn title="This option enables to record the number blocked countries and the number of blocked requests per day.">Record &#8220;Statistics of validation&#8221;</dfn>', 'ip-geo-block' ),
1116
  array( $context, 'callback_field' ),
1117
  $option_slug,
1118
  $section,
1119
  array(
1120
  'type' => 'checkbox',
1121
  'option' => $option_name,
1122
+ 'field' => 'save_statistics',
1123
+ 'value' => $options['save_statistics'],
1124
+ )
1125
+ );
1126
+
1127
+ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1128
+ add_settings_field(
1129
+ $option_name.'_validation_recdays',
1130
+ '<div class="ip-geo-block-subitem">' . __( 'Maximum period for &#8220;Statistics&#8221; [days]', 'ip-geo-block' ) . '</div>',
1131
+ array( $context, 'callback_field' ),
1132
+ $option_slug,
1133
+ $section,
1134
+ array(
1135
+ 'type' => 'text',
1136
+ 'option' => $option_name,
1137
+ 'field' => 'validation',
1138
+ 'sub-field' => 'recdays',
1139
+ 'value' => $options['validation']['recdays'],
1140
+ 'class' => 'ip-geo-block-subitem-parent',
1141
  )
1142
  );
1143
+ endif;
1144
 
1145
  // Record IP address cache
 
1146
  add_settings_field(
1147
+ $option_name.'_cache_hold',
1148
  __( '<dfn title="This option enables to record the IP address, country code and failure counter of login attempts into the cache on database to minimize the impact on site speed.">Record &#8220;IP address cache&#8221;</dfn>', 'ip-geo-block' ),
1149
  array( $context, 'callback_field' ),
1150
  $option_slug,
1152
  array(
1153
  'type' => 'checkbox',
1154
  'option' => $option_name,
1155
+ 'field' => 'cache_hold',
1156
+ 'value' => $options['cache_hold'],
1157
  )
1158
  );
1159
 
1160
+ // Expiration time [sec] for each entry
 
1161
  add_settings_field(
1162
+ $option_name.'_cache_time',
1163
+ '<div class="ip-geo-block-subitem">' . __( '<dfn title="If user authentication fails consecutively beyond &#8220;Max number of failed login attempts per IP address&#8221;, subsequent login will also be prohibited for this period.">Expiration time [sec] for each entry</dfn>', 'ip-geo-block' ) . '</div>',
1164
  array( $context, 'callback_field' ),
1165
  $option_slug,
1166
  $section,
1167
  array(
1168
  'type' => 'text',
1169
  'option' => $option_name,
1170
+ 'field' => 'cache_time',
1171
+ 'value' => $options['cache_time'],
1172
+ 'class' => 'ip-geo-block-subitem-parent',
1173
  )
1174
  );
1175
 
1176
+ // Record Validation logs
 
1177
  add_settings_field(
1178
+ $option_name.'_validation_reclogs',
1179
+ __( '<dfn title="This option enables to record the validation logs including IP addresses.">Record &#8220;Validation logs&#8221;</dfn>', 'ip-geo-block' ),
1180
  array( $context, 'callback_field' ),
1181
  $option_slug,
1182
  $section,
1183
  array(
1184
  'type' => 'select',
1185
  'option' => $option_name,
1186
+ 'field' => 'validation',
1187
  'sub-field' => 'reclogs',
1188
+ 'value' => $options['validation']['reclogs'],
1189
  'list' => array(
1190
  0 => __( 'Disable', 'ip-geo-block' ),
1191
  1 => __( 'When blocked', 'ip-geo-block' ),
1198
  )
1199
  );
1200
 
1201
+ // Expiration time [days] for each entry
1202
  add_settings_field(
1203
+ $option_name.'_validation_explogs',
1204
+ '<div class="ip-geo-block-subitem">' . sprintf( __( '<dfn title="The maximum number of entries in the logs is also limited to %d.">Expiration time [days] for each entry</dfn>', 'ip-geo-block' ), $options['validation']['maxlogs'] ) . '</div>',
1205
  array( $context, 'callback_field' ),
1206
  $option_slug,
1207
  $section,
1208
  array(
1209
  'type' => 'text',
1210
  'option' => $option_name,
1211
+ 'field' => 'validation',
1212
+ 'sub-field' => 'explogs',
1213
+ 'value' => $options['validation']['explogs'],
1214
+ 'class' => 'ip-geo-block-subitem-parent',
1215
  )
1216
  );
1217
 
1218
+ // $_POST key to record with value
1219
  add_settings_field(
1220
+ $option_name.'_validation_postkey',
1221
+ '<div class="ip-geo-block-subitem">' . __( '<dfn title="e.g. action, comment, log, pwd, FILES">$_POST key to record with value</dfn>', 'ip-geo-block' ) . '</div>',
1222
  array( $context, 'callback_field' ),
1223
  $option_slug,
1224
  $section,
1225
  array(
1226
  'type' => 'text',
1227
  'option' => $option_name,
1228
+ 'field' => 'validation',
1229
+ 'sub-field' => 'postkey',
1230
+ 'value' => $options['validation']['postkey'],
1231
+ 'after' => $common[0],
1232
+ 'class' => 'ip-geo-block-subitem-parent',
1233
  )
1234
  );
1235
 
1236
  if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1237
+ // Maximum entries in Logs
 
1238
  add_settings_field(
1239
+ $option_name.'_validation_maxlogs',
1240
+ '<div class="ip-geo-block-subitem">' . __( 'Maximum entries in &#8220;Logs&#8221;', 'ip-geo-block' ) . '</div>',
1241
  array( $context, 'callback_field' ),
1242
  $option_slug,
1243
  $section,
1244
  array(
1245
  'type' => 'text',
1246
  'option' => $option_name,
1247
+ 'field' => 'validation',
1248
+ 'sub-field' => 'maxlogs',
1249
+ 'value' => $options['validation']['maxlogs'],
1250
+ 'class' => 'ip-geo-block-subitem-parent',
1251
  )
1252
  );
1253
 
1254
  // Live update
 
1255
  add_settings_field(
1256
+ $option_name.'_live_update',
1257
+ '<div class="ip-geo-block-subitem">' . __( '<dfn title="Select SQLite database source.">Database source of SQLite for &#8220;Live update&#8221;</dfn>', 'ip-geo-block' ) . '</div>',
1258
  array( $context, 'callback_field' ),
1259
  $option_slug,
1260
  $section,
1261
  array(
1262
  'type' => 'select',
1263
  'option' => $option_name,
1264
+ 'field' => 'live_update',
1265
  'sub-field' => 'in_memory',
1266
+ 'value' => extension_loaded( 'pdo_sqlite' ) ? $options['live_update']['in_memory'] : -1,
1267
+ 'class' => 'ip-geo-block-subitem-parent',
1268
  'list' => array(
1269
  -1 => NULL,
1270
  0 => __( 'Ordinary file', 'ip-geo-block' ),
1279
  );
1280
 
1281
  // Reset data source of live log
 
1282
  add_settings_field(
1283
+ $option_name.'_reset_live',
1284
+ '<div class="ip-geo-block-subitem">' . __( 'Reset database source of &#8220;Live update&#8221;', 'ip-geo-block' ) . '</div>',
1285
  array( $context, 'callback_field' ),
1286
  $option_slug,
1287
  $section,
1288
  array(
1289
  'type' => 'button',
1290
  'option' => $option_name,
1291
+ 'field' => 'reset_live',
1292
  'value' => __( 'Reset now', 'ip-geo-block' ),
1293
  'after' => '<div id="ip-geo-block-reset-live"></div>',
1294
+ 'class' => 'ip-geo-block-subitem-parent',
1295
  )
1296
  );
1297
  endif;
1300
  $tmp = wp_next_scheduled( IP_Geo_Block::CACHE_NAME );
1301
  $tmp = $tmp ? IP_Geo_Block_Util::localdate( $tmp ) : '<span class="ip-geo-block-warn">' . __( 'Task could not be found in WP-Cron. Please try to deactivate this plugin once and activate again.', 'ip-geo-block' ). '</span>';
1302
 
1303
+ // Interval [sec] to cleanup expired entries of IP address
 
1304
  add_settings_field(
1305
+ $option_name.'_cache_time_gc',
1306
+ __( '<dfn title="This option enables to schedule the WP-Cron event to remove the expired entries in &#8220;IP address cache&#8221; and &#8220;Logs&#8221;.">Interval [sec] to cleanup expired entries of IP address</dfn>', 'ip-geo-block' ),
1307
  array( $context, 'callback_field' ),
1308
  $option_slug,
1309
  $section,
1310
  array(
1311
  'type' => 'text',
1312
  'option' => $option_name,
1313
+ 'field' => 'cache_time_gc',
1314
+ 'value' => $options['cache_time_gc'],
1315
  'after' => '<p class="ip-geo-block-desc">' . sprintf( __( 'Next schedule: %s', 'ip-geo-block'), $tmp ) . '</p>',
1316
  )
1317
  );
1318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1319
  // Remove all settings and records at uninstallation
 
1320
  add_settings_field(
1321
+ $option_name.'_clean_uninstall',
1322
  __( 'Remove all settings and records at uninstallation', 'ip-geo-block' ),
1323
  array( $context, 'callback_field' ),
1324
  $option_slug,
1326
  array(
1327
  'type' => 'checkbox',
1328
  'option' => $option_name,
1329
+ 'field' => 'clean_uninstall',
1330
+ 'value' => $options['clean_uninstall'],
1331
  )
1332
  );
1333
 
1336
  *----------------------------------------*/
1337
  add_settings_section(
1338
  $section = $plugin_slug . '-provider',
1339
+ array( __( 'Geolocation API settings', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/geolocation-api-settings.html" title="Geolocation API settings | IP Geo Block">' . $common[4] . '</a>' ),
1340
  array( __CLASS__, 'note_services' ),
1341
  $option_slug
1342
  );
1345
  $provider = IP_Geo_Block_Provider::get_providers( 'key' ); // all available providers
1346
  $providers = IP_Geo_Block_Provider::get_addons( $options['providers'] ); // only local
1347
 
1348
+ // Disable 3rd parties API
1349
+ if ( ! empty( $options['restrict_api'] ) ) {
1350
  foreach ( array_keys( $provider ) as $key ) {
1351
  if ( ! in_array( $key, $providers, TRUE ) )
1352
  $provider[ $key ] = is_string( $provider[ $key ] ) ? '-1' : -1;
1354
  }
1355
 
1356
  // API selection and key settings
 
1357
  add_settings_field(
1358
+ $option_name.'_providers',
1359
+ __( '<dfn title="IP address cache and local databases are scanned at the top priority.">API selection and key settings</dfn>', 'ip-geo-block' ),
1360
  array( $context, 'callback_field' ),
1361
  $option_slug,
1362
  $section,
1363
  array(
1364
  'type' => 'check-provider',
1365
  'option' => $option_name,
1366
+ 'field' => 'providers',
1367
+ 'value' => $options['providers'],
1368
  'local' => $providers,
1369
  'providers' => $provider,
1370
  'titles' => IP_Geo_Block_Provider::get_providers( 'type' ),
1373
 
1374
  if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1375
  // Timeout for network API
 
1376
  add_settings_field(
1377
+ $option_name.'_timeout',
1378
  __( 'Timeout for network API [sec]', 'ip-geo-block' ),
1379
  array( $context, 'callback_field' ),
1380
  $option_slug,
1382
  array(
1383
  'type' => 'text',
1384
  'option' => $option_name,
1385
+ 'field' => 'timeout',
1386
+ 'value' => $options['timeout'],
1387
  )
1388
  );
1389
  endif;
1393
  *----------------------------------------*/
1394
  if ( empty( $providers ) ) {
1395
  $context->add_admin_notice( 'error', sprintf(
1396
+ __( 'Can not find Geolocation API libraries in <code>%s</code>. It seems to have failed downloading <a rel="noreferrer" href="https://github.com/tokkonopapa/WordPress-IP-Geo-API/archive/master.zip" title="Download the contents of tokkonopapa/WordPress-IP-Geo-API as a zip file">ZIP file</a> from <a rel="noreferrer" href="https://github.com/tokkonopapa/WordPress-IP-Geo-API" title="tokkonopapa/WordPress-IP-Geo-API - GitHub">WordPress-IP-Geo-API</a>. Please install <code>ip-geo-api</code> with write permission according to <a rel="noreferrer" href="https://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How can I fix permission troubles? | IP Geo Block">this instruction</a>.', 'ip-geo-block' ),
1397
  apply_filters( 'ip-geo-block-api-dir', basename( WP_CONTENT_DIR ) )
1398
  ) );
1399
  }
1400
 
1401
  add_settings_section(
1402
  $section = $plugin_slug . '-database',
1403
+ array( __( 'Local database settings', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/geolocation-api-library.html" title="Geolocation API library | IP Geo Block">' . $common[4] . '</a>' ),
1404
  array( __CLASS__, 'note_database' ),
1405
  $option_slug
1406
  );
1435
  $tmp = $tmp ? IP_Geo_Block_Util::localdate( $tmp ) : '<span class="ip-geo-block-warn">' . __( 'Task could not be found in WP-Cron. Please try to deactivate this plugin once and activate again.', 'ip-geo-block' ). '</span>';
1436
 
1437
  // Auto updating (once a month)
 
1438
  add_settings_field(
1439
+ $option_name.'_update_auto',
1440
  __( 'Auto updating (once a month)', 'ip-geo-block' ),
1441
  array( $context, 'callback_field' ),
1442
  $option_slug,
1444
  array(
1445
  'type' => 'checkbox',
1446
  'option' => $option_name,
1447
+ 'field' => 'update',
1448
  'sub-field' => 'auto',
1449
+ 'value' => $options['update']['auto'],
1450
  'disabled' => empty( $providers ),
1451
+ 'after' => $options['update']['auto'] ? '<p class="ip-geo-block-desc">' . sprintf( __( 'Next schedule: %s', 'ip-geo-block'), $tmp ) . '</p>' : '',
1452
  )
1453
  );
1454
 
1455
  // Download database
1456
  add_settings_field(
1457
+ $option_name.'_update_download',
1458
  __( 'Download database', 'ip-geo-block' ),
1459
  array( $context, 'callback_field' ),
1460
  $option_slug,
1462
  array(
1463
  'type' => 'button',
1464
  'option' => $option_name,
1465
+ 'field' => 'update',
1466
  'value' => __( 'Download now', 'ip-geo-block' ),
1467
  'disabled' => empty( $providers ),
1468
  'after' => '<div id="ip-geo-block-download"></div>',
1469
  )
1470
  );
1471
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1472
  /*----------------------------------------*
1473
  * Plugin settings
1474
  *----------------------------------------*/
1475
  add_settings_section(
1476
  $section = $plugin_slug . '-others',
1477
+ array( __( 'Plugin settings', 'ip-geo-block' ), '<a href="https://www.ipgeoblock.com/codex/plugin-settings.html" title="Plugin settings | IP Geo Block">' . $common[4] . '</a>' ),
1478
  NULL,
1479
  $option_slug
1480
  );
1484
  add_action( 'network_admin_edit_' . IP_Geo_Block::PLUGIN_NAME, array( $context, 'validate_network_settings' ) );
1485
 
1486
  // Network wide configuration
 
1487
  add_settings_field(
1488
+ $option_name.'_network_wide',
1489
  __( '<dfn title="Synchronize all settings over the network wide.">Network wide settings</dfn>', 'ip-geo-block' ),
1490
  array( $context, 'callback_field' ),
1491
  $option_slug,
1493
  array(
1494
  'type' => 'checkbox',
1495
  'option' => $option_name,
1496
+ 'field' => 'network_wide',
1497
+ 'value' => $options['network_wide'],
1498
  'disabled' => ! current_user_can( 'manage_network_options' ),
1499
  )
1500
  );
1501
  }
1502
  endif;
1503
+ // Emergency login link
1504
+ $key = IP_Geo_Block_Util::get_link();
1505
+ add_settings_field(
1506
+ $option_name.'_login_link',
1507
+ __( '<dfn title="You can access to the login form with a specific key at emergency. Please add the generated link to favorites / bookmarks in your browser as this plugin does not keep the key itself.">Emergency login link</dfn>', 'ip-geo-block' ),
1508
+ array( $context, 'callback_field' ),
1509
+ $option_slug,
1510
+ $section,
1511
+ array(
1512
+ 'type' => 'none',
1513
+ 'before' => empty( $key ) ?
1514
+ '<a class="button-secondary ip-geo-block-primary" id="ip-geo-block-login-link" href="#!">'. __( 'Generate new link', 'ip-geo-block' ) . '</a>&nbsp;' :
1515
+ '<a class="button-secondary' .'" id="ip-geo-block-login-link" href="#!">'. __( 'Delete current link', 'ip-geo-block' ) . '</a>&nbsp;',
1516
+ 'after' => '<div id="ip-geo-block-login-loading"></div>',
1517
+ )
1518
+ );
1519
+
1520
  // Google Maps API key
1521
+ if ( 'default' !== $options['api_key']['GoogleMap'] or defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ) {
 
 
1522
  add_settings_field(
1523
+ $option_name.'_api_key',
1524
  __( '<dfn title="Valid key for Google Maps JavaScript API">Google Maps API key</dfn>', 'ip-geo-block' ),
1525
  array( $context, 'callback_field' ),
1526
  $option_slug,
1528
  array(
1529
  'type' => 'text',
1530
  'option' => $option_name,
1531
+ 'field' => 'api_key',
1532
+ 'sub-field' => 'GoogleMap',
1533
+ 'value' => $options['api_key']['GoogleMap'],
1534
  )
1535
  );
1536
  }
1537
 
 
 
1538
  // Export / Import settings
 
1539
  add_settings_field(
1540
+ $option_name.'_export-import',
1541
+ sprintf( '<dfn title="%s">' . __( 'Export / Import settings', 'ip-geo-block' ) . '</dfn>', $desc[4] ),
1542
  array( $context, 'callback_field' ),
1543
  $option_slug,
1544
  $section,
1545
  array(
1546
  'type' => 'none',
1547
  'before' =>
1548
+ '<a class="button-secondary" id="ip-geo-block-export" title="' . __( 'Export to the local file', 'ip-geo-block' ) . '" href="#!">'. __( 'Export settings', 'ip-geo-block' ) . '</a>&nbsp;' .
1549
+ '<a class="button-secondary" id="ip-geo-block-import" title="' . __( 'Import from the local file', 'ip-geo-block' ) . '" href="#!">'. __( 'Import settings', 'ip-geo-block' ) . '</a>',
1550
  'after' => '<div id="ip-geo-block-export-import"></div>',
1551
  )
1552
  );
1553
 
1554
  // Pre-defined settings
 
1555
  add_settings_field(
1556
+ $option_name.'_pre-defined',
1557
+ sprintf( '<dfn title="%s">' . __( 'Import pre-defined settings', 'ip-geo-block' ) . '</dfn>', $desc[4] ),
1558
  array( $context, 'callback_field' ),
1559
  $option_slug,
1560
  $section,
1561
  array(
1562
  'type' => 'none',
1563
  'before' =>
1564
+ '<a class="button-secondary"' .' id="ip-geo-block-default" title="' . __( 'Import the default settings to revert to the &#8220;Right after installing&#8221; state', 'ip-geo-block' ) . '" href="#!">' . __( 'Default settings', 'ip-geo-block' ) . '</a>&nbsp;' .
1565
+ '<a class="button-secondary ip-geo-block-primary" id="ip-geo-block-preferred" title="' . __( 'Import the preferred settings mainly by enabling Zero-day Exploit Prevention for the &#8220;Back-end target settings&#8221;', 'ip-geo-block' ) . '" href="#!">' . __( 'Best for Back-end', 'ip-geo-block' ) . '</a>',
1566
  'after' => '<div id="ip-geo-block-pre-defined"></div>',
1567
  )
1568
  );
1569
 
1570
  if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1571
+ // DB tables for this plugin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1572
  add_settings_field(
1573
+ $option_name.'_init_table',
1574
+ __( 'DB tables for this plugin', 'ip-geo-block' ),
1575
  array( $context, 'callback_field' ),
1576
  $option_slug,
1577
  $section,
1578
  array(
1579
  'type' => 'button',
1580
  'option' => $option_name,
1581
+ 'field' => 'init_table',
1582
+ 'value' => __( 'Initialize now', 'ip-geo-block' ),
1583
+ 'after' => '<div id="ip-geo-block-init-table"></div>',
1584
  )
1585
  );
1586
  endif;
1587
 
1588
  // Diagnostic information
 
1589
  add_settings_field(
1590
+ $option_name.'_show-info',
1591
+ __( '<dfn title="When you have some unexpected blocking experiences, please press the button to find the blocked requests at the end of dumped information which may help you to solve the issues.">Diagnostic information</dfn><br />[ <a rel="noreferrer" href="https://wordpress.org/support/plugin/ip-geo-block" title="[IP Geo Block] Support | WordPress.org">support forum</a> ]', 'ip-geo-block' ),
1592
  array( $context, 'callback_field' ),
1593
  $option_slug,
1594
  $section,
1595
  array(
1596
  'type' => 'none',
1597
  'before' =>
1598
+ '<a class="button-secondary" id="ip-geo-block-show-info" title="' . __( 'Please copy &amp; paste when submitting your issue to support forum', 'ip-geo-block' ) . '" href="#!">' . __( 'Show information', 'ip-geo-block' ) . '</a>&nbsp;',
1599
  'after' => '<div id="ip-geo-block-wp-info"></div>',
1600
  )
1601
  );
1611
  public static function note_target() {
1612
  echo
1613
  '<ul class="ip-geo-block-note">', "\n",
1614
+ '<li>', __( 'To enhance the protection ability, please refer to &#8220;<a rel="noreferrer" href="https://www.ipgeoblock.com/codex/the-best-practice-for-target-settings.html" title="The best practice for target settings | IP Geo Block">The best practice for target settings</a>&#8221;.', 'ip-geo-block' ), '</li>', "\n",
1615
+ '<li>', __( 'If you have any troubles with these, please check FAQ at <a rel="noreferrer" href="https://wordpress.org/plugins/ip-geo-block/faq/" title="IP Geo Block &mdash; WordPress Plugins">WordPress.org</a> and <a rel="noreferrer" href="https://www.ipgeoblock.com/codex/#faq" title="Codex | IP Geo Block">Codex</a>.', 'ip-geo-block' ), '</li>', "\n",
1616
  '</ul>', "\n";
1617
  }
1618
 
1619
  public static function note_services() {
1620
  echo
1621
  '<ul class="ip-geo-block-note">', "\n",
1622
+ '<li>', __( 'While Geolite2 / Maxmind and IP2Location will fetch the local databases, others will pass an IP address to the 3rd parties\' API via HTTP.', 'ip-geo-block' ), '</li>', "\n",
1623
+ '<li>', __( 'Please select the appropriate APIs to fit the privacy law / regulation in your country / region.', 'ip-geo-block' ), '</li>', "\n",
1624
  '</ul>', "\n";
1625
  }
1626
 
1637
  public static function note_public() {
1638
  echo
1639
  '<ul class="ip-geo-block-note">', "\n",
1640
+ '<li>', __( 'Please refer to the document &#8220;<a rel="noreferrer" href="https://www.ipgeoblock.com/codex/#blocking-on-front-end" title="Codex | IP Geo Block">Blocking on front-end</a>&#8221; for details, including restrictions on cache plugin.', 'ip-geo-block' ), '</li>', "\n",
1641
+ '<li>', __( 'If you find any issues or have something to suggest, please feel free to open an issue at <a rel="noreferrer" href="https://wordpress.org/support/plugin/ip-geo-block" title="[IP Geo Block] Support | WordPress.org">support forum</a>.', 'ip-geo-block' ), '</li>', "\n",
1642
  '</ul>', "\n";
1643
  }
1644
 
1645
+ public static function note_privacy() {
1646
  echo
1647
  '<ul class="ip-geo-block-note">', "\n",
1648
+ '<li>', __( 'Please refer to the document &#8220;<a rel="noreferrer" href="https://www.ipgeoblock.com/codex/record-settings-and-logs.html" title="Codex | IP Geo Block">Record settings and logs</a>&#8221; for details.', 'ip-geo-block' ), '</li>', "\n",
1649
  '</ul>', "\n";
1650
  }
1651
 
admin/includes/tab-statistics.php CHANGED
@@ -27,9 +27,8 @@ class IP_Geo_Block_Admin_Tab {
27
  if ( $options['save_statistics'] ) :
28
 
29
  // Number of blocked access
30
- $field = 'blocked';
31
  add_settings_field(
32
- $option_name.'_'.$field,
33
  __( 'Blocked', 'ip-geo-block' ),
34
  array( $context, 'callback_field' ),
35
  $option_slug,
@@ -37,8 +36,8 @@ if ( $options['save_statistics'] ) :
37
  array(
38
  'type' => 'html',
39
  'option' => $option_name,
40
- 'field' => $field,
41
- 'value' => (int)$statistics[ $field ],
42
  )
43
  );
44
 
@@ -52,9 +51,8 @@ if ( $options['save_statistics'] ) :
52
 
53
  $html = '<div id="' . $plugin_slug . '-chart-countries" data-' . $plugin_slug . '-chart-countries=\'' . json_encode( $count ) . '\'></div>';
54
 
55
- $field = 'countries';
56
  add_settings_field(
57
- $option_name.'_'.$field,
58
  __( 'Blocked by countries', 'ip-geo-block' ),
59
  array( $context, 'callback_field' ),
60
  $option_slug,
@@ -62,7 +60,7 @@ if ( $options['save_statistics'] ) :
62
  array(
63
  'type' => 'html',
64
  'option' => $option_name,
65
- 'field' => $field,
66
  'value' => $html,
67
  )
68
  );
@@ -93,9 +91,8 @@ if ( $options['save_statistics'] ) :
93
  // embed array into data attribute as json
94
  $html = '<div id="' . $plugin_slug . '-chart-daily" data-' . $plugin_slug . '-chart-daily=\'' . json_encode( $count ) . '\'></div>';
95
 
96
- $field = 'daily';
97
  add_settings_field(
98
- $option_name.'_'.$field,
99
  __( 'Blocked per day', 'ip-geo-block' ),
100
  array( $context, 'callback_field' ),
101
  $option_slug,
@@ -103,15 +100,14 @@ if ( $options['save_statistics'] ) :
103
  array(
104
  'type' => 'html',
105
  'option' => $option_name,
106
- 'field' => $field,
107
  'value' => $html,
108
  )
109
  );
110
 
111
  // Blocked by type of IP address
112
- $field = 'type';
113
  add_settings_field(
114
- $option_name.'_'.$field,
115
  __( 'Blocked by type of IP address', 'ip-geo-block' ),
116
  array( $context, 'callback_field' ),
117
  $option_slug,
@@ -119,7 +115,7 @@ if ( $options['save_statistics'] ) :
119
  array(
120
  'type' => 'html',
121
  'option' => $option_name,
122
- 'field' => $field,
123
  'value' => '<table class="'.$option_slug.'-statistics-table">' .
124
  '<thead><tr><th>IPv4</th><th>IPv6</th></tr></thead><tbody><tr>' .
125
  '<td>' . esc_html( $statistics['IPv4'] ) . '</td>' .
@@ -128,7 +124,6 @@ if ( $options['save_statistics'] ) :
128
  )
129
  );
130
 
131
- $field = 'service';
132
  $html = '<table class="'.$option_slug.'-statistics-table"><thead><tr>';
133
  $html .= '<th>' . __( 'Name of API', 'ip-geo-block' ) . '</th>';
134
  $html .= '<th>' . __( 'Call', 'ip-geo-block' ) . '</th>';
@@ -145,7 +140,7 @@ if ( $options['save_statistics'] ) :
145
 
146
  // Average response time of each API
147
  add_settings_field(
148
- $option_name.'_'.$field,
149
  __( 'Average response time of each API', 'ip-geo-block' ),
150
  array( $context, 'callback_field' ),
151
  $option_slug,
@@ -153,15 +148,14 @@ if ( $options['save_statistics'] ) :
153
  array(
154
  'type' => 'html',
155
  'option' => $option_name,
156
- 'field' => $field,
157
  'value' => $html,
158
  )
159
  );
160
 
161
  // Clear statistics
162
- $field = 'clear_statistics';
163
  add_settings_field(
164
- $option_name.'_'.$field,
165
  __( 'Clear statistics', 'ip-geo-block' ),
166
  array( $context, 'callback_field' ),
167
  $option_slug,
@@ -169,7 +163,7 @@ if ( $options['save_statistics'] ) :
169
  array(
170
  'type' => 'button',
171
  'option' => $option_name,
172
- 'field' => $field,
173
  'value' => __( 'Clear all', 'ip-geo-block' ),
174
  'after' => '<div id="'.$plugin_slug.'-statistics"></div>',
175
  )
@@ -178,11 +172,11 @@ if ( $options['save_statistics'] ) :
178
  endif;
179
 
180
  /*----------------------------------------*
181
- * Statistics in logs
182
  *----------------------------------------*/
183
  add_settings_section(
184
  $section = $plugin_slug . '-stat-logs',
185
- __( 'Statistics in Logs', 'ip-geo-block' ),
186
  ( $options['validation']['reclogs'] ?
187
  array( __CLASS__, 'statistics_logs' ) :
188
  array( __CLASS__, 'warn_validation' )
@@ -192,9 +186,8 @@ endif;
192
 
193
  if ( $options['validation']['reclogs'] ) :
194
 
195
- $field = 'clear_logs';
196
  add_settings_field(
197
- $option_name.'_'.$field,
198
  __( 'Clear logs', 'ip-geo-block' ),
199
  array( $context, 'callback_field' ),
200
  $option_slug,
@@ -202,7 +195,7 @@ if ( $options['validation']['reclogs'] ) :
202
  array(
203
  'type' => 'button',
204
  'option' => $option_name,
205
- 'field' => $field,
206
  'value' => __( 'Clear all', 'ip-geo-block' ),
207
  )
208
  );
@@ -210,7 +203,7 @@ if ( $options['validation']['reclogs'] ) :
210
  endif;
211
 
212
  /*----------------------------------------*
213
- * IP address in cache
214
  *----------------------------------------*/
215
  add_settings_section(
216
  $section = $plugin_slug . '-cache',
@@ -224,9 +217,8 @@ endif;
224
 
225
  if ( $options['cache_hold'] ) :
226
 
227
- $field = 'search_filter';
228
  add_settings_field(
229
- $option_name.'_'.$field,
230
  __( 'Search in cache', 'ip-geo-block' ),
231
  array( $context, 'callback_field' ),
232
  $option_slug,
@@ -234,16 +226,15 @@ if ( $options['cache_hold'] ) :
234
  array(
235
  'type' => 'text',
236
  'option' => $option_name,
237
- 'field' => $field,
238
  'value' => '',
239
  'after' => '<a class="button button-secondary" id="ip-geo-block-reset-filter" title="'
240
  . __( 'Reset', 'ip-geo-block' ) . '" href="#!">'. __( 'Reset', 'ip-geo-block' ) . '</a>',
241
  )
242
  );
243
 
244
- $field = 'bulk_action';
245
  add_settings_field(
246
- $option_name.'_'.$field,
247
  __( 'Bulk action', 'ip-geo-block' ),
248
  array( $context, 'callback_field' ),
249
  $option_slug,
@@ -251,7 +242,7 @@ if ( $options['cache_hold'] ) :
251
  array(
252
  'type' => 'select',
253
  'option' => $option_name,
254
- 'field' => $field,
255
  'value' => 0,
256
  'list' => array(
257
  0 => NULL,
@@ -265,9 +256,8 @@ if ( $options['cache_hold'] ) :
265
  )
266
  );
267
 
268
- $field = 'clear_all';
269
  add_settings_field(
270
- $option_name.'_'.$field,
271
  __( 'Clear cache', 'ip-geo-block' ),
272
  array( $context, 'callback_field' ),
273
  $option_slug,
@@ -275,16 +265,15 @@ if ( $options['cache_hold'] ) :
275
  array(
276
  'type' => 'button',
277
  'option' => $option_name,
278
- 'field' => $field,
279
  'value' => __( 'Clear all', 'ip-geo-block' ),
280
  'after' => '<div id="'.$plugin_slug.'-cache"></div>',
281
  )
282
  );
283
 
284
  // Export cache
285
- $field = 'export_cache';
286
  add_settings_field(
287
- $option_name.'_'.$field,
288
  __( 'Export cache', 'ip-geo-block' ),
289
  array( $context, 'callback_field' ),
290
  $option_slug,
@@ -378,7 +367,7 @@ endif;
378
  $key = esc_html( $key );
379
 
380
  if ( 'ip' === $slug && $options['anonymize'] )
381
- $link = $key = preg_replace( '/\d{1,3}$/', '***', $link );
382
 
383
  echo '<li><code>';
384
  echo str_replace(
@@ -404,7 +393,7 @@ endif;
404
  *
405
  */
406
  public static function statistics_cache() {
407
- echo '<table id="', IP_Geo_Block::PLUGIN_NAME, '-statistics-cache" class="dataTable display" cellspacing="0" width="100%">', "\n", '<thead></thead><tbody></tbody></table>', "\n";
408
  }
409
 
410
  /**
@@ -414,14 +403,14 @@ endif;
414
  public static function warn_statistics() {
415
  $context = IP_Geo_Block_Admin::get_instance();
416
  $url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
417
- echo '<p>', sprintf( __( '[ %sRecord &#8220;Statistics&#8221;%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
418
  echo '<p>', __( 'Please set the proper condition to record and analyze the validation statistics.', 'ip-geo-block' ), '</p>', "\n";
419
  }
420
 
421
  public static function warn_validation() {
422
  $context = IP_Geo_Block_Admin::get_instance();
423
  $url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
424
- echo '<p>', sprintf( __( '[ %sRecord &#8220;Logs&#8221;%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
425
  echo '<p>', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
426
  }
427
 
27
  if ( $options['save_statistics'] ) :
28
 
29
  // Number of blocked access
 
30
  add_settings_field(
31
+ $option_name.'_blocked',
32
  __( 'Blocked', 'ip-geo-block' ),
33
  array( $context, 'callback_field' ),
34
  $option_slug,
36
  array(
37
  'type' => 'html',
38
  'option' => $option_name,
39
+ 'field' => 'blocked',
40
+ 'value' => (int)$statistics['blocked'],
41
  )
42
  );
43
 
51
 
52
  $html = '<div id="' . $plugin_slug . '-chart-countries" data-' . $plugin_slug . '-chart-countries=\'' . json_encode( $count ) . '\'></div>';
53
 
 
54
  add_settings_field(
55
+ $option_name.'_countries',
56
  __( 'Blocked by countries', 'ip-geo-block' ),
57
  array( $context, 'callback_field' ),
58
  $option_slug,
60
  array(
61
  'type' => 'html',
62
  'option' => $option_name,
63
+ 'field' => 'countries',
64
  'value' => $html,
65
  )
66
  );
91
  // embed array into data attribute as json
92
  $html = '<div id="' . $plugin_slug . '-chart-daily" data-' . $plugin_slug . '-chart-daily=\'' . json_encode( $count ) . '\'></div>';
93
 
 
94
  add_settings_field(
95
+ $option_name.'_daily',
96
  __( 'Blocked per day', 'ip-geo-block' ),
97
  array( $context, 'callback_field' ),
98
  $option_slug,
100
  array(
101
  'type' => 'html',
102
  'option' => $option_name,
103
+ 'field' => 'daily',
104
  'value' => $html,
105
  )
106
  );
107
 
108
  // Blocked by type of IP address
 
109
  add_settings_field(
110
+ $option_name.'_type',
111
  __( 'Blocked by type of IP address', 'ip-geo-block' ),
112
  array( $context, 'callback_field' ),
113
  $option_slug,
115
  array(
116
  'type' => 'html',
117
  'option' => $option_name,
118
+ 'field' => 'type',
119
  'value' => '<table class="'.$option_slug.'-statistics-table">' .
120
  '<thead><tr><th>IPv4</th><th>IPv6</th></tr></thead><tbody><tr>' .
121
  '<td>' . esc_html( $statistics['IPv4'] ) . '</td>' .
124
  )
125
  );
126
 
 
127
  $html = '<table class="'.$option_slug.'-statistics-table"><thead><tr>';
128
  $html .= '<th>' . __( 'Name of API', 'ip-geo-block' ) . '</th>';
129
  $html .= '<th>' . __( 'Call', 'ip-geo-block' ) . '</th>';
140
 
141
  // Average response time of each API
142
  add_settings_field(
143
+ $option_name.'_service',
144
  __( 'Average response time of each API', 'ip-geo-block' ),
145
  array( $context, 'callback_field' ),
146
  $option_slug,
148
  array(
149
  'type' => 'html',
150
  'option' => $option_name,
151
+ 'field' => 'service',
152
  'value' => $html,
153
  )
154
  );
155
 
156
  // Clear statistics
 
157
  add_settings_field(
158
+ $option_name.'_clear_statistics',
159
  __( 'Clear statistics', 'ip-geo-block' ),
160
  array( $context, 'callback_field' ),
161
  $option_slug,
163
  array(
164
  'type' => 'button',
165
  'option' => $option_name,
166
+ 'field' => 'clear_statistics',
167
  'value' => __( 'Clear all', 'ip-geo-block' ),
168
  'after' => '<div id="'.$plugin_slug.'-statistics"></div>',
169
  )
172
  endif;
173
 
174
  /*----------------------------------------*
175
+ * Statistics in Validation logs
176
  *----------------------------------------*/
177
  add_settings_section(
178
  $section = $plugin_slug . '-stat-logs',
179
+ __( 'Statistics in validation logs', 'ip-geo-block' ),
180
  ( $options['validation']['reclogs'] ?
181
  array( __CLASS__, 'statistics_logs' ) :
182
  array( __CLASS__, 'warn_validation' )
186
 
187
  if ( $options['validation']['reclogs'] ) :
188
 
 
189
  add_settings_field(
190
+ $option_name.'_clear_logs',
191
  __( 'Clear logs', 'ip-geo-block' ),
192
  array( $context, 'callback_field' ),
193
  $option_slug,
195
  array(
196
  'type' => 'button',
197
  'option' => $option_name,
198
+ 'field' => 'clear_logs',
199
  'value' => __( 'Clear all', 'ip-geo-block' ),
200
  )
201
  );
203
  endif;
204
 
205
  /*----------------------------------------*
206
+ * Statistics in IP address cache
207
  *----------------------------------------*/
208
  add_settings_section(
209
  $section = $plugin_slug . '-cache',
217
 
218
  if ( $options['cache_hold'] ) :
219
 
 
220
  add_settings_field(
221
+ $option_name.'_search_filter',
222
  __( 'Search in cache', 'ip-geo-block' ),
223
  array( $context, 'callback_field' ),
224
  $option_slug,
226
  array(
227
  'type' => 'text',
228
  'option' => $option_name,
229
+ 'field' => 'search_filter',
230
  'value' => '',
231
  'after' => '<a class="button button-secondary" id="ip-geo-block-reset-filter" title="'
232
  . __( 'Reset', 'ip-geo-block' ) . '" href="#!">'. __( 'Reset', 'ip-geo-block' ) . '</a>',
233
  )
234
  );
235
 
 
236
  add_settings_field(
237
+ $option_name.'_bulk_action',
238
  __( 'Bulk action', 'ip-geo-block' ),
239
  array( $context, 'callback_field' ),
240
  $option_slug,
242
  array(
243
  'type' => 'select',
244
  'option' => $option_name,
245
+ 'field' => 'bulk_action',
246
  'value' => 0,
247
  'list' => array(
248
  0 => NULL,
256
  )
257
  );
258
 
 
259
  add_settings_field(
260
+ $option_name.'_clear_all',
261
  __( 'Clear cache', 'ip-geo-block' ),
262
  array( $context, 'callback_field' ),
263
  $option_slug,
265
  array(
266
  'type' => 'button',
267
  'option' => $option_name,
268
+ 'field' => 'clear_all',
269
  'value' => __( 'Clear all', 'ip-geo-block' ),
270
  'after' => '<div id="'.$plugin_slug.'-cache"></div>',
271
  )
272
  );
273
 
274
  // Export cache
 
275
  add_settings_field(
276
+ $option_name.'_export_cache',
277
  __( 'Export cache', 'ip-geo-block' ),
278
  array( $context, 'callback_field' ),
279
  $option_slug,
367
  $key = esc_html( $key );
368
 
369
  if ( 'ip' === $slug && $options['anonymize'] )
370
+ $link = $key = IP_Geo_Block_Util::anonymize_ip( $link );
371
 
372
  echo '<li><code>';
373
  echo str_replace(
393
  *
394
  */
395
  public static function statistics_cache() {
396
+ echo '<table id="', IP_Geo_Block::PLUGIN_NAME, '-statistics-cache" class="', IP_Geo_Block::PLUGIN_NAME, '-dataTable display" cellspacing="0" width="100%">', "\n", '<thead></thead><tbody></tbody></table>', "\n";
397
  }
398
 
399
  /**
403
  public static function warn_statistics() {
404
  $context = IP_Geo_Block_Admin::get_instance();
405
  $url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
406
+ echo '<p>', sprintf( __( '[ %sRecord &#8220;Statistics of validation&#8221;%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
407
  echo '<p>', __( 'Please set the proper condition to record and analyze the validation statistics.', 'ip-geo-block' ), '</p>', "\n";
408
  }
409
 
410
  public static function warn_validation() {
411
  $context = IP_Geo_Block_Admin::get_instance();
412
  $url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 3 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-3' );
413
+ echo '<p>', sprintf( __( '[ %sRecord &#8220;Validation logs&#8221;%s ] is disabled.', 'ip-geo-block' ), '<a href="' . $url . '">', '</a>' ), '</p>', "\n";
414
  echo '<p>', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
415
  }
416
 
admin/js/admin.js CHANGED
@@ -79,11 +79,11 @@
79
  }
80
 
81
  function warning(status, msg, cmd) {
82
- window.alert(stripTag(msg || ip_geo_block.msg[12].replace('%s', cmd) + ' (' + status + ')'));
83
  }
84
 
85
  function notice_html5() {
86
- warning(null, stripTag(ip_geo_block.msg[10]));
87
  }
88
 
89
  function redirect(page, tab) {
@@ -175,8 +175,9 @@
175
 
176
  // Show/Hide descendant elements
177
  function show_descendants($this, $elem, mask) {
178
- var stat = (0 === $this.prop('type').indexOf('checkbox') && $this.is(':checked')) ||
179
- (0 === $this.prop('type').indexOf('select' ) && '0' !== $this.val());
 
180
 
181
  // checkbox
182
  $this.siblings('input[name^="' + ID('%', 'settings') + '"]:checkbox').prop('disabled', !stat);
@@ -365,7 +366,7 @@
365
 
366
  for(i = 0; i < n; ++i) {
367
  j = i * size;
368
- r.push(arr.slice(j, j + size));
369
  }
370
 
371
  return r;
@@ -489,11 +490,11 @@
489
  }
490
 
491
  // https://stackoverflow.com/questions/12701772/insert-links-into-google-charts-api-data
492
- n = 'http://www.w3.org/1999/xlink';
493
  $id.find('text').each(function (i, elm) {
494
  p = elm.parentNode;
495
  if ('g' === p.tagName.toLowerCase() && -1 !== (i = inArray(elm.textContent, info))) {
496
- a = document.createElementNS('http://www.w3.org/2000/svg', 'a');
497
  a.setAttributeNS(n, 'xlink:href', info[i].link);
498
  a.setAttributeNS(n, 'title', info[i].label);
499
  a.setAttribute('target', mode ? '_blank' : '_self');
@@ -878,12 +879,12 @@
878
  texp = /(<([^>]+)>)/ig, // regular expression to strip tag
879
  hexp = /data-hash=[\W]([\w]+)[\W]/i, // regular expression to extract hash
880
  data = { IP: [], AS: [] }, // IP address and AS number
881
- hash, cell, cells = $('table.dataTable').find('td>input:checked');
882
 
883
  if (!cmd) {
884
  return false;
885
  } else if (!cells.length) {
886
- warning(null, ip_geo_block.msg[11]);
887
  return false;
888
  }
889
 
@@ -935,7 +936,7 @@
935
 
936
  // Clear all
937
  $(ID('@', 'clear_all')).off('click').on('click', function (/*event*/) {
938
- confirm(ip_geo_block.msg[tabNo === 1 ? 4 : 5], function () {
939
  ajax_clear(tabNo === 1 ? 'cache' : 'logs', null);
940
  });
941
  return false;
@@ -943,7 +944,7 @@
943
 
944
  // Jump to search tab with opening a new window
945
  // @note: `click` cannot be `off` because it's a root.
946
- $('table.dataTable tbody').on('click', 'a', function (/*event*/) {
947
  var p = window.location.search.slice(1).split('&'),
948
  n = p.length, q = {}, i, j;
949
 
@@ -1153,10 +1154,10 @@
1153
  j.appendChild(i);
1154
 
1155
  if (1 & data[key]) {
1156
- j.appendChild(add_icon(dfn, span, ip_geo_block.msg[6], 'lock'));
1157
  }
1158
  if (2 & data[key]) {
1159
- j.appendChild(add_icon(dfn, span, ip_geo_block.msg[7], 'unlock'));
1160
  }
1161
 
1162
  $this.append(j);
@@ -1213,7 +1214,7 @@
1213
  $(ID('.', 'icon-find')).on('click', function (/*event*/) {
1214
  var $this = $(this),
1215
  list = [], n = 0, key, ext, id, s,
1216
- title = stripTag(ip_geo_block.msg[9]),
1217
  target = stripTag($this.data('target')); // `admin`, `plugins`, `themes`
1218
 
1219
  // show description
@@ -1266,7 +1267,7 @@
1266
  // update status of checkbox
1267
  $(ID('@', 'exception_' + target)).trigger('change');
1268
  $(ID('#', 'find-' + target)).append(
1269
- ' ' + '<span class="ip-geo-block-warn">' + stripTag(ip_geo_block.msg[8].replace('%d', n)) + '</span>'
1270
  );
1271
  });
1272
 
@@ -1337,7 +1338,7 @@
1337
  /*--------------------------------
1338
  * Privacy and record settings
1339
  *--------------------------------*/
1340
- $(ID('@', 'anonymize')).on('change', function (/*event*/) {
1341
  $('input[class*="remote"]').prop('disabled', $(this).prop('checked'));
1342
  }).trigger('change');
1343
 
@@ -1455,17 +1456,39 @@
1455
  return false;
1456
  });
1457
 
1458
- // Manipulate DB table for validation logs
1459
- $(ID('@', 'create_table')).on('click', function (/*event*/) {
1460
- confirm(ip_geo_block.msg[1], function () {
1461
- ajax_table('create-table');
1462
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1463
  return false;
1464
  });
1465
 
1466
- $(ID('@', 'delete_table')).on('click', function (/*event*/) {
1467
- confirm(ip_geo_block.msg[2], function () {
1468
- ajax_table('delete-table');
 
1469
  });
1470
  return false;
1471
  });
@@ -1581,7 +1604,7 @@
1581
 
1582
  // Statistics of validation
1583
  $(ID('@', 'clear_statistics')).on('click', function (/*event*/) {
1584
- confirm(ip_geo_block.msg[3], function () {
1585
  ajax_clear('statistics', null);
1586
  });
1587
  return false;
@@ -1589,7 +1612,7 @@
1589
 
1590
  // Statistics in logs
1591
  $(ID('@', 'clear_logs')).on('click', function (/*event*/) {
1592
- confirm(ip_geo_block.msg[5], function () {
1593
  ajax_clear('logs', null);
1594
  });
1595
  return false;
@@ -1862,8 +1885,20 @@
1862
 
1863
  if (ip) {
1864
  // Anonymize IP address
1865
- if ($(ID('@', 'anonymize' )).prop('checked')) {
1866
- ip = ip.replace(/([\.\:])\w{1,4}$/, '$1' + '0');
 
 
 
 
 
 
 
 
 
 
 
 
1867
  $(ID('@', 'ip_address')).val(ip);
1868
  }
1869
 
79
  }
80
 
81
  function warning(status, msg, cmd) {
82
+ window.alert(stripTag(msg || ip_geo_block.msg[11].replace('%s', cmd) + ' (' + status + ')'));
83
  }
84
 
85
  function notice_html5() {
86
+ warning(null, stripTag(ip_geo_block.msg[9]));
87
  }
88
 
89
  function redirect(page, tab) {
175
 
176
  // Show/Hide descendant elements
177
  function show_descendants($this, $elem, mask) {
178
+ var prop = $this.prop('type') || '',
179
+ stat = (0 === prop.indexOf('checkbox') && $this.is(':checked')) ||
180
+ (0 === prop.indexOf('select' ) && '0' !== $this.val());
181
 
182
  // checkbox
183
  $this.siblings('input[name^="' + ID('%', 'settings') + '"]:checkbox').prop('disabled', !stat);
366
 
367
  for(i = 0; i < n; ++i) {
368
  j = i * size;
369
+ r.push(arr.slice(j, j + size)); // IE >= 9
370
  }
371
 
372
  return r;
490
  }
491
 
492
  // https://stackoverflow.com/questions/12701772/insert-links-into-google-charts-api-data
493
+ n = 'https://www.w3.org/1999/xlink';
494
  $id.find('text').each(function (i, elm) {
495
  p = elm.parentNode;
496
  if ('g' === p.tagName.toLowerCase() && -1 !== (i = inArray(elm.textContent, info))) {
497
+ a = document.createElementNS('https://www.w3.org/2000/svg', 'a');
498
  a.setAttributeNS(n, 'xlink:href', info[i].link);
499
  a.setAttributeNS(n, 'title', info[i].label);
500
  a.setAttribute('target', mode ? '_blank' : '_self');
879
  texp = /(<([^>]+)>)/ig, // regular expression to strip tag
880
  hexp = /data-hash=[\W]([\w]+)[\W]/i, // regular expression to extract hash
881
  data = { IP: [], AS: [] }, // IP address and AS number
882
+ hash, cell, cells = $('table' + ID('.', 'dataTable')).find('td>input:checked');
883
 
884
  if (!cmd) {
885
  return false;
886
  } else if (!cells.length) {
887
+ warning(null, ip_geo_block.msg[10]);
888
  return false;
889
  }
890
 
936
 
937
  // Clear all
938
  $(ID('@', 'clear_all')).off('click').on('click', function (/*event*/) {
939
+ confirm(ip_geo_block.msg[0], function () {
940
  ajax_clear(tabNo === 1 ? 'cache' : 'logs', null);
941
  });
942
  return false;
944
 
945
  // Jump to search tab with opening a new window
946
  // @note: `click` cannot be `off` because it's a root.
947
+ $('table' + ID('.', 'dataTable') + ' tbody').on('click', 'a', function (/*event*/) {
948
  var p = window.location.search.slice(1).split('&'),
949
  n = p.length, q = {}, i, j;
950
 
1154
  j.appendChild(i);
1155
 
1156
  if (1 & data[key]) {
1157
+ j.appendChild(add_icon(dfn, span, ip_geo_block.msg[5], 'lock'));
1158
  }
1159
  if (2 & data[key]) {
1160
+ j.appendChild(add_icon(dfn, span, ip_geo_block.msg[6], 'unlock'));
1161
  }
1162
 
1163
  $this.append(j);
1214
  $(ID('.', 'icon-find')).on('click', function (/*event*/) {
1215
  var $this = $(this),
1216
  list = [], n = 0, key, ext, id, s,
1217
+ title = stripTag(ip_geo_block.msg[8]),
1218
  target = stripTag($this.data('target')); // `admin`, `plugins`, `themes`
1219
 
1220
  // show description
1267
  // update status of checkbox
1268
  $(ID('@', 'exception_' + target)).trigger('change');
1269
  $(ID('#', 'find-' + target)).append(
1270
+ ' ' + '<span class="ip-geo-block-warn">' + stripTag(ip_geo_block.msg[7].replace('%d', n)) + '</span>'
1271
  );
1272
  });
1273
 
1338
  /*--------------------------------
1339
  * Privacy and record settings
1340
  *--------------------------------*/
1341
+ $(ID('@', 'restrict_api')).on('change', function (/*event*/) {
1342
  $('input[class*="remote"]').prop('disabled', $(this).prop('checked'));
1343
  }).trigger('change');
1344
 
1456
  return false;
1457
  });
1458
 
1459
+ // Emergency login link
1460
+ $(ID('#', 'login-link')).on('click', function (/*event*/) {
1461
+ var $this = $(this), type = ID('$', 'primary');
1462
+ if ($this.hasClass(type)) {
1463
+ ajax_post('login-loading', {
1464
+ cmd: 'generate-link'
1465
+ }, function (data) {
1466
+ $this.text(ip_geo_block.msg[3]);
1467
+ $this.removeClass(type).nextAll(ID('.', 'desc')).remove();
1468
+ $('<p class="ip-geo-block-desc"></p>')
1469
+ .appendTo($this.parent())
1470
+ .append(
1471
+ ip_geo_block.msg[4],
1472
+ '<a href="' + data.link + '" title="' + ip_geo_block.msg[1] + '" target=_blank>' + data.link + '</a></p>'
1473
+ );
1474
+ });
1475
+ } else {
1476
+ confirm(ip_geo_block.msg[0], function () {
1477
+ ajax_post('login-loading', {
1478
+ cmd: 'delete-link'
1479
+ }, function (data) {
1480
+ $this.text(ip_geo_block.msg[2]);
1481
+ $this.addClass(type).nextAll(ID('.', 'desc')).remove();
1482
+ });
1483
+ });
1484
+ }
1485
  return false;
1486
  });
1487
 
1488
+ // Manipulate DB table for validation logs
1489
+ $(ID('@', 'init_table')).on('click', function (/*event*/) {
1490
+ confirm(ip_geo_block.msg[0], function () {
1491
+ ajax_table('init-table');
1492
  });
1493
  return false;
1494
  });
1604
 
1605
  // Statistics of validation
1606
  $(ID('@', 'clear_statistics')).on('click', function (/*event*/) {
1607
+ confirm(ip_geo_block.msg[0], function () {
1608
  ajax_clear('statistics', null);
1609
  });
1610
  return false;
1612
 
1613
  // Statistics in logs
1614
  $(ID('@', 'clear_logs')).on('click', function (/*event*/) {
1615
+ confirm(ip_geo_block.msg[0], function () {
1616
  ajax_clear('logs', null);
1617
  });
1618
  return false;
1885
 
1886
  if (ip) {
1887
  // Anonymize IP address
1888
+ if ($(ID('@', 'anonymize')).prop('checked')) {
1889
+ if (/[^0-9a-f\.:]/.test(ip)) {
1890
+ warning(null, 'illegal format.');
1891
+ return false;
1892
+ } else if (ip.indexOf('.') !== -1) { // in case of IPv4
1893
+ ip = ip.replace(/\.\w+$/, '.0');
1894
+ } else { // in case of IPv6
1895
+ ip = ip.split(':'); // 2001:db80:abcd:0012:0000:0000:0000:0000
1896
+ ip = ip.splice(0, 4).join(':');
1897
+ if (-1 === ip.indexOf('::')) {
1898
+ ip += '::'; // mask the interface ID
1899
+ }
1900
+ ip = ip.replace(/:{3,}/, '::');
1901
+ }
1902
  $(ID('@', 'ip_address')).val(ip);
1903
  }
1904
 
admin/js/admin.min.js CHANGED
@@ -1,6 +1,6 @@
1
- /*
2
- Project: WordPress IP Geo Block
3
- Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
- This software is released under the MIT License.
5
- */
6
- (function(a,f,t){function b(a,b){var c={".":".ip-geo-block-","#":"#ip-geo-block-","@":"#ip_geo_block_settings_",$:"ip-geo-block-","%":"ip_geo_block_","!":"ip_geo_block_settings_"};return"undefined"!==typeof b?c[a]+b:c.$+a}function da(a){return a.toString().replace(/[&<>"']/g,function(a){return{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[a]}).replace(/&amp;(#\d{2,4}|\w{4,7});/g,"&$1;")}function k(a){return a?da(a.toString().replace(/(<([^>]+)>)/ig,"")):""}function E(b,e){var c=a(f).width();c!==J&&(J=c,"undefined"===typeof p[b]&&(p[b]={id:!1,callback:e}),a(f).off("resize").on("resize",function(){!1!==p[b].id&&f.clearTimeout(p[b].id);p[b].time=f.setTimeout(p[b].callback,200);return!1}))}function C(c,e){e?a(b("#",c)).addClass(b("loading")):a(b("#",c)).removeClass(b("loading"))}function z(a,b){f.confirm(k(a))&&b()}function D(a,b,g){f.alert(k(b||d.msg[12].replace("%s",g)+" ("+a+")"))}function K(a,b){-1!==f.location.href.indexOf(a)&&(f.location=k(a)+(b?"&"+k(b):"")+"&ip-geo-block-auth-nonce="+F.nonce)}function q(b,e,g,l){b&&C(b,!0);e.action=d.action;e.nonce=d.nonce;a.post(d.url,e).done(function(a){g&&g(a)}).fail(function(a){S||D(a.status,a.responseText,e.action)}).always(function(){b&&("object"===typeof l?a.when.apply(a,l).then(function(){C(b,!1)}):C(b,!1))})}function M(a,b){q(a,{cmd:"clear-"+a,which:b},function(a){K(a.page,a.tab)})}function T(a){q(a,{cmd:a},function(a){K(a.page,a.tab)})}function x(a){a.stopImmediatePropagation();return!1}function G(a,e){e?a.removeClass("folding-disable"):(a.children(b(".","hide")).hide(),a.addClass("folding-disable"),a.removeClass(b("dropdown")).addClass(b("dropup")))}function N(c,e,g){var l=0===c.prop("type").indexOf("checkbox")&&c.is(":checked")||0===c.prop("type").indexOf("select")&&"0"!==c.val();c.siblings('input[name^="'+b("%","settings")+'"]:checkbox').prop("disabled",!l);a.isArray(e)?a.each(e,function(c,e){a(e).nextAll(b(".","settings-folding")).each(function(b,e){G(a(e),l&&g[c])})}):e.nextAll(b(".","settings-folding")).each(function(b,c){G(a(c),l&&g)})}function U(c){var e=b("@","validation_ajax_");G(c.closest("ul").next(),a(e+"1").is(":checked")||a(e+"2").is(":checked"))}function H(a){return String(a).replace(/[a-z]/gi,function(a){return String.fromCharCode(a.charCodeAt(0)+("n">a.toLowerCase()?13:-13))})}function ea(a,b){var c=new f.FileReader;c.onload=function(a){b&&b(a.target.result)};c.onerror=function(a){D("Error",a.target.error.code)};c.readAsText(a)}function V(c){var e=c.is(":checked"),g=a(b("@","public_target_rule")),l=a(b("@","public_behavior")),d=c.closest("tr").nextAll("tr");d.find('[name^="'+b("%","settings")+'"]').prop("disabled",!e);d.find(b(".","desc")).css("opacity",e?1:.5);N(c,[g,l],["1"===g.val()?!0:!1,l.val()]);e&&l.change()}function O(c,e){c&&("string"===typeof c&&(c=JSON.parse(c)),e&&(a('input[type="checkbox"]').prop("checked",!1).change(),a("input[name*=providers]").prop("disabled",!1).change()),a(b("#","import")).closest("form").deserialize(c),a(b("@","exception_admin")+","+b("@","validation_mimetype")).change(),a('select[name*="'+b("%","settings")+'"]').change(),a(b("@","validation_login")).change(),V(a(b("@","validation_public"))),U(a(b("@","validation_ajax_1"))),e&&(e=b("%","settings[providers][IPInfoDB]"),a(b("@","providers_IPInfoDB")).prop("checked",c[e]?!0:!1)))}function fa(a,b){var c=Math.ceil(a.length/b),e=[],d;for(d=0;d<c;++d){var m=d*b;e.push(a.slice(m,m+b))}return e}function v(c){"object"===typeof f.google&&(1===c?a(b("#","chart-countries")).length&&(h.drawPie(b("chart-countries")),h.drawLine(b("chart-daily"),"date")):5===c&&a(b(".","network")).each(function(b,c){h.drawStacked(a(c).attr("id"))}))}function W(a){if("object"===typeof f.google){var b=["corechart"];5===a&&b.push("bar");f.google.load("visualization","1",{packages:b,callback:function(){v(a)}});E("draw-chart."+a,function(){v(a)})}}function ha(a){var b,c="undefined"!==typeof wpCookies&&wpCookies.getHash("ip-geo-block")||[];for(b in c)c.hasOwnProperty(b)&&(c[b]=c[b].replace(/[^ox\d]/g,"").split(""));"undefined"===typeof c[a]&&(c[a]=[]);return c}function A(b){var c,g,d=[];a.each(b,function(a,b){d[a]="";if("undefined"!==typeof b&&(g=b.length))for(d[a]=b[0]||"o",c=1;c<g;++c)d[a]+=b[c]||"o"});"undefined"!==typeof wpCookies&&wpCookies.setHash("ip-geo-block",d,new Date(Date.now()+2592E6),F.home+F.admin)}function ia(c){var e=ha(c);a("form").on("click","h2,h3 a",function(){f.open(this.href,null);return!1}).on("click","h2,h3",function(){var d=a(this),l=d.closest("fieldset").data("section"),f=d.parent().nextAll(".panel-body").toggle();d.toggleClass(b("dropup")).toggleClass(b("dropdown"));(d=d.hasClass(b("dropdown")))?f.addClass(b("border")).trigger(b("show-body")):f.removeClass(b("border"));e[c][l]=d?"o":"x";A(e);v(c);return!1});a(b("#","toggle-sections")).on("click",function(){var d,l=a(b(".","field")).find("h2,h3"),f=[b("dropdown"),b("dropup")],m=l.filter("."+f[0]).length;l.each(function(g){d=a(this);d.removeClass(f.join(" ")).addClass(m?f[1]:f[0]);d=d.parent().nextAll(".panel-body").toggle(m?!1:!0);m?d.removeClass(b("border")):d.addClass(b("border")).trigger("show-body");e[c][g]=m?"x":"o"});A(e);v(c);return!1});return e}function P(c){a("body").append('<div style="display:none"><form method="POST" id="'+b("export-form")+'" action="'+d.url.replace("ajax.php","post.php")+'"><input type="hidden" name="action" value="'+d.action+'" /><input type="hidden" name="nonce" value="'+d.nonce+'" /><input type="hidden" name="cmd" value="'+c+'" /><input type="hidden" name="data" value="" id="'+b("export-data")+'"/><input type="submit" value="submit" /></form><input type="file" name="settings" id="'+b("file-dialog")+'" /></div>')}function X(a,b,d,f){a=a.cloneNode(!1);a.setAttribute("title",k(d));b=b.cloneNode(!1);b.setAttribute("class","dashicons dashicons-"+f);a.appendChild(b);return a}function Y(c,e,g){a.extend(!0,a.fn.dataTable.defaults,g,{dom:"tp",serverSide:!1,autoWidth:!1,processing:!0,deferRender:!0,deferLoading:10,info:!1,lengthChange:!1,language:{emptyTable:d.i18n[1],loadingRecords:d.i18n[0],processing:d.i18n[0],zeroRecords:d.i18n[2],paginate:{first:"&laquo;",last:"&raquo;",next:"&rsaquo;",previous:"&lsaquo;"}},responsive:{details:{type:"column",target:"td:nth-child(n+2)"}},columnDefs:[{width:"1.25em",targets:0},{orderable:!1,targets:0},{searchable:!1,targets:0},{targets:[0],data:null,defaultContent:'<input type="checkbox">'}],pagingType:"full_numbers",pageLength:10,scroller:!0,scrollY:1E4,scrollCollapse:!0,drawCallback:function(c){var f=a(b("#",e.tableID)).find("td.dataTables_empty"),g="restore-logs"===e.ajaxCMD?3:2;g>c.iDraw?f.html(d.i18n[0]):g===c.iDraw&&(f.html(d.i18n[1]),f=a(b("@","search_filter")),f.val()&&f.trigger("keyup"))}});var l=a(b("#",e.tableID)).DataTable({ajax:{url:d.url,type:"POST",data:{cmd:e.ajaxCMD,action:d.action,nonce:d.nonce}},mark:!0}),h=function(){l.columns.adjust().responsive.recalc().draw(!1)};E("draw-table."+c,h);a(b("#",e.sectionID)).find(".panel-body").off(b("show-body")).on(b("show-body"),function(){h();return!1}).off("change").on("change",'th>input[type="checkbox"]',function(){var c=a(this).prop("checked");a(b("#",e.tableID)).find('td>input[type="checkbox"]').prop("checked",c);return!1});a(b("#","select-target")).off("change").on("change",function(){var c=a(this).find('input[name="'+b("target")+'"]:checked').val();l.columns(e.targetColumn).search("all"!==c?c:"").draw();return!1}).trigger("change");a(b("#","bulk-action")).off("click").on("click",function(){var f=a(this).prev().val(),g=/(<([^>]+)>)/ig,h=/data-hash=[\W]([\w]+)[\W]/i,k={IP:[],AS:[]},r,w,I=a("table.dataTable").find("td>input:checked");if(!f)return!1;if(!I.length)return D(null,d.msg[11]),!1;I.each(function(){w=l.cell(this.parentNode).data();r="bulk-action-remove"===f||"bulk-action-ip-erase"===f?(r=w[e.columnIP].match(h))?","+r[1]:"":"";k.IP.push(w[e.columnIP].replace(g,"")+r);k.AS.push(w[e.columnAS].replace(g,""))});k.IP.length&&q("loading",{cmd:f,which:k},function(d){"undefined"!==typeof d.page?K(d.page,"tab="+c):d&&(l.ajax.reload(),a(b("#",e.tableID)).find('th input[type="checkbox"]').prop("checked",!1))});return!1});a(b("@","search_filter")).off("keyup").on("keyup",function(){l.search(this.value,!1,!0,!/[A-Z]/.test(this.value)).draw();return!1});a(b("#","reset-filter")).off("click").on("click",function(){a(b("@","search_filter")).val("");l.search("").draw();return!1});a(b("@","clear_all")).off("click").on("click",function(){z(d.msg[1===c?4:5],function(){M(1===c?"cache":"logs",null)});return!1});a("table.dataTable tbody").on("click","a",function(){var b=f.location.search.slice(1).split("&"),e=b.length,d={},g;for(g=0;g<e;++g){var l=b[g].split("=");d[l[0]]=l[1]}d.tab=1===c?4:2;d.s=a(this).text().replace(/[^\w\.:\*]/,"");l=[];for(g in d)d.hasOwnProperty(g)&&l.push(g+"="+d[g]);f.open(f.location.pathname+"?"+l.join("&"),"_blank");return!1});return l}var S=!1,p=[],J=a(f).width(),d=IP_GEO_BLOCK,F=IP_GEO_BLOCK_AUTH;a.fn.deserialize=function(b){return this.each(function(){var c,d=this,f={};for(c in b)if(b.hasOwnProperty(c))try{var h=decodeURIComponent(c);var k=decodeURIComponent(b[c]);f.hasOwnProperty(h)||(f[h]=[]);f[h].push(k)}catch(ja){}a.each(f,function(b,e){c=a('[name="'+b+'"]:input',d).val(e);"hidden"!==c.attr("type")&&c.before('<span style="color:red">*</span>')})})};var h={dataPie:[],viewPie:[],drawPie:function(b){if("undefined"===typeof h.dataPie[b]){var c=h.dataPie[b]=new f.google.visualization.DataTable;c.addColumn("string","Country");c.addColumn("number","Requests");c=a.parseJSON(a("#"+b).attr("data-"+b));h.dataPie[b].addRows(c)}"undefined"===typeof h.viewPie[b]&&(h.viewPie[b]=new f.google.visualization.PieChart(t.getElementById(b)));"undefined"!==typeof h.dataPie[b]&&"undefined"!==typeof h.viewPie[b]&&0<a("#"+b).width()&&h.viewPie[b].draw(h.dataPie[b],{backgroundColor:{fill:"transparent"},chartArea:{left:0,top:"5%",width:"100%",height:"90%"},sliceVisibilityThreshold:.015})},dataLine:[],viewLine:[],drawLine:function(b,d){if("undefined"===typeof h.dataLine[b]){var c=h.dataLine[b]=new f.google.visualization.DataTable;c.addColumn(d,"Date");c.addColumn("number","comment");c.addColumn("number","xmlrpc");c.addColumn("number","login");c.addColumn("number","admin");c.addColumn("number","public");var e=a.parseJSON(a("#"+b).attr("data-"+b));var k=e.length;for(c=0;c<k;++c)e[c][0]=new Date(1E3*e[c][0]);h.dataLine[b].addRows(e)}"undefined"===typeof h.viewLine[b]&&(h.viewLine[b]=new f.google.visualization.LineChart(t.getElementById(b)));"undefined"!==typeof h.dataLine[b]&&"undefined"!==typeof h.viewLine[b]&&0<(c=a("#"+b).width())&&h.viewLine[b].draw(h.dataLine[b],{legend:{position:"bottom"},backgroundColor:{fill:"transparent"},hAxis:{format:"MM/dd"+("datetime"===d?" HH:mm":"")},vAxis:{textPosition:320<c?"out":"in"},chartArea:{left:320<c?"10%":0,top:"5%",width:"100%",height:"75%"}})},dataStacked:[],viewStacked:[],drawStacked:function(c){var d,g,l=a("#"+c);"undefined"===typeof h.dataStacked[c]&&(g=a.parseJSON(l.attr("data-"+c)))&&(g.unshift(["site","comment","xmlrpc","login","admin","poblic",{role:"link"}]),h.dataStacked[c]=f.google.visualization.arrayToDataTable(g));"undefined"===typeof h.viewStacked[c]&&(h.viewStacked[c]=new f.google.visualization.BarChart(t.getElementById(c)),f.google.visualization.events.addListener(h.viewStacked[c],"animationfinish",function(){var d,e,f,g=[],k=h.dataStacked[c],m=k.getNumberOfRows(),q=a(b("#","open-new")).prop("checked");for(d=0;d<m;d++)g.push({label:k.getValue(d,0),link:k.getValue(d,6)});m="http://www.w3.org/1999/xlink";l.find("text").each(function(a,b){f=b.parentNode;var c;if(c="g"===f.tagName.toLowerCase()){a:{c=b.textContent;var d,k=g.length;c=c.replace("\u2026","");for(d=0;d<k;++d)if(g.hasOwnProperty(d)&&0===g[d].label.indexOf(c)){c=d;break a}c=-1}c=-1!==(a=c)}c&&(e=t.createElementNS("http://www.w3.org/2000/svg","a"),e.setAttributeNS(m,"xlink:href",g[a].link),e.setAttributeNS(m,"title",g[a].label),e.setAttribute("target",q?"_blank":"_self"),e.setAttribute("class","site"),e.appendChild(f.removeChild(b)),f.appendChild(e),g.splice(a,1))})}));if(0<(d=l.width())&&"undefined"!==typeof h.dataStacked[c]&&"undefined"!==typeof h.viewStacked[c]){var k=b("range");var m=a.parseJSON(a("."+k).attr("data-"+k));g=h.dataStacked[c];k=40*g.getNumberOfRows();h.viewStacked[c].draw(g,{width:d,height:k+80,allowHtml:!0,isStacked:!0,legend:{position:"top"},chartArea:{top:50,left:90,width:"100%",height:k},hAxis:{minValue:0,maxValue:m[1]},backgroundColor:{fill:"transparent"},animation:{startup:!0,duration:200,easing:"out"}})}},ajaxStacked:function(c,d,f,k){c=Math.max(0,Math.min(4,c));d=5*Math.max(1,Math.min(5,d));q(null,{cmd:"restore-network",which:c,offset:d*f*k,length:d},function(c){var e,f,g,k,l;c=fa(c,d);a(b(".","network")).each(function(b,m){if("undefined"!==typeof c[b]){k=a(m).attr("id");l=h.dataStacked[k];g=Math.min(d,c[b].length);for(e=0;e<g;++e)for(f=1;5>=f;f++)l.setValue(e,f,c[b][e][f]);h.drawStacked(k)}})})}};a(function(){var c=Number(d.tab)||0,e=ia(c);a(b(".","inhibit")).on("submit",function(){return!1});a(f).on("beforeunload",function(){S=!0});switch(c){case 0:var g=b("%","settings");a('[id^="'+b("scan-")+'"]').on("click",function(){var c=a(this),d=c.attr("id"),e=c.parent();q(d.replace(/^.*(?:scan)/,"scanning"),{cmd:"scan-code",which:d.replace(b("scan-"),"")},function(a){e.children("ul").length||e.append('<ul id="'+b("code-list")+'"></ul>');e=e.children("ul").empty();for(c in a)if(a.hasOwnProperty(c)){var c=k(c);if("string"===typeof a[c])var d=k(a[c]);else d=k(a[c].code),c='<abbr title="'+k(a[c].type)+'">'+c+"</abbr>";e.append("<li>"+c+' : <span class="'+b("notice")+'">'+d+"</span></li>")}e.show("slow")});return!1});a(b("@","matching_rule")).on("change",function(){var c=this.value;a(b("@","white_list")).closest("tr").toggle("0"===c);a(b("@","black_list")).closest("tr").toggle("1"===c);return!1}).change();a(b(".","icon-cidr")).on("click",function(){var c=a(b("#","admin-styles-css")).get(0).href,d=f.open("about:blank","","width=560,height=170");c=c.slice(0,c.lastIndexOf("css/"));d.document.write('<!DOCTYPE html><html lang=en><meta charset=utf-8><title>CIDR calculator for IPv4 / IPv6</title><link href="'+c+'css/cidr.min.css?v=.1" rel=stylesheet><div class="row container"><div class=row id=i><fieldset class="col span_11"><legend>Range <input id=a type=button value=Clear tabindex=1></legend><textarea id=c name=range placeholder="192.168.0.0 - 192.168.255.255" rows=5 wrap=off tabindex=2></textarea></fieldset><ul class="col span_2" id=h><li class=row><input id=e type=button value=&rarr; class="col span_24" tabindex=3><li class=row><input id=f type=button value=&larr; class="col span_24" tabindex=6></ul><fieldset class="col span_11"><legend>CIDR <input id=b type=button value=Clear tabindex=4></legend><textarea id=d name=cidr placeholder=192.168.0.0/16 rows=5 wrap=off tabindex=5></textarea></fieldset></div><div class=row id=j><span class=col id=g>\u00a0</span></div></div><script src="'+c+'js/cidr.min.js?v=.1">\x3c/script>');d.document.close();return!1});a(b("@","validation_mimetype")).on("change",function(c){var d=a(this),n=parseInt(d.val(),10);d.nextAll(b(".","settings-folding")).each(function(b,c){G(a(c),n===b+1||n&&2===b)});return x(c)}).change();a('select[name*="response_code"]').on("change",function(c){var d=a(this),n=parseInt(d.val()/100,10),e=d.closest("tr").nextAll("tr");if(0<=d.attr("name").indexOf("public")&&-1===parseInt(a(b("@","public_matching_rule")).val(),10))return e.each(function(b){1>=b&&a(this).hide()}),x(c);3>=n?e.each(function(b){0===b?a(this).show():1===b&&a(this).hide()}):e.each(function(b){0===b?a(this).hide():1===b&&a(this).show()});return x(c)}).change();a(b("#","decode")).on("click",function(){var c=a(b("@","signature")),d=c.val();-1===d.search(/,/)?c.val(H(f.atob(d))):c.val(f.btoa(H(d)));return!1});a(b("@","validation_login")).on("change",function(b){var c=a(this);N(c,c,g,!0);return x(b)}).change();q(null,{cmd:"get-actions"},function(c){var e,n=a(b("#","list-admin")),f=t.createElement("li"),g=t.createElement("input"),h=t.createElement("label"),l=t.createElement("dfn"),m=t.createElement("span");for(y in c)if(c.hasOwnProperty(y)){var y=k(y);if(!n.find("#"+(e=b("!","exception_admin_"+y))).size()){var p=g.cloneNode(!1);p.setAttribute("id",e);p.setAttribute("value",y);p.setAttribute("type","checkbox");var r=f.cloneNode(!1);r.appendChild(p);p=h.cloneNode(!1);p.setAttribute("for",e);p.appendChild(t.createTextNode(y));r.appendChild(p);1&c[y]&&r.appendChild(X(l,m,d.msg[6],"lock"));2&c[y]&&r.appendChild(X(l,m,d.msg[7],"unlock"));n.append(r)}}a(b(".","icon-unlock")).on("click",function(){a(b("#","list-admin")+">li").filter(function(){return!a(this).find(".dashicons-unlock").length}).toggle();return!1});a(b("@","exception_admin")).on("change",function(c){var d=a.grep(a(this).val().split(","),function(a){return""!==a.replace(/^\s+|\s+$/g,"")});a(b("#","list-admin")).find("input").each(function(){var b=a(this),c=b.val();b.prop("checked",-1!==a.inArray(c,d))});return x(c)}).change();a(b("#","list-admin")).on("click","input",function(){var c=a(this);var d=a(b("@","exception_admin")),e=c.val(),n=a.grep(d.val().split(","),function(a){return""!==a.replace(/^\s+|\s+$/g,"")});c=a.inArray(e,n);-1===c?n.push(e):n.splice(c,1);d.val(n.join(",")).change()});a(b(".","icon-find")).on("click",function(){var c=a(this),e=[],n=0,f,ca,g,h,l=k(d.msg[9]),u=k(c.data("target"));a(b("#","find-"+u)).empty();c.next().children(b(".","find-desc")).show();c=a(b("#","list-"+u));c.children("li").each(function(b,c){e.push(a(c).find("input").val())});q("find-"+u,{cmd:"find-"+u},function(R){for(var m in R)R.hasOwnProperty(m)&&(++n,f=k(R[m]),m=k(m),ca=a.inArray(m,e),g=b("!","exception_"+u+"_"+m),h="admin"===u?f+"="+m:"/"+f+"/"+m+"/",h='<a class="ip-geo-block-icon ip-geo-block-icon-alert" href="'+F.sites[0]+F.admin+"options-general.php?page=ip-geo-block&tab=4&s="+encodeURIComponent(h)+'" title="'+l.replace("%s",h)+'" target="_blank"><span></span></a>',0>ca?(e.push(m),c.prepend('<li><input id="'+g+'" value="'+m+'" type="checkbox" '+("admin"===u?"/>":"name=ip_geo_block_settings[exception]["+u+"]["+m+"] />")+'<label for="'+g+'">'+m+"</lable>"+h+"</li>")):(g=c.find("#"+g).parent(),g.find("a").length||g.append(h)));a(b("@","exception_"+u)).trigger("change");a(b("#","find-"+u)).append(' <span class="ip-geo-block-warn">'+k(d.msg[8].replace("%d",n))+"</span>")});return!1})});a('input[id^="'+b("!","validation_ajax_")+'"]').on("change",function(){U(a(this))}).change();a(b("@","validation_public")).on("change",function(b){V(a(this));return x(b)}).change();a(b("@","public_matching_rule")).on("change",function(c){var d=this.value;a(b("@","public_white_list")).closest("tr").toggle("0"===d);a(b("@","public_black_list")).closest("tr").toggle("1"===d);a(b("@","public_response_code")).change().closest("tr").toggle("-1"!==d);return x(c)}).change();a(b("@","public_behavior")).on("change",function(b){var c=a(this);G(c.siblings("ul"),c.prop("checked"));return x(b)}).change();a(b("@","update")).on("click",function(){q("download",{cmd:"download"},function(c){var d;for(d in c)if(c.hasOwnProperty(d)){var e=c[d];for(n in e)if(e.hasOwnProperty(n)){var n=k(n);e[n].filename&&a(b("@",d+"_"+n+"_path")).val(k(e[n].filename));e[n].message&&a(b("#",d+"-"+n)).text(k(e[n].message))}}});return!1});a(b("@","anonymize")).on("change",function(){a('input[class*="remote"]').prop("disabled",a(this).prop("checked"))}).trigger("change");a(b("@","save_statistics")).on("change",function(){a(b("@","validation_recdays")).prop("disabled",!a(this).prop("checked"));return!1}).trigger("change");a(b("@","validation_reclogs")).on("change",function(){var b=a(this);b.parent().parent().nextAll().find('input[id*="validation"]').prop("disabled",0===Number(b.prop("selectedIndex")))}).trigger("change");a(b("@","cache_hold")).on("change",function(){var b=a(this).prop("checked");a('input[name*="[cache_time]"]').prop("disabled",!b);a('select[id*="login_fails"]').prop("disabled",!b)}).trigger("change");a(b("@","comment_pos")).on("change",function(){var b=a(this);b.nextAll('input[type="text"]').prop("disabled",0===Number(b.prop("selectedIndex")))}).trigger("change");P("validate");a(b("#","export")).on("click",function(){if("undefined"===typeof JSON)return D(null,k(d.msg[10])),!1;var c=g,e={};a.each(a(this).closest("form").serializeArray(),function(a,b){-1!==b.name.indexOf(c)&&(e[b.name]=b.value)});e[c+="[signature]"]=f.btoa(H(e[c]));a(b("#","export-data")).val(JSON.stringify(e));a(b("#","export-form")).submit();return!1});a(b("#","file-dialog")).on("change",function(a){if("undefined"===typeof f.FileReader)return D(null,k(d.msg[10])),!1;var b;(a=a.target.files[0])&&ea(a,function(a){a=JSON.parse(a);b=g+"[signature]";"undefined"!==typeof a[b]&&(a[b]=f.btoa(H(a[b])));q("export-import",{cmd:"validate",data:JSON.stringify(a)},function(a){O(a,!0)})});return!1});a(b("#","import")).on("click",function(){a(b("#","file-dialog")).click();return!1});a(b("#","default")).on("click",function(){z(d.msg[0],function(){q("pre-defined",{cmd:"import-default"},function(a){O(a,!0)})});return!1});a(b("#","preferred")).on("click",function(){z(d.msg[0],function(){q("pre-defined",{cmd:"import-preferred"},function(a){O(a,!1)})});return!1});a(b("@","reset_live")).on("click",function(){q("reset-live",{cmd:"reset-live"});return!1});a(b("@","create_table")).on("click",function(){z(d.msg[1],function(){T("create-table")});return!1});a(b("@","delete_table")).on("click",function(){z(d.msg[2],function(){T("delete-table")});return!1});a(b("#","show-info")).on("click",function(){a(b("#","wp-info")).empty();q("wp-info",{cmd:"show-info"},function(c){var d,e=[];for(d in c)c.hasOwnProperty(d)&&e.push("- "+d+" "+c[d]);a(b("#","wp-info")).html('<textarea class="regular-text code" rows="'+e.length+'">'+e.join("\n")+"</textarea>").find("textarea").select();return!1})});a('select[name^="'+g+'"]').on("change",function(){var c=a(this),d,e=b(".","desc");c.next(e).empty();(d=c.children("option:selected").data("desc"))&&c.next(e).html(a.parseHTML(d));N(c,c,g,!0);return!1}).change();a(b(".","icon-cycle")).on("click",function(){var c=a(this).nextAll("li"),d=c.find(b("@","exception_admin"));c=c.find("input:checkbox").filter(":visible");var e=c.filter(":checked").length;c.prop("checked",!e);if(d.length)if(e)d.val("");else{var f=[];c.each(function(b,c){f.push(a(c).val())});d.val(f.join(","))}a(this).blur();return!1});a(b(".","settings-folding>dfn")).on("click",function(){var c=b("drop"),d=a(this).parent();d.children(b(".","hide")).toggle();d.toggleClass(c+"up").toggleClass(c+"down");d.hasClass(c+"up")&&d.children("div").hide();return!1});a("#submit").on("click",function(){var c=a(b("@","signature")),d=c.val();-1!==d.indexOf(",")&&c.val(f.btoa(H(d)));return!0});break;case 1:W(c);var l=0;a(b("#","sort-slug")).on("click",function(){var b=a(this).closest("ol"),c=b.children("li");(l=!l)?c.sort(function(b,c){return a(b).text()>a(c).text()}):c.sort(function(b,c){return parseInt(a(b).text().replace(/^.*\((\d+)\)$/,"$1"),10)<=parseInt(a(c).text().replace(/^.*\((\d+)\)$/,"$1"),10)});b.children("li").remove();c.appendTo(b)});a(b("@","clear_statistics")).on("click",function(){z(d.msg[3],function(){M("statistics",null)});return!1});a(b("@","clear_logs")).on("click",function(){z(d.msg[5],function(){M("logs",null)});return!1});Y(c,{tableID:"statistics-cache",ajaxCMD:"restore-cache",sectionID:"section-2",targetColumn:4,columnIP:1,columnAS:3},{columns:[{title:'<input type="checkbox">'},{title:d.i18n[3]},{title:d.i18n[4]},{title:d.i18n[5]},{title:d.i18n[6]},{title:d.i18n[7]},{title:d.i18n[8]},{title:d.i18n[9]}],columnDefs:[{responsivePriority:0,targets:0},{responsivePriority:1,targets:1},{responsivePriority:2,targets:2},{responsivePriority:6,targets:3},{responsivePriority:7,targets:4},{responsivePriority:3,targets:5},{responsivePriority:4,targets:6},{responsivePriority:5,targets:7},{className:"all",targets:[0,1,2,5]}]});P("export-cache");a(b("#","export-cache")).on("click",function(){a(b("#","export-form")).submit();return!1});break;case 4:var w={tableID:"validation-logs",sectionID:"section-0",targetColumn:6,columnIP:3,columnAS:5},m={columns:[{title:'<input type="checkbox">'},{title:""},{title:d.i18n[10]},{title:d.i18n[3]},{title:d.i18n[4]},{title:d.i18n[5]},{title:d.i18n[7]},{title:d.i18n[11]},{title:d.i18n[12]},{title:d.i18n[13]},{title:d.i18n[14]},{title:d.i18n[15]}],columnDefs:[{responsivePriority:11,targets:0},{responsivePriority:0,targets:1},{responsivePriority:1,targets:2},{responsivePriority:2,targets:3},{responsivePriority:3,targets:4},{responsivePriority:6,targets:5},{responsivePriority:4,targets:6},{responsivePriority:5,targets:7},{responsivePriority:7,targets:8},{responsivePriority:8,targets:9},{responsivePriority:9,targets:10},{responsivePriority:10,targets:11},{visible:!1,targets:1},{className:"all",targets:[0,2,3,4]},{className:"none",targets:[8,9,10,11]}]},p=null,v=null,C=a(b("#","live-loading")),r=null,Q=function(){p&&(f.clearTimeout(p),p=null);v&&(C.removeClass(b("live-timer")),f.clearTimeout(v),v=null)},I=function(){Q();q("live-loading",{cmd:"live-start"},function(a){if(a.error)D(null,a.error);else if(a.data.length){var b,c=a.data.length;for(b=0;b<c;b++)r.row.add(a.data[b]);r.draw(!1)}p=f.setTimeout(I,1E3*d.interval)})},E=function(a,b){Q();q(null,{cmd:a||"live-stop",callback:b})},J=function(){E("live-pause",function(){C.addClass(b("live-timer"));v=f.setTimeout(function(){Q();a(b("#","live-log-stop")).prop("checked",!0)},1E3*d.timeout)})},B=b(""),Z=function(b,c,d){-1===c[7].indexOf("pass")?a(b).addClass(B+d+"blocked"):a(b).addClass(B+d+"passed")},aa=a(b("#","live-log")),ba=a(b("#","live-update"));a(b("#","validation-logs")).on("animationend",function(){a(this).find('tr[class*="'+B+'new"]').each(function(){var b=a(this);-1!==b.prop("class").indexOf("passed")?b.addClass(B+"passed").removeClass(B+"new-passed"):b.addClass(B+"blocked").removeClass(B+"new-blocked")});return!1});aa.on("change",function(){switch(a('input[name="'+b("live-log")+'"]:checked').val()){case "start":I();break;case "pause":J();break;case "stop":E()}});ba.on("change",function(){var d=aa.closest("tr"),f=ba.prop("checked");e[c][1]=f?"o":"x";A(e);r&&r.clear().destroy();f?(d.show().next().next().next().nextAll().hide(),w.ajaxCMD="live-stop",m.order=[1,"desc"],m.createdRow=function(a,b){Z(a,b,"new-")}):(d.hide().next().next().next().nextAll().show(),w.ajaxCMD="restore-logs",m.order=[0,""],m.createdRow=function(a,b){Z(a,b,"")});a(b("#","live-log-stop")).trigger("click");r=Y(c,w,m);return!1}).trigger("change");P("export-logs");a(b("#","export-logs")).on("click",function(){a(b("#","export-form")).submit();return!1});break;case 2:a(f).on(b("gmap-error"),function(){q(null,{cmd:"gmap-error"},function(a){K(a.page,a.tab)})});var L=a(b("#","map"));"object"===typeof f.google?L.each(function(){a(this).GmapRS()}):L.each(function(){a(this).empty().html('<iframe src="'+d.altgmap+'?output=embed" frameborder="0" style="width:100%; height:400px; border:0" allowfullscreen></iframe>')});a('select[id^="'+b("!","service")+'"]').on("change",function(){e[c][3]=a(this).prop("selectedIndex");A(e)}).change();a(b("@","get_location")).on("click",function(){var c=a(b("#","whois")),d=a.trim(a(b("@","ip_address")).val());if(d){a(b("@","anonymize")).prop("checked")&&(d=d.replace(/([\.:])\w{1,4}$/,"$10"),a(b("@","ip_address")).val(d));c.hide().empty();var e=a.whois(d,function(d){var e,f="";for(e=0;e<d.length;++e)f+="<tr><td>"+d[e].name+"</td><td>"+d[e].value+"</td></tr>";c.html('<fieldset id="'+b("section-1")+'" class="'+b("field")+' panel panel-default" data-section="1"><legend class="panel-heading"><h3 id="'+b("whois-title")+'" class="'+b("dropdown")+'">Whois</h3></legend><div class="panel-body '+b("border")+'"><table class="'+b("table")+'">'+f+"</table></div></fieldset>").fadeIn("slow");a(b("#","whois-title")).on("click",function(){var c=a(this);c.parent().nextAll().toggle();c.toggleClass(b("dropup")).toggleClass(b("dropdown"));return!1})});q("loading",{cmd:"search",ip:d,which:a(b("@","service")).val()},function(a){var c="",e=k(a.latitude||"0"),g=k(a.longitude||"0"),h=a.latitude||a.longitude?8:2;for(l in a)if(a.hasOwnProperty(l)){var l=k(l);c+='<li><span class="'+b("title")+'">'+l+' : </span><span class="'+b("result")+'">'+k(a[l])+"</span></li>"}"object"===typeof f.google?L.GmapRS("addMarker",{latitude:e,longitude:g,title:d,content:"<ul>"+c+"</ul>",show:!0,zoom:h}):L.css({height:"600px",backgroundColor:"transparent"}).empty().html('<ul style="margin-top:0; margin-left:1em;"><li><span class="'+b("title")+'">IP address : </span><span class="'+b("result")+'">'+k(d)+"</span></li>"+c+'</ul><iframe src="//maps.google.com/maps?q='+e+","+g+"&z="+h+'&output=embed" frameborder="0" style="width:100%; height:400px; border:0" allowfullscreen></iframe>')},[e])}return!1});a(b("@","ip_address")).on("keypress",function(c){if(c.which&&13===c.which||c.keyCode&&13===c.keyCode)return a(b("@","get_location")).click(),!1});a(b("@","ip_address")).val()&&a(b("@","get_location")).click();break;case 5:W(c),a("input[name="+b("duration")+"]:radio").on("click",function(){var b=a('div[class*="paginate"]').find('a[class*="current"]').text();e[c][2]=a(this).val()||0;e[c][3]=e[c][3]||2;e[c][4]=e[c][4]||1;A(e);h.ajaxStacked(e[c][2],e[c][3],e[c][4],b-1)}),a(b("#","open-new")).on("change",function(){var d=a(this).prop("checked");e[c][1]=d?"o":"x";A(e);a(b("#","section-0 svg")).find("a").each(function(){this.setAttribute("target",d?"_blank":"_self")})}),a(b("#","apply-layout")).on("click",function(){var d=a(b("#","select-layout"));e[c][3]=d.find('select[name="rows"] option:selected').val();e[c][4]=d.find('select[name="cols"] option:selected').val();A(e)}),a("ul.wp-submenu>li.wp-first-item").removeClass("current").next().addClass("current")}})})(jQuery,window,document);
1
+ /*!
2
+ * Project: WordPress IP Geo Block
3
+ * Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
+ * This software is released under the MIT License.
5
+ */
6
+ !function(e,t,n){"use strict";var i=!1,a=[],o=e(t).width(),r=IP_GEO_BLOCK,l=IP_GEO_BLOCK_AUTH;function c(e,t){var n={".":".ip-geo-block-","#":"#ip-geo-block-","@":"#ip_geo_block_settings_",$:"ip-geo-block-","%":"ip_geo_block_","!":"ip_geo_block_settings_"};return void 0!==t?n[e]+t:n.$+e}function s(e){return e?function(e){return e.toString().replace(/[&<>"']/g,function(e){return{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]}).replace(/&amp;(#\d{2,4}|\w{4,7});/g,"&$1;")}(e.toString().replace(/(<([^>]+)>)/gi,"")):""}function d(n,i){var r=e(t).width();r!==o&&(o=r,void 0===a[n]&&(a[n]={id:!1,callback:i}),e(t).off("resize").on("resize",function(){return!1!==a[n].id&&t.clearTimeout(a[n].id),a[n].time=t.setTimeout(a[n].callback,200),!1}))}function u(t,n){n?e(c("#",t)).addClass(c("loading")):e(c("#",t)).removeClass(c("loading"))}function p(e,n){t.confirm(s(e))&&n()}function h(e,n,i){t.alert(s(n||r.msg[11].replace("%s",i)+" ("+e+")"))}function f(){h(null,s(r.msg[9]))}function g(e,n){-1!==t.location.href.indexOf(e)&&(t.location=s(e)+(n?"&"+s(n):"")+"&ip-geo-block-auth-nonce="+l.nonce)}function m(t,n,a,o){t&&u(t,!0),n.action=r.action,n.nonce=r.nonce,e.post(r.url,n).done(function(e){a&&a(e)}).fail(function(e){i||h(e.status,e.responseText,n.action)}).always(function(){t&&("object"==typeof o?e.when.apply(e,o).then(function(){u(t,!1)}):u(t,!1))})}function v(e,t){m(e,{cmd:"clear-"+e,which:t},function(e){g(e.page,e.tab)})}function b(e){return e.stopImmediatePropagation(),!1}function k(e,t){t?e.removeClass("folding-disable"):(e.children(c(".","hide")).hide(),e.addClass("folding-disable"),e.removeClass(c("dropdown")).addClass(c("dropup")))}function w(t,n,i){var a=t.prop("type")||"",o=0===a.indexOf("checkbox")&&t.is(":checked")||0===a.indexOf("select")&&"0"!==t.val();t.siblings('input[name^="'+c("%","settings")+'"]:checkbox').prop("disabled",!o),e.isArray(n)?e.each(n,function(t,n){e(n).nextAll(c(".","settings-folding")).each(function(n,a){k(e(a),o&&i[t])})}):n.nextAll(c(".","settings-folding")).each(function(t,n){k(e(n),o&&i)})}function x(t){var n=c("@","validation_ajax_");k(t.closest("ul").next(),e(n+"1").is(":checked")||e(n+"2").is(":checked"))}function y(e){return String(e).replace(/[a-z]/gi,function(e){return String.fromCharCode(e.charCodeAt(0)+(e.toLowerCase()<"n"?13:-13))})}function _(e){return function(e){return t.btoa(e)}(y(e))}function C(e){return y(function(e){return t.atob(e)}(e))}function P(t){var n=t.is(":checked"),i=e(c("@","public_target_rule")),a=e(c("@","public_behavior")),o=t.closest("tr").nextAll("tr");o.find('[name^="'+c("%","settings")+'"]').prop("disabled",!n),o.find(c(".","desc")).css("opacity",n?1:.5),w(t,[i,a],["1"===i.val(),a.val()]),n&&a.change()}function A(t,n){t&&("string"==typeof t&&(t=JSON.parse(t)),n&&(e('input[type="checkbox"]').prop("checked",!1).change(),e("input[name*=providers]").prop("disabled",!1).change()),e(c("#","import")).closest("form").deserialize(t),e(c("@","exception_admin")+","+c("@","validation_mimetype")).change(),e('select[name*="'+c("%","settings")+'"]').change(),e(c("@","validation_login")).change(),P(e(c("@","validation_public"))),x(e(c("@","validation_ajax_1"))),n&&(n=c("%","settings[providers][IPInfoDB]"),e(c("@","providers_IPInfoDB")).prop("checked",!!t[n])))}e.fn.deserialize=function(t){return this.each(function(){var n,i,a,o=this,r={};for(n in t)if(t.hasOwnProperty(n))try{i=decodeURIComponent(n),a=decodeURIComponent(t[n]),r.hasOwnProperty(i)||(r[i]=[]),r[i].push(a)}catch(e){}e.each(r,function(t,i){"hidden"!==(n=e('[name="'+t+'"]:input',o).val(i)).attr("type")&&n.before('<span style="color:red">*</span>')})})};var S={dataPie:[],viewPie:[],drawPie:function(i){var a,o;void 0===S.dataPie[i]&&((a=S.dataPie[i]=new t.google.visualization.DataTable).addColumn("string","Country"),a.addColumn("number","Requests"),o=e.parseJSON(e("#"+i).attr("data-"+i)),S.dataPie[i].addRows(o)),void 0===S.viewPie[i]&&(S.viewPie[i]=new t.google.visualization.PieChart(n.getElementById(i))),void 0!==S.dataPie[i]&&void 0!==S.viewPie[i]&&0<(a=e("#"+i).width())&&S.viewPie[i].draw(S.dataPie[i],{backgroundColor:{fill:"transparent"},chartArea:{left:0,top:"5%",width:"100%",height:"90%"},sliceVisibilityThreshold:.015})},dataLine:[],viewLine:[],drawLine:function(i,a){var o,r,l;if(void 0===S.dataLine[i]){for((o=S.dataLine[i]=new t.google.visualization.DataTable).addColumn(a,"Date"),o.addColumn("number","comment"),o.addColumn("number","xmlrpc"),o.addColumn("number","login"),o.addColumn("number","admin"),o.addColumn("number","public"),r=(l=e.parseJSON(e("#"+i).attr("data-"+i))).length,o=0;o<r;++o)l[o][0]=new Date(1e3*l[o][0]);S.dataLine[i].addRows(l)}void 0===S.viewLine[i]&&(S.viewLine[i]=new t.google.visualization.LineChart(n.getElementById(i))),void 0!==S.dataLine[i]&&void 0!==S.viewLine[i]&&0<(o=e("#"+i).width())&&S.viewLine[i].draw(S.dataLine[i],{legend:{position:"bottom"},backgroundColor:{fill:"transparent"},hAxis:{format:"MM/dd"+("datetime"===a?" HH:mm":"")},vAxis:{textPosition:o>320?"out":"in"},chartArea:{left:o>320?"10%":0,top:"5%",width:"100%",height:"75%"}})},dataStacked:[],viewStacked:[],drawStacked:function(i){var a,o,r,l,s=e("#"+i);void 0===S.dataStacked[i]&&(r=e.parseJSON(s.attr("data-"+i)))&&(r.unshift(["site","comment","xmlrpc","login","admin","poblic",{role:"link"}]),S.dataStacked[i]=t.google.visualization.arrayToDataTable(r)),void 0===S.viewStacked[i]&&(S.viewStacked[i]=new t.google.visualization.BarChart(n.getElementById(i)),t.google.visualization.events.addListener(S.viewStacked[i],"animationfinish",function(){var t,a,o,r=[],l=S.dataStacked[i],d=l.getNumberOfRows(),u=e(c("#","open-new")).prop("checked");for(t=0;t<d;t++)r.push({label:l.getValue(t,0),link:l.getValue(t,6)});d="https://www.w3.org/1999/xlink",s.find("text").each(function(e,t){"g"===(o=t.parentNode).tagName.toLowerCase()&&-1!==(e=function(e,t){var n,i=t.length;for(e=e.replace("…",""),n=0;n<i;++n)if(t.hasOwnProperty(n)&&0===t[n].label.indexOf(e))return n;return-1}(t.textContent,r))&&((a=n.createElementNS("https://www.w3.org/2000/svg","a")).setAttributeNS(d,"xlink:href",r[e].link),a.setAttributeNS(d,"title",r[e].label),a.setAttribute("target",u?"_blank":"_self"),a.setAttribute("class","site"),a.appendChild(o.removeChild(t)),o.appendChild(a),r.splice(e,1))})})),0<(o=s.width())&&void 0!==S.dataStacked[i]&&void 0!==S.viewStacked[i]&&(a=c("range"),l=e.parseJSON(e("."+a).attr("data-"+a)),a=40*(r=S.dataStacked[i]).getNumberOfRows(),S.viewStacked[i].draw(r,{width:o,height:a+80,allowHtml:!0,isStacked:!0,legend:{position:"top"},chartArea:{top:50,left:90,width:"100%",height:a},hAxis:{minValue:0,maxValue:l[1]},backgroundColor:{fill:"transparent"},animation:{startup:!0,duration:200,easing:"out"}}))},ajaxStacked:function(t,n,i,a){m(null,{cmd:"restore-network",which:t=Math.max(0,Math.min(4,t)),offset:(n=5*Math.max(1,Math.min(5,n)))*i*a,length:n},function(t){var i,a,o,r,l;t=function(e,t){var n,i,a=Math.ceil(e.length/t),o=[];for(n=0;n<a;++n)i=n*t,o.push(e.slice(i,i+t));return o}(t,n),e(c(".","network")).each(function(c,s){if(void 0!==t[c]){for(r=e(s).attr("id"),l=S.dataStacked[r],o=Math.min(n,t[c].length),i=0;i<o;++i)for(a=1;a<=5;a++)l.setValue(i,a,t[c][i][a]);S.drawStacked(r)}})})}};function I(n){"object"==typeof t.google&&(1===n?e(c("#","chart-countries")).length&&(S.drawPie(c("chart-countries")),S.drawLine(c("chart-daily"),"date")):5===n&&e(c(".","network")).each(function(t,n){S.drawStacked(e(n).attr("id"))}))}function O(e){if("object"==typeof t.google){var n=["corechart"];5===e&&n.push("bar"),t.google.load("visualization","1",{packages:n,callback:function(){I(e)}}),d("draw-chart."+e,function(){I(e)})}}function D(t){var n,i,a=[];e.each(t,function(e,t){if(a[e]="",void 0!==t&&(i=t.length))for(a[e]=t[0]||"o",n=1;n<i;++n)a[e]+=t[n]||"o"}),"undefined"!=typeof wpCookies&&wpCookies.setHash("ip-geo-block",a,new Date(Date.now()+2592e6),l.home+l.admin)}function j(n){var i=function(e){var t,n="undefined"!=typeof wpCookies&&wpCookies.getHash("ip-geo-block")||[];for(t in n)n.hasOwnProperty(t)&&(n[t]=n[t].replace(/[^ox\d]/g,"").split(""));return void 0===n[e]&&(n[e]=[]),n}(n);return e("form").on("click","h2,h3 a",function(){return t.open(this.href,null),!1}).on("click","h2,h3",function(){return function(e,t,n){var i,a=e.closest("fieldset").data("section"),o=e.parent().nextAll(".panel-body").toggle();e.toggleClass(c("dropup")).toggleClass(c("dropdown")),(i=e.hasClass(c("dropdown")))?o.addClass(c("border")).trigger(c("show-body")):o.removeClass(c("border")),n[t][a]=i?"o":"x",D(n),I(t)}(e(this),n,i),!1}),e(c("#","toggle-sections")).on("click",function(){var t,a=e(c(".","field")).find("h2,h3"),o=[c("dropdown"),c("dropup")],r=a.filter("."+o[0]).length;return a.each(function(a){(t=e(this)).removeClass(o.join(" ")).addClass(r?o[1]:o[0]),t=t.parent().nextAll(".panel-body").toggle(!r),r?t.removeClass(c("border")):t.addClass(c("border")).trigger("show-body"),i[n][a]=r?"x":"o"}),D(i),I(n),!1}),i}function N(t){e("body").append('<div style="display:none"><form method="POST" id="'+c("export-form")+'" action="'+r.url.replace("ajax.php","post.php")+'"><input type="hidden" name="action" value="'+r.action+'" /><input type="hidden" name="nonce" value="'+r.nonce+'" /><input type="hidden" name="cmd" value="'+t+'" /><input type="hidden" name="data" value="" id="'+c("export-data")+'"/><input type="submit" value="submit" /></form><input type="file" name="settings" id="'+c("file-dialog")+'" /></div>')}function T(e,t,n,i){var a,o;return(a=e.cloneNode(!1)).setAttribute("title",s(n)),(o=t.cloneNode(!1)).setAttribute("class","dashicons dashicons-"+i),a.appendChild(o),a}function L(n,i,a){e.extend(!0,e.fn.dataTable.defaults,a,{dom:"tp",serverSide:!1,autoWidth:!1,processing:!0,deferRender:!0,deferLoading:10,info:!1,lengthChange:!1,language:{emptyTable:r.i18n[1],loadingRecords:r.i18n[0],processing:r.i18n[0],zeroRecords:r.i18n[2],paginate:{first:"&laquo;",last:"&raquo;",next:"&rsaquo;",previous:"&lsaquo;"}},responsive:{details:{type:"column",target:"td:nth-child(n+2)"}},columnDefs:[{width:"1.25em",targets:0},{orderable:!1,targets:0},{searchable:!1,targets:0},{targets:[0],data:null,defaultContent:'<input type="checkbox">'}],pagingType:"full_numbers",pageLength:10,scroller:!0,scrollY:1e4,scrollCollapse:!0,drawCallback:function(t){var n=e(c("#",i.tableID)).find("td.dataTables_empty"),a="restore-logs"===i.ajaxCMD?3:2;a>t.iDraw?n.html(r.i18n[0]):a===t.iDraw&&(n.html(r.i18n[1]),(n=e(c("@","search_filter"))).val()&&n.trigger("keyup"))}});var o=e(c("#",i.tableID)).DataTable({ajax:{url:r.url,type:"POST",data:{cmd:i.ajaxCMD,action:r.action,nonce:r.nonce}},mark:!0}),l=function(){o.columns.adjust().responsive.recalc().draw(!1)};return d("draw-table."+n,l),e(c("#",i.sectionID)).find(".panel-body").off(c("show-body")).on(c("show-body"),function(){return l(),!1}).off("change").on("change",'th>input[type="checkbox"]',function(){var t=e(this).prop("checked");return e(c("#",i.tableID)).find('td>input[type="checkbox"]').prop("checked",t),!1}),e(c("#","select-target")).off("change").on("change",function(){var t=e(this).find('input[name="'+c("target")+'"]:checked').val();return o.columns(i.targetColumn).search("all"!==t?t:"").draw(),!1}).trigger("change"),e(c("#","bulk-action")).off("click").on("click",function(){var t,a,l=e(this).prev().val(),s=/(<([^>]+)>)/gi,d=/data-hash=[\W]([\w]+)[\W]/i,u={IP:[],AS:[]},p=e("table"+c(".","dataTable")).find("td>input:checked");return!!l&&(p.length?(p.each(function(){a=o.cell(this.parentNode).data(),t=("bulk-action-remove"===l||"bulk-action-ip-erase"===l)&&(t=a[i.columnIP].match(d))?","+t[1]:"",u.IP.push(a[i.columnIP].replace(s,"")+t),u.AS.push(a[i.columnAS].replace(s,""))}),u.IP.length&&m("loading",{cmd:l,which:u},function(t){void 0!==t.page?g(t.page,"tab="+n):t&&(o.ajax.reload(),e(c("#",i.tableID)).find('th input[type="checkbox"]').prop("checked",!1))}),!1):(h(null,r.msg[10]),!1))}),e(c("@","search_filter")).off("keyup").on("keyup",function(){return o.search(this.value,!1,!0,!/[A-Z]/.test(this.value)).draw(),!1}),e(c("#","reset-filter")).off("click").on("click",function(){return e(c("@","search_filter")).val(""),o.search("").draw(),!1}),e(c("@","clear_all")).off("click").on("click",function(){return p(r.msg[0],function(){v(1===n?"cache":"logs",null)}),!1}),e("table"+c(".","dataTable")+" tbody").on("click","a",function(){var i,a,o=t.location.search.slice(1).split("&"),r=o.length,l={};for(i=0;i<r;++i)l[(a=o[i].split("="))[0]]=a[1];for(i in l.tab=1===n?4:2,l.s=e(this).text().replace(/[^\w\.\:\*]/,""),a=[],l)l.hasOwnProperty(i)&&a.push(i+"="+l[i]);return t.open(t.location.pathname+"?"+a.join("&"),"_blank"),!1}),o}e(function(){var a=Number(r.tab)||0,o=j(a);switch(e(c(".","inhibit")).on("submit",function(){return!1}),e(t).on("beforeunload",function(){i=!0}),a){case 0:var d=c("%","settings");e('[id^="'+c("scan-")+'"]').on("click",function(){var t=e(this),n=t.attr("id"),i=t.parent();return m(n.replace(/^.*(?:scan)/,"scanning"),{cmd:"scan-code",which:n.replace(c("scan-"),"")},function(e){var t,n;for(t in i.children("ul").length||i.append('<ul id="'+c("code-list")+'"></ul>'),i=i.children("ul").empty(),e)e.hasOwnProperty(t)&&("string"==typeof e[t=s(t)]?n=s(e[t]):(n=s(e[t].code),t='<abbr title="'+s(e[t].type)+'">'+t+"</abbr>"),i.append("<li>"+t+' : <span class="'+c("notice")+'">'+n+"</span></li>"));i.show("slow")}),!1}),e(c("@","matching_rule")).on("change",function(){var t=this.value;return e(c("@","white_list")).closest("tr").toggle("0"===t),e(c("@","black_list")).closest("tr").toggle("1"===t),!1}).change(),e(c(".","icon-cidr")).on("click",function(){var n=e(c("#","admin-styles-css")).get(0).href,i=t.open("about:blank","","width=560,height=170");return n=n.slice(0,n.lastIndexOf("css/")),i.document.write('<!DOCTYPE html><html lang=en><meta charset=utf-8><title>CIDR calculator for IPv4 / IPv6</title><link href="'+n+'css/cidr.min.css?v=.1" rel=stylesheet><div class="row container"><div class=row id=i><fieldset class="col span_11"><legend>Range <input id=a type=button value=Clear tabindex=1></legend><textarea id=c name=range placeholder="192.168.0.0 - 192.168.255.255" rows=5 wrap=off tabindex=2></textarea></fieldset><ul class="col span_2" id=h><li class=row><input id=e type=button value=&rarr; class="col span_24" tabindex=3><li class=row><input id=f type=button value=&larr; class="col span_24" tabindex=6></ul><fieldset class="col span_11"><legend>CIDR <input id=b type=button value=Clear tabindex=4></legend><textarea id=d name=cidr placeholder=192.168.0.0/16 rows=5 wrap=off tabindex=5></textarea></fieldset></div><div class=row id=j><span class=col id=g> </span></div></div><script src="'+n+'js/cidr.min.js?v=.1"><\/script>'),i.document.close(),!1}),e(c("@","validation_mimetype")).on("change",function(t){var n=e(this),i=parseInt(n.val(),10);return n.nextAll(c(".","settings-folding")).each(function(t,n){k(e(n),i===t+1||i&&2===t)}),b(t)}).change(),e('select[name*="response_code"]').on("change",function(t){var n=e(this),i=parseInt(n.val()/100,10),a=n.closest("tr").nextAll("tr");return 0<=n.attr("name").indexOf("public")&&-1===parseInt(e(c("@","public_matching_rule")).val(),10)?(a.each(function(t){1>=t&&e(this).hide()}),b(t)):(i<=3?a.each(function(t){0===t?e(this).show():1===t&&e(this).hide()}):a.each(function(t){0===t?e(this).hide():1===t&&e(this).show()}),b(t))}).change(),e(c("#","decode")).on("click",function(){var t=e(c("@","signature")),n=t.val();return-1===n.search(/,/)?t.val(C(n)):t.val(_(n)),!1}),e(c("@","validation_login")).on("change",function(t){var n=e(this);return w(n,n,d),b(t)}).change(),m(null,{cmd:"get-actions"},function(t){var i,a,o,d,u=e(c("#","list-admin")),p=n.createElement("li"),h=n.createElement("input"),f=n.createElement("label"),g=n.createElement("dfn"),v=n.createElement("span");for(d in t)t.hasOwnProperty(d)&&(d=s(d),u.find("#"+(o=c("!","exception_admin_"+d))).size()||((i=h.cloneNode(!1)).setAttribute("id",o),i.setAttribute("value",d),i.setAttribute("type","checkbox"),(a=p.cloneNode(!1)).appendChild(i),(i=f.cloneNode(!1)).setAttribute("for",o),i.appendChild(n.createTextNode(d)),a.appendChild(i),1&t[d]&&a.appendChild(T(g,v,r.msg[5],"lock")),2&t[d]&&a.appendChild(T(g,v,r.msg[6],"unlock")),u.append(a)));e(c(".","icon-unlock")).on("click",function(){return e(c("#","list-admin")+">li").filter(function(){return!e(this).find(".dashicons-unlock").length}).toggle(),!1}),e(c("@","exception_admin")).on("change",function(t){var n=e.grep(e(this).val().split(","),function(e){return""!==e.replace(/^\s+|\s+$/g,"")});return e(c("#","list-admin")).find("input").each(function(){var t=e(this),i=t.val();t.prop("checked",-1!==e.inArray(i,n))}),b(t)}).change(),e(c("#","list-admin")).on("click","input",function(){var t,n=e(this),i=e(c("@","exception_admin")),a=n.val(),o=e.grep(i.val().split(","),function(e){return""!==e.replace(/^\s+|\s+$/g,"")});-1===(t=e.inArray(a,o))?o.push(a):o.splice(t,1),i.val(o.join(",")).change()}),e(c(".","icon-find")).on("click",function(){var t,n,i,a,o=e(this),d=[],u=0,p=s(r.msg[8]),h=s(o.data("target"));return e(c("#","find-"+h)).empty(),o.next().children(c(".","find-desc")).show(),(o=e(c("#","list-"+h))).children("li").each(function(t,n){d.push(e(n).find("input").val())}),m("find-"+h,{cmd:"find-"+h},function(f){var g;for(g in f)f.hasOwnProperty(g)&&(++u,t=s(f[g]),g=s(g),n=e.inArray(g,d),i=c("!","exception_"+h+"_"+g),a="admin"===h?t+"="+g:"/"+t+"/"+g+"/",a='<a class="ip-geo-block-icon ip-geo-block-icon-alert" href="'+l.sites[0]+l.admin+"options-general.php?page=ip-geo-block&tab=4&s="+encodeURIComponent(a)+'" title="'+p.replace("%s",a)+'" target="_blank"><span></span></a>',n<0?(d.push(g),o.prepend('<li><input id="'+i+'" value="'+g+'" type="checkbox" '+("admin"===h?"/>":"name=ip_geo_block_settings[exception]["+h+"]["+g+"] />")+'<label for="'+i+'">'+g+"</lable>"+a+"</li>")):(i=o.find("#"+i).parent()).find("a").length||i.append(a));e(c("@","exception_"+h)).trigger("change"),e(c("#","find-"+h)).append(' <span class="ip-geo-block-warn">'+s(r.msg[7].replace("%d",u))+"</span>")}),!1})}),e('input[id^="'+c("!","validation_ajax_")+'"]').on("change",function(){x(e(this))}).change(),e(c("@","validation_public")).on("change",function(t){return P(e(this)),b(t)}).change(),e(c("@","public_matching_rule")).on("change",function(t){var n=this.value;return e(c("@","public_white_list")).closest("tr").toggle("0"===n),e(c("@","public_black_list")).closest("tr").toggle("1"===n),e(c("@","public_response_code")).change().closest("tr").toggle("-1"!==n),b(t)}).change(),e(c("@","public_behavior")).on("change",function(t){var n=e(this);return k(n.siblings("ul"),n.prop("checked")),b(t)}).change(),e(c("@","update")).on("click",function(){return m("download",{cmd:"download"},function(t){var n,i,a;for(n in t)if(t.hasOwnProperty(n))for(i in a=t[n])a.hasOwnProperty(i)&&(a[i=s(i)].filename&&e(c("@",n+"_"+i+"_path")).val(s(a[i].filename)),a[i].message&&e(c("#",n+"-"+i)).text(s(a[i].message)))}),!1}),e(c("@","restrict_api")).on("change",function(){e('input[class*="remote"]').prop("disabled",e(this).prop("checked"))}).trigger("change"),e(c("@","save_statistics")).on("change",function(){return e(c("@","validation_recdays")).prop("disabled",!e(this).prop("checked")),!1}).trigger("change"),e(c("@","validation_reclogs")).on("change",function(){var t=e(this);t.parent().parent().nextAll().find('input[id*="validation"]').prop("disabled",0===Number(t.prop("selectedIndex")))}).trigger("change"),e(c("@","cache_hold")).on("change",function(){var t=e(this).prop("checked");e('input[name*="[cache_time]"]').prop("disabled",!t),e('select[id*="login_fails"]').prop("disabled",!t)}).trigger("change"),e(c("@","comment_pos")).on("change",function(){var t=e(this);t.nextAll('input[type="text"]').prop("disabled",0===Number(t.prop("selectedIndex")))}).trigger("change"),N("validate"),e(c("#","export")).on("click",function(){if("undefined"==typeof JSON)return f(),!1;var t=d,n={};return e.each(e(this).closest("form").serializeArray(),function(e,i){-1!==i.name.indexOf(t)&&(n[i.name]=i.value)}),n[t+="[signature]"]=_(n[t]),e(c("#","export-data")).val(JSON.stringify(n)),e(c("#","export-form")).submit(),!1}),e(c("#","file-dialog")).on("change",function(e){if(void 0===t.FileReader)return f(),!1;var n,i=e.target.files[0];return i&&function(e,n){var i=new t.FileReader;i.onload=function(e){n&&n(e.target.result)},i.onerror=function(e){h("Error",e.target.error.code)},i.readAsText(e)}(i,function(e){void 0!==(e=JSON.parse(e))[n=d+"[signature]"]&&(e[n]=_(e[n])),m("export-import",{cmd:"validate",data:JSON.stringify(e)},function(e){A(e,!0)})}),!1}),e(c("#","import")).on("click",function(){return e(c("#","file-dialog")).click(),!1}),e(c("#","default")).on("click",function(){return p(r.msg[0],function(){m("pre-defined",{cmd:"import-default"},function(e){A(e,!0)})}),!1}),e(c("#","preferred")).on("click",function(){return p(r.msg[0],function(){m("pre-defined",{cmd:"import-preferred"},function(e){A(e,!1)})}),!1}),e(c("@","reset_live")).on("click",function(){return m("reset-live",{cmd:"reset-live"}),!1}),e(c("#","login-link")).on("click",function(){var t=e(this),n=c("$","primary");return t.hasClass(n)?m("login-loading",{cmd:"generate-link"},function(i){t.text(r.msg[3]),t.removeClass(n).nextAll(c(".","desc")).remove(),e('<p class="ip-geo-block-desc"></p>').appendTo(t.parent()).append(r.msg[4],'<a href="'+i.link+'" title="'+r.msg[1]+'" target=_blank>'+i.link+"</a></p>")}):p(r.msg[0],function(){m("login-loading",{cmd:"delete-link"},function(e){t.text(r.msg[2]),t.addClass(n).nextAll(c(".","desc")).remove()})}),!1}),e(c("@","init_table")).on("click",function(){return p(r.msg[0],function(){var e;m(e="init-table",{cmd:e},function(e){g(e.page,e.tab)})}),!1}),e(c("#","show-info")).on("click",function(){e(c("#","wp-info")).empty(),m("wp-info",{cmd:"show-info"},function(t){var n,i=[];for(n in t)t.hasOwnProperty(n)&&i.push("- "+n+" "+t[n]);return e(c("#","wp-info")).html('<textarea class="regular-text code" rows="'+i.length+'">'+i.join("\n")+"</textarea>").find("textarea").select(),!1})}),e('select[name^="'+d+'"]').on("change",function(){var t,n,i,a=e(this);return t=a,i=c(".","desc"),t.next(i).empty(),(n=t.children("option:selected").data("desc"))&&t.next(i).html(e.parseHTML(n)),w(a,a,d),!1}).change(),e(c(".","icon-cycle")).on("click",function(){var t,n=e(this).nextAll("li"),i=n.find(c("@","exception_admin")),a=n.find("input:checkbox").filter(":visible"),o=a.filter(":checked").length;return a.prop("checked",!o),i.length&&(o?i.val(""):(t=[],a.each(function(n,i){t.push(e(i).val())}),i.val(t.join(",")))),e(this).blur(),!1}),e(c(".","settings-folding>dfn")).on("click",function(){var t=c("drop"),n=e(this).parent();return n.children(c(".","hide")).toggle(),n.toggleClass(t+"up").toggleClass(t+"down"),n.hasClass(t+"up")&&n.children("div").hide(),!1}),e("#submit").on("click",function(){var t=e(c("@","signature")),n=t.val();return-1!==n.indexOf(",")&&t.val(_(n)),!0});break;case 1:O(a);var u=0;e(c("#","sort-slug")).on("click",function(){var t=e(this).closest("ol"),n=t.children("li");(u=!u)?n.sort(function(t,n){return e(t).text()>e(n).text()}):n.sort(function(t,n){return parseInt(e(t).text().replace(/^.*\((\d+)\)$/,"$1"),10)<=parseInt(e(n).text().replace(/^.*\((\d+)\)$/,"$1"),10)}),t.children("li").remove(),n.appendTo(t)}),e(c("@","clear_statistics")).on("click",function(){return p(r.msg[0],function(){v("statistics",null)}),!1}),e(c("@","clear_logs")).on("click",function(){return p(r.msg[0],function(){v("logs",null)}),!1}),L(a,{tableID:"statistics-cache",ajaxCMD:"restore-cache",sectionID:"section-2",targetColumn:4,columnIP:1,columnAS:3},{columns:[{title:'<input type="checkbox">'},{title:r.i18n[3]},{title:r.i18n[4]},{title:r.i18n[5]},{title:r.i18n[6]},{title:r.i18n[7]},{title:r.i18n[8]},{title:r.i18n[9]}],columnDefs:[{responsivePriority:0,targets:0},{responsivePriority:1,targets:1},{responsivePriority:2,targets:2},{responsivePriority:6,targets:3},{responsivePriority:7,targets:4},{responsivePriority:3,targets:5},{responsivePriority:4,targets:6},{responsivePriority:5,targets:7},{className:"all",targets:[0,1,2,5]}]}),N("export-cache"),e(c("#","export-cache")).on("click",function(){return e(c("#","export-form")).submit(),!1});break;case 4:var y={tableID:"validation-logs",sectionID:"section-0",targetColumn:6,columnIP:3,columnAS:5},I={columns:[{title:'<input type="checkbox">'},{title:""},{title:r.i18n[10]},{title:r.i18n[3]},{title:r.i18n[4]},{title:r.i18n[5]},{title:r.i18n[7]},{title:r.i18n[11]},{title:r.i18n[12]},{title:r.i18n[13]},{title:r.i18n[14]},{title:r.i18n[15]}],columnDefs:[{responsivePriority:11,targets:0},{responsivePriority:0,targets:1},{responsivePriority:1,targets:2},{responsivePriority:2,targets:3},{responsivePriority:3,targets:4},{responsivePriority:6,targets:5},{responsivePriority:4,targets:6},{responsivePriority:5,targets:7},{responsivePriority:7,targets:8},{responsivePriority:8,targets:9},{responsivePriority:9,targets:10},{responsivePriority:10,targets:11},{visible:!1,targets:1},{className:"all",targets:[0,2,3,4]},{className:"none",targets:[8,9,10,11]}]},R=null,z=null,M=e(c("#","live-loading")),E=null,$=function(){R&&(t.clearTimeout(R),R=null),z&&(M.removeClass(c("live-timer")),t.clearTimeout(z),z=null)},J=function(){$(),m("live-loading",{cmd:"live-start"},function(e){if(e.error)h(null,e.error);else if(e.data.length){var n,i=e.data.length;for(n=0;n<i;n++)E.row.add(e.data[n]);E.draw(!1)}R=t.setTimeout(J,1e3*r.interval)})},B=function(e,t){$(),m(null,{cmd:e||"live-stop",callback:t})},q=c(""),H=function(t,n,i){-1===n[7].indexOf("pass")?e(t).addClass(q+i+"blocked"):e(t).addClass(q+i+"passed")},V=e(c("#","live-log")),G=e(c("#","live-update"));e(c("#","validation-logs")).on("animationend",function(){return e(this).find('tr[class*="'+q+'new"]').each(function(){var t=e(this);-1!==t.prop("class").indexOf("passed")?t.addClass(q+"passed").removeClass(q+"new-passed"):t.addClass(q+"blocked").removeClass(q+"new-blocked")}),!1}),V.on("change",function(){switch(e('input[name="'+c("live-log")+'"]:checked').val()){case"start":J();break;case"pause":B("live-pause",function(){M.addClass(c("live-timer")),z=t.setTimeout(function(){$(),e(c("#","live-log-stop")).prop("checked",!0)},1e3*r.timeout)});break;case"stop":B()}}),G.on("change",function(){var t=V.closest("tr"),n=G.prop("checked");return o[a][1]=n?"o":"x",D(o),E&&E.clear().destroy(),n?(t.show().next().next().next().nextAll().hide(),y.ajaxCMD="live-stop",I.order=[1,"desc"],I.createdRow=function(e,t){H(e,t,"new-")}):(t.hide().next().next().next().nextAll().show(),y.ajaxCMD="restore-logs",I.order=[0,""],I.createdRow=function(e,t){H(e,t,"")}),e(c("#","live-log-stop")).trigger("click"),E=L(a,y,I),!1}).trigger("change"),N("export-logs"),e(c("#","export-logs")).on("click",function(){return e(c("#","export-form")).submit(),!1});break;case 2:e(t).on(c("gmap-error"),function(){m(null,{cmd:"gmap-error"},function(e){g(e.page,e.tab)})});var U=e(c("#","map"));"object"==typeof t.google?U.each(function(){e(this).GmapRS()}):U.each(function(){e(this).empty().html('<iframe src="'+r.altgmap+'?output=embed" frameborder="0" style="width:100%; height:400px; border:0" allowfullscreen></iframe>')}),e('select[id^="'+c("!","service")+'"]').on("change",function(){o[a][3]=e(this).prop("selectedIndex"),D(o)}).change(),e(c("@","get_location")).on("click",function(){var n,i=e(c("#","whois")),a=e.trim(e(c("@","ip_address")).val());if(a){if(e(c("@","anonymize")).prop("checked")){if(/[^0-9a-f\.:]/.test(a))return h(null,"illegal format."),!1;-1!==a.indexOf(".")?a=a.replace(/\.\w+$/,".0"):(-1===(a=(a=a.split(":")).splice(0,4).join(":")).indexOf("::")&&(a+="::"),a=a.replace(/:{3,}/,"::")),e(c("@","ip_address")).val(a)}i.hide().empty(),n=e.whois(a,function(t){var n,a="";for(n=0;n<t.length;++n)a+="<tr><td>"+t[n].name+"</td><td>"+t[n].value+"</td></tr>";i.html('<fieldset id="'+c("section-1")+'" class="'+c("field")+' panel panel-default" data-section="1"><legend class="panel-heading"><h3 id="'+c("whois-title")+'" class="'+c("dropdown")+'">Whois</h3></legend><div class="panel-body '+c("border")+'"><table class="'+c("table")+'">'+a+"</table></div></fieldset>").fadeIn("slow"),e(c("#","whois-title")).on("click",function(){var t=e(this);return t.parent().nextAll().toggle(),t.toggleClass(c("dropup")).toggleClass(c("dropdown")),!1})}),m("loading",{cmd:"search",ip:a,which:e(c("@","service")).val()},function(e){var n,i="",o=s(e.latitude||"0"),r=s(e.longitude||"0"),l=e.latitude||e.longitude?8:2;for(n in e)e.hasOwnProperty(n)&&(n=s(n),i+='<li><span class="'+c("title")+'">'+n+' : </span><span class="'+c("result")+'">'+s(e[n])+"</span></li>");"object"==typeof t.google?U.GmapRS("addMarker",{latitude:o,longitude:r,title:a,content:"<ul>"+i+"</ul>",show:!0,zoom:l}):U.css({height:"600px",backgroundColor:"transparent"}).empty().html('<ul style="margin-top:0; margin-left:1em;"><li><span class="'+c("title")+'">IP address : </span><span class="'+c("result")+'">'+s(a)+"</span></li>"+i+'</ul><iframe src="//maps.google.com/maps?q='+o+","+r+"&z="+l+'&output=embed" frameborder="0" style="width:100%; height:400px; border:0" allowfullscreen></iframe>')},[n])}return!1}),e(c("@","ip_address")).on("keypress",function(t){if(t.which&&13===t.which||t.keyCode&&13===t.keyCode)return e(c("@","get_location")).click(),!1}),e(c("@","ip_address")).val()&&e(c("@","get_location")).click();break;case 5:O(a),e("input[name="+c("duration")+"]:radio").on("click",function(){var t=e('div[class*="paginate"]').find('a[class*="current"]').text();o[a][2]=e(this).val()||0,o[a][3]=o[a][3]||2,o[a][4]=o[a][4]||1,D(o),S.ajaxStacked(o[a][2],o[a][3],o[a][4],t-1)}),e(c("#","open-new")).on("change",function(){var t=e(this).prop("checked");o[a][1]=t?"o":"x",D(o),e(c("#","section-0 svg")).find("a").each(function(){this.setAttribute("target",t?"_blank":"_self")})}),e(c("#","apply-layout")).on("click",function(){var t=e(c("#","select-layout"));o[a][3]=t.find('select[name="rows"] option:selected').val(),o[a][4]=t.find('select[name="cols"] option:selected').val(),D(o)}),e("ul.wp-submenu>li.wp-first-item").removeClass("current").next().addClass("current")}})}(jQuery,window,document);
admin/js/whois.js CHANGED
@@ -46,7 +46,7 @@
46
  })
47
 
48
  .done(function (data, textStatus, jqXHR) {
49
- // http://stackoverflow.com/questions/722668/traverse-all-the-nodes-of-a-json-object-tree-with-javascript#answer-722676
50
  function traverse(key, value) {
51
  if (value && typeof value === 'object') {
52
  if (value.errormessage) {
@@ -79,7 +79,7 @@
79
 
80
  if (value.link) {
81
  if ((value['referenced-type'] || false) && 'aut-num' === value['referenced-type']) {
82
- value.value += ' [ <a href="http://ipinfo.io/' + escapeHTML(value.value) + '" target=_blank>Search on ipinfo.io</a> ]';
83
  } else {
84
  value.value = '<a href="' + escapeHTML(value.link.href) + '.json" target=_blank>' + escapeHTML(value.value) + '</a>';
85
  }
46
  })
47
 
48
  .done(function (data, textStatus, jqXHR) {
49
+ // https://stackoverflow.com/questions/722668/traverse-all-the-nodes-of-a-json-object-tree-with-javascript#answer-722676
50
  function traverse(key, value) {
51
  if (value && typeof value === 'object') {
52
  if (value.errormessage) {
79
 
80
  if (value.link) {
81
  if ((value['referenced-type'] || false) && 'aut-num' === value['referenced-type']) {
82
+ value.value += ' [ <a href="https://ipinfo.io/' + escapeHTML(value.value) + '" target=_blank>Search on ipinfo.io</a> ]';
83
  } else {
84
  value.value = '<a href="' + escapeHTML(value.link.href) + '.json" target=_blank>' + escapeHTML(value.value) + '</a>';
85
  }
admin/js/whois.min.js CHANGED
@@ -5,4 +5,4 @@
5
  Copyright (c) 2016 tokkonopapa (tokkonopapa@yahoo.com)
6
  This software is released under the MIT License.
7
  */
8
- (function(g){g.extend({whois:function(l,e){function b(b){return b?b.toString().replace(/[&<>"']/g,function(b){return{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[b]}):""}var f=[];return g.ajax({url:'https://query.yahooapis.com/v1/public/yql?q=select * from xml where url="%URL%"&format=json&jsonCompat=new'.replace(/%URL%/,"https://rest.db.ripe.net/search%3fflags=no-filtering%26flags=resource%26query-string="+l),method:"GET",dataType:"json"}).done(function(c,d,e){function k(c,a){if(a&&"object"===typeof a)if(a.errormessage){var d=a.errormessage,e=d.text.split(/\n+/);f.push({name:b(d.severity),value:b(e[1].replace(/%s/,d.args.value))})}else a.href?(a.href=b(a.href),f.push({name:b(c),value:'<a href="'+a.href+'.json" target=_blank>'+a.href+"</a>"})):a.name&&a.value?(a.link?a.value=a["referenced-type"]&&"aut-num"===a["referenced-type"]?a.value+(' [ <a href="http://ipinfo.io/'+b(a.value)+'" target=_blank>Search on ipinfo.io</a> ]'):'<a href="'+b(a.link.href)+'.json" target=_blank>'+b(a.value)+"</a>":"remarks"===a.name&&(a.value=b(a.value),a.value=a.value.replace(/(https?:\/\/[^\s]+)/gi,'<a href="$1" target=_blank>$1</a>')),f.push({name:b(a.name),value:a.value})):"primary-key"!==c&&g.each(a,function(a,b){k(a,b)})}var h;c=c.query.results;d=[];for(h in c)if(c.hasOwnProperty(h)){d=c[h];break}k(null,d)}).fail(function(c,d,e){f.push({name:b(d),value:b(e)})}).always(function(){f.push({name:"copyright",value:'<a href="https://apps.db.ripe.net/search/query.html" title="Database Query - RIPE Network Coordination Centre">RIPE NCC</a>'});e&&e(f)})}})})(jQuery);
5
  Copyright (c) 2016 tokkonopapa (tokkonopapa@yahoo.com)
6
  This software is released under the MIT License.
7
  */
8
+ (function(g){g.extend({whois:function(l,e){function b(b){return b?b.toString().replace(/[&<>"']/g,function(b){return{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[b]}):""}var f=[];return g.ajax({url:'https://query.yahooapis.com/v1/public/yql?q=select * from xml where url="%URL%"&format=json&jsonCompat=new'.replace(/%URL%/,"https://rest.db.ripe.net/search%3fflags=no-filtering%26flags=resource%26query-string="+l),method:"GET",dataType:"json"}).done(function(c,d,e){function k(c,a){if(a&&"object"===typeof a)if(a.errormessage){var d=a.errormessage,e=d.text.split(/\n+/);f.push({name:b(d.severity),value:b(e[1].replace(/%s/,d.args.value))})}else a.href?(a.href=b(a.href),f.push({name:b(c),value:'<a href="'+a.href+'.json" target=_blank>'+a.href+"</a>"})):a.name&&a.value?(a.link?a.value=a["referenced-type"]&&"aut-num"===a["referenced-type"]?a.value+(' [ <a href="https://ipinfo.io/'+b(a.value)+'" target=_blank>Search on ipinfo.io</a> ]'):'<a href="'+b(a.link.href)+'.json" target=_blank>'+b(a.value)+"</a>":"remarks"===a.name&&(a.value=b(a.value),a.value=a.value.replace(/(https?:\/\/[^\s]+)/gi,'<a href="$1" target=_blank>$1</a>')),f.push({name:b(a.name),value:a.value})):"primary-key"!==c&&g.each(a,function(a,b){k(a,b)})}var h;c=c.query.results;d=[];for(h in c)if(c.hasOwnProperty(h)){d=c[h];break}k(null,d)}).fail(function(c,d,e){f.push({name:b(d),value:b(e)})}).always(function(){f.push({name:"copyright",value:'<a href="https://apps.db.ripe.net/search/query.html" title="Database Query - RIPE Network Coordination Centre">RIPE NCC</a>'});e&&e(f)})}})})(jQuery);
classes/class-ip-geo-block-actv.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
classes/class-ip-geo-block-apis.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
@@ -84,7 +84,7 @@ abstract class IP_Geo_Block_API {
84
  // build query
85
  $tmp = self::build_url( $ip, $template );
86
 
87
- // http://codex.wordpress.org/Function_Reference/wp_remote_get
88
  $res = @wp_remote_get( $tmp, $args ); // @since 2.7
89
  if ( is_wp_error( $res ) )
90
  return array( 'errorMessage' => $res->get_error_message() );
@@ -204,14 +204,14 @@ abstract class IP_Geo_Block_API {
204
  * Term of use : https://ipdata.co/terms.html
205
  * Licence fee : free
206
  * Rate limit : 1500 requests free daily
207
- * Sample URL : https://api.ipdata.co/8.8.8.8
208
  * Input type : IP address (IPv4, IPv6)
209
  * Output type : json
210
  */
211
  class IP_Geo_Block_API_Ipdataco extends IP_Geo_Block_API {
212
  protected $template = array(
213
  'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
214
- 'url' => 'https://api.ipdata.co/%API_IP%',
215
  'api' => array(
216
  '%API_FORMAT%' => 'json',
217
  ),
@@ -233,14 +233,14 @@ class IP_Geo_Block_API_Ipdataco extends IP_Geo_Block_API {
233
  * Term of use : https://ipstack.com/terms
234
  * Licence fee : free for registered user
235
  * Rate limit : 10,000 queries per month
236
- * Sample URL : http://api.ipstack.com/186.116.207.169?access_key=YOUR_ACCESS_KEY&output=json&legacy=1
237
  * Input type : IP address (IPv4, IPv6) / domain name
238
  * Output type : json, xml
239
  */
240
  class IP_Geo_Block_API_ipstack extends IP_Geo_Block_API {
241
  protected $template = array(
242
  'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
243
- 'url' => 'http://api.ipstack.com/%API_IP%?access_key=%API_KEY%&output=%API_FORMAT%&legacy=1',
244
  'api' => array(
245
  '%API_FORMAT%' => 'json',
246
  ),
@@ -305,7 +305,7 @@ class IP_Geo_Block_API_ipinfoio extends IP_Geo_Block_API {
305
  /**
306
  * Class for Nekudo
307
  *
308
- * URL : http://geoip.nekudo.com/
309
  * Term of use : https://nekudo.com/blog/new-project-shiny-geoip
310
  * Licence fee : free to use the API
311
  * Rate limit : none
@@ -406,15 +406,15 @@ class IP_Geo_Block_API_ipapicom extends IP_Geo_Block_API {
406
  * Term of use :
407
  * Licence fee : free (need to regist to get API key)
408
  * Rate limit : 2 queries/second for registered user
409
- * Sample URL : http://api.ipinfodb.com/v3/ip-city/?key=...&format=xml&ip=124.83.187.140
410
- * Sample URL : http://api.ipinfodb.com/v3/ip-country/?key=...&format=xml&ip=yahoo.co.jp
411
  * Input type : IP address (IPv4, IPv6) / domain name
412
  * Output type : json, xml
413
  */
414
  class IP_Geo_Block_API_IPInfoDB extends IP_Geo_Block_API {
415
  protected $template = array(
416
  'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
417
- 'url' => 'http://api.ipinfodb.com/v3/%API_OPTION%/?key=%API_KEY%&format=%API_FORMAT%&ip=%API_IP%',
418
  'api' => array(
419
  '%API_FORMAT%' => 'xml',
420
  '%API_OPTION%' => 'ip-city',
@@ -481,7 +481,7 @@ class IP_Geo_Block_API_Cache extends IP_Geo_Block_API {
481
  'asn' => $validate['asn' ], // @since 3.0.4
482
  'code' => $validate['code'],
483
  'auth' => $validate['auth'], // get_current_user_id() > 0
484
- 'fail' => $validate['auth'] ? 0 : $fail,
485
  'call' => $settings['save_statistics'] ? $call : 0,
486
  'last' => $last,
487
  'view' => $view,
@@ -524,12 +524,6 @@ class IP_Geo_Block_API_Cache extends IP_Geo_Block_API {
524
  class IP_Geo_Block_Provider {
525
 
526
  protected static $providers = array(
527
- 'Ipdata.co' => array(
528
- 'key' => NULL,
529
- 'type' => 'IPv4, IPv6 / free',
530
- 'link' => '<a rel="noreferrer" href="https://ipdata.co/" title="ipdata.co - IP Geolocation and Threat Data API">https://ipdata.co/</a>&nbsp;(IPv4, IPv6 / free for 1500 requests/day)',
531
- ),
532
-
533
  'ipinfo.io' => array(
534
  'key' => NULL,
535
  'type' => 'IPv4, IPv6 / free',
@@ -539,7 +533,7 @@ class IP_Geo_Block_Provider {
539
  'Nekudo' => array(
540
  'key' => NULL,
541
  'type' => 'IPv4, IPv6 / free',
542
- 'link' => '<a rel="noreferrer" href="http://geoip.nekudo.com/" title="geoip.nekudo.com | Free IP to geolocation API">http://geoip.nekudo.com/</a>&nbsp;(IPv4, IPv6 / free)',
543
  ),
544
 
545
  'GeoIPLookup' => array(
@@ -554,6 +548,12 @@ class IP_Geo_Block_Provider {
554
  'link' => '<a rel="noreferrer" href="http://ip-api.com/" title="IP-API.com - Free Geolocation API">http://ip-api.com/</a>&nbsp;(IPv4, IPv6 / free for non-commercial use)',
555
  ),
556
 
 
 
 
 
 
 
557
  'ipstack' => array(
558
  'key' => '',
559
  'type' => 'IPv4, IPv6 / free for registered user',
@@ -630,7 +630,7 @@ class IP_Geo_Block_Provider {
630
  $list = array();
631
  $providers = $settings['providers'];
632
 
633
- foreach ( self::get_providers( 'key', $rand, $cache, ! $settings['anonymize'] && $all ) as $key => $val ) {
634
  if ( ! empty( $providers[ $key ] ) || ( ! isset( $providers[ $key ] ) && NULL === $val ) )
635
  $list[] = $key;
636
  }
@@ -658,7 +658,7 @@ class IP_Geo_Block_Provider {
658
  }
659
 
660
  if ( 0 === $field )
661
- return __( 'You need to select at least one IP geolocation service. Otherwise <strong>you\'ll be blocked</strong> after the cache expires.', 'ip-geo-block' );
662
 
663
  return NULL;
664
  }
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
84
  // build query
85
  $tmp = self::build_url( $ip, $template );
86
 
87
+ // https://codex.wordpress.org/Function_Reference/wp_remote_get
88
  $res = @wp_remote_get( $tmp, $args ); // @since 2.7
89
  if ( is_wp_error( $res ) )
90
  return array( 'errorMessage' => $res->get_error_message() );
204
  * Term of use : https://ipdata.co/terms.html
205
  * Licence fee : free
206
  * Rate limit : 1500 requests free daily
207
+ * Sample URL : https://api.ipdata.co/8.8.8.8?api-key=...
208
  * Input type : IP address (IPv4, IPv6)
209
  * Output type : json
210
  */
211
  class IP_Geo_Block_API_Ipdataco extends IP_Geo_Block_API {
212
  protected $template = array(
213
  'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
214
+ 'url' => 'https://api.ipdata.co/%API_IP%?api-key=%API_KEY%',
215
  'api' => array(
216
  '%API_FORMAT%' => 'json',
217
  ),
233
  * Term of use : https://ipstack.com/terms
234
  * Licence fee : free for registered user
235
  * Rate limit : 10,000 queries per month
236
+ * Sample URL : https://api.ipstack.com/186.116.207.169?access_key=YOUR_ACCESS_KEY&output=json&legacy=1
237
  * Input type : IP address (IPv4, IPv6) / domain name
238
  * Output type : json, xml
239
  */
240
  class IP_Geo_Block_API_ipstack extends IP_Geo_Block_API {
241
  protected $template = array(
242
  'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
243
+ 'url' => 'https://api.ipstack.com/%API_IP%?access_key=%API_KEY%&output=%API_FORMAT%&legacy=1',
244
  'api' => array(
245
  '%API_FORMAT%' => 'json',
246
  ),
305
  /**
306
  * Class for Nekudo
307
  *
308
+ * URL : https://geoip.nekudo.com/
309
  * Term of use : https://nekudo.com/blog/new-project-shiny-geoip
310
  * Licence fee : free to use the API
311
  * Rate limit : none
406
  * Term of use :
407
  * Licence fee : free (need to regist to get API key)
408
  * Rate limit : 2 queries/second for registered user
409
+ * Sample URL : https://api.ipinfodb.com/v3/ip-city/?key=...&format=xml&ip=124.83.187.140
410
+ * Sample URL : https://api.ipinfodb.com/v3/ip-country/?key=...&format=xml&ip=yahoo.co.jp
411
  * Input type : IP address (IPv4, IPv6) / domain name
412
  * Output type : json, xml
413
  */
414
  class IP_Geo_Block_API_IPInfoDB extends IP_Geo_Block_API {
415
  protected $template = array(
416
  'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
417
+ 'url' => 'https://api.ipinfodb.com/v3/%API_OPTION%/?key=%API_KEY%&format=%API_FORMAT%&ip=%API_IP%',
418
  'api' => array(
419
  '%API_FORMAT%' => 'xml',
420
  '%API_OPTION%' => 'ip-city',
481
  'asn' => $validate['asn' ], // @since 3.0.4
482
  'code' => $validate['code'],
483
  'auth' => $validate['auth'], // get_current_user_id() > 0
484
+ 'fail' => $fail, // $validate['auth'] ? 0 : $fail,
485
  'call' => $settings['save_statistics'] ? $call : 0,
486
  'last' => $last,
487
  'view' => $view,
524
  class IP_Geo_Block_Provider {
525
 
526
  protected static $providers = array(
 
 
 
 
 
 
527
  'ipinfo.io' => array(
528
  'key' => NULL,
529
  'type' => 'IPv4, IPv6 / free',
533
  'Nekudo' => array(
534
  'key' => NULL,
535
  'type' => 'IPv4, IPv6 / free',
536
+ 'link' => '<a rel="noreferrer" href="https://geoip.nekudo.com/" title="geoip.nekudo.com | Free IP to geolocation API">https://geoip.nekudo.com/</a>&nbsp;(IPv4, IPv6 / free)',
537
  ),
538
 
539
  'GeoIPLookup' => array(
548
  'link' => '<a rel="noreferrer" href="http://ip-api.com/" title="IP-API.com - Free Geolocation API">http://ip-api.com/</a>&nbsp;(IPv4, IPv6 / free for non-commercial use)',
549
  ),
550
 
551
+ 'Ipdata.co' => array(
552
+ 'key' => '',
553
+ 'type' => 'IPv4, IPv6 / free',
554
+ 'link' => '<a rel="noreferrer" href="https://ipdata.co/" title="ipdata.co - IP Geolocation and Threat Data API">https://ipdata.co/</a>&nbsp;(IPv4, IPv6 / up to 1500 requests daily free for registered user)',
555
+ ),
556
+
557
  'ipstack' => array(
558
  'key' => '',
559
  'type' => 'IPv4, IPv6 / free for registered user',
630
  $list = array();
631
  $providers = $settings['providers'];
632
 
633
+ foreach ( self::get_providers( 'key', $rand, $cache, empty( $settings['restrict_api'] ) && $all ) as $key => $val ) {
634
  if ( ! empty( $providers[ $key ] ) || ( ! isset( $providers[ $key ] ) && NULL === $val ) )
635
  $list[] = $key;
636
  }
658
  }
659
 
660
  if ( 0 === $field )
661
+ return __( 'You need to select at least one IP Geolocation API. Otherwise <strong>you\'ll be blocked</strong> after the cache expires.', 'ip-geo-block' );
662
 
663
  return NULL;
664
  }
classes/class-ip-geo-block-cron.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
  require_once ABSPATH . 'wp-admin/includes/plugin.php'; // is_plugin_active_for_network() @since 3.0.0
@@ -64,6 +64,7 @@ class IP_Geo_Block_Cron {
64
  $ip = IP_Geo_Block::get_ip_address( $settings = IP_Geo_Block::get_option() );
65
  add_filter( IP_Geo_Block::PLUGIN_NAME . '-ip-addr', array( __CLASS__, 'extract_ip' ) );
66
 
 
67
  $args = IP_Geo_Block::get_request_headers( $settings );
68
 
69
  // download database files (higher priority order)
@@ -83,8 +84,7 @@ class IP_Geo_Block_Cron {
83
 
84
  // update matching rule immediately
85
  if ( $immediate && 'done' !== get_transient( IP_Geo_Block::CRON_NAME ) ) {
86
- $validate = IP_Geo_Block::get_geolocation( $ip, array( $provider ) );
87
- $validate = IP_Geo_Block::validate_country( 'cron', $validate, $settings );
88
 
89
  if ( 'ZZ' === $validate['code'] )
90
  continue;
@@ -180,8 +180,8 @@ class IP_Geo_Block_Cron {
180
  self::stop_cache_gc();
181
 
182
  IP_Geo_Block_Logs::delete_expired( array(
183
- $settings['validation']['explogs'],
184
- $settings['cache_time']
185
  ) );
186
 
187
  self::start_cache_gc( $settings );
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
  require_once ABSPATH . 'wp-admin/includes/plugin.php'; // is_plugin_active_for_network() @since 3.0.0
64
  $ip = IP_Geo_Block::get_ip_address( $settings = IP_Geo_Block::get_option() );
65
  add_filter( IP_Geo_Block::PLUGIN_NAME . '-ip-addr', array( __CLASS__, 'extract_ip' ) );
66
 
67
+ $context = IP_Geo_Block::get_instance();
68
  $args = IP_Geo_Block::get_request_headers( $settings );
69
 
70
  // download database files (higher priority order)
84
 
85
  // update matching rule immediately
86
  if ( $immediate && 'done' !== get_transient( IP_Geo_Block::CRON_NAME ) ) {
87
+ $validate = $context->validate_ip( 'admin', $settings );
 
88
 
89
  if ( 'ZZ' === $validate['code'] )
90
  continue;
180
  self::stop_cache_gc();
181
 
182
  IP_Geo_Block_Logs::delete_expired( array(
183
+ min( 365, max( 1, (int)$settings['validation']['explogs'] ) ) * DAY_IN_SECONDS,
184
+ (int)$settings['cache_time']
185
  ) );
186
 
187
  self::start_cache_gc( $settings );
classes/class-ip-geo-block-file.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @link https://codex.wordpress.org/Filesystem_API
10
  * @copyright 2013-2018 tokkonopapa
11
  */
@@ -273,7 +273,7 @@ if (0) {
273
  if ( empty( $wp_filesystem ) )
274
  return array();
275
 
276
- // http://php.net/manual/en/function.file.php#refsect1-function.file-returnvalues
277
  @ini_set( 'auto_detect_line_endings', TRUE );
278
 
279
  if ( ! $this->is_file( $file ) || ! $this->is_readable( $file ) )
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @link https://codex.wordpress.org/Filesystem_API
10
  * @copyright 2013-2018 tokkonopapa
11
  */
273
  if ( empty( $wp_filesystem ) )
274
  return array();
275
 
276
+ // https://php.net/manual/en/function.file.php#refsect1-function.file-returnvalues
277
  @ini_set( 'auto_detect_line_endings', TRUE );
278
 
279
  if ( ! $this->is_file( $file ) || ! $this->is_readable( $file ) )
classes/class-ip-geo-block-lkup.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2016-2018 tokkonopapa
10
  */
11
 
@@ -14,7 +14,7 @@ class IP_Geo_Block_Lkup {
14
  /**
15
  * Converts IP address to in_addr representation
16
  *
17
- * @link http://stackoverflow.com/questions/14459041/inet-pton-replacement-function-for-php-5-2-17-in-windows
18
  */
19
  private static function inet_pton( $ip ) {
20
  // available on Windows platforms after PHP 5.3.0, need IPv6 support by PHP
@@ -63,39 +63,14 @@ class IP_Geo_Block_Lkup {
63
  *
64
  */
65
  public static function gethostbyaddr( $ip ) {
66
- // available on Windows platforms after PHP 5.3.0
67
- if ( function_exists( 'gethostbyaddr' ) )
68
- $host = @gethostbyaddr( $ip );
69
-
70
- // if not available
71
- if ( empty( $host ) ) {
72
- if ( function_exists( 'dns_get_record' ) ) {
73
- // generate in-addr.arpa notation
74
- if ( FALSE !== filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {
75
- $ptr = implode( ".", array_reverse( explode( ".", $ip ) ) ) . ".in-addr.arpa";
76
- }
77
-
78
- elseif ( FALSE !== filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) {
79
- $ptr = self::inet_pton( $ip );
80
- $ptr = implode(".", array_reverse( str_split( bin2hex( $ptr ) ) ) ) . ".ip6.arpa";
81
- }
82
-
83
- if ( isset( $ptr ) and $ptr = @dns_get_record( $ptr, DNS_PTR ) ) {
84
- $host = $ptr[0]['target'];
85
- }
86
- }
87
- }
88
-
89
- // For compatibility with versions before PHP 5.3.0
90
- // on some operating systems, try the PEAR class Net_DNS
91
- if ( empty( $host ) ) {
92
  set_include_path( IP_GEO_BLOCK_PATH . 'includes' . PATH_SEPARATOR . get_include_path() );
93
  require_once IP_GEO_BLOCK_PATH . 'includes/Net/DNS2.php';
94
 
95
- // use google public dns
96
- $r = new Net_DNS2_Resolver(
97
- array( 'nameservers' => array( '8.8.8.8' ) )
98
- );
99
 
100
  try {
101
  $result = $r->query( $ip, 'PTR' );
@@ -107,14 +82,34 @@ class IP_Geo_Block_Lkup {
107
  if ( isset( $result->answer ) ) {
108
  foreach ( $result->answer as $obj ) {
109
  if ( 'PTR' === $obj->type ) {
110
- $host = $obj->ptrdname;
111
- break;
112
  }
113
  }
114
  }
115
  }
116
 
117
- return isset( $host ) ? $host : $ip;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
119
 
120
  }
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2016-2018 tokkonopapa
10
  */
11
 
14
  /**
15
  * Converts IP address to in_addr representation
16
  *
17
+ * @link https://stackoverflow.com/questions/14459041/inet-pton-replacement-function-for-php-5-2-17-in-windows
18
  */
19
  private static function inet_pton( $ip ) {
20
  // available on Windows platforms after PHP 5.3.0, need IPv6 support by PHP
63
  *
64
  */
65
  public static function gethostbyaddr( $ip ) {
66
+ // array( 'nameservers' => array( '8.8.8.8', '8.8.4.4' ) ) // Google public DNS
67
+ // array( 'nameservers' => array( '1.1.1.1', '1.0.0.1' ) ) // APNIC public DNS
68
+ $servers = array( 'nameservers' => apply_filters( IP_GEO_BLOCK::PLUGIN_NAME . '-dns', array() ) );
69
+ if ( ! empty( $servers['nameservers'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  set_include_path( IP_GEO_BLOCK_PATH . 'includes' . PATH_SEPARATOR . get_include_path() );
71
  require_once IP_GEO_BLOCK_PATH . 'includes/Net/DNS2.php';
72
 
73
+ $r = new Net_DNS2_Resolver( $servers );
 
 
 
74
 
75
  try {
76
  $result = $r->query( $ip, 'PTR' );
82
  if ( isset( $result->answer ) ) {
83
  foreach ( $result->answer as $obj ) {
84
  if ( 'PTR' === $obj->type ) {
85
+ return $obj->ptrdname;
 
86
  }
87
  }
88
  }
89
  }
90
 
91
+ // available on Windows platforms after PHP 5.3.0
92
+ if ( function_exists( 'gethostbyaddr' ) )
93
+ $host = @gethostbyaddr( $ip );
94
+
95
+ // if not available
96
+ if ( empty( $host ) && function_exists( 'dns_get_record' ) ) {
97
+ // generate in-addr.arpa notation
98
+ if ( FALSE !== filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {
99
+ $ptr = implode( ".", array_reverse( explode( ".", $ip ) ) ) . ".in-addr.arpa";
100
+ }
101
+
102
+ elseif ( FALSE !== filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) {
103
+ $ptr = self::inet_pton( $ip );
104
+ $ptr = implode(".", array_reverse( str_split( bin2hex( $ptr ) ) ) ) . ".ip6.arpa";
105
+ }
106
+
107
+ if ( isset( $ptr ) and $ptr = @dns_get_record( $ptr, DNS_PTR ) ) {
108
+ return $ptr[0]['target'];
109
+ }
110
+ }
111
+
112
+ return empty( $host ) ? $ip : $host;
113
  }
114
 
115
  }
classes/class-ip-geo-block-load.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2016-2018 tokkonopapa
10
  */
11
 
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2016-2018 tokkonopapa
10
  */
11
 
classes/class-ip-geo-block-logs.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
@@ -13,9 +13,12 @@
13
  define( 'IP_GEO_BLOCK_MAX_STR_LEN', 255 );
14
  define( 'IP_GEO_BLOCK_MAX_BIN_LEN', 512 );
15
 
 
 
 
 
16
  class IP_Geo_Block_Logs {
17
 
18
- const CRYPT_KEY = NONCE_KEY;
19
  const TABLE_LOGS = 'ip_geo_block_logs';
20
  const TABLE_STAT = 'ip_geo_block_stat';
21
 
@@ -30,6 +33,9 @@ class IP_Geo_Block_Logs {
30
  'daystats' => array(),
31
  );
32
 
 
 
 
33
  // SQLite for Live update
34
  private static $pdo = NULL;
35
  private static $stm = NULL;
@@ -109,7 +115,97 @@ class IP_Geo_Block_Logs {
109
  }
110
 
111
  /**
112
- * Delete
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  *
114
  */
115
  public static function delete_tables( $which = 'all' ) {
@@ -138,7 +234,7 @@ class IP_Geo_Block_Logs {
138
  return sprintf( __( 'Creating a DB table %s had failed. Once de-activate this plugin, and then activate again.', 'ip-geo-block' ), $table );
139
 
140
  $result = $wpdb->get_results( "SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table'", ARRAY_A );
141
- foreach ( $result as $col ) {
142
  if ( in_array( $col['COLUMN_NAME'], array( 'ip', 'host' ), TRUE ) && 'varbinary' !== $col['DATA_TYPE'] )
143
  return sprintf( __( 'Column type in %s unmatched. Once de-activate this plugin, and then activate again.', 'ip-geo-block' ), $table );
144
  }
@@ -177,8 +273,7 @@ class IP_Geo_Block_Logs {
177
  public static function restore_stat( $default = FALSE ) {
178
  global $wpdb;
179
  $table = $wpdb->prefix . self::TABLE_STAT;
180
-
181
- $data = $wpdb->get_results( "SELECT * FROM `$table`", ARRAY_A ) or self::error( __LINE__ );
182
  return empty( $data ) ? ( $default ? self::$default : FALSE ) : unserialize( $data[0]['data'] );
183
  }
184
 
@@ -243,7 +338,7 @@ class IP_Geo_Block_Logs {
243
  /**
244
  * Truncate string as utf8
245
  *
246
- * @see http://jetpack.wp-a2z.org/oik_api/mbstring_binary_safe_encoding/
247
  * @link https://core.trac.wordpress.org/browser/trunk/src/wp-includes/formatting.php
248
  * @link https://core.trac.wordpress.org/browser/trunk/src/wp-includes/functions.php
249
  */
@@ -336,7 +431,7 @@ class IP_Geo_Block_Logs {
336
  }
337
 
338
  $headers = self::truncate_utf8( implode( ',', $headers ) );
339
- return $anonymize ? IP_Geo_Block_Util::anonymize_ip( $headers ) : $headers;
340
  }
341
 
342
  private static function get_post_data( $hook, $validate, $settings ) {
@@ -421,8 +516,8 @@ class IP_Geo_Block_Logs {
421
  *
422
  * The absolute path to the database can be set via filter hook `ip-geo-block-live-log`.
423
  *
424
- * @see http://php.net/manual/en/pdo.connections.php
425
- * @see http://php.net/manual/en/features.persistent-connections.php
426
  * @see https://www.sqlite.org/sharedcache.html#shared_cache_and_in_memory_databases
427
  *
428
  * @param int $id ID of the blog
@@ -435,7 +530,9 @@ class IP_Geo_Block_Logs {
435
  register_shutdown_function( 'IP_Geo_Block_Logs::close_sqlite_db' );
436
 
437
  // Set data source name
438
- $id = apply_filters( IP_Geo_Block::PLUGIN_NAME . '-live-log', ($dsn ? ':memory:' : get_temp_dir() . IP_Geo_Block::PLUGIN_NAME . "-${id}.sqlite") );
 
 
439
 
440
  try {
441
  $pdo = new PDO( 'sqlite:' . $id, null, null, array(
@@ -523,11 +620,11 @@ class IP_Geo_Block_Logs {
523
 
524
  // mark if malicious upload exists
525
  if ( isset( $validate['upload'] ) )
526
- $validate['result'] .= '*';
527
 
528
  // anonymize ip address
529
  if ( $settings['anonymize'] )
530
- $validate['ip'] = preg_replace( '/\w{1,3}$/', '***', $validate['ip'] );
531
 
532
  if ( $record ) {
533
  // count the number of rows for each hook
@@ -543,29 +640,46 @@ class IP_Geo_Block_Logs {
543
  ) and $wpdb->query( $sql ) or self::error( __LINE__ );
544
 
545
  // insert into DB
546
- $sql = $wpdb->prepare(
547
- "INSERT INTO `$table`
548
- (`time`, `ip`, `asn`, `hook`, `auth`, `code`, `result`, `method`, `user_agent`, `headers`, `data`)
549
- VALUES (%d, AES_ENCRYPT(%s, %s), %s, %s, %d, %s, %s, %s, %s, AES_ENCRYPT(%s, %s), %s)",
550
- $_SERVER['REQUEST_TIME'],
551
- $validate['ip'],
552
- self::CRYPT_KEY,
553
- $validate['asn'],
554
- $hook,
555
- $validate['auth'],
556
- $validate['code'],
557
- $validate['result'],
558
- $method,
559
- $agent,
560
- $heads,
561
- self::CRYPT_KEY,
562
- $posts
563
- ) and $wpdb->query( $sql ) or self::error( __LINE__ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
 
565
  // backup logs to text files
566
- if ( $dir = apply_filters(
567
- IP_Geo_Block::PLUGIN_NAME . '-backup-dir', $settings['validation']['backup'], $hook
568
- ) ) {
569
  self::backup_logs( $hook, $validate, $method, $agent, $heads, $posts, $dir );
570
  }
571
  }
@@ -586,7 +700,7 @@ class IP_Geo_Block_Logs {
586
  self::$stm = self::$pdo->prepare( // possibly throw an PDOException
587
  'INSERT INTO ' . self::TABLE_LOGS . ' (blog_id, time, ip, asn, hook, auth, code, result, method, user_agent, headers, data) ' .
588
  'VALUES ' . ' ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);'
589
- ); // example: http://php.net/manual/en/pdo.lobs.php
590
  self::$stm->bindParam( 1, $id, PDO::PARAM_INT );
591
  self::$stm->bindParam( 2, $_SERVER['REQUEST_TIME'], PDO::PARAM_INT );
592
  self::$stm->bindParam( 3, $validate['ip'], PDO::PARAM_STR );
@@ -627,7 +741,7 @@ class IP_Geo_Block_Logs {
627
 
628
  try {
629
  self::$pdo->beginTransaction(); // possibly throw an PDOException
630
- if ( self::$stm = self::$pdo->query( "SELECT hook, time, ip, code, result, asn, method, user_agent, headers, data FROM " . self::TABLE_LOGS . " WHERE blog_id = ${id};" ) ) {
631
  $result = self::$stm->fetchAll( PDO::FETCH_NUM ); // array or FALSE
632
  self::$pdo->exec( "DELETE FROM " . self::TABLE_LOGS . " WHERE blog_id = ${id};" ); // int or FALSE
633
  }
@@ -652,14 +766,20 @@ class IP_Geo_Block_Logs {
652
  * @param string $hook type of log name
653
  * @return array log data
654
  */
655
- public static function restore_logs( $hook = NULL ) {
656
  global $wpdb;
657
  $table = $wpdb->prefix . self::TABLE_LOGS;
658
 
659
- $sql = $wpdb->prepare(
660
- "SELECT `hook`, `time`, `ip`, AES_DECRYPT(`ip`, %s), `code`, `result`, `asn`, `method`, `user_agent`, `headers`, AES_DECRYPT(`headers`, %s), `data` FROM `$table`",
661
- self::CRYPT_KEY, self::CRYPT_KEY
662
- );
 
 
 
 
 
 
663
 
664
  if ( in_array( $hook, array( 'comment', 'login', 'admin', 'xmlrpc', 'public' ), TRUE ) )
665
  $sql .= $wpdb->prepare( " WHERE `hook` = %s ORDER BY `time` DESC", $hook );
@@ -669,12 +789,15 @@ class IP_Geo_Block_Logs {
669
  $result = $sql ? $wpdb->get_results( $sql, ARRAY_N ) : array();
670
 
671
  foreach ( $result as $key => $val ) {
672
- if ( ctype_print( $result[ $key ][2] ) ) {
673
- array_splice( $result[ $key ], 3, 1 ); // remove encrypted `ip`
674
- array_splice( $result[ $key ], 9, 1 ); // remove encrypted `headers`
 
 
 
675
  } else {
676
- array_splice( $result[ $key ], 2, 1 ); // keep decrypted `ip`
677
- array_splice( $result[ $key ], 8, 1 ); // keep decrypted `headers`
678
  }
679
  }
680
 
@@ -692,15 +815,25 @@ class IP_Geo_Block_Logs {
692
  if ( $settings['anonymize'] )
693
  $ip = IP_Geo_Block_Util::anonymize_ip( $ip );
694
 
695
- $sql = $wpdb->prepare(
696
- "SELECT `time`, `ip`, AES_DECRYPT(`ip`, %s), `asn`, `hook`, `auth`, `code`, `result`, `method`, `user_agent`, `headers`, AES_DECRYPT(`headers`, %s), `data` FROM `$table` WHERE `ip` = AES_ENCRYPT(%s, %s)",
697
- self::CRYPT_KEY, self::CRYPT_KEY, $ip, self::CRYPT_KEY
698
- ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
699
 
700
- empty( $result ) and $result = array();
 
 
 
 
 
 
 
 
 
 
701
 
702
- foreach ( $result as $key => $val ) {
703
- if ( ctype_print( $result[ $key ][2] ) ) {
 
 
 
704
  array_splice( $result[ $key ], 3, 1 ); // remove encrypted `ip`
705
  array_splice( $result[ $key ], 11, 1 ); // remove encrypted `headers`
706
  } else {
@@ -725,9 +858,18 @@ class IP_Geo_Block_Logs {
725
  global $wpdb;
726
  $table = $wpdb->prefix . self::TABLE_LOGS;
727
 
 
 
728
  foreach ( array_unique( (array)$entry ) as $ip ) {
729
- $sql = $wpdb->prepare( "DELETE FROM `$table` WHERE `ip` = AES_ENCRYPT(%s, %s) OR `ip` = %s", $ip, self::CRYPT_KEY, $ip )
730
- and $result = ( FALSE !== $wpdb->query( $sql ) ) or self::error( __LINE__ );
 
 
 
 
 
 
 
731
  }
732
 
733
  return isset( $result ) ? $result : FALSE;
@@ -741,15 +883,24 @@ class IP_Geo_Block_Logs {
741
  global $wpdb;
742
  $table = $wpdb->prefix . self::TABLE_LOGS;
743
 
744
- $sql = $wpdb->prepare(
745
- "SELECT `time`, `ip`, AES_DECRYPT(`ip`, %s), `asn`, `hook`, `code`, `method`, `data` FROM `$table` WHERE `time` > %d",
746
- self::CRYPT_KEY, $_SERVER['REQUEST_TIME'] - $duration
747
- ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
748
 
749
- empty( $result ) and $result = array();
 
 
 
 
 
 
 
 
 
 
750
 
751
- foreach ( $result as $key => $val ) {
752
- if ( ctype_print( $result[ $key ][1] ) ) {
 
 
753
  array_splice( $result[ $key ], 2, 1 ); // remove encrypted `ip`
754
  } else {
755
  array_splice( $result[ $key ], 1, 1 ); // keep decrypted `ip`
@@ -774,19 +925,18 @@ class IP_Geo_Block_Logs {
774
  global $wpdb;
775
  $table = $wpdb->prefix . self::TABLE_LOGS;
776
 
777
- $result = array();
778
 
779
  $sql = $wpdb->prepare(
780
- "SELECT `time`, `ip`, AES_DECRYPT(`ip`, %s), `asn`, `hook`, `code`, `method`, `data` FROM `$table` WHERE `result` NOT LIKE '%%pass%%' AND `" . $key . "` LIKE '%%%s%%'",
781
- self::CRYPT_KEY, $search
782
  ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
783
 
784
- foreach ( $result as $key => $val ) {
785
- if ( ctype_print( $result[ $key ][1] ) ) {
786
  array_splice( $result[ $key ], 2, 1 ); // remove encrypted `ip`
787
- } else {
788
  array_splice( $result[ $key ], 1, 1 ); // keep decrypted `ip`
789
- }
790
 
791
  $result[ $key ] = array_combine(
792
  array( 'time', 'ip', 'asn', 'hook', 'code', 'method', 'data' ),
@@ -841,6 +991,10 @@ class IP_Geo_Block_Logs {
841
  public static function clear_cache() {
842
  global $wpdb;
843
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
 
 
 
 
844
  $wpdb->query( "TRUNCATE TABLE `$table`" ) or self::error( __LINE__ );
845
  }
846
 
@@ -852,14 +1006,30 @@ class IP_Geo_Block_Logs {
852
  global $wpdb;
853
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
854
 
855
- $sql = $wpdb->prepare(
856
- "SELECT `time`, `hook`, AES_DECRYPT(`ip`, %s), `asn`, `code`, `auth`, `fail`, `call`, `last`, `view`, AES_DECRYPT(`host`, %s), `ip` FROM `$table`",
857
- self::CRYPT_KEY, self::CRYPT_KEY
858
- ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
 
 
 
 
 
 
 
 
 
 
859
 
860
  // transform DB to cache format
861
  $cache = $hash = array();
862
- foreach ( (array)$result as $key => $val ) {
 
 
 
 
 
 
863
  // make the encrypted `ip` hashed so that it can be specified as a key
864
  $val = array_combine( array( 'time', 'hook', 'ip', 'asn', 'code', 'auth', 'fail', 'call', 'last', 'view', 'host', 'hash' ), $val );
865
  $val['hash'] = bin2hex( $val['hash'] );
@@ -887,12 +1057,24 @@ class IP_Geo_Block_Logs {
887
  global $wpdb;
888
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
889
 
890
- $sql = $wpdb->prepare(
891
- "SELECT `time`, `hook`, `asn`, `code`, `auth`, `fail`, `call`, `last`, `view`, AES_DECRYPT(`host`, %s) FROM `$table` WHERE `ip` = AES_ENCRYPT(%s, %s)",
892
- self::CRYPT_KEY, $ip, self::CRYPT_KEY
893
- ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
 
 
 
 
 
 
 
 
 
894
 
895
  if ( ! empty( $result[0] ) ) {
 
 
 
896
  $result[0] = array_combine( array( 'time', 'hook', 'asn', 'code', 'auth', 'fail', 'call', 'last', 'view', 'host' ), $result[0] );
897
  $result[0]['ip'] = $ip;
898
  return $result[0];
@@ -909,33 +1091,61 @@ class IP_Geo_Block_Logs {
909
  global $wpdb;
910
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
911
 
912
- $sql = $wpdb->prepare(
913
- "INSERT INTO `$table`
914
- (`time`, `hook`, `ip`, `asn`, `code`, `auth`, `fail`, `call`, `last`, `view`, `host`)
915
- VALUES (%d, %s, AES_ENCRYPT(%s, %s), %s, %s, %d, %d, %d, %d, %d, AES_ENCRYPT(%s, %s))
916
- ON DUPLICATE KEY UPDATE
917
- `time` = VALUES(`time`),
918
- `hook` = VALUES(`hook`),
919
- `auth` = VALUES(`auth`),
920
- `code` = VALUES(`code`),
921
- `fail` = VALUES(`fail`),
922
- `call` = VALUES(`call`),
923
- `last` = VALUES(`last`),
924
- `view` = VALUES(`view`)",
925
- $cache['time'],
926
- $cache['hook'],
927
- $cache['ip' ],
928
- self::CRYPT_KEY,
929
- $cache['asn' ],
930
- $cache['code'],
931
- $cache['auth'],
932
- $cache['fail'],
933
- $cache['call'],
934
- $cache['last'],
935
- $cache['view'],
936
- $cache['host'],
937
- self::CRYPT_KEY
938
- ) and $wpdb->query( $sql ) or self::error( __LINE__ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
939
  }
940
 
941
  /**
@@ -946,13 +1156,21 @@ class IP_Geo_Block_Logs {
946
  global $wpdb;
947
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
948
 
 
 
 
 
 
949
  foreach ( empty( $entry ) ? array( IP_Geo_Block::get_ip_address() ) : $entry as $ip ) {
950
  // if specified ip address is anonymized, then extract the encripted value
951
  $ip = explode( ',', $ip );
952
- if ( empty( $ip[1] ) )
953
- $sql = $wpdb->prepare( "DELETE FROM `$table` WHERE `ip` = AES_ENCRYPT(%s, %s)", $ip[0], self::CRYPT_KEY );
954
- else
 
 
955
  $sql = $wpdb->prepare( "DELETE FROM `$table` WHERE `ip` = UNHEX(%s)", $ip[1] );
 
956
 
957
  $sql and $result = ( FALSE !== $wpdb->query( $sql ) ) or self::error( __LINE__ );
958
  }
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
13
  define( 'IP_GEO_BLOCK_MAX_STR_LEN', 255 );
14
  define( 'IP_GEO_BLOCK_MAX_BIN_LEN', 512 );
15
 
16
+ // Cipher mode and type
17
+ define( 'IP_GEO_BLOCK_CIPHER_MODE', 2 ); // 0:before 3.0.13, 1:mysql default, 2:openssl
18
+ define( 'IP_GEO_BLOCK_CIPHER_TYPE', 'AES-256-CBC' ); // for openssl
19
+
20
  class IP_Geo_Block_Logs {
21
 
 
22
  const TABLE_LOGS = 'ip_geo_block_logs';
23
  const TABLE_STAT = 'ip_geo_block_stat';
24
 
33
  'daystats' => array(),
34
  );
35
 
36
+ // Cipher mode and key
37
+ private static $cipher = array();
38
+
39
  // SQLite for Live update
40
  private static $pdo = NULL;
41
  private static $stm = NULL;
115
  }
116
 
117
  /**
118
+ * Encrypts / Decrypts a string.
119
+ *
120
+ * @link https://php.net/manual/en/function.openssl-encrypt.php#119346
121
+ * @link https://mysqlserverteam.com/understand-and-satisfy-your-aes-encryption-needs-with-5-6-17/
122
+ *
123
+ * @param int $mode 0:before 3.0.12, 1:mysql default, 2:openssl
124
+ * @return array actual mode and cipher key
125
+ */
126
+ private static function cipher_mode_key( $mode = IP_GEO_BLOCK_CIPHER_MODE ) {
127
+ $mode and $mode = defined( 'OPENSSL_RAW_DATA' ) ? $mode : 1; // @since PHP 5.3.3
128
+
129
+ if ( empty( self::$cipher['mode'] ) ) {
130
+ // openssl
131
+ if ( 2 === $mode ) {
132
+ // `openssl_random_pseudo_bytes()` can not be used as an IV because of search function
133
+ self::$cipher['iv' ] = md5( NONCE_KEY . NONCE_SALT, TRUE ); // 16 bytes (128 bits)
134
+ self::$cipher['key'] = IP_Geo_Block_Util::hash_hmac(
135
+ function_exists( 'hash' ) ? 'sha256' /* 32 bytes (256 bits) */ : 'sha1' /* 20 bytes (160 bits) */,
136
+ AUTH_KEY, AUTH_SALT, TRUE
137
+ );
138
+ }
139
+
140
+ // mysql default
141
+ elseif ( 1 === $mode ) {
142
+ self::$cipher['key'] = md5( NONCE_KEY . NONCE_SALT, TRUE ); // 16 bytes (128 bits)
143
+ }
144
+
145
+ // before 3.0.12
146
+ else {
147
+ self::$cipher['key'] = NONCE_KEY;
148
+ }
149
+ }
150
+
151
+ return self::$cipher['mode'] = $mode;
152
+ }
153
+
154
+ private static function decrypt( $data ) {
155
+ return openssl_decrypt( $data, IP_GEO_BLOCK_CIPHER_TYPE, self::$cipher['key'], OPENSSL_RAW_DATA, self::$cipher['iv'] ); // @since PHP 5.3.0
156
+ }
157
+
158
+ private static function encrypt( $data ) {
159
+ return openssl_encrypt( $data, IP_GEO_BLOCK_CIPHER_TYPE, self::$cipher['key'], OPENSSL_RAW_DATA, self::$cipher['iv'] ); // @since PHP 5.3.0
160
+ }
161
+
162
+ private static function encrypt_ip( $ip ) {
163
+ return isset( self::$cipher[ $ip ] ) ? self::$cipher[ $ip ] : self::$cipher[ $ip ] = self::encrypt( $ip );
164
+ }
165
+
166
+ /**
167
+ * Upgrade
168
+ *
169
+ */
170
+ public static function upgrade( $version ) {
171
+ // delete IP address cache
172
+ self::clear_cache();
173
+
174
+ // restore logs by old format
175
+ $logs = self::restore_logs( NULL, FALSE ); // should be called before `cipher_mode_key()`
176
+
177
+ if ( 1 === ( $mode = self::cipher_mode_key() ) )
178
+ $key = bin2hex( self::$cipher['key'] );
179
+
180
+ // `No`, `hook`, `time`, `ip`, `code`, `result`, `asn`, `method`, `user_agent`, `headers`, `data`
181
+ $fields = $ips = $headers = array();
182
+ foreach ( $logs as $log ) {
183
+ if ( $log[3] ) { // if `ip` is successfully extracted
184
+ $fields[] = $log[0]; // `No`
185
+ if ( 2 === $mode ) {
186
+ $ips [] = "UNHEX('" . bin2hex( self::encrypt( $log[3] ) ) . "')"; // `ip`
187
+ $headers[] = "UNHEX('" . bin2hex( self::encrypt( $log[9] ) ) . "')"; // `headers`
188
+ } else {
189
+ $ips [] = "AES_ENCRYPT(UNHEX('" . bin2hex( $log[3] ) . "'), UNHEX('" . $key . "'))"; // `ip`
190
+ $headers[] = "AES_ENCRYPT(UNHEX('" . bin2hex( $log[9] ) . "'), UNHEX('" . $key . "'))"; // `headers`
191
+ }
192
+ }
193
+ }
194
+
195
+ // bulk update logs
196
+ if ( ! empty( $fields ) ) {
197
+ global $wpdb;
198
+ $table = $wpdb->prefix . self::TABLE_LOGS;
199
+
200
+ $sql = sprintf(
201
+ "UPDATE `$table` set `ip` = ELT(FIELD(`No`, %s), %s), `headers` = ELT(FIELD(`No`, %s), %s) WHERE `No` IN (%s)",
202
+ $fields = implode( ',', $fields ), implode( ',', $ips ), $fields, implode( ',', $headers ), $fields
203
+ ) and $wpdb->query( $sql ) or self::error( __LINE__ );
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Delete specific tables
209
  *
210
  */
211
  public static function delete_tables( $which = 'all' ) {
234
  return sprintf( __( 'Creating a DB table %s had failed. Once de-activate this plugin, and then activate again.', 'ip-geo-block' ), $table );
235
 
236
  $result = $wpdb->get_results( "SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table'", ARRAY_A );
237
+ foreach ( empty( $result ) ? array() : $result as $col ) {
238
  if ( in_array( $col['COLUMN_NAME'], array( 'ip', 'host' ), TRUE ) && 'varbinary' !== $col['DATA_TYPE'] )
239
  return sprintf( __( 'Column type in %s unmatched. Once de-activate this plugin, and then activate again.', 'ip-geo-block' ), $table );
240
  }
273
  public static function restore_stat( $default = FALSE ) {
274
  global $wpdb;
275
  $table = $wpdb->prefix . self::TABLE_STAT;
276
+ $data = $wpdb->get_results( "SELECT * FROM `$table`", ARRAY_A ) or self::error( __LINE__ );
 
277
  return empty( $data ) ? ( $default ? self::$default : FALSE ) : unserialize( $data[0]['data'] );
278
  }
279
 
338
  /**
339
  * Truncate string as utf8
340
  *
341
+ * @see https://jetpack.wp-a2z.org/oik_api/mbstring_binary_safe_encoding/
342
  * @link https://core.trac.wordpress.org/browser/trunk/src/wp-includes/formatting.php
343
  * @link https://core.trac.wordpress.org/browser/trunk/src/wp-includes/functions.php
344
  */
431
  }
432
 
433
  $headers = self::truncate_utf8( implode( ',', $headers ) );
434
+ return $anonymize ? IP_Geo_Block_Util::anonymize_ip( $headers, FALSE ) : $headers;
435
  }
436
 
437
  private static function get_post_data( $hook, $validate, $settings ) {
516
  *
517
  * The absolute path to the database can be set via filter hook `ip-geo-block-live-log`.
518
  *
519
+ * @see https://php.net/manual/en/pdo.connections.php
520
+ * @see https://php.net/manual/en/features.persistent-connections.php
521
  * @see https://www.sqlite.org/sharedcache.html#shared_cache_and_in_memory_databases
522
  *
523
  * @param int $id ID of the blog
530
  register_shutdown_function( 'IP_Geo_Block_Logs::close_sqlite_db' );
531
 
532
  // Set data source name
533
+ $id = apply_filters( IP_Geo_Block::PLUGIN_NAME . '-live-log',
534
+ ( $dsn ? ':memory:' : get_temp_dir() . IP_Geo_Block::PLUGIN_NAME . "-${id}.sqlite" )
535
+ );
536
 
537
  try {
538
  $pdo = new PDO( 'sqlite:' . $id, null, null, array(
620
 
621
  // mark if malicious upload exists
622
  if ( isset( $validate['upload'] ) )
623
+ $validate['result'] .= '^';
624
 
625
  // anonymize ip address
626
  if ( $settings['anonymize'] )
627
+ $validate['ip'] = IP_Geo_Block_Util::anonymize_ip( $validate['ip'] );
628
 
629
  if ( $record ) {
630
  // count the number of rows for each hook
640
  ) and $wpdb->query( $sql ) or self::error( __LINE__ );
641
 
642
  // insert into DB
643
+ if ( 2 === self::cipher_mode_key() ) {
644
+ $sql = $wpdb->prepare(
645
+ "INSERT INTO `$table`
646
+ (`time`, `ip`, `asn`, `hook`, `auth`, `code`, `result`, `method`, `user_agent`, `headers`, `data`)
647
+ VALUES (%d, %s, %s, %s, %d, %s, %s, %s, %s, %s, %s)",
648
+ $_SERVER['REQUEST_TIME'],
649
+ self::encrypt_ip( $validate['ip'] ),
650
+ $validate['asn'],
651
+ $hook,
652
+ $validate['auth'],
653
+ $validate['code'],
654
+ $validate['result'],
655
+ $method,
656
+ $agent,
657
+ self::encrypt( $heads ),
658
+ $posts
659
+ ) and $wpdb->query( $sql ) or self::error( __LINE__ );
660
+ } else {
661
+ $sql = $wpdb->prepare(
662
+ "INSERT INTO `$table`
663
+ (`time`, `ip`, `asn`, `hook`, `auth`, `code`, `result`, `method`, `user_agent`, `headers`, `data`)
664
+ VALUES (%d, AES_ENCRYPT(%s, %s), %s, %s, %d, %s, %s, %s, %s, AES_ENCRYPT(%s, %s), %s)",
665
+ $_SERVER['REQUEST_TIME'],
666
+ $validate['ip'],
667
+ self::$cipher['key'],
668
+ $validate['asn'],
669
+ $hook,
670
+ $validate['auth'],
671
+ $validate['code'],
672
+ $validate['result'],
673
+ $method,
674
+ $agent,
675
+ $heads,
676
+ self::$cipher['key'],
677
+ $posts
678
+ ) and $wpdb->query( $sql ) or self::error( __LINE__ );
679
+ }
680
 
681
  // backup logs to text files
682
+ if ( $dir = apply_filters( IP_Geo_Block::PLUGIN_NAME . '-backup-dir', $settings['validation']['backup'], $hook ) ) {
 
 
683
  self::backup_logs( $hook, $validate, $method, $agent, $heads, $posts, $dir );
684
  }
685
  }
700
  self::$stm = self::$pdo->prepare( // possibly throw an PDOException
701
  'INSERT INTO ' . self::TABLE_LOGS . ' (blog_id, time, ip, asn, hook, auth, code, result, method, user_agent, headers, data) ' .
702
  'VALUES ' . ' ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);'
703
+ ); // example: https://php.net/manual/en/pdo.lobs.php
704
  self::$stm->bindParam( 1, $id, PDO::PARAM_INT );
705
  self::$stm->bindParam( 2, $_SERVER['REQUEST_TIME'], PDO::PARAM_INT );
706
  self::$stm->bindParam( 3, $validate['ip'], PDO::PARAM_STR );
741
 
742
  try {
743
  self::$pdo->beginTransaction(); // possibly throw an PDOException
744
+ if ( self::$stm = self::$pdo->query( "SELECT No, hook, time, ip, code, result, asn, method, user_agent, headers, data FROM " . self::TABLE_LOGS . " WHERE blog_id = ${id};" ) ) {
745
  $result = self::$stm->fetchAll( PDO::FETCH_NUM ); // array or FALSE
746
  self::$pdo->exec( "DELETE FROM " . self::TABLE_LOGS . " WHERE blog_id = ${id};" ); // int or FALSE
747
  }
766
  * @param string $hook type of log name
767
  * @return array log data
768
  */
769
+ public static function restore_logs( $hook = NULL, $upgrade = IP_GEO_BLOCK_CIPHER_MODE ) {
770
  global $wpdb;
771
  $table = $wpdb->prefix . self::TABLE_LOGS;
772
 
773
+ $mode = self::cipher_mode_key( $upgrade );
774
+
775
+ if ( 2 === $mode ) { // openssl
776
+ $sql = "SELECT `No`, `hook`, `time`, `ip`, `code`, `result`, `asn`, `method`, `user_agent`, `headers`, `data` FROM `$table`";
777
+ } else { // mysql default
778
+ $sql = $wpdb->prepare(
779
+ "SELECT `No`, `hook`, `time`, `ip`, AES_DECRYPT(`ip`, %s), `code`, `result`, `asn`, `method`, `user_agent`, `headers`, AES_DECRYPT(`headers`, %s), `data` FROM `$table`",
780
+ self::$cipher['key'], self::$cipher['key']
781
+ );
782
+ }
783
 
784
  if ( in_array( $hook, array( 'comment', 'login', 'admin', 'xmlrpc', 'public' ), TRUE ) )
785
  $sql .= $wpdb->prepare( " WHERE `hook` = %s ORDER BY `time` DESC", $hook );
789
  $result = $sql ? $wpdb->get_results( $sql, ARRAY_N ) : array();
790
 
791
  foreach ( $result as $key => $val ) {
792
+ if ( 2 === $mode ) {
793
+ $result[ $key ][3] = self::decrypt( $val[3] );
794
+ $result[ $key ][9] = self::decrypt( $val[9] );
795
+ } elseif ( ctype_print( $result[ $key ][3] ) ) {
796
+ array_splice( $result[ $key ], 4, 1 ); // remove encrypted `ip`
797
+ array_splice( $result[ $key ], 10, 1 ); // remove encrypted `headers`
798
  } else {
799
+ array_splice( $result[ $key ], 3, 1 ); // keep decrypted `ip`
800
+ array_splice( $result[ $key ], 9, 1 ); // keep decrypted `headers`
801
  }
802
  }
803
 
815
  if ( $settings['anonymize'] )
816
  $ip = IP_Geo_Block_Util::anonymize_ip( $ip );
817
 
818
+ $mode = self::cipher_mode_key();
 
 
 
819
 
820
+ if ( 2 === $mode ) { // openssl
821
+ $sql = $wpdb->prepare(
822
+ "SELECT `time`, `ip`, `asn`, `hook`, `auth`, `code`, `result`, `method`, `user_agent`, `headers`, `data` FROM `$table` WHERE `ip` = %s",
823
+ self::encrypt_ip( $ip )
824
+ ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
825
+ } else { // mysql default
826
+ $sql = $wpdb->prepare(
827
+ "SELECT `time`, `ip`, AES_DECRYPT(`ip`, %s), `asn`, `hook`, `auth`, `code`, `result`, `method`, `user_agent`, `headers`, AES_DECRYPT(`headers`, %s), `data` FROM `$table` WHERE `ip` = AES_ENCRYPT(%s, %s)",
828
+ self::$cipher['key'], self::$cipher['key'], $ip, self::$cipher['key']
829
+ ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
830
+ }
831
 
832
+ foreach ( empty( $result ) ? array() : $result as $key => $val ) {
833
+ if ( 2 === $mode ) {
834
+ $result[ $key ][1] = self::decrypt( $val[1] );
835
+ $result[ $key ][9] = self::decrypt( $val[9] );
836
+ } elseif ( ctype_print( $result[ $key ][2] ) ) {
837
  array_splice( $result[ $key ], 3, 1 ); // remove encrypted `ip`
838
  array_splice( $result[ $key ], 11, 1 ); // remove encrypted `headers`
839
  } else {
858
  global $wpdb;
859
  $table = $wpdb->prefix . self::TABLE_LOGS;
860
 
861
+ $mode = self::cipher_mode_key();
862
+
863
  foreach ( array_unique( (array)$entry ) as $ip ) {
864
+ if ( 2 === $mode ) {
865
+ $sql = $wpdb->prepare( "DELETE FROM `$table` WHERE `ip` = %s OR `ip` = %s",
866
+ self::encrypt_ip( $ip ), $ip
867
+ ) and $result = ( FALSE !== $wpdb->query( $sql ) ) or self::error( __LINE__ );
868
+ } else {
869
+ $sql = $wpdb->prepare( "DELETE FROM `$table` WHERE `ip` = AES_ENCRYPT(%s, %s) OR `ip` = %s",
870
+ $ip, self::$cipher['key'], $ip
871
+ ) and $result = ( FALSE !== $wpdb->query( $sql ) ) or self::error( __LINE__ );
872
+ }
873
  }
874
 
875
  return isset( $result ) ? $result : FALSE;
883
  global $wpdb;
884
  $table = $wpdb->prefix . self::TABLE_LOGS;
885
 
886
+ $mode = self::cipher_mode_key();
 
 
 
887
 
888
+ if ( 2 === $mode ) {
889
+ $sql = $wpdb->prepare(
890
+ "SELECT `time`, `ip`, `asn`, `hook`, `code`, `method`, `data` FROM `$table` WHERE `time` > %d",
891
+ $_SERVER['REQUEST_TIME'] - $duration
892
+ ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
893
+ } else {
894
+ $sql = $wpdb->prepare(
895
+ "SELECT `time`, `ip`, AES_DECRYPT(`ip`, %s), `asn`, `hook`, `code`, `method`, `data` FROM `$table` WHERE `time` > %d",
896
+ self::$cipher['key'], $_SERVER['REQUEST_TIME'] - $duration
897
+ ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
898
+ }
899
 
900
+ foreach ( empty( $result ) ? array() : $result as $key => $val ) {
901
+ if ( 2 === $mode ) {
902
+ $result[ $key ][1] = self::decrypt( $val[1] );
903
+ } elseif ( ctype_print( $result[ $key ][1] ) ) {
904
  array_splice( $result[ $key ], 2, 1 ); // remove encrypted `ip`
905
  } else {
906
  array_splice( $result[ $key ], 1, 1 ); // keep decrypted `ip`
925
  global $wpdb;
926
  $table = $wpdb->prefix . self::TABLE_LOGS;
927
 
928
+ self::cipher_mode_key();
929
 
930
  $sql = $wpdb->prepare(
931
+ "SELECT `time`, `ip`, AES_DECRYPT(`ip`, %s), `asn`, `hook`, `code`, `method`, `data` FROM `$table` " .
932
+ "WHERE `result` NOT LIKE '%%pass%%' AND `" . $key . "` LIKE '%%%s%%'", self::$cipher['key'], $search
933
  ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
934
 
935
+ foreach ( empty( $result ) ? array() : $result as $key => $val ) {
936
+ if ( ctype_print( $result[ $key ][1] ) )
937
  array_splice( $result[ $key ], 2, 1 ); // remove encrypted `ip`
938
+ else
939
  array_splice( $result[ $key ], 1, 1 ); // keep decrypted `ip`
 
940
 
941
  $result[ $key ] = array_combine(
942
  array( 'time', 'ip', 'asn', 'hook', 'code', 'method', 'data' ),
991
  public static function clear_cache() {
992
  global $wpdb;
993
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
994
+
995
+ if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) )
996
+ return;
997
+
998
  $wpdb->query( "TRUNCATE TABLE `$table`" ) or self::error( __LINE__ );
999
  }
1000
 
1006
  global $wpdb;
1007
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
1008
 
1009
+ if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) )
1010
+ return;
1011
+
1012
+ $mode = self::cipher_mode_key();
1013
+
1014
+ if ( 2 === $mode ) {
1015
+ $sql = "SELECT `time`, `hook`, `ip`, `asn`, `code`, `auth`, `fail`, `call`, `last`, `view`, `host` FROM `$table`";
1016
+ $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
1017
+ } else {
1018
+ $sql = $wpdb->prepare(
1019
+ "SELECT `time`, `hook`, AES_DECRYPT(`ip`, %s), `asn`, `code`, `auth`, `fail`, `call`, `last`, `view`, AES_DECRYPT(`host`, %s), `ip` FROM `$table`",
1020
+ self::$cipher['key'], self::$cipher['key']
1021
+ ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
1022
+ }
1023
 
1024
  // transform DB to cache format
1025
  $cache = $hash = array();
1026
+ foreach ( empty( $result ) ? array() : $result as $key => $val ) {
1027
+ if ( 2 === $mode ) {
1028
+ $val[11] = $val[ 2]; // `hash`
1029
+ $val[ 2] = self::decrypt( $val[ 2] ); // `ip`
1030
+ $val[10] = self::decrypt( $val[10] ); // `host`
1031
+ }
1032
+
1033
  // make the encrypted `ip` hashed so that it can be specified as a key
1034
  $val = array_combine( array( 'time', 'hook', 'ip', 'asn', 'code', 'auth', 'fail', 'call', 'last', 'view', 'host', 'hash' ), $val );
1035
  $val['hash'] = bin2hex( $val['hash'] );
1057
  global $wpdb;
1058
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
1059
 
1060
+ $mode = self::cipher_mode_key();
1061
+
1062
+ if ( 2 === $mode ) {
1063
+ $sql = $wpdb->prepare(
1064
+ "SELECT `time`, `hook`, `asn`, `code`, `auth`, `fail`, `call`, `last`, `view`, `host` FROM `$table` " .
1065
+ "WHERE `ip` = %s", self::encrypt_ip( $ip )
1066
+ ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
1067
+ } else {
1068
+ $sql = $wpdb->prepare(
1069
+ "SELECT `time`, `hook`, `asn`, `code`, `auth`, `fail`, `call`, `last`, `view`, AES_DECRYPT(`host`, %s) FROM `$table` " .
1070
+ "WHERE `ip` = AES_ENCRYPT(%s, %s)", self::$cipher['key'], $ip, self::$cipher['key']
1071
+ ) and $result = $wpdb->get_results( $sql, ARRAY_N ) or self::error( __LINE__ );
1072
+ }
1073
 
1074
  if ( ! empty( $result[0] ) ) {
1075
+ if ( 2 === $mode )
1076
+ $result[0][9] = self::decrypt( $result[0][9] ); // decrypt `host`
1077
+
1078
  $result[0] = array_combine( array( 'time', 'hook', 'asn', 'code', 'auth', 'fail', 'call', 'last', 'view', 'host' ), $result[0] );
1079
  $result[0]['ip'] = $ip;
1080
  return $result[0];
1091
  global $wpdb;
1092
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
1093
 
1094
+ if ( 2 === self::cipher_mode_key() ) {
1095
+ $sql = $wpdb->prepare(
1096
+ "INSERT INTO `$table`
1097
+ (`time`, `hook`, `ip`, `asn`, `code`, `auth`, `fail`, `call`, `last`, `view`, `host`)
1098
+ VALUES (%d, %s, %s, %s, %s, %d, %d, %d, %d, %d, %s)
1099
+ ON DUPLICATE KEY UPDATE
1100
+ `time` = VALUES(`time`),
1101
+ `hook` = VALUES(`hook`),
1102
+ `auth` = VALUES(`auth`),
1103
+ `code` = VALUES(`code`),
1104
+ `fail` = VALUES(`fail`),
1105
+ `call` = VALUES(`call`),
1106
+ `last` = VALUES(`last`),
1107
+ `view` = VALUES(`view`)",
1108
+ $cache['time'],
1109
+ $cache['hook'],
1110
+ self::encrypt_ip( $cache['ip'] ),
1111
+ $cache['asn' ],
1112
+ $cache['code'],
1113
+ $cache['auth'],
1114
+ $cache['fail'],
1115
+ $cache['call'],
1116
+ $cache['last'],
1117
+ $cache['view'],
1118
+ self::encrypt( $cache['host'] )
1119
+ ) and $wpdb->query( $sql ) or self::error( __LINE__ );
1120
+ } else {
1121
+ $sql = $wpdb->prepare(
1122
+ "INSERT INTO `$table`
1123
+ (`time`, `hook`, `ip`, `asn`, `code`, `auth`, `fail`, `call`, `last`, `view`, `host`)
1124
+ VALUES (%d, %s, AES_ENCRYPT(%s, %s), %s, %s, %d, %d, %d, %d, %d, AES_ENCRYPT(%s, %s))
1125
+ ON DUPLICATE KEY UPDATE
1126
+ `time` = VALUES(`time`),
1127
+ `hook` = VALUES(`hook`),
1128
+ `auth` = VALUES(`auth`),
1129
+ `code` = VALUES(`code`),
1130
+ `fail` = VALUES(`fail`),
1131
+ `call` = VALUES(`call`),
1132
+ `last` = VALUES(`last`),
1133
+ `view` = VALUES(`view`)",
1134
+ $cache['time'],
1135
+ $cache['hook'],
1136
+ $cache['ip' ],
1137
+ self::$cipher['key'],
1138
+ $cache['asn' ],
1139
+ $cache['code'],
1140
+ $cache['auth'],
1141
+ $cache['fail'],
1142
+ $cache['call'],
1143
+ $cache['last'],
1144
+ $cache['view'],
1145
+ $cache['host'],
1146
+ self::$cipher['key']
1147
+ ) and $wpdb->query( $sql ) or self::error( __LINE__ );
1148
+ }
1149
  }
1150
 
1151
  /**
1156
  global $wpdb;
1157
  $table = $wpdb->prefix . IP_Geo_Block::CACHE_NAME;
1158
 
1159
+ if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) )
1160
+ return;
1161
+
1162
+ $mode = self::cipher_mode_key();
1163
+
1164
  foreach ( empty( $entry ) ? array( IP_Geo_Block::get_ip_address() ) : $entry as $ip ) {
1165
  // if specified ip address is anonymized, then extract the encripted value
1166
  $ip = explode( ',', $ip );
1167
+ if ( empty( $ip[1] ) ) {
1168
+ $sql = $wpdb->prepare( "DELETE FROM `$table` WHERE `ip` = %s",
1169
+ 2 === $mode ? self::encrypt_ip( $ip[0] ) : 'AES_ENCRYPT(' . $ip[0] . ', ' . self::$cipher['key'] . ')'
1170
+ );
1171
+ } else {
1172
  $sql = $wpdb->prepare( "DELETE FROM `$table` WHERE `ip` = UNHEX(%s)", $ip[1] );
1173
+ }
1174
 
1175
  $sql and $result = ( FALSE !== $wpdb->query( $sql ) ) or self::error( __LINE__ );
1176
  }
classes/class-ip-geo-block-opts.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
@@ -16,7 +16,7 @@ class IP_Geo_Block_Opts {
16
  *
17
  */
18
  private static $option_table = array(
19
- 'version' => '3.0.12',// Version of this table (not package)
20
  // since version 1.0
21
  'providers' => array(), // List of providers and API keys
22
  'comment' => array( // Message on the comment form
@@ -31,7 +31,7 @@ class IP_Geo_Block_Opts {
31
  'save_statistics' => TRUE, // Record validation statistics
32
  'clean_uninstall' => TRUE, // Remove all savings from DB
33
  // since version 1.1
34
- 'cache_hold' => FALSE, // Record IP address cache
35
  'cache_time' => HOUR_IN_SECONDS, // @since 3.5
36
  // since version 3.0.0
37
  'cache_time_gc' => 900, // Cache garbage collection time
@@ -45,13 +45,13 @@ class IP_Geo_Block_Opts {
45
  'ajax' => 0, // Validate on ajax/post (1:country 2:ZEP)
46
  'xmlrpc' => 1, // Validate on xmlrpc (1:country 2:close)
47
  'proxy' => NULL, // $_SERVER variables for IPs
48
- 'reclogs' => 0, // 1:blocked 2:passed 3:unauth 4:auth 5:all 6:blocked/passed
49
  'postkey' => 'action,comment,log,pwd,FILES', // Keys in $_POST, $_FILES
50
  // since version 1.3.1
51
  'maxlogs' => 500, // Max number of rows for validation logs
52
  'backup' => NULL, // Absolute path to directory for backup logs
53
- // since version 3.0.12
54
- 'explogs' => WEEK_IN_SECONDS, // expiration time for logs
55
  // since version 2.1.0
56
  'plugins' => 0, // Validate on wp-content/plugins (1:country 2:ZEP)
57
  'themes' => 0, // Validate on wp-content/themes (1:country 2:ZEP)
@@ -185,8 +185,15 @@ class IP_Geo_Block_Opts {
185
  ),
186
  // since version 3.0.10
187
  'behavior' => array(
188
- 'time' => 10, // More than 10 page view in 10 seconds
189
- 'view' => 10, // More than 10 page view in 10 seconds
 
 
 
 
 
 
 
190
  ),
191
  );
192
 
@@ -412,18 +419,23 @@ class IP_Geo_Block_Opts {
412
  IP_Geo_Block_Logs::reset_sqlite_db();
413
  }
414
 
415
- if ( version_compare( $version, '3.0.12' ) < 0 ) {
416
- $settings['validation']['maxlogs'] = $default['validation']['maxlogs'];
417
- $settings['validation']['explogs'] = $default['validation']['explogs'];
 
 
418
  }
419
 
420
- // save package version number
 
 
 
421
  $settings['version'] = IP_Geo_Block::VERSION;
422
  }
423
 
424
- // install addons for IP Geolocation database API ver. 1.1.12
425
  $providers = IP_Geo_Block_Provider::get_addons();
426
- if ( empty( $providers ) || ! $settings['api_dir'] || version_compare( $version, '3.0.9' ) < 0 )
427
  $settings['api_dir'] = self::install_api( $settings );
428
 
429
  $settings['request_ua'] = trim( str_replace( array( 'InfiniteWP' ), '', @$_SERVER['HTTP_USER_AGENT'] ) );
@@ -461,20 +473,20 @@ class IP_Geo_Block_Opts {
461
  public static function delete_api( $settings ) {
462
  require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
463
  $fs = IP_Geo_Block_FS::init( 'delete_api' );
 
464
  return $fs->delete( self::get_api_dir( $settings ), TRUE ); // $recursive = true
465
  }
466
 
467
  private static function get_api_dir( $settings ) {
468
  // wp-content
469
- $dir = empty( $settings['api_dir'] ) ? WP_CONTENT_DIR : dirname( $settings['api_dir'] );
470
 
471
  if ( ! @is_writable( $dir ) ) {
472
  // wp-content/uploads
473
  $dir = wp_upload_dir();
474
  $dir = $dir['basedir'];
475
 
476
- if ( ! @is_writable( $dir ) ) {
477
- // wp-content/plugins/ip-geo-block
478
  $dir = @is_writable( IP_GEO_BLOCK_PATH ) ? IP_GEO_BLOCK_PATH : NULL;
479
  }
480
  }
@@ -484,7 +496,7 @@ class IP_Geo_Block_Opts {
484
  ) . IP_Geo_Block::GEOAPI_NAME; // must add `ip-geo-api` for basename
485
  }
486
 
487
- // http://php.net/manual/function.copy.php#91010
488
  private static function recurse_copy( $src, $dst ) {
489
  require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
490
  $fs = IP_Geo_Block_FS::init( 'recurse_copy' );
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
16
  *
17
  */
18
  private static $option_table = array(
19
+ 'version' => '3.0.14',// Version of this table (not package)
20
  // since version 1.0
21
  'providers' => array(), // List of providers and API keys
22
  'comment' => array( // Message on the comment form
31
  'save_statistics' => TRUE, // Record validation statistics
32
  'clean_uninstall' => TRUE, // Remove all savings from DB
33
  // since version 1.1
34
+ 'cache_hold' => TRUE, // Record IP address cache
35
  'cache_time' => HOUR_IN_SECONDS, // @since 3.5
36
  // since version 3.0.0
37
  'cache_time_gc' => 900, // Cache garbage collection time
45
  'ajax' => 0, // Validate on ajax/post (1:country 2:ZEP)
46
  'xmlrpc' => 1, // Validate on xmlrpc (1:country 2:close)
47
  'proxy' => NULL, // $_SERVER variables for IPs
48
+ 'reclogs' => 1, // 1:blocked 2:passed 3:unauth 4:auth 5:all 6:blocked/passed
49
  'postkey' => 'action,comment,log,pwd,FILES', // Keys in $_POST, $_FILES
50
  // since version 1.3.1
51
  'maxlogs' => 500, // Max number of rows for validation logs
52
  'backup' => NULL, // Absolute path to directory for backup logs
53
+ // since version 3.0.13
54
+ 'explogs' => 7, // expiration time for logs [days]
55
  // since version 2.1.0
56
  'plugins' => 0, // Validate on wp-content/plugins (1:country 2:ZEP)
57
  'themes' => 0, // Validate on wp-content/themes (1:country 2:ZEP)
185
  ),
186
  // since version 3.0.10
187
  'behavior' => array(
188
+ 'view' => 7, // More than 7 page view in 5 seconds
189
+ 'time' => 5, // More than 7 page view in 5 seconds
190
+ ),
191
+ // since version 3.0.13
192
+ 'restrict_api' => TRUE, // Do not send IP address to external APIs
193
+ // since version 3.0.14
194
+ 'login_link' => array(
195
+ 'link' => NULL, // key of login link
196
+ 'hash' => NULL, // hash of 'link'
197
  ),
198
  );
199
 
419
  IP_Geo_Block_Logs::reset_sqlite_db();
420
  }
421
 
422
+ if ( version_compare( $version, '3.0.13' ) < 0 ) {
423
+ $settings['validation' ]['maxlogs'] = $default['validation']['maxlogs'];
424
+ $settings['validation' ]['explogs'] = $default['validation']['explogs'];
425
+ $settings['restrict_api'] = $settings['anonymize'];
426
+ IP_Geo_Block_Logs::upgrade( $version );
427
  }
428
 
429
+ if ( version_compare( $version, '3.0.14' ) < 0 )
430
+ $settings['login_link'] = $default['login_link'];
431
+
432
+ // update package version number
433
  $settings['version'] = IP_Geo_Block::VERSION;
434
  }
435
 
436
+ // install addons for IP Geolocation database API ver. 1.1.13
437
  $providers = IP_Geo_Block_Provider::get_addons();
438
+ if ( empty( $providers ) || ! $settings['api_dir'] || ! file_exists( $settings['api_dir'] ) || version_compare( $version, '3.0.14' ) < 0 )
439
  $settings['api_dir'] = self::install_api( $settings );
440
 
441
  $settings['request_ua'] = trim( str_replace( array( 'InfiniteWP' ), '', @$_SERVER['HTTP_USER_AGENT'] ) );
473
  public static function delete_api( $settings ) {
474
  require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
475
  $fs = IP_Geo_Block_FS::init( 'delete_api' );
476
+
477
  return $fs->delete( self::get_api_dir( $settings ), TRUE ); // $recursive = true
478
  }
479
 
480
  private static function get_api_dir( $settings ) {
481
  // wp-content
482
+ $dir = ( empty( $settings['api_dir'] ) || ! file_exists( $settings['api_dir'] ) ) ? WP_CONTENT_DIR : dirname( $settings['api_dir'] );
483
 
484
  if ( ! @is_writable( $dir ) ) {
485
  // wp-content/uploads
486
  $dir = wp_upload_dir();
487
  $dir = $dir['basedir'];
488
 
489
+ if ( ! @is_writable( $dir ) ) { // wp-content/plugins/ip-geo-block
 
490
  $dir = @is_writable( IP_GEO_BLOCK_PATH ) ? IP_GEO_BLOCK_PATH : NULL;
491
  }
492
  }
496
  ) . IP_Geo_Block::GEOAPI_NAME; // must add `ip-geo-api` for basename
497
  }
498
 
499
+ // https://php.net/manual/function.copy.php#91010
500
  private static function recurse_copy( $src, $dst ) {
501
  require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
502
  $fs = IP_Geo_Block_FS::init( 'recurse_copy' );
classes/class-ip-geo-block-util.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
@@ -19,11 +19,8 @@ class IP_Geo_Block_Util {
19
  static $offset = NULL;
20
  static $format = NULL;
21
 
22
- if ( NULL === $offset )
23
- $offset = wp_timezone_override_offset() * HOUR_IN_SECONDS;
24
-
25
- if ( NULL === $format )
26
- $format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
27
 
28
  return date_i18n( $fmt ? $fmt : $format, $timestamp ? (int)$timestamp + $offset : FALSE );
29
  }
@@ -147,7 +144,7 @@ class IP_Geo_Block_Util {
147
  /**
148
  * Convert back to string from a parsed url.
149
  *
150
- * @source http://php.net/manual/en/function.parse-url.php#106731
151
  */
152
  private static function unparse_url( $url ) {
153
  $scheme = isset( $url['scheme' ] ) ? $url['scheme' ] . '://' : '';
@@ -297,7 +294,7 @@ class IP_Geo_Block_Util {
297
  if ( function_exists( 'get_user_by' ) )
298
  return get_user_by( $field, $value );
299
 
300
- $userdata = WP_User::get_data_by( $field, $value ); // wp-includes/class-wp-user.php @since 2.0.0
301
 
302
  if ( ! $userdata )
303
  return FALSE;
@@ -308,30 +305,18 @@ class IP_Geo_Block_Util {
308
  return $user;
309
  }
310
 
311
- /**
312
- * WP alternative function for mu-plugins
313
- *
314
- * Filters whether the current request is a WordPress Ajax request.
315
- * @source wp-includes/load.php @since 4.7.0
316
- */
317
- public static function doing_ajax() {
318
- return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
319
- }
320
-
321
  /**
322
  * WP alternative function for mu-plugins
323
  *
324
  * Validates authentication cookie.
325
  * @source wp-includes/pluggable.php
326
  */
327
- public static function validate_auth_cookie( $scheme = 'logged_in' ) {
328
- static $cache_uid = NULL;
329
-
330
- if ( NULL === $cache_uid ) {
331
- $cache_uid = FALSE;
332
 
 
333
  if ( ! ( $cookie = self::parse_auth_cookie( $scheme ) ) )
334
- return FALSE;
335
 
336
  $scheme = $cookie['scheme'];
337
  $username = $cookie['username'];
@@ -340,17 +325,17 @@ class IP_Geo_Block_Util {
340
  $expired = $expiration = $cookie['expiration'];
341
 
342
  // Allow a grace period for POST and Ajax requests
343
- if ( self::doing_ajax() || 'POST' === $_SERVER['REQUEST_METHOD'] )
344
  $expired += HOUR_IN_SECONDS;
345
 
346
  // Quick check to see if an honest cookie has expired
347
  if ( $expired < time() )
348
- return FALSE;
349
 
350
- if ( ! ( $user = self::get_user_by( 'login', $username ) ) ) // wp-includes/pluggable.php @since 2.8.0
351
- return FALSE;
352
 
353
- $pass_frag = substr( $user->user_pass, 8, 4 );
354
  $key = self::hash_nonce( $username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
355
 
356
  // If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
@@ -358,16 +343,16 @@ class IP_Geo_Block_Util {
358
  $hash = self::hash_hmac( $algo, $username . '|' . $expiration . '|' . $token, $key );
359
 
360
  if ( ! self::hash_equals( $hash, $hmac ) )
361
- return FALSE;
362
-
363
- $manager = WP_Session_Tokens::get_instance( $user->ID ); // wp-includes/class-wp-session-tokens.php @since 4.0.0
364
- if ( ! $manager->verify( $token ) )
365
- return FALSE;
366
 
367
- $cache_uid = $user->ID;
 
 
 
 
368
  }
369
 
370
- return $cache_uid;
371
  }
372
 
373
  /**
@@ -384,8 +369,8 @@ class IP_Geo_Block_Util {
384
  * WP alternative function of hash_equals() for mu-plugins
385
  *
386
  * Timing attack safe string comparison.
387
- * @source http://php.net/manual/en/function.hash-equals.php#115635
388
- * @see http://php.net/manual/en/language.operators.increment.php
389
  * @see wp-includes/compat.php
390
  */
391
  private static function hash_equals( $a, $b ) {
@@ -410,9 +395,9 @@ class IP_Geo_Block_Util {
410
  * WP alternative function of hash_hmac() for mu-plugins
411
  *
412
  * Generate a keyed hash value using the HMAC method.
413
- * @source http://php.net/manual/en/function.hash-hmac.php#93440
414
  */
415
- private static function hash_hmac( $algo, $data, $key, $raw_output = FALSE ) {
416
  // PHP 5 >= 5.1.2, PECL hash >= 1.1 or wp-includes/compat.php
417
  if ( function_exists( 'hash_hmac' ) )
418
  return hash_hmac( $algo, $data, $key, $raw_output );
@@ -486,9 +471,7 @@ class IP_Geo_Block_Util {
486
 
487
  header( "Location: $location", TRUE, $status );
488
  return TRUE;
489
- }
490
-
491
- else {
492
  return FALSE;
493
  }
494
  }
@@ -596,8 +579,18 @@ class IP_Geo_Block_Util {
596
  * @source wp-includes/pluggable.php
597
  */
598
  public static function is_user_logged_in() {
599
- // possibly logged in but should be verified after 'init' hook is fired.
600
- return did_action( 'init' ) ? is_user_logged_in() : (bool)( class_exists( 'WP_Session_Tokens', FALSE ) ? self::validate_auth_cookie() : self::parse_auth_cookie() );
 
 
 
 
 
 
 
 
 
 
601
  }
602
 
603
  /**
@@ -607,18 +600,18 @@ class IP_Geo_Block_Util {
607
  * @source wp-includes/user.php
608
  */
609
  public static function get_current_user_id() {
610
- static $cache_uid = NULL;
611
-
612
- if ( NULL === $cache_uid ) {
613
- if ( ! ( $cache_uid = ( did_action( 'init' ) ? get_current_user_id() : 0 ) ) ) {
614
- $keys = preg_grep( '/wp-settings-/', array_keys( isset( $_COOKIE ) ? $_COOKIE : array() ) );
615
- if ( $val = array_shift( $keys ) ) {
616
- $cache_uid = (int)substr( $val, strrpos( $val, '-' ) + 1 ); // get numerical characters
617
- }
618
  }
619
  }
620
 
621
- return $cache_uid;
622
  }
623
 
624
  /**
@@ -628,10 +621,10 @@ class IP_Geo_Block_Util {
628
  * @source wp-includes/capabilities.php
629
  */
630
  public static function current_user_can( $capability ) {
631
- do_action( IP_Geo_Block::PLUGIN_NAME . '-check-capability', $capability );
 
632
 
633
- // possibly logged in but should be verified after 'init' hook is fired.
634
- return did_action( 'init' ) ? current_user_can( $capability ) : (bool)( class_exists( 'WP_Session_Tokens', FALSE ) ? self::validate_auth_cookie() : self::parse_auth_cookie() );
635
  }
636
 
637
  /**
@@ -694,7 +687,7 @@ class IP_Geo_Block_Util {
694
  /**
695
  * Arrange $_FILES array
696
  *
697
- * @see http://php.net/manual/features.file-upload.multiple.php#53240
698
  */
699
  public static function arrange_files( $files ) {
700
  if ( ! is_array( $files['name'] ) )
@@ -783,7 +776,6 @@ class IP_Geo_Block_Util {
783
  private static function is_IIS() {
784
  $_is_apache = ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== FALSE || strpos( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== FALSE );
785
  $_is_IIS = ! $_is_apache && ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) !== FALSE || strpos( $_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer' ) !== FALSE );
786
-
787
  return $_is_IIS ? substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) : FALSE;
788
  }
789
 
@@ -827,7 +819,7 @@ class IP_Geo_Block_Util {
827
  *
828
  * @param string $vars comma separated keys in $_SERVER for http header ('HTTP_...')
829
  * @return string $ip IP address
830
- * @link http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html
831
  * @link https://github.com/zendframework/zend-http/blob/master/src/PhpEnvironment/RemoteAddress.php
832
  */
833
  public static function get_client_ip( $vars = NULL ) {
@@ -842,7 +834,7 @@ class IP_Geo_Block_Util {
842
  }
843
  }
844
 
845
- return isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
846
  }
847
 
848
  /**
@@ -878,14 +870,14 @@ class IP_Geo_Block_Util {
878
  * 192.168.0.0/16 reserved for Private-Use Networks [RFC1918]
879
  */
880
  public static function is_private_ip( $ip ) {
881
- // http://php.net/manual/en/filter.filters.flags.php
882
  return ! filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE );
883
  }
884
 
885
  /**
886
  * Get IP address of the host server
887
  *
888
- * @link http://php.net/manual/en/reserved.variables.server.php#88418
889
  */
890
  public static function get_server_ip() {
891
  return isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : ( (int)self::is_IIS() >= 7 ?
@@ -921,8 +913,8 @@ class IP_Geo_Block_Util {
921
  $installed[ $key ] = isset( $installed[ $key ] ) ? $installed[ $key ] | $val : $val;
922
  }
923
  }
924
- unset( $installed['ip_geo_block'] );
925
 
 
926
  return $installed;
927
  }
928
 
@@ -945,56 +937,136 @@ class IP_Geo_Block_Util {
945
  * Anonymize IP address in string
946
  *
947
  */
948
- public static function anonymize_ip( $subject ) {
949
- return preg_replace(
950
- array(
951
- // loose pattern for IPv4
952
- '/([0-9]{9})[0-9]{3}([^0-9]?)/',
953
- '/([0-9]{1,3}[-\.][0-9]{1,3}[-\.][0-9]{1,3}[-\.])[0-9]+([^0-9]?)/',
954
-
955
- // loose pattern for IPv6
956
- '/((?:[0-9a-f:]+[-:]+)+)[0-9a-f\*]+([^0-9a-f]?)/i',
957
- ),
958
- '$1***$2',
959
- $subject
960
- );
961
  }
962
 
963
  /**
964
  * Load and show theme template
965
  *
966
  */
967
- private static $theme_template = NULL;
968
-
969
- public static function show_theme_template( $type, $settings ) {
970
- if ( ( $action = current_filter() ) /* @since 2.5.0 - FALSE, `plugins_loaded` or `wp` */ && (
971
- file_exists( get_stylesheet_directory() . '/' . $type . '.php' ) /* child theme */ ||
972
- file_exists( get_template_directory() . '/' . $type . '.php' ) /* parent theme */ ) ) {
973
- // keep type of theme template
974
- self::$theme_template = $type;
975
-
976
- if ( 'wp' === $action ) // action hook `wp` is too late to include the template file directly
977
- add_filter( 'template_include', 'IP_Geo_Block_Util::load_theme_template', $settings['priority'] );
978
- else
979
- add_action( 'init', 'IP_Geo_Block_Util::load_theme_template', $settings['priority'] );
 
 
 
980
 
981
- return TRUE;
982
- } else {
983
- return FALSE;
 
984
  }
 
 
985
  }
986
 
987
  public static function load_theme_template( $template = FALSE ) {
988
  global $wp_query;
989
- $wp_query->set_404(); // for stylesheet
990
- $wp_query->is_404 = ( 404 === self::$theme_template );
991
- status_header( self::$theme_template ); // @since 2.0.0
992
 
993
- if ( $template ) {
994
- return locate_template( array( self::$theme_template . '.php' ) ); // @since 2.7.0 in wp-includes/template.php
995
- } else {
996
- @include locate_template( array( self::$theme_template . '.php' ) );
997
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
998
  }
 
 
999
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1000
  }
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
19
  static $offset = NULL;
20
  static $format = NULL;
21
 
22
+ NULL === $offset and $offset = wp_timezone_override_offset() * HOUR_IN_SECONDS;
23
+ NULL === $format and $format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
 
 
 
24
 
25
  return date_i18n( $fmt ? $fmt : $format, $timestamp ? (int)$timestamp + $offset : FALSE );
26
  }
144
  /**
145
  * Convert back to string from a parsed url.
146
  *
147
+ * @source https://php.net/manual/en/function.parse-url.php#106731
148
  */
149
  private static function unparse_url( $url ) {
150
  $scheme = isset( $url['scheme' ] ) ? $url['scheme' ] . '://' : '';
294
  if ( function_exists( 'get_user_by' ) )
295
  return get_user_by( $field, $value );
296
 
297
+ $userdata = WP_User::get_data_by( $field, $value ); // wp-includes/class-wp-user.php @since 3.3.0
298
 
299
  if ( ! $userdata )
300
  return FALSE;
305
  return $user;
306
  }
307
 
 
 
 
 
 
 
 
 
 
 
308
  /**
309
  * WP alternative function for mu-plugins
310
  *
311
  * Validates authentication cookie.
312
  * @source wp-includes/pluggable.php
313
  */
314
+ private static function validate_auth_cookie( $scheme = 'logged_in' ) {
315
+ static $cache_user = NULL;
 
 
 
316
 
317
+ if ( NULL === $cache_user ) {
318
  if ( ! ( $cookie = self::parse_auth_cookie( $scheme ) ) )
319
+ return $cache_user = FALSE;
320
 
321
  $scheme = $cookie['scheme'];
322
  $username = $cookie['username'];
325
  $expired = $expiration = $cookie['expiration'];
326
 
327
  // Allow a grace period for POST and Ajax requests
328
+ if ( defined( 'DOING_AJAX' ) || 'POST' === $_SERVER['REQUEST_METHOD'] )
329
  $expired += HOUR_IN_SECONDS;
330
 
331
  // Quick check to see if an honest cookie has expired
332
  if ( $expired < time() )
333
+ return $cache_user = FALSE;
334
 
335
+ if ( ! ( $cache_user = self::get_user_by( 'login', $username ) ) ) // wp-includes/pluggable.php @since 2.8.0
336
+ return $cache_user = FALSE;
337
 
338
+ $pass_frag = substr( $cache_user->user_pass, 8, 4 );
339
  $key = self::hash_nonce( $username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
340
 
341
  // If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
343
  $hash = self::hash_hmac( $algo, $username . '|' . $expiration . '|' . $token, $key );
344
 
345
  if ( ! self::hash_equals( $hash, $hmac ) )
346
+ return $cache_user = FALSE;
 
 
 
 
347
 
348
+ if ( class_exists( 'WP_Session_Tokens', FALSE ) ) { // @since 4.0.0
349
+ $manager = WP_Session_Tokens::get_instance( $cache_user->ID );
350
+ if ( ! $manager->verify( $token ) )
351
+ return $cache_user = FALSE;
352
+ }
353
  }
354
 
355
+ return $cache_user;
356
  }
357
 
358
  /**
369
  * WP alternative function of hash_equals() for mu-plugins
370
  *
371
  * Timing attack safe string comparison.
372
+ * @source https://php.net/manual/en/function.hash-equals.php#115635
373
+ * @see https://php.net/manual/en/language.operators.increment.php
374
  * @see wp-includes/compat.php
375
  */
376
  private static function hash_equals( $a, $b ) {
395
  * WP alternative function of hash_hmac() for mu-plugins
396
  *
397
  * Generate a keyed hash value using the HMAC method.
398
+ * @source https://php.net/manual/en/function.hash-hmac.php#93440
399
  */
400
+ public static function hash_hmac( $algo, $data, $key, $raw_output = FALSE ) {
401
  // PHP 5 >= 5.1.2, PECL hash >= 1.1 or wp-includes/compat.php
402
  if ( function_exists( 'hash_hmac' ) )
403
  return hash_hmac( $algo, $data, $key, $raw_output );
471
 
472
  header( "Location: $location", TRUE, $status );
473
  return TRUE;
474
+ } else {
 
 
475
  return FALSE;
476
  }
477
  }
579
  * @source wp-includes/pluggable.php
580
  */
581
  public static function is_user_logged_in() {
582
+ static $logged_in = NULL;
583
+
584
+ if ( NULL === $logged_in ) {
585
+ if ( did_action( 'init' ) ) {
586
+ $logged_in = is_user_logged_in(); // @since 2.0.0
587
+ } else {
588
+ $user = self::validate_auth_cookie();
589
+ $logged_in = $user ? $user->exists() : FALSE; // @since 3.4.0
590
+ }
591
+ }
592
+
593
+ return $logged_in;
594
  }
595
 
596
  /**
600
  * @source wp-includes/user.php
601
  */
602
  public static function get_current_user_id() {
603
+ static $user_id = NULL;
604
+
605
+ if ( NULL === $user_id ) {
606
+ if ( did_action( 'init' ) ) {
607
+ $user_id = get_current_user_id(); // @since MU 3.0.0
608
+ } else {
609
+ $user = self::validate_auth_cookie();
610
+ $user_id = $user ? $user->ID : 0; // @since 2.0.0
611
  }
612
  }
613
 
614
+ return $user_id;
615
  }
616
 
617
  /**
621
  * @source wp-includes/capabilities.php
622
  */
623
  public static function current_user_can( $capability ) {
624
+ if ( did_action( 'init' ) )
625
+ return current_user_can( $capability ); // @since 2.0.0
626
 
627
+ return ( $user = self::validate_auth_cookie() ) ? $user->has_cap( $capability ) : FALSE; // @since 2.0.0
 
628
  }
629
 
630
  /**
687
  /**
688
  * Arrange $_FILES array
689
  *
690
+ * @see https://php.net/manual/features.file-upload.multiple.php#53240
691
  */
692
  public static function arrange_files( $files ) {
693
  if ( ! is_array( $files['name'] ) )
776
  private static function is_IIS() {
777
  $_is_apache = ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== FALSE || strpos( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== FALSE );
778
  $_is_IIS = ! $_is_apache && ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) !== FALSE || strpos( $_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer' ) !== FALSE );
 
779
  return $_is_IIS ? substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) : FALSE;
780
  }
781
 
819
  *
820
  * @param string $vars comma separated keys in $_SERVER for http header ('HTTP_...')
821
  * @return string $ip IP address
822
+ * @link https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html
823
  * @link https://github.com/zendframework/zend-http/blob/master/src/PhpEnvironment/RemoteAddress.php
824
  */
825
  public static function get_client_ip( $vars = NULL ) {
834
  }
835
  }
836
 
837
+ return isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; // for CLI
838
  }
839
 
840
  /**
870
  * 192.168.0.0/16 reserved for Private-Use Networks [RFC1918]
871
  */
872
  public static function is_private_ip( $ip ) {
873
+ // https://php.net/manual/en/filter.filters.flags.php
874
  return ! filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE );
875
  }
876
 
877
  /**
878
  * Get IP address of the host server
879
  *
880
+ * @link https://php.net/manual/en/reserved.variables.server.php#88418
881
  */
882
  public static function get_server_ip() {
883
  return isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : ( (int)self::is_IIS() >= 7 ?
913
  $installed[ $key ] = isset( $installed[ $key ] ) ? $installed[ $key ] | $val : $val;
914
  }
915
  }
 
916
 
917
+ unset( $installed['ip_geo_block'] );
918
  return $installed;
919
  }
920
 
937
  * Anonymize IP address in string
938
  *
939
  */
940
+ public static function anonymize_ip( $subject, $strict = TRUE ) {
941
+ return $strict ?
942
+ preg_replace( '/(:)*[0-9a-f\*]{0,4}$/', '$1***', $subject, 1 ) :
943
+ preg_replace(
944
+ array(
945
+ '/([0-9a-f]{3,})[0-9a-f]{3,}/', // loose pattern for IPv[4|6]
946
+ '/((?:[0-9]{1,3}[-_x\.]){3,})[0-9]+/', // loose pattern for IPv4
947
+ '/((?:[0-9a-f]+[-:]+)+)[0-9a-f:\*]{2,}/', // loose pattern for IPv6
948
+ ),
949
+ '$1***',
950
+ $subject
951
+ );
 
952
  }
953
 
954
  /**
955
  * Load and show theme template
956
  *
957
  */
958
+ private static $theme_template = array();
959
+
960
+ public static function show_theme_template( $code, $settings ) {
961
+ if ( file_exists( $file = get_stylesheet_directory() . '/' . $code . '.php' ) /* child theme */ ||
962
+ file_exists( $file = get_template_directory() . '/' . $code . '.php' ) /* parent theme */ ) {
963
+ // keep the response code and the template file
964
+ self::$theme_template = array( 'code' => $code, 'file' => $file );
965
+
966
+ // case 1: validation timing is `init`
967
+ if ( $action = current_filter() ) { // `plugins_loaded`, `wp` or FALSE
968
+ add_action( // `wp` (on front-end target) is too late to apply `init`
969
+ 'wp' === $action ? 'template_redirect' : 'init',
970
+ 'IP_Geo_Block_Util::load_theme_template', $settings['priority']
971
+ );
972
+ return TRUE; // load template at the specified action
973
+ }
974
 
975
+ // case 2: validation timing is `mu-plugins`
976
+ elseif ( '<?php' !== file_get_contents( $file, FALSE, NULL, 0, 5 ) ) {
977
+ self::load_theme_template(); // load template and die immediately
978
+ }
979
  }
980
+
981
+ return FALSE; // die with wp_die() immediately
982
  }
983
 
984
  public static function load_theme_template( $template = FALSE ) {
985
  global $wp_query;
986
+ if ( $wp_query )
987
+ $wp_query->set_404(); // for stylesheet
 
988
 
989
+ status_header( self::$theme_template['code'] ); // @since 2.0.0
990
+
991
+ // avoid loading template for HEAD requests because of performance bump. See #14348.
992
+ 'HEAD' !== $_SERVER['REQUEST_METHOD'] and include self::$theme_template['file'];
993
+ exit;
994
+ }
995
+
996
+ /**
997
+ * Generates cryptographically secure pseudo-random bytes
998
+ *
999
+ */
1000
+ private static function random_bytes( $length = 64 ) {
1001
+ if ( PHP_VERSION_ID < 70000 )
1002
+ require_once IP_GEO_BLOCK_PATH . 'includes/random_compat/random.php';
1003
+
1004
+ // align length
1005
+ $length = max( 64, $length ) - ( $length % 2 );
1006
+
1007
+ try {
1008
+ $str = bin2hex( random_bytes( $length / 2 ) );
1009
+ } catch ( TypeError $e ) {
1010
+ $str = NULL;
1011
+ } catch ( Exception $e ) {
1012
+ $str = NULL;
1013
+ }
1014
+
1015
+ if ( empty( $str ) && function_exists( 'openssl_random_pseudo_bytes' ) )
1016
+ $str = bin2hex( openssl_random_pseudo_bytes( $length / 2 ) );
1017
+
1018
+ if ( empty( $str ) ) {
1019
+ for( $i = 0; $i < $length; $i++ ) {
1020
+ $str .= chr( ( mt_rand( 1, 36 ) <= 26 ) ? mt_rand( 97, 122 ) : mt_rand( 48, 57 ) );
1021
+ }
1022
  }
1023
+
1024
+ return $str;
1025
  }
1026
+
1027
+ /**
1028
+ * Manipulate emergency login link
1029
+ *
1030
+ */
1031
+ private static function hash_link( $link ) {
1032
+ return self::hash_hmac(
1033
+ function_exists( 'hash' ) ? 'sha256' /* 32 bytes (256 bits) */ : 'sha1' /* 20 bytes (160 bits) */,
1034
+ $link, NONCE_SALT, TRUE
1035
+ );
1036
+ }
1037
+
1038
+ public static function generate_link() {
1039
+ $link = self::random_bytes();
1040
+ $hash = bin2hex( self::hash_link( $link ) );
1041
+
1042
+ /**
1043
+ * Verify the consistency of `self::hash_hmac()`
1044
+ * key from external: self::verify_link( $link )
1045
+ * key from internal: self::verify_link( 'link', 'hash' )
1046
+ */
1047
+ $settings = IP_Geo_Block::get_option();
1048
+ $settings['login_link'] = array(
1049
+ 'link' => $hash,
1050
+ 'hash' => bin2hex( self::hash_link( $hash ) ),
1051
+ );
1052
+
1053
+ update_option( IP_Geo_Block::OPTION_NAME, $settings );
1054
+ return add_query_arg( IP_Geo_Block::PLUGIN_NAME . '-key', $link, wp_login_url() );
1055
+ }
1056
+
1057
+ public static function delete_link() {
1058
+ $settings = IP_Geo_Block::get_option();
1059
+ $settings['login_link'] = array( 'link' => NULL, 'hash' => NULL );
1060
+ update_option( IP_Geo_Block::OPTION_NAME, $settings );
1061
+ }
1062
+
1063
+ public static function get_link() {
1064
+ $settings = IP_Geo_Block::get_option();
1065
+ return $settings['login_link']['link'] ? $settings['login_link']['link'] : FALSE;
1066
+ }
1067
+
1068
+ public static function verify_link( $link, $hash = NULL ) {
1069
+ return self::hash_equals( self::hash_link( $link ), pack( 'H*', $hash ? $hash : self::get_link() ) ); // hex2bin() for PHP 5.4+
1070
+ }
1071
+
1072
  }
classes/class-ip-geo-block.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
- * @link http://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
@@ -15,7 +15,7 @@ class IP_Geo_Block {
15
  * Unique identifier for this plugin.
16
  *
17
  */
18
- const VERSION = '3.0.12.1';
19
  const GEOAPI_NAME = 'ip-geo-api';
20
  const PLUGIN_NAME = 'ip-geo-block';
21
  const OPTION_NAME = 'ip_geo_block_settings';
@@ -153,18 +153,6 @@ class IP_Geo_Block {
153
  // force to redirect on logout to remove nonce, embed a nonce into pages
154
  add_filter( 'wp_redirect', array( $this, 'logout_redirect' ), 20, 2 ); // logout_redirect @4.2
155
  add_filter( 'http_request_args', array( $this, 'request_nonce' ), $priority, 2 ); // @since 2.7.0
156
-
157
- // Hotfix: https://blog.ripstech.com/2018/wordpress-file-delete-to-code-execution/
158
- add_filter( 'wp_update_attachment_metadata', array( $this, 'unlink_tempfix' ), $priority );
159
- }
160
-
161
- // Hotfix: WordPress File Delete to Code Execution
162
- function unlink_tempfix( $data ) {
163
- if( isset( $data['thumb'] ) ) {
164
- $data['thumb'] = basename( $data['thumb'] );
165
- }
166
-
167
- return $data;
168
  }
169
 
170
  /**
@@ -194,7 +182,7 @@ class IP_Geo_Block {
194
 
195
  // get optional values from wp options
196
  public static function get_option() {
197
- return FALSE !== ( $option = get_option( self::OPTION_NAME ) ) ? $option : self::get_default();
198
  }
199
 
200
  // get the WordPress path of validation target
@@ -247,7 +235,7 @@ class IP_Geo_Block {
247
  /**
248
  * Setup the http header.
249
  *
250
- * @see http://codex.wordpress.org/Function_Reference/wp_remote_get
251
  */
252
  public static function get_request_headers( $settings ) {
253
  return apply_filters( self::PLUGIN_NAME . '-headers', array(
@@ -279,8 +267,9 @@ class IP_Geo_Block {
279
  * Return true if the validation result is passed.
280
  *
281
  */
282
- public static function is_passed ( $result ) { return 0 === strncmp( 'pass', $result, 4 ); }
283
- public static function is_blocked( $result ) { return 0 !== strncmp( 'pass', $result, 4 ); }
 
284
 
285
  /**
286
  * Build a validation result for the current user.
@@ -454,12 +443,12 @@ class IP_Geo_Block {
454
  // 9 check_behavior (high), check_ua (low)
455
  // priority low 10 check_page (high), validate_country (low)
456
  $var = self::PLUGIN_NAME . '-' . $hook;
457
- $settings['validation' ]['mimetype' ] and add_filter( $var, array( $this, 'check_upload' ), 5, 2 );
458
- $check_auth and add_filter( $var, array( $this, 'check_auth' ), 6, 2 );
459
  $settings['extra_ips' ] = apply_filters( self::PLUGIN_NAME . '-extra-ips', $settings['extra_ips'], $hook );
460
- $settings['extra_ips' ]['black_list'] and add_filter( $var, array( $this, 'check_ips_black' ), 7, 2 );
461
- $settings['extra_ips' ]['white_list'] and add_filter( $var, array( $this, 'check_ips_white' ), 7, 2 );
462
- $settings['login_fails'] >= 0 and add_filter( $var, array( $this, 'check_fail' ), 8, 2 );
463
 
464
  // make valid provider name list
465
  $providers = IP_Geo_Block_Provider::get_valid_providers( $settings );
@@ -544,22 +533,38 @@ class IP_Geo_Block {
544
  * Validate on login.
545
  *
546
  */
 
 
 
 
 
 
 
547
  public function validate_login() {
548
  // parse action
549
  $action = isset( $_GET['key'] ) ? 'resetpass' : ( isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login' );
550
  $action = 'retrievepassword' === $action ? 'lostpassword' : ( 'rp' === $action ? 'resetpass' : $action );
551
-
552
  $settings = self::get_option();
553
- $list = $settings['login_action'];
554
 
555
  // the same rule should be applied to login and logout
556
- ! empty( $list['login'] ) and $list['logout'] = TRUE;
557
 
558
  // avoid conflict with WP Limit Login Attempts (wp-includes/pluggable.php @since 2.5.0)
559
  ! empty( $_POST ) and add_action( 'wp_login_failed', array( $this, 'auth_fail' ), $settings['priority'] );
560
 
 
 
 
 
 
 
 
 
 
 
 
561
  // enables to skip validation of country on login/out except BuddyPress signup
562
- $this->validate_ip( 'login', $settings, ! empty( $list[ $action ] ) || 'bp_' === substr( current_filter(), 0, 3 ) );
563
  }
564
 
565
  /**
@@ -569,7 +574,6 @@ class IP_Geo_Block {
569
  private function check_exceptions( $action, $page, $exceptions = array() ) {
570
  $in_action = in_array( $action, $exceptions, TRUE );
571
  $in_page = in_array( $page, $exceptions, TRUE );
572
-
573
  return ( ( $action xor $page ) && ( ! $in_action and ! $in_page ) ) ||
574
  ( ( $action and $page ) && ( ! $in_action or ! $in_page ) ) ? FALSE : TRUE;
575
  }
@@ -607,8 +611,8 @@ class IP_Geo_Block {
607
  $list = array_merge( apply_filters( self::PLUGIN_NAME . '-bypass-admins', array(), $settings ), array(
608
  // in wp-admin js/widget.js, includes/template.php, async-upload.php, plugins.php, PHP Compatibility Checker
609
  'heartbeat', 'save-widget', 'wp-compression-test', 'upload-attachment', 'deactivate', 'imgedit-preview', 'wpephpcompat_start_test',
610
- // bbPress, Anti-Malware Security and Brute-Force Firewall, Jetpack page & action
611
- 'bp_avatar_upload', 'GOTMLS_logintime', 'jetpack', 'authorize', 'jetpack_modules', 'atd_settings', 'bulk-activate', 'bulk-deactivate',
612
  ) );
613
 
614
  // skip validation of country code and WP-ZEP if exceptions matches action or page
@@ -878,9 +882,9 @@ class IP_Geo_Block {
878
  public function check_behavior( $validate, $settings ) {
879
  // check if page view with a short period time is under the threshold
880
  $cache = IP_Geo_Block_API_Cache::get_cache( self::$remote_addr );
881
- if ( $cache && $cache['view'] >= $settings['behavior']['view'] && $_SERVER['REQUEST_TIME'] - $cache['last'] <= $settings['behavior']['time'] ) {
 
882
  return $validate + array( 'result' => 'badbot' ); // can't overwrite existing result
883
- }
884
 
885
  return $validate;
886
  }
5
  * @package IP_Geo_Block
6
  * @author tokkonopapa <tokkonopapa@yahoo.com>
7
  * @license GPL-3.0
8
+ * @link https://www.ipgeoblock.com/
9
  * @copyright 2013-2018 tokkonopapa
10
  */
11
 
15
  * Unique identifier for this plugin.
16
  *
17
  */
18
+ const VERSION = '3.0.14';
19
  const GEOAPI_NAME = 'ip-geo-api';
20
  const PLUGIN_NAME = 'ip-geo-block';
21
  const OPTION_NAME = 'ip_geo_block_settings';
153
  // force to redirect on logout to remove nonce, embed a nonce into pages
154
  add_filter( 'wp_redirect', array( $this, 'logout_redirect' ), 20, 2 ); // logout_redirect @4.2
155
  add_filter( 'http_request_args', array( $this, 'request_nonce' ), $priority, 2 ); // @since 2.7.0
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
157
 
158
  /**
182
 
183
  // get optional values from wp options
184
  public static function get_option() {
185
+ return ( $option = get_option( self::OPTION_NAME ) ) ? $option : self::get_default();
186
  }
187
 
188
  // get the WordPress path of validation target
235
  /**
236
  * Setup the http header.
237
  *
238
+ * @see https://codex.wordpress.org/Function_Reference/wp_remote_get
239
  */
240
  public static function get_request_headers( $settings ) {
241
  return apply_filters( self::PLUGIN_NAME . '-headers', array(
267
  * Return true if the validation result is passed.
268
  *
269
  */
270
+ public static function is_passed ( $result ) { return 0 === strncmp( 'pass', $result, 4 ); }
271
+ public static function is_blocked( $result ) { return 0 !== strncmp( 'pass', $result, 4 ); }
272
+ public static function is_listed ( $code, $list ) { return FALSE !== strpos( $list, (string)$code ); }
273
 
274
  /**
275
  * Build a validation result for the current user.
443
  // 9 check_behavior (high), check_ua (low)
444
  // priority low 10 check_page (high), validate_country (low)
445
  $var = self::PLUGIN_NAME . '-' . $hook;
446
+ $settings['validation' ]['mimetype' ] and add_filter( $var, array( $this, 'check_upload' ), 5, 2 );
447
+ $check_auth and add_filter( $var, array( $this, 'check_auth' ), 6, 2 );
448
  $settings['extra_ips' ] = apply_filters( self::PLUGIN_NAME . '-extra-ips', $settings['extra_ips'], $hook );
449
+ $settings['extra_ips' ]['black_list'] and add_filter( $var, array( $this, 'check_ips_black' ), 7, 2 );
450
+ $settings['extra_ips' ]['white_list'] and add_filter( $var, array( $this, 'check_ips_white' ), 7, 2 );
451
+ $settings['login_fails'] >= 0 && $block and add_filter( $var, array( $this, 'check_fail' ), 8, 2 );
452
 
453
  // make valid provider name list
454
  $providers = IP_Geo_Block_Provider::get_valid_providers( $settings );
533
  * Validate on login.
534
  *
535
  */
536
+ public function filter_login_url( $url, $path, $scheme, $blog_id ) {
537
+ if ( isset( $this->login_key ) && FALSE !== strpos( $url, $this->request_uri ) )
538
+ $url = esc_url( add_query_arg( self::PLUGIN_NAME . '-key', $this->login_key, $url ) );
539
+
540
+ return $url;
541
+ }
542
+
543
  public function validate_login() {
544
  // parse action
545
  $action = isset( $_GET['key'] ) ? 'resetpass' : ( isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login' );
546
  $action = 'retrievepassword' === $action ? 'lostpassword' : ( 'rp' === $action ? 'resetpass' : $action );
 
547
  $settings = self::get_option();
 
548
 
549
  // the same rule should be applied to login and logout
550
+ ! empty( $settings['login_action']['login'] ) and $settings['login_action']['logout'] = TRUE;
551
 
552
  // avoid conflict with WP Limit Login Attempts (wp-includes/pluggable.php @since 2.5.0)
553
  ! empty( $_POST ) and add_action( 'wp_login_failed', array( $this, 'auth_fail' ), $settings['priority'] );
554
 
555
+ // verify emergency login key
556
+ if ( 'login' === $action && ! empty( $_REQUEST[ self::PLUGIN_NAME . '-key' ] ) &&
557
+ IP_Geo_Block_Util::verify_link( $_REQUEST[ self::PLUGIN_NAME . '-key' ] ) ) {
558
+ $this->login_key = sanitize_key( $_REQUEST[ self::PLUGIN_NAME . '-key' ] );
559
+
560
+ // add the verified key to the url in login form
561
+ has_filter( 'site_url', array( $this, 'filter_login_url' ) ) or
562
+ add_filter( 'site_url', array( $this, 'filter_login_url' ), 10, 4 );
563
+ $settings['login_action']['login'] = FALSE; // skip blocking in validate_ip()
564
+ }
565
+
566
  // enables to skip validation of country on login/out except BuddyPress signup
567
+ $this->validate_ip( 'login', $settings, ! empty( $settings['login_action'][ $action ] ) || 'bp_' === substr( current_filter(), 0, 3 ) );
568
  }
569
 
570
  /**
574
  private function check_exceptions( $action, $page, $exceptions = array() ) {
575
  $in_action = in_array( $action, $exceptions, TRUE );
576
  $in_page = in_array( $page, $exceptions, TRUE );
 
577
  return ( ( $action xor $page ) && ( ! $in_action and ! $in_page ) ) ||
578
  ( ( $action and $page ) && ( ! $in_action or ! $in_page ) ) ? FALSE : TRUE;
579
  }
611
  $list = array_merge( apply_filters( self::PLUGIN_NAME . '-bypass-admins', array(), $settings ), array(
612
  // in wp-admin js/widget.js, includes/template.php, async-upload.php, plugins.php, PHP Compatibility Checker
613
  'heartbeat', 'save-widget', 'wp-compression-test', 'upload-attachment', 'deactivate', 'imgedit-preview', 'wpephpcompat_start_test',
614
+ // bbPress, Anti-Malware Security and Brute-Force Firewall, Jetpack page & action, Email Subscribers & Newsletters by Icegram
615
+ 'bp_avatar_upload', 'GOTMLS_logintime', 'jetpack', 'authorize', 'jetpack_modules', 'atd_settings', 'bulk-activate', 'bulk-deactivate', 'es_sendemail',
616
  ) );
617
 
618
  // skip validation of country code and WP-ZEP if exceptions matches action or page
882
  public function check_behavior( $validate, $settings ) {
883
  // check if page view with a short period time is under the threshold
884
  $cache = IP_Geo_Block_API_Cache::get_cache( self::$remote_addr );
885
+
886
+ if ( $cache && $cache['view'] >= $settings['behavior']['view'] && $_SERVER['REQUEST_TIME'] - $cache['last'] <= $settings['behavior']['time'] )
887
  return $validate + array( 'result' => 'badbot' ); // can't overwrite existing result
 
888
 
889
  return $validate;
890
  }
includes/Net/DNS2.php CHANGED
@@ -354,7 +354,7 @@ class Net_DNS2
354
  // only auto-load our classes
355
  //
356
  if (strncmp($name, 'Net_DNS2', 8) == 0) {
357
-
358
  include str_replace('_', '/', $name) . '.php';
359
  }
360
 
354
  // only auto-load our classes
355
  //
356
  if (strncmp($name, 'Net_DNS2', 8) == 0) {
357
+ //if(!in_array($name,array('Net_DNS2_RR_SOA', 'Net_DNS2_RR_CNAME', 'Net_DNS2_Exception', 'Net_DNS2_Resolver','Net_DNS2_Socket','Net_DNS2_Packet_Request','Net_DNS2_Packet','Net_DNS2_Header','Net_DNS2_Lookups','Net_DNS2_Question','Net_DNS2_Socket_Sockets','Net_DNS2_Packet_Response','Net_DNS2_RR','Net_DNS2_RR_PTR'))) debug_log($name);//in_array( $name, array( 'Net_DNS2_Resolver', 'Net_DNS2_Socket', 'Net_DNS2_Packet_Request', 'Net_DNS2_Packet', 'Net_DNS2_Header', 'Net_DNS2_Lookups', 'Net_DNS2_Question', 'Net_DNS2_Socket_Sockets', 'Net_DNS2_Packet_Response', 'Net_DNS2_RR', 'Net_DNS2_RR_PTR', 'Net_DNS2_RR_SOA', 'Net_DNS2_RR_CNAME', 'Net_DNS2_RR_OPT', 'Net_DNS2_RR_SIG', 'Net_DNS2_RR_TSIG', 'Net_DNS2_Exception' ) ) and debug_log($name);
358
  include str_replace('_', '/', $name) . '.php';
359
  }
360
 
includes/Net/DNS2/BitMap.php DELETED
@@ -1,254 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * a class to handle converting RR bitmaps to arrays and back; used on NSEC
54
- * and NSEC3 RR's
55
- *
56
- * @category Networking
57
- * @package Net_DNS2
58
- * @author Mike Pultz <mike@mikepultz.com>
59
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
60
- * @link http://pear.php.net/package/Net_DNS2
61
- * @see Net_DNS2_Packet
62
- *
63
- */
64
- class Net_DNS2_BitMap
65
- {
66
- /**
67
- * parses a RR bitmap field defined in RFC3845, into an array of RR names.
68
- *
69
- * Type Bit Map(s) Field = ( Window Block # | Bitmap Length | Bitmap ) +
70
- *
71
- * @param string $data a bitmap stringto parse
72
- *
73
- * @return array
74
- * @access public
75
- *
76
- */
77
- public static function bitMapToArray($data)
78
- {
79
- if (strlen($data) == 0) {
80
- return null;
81
- }
82
-
83
- $output = array();
84
- $offset = 0;
85
- $length = strlen($data);
86
-
87
- while ($offset < $length) {
88
-
89
- //
90
- // unpack the window and length values
91
- //
92
- $x = unpack('@' . $offset . '/Cwindow/Clength', $data);
93
- $offset += 2;
94
-
95
- //
96
- // copy out the bitmap value
97
- //
98
- $bitmap = unpack('C*', substr($data, $offset, $x['length']));
99
- $offset += $x['length'];
100
-
101
- //
102
- // I'm not sure if there's a better way of doing this, but PHP doesn't
103
- // have a 'B' flag for unpack()
104
- //
105
- $bitstr = '';
106
- foreach ($bitmap as $r) {
107
-
108
- $bitstr .= sprintf('%08b', $r);
109
- }
110
-
111
- $blen = strlen($bitstr);
112
- for ($i=0; $i<$blen; $i++) {
113
-
114
- if ($bitstr[$i] == '1') {
115
-
116
- $type = $x['window'] * 256 + $i;
117
-
118
- if (isset(Net_DNS2_Lookups::$rr_types_by_id[$type])) {
119
-
120
- $output[] = Net_DNS2_Lookups::$rr_types_by_id[$type];
121
- } else {
122
-
123
- $output[] = 'TYPE' . $type;
124
- }
125
- }
126
- }
127
- }
128
-
129
- return $output;
130
- }
131
-
132
- /**
133
- * builds a RR Bit map from an array of RR type names
134
- *
135
- * @param array $data a list of RR names
136
- *
137
- * @return string
138
- * @access public
139
- *
140
- */
141
- public static function arrayToBitMap(array $data)
142
- {
143
- if (count($data) == 0) {
144
- return null;
145
- }
146
-
147
- $current_window = 0;
148
-
149
- //
150
- // go through each RR
151
- //
152
- $max = 0;
153
- $bm = array();
154
-
155
- foreach ($data as $rr) {
156
-
157
- $rr = strtoupper($rr);
158
-
159
- //
160
- // get the type id for the RR
161
- //
162
- $type = @Net_DNS2_Lookups::$rr_types_by_name[$rr];
163
- if (isset($type)) {
164
-
165
- //
166
- // skip meta types or qtypes
167
- //
168
- if ( (isset(Net_DNS2_Lookups::$rr_qtypes_by_id[$type]))
169
- || (isset(Net_DNS2_Lookups::$rr_metatypes_by_id[$type]))
170
- ) {
171
- continue;
172
- }
173
-
174
- } else {
175
-
176
- //
177
- // if it's not found, then it must be defined as TYPE<id>, per
178
- // RFC3845 section 2.2, if it's not, we ignore it.
179
- //
180
- list($name, $type) = explode('TYPE', $rr);
181
- if (!isset($type)) {
182
-
183
- continue;
184
- }
185
- }
186
-
187
- //
188
- // build the current window
189
- //
190
- $current_window = (int)($type / 256);
191
-
192
- $val = $type - $current_window * 256.0;
193
- if ($val > $max) {
194
- $max = $val;
195
- }
196
-
197
- $bm[$current_window][$val] = 1;
198
- $bm[$current_window]['length'] = ceil(($max + 1) / 8);
199
- }
200
-
201
- $output = '';
202
-
203
- foreach ($bm as $window => $bitdata) {
204
-
205
- $bitstr = '';
206
-
207
- for ($i=0; $i<$bm[$window]['length'] * 8; $i++) {
208
- if (isset($bm[$window][$i])) {
209
- $bitstr .= '1';
210
- } else {
211
- $bitstr .= '0';
212
- }
213
- }
214
-
215
- $output .= pack('CC', $window, $bm[$window]['length']);
216
- $output .= pack('H*', self::bigBaseConvert($bitstr));
217
- }
218
-
219
- return $output;
220
- }
221
-
222
- /**
223
- * a base_convert that handles large numbers; forced to 2/16
224
- *
225
- * @param string $number a bit string
226
- *
227
- * @return string
228
- * @access public
229
- *
230
- */
231
- public static function bigBaseConvert($number)
232
- {
233
- $result = '';
234
-
235
- $bin = substr(chunk_split(strrev($number), 4, '-'), 0, -1);
236
- $temp = preg_split('[-]', $bin, -1, PREG_SPLIT_DELIM_CAPTURE);
237
-
238
- for ($i = count($temp)-1;$i >= 0;$i--) {
239
-
240
- $result = $result . base_convert(strrev($temp[$i]), 2, 16);
241
- }
242
-
243
- return strtoupper($result);
244
- }
245
- }
246
-
247
- /*
248
- * Local variables:
249
- * tab-width: 4
250
- * c-basic-offset: 4
251
- * c-hanging-comment-ender-p: nil
252
- * End:
253
- */
254
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/Cache.php DELETED
@@ -1,311 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.1.0
49
- *
50
- */
51
-
52
- /**
53
- * A class to provide simple dns lookup caching.
54
- *
55
- * @category Networking
56
- * @package Net_DNS2
57
- * @author Mike Pultz <mike@mikepultz.com>
58
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
59
- * @link http://pear.php.net/package/Net_DNS2
60
- * @see Net_DNS2_Packet
61
- *
62
- */
63
- class Net_DNS2_Cache
64
- {
65
- /*
66
- * the filename of the cache file
67
- */
68
- protected $cache_file = '';
69
-
70
- /*
71
- * the local data store for the cache
72
- */
73
- protected $cache_data = array();
74
-
75
- /*
76
- * the size of the cache to use
77
- */
78
- protected $cache_size = 0;
79
-
80
- /*
81
- * the cache serializer
82
- */
83
- protected $cache_serializer;
84
-
85
- /*
86
- * an internal flag to make sure we don't load the cache content more
87
- * than once per instance.
88
- */
89
- protected $cache_opened = false;
90
-
91
- /**
92
- * returns true/false if the provided key is defined in the cache
93
- *
94
- * @param string $key the key to lookup in the local cache
95
- *
96
- * @return boolean
97
- * @access public
98
- *
99
- */
100
- public function has($key)
101
- {
102
- return isset($this->cache_data[$key]);
103
- }
104
-
105
- /**
106
- * returns the value for the given key
107
- *
108
- * @param string $key the key to lookup in the local cache
109
- *
110
- * @return mixed returns the cache data on sucess, false on error
111
- * @access public
112
- *
113
- */
114
- public function get($key)
115
- {
116
- if (isset($this->cache_data[$key])) {
117
-
118
- if ($this->cache_serializer == 'json') {
119
- return json_decode($this->cache_data[$key]['object']);
120
- } else {
121
- return unserialize($this->cache_data[$key]['object']);
122
- }
123
- } else {
124
-
125
- return false;
126
- }
127
- }
128
-
129
- /**
130
- * adds a new key/value pair to the cache
131
- *
132
- * @param string $key the key for the new cache entry
133
- * @param mixed $data the data to store in cache
134
- *
135
- * @return void
136
- * @access public
137
- *
138
- */
139
- public function put($key, $data)
140
- {
141
- $ttl = 86400 * 365;
142
-
143
- //
144
- // clear the rdata values
145
- //
146
- $data->rdata = '';
147
- $data->rdlength = 0;
148
-
149
- //
150
- // find the lowest TTL, and use that as the TTL for the whole cached
151
- // object. The downside to using one TTL for the whole object, is that
152
- // we'll invalidate entries before they actuall expire, causing a
153
- // real lookup to happen.
154
- //
155
- // The upside is that we don't need to require() each RR type in the
156
- // cache, so we can look at their individual TTL's on each run- we only
157
- // unserialize the actual RR object when it's get() from the cache.
158
- //
159
- foreach ($data->answer as $index => $rr) {
160
-
161
- if ($rr->ttl < $ttl) {
162
- $ttl = $rr->ttl;
163
- }
164
-
165
- $rr->rdata = '';
166
- $rr->rdlength = 0;
167
- }
168
- foreach ($data->authority as $index => $rr) {
169
-
170
- if ($rr->ttl < $ttl) {
171
- $ttl = $rr->ttl;
172
- }
173
-
174
- $rr->rdata = '';
175
- $rr->rdlength = 0;
176
- }
177
- foreach ($data->additional as $index => $rr) {
178
-
179
- if ($rr->ttl < $ttl) {
180
- $ttl = $rr->ttl;
181
- }
182
-
183
- $rr->rdata = '';
184
- $rr->rdlength = 0;
185
- }
186
-
187
- $this->cache_data[$key] = array(
188
-
189
- 'cache_date' => time(),
190
- 'ttl' => $ttl
191
- );
192
-
193
- if ($this->cache_serializer == 'json') {
194
- $this->cache_data[$key]['object'] = json_encode($data);
195
- } else {
196
- $this->cache_data[$key]['object'] = serialize($data);
197
- }
198
- }
199
-
200
- /**
201
- * runs a clean up process on the cache data
202
- *
203
- * @return void
204
- * @access protected
205
- *
206
- */
207
- protected function clean()
208
- {
209
- if (count($this->cache_data) > 0) {
210
-
211
- //
212
- // go through each entry and adjust their TTL, and remove entries that
213
- // have expired
214
- //
215
- $now = time();
216
-
217
- foreach ($this->cache_data as $key => $data) {
218
-
219
- $diff = $now - $data['cache_date'];
220
-
221
- if ($data['ttl'] <= $diff) {
222
-
223
- unset($this->cache_data[$key]);
224
- } else {
225
-
226
- $this->cache_data[$key]['ttl'] -= $diff;
227
- $this->cache_data[$key]['cache_date'] = $now;
228
- }
229
- }
230
- }
231
- }
232
-
233
- /**
234
- * runs a clean up process on the cache data
235
- *
236
- * @return mixed
237
- * @access protected
238
- *
239
- */
240
- protected function resize()
241
- {
242
- if (count($this->cache_data) > 0) {
243
-
244
- //
245
- // serialize the cache data
246
- //
247
- if ($this->cache_serializer == 'json') {
248
- $cache = json_encode($this->cache_data);
249
- } else {
250
- $cache = serialize($this->cache_data);
251
- }
252
-
253
- //
254
- // only do this part if the size allocated to the cache storage
255
- // is smaller than the actual cache data
256
- //
257
- if (strlen($cache) > $this->cache_size) {
258
-
259
- while (strlen($cache) > $this->cache_size) {
260
-
261
- //
262
- // go through the data, and remove the entries closed to
263
- // their expiration date.
264
- //
265
- $smallest_ttl = time();
266
- $smallest_key = null;
267
-
268
- foreach ($this->cache_data as $key => $data) {
269
-
270
- if ($data['ttl'] < $smallest_ttl) {
271
-
272
- $smallest_ttl = $data['ttl'];
273
- $smallest_key = $key;
274
- }
275
- }
276
-
277
- //
278
- // unset the key with the smallest TTL
279
- //
280
- unset($this->cache_data[$smallest_key]);
281
-
282
- //
283
- // re-serialize
284
- //
285
- if ($this->cache_serializer == 'json') {
286
- $cache = json_encode($this->cache_data);
287
- } else {
288
- $cache = serialize($this->cache_data);
289
- }
290
- }
291
- }
292
-
293
- if ( ($cache == 'a:0:{}') || ($cache == '{}') ) {
294
- return null;
295
- } else {
296
- return $cache;
297
- }
298
- }
299
-
300
- return null;
301
- }
302
- };
303
-
304
- /*
305
- * Local variables:
306
- * tab-width: 4
307
- * c-basic-offset: 4
308
- * c-hanging-comment-ender-p: nil
309
- * End:
310
- */
311
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/Cache/File.php DELETED
@@ -1,247 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.1.0
49
- *
50
- */
51
-
52
- /**
53
- * File-based caching for the Net_DNS2_Cache class
54
- *
55
- * @category Networking
56
- * @package Net_DNS2
57
- * @author Mike Pultz <mike@mikepultz.com>
58
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
59
- * @link http://pear.php.net/package/Net_DNS2
60
- * @see Net_DNS2_Packet
61
- *
62
- */
63
- class Net_DNS2_Cache_File extends Net_DNS2_Cache
64
- {
65
- /**
66
- * open a cache object
67
- *
68
- * @param string $cache_file path to a file to use for cache storage
69
- * @param integer $size the size of the shared memory segment to create
70
- * @param string $serializer the name of the cache serialize to use
71
- *
72
- * @throws Net_DNS2_Exception
73
- * @access public
74
- * @return void
75
- *
76
- */
77
- public function open($cache_file, $size, $serializer)
78
- {
79
- $this->cache_size = $size;
80
- $this->cache_file = $cache_file;
81
- $this->cache_serializer = $serializer;
82
-
83
- //
84
- // check that the file exists first
85
- //
86
- if ( ($this->cache_opened == false)
87
- && (file_exists($this->cache_file) == true)
88
- && (filesize($this->cache_file) > 0)
89
- ) {
90
- //
91
- // open the file for reading
92
- //
93
- $fp = @fopen($this->cache_file, 'r');
94
- if ($fp !== false) {
95
-
96
- //
97
- // lock the file just in case
98
- //
99
- flock($fp, LOCK_EX);
100
-
101
- //
102
- // read the file contents
103
- //
104
- $data = fread($fp, filesize($this->cache_file));
105
-
106
- $decoded = null;
107
-
108
- if ($this->cache_serializer == 'json') {
109
-
110
- $decoded = json_decode($data, true);
111
- } else {
112
-
113
- $decoded = unserialize($data);
114
- }
115
-
116
- if (is_array($decoded) == true) {
117
-
118
- $this->cache_data = $decoded;
119
- } else {
120
-
121
- $this->cache_data = array();
122
- }
123
-
124
- //
125
- // unlock
126
- //
127
- flock($fp, LOCK_UN);
128
-
129
- //
130
- // close the file
131
- //
132
- fclose($fp);
133
-
134
- //
135
- // clean up the data
136
- //
137
- $this->clean();
138
-
139
- //
140
- // mark this so we don't read this contents more than once per instance.
141
- //
142
- $this->cache_opened = true;
143
- }
144
- }
145
- }
146
-
147
- /**
148
- * Destructor
149
- *
150
- * @access public
151
- *
152
- */
153
- public function __destruct()
154
- {
155
- //
156
- // if there's no cache file set, then there's nothing to do
157
- //
158
- if (strlen($this->cache_file) == 0) {
159
- return;
160
- }
161
-
162
- //
163
- // open the file for reading/writing
164
- //
165
- $fp = fopen($this->cache_file, 'a+');
166
- if ($fp !== false) {
167
-
168
- //
169
- // lock the file just in case
170
- //
171
- flock($fp, LOCK_EX);
172
-
173
- //
174
- // seek to the start of the file to read
175
- //
176
- fseek($fp, 0, SEEK_SET);
177
-
178
- //
179
- // read the file contents
180
- //
181
- $data = @fread($fp, filesize($this->cache_file));
182
- if ( ($data !== false) && (strlen($data) > 0) ) {
183
-
184
- //
185
- // unserialize and store the data
186
- //
187
- $c = $this->cache_data;
188
-
189
- $decoded = null;
190
-
191
- if ($this->cache_serializer == 'json') {
192
-
193
- $decoded = json_decode($data, true);
194
- } else {
195
-
196
- $decoded = unserialize($data);
197
- }
198
-
199
- if (is_array($decoded) == true) {
200
-
201
- $this->cache_data = array_merge($c, $decoded);
202
- }
203
- }
204
-
205
- //
206
- // trucate the file
207
- //
208
- ftruncate($fp, 0);
209
-
210
- //
211
- // clean the data
212
- //
213
- $this->clean();
214
-
215
- //
216
- // resize the data
217
- //
218
- $data = $this->resize();
219
- if (!is_null($data)) {
220
-
221
- //
222
- // write the file contents
223
- //
224
- fwrite($fp, $data);
225
- }
226
-
227
- //
228
- // unlock
229
- //
230
- flock($fp, LOCK_UN);
231
-
232
- //
233
- // close the file
234
- //
235
- fclose($fp);
236
- }
237
- }
238
- };
239
-
240
- /*
241
- * Local variables:
242
- * tab-width: 4
243
- * c-basic-offset: 4
244
- * c-hanging-comment-ender-p: nil
245
- * End:
246
- */
247
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/Cache/Shm.php DELETED
@@ -1,318 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.1.0
49
- *
50
- */
51
-
52
- /**
53
- * Shared Memory-based caching for the Net_DNS2_Cache class
54
- *
55
- * @category Networking
56
- * @package Net_DNS2
57
- * @author Mike Pultz <mike@mikepultz.com>
58
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
59
- * @link http://pear.php.net/package/Net_DNS2
60
- * @see Net_DNS2_Packet
61
- *
62
- */
63
- class Net_DNS2_Cache_Shm extends Net_DNS2_Cache
64
- {
65
- /*
66
- * resource id of the shared memory cache
67
- */
68
- private $_cache_id = false;
69
-
70
- /*
71
- * the IPC key
72
- */
73
- private $_cache_file_tok = -1;
74
-
75
- /**
76
- * open a cache object
77
- *
78
- * @param string $cache_file path to a file to use for cache storage
79
- * @param integer $size the size of the shared memory segment to create
80
- * @param string $serializer the name of the cache serialize to use
81
- *
82
- * @throws Net_DNS2_Exception
83
- * @access public
84
- * @return void
85
- *
86
- */
87
- public function open($cache_file, $size, $serializer)
88
- {
89
- $this->cache_size = $size;
90
- $this->cache_file = $cache_file;
91
- $this->cache_serializer = $serializer;
92
-
93
- //
94
- // if we've already loaded the cache data, then just return right away
95
- //
96
- if ($this->cache_opened == true)
97
- {
98
- return;
99
- }
100
-
101
- //
102
- // make sure the file exists first
103
- //
104
- if (!file_exists($cache_file)) {
105
-
106
- if (file_put_contents($cache_file, '') === false) {
107
-
108
- throw new Net_DNS2_Exception(
109
- 'failed to create empty SHM file: ' . $cache_file,
110
- Net_DNS2_Lookups::E_CACHE_SHM_FILE
111
- );
112
- }
113
- }
114
-
115
- //
116
- // convert the filename to a IPC key
117
- //
118
- $this->_cache_file_tok = ftok($cache_file, 't');
119
- if ($this->_cache_file_tok == -1) {
120
-
121
- throw new Net_DNS2_Exception(
122
- 'failed on ftok() file: ' . $this->_cache_file_tok,
123
- Net_DNS2_Lookups::E_CACHE_SHM_FILE
124
- );
125
- }
126
-
127
- //
128
- // try to open an existing cache; if it doesn't exist, then there's no
129
- // cache, and nothing to do.
130
- //
131
- $this->_cache_id = @shmop_open($this->_cache_file_tok, 'w', 0, 0);
132
- if ($this->_cache_id !== false) {
133
-
134
- //
135
- // this returns the size allocated, and not the size used, but it's
136
- // still a good check to make sure there's space allocated.
137
- //
138
- $allocated = shmop_size($this->_cache_id);
139
- if ($allocated > 0) {
140
-
141
- //
142
- // read the data from the shared memory segment
143
- //
144
- $data = trim(shmop_read($this->_cache_id, 0, $allocated));
145
- if ( ($data !== false) && (strlen($data) > 0) ) {
146
-
147
- //
148
- // unserialize and store the data
149
- //
150
- $decoded = null;
151
-
152
- if ($this->cache_serializer == 'json') {
153
-
154
- $decoded = json_decode($data, true);
155
- } else {
156
-
157
- $decoded = unserialize($data);
158
- }
159
-
160
- if (is_array($decoded) == true) {
161
-
162
- $this->cache_data = $decoded;
163
- } else {
164
-
165
- $this->cache_data = array();
166
- }
167
-
168
- //
169
- // call clean to clean up old entries
170
- //
171
- $this->clean();
172
-
173
- //
174
- // mark the cache as loaded, so we don't load it more than once
175
- //
176
- $this->cache_opened = true;
177
- }
178
- }
179
- }
180
- }
181
-
182
- /**
183
- * Destructor
184
- *
185
- * @access public
186
- *
187
- */
188
- public function __destruct()
189
- {
190
- //
191
- // if there's no cache file set, then there's nothing to do
192
- //
193
- if (strlen($this->cache_file) == 0) {
194
- return;
195
- }
196
-
197
- $fp = fopen($this->cache_file, 'r');
198
- if ($fp !== false) {
199
-
200
- //
201
- // lock the file
202
- //
203
- flock($fp, LOCK_EX);
204
-
205
- //
206
- // check to see if we have an open shm segment
207
- //
208
- if ($this->_cache_id === false) {
209
-
210
- //
211
- // try opening it again, incase it was created by another
212
- // process in the mean time
213
- //
214
- $this->_cache_id = @shmop_open(
215
- $this->_cache_file_tok, 'w', 0, 0
216
- );
217
- if ($this->_cache_id === false) {
218
-
219
- //
220
- // otherwise, create it.
221
- //
222
- $this->_cache_id = @shmop_open(
223
- $this->_cache_file_tok, 'c', 0, $this->cache_size
224
- );
225
- }
226
- }
227
-
228
- //
229
- // get the size allocated to the segment
230
- //
231
- $allocated = shmop_size($this->_cache_id);
232
-
233
- //
234
- // read the contents
235
- //
236
- $data = trim(shmop_read($this->_cache_id, 0, $allocated));
237
-
238
- //
239
- // if there was some data
240
- //
241
- if ( ($data !== false) && (strlen($data) > 0) ) {
242
-
243
- //
244
- // unserialize and store the data
245
- //
246
- $c = $this->cache_data;
247
-
248
- $decoded = null;
249
-
250
- if ($this->cache_serializer == 'json') {
251
-
252
- $decoded = json_decode($data, true);
253
- } else {
254
-
255
- $decoded = unserialize($data);
256
- }
257
-
258
- if (is_array($decoded) == true) {
259
-
260
- $this->cache_data = array_merge($c, $decoded);
261
- }
262
- }
263
-
264
- //
265
- // delete the segment
266
- //
267
- shmop_delete($this->_cache_id);
268
-
269
- //
270
- // clean the data
271
- //
272
- $this->clean();
273
-
274
- //
275
- // clean up and write the data
276
- //
277
- $data = $this->resize();
278
- if (!is_null($data)) {
279
-
280
- //
281
- // re-create segment
282
- //
283
- $this->_cache_id = @shmop_open(
284
- $this->_cache_file_tok, 'c', 0644, $this->cache_size
285
- );
286
- if ($this->_cache_id === false) {
287
- return;
288
- }
289
-
290
- $o = shmop_write($this->_cache_id, $data, 0);
291
- }
292
-
293
- //
294
- // close the segment
295
- //
296
- shmop_close($this->_cache_id);
297
-
298
- //
299
- // unlock
300
- //
301
- flock($fp, LOCK_UN);
302
-
303
- //
304
- // close the file
305
- //
306
- fclose($fp);
307
- }
308
- }
309
- };
310
-
311
- /*
312
- * Local variables:
313
- * tab-width: 4
314
- * c-basic-offset: 4
315
- * c-hanging-comment-ender-p: nil
316
- * End:
317
- */
318
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/PrivateKey.php DELETED
@@ -1,424 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2011 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.1.0
49
- *
50
- */
51
-
52
- /**
53
- * SSL Private Key container class
54
- *
55
- * @category Networking
56
- * @package Net_DNS2
57
- * @author Mike Pultz <mike@mikepultz.com>
58
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
59
- * @link http://pear.php.net/package/Net_DNS2
60
- *
61
- */
62
- class Net_DNS2_PrivateKey
63
- {
64
- /*
65
- * the filename that was loaded; stored for reference
66
- */
67
- public $filename;
68
-
69
- /*
70
- * the keytag for the signature
71
- */
72
- public $keytag;
73
-
74
- /*
75
- * the sign name for the signature
76
- */
77
- public $signname;
78
-
79
- /*
80
- * the algorithm used for the signature
81
- */
82
- public $algorithm;
83
-
84
- /*
85
- * the key format fo the signature
86
- */
87
- public $key_format;
88
-
89
- /*
90
- * the openssl private key id
91
- */
92
- public $instance;
93
-
94
- /*
95
- * RSA: modulus
96
- */
97
- private $_modulus;
98
-
99
- /*
100
- * RSA: public exponent
101
- */
102
- private $_public_exponent;
103
-
104
- /*
105
- * RSA: rivate exponent
106
- */
107
- private $_private_exponent;
108
-
109
- /*
110
- * RSA: prime1
111
- */
112
- private $_prime1;
113
-
114
- /*
115
- * RSA: prime2
116
- */
117
- private $_prime2;
118
-
119
- /*
120
- * RSA: exponent 1
121
- */
122
- private $_exponent1;
123
-
124
- /*
125
- * RSA: exponent 2
126
- */
127
- private $_exponent2;
128
-
129
- /*
130
- * RSA: coefficient
131
- */
132
- private $_coefficient;
133
-
134
- /*
135
- * DSA: prime
136
- */
137
- public $prime;
138
-
139
- /*
140
- * DSA: subprime
141
- */
142
- public $subprime;
143
-
144
- /*
145
- * DSA: base
146
- */
147
- public $base;
148
-
149
- /*
150
- * DSA: private value
151
- */
152
- public $private_value;
153
-
154
- /*
155
- * DSA: public value
156
- */
157
- public $public_value;
158
-
159
- /**
160
- * Constructor - base constructor the private key container class
161
- *
162
- * @param string $file path to a private-key file to parse and load
163
- *
164
- * @throws Net_DNS2_Exception
165
- * @access public
166
- *
167
- */
168
- public function __construct($file = null)
169
- {
170
- if (isset($file)) {
171
- $this->parseFile($file);
172
- }
173
- }
174
-
175
- /**
176
- * parses a private key file generated by dnssec-keygen
177
- *
178
- * @param string $file path to a private-key file to parse and load
179
- *
180
- * @return boolean
181
- * @throws Net_DNS2_Exception
182
- * @access public
183
- *
184
- */
185
- public function parseFile($file)
186
- {
187
- //
188
- // check for OpenSSL
189
- //
190
- if (extension_loaded('openssl') === false) {
191
-
192
- throw new Net_DNS2_Exception(
193
- 'the OpenSSL extension is required to use parse private key.',
194
- Net_DNS2_Lookups::E_OPENSSL_UNAVAIL
195
- );
196
- }
197
-
198
- //
199
- // check to make sure the file exists
200
- //
201
- if (is_readable($file) == false) {
202
-
203
- throw new Net_DNS2_Exception(
204
- 'invalid private key file: ' . $file,
205
- Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
206
- );
207
- }
208
-
209
- //
210
- // get the base filename, and parse it for the local value
211
- //
212
- $keyname = basename($file);
213
- if (strlen($keyname) == 0) {
214
-
215
- throw new Net_DNS2_Exception(
216
- 'failed to get basename() for: ' . $file,
217
- Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
218
- );
219
- }
220
-
221
- //
222
- // parse the keyname
223
- //
224
- if (preg_match("/K(.*)\.\+(\d{3})\+(\d*)\.private/", $keyname, $matches)) {
225
-
226
- $this->signname = $matches[1];
227
- $this->algorithm = intval($matches[2]);
228
- $this->keytag = intval($matches[3]);
229
-
230
- } else {
231
-
232
- throw new Net_DNS2_Exception(
233
- 'file ' . $keyname . ' does not look like a private key file!',
234
- Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
235
- );
236
- }
237
-
238
- //
239
- // read all the data from the
240
- //
241
- $data = file($file, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
242
- if (count($data) == 0) {
243
-
244
- throw new Net_DNS2_Exception(
245
- 'file ' . $keyname . ' is empty!',
246
- Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
247
- );
248
- }
249
-
250
- foreach ($data as $line) {
251
-
252
- list($key, $value) = explode(':', $line);
253
-
254
- $key = trim($key);
255
- $value = trim($value);
256
-
257
- switch(strtolower($key)) {
258
-
259
- case 'private-key-format':
260
- $this->_key_format = $value;
261
- break;
262
-
263
- case 'algorithm':
264
- if ($this->algorithm != $value) {
265
- throw new Net_DNS2_Exception(
266
- 'Algorithm mis-match! filename is ' . $this->algorithm .
267
- ', contents say ' . $value,
268
- Net_DNS2_Lookups::E_OPENSSL_INV_ALGO
269
- );
270
- }
271
- break;
272
-
273
- //
274
- // RSA
275
- //
276
- case 'modulus':
277
- $this->_modulus = $value;
278
- break;
279
-
280
- case 'publicexponent':
281
- $this->_public_exponent = $value;
282
- break;
283
-
284
- case 'privateexponent':
285
- $this->_private_exponent = $value;
286
- break;
287
-
288
- case 'prime1':
289
- $this->_prime1 = $value;
290
- break;
291
-
292
- case 'prime2':
293
- $this->_prime2 = $value;
294
- break;
295
-
296
- case 'exponent1':
297
- $this->_exponent1 = $value;
298
- break;
299
-
300
- case 'exponent2':
301
- $this->_exponent2 = $value;
302
- break;
303
-
304
- case 'coefficient':
305
- $this->_coefficient = $value;
306
- break;
307
-
308
- //
309
- // DSA - this won't work in PHP until the OpenSSL extension is better
310
- //
311
- case 'prime(p)':
312
- $this->prime = $value;
313
- break;
314
-
315
- case 'subprime(q)':
316
- $this->subprime = $value;
317
- break;
318
-
319
- case 'base(g)':
320
- $this->base = $value;
321
- break;
322
-
323
- case 'private_value(x)':
324
- $this->private_value = $value;
325
- break;
326
-
327
- case 'public_value(y)':
328
- $this->public_value = $value;
329
- break;
330
-
331
- default:
332
- throw new Net_DNS2_Exception(
333
- 'unknown private key data: ' . $key . ': ' . $value,
334
- Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
335
- );
336
- }
337
- }
338
-
339
- //
340
- // generate the private key
341
- //
342
- $args = array();
343
-
344
- switch($this->algorithm) {
345
-
346
- //
347
- // RSA
348
- //
349
- case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSAMD5:
350
- case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA1:
351
- case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA256:
352
- case Net_DNS2_Lookups::DNSSEC_ALGORITHM_RSASHA512:
353
-
354
- $args = array(
355
-
356
- 'rsa' => array(
357
-
358
- 'n' => base64_decode($this->_modulus),
359
- 'e' => base64_decode($this->_public_exponent),
360
- 'd' => base64_decode($this->_private_exponent),
361
- 'p' => base64_decode($this->_prime1),
362
- 'q' => base64_decode($this->_prime2),
363
- 'dmp1' => base64_decode($this->_exponent1),
364
- 'dmq1' => base64_decode($this->_exponent2),
365
- 'iqmp' => base64_decode($this->_coefficient)
366
- )
367
- );
368
-
369
- break;
370
-
371
- //
372
- // DSA - this won't work in PHP until the OpenSSL extension is better
373
- //
374
- case Net_DNS2_Lookups::DNSSEC_ALGORITHM_DSA:
375
-
376
- $args = array(
377
-
378
- 'dsa' => array(
379
-
380
- 'p' => base64_decode($this->prime),
381
- 'q' => base64_decode($this->subprime),
382
- 'g' => base64_decode($this->base),
383
- 'priv_key' => base64_decode($this->private_value),
384
- 'pub_key' => base64_decode($this->public_value)
385
- )
386
- );
387
-
388
- break;
389
-
390
- default:
391
- throw new Net_DNS2_Exception(
392
- 'we only currently support RSAMD5 and RSASHA1 encryption.',
393
- Net_DNS2_Lookups::E_OPENSSL_INV_PKEY
394
- );
395
- }
396
-
397
- //
398
- // generate and store the key
399
- //
400
- $this->instance = openssl_pkey_new($args);
401
- if ($this->instance === false) {
402
- throw new Net_DNS2_Exception(
403
- openssl_error_string(),
404
- Net_DNS2_Lookups::E_OPENSSL_ERROR
405
- );
406
- }
407
-
408
- //
409
- // store the filename incase we need it for something
410
- //
411
- $this->filename = $file;
412
-
413
- return true;
414
- }
415
- }
416
-
417
- /*
418
- * Local variables:
419
- * tab-width: 4
420
- * c-basic-offset: 4
421
- * c-hanging-comment-ender-p: nil
422
- * End:
423
- */
424
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/A.php DELETED
@@ -1,156 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * A Resource Record - RFC1035 section 3.4.1
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | ADDRESS |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- *
59
- * @category Networking
60
- * @package Net_DNS2
61
- * @author Mike Pultz <mike@mikepultz.com>
62
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
63
- * @link http://pear.php.net/package/Net_DNS2
64
- * @see Net_DNS2_RR
65
- *
66
- */
67
- class Net_DNS2_RR_A extends Net_DNS2_RR
68
- {
69
- /*
70
- * The IPv4 address in quad-dotted notation
71
- */
72
- public $address;
73
-
74
- /**
75
- * method to return the rdata portion of the packet as a string
76
- *
77
- * @return string
78
- * @access protected
79
- *
80
- */
81
- protected function rrToString()
82
- {
83
- return $this->address;
84
- }
85
-
86
- /**
87
- * parses the rdata portion from a standard DNS config line
88
- *
89
- * @param array $rdata a string split line of values for the rdata
90
- *
91
- * @return boolean
92
- * @access protected
93
- *
94
- */
95
- protected function rrFromString(array $rdata)
96
- {
97
- $value = array_shift($rdata);
98
-
99
- if (Net_DNS2::isIPv4($value) == true) {
100
-
101
- $this->address = $value;
102
- return true;
103
- }
104
-
105
- return false;
106
- }
107
-
108
- /**
109
- * parses the rdata of the Net_DNS2_Packet object
110
- *
111
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
112
- *
113
- * @return boolean
114
- * @access protected
115
- *
116
- */
117
- protected function rrSet(Net_DNS2_Packet &$packet)
118
- {
119
- if ($this->rdlength > 0) {
120
-
121
- $this->address = inet_ntop($this->rdata);
122
- if ($this->address !== false) {
123
-
124
- return true;
125
- }
126
- }
127
-
128
- return false;
129
- }
130
-
131
- /**
132
- * returns the rdata portion of the DNS packet
133
- *
134
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
135
- * compressed names
136
- *
137
- * @return mixed either returns a binary packed
138
- * string or null on failure
139
- * @access protected
140
- *
141
- */
142
- protected function rrGet(Net_DNS2_Packet &$packet)
143
- {
144
- $packet->offset += 4;
145
- return inet_pton($this->address);
146
- }
147
- }
148
-
149
- /*
150
- * Local variables:
151
- * tab-width: 4
152
- * c-basic-offset: 4
153
- * c-hanging-comment-ender-p: nil
154
- * End:
155
- */
156
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/AAAA.php DELETED
@@ -1,177 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * A Resource Record - RFC1035 section 3.4.1
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | |
57
- * | |
58
- * | |
59
- * | ADDRESS |
60
- * | |
61
- * | (128 bit) |
62
- * | |
63
- * | |
64
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
65
- *
66
- * @category Networking
67
- * @package Net_DNS2
68
- * @author Mike Pultz <mike@mikepultz.com>
69
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
70
- * @link http://pear.php.net/package/Net_DNS2
71
- * @see Net_DNS2_RR
72
- *
73
- */
74
- class Net_DNS2_RR_AAAA extends Net_DNS2_RR
75
- {
76
- /*
77
- * the IPv6 address in the preferred hexadecimal values of the eight
78
- * 16-bit pieces
79
- * per RFC1884
80
- *
81
- */
82
- public $address;
83
-
84
- /**
85
- * method to return the rdata portion of the packet as a string
86
- *
87
- * @return string
88
- * @access protected
89
- *
90
- */
91
- protected function rrToString()
92
- {
93
- return $this->address;
94
- }
95
-
96
- /**
97
- * parses the rdata portion from a standard DNS config line
98
- *
99
- * @param array $rdata a string split line of values for the rdata
100
- *
101
- * @return boolean
102
- * @access protected
103
- *
104
- */
105
- protected function rrFromString(array $rdata)
106
- {
107
- //
108
- // expand out compressed formats
109
- //
110
- $value = array_shift($rdata);
111
- if (Net_DNS2::isIPv6($value) == true) {
112
-
113
- $this->address = $value;
114
- return true;
115
- }
116
-
117
- return false;
118
- }
119
-
120
- /**
121
- * parses the rdata of the Net_DNS2_Packet object
122
- *
123
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
124
- *
125
- * @return boolean
126
- * @access protected
127
- *
128
- */
129
- protected function rrSet(Net_DNS2_Packet &$packet)
130
- {
131
- //
132
- // must be 8 x 16bit chunks, or 16 x 8bit
133
- //
134
- if ($this->rdlength == 16) {
135
-
136
- //
137
- // PHP's inet_ntop returns IPv6 addresses in their compressed form,
138
- // but we want to keep with the preferred standard, so we'll parse
139
- // it manually.
140
- //
141
- $x = unpack('n8', $this->rdata);
142
- if (count($x) == 8) {
143
-
144
- $this->address = vsprintf('%x:%x:%x:%x:%x:%x:%x:%x', $x);
145
- return true;
146
- }
147
- }
148
-
149
- return false;
150
- }
151
-
152
- /**
153
- * returns the rdata portion of the DNS packet
154
- *
155
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
156
- * compressed names
157
- *
158
- * @return mixed either returns a binary packed
159
- * string or null on failure
160
- * @access protected
161
- *
162
- */
163
- protected function rrGet(Net_DNS2_Packet &$packet)
164
- {
165
- $packet->offset += 16;
166
- return inet_pton($this->address);
167
- }
168
- }
169
-
170
- /*
171
- * Local variables:
172
- * tab-width: 4
173
- * c-basic-offset: 4
174
- * c-hanging-comment-ender-p: nil
175
- * End:
176
- */
177
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/AFSDB.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * AFSDB Resource Record - RFC1183 section 1
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | SUBTYPE |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * / HOSTNAME /
59
- * / /
60
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
61
- *
62
- * @category Networking
63
- * @package Net_DNS2
64
- * @author Mike Pultz <mike@mikepultz.com>
65
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
66
- * @link http://pear.php.net/package/Net_DNS2
67
- * @see Net_DNS2_RR
68
- *
69
- */
70
- class Net_DNS2_RR_AFSDB extends Net_DNS2_RR
71
- {
72
- /*
73
- * The AFSDB sub type
74
- */
75
- public $subtype;
76
-
77
- /*
78
- * The AFSDB hostname
79
- */
80
- public $hostname;
81
-
82
- /**
83
- * method to return the rdata portion of the packet as a string
84
- *
85
- * @return string
86
- * @access protected
87
- *
88
- */
89
- protected function rrToString()
90
- {
91
- return $this->subtype . ' ' . $this->cleanString($this->hostname) . '.';
92
- }
93
-
94
- /**
95
- * parses the rdata portion from a standard DNS config line
96
- *
97
- * @param array $rdata a string split line of values for the rdata
98
- *
99
- * @return boolean
100
- * @access protected
101
- *
102
- */
103
- protected function rrFromString(array $rdata)
104
- {
105
- $this->subtype = array_shift($rdata);
106
- $this->hostname = $this->cleanString(array_shift($rdata));
107
-
108
- return true;
109
- }
110
-
111
- /**
112
- * parses the rdata of the Net_DNS2_Packet object
113
- *
114
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
115
- *
116
- * @return boolean
117
- * @access protected
118
- *
119
- */
120
- protected function rrSet(Net_DNS2_Packet &$packet)
121
- {
122
- if ($this->rdlength > 0) {
123
-
124
- //
125
- // unpack the subtype
126
- //
127
- $x = unpack('nsubtype', $this->rdata);
128
-
129
- $this->subtype = $x['subtype'];
130
- $offset = $packet->offset + 2;
131
-
132
- $this->hostname = Net_DNS2_Packet::expand($packet, $offset);
133
-
134
- return true;
135
- }
136
-
137
- return false;
138
- }
139
-
140
- /**
141
- * returns the rdata portion of the DNS packet
142
- *
143
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
144
- * compressed names
145
- *
146
- * @return mixed either returns a binary packed
147
- * string or null on failure
148
- * @access protected
149
- *
150
- */
151
- protected function rrGet(Net_DNS2_Packet &$packet)
152
- {
153
- if (strlen($this->hostname) > 0) {
154
-
155
- $data = pack('n', $this->subtype);
156
- $packet->offset += 2;
157
-
158
- $data .= $packet->compress($this->hostname, $packet->offset);
159
-
160
- return $data;
161
- }
162
-
163
- return null;
164
- }
165
- }
166
-
167
- /*
168
- * Local variables:
169
- * tab-width: 4
170
- * c-basic-offset: 4
171
- * c-hanging-comment-ender-p: nil
172
- * End:
173
- */
174
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/ANY.php DELETED
@@ -1,129 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * This is only used for generating an empty ANY RR.
54
- *
55
- * @category Networking
56
- * @package Net_DNS2
57
- * @author Mike Pultz <mike@mikepultz.com>
58
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
59
- * @link http://pear.php.net/package/Net_DNS2
60
- * @see Net_DNS2_RR
61
- *
62
- */
63
- class Net_DNS2_RR_ANY extends Net_DNS2_RR
64
- {
65
- /**
66
- * method to return the rdata portion of the packet as a string
67
- *
68
- * @return string
69
- * @access protected
70
- *
71
- */
72
- protected function rrToString()
73
- {
74
- return '';
75
- }
76
-
77
- /**
78
- * parses the rdata portion from a standard DNS config line
79
- *
80
- * @param array $rdata a string split line of values for the rdata
81
- *
82
- * @return boolean
83
- * @access protected
84
- *
85
- */
86
- protected function rrFromString(array $rdata)
87
- {
88
- return true;
89
- }
90
-
91
- /**
92
- * parses the rdata of the Net_DNS2_Packet object
93
- *
94
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
95
- *
96
- * @return boolean
97
- * @access protected
98
- *
99
- */
100
- protected function rrSet(Net_DNS2_Packet &$packet)
101
- {
102
- return true;
103
- }
104
-
105
- /**
106
- * returns the rdata portion of the DNS packet
107
- *
108
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
109
- * compressed names
110
- *
111
- * @return mixed either returns a binary packed
112
- * string or null on failure
113
- * @access protected
114
- *
115
- */
116
- protected function rrGet(Net_DNS2_Packet &$packet)
117
- {
118
- return '';
119
- }
120
- }
121
-
122
- /*
123
- * Local variables:
124
- * tab-width: 4
125
- * c-basic-offset: 4
126
- * c-hanging-comment-ender-p: nil
127
- * End:
128
- */
129
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/APL.php DELETED
@@ -1,343 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.0.0
49
- *
50
- */
51
-
52
- /**
53
- * APL Resource Record - RFC3123
54
- *
55
- * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
56
- * | ADDRESSFAMILY |
57
- * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
58
- * | PREFIX | N | AFDLENGTH |
59
- * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
60
- * / AFDPART /
61
- * | |
62
- * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_APL extends Net_DNS2_RR
73
- {
74
- /*
75
- * a list of all the address prefix list items
76
- */
77
- public $apl_items = array();
78
-
79
- /**
80
- * method to return the rdata portion of the packet as a string
81
- *
82
- * @return string
83
- * @access protected
84
- *
85
- */
86
- protected function rrToString()
87
- {
88
- $out = '';
89
-
90
- foreach ($this->apl_items as $item) {
91
-
92
- if ($item['n'] == 1) {
93
-
94
- $out .= '!';
95
- }
96
-
97
- $out .= $item['address_family'] . ':' .
98
- $item['afd_part'] . '/' . $item['prefix'] . ' ';
99
- }
100
-
101
- return trim($out);
102
- }
103
-
104
- /**
105
- * parses the rdata portion from a standard DNS config line
106
- *
107
- * @param array $rdata a string split line of values for the rdata
108
- *
109
- * @return boolean
110
- * @access protected
111
- *
112
- */
113
- protected function rrFromString(array $rdata)
114
- {
115
- foreach ($rdata as $item) {
116
-
117
- if (preg_match('/^(!?)([1|2])\:([^\/]*)\/([0-9]{1,3})$/', $item, $m)) {
118
-
119
- $i = array(
120
-
121
- 'address_family' => $m[2],
122
- 'prefix' => $m[4],
123
- 'n' => ($m[1] == '!') ? 1 : 0,
124
- 'afd_part' => strtolower($m[3])
125
- );
126
-
127
- $address = $this->_trimZeros(
128
- $i['address_family'], $i['afd_part']
129
- );
130
-
131
- $i['afd_length'] = count(explode('.', $address));
132
-
133
- $this->apl_items[] = $i;
134
- }
135
- }
136
-
137
- return true;
138
- }
139
-
140
- /**
141
- * parses the rdata of the Net_DNS2_Packet object
142
- *
143
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
144
- *
145
- * @return boolean
146
- * @access protected
147
- *
148
- */
149
- protected function rrSet(Net_DNS2_Packet &$packet)
150
- {
151
- if ($this->rdlength > 0) {
152
-
153
- $offset = 0;
154
-
155
- while ($offset < $this->rdlength) {
156
-
157
- //
158
- // unpack the family, prefix, negate and length values
159
- //
160
- $x = unpack(
161
- 'naddress_family/Cprefix/Cextra', substr($this->rdata, $offset)
162
- );
163
-
164
- $item = array(
165
-
166
- 'address_family' => $x['address_family'],
167
- 'prefix' => $x['prefix'],
168
- 'n' => ($x['extra'] >> 7) & 0x1,
169
- 'afd_length' => $x['extra'] & 0xf
170
- );
171
-
172
- switch($item['address_family']) {
173
-
174
- case 1:
175
- $r = unpack(
176
- 'C*', substr($this->rdata, $offset + 4, $item['afd_length'])
177
- );
178
- if (count($r) < 4) {
179
-
180
- for ($c=count($r)+1; $c<4+1; $c++) {
181
-
182
- $r[$c] = 0;
183
- }
184
- }
185
-
186
- $item['afd_part'] = implode('.', $r);
187
-
188
- break;
189
- case 2:
190
- $r = unpack(
191
- 'C*', substr($this->rdata, $offset + 4, $item['afd_length'])
192
- );
193
- if (count($r) < 8) {
194
-
195
- for ($c=count($r)+1; $c<8+1; $c++) {
196
-
197
- $r[$c] = 0;
198
- }
199
- }
200
-
201
- $item['afd_part'] = sprintf(
202
- '%x:%x:%x:%x:%x:%x:%x:%x',
203
- $r[1], $r[2], $r[3], $r[4], $r[5], $r[6], $r[7], $r[8]
204
- );
205
-
206
- break;
207
- default:
208
- return false;
209
- }
210
-
211
- $this->apl_items[] = $item;
212
-
213
- $offset += 4 + $item['afd_length'];
214
- }
215
-
216
- return true;
217
- }
218
-
219
- return false;
220
- }
221
-
222
- /**
223
- * returns the rdata portion of the DNS packet
224
- *
225
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
226
- * compressed names
227
- *
228
- * @return mixed either returns a binary packed
229
- * string or null on failure
230
- * @access protected
231
- *
232
- */
233
- protected function rrGet(Net_DNS2_Packet &$packet)
234
- {
235
- if (count($this->apl_items) > 0) {
236
-
237
- $data = '';
238
-
239
- foreach ($this->apl_items as $item) {
240
-
241
- //
242
- // pack the address_family and prefix values
243
- //
244
- $data .= pack(
245
- 'nCC',
246
- $item['address_family'],
247
- $item['prefix'],
248
- ($item['n'] << 7) | $item['afd_length']
249
- );
250
-
251
- switch($item['address_family']) {
252
- case 1:
253
- $address = explode(
254
- '.',
255
- $this->_trimZeros($item['address_family'], $item['afd_part'])
256
- );
257
-
258
- foreach ($address as $b) {
259
- $data .= chr($b);
260
- }
261
- break;
262
- case 2:
263
- $address = explode(
264
- ':',
265
- $this->_trimZeros($item['address_family'], $item['afd_part'])
266
- );
267
-
268
- foreach ($address as $b) {
269
- $data .= pack('H', $b);
270
- }
271
- break;
272
- default:
273
- return null;
274
- }
275
- }
276
-
277
- $packet->offset += strlen($data);
278
-
279
- return $data;
280
- }
281
-
282
- return null;
283
- }
284
-
285
- /**
286
- * returns an IP address with the right-hand zero's trimmed
287
- *
288
- * @param integer $family the IP address family from the rdata
289
- * @param string $address the IP address
290
- *
291
- * @return string the trimmed IP addresss.
292
- *
293
- * @access private
294
- *
295
- */
296
- private function _trimZeros($family, $address)
297
- {
298
- $a = array();
299
-
300
- switch($family) {
301
- case 1:
302
- $a = array_reverse(explode('.', $address));
303
- break;
304
- case 2:
305
- $a = array_reverse(explode(':', $address));
306
- break;
307
- default:
308
- return '';
309
- }
310
-
311
- foreach ($a as $value) {
312
-
313
- if ($value === '0') {
314
-
315
- array_shift($a);
316
- }
317
- }
318
-
319
- $out = '';
320
-
321
- switch($family) {
322
- case 1:
323
- $out = implode('.', array_reverse($a));
324
- break;
325
- case 2:
326
- $out = implode(':', array_reverse($a));
327
- break;
328
- default:
329
- return '';
330
- }
331
-
332
- return $out;
333
- }
334
- }
335
-
336
- /*
337
- * Local variables:
338
- * tab-width: 4
339
- * c-basic-offset: 4
340
- * c-hanging-comment-ender-p: nil
341
- * End:
342
- */
343
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/ATMA.php DELETED
@@ -1,210 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.1.0
49
- *
50
- */
51
-
52
- /**
53
- * ATMA Resource Record
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
56
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
57
- * | FORMAT | |
58
- * | +--+--+--+--+--+--+--+--+
59
- * / ADDRESS /
60
- * | |
61
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
62
- *
63
- * @category Networking
64
- * @package Net_DNS2
65
- * @author Mike Pultz <mike@mikepultz.com>
66
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
67
- * @link http://pear.php.net/package/Net_DNS2
68
- * @see Net_DNS2_RR
69
- *
70
- */
71
- class Net_DNS2_RR_ATMA extends Net_DNS2_RR
72
- {
73
- /*
74
- * One octet that indicates the format of ADDRESS. The two possible values
75
- * for FORMAT are value 0 indicating ATM End System Address (AESA) format
76
- * and value 1 indicating E.164 format
77
- */
78
- public $format;
79
-
80
- /*
81
- * The IPv4 address in quad-dotted notation
82
- */
83
- public $address;
84
-
85
- /**
86
- * method to return the rdata portion of the packet as a string
87
- *
88
- * @return string
89
- * @access protected
90
- *
91
- */
92
- protected function rrToString()
93
- {
94
- return $this->address;
95
- }
96
-
97
- /**
98
- * parses the rdata portion from a standard DNS config line
99
- *
100
- * @param array $rdata a string split line of values for the rdata
101
- *
102
- * @return boolean
103
- * @access protected
104
- *
105
- */
106
- protected function rrFromString(array $rdata)
107
- {
108
- $value = array_shift($rdata);
109
-
110
- if (ctype_xdigit($value) == true) {
111
-
112
- $this->format = 0;
113
- $this->address = $value;
114
-
115
- } else if (is_numeric($value) == true) {
116
-
117
- $this->format = 1;
118
- $this->address = $value;
119
-
120
- } else {
121
-
122
- return false;
123
- }
124
-
125
- return true;
126
- }
127
-
128
- /**
129
- * parses the rdata of the Net_DNS2_Packet object
130
- *
131
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
132
- *
133
- * @return boolean
134
- * @access protected
135
- *
136
- */
137
- protected function rrSet(Net_DNS2_Packet &$packet)
138
- {
139
- if ($this->rdlength > 0) {
140
-
141
- //
142
- // unpack the format
143
- //
144
- $x = unpack('Cformat/N*address', $this->rdata);
145
-
146
- $this->format = $x['format'];
147
-
148
- if ($this->format == 0) {
149
-
150
- $a = unpack('@1/H*address', $this->rdata);
151
-
152
- $this->address = $a['address'];
153
-
154
- } else if ($this->format == 1) {
155
-
156
- $this->address = substr($this->rdata, 1, $this->rdlength - 1);
157
-
158
- } else {
159
-
160
- return false;
161
- }
162
-
163
- return true;
164
- }
165
-
166
- return false;
167
- }
168
-
169
- /**
170
- * returns the rdata portion of the DNS packet
171
- *
172
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
173
- * compressed names
174
- *
175
- * @return mixed either returns a binary packed
176
- * string or null on failure
177
- * @access protected
178
- *
179
- */
180
- protected function rrGet(Net_DNS2_Packet &$packet)
181
- {
182
- $data = chr($this->format);
183
-
184
- if ($this->format == 0) {
185
-
186
- $data .= pack('H*', $this->address);
187
-
188
- } else if ($this->format == 1) {
189
-
190
- $data .= $this->address;
191
-
192
- } else {
193
-
194
- return null;
195
- }
196
-
197
- $packet->offset += strlen($data);
198
-
199
- return $data;
200
- }
201
- }
202
-
203
- /*
204
- * Local variables:
205
- * tab-width: 4
206
- * c-basic-offset: 4
207
- * c-hanging-comment-ender-p: nil
208
- * End:
209
- */
210
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/AVC.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2016, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2016 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.4.2
49
- *
50
- */
51
-
52
- /**
53
- * The AVC RR is implemented exactly like the TXT record, so
54
- * for now we just extend the TXT RR and use it.
55
- *
56
- * @category Networking
57
- * @package Net_DNS2
58
- * @author Mike Pultz <mike@mikepultz.com>
59
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
60
- * @link http://pear.php.net/package/Net_DNS2
61
- * @see Net_DNS2_RR
62
- *
63
- */
64
- class Net_DNS2_RR_AVC extends Net_DNS2_RR_TXT
65
- {
66
- }
67
-
68
- /*
69
- * Local variables:
70
- * tab-width: 4
71
- * c-basic-offset: 4
72
- * c-hanging-comment-ender-p: nil
73
- * End:
74
- */
75
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/CAA.php DELETED
@@ -1,179 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2011, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2011 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.2.0
49
- *
50
- */
51
-
52
- /**
53
- * CAA Resource Record - http://tools.ietf.org/html/draft-ietf-pkix-caa-03
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | FLAGS | TAG LENGTH |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * / TAG /
59
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
60
- * / DATA /
61
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
62
- *
63
- * @category Networking
64
- * @package Net_DNS2
65
- * @author Mike Pultz <mike@mikepultz.com>
66
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
67
- * @link http://pear.php.net/package/Net_DNS2
68
- * @see Net_DNS2_RR
69
- *
70
- */
71
- class Net_DNS2_RR_CAA extends Net_DNS2_RR
72
- {
73
- /*
74
- * The critcal flag
75
- */
76
- public $flags;
77
-
78
- /*
79
- * The property identifier
80
- */
81
- public $tag;
82
-
83
- /*
84
- * The property value
85
- */
86
- public $value;
87
-
88
- /**
89
- * method to return the rdata portion of the packet as a string
90
- *
91
- * @return string
92
- * @access protected
93
- *
94
- */
95
- protected function rrToString()
96
- {
97
- return $this->flags . ' ' . $this->tag . ' "' .
98
- trim($this->cleanString($this->value), '"') . '"';
99
- }
100
-
101
- /**
102
- * parses the rdata portion from a standard DNS config line
103
- *
104
- * @param array $rdata a string split line of values for the rdata
105
- *
106
- * @return boolean
107
- * @access protected
108
- *
109
- */
110
- protected function rrFromString(array $rdata)
111
- {
112
- $this->flags = array_shift($rdata);
113
- $this->tag = array_shift($rdata);
114
-
115
- $this->value = trim($this->cleanString(implode($rdata, ' ')), '"');
116
-
117
- return true;
118
- }
119
-
120
- /**
121
- * parses the rdata of the Net_DNS2_Packet object
122
- *
123
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
124
- *
125
- * @return boolean
126
- * @access protected
127
- *
128
- */
129
- protected function rrSet(Net_DNS2_Packet &$packet)
130
- {
131
- if ($this->rdlength > 0) {
132
-
133
- //
134
- // unpack the flags and tag length
135
- //
136
- $x = unpack('Cflags/Ctag_length', $this->rdata);
137
-
138
- $this->flags = $x['flags'];
139
- $offset = 2;
140
-
141
- $this->tag = substr($this->rdata, $offset, $x['tag_length']);
142
- $offset += $x['tag_length'];
143
-
144
- $this->value = substr($this->rdata, $offset);
145
-
146
- return true;
147
- }
148
-
149
- return false;
150
- }
151
-
152
- /**
153
- * returns the rdata portion of the DNS packet
154
- *
155
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
156
- * compressed names
157
- *
158
- * @return mixed either returns a binary packed
159
- * string or null on failure
160
- * @access protected
161
- *
162
- */
163
- protected function rrGet(Net_DNS2_Packet &$packet)
164
- {
165
- if (strlen($this->value) > 0) {
166
-
167
- $data = chr($this->flags);
168
- $data .= chr(strlen($this->tag)) . $this->tag . $this->value;
169
-
170
- $packet->offset += strlen($data);
171
-
172
- return $data;
173
- }
174
-
175
- return null;
176
- }
177
- }
178
-
179
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/CDNSKEY.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2014, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2014 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.4.0
49
- *
50
- */
51
-
52
- /**
53
- * The CDNSKEY RR is implemented exactly like the DNSKEY record, so
54
- * for now we just extend the DNSKEY RR and use it.
55
- *
56
- * http://www.rfc-editor.org/rfc/rfc7344.txt
57
- *
58
- * @category Networking
59
- * @package Net_DNS2
60
- * @author Mike Pultz <mike@mikepultz.com>
61
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
62
- * @link http://pear.php.net/package/Net_DNS2
63
- * @see Net_DNS2_RR
64
- *
65
- */
66
- class Net_DNS2_RR_CDNSKEY extends Net_DNS2_RR_DNSKEY
67
- {
68
- }
69
-
70
- /*
71
- * Local variables:
72
- * tab-width: 4
73
- * c-basic-offset: 4
74
- * c-hanging-comment-ender-p: nil
75
- * End:
76
- */
77
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/CDS.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2011, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2011 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.2.0
49
- *
50
- */
51
-
52
- /**
53
- * The CDS RR is implemented exactly like the DS record, so
54
- * for now we just extend the DS RR and use it.
55
- *
56
- * http://www.rfc-editor.org/rfc/rfc7344.txt
57
- *
58
- * @category Networking
59
- * @package Net_DNS2
60
- * @author Mike Pultz <mike@mikepultz.com>
61
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
62
- * @link http://pear.php.net/package/Net_DNS2
63
- * @see Net_DNS2_RR
64
- *
65
- */
66
- class Net_DNS2_RR_CDS extends Net_DNS2_RR_DS
67
- {
68
- }
69
-
70
- /*
71
- * Local variables:
72
- * tab-width: 4
73
- * c-basic-offset: 4
74
- * c-hanging-comment-ender-p: nil
75
- * End:
76
- */
77
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/CERT.php DELETED
@@ -1,292 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * CERT Resource Record - RFC4398 section 2
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | format | key tag |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59
- * | algorithm | /
60
- * +---------------+ certificate or CRL /
61
- * / /
62
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_CERT extends Net_DNS2_RR
73
- {
74
- /*
75
- * format's allowed for certificates
76
- */
77
- const CERT_FORMAT_RES = 0;
78
- const CERT_FORMAT_PKIX = 1;
79
- const CERT_FORMAT_SPKI = 2;
80
- const CERT_FORMAT_PGP = 3;
81
- const CERT_FORMAT_IPKIX = 4;
82
- const CERT_FORMAT_ISPKI = 5;
83
- const CERT_FORMAT_IPGP = 6;
84
- const CERT_FORMAT_ACPKIX = 7;
85
- const CERT_FORMAT_IACPKIX = 8;
86
- const CERT_FORMAT_URI = 253;
87
- const CERT_FORMAT_OID = 254;
88
-
89
- public $cert_format_name_to_id = array();
90
- public $cert_format_id_to_name = array(
91
-
92
- self::CERT_FORMAT_RES => 'Reserved',
93
- self::CERT_FORMAT_PKIX => 'PKIX',
94
- self::CERT_FORMAT_SPKI => 'SPKI',
95
- self::CERT_FORMAT_PGP => 'PGP',
96
- self::CERT_FORMAT_IPKIX => 'IPKIX',
97
- self::CERT_FORMAT_ISPKI => 'ISPKI',
98
- self::CERT_FORMAT_IPGP => 'IPGP',
99
- self::CERT_FORMAT_ACPKIX => 'ACPKIX',
100
- self::CERT_FORMAT_IACPKIX => 'IACPKIX',
101
- self::CERT_FORMAT_URI => 'URI',
102
- self::CERT_FORMAT_OID => 'OID'
103
- );
104
-
105
- /*
106
- * certificate format
107
- */
108
- public $format;
109
-
110
- /*
111
- * key tag
112
- */
113
- public $keytag;
114
-
115
- /*
116
- * The algorithm used for the CERt
117
- */
118
- public $algorithm;
119
-
120
- /*
121
- * certificate
122
- */
123
- public $certificate;
124
-
125
- /**
126
- * we have our own constructor so that we can load our certificate
127
- * information for parsing.
128
- *
129
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
130
- * @param array $rr a array with parsed RR values
131
- *
132
- * @return
133
- *
134
- */
135
- public function __construct(Net_DNS2_Packet &$packet = null, array $rr = null)
136
- {
137
- parent::__construct($packet, $rr);
138
-
139
- //
140
- // load the lookup values
141
- //
142
- $this->cert_format_name_to_id = array_flip($this->cert_format_id_to_name);
143
- }
144
-
145
- /**
146
- * method to return the rdata portion of the packet as a string
147
- *
148
- * @return string
149
- * @access protected
150
- *
151
- */
152
- protected function rrToString()
153
- {
154
- return $this->format . ' ' . $this->keytag . ' ' . $this->algorithm .
155
- ' ' . base64_encode($this->certificate);
156
- }
157
-
158
- /**
159
- * parses the rdata portion from a standard DNS config line
160
- *
161
- * @param array $rdata a string split line of values for the rdata
162
- *
163
- * @return boolean
164
- * @access protected
165
- *
166
- */
167
- protected function rrFromString(array $rdata)
168
- {
169
- //
170
- // load and check the format; can be an int, or a mnemonic symbol
171
- //
172
- $this->format = array_shift($rdata);
173
- if (!is_numeric($this->format)) {
174
-
175
- $mnemonic = strtoupper(trim($this->format));
176
- if (!isset($this->cert_format_name_to_id[$mnemonic])) {
177
-
178
- return false;
179
- }
180
-
181
- $this->format = $this->cert_format_name_to_id[$mnemonic];
182
- } else {
183
-
184
- if (!isset($this->cert_format_id_to_name[$this->format])) {
185
-
186
- return false;
187
- }
188
- }
189
-
190
- $this->keytag = array_shift($rdata);
191
-
192
- //
193
- // parse and check the algorithm; can be an int, or a mnemonic symbol
194
- //
195
- $this->algorithm = array_shift($rdata);
196
- if (!is_numeric($this->algorithm)) {
197
-
198
- $mnemonic = strtoupper(trim($this->algorithm));
199
- if (!isset(Net_DNS2_Lookups::$algorithm_name_to_id[$mnemonic])) {
200
-
201
- return false;
202
- }
203
-
204
- $this->algorithm = Net_DNS2_Lookups::$algorithm_name_to_id[
205
- $mnemonic
206
- ];
207
- } else {
208
-
209
- if (!isset(Net_DNS2_Lookups::$algorithm_id_to_name[$this->algorithm])) {
210
- return false;
211
- }
212
- }
213
-
214
- //
215
- // parse and base64 decode the certificate
216
- //
217
- // certificates MUST be provided base64 encoded, if not, everything will
218
- // be broken after this point, as we assume it's base64 encoded.
219
- //
220
- $this->certificate = base64_decode(implode(' ', $rdata));
221
-
222
- return true;
223
- }
224
-
225
- /**
226
- * parses the rdata of the Net_DNS2_Packet object
227
- *
228
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
229
- *
230
- * @return boolean
231
- * @access protected
232
- *
233
- */
234
- protected function rrSet(Net_DNS2_Packet &$packet)
235
- {
236
- if ($this->rdlength > 0) {
237
-
238
- //
239
- // unpack the format, keytag and algorithm
240
- //
241
- $x = unpack('nformat/nkeytag/Calgorithm', $this->rdata);
242
-
243
- $this->format = $x['format'];
244
- $this->keytag = $x['keytag'];
245
- $this->algorithm = $x['algorithm'];
246
-
247
- //
248
- // copy the certificate
249
- //
250
- $this->certificate = substr($this->rdata, 5, $this->rdlength - 5);
251
-
252
- return true;
253
- }
254
-
255
- return false;
256
- }
257
-
258
- /**
259
- * returns the rdata portion of the DNS packet
260
- *
261
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
262
- * compressed names
263
- *
264
- * @return mixed either returns a binary packed
265
- * string or null on failure
266
- * @access protected
267
- *
268
- */
269
- protected function rrGet(Net_DNS2_Packet &$packet)
270
- {
271
- if (strlen($this->certificate) > 0) {
272
-
273
- $data = pack('nnC', $this->format, $this->keytag, $this->algorithm) .
274
- $this->certificate;
275
-
276
- $packet->offset += strlen($data);
277
-
278
- return $data;
279
- }
280
-
281
- return null;
282
- }
283
- }
284
-
285
- /*
286
- * Local variables:
287
- * tab-width: 4
288
- * c-basic-offset: 4
289
- * c-hanging-comment-ender-p: nil
290
- * End:
291
- */
292
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/CSYNC.php DELETED
@@ -1,203 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2015, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2015 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.4.1
49
- *
50
- */
51
-
52
- /**
53
- * CSYNC Resource Record - RFC 7477 seciond 2.1.1
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | SOA Serial |
57
- * | |
58
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
59
- * | Flags |
60
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
61
- * / Type Bit Map /
62
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_CSYNC extends Net_DNS2_RR
73
- {
74
- /*
75
- * serial number
76
- */
77
- public $serial;
78
-
79
- /*
80
- * flags
81
- */
82
- public $flags;
83
-
84
- /*
85
- * array of RR type names
86
- */
87
- public $type_bit_maps = array();
88
-
89
- /**
90
- * method to return the rdata portion of the packet as a string
91
- *
92
- * @return string
93
- * @access protected
94
- *
95
- */
96
- protected function rrToString()
97
- {
98
- $out = $this->serial . ' ' . $this->flags;
99
-
100
- //
101
- // show the RR's
102
- //
103
- foreach ($this->type_bit_maps as $rr) {
104
-
105
- $out .= ' ' . strtoupper($rr);
106
- }
107
-
108
- return $out;
109
- }
110
-
111
- /**
112
- * parses the rdata portion from a standard DNS config line
113
- *
114
- * @param array $rdata a string split line of values for the rdata
115
- *
116
- * @return boolean
117
- * @access protected
118
- *
119
- */
120
- protected function rrFromString(array $rdata)
121
- {
122
- $this->serial = array_shift($rdata);
123
- $this->flags = array_shift($rdata);
124
-
125
- $this->type_bit_maps = $rdata;
126
-
127
- return true;
128
- }
129
-
130
- /**
131
- * parses the rdata of the Net_DNS2_Packet object
132
- *
133
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
134
- *
135
- * @return boolean
136
- * @access protected
137
- *
138
- */
139
- protected function rrSet(Net_DNS2_Packet &$packet)
140
- {
141
- if ($this->rdlength > 0) {
142
-
143
- //
144
- // unpack the serial and flags values
145
- //
146
- $x = unpack('@' . $packet->offset . '/Nserial/nflags', $packet->rdata);
147
-
148
- $this->serial = Net_DNS2::expandUint32($x['serial']);
149
- $this->flags = $x['flags'];
150
-
151
- //
152
- // parse out the RR bitmap
153
- //
154
- $this->type_bit_maps = Net_DNS2_BitMap::bitMapToArray(
155
- substr($this->rdata, 6)
156
- );
157
-
158
- return true;
159
- }
160
-
161
- return false;
162
- }
163
-
164
- /**
165
- * returns the rdata portion of the DNS packet
166
- *
167
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
168
- * compressed names
169
- *
170
- * @return mixed either returns a binary packed
171
- * string or null on failure
172
- * @access protected
173
- *
174
- */
175
- protected function rrGet(Net_DNS2_Packet &$packet)
176
- {
177
- //
178
- // pack the serial and flags values
179
- //
180
- $data = pack('Nn', $this->serial, $this->flags);
181
-
182
- //
183
- // convert the array of RR names to a type bitmap
184
- //
185
- $data .= Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
186
-
187
- //
188
- // advance the offset
189
- //
190
- $packet->offset += strlen($data);
191
-
192
- return $data;
193
- }
194
- }
195
-
196
- /*
197
- * Local variables:
198
- * tab-width: 4
199
- * c-basic-offset: 4
200
- * c-hanging-comment-ender-p: nil
201
- * End:
202
- */
203
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/DHCID.php DELETED
@@ -1,207 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * DHCID Resource Record - RFC4701 section 3.1
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | ID Type Code |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * | Digest Type | /
59
- * +--+--+--+--+--+--+--+--+ /
60
- * / /
61
- * / Digest /
62
- * / /
63
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
64
- *
65
- * @category Networking
66
- * @package Net_DNS2
67
- * @author Mike Pultz <mike@mikepultz.com>
68
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
69
- * @link http://pear.php.net/package/Net_DNS2
70
- * @see Net_DNS2_RR
71
- *
72
- */
73
- class Net_DNS2_RR_DHCID extends Net_DNS2_RR
74
- {
75
- /*
76
- * Identifier type
77
- */
78
- public $id_type;
79
-
80
- /*
81
- * Digest Type
82
- */
83
- public $digest_type;
84
-
85
- /*
86
- * The digest
87
- */
88
- public $digest;
89
-
90
-
91
- /**
92
- * method to return the rdata portion of the packet as a string
93
- *
94
- * @return string
95
- * @access protected
96
- *
97
- */
98
- protected function rrToString()
99
- {
100
- $out = pack('nC', $this->id_type, $this->digest_type);
101
- $out .= base64_decode($this->digest);
102
-
103
- return base64_encode($out);
104
- }
105
-
106
- /**
107
- * parses the rdata portion from a standard DNS config line
108
- *
109
- * @param array $rdata a string split line of values for the rdata
110
- *
111
- * @return boolean
112
- * @access protected
113
- *
114
- */
115
- protected function rrFromString(array $rdata)
116
- {
117
- $data = base64_decode(array_shift($rdata));
118
- if (strlen($data) > 0) {
119
-
120
- //
121
- // unpack the id type and digest type
122
- //
123
- $x = unpack('nid_type/Cdigest_type', $data);
124
-
125
- $this->id_type = $x['id_type'];
126
- $this->digest_type = $x['digest_type'];
127
-
128
- //
129
- // copy out the digest
130
- //
131
- $this->digest = base64_encode(substr($data, 3, strlen($data) - 3));
132
-
133
- return true;
134
- }
135
-
136
- return false;
137
- }
138
-
139
- /**
140
- * parses the rdata of the Net_DNS2_Packet object
141
- *
142
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
143
- *
144
- * @return boolean
145
- * @access protected
146
- *
147
- */
148
- protected function rrSet(Net_DNS2_Packet &$packet)
149
- {
150
- if ($this->rdlength > 0) {
151
-
152
- //
153
- // unpack the id type and digest type
154
- //
155
- $x = unpack('nid_type/Cdigest_type', $this->rdata);
156
-
157
- $this->id_type = $x['id_type'];
158
- $this->digest_type = $x['digest_type'];
159
-
160
- //
161
- // copy out the digest
162
- //
163
- $this->digest = base64_encode(
164
- substr($this->rdata, 3, $this->rdlength - 3)
165
- );
166
-
167
- return true;
168
- }
169
-
170
- return false;
171
- }
172
-
173
- /**
174
- * returns the rdata portion of the DNS packet
175
- *
176
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
177
- * compressed names
178
- *
179
- * @return mixed either returns a binary packed
180
- * string or null on failure
181
- * @access protected
182
- *
183
- */
184
- protected function rrGet(Net_DNS2_Packet &$packet)
185
- {
186
- if (strlen($this->digest) > 0) {
187
-
188
- $data = pack('nC', $this->id_type, $this->digest_type) .
189
- base64_decode($this->digest);
190
-
191
- $packet->offset += strlen($data);
192
-
193
- return $data;
194
- }
195
-
196
- return null;
197
- }
198
- }
199
-
200
- /*
201
- * Local variables:
202
- * tab-width: 4
203
- * c-basic-offset: 4
204
- * c-hanging-comment-ender-p: nil
205
- * End:
206
- */
207
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/DLV.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * The DLV RR is implemented exactly like the DS RR; so we just extend that
54
- * class, and use all of it's methods
55
- *
56
- * @category Networking
57
- * @package Net_DNS2
58
- * @author Mike Pultz <mike@mikepultz.com>
59
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
60
- * @link http://pear.php.net/package/Net_DNS2
61
- * @see Net_DNS2_RR
62
- *
63
- */
64
- class Net_DNS2_RR_DLV extends Net_DNS2_RR_DS
65
- {
66
- }
67
-
68
- /*
69
- * Local variables:
70
- * tab-width: 4
71
- * c-basic-offset: 4
72
- * c-hanging-comment-ender-p: nil
73
- * End:
74
- */
75
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/DNAME.php DELETED
@@ -1,153 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * DNAME Resource Record - RFC2672 section 3
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * / DNAME /
57
- * / /
58
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
59
- *
60
- * @category Networking
61
- * @package Net_DNS2
62
- * @author Mike Pultz <mike@mikepultz.com>
63
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
64
- * @link http://pear.php.net/package/Net_DNS2
65
- * @see Net_DNS2_RR
66
- *
67
- */
68
- class Net_DNS2_RR_DNAME extends Net_DNS2_RR
69
- {
70
- /*
71
- * The target name
72
- */
73
- public $dname;
74
-
75
- /**
76
- * method to return the rdata portion of the packet as a string
77
- *
78
- * @return string
79
- * @access protected
80
- *
81
- */
82
- protected function rrToString()
83
- {
84
- return $this->cleanString($this->dname) . '.';
85
- }
86
-
87
- /**
88
- * parses the rdata portion from a standard DNS config line
89
- *
90
- * @param array $rdata a string split line of values for the rdata
91
- *
92
- * @return boolean
93
- * @access protected
94
- *
95
- */
96
- protected function rrFromString(array $rdata)
97
- {
98
- $this->dname = $this->cleanString(array_shift($rdata));
99
- return true;
100
- }
101
-
102
- /**
103
- * parses the rdata of the Net_DNS2_Packet object
104
- *
105
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
106
- *
107
- * @return boolean
108
- * @access protected
109
- *
110
- */
111
- protected function rrSet(Net_DNS2_Packet &$packet)
112
- {
113
- if ($this->rdlength > 0) {
114
-
115
- $offset = $packet->offset;
116
- $this->dname = Net_DNS2_Packet::expand($packet, $offset);
117
-
118
- return true;
119
- }
120
-
121
- return false;
122
- }
123
-
124
- /**
125
- * returns the rdata portion of the DNS packet
126
- *
127
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
128
- * compressed names
129
- *
130
- * @return mixed either returns a binary packed
131
- * string or null on failure
132
- * @access protected
133
- *
134
- */
135
- protected function rrGet(Net_DNS2_Packet &$packet)
136
- {
137
- if (strlen($this->dname) > 0) {
138
-
139
- return $packet->compress($this->dname, $packet->offset);
140
- }
141
-
142
- return null;
143
- }
144
- }
145
-
146
- /*
147
- * Local variables:
148
- * tab-width: 4
149
- * c-basic-offset: 4
150
- * c-hanging-comment-ender-p: nil
151
- * End:
152
- */
153
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/DNSKEY.php DELETED
@@ -1,198 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * DNSKEY Resource Record - RFC4034 sction 2.1
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | Flags | Protocol | Algorithm |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59
- * / /
60
- * / Public Key /
61
- * / /
62
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_DNSKEY extends Net_DNS2_RR
73
- {
74
- /*
75
- * flags
76
- */
77
- public $flags;
78
-
79
- /*
80
- * protocol
81
- */
82
- public $protocol;
83
-
84
- /*
85
- * algorithm used
86
- */
87
- public $algorithm;
88
-
89
- /*
90
- * the public key
91
- */
92
- public $key;
93
-
94
- /**
95
- * method to return the rdata portion of the packet as a string
96
- *
97
- * @return string
98
- * @access protected
99
- *
100
- */
101
- protected function rrToString()
102
- {
103
- return $this->flags . ' ' . $this->protocol . ' ' .
104
- $this->algorithm . ' ' . $this->key;
105
- }
106
-
107
- /**
108
- * parses the rdata portion from a standard DNS config line
109
- *
110
- * @param array $rdata a string split line of values for the rdata
111
- *
112
- * @return boolean
113
- * @access protected
114
- *
115
- */
116
- protected function rrFromString(array $rdata)
117
- {
118
- $this->flags = array_shift($rdata);
119
- $this->protocol = array_shift($rdata);
120
- $this->algorithm = array_shift($rdata);
121
- $this->key = implode(' ', $rdata);
122
-
123
- return true;
124
- }
125
-
126
- /**
127
- * parses the rdata of the Net_DNS2_Packet object
128
- *
129
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
130
- *
131
- * @return boolean
132
- * @access protected
133
- *
134
- */
135
- protected function rrSet(Net_DNS2_Packet &$packet)
136
- {
137
- if ($this->rdlength > 0) {
138
-
139
- //
140
- // unpack the flags, protocol and algorithm
141
- //
142
- $x = unpack('nflags/Cprotocol/Calgorithm', $this->rdata);
143
-
144
- //
145
- // TODO: right now we're just displaying what's in DNS; we really
146
- // should be parsing bit 7 and bit 15 of the flags field, and store
147
- // those separately.
148
- //
149
- // right now the DNSSEC implementation is really just for display,
150
- // we don't validate or handle any of the keys
151
- //
152
- $this->flags = $x['flags'];
153
- $this->protocol = $x['protocol'];
154
- $this->algorithm = $x['algorithm'];
155
-
156
- $this->key = base64_encode(substr($this->rdata, 4));
157
-
158
- return true;
159
- }
160
-
161
- return false;
162
- }
163
-
164
- /**
165
- * returns the rdata portion of the DNS packet
166
- *
167
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
168
- * compressed names
169
- *
170
- * @return mixed either returns a binary packed
171
- * string or null on failure
172
- * @access protected
173
- *
174
- */
175
- protected function rrGet(Net_DNS2_Packet &$packet)
176
- {
177
- if (strlen($this->key) > 0) {
178
-
179
- $data = pack('nCC', $this->flags, $this->protocol, $this->algorithm);
180
- $data .= base64_decode($this->key);
181
-
182
- $packet->offset += strlen($data);
183
-
184
- return $data;
185
- }
186
-
187
- return null;
188
- }
189
- }
190
-
191
- /*
192
- * Local variables:
193
- * tab-width: 4
194
- * c-basic-offset: 4
195
- * c-hanging-comment-ender-p: nil
196
- * End:
197
- */
198
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/DS.php DELETED
@@ -1,209 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * DS Resource Record - RFC4034 sction 5.1
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | Key Tag | Algorithm | Digest Type |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59
- * / /
60
- * / Digest /
61
- * / /
62
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_DS extends Net_DNS2_RR
73
- {
74
- /*
75
- * key tag
76
- */
77
- public $keytag;
78
-
79
- /*
80
- * algorithm number
81
- */
82
- public $algorithm;
83
-
84
- /*
85
- * algorithm used to construct the digest
86
- */
87
- public $digesttype;
88
-
89
- /*
90
- * the digest data
91
- */
92
- public $digest;
93
-
94
- /**
95
- * method to return the rdata portion of the packet as a string
96
- *
97
- * @return string
98
- * @access protected
99
- *
100
- */
101
- protected function rrToString()
102
- {
103
- return $this->keytag . ' ' . $this->algorithm . ' ' .
104
- $this->digesttype . ' ' . $this->digest;
105
- }
106
-
107
- /**
108
- * parses the rdata portion from a standard DNS config line
109
- *
110
- * @param array $rdata a string split line of values for the rdata
111
- *
112
- * @return boolean
113
- * @access protected
114
- *
115
- */
116
- protected function rrFromString(array $rdata)
117
- {
118
- $this->keytag = array_shift($rdata);
119
- $this->algorithm = array_shift($rdata);
120
- $this->digesttype = array_shift($rdata);
121
- $this->digest = implode('', $rdata);
122
-
123
- return true;
124
- }
125
-
126
- /**
127
- * parses the rdata of the Net_DNS2_Packet object
128
- *
129
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
130
- *
131
- * @return boolean
132
- * @access protected
133
- *
134
- */
135
- protected function rrSet(Net_DNS2_Packet &$packet)
136
- {
137
- if ($this->rdlength > 0) {
138
-
139
- //
140
- // unpack the keytag, algorithm and digesttype
141
- //
142
- $x = unpack('nkeytag/Calgorithm/Cdigesttype', $this->rdata);
143
-
144
- $this->keytag = $x['keytag'];
145
- $this->algorithm = $x['algorithm'];
146
- $this->digesttype = $x['digesttype'];
147
-
148
- //
149
- // figure out the digest size
150
- //
151
- $digest_size = 0;
152
- if ($this->digesttype == 1) {
153
-
154
- $digest_size = 20; // SHA1
155
-
156
- } else if ($this->digesttype == 2) {
157
-
158
- $digest_size = 32; // SHA256
159
- }
160
-
161
- //
162
- // copy the digest
163
- //
164
- $x = unpack('H*', substr($this->rdata, 4, $digest_size));
165
- $this->digest = $x[1];
166
-
167
- return true;
168
- }
169
-
170
- return false;
171
- }
172
-
173
- /**
174
- * returns the rdata portion of the DNS packet
175
- *
176
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
177
- * compressed names
178
- *
179
- * @return mixed either returns a binary packed
180
- * string or null on failure
181
- * @access protected
182
- *
183
- */
184
- protected function rrGet(Net_DNS2_Packet &$packet)
185
- {
186
- if (strlen($this->digest) > 0) {
187
-
188
- $data = pack(
189
- 'nCCH*',
190
- $this->keytag, $this->algorithm, $this->digesttype, $this->digest
191
- );
192
-
193
- $packet->offset += strlen($data);
194
-
195
- return $data;
196
- }
197
-
198
- return null;
199
- }
200
- }
201
-
202
- /*
203
- * Local variables:
204
- * tab-width: 4
205
- * c-basic-offset: 4
206
- * c-hanging-comment-ender-p: nil
207
- * End:
208
- */
209
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/EID.php DELETED
@@ -1,130 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * EID Resource Record - undefined; the rdata is simply used as-is in it's
54
- * binary format, so not process has to be done.
55
- *
56
- * @category Networking
57
- * @package Net_DNS2
58
- * @author Mike Pultz <mike@mikepultz.com>
59
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
60
- * @link http://pear.php.net/package/Net_DNS2
61
- * @see Net_DNS2_RR
62
- *
63
- */
64
- class Net_DNS2_RR_EID extends Net_DNS2_RR
65
- {
66
- /**
67
- * method to return the rdata portion of the packet as a string
68
- *
69
- * @return string
70
- * @access protected
71
- *
72
- */
73
- protected function rrToString()
74
- {
75
- return '';
76
- }
77
-
78
- /**
79
- * parses the rdata portion from a standard DNS config line
80
- *
81
- * @param array $rdata a string split line of values for the rdata
82
- *
83
- * @return boolean
84
- * @access protected
85
- *
86
- */
87
- protected function rrFromString(array $rdata)
88
- {
89
- return true;
90
- }
91
-
92
- /**
93
- * parses the rdata of the Net_DNS2_Packet object
94
- *
95
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
96
- *
97
- * @return boolean
98
- * @access protected
99
- *
100
- */
101
- protected function rrSet(Net_DNS2_Packet &$packet)
102
- {
103
- return true;
104
- }
105
-
106
- /**
107
- * returns the rdata portion of the DNS packet
108
- *
109
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
110
- * compressed names
111
- *
112
- * @return mixed either returns a binary packed
113
- * string or null on failure
114
- * @access protected
115
- *
116
- */
117
- protected function rrGet(Net_DNS2_Packet &$packet)
118
- {
119
- return $this->rdata;
120
- }
121
- }
122
-
123
- /*
124
- * Local variables:
125
- * tab-width: 4
126
- * c-basic-offset: 4
127
- * c-hanging-comment-ender-p: nil
128
- * End:
129
- */
130
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/EUI48.php DELETED
@@ -1,187 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2013 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.3.2
49
- *
50
- */
51
-
52
- /**
53
- * EUI48 Resource Record - RFC7043 section 3.1
54
- *
55
- * 0 1 2 3
56
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
57
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
58
- * | EUI-48 Address |
59
- * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60
- * | |
61
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
62
- *
63
- * @category Networking
64
- * @package Net_DNS2
65
- * @author Mike Pultz <mike@mikepultz.com>
66
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
67
- * @link http://pear.php.net/package/Net_DNS2
68
- * @see Net_DNS2_RR
69
- *
70
- */
71
- class Net_DNS2_RR_EUI48 extends Net_DNS2_RR
72
- {
73
- /*
74
- * The EUI48 address, in hex format
75
- */
76
- public $address;
77
-
78
- /**
79
- * method to return the rdata portion of the packet as a string
80
- *
81
- * @return string
82
- * @access protected
83
- *
84
- */
85
- protected function rrToString()
86
- {
87
- return $this->address;
88
- }
89
-
90
- /**
91
- * parses the rdata portion from a standard DNS config line
92
- *
93
- * @param array $rdata a string split line of values for the rdata
94
- *
95
- * @return boolean
96
- * @access protected
97
- *
98
- */
99
- protected function rrFromString(array $rdata)
100
- {
101
- $value = array_shift($rdata);
102
-
103
- //
104
- // re: RFC 7043, the field must be represented as six two-digit hex numbers
105
- // separated by hyphens.
106
- //
107
- $a = explode('-', $value);
108
- if (count($a) != 6) {
109
-
110
- return false;
111
- }
112
-
113
- //
114
- // make sure they're all hex values
115
- //
116
- foreach ($a as $i) {
117
- if (ctype_xdigit($i) == false) {
118
- return false;
119
- }
120
- }
121
-
122
- //
123
- // store it
124
- //
125
- $this->address = strtolower($value);
126
-
127
- return true;
128
- }
129
-
130
- /**
131
- * parses the rdata of the Net_DNS2_Packet object
132
- *
133
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
134
- *
135
- * @return boolean
136
- * @access protected
137
- *
138
- */
139
- protected function rrSet(Net_DNS2_Packet &$packet)
140
- {
141
- if ($this->rdlength > 0) {
142
-
143
- $x = unpack('C6', $this->rdata);
144
- if (count($x) == 6) {
145
-
146
- $this->address = vsprintf('%02x-%02x-%02x-%02x-%02x-%02x', $x);
147
- return true;
148
- }
149
- }
150
-
151
- return false;
152
- }
153
-
154
- /**
155
- * returns the rdata portion of the DNS packet
156
- *
157
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
158
- * compressed names
159
- *
160
- * @return mixed either returns a binary packed
161
- * string or null on failure
162
- * @access protected
163
- *
164
- */
165
- protected function rrGet(Net_DNS2_Packet &$packet)
166
- {
167
- $data = '';
168
-
169
- $a = explode('-', $this->address);
170
- foreach ($a as $b) {
171
-
172
- $data .= chr(hexdec($b));
173
- }
174
-
175
- $packet->offset += 6;
176
- return $data;
177
- }
178
- }
179
-
180
- /*
181
- * Local variables:
182
- * tab-width: 4
183
- * c-basic-offset: 4
184
- * c-hanging-comment-ender-p: nil
185
- * End:
186
- */
187
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/EUI64.php DELETED
@@ -1,188 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2013 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.3.2
49
- *
50
- */
51
-
52
- /**
53
- * EUI64 Resource Record - RFC7043 section 4.1
54
- *
55
- * 0 1 2 3
56
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
57
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
58
- * | EUI-48 Address |
59
- * | |
60
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61
- *
62
- * @category Networking
63
- * @package Net_DNS2
64
- * @author Mike Pultz <mike@mikepultz.com>
65
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
66
- * @link http://pear.php.net/package/Net_DNS2
67
- * @see Net_DNS2_RR
68
- *
69
- */
70
- class Net_DNS2_RR_EUI64 extends Net_DNS2_RR
71
- {
72
- /*
73
- * The EUI64 address, in hex format
74
- */
75
- public $address;
76
-
77
- /**
78
- * method to return the rdata portion of the packet as a string
79
- *
80
- * @return string
81
- * @access protected
82
- *
83
- */
84
- protected function rrToString()
85
- {
86
- return $this->address;
87
- }
88
-
89
- /**
90
- * parses the rdata portion from a standard DNS config line
91
- *
92
- * @param array $rdata a string split line of values for the rdata
93
- *
94
- * @return boolean
95
- * @access protected
96
- *
97
- */
98
- protected function rrFromString(array $rdata)
99
- {
100
- $value = array_shift($rdata);
101
-
102
- //
103
- // re: RFC 7043, the field must be represented as 8 two-digit hex numbers
104
- // separated by hyphens.
105
- //
106
- $a = explode('-', $value);
107
- if (count($a) != 8) {
108
-
109
- return false;
110
- }
111
-
112
- //
113
- // make sure they're all hex values
114
- //
115
- foreach ($a as $i) {
116
- if (ctype_xdigit($i) == false) {
117
- return false;
118
- }
119
- }
120
-
121
- //
122
- // store it
123
- //
124
- $this->address = strtolower($value);
125
-
126
- return true;
127
- }
128
-
129
- /**
130
- * parses the rdata of the Net_DNS2_Packet object
131
- *
132
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
133
- *
134
- * @return boolean
135
- * @access protected
136
- *
137
- */
138
- protected function rrSet(Net_DNS2_Packet &$packet)
139
- {
140
- if ($this->rdlength > 0) {
141
-
142
- $x = unpack('C8', $this->rdata);
143
- if (count($x) == 8) {
144
-
145
- $this->address = vsprintf(
146
- '%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x', $x
147
- );
148
- return true;
149
- }
150
- }
151
-
152
- return false;
153
- }
154
-
155
- /**
156
- * returns the rdata portion of the DNS packet
157
- *
158
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
159
- * compressed names
160
- *
161
- * @return mixed either returns a binary packed
162
- * string or null on failure
163
- * @access protected
164
- *
165
- */
166
- protected function rrGet(Net_DNS2_Packet &$packet)
167
- {
168
- $data = '';
169
-
170
- $a = explode('-', $this->address);
171
- foreach ($a as $b) {
172
-
173
- $data .= chr(hexdec($b));
174
- }
175
-
176
- $packet->offset += 8;
177
- return $data;
178
- }
179
- }
180
-
181
- /*
182
- * Local variables:
183
- * tab-width: 4
184
- * c-basic-offset: 4
185
- * c-hanging-comment-ender-p: nil
186
- * End:
187
- */
188
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/HINFO.php DELETED
@@ -1,175 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * HINFO Resource Record - RFC1035 section 3.3.2
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * / CPU /
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * / OS /
59
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
60
- *
61
- * @category Networking
62
- * @package Net_DNS2
63
- * @author Mike Pultz <mike@mikepultz.com>
64
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
65
- * @link http://pear.php.net/package/Net_DNS2
66
- * @see Net_DNS2_RR
67
- *
68
- */
69
- class Net_DNS2_RR_HINFO extends Net_DNS2_RR
70
- {
71
- /*
72
- * computer informatino
73
- */
74
- public $cpu;
75
-
76
- /*
77
- * operataing system
78
- */
79
- public $os;
80
-
81
- /**
82
- * method to return the rdata portion of the packet as a string
83
- *
84
- * @return string
85
- * @access protected
86
- *
87
- */
88
- protected function rrToString()
89
- {
90
- return $this->formatString($this->cpu) . ' ' .
91
- $this->formatString($this->os);
92
- }
93
-
94
- /**
95
- * parses the rdata portion from a standard DNS config line
96
- *
97
- * @param array $rdata a string split line of values for the rdata
98
- *
99
- * @return boolean
100
- * @access protected
101
- *
102
- */
103
- protected function rrFromString(array $rdata)
104
- {
105
- $data = $this->buildString($rdata);
106
- if (count($data) == 2) {
107
-
108
- $this->cpu = $data[0];
109
- $this->os = $data[1];
110
-
111
- return true;
112
- }
113
-
114
- return false;
115
- }
116
-
117
- /**
118
- * parses the rdata of the Net_DNS2_Packet object
119
- *
120
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
121
- *
122
- * @return boolean
123
- * @access protected
124
- *
125
- */
126
- protected function rrSet(Net_DNS2_Packet &$packet)
127
- {
128
- if ($this->rdlength > 0) {
129
-
130
- $offset = $packet->offset;
131
-
132
- $this->cpu = trim(Net_DNS2_Packet::label($packet, $offset), '"');
133
- $this->os = trim(Net_DNS2_Packet::label($packet, $offset), '"');
134
-
135
- return true;
136
- }
137
-
138
- return false;
139
- }
140
-
141
- /**
142
- * returns the rdata portion of the DNS packet
143
- *
144
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
145
- * compressed names
146
- *
147
- * @return mixed either returns a binary packed
148
- * string or null on failure
149
- * @access protected
150
- *
151
- */
152
- protected function rrGet(Net_DNS2_Packet &$packet)
153
- {
154
- if (strlen($this->cpu) > 0) {
155
-
156
- $data = chr(strlen($this->cpu)) . $this->cpu;
157
- $data .= chr(strlen($this->os)) . $this->os;
158
-
159
- $packet->offset += strlen($data);
160
-
161
- return $data;
162
- }
163
-
164
- return null;
165
- }
166
- }
167
-
168
- /*
169
- * Local variables:
170
- * tab-width: 4
171
- * c-basic-offset: 4
172
- * c-hanging-comment-ender-p: nil
173
- * End:
174
- */
175
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/HIP.php DELETED
@@ -1,287 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.0.0
49
- *
50
- */
51
-
52
- /**
53
- * HIP Resource Record - RFC5205 section 5
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | HIT length | PK algorithm | PK length |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59
- * | |
60
- * ~ HIT ~
61
- * | |
62
- * + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63
- * | | |
64
- * +-+-+-+-+-+-+-+-+-+-+-+ +
65
- * | Public Key |
66
- * ~ ~
67
- * | |
68
- * + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
69
- * | | |
70
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
71
- * | |
72
- * ~ Rendezvous Servers ~
73
- * | |
74
- * + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
75
- * | |
76
- * +-+-+-+-+-+-+-+
77
- *
78
- * @category Networking
79
- * @package Net_DNS2
80
- * @author Mike Pultz <mike@mikepultz.com>
81
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
82
- * @link http://pear.php.net/package/Net_DNS2
83
- * @see Net_DNS2_RR
84
- *
85
- */
86
- class Net_DNS2_RR_HIP extends Net_DNS2_RR
87
- {
88
- /*
89
- * The length of the HIT field
90
- */
91
- public $hit_length;
92
-
93
- /*
94
- * the public key cryptographic algorithm
95
- */
96
- public $pk_algorithm;
97
-
98
- /*
99
- * the length of the public key field
100
- */
101
- public $pk_length;
102
-
103
- /*
104
- * The HIT is stored as a binary value in network byte order.
105
- */
106
- public $hit;
107
-
108
- /*
109
- * The public key
110
- */
111
- public $public_key;
112
-
113
- /*
114
- * a list of rendezvous servers
115
- */
116
- public $rendezvous_servers = array();
117
-
118
- /**
119
- * method to return the rdata portion of the packet as a string
120
- *
121
- * @return string
122
- * @access protected
123
- *
124
- */
125
- protected function rrToString()
126
- {
127
- $out = $this->pk_algorithm . ' ' .
128
- $this->hit . ' ' . $this->public_key . ' ';
129
-
130
- foreach ($this->rendezvous_servers as $index => $server) {
131
-
132
- $out .= $server . '. ';
133
- }
134
-
135
- return trim($out);
136
- }
137
-
138
- /**
139
- * parses the rdata portion from a standard DNS config line
140
- *
141
- * @param array $rdata a string split line of values for the rdata
142
- *
143
- * @return boolean
144
- * @access protected
145
- *
146
- */
147
- protected function rrFromString(array $rdata)
148
- {
149
- $this->pk_algorithm = array_shift($rdata);
150
- $this->hit = strtoupper(array_shift($rdata));
151
- $this->public_key = array_shift($rdata);
152
-
153
- //
154
- // anything left on the array, must be one or more rendezevous servers. add
155
- // them and strip off the trailing dot
156
- //
157
- if (count($rdata) > 0) {
158
-
159
- $this->rendezvous_servers = preg_replace('/\.$/', '', $rdata);
160
- }
161
-
162
- //
163
- // store the lengths;
164
- //
165
- $this->hit_length = strlen(pack('H*', $this->hit));
166
- $this->pk_length = strlen(base64_decode($this->public_key));
167
-
168
- return true;
169
- }
170
-
171
- /**
172
- * parses the rdata of the Net_DNS2_Packet object
173
- *
174
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
175
- *
176
- * @return boolean
177
- * @access protected
178
- *
179
- */
180
- protected function rrSet(Net_DNS2_Packet &$packet)
181
- {
182
- if ($this->rdlength > 0) {
183
-
184
- //
185
- // unpack the algorithm and length values
186
- //
187
- $x = unpack('Chit_length/Cpk_algorithm/npk_length', $this->rdata);
188
-
189
- $this->hit_length = $x['hit_length'];
190
- $this->pk_algorithm = $x['pk_algorithm'];
191
- $this->pk_length = $x['pk_length'];
192
-
193
- $offset = 4;
194
-
195
- //
196
- // copy out the HIT value
197
- //
198
- $hit = unpack('H*', substr($this->rdata, $offset, $this->hit_length));
199
-
200
- $this->hit = strtoupper($hit[1]);
201
- $offset += $this->hit_length;
202
-
203
- //
204
- // copy out the public key
205
- //
206
- $this->public_key = base64_encode(
207
- substr($this->rdata, $offset, $this->pk_length)
208
- );
209
- $offset += $this->pk_length;
210
-
211
- //
212
- // copy out any possible rendezvous servers
213
- //
214
- $offset = $packet->offset + $offset;
215
-
216
- while ( ($offset - $packet->offset) < $this->rdlength) {
217
-
218
- $this->rendezvous_servers[] = Net_DNS2_Packet::expand(
219
- $packet, $offset
220
- );
221
- }
222
-
223
- return true;
224
- }
225
-
226
- return false;
227
- }
228
-
229
- /**
230
- * returns the rdata portion of the DNS packet
231
- *
232
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
233
- * compressed names
234
- *
235
- * @return mixed either returns a binary packed
236
- * string or null on failure
237
- * @access protected
238
- *
239
- */
240
- protected function rrGet(Net_DNS2_Packet &$packet)
241
- {
242
- if ( (strlen($this->hit) > 0) && (strlen($this->public_key) > 0) ) {
243
-
244
- //
245
- // pack the length, algorithm and HIT values
246
- //
247
- $data = pack(
248
- 'CCnH*',
249
- $this->hit_length,
250
- $this->pk_algorithm,
251
- $this->pk_length,
252
- $this->hit
253
- );
254
-
255
- //
256
- // add the public key
257
- //
258
- $data .= base64_decode($this->public_key);
259
-
260
- //
261
- // add the offset
262
- //
263
- $packet->offset += strlen($data);
264
-
265
- //
266
- // add each rendezvous server
267
- //
268
- foreach ($this->rendezvous_servers as $index => $server) {
269
-
270
- $data .= $packet->compress($server, $packet->offset);
271
- }
272
-
273
- return $data;
274
- }
275
-
276
- return null;
277
- }
278
- }
279
-
280
- /*
281
- * Local variables:
282
- * tab-width: 4
283
- * c-basic-offset: 4
284
- * c-hanging-comment-ender-p: nil
285
- * End:
286
- */
287
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/IPSECKEY.php DELETED
@@ -1,386 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * IPSECKEY Resource Record - RFC4025 section 2.1
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | precedence | gateway type | algorithm | gateway |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-------------+ +
59
- * ~ gateway ~
60
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61
- * | /
62
- * / public key /
63
- * / /
64
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
65
- *
66
- * @category Networking
67
- * @package Net_DNS2
68
- * @author Mike Pultz <mike@mikepultz.com>
69
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
70
- * @link http://pear.php.net/package/Net_DNS2
71
- * @see Net_DNS2_RR
72
- *
73
- */
74
- class Net_DNS2_RR_IPSECKEY extends Net_DNS2_RR
75
- {
76
- const GATEWAY_TYPE_NONE = 0;
77
- const GATEWAY_TYPE_IPV4 = 1;
78
- const GATEWAY_TYPE_IPV6 = 2;
79
- const GATEWAY_TYPE_DOMAIN = 3;
80
-
81
- const ALGORITHM_NONE = 0;
82
- const ALGORITHM_DSA = 1;
83
- const ALGORITHM_RSA = 2;
84
-
85
- /*
86
- * Precedence (used the same was as a preference field)
87
- */
88
- public $precedence;
89
-
90
- /*
91
- * Gateway type - specifies the format of the gataway information
92
- * This can be either:
93
- *
94
- * 0 No Gateway
95
- * 1 IPv4 address
96
- * 2 IPV6 address
97
- * 3 wire-encoded domain name (not compressed)
98
- *
99
- */
100
- public $gateway_type;
101
-
102
- /*
103
- * The algorithm used
104
- *
105
- * This can be:
106
- *
107
- * 0 No key is present
108
- * 1 DSA key is present
109
- * 2 RSA key is present
110
- *
111
- */
112
- public $algorithm;
113
-
114
- /*
115
- * The gatway information
116
- */
117
- public $gateway;
118
-
119
- /*
120
- * the public key
121
- */
122
- public $key;
123
-
124
- /**
125
- * method to return the rdata portion of the packet as a string
126
- *
127
- * @return string
128
- * @access protected
129
- *
130
- */
131
- protected function rrToString()
132
- {
133
- $out = $this->precedence . ' ' . $this->gateway_type . ' ' .
134
- $this->algorithm . ' ';
135
-
136
- switch($this->gateway_type) {
137
- case self::GATEWAY_TYPE_NONE:
138
- $out .= '. ';
139
- break;
140
-
141
- case self::GATEWAY_TYPE_IPV4:
142
- case self::GATEWAY_TYPE_IPV6:
143
- $out .= $this->gateway . ' ';
144
- break;
145
-
146
- case self::GATEWAY_TYPE_DOMAIN:
147
- $out .= $this->gateway . '. ';
148
- break;
149
- }
150
-
151
- $out .= $this->key;
152
- return $out;
153
- }
154
-
155
- /**
156
- * parses the rdata portion from a standard DNS config line
157
- *
158
- * @param array $rdata a string split line of values for the rdata
159
- *
160
- * @return boolean
161
- * @access protected
162
- *
163
- */
164
- protected function rrFromString(array $rdata)
165
- {
166
- //
167
- // load the data
168
- //
169
- $precedence = array_shift($rdata);
170
- $gateway_type = array_shift($rdata);
171
- $algorithm = array_shift($rdata);
172
- $gateway = strtolower(trim(array_shift($rdata)));
173
- $key = array_shift($rdata);
174
-
175
- //
176
- // validate it
177
- //
178
- switch($gateway_type) {
179
- case self::GATEWAY_TYPE_NONE:
180
- $gateway = '';
181
- break;
182
-
183
- case self::GATEWAY_TYPE_IPV4:
184
- if (Net_DNS2::isIPv4($gateway) == false) {
185
- return false;
186
- }
187
- break;
188
-
189
- case self::GATEWAY_TYPE_IPV6:
190
- if (Net_DNS2::isIPv6($gateway) == false) {
191
- return false;
192
- }
193
- break;
194
-
195
- case self::GATEWAY_TYPE_DOMAIN:
196
- ; // do nothing
197
- break;
198
-
199
- default:
200
- return false;
201
- }
202
-
203
- //
204
- // check the algorithm and key
205
- //
206
- switch($algorithm) {
207
- case self::ALGORITHM_NONE:
208
- $key = '';
209
- break;
210
-
211
- case self::ALGORITHM_DSA:
212
- case self::ALGORITHM_RSA:
213
- ; // do nothing
214
- break;
215
-
216
- default:
217
- return false;
218
- }
219
-
220
- //
221
- // store the values
222
- //
223
- $this->precedence = $precedence;
224
- $this->gateway_type = $gateway_type;
225
- $this->algorithm = $algorithm;
226
- $this->gateway = $gateway;
227
- $this->key = $key;
228
-
229
- return true;
230
- }
231
-
232
- /**
233
- * parses the rdata of the Net_DNS2_Packet object
234
- *
235
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
236
- *
237
- * @return boolean
238
- * @access protected
239
- *
240
- */
241
- protected function rrSet(Net_DNS2_Packet &$packet)
242
- {
243
- if ($this->rdlength > 0) {
244
-
245
- //
246
- // parse off the precedence, gateway type and algorithm
247
- //
248
- $x = unpack('Cprecedence/Cgateway_type/Calgorithm', $this->rdata);
249
-
250
- $this->precedence = $x['precedence'];
251
- $this->gateway_type = $x['gateway_type'];
252
- $this->algorithm = $x['algorithm'];
253
-
254
- $offset = 3;
255
-
256
- //
257
- // extract the gatway based on the type
258
- //
259
- switch($this->gateway_type) {
260
- case self::GATEWAY_TYPE_NONE:
261
- $this->gateway = '';
262
- break;
263
-
264
- case self::GATEWAY_TYPE_IPV4:
265
- $this->gateway = inet_ntop(substr($this->rdata, $offset, 4));
266
- $offset += 4;
267
- break;
268
-
269
- case self::GATEWAY_TYPE_IPV6:
270
- $ip = unpack('n8', substr($this->rdata, $offset, 16));
271
- if (count($ip) == 8) {
272
-
273
- $this->gateway = vsprintf('%x:%x:%x:%x:%x:%x:%x:%x', $ip);
274
- $offset += 16;
275
- } else {
276
-
277
- return false;
278
- }
279
- break;
280
-
281
- case self::GATEWAY_TYPE_DOMAIN:
282
-
283
- $doffset = $offset + $packet->offset;
284
- $this->gateway = Net_DNS2_Packet::expand($packet, $doffset);
285
- $offset = ($doffset - $packet->offset);
286
- break;
287
-
288
- default:
289
- return false;
290
- }
291
-
292
- //
293
- // extract the key
294
- //
295
- switch($this->algorithm) {
296
- case self::ALGORITHM_NONE:
297
- $this->key = '';
298
- break;
299
-
300
- case self::ALGORITHM_DSA:
301
- case self::ALGORITHM_RSA:
302
- $this->key = base64_encode(substr($this->rdata, $offset));
303
- break;
304
-
305
- default:
306
- return false;
307
- }
308
-
309
- return true;
310
- }
311
-
312
- return false;
313
- }
314
-
315
- /**
316
- * returns the rdata portion of the DNS packet
317
- *
318
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
319
- * compressed names
320
- *
321
- * @return mixed either returns a binary packed
322
- * string or null on failure
323
- * @access protected
324
- *
325
- */
326
- protected function rrGet(Net_DNS2_Packet &$packet)
327
- {
328
- //
329
- // pack the precedence, gateway type and algorithm
330
- //
331
- $data = pack(
332
- 'CCC', $this->precedence, $this->gateway_type, $this->algorithm
333
- );
334
-
335
- //
336
- // add the gateway based on the type
337
- //
338
- switch($this->gateway_type) {
339
- case self::GATEWAY_TYPE_NONE:
340
- ; // add nothing
341
- break;
342
-
343
- case self::GATEWAY_TYPE_IPV4:
344
- case self::GATEWAY_TYPE_IPV6:
345
- $data .= inet_pton($this->gateway);
346
- break;
347
-
348
- case self::GATEWAY_TYPE_DOMAIN:
349
- $data .= chr(strlen($this->gateway)) . $this->gateway;
350
- break;
351
-
352
- default:
353
- return null;
354
- }
355
-
356
- //
357
- // add the key if there's one specified
358
- //
359
- switch($this->algorithm) {
360
- case self::ALGORITHM_NONE:
361
- ; // add nothing
362
- break;
363
-
364
- case self::ALGORITHM_DSA:
365
- case self::ALGORITHM_RSA:
366
- $data .= base64_decode($this->key);
367
- break;
368
-
369
- default:
370
- return null;
371
- }
372
-
373
- $packet->offset += strlen($data);
374
-
375
- return $data;
376
- }
377
- }
378
-
379
- /*
380
- * Local variables:
381
- * tab-width: 4
382
- * c-basic-offset: 4
383
- * c-hanging-comment-ender-p: nil
384
- * End:
385
- */
386
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/ISDN.php DELETED
@@ -1,190 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * ISDN Resource Record - RFC1183 section 3.2
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * / ISDN-address /
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * / SA /
59
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
60
- *
61
- * @category Networking
62
- * @package Net_DNS2
63
- * @author Mike Pultz <mike@mikepultz.com>
64
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
65
- * @link http://pear.php.net/package/Net_DNS2
66
- * @see Net_DNS2_RR
67
- *
68
- */
69
- class Net_DNS2_RR_ISDN extends Net_DNS2_RR
70
- {
71
- /*
72
- * ISDN Number
73
- */
74
- public $isdnaddress;
75
-
76
- /*
77
- * Sub-Address
78
- */
79
- public $sa;
80
-
81
- /**
82
- * method to return the rdata portion of the packet as a string
83
- *
84
- * @return string
85
- * @access protected
86
- *
87
- */
88
- protected function rrToString()
89
- {
90
- return $this->formatString($this->isdnaddress) . ' ' .
91
- $this->formatString($this->sa);
92
- }
93
-
94
- /**
95
- * parses the rdata portion from a standard DNS config line
96
- *
97
- * @param array $rdata a string split line of values for the rdata
98
- *
99
- * @return boolean
100
- * @access protected
101
- *
102
- */
103
- protected function rrFromString(array $rdata)
104
- {
105
- $data = $this->buildString($rdata);
106
- if (count($data) >= 1) {
107
-
108
- $this->isdnaddress = $data[0];
109
- if (isset($data[1])) {
110
-
111
- $this->sa = $data[1];
112
- }
113
-
114
- return true;
115
- }
116
-
117
- return false;
118
- }
119
-
120
- /**
121
- * parses the rdata of the Net_DNS2_Packet object
122
- *
123
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
124
- *
125
- * @return boolean
126
- * @access protected
127
- *
128
- */
129
- protected function rrSet(Net_DNS2_Packet &$packet)
130
- {
131
- if ($this->rdlength > 0) {
132
-
133
- $this->isdnaddress = Net_DNS2_Packet::label($packet, $packet->offset);
134
-
135
- //
136
- // look for a SA (sub address) - it's optional
137
- //
138
- if ( (strlen($this->isdnaddress) + 1) < $this->rdlength) {
139
-
140
- $this->sa = Net_DNS2_Packet::label($packet, $packet->offset);
141
- } else {
142
-
143
- $this->sa = '';
144
- }
145
-
146
- return true;
147
- }
148
-
149
- return false;
150
- }
151
-
152
- /**
153
- * returns the rdata portion of the DNS packet
154
- *
155
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
156
- * compressed names
157
- *
158
- * @return mixed either returns a binary packed
159
- * string or null on failure
160
- * @access protected
161
- *
162
- */
163
- protected function rrGet(Net_DNS2_Packet &$packet)
164
- {
165
- if (strlen($this->isdnaddress) > 0) {
166
-
167
- $data = chr(strlen($this->isdnaddress)) . $this->isdnaddress;
168
- if (!empty($this->sa)) {
169
-
170
- $data .= chr(strlen($this->sa));
171
- $data .= $this->sa;
172
- }
173
-
174
- $packet->offset += strlen($data);
175
-
176
- return $data;
177
- }
178
-
179
- return null;
180
- }
181
- }
182
-
183
- /*
184
- * Local variables:
185
- * tab-width: 4
186
- * c-basic-offset: 4
187
- * c-hanging-comment-ender-p: nil
188
- * End:
189
- */
190
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/KEY.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * the KEY RR is implemented the same as the DNSKEY RR, the only difference
54
- * is how the flags data is parsed.
55
- *
56
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
57
- * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
58
- * | A/C | Z | XT| Z | Z | NAMTYP| Z | Z | Z | Z | SIG |
59
- * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
60
- *
61
- * DNSKEY only uses bits 7 and 15
62
- *
63
- * We're not doing anything with these flags right now, so duplicating the
64
- * class like this is fine.
65
- *
66
- * @category Networking
67
- * @package Net_DNS2
68
- * @author Mike Pultz <mike@mikepultz.com>
69
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
70
- * @link http://pear.php.net/package/Net_DNS2
71
- * @see Net_DNS2_RR
72
- *
73
- */
74
- class Net_DNS2_RR_KEY extends Net_DNS2_RR_DNSKEY
75
- {
76
- }
77
-
78
- /*
79
- * Local variables:
80
- * tab-width: 4
81
- * c-basic-offset: 4
82
- * c-hanging-comment-ender-p: nil
83
- * End:
84
- */
85
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/KX.php DELETED
@@ -1,179 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * KX Resource Record - RFC2230 section 3.1
54
- *
55
- * This class is almost identical to MX, except that the the exchanger
56
- * domain is not compressed, it's added as a label
57
- *
58
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
59
- * | PREFERENCE |
60
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
61
- * / EXCHANGER /
62
- * / /
63
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
64
- *
65
- * @category Networking
66
- * @package Net_DNS2
67
- * @author Mike Pultz <mike@mikepultz.com>
68
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
69
- * @link http://pear.php.net/package/Net_DNS2
70
- * @see Net_DNS2_RR
71
- *
72
- */
73
- class Net_DNS2_RR_KX extends Net_DNS2_RR
74
- {
75
- /*
76
- * the preference for this mail exchanger
77
- */
78
- public $preference;
79
-
80
- /*
81
- * the hostname of the mail exchanger
82
- */
83
- public $exchange;
84
-
85
- /**
86
- * method to return the rdata portion of the packet as a string
87
- *
88
- * @return string
89
- * @access protected
90
- *
91
- */
92
- protected function rrToString()
93
- {
94
- return $this->preference . ' ' . $this->cleanString($this->exchange) . '.';
95
- }
96
-
97
- /**
98
- * parses the rdata portion from a standard DNS config line
99
- *
100
- * @param array $rdata a string split line of values for the rdata
101
- *
102
- * @return boolean
103
- * @access protected
104
- *
105
- */
106
- protected function rrFromString(array $rdata)
107
- {
108
- $this->preference = array_shift($rdata);
109
- $this->exchange = $this->cleanString(array_shift($rdata));
110
-
111
- return true;
112
- }
113
-
114
- /**
115
- * parses the rdata of the Net_DNS2_Packet object
116
- *
117
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
118
- *
119
- * @return boolean
120
- * @access protected
121
- *
122
- */
123
- protected function rrSet(Net_DNS2_Packet &$packet)
124
- {
125
- if ($this->rdlength > 0) {
126
-
127
- //
128
- // parse the preference
129
- //
130
- $x = unpack('npreference', $this->rdata);
131
- $this->preference = $x['preference'];
132
-
133
- //
134
- // get the exchange entry server)
135
- //
136
- $offset = $packet->offset + 2;
137
- $this->exchange = Net_DNS2_Packet::label($packet, $offset);
138
-
139
- return true;
140
- }
141
-
142
- return false;
143
- }
144
-
145
- /**
146
- * returns the rdata portion of the DNS packet
147
- *
148
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
149
- * compressed names
150
- *
151
- * @return mixed either returns a binary packed
152
- * string or null on failure
153
- * @access protected
154
- *
155
- */
156
- protected function rrGet(Net_DNS2_Packet &$packet)
157
- {
158
- if (strlen($this->exchange) > 0) {
159
-
160
- $data = pack('nC', $this->preference, strlen($this->exchange)) .
161
- $this->exchange;
162
-
163
- $packet->offset += strlen($data);
164
-
165
- return $data;
166
- }
167
-
168
- return null;
169
- }
170
- }
171
-
172
- /*
173
- * Local variables:
174
- * tab-width: 4
175
- * c-basic-offset: 4
176
- * c-hanging-comment-ender-p: nil
177
- * End:
178
- */
179
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/L32.php DELETED
@@ -1,180 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2013 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.3.1
49
- *
50
- */
51
-
52
- /**
53
- * L32 Resource Record - RFC6742 section 2.2
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | Preference | Locator32 (16 MSBs) |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59
- * | Locator32 (16 LSBs) |
60
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61
- *
62
- * @category Networking
63
- * @package Net_DNS2
64
- * @author Mike Pultz <mike@mikepultz.com>
65
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
66
- * @link http://pear.php.net/package/Net_DNS2
67
- * @see Net_DNS2_RR
68
- *
69
- */
70
- class Net_DNS2_RR_L32 extends Net_DNS2_RR
71
- {
72
- /*
73
- * The preference
74
- */
75
- public $preference;
76
-
77
- /*
78
- * The locator32 field
79
- */
80
- public $locator32;
81
-
82
- /**
83
- * method to return the rdata portion of the packet as a string
84
- *
85
- * @return string
86
- * @access protected
87
- *
88
- */
89
- protected function rrToString()
90
- {
91
- return $this->preference . ' ' . $this->locator32;
92
- }
93
-
94
- /**
95
- * parses the rdata portion from a standard DNS config line
96
- *
97
- * @param array $rdata a string split line of values for the rdata
98
- *
99
- * @return boolean
100
- * @access protected
101
- *
102
- */
103
- protected function rrFromString(array $rdata)
104
- {
105
- $this->preference = array_shift($rdata);
106
- $this->locator32 = array_shift($rdata);
107
-
108
- return true;
109
- }
110
-
111
- /**
112
- * parses the rdata of the Net_DNS2_Packet object
113
- *
114
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
115
- *
116
- * @return boolean
117
- * @access protected
118
- *
119
- */
120
- protected function rrSet(Net_DNS2_Packet &$packet)
121
- {
122
- if ($this->rdlength > 0) {
123
-
124
- //
125
- // unpack the values
126
- //
127
- $x = unpack('npreference/C4locator', $this->rdata);
128
-
129
- $this->preference = $x['preference'];
130
-
131
- //
132
- // build the locator value
133
- //
134
- $this->locator32 = $x['locator1'] . '.' . $x['locator2'] . '.' .
135
- $x['locator3'] . '.' . $x['locator4'];
136
-
137
- return true;
138
- }
139
-
140
- return false;
141
- }
142
-
143
- /**
144
- * returns the rdata portion of the DNS packet
145
- *
146
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
147
- * compressed names
148
- *
149
- * @return mixed either returns a binary packed
150
- * string or null on failure
151
- * @access protected
152
- *
153
- */
154
- protected function rrGet(Net_DNS2_Packet &$packet)
155
- {
156
- if (strlen($this->locator32) > 0) {
157
-
158
- //
159
- // break out the locator value
160
- //
161
- $n = explode('.', $this->locator32);
162
-
163
- //
164
- // pack the data
165
- //
166
- return pack('nC4', $this->preference, $n[0], $n[1], $n[2], $n[3]);
167
- }
168
-
169
- return null;
170
- }
171
- }
172
-
173
- /*
174
- * Local variables:
175
- * tab-width: 4
176
- * c-basic-offset: 4
177
- * c-hanging-comment-ender-p: nil
178
- * End:
179
- */
180
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/L64.php DELETED
@@ -1,187 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2013 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.3.1
49
- *
50
- */
51
-
52
- /**
53
- * L64 Resource Record - RFC6742 section 2.3
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | Preference | |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
59
- * | Locator64 |
60
- * + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61
- * | |
62
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_L64 extends Net_DNS2_RR
73
- {
74
- /*
75
- * The preference
76
- */
77
- public $preference;
78
-
79
- /*
80
- * The locator64 field
81
- */
82
- public $locator64;
83
-
84
- /**
85
- * method to return the rdata portion of the packet as a string
86
- *
87
- * @return string
88
- * @access protected
89
- *
90
- */
91
- protected function rrToString()
92
- {
93
- return $this->preference . ' ' . $this->locator64;
94
- }
95
-
96
- /**
97
- * parses the rdata portion from a standard DNS config line
98
- *
99
- * @param array $rdata a string split line of values for the rdata
100
- *
101
- * @return boolean
102
- * @access protected
103
- *
104
- */
105
- protected function rrFromString(array $rdata)
106
- {
107
- $this->preference = array_shift($rdata);
108
- $this->locator64 = array_shift($rdata);
109
-
110
- return true;
111
- }
112
-
113
- /**
114
- * parses the rdata of the Net_DNS2_Packet object
115
- *
116
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
117
- *
118
- * @return boolean
119
- * @access protected
120
- *
121
- */
122
- protected function rrSet(Net_DNS2_Packet &$packet)
123
- {
124
- if ($this->rdlength > 0) {
125
-
126
- //
127
- // unpack the values
128
- //
129
- $x = unpack('npreference/n4locator', $this->rdata);
130
-
131
- $this->preference = $x['preference'];
132
-
133
- //
134
- // build the locator64
135
- //
136
- $this->locator64 = dechex($x['locator1']) . ':' .
137
- dechex($x['locator2']) . ':' .
138
- dechex($x['locator3']) . ':' .
139
- dechex($x['locator4']);
140
-
141
- return true;
142
- }
143
-
144
- return false;
145
- }
146
-
147
- /**
148
- * returns the rdata portion of the DNS packet
149
- *
150
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
151
- * compressed names
152
- *
153
- * @return mixed either returns a binary packed
154
- * string or null on failure
155
- * @access protected
156
- *
157
- */
158
- protected function rrGet(Net_DNS2_Packet &$packet)
159
- {
160
- if (strlen($this->locator64) > 0) {
161
-
162
- //
163
- // break out the locator64
164
- //
165
- $n = explode(':', $this->locator64);
166
-
167
- //
168
- // pack the data
169
- //
170
- return pack(
171
- 'n5', $this->preference, hexdec($n[0]), hexdec($n[1]),
172
- hexdec($n[2]), hexdec($n[3])
173
- );
174
- }
175
-
176
- return null;
177
- }
178
- }
179
-
180
- /*
181
- * Local variables:
182
- * tab-width: 4
183
- * c-basic-offset: 4
184
- * c-hanging-comment-ender-p: nil
185
- * End:
186
- */
187
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/LOC.php DELETED
@@ -1,440 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * LOC Resource Record - RFC1876 section 2
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | VERSION | SIZE |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * | HORIZ PRE | VERT PRE |
59
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
60
- * | LATITUDE |
61
- * | |
62
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
63
- * | LONGITUDE |
64
- * | |
65
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
66
- * | ALTITUDE |
67
- * | |
68
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
69
- *
70
- * @category Networking
71
- * @package Net_DNS2
72
- * @author Mike Pultz <mike@mikepultz.com>
73
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
74
- * @link http://pear.php.net/package/Net_DNS2
75
- * @see Net_DNS2_RR
76
- *
77
- */
78
- class Net_DNS2_RR_LOC extends Net_DNS2_RR
79
- {
80
- /*
81
- * the LOC version- should only ever be 0
82
- */
83
- public $version;
84
-
85
- /*
86
- * The diameter of a sphere enclosing the described entity
87
- */
88
- public $size;
89
-
90
- /*
91
- * The horizontal precision of the data
92
- */
93
- public $horiz_pre;
94
-
95
- /*
96
- * The vertical precision of the data
97
- */
98
- public $vert_pre;
99
-
100
- /*
101
- * The latitude - stored in decimal degrees
102
- */
103
- public $latitude;
104
-
105
- /*
106
- * The longitude - stored in decimal degrees
107
- */
108
- public $longitude;
109
-
110
- /*
111
- * The altitude - stored in decimal
112
- */
113
- public $altitude;
114
-
115
- /*
116
- * used for quick power-of-ten lookups
117
- */
118
- private $_powerOfTen = array(1, 10, 100, 1000, 10000, 100000,
119
- 1000000,10000000,100000000,1000000000);
120
-
121
- /*
122
- * some conversion values
123
- */
124
- const CONV_SEC = 1000;
125
- const CONV_MIN = 60000;
126
- const CONV_DEG = 3600000;
127
-
128
- const REFERENCE_ALT = 10000000;
129
- const REFERENCE_LATLON = 2147483648;
130
-
131
- /**
132
- * method to return the rdata portion of the packet as a string
133
- *
134
- * @return string
135
- * @access protected
136
- *
137
- */
138
- protected function rrToString()
139
- {
140
- if ($this->version == 0) {
141
-
142
- return $this->_d2Dms($this->latitude, 'LAT') . ' ' .
143
- $this->_d2Dms($this->longitude, 'LNG') . ' ' .
144
- sprintf('%.2fm', $this->altitude) . ' ' .
145
- sprintf('%.2fm', $this->size) . ' ' .
146
- sprintf('%.2fm', $this->horiz_pre) . ' ' .
147
- sprintf('%.2fm', $this->vert_pre);
148
- }
149
-
150
- return '';
151
- }
152
-
153
- /**
154
- * parses the rdata portion from a standard DNS config line
155
- *
156
- * @param array $rdata a string split line of values for the rdata
157
- *
158
- * @return boolean
159
- * @access protected
160
- *
161
- */
162
- protected function rrFromString(array $rdata)
163
- {
164
- //
165
- // format as defined by RFC1876 section 3
166
- //
167
- // d1 [m1 [s1]] {"N"|"S"} d2 [m2 [s2]] {"E"|"W"} alt["m"]
168
- // [siz["m"] [hp["m"] [vp["m"]]]]
169
- //
170
- $res = preg_match(
171
- '/^(\d+) \s+((\d+) \s+)?(([\d.]+) \s+)?(N|S) \s+(\d+) ' .
172
- '\s+((\d+) \s+)?(([\d.]+) \s+)?(E|W) \s+(-?[\d.]+) m?(\s+ ' .
173
- '([\d.]+) m?)?(\s+ ([\d.]+) m?)?(\s+ ([\d.]+) m?)?/ix',
174
- implode(' ', $rdata), $x
175
- );
176
-
177
- if ($res) {
178
-
179
- //
180
- // latitude
181
- //
182
- $latdeg = $x[1];
183
- $latmin = (isset($x[3])) ? $x[3] : 0;
184
- $latsec = (isset($x[5])) ? $x[5] : 0;
185
- $lathem = strtoupper($x[6]);
186
-
187
- $this->latitude = $this->_dms2d($latdeg, $latmin, $latsec, $lathem);
188
-
189
- //
190
- // longitude
191
- //
192
- $londeg = $x[7];
193
- $lonmin = (isset($x[9])) ? $x[9] : 0;
194
- $lonsec = (isset($x[11])) ? $x[11] : 0;
195
- $lonhem = strtoupper($x[12]);
196
-
197
- $this->longitude = $this->_dms2d($londeg, $lonmin, $lonsec, $lonhem);
198
-
199
- //
200
- // the rest of teh values
201
- //
202
- $version = 0;
203
-
204
- $this->size = (isset($x[15])) ? $x[15] : 1;
205
- $this->horiz_pre = ((isset($x[17])) ? $x[17] : 10000);
206
- $this->vert_pre = ((isset($x[19])) ? $x[19] : 10);
207
- $this->altitude = $x[13];
208
-
209
- return true;
210
- }
211
-
212
- return false;
213
- }
214
-
215
- /**
216
- * parses the rdata of the Net_DNS2_Packet object
217
- *
218
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
219
- *
220
- * @return boolean
221
- * @access protected
222
- *
223
- */
224
- protected function rrSet(Net_DNS2_Packet &$packet)
225
- {
226
- if ($this->rdlength > 0) {
227
-
228
- //
229
- // unpack all the values
230
- //
231
- $x = unpack(
232
- 'Cver/Csize/Choriz_pre/Cvert_pre/Nlatitude/Nlongitude/Naltitude',
233
- $this->rdata
234
- );
235
-
236
- //
237
- // version must be 0 per RFC 1876 section 2
238
- //
239
- $this->version = $x['ver'];
240
- if ($this->version == 0) {
241
-
242
- $this->size = $this->_precsizeNtoA($x['size']);
243
- $this->horiz_pre = $this->_precsizeNtoA($x['horiz_pre']);
244
- $this->vert_pre = $this->_precsizeNtoA($x['vert_pre']);
245
-
246
- //
247
- // convert the latitude and longitude to degress in decimal
248
- //
249
- if ($x['latitude'] < 0) {
250
-
251
- $this->latitude = ($x['latitude'] +
252
- self::REFERENCE_LATLON) / self::CONV_DEG;
253
- } else {
254
-
255
- $this->latitude = ($x['latitude'] -
256
- self::REFERENCE_LATLON) / self::CONV_DEG;
257
- }
258
-
259
- if ($x['longitude'] < 0) {
260
-
261
- $this->longitude = ($x['longitude'] +
262
- self::REFERENCE_LATLON) / self::CONV_DEG;
263
- } else {
264
-
265
- $this->longitude = ($x['longitude'] -
266
- self::REFERENCE_LATLON) / self::CONV_DEG;
267
- }
268
-
269
- //
270
- // convert down the altitude
271
- //
272
- $this->altitude = ($x['altitude'] - self::REFERENCE_ALT) / 100;
273
-
274
- return true;
275
-
276
- } else {
277
-
278
- return false;
279
- }
280
-
281
- return true;
282
- }
283
-
284
- return false;
285
- }
286
-
287
- /**
288
- * returns the rdata portion of the DNS packet
289
- *
290
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
291
- * compressed names
292
- *
293
- * @return mixed either returns a binary packed
294
- * string or null on failure
295
- * @access protected
296
- *
297
- */
298
- protected function rrGet(Net_DNS2_Packet &$packet)
299
- {
300
- if ($this->version == 0) {
301
-
302
- $lat = 0;
303
- $lng = 0;
304
-
305
- if ($this->latitude < 0) {
306
-
307
- $lat = ($this->latitude * self::CONV_DEG) - self::REFERENCE_LATLON;
308
- } else {
309
-
310
- $lat = ($this->latitude * self::CONV_DEG) + self::REFERENCE_LATLON;
311
- }
312
-
313
- if ($this->longitude < 0) {
314
-
315
- $lng = ($this->longitude * self::CONV_DEG) - self::REFERENCE_LATLON;
316
- } else {
317
-
318
- $lng = ($this->longitude * self::CONV_DEG) + self::REFERENCE_LATLON;
319
- }
320
-
321
- $packet->offset += 16;
322
-
323
- return pack(
324
- 'CCCCNNN',
325
- $this->version,
326
- $this->_precsizeAtoN($this->size),
327
- $this->_precsizeAtoN($this->horiz_pre),
328
- $this->_precsizeAtoN($this->vert_pre),
329
- $lat, $lng,
330
- ($this->altitude * 100) + self::REFERENCE_ALT
331
- );
332
- }
333
-
334
- return null;
335
- }
336
-
337
- /**
338
- * takes an XeY precision/size value, returns a string representation.
339
- * shamlessly stolen from RFC1876 Appendix A
340
- *
341
- * @param integer $prec the value to convert
342
- *
343
- * @return string
344
- * @access private
345
- *
346
- */
347
- private function _precsizeNtoA($prec)
348
- {
349
- $mantissa = (($prec >> 4) & 0x0f) % 10;
350
- $exponent = (($prec >> 0) & 0x0f) % 10;
351
-
352
- return $mantissa * $this->_powerOfTen[$exponent];
353
- }
354
-
355
- /**
356
- * converts ascii size/precision X * 10**Y(cm) to 0xXY.
357
- * shamlessly stolen from RFC1876 Appendix A
358
- *
359
- * @param string $prec the value to convert
360
- *
361
- * @return integer
362
- * @access private
363
- *
364
- */
365
- private function _precsizeAtoN($prec)
366
- {
367
- $exponent = 0;
368
- while ($prec >= 10) {
369
-
370
- $prec /= 10;
371
- ++$exponent;
372
- }
373
-
374
- return ($prec << 4) | ($exponent & 0x0f);
375
- }
376
-
377
- /**
378
- * convert lat/lng in deg/min/sec/hem to decimal value
379
- *
380
- * @param integer $deg the degree value
381
- * @param integer $min the minutes value
382
- * @param integer $sec the seconds value
383
- * @param string $hem the hemisphere (N/E/S/W)
384
- *
385
- * @return float the decinmal value
386
- * @access private
387
- *
388
- */
389
- private function _dms2d($deg, $min, $sec, $hem)
390
- {
391
- $deg = $deg - 0;
392
- $min = $min - 0;
393
-
394
- $sign = ($hem == 'W' || $hem == 'S') ? -1 : 1;
395
- return ((($sec/60+$min)/60)+$deg) * $sign;
396
- }
397
-
398
- /**
399
- * convert lat/lng in decimal to deg/min/sec/hem
400
- *
401
- * @param float $data the decimal value
402
- * @param string $latlng either LAT or LNG so we can determine the HEM value
403
- *
404
- * @return string
405
- * @access private
406
- *
407
- */
408
- private function _d2Dms($data, $latlng)
409
- {
410
- $deg = 0;
411
- $min = 0;
412
- $sec = 0;
413
- $msec = 0;
414
- $hem = '';
415
-
416
- if ($latlng == 'LAT') {
417
- $hem = ($data > 0) ? 'N' : 'S';
418
- } else {
419
- $hem = ($data > 0) ? 'E' : 'W';
420
- }
421
-
422
- $data = abs($data);
423
-
424
- $deg = (int)$data;
425
- $min = (int)(($data - $deg) * 60);
426
- $sec = (int)(((($data - $deg) * 60) - $min) * 60);
427
- $msec = round((((((($data - $deg) * 60) - $min) * 60) - $sec) * 1000));
428
-
429
- return sprintf('%d %02d %02d.%03d %s', $deg, $min, $sec, round($msec), $hem);
430
- }
431
- }
432
-
433
- /*
434
- * Local variables:
435
- * tab-width: 4
436
- * c-basic-offset: 4
437
- * c-hanging-comment-ender-p: nil
438
- * End:
439
- */
440
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/LP.php DELETED
@@ -1,177 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2013 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.3.1
49
- *
50
- */
51
-
52
- /**
53
- * LP Resource Record - RFC6742 section 2.4
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | Preference | /
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
59
- * / /
60
- * / FQDN /
61
- * / /
62
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_LP extends Net_DNS2_RR
73
- {
74
- /*
75
- * The preference
76
- */
77
- public $preference;
78
-
79
- /*
80
- * The fdqn field
81
- */
82
- public $fqdn;
83
-
84
- /**
85
- * method to return the rdata portion of the packet as a string
86
- *
87
- * @return string
88
- * @access protected
89
- *
90
- */
91
- protected function rrToString()
92
- {
93
- return $this->preference . ' ' . $this->fqdn . '.';
94
- }
95
-
96
- /**
97
- * parses the rdata portion from a standard DNS config line
98
- *
99
- * @param array $rdata a string split line of values for the rdata
100
- *
101
- * @return boolean
102
- * @access protected
103
- *
104
- */
105
- protected function rrFromString(array $rdata)
106
- {
107
- $this->preference = array_shift($rdata);
108
- $this->fqdn = trim(array_shift($rdata), '.');
109
-
110
- return true;
111
- }
112
-
113
- /**
114
- * parses the rdata of the Net_DNS2_Packet object
115
- *
116
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
117
- *
118
- * @return boolean
119
- * @access protected
120
- *
121
- */
122
- protected function rrSet(Net_DNS2_Packet &$packet)
123
- {
124
- if ($this->rdlength > 0) {
125
-
126
- //
127
- // parse the preference
128
- //
129
- $x = unpack('npreference', $this->rdata);
130
- $this->preference = $x['preference'];
131
- $offset = $packet->offset + 2;
132
-
133
- //
134
- // get the hostname
135
- //
136
- $this->fqdn = Net_DNS2_Packet::expand($packet, $offset);
137
-
138
- return true;
139
- }
140
-
141
- return false;
142
- }
143
-
144
- /**
145
- * returns the rdata portion of the DNS packet
146
- *
147
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
148
- * compressed names
149
- *
150
- * @return mixed either returns a binary packed
151
- * string or null on failure
152
- * @access protected
153
- *
154
- */
155
- protected function rrGet(Net_DNS2_Packet &$packet)
156
- {
157
- if (strlen($this->fqdn) > 0) {
158
-
159
- $data = pack('n', $this->preference);
160
- $packet->offset += 2;
161
-
162
- $data .= $packet->compress($this->fqdn, $packet->offset);
163
- return $data;
164
- }
165
-
166
- return null;
167
- }
168
- }
169
-
170
- /*
171
- * Local variables:
172
- * tab-width: 4
173
- * c-basic-offset: 4
174
- * c-hanging-comment-ender-p: nil
175
- * End:
176
- */
177
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/MX.php DELETED
@@ -1,175 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * MX Resource Record - RFC1035 section 3.3.9
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | PREFERENCE |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * / EXCHANGE /
59
- * / /
60
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
61
- *
62
- * @category Networking
63
- * @package Net_DNS2
64
- * @author Mike Pultz <mike@mikepultz.com>
65
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
66
- * @link http://pear.php.net/package/Net_DNS2
67
- * @see Net_DNS2_RR
68
- *
69
- */
70
- class Net_DNS2_RR_MX extends Net_DNS2_RR
71
- {
72
- /*
73
- * the preference for this mail exchanger
74
- */
75
- public $preference;
76
-
77
- /*
78
- * the hostname of the mail exchanger
79
- */
80
- public $exchange;
81
-
82
- /**
83
- * method to return the rdata portion of the packet as a string
84
- *
85
- * @return string
86
- * @access protected
87
- *
88
- */
89
- protected function rrToString()
90
- {
91
- return $this->preference . ' ' . $this->cleanString($this->exchange) . '.';
92
- }
93
-
94
- /**
95
- * parses the rdata portion from a standard DNS config line
96
- *
97
- * @param array $rdata a string split line of values for the rdata
98
- *
99
- * @return boolean
100
- * @access protected
101
- *
102
- */
103
- protected function rrFromString(array $rdata)
104
- {
105
- $this->preference = array_shift($rdata);
106
- $this->exchange = $this->cleanString(array_shift($rdata));
107
-
108
- return true;
109
- }
110
-
111
- /**
112
- * parses the rdata of the Net_DNS2_Packet object
113
- *
114
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
115
- *
116
- * @return boolean
117
- * @access protected
118
- *
119
- */
120
- protected function rrSet(Net_DNS2_Packet &$packet)
121
- {
122
- if ($this->rdlength > 0) {
123
-
124
- //
125
- // parse the preference
126
- //
127
- $x = unpack('npreference', $this->rdata);
128
- $this->preference = $x['preference'];
129
-
130
- //
131
- // get the exchange entry server)
132
- //
133
- $offset = $packet->offset + 2;
134
- $this->exchange = Net_DNS2_Packet::expand($packet, $offset);
135
-
136
- return true;
137
- }
138
-
139
- return false;
140
- }
141
-
142
- /**
143
- * returns the rdata portion of the DNS packet
144
- *
145
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
146
- * compressed names
147
- *
148
- * @return mixed either returns a binary packed
149
- * string or null on failure
150
- * @access protected
151
- *
152
- */
153
- protected function rrGet(Net_DNS2_Packet &$packet)
154
- {
155
- if (strlen($this->exchange) > 0) {
156
-
157
- $data = pack('n', $this->preference);
158
- $packet->offset += 2;
159
-
160
- $data .= $packet->compress($this->exchange, $packet->offset);
161
- return $data;
162
- }
163
-
164
- return null;
165
- }
166
- }
167
-
168
- /*
169
- * Local variables:
170
- * tab-width: 4
171
- * c-basic-offset: 4
172
- * c-hanging-comment-ender-p: nil
173
- * End:
174
- */
175
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/NAPTR.php DELETED
@@ -1,231 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * NAPTR Resource Record - RFC2915
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
56
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
57
- * | ORDER |
58
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
59
- * | PREFERENCE |
60
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
61
- * / FLAGS /
62
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
63
- * / SERVICES /
64
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
65
- * / REGEXP /
66
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
67
- * / REPLACEMENT /
68
- * / /
69
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
70
- *
71
- * @category Networking
72
- * @package Net_DNS2
73
- * @author Mike Pultz <mike@mikepultz.com>
74
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
75
- * @link http://pear.php.net/package/Net_DNS2
76
- * @see Net_DNS2_RR
77
- *
78
- */
79
- class Net_DNS2_RR_NAPTR extends Net_DNS2_RR
80
- {
81
- /*
82
- * the order in which the NAPTR records MUST be processed
83
- */
84
- public $order;
85
-
86
- /*
87
- * specifies the order in which NAPTR records with equal "order"
88
- * values SHOULD be processed
89
- */
90
- public $preference;
91
-
92
- /*
93
- * rewrite flags
94
- */
95
- public $flags;
96
-
97
- /*
98
- * Specifies the service(s) available down this rewrite path
99
- */
100
- public $services;
101
-
102
- /*
103
- * regular expression
104
- */
105
- public $regexp;
106
-
107
- /*
108
- * The next NAME to query for NAPTR, SRV, or address records
109
- * depending on the value of the flags field
110
- */
111
- public $replacement;
112
-
113
- /**
114
- * method to return the rdata portion of the packet as a string
115
- *
116
- * @return string
117
- * @access protected
118
- *
119
- */
120
- protected function rrToString()
121
- {
122
- return $this->order . ' ' . $this->preference . ' ' .
123
- $this->formatString($this->flags) . ' ' .
124
- $this->formatString($this->services) . ' ' .
125
- $this->formatString($this->regexp) . ' ' .
126
- $this->cleanString($this->replacement) . '.';
127
- }
128
-
129
- /**
130
- * parses the rdata portion from a standard DNS config line
131
- *
132
- * @param array $rdata a string split line of values for the rdata
133
- *
134
- * @return boolean
135
- * @access protected
136
- *
137
- */
138
- protected function rrFromString(array $rdata)
139
- {
140
- $this->order = array_shift($rdata);
141
- $this->preference = array_shift($rdata);
142
-
143
- $data = $this->buildString($rdata);
144
- if (count($data) == 4) {
145
-
146
- $this->flags = $data[0];
147
- $this->services = $data[1];
148
- $this->regexp = $data[2];
149
- $this->replacement = $this->cleanString($data[3]);
150
-
151
- return true;
152
- }
153
-
154
- return false;
155
- }
156
-
157
- /**
158
- * parses the rdata of the Net_DNS2_Packet object
159
- *
160
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
161
- *
162
- * @return boolean
163
- * @access protected
164
- *
165
- */
166
- protected function rrSet(Net_DNS2_Packet &$packet)
167
- {
168
- if ($this->rdlength > 0) {
169
-
170
- //
171
- // unpack the order and preference
172
- //
173
- $x = unpack('norder/npreference', $this->rdata);
174
-
175
- $this->order = $x['order'];
176
- $this->preference = $x['preference'];
177
-
178
- $offset = $packet->offset + 4;
179
-
180
- $this->flags = Net_DNS2_Packet::label($packet, $offset);
181
- $this->services = Net_DNS2_Packet::label($packet, $offset);
182
- $this->regexp = Net_DNS2_Packet::label($packet, $offset);
183
-
184
- $this->replacement = Net_DNS2_Packet::expand($packet, $offset);
185
-
186
- return true;
187
- }
188
-
189
- return false;
190
- }
191
-
192
- /**
193
- * returns the rdata portion of the DNS packet
194
- *
195
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
196
- * compressed names
197
- *
198
- * @return mixed either returns a binary packed
199
- * string or null on failure
200
- * @access protected
201
- *
202
- */
203
- protected function rrGet(Net_DNS2_Packet &$packet)
204
- {
205
- if ( (isset($this->order)) && (strlen($this->services) > 0) ) {
206
-
207
- $data = pack('nn', $this->order, $this->preference);
208
-
209
- $data .= chr(strlen($this->flags)) . $this->flags;
210
- $data .= chr(strlen($this->services)) . $this->services;
211
- $data .= chr(strlen($this->regexp)) . $this->regexp;
212
-
213
- $packet->offset += strlen($data);
214
-
215
- $data .= $packet->compress($this->replacement, $packet->offset);
216
-
217
- return $data;
218
- }
219
-
220
- return null;
221
- }
222
- }
223
-
224
- /*
225
- * Local variables:
226
- * tab-width: 4
227
- * c-basic-offset: 4
228
- * c-hanging-comment-ender-p: nil
229
- * End:
230
- */
231
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/NID.php DELETED
@@ -1,187 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2013, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2013 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.3.1
49
- *
50
- */
51
-
52
- /**
53
- * NID Resource Record - RFC6742 section 2.1
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | Preference | |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
59
- * | NodeID |
60
- * + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61
- * | |
62
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_NID extends Net_DNS2_RR
73
- {
74
- /*
75
- * The preference
76
- */
77
- public $preference;
78
-
79
- /*
80
- * The node ID field
81
- */
82
- public $nodeid;
83
-
84
- /**
85
- * method to return the rdata portion of the packet as a string
86
- *
87
- * @return string
88
- * @access protected
89
- *
90
- */
91
- protected function rrToString()
92
- {
93
- return $this->preference . ' ' . $this->nodeid;
94
- }
95
-
96
- /**
97
- * parses the rdata portion from a standard DNS config line
98
- *
99
- * @param array $rdata a string split line of values for the rdata
100
- *
101
- * @return boolean
102
- * @access protected
103
- *
104
- */
105
- protected function rrFromString(array $rdata)
106
- {
107
- $this->preference = array_shift($rdata);
108
- $this->nodeid = array_shift($rdata);
109
-
110
- return true;
111
- }
112
-
113
- /**
114
- * parses the rdata of the Net_DNS2_Packet object
115
- *
116
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
117
- *
118
- * @return boolean
119
- * @access protected
120
- *
121
- */
122
- protected function rrSet(Net_DNS2_Packet &$packet)
123
- {
124
- if ($this->rdlength > 0) {
125
-
126
- //
127
- // unpack the values
128
- //
129
- $x = unpack('npreference/n4nodeid', $this->rdata);
130
-
131
- $this->preference = $x['preference'];
132
-
133
- //
134
- // build the node id
135
- //
136
- $this->nodeid = dechex($x['nodeid1']) . ':' .
137
- dechex($x['nodeid2']) . ':' .
138
- dechex($x['nodeid3']) . ':' .
139
- dechex($x['nodeid4']);
140
-
141
- return true;
142
- }
143
-
144
- return false;
145
- }
146
-
147
- /**
148
- * returns the rdata portion of the DNS packet
149
- *
150
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
151
- * compressed names
152
- *
153
- * @return mixed either returns a binary packed
154
- * string or null on failure
155
- * @access protected
156
- *
157
- */
158
- protected function rrGet(Net_DNS2_Packet &$packet)
159
- {
160
- if (strlen($this->nodeid) > 0) {
161
-
162
- //
163
- // break out the node id
164
- //
165
- $n = explode(':', $this->nodeid);
166
-
167
- //
168
- // pack the data
169
- //
170
- return pack(
171
- 'n5', $this->preference, hexdec($n[0]), hexdec($n[1]),
172
- hexdec($n[2]), hexdec($n[3])
173
- );
174
- }
175
-
176
- return null;
177
- }
178
- }
179
-
180
- /*
181
- * Local variables:
182
- * tab-width: 4
183
- * c-basic-offset: 4
184
- * c-hanging-comment-ender-p: nil
185
- * End:
186
- */
187
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/NIMLOC.php DELETED
@@ -1,130 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * NIMLOCK Resource Record - undefined; the rdata is simply used as-is in it's
54
- * binary format, so not process has to be done.
55
- *
56
- * @category Networking
57
- * @package Net_DNS2
58
- * @author Mike Pultz <mike@mikepultz.com>
59
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
60
- * @link http://pear.php.net/package/Net_DNS2
61
- * @see Net_DNS2_RR
62
- *
63
- */
64
- class Net_DNS2_RR_NIMLOCK extends Net_DNS2_RR
65
- {
66
- /**
67
- * method to return the rdata portion of the packet as a string
68
- *
69
- * @return string
70
- * @access protected
71
- *
72
- */
73
- protected function rrToString()
74
- {
75
- return '';
76
- }
77
-
78
- /**
79
- * parses the rdata portion from a standard DNS config line
80
- *
81
- * @param array $rdata a string split line of values for the rdata
82
- *
83
- * @return boolean
84
- * @access protected
85
- *
86
- */
87
- protected function rrFromString(array $rdata)
88
- {
89
- return true;
90
- }
91
-
92
- /**
93
- * parses the rdata of the Net_DNS2_Packet object
94
- *
95
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
96
- *
97
- * @return boolean
98
- * @access protected
99
- *
100
- */
101
- protected function rrSet(Net_DNS2_Packet &$packet)
102
- {
103
- return true;
104
- }
105
-
106
- /**
107
- * returns the rdata portion of the DNS packet
108
- *
109
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
110
- * compressed names
111
- *
112
- * @return mixed either returns a binary packed
113
- * string or null on failure
114
- * @access protected
115
- *
116
- */
117
- protected function rrGet(Net_DNS2_Packet &$packet)
118
- {
119
- return $this->rdata;
120
- }
121
- }
122
-
123
- /*
124
- * Local variables:
125
- * tab-width: 4
126
- * c-basic-offset: 4
127
- * c-hanging-comment-ender-p: nil
128
- * End:
129
- */
130
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/NS.php DELETED
@@ -1,153 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * NS Resource Record - RFC1035 section 3.3.11
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * / NSDNAME /
57
- * / /
58
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
59
- *
60
- * @category Networking
61
- * @package Net_DNS2
62
- * @author Mike Pultz <mike@mikepultz.com>
63
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
64
- * @link http://pear.php.net/package/Net_DNS2
65
- * @see Net_DNS2_RR
66
- *
67
- */
68
- class Net_DNS2_RR_NS extends Net_DNS2_RR
69
- {
70
- /*
71
- * the hostname of the DNS server
72
- */
73
- public $nsdname;
74
-
75
- /**
76
- * method to return the rdata portion of the packet as a string
77
- *
78
- * @return string
79
- * @access protected
80
- *
81
- */
82
- protected function rrToString()
83
- {
84
- return $this->cleanString($this->nsdname) . '.';
85
- }
86
-
87
- /**
88
- * parses the rdata portion from a standard DNS config line
89
- *
90
- * @param array $rdata a string split line of values for the rdata
91
- *
92
- * @return boolean
93
- * @access protected
94
- *
95
- */
96
- protected function rrFromString(array $rdata)
97
- {
98
- $this->nsdname = $this->cleanString(array_shift($rdata));
99
- return true;
100
- }
101
-
102
- /**
103
- * parses the rdata of the Net_DNS2_Packet object
104
- *
105
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
106
- *
107
- * @return boolean
108
- * @access protected
109
- *
110
- */
111
- protected function rrSet(Net_DNS2_Packet &$packet)
112
- {
113
- if ($this->rdlength > 0) {
114
-
115
- $offset = $packet->offset;
116
- $this->nsdname = Net_DNS2_Packet::expand($packet, $offset);
117
-
118
- return true;
119
- }
120
-
121
- return false;
122
- }
123
-
124
- /**
125
- * returns the rdata portion of the DNS packet
126
- *
127
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
128
- * compressed names
129
- *
130
- * @return mixed either returns a binary packed
131
- * string or null on failure
132
- * @access protected
133
- *
134
- */
135
- protected function rrGet(Net_DNS2_Packet &$packet)
136
- {
137
- if (strlen($this->nsdname) > 0) {
138
-
139
- return $packet->compress($this->nsdname, $packet->offset);
140
- }
141
-
142
- return null;
143
- }
144
- }
145
-
146
- /*
147
- * Local variables:
148
- * tab-width: 4
149
- * c-basic-offset: 4
150
- * c-hanging-comment-ender-p: nil
151
- * End:
152
- */
153
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/NSAP.php DELETED
@@ -1,262 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * NSAP Resource Record - RFC1706
54
- *
55
- * |--------------|
56
- * | <-- IDP --> |
57
- * |--------------|-------------------------------------|
58
- * | AFI | IDI | <-- DSP --> |
59
- * |-----|--------|-------------------------------------|
60
- * | 47 | 0005 | DFI | AA |Rsvd | RD |Area | ID |Sel |
61
- * |-----|--------|-----|----|-----|----|-----|----|----|
62
- * octets | 1 | 2 | 1 | 3 | 2 | 2 | 2 | 6 | 1 |
63
- * |-----|--------|-----|----|-----|----|-----|----|----|
64
- *
65
- * @category Networking
66
- * @package Net_DNS2
67
- * @author Mike Pultz <mike@mikepultz.com>
68
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
69
- * @link http://pear.php.net/package/Net_DNS2
70
- * @see Net_DNS2_RR
71
- *
72
- */
73
- class Net_DNS2_RR_NSAP extends Net_DNS2_RR
74
- {
75
- public $afi;
76
- public $idi;
77
- public $dfi;
78
- public $aa;
79
- public $rsvd;
80
- public $rd;
81
- public $area;
82
- public $id;
83
- public $sel;
84
-
85
- /**
86
- * method to return the rdata portion of the packet as a string
87
- *
88
- * @return string
89
- * @access protected
90
- *
91
- */
92
- protected function rrToString()
93
- {
94
- return $this->cleanString($this->afi) . '.' .
95
- $this->cleanString($this->idi) . '.' .
96
- $this->cleanString($this->dfi) . '.' .
97
- $this->cleanString($this->aa) . '.' .
98
- $this->cleanString($this->rsvd) . '.' .
99
- $this->cleanString($this->rd) . '.' .
100
- $this->cleanString($this->area) . '.' .
101
- $this->cleanString($this->id) . '.' .
102
- $this->sel;
103
- }
104
-
105
- /**
106
- * parses the rdata portion from a standard DNS config line
107
- *
108
- * @param array $rdata a string split line of values for the rdata
109
- *
110
- * @return boolean
111
- * @access protected
112
- *
113
- */
114
- protected function rrFromString(array $rdata)
115
- {
116
- $data = strtolower(trim(array_shift($rdata)));
117
-
118
- //
119
- // there is no real standard for format, so we can't rely on the fact that
120
- // the value will come in with periods separating the values- so strip
121
- // them out if they're included, and parse without them.
122
- //
123
- $data = str_replace(array('.', '0x'), '', $data);
124
-
125
- //
126
- // unpack it as ascii characters
127
- //
128
- $x = unpack('A2afi/A4idi/A2dfi/A6aa/A4rsvd/A4rd/A4area/A12id/A2sel', $data);
129
-
130
- //
131
- // make sure the afi value is 47
132
- //
133
- if ($x['afi'] == '47') {
134
-
135
- $this->afi = '0x' . $x['afi'];
136
- $this->idi = $x['idi'];
137
- $this->dfi = $x['dfi'];
138
- $this->aa = $x['aa'];
139
- $this->rsvd = $x['rsvd'];
140
- $this->rd = $x['rd'];
141
- $this->area = $x['area'];
142
- $this->id = $x['id'];
143
- $this->sel = $x['sel'];
144
-
145
- return true;
146
- }
147
-
148
- return false;
149
- }
150
-
151
- /**
152
- * parses the rdata of the Net_DNS2_Packet object
153
- *
154
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
155
- *
156
- * @return boolean
157
- * @access protected
158
- *
159
- */
160
- protected function rrSet(Net_DNS2_Packet &$packet)
161
- {
162
- if ($this->rdlength == 20) {
163
-
164
- //
165
- // get the AFI value
166
- //
167
- $this->afi = dechex(ord($this->rdata[0]));
168
-
169
- //
170
- // we only support AFI 47- there arent' any others defined.
171
- //
172
- if ($this->afi == '47') {
173
-
174
- //
175
- // unpack the rest of the values
176
- //
177
- $x = unpack(
178
- 'Cafi/nidi/Cdfi/C3aa/nrsvd/nrd/narea/Nidh/nidl/Csel',
179
- $this->rdata
180
- );
181
-
182
- $this->afi = sprintf('0x%02x', $x['afi']);
183
- $this->idi = sprintf('%04x', $x['idi']);
184
- $this->dfi = sprintf('%02x', $x['dfi']);
185
- $this->aa = sprintf(
186
- '%06x', $x['aa1'] << 16 | $x['aa2'] << 8 | $x['aa3']
187
- );
188
- $this->rsvd = sprintf('%04x', $x['rsvd']);
189
- $this->rd = sprintf('%04x', $x['rd']);
190
- $this->area = sprintf('%04x', $x['area']);
191
- $this->id = sprintf('%08x', $x['idh']) .
192
- sprintf('%04x', $x['idl']);
193
- $this->sel = sprintf('%02x', $x['sel']);
194
-
195
- return true;
196
- }
197
- }
198
-
199
- return false;
200
- }
201
-
202
- /**
203
- * returns the rdata portion of the DNS packet
204
- *
205
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
206
- * compressed names
207
- *
208
- * @return mixed either returns a binary packed
209
- * string or null on failure
210
- * @access protected
211
- *
212
- */
213
- protected function rrGet(Net_DNS2_Packet &$packet)
214
- {
215
- if ($this->afi === '0'.'x47') {
216
-
217
- //
218
- // build the aa field
219
- //
220
- $aa = unpack('A2x/A2y/A2z', $this->aa);
221
-
222
- //
223
- // build the id field
224
- //
225
- $id = unpack('A8a/A4b', $this->id);
226
-
227
- //
228
- $data = pack(
229
- 'CnCCCCnnnNnC',
230
- hexdec($this->afi),
231
- hexdec($this->idi),
232
- hexdec($this->dfi),
233
- hexdec($aa['x']),
234
- hexdec($aa['y']),
235
- hexdec($aa['z']),
236
- hexdec($this->rsvd),
237
- hexdec($this->rd),
238
- hexdec($this->area),
239
- hexdec($id['a']),
240
- hexdec($id['b']),
241
- hexdec($this->sel)
242
- );
243
-
244
- if (strlen($data) == 20) {
245
-
246
- $packet->offset += 20;
247
- return $data;
248
- }
249
- }
250
-
251
- return null;
252
- }
253
- }
254
-
255
- /*
256
- * Local variables:
257
- * tab-width: 4
258
- * c-basic-offset: 4
259
- * c-hanging-comment-ender-p: nil
260
- * End:
261
- */
262
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/NSEC.php DELETED
@@ -1,184 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * NSEC Resource Record - RFC3845 section 2.1
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * / Next Domain Name /
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59
- * / List of Type Bit Map(s) /
60
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61
- *
62
- * @category Networking
63
- * @package Net_DNS2
64
- * @author Mike Pultz <mike@mikepultz.com>
65
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
66
- * @link http://pear.php.net/package/Net_DNS2
67
- * @see Net_DNS2_RR
68
- *
69
- */
70
- class Net_DNS2_RR_NSEC extends Net_DNS2_RR
71
- {
72
- /*
73
- * The next owner name
74
- */
75
- public $next_domain_name;
76
-
77
- /*
78
- * identifies the RRset types that exist at the NSEC RR's owner name.
79
- */
80
- public $type_bit_maps = array();
81
-
82
- /**
83
- * method to return the rdata portion of the packet as a string
84
- *
85
- * @return string
86
- * @access protected
87
- *
88
- */
89
- protected function rrToString()
90
- {
91
- $data = $this->cleanString($this->next_domain_name) . '.';
92
-
93
- foreach ($this->type_bit_maps as $rr) {
94
-
95
- $data .= ' ' . $rr;
96
- }
97
-
98
- return $data;
99
- }
100
-
101
- /**
102
- * parses the rdata portion from a standard DNS config line
103
- *
104
- * @param array $rdata a string split line of values for the rdata
105
- *
106
- * @return boolean
107
- * @access protected
108
- *
109
- */
110
- protected function rrFromString(array $rdata)
111
- {
112
- $this->next_domain_name = $this->cleanString(array_shift($rdata));
113
- $this->type_bit_maps = $rdata;
114
-
115
- return true;
116
- }
117
-
118
- /**
119
- * parses the rdata of the Net_DNS2_Packet object
120
- *
121
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
122
- *
123
- * @return boolean
124
- * @access protected
125
- *
126
- */
127
- protected function rrSet(Net_DNS2_Packet &$packet)
128
- {
129
- if ($this->rdlength > 0) {
130
-
131
- //
132
- // expand the next domain name
133
- //
134
- $offset = $packet->offset;
135
- $this->next_domain_name = Net_DNS2_Packet::expand($packet, $offset);
136
-
137
- //
138
- // parse out the RR's from the bitmap
139
- //
140
- $this->type_bit_maps = Net_DNS2_BitMap::bitMapToArray(
141
- substr($this->rdata, $offset - $packet->offset)
142
- );
143
-
144
- return true;
145
- }
146
-
147
- return false;
148
- }
149
-
150
- /**
151
- * returns the rdata portion of the DNS packet
152
- *
153
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
154
- * compressed names
155
- *
156
- * @return mixed either returns a binary packed
157
- * string or null on failure
158
- * @access protected
159
- *
160
- */
161
- protected function rrGet(Net_DNS2_Packet &$packet)
162
- {
163
- if (strlen($this->next_domain_name) > 0) {
164
-
165
- $data = $packet->compress($this->next_domain_name, $packet->offset);
166
- $bitmap = Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
167
-
168
- $packet->offset += strlen($bitmap);
169
-
170
- return $data . $bitmap;
171
- }
172
-
173
- return null;
174
- }
175
- }
176
-
177
- /*
178
- * Local variables:
179
- * tab-width: 4
180
- * c-basic-offset: 4
181
- * c-hanging-comment-ender-p: nil
182
- * End:
183
- */
184
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/NSEC3.php DELETED
@@ -1,310 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * NSEC3 Resource Record - RFC5155 section 3.2
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | Hash Alg. | Flags | Iterations |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59
- * | Salt Length | Salt /
60
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61
- * | Hash Length | Next Hashed Owner Name /
62
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63
- * / Type Bit Maps /
64
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
65
- *
66
- * @category Networking
67
- * @package Net_DNS2
68
- * @author Mike Pultz <mike@mikepultz.com>
69
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
70
- * @link http://pear.php.net/package/Net_DNS2
71
- * @see Net_DNS2_RR
72
- *
73
- */
74
- class Net_DNS2_RR_NSEC3 extends Net_DNS2_RR
75
- {
76
- /*
77
- * Algorithm to use
78
- */
79
- public $algorithm;
80
-
81
- /*
82
- * flags
83
- */
84
- public $flags;
85
-
86
- /*
87
- * defines the number of additional times the hash is performed.
88
- */
89
- public $iterations;
90
-
91
- /*
92
- * the length of the salt- not displayed
93
- */
94
- public $salt_length;
95
-
96
- /*
97
- * the salt
98
- */
99
- public $salt;
100
-
101
- /*
102
- * the length of the hash value
103
- */
104
- public $hash_length;
105
-
106
- /*
107
- * the hashed value of the owner name
108
- */
109
- public $hashed_owner_name;
110
-
111
- /*
112
- * array of RR type names
113
- */
114
- public $type_bit_maps = array();
115
-
116
- /**
117
- * method to return the rdata portion of the packet as a string
118
- *
119
- * @return string
120
- * @access protected
121
- *
122
- */
123
- protected function rrToString()
124
- {
125
- $out = $this->algorithm . ' ' . $this->flags . ' ' . $this->iterations . ' ';
126
-
127
- //
128
- // per RFC5155, the salt_length value isn't displayed, and if the salt
129
- // is empty, the salt is displayed as '-'
130
- //
131
- if ($this->salt_length > 0) {
132
-
133
- $out .= $this->salt;
134
- } else {
135
-
136
- $out .= '-';
137
- }
138
-
139
- //
140
- // per RFC5255 the hash length isn't shown
141
- //
142
- $out .= ' ' . $this->hashed_owner_name;
143
-
144
- //
145
- // show the RR's
146
- //
147
- foreach ($this->type_bit_maps as $rr) {
148
-
149
- $out .= ' ' . strtoupper($rr);
150
- }
151
-
152
- return $out;
153
- }
154
-
155
- /**
156
- * parses the rdata portion from a standard DNS config line
157
- *
158
- * @param array $rdata a string split line of values for the rdata
159
- *
160
- * @return boolean
161
- * @access protected
162
- *
163
- */
164
- protected function rrFromString(array $rdata)
165
- {
166
- $this->algorithm = array_shift($rdata);
167
- $this->flags = array_shift($rdata);
168
- $this->iterations = array_shift($rdata);
169
-
170
- //
171
- // an empty salt is represented as '-' per RFC5155 section 3.3
172
- //
173
- $salt = array_shift($rdata);
174
- if ($salt == '-') {
175
-
176
- $this->salt_length = 0;
177
- $this->salt = '';
178
- } else {
179
-
180
- $this->salt_length = strlen(pack('H*', $salt));
181
- $this->salt = strtoupper($salt);
182
- }
183
-
184
- $this->hashed_owner_name = array_shift($rdata);
185
- $this->hash_length = strlen(base64_decode($this->hashed_owner_name));
186
-
187
- $this->type_bit_maps = $rdata;
188
-
189
- return true;
190
- }
191
-
192
- /**
193
- * parses the rdata of the Net_DNS2_Packet object
194
- *
195
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
196
- *
197
- * @return boolean
198
- * @access protected
199
- *
200
- */
201
- protected function rrSet(Net_DNS2_Packet &$packet)
202
- {
203
- if ($this->rdlength > 0) {
204
-
205
- //
206
- // unpack the first values
207
- //
208
- $x = unpack('Calgorithm/Cflags/niterations/Csalt_length', $this->rdata);
209
-
210
- $this->algorithm = $x['algorithm'];
211
- $this->flags = $x['flags'];
212
- $this->iterations = $x['iterations'];
213
- $this->salt_length = $x['salt_length'];
214
-
215
- $offset = 5;
216
-
217
- if ($this->salt_length > 0) {
218
-
219
- $x = unpack('H*', substr($this->rdata, $offset, $this->salt_length));
220
- $this->salt = strtoupper($x[1]);
221
- $offset += $this->salt_length;
222
- }
223
-
224
- //
225
- // unpack the hash length
226
- //
227
- $x = unpack('@' . $offset . '/Chash_length', $this->rdata);
228
- $offset++;
229
-
230
- //
231
- // copy out the hash
232
- //
233
- $this->hash_length = $x['hash_length'];
234
- if ($this->hash_length > 0) {
235
-
236
- $this->hashed_owner_name = base64_encode(
237
- substr($this->rdata, $offset, $this->hash_length)
238
- );
239
- $offset += $this->hash_length;
240
- }
241
-
242
- //
243
- // parse out the RR bitmap
244
- //
245
- $this->type_bit_maps = Net_DNS2_BitMap::bitMapToArray(
246
- substr($this->rdata, $offset)
247
- );
248
-
249
- return true;
250
- }
251
-
252
- return false;
253
- }
254
-
255
- /**
256
- * returns the rdata portion of the DNS packet
257
- *
258
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
259
- * compressed names
260
- *
261
- * @return mixed either returns a binary packed
262
- * string or null on failure
263
- * @access protected
264
- *
265
- */
266
- protected function rrGet(Net_DNS2_Packet &$packet)
267
- {
268
- //
269
- // pull the salt and build the length
270
- //
271
- $salt = pack('H*', $this->salt);
272
- $this->salt_length = strlen($salt);
273
-
274
- //
275
- // pack the algorithm, flags, iterations and salt length
276
- //
277
- $data = pack(
278
- 'CCnC',
279
- $this->algorithm, $this->flags, $this->iterations, $this->salt_length
280
- );
281
- $data .= $salt;
282
-
283
- //
284
- // add the hash length and hash
285
- //
286
- $data .= chr($this->hash_length);
287
- if ($this->hash_length > 0) {
288
-
289
- $data .= base64_decode($this->hashed_owner_name);
290
- }
291
-
292
- //
293
- // conver the array of RR names to a type bitmap
294
- //
295
- $data .= Net_DNS2_BitMap::arrayToBitMap($this->type_bit_maps);
296
-
297
- $packet->offset += strlen($data);
298
-
299
- return $data;
300
- }
301
- }
302
-
303
- /*
304
- * Local variables:
305
- * tab-width: 4
306
- * c-basic-offset: 4
307
- * c-hanging-comment-ender-p: nil
308
- * End:
309
- */
310
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/NSEC3PARAM.php DELETED
@@ -1,220 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * NSEC3PARAM Resource Record - RFC5155 section 4.2
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | Hash Alg. | Flags | Iterations |
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59
- * | Salt Length | Salt /
60
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61
- *
62
- * @category Networking
63
- * @package Net_DNS2
64
- * @author Mike Pultz <mike@mikepultz.com>
65
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
66
- * @link http://pear.php.net/package/Net_DNS2
67
- * @see Net_DNS2_RR
68
- *
69
- */
70
- class Net_DNS2_RR_NSEC3PARAM extends Net_DNS2_RR
71
- {
72
- /*
73
- * Algorithm to use
74
- *
75
- * TODO: same as the NSEC3
76
- */
77
- public $algorithm;
78
-
79
- /*
80
- * flags
81
- */
82
- public $flags;
83
-
84
- /*
85
- * defines the number of additional times the hash is performed.
86
- */
87
- public $iterations;
88
-
89
- /*
90
- * the length of the salt- not displayed
91
- */
92
- public $salt_length;
93
-
94
- /*
95
- * the salt
96
- */
97
- public $salt;
98
-
99
- /**
100
- * method to return the rdata portion of the packet as a string
101
- *
102
- * @return string
103
- * @access protected
104
- *
105
- */
106
- protected function rrToString()
107
- {
108
- $out = $this->algorithm . ' ' . $this->flags . ' ' . $this->iterations . ' ';
109
-
110
- //
111
- // per RFC5155, the salt_length value isn't displayed, and if the salt
112
- // is empty, the salt is displayed as "-"
113
- //
114
- if ($this->salt_length > 0) {
115
-
116
- $out .= $this->salt;
117
- } else {
118
-
119
- $out .= '-';
120
- }
121
-
122
- return $out;
123
- }
124
-
125
- /**
126
- * parses the rdata portion from a standard DNS config line
127
- *
128
- * @param array $rdata a string split line of values for the rdata
129
- *
130
- * @return boolean
131
- * @access protected
132
- *
133
- */
134
- protected function rrFromString(array $rdata)
135
- {
136
- $this->algorithm = array_shift($rdata);
137
- $this->flags = array_shift($rdata);
138
- $this->iterations = array_shift($rdata);
139
-
140
- $salt = array_shift($rdata);
141
- if ($salt == '-') {
142
-
143
- $this->salt_length = 0;
144
- $this->salt = '';
145
- } else {
146
-
147
- $this->salt_length = strlen(pack('H*', $salt));
148
- $this->salt = strtoupper($salt);
149
- }
150
-
151
- return true;
152
- }
153
-
154
- /**
155
- * parses the rdata of the Net_DNS2_Packet object
156
- *
157
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
158
- *
159
- * @return boolean
160
- * @access protected
161
- *
162
- */
163
- protected function rrSet(Net_DNS2_Packet &$packet)
164
- {
165
- if ($this->rdlength > 0) {
166
-
167
- $x = unpack('Calgorithm/Cflags/niterations/Csalt_length', $this->rdata);
168
-
169
- $this->algorithm = $x['algorithm'];
170
- $this->flags = $x['flags'];
171
- $this->iterations = $x['iterations'];
172
- $this->salt_length = $x['salt_length'];
173
-
174
- if ($this->salt_length > 0) {
175
-
176
- $x = unpack('H*', substr($this->rdata, 5, $this->salt_length));
177
- $this->salt = strtoupper($x[1]);
178
- }
179
-
180
- return true;
181
- }
182
-
183
- return false;
184
- }
185
-
186
- /**
187
- * returns the rdata portion of the DNS packet
188
- *
189
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
190
- * compressed names
191
- *
192
- * @return mixed either returns a binary packed
193
- * string or null on failure
194
- * @access protected
195
- *
196
- */
197
- protected function rrGet(Net_DNS2_Packet &$packet)
198
- {
199
- $salt = pack('H*', $this->salt);
200
- $this->salt_length = strlen($salt);
201
-
202
- $data = pack(
203
- 'CCnC',
204
- $this->algorithm, $this->flags, $this->iterations, $this->salt_length
205
- ) . $salt;
206
-
207
- $packet->offset += strlen($data);
208
-
209
- return $data;
210
- }
211
- }
212
-
213
- /*
214
- * Local variables:
215
- * tab-width: 4
216
- * c-basic-offset: 4
217
- * c-hanging-comment-ender-p: nil
218
- * End:
219
- */
220
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/OPENPGPKEY.php DELETED
@@ -1,159 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2014, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2014 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.4.0
49
- *
50
- */
51
-
52
- /**
53
- * OPENPGPKEY Resource Record - https://tools.ietf.org/html/draft-ietf-dane-openpgpkey-01
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * / /
58
- * / OpenPGP Public KeyRing /
59
- * / /
60
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61
- *
62
- * @category Networking
63
- * @package Net_DNS2
64
- * @author Mike Pultz <mike@mikepultz.com>
65
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
66
- * @link http://pear.php.net/package/Net_DNS2
67
- * @see Net_DNS2_RR
68
- *
69
- */
70
- class Net_DNS2_RR_OPENPGPKEY extends Net_DNS2_RR
71
- {
72
- /*
73
- * the public key
74
- */
75
- public $key;
76
-
77
- /**
78
- * method to return the rdata portion of the packet as a string
79
- *
80
- * @return string
81
- * @access protected
82
- *
83
- */
84
- protected function rrToString()
85
- {
86
- return $this->key;
87
- }
88
-
89
- /**
90
- * parses the rdata portion from a standard DNS config line
91
- *
92
- * @param array $rdata a string split line of values for the rdata
93
- *
94
- * @return boolean
95
- * @access protected
96
- *
97
- */
98
- protected function rrFromString(array $rdata)
99
- {
100
- $this->key = array_shift($rdata);
101
-
102
- return true;
103
- }
104
-
105
- /**
106
- * parses the rdata of the Net_DNS2_Packet object
107
- *
108
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
109
- *
110
- * @return boolean
111
- * @access protected
112
- *
113
- */
114
- protected function rrSet(Net_DNS2_Packet &$packet)
115
- {
116
- if ($this->rdlength > 0) {
117
-
118
- $this->key = base64_encode(substr($this->rdata, 0, $this->rdlength));
119
-
120
- return true;
121
- }
122
-
123
- return false;
124
- }
125
-
126
- /**
127
- * returns the rdata portion of the DNS packet
128
- *
129
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
130
- * compressed names
131
- *
132
- * @return mixed either returns a binary packed
133
- * string or null on failure
134
- * @access protected
135
- *
136
- */
137
- protected function rrGet(Net_DNS2_Packet &$packet)
138
- {
139
- if (strlen($this->key) > 0) {
140
-
141
- $data = base64_decode($this->key);
142
-
143
- $packet->offset += strlen($data);
144
-
145
- return $data;
146
- }
147
-
148
- return null;
149
- }
150
- }
151
-
152
- /*
153
- * Local variables:
154
- * tab-width: 4
155
- * c-basic-offset: 4
156
- * c-hanging-comment-ender-p: nil
157
- * End:
158
- */
159
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/PX.php DELETED
@@ -1,186 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * PX Resource Record - RFC2163 section 4
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | PREFERENCE |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * / MAP822 /
59
- * / /
60
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
61
- * / MAPX400 /
62
- * / /
63
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
64
- *
65
- * @category Networking
66
- * @package Net_DNS2
67
- * @author Mike Pultz <mike@mikepultz.com>
68
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
69
- * @link http://pear.php.net/package/Net_DNS2
70
- * @see Net_DNS2_RR
71
- *
72
- */
73
- class Net_DNS2_RR_PX extends Net_DNS2_RR
74
- {
75
- /*
76
- * preference
77
- */
78
- public $preference;
79
-
80
- /*
81
- * the RFC822 part of the MCGAM
82
- */
83
- public $map822;
84
-
85
- /*
86
- * the X.400 part of the MCGAM
87
- */
88
- public $mapx400;
89
-
90
- /**
91
- * method to return the rdata portion of the packet as a string
92
- *
93
- * @return string
94
- * @access protected
95
- *
96
- */
97
- protected function rrToString()
98
- {
99
- return $this->preference . ' ' . $this->cleanString($this->map822) . '. ' .
100
- $this->cleanString($this->mapx400) . '.';
101
- }
102
-
103
- /**
104
- * parses the rdata portion from a standard DNS config line
105
- *
106
- * @param array $rdata a string split line of values for the rdata
107
- *
108
- * @return boolean
109
- * @access protected
110
- *
111
- */
112
- protected function rrFromString(array $rdata)
113
- {
114
- $this->preference = $rdata[0];
115
- $this->map822 = $this->cleanString($rdata[1]);
116
- $this->mapx400 = $this->cleanString($rdata[2]);
117
-
118
- return true;
119
- }
120
-
121
- /**
122
- * parses the rdata of the Net_DNS2_Packet object
123
- *
124
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
125
- *
126
- * @return boolean
127
- * @access protected
128
- *
129
- */
130
- protected function rrSet(Net_DNS2_Packet &$packet)
131
- {
132
- if ($this->rdlength > 0) {
133
-
134
- //
135
- // parse the preference
136
- //
137
- $x = unpack('npreference', $this->rdata);
138
- $this->preference = $x['preference'];
139
-
140
- $offset = $packet->offset + 2;
141
-
142
- $this->map822 = Net_DNS2_Packet::expand($packet, $offset);
143
- $this->mapx400 = Net_DNS2_Packet::expand($packet, $offset);
144
-
145
- return true;
146
- }
147
-
148
- return false;
149
- }
150
-
151
- /**
152
- * returns the rdata portion of the DNS packet
153
- *
154
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
155
- * compressed names
156
- *
157
- * @return mixed either returns a binary packed
158
- * string or null on failure
159
- * @access protected
160
- *
161
- */
162
- protected function rrGet(Net_DNS2_Packet &$packet)
163
- {
164
- if (strlen($this->map822) > 0) {
165
-
166
- $data = pack('n', $this->preference);
167
- $packet->offset += 2;
168
-
169
- $data .= $packet->compress($this->map822, $packet->offset);
170
- $data .= $packet->compress($this->mapx400, $packet->offset);
171
-
172
- return $data;
173
- }
174
-
175
- return null;
176
- }
177
- }
178
-
179
- /*
180
- * Local variables:
181
- * tab-width: 4
182
- * c-basic-offset: 4
183
- * c-hanging-comment-ender-p: nil
184
- * End:
185
- */
186
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/RP.php DELETED
@@ -1,167 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * RP Resource Record - RFC1183 section 2.2
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * / mboxdname /
57
- * / /
58
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
59
- * / txtdname /
60
- * / /
61
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
62
- *
63
- * @category Networking
64
- * @package Net_DNS2
65
- * @author Mike Pultz <mike@mikepultz.com>
66
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
67
- * @link http://pear.php.net/package/Net_DNS2
68
- * @see Net_DNS2_RR
69
- *
70
- */
71
- class Net_DNS2_RR_RP extends Net_DNS2_RR
72
- {
73
- /*
74
- * mailbox for the responsible person
75
- */
76
- public $mboxdname;
77
-
78
- /*
79
- * is a domain name for which TXT RR's exists
80
- */
81
- public $txtdname;
82
-
83
- /**
84
- * method to return the rdata portion of the packet as a string
85
- *
86
- * @return string
87
- * @access protected
88
- *
89
- */
90
- protected function rrToString()
91
- {
92
- return $this->cleanString($this->mboxdname) . '. ' .
93
- $this->cleanString($this->txtdname) . '.';
94
- }
95
-
96
- /**
97
- * parses the rdata portion from a standard DNS config line
98
- *
99
- * @param array $rdata a string split line of values for the rdata
100
- *
101
- * @return boolean
102
- * @access protected
103
- *
104
- */
105
- protected function rrFromString(array $rdata)
106
- {
107
- $this->mboxdname = $this->cleanString($rdata[0]);
108
- $this->txtdname = $this->cleanString($rdata[1]);
109
-
110
- return true;
111
- }
112
-
113
- /**
114
- * parses the rdata of the Net_DNS2_Packet object
115
- *
116
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
117
- *
118
- * @return boolean
119
- * @access protected
120
- *
121
- */
122
- protected function rrSet(Net_DNS2_Packet &$packet)
123
- {
124
- if ($this->rdlength > 0) {
125
-
126
- $offset = $packet->offset;
127
-
128
- $this->mboxdname = Net_DNS2_Packet::expand($packet, $offset);
129
- $this->txtdname = Net_DNS2_Packet::expand($packet, $offset);
130
-
131
- return true;
132
- }
133
-
134
- return false;
135
- }
136
-
137
- /**
138
- * returns the rdata portion of the DNS packet
139
- *
140
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
141
- * compressed names
142
- *
143
- * @return mixed either returns a binary packed
144
- * string or null on failure
145
- * @access protected
146
- *
147
- */
148
- protected function rrGet(Net_DNS2_Packet &$packet)
149
- {
150
- if (strlen($this->mboxdname) > 0) {
151
-
152
- return $packet->compress($this->mboxdname, $packet->offset) .
153
- $packet->compress($this->txtdname, $packet->offset);
154
- }
155
-
156
- return null;
157
- }
158
- }
159
-
160
- /*
161
- * Local variables:
162
- * tab-width: 4
163
- * c-basic-offset: 4
164
- * c-hanging-comment-ender-p: nil
165
- * End:
166
- */
167
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/RRSIG.php DELETED
@@ -1,329 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- * This file contains code based off the Net::DNS::SEC Perl module by
51
- * Olaf M. Kolkman
52
- *
53
- * This is the copyright notice from the PERL Net::DNS::SEC module:
54
- *
55
- * Copyright (c) 2001 - 2005 RIPE NCC. Author Olaf M. Kolkman
56
- * Copyright (c) 2007 - 2008 NLnet Labs. Author Olaf M. Kolkman
57
- * <olaf@net-dns.org>
58
- *
59
- * All Rights Reserved
60
- *
61
- * Permission to use, copy, modify, and distribute this software and its
62
- * documentation for any purpose and without fee is hereby granted,
63
- * provided that the above copyright notice appear in all copies and that
64
- * both that copyright notice and this permission notice appear in
65
- * supporting documentation, and that the name of the author not be
66
- * used in advertising or publicity pertaining to distribution of the
67
- * software without specific, written prior permission.
68
- *
69
- * THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
70
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
71
- * AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
72
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
73
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
74
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
75
- *
76
- */
77
-
78
- /**
79
- * RRSIG Resource Record - RFC4034 sction 3.1
80
- *
81
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
82
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
83
- * | Type Covered | Algorithm | Labels |
84
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
85
- * | Original TTL |
86
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
87
- * | Signature Expiration |
88
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
89
- * | Signature Inception |
90
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
91
- * | Key Tag | /
92
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Signer's Name /
93
- * / /
94
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
95
- * / /
96
- * / Signature /
97
- * / /
98
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
99
- *
100
- * @category Networking
101
- * @package Net_DNS2
102
- * @author Mike Pultz <mike@mikepultz.com>
103
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
104
- * @link http://pear.php.net/package/Net_DNS2
105
- * @see Net_DNS2_RR
106
- *
107
- */
108
- class Net_DNS2_RR_RRSIG extends Net_DNS2_RR
109
- {
110
- /*
111
- * the RR type covered by this signature
112
- */
113
- public $typecovered;
114
-
115
- /*
116
- * the algorithm used for the signature
117
- */
118
- public $algorithm;
119
-
120
- /*
121
- * the number of labels in the name
122
- */
123
- public $labels;
124
-
125
- /*
126
- * the original TTL
127
- */
128
- public $origttl;
129
-
130
- /*
131
- * the signature expiration
132
- */
133
- public $sigexp;
134
-
135
- /*
136
- * the inception of the signature
137
- */
138
- public $sigincep;
139
-
140
- /*
141
- * the keytag used
142
- */
143
- public $keytag;
144
-
145
- /*
146
- * the signer's name
147
- */
148
- public $signname;
149
-
150
- /*
151
- * the signature
152
- */
153
- public $signature;
154
-
155
- /**
156
- * method to return the rdata portion of the packet as a string
157
- *
158
- * @return string
159
- * @access protected
160
- *
161
- */
162
- protected function rrToString()
163
- {
164
- return $this->typecovered . ' ' . $this->algorithm . ' ' .
165
- $this->labels . ' ' . $this->origttl . ' ' .
166
- $this->sigexp . ' ' . $this->sigincep . ' ' .
167
- $this->keytag . ' ' . $this->cleanString($this->signname) . '. ' .
168
- $this->signature;
169
- }
170
-
171
- /**
172
- * parses the rdata portion from a standard DNS config line
173
- *
174
- * @param array $rdata a string split line of values for the rdata
175
- *
176
- * @return boolean
177
- * @access protected
178
- *
179
- */
180
- protected function rrFromString(array $rdata)
181
- {
182
- $this->typecovered = strtoupper(array_shift($rdata));
183
- $this->algorithm = array_shift($rdata);
184
- $this->labels = array_shift($rdata);
185
- $this->origttl = array_shift($rdata);
186
- $this->sigexp = array_shift($rdata);
187
- $this->sigincep = array_shift($rdata);
188
- $this->keytag = array_shift($rdata);
189
- $this->signname = $this->cleanString(array_shift($rdata));
190
-
191
- foreach ($rdata as $line) {
192
-
193
- $this->signature .= $line;
194
- }
195
-
196
- $this->signature = trim($this->signature);
197
-
198
- return true;
199
- }
200
-
201
- /**
202
- * parses the rdata of the Net_DNS2_Packet object
203
- *
204
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
205
- *
206
- * @return boolean
207
- * @access protected
208
- *
209
- */
210
- protected function rrSet(Net_DNS2_Packet &$packet)
211
- {
212
- if ($this->rdlength > 0) {
213
-
214
- //
215
- // unpack
216
- //
217
- $x = unpack(
218
- 'ntc/Calgorithm/Clabels/Norigttl/Nsigexp/Nsigincep/nkeytag',
219
- $this->rdata
220
- );
221
-
222
- $this->typecovered = Net_DNS2_Lookups::$rr_types_by_id[$x['tc']];
223
- $this->algorithm = $x['algorithm'];
224
- $this->labels = $x['labels'];
225
- $this->origttl = Net_DNS2::expandUint32($x['origttl']);
226
-
227
- //
228
- // the dates are in GM time
229
- //
230
- $this->sigexp = gmdate('YmdHis', $x['sigexp']);
231
- $this->sigincep = gmdate('YmdHis', $x['sigincep']);
232
-
233
- //
234
- // get the keytag
235
- //
236
- $this->keytag = $x['keytag'];
237
-
238
- //
239
- // get teh signers name and signature
240
- //
241
- $offset = $packet->offset + 18;
242
- $sigoffset = $offset;
243
-
244
- $this->signname = strtolower(
245
- Net_DNS2_Packet::expand($packet, $sigoffset)
246
- );
247
- $this->signature = base64_encode(
248
- substr($this->rdata, 18 + ($sigoffset - $offset))
249
- );
250
-
251
- return true;
252
- }
253
-
254
- return false;
255
- }
256
-
257
- /**
258
- * returns the rdata portion of the DNS packet
259
- *
260
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
261
- * compressed names
262
- *
263
- * @return mixed either returns a binary packed
264
- * string or null on failure
265
- * @access protected
266
- *
267
- */
268
- protected function rrGet(Net_DNS2_Packet &$packet)
269
- {
270
- if (strlen($this->signature) > 0) {
271
-
272
- //
273
- // parse the values out of the dates
274
- //
275
- preg_match(
276
- '/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/', $this->sigexp, $e
277
- );
278
- preg_match(
279
- '/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/', $this->sigincep, $i
280
- );
281
-
282
- //
283
- // pack the value
284
- //
285
- $data = pack(
286
- 'nCCNNNn',
287
- Net_DNS2_Lookups::$rr_types_by_name[$this->typecovered],
288
- $this->algorithm,
289
- $this->labels,
290
- $this->origttl,
291
- gmmktime($e[4], $e[5], $e[6], $e[2], $e[3], $e[1]),
292
- gmmktime($i[4], $i[5], $i[6], $i[2], $i[3], $i[1]),
293
- $this->keytag
294
- );
295
-
296
- //
297
- // the signer name is special; it's not allowed to be compressed
298
- // (see section 3.1.7)
299
- //
300
- $names = explode('.', strtolower($this->signname));
301
- foreach ($names as $name) {
302
-
303
- $data .= chr(strlen($name));
304
- $data .= $name;
305
- }
306
- $data .= "\0";
307
-
308
- //
309
- // add the signature
310
- //
311
- $data .= base64_decode($this->signature);
312
-
313
- $packet->offset += strlen($data);
314
-
315
- return $data;
316
- }
317
-
318
- return null;
319
- }
320
- }
321
-
322
- /*
323
- * Local variables:
324
- * tab-width: 4
325
- * c-basic-offset: 4
326
- * c-hanging-comment-ender-p: nil
327
- * End:
328
- */
329
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/RT.php DELETED
@@ -1,175 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * RT Resource Record - RFC1183 section 3.3
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | preference |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * / intermediate-host /
59
- * / /
60
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
61
- *
62
- * @category Networking
63
- * @package Net_DNS2
64
- * @author Mike Pultz <mike@mikepultz.com>
65
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
66
- * @link http://pear.php.net/package/Net_DNS2
67
- * @see Net_DNS2_RR
68
- *
69
- */
70
- class Net_DNS2_RR_RT extends Net_DNS2_RR
71
- {
72
- /*
73
- * the preference of this route
74
- */
75
- public $preference;
76
-
77
- /*
78
- * host which will servce as an intermediate in reaching the owner host
79
- */
80
- public $intermediatehost;
81
-
82
- /**
83
- * method to return the rdata portion of the packet as a string
84
- *
85
- * @return string
86
- * @access protected
87
- *
88
- */
89
- protected function rrToString()
90
- {
91
- return $this->preference . ' ' .
92
- $this->cleanString($this->intermediatehost) . '.';
93
- }
94
-
95
- /**
96
- * parses the rdata portion from a standard DNS config line
97
- *
98
- * @param array $rdata a string split line of values for the rdata
99
- *
100
- * @return boolean
101
- * @access protected
102
- *
103
- */
104
- protected function rrFromString(array $rdata)
105
- {
106
- $this->preference = $rdata[0];
107
- $this->intermediatehost = $this->cleanString($rdata[1]);
108
-
109
- return true;
110
- }
111
-
112
- /**
113
- * parses the rdata of the Net_DNS2_Packet object
114
- *
115
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
116
- *
117
- * @return boolean
118
- * @access protected
119
- *
120
- */
121
- protected function rrSet(Net_DNS2_Packet &$packet)
122
- {
123
- if ($this->rdlength > 0) {
124
-
125
- //
126
- // unpack the preference
127
- //
128
- $x = unpack('npreference', $this->rdata);
129
-
130
- $this->preference = $x['preference'];
131
- $offset = $packet->offset + 2;
132
-
133
- $this->intermediatehost = Net_DNS2_Packet::expand($packet, $offset);
134
-
135
- return true;
136
- }
137
-
138
- return false;
139
- }
140
-
141
- /**
142
- * returns the rdata portion of the DNS packet
143
- *
144
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
145
- * compressed names
146
- *
147
- * @return mixed either returns a binary packed
148
- * string or null on failure
149
- * @access protected
150
- *
151
- */
152
- protected function rrGet(Net_DNS2_Packet &$packet)
153
- {
154
- if (strlen($this->intermediatehost) > 0) {
155
-
156
- $data = pack('n', $this->preference);
157
- $packet->offset += 2;
158
-
159
- $data .= $packet->compress($this->intermediatehost, $packet->offset);
160
-
161
- return $data;
162
- }
163
-
164
- return null;
165
- }
166
- }
167
-
168
- /*
169
- * Local variables:
170
- * tab-width: 4
171
- * c-basic-offset: 4
172
- * c-hanging-comment-ender-p: nil
173
- * End:
174
- */
175
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/SMIMEA.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2016, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2016 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.4.2
49
- *
50
- */
51
-
52
- /**
53
- * The SMIMEA RR is implemented exactly like the TLSA record, so
54
- * for now we just extend the TLSA RR and use it.
55
- *
56
- * @category Networking
57
- * @package Net_DNS2
58
- * @author Mike Pultz <mike@mikepultz.com>
59
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
60
- * @link http://pear.php.net/package/Net_DNS2
61
- * @see Net_DNS2_RR
62
- *
63
- */
64
- class Net_DNS2_RR_SMIMEA extends Net_DNS2_RR_TLSA
65
- {
66
- }
67
-
68
- /*
69
- * Local variables:
70
- * tab-width: 4
71
- * c-basic-offset: 4
72
- * c-hanging-comment-ender-p: nil
73
- * End:
74
- */
75
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/SPF.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * The SPF RR is implemented exactly like the TXT record, so
54
- * for now we just extend the TXT RR and use it.
55
- *
56
- * @category Networking
57
- * @package Net_DNS2
58
- * @author Mike Pultz <mike@mikepultz.com>
59
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
60
- * @link http://pear.php.net/package/Net_DNS2
61
- * @see Net_DNS2_RR
62
- *
63
- */
64
- class Net_DNS2_RR_SPF extends Net_DNS2_RR_TXT
65
- {
66
- }
67
-
68
- /*
69
- * Local variables:
70
- * tab-width: 4
71
- * c-basic-offset: 4
72
- * c-hanging-comment-ender-p: nil
73
- * End:
74
- */
75
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/SRV.php DELETED
@@ -1,186 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * SRV Resource Record - RFC2782
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | PRIORITY |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * | WEIGHT |
59
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
60
- * | PORT |
61
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
62
- * / TARGET /
63
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
64
- *
65
- * @category Networking
66
- * @package Net_DNS2
67
- * @author Mike Pultz <mike@mikepultz.com>
68
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
69
- * @link http://pear.php.net/package/Net_DNS2
70
- * @see Net_DNS2_RR
71
- *
72
- */
73
- class Net_DNS2_RR_SRV extends Net_DNS2_RR
74
- {
75
- /*
76
- * The priority of this target host.
77
- */
78
- public $priority;
79
-
80
- /*
81
- * a relative weight for entries with the same priority
82
- */
83
- public $weight;
84
-
85
- /*
86
- * The port on this target host of this service.
87
- */
88
- public $port;
89
-
90
- /*
91
- * The domain name of the target host
92
- */
93
- public $target;
94
-
95
- /**
96
- * method to return the rdata portion of the packet as a string
97
- *
98
- * @return string
99
- * @access protected
100
- *
101
- */
102
- protected function rrToString()
103
- {
104
- return $this->priority . ' ' . $this->weight . ' ' .
105
- $this->port . ' ' . $this->cleanString($this->target) . '.';
106
- }
107
-
108
- /**
109
- * parses the rdata portion from a standard DNS config line
110
- *
111
- * @param array $rdata a string split line of values for the rdata
112
- *
113
- * @return boolean
114
- * @access protected
115
- *
116
- */
117
- protected function rrFromString(array $rdata)
118
- {
119
- $this->priority = $rdata[0];
120
- $this->weight = $rdata[1];
121
- $this->port = $rdata[2];
122
-
123
- $this->target = $this->cleanString($rdata[3]);
124
-
125
- return true;
126
- }
127
-
128
- /**
129
- * parses the rdata of the Net_DNS2_Packet object
130
- *
131
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
132
- *
133
- * @return boolean
134
- * @access protected
135
- *
136
- */
137
- protected function rrSet(Net_DNS2_Packet &$packet)
138
- {
139
- if ($this->rdlength > 0) {
140
-
141
- //
142
- // unpack the priority, weight and port
143
- //
144
- $x = unpack('npriority/nweight/nport', $this->rdata);
145
-
146
- $this->priority = $x['priority'];
147
- $this->weight = $x['weight'];
148
- $this->port = $x['port'];
149
-
150
- $offset = $packet->offset + 6;
151
- $this->target = Net_DNS2_Packet::expand($packet, $offset);
152
-
153
- return true;
154
- }
155
-
156
- return false;
157
- }
158
-
159
- /**
160
- * returns the rdata portion of the DNS packet
161
- *
162
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
163
- * compressed names
164
- *
165
- * @return mixed either returns a binary packed
166
- * string or null on failure
167
- * @access protected
168
- *
169
- */
170
- protected function rrGet(Net_DNS2_Packet &$packet)
171
- {
172
- if (strlen($this->target) > 0) {
173
-
174
- $data = pack('nnn', $this->priority, $this->weight, $this->port);
175
- $packet->offset += 6;
176
-
177
- $data .= $packet->compress($this->target, $packet->offset);
178
-
179
- return $data;
180
- }
181
-
182
- return null;
183
- }
184
- }
185
-
186
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/SSHFP.php DELETED
@@ -1,250 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * SSHFP Resource Record - RFC4255 section 3.1
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | algorithm | fp type | /
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
59
- * / /
60
- * / fingerprint /
61
- * / /
62
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_SSHFP extends Net_DNS2_RR
73
- {
74
- /*
75
- * the algorithm used
76
- */
77
- public $algorithm;
78
-
79
- /*
80
- * The finger print type
81
- */
82
- public $fp_type;
83
-
84
- /*
85
- * the finger print data
86
- */
87
- public $fingerprint;
88
-
89
- /*
90
- * Algorithms
91
- */
92
- const SSHFP_ALGORITHM_RES = 0;
93
- const SSHFP_ALGORITHM_RSA = 1;
94
- const SSHFP_ALGORITHM_DSS = 2;
95
- const SSHFP_ALGORITHM_ECDSA = 3;
96
-
97
- /*
98
- * Fingerprint Types
99
- */
100
- const SSHFP_FPTYPE_RES = 0;
101
- const SSHFP_FPTYPE_SHA1 = 1;
102
- const SSHFP_FPTYPE_SHA256 = 2;
103
-
104
-
105
- /**
106
- * method to return the rdata portion of the packet as a string
107
- *
108
- * @return string
109
- * @access protected
110
- *
111
- */
112
- protected function rrToString()
113
- {
114
- return $this->algorithm . ' ' . $this->fp_type . ' ' . $this->fingerprint;
115
- }
116
-
117
- /**
118
- * parses the rdata portion from a standard DNS config line
119
- *
120
- * @param array $rdata a string split line of values for the rdata
121
- *
122
- * @return boolean
123
- * @access protected
124
- *
125
- */
126
- protected function rrFromString(array $rdata)
127
- {
128
- //
129
- // "The use of mnemonics instead of numbers is not allowed."
130
- //
131
- // RFC4255 section 3.2
132
- //
133
- $algorithm = array_shift($rdata);
134
- $fp_type = array_shift($rdata);
135
- $fingerprint = strtolower(implode('', $rdata));
136
-
137
- //
138
- // There are only two algorithm's defined
139
- //
140
- if ( ($algorithm != self::SSHFP_ALGORITHM_RSA)
141
- && ($algorithm != self::SSHFP_ALGORITHM_DSS)
142
- && ($algorithm != self::SSHFP_ALGORITHM_ECDSA)
143
- ) {
144
- return false;
145
- }
146
-
147
- //
148
- // there are only two fingerprints defined
149
- //
150
- if ( ($fp_type != self::SSHFP_FPTYPE_SHA1)
151
- && ($fp_type != self::SSHFP_FPTYPE_SHA256)
152
- ) {
153
- return false;
154
- }
155
-
156
- $this->algorithm = $algorithm;
157
- $this->fp_type = $fp_type;
158
- $this->fingerprint = $fingerprint;
159
-
160
- return true;
161
- }
162
-
163
- /**
164
- * parses the rdata of the Net_DNS2_Packet object
165
- *
166
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
167
- *
168
- * @return boolean
169
- * @access protected
170
- *
171
- */
172
- protected function rrSet(Net_DNS2_Packet &$packet)
173
- {
174
- if ($this->rdlength > 0) {
175
-
176
- //
177
- // unpack the algorithm and finger print type
178
- //
179
- $x = unpack('Calgorithm/Cfp_type', $this->rdata);
180
-
181
- $this->algorithm = $x['algorithm'];
182
- $this->fp_type = $x['fp_type'];
183
-
184
- //
185
- // There are only three algorithm's defined
186
- //
187
- if ( ($this->algorithm != self::SSHFP_ALGORITHM_RSA)
188
- && ($this->algorithm != self::SSHFP_ALGORITHM_DSS)
189
- && ($this->algorithm != self::SSHFP_ALGORITHM_ECDSA)
190
- ) {
191
- return false;
192
- }
193
-
194
- //
195
- // there are only two fingerprints defined
196
- //
197
- if ( ($this->fp_type != self::SSHFP_FPTYPE_SHA1)
198
- && ($this->fp_type != self::SSHFP_FPTYPE_SHA256)
199
- ) {
200
- return false;
201
- }
202
-
203
- //
204
- // parse the finger print; this assumes SHA-1
205
- //
206
- $fp = unpack('H*a', substr($this->rdata, 2));
207
- $this->fingerprint = strtolower($fp['a']);
208
-
209
- return true;
210
- }
211
-
212
- return false;
213
- }
214
-
215
- /**
216
- * returns the rdata portion of the DNS packet
217
- *
218
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
219
- * compressed names
220
- *
221
- * @return mixed either returns a binary packed
222
- * string or null on failure
223
- * @access protected
224
- *
225
- */
226
- protected function rrGet(Net_DNS2_Packet &$packet)
227
- {
228
- if (strlen($this->fingerprint) > 0) {
229
-
230
- $data = pack(
231
- 'CCH*', $this->algorithm, $this->fp_type, $this->fingerprint
232
- );
233
-
234
- $packet->offset += strlen($data);
235
-
236
- return $data;
237
- }
238
-
239
- return null;
240
- }
241
- }
242
-
243
- /*
244
- * Local variables:
245
- * tab-width: 4
246
- * c-basic-offset: 4
247
- * c-hanging-comment-ender-p: nil
248
- * End:
249
- */
250
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/TA.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2011, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2011 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.2.0
49
- *
50
- */
51
-
52
- /**
53
- * The TA RR is implemented exactly like the DS record, so
54
- * for now we just extend the DS RR and use it.
55
- *
56
- * @category Networking
57
- * @package Net_DNS2
58
- * @author Mike Pultz <mike@mikepultz.com>
59
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
60
- * @link http://pear.php.net/package/Net_DNS2
61
- * @see Net_DNS2_RR
62
- *
63
- */
64
- class Net_DNS2_RR_TA extends Net_DNS2_RR_DS
65
- {
66
- }
67
-
68
- /*
69
- * Local variables:
70
- * tab-width: 4
71
- * c-basic-offset: 4
72
- * c-hanging-comment-ender-p: nil
73
- * End:
74
- */
75
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/TALINK.php DELETED
@@ -1,171 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2011, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2011 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.2.0
49
- *
50
- */
51
-
52
- /**
53
- * TALINK Resource Record - DNSSEC Trust Anchor
54
- *
55
- * http://tools.ietf.org/id/draft-ietf-dnsop-dnssec-trust-history-00.txt
56
- *
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * / PREVIOUS /
59
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
60
- * / NEXT /
61
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
62
- *
63
- * @category Networking
64
- * @package Net_DNS2
65
- * @author Mike Pultz <mike@mikepultz.com>
66
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
67
- * @link http://pear.php.net/package/Net_DNS2
68
- * @see Net_DNS2_RR
69
- *
70
- */
71
- class Net_DNS2_RR_TALINK extends Net_DNS2_RR
72
- {
73
- /*
74
- * the previous domain name
75
- */
76
- public $previous;
77
-
78
- /*
79
- * the next domain name
80
- */
81
- public $next;
82
-
83
- /**
84
- * method to return the rdata portion of the packet as a string
85
- *
86
- * @return string
87
- * @access protected
88
- *
89
- */
90
- protected function rrToString()
91
- {
92
- return $this->cleanString($this->previous) . '. ' .
93
- $this->cleanString($this->next) . '.';
94
- }
95
-
96
- /**
97
- * parses the rdata portion from a standard DNS config line
98
- *
99
- * @param array $rdata a string split line of values for the rdata
100
- *
101
- * @return boolean
102
- * @access protected
103
- *
104
- */
105
- protected function rrFromString(array $rdata)
106
- {
107
- $this->previous = $this->cleanString($rdata[0]);
108
- $this->next = $this->cleanString($rdata[1]);
109
-
110
- return true;
111
- }
112
-
113
- /**
114
- * parses the rdata of the Net_DNS2_Packet object
115
- *
116
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
117
- *
118
- * @return boolean
119
- * @access protected
120
- *
121
- */
122
- protected function rrSet(Net_DNS2_Packet &$packet)
123
- {
124
- if ($this->rdlength > 0) {
125
-
126
- $offset = $packet->offset;
127
-
128
- $this->previous = Net_DNS2_Packet::label($packet, $offset);
129
- $this->next = Net_DNS2_Packet::label($packet, $offset);
130
-
131
- return true;
132
- }
133
-
134
- return false;
135
- }
136
-
137
- /**
138
- * returns the rdata portion of the DNS packet
139
- *
140
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
141
- * compressed names
142
- *
143
- * @return mixed either returns a binary packed
144
- * string or null on failure
145
- * @access protected
146
- *
147
- */
148
- protected function rrGet(Net_DNS2_Packet &$packet)
149
- {
150
- if ( (strlen($this->previous) > 0) || (strlen($this->next) > 0) ) {
151
-
152
- $data = chr(strlen($this->previous)) . $this->previous .
153
- chr(strlen($this->next)) . $this->next;
154
-
155
- $packet->offset += strlen($data);
156
-
157
- return $data;
158
- }
159
-
160
- return null;
161
- }
162
- }
163
-
164
- /*
165
- * Local variables:
166
- * tab-width: 4
167
- * c-basic-offset: 4
168
- * c-hanging-comment-ender-p: nil
169
- * End:
170
- */
171
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/TKEY.php DELETED
@@ -1,307 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * TKEY Resource Record - RFC 2930 section 2
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * / ALGORITHM /
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * | INCEPTION |
59
- * | |
60
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
61
- * | EXPIRATION |
62
- * | |
63
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
64
- * | MODE |
65
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
66
- * | ERROR |
67
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
68
- * | KEY SIZE |
69
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
70
- * / KEY DATA /
71
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
72
- * | OTHER SIZE |
73
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
74
- * / OTHER DATA /
75
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
76
- *
77
- * @category Networking
78
- * @package Net_DNS2
79
- * @author Mike Pultz <mike@mikepultz.com>
80
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
81
- * @link http://pear.php.net/package/Net_DNS2
82
- * @see Net_DNS2_RR
83
- *
84
- */
85
- class Net_DNS2_RR_TKEY extends Net_DNS2_RR
86
- {
87
- public $algorithm;
88
- public $inception;
89
- public $expiration;
90
- public $mode;
91
- public $error;
92
- public $key_size;
93
- public $key_data;
94
- public $other_size;
95
- public $other_data;
96
-
97
- /*
98
- * TSIG Modes
99
- */
100
- const TSIG_MODE_RES = 0;
101
- const TSIG_MODE_SERV_ASSIGN = 1;
102
- const TSIG_MODE_DH = 2;
103
- const TSIG_MODE_GSS_API = 3;
104
- const TSIG_MODE_RESV_ASSIGN = 4;
105
- const TSIG_MODE_KEY_DELE = 5;
106
-
107
- /*
108
- * map the mod id's to names so we can validate
109
- */
110
- public $tsgi_mode_id_to_name = array(
111
-
112
- self::TSIG_MODE_RES => 'Reserved',
113
- self::TSIG_MODE_SERV_ASSIGN => 'Server Assignment',
114
- self::TSIG_MODE_DH => 'Diffie-Hellman',
115
- self::TSIG_MODE_GSS_API => 'GSS-API',
116
- self::TSIG_MODE_RESV_ASSIGN => 'Resolver Assignment',
117
- self::TSIG_MODE_KEY_DELE => 'Key Deletion'
118
- );
119
-
120
- /**
121
- * method to return the rdata portion of the packet as a string
122
- *
123
- * @return string
124
- * @access protected
125
- *
126
- */
127
- protected function rrToString()
128
- {
129
- $out = $this->cleanString($this->algorithm) . '. ' . $this->mode;
130
- if ($this->key_size > 0) {
131
-
132
- $out .= ' ' . trim($this->key_data, '.') . '.';
133
- } else {
134
-
135
- $out .= ' .';
136
- }
137
-
138
- return $out;
139
- }
140
-
141
- /**
142
- * parses the rdata portion from a standard DNS config line
143
- *
144
- * @param array $rdata a string split line of values for the rdata
145
- *
146
- * @return boolean
147
- * @access protected
148
- *
149
- */
150
- protected function rrFromString(array $rdata)
151
- {
152
- //
153
- // data passed in is assumed: <algorithm> <mode> <key>
154
- //
155
- $this->algorithm = $this->cleanString(array_shift($rdata));
156
- $this->mode = array_shift($rdata);
157
- $this->key_data = trim(array_shift($rdata), '.');
158
-
159
- //
160
- // the rest of the data is set manually
161
- //
162
- $this->inception = time();
163
- $this->expiration = time() + 86400; // 1 day
164
- $this->error = 0;
165
- $this->key_size = strlen($this->key_data);
166
- $this->other_size = 0;
167
- $this->other_data = '';
168
-
169
- return true;
170
- }
171
-
172
- /**
173
- * parses the rdata of the Net_DNS2_Packet object
174
- *
175
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
176
- *
177
- * @return boolean
178
- * @access protected
179
- *
180
- */
181
- protected function rrSet(Net_DNS2_Packet &$packet)
182
- {
183
- if ($this->rdlength > 0) {
184
-
185
- //
186
- // expand the algorithm
187
- //
188
- $offset = $packet->offset;
189
- $this->algorithm = Net_DNS2_Packet::expand($packet, $offset);
190
-
191
- //
192
- // unpack inception, expiration, mode, error and key size
193
- //
194
- $x = unpack(
195
- '@' . $offset . '/Ninception/Nexpiration/nmode/nerror/nkey_size',
196
- $packet->rdata
197
- );
198
-
199
- $this->inception = Net_DNS2::expandUint32($x['inception']);
200
- $this->expiration = Net_DNS2::expandUint32($x['expiration']);
201
- $this->mode = $x['mode'];
202
- $this->error = $x['error'];
203
- $this->key_size = $x['key_size'];
204
-
205
- $offset += 14;
206
-
207
- //
208
- // if key_size > 0, then copy out the key
209
- //
210
- if ($this->key_size > 0) {
211
-
212
- $this->key_data = substr($packet->rdata, $offset, $this->key_size);
213
- $offset += $this->key_size;
214
- }
215
-
216
- //
217
- // unpack the other length
218
- //
219
- $x = unpack('@' . $offset . '/nother_size', $packet->rdata);
220
-
221
- $this->other_size = $x['other_size'];
222
- $offset += 2;
223
-
224
- //
225
- // if other_size > 0, then copy out the data
226
- //
227
- if ($this->other_size > 0) {
228
-
229
- $this->other_data = substr(
230
- $packet->rdata, $offset, $this->other_size
231
- );
232
- }
233
-
234
- return true;
235
- }
236
-
237
- return false;
238
- }
239
-
240
- /**
241
- * returns the rdata portion of the DNS packet
242
- *
243
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
244
- * compressed names
245
- *
246
- * @return mixed either returns a binary packed
247
- * string or null on failure
248
- * @access protected
249
- *
250
- */
251
- protected function rrGet(Net_DNS2_Packet &$packet)
252
- {
253
- if (strlen($this->algorithm) > 0) {
254
-
255
- //
256
- // make sure the size values are correct
257
- //
258
- $this->key_size = strlen($this->key_data);
259
- $this->other_size = strlen($this->other_data);
260
-
261
- //
262
- // add the algorithm without compression
263
- //
264
- $data = Net_DNS2_Packet::pack($this->algorithm);
265
-
266
- //
267
- // pack in the inception, expiration, mode, error and key size
268
- //
269
- $data .= pack(
270
- 'NNnnn', $this->inception, $this->expiration,
271
- $this->mode, 0, $this->key_size
272
- );
273
-
274
- //
275
- // if the key_size > 0, then add the key
276
- //
277
- if ($this->key_size > 0) {
278
-
279
- $data .= $this->key_data;
280
- }
281
-
282
- //
283
- // pack in the other size
284
- //
285
- $data .= pack('n', $this->other_size);
286
- if ($this->other_size > 0) {
287
-
288
- $data .= $this->other_data;
289
- }
290
-
291
- $packet->offset += strlen($data);
292
-
293
- return $data;
294
- }
295
-
296
- return null;
297
- }
298
- }
299
-
300
- /*
301
- * Local variables:
302
- * tab-width: 4
303
- * c-basic-offset: 4
304
- * c-hanging-comment-ender-p: nil
305
- * End:
306
- */
307
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/TLSA.php DELETED
@@ -1,194 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2012, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2012 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.2.5
49
- *
50
- */
51
-
52
- /**
53
- * TLSA Resource Record - RFC 6698
54
- *
55
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
56
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57
- * | Cert. Usage | Selector | Matching Type | /
58
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ /
59
- * / /
60
- * / Certificate Association Data /
61
- * / /
62
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2_RR
70
- *
71
- */
72
- class Net_DNS2_RR_TLSA extends Net_DNS2_RR
73
- {
74
- /*
75
- * The Certificate Usage Field
76
- */
77
- public $cert_usage;
78
-
79
- /*
80
- * The Selector Field
81
- */
82
- public $selector;
83
-
84
- /*
85
- * The Matching Type Field
86
- */
87
- public $matching_type;
88
-
89
- /*
90
- * The Certificate Association Data Field
91
- */
92
- public $certificate;
93
-
94
- /**
95
- * method to return the rdata portion of the packet as a string
96
- *
97
- * @return string
98
- * @access protected
99
- *
100
- */
101
- protected function rrToString()
102
- {
103
- return $this->cert_usage . ' ' . $this->selector . ' ' .
104
- $this->matching_type . ' ' . base64_encode($this->certificate);
105
- }
106
-
107
- /**
108
- * parses the rdata portion from a standard DNS config line
109
- *
110
- * @param array $rdata a string split line of values for the rdata
111
- *
112
- * @return boolean
113
- * @access protected
114
- *
115
- */
116
- protected function rrFromString(array $rdata)
117
- {
118
- $this->cert_usage = array_shift($rdata);
119
- $this->selector = array_shift($rdata);
120
- $this->matching_type = array_shift($rdata);
121
- $this->certificate = base64_decode(implode('', $rdata));
122
-
123
- return true;
124
- }
125
-
126
- /**
127
- * parses the rdata of the Net_DNS2_Packet object
128
- *
129
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
130
- *
131
- * @return boolean
132
- * @access protected
133
- *
134
- */
135
- protected function rrSet(Net_DNS2_Packet &$packet)
136
- {
137
- if ($this->rdlength > 0) {
138
-
139
- //
140
- // unpack the format, keytag and algorithm
141
- //
142
- $x = unpack('Cusage/Cselector/Ctype', $this->rdata);
143
-
144
- $this->cert_usage = $x['usage'];
145
- $this->selector = $x['selector'];
146
- $this->matching_type = $x['type'];
147
-
148
- //
149
- // copy the certificate
150
- //
151
- $this->certificate = substr($this->rdata, 3, $this->rdlength - 3);
152
-
153
- return true;
154
- }
155
-
156
- return false;
157
- }
158
-
159
- /**
160
- * returns the rdata portion of the DNS packet
161
- *
162
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
163
- * compressed names
164
- *
165
- * @return mixed either returns a binary packed
166
- * string or null on failure
167
- * @access protected
168
- *
169
- */
170
- protected function rrGet(Net_DNS2_Packet &$packet)
171
- {
172
- if (strlen($this->certificate) > 0) {
173
-
174
- $data = pack(
175
- 'CCC', $this->cert_usage, $this->selector, $this->matching_type
176
- ) . $this->certificate;
177
-
178
- $packet->offset += strlen($data);
179
-
180
- return $data;
181
- }
182
-
183
- return null;
184
- }
185
- }
186
-
187
- /*
188
- * Local variables:
189
- * tab-width: 4
190
- * c-basic-offset: 4
191
- * c-hanging-comment-ender-p: nil
192
- * End:
193
- */
194
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/TXT.php DELETED
@@ -1,177 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * TXT Resource Record - RFC1035 section 3.3.14
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * / TXT-DATA /
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- *
59
- * @category Networking
60
- * @package Net_DNS2
61
- * @author Mike Pultz <mike@mikepultz.com>
62
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
63
- * @link http://pear.php.net/package/Net_DNS2
64
- * @see Net_DNS2_RR
65
- *
66
- */
67
- class Net_DNS2_RR_TXT extends Net_DNS2_RR
68
- {
69
- /*
70
- * an array of the text strings
71
- */
72
- public $text = array();
73
-
74
- /**
75
- * method to return the rdata portion of the packet as a string
76
- *
77
- * @return string
78
- * @access protected
79
- *
80
- */
81
- protected function rrToString()
82
- {
83
- if (count($this->text) == 0) {
84
- return '""';
85
- }
86
-
87
- $data = '';
88
-
89
- foreach ($this->text as $t) {
90
-
91
- $data .= $this->formatString($t) . ' ';
92
- }
93
-
94
- return trim($data);
95
- }
96
-
97
- /**
98
- * parses the rdata portion from a standard DNS config line
99
- *
100
- * @param array $rdata a string split line of values for the rdata
101
- *
102
- * @return boolean
103
- * @access protected
104
- *
105
- */
106
- protected function rrFromString(array $rdata)
107
- {
108
- $data = $this->buildString($rdata);
109
- if (count($data) > 0) {
110
-
111
- $this->text = $data;
112
- }
113
-
114
- return true;
115
- }
116
-
117
- /**
118
- * parses the rdata of the Net_DNS2_Packet object
119
- *
120
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
121
- *
122
- * @return boolean
123
- * @access protected
124
- *
125
- */
126
- protected function rrSet(Net_DNS2_Packet &$packet)
127
- {
128
- if ($this->rdlength > 0) {
129
-
130
- $length = $packet->offset + $this->rdlength;
131
- $offset = $packet->offset;
132
-
133
- while ($length > $offset) {
134
-
135
- $this->text[] = Net_DNS2_Packet::label($packet, $offset);
136
- }
137
-
138
- return true;
139
- }
140
-
141
- return false;
142
- }
143
-
144
- /**
145
- * returns the rdata portion of the DNS packet
146
- *
147
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
148
- * compressed names
149
- *
150
- * @return mixed either returns a binary packed
151
- * string or null on failure
152
- * @access protected
153
- *
154
- */
155
- protected function rrGet(Net_DNS2_Packet &$packet)
156
- {
157
- $data = null;
158
-
159
- foreach ($this->text as $t) {
160
-
161
- $data .= chr(strlen($t)) . $t;
162
- }
163
-
164
- $packet->offset += strlen($data);
165
-
166
- return $data;
167
- }
168
- }
169
-
170
- /*
171
- * Local variables:
172
- * tab-width: 4
173
- * c-basic-offset: 4
174
- * c-hanging-comment-ender-p: nil
175
- * End:
176
- */
177
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/URI.php DELETED
@@ -1,183 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2011, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2011 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.2.0
49
- *
50
- */
51
-
52
- /**
53
- * URI Resource Record - http://tools.ietf.org/html/draft-faltstrom-uri-06
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | PRIORITY |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * | WEIGHT |
59
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
60
- * / TARGET /
61
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
62
- *
63
- * @category Networking
64
- * @package Net_DNS2
65
- * @author Mike Pultz <mike@mikepultz.com>
66
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
67
- * @link http://pear.php.net/package/Net_DNS2
68
- * @see Net_DNS2_RR
69
- *
70
- */
71
- class Net_DNS2_RR_URI extends Net_DNS2_RR
72
- {
73
- /*
74
- * The priority of this target host.
75
- */
76
- public $priority;
77
-
78
- /*
79
- * a relative weight for entries with the same priority
80
- */
81
- public $weight;
82
-
83
- /*
84
- * The domain name of the target host
85
- */
86
- public $target;
87
-
88
- /**
89
- * method to return the rdata portion of the packet as a string
90
- *
91
- * @return string
92
- * @access protected
93
- *
94
- */
95
- protected function rrToString()
96
- {
97
- //
98
- // presentation format has double quotes (") around the target.
99
- //
100
- return $this->priority . ' ' . $this->weight . ' "' .
101
- $this->cleanString($this->target) . '"';
102
- }
103
-
104
- /**
105
- * parses the rdata portion from a standard DNS config line
106
- *
107
- * @param array $rdata a string split line of values for the rdata
108
- *
109
- * @return boolean
110
- * @access protected
111
- *
112
- */
113
- protected function rrFromString(array $rdata)
114
- {
115
- $this->priority = $rdata[0];
116
- $this->weight = $rdata[1];
117
-
118
- //
119
- // make sure to trim the lead/trailing double quote if it's there.
120
- //
121
- $this->target = trim($this->cleanString($rdata[2]), '"');
122
-
123
- return true;
124
- }
125
-
126
- /**
127
- * parses the rdata of the Net_DNS2_Packet object
128
- *
129
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
130
- *
131
- * @return boolean
132
- * @access protected
133
- *
134
- */
135
- protected function rrSet(Net_DNS2_Packet &$packet)
136
- {
137
- if ($this->rdlength > 0) {
138
-
139
- //
140
- // unpack the priority and weight
141
- //
142
- $x = unpack('npriority/nweight', $this->rdata);
143
-
144
- $this->priority = $x['priority'];
145
- $this->weight = $x['weight'];
146
-
147
- $offset = $packet->offset + 4;
148
- $this->target = Net_DNS2_Packet::expand($packet, $offset);
149
-
150
- return true;
151
- }
152
-
153
- return false;
154
- }
155
-
156
- /**
157
- * returns the rdata portion of the DNS packet
158
- *
159
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
160
- * compressed names
161
- *
162
- * @return mixed either returns a binary packed
163
- * string or null on failure
164
- * @access protected
165
- *
166
- */
167
- protected function rrGet(Net_DNS2_Packet &$packet)
168
- {
169
- if (strlen($this->target) > 0) {
170
-
171
- $data = pack('nn', $this->priority, $this->weight);
172
- $packet->offset += 4;
173
-
174
- $data .= $packet->compress(trim($this->target, '"'), $packet->offset);
175
-
176
- return $data;
177
- }
178
-
179
- return null;
180
- }
181
- }
182
-
183
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/WKS.php DELETED
@@ -1,235 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 1.0.1
49
- *
50
- */
51
-
52
- /**
53
- * WKS Resource Record - RFC1035 section 3.4.2
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * | ADDRESS |
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- * | PROTOCOL | |
59
- * +--+--+--+--+--+--+--+--+ |
60
- * | |
61
- * / <BIT MAP> /
62
- * / /
63
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
64
- *
65
- * @category Networking
66
- * @package Net_DNS2
67
- * @author Mike Pultz <mike@mikepultz.com>
68
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
69
- * @link http://pear.php.net/package/Net_DNS2
70
- * @see Net_DNS2_RR
71
- *
72
- */
73
- class Net_DNS2_RR_WKS extends Net_DNS2_RR
74
- {
75
- /*
76
- * The IP address of the service
77
- */
78
- public $address;
79
-
80
- /*
81
- * The protocol of the service
82
- */
83
- public $protocol;
84
-
85
- /*
86
- * bitmap
87
- */
88
- public $bitmap = array();
89
-
90
- /**
91
- * method to return the rdata portion of the packet as a string
92
- *
93
- * @return string
94
- * @access protected
95
- *
96
- */
97
- protected function rrToString()
98
- {
99
- $data = $this->address . ' ' . $this->protocol;
100
-
101
- foreach ($this->bitmap as $port) {
102
- $data .= ' ' . $port;
103
- }
104
-
105
- return $data;
106
- }
107
-
108
- /**
109
- * parses the rdata portion from a standard DNS config line
110
- *
111
- * @param array $rdata a string split line of values for the rdata
112
- *
113
- * @return boolean
114
- * @access protected
115
- *
116
- */
117
- protected function rrFromString(array $rdata)
118
- {
119
- $this->address = strtolower(trim(array_shift($rdata), '.'));
120
- $this->protocol = array_shift($rdata);
121
- $this->bitmap = $rdata;
122
-
123
- return true;
124
- }
125
-
126
- /**
127
- * parses the rdata of the Net_DNS2_Packet object
128
- *
129
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
130
- *
131
- * @return boolean
132
- * @access protected
133
- *
134
- */
135
- protected function rrSet(Net_DNS2_Packet &$packet)
136
- {
137
- if ($this->rdlength > 0) {
138
-
139
- //
140
- // get the address and protocol value
141
- //
142
- $x = unpack('Naddress/Cprotocol', $this->rdata);
143
-
144
- $this->address = long2ip($x['address']);
145
- $this->protocol = $x['protocol'];
146
-
147
- //
148
- // unpack the port list bitmap
149
- //
150
- $port = 0;
151
- foreach (unpack('@5/C*', $this->rdata) as $set) {
152
-
153
- $s = sprintf('%08b', $set);
154
-
155
- for ($i=0; $i<8; $i++, $port++) {
156
- if ($s[$i] == '1') {
157
- $this->bitmap[] = $port;
158
- }
159
- }
160
- }
161
-
162
- return true;
163
- }
164
-
165
- return false;
166
- }
167
-
168
- /**
169
- * returns the rdata portion of the DNS packet
170
- *
171
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
172
- * compressed names
173
- *
174
- * @return mixed either returns a binary packed
175
- * string or null on failure
176
- * @access protected
177
- *
178
- */
179
- protected function rrGet(Net_DNS2_Packet &$packet)
180
- {
181
- if (strlen($this->address) > 0) {
182
-
183
- $data = pack('NC', ip2long($this->address), $this->protocol);
184
-
185
- $ports = array();
186
-
187
- $n = 0;
188
- foreach ($this->bitmap as $port) {
189
- $ports[$port] = 1;
190
-
191
- if ($port > $n) {
192
- $n = $port;
193
- }
194
- }
195
- for ($i=0; $i<ceil($n/8)*8; $i++) {
196
- if (!isset($ports[$i])) {
197
- $ports[$i] = 0;
198
- }
199
- }
200
-
201
- ksort($ports);
202
-
203
- $string = '';
204
- $n = 0;
205
-
206
- foreach ($ports as $s) {
207
-
208
- $string .= $s;
209
- $n++;
210
-
211
- if ($n == 8) {
212
-
213
- $data .= chr(bindec($string));
214
- $string = '';
215
- $n = 0;
216
- }
217
- }
218
-
219
- $packet->offset += strlen($data);
220
-
221
- return $data;
222
- }
223
-
224
- return null;
225
- }
226
- }
227
-
228
- /*
229
- * Local variables:
230
- * tab-width: 4
231
- * c-basic-offset: 4
232
- * c-hanging-comment-ender-p: nil
233
- * End:
234
- */
235
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/RR/X25.php DELETED
@@ -1,160 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * X25 Resource Record - RFC1183 section 3.1
54
- *
55
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
56
- * / PSDN-address /
57
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
58
- *
59
- * @category Networking
60
- * @package Net_DNS2
61
- * @author Mike Pultz <mike@mikepultz.com>
62
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
63
- * @link http://pear.php.net/package/Net_DNS2
64
- * @see Net_DNS2_RR
65
- *
66
- */
67
- class Net_DNS2_RR_X25 extends Net_DNS2_RR
68
- {
69
- /*
70
- * The PSDN address
71
- */
72
- public $psdnaddress;
73
-
74
- /**
75
- * method to return the rdata portion of the packet as a string
76
- *
77
- * @return string
78
- * @access protected
79
- *
80
- */
81
- protected function rrToString()
82
- {
83
- return $this->formatString($this->psdnaddress);
84
- }
85
-
86
- /**
87
- * parses the rdata portion from a standard DNS config line
88
- *
89
- * @param array $rdata a string split line of values for the rdata
90
- *
91
- * @return boolean
92
- * @access protected
93
- *
94
- */
95
- protected function rrFromString(array $rdata)
96
- {
97
- $data = $this->buildString($rdata);
98
- if (count($data) == 1) {
99
-
100
- $this->psdnaddress = $data[0];
101
- return true;
102
- }
103
-
104
- return false;
105
- }
106
-
107
- /**
108
- * parses the rdata of the Net_DNS2_Packet object
109
- *
110
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet to parse the RR from
111
- *
112
- * @return boolean
113
- * @access protected
114
- *
115
- */
116
- protected function rrSet(Net_DNS2_Packet &$packet)
117
- {
118
- if ($this->rdlength > 0) {
119
-
120
- $this->psdnaddress = Net_DNS2_Packet::label($packet, $packet->offset);
121
- return true;
122
- }
123
-
124
- return false;
125
- }
126
-
127
- /**
128
- * returns the rdata portion of the DNS packet
129
- *
130
- * @param Net_DNS2_Packet &$packet a Net_DNS2_Packet packet use for
131
- * compressed names
132
- *
133
- * @return mixed either returns a binary packed
134
- * string or null on failure
135
- * @access protected
136
- *
137
- */
138
- protected function rrGet(Net_DNS2_Packet &$packet)
139
- {
140
- if (strlen($this->psdnaddress) > 0) {
141
-
142
- $data = chr(strlen($this->psdnaddress)) . $this->psdnaddress;
143
-
144
- $packet->offset += strlen($data);
145
-
146
- return $data;
147
- }
148
-
149
- return null;
150
- }
151
- }
152
-
153
- /*
154
- * Local variables:
155
- * tab-width: 4
156
- * c-basic-offset: 4
157
- * c-hanging-comment-ender-p: nil
158
- * End:
159
- */
160
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/DNS2/Updater.php DELETED
@@ -1,654 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * DNS Library for handling lookups and updates.
6
- *
7
- * PHP Version 5
8
- *
9
- * Copyright (c) 2010, Mike Pultz <mike@mikepultz.com>.
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without
13
- * modification, are permitted provided that the following conditions
14
- * are met:
15
- *
16
- * * Redistributions of source code must retain the above copyright
17
- * notice, this list of conditions and the following disclaimer.
18
- *
19
- * * Redistributions in binary form must reproduce the above copyright
20
- * notice, this list of conditions and the following disclaimer in
21
- * the documentation and/or other materials provided with the
22
- * distribution.
23
- *
24
- * * Neither the name of Mike Pultz nor the names of his contributors
25
- * may be used to endorse or promote products derived from this
26
- * software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
37
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
- * POSSIBILITY OF SUCH DAMAGE.
40
- *
41
- * @category Networking
42
- * @package Net_DNS2
43
- * @author Mike Pultz <mike@mikepultz.com>
44
- * @copyright 2010 Mike Pultz <mike@mikepultz.com>
45
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
46
- * @version SVN: $Id$
47
- * @link http://pear.php.net/package/Net_DNS2
48
- * @since File available since Release 0.6.0
49
- *
50
- */
51
-
52
- /**
53
- * The main dynamic DNS updater class.
54
- *
55
- * This class provices functions to handle all defined dynamic DNS update
56
- * requests as defined by RFC 2136.
57
- *
58
- * This is separate from the Net_DNS2_Resolver class, as while the underlying
59
- * protocol is the same, the functionality is completely different.
60
- *
61
- * Generally, query (recursive) lookups are done against caching server, while
62
- * update requests are done against authoratative servers.
63
- *
64
- * @category Networking
65
- * @package Net_DNS2
66
- * @author Mike Pultz <mike@mikepultz.com>
67
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
68
- * @link http://pear.php.net/package/Net_DNS2
69
- * @see Net_DNS2
70
- *
71
- */
72
- class Net_DNS2_Updater extends Net_DNS2
73
- {
74
- /*
75
- * a Net_DNS2_Packet_Request object used for the update request
76
- */
77
- private $_packet;
78
-
79
- /**
80
- * Constructor - builds a new Net_DNS2_Updater objected used for doing
81
- * dynamic DNS updates
82
- *
83
- * @param string $zone the domain name to use for DNS updates
84
- * @param mixed $options an array of config options or null
85
- *
86
- * @throws Net_DNS2_Exception
87
- * @access public
88
- *
89
- */
90
- public function __construct($zone, array $options = null)
91
- {
92
- parent::__construct($options);
93
-
94
- //
95
- // create the packet
96
- //
97
- $this->_packet = new Net_DNS2_Packet_Request(
98
- strtolower(trim($zone, " \n\r\t.")), 'SOA', 'IN'
99
- );
100
-
101
- //
102
- // make sure the opcode on the packet is set to UPDATE
103
- //
104
- $this->_packet->header->opcode = Net_DNS2_Lookups::OPCODE_UPDATE;
105
- }
106
-
107
- /**
108
- * checks that the given name matches the name for the zone we're updating
109
- *
110
- * @param string $name The name to be checked.
111
- *
112
- * @return boolean
113
- * @throws Net_DNS2_Exception
114
- * @access private
115
- *
116
- */
117
- private function _checkName($name)
118
- {
119
- if (!preg_match('/' . $this->_packet->question[0]->qname . '$/', $name)) {
120
-
121
- throw new Net_DNS2_Exception(
122
- 'name provided (' . $name . ') does not match zone name (' .
123
- $this->_packet->question[0]->qname . ')',
124
- Net_DNS2_Lookups::E_PACKET_INVALID
125
- );
126
- }
127
-
128
- return true;
129
- }
130
-
131
- /**
132
- * add a signature to the request for authentication
133
- *
134
- * @param string $keyname the key name to use for the TSIG RR
135
- * @param string $signature the key to sign the request.
136
- *
137
- * @return boolean
138
- * @access public
139
- * @see Net_DNS2::signTSIG()
140
- * @deprecated function deprecated in 1.1.0
141
- *
142
- */
143
- public function signature($keyname, $signature)
144
- {
145
- return $this->signTSIG($keyname, $signature);
146
- }
147
-
148
- /**
149
- * 2.5.1 - Add To An RRset
150
- *
151
- * RRs are added to the Update Section whose NAME, TYPE, TTL, RDLENGTH
152
- * and RDATA are those being added, and CLASS is the same as the zone
153
- * class. Any duplicate RRs will be silently ignored by the primary
154
- * master.
155
- *
156
- * @param Net_DNS2_RR $rr the Net_DNS2_RR object to be added to the zone
157
- *
158
- * @return boolean
159
- * @throws Net_DNS2_Exception
160
- * @access public
161
- *
162
- */
163
- public function add(Net_DNS2_RR $rr)
164
- {
165
- $this->_checkName($rr->name);
166
-
167
- //
168
- // add the RR to the "update" section
169
- //
170
- if (!in_array($rr, $this->_packet->authority)) {
171
- $this->_packet->authority[] = $rr;
172
- }
173
-
174
- return true;
175
- }
176
-
177
- /**
178
- * 2.5.4 - Delete An RR From An RRset
179
- *
180
- * RRs to be deleted are added to the Update Section. The NAME, TYPE,
181
- * RDLENGTH and RDATA must match the RR being deleted. TTL must be
182
- * specified as zero (0) and will otherwise be ignored by the primary
183
- * master. CLASS must be specified as NONE to distinguish this from an
184
- * RR addition. If no such RRs exist, then this Update RR will be
185
- * silently ignored by the primary master.
186
- *
187
- * @param Net_DNS2_RR $rr the Net_DNS2_RR object to be deleted from the zone
188
- *
189
- * @return boolean
190
- * @throws Net_DNS2_Exception
191
- * @access public
192
- *
193
- */
194
- public function delete(Net_DNS2_RR $rr)
195
- {
196
- $this->_checkName($rr->name);
197
-
198
- $rr->ttl = 0;
199
- $rr->class = 'NONE';
200
-
201
- //
202
- // add the RR to the "update" section
203
- //
204
- if (!in_array($rr, $this->_packet->authority)) {
205
- $this->_packet->authority[] = $rr;
206
- }
207
-
208
- return true;
209
- }
210
-
211
- /**
212
- * 2.5.2 - Delete An RRset
213
- *
214
- * One RR is added to the Update Section whose NAME and TYPE are those
215
- * of the RRset to be deleted. TTL must be specified as zero (0) and is
216
- * otherwise not used by the primary master. CLASS must be specified as
217
- * ANY. RDLENGTH must be zero (0) and RDATA must therefore be empty.
218
- * If no such RRset exists, then this Update RR will be silently ignored
219
- * by the primary master
220
- *
221
- * @param string $name the RR name to be removed from the zone
222
- * @param string $type the RR type to be removed from the zone
223
- *
224
- * @return boolean
225
- * @throws Net_DNS2_Exception
226
- * @access public
227
- *
228
- */
229
- public function deleteAny($name, $type)
230
- {
231
- $this->_checkName($name);
232
-
233
- $class = Net_DNS2_Lookups::$rr_types_id_to_class[
234
- Net_DNS2_Lookups::$rr_types_by_name[$type]
235
- ];
236
- if (!isset($class)) {
237
-
238
- throw new Net_DNS2_Exception(
239
- 'unknown or un-supported resource record type: ' . $type,
240
- Net_DNS2_Lookups::E_RR_INVALID
241
- );
242
- }
243
-
244
- $rr = new $class;
245
-
246
- $rr->name = $name;
247
- $rr->ttl = 0;
248
- $rr->class = 'ANY';
249
- $rr->rdlength = -1;
250
- $rr->rdata = '';
251
-
252
- //
253
- // add the RR to the "update" section
254
- //
255
- if (!in_array($rr, $this->_packet->authority)) {
256
- $this->_packet->authority[] = $rr;
257
- }
258
-
259
- return true;
260
- }
261
-
262
- /**
263
- * 2.5.3 - Delete All RRsets From A Name
264
- *
265
- * One RR is added to the Update Section whose NAME is that of the name
266
- * to be cleansed of RRsets. TYPE must be specified as ANY. TTL must
267
- * be specified as zero (0) and is otherwise not used by the primary
268
- * master. CLASS must be specified as ANY. RDLENGTH must be zero (0)
269
- * and RDATA must therefore be empty. If no such RRsets exist, then
270
- * this Update RR will be silently ignored by the primary master.
271
- *
272
- * @param string $name the RR name to be removed from the zone
273
- *
274
- * @return boolean
275
- * @throws Net_DNS2_Exception
276
- * @access public
277
- *
278
- */
279
- public function deleteAll($name)
280
- {
281
- $this->_checkName($name);
282
-
283
- //
284
- // the Net_DNS2_RR_ANY class is just an empty stub class used for these
285
- // cases only
286
- //
287
- $rr = new Net_DNS2_RR_ANY;
288
-
289
- $rr->name = $name;
290
- $rr->ttl = 0;
291
- $rr->type = 'ANY';
292
- $rr->class = 'ANY';
293
- $rr->rdlength = -1;
294
- $rr->rdata = '';
295
-
296
- //
297
- // add the RR to the "update" section
298
- //
299
- if (!in_array($rr, $this->_packet->authority)) {
300
- $this->_packet->authority[] = $rr;
301
- }
302
-
303
- return true;
304
- }
305
-
306
- /**
307
- * 2.4.1 - RRset Exists (Value Independent)
308
- *
309
- * At least one RR with a specified NAME and TYPE (in the zone and class
310
- * specified in the Zone Section) must exist.
311
- *
312
- * For this prerequisite, a requestor adds to the section a single RR
313
- * whose NAME and TYPE are equal to that of the zone RRset whose
314
- * existence is required. RDLENGTH is zero and RDATA is therefore
315
- * empty. CLASS must be specified as ANY to differentiate this
316
- * condition from that of an actual RR whose RDLENGTH is naturally zero
317
- * (0) (e.g., NULL). TTL is specified as zero (0).
318
- *
319
- * @param string $name the RR name for the prerequisite
320
- * @param string $type the RR type for the prerequisite
321
- *
322
- * @return boolean
323
- * @throws Net_DNS2_Exception
324
- * @access public
325
- *
326
- */
327
- public function checkExists($name, $type)
328
- {
329
- $this->_checkName($name);
330
-
331
- $class = Net_DNS2_Lookups::$rr_types_id_to_class[
332
- Net_DNS2_Lookups::$rr_types_by_name[$type]
333
- ];
334
- if (!isset($class)) {
335
-
336
- throw new Net_DNS2_Exception(
337
- 'unknown or un-supported resource record type: ' . $type,
338
- Net_DNS2_Lookups::E_RR_INVALID
339
- );
340
- }
341
-
342
- $rr = new $class;
343
-
344
- $rr->name = $name;
345
- $rr->ttl = 0;
346
- $rr->class = 'ANY';
347
- $rr->rdlength = -1;
348
- $rr->rdata = '';
349
-
350
- //
351
- // add the RR to the "prerequisite" section
352
- //
353
- if (!in_array($rr, $this->_packet->answer)) {
354
- $this->_packet->answer[] = $rr;
355
- }
356
-
357
- return true;
358
- }
359
-
360
- /**
361
- * 2.4.2 - RRset Exists (Value Dependent)
362
- *
363
- * A set of RRs with a specified NAME and TYPE exists and has the same
364
- * members with the same RDATAs as the RRset specified here in this
365
- * section. While RRset ordering is undefined and therefore not
366
- * significant to this comparison, the sets be identical in their
367
- * extent.
368
- *
369
- * For this prerequisite, a requestor adds to the section an entire
370
- * RRset whose preexistence is required. NAME and TYPE are that of the
371
- * RRset being denoted. CLASS is that of the zone. TTL must be
372
- * specified as zero (0) and is ignored when comparing RRsets for
373
- * identity.
374
- *
375
- * @param Net_DNS2_RR $rr the RR object to be used as a prerequisite
376
- *
377
- * @return boolean
378
- * @throws Net_DNS2_Exception
379
- * @access public
380
- *
381
- */
382
- public function checkValueExists(Net_DNS2_RR $rr)
383
- {
384
- $this->_checkName($rr->name);
385
-
386
- $rr->ttl = 0;
387
-
388
- //
389
- // add the RR to the "prerequisite" section
390
- //
391
- if (!in_array($rr, $this->_packet->answer)) {
392
- $this->_packet->answer[] = $rr;
393
- }
394
-
395
- return true;
396
- }
397
-
398
- /**
399
- * 2.4.3 - RRset Does Not Exist
400
- *
401
- * No RRs with a specified NAME and TYPE (in the zone and class denoted
402
- * by the Zone Section) can exist.
403
- *
404
- * For this prerequisite, a requestor adds to the section a single RR
405
- * whose NAME and TYPE are equal to that of the RRset whose nonexistence
406
- * is required. The RDLENGTH of this record is zero (0), and RDATA
407
- * field is therefore empty. CLASS must be specified as NONE in order
408
- * to distinguish this condition from a valid RR whose RDLENGTH is
409
- * naturally zero (0) (for example, the NULL RR). TTL must be specified
410
- * as zero (0).
411
- *
412
- * @param string $name the RR name for the prerequisite
413
- * @param string $type the RR type for the prerequisite
414
- *
415
- * @return boolean
416
- * @throws Net_DNS2_Exception
417
- * @access public
418
- *
419
- */
420
- public function checkNotExists($name, $type)
421
- {
422
- $this->_checkName($name);
423
-
424
- $class = Net_DNS2_Lookups::$rr_types_id_to_class[
425
- Net_DNS2_Lookups::$rr_types_by_name[$type]
426
- ];
427
- if (!isset($class)) {
428
-
429
- throw new Net_DNS2_Exception(
430
- 'unknown or un-supported resource record type: ' . $type,
431
- Net_DNS2_Lookups::E_RR_INVALID
432
- );
433
- }
434
-
435
- $rr = new $class;
436
-
437
- $rr->name = $name;
438
- $rr->ttl = 0;
439
- $rr->class = 'NONE';
440
- $rr->rdlength = -1;
441
- $rr->rdata = '';
442
-
443
- //
444
- // add the RR to the "prerequisite" section
445
- //
446
- if (!in_array($rr, $this->_packet->answer)) {
447
- $this->_packet->answer[] = $rr;
448
- }
449
-
450
- return true;
451
- }
452
-
453
- /**
454
- * 2.4.4 - Name Is In Use
455
- *
456
- * Name is in use. At least one RR with a specified NAME (in the zone
457
- * and class specified by the Zone Section) must exist. Note that this
458
- * prerequisite is NOT satisfied by empty nonterminals.
459
- *
460
- * For this prerequisite, a requestor adds to the section a single RR
461
- * whose NAME is equal to that of the name whose ownership of an RR is
462
- * required. RDLENGTH is zero and RDATA is therefore empty. CLASS must
463
- * be specified as ANY to differentiate this condition from that of an
464
- * actual RR whose RDLENGTH is naturally zero (0) (e.g., NULL). TYPE
465
- * must be specified as ANY to differentiate this case from that of an
466
- * RRset existence test. TTL is specified as zero (0).
467
- *
468
- * @param string $name the RR name for the prerequisite
469
- *
470
- * @return boolean
471
- * @throws Net_DNS2_Exception
472
- * @access public
473
- *
474
- */
475
- public function checkNameInUse($name)
476
- {
477
- $this->_checkName($name);
478
-
479
- //
480
- // the Net_DNS2_RR_ANY class is just an empty stub class used for these
481
- // cases only
482
- //
483
- $rr = new Net_DNS2_RR_ANY;
484
-
485
- $rr->name = $name;
486
- $rr->ttl = 0;
487
- $rr->type = 'ANY';
488
- $rr->class = 'ANY';
489
- $rr->rdlength = -1;
490
- $rr->rdata = '';
491
-
492
- //
493
- // add the RR to the "prerequisite" section
494
- //
495
- if (!in_array($rr, $this->_packet->answer)) {
496
- $this->_packet->answer[] = $rr;
497
- }
498
-
499
- return true;
500
- }
501
-
502
- /**
503
- * 2.4.5 - Name Is Not In Use
504
- *
505
- * Name is not in use. No RR of any type is owned by a specified NAME.
506
- * Note that this prerequisite IS satisfied by empty nonterminals.
507
- *
508
- * For this prerequisite, a requestor adds to the section a single RR
509
- * whose NAME is equal to that of the name whose nonownership of any RRs
510
- * is required. RDLENGTH is zero and RDATA is therefore empty. CLASS
511
- * must be specified as NONE. TYPE must be specified as ANY. TTL must
512
- * be specified as zero (0).
513
- *
514
- * @param string $name the RR name for the prerequisite
515
- *
516
- * @return boolean
517
- * @throws Net_DNS2_Exception
518
- * @access public
519
- *
520
- */
521
- public function checkNameNotInUse($name)
522
- {
523
- $this->_checkName($name);
524
-
525
- //
526
- // the Net_DNS2_RR_ANY class is just an empty stub class used for these
527
- // cases only
528
- //
529
- $rr = new Net_DNS2_RR_ANY;
530
-
531
- $rr->name = $name;
532
- $rr->ttl = 0;
533
- $rr->type = 'ANY';
534
- $rr->class = 'NONE';
535
- $rr->rdlength = -1;
536
- $rr->rdata = '';
537
-
538
- //
539
- // add the RR to the "prerequisite" section
540
- //
541
- if (!in_array($rr, $this->_packet->answer)) {
542
- $this->_packet->answer[] = $rr;
543
- }
544
-
545
- return true;
546
- }
547
-
548
- /**
549
- * returns the current internal packet object.
550
- *
551
- * @return Net_DNS2_Packet_Request
552
- * @access public
553
- #
554
- */
555
- public function packet()
556
- {
557
- //
558
- // take a copy
559
- //
560
- $p = $this->_packet;
561
-
562
- //
563
- // check for an authentication method; either TSIG or SIG
564
- //
565
- if ( ($this->auth_signature instanceof Net_DNS2_RR_TSIG)
566
- || ($this->auth_signature instanceof Net_DNS2_RR_SIG)
567
- ) {
568
- $p->additional[] = $this->auth_signature;
569
- }
570
-
571
- //
572
- // update the counts
573
- //
574
- $p->header->qdcount = count($p->question);
575
- $p->header->ancount = count($p->answer);
576
- $p->header->nscount = count($p->authority);
577
- $p->header->arcount = count($p->additional);
578
-
579
- return $p;
580
- }
581
-
582
- /**
583
- * executes the update request with the object informaton
584
- *
585
- * @param Net_DNS2_Packet_Response &$response ref to the response object
586
- *
587
- * @return boolean
588
- * @throws Net_DNS2_Exception
589
- * @access public
590
- *
591
- */
592
- public function update(&$response = null)
593
- {
594
- //
595
- // make sure we have some name servers set
596
- //
597
- $this->checkServers(Net_DNS2::RESOLV_CONF);
598
-
599
- //
600
- // check for an authentication method; either TSIG or SIG
601
- //
602
- if ( ($this->auth_signature instanceof Net_DNS2_RR_TSIG)
603
- || ($this->auth_signature instanceof Net_DNS2_RR_SIG)
604
- ) {
605
- $this->_packet->additional[] = $this->auth_signature;
606
- }
607
-
608
- //
609
- // update the counts
610
- //
611
- $this->_packet->header->qdcount = count($this->_packet->question);
612
- $this->_packet->header->ancount = count($this->_packet->answer);
613
- $this->_packet->header->nscount = count($this->_packet->authority);
614
- $this->_packet->header->arcount = count($this->_packet->additional);
615
-
616
- //
617
- // make sure we have some data to send
618
- //
619
- if ( ($this->_packet->header->qdcount == 0)
620
- || ($this->_packet->header->nscount == 0)
621
- ) {
622
- throw new Net_DNS2_Exception(
623
- 'empty headers- nothing to send!',
624
- Net_DNS2_Lookups::E_PACKET_INVALID
625
- );
626
- }
627
-
628
- //
629
- // send the packet and get back the response
630
- //
631
- $response = $this->sendPacket($this->_packet, $this->use_tcp);
632
-
633
- //
634
- // clear the internal packet so if we make another request, we don't have
635
- // old data being sent.
636
- //
637
- $this->_packet->reset();
638
-
639
- //
640
- // for updates, we just need to know it worked- we don't actualy need to
641
- // return the response object
642
- //
643
- return true;
644
- }
645
- }
646
-
647
- /*
648
- * Local variables:
649
- * tab-width: 4
650
- * c-basic-offset: 4
651
- * c-hanging-comment-ender-p: nil
652
- * End:
653
- */
654
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Net/IPv4.php CHANGED
File without changes
includes/random_compat/LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Paragon Initiative Enterprises
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
includes/random_compat/byte_safe_strings.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!is_callable('RandomCompat_strlen')) {
30
+ if (
31
+ defined('MB_OVERLOAD_STRING')
32
+ &&
33
+ ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING
34
+ ) {
35
+ /**
36
+ * strlen() implementation that isn't brittle to mbstring.func_overload
37
+ *
38
+ * This version uses mb_strlen() in '8bit' mode to treat strings as raw
39
+ * binary rather than UTF-8, ISO-8859-1, etc
40
+ *
41
+ * @param string $binary_string
42
+ *
43
+ * @throws TypeError
44
+ *
45
+ * @return int
46
+ */
47
+ function RandomCompat_strlen($binary_string)
48
+ {
49
+ if (!is_string($binary_string)) {
50
+ throw new TypeError(
51
+ 'RandomCompat_strlen() expects a string'
52
+ );
53
+ }
54
+
55
+ return (int) mb_strlen($binary_string, '8bit');
56
+ }
57
+
58
+ } else {
59
+ /**
60
+ * strlen() implementation that isn't brittle to mbstring.func_overload
61
+ *
62
+ * This version just used the default strlen()
63
+ *
64
+ * @param string $binary_string
65
+ *
66
+ * @throws TypeError
67
+ *
68
+ * @return int
69
+ */
70
+ function RandomCompat_strlen($binary_string)
71
+ {
72
+ if (!is_string($binary_string)) {
73
+ throw new TypeError(
74
+ 'RandomCompat_strlen() expects a string'
75
+ );
76
+ }
77
+ return (int) strlen($binary_string);
78
+ }
79
+ }
80
+ }
81
+
82
+ if (!is_callable('RandomCompat_substr')) {
83
+
84
+ if (
85
+ defined('MB_OVERLOAD_STRING')
86
+ &&
87
+ ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING
88
+ ) {
89
+ /**
90
+ * substr() implementation that isn't brittle to mbstring.func_overload
91
+ *
92
+ * This version uses mb_substr() in '8bit' mode to treat strings as raw
93
+ * binary rather than UTF-8, ISO-8859-1, etc
94
+ *
95
+ * @param string $binary_string
96
+ * @param int $start
97
+ * @param int|null $length (optional)
98
+ *
99
+ * @throws TypeError
100
+ *
101
+ * @return string
102
+ */
103
+ function RandomCompat_substr($binary_string, $start, $length = null)
104
+ {
105
+ if (!is_string($binary_string)) {
106
+ throw new TypeError(
107
+ 'RandomCompat_substr(): First argument should be a string'
108
+ );
109
+ }
110
+
111
+ if (!is_int($start)) {
112
+ throw new TypeError(
113
+ 'RandomCompat_substr(): Second argument should be an integer'
114
+ );
115
+ }
116
+
117
+ if ($length === null) {
118
+ /**
119
+ * mb_substr($str, 0, NULL, '8bit') returns an empty string on
120
+ * PHP 5.3, so we have to find the length ourselves.
121
+ */
122
+ /** @var int $length */
123
+ $length = RandomCompat_strlen($binary_string) - $start;
124
+ } elseif (!is_int($length)) {
125
+ throw new TypeError(
126
+ 'RandomCompat_substr(): Third argument should be an integer, or omitted'
127
+ );
128
+ }
129
+
130
+ // Consistency with PHP's behavior
131
+ if ($start === RandomCompat_strlen($binary_string) && $length === 0) {
132
+ return '';
133
+ }
134
+ if ($start > RandomCompat_strlen($binary_string)) {
135
+ return '';
136
+ }
137
+
138
+ return (string) mb_substr(
139
+ (string) $binary_string,
140
+ (int) $start,
141
+ (int) $length,
142
+ '8bit'
143
+ );
144
+ }
145
+
146
+ } else {
147
+
148
+ /**
149
+ * substr() implementation that isn't brittle to mbstring.func_overload
150
+ *
151
+ * This version just uses the default substr()
152
+ *
153
+ * @param string $binary_string
154
+ * @param int $start
155
+ * @param int|null $length (optional)
156
+ *
157
+ * @throws TypeError
158
+ *
159
+ * @return string
160
+ */
161
+ function RandomCompat_substr($binary_string, $start, $length = null)
162
+ {
163
+ if (!is_string($binary_string)) {
164
+ throw new TypeError(
165
+ 'RandomCompat_substr(): First argument should be a string'
166
+ );
167
+ }
168
+
169
+ if (!is_int($start)) {
170
+ throw new TypeError(
171
+ 'RandomCompat_substr(): Second argument should be an integer'
172
+ );
173
+ }
174
+
175
+ if ($length !== null) {
176
+ if (!is_int($length)) {
177
+ throw new TypeError(
178
+ 'RandomCompat_substr(): Third argument should be an integer, or omitted'
179
+ );
180
+ }
181
+
182
+ return (string) substr(
183
+ (string )$binary_string,
184
+ (int) $start,
185
+ (int) $length
186
+ );
187
+ }
188
+
189
+ return (string) substr(
190
+ (string) $binary_string,
191
+ (int) $start
192
+ );
193
+ }
194
+ }
195
+ }
includes/random_compat/cast_to_int.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!is_callable('RandomCompat_intval')) {
30
+
31
+ /**
32
+ * Cast to an integer if we can, safely.
33
+ *
34
+ * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
35
+ * (non-inclusive), it will sanely cast it to an int. If you it's equal to
36
+ * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
37
+ * lose precision, so the <= and => operators might accidentally let a float
38
+ * through.
39
+ *
40
+ * @param int|float $number The number we want to convert to an int
41
+ * @param bool $fail_open Set to true to not throw an exception
42
+ *
43
+ * @return float|int
44
+ * @psalm-suppress InvalidReturnType
45
+ *
46
+ * @throws TypeError
47
+ */
48
+ function RandomCompat_intval($number, $fail_open = false)
49
+ {
50
+ if (is_int($number) || is_float($number)) {
51
+ $number += 0;
52
+ } elseif (is_numeric($number)) {
53
+ /** @psalm-suppress InvalidOperand */
54
+ $number += 0;
55
+ }
56
+ /** @var int|float $number */
57
+
58
+ if (
59
+ is_float($number)
60
+ &&
61
+ $number > ~PHP_INT_MAX
62
+ &&
63
+ $number < PHP_INT_MAX
64
+ ) {
65
+ $number = (int) $number;
66
+ }
67
+
68
+ if (is_int($number)) {
69
+ return (int) $number;
70
+ } elseif (!$fail_open) {
71
+ throw new TypeError(
72
+ 'Expected an integer.'
73
+ );
74
+ }
75
+ return $number;
76
+ }
77
+ }
includes/random_compat/error_polyfill.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!class_exists('Error', false)) {
30
+ // We can't really avoid making this extend Exception in PHP 5.
31
+ class Error extends Exception
32
+ {
33
+
34
+ }
35
+ }
36
+
37
+ if (!class_exists('TypeError', false)) {
38
+ if (is_subclass_of('Error', 'Exception')) {
39
+ class TypeError extends Error
40
+ {
41
+
42
+ }
43
+ } else {
44
+ class TypeError extends Exception
45
+ {
46
+
47
+ }
48
+ }
49
+ }
includes/random_compat/random.php ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * @version 2.0.17
7
+ * @released 2018-07-04
8
+ *
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in
21
+ * all copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ if (!defined('PHP_VERSION_ID')) {
33
+ // This constant was introduced in PHP 5.2.7
34
+ $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION));
35
+ define(
36
+ 'PHP_VERSION_ID',
37
+ $RandomCompatversion[0] * 10000
38
+ + $RandomCompatversion[1] * 100
39
+ + $RandomCompatversion[2]
40
+ );
41
+ $RandomCompatversion = null;
42
+ }
43
+
44
+ /**
45
+ * PHP 7.0.0 and newer have these functions natively.
46
+ */
47
+ if (PHP_VERSION_ID >= 70000) {
48
+ return;
49
+ }
50
+
51
+ if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
52
+ define('RANDOM_COMPAT_READ_BUFFER', 8);
53
+ }
54
+
55
+ $RandomCompatDIR = dirname(__FILE__);
56
+
57
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'byte_safe_strings.php';
58
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'cast_to_int.php';
59
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'error_polyfill.php';
60
+
61
+ if (!is_callable('random_bytes')) {
62
+ /**
63
+ * PHP 5.2.0 - 5.6.x way to implement random_bytes()
64
+ *
65
+ * We use conditional statements here to define the function in accordance
66
+ * to the operating environment. It's a micro-optimization.
67
+ *
68
+ * In order of preference:
69
+ * 1. Use libsodium if available.
70
+ * 2. fread() /dev/urandom if available (never on Windows)
71
+ * 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)
72
+ * 4. COM('CAPICOM.Utilities.1')->GetRandom()
73
+ *
74
+ * See RATIONALE.md for our reasoning behind this particular order
75
+ */
76
+ if (extension_loaded('libsodium')) {
77
+ // See random_bytes_libsodium.php
78
+ if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) {
79
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php';
80
+ } elseif (method_exists('Sodium', 'randombytes_buf')) {
81
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php';
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Reading directly from /dev/urandom:
87
+ */
88
+ if (DIRECTORY_SEPARATOR === '/') {
89
+ // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast
90
+ // way to exclude Windows.
91
+ $RandomCompatUrandom = true;
92
+ $RandomCompat_basedir = ini_get('open_basedir');
93
+
94
+ if (!empty($RandomCompat_basedir)) {
95
+ $RandomCompat_open_basedir = explode(
96
+ PATH_SEPARATOR,
97
+ strtolower($RandomCompat_basedir)
98
+ );
99
+ $RandomCompatUrandom = (array() !== array_intersect(
100
+ array('/dev', '/dev/', '/dev/urandom'),
101
+ $RandomCompat_open_basedir
102
+ ));
103
+ $RandomCompat_open_basedir = null;
104
+ }
105
+
106
+ if (
107
+ !is_callable('random_bytes')
108
+ &&
109
+ $RandomCompatUrandom
110
+ &&
111
+ @is_readable('/dev/urandom')
112
+ ) {
113
+ // Error suppression on is_readable() in case of an open_basedir
114
+ // or safe_mode failure. All we care about is whether or not we
115
+ // can read it at this point. If the PHP environment is going to
116
+ // panic over trying to see if the file can be read in the first
117
+ // place, that is not helpful to us here.
118
+
119
+ // See random_bytes_dev_urandom.php
120
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_dev_urandom.php';
121
+ }
122
+ // Unset variables after use
123
+ $RandomCompat_basedir = null;
124
+ } else {
125
+ $RandomCompatUrandom = false;
126
+ }
127
+
128
+ /**
129
+ * mcrypt_create_iv()
130
+ *
131
+ * We only want to use mcypt_create_iv() if:
132
+ *
133
+ * - random_bytes() hasn't already been defined
134
+ * - the mcrypt extensions is loaded
135
+ * - One of these two conditions is true:
136
+ * - We're on Windows (DIRECTORY_SEPARATOR !== '/')
137
+ * - We're not on Windows and /dev/urandom is readabale
138
+ * (i.e. we're not in a chroot jail)
139
+ * - Special case:
140
+ * - If we're not on Windows, but the PHP version is between
141
+ * 5.6.10 and 5.6.12, we don't want to use mcrypt. It will
142
+ * hang indefinitely. This is bad.
143
+ * - If we're on Windows, we want to use PHP >= 5.3.7 or else
144
+ * we get insufficient entropy errors.
145
+ */
146
+ if (
147
+ !is_callable('random_bytes')
148
+ &&
149
+ // Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be.
150
+ (DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307)
151
+ &&
152
+ // Prevent this code from hanging indefinitely on non-Windows;
153
+ // see https://bugs.php.net/bug.php?id=69833
154
+ (
155
+ DIRECTORY_SEPARATOR !== '/' ||
156
+ (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613)
157
+ )
158
+ &&
159
+ extension_loaded('mcrypt')
160
+ ) {
161
+ // See random_bytes_mcrypt.php
162
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_mcrypt.php';
163
+ }
164
+ $RandomCompatUrandom = null;
165
+
166
+ /**
167
+ * This is a Windows-specific fallback, for when the mcrypt extension
168
+ * isn't loaded.
169
+ */
170
+ if (
171
+ !is_callable('random_bytes')
172
+ &&
173
+ extension_loaded('com_dotnet')
174
+ &&
175
+ class_exists('COM')
176
+ ) {
177
+ $RandomCompat_disabled_classes = preg_split(
178
+ '#\s*,\s*#',
179
+ strtolower(ini_get('disable_classes'))
180
+ );
181
+
182
+ if (!in_array('com', $RandomCompat_disabled_classes)) {
183
+ try {
184
+ $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
185
+ if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
186
+ // See random_bytes_com_dotnet.php
187
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php';
188
+ }
189
+ } catch (com_exception $e) {
190
+ // Don't try to use it.
191
+ }
192
+ }
193
+ $RandomCompat_disabled_classes = null;
194
+ $RandomCompatCOMtest = null;
195
+ }
196
+
197
+ /**
198
+ * throw new Exception
199
+ */
200
+ if (!is_callable('random_bytes')) {
201
+ /**
202
+ * We don't have any more options, so let's throw an exception right now
203
+ * and hope the developer won't let it fail silently.
204
+ *
205
+ * @param mixed $length
206
+ * @psalm-suppress InvalidReturnType
207
+ * @throws Exception
208
+ * @return string
209
+ */
210
+ function random_bytes($length)
211
+ {
212
+ unset($length); // Suppress "variable not used" warnings.
213
+ throw new Exception(
214
+ 'There is no suitable CSPRNG installed on your system'
215
+ );
216
+ return '';
217
+ }
218
+ }
219
+ }
220
+
221
+ if (!is_callable('random_int')) {
222
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_int.php';
223
+ }
224
+
225
+ $RandomCompatDIR = null;
includes/random_compat/random_bytes_com_dotnet.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!is_callable('random_bytes')) {
30
+ /**
31
+ * Windows with PHP < 5.3.0 will not have the function
32
+ * openssl_random_pseudo_bytes() available, so let's use
33
+ * CAPICOM to work around this deficiency.
34
+ *
35
+ * @param int $bytes
36
+ *
37
+ * @throws Exception
38
+ *
39
+ * @return string
40
+ */
41
+ function random_bytes($bytes)
42
+ {
43
+ try {
44
+ /** @var int $bytes */
45
+ $bytes = RandomCompat_intval($bytes);
46
+ } catch (TypeError $ex) {
47
+ throw new TypeError(
48
+ 'random_bytes(): $bytes must be an integer'
49
+ );
50
+ }
51
+
52
+ if ($bytes < 1) {
53
+ throw new Error(
54
+ 'Length must be greater than 0'
55
+ );
56
+ }
57
+
58
+ /** @var string $buf */
59
+ $buf = '';
60
+ if (!class_exists('COM')) {
61
+ throw new Error(
62
+ 'COM does not exist'
63
+ );
64
+ }
65
+ /** @var COM $util */
66
+ $util = new COM('CAPICOM.Utilities.1');
67
+ $execCount = 0;
68
+
69
+ /**
70
+ * Let's not let it loop forever. If we run N times and fail to
71
+ * get N bytes of random data, then CAPICOM has failed us.
72
+ */
73
+ do {
74
+ $buf .= base64_decode((string) $util->GetRandom($bytes, 0));
75
+ if (RandomCompat_strlen($buf) >= $bytes) {
76
+ /**
77
+ * Return our random entropy buffer here:
78
+ */
79
+ return (string) RandomCompat_substr($buf, 0, $bytes);
80
+ }
81
+ ++$execCount;
82
+ } while ($execCount < $bytes);
83
+
84
+ /**
85
+ * If we reach here, PHP has failed us.
86
+ */
87
+ throw new Exception(
88
+ 'Could not gather sufficient random data'
89
+ );
90
+ }
91
+ }
includes/random_compat/random_bytes_dev_urandom.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
30
+ define('RANDOM_COMPAT_READ_BUFFER', 8);
31
+ }
32
+
33
+ if (!is_callable('random_bytes')) {
34
+ /**
35
+ * Unless open_basedir is enabled, use /dev/urandom for
36
+ * random numbers in accordance with best practices
37
+ *
38
+ * Why we use /dev/urandom and not /dev/random
39
+ * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers
40
+ *
41
+ * @param int $bytes
42
+ *
43
+ * @throws Exception
44
+ *
45
+ * @return string
46
+ */
47
+ function random_bytes($bytes)
48
+ {
49
+ /** @var resource $fp */
50
+ static $fp = null;
51
+
52
+ /**
53
+ * This block should only be run once
54
+ */
55
+ if (empty($fp)) {
56
+ /**
57
+ * We use /dev/urandom if it is a char device.
58
+ * We never fall back to /dev/random
59
+ */
60
+ /** @var resource|bool $fp */
61
+ $fp = fopen('/dev/urandom', 'rb');
62
+ if (is_resource($fp)) {
63
+ /** @var array<string, int> $st */
64
+ $st = fstat($fp);
65
+ if (($st['mode'] & 0170000) !== 020000) {
66
+ fclose($fp);
67
+ $fp = false;
68
+ }
69
+ }
70
+
71
+ if (is_resource($fp)) {
72
+ /**
73
+ * stream_set_read_buffer() does not exist in HHVM
74
+ *
75
+ * If we don't set the stream's read buffer to 0, PHP will
76
+ * internally buffer 8192 bytes, which can waste entropy
77
+ *
78
+ * stream_set_read_buffer returns 0 on success
79
+ */
80
+ if (is_callable('stream_set_read_buffer')) {
81
+ stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
82
+ }
83
+ if (is_callable('stream_set_chunk_size')) {
84
+ stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER);
85
+ }
86
+ }
87
+ }
88
+
89
+ try {
90
+ /** @var int $bytes */
91
+ $bytes = RandomCompat_intval($bytes);
92
+ } catch (TypeError $ex) {
93
+ throw new TypeError(
94
+ 'random_bytes(): $bytes must be an integer'
95
+ );
96
+ }
97
+
98
+ if ($bytes < 1) {
99
+ throw new Error(
100
+ 'Length must be greater than 0'
101
+ );
102
+ }
103
+
104
+ /**
105
+ * This if() block only runs if we managed to open a file handle
106
+ *
107
+ * It does not belong in an else {} block, because the above
108
+ * if (empty($fp)) line is logic that should only be run once per
109
+ * page load.
110
+ */
111
+ if (is_resource($fp)) {
112
+ /**
113
+ * @var int
114
+ */
115
+ $remaining = $bytes;
116
+
117
+ /**
118
+ * @var string|bool
119
+ */
120
+ $buf = '';
121
+
122
+ /**
123
+ * We use fread() in a loop to protect against partial reads
124
+ */
125
+ do {
126
+ /**
127
+ * @var string|bool
128
+ */
129
+ $read = fread($fp, $remaining);
130
+ if (!is_string($read)) {
131
+ if ($read === false) {
132
+ /**
133
+ * We cannot safely read from the file. Exit the
134
+ * do-while loop and trigger the exception condition
135
+ *
136
+ * @var string|bool
137
+ */
138
+ $buf = false;
139
+ break;
140
+ }
141
+ }
142
+ /**
143
+ * Decrease the number of bytes returned from remaining
144
+ */
145
+ $remaining -= RandomCompat_strlen($read);
146
+ /**
147
+ * @var string|bool
148
+ */
149
+ $buf = $buf . $read;
150
+ } while ($remaining > 0);
151
+
152
+ /**
153
+ * Is our result valid?
154
+ */
155
+ if (is_string($buf)) {
156
+ if (RandomCompat_strlen($buf) === $bytes) {
157
+ /**
158
+ * Return our random entropy buffer here:
159
+ */
160
+ return $buf;
161
+ }
162
+ }
163
+ }
164
+
165
+ /**
166
+ * If we reach here, PHP has failed us.
167
+ */
168
+ throw new Exception(
169
+ 'Error reading from source device'
170
+ );
171
+ }
172
+ }
includes/random_compat/random_bytes_libsodium.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!is_callable('random_bytes')) {
30
+ /**
31
+ * If the libsodium PHP extension is loaded, we'll use it above any other
32
+ * solution.
33
+ *
34
+ * libsodium-php project:
35
+ * @ref https://github.com/jedisct1/libsodium-php
36
+ *
37
+ * @param int $bytes
38
+ *
39
+ * @throws Exception
40
+ *
41
+ * @return string
42
+ */
43
+ function random_bytes($bytes)
44
+ {
45
+ try {
46
+ /** @var int $bytes */
47
+ $bytes = RandomCompat_intval($bytes);
48
+ } catch (TypeError $ex) {
49
+ throw new TypeError(
50
+ 'random_bytes(): $bytes must be an integer'
51
+ );
52
+ }
53
+
54
+ if ($bytes < 1) {
55
+ throw new Error(
56
+ 'Length must be greater than 0'
57
+ );
58
+ }
59
+
60
+ /**
61
+ * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
62
+ * generated in one invocation.
63
+ */
64
+ /** @var string|bool $buf */
65
+ if ($bytes > 2147483647) {
66
+ $buf = '';
67
+ for ($i = 0; $i < $bytes; $i += 1073741824) {
68
+ $n = ($bytes - $i) > 1073741824
69
+ ? 1073741824
70
+ : $bytes - $i;
71
+ $buf .= \Sodium\randombytes_buf($n);
72
+ }
73
+ } else {
74
+ /** @var string|bool $buf */
75
+ $buf = \Sodium\randombytes_buf($bytes);
76
+ }
77
+
78
+ if (is_string($buf)) {
79
+ if (RandomCompat_strlen($buf) === $bytes) {
80
+ return $buf;
81
+ }
82
+ }
83
+
84
+ /**
85
+ * If we reach here, PHP has failed us.
86
+ */
87
+ throw new Exception(
88
+ 'Could not gather sufficient random data'
89
+ );
90
+ }
91
+ }
includes/random_compat/random_bytes_libsodium_legacy.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!is_callable('random_bytes')) {
30
+ /**
31
+ * If the libsodium PHP extension is loaded, we'll use it above any other
32
+ * solution.
33
+ *
34
+ * libsodium-php project:
35
+ * @ref https://github.com/jedisct1/libsodium-php
36
+ *
37
+ * @param int $bytes
38
+ *
39
+ * @throws Exception
40
+ *
41
+ * @return string
42
+ */
43
+ function random_bytes($bytes)
44
+ {
45
+ try {
46
+ /** @var int $bytes */
47
+ $bytes = RandomCompat_intval($bytes);
48
+ } catch (TypeError $ex) {
49
+ throw new TypeError(
50
+ 'random_bytes(): $bytes must be an integer'
51
+ );
52
+ }
53
+
54
+ if ($bytes < 1) {
55
+ throw new Error(
56
+ 'Length must be greater than 0'
57
+ );
58
+ }
59
+
60
+ /**
61
+ * @var string
62
+ */
63
+ $buf = '';
64
+
65
+ /**
66
+ * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
67
+ * generated in one invocation.
68
+ */
69
+ if ($bytes > 2147483647) {
70
+ for ($i = 0; $i < $bytes; $i += 1073741824) {
71
+ $n = ($bytes - $i) > 1073741824
72
+ ? 1073741824
73
+ : $bytes - $i;
74
+ $buf .= Sodium::randombytes_buf((int) $n);
75
+ }
76
+ } else {
77
+ $buf .= Sodium::randombytes_buf((int) $bytes);
78
+ }
79
+
80
+ if (is_string($buf)) {
81
+ if (RandomCompat_strlen($buf) === $bytes) {
82
+ return $buf;
83
+ }
84
+ }
85
+
86
+ /**
87
+ * If we reach here, PHP has failed us.
88
+ */
89
+ throw new Exception(
90
+ 'Could not gather sufficient random data'
91
+ );
92
+ }
93
+ }
includes/random_compat/random_bytes_mcrypt.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Random_* Compatibility Library
4
+ * for using the new PHP 7 random_* API in PHP 5 projects
5
+ *
6
+ * The MIT License (MIT)
7
+ *
8
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ * SOFTWARE.
27
+ */
28
+
29
+ if (!is_callable('random_bytes')) {
30
+ /**
31
+ * Powered by ext/mcrypt (and thankfully NOT libmcrypt)
32
+ *
33
+ * @ref https://bugs.php.net/bug.php?id=55169
34
+ * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386
35
+ *
36
+ * @param int $bytes
37
+ *
38
+ * @throws Exception
39
+ *
40
+ * @return string
41
+ */
42
+ function random_bytes($bytes)
43
+ {
44
+ try {
45
+ /** @var int $bytes */
46
+ $bytes = RandomCompat_intval($bytes);
47
+ } catch (TypeError $ex) {
48
+ throw new TypeError(
49
+ 'random_bytes(): $bytes must be an integer'
50
+ );
51
+ }
52
+
53
+ if ($bytes < 1) {
54
+ throw new Error(
55
+ 'Length must be greater than 0'
56
+ );
57
+ }
58
+
59
+ /** @var string|bool $buf */
60
+ $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM);
61
+ if (
62
+ is_string($buf)
63
+ &&
64
+ RandomCompat_strlen($buf) === $bytes
65
+ ) {
66
+ /**
67
+ * Return our random entropy buffer here:
68
+ */
69
+ return $buf;
70
+ }
71
+
72
+ /**
73
+ * If we reach here, PHP has failed us.
74
+ */
75
+ throw new Exception(
76
+ 'Could not gather sufficient random data'
77
+ );
78
+ }
79
+ }
includes/random_compat/random_int.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!is_callable('random_int')) {
4
+ /**
5
+ * Random_* Compatibility Library
6
+ * for using the new PHP 7 random_* API in PHP 5 projects
7
+ *
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in
20
+ * all copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * Fetch a random integer between $min and $max inclusive
33
+ *
34
+ * @param int $min
35
+ * @param int $max
36
+ *
37
+ * @throws Exception
38
+ *
39
+ * @return int
40
+ */
41
+ function random_int($min, $max)
42
+ {
43
+ /**
44
+ * Type and input logic checks
45
+ *
46
+ * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
47
+ * (non-inclusive), it will sanely cast it to an int. If you it's equal to
48
+ * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
49
+ * lose precision, so the <= and => operators might accidentally let a float
50
+ * through.
51
+ */
52
+
53
+ try {
54
+ /** @var int $min */
55
+ $min = RandomCompat_intval($min);
56
+ } catch (TypeError $ex) {
57
+ throw new TypeError(
58
+ 'random_int(): $min must be an integer'
59
+ );
60
+ }
61
+
62
+ try {
63
+ /** @var int $max */
64
+ $max = RandomCompat_intval($max);
65
+ } catch (TypeError $ex) {
66
+ throw new TypeError(
67
+ 'random_int(): $max must be an integer'
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Now that we've verified our weak typing system has given us an integer,
73
+ * let's validate the logic then we can move forward with generating random
74
+ * integers along a given range.
75
+ */
76
+ if ($min > $max) {
77
+ throw new Error(
78
+ 'Minimum value must be less than or equal to the maximum value'
79
+ );
80
+ }
81
+
82
+ if ($max === $min) {
83
+ return (int) $min;
84
+ }
85
+
86
+ /**
87
+ * Initialize variables to 0
88
+ *
89
+ * We want to store:
90
+ * $bytes => the number of random bytes we need
91
+ * $mask => an integer bitmask (for use with the &) operator
92
+ * so we can minimize the number of discards
93
+ */
94
+ $attempts = $bits = $bytes = $mask = $valueShift = 0;
95
+ /** @var int $attempts */
96
+ /** @var int $bits */
97
+ /** @var int $bytes */
98
+ /** @var int $mask */
99
+ /** @var int $valueShift */
100
+
101
+ /**
102
+ * At this point, $range is a positive number greater than 0. It might
103
+ * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to
104
+ * a float and we will lose some precision.
105
+ *
106
+ * @var int|float $range
107
+ */
108
+ $range = $max - $min;
109
+
110
+ /**
111
+ * Test for integer overflow:
112
+ */
113
+ if (!is_int($range)) {
114
+
115
+ /**
116
+ * Still safely calculate wider ranges.
117
+ * Provided by @CodesInChaos, @oittaa
118
+ *
119
+ * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435
120
+ *
121
+ * We use ~0 as a mask in this case because it generates all 1s
122
+ *
123
+ * @ref https://eval.in/400356 (32-bit)
124
+ * @ref http://3v4l.org/XX9r5 (64-bit)
125
+ */
126
+ $bytes = PHP_INT_SIZE;
127
+ /** @var int $mask */
128
+ $mask = ~0;
129
+
130
+ } else {
131
+
132
+ /**
133
+ * $bits is effectively ceil(log($range, 2)) without dealing with
134
+ * type juggling
135
+ */
136
+ while ($range > 0) {
137
+ if ($bits % 8 === 0) {
138
+ ++$bytes;
139
+ }
140
+ ++$bits;
141
+ $range >>= 1;
142
+ /** @var int $mask */
143
+ $mask = $mask << 1 | 1;
144
+ }
145
+ $valueShift = $min;
146
+ }
147
+
148
+ /** @var int $val */
149
+ $val = 0;
150
+ /**
151
+ * Now that we have our parameters set up, let's begin generating
152
+ * random integers until one falls between $min and $max
153
+ */
154
+ /** @psalm-suppress RedundantCondition */
155
+ do {
156
+ /**
157
+ * The rejection probability is at most 0.5, so this corresponds
158
+ * to a failure probability of 2^-128 for a working RNG
159
+ */
160
+ if ($attempts > 128) {
161
+ throw new Exception(
162
+ 'random_int: RNG is broken - too many rejections'
163
+ );
164
+ }
165
+
166
+ /**
167
+ * Let's grab the necessary number of random bytes
168
+ */
169
+ $randomByteString = random_bytes($bytes);
170
+
171
+ /**
172
+ * Let's turn $randomByteString into an integer
173
+ *
174
+ * This uses bitwise operators (<< and |) to build an integer
175
+ * out of the values extracted from ord()
176
+ *
177
+ * Example: [9F] | [6D] | [32] | [0C] =>
178
+ * 159 + 27904 + 3276800 + 201326592 =>
179
+ * 204631455
180
+ */
181
+ $val &= 0;
182
+ for ($i = 0; $i < $bytes; ++$i) {
183
+ $val |= ord($randomByteString[$i]) << ($i * 8);
184
+ }
185
+ /** @var int $val */
186
+
187
+ /**
188
+ * Apply mask
189
+ */
190
+ $val &= $mask;
191
+ $val += $valueShift;
192
+
193
+ ++$attempts;
194
+ /**
195
+ * If $val overflows to a floating point number,
196
+ * ... or is larger than $max,
197
+ * ... or smaller than $min,
198
+ * then try again.
199
+ */
200
+ } while (!is_int($val) || $val > $max || $val < $min);
201
+
202
+ return (int) $val;
203
+ }
204
+ }
ip-geo-block.php CHANGED
@@ -7,15 +7,15 @@
7
  * @package IP_Geo_Block
8
  * @author tokkonopapa <tokkonopapa@yahoo.com>
9
  * @license GPL-3.0
10
- * @link http://www.ipgeoblock.com/
11
  * @copyright 2013-2018 tokkonopapa
12
  *
13
  * Plugin Name: IP Geo Block
14
- * Plugin URI: http://wordpress.org/plugins/ip-geo-block/
15
  * Description: It blocks any spams, login attempts and malicious access to the admin area posted from outside your nation, and also prevents zero-day exploit.
16
- * Version: 3.0.12.1
17
  * Author: tokkonopapa
18
- * Author URI: http://www.ipgeoblock.com/
19
  * Text Domain: ip-geo-block
20
  * License: GPL-3.0
21
  * License URI: https://www.gnu.org/licenses/gpl-3.0.txt
7
  * @package IP_Geo_Block
8
  * @author tokkonopapa <tokkonopapa@yahoo.com>
9
  * @license GPL-3.0
10
+ * @link https://www.ipgeoblock.com/
11
  * @copyright 2013-2018 tokkonopapa
12
  *
13
  * Plugin Name: IP Geo Block
14
+ * Plugin URI: https://wordpress.org/plugins/ip-geo-block/
15
  * Description: It blocks any spams, login attempts and malicious access to the admin area posted from outside your nation, and also prevents zero-day exploit.
16
+ * Version: 3.0.14
17
  * Author: tokkonopapa
18
+ * Author URI: https://www.ipgeoblock.com/
19
  * Text Domain: ip-geo-block
20
  * License: GPL-3.0
21
  * License URI: https://www.gnu.org/licenses/gpl-3.0.txt
languages/ip-geo-block-ja.mo CHANGED
Binary file
languages/ip-geo-block-ja.po CHANGED
@@ -2,22 +2,22 @@
2
  # This file is distributed under the same license as the IP Geo Block package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: IP Geo Block 3.0.12\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/ip-geo-block\n"
7
- "POT-Creation-Date: 2018-05-20 16:59+0900\n"
8
- "PO-Revision-Date: 2018-05-20 17:01+0900\n"
9
  "Language-Team: \n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 2.0.6\n"
14
  "X-Poedit-KeywordsList: __;_e;_n;_x;esc_html_e;esc_html__;esc_attr_e;"
15
  "esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_x:1,2c;_n:1,2\n"
16
  "X-Poedit-Basepath: ..\n"
17
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "Last-Translator: tokkonopapa <tokkonopapa@yahoo.com>\n"
20
- "Language: ja_JP\n"
21
  "X-Poedit-SearchPath-0: .\n"
22
 
23
  #. Description of the plugin/theme
@@ -25,339 +25,342 @@ msgid ""
25
  "It blocks any spams, login attempts and malicious access to the admin area "
26
  "posted from outside your nation, and also prevents zero-day exploit."
27
  msgstr ""
28
- "自国以外から投稿されるスパム、ログインフォーム、さらにゼロデイ攻撃を含む管理領"
29
- "域への悪意あるアクセスからサイトを守ります。"
30
 
31
- #: admin/class-ip-geo-block-admin.php:269
32
- msgid "Import settings ?"
33
- msgstr "設定をインポートしますか?"
34
-
35
- #: admin/class-ip-geo-block-admin.php:270
36
- msgid "Create table ?"
37
- msgstr "テーブルを作成しますか?"
38
 
39
- #: admin/class-ip-geo-block-admin.php:271
40
- msgid "Delete table ?"
41
- msgstr "テーブルを削除しますか?"
 
42
 
43
- #: admin/class-ip-geo-block-admin.php:272
44
- msgid "Clear statistics ?"
45
- msgstr "統計をクリアしますか?"
46
 
47
- #: admin/class-ip-geo-block-admin.php:273
48
- msgid "Clear cache ?"
49
- msgstr "キャッシュをクリアしますか?"
50
 
51
- #: admin/class-ip-geo-block-admin.php:274
52
- msgid "Clear logs ?"
53
- msgstr "ログをクリアしますか?"
 
54
 
55
- #: admin/class-ip-geo-block-admin.php:275
56
  msgid "ajax for logged-in user"
57
  msgstr "認証済ユーザー用 ajax"
58
 
59
- #: admin/class-ip-geo-block-admin.php:276
60
  msgid "ajax for non logged-in user"
61
  msgstr "未認証ユーザー用 ajax"
62
 
63
- #: admin/class-ip-geo-block-admin.php:277
64
  #, php-format
65
  msgid "[Found: %d]"
66
  msgstr "[見つかった数:%d]"
67
 
68
- #: admin/class-ip-geo-block-admin.php:278
69
  #, php-format
70
  msgid "Find and verify `%s` on &#8220;Logs&#8221; tab."
71
  msgstr "ログから `%s` を検索し、検証して下さい。"
72
 
73
- #: admin/class-ip-geo-block-admin.php:279
74
  msgid "This feature is available with HTML5 compliant browsers."
75
  msgstr "HTML5準拠のブラウザでのみ機能します。"
76
 
77
- #: admin/class-ip-geo-block-admin.php:280
78
  msgid "The selected row cannot be found in the visible area."
79
  msgstr "可視領域に選択された行が見つかりません。"
80
 
81
- #: admin/class-ip-geo-block-admin.php:281
82
- #: admin/class-ip-geo-block-admin.php:1483
83
  #, php-format
84
  msgid "An error occurred while executing the ajax command `%s`."
85
  msgstr "Ajaxコマンド `%s` の実行中にエラーが発生しました。"
86
 
87
- #: admin/class-ip-geo-block-admin.php:285
88
  msgid "No data available in table"
89
  msgstr "テーブルにデータがありません"
90
 
91
- #: admin/class-ip-geo-block-admin.php:286
92
  msgid "No matching records found"
93
  msgstr "一致するレコードがありません"
94
 
95
- #: admin/class-ip-geo-block-admin.php:287
96
- #: admin/includes/class-admin-ajax.php:111
97
- #: admin/includes/class-admin-ajax.php:237
98
- #: admin/includes/tab-geolocation.php:70
99
  msgid "IP address"
100
  msgstr "IPアドレス"
101
 
102
- #: admin/class-ip-geo-block-admin.php:288
103
- #: admin/includes/class-admin-ajax.php:112
104
- #: admin/includes/class-admin-ajax.php:238
105
  msgid "Code"
106
  msgstr "国"
107
 
108
- #: admin/class-ip-geo-block-admin.php:289
109
- #: admin/includes/class-admin-ajax.php:113
110
- #: admin/includes/class-admin-ajax.php:239
111
  msgid "ASN"
112
  msgstr "AS番号"
113
 
114
- #: admin/class-ip-geo-block-admin.php:290
115
- #: admin/includes/class-admin-ajax.php:240
116
  msgid "Host name"
117
  msgstr "ホスト名"
118
 
119
- #: admin/class-ip-geo-block-admin.php:291
120
- #: admin/includes/class-admin-ajax.php:114
121
- #: admin/includes/class-admin-ajax.php:241
122
  msgid "Target"
123
  msgstr "検証対象"
124
 
125
- #: admin/class-ip-geo-block-admin.php:292
126
- #: admin/includes/class-admin-ajax.php:242
127
  msgid "Failure / Total"
128
  msgstr "ログイン失敗/総計"
129
 
130
- #: admin/class-ip-geo-block-admin.php:293
131
- #: admin/includes/class-admin-ajax.php:243
132
  msgid "Elapsed[sec]"
133
  msgstr "経過 [秒]"
134
 
135
- #: admin/class-ip-geo-block-admin.php:294
136
- #: admin/includes/class-admin-ajax.php:110
137
  msgid "Time"
138
  msgstr "日時"
139
 
140
- #: admin/class-ip-geo-block-admin.php:295
141
- #: admin/includes/class-admin-ajax.php:115
142
  msgid "Result"
143
  msgstr "検証結果"
144
 
145
- #: admin/class-ip-geo-block-admin.php:296
146
- #: admin/includes/class-admin-ajax.php:116
147
  msgid "Request"
148
  msgstr "リクエスト"
149
 
150
- #: admin/class-ip-geo-block-admin.php:297
151
- #: admin/includes/class-admin-ajax.php:117
152
  msgid "User agent"
153
  msgstr "ユーザー・エージェント"
154
 
155
- #: admin/class-ip-geo-block-admin.php:298
156
- #: admin/includes/class-admin-ajax.php:118
157
  msgid "HTTP headers"
158
  msgstr "HTTP ヘッダー"
159
 
160
- #: admin/class-ip-geo-block-admin.php:299
161
- #: admin/includes/class-admin-ajax.php:119
162
  msgid "$_POST data"
163
  msgstr "$_POST データ"
164
 
165
- #: admin/class-ip-geo-block-admin.php:325
166
  msgid "Contribute on GitHub"
167
  msgstr "開発に参加"
168
 
169
- #: admin/class-ip-geo-block-admin.php:339
170
- #: admin/class-ip-geo-block-admin.php:447
171
- #: admin/class-ip-geo-block-admin.php:664
172
  msgid "Settings"
173
  msgstr "設定"
174
 
175
- #: admin/class-ip-geo-block-admin.php:425
176
- #: admin/class-ip-geo-block-admin.php:426
177
- #: admin/class-ip-geo-block-admin.php:436
178
- #: admin/class-ip-geo-block-admin.php:437
179
- #: admin/class-ip-geo-block-admin.php:446
180
  #: admin/class-ip-geo-block-admin.php:455
 
 
 
 
181
  msgid "IP Geo Block"
182
  msgstr "IP Geo Block"
183
 
184
- #: admin/class-ip-geo-block-admin.php:456
185
- #: admin/class-ip-geo-block-admin.php:669
186
  msgid "Site List"
187
  msgstr "サイト一覧"
188
 
189
- #: admin/class-ip-geo-block-admin.php:485
190
  msgid "You need WordPress 3.7+."
191
- msgstr "WordPress 3.7&thinsp;以上が必要です。"
192
 
193
- #: admin/class-ip-geo-block-admin.php:491
194
  #, php-format
195
  msgid ""
196
  "Now downloading geolocation databases in background. After a little while, "
197
  "please check your country code and &#8220;<strong>Matching rule</"
198
  "strong>&#8221; at <a href=\"%s\">Validation rule settings</a>."
199
  msgstr ""
200
- "バックグラウンドで位置情報データベースをダウンロードしています。少しの間をおい"
201
- "た後、あなたの国コードと[<strong>マッチング規則</strong>]を[<a href=\"%s\">"
202
- "検証ルールの設定</a>]で確認して下さい。"
203
 
204
- #: admin/class-ip-geo-block-admin.php:497
205
  #, php-format
206
  msgid ""
207
  "The &#8220;<strong>Matching rule</strong>&#8221; is not set properly. Please "
208
  "confirm it at <a href=\"%s\">Validation rule settings</a>."
209
  msgstr ""
210
- "[<strong>マッチング規則</strong>]が正しく設定されていません。[<a href=\"%s"
211
- "\">検証ルールの設定</a>]を確認して下さい。"
212
 
213
- #: admin/class-ip-geo-block-admin.php:506
214
  msgid "Local database and matching rule have been updated."
215
  msgstr "ローカル・データベースとマッチング規則を更新しました。"
216
 
217
- #: admin/class-ip-geo-block-admin.php:517
218
  msgid ""
219
  "Once you logout, you will be unable to login again because the number of "
220
  "login attempts reaches the limit."
221
  msgstr ""
222
- "あなたのIPアドレスのログイン試行可能回数がリミットに達したため、ログアウトする"
223
- "と再びログインする事が出来なくなります。"
224
 
225
- #: admin/class-ip-geo-block-admin.php:519
226
  #, php-format
227
  msgid ""
228
- "Please execute \"<strong>Clear cache</strong>\" on <a href=\"%s\">Statistics "
229
- "tab</a> to prevent locking yourself out."
 
230
  msgstr ""
231
- "<a href=\"%s\">[統計]タブ</a>の[<strong>キャッシュのクリア</strong>]を実行"
232
- "し、ロックアウトを回避してください。"
233
 
234
- #: admin/class-ip-geo-block-admin.php:529
235
  msgid ""
236
  "Once you logout, you will be unable to login again because your country code "
237
  "or IP address is in the blacklist."
238
  msgstr ""
239
- "あなたの国コードまたはIPアドレスがブラックリストに含まれているため、ログアウト"
240
- "すると再びログインする事が出来なくなります。"
241
 
242
- #: admin/class-ip-geo-block-admin.php:530
243
  msgid ""
244
  "Once you logout, you will be unable to login again because your country code "
245
  "or IP address is not in the whitelist."
246
  msgstr ""
247
- "あなたの国コードまたはIPアドレスがホワイトリストに含まれていないため、ログアウ"
248
- "トすると再びログインする事が出来なくなります。"
249
 
250
- #: admin/class-ip-geo-block-admin.php:534
251
  #, php-format
252
  msgid "Please check your &#8220;%sValidation rule settings%s&#8221;."
253
  msgstr "[%s検証ルールの設定%s]を確認して下さい。"
254
 
255
- #: admin/class-ip-geo-block-admin.php:538
256
  #, php-format
257
  msgid ""
258
  "Please confirm your local geolocation databases at &#8220;%sLocal database "
259
  "settings%s&#8221; section and remove your IP address in cache at &#8220;"
260
  "%sStatistics in cache%s&#8221; section."
261
  msgstr ""
262
- "[%sローカル・データベースの設定%s]で位置情報データベースを確認し、[%sキャッ"
263
- "シュの統計%s]でキャッシュされているあなたのIPアドレスを削除して下さい。"
264
 
265
- #: admin/class-ip-geo-block-admin.php:559
 
 
 
 
 
 
 
 
 
 
266
  msgid ""
267
  "&#8220;mu-plugins&#8221; (ip-geo-block-mu.php) at &#8220;Validation "
268
  "timing&#8221; is imcompatible with <strong>IP Geo Allow</strong>. Please "
269
  "select &#8220;init&#8221; action hook."
270
  msgstr ""
271
- "[検証のタイミング]に「&#8220;mu-plugins&#8221; (ip-geo-block-mu.php)」が選択"
272
- "されていますが、<strong>IP Geo Allow</strong> と互換性がありません。「&#8220;"
273
- "init&#8221; アクション・フック」を選択してください。"
274
 
275
- #: admin/class-ip-geo-block-admin.php:665
276
  msgid "Statistics"
277
  msgstr "統計"
278
 
279
- #: admin/class-ip-geo-block-admin.php:666
280
  msgid "Logs"
281
  msgstr "ログ"
282
 
283
- #: admin/class-ip-geo-block-admin.php:667
284
  msgid "Search"
285
  msgstr "検索"
286
 
287
- #: admin/class-ip-geo-block-admin.php:668
288
  msgid "Attribution"
289
  msgstr "リンク"
290
 
291
- #: admin/class-ip-geo-block-admin.php:685
292
- #: admin/class-ip-geo-block-admin.php:702
293
  msgid "Network wide"
294
  msgstr "ネットワーク管理"
295
 
296
- #: admin/class-ip-geo-block-admin.php:715
297
  msgid "Toggle all"
298
  msgstr "全てを開閉"
299
 
300
- #: admin/class-ip-geo-block-admin.php:718
301
  msgid ""
302
- "Independent of &#8220;Statistics and Logs settings&#8221;, you can see all "
303
  "the requests validated by this plugin in almost real time."
304
  msgstr ""
305
- "[統計とログの設定]にかかわらず、このプラグインによる検証結果のすべてを、ほぼ"
306
- "リアルタイムに表示します。"
307
 
308
- #: admin/class-ip-geo-block-admin.php:718 admin/includes/tab-accesslog.php:39
309
  msgid "Live update"
310
  msgstr "ライブアップデート"
311
 
312
- #: admin/class-ip-geo-block-admin.php:722
313
  msgid "Open a new window on clicking the link in the chart."
314
  msgstr "チャート内のリンクをクリックすると、新しいウィンドウが開きます。"
315
 
316
- #: admin/class-ip-geo-block-admin.php:722
317
- msgid "Open a new window"
318
- msgstr "別窓で開く"
319
-
320
- #: admin/class-ip-geo-block-admin.php:745
321
  msgid "Thanks for providing these great services for free."
322
  msgstr "これらのすばらしいサービスの提供元に、敬意と感謝の意を表します!"
323
 
324
- #: admin/class-ip-geo-block-admin.php:746
325
  msgid ""
326
- "(Most browsers will redirect you to each site <a href=\"http://www."
327
  "ipgeoblock.com/etc/referer.html\" title=\"Referer Checker\">without referrer "
328
  "when you click the link</a>.)"
329
  msgstr ""
330
- "(ほとんどのブラウザでは、<a href=\"http://www.ipgeoblock.com/etc/referer.html"
331
- "\" title=\"Referer Checker\">参照元を残さずにリンク先にリダイレクトできます</"
332
- "a>。)"
333
 
334
- #: admin/class-ip-geo-block-admin.php:751
335
  msgid "Back to top"
336
  msgstr "トップに戻る"
337
 
338
- #: admin/class-ip-geo-block-admin.php:843
339
  msgid "Enable"
340
  msgstr "有効"
341
 
342
- #: admin/class-ip-geo-block-admin.php:858
343
  msgid "Select one"
344
  msgstr "何れかを選択"
345
 
346
- #: admin/class-ip-geo-block-admin.php:1273
347
  msgid "You do not have sufficient permissions to access this page."
348
  msgstr "このページにアクセスするための十分な権限がありません。"
349
 
350
- #: admin/class-ip-geo-block-admin.php:1300
351
  #: admin/includes/class-admin-rewrite.php:194
352
  #: classes/class-ip-geo-block-cron.php:217
353
  #: classes/class-ip-geo-block-cron.php:321
354
  #: classes/class-ip-geo-block-cron.php:395
355
- #: classes/class-ip-geo-block-opts.php:452
356
  #, php-format
357
  msgid "Unable to write <code>%s</code>. Please check the permission."
358
  msgstr "<code>%s</code> に書き込めません。パーミッションをチェックして下さい。"
359
 
360
- #: admin/class-ip-geo-block-admin.php:1330
361
  msgid "Settings saved."
362
  msgstr "設定を保存しました。"
363
 
@@ -365,17 +368,17 @@ msgstr "設定を保存しました。"
365
  msgid "n/a"
366
  msgstr "利用不可"
367
 
368
- #: admin/includes/class-admin-ajax.php:75 admin/includes/tab-settings.php:75
369
- #: admin/includes/tab-settings.php:95
370
  msgid "UNKNOWN"
371
  msgstr "不明"
372
 
373
- #: admin/includes/class-admin-ajax.php:198
374
  #, php-format
375
  msgid "The user %s (user ID: %d) is in use."
376
  msgstr "ユーザー %s(ユーザーID:%d)が使用中です。"
377
 
378
- #: admin/includes/class-admin-ajax.php:492
379
  #, php-format
380
  msgid ""
381
  "illegal format at %s. Please delete the corresponding line and try again."
@@ -397,117 +400,116 @@ msgstr "あるいは %s を参照し、手動で設定して下さい。"
397
  #: admin/includes/class-admin-rewrite.php:234
398
  #, php-format
399
  msgid "&#8220;auto_prepend_file&#8221; already defined in %s."
400
- msgstr "%s&thinsp;で既に「auto_prepend_file」が設定されています。"
401
 
402
  #: admin/includes/tab-accesslog.php:19
403
  msgid "Validation logs"
404
  msgstr "検証のログ"
405
 
406
- #: admin/includes/tab-accesslog.php:19 admin/includes/tab-settings.php:765
407
- #: admin/includes/tab-settings.php:1410
408
  msgid "Help"
409
  msgstr "ヘルプ"
410
 
411
- #: admin/includes/tab-accesslog.php:54 admin/includes/tab-settings.php:457
412
  msgid "Comment post"
413
  msgstr "コメント投稿"
414
 
415
- #: admin/includes/tab-accesslog.php:55 admin/includes/tab-settings.php:458
416
  msgid "XML-RPC"
417
  msgstr "XML-RPC"
418
 
419
- #: admin/includes/tab-accesslog.php:56 admin/includes/tab-settings.php:459
420
  msgid "Login form"
421
  msgstr "ログイン・フォーム"
422
 
423
- #: admin/includes/tab-accesslog.php:57 admin/includes/tab-settings.php:460
424
  msgid "Admin area"
425
  msgstr "管理領域"
426
 
427
- #: admin/includes/tab-accesslog.php:58 admin/includes/tab-settings.php:462
428
  msgid "Public facing pages"
429
  msgstr "一般公開ページ"
430
 
431
- #: admin/includes/tab-accesslog.php:61 admin/includes/tab-network.php:76
432
  msgid "All"
433
  msgstr "全て"
434
 
435
- #: admin/includes/tab-accesslog.php:71
436
  msgid "Select target"
437
  msgstr "対象を選択"
438
 
439
- #: admin/includes/tab-accesslog.php:87
440
  msgid "Search in logs"
441
  msgstr "ログを検索"
442
 
443
- #: admin/includes/tab-accesslog.php:96 admin/includes/tab-statistics.php:240
444
  msgid "Reset"
445
  msgstr "リセット"
446
 
447
- #: admin/includes/tab-accesslog.php:104 admin/includes/tab-statistics.php:247
448
  msgid "Bulk action"
449
  msgstr "選択して実行"
450
 
451
- #: admin/includes/tab-accesslog.php:115 admin/includes/tab-statistics.php:258
452
  msgid "Remove entries by IP address"
453
  msgstr "指定のIPアドレスでエントリを削除"
454
 
455
- #: admin/includes/tab-accesslog.php:116 admin/includes/tab-statistics.php:259
456
  msgid "Add IP address to &#8220;Whitelist&#8221;"
457
  msgstr "IPアドレスをホワイトリストへ追加"
458
 
459
- #: admin/includes/tab-accesslog.php:117 admin/includes/tab-statistics.php:260
460
  msgid "Add IP address to &#8220;Blacklist&#8221;"
461
  msgstr "IPアドレスをブラックリストへ追加"
462
 
463
- #: admin/includes/tab-accesslog.php:118 admin/includes/tab-statistics.php:261
464
  msgid "Add AS number to &#8220;Whitelist&#8221;"
465
  msgstr "AS番号をホワイトリストへ追加"
466
 
467
- #: admin/includes/tab-accesslog.php:119 admin/includes/tab-statistics.php:262
468
  msgid "Add AS number to &#8220;Blacklist&#8221;"
469
  msgstr "AS番号をブラックリストへ追加"
470
 
471
- #: admin/includes/tab-accesslog.php:121 admin/includes/tab-network.php:56
472
- #: admin/includes/tab-statistics.php:264
473
  msgid "Apply"
474
  msgstr "実行する"
475
 
476
- #: admin/includes/tab-accesslog.php:129 admin/includes/tab-statistics.php:198
477
  msgid "Clear logs"
478
  msgstr "ログをクリア"
479
 
480
- #: admin/includes/tab-accesslog.php:137 admin/includes/tab-statistics.php:173
481
- #: admin/includes/tab-statistics.php:206 admin/includes/tab-statistics.php:279
482
  msgid "Clear all"
483
  msgstr "全てをクリア"
484
 
485
- #: admin/includes/tab-accesslog.php:147
486
  msgid "Export logs"
487
  msgstr "ログをエクスポート"
488
 
489
- #: admin/includes/tab-accesslog.php:153 admin/includes/tab-settings.php:1582
490
- #: admin/includes/tab-statistics.php:294
491
  msgid "Export to the local file"
492
  msgstr "ローカル・ファイルへエクスポートする"
493
 
494
- #: admin/includes/tab-accesslog.php:153 admin/includes/tab-statistics.php:294
495
  msgid "Export csv"
496
  msgstr "CSVへエクスポート"
497
 
498
- #: admin/includes/tab-accesslog.php:174 admin/includes/tab-network.php:114
499
- #: admin/includes/tab-statistics.php:424
500
  #, php-format
501
- msgid "[ %sRecord &#8220;Logs&#8221;%s ] is disabled."
502
  msgstr "[%s検証のログを記録%s]が無効です。"
503
 
504
- #: admin/includes/tab-accesslog.php:175 admin/includes/tab-network.php:115
505
- #: admin/includes/tab-statistics.php:425
506
  msgid ""
507
  "Please set the proper condition to record and analyze the validation logs."
508
  msgstr "検証のログを記録し分析するためには、適切な条件を設定して下さい。"
509
 
510
- #: admin/includes/tab-attribution.php:16
511
  msgid "Attribution links"
512
  msgstr "リンク"
513
 
@@ -515,27 +517,24 @@ msgstr "リンク"
515
  msgid "Search IP address geolocation"
516
  msgstr "IPアドレスの位置情報を検索"
517
 
518
- #: admin/includes/tab-geolocation.php:42
519
- msgid "Geolocation service"
520
- msgstr "位置情報サービス"
521
 
522
- #: admin/includes/tab-geolocation.php:86 admin/includes/tab-settings.php:1101
523
  msgid ""
524
- "<dfn title=\"IP address is always encrypted on recording in cache and logs. "
525
- "Moreover, this option makes the IP address anonymous and restricted on "
526
- "sending to the 3rd parties such as geolocation APIs or whois service."
527
- "\">Anonymize IP address and restrict 3rd party APIs</dfn>"
528
  msgstr ""
529
- "<dfn title=\"IPアドレスは、キャッシュとログに記録される際に常に暗号化されま"
530
- "す。このオプションはさらに、IPアドレスを匿名化し、位置情報サービスやwhoisサー"
531
- "ビスなどの第三者への送信を制限します。\">IPアドレスを匿名化し、APIの使用を制限"
532
- "する</dfn>"
533
 
534
- #: admin/includes/tab-geolocation.php:101
535
- msgid "Find geolocation"
536
  msgstr "位置情報の検索"
537
 
538
- #: admin/includes/tab-geolocation.php:109
539
  msgid "Search now"
540
  msgstr "今すぐ検索"
541
 
@@ -551,71 +550,101 @@ msgstr "行数"
551
  msgid "Columns"
552
  msgstr "列数"
553
 
554
- #: admin/includes/tab-network.php:62
555
  msgid "Chart display layout"
556
  msgstr "チャートの表示レイアウト"
557
 
558
- #: admin/includes/tab-network.php:77
559
  msgid "Latest 1 hour"
560
  msgstr "最新の1時間"
561
 
562
- #: admin/includes/tab-network.php:78
563
  msgid "Latest 24 hours"
564
  msgstr "最新の24時間"
565
 
566
- #: admin/includes/tab-network.php:79
567
  msgid "Latest 1 week"
568
  msgstr "最新の1週間"
569
 
570
- #: admin/includes/tab-network.php:92
571
  msgid "Duration to retrieve"
572
  msgstr "取得する期間"
573
 
574
- #: admin/includes/tab-settings.php:44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
  msgid "Validation rule settings"
576
  msgstr "検証ルールの設定"
577
 
578
- #: admin/includes/tab-settings.php:67
579
  msgid ""
580
  "<dfn title=\"You can confirm the appropriate Geolocation APIs and country "
581
  "code by referring &#8220;Scan country code&#8221;.\">Your IP address / "
582
  "Country</dfn>"
583
  msgstr ""
584
- "<dfn title=\"[国コードを検索する]を参照し、適切な位置情報APIと国コードを設定"
585
- "して下さい。\">あなたのIPアドレス / 国コード</dfn>"
586
 
587
- #: admin/includes/tab-settings.php:76 admin/includes/tab-settings.php:96
588
  msgid "Scan all the APIs you selected at Geolocation API settings"
589
  msgstr "選択された位置情報APIを検索します"
590
 
591
- #: admin/includes/tab-settings.php:76 admin/includes/tab-settings.php:96
592
  msgid "Scan country code"
593
  msgstr "国コードを検索する"
594
 
595
- #: admin/includes/tab-settings.php:87
596
  msgid ""
597
  "<dfn title=\"You can confirm the appropriate Geolocation APIs and country "
598
  "code by referring &#8220;Scan country code&#8221;.\">Server IP address / "
599
  "Country</dfn>"
600
  msgstr ""
601
- "<dfn title=\"[国コードを検索する]を参照し、適切な位置情報APIと国コードを設定"
602
- "して下さい。\">サーバーのIPアドレス / 国コード</dfn>"
603
 
604
- #: admin/includes/tab-settings.php:104
605
  msgid "Whitelist"
606
  msgstr "ホワイトリスト"
607
 
608
- #: admin/includes/tab-settings.php:105
609
  msgid "Blacklist"
610
  msgstr "ブラックリスト"
611
 
612
- #: admin/includes/tab-settings.php:109
613
  msgid ""
614
  "Please select either &#8220;Whitelist&#8221; or &#8220;Blacklist&#8221;."
615
- msgstr ""
616
- "「ホワイトリスト」または「ブラックリスト」のどちらかを選択してください。"
617
 
618
- #: admin/includes/tab-settings.php:110
619
  msgid ""
620
  "<dfn title=\"&#8220;Block by country&#8221; will be bypassed in case of "
621
  "empty. The special code &#8220;XX&#8221; is assigned as private IP address "
@@ -624,13 +653,11 @@ msgid ""
624
  "the code that does not correspond to any of the countries.\">Whitelist of "
625
  "country code</dfn>"
626
  msgstr ""
627
- "<dfn title=\"空欄の場合、「国コードで遮断」はバイパスされます。特別なコード"
628
- "「XX」は、localhost&thinsp;を含むプライベート・アドレスに割り当てられ、また"
629
- "「ZZ」は不明(位置情報データベースに未登録)を表します。どの国にもマッチさせな"
630
- "いことが必要な場合には、「YY」を指定してください。\">国コードのホワイトリスト"
631
- "</dfn>"
632
 
633
- #: admin/includes/tab-settings.php:111
634
  msgid ""
635
  "<dfn title=\"&#8220;Block by country&#8221; will be bypassed in case of "
636
  "empty. The special code &#8220;XX&#8221; is assigned as private IP address "
@@ -639,98 +666,59 @@ msgid ""
639
  "the code that does not correspond to any of the countries.\">Blacklist of "
640
  "country code</dfn>"
641
  msgstr ""
642
- "<dfn title=\"空欄の場合、「国コードで遮断」はバイパスされます。特別なコード"
643
- "「XX」は、localhost&thinsp;を含むプライベート・アドレスに割り当てられ、また"
644
- "「ZZ」は不明(位置情報データベースに未登録)を表します。どの国にもマッチさせな"
645
- "いことが必要な場合には、「YY」を指定してください。\">国コードのブラックリスト"
646
- "</dfn>"
647
-
648
- #: admin/includes/tab-settings.php:115
649
- msgid "(comma separated)"
650
- msgstr "(カンマ区切り)"
651
 
652
- #: admin/includes/tab-settings.php:116
653
- msgid "(comma or RET separated)"
654
- msgstr "(カンマ、改行区切り)"
655
-
656
- #: admin/includes/tab-settings.php:117
657
- msgid "Toggle selection"
658
- msgstr "選択を切り替える"
659
-
660
- #: admin/includes/tab-settings.php:118
661
- msgid "Find blocked requests in &#8220;Logs&#8220;"
662
- msgstr "ログから遮断されたリクエストを検索する"
663
-
664
- #: admin/includes/tab-settings.php:119
665
- msgid ""
666
- "Before adding as &#8220;Exception&#8221;, please click on &#8220;<a class="
667
- "\"ip-geo-block-icon ip-geo-block-icon-alert\" title=\"This button is just a "
668
- "sample.\"><span></span></a>&#8221; button (if exists) attached to the "
669
- "following list to confirm that the blocked request is not malicious."
670
- msgstr ""
671
- "[例外]に追加する前に、以下の候補に付いたボタン&thinsp;&#8220;<a class=\"ip-"
672
- "geo-block-icon ip-geo-block-icon-alert\" title=\"このボタンは単なるサンプルで"
673
- "す。\"><span></span></a>&#8221;(もしあれば)をクリックし、遮断されたリクエス"
674
- "トに悪意のないことを確認して下さい。"
675
-
676
- #: admin/includes/tab-settings.php:120
677
- msgid "Open CIDR calculator for IPv4 / IPv6."
678
- msgstr "IPv4/IPv6用CIDR変換プログラムを開きます。"
679
-
680
- #: admin/includes/tab-settings.php:127 admin/includes/tab-settings.php:796
681
  msgid "Matching rule"
682
  msgstr "マッチング規則"
683
 
684
- #: admin/includes/tab-settings.php:139
685
  msgid ""
686
  "A request from which the country code or IP address is <strong>NOT</strong> "
687
  "in the whitelist will be blocked."
688
  msgstr ""
689
- "国コードまたはIPアドレスがホワイトリストに<strong>含まれていない</strong>リク"
690
- "エストを遮断します。"
691
 
692
- #: admin/includes/tab-settings.php:140
693
  msgid ""
694
  "A request from which the country code or IP address is in the blacklist will "
695
  "be blocked."
696
- msgstr ""
697
- "国コードまたはIPアドレスがブラックリストに<strong>含まれている</strong>リクエ"
698
- "ストを遮断します。"
699
 
700
- #: admin/includes/tab-settings.php:186
701
  msgid ""
702
  "<dfn title=\"It enables utilizing &#8220;AS number&#8221; in the &#8220;"
703
  "Whitelist/Blacklist of extra IP addresses&#8221; to specify a group of IP "
704
  "networks.\">Use Autonomous System Number</dfn>"
705
  msgstr ""
706
- "<dfn title=\"ホワイトリスト、ブラックリストにIPアドレスを指定する代わりに、"
707
- "ネットワークのグループを代表する「AS番号」の指定を可能にします。\">AS番号を使"
708
- "用可能にする</dfn>"
709
 
710
- #: admin/includes/tab-settings.php:197
711
  #, php-format
712
  msgid "Some useful tools to find ASN are introduced in &#8220;%s&#8221;."
713
  msgstr "AS番号の検索に役立つツールを &#8220;%s&#8221; に紹介しています。"
714
 
715
- #: admin/includes/tab-settings.php:206
716
  msgid ""
717
  "<dfn title=\"e.g. &#8220;192.0.64.0/18&#8221; for Jetpack server, "
718
  "&#8220;69.46.36.0/27&#8221; for WordFence server or &#8220;AS32934&#8221; "
719
  "for Facebook.\">Whitelist of extra IP addresses prior to country code</dfn>"
720
  msgstr ""
721
- "<dfn title=\"例)192.0.64.0/18(Jetpackサーバー)、69.46.36.0/27(WordFence"
722
- "サーバー)、AS32934(Facebook)\">国コードに優先して検証するIPアドレスのホワイ"
723
- "トリスト</dfn>"
724
 
725
- #: admin/includes/tab-settings.php:228
726
  msgid ""
727
  "<dfn title=\"Server level access control is recommended (e.g. .htaccess)."
728
  "\">Blacklist of extra IP addresses prior to country code</dfn>"
729
  msgstr ""
730
- "<dfn title=\"サーバー・レベルのアクセス制御の使用をお勧めします(例:."
731
- "htaccess)。\">国コードに優先して検証するIPアドレスのブラックリスト</dfn>"
732
 
733
- #: admin/includes/tab-settings.php:251
734
  msgid ""
735
  "<dfn title=\"If your server is placed behind the proxy server or the load "
736
  "balancing server, you need to put the appropriate key such as &#8220;"
@@ -738,13 +726,11 @@ msgid ""
738
  "that to retrieve the client IP address.\">$_SERVER keys to retrieve extra IP "
739
  "addresses</dfn>"
740
  msgstr ""
741
- "<dfn title=\"あなたのサーバーがプロキシー・サーバーやロード・バランサーの背後"
742
- "に位置する場合には、クライアントのIPアドレスを抽出するために"
743
- "「HTTP_X_FORWARDED_FOR」や「HTTP_X_REAL_IP」など、$_SERVER&thinsp;の適切なキー"
744
- "を指定してください。\">IPアドレスを追加抽出する&thinsp;$_SERVER&thinsp;のキー"
745
- "</dfn>"
746
 
747
- #: admin/includes/tab-settings.php:270
748
  msgid ""
749
  "<dfn title=\"It validates malicious signatures independently of &#8220;Block "
750
  "by country&#8221; and &#8220;Prevent Zero-day Exploit&#8221; for the target "
@@ -754,52 +740,45 @@ msgid ""
754
  "block-decode\" title=\"When you find ugly character string in the text area, "
755
  "please click to restore.\"><span></span></a>)</nobr>"
756
  msgstr ""
757
- "<dfn title=\"「国コードで遮断」および「ゼロデイ攻撃を遮断」とは独立に、[管理"
758
- "領域]、[管理領域 ajax/post]、[プラグイン領域]、[テーマ領域]をターゲット"
759
- "とした悪意のあるシグネチャを検証します。\">悪意のあるシグネチャ</dfn> "
760
- "<nobr>(<a class=\"ip-geo-block-icon ip-geo-block-icon-cycle\" id=\"ip-geo-"
761
- "block-decode\" title=\"文字化けした場合、クリックして復元して下さ"
762
- "い。\"><span></span></a>)</nobr>"
763
 
764
- #: admin/includes/tab-settings.php:284
765
  msgid ""
766
  "<dfn title=\"Select allowed MIME type.\">Whitelist of allowed MIME type</dfn>"
767
- msgstr ""
768
- "<dfn title=\"許可する&thinsp;MIME&thinsp;タイプを指定します。\">許可する"
769
- "&thinsp;MIME&thinsp;タイプのホワイトリスト</dfn>"
770
 
771
- #: admin/includes/tab-settings.php:295
772
  msgid ""
773
  "<dfn title=\"Put forbidden file extensions.\">Blacklist of forbidden file "
774
  "extensions</dfn>"
775
  msgstr ""
776
- "<dfn title=\"禁止するファイルの拡張子を設定します。\">禁止するファイル拡張子の"
777
- "ブラックリスト</dfn>"
778
 
779
- #: admin/includes/tab-settings.php:299
780
  msgid ""
781
  "<dfn title=\"Specify the capabilities to be verified. Depending on the "
782
  "particular type of uploader, certain capability may be required. Default is "
783
  "&#8220;upload_files&#8221; for Administrator, Editor and Author. This "
784
  "verification will be skipped if empty.\">Capabilities to be verified</dfn>"
785
  msgstr ""
786
- "<dfn title=\"検証する権限を指定します。アップローダーによっては、特定の権限を"
787
- "必要とする場合があります。デフォルトは、管理者(Administrator)、編集者"
788
- "(Editor)、投稿者(Author)向けの「upload_files」です。空欄の場合、この検証は"
789
- "スキップされます。\">検証する権限</dfn>"
790
 
791
- #: admin/includes/tab-settings.php:299
792
  msgid ""
793
- "(&thinsp;See &#8220;<a rel=\"noreferrer\" href=\"https://codex.wordpress.org/"
794
  "Roles_and_Capabilities\" title=\"Roles and Capabilities &laquo; WordPress "
795
- "Codex\">Roles and Capabilities</a>&#8221;&thinsp;)"
796
  msgstr ""
797
- "(&#8220;<a rel=\"noreferrer\" href=\"http://wpdocs.osdn.jp/%E3%83%A6%E3%83%BC"
798
- "%E3%82%B6%E3%83%BC%E3%81%AE%E7%A8%AE%E9%A1%9E%E3%81%A8%E6%A8%A9%E9%99%90\" "
799
- "title=\"ユーザーの種類と権限 - WordPress Codex 日本語版\">ユーザーの種類と権限"
800
- "</a>&#8220; を参照)"
801
 
802
- #: admin/includes/tab-settings.php:307
803
  msgid ""
804
  "<dfn title=\"It restricts the file types on upload in order to block malware "
805
  "and backdoor via both back-end and front-end. Please consider to select "
@@ -807,35 +786,34 @@ msgid ""
807
  "timing&#8221; so that other staff would not fetch the uploaded files before "
808
  "this validation.\">Prevent malicious file uploading</dfn>"
809
  msgstr ""
810
- "<dfn title=\"ファイル・タイプを限定し、バックエンド、またはフロントエンドを経"
811
- "由するマルウェアやバックドアのアップロードを遮断します。他のプラグインやテーマ"
812
- "に先んじて確実に遮断するために、[検証のタイミング]を「&#8220;mu-"
813
- "plugins&#8221; (ip-geo-block-mu.php)」に設定することを検討してください。\">悪"
814
- "意のあるアップロード防止</dfn>"
815
 
816
- #: admin/includes/tab-settings.php:318 admin/includes/tab-settings.php:499
817
- #: admin/includes/tab-settings.php:623 admin/includes/tab-settings.php:1160
818
  msgid "Disable"
819
  msgstr "無効"
820
 
821
- #: admin/includes/tab-settings.php:319
822
  msgid "Verify file extension and MIME type"
823
- msgstr "拡張子と&thinsp;MIME&thinsp;タイプを検証"
824
 
825
- #: admin/includes/tab-settings.php:320
826
  msgid "Verify file extension only"
827
  msgstr "ファイル拡張子のみを検証"
828
 
829
- #: admin/includes/tab-settings.php:330
830
  #, php-format
831
  msgid ""
832
  "<dfn title=\"You can put your original 403.php and so on into your theme "
833
  "directory.\">Response code</dfn> %s"
834
  msgstr ""
835
- "<dfn title=\"テーマ・ディレクトリには&thinsp;403.php&thinsp;など、独自のファイ"
836
- "ルを設置する事が出来ます。\">レスポンス・コード</dfn> %s"
837
 
838
- #: admin/includes/tab-settings.php:360 admin/includes/tab-settings.php:883
839
  msgid ""
840
  "<dfn title=\"Specify the URL for response code 2xx and 3xx. If it is pointed "
841
  "to a public facing page, visitors would not be blocked on the page to "
@@ -843,339 +821,354 @@ msgid ""
843
  "[Front-end target settings] section. Empty URL is altered to your home."
844
  "\">Redirect URL</dfn>"
845
  msgstr ""
846
- "<dfn title=\"レスポンス・コード&thinsp;2xx&thinsp;、3xx&thinsp;用のリダイレク"
847
- "ト先&thinsp;URL&thinsp;を指定します。リダイレクトのループを避けるため、自サイ"
848
- "ト内の&thinsp;URL&thinsp;は[フロントエンドの設定]に関わらず遮断の対象外とな"
849
- "ります。空欄の場合、サイトのホームが使用されます。\">リダイレクト先&thinsp;"
850
- "URL</dfn>"
851
 
852
- #: admin/includes/tab-settings.php:378 admin/includes/tab-settings.php:902
853
  msgid ""
854
  "<dfn title=\"Specify the message for response code 4xx and 5xx.\">Response "
855
  "message</dfn>"
856
  msgstr ""
857
- "<dfn title=\"レスポンス・コード&thinsp;4xx、5xx&thinsp;用のメッセージを指定し"
858
- "ます。\">レスポンス・メッセージ</dfn>"
859
 
860
- #: admin/includes/tab-settings.php:395
861
- msgid ""
862
- "<dfn title=\"This is applied to &#8220;XML-RPC&#8221; and &#8220;Login "
863
- "form&#8221;. Lockout period is defined as expiration time at &#8220;Privacy "
864
- "and record settings&#8221;.\">Max number of failed login attempts per IP "
865
- "address</dfn>"
866
- msgstr ""
867
- "<dfn title=\"[XML-RPC]と[ログイン・フォーム]に適用されます。ロックアウト時"
868
- "間は[プライバシーと記録の設定]の[キャッシュの有効時間]で定義します。\">IP"
869
- "アドレス当たりのログイン試行可能回数</dfn>"
870
-
871
- #: admin/includes/tab-settings.php:423
872
  msgid "Select when to run the validation."
873
  msgstr "検証を実行するタイミングを選択します。"
874
 
875
- #: admin/includes/tab-settings.php:423
876
  msgid "Validation timing"
877
  msgstr "検証のタイミング"
878
 
879
- #: admin/includes/tab-settings.php:434
880
  msgid "&#8220;init&#8221; action hook"
881
  msgstr "&#8220;init&#8221; アクション・フック"
882
 
883
- #: admin/includes/tab-settings.php:435
884
  msgid "&#8220;mu-plugins&#8221; (ip-geo-block-mu.php)"
885
  msgstr "&#8220;mu-plugins&#8221; (ip-geo-block-mu.php)"
886
 
887
- #: admin/includes/tab-settings.php:438
888
  msgid ""
889
  "Validate at &#8220;init&#8221; action hook in the same manner as typical "
890
  "plugins."
891
- msgstr ""
892
- "標準的な他のプラグインと同様、init アクション・フックのタイミングで検証を実行"
893
- "します。"
894
 
895
- #: admin/includes/tab-settings.php:439
896
  msgid ""
897
  "Validate at an earlier phase than other typical plugins. It can reduce load "
898
- "on server but has <a rel='noreferrer' href='http://www.ipgeoblock.com/codex/"
899
  "validation-timing.html' title='Validation timing | IP Geo Block'>some "
900
  "restrictions</a>."
901
  msgstr ""
902
- "標準的な他のプラグインより早いタイミングで検証を実行します。これによりサーバー"
903
- "の負荷は軽減されますが、<a rel='noreferrer' href='http://www.ipgeoblock.com/"
904
- "codex/validation-timing.html' title='Validation timing | IP Geo Block'>幾つか"
905
- "の制限事項</a>&thinsp;が生じます。"
906
 
907
- #: admin/includes/tab-settings.php:449
908
  msgid "Back-end target settings"
909
  msgstr "バックエンドの設定"
910
 
911
- #: admin/includes/tab-settings.php:455
912
  #, php-format
913
  msgid "<dfn title=\"Validate request to %s.\">%s</dfn>"
914
  msgstr "<dfn title=\"%s へのリクエストを検証します。\">%s</dfn>"
915
 
916
- #: admin/includes/tab-settings.php:461
917
  msgid "Other areas"
918
  msgstr "その他の領域"
919
 
920
- #: admin/includes/tab-settings.php:462
921
  msgid "public facing pages"
922
  msgstr "一般公開ページ"
923
 
924
- #: admin/includes/tab-settings.php:480 admin/includes/tab-settings.php:500
925
- #: admin/includes/tab-settings.php:533 admin/includes/tab-settings.php:539
926
  #: admin/includes/tab-settings.php:784
927
  msgid "Block by country"
928
  msgstr "国コードで遮断"
929
 
930
- #: admin/includes/tab-settings.php:501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
931
  msgid "Completely close"
932
  msgstr "完全に閉鎖"
933
 
934
- #: admin/includes/tab-settings.php:507
935
  msgid "Action to login as a registered user."
936
  msgstr "登録済みユーザーとしてログインするアクション。"
937
 
938
- #: admin/includes/tab-settings.php:507
939
  msgid "Log in"
940
  msgstr "ログイン"
941
 
942
- #: admin/includes/tab-settings.php:508
943
  msgid "Action to register new users."
944
  msgstr "新規ユーザーを登録するアクション。"
945
 
946
- #: admin/includes/tab-settings.php:508
947
  msgid "Register"
948
  msgstr "登録"
949
 
950
- #: admin/includes/tab-settings.php:509
951
  msgid "Action to reset a password to create a new one."
952
  msgstr "パスワードをリセットし、新しいパスワードに更新するアクション。"
953
 
954
- #: admin/includes/tab-settings.php:509
955
  msgid "Password Reset"
956
  msgstr "パスワードのリセット"
957
 
958
- #: admin/includes/tab-settings.php:510
959
  msgid "Action to email a password to a registered user."
960
  msgstr "登録済みユーザーにパスワードを送付するアクション。"
961
 
962
- #: admin/includes/tab-settings.php:510
963
  msgid "Lost Password"
964
  msgstr "パスワード紛失"
965
 
966
- #: admin/includes/tab-settings.php:511
967
  msgid ""
968
  "Action to show prompt to enter a password on password protected post and "
969
  "page."
970
- msgstr ""
971
- "パスワードで保護された投稿とページにパスワードを入力するプロンプトを表示するア"
972
- "クション。"
973
 
974
- #: admin/includes/tab-settings.php:511
975
  msgid "Password protected"
976
  msgstr "パスワード保護"
977
 
978
- #: admin/includes/tab-settings.php:534
979
  msgid ""
980
  "<dfn title=\"Specify the individual action as a blocking target.\">Target "
981
  "actions</dfn>"
982
- msgstr ""
983
- "<dfn title=\"遮断対象とするアクションを指定します。\">対象アクション</dfn>"
984
 
985
- #: admin/includes/tab-settings.php:540
986
  msgid "Prevent Zero-day Exploit"
987
  msgstr "ゼロデイ攻撃を遮断"
988
 
989
- #: admin/includes/tab-settings.php:544
990
  msgid ""
991
  "It will block a request related to the services for both public facing pages "
992
  "and the dashboard."
993
- msgstr ""
994
- "一般公開ページとダッシュボード向けサービスに関連するリクエストを遮断します。"
995
 
996
- #: admin/includes/tab-settings.php:545
997
  msgid ""
998
  "Regardless of the country code, it will block a malicious request related to "
999
  "the services only for the dashboard."
 
 
 
 
 
 
 
 
1000
  msgstr ""
1001
- "国コードに拘らず、ダッシュボード向けサービスだけに関連する悪意のあるリクエスト"
1002
- "を遮断します。"
1003
 
1004
- #: admin/includes/tab-settings.php:568
 
 
 
 
1005
  msgid "admin post for logged-in user"
1006
  msgstr "認証済ユーザー用 admin post"
1007
 
1008
- #: admin/includes/tab-settings.php:569
1009
  msgid "admin post for non logged-in user"
1010
  msgstr "未認証ユーザー用 admin post"
1011
 
1012
- #: admin/includes/tab-settings.php:593
1013
  msgid "Admin ajax/post"
1014
- msgstr "管理領域&thinsp;ajax/post"
1015
 
1016
- #: admin/includes/tab-settings.php:607
1017
  msgid ""
1018
  "Specify the action name (&#8220;action=&hellip;&#8221;) or the page name "
1019
  "(&#8220;page=&hellip;&#8221;) to prevent unintended blocking caused by "
1020
  "&#8220;Block by country&#8221; (for non logged-in user) and &#8220;Prevent "
1021
  "Zero-day Exploit&#8221; (for logged-in user)."
1022
  msgstr ""
1023
- "「国コードで遮断」(未認証ユーザーの場合)および「ゼロデイ攻撃を遮断」(認証済"
1024
- "みユーザーの場合)が、意図しない遮断の原因となる場合、アクション名(&#8220;"
1025
- "action=&hellip;&#8221; の &#8220;&hellip;&#8221; 部分)、またはページ名"
1026
- "(&#8220;page=&hellip;&#8221; の &#8220;&hellip;&#8221; 部分)を指定し、検証対"
1027
- "象から除外します。"
1028
 
1029
- #: admin/includes/tab-settings.php:607 admin/includes/tab-settings.php:685
1030
- #: admin/includes/tab-settings.php:746
1031
  msgid "Exceptions"
1032
  msgstr "例外"
1033
 
1034
- #: admin/includes/tab-settings.php:608
1035
  msgid "Toggle with non logged-in user"
1036
  msgstr "未認証ユーザー用を含む項目に限定して表示する"
1037
 
1038
- #: admin/includes/tab-settings.php:611
1039
  msgid "Candidate actions/pages"
1040
- msgstr "候補&thinsp;アクション/ページ"
1041
 
1042
- #: admin/includes/tab-settings.php:625
1043
  #, php-format
1044
  msgid ""
1045
  "Regardless of the country code, it will block a malicious request to <code>"
1046
  "%s&ctdot;/*.php</code>."
1047
- msgstr ""
1048
- "国コードに拘らず、<code>%s&ctdot;/*.php</code>への悪意のあるリクエストを遮断し"
1049
- "ます。"
1050
 
1051
- #: admin/includes/tab-settings.php:626
1052
  msgid ""
1053
  "Select the item which causes unintended blocking in order to exclude from "
1054
  "the validation target. Grayed item indicates &#8220;INACTIVE&#8221;."
1055
  msgstr ""
1056
- "意図しない遮断の原因となる項目を選択し、検証対象から除外します。灰色で表示され"
1057
- "た項目は、「非アクティブ」であることを示しています。"
1058
 
1059
- #: admin/includes/tab-settings.php:627
1060
  #, php-format
1061
  msgid ""
1062
- "It configures &#8220;%s&#8221; to validate a request to the PHP file which "
1063
- "does not load WordPress core. Make sure to deny direct access to the hidden "
1064
- "files beginning with a dot by the server's configuration."
1065
  msgstr ""
1066
- "WordPressコアを読み込まないPHPファイルへのリクエストを検証対象とするため"
1067
- "に、%s を設定します。ドットで始まる隠しファイルへのアクセス拒否がサーバー側で"
1068
- "設定されていることを確認して下さい。"
1069
 
1070
- #: admin/includes/tab-settings.php:628
1071
  msgid "Sorry, but your server type is not supported."
1072
  msgstr "このサーバーではサポートされません。"
1073
 
1074
- #: admin/includes/tab-settings.php:664 admin/includes/tab-settings.php:725
 
 
 
 
 
 
1075
  msgid "Force to load WP core"
1076
  msgstr "WPコアの読み込みを強制"
1077
 
1078
- #: admin/includes/tab-settings.php:669
1079
  msgid "Plugins area"
1080
  msgstr "プラグイン領域"
1081
 
1082
- #: admin/includes/tab-settings.php:730
1083
  msgid "Themes area"
1084
  msgstr "テーマ領域"
1085
 
1086
- #: admin/includes/tab-settings.php:765
1087
  msgid "Front-end target settings"
1088
  msgstr "フロントエンドの設定"
1089
 
1090
- #: admin/includes/tab-settings.php:789
1091
  msgid "Follow &#8220;Validation rule settings&#8221;"
1092
  msgstr "[検証ルールの設定]に従う"
1093
 
1094
- #: admin/includes/tab-settings.php:851
1095
  #, php-format
1096
  msgid ""
1097
  "<dfn title=\"You can configure a different response code from the Back-end. "
1098
  "This is useful to prevent violation against your affiliate program."
1099
  "\">Response code</dfn> %s"
1100
  msgstr ""
1101
- "<dfn title=\"バックエンドと異なるレスポンス・コードを設定できます。これは、ア"
1102
- "フィリエイト・プログラムに対する違反を防止するのに役立つでしょう。\">レスポン"
1103
- "ス・コード</dfn> %s"
1104
 
1105
- #: admin/includes/tab-settings.php:917
1106
  msgid ""
1107
  "<dfn title=\"Specify the individual page as a blocking target.\">Page</dfn>"
1108
  msgstr "<dfn title=\"特定のページを遮断対象に指定します。\">ページ</dfn>"
1109
 
1110
- #: admin/includes/tab-settings.php:929
1111
  msgid ""
1112
  "<dfn title=\"Specify the individual post type on a single page as a blocking "
1113
  "target.\">Post type</dfn>"
1114
- msgstr ""
1115
- "<dfn title=\"特定の投稿タイプのシングルページを遮断対象に指定します。\">投稿タ"
1116
- "イプ</dfn>"
1117
 
1118
- #: admin/includes/tab-settings.php:941
1119
  msgid ""
1120
  "<dfn title=\"Specify the individual category on a single page or archive "
1121
  "page as a blocking target.\">Category</dfn>"
1122
  msgstr ""
1123
- "<dfn title=\"特定のカテゴリを含むシングルページかアーカイブページを遮断対象に"
1124
- "指定します。\">カテゴリ</dfn>"
1125
 
1126
- #: admin/includes/tab-settings.php:953
1127
  msgid ""
1128
  "<dfn title=\"Specify the individual tag on a single page or archive page as "
1129
  "a blocking target.\">Tag</dfn>"
1130
  msgstr ""
1131
- "<dfn title=\"特定のタグを含むシングルページかアーカイブページを遮断対象に指定"
1132
- "します。\">タグ</dfn>"
1133
 
1134
- #: admin/includes/tab-settings.php:968
1135
  msgid "Specify the validation target on front-end."
1136
  msgstr "フロントエンドの検証対象を設定します。"
1137
 
1138
- #: admin/includes/tab-settings.php:968
1139
  msgid "Validation target"
1140
  msgstr "検証対象"
1141
 
1142
- #: admin/includes/tab-settings.php:979
1143
  msgid "All requests"
1144
  msgstr "全てのリクエスト"
1145
 
1146
- #: admin/includes/tab-settings.php:980
1147
  msgid "Specify the targets"
1148
  msgstr "ターゲットを指定"
1149
 
1150
- #: admin/includes/tab-settings.php:983
1151
  msgid ""
1152
  "Notice that &#8220;Validation timing&#8221; is deferred till &#8220;"
1153
  "wp&#8221; action hook. It means that this feature would not be compatible "
1154
  "with any page caching."
1155
  msgstr ""
1156
- "[検証のタイミング]が &#8220;wp&#8221; アクション・フックまで遅延されます。こ"
1157
- "れにより、ページ・キャッシュとの互換性がなくなることに注意してください。"
 
 
 
 
1158
 
1159
- #: admin/includes/tab-settings.php:990
 
 
 
 
1160
  msgid ""
1161
  "<dfn title=\"Specify the frequency of request for certain period of time."
1162
  "\">Blocking condition</dfn>"
1163
  msgstr "<dfn title=\"特定期間のリクエスト頻度を設定します。\">遮断条件</dfn>"
1164
 
1165
- #: admin/includes/tab-settings.php:992
1166
  #, php-format
1167
  msgid "More than %1$s page view (PV) in %2$s seconds"
1168
- msgstr "%2$s 秒間に %1$s を超えるページビュー (PV)"
1169
 
1170
- #: admin/includes/tab-settings.php:1001
1171
  msgid ""
1172
  "<dfn title=\"It will validate the frequency of request.\">Block badly-"
1173
  "behaved bots and crawlers</dfn>"
1174
- msgstr ""
1175
- "<dfn title=\"リクエスト頻度を検証します。\">行儀の悪いボットやクローラーを遮断"
1176
- "</dfn>"
1177
 
1178
- #: admin/includes/tab-settings.php:1019
1179
  msgid ""
1180
  "A part of user agent string and a qualification connected with a separator "
1181
  "that indicates an applicable rule and can be &#8220;:&#8221; (pass) or "
@@ -1184,608 +1177,546 @@ msgid ""
1184
  "negative operator &#8220;!&#8221; can be placed just before a &#8220;"
1185
  "qualification&#8221;."
1186
  msgstr ""
1187
- "適用されるルールを表す記号(「:」は通過、「#」は遮断)で区切られたユーザーエー"
1188
- "ジェント文字列の一部と「条件」のペアです。「条件」には「DNS」、「FEED」、国"
1189
- "コード、または&nbsp;IPアドレス(CIDR記法)が使えます。また否定を表す記号「!」"
1190
- "を「条件」の直前に配置する事が出来ます。"
1191
 
1192
- #: admin/includes/tab-settings.php:1019
1193
  msgid "UA string and qualification"
1194
-
2
  # This file is distributed under the same license as the IP Geo Block package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: IP Geo Block 3.0.14\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/ip-geo-block\n"
7
+ "POT-Creation-Date: 2018-09-14 22:01+0900\n"
8
+ "PO-Revision-Date: 2018-09-14 22:03+0900\n"
9
  "Language-Team: \n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.1.1\n"
14
  "X-Poedit-KeywordsList: __;_e;_n;_x;esc_html_e;esc_html__;esc_attr_e;"
15
  "esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_x:1,2c;_n:1,2\n"
16
  "X-Poedit-Basepath: ..\n"
17
+ "Plural-Forms: nplurals=1; plural=0;\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
  "Last-Translator: tokkonopapa <tokkonopapa@yahoo.com>\n"
20
+ "Language: ja\n"
21
  "X-Poedit-SearchPath-0: .\n"
22
 
23
  #. Description of the plugin/theme
25
  "It blocks any spams, login attempts and malicious access to the admin area "
26
  "posted from outside your nation, and also prevents zero-day exploit."
27
  msgstr ""
28
+ "自国以外から投稿されるスパム、ログインフォーム、さらにゼロデイ攻撃を含む管理領域への悪意あるアクセスか"
29
+ "らサイトを守ります。"
30
 
31
+ #: admin/class-ip-geo-block-admin.php:290
32
+ msgid "Are you sure ?"
33
+ msgstr "実行してもよいですか?"
 
 
 
 
34
 
35
+ #: admin/class-ip-geo-block-admin.php:291
36
+ #: admin/class-ip-geo-block-admin.php:764
37
+ msgid "Open a new window"
38
+ msgstr "別窓で開く"
39
 
40
+ #: admin/class-ip-geo-block-admin.php:292 admin/includes/tab-settings.php:1514
41
+ msgid "Generate new link"
42
+ msgstr "新しいリンクを生成"
43
 
44
+ #: admin/class-ip-geo-block-admin.php:293 admin/includes/tab-settings.php:1515
45
+ msgid "Delete current link"
46
+ msgstr "生成したリンクを削除"
47
 
48
+ #: admin/class-ip-geo-block-admin.php:294
49
+ msgid ""
50
+ "Please add the following link to favorites / bookmarks in your browser : "
51
+ msgstr "次のリンクをブラウザのお気に入り/ブックマークに追加して下さい : "
52
 
53
+ #: admin/class-ip-geo-block-admin.php:295
54
  msgid "ajax for logged-in user"
55
  msgstr "認証済ユーザー用 ajax"
56
 
57
+ #: admin/class-ip-geo-block-admin.php:296
58
  msgid "ajax for non logged-in user"
59
  msgstr "未認証ユーザー用 ajax"
60
 
61
+ #: admin/class-ip-geo-block-admin.php:297
62
  #, php-format
63
  msgid "[Found: %d]"
64
  msgstr "[見つかった数:%d]"
65
 
66
+ #: admin/class-ip-geo-block-admin.php:298
67
  #, php-format
68
  msgid "Find and verify `%s` on &#8220;Logs&#8221; tab."
69
  msgstr "ログから `%s` を検索し、検証して下さい。"
70
 
71
+ #: admin/class-ip-geo-block-admin.php:299
72
  msgid "This feature is available with HTML5 compliant browsers."
73
  msgstr "HTML5準拠のブラウザでのみ機能します。"
74
 
75
+ #: admin/class-ip-geo-block-admin.php:300
76
  msgid "The selected row cannot be found in the visible area."
77
  msgstr "可視領域に選択された行が見つかりません。"
78
 
79
+ #: admin/class-ip-geo-block-admin.php:301
80
+ #: admin/class-ip-geo-block-admin.php:1541
81
  #, php-format
82
  msgid "An error occurred while executing the ajax command `%s`."
83
  msgstr "Ajaxコマンド `%s` の実行中にエラーが発生しました。"
84
 
85
+ #: admin/class-ip-geo-block-admin.php:305
86
  msgid "No data available in table"
87
  msgstr "テーブルにデータがありません"
88
 
89
+ #: admin/class-ip-geo-block-admin.php:306
90
  msgid "No matching records found"
91
  msgstr "一致するレコードがありません"
92
 
93
+ #: admin/class-ip-geo-block-admin.php:307
94
+ #: admin/includes/class-admin-ajax.php:107
95
+ #: admin/includes/class-admin-ajax.php:240
96
+ #: admin/includes/tab-geolocation.php:68
97
  msgid "IP address"
98
  msgstr "IPアドレス"
99
 
100
+ #: admin/class-ip-geo-block-admin.php:308
101
+ #: admin/includes/class-admin-ajax.php:108
102
+ #: admin/includes/class-admin-ajax.php:241
103
  msgid "Code"
104
  msgstr "国"
105
 
106
+ #: admin/class-ip-geo-block-admin.php:309
107
+ #: admin/includes/class-admin-ajax.php:109
108
+ #: admin/includes/class-admin-ajax.php:242
109
  msgid "ASN"
110
  msgstr "AS番号"
111
 
112
+ #: admin/class-ip-geo-block-admin.php:310
113
+ #: admin/includes/class-admin-ajax.php:243
114
  msgid "Host name"
115
  msgstr "ホスト名"
116
 
117
+ #: admin/class-ip-geo-block-admin.php:311
118
+ #: admin/includes/class-admin-ajax.php:110
119
+ #: admin/includes/class-admin-ajax.php:244
120
  msgid "Target"
121
  msgstr "検証対象"
122
 
123
+ #: admin/class-ip-geo-block-admin.php:312
124
+ #: admin/includes/class-admin-ajax.php:245
125
  msgid "Failure / Total"
126
  msgstr "ログイン失敗/総計"
127
 
128
+ #: admin/class-ip-geo-block-admin.php:313
129
+ #: admin/includes/class-admin-ajax.php:246
130
  msgid "Elapsed[sec]"
131
  msgstr "経過 [秒]"
132
 
133
+ #: admin/class-ip-geo-block-admin.php:314
134
+ #: admin/includes/class-admin-ajax.php:106
135
  msgid "Time"
136
  msgstr "日時"
137
 
138
+ #: admin/class-ip-geo-block-admin.php:315
139
+ #: admin/includes/class-admin-ajax.php:111
140
  msgid "Result"
141
  msgstr "検証結果"
142
 
143
+ #: admin/class-ip-geo-block-admin.php:316
144
+ #: admin/includes/class-admin-ajax.php:112
145
  msgid "Request"
146
  msgstr "リクエスト"
147
 
148
+ #: admin/class-ip-geo-block-admin.php:317
149
+ #: admin/includes/class-admin-ajax.php:113
150
  msgid "User agent"
151
  msgstr "ユーザー・エージェント"
152
 
153
+ #: admin/class-ip-geo-block-admin.php:318
154
+ #: admin/includes/class-admin-ajax.php:114
155
  msgid "HTTP headers"
156
  msgstr "HTTP ヘッダー"
157
 
158
+ #: admin/class-ip-geo-block-admin.php:319
159
+ #: admin/includes/class-admin-ajax.php:115
160
  msgid "$_POST data"
161
  msgstr "$_POST データ"
162
 
163
+ #: admin/class-ip-geo-block-admin.php:345
164
  msgid "Contribute on GitHub"
165
  msgstr "開発に参加"
166
 
167
+ #: admin/class-ip-geo-block-admin.php:359
168
+ #: admin/class-ip-geo-block-admin.php:477
169
+ #: admin/class-ip-geo-block-admin.php:706
170
  msgid "Settings"
171
  msgstr "設定"
172
 
173
+ #: admin/class-ip-geo-block-admin.php:454
 
 
 
 
174
  #: admin/class-ip-geo-block-admin.php:455
175
+ #: admin/class-ip-geo-block-admin.php:465
176
+ #: admin/class-ip-geo-block-admin.php:466
177
+ #: admin/class-ip-geo-block-admin.php:476
178
+ #: admin/class-ip-geo-block-admin.php:486
179
  msgid "IP Geo Block"
180
  msgstr "IP Geo Block"
181
 
182
+ #: admin/class-ip-geo-block-admin.php:487
183
+ #: admin/class-ip-geo-block-admin.php:711
184
  msgid "Site List"
185
  msgstr "サイト一覧"
186
 
187
+ #: admin/class-ip-geo-block-admin.php:515
188
  msgid "You need WordPress 3.7+."
189
+ msgstr "WordPress 3.7 以上が必要です。"
190
 
191
+ #: admin/class-ip-geo-block-admin.php:521
192
  #, php-format
193
  msgid ""
194
  "Now downloading geolocation databases in background. After a little while, "
195
  "please check your country code and &#8220;<strong>Matching rule</"
196
  "strong>&#8221; at <a href=\"%s\">Validation rule settings</a>."
197
  msgstr ""
198
+ "バックグラウンドで位置情報データベースをダウンロードしています。少しの間をおいた後、あなたの国コードと"
199
+ "[<strong>マッチング規則</strong>]を[<a href=\"%s\">検証ルールの設定</a>]で確認して下さい。"
 
200
 
201
+ #: admin/class-ip-geo-block-admin.php:527
202
  #, php-format
203
  msgid ""
204
  "The &#8220;<strong>Matching rule</strong>&#8221; is not set properly. Please "
205
  "confirm it at <a href=\"%s\">Validation rule settings</a>."
206
  msgstr ""
207
+ "[<strong>マッチング規則</strong>]が正しく設定されていません。[<a href=\"%s\">検証ルールの設定</a>]"
208
+ "を確認して下さい。"
209
 
210
+ #: admin/class-ip-geo-block-admin.php:536
211
  msgid "Local database and matching rule have been updated."
212
  msgstr "ローカル・データベースとマッチング規則を更新しました。"
213
 
214
+ #: admin/class-ip-geo-block-admin.php:547
215
  msgid ""
216
  "Once you logout, you will be unable to login again because the number of "
217
  "login attempts reaches the limit."
218
  msgstr ""
219
+ "あなたのIPアドレスのログイン試行可能回数がリミットに達したため、ログアウトすると再びログインする事が出"
220
+ "来なくなります。"
221
 
222
+ #: admin/class-ip-geo-block-admin.php:549
223
  #, php-format
224
  msgid ""
225
+ "Please remove your IP address in &#8220;%1$sStatistics in IP address cache"
226
+ "%2$s&#8221; on &#8220;%3$sStatistics%4$s&#8221; tab to prevent locking "
227
+ "yourself out."
228
  msgstr ""
229
+ "[%3$s統計%4$s]タブの[%1$sIPアドレスのキャッシュ%2$s]から自身のIPアドレスを削除し、ロックアウトを回"
230
+ "避してください。"
231
 
232
+ #: admin/class-ip-geo-block-admin.php:560
233
  msgid ""
234
  "Once you logout, you will be unable to login again because your country code "
235
  "or IP address is in the blacklist."
236
  msgstr ""
237
+ "あなたの国コードまたはIPアドレスがブラックリストに含まれているため、ログアウトすると再びログインする事"
238
+ "が出来なくなります。"
239
 
240
+ #: admin/class-ip-geo-block-admin.php:561
241
  msgid ""
242
  "Once you logout, you will be unable to login again because your country code "
243
  "or IP address is not in the whitelist."
244
  msgstr ""
245
+ "あなたの国コードまたはIPアドレスがホワイトリストに含まれていないため、ログアウトすると再びログインする"
246
+ "事が出来なくなります。"
247
 
248
+ #: admin/class-ip-geo-block-admin.php:565
249
  #, php-format
250
  msgid "Please check your &#8220;%sValidation rule settings%s&#8221;."
251
  msgstr "[%s検証ルールの設定%s]を確認して下さい。"
252
 
253
+ #: admin/class-ip-geo-block-admin.php:569
254
  #, php-format
255
  msgid ""
256
  "Please confirm your local geolocation databases at &#8220;%sLocal database "
257
  "settings%s&#8221; section and remove your IP address in cache at &#8220;"
258
  "%sStatistics in cache%s&#8221; section."
259
  msgstr ""
260
+ "[%sローカル・データベースの設定%s]で位置情報データベースを確認し、[%sキャッシュの統計%s]でキャッ"
261
+ "シュされているあなたのIPアドレスを削除して下さい。"
262
 
263
+ #: admin/class-ip-geo-block-admin.php:590
264
+ #, php-format
265
+ msgid ""
266
+ "Emergency login link is outdated. Please delete it once and generate again "
267
+ "at &#8220;%sPlugin settings%s&#8221; section. Also do not forget to update "
268
+ "favorites / bookmarks in your browser."
269
+ msgstr ""
270
+ "緊急ログイン・リンクが古くなっています。[%sプラグインの設定%s]で一度削除してから再度生成してくださ"
271
+ "い。 またブラウザのお気に入り/ブックマークも忘れずに更新して下さい。"
272
+
273
+ #: admin/class-ip-geo-block-admin.php:599
274
  msgid ""
275
  "&#8220;mu-plugins&#8221; (ip-geo-block-mu.php) at &#8220;Validation "
276
  "timing&#8221; is imcompatible with <strong>IP Geo Allow</strong>. Please "
277
  "select &#8220;init&#8221; action hook."
278
  msgstr ""
279
+ "[検証のタイミング]に「&#8220;mu-plugins&#8221; (ip-geo-block-mu.php)」が選択されていますが、"
280
+ "<strong>IP Geo Allow</strong> と互換性がありません。「&#8220;init&#8221; アクション・フック」を選択し"
281
+ "てください。"
282
 
283
+ #: admin/class-ip-geo-block-admin.php:707
284
  msgid "Statistics"
285
  msgstr "統計"
286
 
287
+ #: admin/class-ip-geo-block-admin.php:708
288
  msgid "Logs"
289
  msgstr "ログ"
290
 
291
+ #: admin/class-ip-geo-block-admin.php:709
292
  msgid "Search"
293
  msgstr "検索"
294
 
295
+ #: admin/class-ip-geo-block-admin.php:710
296
  msgid "Attribution"
297
  msgstr "リンク"
298
 
299
+ #: admin/class-ip-geo-block-admin.php:727
300
+ #: admin/class-ip-geo-block-admin.php:744
301
  msgid "Network wide"
302
  msgstr "ネットワーク管理"
303
 
304
+ #: admin/class-ip-geo-block-admin.php:757
305
  msgid "Toggle all"
306
  msgstr "全てを開閉"
307
 
308
+ #: admin/class-ip-geo-block-admin.php:760
309
  msgid ""
310
+ "Independent of &#8220;Privacy and record settings&#8221;, you can see all "
311
  "the requests validated by this plugin in almost real time."
312
  msgstr ""
313
+ "[プライバシーと記録の設定]にかかわらず、このプラグインによる検証結果のすべてを、ほぼリアルタイムに表"
314
+ "示します。"
315
 
316
+ #: admin/class-ip-geo-block-admin.php:760 admin/includes/tab-accesslog.php:38
317
  msgid "Live update"
318
  msgstr "ライブアップデート"
319
 
320
+ #: admin/class-ip-geo-block-admin.php:764
321
  msgid "Open a new window on clicking the link in the chart."
322
  msgstr "チャート内のリンクをクリックすると、新しいウィンドウが開きます。"
323
 
324
+ #: admin/class-ip-geo-block-admin.php:787
 
 
 
 
325
  msgid "Thanks for providing these great services for free."
326
  msgstr "これらのすばらしいサービスの提供元に、敬意と感謝の意を表します!"
327
 
328
+ #: admin/class-ip-geo-block-admin.php:788
329
  msgid ""
330
+ "(Most browsers will redirect you to each site <a href=\"https://www."
331
  "ipgeoblock.com/etc/referer.html\" title=\"Referer Checker\">without referrer "
332
  "when you click the link</a>.)"
333
  msgstr ""
334
+ "(ほとんどのブラウザでは、<a href=\"https://www.ipgeoblock.com/etc/referer.html\" title=\"Referer "
335
+ "Checker\">参照元を残さずにリンク先にリダイレクトできます</a>。)"
 
336
 
337
+ #: admin/class-ip-geo-block-admin.php:793
338
  msgid "Back to top"
339
  msgstr "トップに戻る"
340
 
341
+ #: admin/class-ip-geo-block-admin.php:885
342
  msgid "Enable"
343
  msgstr "有効"
344
 
345
+ #: admin/class-ip-geo-block-admin.php:900
346
  msgid "Select one"
347
  msgstr "何れかを選択"
348
 
349
+ #: admin/class-ip-geo-block-admin.php:1323
350
  msgid "You do not have sufficient permissions to access this page."
351
  msgstr "このページにアクセスするための十分な権限がありません。"
352
 
353
+ #: admin/class-ip-geo-block-admin.php:1350
354
  #: admin/includes/class-admin-rewrite.php:194
355
  #: classes/class-ip-geo-block-cron.php:217
356
  #: classes/class-ip-geo-block-cron.php:321
357
  #: classes/class-ip-geo-block-cron.php:395
358
+ #: classes/class-ip-geo-block-opts.php:464
359
  #, php-format
360
  msgid "Unable to write <code>%s</code>. Please check the permission."
361
  msgstr "<code>%s</code> に書き込めません。パーミッションをチェックして下さい。"
362
 
363
+ #: admin/class-ip-geo-block-admin.php:1380
364
  msgid "Settings saved."
365
  msgstr "設定を保存しました。"
366
 
368
  msgid "n/a"
369
  msgstr "利用不可"
370
 
371
+ #: admin/includes/class-admin-ajax.php:75 admin/includes/tab-settings.php:85
372
+ #: admin/includes/tab-settings.php:104
373
  msgid "UNKNOWN"
374
  msgstr "不明"
375
 
376
+ #: admin/includes/class-admin-ajax.php:201
377
  #, php-format
378
  msgid "The user %s (user ID: %d) is in use."
379
  msgstr "ユーザー %s(ユーザーID:%d)が使用中です。"
380
 
381
+ #: admin/includes/class-admin-ajax.php:494
382
  #, php-format
383
  msgid ""
384
  "illegal format at %s. Please delete the corresponding line and try again."
400
  #: admin/includes/class-admin-rewrite.php:234
401
  #, php-format
402
  msgid "&#8220;auto_prepend_file&#8221; already defined in %s."
403
+ msgstr "%s で既に「auto_prepend_file」が設定されています。"
404
 
405
  #: admin/includes/tab-accesslog.php:19
406
  msgid "Validation logs"
407
  msgstr "検証のログ"
408
 
409
+ #: admin/includes/tab-accesslog.php:19 admin/includes/tab-settings.php:18
 
410
  msgid "Help"
411
  msgstr "ヘルプ"
412
 
413
+ #: admin/includes/tab-accesslog.php:53 admin/includes/tab-settings.php:414
414
  msgid "Comment post"
415
  msgstr "コメント投稿"
416
 
417
+ #: admin/includes/tab-accesslog.php:54 admin/includes/tab-settings.php:415
418
  msgid "XML-RPC"
419
  msgstr "XML-RPC"
420
 
421
+ #: admin/includes/tab-accesslog.php:55 admin/includes/tab-settings.php:416
422
  msgid "Login form"
423
  msgstr "ログイン・フォーム"
424
 
425
+ #: admin/includes/tab-accesslog.php:56 admin/includes/tab-settings.php:417
426
  msgid "Admin area"
427
  msgstr "管理領域"
428
 
429
+ #: admin/includes/tab-accesslog.php:57 admin/includes/tab-settings.php:419
430
  msgid "Public facing pages"
431
  msgstr "一般公開ページ"
432
 
433
+ #: admin/includes/tab-accesslog.php:60 admin/includes/tab-network.php:75
434
  msgid "All"
435
  msgstr "全て"
436
 
437
+ #: admin/includes/tab-accesslog.php:69
438
  msgid "Select target"
439
  msgstr "対象を選択"
440
 
441
+ #: admin/includes/tab-accesslog.php:84
442
  msgid "Search in logs"
443
  msgstr "ログを検索"
444
 
445
+ #: admin/includes/tab-accesslog.php:93 admin/includes/tab-statistics.php:232
446
  msgid "Reset"
447
  msgstr "リセット"
448
 
449
+ #: admin/includes/tab-accesslog.php:100 admin/includes/tab-statistics.php:238
450
  msgid "Bulk action"
451
  msgstr "選択して実行"
452
 
453
+ #: admin/includes/tab-accesslog.php:111 admin/includes/tab-statistics.php:249
454
  msgid "Remove entries by IP address"
455
  msgstr "指定のIPアドレスでエントリを削除"
456
 
457
+ #: admin/includes/tab-accesslog.php:112 admin/includes/tab-statistics.php:250
458
  msgid "Add IP address to &#8220;Whitelist&#8221;"
459
  msgstr "IPアドレスをホワイトリストへ追加"
460
 
461
+ #: admin/includes/tab-accesslog.php:113 admin/includes/tab-statistics.php:251
462
  msgid "Add IP address to &#8220;Blacklist&#8221;"
463
  msgstr "IPアドレスをブラックリストへ追加"
464
 
465
+ #: admin/includes/tab-accesslog.php:114 admin/includes/tab-statistics.php:252
466
  msgid "Add AS number to &#8220;Whitelist&#8221;"
467
  msgstr "AS番号をホワイトリストへ追加"
468
 
469
+ #: admin/includes/tab-accesslog.php:115 admin/includes/tab-statistics.php:253
470
  msgid "Add AS number to &#8220;Blacklist&#8221;"
471
  msgstr "AS番号をブラックリストへ追加"
472
 
473
+ #: admin/includes/tab-accesslog.php:117 admin/includes/tab-network.php:56
474
+ #: admin/includes/tab-statistics.php:255
475
  msgid "Apply"
476
  msgstr "実行する"
477
 
478
+ #: admin/includes/tab-accesslog.php:124 admin/includes/tab-statistics.php:191
479
  msgid "Clear logs"
480
  msgstr "ログをクリア"
481
 
482
+ #: admin/includes/tab-accesslog.php:132 admin/includes/tab-statistics.php:167
483
+ #: admin/includes/tab-statistics.php:199 admin/includes/tab-statistics.php:269
484
  msgid "Clear all"
485
  msgstr "全てをクリア"
486
 
487
+ #: admin/includes/tab-accesslog.php:141
488
  msgid "Export logs"
489
  msgstr "ログをエクスポート"
490
 
491
+ #: admin/includes/tab-accesslog.php:147 admin/includes/tab-settings.php:1548
492
+ #: admin/includes/tab-statistics.php:283
493
  msgid "Export to the local file"
494
  msgstr "ローカル・ファイルへエクスポートする"
495
 
496
+ #: admin/includes/tab-accesslog.php:147 admin/includes/tab-statistics.php:283
497
  msgid "Export csv"
498
  msgstr "CSVへエクスポート"
499
 
500
+ #: admin/includes/tab-accesslog.php:168 admin/includes/tab-network.php:112
501
+ #: admin/includes/tab-statistics.php:413
502
  #, php-format
503
+ msgid "[ %sRecord &#8220;Validation logs&#8221;%s ] is disabled."
504
  msgstr "[%s検証のログを記録%s]が無効です。"
505
 
506
+ #: admin/includes/tab-accesslog.php:169 admin/includes/tab-network.php:113
507
+ #: admin/includes/tab-statistics.php:414
508
  msgid ""
509
  "Please set the proper condition to record and analyze the validation logs."
510
  msgstr "検証のログを記録し分析するためには、適切な条件を設定して下さい。"
511
 
512
+ #: admin/includes/tab-attribution.php:13
513
  msgid "Attribution links"
514
  msgstr "リンク"
515
 
517
  msgid "Search IP address geolocation"
518
  msgstr "IPアドレスの位置情報を検索"
519
 
520
+ #: admin/includes/tab-geolocation.php:41
521
+ msgid "Geolocation API"
522
+ msgstr "位置情報API"
523
 
524
+ #: admin/includes/tab-geolocation.php:83 admin/includes/tab-settings.php:1085
525
  msgid ""
526
+ "<dfn title=\"IP address is always encrypted on recording in Cache and Logs. "
527
+ "Moreover, this option replaces the end of IP address with &#8220;***&#8221; "
528
+ "to make it anonymous.\">Anonymize IP address</dfn>"
 
529
  msgstr ""
530
+ "<dfn title=\"IPアドレスは、常に暗号化されてキャッシュとログに記録されます。このオプションはさらに、IP"
531
+ "アドレスの末尾を「***」に置き換えて匿名化します。\">IPアドレスを匿名化する</dfn>"
 
 
532
 
533
+ #: admin/includes/tab-geolocation.php:98
534
+ msgid "Search geolocation"
535
  msgstr "位置情報の検索"
536
 
537
+ #: admin/includes/tab-geolocation.php:106
538
  msgid "Search now"
539
  msgstr "今すぐ検索"
540
 
550
  msgid "Columns"
551
  msgstr "列数"
552
 
553
+ #: admin/includes/tab-network.php:61
554
  msgid "Chart display layout"
555
  msgstr "チャートの表示レイアウト"
556
 
557
+ #: admin/includes/tab-network.php:76
558
  msgid "Latest 1 hour"
559
  msgstr "最新の1時間"
560
 
561
+ #: admin/includes/tab-network.php:77
562
  msgid "Latest 24 hours"
563
  msgstr "最新の24時間"
564
 
565
+ #: admin/includes/tab-network.php:78
566
  msgid "Latest 1 week"
567
  msgstr "最新の1週間"
568
 
569
+ #: admin/includes/tab-network.php:90
570
  msgid "Duration to retrieve"
571
  msgstr "取得する期間"
572
 
573
+ #: admin/includes/tab-settings.php:14
574
+ msgid "(comma separated)"
575
+ msgstr "(カンマ区切り)"
576
+
577
+ #: admin/includes/tab-settings.php:15
578
+ msgid "(comma or RET separated)"
579
+ msgstr "(カンマ、改行区切り)"
580
+
581
+ #: admin/includes/tab-settings.php:16
582
+ msgid "Toggle selection"
583
+ msgstr "選択を切り替える"
584
+
585
+ #: admin/includes/tab-settings.php:17
586
+ msgid "Find blocked requests in &#8220;Logs&#8220;"
587
+ msgstr "ログから遮断されたリクエストを検索する"
588
+
589
+ #: admin/includes/tab-settings.php:19
590
+ msgid ""
591
+ "Before adding as &#8220;Exception&#8221;, please click on &#8220;<a class="
592
+ "\"ip-geo-block-icon ip-geo-block-icon-alert\" title=\"This button is just a "
593
+ "sample.\"><span></span></a>&#8221; button (if exists) attached to the "
594
+ "following list to confirm that the blocked request is not malicious."
595
+ msgstr ""
596
+ "[例外]に追加する前に、以下の候補に付いたボタン &#8220;<a class=\"ip-geo-block-icon ip-geo-block-"
597
+ "icon-alert\" title=\"このボタンは単なるサンプルです。\"><span></span></a>&#8221;(もしあれば)をクリッ"
598
+ "クし、遮断されたリクエストに悪意のないことを確認して下さい。"
599
+
600
+ #: admin/includes/tab-settings.php:20
601
+ msgid "Open CIDR calculator for IPv4 / IPv6."
602
+ msgstr "IPv4/IPv6用CIDR変換電卓を開きます。"
603
+
604
+ #: admin/includes/tab-settings.php:55
605
  msgid "Validation rule settings"
606
  msgstr "検証ルールの設定"
607
 
608
+ #: admin/includes/tab-settings.php:77
609
  msgid ""
610
  "<dfn title=\"You can confirm the appropriate Geolocation APIs and country "
611
  "code by referring &#8220;Scan country code&#8221;.\">Your IP address / "
612
  "Country</dfn>"
613
  msgstr ""
614
+ "<dfn title=\"[国コードを検索する]を参照し、適切な位置情報APIと国コードを設定して下さい。\">あなたの"
615
+ "IPアドレス / 国コード</dfn>"
616
 
617
+ #: admin/includes/tab-settings.php:86 admin/includes/tab-settings.php:105
618
  msgid "Scan all the APIs you selected at Geolocation API settings"
619
  msgstr "選択された位置情報APIを検索します"
620
 
621
+ #: admin/includes/tab-settings.php:86 admin/includes/tab-settings.php:105
622
  msgid "Scan country code"
623
  msgstr "国コードを検索する"
624
 
625
+ #: admin/includes/tab-settings.php:96
626
  msgid ""
627
  "<dfn title=\"You can confirm the appropriate Geolocation APIs and country "
628
  "code by referring &#8220;Scan country code&#8221;.\">Server IP address / "
629
  "Country</dfn>"
630
  msgstr ""
631
+ "<dfn title=\"[国コードを検索する]を参照し、適切な位置情報APIと国コードを設定して下さい。\">サーバー"
632
+ "IPアドレス / 国コード</dfn>"
633
 
634
+ #: admin/includes/tab-settings.php:113
635
  msgid "Whitelist"
636
  msgstr "ホワイトリスト"
637
 
638
+ #: admin/includes/tab-settings.php:114
639
  msgid "Blacklist"
640
  msgstr "ブラックリスト"
641
 
642
+ #: admin/includes/tab-settings.php:118
643
  msgid ""
644
  "Please select either &#8220;Whitelist&#8221; or &#8220;Blacklist&#8221;."
645
+ msgstr "「ホワイトリスト」または「ブラックリスト」のどちらかを選択してください。"
 
646
 
647
+ #: admin/includes/tab-settings.php:119
648
  msgid ""
649
  "<dfn title=\"&#8220;Block by country&#8221; will be bypassed in case of "
650
  "empty. The special code &#8220;XX&#8221; is assigned as private IP address "
653
  "the code that does not correspond to any of the countries.\">Whitelist of "
654
  "country code</dfn>"
655
  msgstr ""
656
+ "<dfn title=\"空欄の場合、「国コードで遮断」はバイパスされます。特別なコード「XX」は、localhost を含む"
657
+ "プライベート・アドレスに割り当てられ、また「ZZ」は不明(位置情報データベースに未登録)を表します。どの"
658
+ "国にもマッチさせないことが必要な場合には、「YY」を指定してください。\">国コードのホワイトリスト</dfn>"
 
 
659
 
660
+ #: admin/includes/tab-settings.php:120
661
  msgid ""
662
  "<dfn title=\"&#8220;Block by country&#8221; will be bypassed in case of "
663
  "empty. The special code &#8220;XX&#8221; is assigned as private IP address "
666
  "the code that does not correspond to any of the countries.\">Blacklist of "
667
  "country code</dfn>"
668
  msgstr ""
669
+ "<dfn title=\"空欄の場合、「国コードで遮断」はバイパスされます。特別なコード「XX」は、localhost を含む"
670
+ "プライベート・アドレスに割り当てられ、また「ZZ」は不明(位置情報データベースに未登録)を表します。どの"
671
+ "国にもマッチさせないことが必要な場合には、「YY」を指定してください。\">国コードのブラックリスト</dfn>"
 
 
 
 
 
 
672
 
673
+ #: admin/includes/tab-settings.php:126 admin/includes/tab-settings.php:791
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
  msgid "Matching rule"
675
  msgstr "マッチング規則"
676
 
677
+ #: admin/includes/tab-settings.php:138
678
  msgid ""
679
  "A request from which the country code or IP address is <strong>NOT</strong> "
680
  "in the whitelist will be blocked."
681
  msgstr ""
682
+ "国コードまたはIPアドレスがホワイトリストに<strong>含まれていない</strong>リクエストを遮断します。"
 
683
 
684
+ #: admin/includes/tab-settings.php:139
685
  msgid ""
686
  "A request from which the country code or IP address is in the blacklist will "
687
  "be blocked."
688
+ msgstr "国コードまたはIPアドレスがブラックリストに<strong>含まれている</strong>リクエストを遮断します。"
 
 
689
 
690
+ #: admin/includes/tab-settings.php:181
691
  msgid ""
692
  "<dfn title=\"It enables utilizing &#8220;AS number&#8221; in the &#8220;"
693
  "Whitelist/Blacklist of extra IP addresses&#8221; to specify a group of IP "
694
  "networks.\">Use Autonomous System Number</dfn>"
695
  msgstr ""
696
+ "<dfn title=\"ホワイトリスト、ブラックリストにIPアドレスを指定する代わりに、ネットワークのグループを代"
697
+ "表する「AS番号」の指定を可能にします。\">AS番号を使用可能にする</dfn>"
 
698
 
699
+ #: admin/includes/tab-settings.php:192
700
  #, php-format
701
  msgid "Some useful tools to find ASN are introduced in &#8220;%s&#8221;."
702
  msgstr "AS番号の検索に役立つツールを &#8220;%s&#8221; に紹介しています。"
703
 
704
+ #: admin/includes/tab-settings.php:199
705
  msgid ""
706
  "<dfn title=\"e.g. &#8220;192.0.64.0/18&#8221; for Jetpack server, "
707
  "&#8220;69.46.36.0/27&#8221; for WordFence server or &#8220;AS32934&#8221; "
708
  "for Facebook.\">Whitelist of extra IP addresses prior to country code</dfn>"
709
  msgstr ""
710
+ "<dfn title=\"例)192.0.64.0/18(Jetpackサーバー)、69.46.36.0/27(WordFenceサーバー)、"
711
+ "AS32934(Facebook)\">国コードに優先して検証するIPアドレスのホワイトリスト</dfn>"
 
712
 
713
+ #: admin/includes/tab-settings.php:220
714
  msgid ""
715
  "<dfn title=\"Server level access control is recommended (e.g. .htaccess)."
716
  "\">Blacklist of extra IP addresses prior to country code</dfn>"
717
  msgstr ""
718
+ "<dfn title=\"サーバー・レベルのアクセス制御の使用をお勧めします(例:.htaccess)。\">国コードに優先し"
719
+ "て検証するIPアドレスのブラックリスト</dfn>"
720
 
721
+ #: admin/includes/tab-settings.php:241
722
  msgid ""
723
  "<dfn title=\"If your server is placed behind the proxy server or the load "
724
  "balancing server, you need to put the appropriate key such as &#8220;"
726
  "that to retrieve the client IP address.\">$_SERVER keys to retrieve extra IP "
727
  "addresses</dfn>"
728
  msgstr ""
729
+ "<dfn title=\"あなたのサーバーがプロキシー・サーバーやロード・バランサーの背後に位置する場合は、クライ"
730
+ "アントのIPアドレスを抽出するため「HTTP_X_FORWARDED_FOR」や「HTTP_X_REAL_IP」など、$_SERVER の適切な"
731
+ "キーを指定してください。\">IPアドレスを追加抽出する $_SERVER のキー</dfn>"
 
 
732
 
733
+ #: admin/includes/tab-settings.php:259
734
  msgid ""
735
  "<dfn title=\"It validates malicious signatures independently of &#8220;Block "
736
  "by country&#8221; and &#8220;Prevent Zero-day Exploit&#8221; for the target "
740
  "block-decode\" title=\"When you find ugly character string in the text area, "
741
  "please click to restore.\"><span></span></a>)</nobr>"
742
  msgstr ""
743
+ "<dfn title=\"「国コードで遮断」および「ゼロデイ攻撃を遮断」とは独立に、[管理領域]、[管理領域 ajax/"
744
+ "post]、[プラグイン領域]、[テーマ領域]をターゲットとした悪意のあるシグネチャを検証します。\">悪意"
745
+ "のあるシグネチャ</dfn> <nobr>(<a class=\"ip-geo-block-icon ip-geo-block-icon-cycle\" id=\"ip-geo-"
746
+ "block-decode\" title=\"文字化けした場合、クリックして復元して下さい。\"><span></span></a>)</nobr>"
 
 
747
 
748
+ #: admin/includes/tab-settings.php:273
749
  msgid ""
750
  "<dfn title=\"Select allowed MIME type.\">Whitelist of allowed MIME type</dfn>"
751
+ msgstr "<dfn title=\"許可する MIME タイプを指定します。\">許可する MIME タイプのホワイトリスト</dfn>"
 
 
752
 
753
+ #: admin/includes/tab-settings.php:284
754
  msgid ""
755
  "<dfn title=\"Put forbidden file extensions.\">Blacklist of forbidden file "
756
  "extensions</dfn>"
757
  msgstr ""
758
+ "<dfn title=\"禁止するファイルの拡張子を設定します。\">禁止するファイル拡張子のブラックリスト</dfn>"
 
759
 
760
+ #: admin/includes/tab-settings.php:288
761
  msgid ""
762
  "<dfn title=\"Specify the capabilities to be verified. Depending on the "
763
  "particular type of uploader, certain capability may be required. Default is "
764
  "&#8220;upload_files&#8221; for Administrator, Editor and Author. This "
765
  "verification will be skipped if empty.\">Capabilities to be verified</dfn>"
766
  msgstr ""
767
+ "<dfn title=\"検証する権限を指定します。アップローダーによっては、特定の権限を必要とする場合がありま"
768
+ "す。デフォルトは、管理者(Administrator)、編集者(Editor)、投稿者(Author)向けの「upload_files」で"
769
+ "す。空欄の場合、この検証はスキップされます。\">検証する権限</dfn>"
 
770
 
771
+ #: admin/includes/tab-settings.php:288
772
  msgid ""
773
+ "( See &#8220;<a rel=\"noreferrer\" href=\"https://codex.wordpress.org/"
774
  "Roles_and_Capabilities\" title=\"Roles and Capabilities &laquo; WordPress "
775
+ "Codex\">Roles and Capabilities</a>&#8221; )"
776
  msgstr ""
777
+ "(&#8220;<a rel=\"noreferrer\" href=\"https://wpdocs.osdn.jp/%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC"
778
+ "%E3%81%AE%E7%A8%AE%E9%A1%9E%E3%81%A8%E6%A8%A9%E9%99%90\" title=\"ユーザーの種類と権限 - WordPress "
779
+ "Codex 日本語版\">ユーザーの種類と権限</a>&#8220; を参照)"
 
780
 
781
+ #: admin/includes/tab-settings.php:294
782
  msgid ""
783
  "<dfn title=\"It restricts the file types on upload in order to block malware "
784
  "and backdoor via both back-end and front-end. Please consider to select "
786
  "timing&#8221; so that other staff would not fetch the uploaded files before "
787
  "this validation.\">Prevent malicious file uploading</dfn>"
788
  msgstr ""
789
+ "<dfn title=\"ファイル・タイプを限定し、バックエンド、またはフロントエンドを経由するマルウェアやバック"
790
+ "ドアのアップロードを遮断します。他のプラグインやテーマに先んじて確実に遮断するために、[検証のタイミン"
791
+ "グ]を「&#8220;mu-plugins&#8221; (ip-geo-block-mu.php)」に設定することを検討してください。\">悪意のあ"
792
+ "るアップロード防止</dfn>"
 
793
 
794
+ #: admin/includes/tab-settings.php:305 admin/includes/tab-settings.php:480
795
+ #: admin/includes/tab-settings.php:625 admin/includes/tab-settings.php:1190
796
  msgid "Disable"
797
  msgstr "無効"
798
 
799
+ #: admin/includes/tab-settings.php:306
800
  msgid "Verify file extension and MIME type"
801
+ msgstr "拡張子と MIME タイプを検証"
802
 
803
+ #: admin/includes/tab-settings.php:307
804
  msgid "Verify file extension only"
805
  msgstr "ファイル拡張子のみを検証"
806
 
807
+ #: admin/includes/tab-settings.php:316
808
  #, php-format
809
  msgid ""
810
  "<dfn title=\"You can put your original 403.php and so on into your theme "
811
  "directory.\">Response code</dfn> %s"
812
  msgstr ""
813
+ "<dfn title=\"テーマ・ディレクトリには 403.php など、独自のファイルを設置する事が出来ます。\">レスポン"
814
+ "ス・コード</dfn> %s"
815
 
816
+ #: admin/includes/tab-settings.php:345 admin/includes/tab-settings.php:874
817
  msgid ""
818
  "<dfn title=\"Specify the URL for response code 2xx and 3xx. If it is pointed "
819
  "to a public facing page, visitors would not be blocked on the page to "
821
  "[Front-end target settings] section. Empty URL is altered to your home."
822
  "\">Redirect URL</dfn>"
823
  msgstr ""
824
+ "<dfn title=\"レスポンス・コード 2xx3xx 用のリダイレクト先 URL を指定します。リダイレクトのループを"
825
+ "避けるため、自サイト内の URL は[フロントエンドの設定]に関わらず遮断の対象外となります。空欄の場合、"
826
+ "サイトのホームが使用されます。\">リダイレクト先 URL</dfn>"
 
 
827
 
828
+ #: admin/includes/tab-settings.php:362 admin/includes/tab-settings.php:892
829
  msgid ""
830
  "<dfn title=\"Specify the message for response code 4xx and 5xx.\">Response "
831
  "message</dfn>"
832
  msgstr ""
833
+ "<dfn title=\"レスポンス・コード 4xx、5xx 用のメッセージを指定します。\">レスポンス・メッセージ</dfn>"
 
834
 
835
+ #: admin/includes/tab-settings.php:380
 
 
 
 
 
 
 
 
 
 
 
836
  msgid "Select when to run the validation."
837
  msgstr "検証を実行するタイミングを選択します。"
838
 
839
+ #: admin/includes/tab-settings.php:380
840
  msgid "Validation timing"
841
  msgstr "検証のタイミング"
842
 
843
+ #: admin/includes/tab-settings.php:391
844
  msgid "&#8220;init&#8221; action hook"
845
  msgstr "&#8220;init&#8221; アクション・フック"
846
 
847
+ #: admin/includes/tab-settings.php:392
848
  msgid "&#8220;mu-plugins&#8221; (ip-geo-block-mu.php)"
849
  msgstr "&#8220;mu-plugins&#8221; (ip-geo-block-mu.php)"
850
 
851
+ #: admin/includes/tab-settings.php:395
852
  msgid ""
853
  "Validate at &#8220;init&#8221; action hook in the same manner as typical "
854
  "plugins."
855
+ msgstr "標準的な他のプラグインと同様、init アクション・フックのタイミングで検証を実行します。"
 
 
856
 
857
+ #: admin/includes/tab-settings.php:396
858
  msgid ""
859
  "Validate at an earlier phase than other typical plugins. It can reduce load "
860
+ "on server but has <a rel='noreferrer' href='https://www.ipgeoblock.com/codex/"
861
  "validation-timing.html' title='Validation timing | IP Geo Block'>some "
862
  "restrictions</a>."
863
  msgstr ""
864
+ "標準的な他のプラグインより早いタイミングで検証を実行します。これによりサーバーの負荷は軽減されますが、"
865
+ "<a rel=‘noreferrer href=‘https://www.ipgeoblock.com/codex/validation-timing.html' title=‘Validation "
866
+ "timing | IP Geo Block’>幾つかの制限事項</a> が生じます。"
 
867
 
868
+ #: admin/includes/tab-settings.php:406
869
  msgid "Back-end target settings"
870
  msgstr "バックエンドの設定"
871
 
872
+ #: admin/includes/tab-settings.php:412
873
  #, php-format
874
  msgid "<dfn title=\"Validate request to %s.\">%s</dfn>"
875
  msgstr "<dfn title=\"%s へのリクエストを検証します。\">%s</dfn>"
876
 
877
+ #: admin/includes/tab-settings.php:418
878
  msgid "Other areas"
879
  msgstr "その他の領域"
880
 
881
+ #: admin/includes/tab-settings.php:419
882
  msgid "public facing pages"
883
  msgstr "一般公開ページ"
884
 
885
+ #: admin/includes/tab-settings.php:435 admin/includes/tab-settings.php:481
886
+ #: admin/includes/tab-settings.php:513 admin/includes/tab-settings.php:519
887
  #: admin/includes/tab-settings.php:784
888
  msgid "Block by country"
889
  msgstr "国コードで遮断"
890
 
891
+ #: admin/includes/tab-settings.php:445
892
+ msgid "The whole will be wrapped by &lt;p&gt; tag. Allowed tags: "
893
+ msgstr "全体を &lt;p&gt; タグで囲みます。使用可能タグ:"
894
+
895
+ #: admin/includes/tab-settings.php:445
896
+ msgid "Message on comment form"
897
+ msgstr "投稿フォーム上のメッセージ"
898
+
899
+ #: admin/includes/tab-settings.php:458
900
+ msgid "None"
901
+ msgstr "なし"
902
+
903
+ #: admin/includes/tab-settings.php:459
904
+ msgid "Top"
905
+ msgstr "上部"
906
+
907
+ #: admin/includes/tab-settings.php:460
908
+ msgid "Bottom"
909
+ msgstr "下部"
910
+
911
+ #: admin/includes/tab-settings.php:482
912
  msgid "Completely close"
913
  msgstr "完全に閉鎖"
914
 
915
+ #: admin/includes/tab-settings.php:488
916
  msgid "Action to login as a registered user."
917
  msgstr "登録済みユーザーとしてログインするアクション。"
918
 
919
+ #: admin/includes/tab-settings.php:488
920
  msgid "Log in"
921
  msgstr "ログイン"
922
 
923
+ #: admin/includes/tab-settings.php:489
924
  msgid "Action to register new users."
925
  msgstr "新規ユーザーを登録するアクション。"
926
 
927
+ #: admin/includes/tab-settings.php:489
928
  msgid "Register"
929
  msgstr "登録"
930
 
931
+ #: admin/includes/tab-settings.php:490
932
  msgid "Action to reset a password to create a new one."
933
  msgstr "パスワードをリセットし、新しいパスワードに更新するアクション。"
934
 
935
+ #: admin/includes/tab-settings.php:490
936
  msgid "Password Reset"
937
  msgstr "パスワードのリセット"
938
 
939
+ #: admin/includes/tab-settings.php:491
940
  msgid "Action to email a password to a registered user."
941
  msgstr "登録済みユーザーにパスワードを送付するアクション。"
942
 
943
+ #: admin/includes/tab-settings.php:491
944
  msgid "Lost Password"
945
  msgstr "パスワード紛失"
946
 
947
+ #: admin/includes/tab-settings.php:492
948
  msgid ""
949
  "Action to show prompt to enter a password on password protected post and "
950
  "page."
951
+ msgstr "パスワードで保護された投稿とページにパスワードを入力するプロンプトを表示するアクション。"
 
 
952
 
953
+ #: admin/includes/tab-settings.php:492
954
  msgid "Password protected"
955
  msgstr "パスワード保護"
956
 
957
+ #: admin/includes/tab-settings.php:514
958
  msgid ""
959
  "<dfn title=\"Specify the individual action as a blocking target.\">Target "
960
  "actions</dfn>"
961
+ msgstr "<dfn title=\"遮断対象とするアクションを指定します。\">対象アクション</dfn>"
 
962
 
963
+ #: admin/includes/tab-settings.php:520
964
  msgid "Prevent Zero-day Exploit"
965
  msgstr "ゼロデイ攻撃を遮断"
966
 
967
+ #: admin/includes/tab-settings.php:524
968
  msgid ""
969
  "It will block a request related to the services for both public facing pages "
970
  "and the dashboard."
971
+ msgstr "一般公開ページとダッシュボード向けサービスに関連するリクエストを遮断します。"
 
972
 
973
+ #: admin/includes/tab-settings.php:525
974
  msgid ""
975
  "Regardless of the country code, it will block a malicious request related to "
976
  "the services only for the dashboard."
977
+ msgstr "国コードに拘らず、ダッシュボード向けサービスだけに関連する悪意のあるリクエストを遮断します。"
978
+
979
+ #: admin/includes/tab-settings.php:531
980
+ msgid ""
981
+ "This is applied to &#8220;XML-RPC&#8221; and &#8220;Login form&#8221; when "
982
+ "&#8220;IP address cache&#8221; in &#8220;Privacy and record settings&#8221; "
983
+ "section is enabled. Lockout period is the same as expiration time of the "
984
+ "cache."
985
  msgstr ""
986
+ "[プライバシーと記録の設定]&raquo;[IPアドレスのキャッシュを記録]が有効の時、[XML-RPC]と[ログイ"
987
+ "ン・フォーム]に適用されます。ロックアウト時間は[有効時間]で定義します。"
988
 
989
+ #: admin/includes/tab-settings.php:531
990
+ msgid "Max failed login attempts per IP address"
991
+ msgstr "IPアドレス当たりのログイン試行可能回数"
992
+
993
+ #: admin/includes/tab-settings.php:572
994
  msgid "admin post for logged-in user"
995
  msgstr "認証済ユーザー用 admin post"
996
 
997
+ #: admin/includes/tab-settings.php:573
998
  msgid "admin post for non logged-in user"
999
  msgstr "未認証ユーザー用 admin post"
1000
 
1001
+ #: admin/includes/tab-settings.php:595
1002
  msgid "Admin ajax/post"
1003
+ msgstr "管理領域 ajax/post"
1004
 
1005
+ #: admin/includes/tab-settings.php:609
1006
  msgid ""
1007
  "Specify the action name (&#8220;action=&hellip;&#8221;) or the page name "
1008
  "(&#8220;page=&hellip;&#8221;) to prevent unintended blocking caused by "
1009
  "&#8220;Block by country&#8221; (for non logged-in user) and &#8220;Prevent "
1010
  "Zero-day Exploit&#8221; (for logged-in user)."
1011
  msgstr ""
1012
+ "「国コードで遮断」(未認証ユーザーの場合)および「ゼロデイ攻撃を遮断」(認証済みユーザーの場合)が、意"
1013
+ "図しない遮断の原因となる場合、アクション名(&#8220;action=&hellip;&#8221; の &#8220;&hellip;&#8221; 部"
1014
+ "分)、またはページ名(&#8220;page=&hellip;&#8221; の &#8220;&hellip;&#8221; 部分)を指定し、検証対象か"
1015
+ "ら除外します。"
 
1016
 
1017
+ #: admin/includes/tab-settings.php:609 admin/includes/tab-settings.php:687
1018
+ #: admin/includes/tab-settings.php:747
1019
  msgid "Exceptions"
1020
  msgstr "例外"
1021
 
1022
+ #: admin/includes/tab-settings.php:610
1023
  msgid "Toggle with non logged-in user"
1024
  msgstr "未認証ユーザー用を含む項目に限定して表示する"
1025
 
1026
+ #: admin/includes/tab-settings.php:613
1027
  msgid "Candidate actions/pages"
1028
+ msgstr "候補 アクション/ページ"
1029
 
1030
+ #: admin/includes/tab-settings.php:627
1031
  #, php-format
1032
  msgid ""
1033
  "Regardless of the country code, it will block a malicious request to <code>"
1034
  "%s&ctdot;/*.php</code>."
1035
+ msgstr "国コードに拘らず、<code>%s&ctdot;/*.php</code>への悪意のあるリクエストを遮断します。"
 
 
1036
 
1037
+ #: admin/includes/tab-settings.php:628
1038
  msgid ""
1039
  "Select the item which causes unintended blocking in order to exclude from "
1040
  "the validation target. Grayed item indicates &#8220;INACTIVE&#8221;."
1041
  msgstr ""
1042
+ "意図しない遮断の原因となる項目を選択し、検証対象から除外します。灰色で表示された項目は、「非アクティ"
1043
+ "ブ」であることを示しています。"
1044
 
1045
+ #: admin/includes/tab-settings.php:629
1046
  #, php-format
1047
  msgid ""
1048
+ "It configures &#8220;%s&#8221; to validate a direct request to the PHP file "
1049
+ "which does not load WordPress core. Make sure to deny direct access to the "
1050
+ "hidden files beginning with a dot by the server's configuration."
1051
  msgstr ""
1052
+ "WordPressコアを読み込まないPHPファイルへのリクエストを検証対象とするために、%s を設定します。ドットで"
1053
+ "始まる隠しファイルへのアクセス拒否がサーバー側で設定されていることを確認して下さい。"
 
1054
 
1055
+ #: admin/includes/tab-settings.php:630
1056
  msgid "Sorry, but your server type is not supported."
1057
  msgstr "このサーバーではサポートされません。"
1058
 
1059
+ #: admin/includes/tab-settings.php:631
1060
+ msgid ""
1061
+ "You need to click &#8220;Save Changes&#8221; button for imported settings to "
1062
+ "take effect."
1063
+ msgstr "インポートされた設定を有効にするには、[変更を保存]ボタンをクリックする必要があります。"
1064
+
1065
+ #: admin/includes/tab-settings.php:666 admin/includes/tab-settings.php:726
1066
  msgid "Force to load WP core"
1067
  msgstr "WPコアの読み込みを強制"
1068
 
1069
+ #: admin/includes/tab-settings.php:671
1070
  msgid "Plugins area"
1071
  msgstr "プラグイン領域"
1072
 
1073
+ #: admin/includes/tab-settings.php:731
1074
  msgid "Themes area"
1075
  msgstr "テーマ領域"
1076
 
1077
+ #: admin/includes/tab-settings.php:766
1078
  msgid "Front-end target settings"
1079
  msgstr "フロントエンドの設定"
1080
 
1081
+ #: admin/includes/tab-settings.php:801
1082
  msgid "Follow &#8220;Validation rule settings&#8221;"
1083
  msgstr "[検証ルールの設定]に従う"
1084
 
1085
+ #: admin/includes/tab-settings.php:843
1086
  #, php-format
1087
  msgid ""
1088
  "<dfn title=\"You can configure a different response code from the Back-end. "
1089
  "This is useful to prevent violation against your affiliate program."
1090
  "\">Response code</dfn> %s"
1091
  msgstr ""
1092
+ "<dfn title=\"バックエンドと異なるレスポンス・コードを設定できます。これは、アフィリエイト・プログラム"
1093
+ "に対する違反を防止するのに役立つでしょう。\">レスポンス・コード</dfn> %s"
 
1094
 
1095
+ #: admin/includes/tab-settings.php:907
1096
  msgid ""
1097
  "<dfn title=\"Specify the individual page as a blocking target.\">Page</dfn>"
1098
  msgstr "<dfn title=\"特定のページを遮断対象に指定します。\">ページ</dfn>"
1099
 
1100
+ #: admin/includes/tab-settings.php:919
1101
  msgid ""
1102
  "<dfn title=\"Specify the individual post type on a single page as a blocking "
1103
  "target.\">Post type</dfn>"
1104
+ msgstr "<dfn title=\"特定の投稿タイプのシングルページを遮断対象に指定します。\">投稿タイプ</dfn>"
 
 
1105
 
1106
+ #: admin/includes/tab-settings.php:931
1107
  msgid ""
1108
  "<dfn title=\"Specify the individual category on a single page or archive "
1109
  "page as a blocking target.\">Category</dfn>"
1110
  msgstr ""
1111
+ "<dfn title=\"特定のカテゴリを含むシングルページかアーカイブページを遮断対象に指定します。\">カテゴリ</"
1112
+ "dfn>"
1113
 
1114
+ #: admin/includes/tab-settings.php:943
1115
  msgid ""
1116
  "<dfn title=\"Specify the individual tag on a single page or archive page as "
1117
  "a blocking target.\">Tag</dfn>"
1118
  msgstr ""
1119
+ "<dfn title=\"特定のタグを含むシングルページかアーカイブページを遮断対象に指定します。\">タグ</dfn>"
 
1120
 
1121
+ #: admin/includes/tab-settings.php:957
1122
  msgid "Specify the validation target on front-end."
1123
  msgstr "フロントエンドの検証対象を設定します。"
1124
 
1125
+ #: admin/includes/tab-settings.php:957
1126
  msgid "Validation target"
1127
  msgstr "検証対象"
1128
 
1129
+ #: admin/includes/tab-settings.php:968
1130
  msgid "All requests"
1131
  msgstr "全てのリクエスト"
1132
 
1133
+ #: admin/includes/tab-settings.php:969
1134
  msgid "Specify the targets"
1135
  msgstr "ターゲットを指定"
1136
 
1137
+ #: admin/includes/tab-settings.php:972
1138
  msgid ""
1139
  "Notice that &#8220;Validation timing&#8221; is deferred till &#8220;"
1140
  "wp&#8221; action hook. It means that this feature would not be compatible "
1141
  "with any page caching."
1142
  msgstr ""
1143
+ "[検証のタイミング]が &#8220;wp&#8221; アクション・フックまで遅延されます。これにより、ページ・キャッ"
1144
+ "シュとの互換性がなくなることに注意してください。"
1145
+
1146
+ #: admin/includes/tab-settings.php:982
1147
+ msgid "Specify the name of actions as exception that is invariably blocked."
1148
+ msgstr "常に遮断されるアクション名を例外として指定します。"
1149
 
1150
+ #: admin/includes/tab-settings.php:982
1151
+ msgid "Excluded actions"
1152
+ msgstr "除外するアクション"
1153
+
1154
+ #: admin/includes/tab-settings.php:998
1155
  msgid ""
1156
  "<dfn title=\"Specify the frequency of request for certain period of time."
1157
  "\">Blocking condition</dfn>"
1158
  msgstr "<dfn title=\"特定期間のリクエスト頻度を設定します。\">遮断条件</dfn>"
1159
 
1160
+ #: admin/includes/tab-settings.php:1000
1161
  #, php-format
1162
  msgid "More than %1$s page view (PV) in %2$s seconds"
1163
+ msgstr "%2$s 秒間で %1$s を超えるページビュー (PV)"
1164
 
1165
+ #: admin/includes/tab-settings.php:1008
1166
  msgid ""
1167
  "<dfn title=\"It will validate the frequency of request.\">Block badly-"
1168
  "behaved bots and crawlers</dfn>"
1169
+ msgstr "<dfn title=\"リクエスト頻度を検証します。\">行儀の悪いボットやクローラーを遮断</dfn>"
 
 
1170
 
1171
+ #: admin/includes/tab-settings.php:1025
1172
  msgid ""
1173
  "A part of user agent string and a qualification connected with a separator "
1174
  "that indicates an applicable rule and can be &#8220;:&#8221; (pass) or "
1177
  "negative operator &#8220;!&#8221; can be placed just before a &#8220;"
1178
  "qualification&#8221;."
1179
  msgstr ""
1180
+ "適用されるルールを表す記号(「:」は通過、「#」は遮断)で区切られたユーザーエージェント文字列の一部と"
1181
+ "「条件」のペアです。「条件」には「DNS」、「FEED」、国コード、または&nbsp;IPアドレス(CIDR記法)が使え"
1182
+ "ます。また否定を表す記号「!」を「条件」の直前に配置する事が出来ます。"
 
1183
 
1184
+ #: admin/includes/tab-settings.php:1025
1185
  msgid "UA string and qualification"