WP Statistics - Version 12.0.12.1

Version Description

  • Fixed: PHP syntax error for array brackets when the PHP < 5.4
Download this release

Release Info

Developer mostafa.s1990
Plugin Icon 128x128 WP Statistics
Version 12.0.12.1
Comparing to
See all releases

Code changes from version 12.0.12 to 12.0.12.1

Files changed (78) hide show
  1. assets/css/admin.css +2 -2
  2. assets/css/admin.min.css +1 -1
  3. composer.lock +282 -282
  4. includes/templates/index.php +2 -2
  5. readme.txt +4 -1
  6. vendor/autoload.php +7 -7
  7. vendor/composer/ClassLoader.php +415 -415
  8. vendor/composer/LICENSE +21 -21
  9. vendor/composer/autoload_classmap.php +9 -9
  10. vendor/composer/autoload_namespaces.php +9 -9
  11. vendor/composer/autoload_psr4.php +15 -15
  12. vendor/composer/autoload_real.php +52 -52
  13. vendor/composer/autoload_static.php +65 -65
  14. vendor/composer/ca-bundle/LICENSE +19 -19
  15. vendor/composer/ca-bundle/README.md +70 -70
  16. vendor/composer/ca-bundle/src/CaBundle.php +291 -291
  17. vendor/composer/installed.json +275 -275
  18. vendor/geoip2/geoip2/.gitmodules +3 -3
  19. vendor/geoip2/geoip2/.php_cs +33 -33
  20. vendor/geoip2/geoip2/CHANGELOG.md +243 -243
  21. vendor/geoip2/geoip2/LICENSE +202 -202
  22. vendor/geoip2/geoip2/README.md +401 -401
  23. vendor/geoip2/geoip2/composer.json +31 -31
  24. vendor/geoip2/geoip2/src/Database/Reader.php +283 -283
  25. vendor/geoip2/geoip2/src/Exception/AddressNotFoundException.php +10 -10
  26. vendor/geoip2/geoip2/src/Exception/AuthenticationException.php +10 -10
  27. vendor/geoip2/geoip2/src/Exception/GeoIp2Exception.php +10 -10
  28. vendor/geoip2/geoip2/src/Exception/HttpException.php +24 -24
  29. vendor/geoip2/geoip2/src/Exception/InvalidRequestException.php +26 -26
  30. vendor/geoip2/geoip2/src/Exception/OutOfQueriesException.php +10 -10
  31. vendor/geoip2/geoip2/src/Model/AbstractModel.php +67 -67
  32. vendor/geoip2/geoip2/src/Model/AnonymousIp.php +46 -46
  33. vendor/geoip2/geoip2/src/Model/Asn.php +35 -35
  34. vendor/geoip2/geoip2/src/Model/City.php +133 -133
  35. vendor/geoip2/geoip2/src/Model/ConnectionType.php +31 -31
  36. vendor/geoip2/geoip2/src/Model/Country.php +71 -71
  37. vendor/geoip2/geoip2/src/Model/Domain.php +31 -31
  38. vendor/geoip2/geoip2/src/Model/Enterprise.php +47 -47
  39. vendor/geoip2/geoip2/src/Model/Insights.php +47 -47
  40. vendor/geoip2/geoip2/src/Model/Isp.php +44 -44
  41. vendor/geoip2/geoip2/src/ProviderInterface.php +20 -20
  42. vendor/geoip2/geoip2/src/Record/AbstractPlaceRecord.php +66 -66
  43. vendor/geoip2/geoip2/src/Record/AbstractRecord.php +61 -61
  44. vendor/geoip2/geoip2/src/Record/City.php +29 -29
  45. vendor/geoip2/geoip2/src/Record/Continent.php +32 -32
  46. vendor/geoip2/geoip2/src/Record/Country.php +37 -37
  47. vendor/geoip2/geoip2/src/Record/Location.php +52 -52
  48. vendor/geoip2/geoip2/src/Record/MaxMind.php +19 -19
  49. vendor/geoip2/geoip2/src/Record/Postal.php +26 -26
  50. vendor/geoip2/geoip2/src/Record/RepresentedCountry.php +35 -35
  51. vendor/geoip2/geoip2/src/Record/Subdivision.php +40 -40
  52. vendor/geoip2/geoip2/src/Record/Traits.php +95 -95
  53. vendor/geoip2/geoip2/src/WebService/Client.php +239 -239
  54. vendor/maxmind-db/reader/LICENSE +202 -202
  55. vendor/maxmind-db/reader/ext/config.m4 +19 -19
  56. vendor/maxmind-db/reader/ext/maxminddb.c +565 -565
  57. vendor/maxmind-db/reader/ext/tests/001-load.phpt +10 -10
  58. vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php +309 -309
  59. vendor/maxmind-db/reader/src/MaxMind/Db/Reader/InvalidDatabaseException.php +10 -10
  60. vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Metadata.php +77 -77
  61. vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Util.php +28 -28
  62. vendor/maxmind/web-service-common/CHANGELOG.md +74 -74
  63. vendor/maxmind/web-service-common/LICENSE +202 -202
  64. vendor/maxmind/web-service-common/README.md +26 -26
  65. vendor/maxmind/web-service-common/composer.json +31 -31
  66. vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php +10 -10
  67. vendor/maxmind/web-service-common/src/Exception/HttpException.php +40 -40
  68. vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php +10 -10
  69. vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php +12 -12
  70. vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php +37 -37
  71. vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php +7 -7
  72. vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php +10 -10
  73. vendor/maxmind/web-service-common/src/Exception/WebServiceException.php +10 -10
  74. vendor/maxmind/web-service-common/src/WebService/Client.php +470 -470
  75. vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php +110 -110
  76. vendor/maxmind/web-service-common/src/WebService/Http/Request.php +29 -29
  77. vendor/maxmind/web-service-common/src/WebService/Http/RequestFactory.php +26 -26
  78. wp-statistics.php +3 -3
assets/css/admin.css CHANGED
@@ -17,7 +17,7 @@
17
  }
18
 
19
  .column-wp-statistics {
20
- width: 50px;
21
  }
22
 
23
  .button-link.wps-more,
@@ -55,4 +55,4 @@
55
  margin: 0 8px;
56
  font-size: 15px;
57
  color: #589616;
58
- }
17
  }
18
 
19
  .column-wp-statistics {
20
+ width: 52px;
21
  }
22
 
23
  .button-link.wps-more,
55
  margin: 0 8px;
56
  font-size: 15px;
57
  color: #589616;
58
+ }
assets/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- #adminmenu #toplevel_page_wps_overview_page .wp-menu-image:before{content:"\f184"}#wp-admin-bar-wp-statistic-menu .ab-icon:before{font-family:"dashicons"!important;content:"\f184"!important}.wps-center{text-align:center}#wps_about_postbox #about_postbox img{max-width:170px;margin:0 0 9px}.column-wp-statistics{width:50px}.button-link.wps-more,.button-link.wps-refresh{text-decoration:none!important}.wp-statistics-plugins .widefat > *{float:left}.wp-statistics-plugins .widefat .plugin-card .desc,.wp-statistics-plugins .widefat .plugin-card .name{margin-right:0}.rtl .wp-statistics-plugins .widefat > *{float:right}.rtl .wp-statistics-plugins .widefat .plugin-card .desc,.rtl .wp-statistics-plugins .widefat .plugin-card .name{margin-right:148px;margin-left:0}.wp-statistics-plugins .widefat .plugin-card-bottom{float:initial}.wp-statistics-plugins .widefat .column-downloaded p{margin:2px 0 0}.wp-statistics-plugins .column-price{display:inline;margin:0 8px;font-size:15px;color:#589616}
1
+ #adminmenu #toplevel_page_wps_overview_page .wp-menu-image:before{content:"\f184"}#wp-admin-bar-wp-statistic-menu .ab-icon:before{font-family:"dashicons"!important;content:"\f184"!important}.wps-center{text-align:center}#wps_about_postbox #about_postbox img{max-width:170px;margin:0 0 9px}.column-wp-statistics{width:52px}.button-link.wps-more,.button-link.wps-refresh{text-decoration:none!important}.wp-statistics-plugins .widefat > *{float:left}.wp-statistics-plugins .widefat .plugin-card .desc,.wp-statistics-plugins .widefat .plugin-card .name{margin-right:0}.rtl .wp-statistics-plugins .widefat > *{float:right}.rtl .wp-statistics-plugins .widefat .plugin-card .desc,.rtl .wp-statistics-plugins .widefat .plugin-card .name{margin-right:148px;margin-left:0}.wp-statistics-plugins .widefat .plugin-card-bottom{float:initial}.wp-statistics-plugins .widefat .column-downloaded p{margin:2px 0 0}.wp-statistics-plugins .column-price{display:inline;margin:0 8px;font-size:15px;color:#589616}
composer.lock CHANGED
@@ -1,282 +1,282 @@
1
- {
2
- "_readme": [
3
- "This file locks the dependencies of your project to a known state",
4
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
- "This file is @generated automatically"
6
- ],
7
- "hash": "1d0528fc4586a954e5c487bfcb0444b2",
8
- "content-hash": "b02574b3168e88e8f4d17f9f12d910a4",
9
- "packages": [
10
- {
11
- "name": "composer/ca-bundle",
12
- "version": "1.0.7",
13
- "source": {
14
- "type": "git",
15
- "url": "https://github.com/composer/ca-bundle.git",
16
- "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12"
17
- },
18
- "dist": {
19
- "type": "zip",
20
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
21
- "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
22
- "shasum": ""
23
- },
24
- "require": {
25
- "ext-openssl": "*",
26
- "ext-pcre": "*",
27
- "php": "^5.3.2 || ^7.0"
28
- },
29
- "require-dev": {
30
- "phpunit/phpunit": "^4.5",
31
- "psr/log": "^1.0",
32
- "symfony/process": "^2.5 || ^3.0"
33
- },
34
- "suggest": {
35
- "symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+"
36
- },
37
- "type": "library",
38
- "extra": {
39
- "branch-alias": {
40
- "dev-master": "1.x-dev"
41
- }
42
- },
43
- "autoload": {
44
- "psr-4": {
45
- "Composer\\CaBundle\\": "src"
46
- }
47
- },
48
- "notification-url": "https://packagist.org/downloads/",
49
- "license": [
50
- "MIT"
51
- ],
52
- "authors": [
53
- {
54
- "name": "Jordi Boggiano",
55
- "email": "j.boggiano@seld.be",
56
- "homepage": "http://seld.be"
57
- }
58
- ],
59
- "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
60
- "keywords": [
61
- "cabundle",
62
- "cacert",
63
- "certificate",
64
- "ssl",
65
- "tls"
66
- ],
67
- "time": "2017-03-06 11:59:08"
68
- },
69
- {
70
- "name": "geoip2/geoip2",
71
- "version": "v2.6.0",
72
- "source": {
73
- "type": "git",
74
- "url": "https://github.com/maxmind/GeoIP2-php.git",
75
- "reference": "9f6f1edf9901fed5cd692dd260333bf52091acd3"
76
- },
77
- "dist": {
78
- "type": "zip",
79
- "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/9f6f1edf9901fed5cd692dd260333bf52091acd3",
80
- "reference": "9f6f1edf9901fed5cd692dd260333bf52091acd3",
81
- "shasum": ""
82
- },
83
- "require": {
84
- "maxmind-db/reader": "~1.0",
85
- "maxmind/web-service-common": "~0.4",
86
- "php": ">=5.4"
87
- },
88
- "require-dev": {
89
- "apigen/apigen": "*",
90
- "friendsofphp/php-cs-fixer": "2.*",
91
- "phpunit/phpunit": "4.*",
92
- "squizlabs/php_codesniffer": "3.*"
93
- },
94
- "type": "library",
95
- "autoload": {
96
- "psr-4": {
97
- "GeoIp2\\": "src"
98
- }
99
- },
100
- "notification-url": "https://packagist.org/downloads/",
101
- "license": [
102
- "Apache-2.0"
103
- ],
104
- "authors": [
105
- {
106
- "name": "Gregory J. Oschwald",
107
- "email": "goschwald@maxmind.com",
108
- "homepage": "http://www.maxmind.com/"
109
- }
110
- ],
111
- "description": "MaxMind GeoIP2 PHP API",
112
- "homepage": "https://github.com/maxmind/GeoIP2-php",
113
- "keywords": [
114
- "IP",
115
- "geoip",
116
- "geoip2",
117
- "geolocation",
118
- "maxmind"
119
- ],
120
- "time": "2017-07-10 17:59:43"
121
- },
122
- {
123
- "name": "maxmind-db/reader",
124
- "version": "v1.1.3",
125
- "source": {
126
- "type": "git",
127
- "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
128
- "reference": "7eeccf61b078bb23bb07b1a151a7e5db52871e65"
129
- },
130
- "dist": {
131
- "type": "zip",
132
- "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/7eeccf61b078bb23bb07b1a151a7e5db52871e65",
133
- "reference": "7eeccf61b078bb23bb07b1a151a7e5db52871e65",
134
- "shasum": ""
135
- },
136
- "require": {
137
- "php": ">=5.3.1"
138
- },
139
- "require-dev": {
140
- "phpunit/phpunit": "4.2.*",
141
- "satooshi/php-coveralls": "1.0.*",
142
- "squizlabs/php_codesniffer": "2.*"
143
- },
144
- "suggest": {
145
- "ext-bcmath": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
146
- "ext-gmp": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
147
- "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
148
- },
149
- "type": "library",
150
- "autoload": {
151
- "psr-4": {
152
- "MaxMind\\Db\\": "src/MaxMind/Db"
153
- }
154
- },
155
- "notification-url": "https://packagist.org/downloads/",
156
- "license": [
157
- "Apache-2.0"
158
- ],
159
- "authors": [
160
- {
161
- "name": "Gregory J. Oschwald",
162
- "email": "goschwald@maxmind.com",
163
- "homepage": "http://www.maxmind.com/"
164
- }
165
- ],
166
- "description": "MaxMind DB Reader API",
167
- "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
168
- "keywords": [
169
- "database",
170
- "geoip",
171
- "geoip2",
172
- "geolocation",
173
- "maxmind"
174
- ],
175
- "time": "2017-01-19 23:49:38"
176
- },
177
- {
178
- "name": "maxmind/web-service-common",
179
- "version": "v0.4.0",
180
- "source": {
181
- "type": "git",
182
- "url": "https://github.com/maxmind/web-service-common-php.git",
183
- "reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88"
184
- },
185
- "dist": {
186
- "type": "zip",
187
- "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/622f7c732a7f9c4c62497fc103939e042b6bdb88",
188
- "reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88",
189
- "shasum": ""
190
- },
191
- "require": {
192
- "composer/ca-bundle": "^1.0.3",
193
- "ext-curl": "*",
194
- "ext-json": "*",
195
- "php": ">=5.4"
196
- },
197
- "require-dev": {
198
- "friendsofphp/php-cs-fixer": "2.*",
199
- "phpunit/phpunit": "4.*",
200
- "squizlabs/php_codesniffer": "3.*"
201
- },
202
- "type": "library",
203
- "autoload": {
204
- "psr-4": {
205
- "MaxMind\\Exception\\": "src/Exception",
206
- "MaxMind\\WebService\\": "src/WebService"
207
- }
208
- },
209
- "notification-url": "https://packagist.org/downloads/",
210
- "license": [
211
- "Apache-2.0"
212
- ],
213
- "authors": [
214
- {
215
- "name": "Gregory Oschwald",
216
- "email": "goschwald@maxmind.com"
217
- }
218
- ],
219
- "description": "Internal MaxMind Web Service API",
220
- "homepage": "https://github.com/maxmind/web-service-common-php",
221
- "time": "2017-07-06 17:48:21"
222
- },
223
- {
224
- "name": "s1lentium/iptools",
225
- "version": "v1.1.0",
226
- "source": {
227
- "type": "git",
228
- "url": "https://github.com/S1lentium/IPTools.git",
229
- "reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea"
230
- },
231
- "dist": {
232
- "type": "zip",
233
- "url": "https://api.github.com/repos/S1lentium/IPTools/zipball/cb4843d4077872643b5d38d18b8591b4aaf605ea",
234
- "reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea",
235
- "shasum": ""
236
- },
237
- "require": {
238
- "ext-bcmath": "*",
239
- "php": ">=5.4.0"
240
- },
241
- "require-dev": {
242
- "satooshi/php-coveralls": "~1.0"
243
- },
244
- "type": "library",
245
- "autoload": {
246
- "psr-4": {
247
- "IPTools\\": "src/"
248
- }
249
- },
250
- "notification-url": "https://packagist.org/downloads/",
251
- "license": [
252
- "MIT"
253
- ],
254
- "authors": [
255
- {
256
- "name": "Safarov Alisher",
257
- "email": "alisher.safarov@outlook.com",
258
- "homepage": "https://github.com/S1lentium"
259
- }
260
- ],
261
- "description": "PHP Library for manipulating network addresses (IPv4 and IPv6)",
262
- "keywords": [
263
- "IP",
264
- "IP-Tools",
265
- "cidr",
266
- "ipv4",
267
- "ipv6",
268
- "network",
269
- "subnet"
270
- ],
271
- "time": "2016-08-21 15:57:09"
272
- }
273
- ],
274
- "packages-dev": [],
275
- "aliases": [],
276
- "minimum-stability": "stable",
277
- "stability-flags": [],
278
- "prefer-stable": false,
279
- "prefer-lowest": false,
280
- "platform": [],
281
- "platform-dev": []
282
- }
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "hash": "1d0528fc4586a954e5c487bfcb0444b2",
8
+ "content-hash": "b02574b3168e88e8f4d17f9f12d910a4",
9
+ "packages": [
10
+ {
11
+ "name": "composer/ca-bundle",
12
+ "version": "1.0.7",
13
+ "source": {
14
+ "type": "git",
15
+ "url": "https://github.com/composer/ca-bundle.git",
16
+ "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12"
17
+ },
18
+ "dist": {
19
+ "type": "zip",
20
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
21
+ "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
22
+ "shasum": ""
23
+ },
24
+ "require": {
25
+ "ext-openssl": "*",
26
+ "ext-pcre": "*",
27
+ "php": "^5.3.2 || ^7.0"
28
+ },
29
+ "require-dev": {
30
+ "phpunit/phpunit": "^4.5",
31
+ "psr/log": "^1.0",
32
+ "symfony/process": "^2.5 || ^3.0"
33
+ },
34
+ "suggest": {
35
+ "symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+"
36
+ },
37
+ "type": "library",
38
+ "extra": {
39
+ "branch-alias": {
40
+ "dev-master": "1.x-dev"
41
+ }
42
+ },
43
+ "autoload": {
44
+ "psr-4": {
45
+ "Composer\\CaBundle\\": "src"
46
+ }
47
+ },
48
+ "notification-url": "https://packagist.org/downloads/",
49
+ "license": [
50
+ "MIT"
51
+ ],
52
+ "authors": [
53
+ {
54
+ "name": "Jordi Boggiano",
55
+ "email": "j.boggiano@seld.be",
56
+ "homepage": "http://seld.be"
57
+ }
58
+ ],
59
+ "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
60
+ "keywords": [
61
+ "cabundle",
62
+ "cacert",
63
+ "certificate",
64
+ "ssl",
65
+ "tls"
66
+ ],
67
+ "time": "2017-03-06 11:59:08"
68
+ },
69
+ {
70
+ "name": "geoip2/geoip2",
71
+ "version": "v2.6.0",
72
+ "source": {
73
+ "type": "git",
74
+ "url": "https://github.com/maxmind/GeoIP2-php.git",
75
+ "reference": "9f6f1edf9901fed5cd692dd260333bf52091acd3"
76
+ },
77
+ "dist": {
78
+ "type": "zip",
79
+ "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/9f6f1edf9901fed5cd692dd260333bf52091acd3",
80
+ "reference": "9f6f1edf9901fed5cd692dd260333bf52091acd3",
81
+ "shasum": ""
82
+ },
83
+ "require": {
84
+ "maxmind-db/reader": "~1.0",
85
+ "maxmind/web-service-common": "~0.4",
86
+ "php": ">=5.4"
87
+ },
88
+ "require-dev": {
89
+ "apigen/apigen": "*",
90
+ "friendsofphp/php-cs-fixer": "2.*",
91
+ "phpunit/phpunit": "4.*",
92
+ "squizlabs/php_codesniffer": "3.*"
93
+ },
94
+ "type": "library",
95
+ "autoload": {
96
+ "psr-4": {
97
+ "GeoIp2\\": "src"
98
+ }
99
+ },
100
+ "notification-url": "https://packagist.org/downloads/",
101
+ "license": [
102
+ "Apache-2.0"
103
+ ],
104
+ "authors": [
105
+ {
106
+ "name": "Gregory J. Oschwald",
107
+ "email": "goschwald@maxmind.com",
108
+ "homepage": "http://www.maxmind.com/"
109
+ }
110
+ ],
111
+ "description": "MaxMind GeoIP2 PHP API",
112
+ "homepage": "https://github.com/maxmind/GeoIP2-php",
113
+ "keywords": [
114
+ "IP",
115
+ "geoip",
116
+ "geoip2",
117
+ "geolocation",
118
+ "maxmind"
119
+ ],
120
+ "time": "2017-07-10 17:59:43"
121
+ },
122
+ {
123
+ "name": "maxmind-db/reader",
124
+ "version": "v1.1.3",
125
+ "source": {
126
+ "type": "git",
127
+ "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
128
+ "reference": "7eeccf61b078bb23bb07b1a151a7e5db52871e65"
129
+ },
130
+ "dist": {
131
+ "type": "zip",
132
+ "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/7eeccf61b078bb23bb07b1a151a7e5db52871e65",
133
+ "reference": "7eeccf61b078bb23bb07b1a151a7e5db52871e65",
134
+ "shasum": ""
135
+ },
136
+ "require": {
137
+ "php": ">=5.3.1"
138
+ },
139
+ "require-dev": {
140
+ "phpunit/phpunit": "4.2.*",
141
+ "satooshi/php-coveralls": "1.0.*",
142
+ "squizlabs/php_codesniffer": "2.*"
143
+ },
144
+ "suggest": {
145
+ "ext-bcmath": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
146
+ "ext-gmp": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
147
+ "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
148
+ },
149
+ "type": "library",
150
+ "autoload": {
151
+ "psr-4": {
152
+ "MaxMind\\Db\\": "src/MaxMind/Db"
153
+ }
154
+ },
155
+ "notification-url": "https://packagist.org/downloads/",
156
+ "license": [
157
+ "Apache-2.0"
158
+ ],
159
+ "authors": [
160
+ {
161
+ "name": "Gregory J. Oschwald",
162
+ "email": "goschwald@maxmind.com",
163
+ "homepage": "http://www.maxmind.com/"
164
+ }
165
+ ],
166
+ "description": "MaxMind DB Reader API",
167
+ "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
168
+ "keywords": [
169
+ "database",
170
+ "geoip",
171
+ "geoip2",
172
+ "geolocation",
173
+ "maxmind"
174
+ ],
175
+ "time": "2017-01-19 23:49:38"
176
+ },
177
+ {
178
+ "name": "maxmind/web-service-common",
179
+ "version": "v0.4.0",
180
+ "source": {
181
+ "type": "git",
182
+ "url": "https://github.com/maxmind/web-service-common-php.git",
183
+ "reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88"
184
+ },
185
+ "dist": {
186
+ "type": "zip",
187
+ "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/622f7c732a7f9c4c62497fc103939e042b6bdb88",
188
+ "reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88",
189
+ "shasum": ""
190
+ },
191
+ "require": {
192
+ "composer/ca-bundle": "^1.0.3",
193
+ "ext-curl": "*",
194
+ "ext-json": "*",
195
+ "php": ">=5.4"
196
+ },
197
+ "require-dev": {
198
+ "friendsofphp/php-cs-fixer": "2.*",
199
+ "phpunit/phpunit": "4.*",
200
+ "squizlabs/php_codesniffer": "3.*"
201
+ },
202
+ "type": "library",
203
+ "autoload": {
204
+ "psr-4": {
205
+ "MaxMind\\Exception\\": "src/Exception",
206
+ "MaxMind\\WebService\\": "src/WebService"
207
+ }
208
+ },
209
+ "notification-url": "https://packagist.org/downloads/",
210
+ "license": [
211
+ "Apache-2.0"
212
+ ],
213
+ "authors": [
214
+ {
215
+ "name": "Gregory Oschwald",
216
+ "email": "goschwald@maxmind.com"
217
+ }
218
+ ],
219
+ "description": "Internal MaxMind Web Service API",
220
+ "homepage": "https://github.com/maxmind/web-service-common-php",
221
+ "time": "2017-07-06 17:48:21"
222
+ },
223
+ {
224
+ "name": "s1lentium/iptools",
225
+ "version": "v1.1.0",
226
+ "source": {
227
+ "type": "git",
228
+ "url": "https://github.com/S1lentium/IPTools.git",
229
+ "reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea"
230
+ },
231
+ "dist": {
232
+ "type": "zip",
233
+ "url": "https://api.github.com/repos/S1lentium/IPTools/zipball/cb4843d4077872643b5d38d18b8591b4aaf605ea",
234
+ "reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea",
235
+ "shasum": ""
236
+ },
237
+ "require": {
238
+ "ext-bcmath": "*",
239
+ "php": ">=5.4.0"
240
+ },
241
+ "require-dev": {
242
+ "satooshi/php-coveralls": "~1.0"
243
+ },
244
+ "type": "library",
245
+ "autoload": {
246
+ "psr-4": {
247
+ "IPTools\\": "src/"
248
+ }
249
+ },
250
+ "notification-url": "https://packagist.org/downloads/",
251
+ "license": [
252
+ "MIT"
253
+ ],
254
+ "authors": [
255
+ {
256
+ "name": "Safarov Alisher",
257
+ "email": "alisher.safarov@outlook.com",
258
+ "homepage": "https://github.com/S1lentium"
259
+ }
260
+ ],
261
+ "description": "PHP Library for manipulating network addresses (IPv4 and IPv6)",
262
+ "keywords": [
263
+ "IP",
264
+ "IP-Tools",
265
+ "cidr",
266
+ "ipv4",
267
+ "ipv6",
268
+ "network",
269
+ "subnet"
270
+ ],
271
+ "time": "2016-08-21 15:57:09"
272
+ }
273
+ ],
274
+ "packages-dev": [],
275
+ "aliases": [],
276
+ "minimum-stability": "stable",
277
+ "stability-flags": [],
278
+ "prefer-stable": false,
279
+ "prefer-lowest": false,
280
+ "platform": [],
281
+ "platform-dev": []
282
+ }
includes/templates/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
- # Silence is golden.
1
+ <?php
2
+ # Silence is golden.
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wp-statistics.com/donate/
4
  Tags: statistics, stats, visit, visitors, chart, browser, blog, today, yesterday, week, month, year, total, post, page, sidebar, summary, hits, pagerank, google, alexa, live visit
5
  Requires at least: 3.0
6
  Tested up to: 4.8
7
- Stable tag: 12.0.12
8
  License: GPL3
9
 
10
  Complete statistics for your WordPress site.
@@ -287,6 +287,9 @@ You may also downgrade to WP Statistics 10.3 as a temporary measure, but no new
287
  This is a security fix, please update immediately.
288
 
289
  == Changelog ==
 
 
 
290
  = 12.0.12 =
291
  * Added: Add-ons page! The Add-ons add functionality to your WP-Statistics. [Click here](https://wp-statistics.com/add-ons/) to see current Add-ons.
292
  * Fixed: Translations issue.
4
  Tags: statistics, stats, visit, visitors, chart, browser, blog, today, yesterday, week, month, year, total, post, page, sidebar, summary, hits, pagerank, google, alexa, live visit
5
  Requires at least: 3.0
6
  Tested up to: 4.8
7
+ Stable tag: 12.0.12.1
8
  License: GPL3
9
 
10
  Complete statistics for your WordPress site.
287
  This is a security fix, please update immediately.
288
 
289
  == Changelog ==
290
+ = 12.0.12.1 =
291
+ * Fixed: PHP syntax error for array brackets when the PHP < 5.4
292
+
293
  = 12.0.12 =
294
  * Added: Add-ons page! The Add-ons add functionality to your WP-Statistics. [Click here](https://wp-statistics.com/add-ons/) to see current Add-ons.
295
  * Fixed: Translations issue.
vendor/autoload.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
-
3
- // autoload.php @generated by Composer
4
-
5
- require_once __DIR__ . '/composer/autoload_real.php';
6
-
7
- return ComposerAutoloaderInit9d8833294cc7806cc2c9e043ead23c40::getLoader();
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit9d8833294cc7806cc2c9e043ead23c40::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -1,415 +1,415 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Composer.
5
- *
6
- * (c) Nils Adermann <naderman@naderman.de>
7
- * Jordi Boggiano <j.boggiano@seld.be>
8
- *
9
- * For the full copyright and license information, please view the LICENSE
10
- * file that was distributed with this source code.
11
- */
12
-
13
- namespace Composer\Autoload;
14
-
15
- /**
16
- * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
- *
18
- * $loader = new \Composer\Autoload\ClassLoader();
19
- *
20
- * // register classes with namespaces
21
- * $loader->add('Symfony\Component', __DIR__.'/component');
22
- * $loader->add('Symfony', __DIR__.'/framework');
23
- *
24
- * // activate the autoloader
25
- * $loader->register();
26
- *
27
- * // to enable searching the include path (eg. for PEAR packages)
28
- * $loader->setUseIncludePath(true);
29
- *
30
- * In this example, if you try to use a class in the Symfony\Component
31
- * namespace or one of its children (Symfony\Component\Console for instance),
32
- * the autoloader will first look for the class under the component/
33
- * directory, and it will then fallback to the framework/ directory if not
34
- * found before giving up.
35
- *
36
- * This class is loosely based on the Symfony UniversalClassLoader.
37
- *
38
- * @author Fabien Potencier <fabien@symfony.com>
39
- * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see http://www.php-fig.org/psr/psr-0/
41
- * @see http://www.php-fig.org/psr/psr-4/
42
- */
43
- class ClassLoader
44
- {
45
- // PSR-4
46
- private $prefixLengthsPsr4 = array();
47
- private $prefixDirsPsr4 = array();
48
- private $fallbackDirsPsr4 = array();
49
-
50
- // PSR-0
51
- private $prefixesPsr0 = array();
52
- private $fallbackDirsPsr0 = array();
53
-
54
- private $useIncludePath = false;
55
- private $classMap = array();
56
- private $classMapAuthoritative = false;
57
- private $missingClasses = array();
58
-
59
- public function getPrefixes()
60
- {
61
- if (!empty($this->prefixesPsr0)) {
62
- return call_user_func_array('array_merge', $this->prefixesPsr0);
63
- }
64
-
65
- return array();
66
- }
67
-
68
- public function getPrefixesPsr4()
69
- {
70
- return $this->prefixDirsPsr4;
71
- }
72
-
73
- public function getFallbackDirs()
74
- {
75
- return $this->fallbackDirsPsr0;
76
- }
77
-
78
- public function getFallbackDirsPsr4()
79
- {
80
- return $this->fallbackDirsPsr4;
81
- }
82
-
83
- public function getClassMap()
84
- {
85
- return $this->classMap;
86
- }
87
-
88
- /**
89
- * @param array $classMap Class to filename map
90
- */
91
- public function addClassMap(array $classMap)
92
- {
93
- if ($this->classMap) {
94
- $this->classMap = array_merge($this->classMap, $classMap);
95
- } else {
96
- $this->classMap = $classMap;
97
- }
98
- }
99
-
100
- /**
101
- * Registers a set of PSR-0 directories for a given prefix, either
102
- * appending or prepending to the ones previously set for this prefix.
103
- *
104
- * @param string $prefix The prefix
105
- * @param array|string $paths The PSR-0 root directories
106
- * @param bool $prepend Whether to prepend the directories
107
- */
108
- public function add($prefix, $paths, $prepend = false)
109
- {
110
- if (!$prefix) {
111
- if ($prepend) {
112
- $this->fallbackDirsPsr0 = array_merge(
113
- (array) $paths,
114
- $this->fallbackDirsPsr0
115
- );
116
- } else {
117
- $this->fallbackDirsPsr0 = array_merge(
118
- $this->fallbackDirsPsr0,
119
- (array) $paths
120
- );
121
- }
122
-
123
- return;
124
- }
125
-
126
- $first = $prefix[0];
127
- if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
- $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
-
130
- return;
131
- }
132
- if ($prepend) {
133
- $this->prefixesPsr0[$first][$prefix] = array_merge(
134
- (array) $paths,
135
- $this->prefixesPsr0[$first][$prefix]
136
- );
137
- } else {
138
- $this->prefixesPsr0[$first][$prefix] = array_merge(
139
- $this->prefixesPsr0[$first][$prefix],
140
- (array) $paths
141
- );
142
- }
143
- }
144
-
145
- /**
146
- * Registers a set of PSR-4 directories for a given namespace, either
147
- * appending or prepending to the ones previously set for this namespace.
148
- *
149
- * @param string $prefix The prefix/namespace, with trailing '\\'
150
- * @param array|string $paths The PSR-4 base directories
151
- * @param bool $prepend Whether to prepend the directories
152
- *
153
- * @throws \InvalidArgumentException
154
- */
155
- public function addPsr4($prefix, $paths, $prepend = false)
156
- {
157
- if (!$prefix) {
158
- // Register directories for the root namespace.
159
- if ($prepend) {
160
- $this->fallbackDirsPsr4 = array_merge(
161
- (array) $paths,
162
- $this->fallbackDirsPsr4
163
- );
164
- } else {
165
- $this->fallbackDirsPsr4 = array_merge(
166
- $this->fallbackDirsPsr4,
167
- (array) $paths
168
- );
169
- }
170
- } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
- // Register directories for a new namespace.
172
- $length = strlen($prefix);
173
- if ('\\' !== $prefix[$length - 1]) {
174
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
175
- }
176
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
177
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
- } elseif ($prepend) {
179
- // Prepend directories for an already registered namespace.
180
- $this->prefixDirsPsr4[$prefix] = array_merge(
181
- (array) $paths,
182
- $this->prefixDirsPsr4[$prefix]
183
- );
184
- } else {
185
- // Append directories for an already registered namespace.
186
- $this->prefixDirsPsr4[$prefix] = array_merge(
187
- $this->prefixDirsPsr4[$prefix],
188
- (array) $paths
189
- );
190
- }
191
- }
192
-
193
- /**
194
- * Registers a set of PSR-0 directories for a given prefix,
195
- * replacing any others previously set for this prefix.
196
- *
197
- * @param string $prefix The prefix
198
- * @param array|string $paths The PSR-0 base directories
199
- */
200
- public function set($prefix, $paths)
201
- {
202
- if (!$prefix) {
203
- $this->fallbackDirsPsr0 = (array) $paths;
204
- } else {
205
- $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
- }
207
- }
208
-
209
- /**
210
- * Registers a set of PSR-4 directories for a given namespace,
211
- * replacing any others previously set for this namespace.
212
- *
213
- * @param string $prefix The prefix/namespace, with trailing '\\'
214
- * @param array|string $paths The PSR-4 base directories
215
- *
216
- * @throws \InvalidArgumentException
217
- */
218
- public function setPsr4($prefix, $paths)
219
- {
220
- if (!$prefix) {
221
- $this->fallbackDirsPsr4 = (array) $paths;
222
- } else {
223
- $length = strlen($prefix);
224
- if ('\\' !== $prefix[$length - 1]) {
225
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226
- }
227
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
- }
230
- }
231
-
232
- /**
233
- * Turns on searching the include path for class files.
234
- *
235
- * @param bool $useIncludePath
236
- */
237
- public function setUseIncludePath($useIncludePath)
238
- {
239
- $this->useIncludePath = $useIncludePath;
240
- }
241
-
242
- /**
243
- * Can be used to check if the autoloader uses the include path to check
244
- * for classes.
245
- *
246
- * @return bool
247
- */
248
- public function getUseIncludePath()
249
- {
250
- return $this->useIncludePath;
251
- }
252
-
253
- /**
254
- * Turns off searching the prefix and fallback directories for classes
255
- * that have not been registered with the class map.
256
- *
257
- * @param bool $classMapAuthoritative
258
- */
259
- public function setClassMapAuthoritative($classMapAuthoritative)
260
- {
261
- $this->classMapAuthoritative = $classMapAuthoritative;
262
- }
263
-
264
- /**
265
- * Should class lookup fail if not found in the current class map?
266
- *
267
- * @return bool
268
- */
269
- public function isClassMapAuthoritative()
270
- {
271
- return $this->classMapAuthoritative;
272
- }
273
-
274
- /**
275
- * Registers this instance as an autoloader.
276
- *
277
- * @param bool $prepend Whether to prepend the autoloader or not
278
- */
279
- public function register($prepend = false)
280
- {
281
- spl_autoload_register(array($this, 'loadClass'), true, $prepend);
282
- }
283
-
284
- /**
285
- * Unregisters this instance as an autoloader.
286
- */
287
- public function unregister()
288
- {
289
- spl_autoload_unregister(array($this, 'loadClass'));
290
- }
291
-
292
- /**
293
- * Loads the given class or interface.
294
- *
295
- * @param string $class The name of the class
296
- * @return bool|null True if loaded, null otherwise
297
- */
298
- public function loadClass($class)
299
- {
300
- if ($file = $this->findFile($class)) {
301
- includeFile($file);
302
-
303
- return true;
304
- }
305
- }
306
-
307
- /**
308
- * Finds the path to the file where the class is defined.
309
- *
310
- * @param string $class The name of the class
311
- *
312
- * @return string|false The path if found, false otherwise
313
- */
314
- public function findFile($class)
315
- {
316
- // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
- if ('\\' == $class[0]) {
318
- $class = substr($class, 1);
319
- }
320
-
321
- // class map lookup
322
- if (isset($this->classMap[$class])) {
323
- return $this->classMap[$class];
324
- }
325
- if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
326
- return false;
327
- }
328
-
329
- $file = $this->findFileWithExtension($class, '.php');
330
-
331
- // Search for Hack files if we are running on HHVM
332
- if (false === $file && defined('HHVM_VERSION')) {
333
- $file = $this->findFileWithExtension($class, '.hh');
334
- }
335
-
336
- if (false === $file) {
337
- // Remember that this class does not exist.
338
- $this->missingClasses[$class] = true;
339
- }
340
-
341
- return $file;
342
- }
343
-
344
- private function findFileWithExtension($class, $ext)
345
- {
346
- // PSR-4 lookup
347
- $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
348
-
349
- $first = $class[0];
350
- if (isset($this->prefixLengthsPsr4[$first])) {
351
- foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
- if (0 === strpos($class, $prefix)) {
353
- foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
355
- return $file;
356
- }
357
- }
358
- }
359
- }
360
- }
361
-
362
- // PSR-4 fallback dirs
363
- foreach ($this->fallbackDirsPsr4 as $dir) {
364
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
365
- return $file;
366
- }
367
- }
368
-
369
- // PSR-0 lookup
370
- if (false !== $pos = strrpos($class, '\\')) {
371
- // namespaced class name
372
- $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
373
- . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
374
- } else {
375
- // PEAR-like class name
376
- $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
377
- }
378
-
379
- if (isset($this->prefixesPsr0[$first])) {
380
- foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
381
- if (0 === strpos($class, $prefix)) {
382
- foreach ($dirs as $dir) {
383
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
384
- return $file;
385
- }
386
- }
387
- }
388
- }
389
- }
390
-
391
- // PSR-0 fallback dirs
392
- foreach ($this->fallbackDirsPsr0 as $dir) {
393
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
394
- return $file;
395
- }
396
- }
397
-
398
- // PSR-0 include paths.
399
- if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
- return $file;
401
- }
402
-
403
- return false;
404
- }
405
- }
406
-
407
- /**
408
- * Scope isolated include.
409
- *
410
- * Prevents access to $this/self from included files.
411
- */
412
- function includeFile($file)
413
- {
414
- include $file;
415
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+ private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
+
59
+ public function getPrefixes()
60
+ {
61
+ if (!empty($this->prefixesPsr0)) {
62
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
63
+ }
64
+
65
+ return array();
66
+ }
67
+
68
+ public function getPrefixesPsr4()
69
+ {
70
+ return $this->prefixDirsPsr4;
71
+ }
72
+
73
+ public function getFallbackDirs()
74
+ {
75
+ return $this->fallbackDirsPsr0;
76
+ }
77
+
78
+ public function getFallbackDirsPsr4()
79
+ {
80
+ return $this->fallbackDirsPsr4;
81
+ }
82
+
83
+ public function getClassMap()
84
+ {
85
+ return $this->classMap;
86
+ }
87
+
88
+ /**
89
+ * @param array $classMap Class to filename map
90
+ */
91
+ public function addClassMap(array $classMap)
92
+ {
93
+ if ($this->classMap) {
94
+ $this->classMap = array_merge($this->classMap, $classMap);
95
+ } else {
96
+ $this->classMap = $classMap;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Registers a set of PSR-0 directories for a given prefix, either
102
+ * appending or prepending to the ones previously set for this prefix.
103
+ *
104
+ * @param string $prefix The prefix
105
+ * @param array|string $paths The PSR-0 root directories
106
+ * @param bool $prepend Whether to prepend the directories
107
+ */
108
+ public function add($prefix, $paths, $prepend = false)
109
+ {
110
+ if (!$prefix) {
111
+ if ($prepend) {
112
+ $this->fallbackDirsPsr0 = array_merge(
113
+ (array) $paths,
114
+ $this->fallbackDirsPsr0
115
+ );
116
+ } else {
117
+ $this->fallbackDirsPsr0 = array_merge(
118
+ $this->fallbackDirsPsr0,
119
+ (array) $paths
120
+ );
121
+ }
122
+
123
+ return;
124
+ }
125
+
126
+ $first = $prefix[0];
127
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
+
130
+ return;
131
+ }
132
+ if ($prepend) {
133
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
134
+ (array) $paths,
135
+ $this->prefixesPsr0[$first][$prefix]
136
+ );
137
+ } else {
138
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
139
+ $this->prefixesPsr0[$first][$prefix],
140
+ (array) $paths
141
+ );
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Registers a set of PSR-4 directories for a given namespace, either
147
+ * appending or prepending to the ones previously set for this namespace.
148
+ *
149
+ * @param string $prefix The prefix/namespace, with trailing '\\'
150
+ * @param array|string $paths The PSR-4 base directories
151
+ * @param bool $prepend Whether to prepend the directories
152
+ *
153
+ * @throws \InvalidArgumentException
154
+ */
155
+ public function addPsr4($prefix, $paths, $prepend = false)
156
+ {
157
+ if (!$prefix) {
158
+ // Register directories for the root namespace.
159
+ if ($prepend) {
160
+ $this->fallbackDirsPsr4 = array_merge(
161
+ (array) $paths,
162
+ $this->fallbackDirsPsr4
163
+ );
164
+ } else {
165
+ $this->fallbackDirsPsr4 = array_merge(
166
+ $this->fallbackDirsPsr4,
167
+ (array) $paths
168
+ );
169
+ }
170
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+ // Register directories for a new namespace.
172
+ $length = strlen($prefix);
173
+ if ('\\' !== $prefix[$length - 1]) {
174
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
175
+ }
176
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
177
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
+ } elseif ($prepend) {
179
+ // Prepend directories for an already registered namespace.
180
+ $this->prefixDirsPsr4[$prefix] = array_merge(
181
+ (array) $paths,
182
+ $this->prefixDirsPsr4[$prefix]
183
+ );
184
+ } else {
185
+ // Append directories for an already registered namespace.
186
+ $this->prefixDirsPsr4[$prefix] = array_merge(
187
+ $this->prefixDirsPsr4[$prefix],
188
+ (array) $paths
189
+ );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Registers a set of PSR-0 directories for a given prefix,
195
+ * replacing any others previously set for this prefix.
196
+ *
197
+ * @param string $prefix The prefix
198
+ * @param array|string $paths The PSR-0 base directories
199
+ */
200
+ public function set($prefix, $paths)
201
+ {
202
+ if (!$prefix) {
203
+ $this->fallbackDirsPsr0 = (array) $paths;
204
+ } else {
205
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Registers a set of PSR-4 directories for a given namespace,
211
+ * replacing any others previously set for this namespace.
212
+ *
213
+ * @param string $prefix The prefix/namespace, with trailing '\\'
214
+ * @param array|string $paths The PSR-4 base directories
215
+ *
216
+ * @throws \InvalidArgumentException
217
+ */
218
+ public function setPsr4($prefix, $paths)
219
+ {
220
+ if (!$prefix) {
221
+ $this->fallbackDirsPsr4 = (array) $paths;
222
+ } else {
223
+ $length = strlen($prefix);
224
+ if ('\\' !== $prefix[$length - 1]) {
225
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226
+ }
227
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Turns on searching the include path for class files.
234
+ *
235
+ * @param bool $useIncludePath
236
+ */
237
+ public function setUseIncludePath($useIncludePath)
238
+ {
239
+ $this->useIncludePath = $useIncludePath;
240
+ }
241
+
242
+ /**
243
+ * Can be used to check if the autoloader uses the include path to check
244
+ * for classes.
245
+ *
246
+ * @return bool
247
+ */
248
+ public function getUseIncludePath()
249
+ {
250
+ return $this->useIncludePath;
251
+ }
252
+
253
+ /**
254
+ * Turns off searching the prefix and fallback directories for classes
255
+ * that have not been registered with the class map.
256
+ *
257
+ * @param bool $classMapAuthoritative
258
+ */
259
+ public function setClassMapAuthoritative($classMapAuthoritative)
260
+ {
261
+ $this->classMapAuthoritative = $classMapAuthoritative;
262
+ }
263
+
264
+ /**
265
+ * Should class lookup fail if not found in the current class map?
266
+ *
267
+ * @return bool
268
+ */
269
+ public function isClassMapAuthoritative()
270
+ {
271
+ return $this->classMapAuthoritative;
272
+ }
273
+
274
+ /**
275
+ * Registers this instance as an autoloader.
276
+ *
277
+ * @param bool $prepend Whether to prepend the autoloader or not
278
+ */
279
+ public function register($prepend = false)
280
+ {
281
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
282
+ }
283
+
284
+ /**
285
+ * Unregisters this instance as an autoloader.
286
+ */
287
+ public function unregister()
288
+ {
289
+ spl_autoload_unregister(array($this, 'loadClass'));
290
+ }
291
+
292
+ /**
293
+ * Loads the given class or interface.
294
+ *
295
+ * @param string $class The name of the class
296
+ * @return bool|null True if loaded, null otherwise
297
+ */
298
+ public function loadClass($class)
299
+ {
300
+ if ($file = $this->findFile($class)) {
301
+ includeFile($file);
302
+
303
+ return true;
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Finds the path to the file where the class is defined.
309
+ *
310
+ * @param string $class The name of the class
311
+ *
312
+ * @return string|false The path if found, false otherwise
313
+ */
314
+ public function findFile($class)
315
+ {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
+ // class map lookup
322
+ if (isset($this->classMap[$class])) {
323
+ return $this->classMap[$class];
324
+ }
325
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
326
+ return false;
327
+ }
328
+
329
+ $file = $this->findFileWithExtension($class, '.php');
330
+
331
+ // Search for Hack files if we are running on HHVM
332
+ if (false === $file && defined('HHVM_VERSION')) {
333
+ $file = $this->findFileWithExtension($class, '.hh');
334
+ }
335
+
336
+ if (false === $file) {
337
+ // Remember that this class does not exist.
338
+ $this->missingClasses[$class] = true;
339
+ }
340
+
341
+ return $file;
342
+ }
343
+
344
+ private function findFileWithExtension($class, $ext)
345
+ {
346
+ // PSR-4 lookup
347
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
348
+
349
+ $first = $class[0];
350
+ if (isset($this->prefixLengthsPsr4[$first])) {
351
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
+ if (0 === strpos($class, $prefix)) {
353
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
355
+ return $file;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ // PSR-4 fallback dirs
363
+ foreach ($this->fallbackDirsPsr4 as $dir) {
364
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
365
+ return $file;
366
+ }
367
+ }
368
+
369
+ // PSR-0 lookup
370
+ if (false !== $pos = strrpos($class, '\\')) {
371
+ // namespaced class name
372
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
373
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
374
+ } else {
375
+ // PEAR-like class name
376
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
377
+ }
378
+
379
+ if (isset($this->prefixesPsr0[$first])) {
380
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
381
+ if (0 === strpos($class, $prefix)) {
382
+ foreach ($dirs as $dir) {
383
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
384
+ return $file;
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ // PSR-0 fallback dirs
392
+ foreach ($this->fallbackDirsPsr0 as $dir) {
393
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
394
+ return $file;
395
+ }
396
+ }
397
+
398
+ // PSR-0 include paths.
399
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
+ return $file;
401
+ }
402
+
403
+ return false;
404
+ }
405
+ }
406
+
407
+ /**
408
+ * Scope isolated include.
409
+ *
410
+ * Prevents access to $this/self from included files.
411
+ */
412
+ function includeFile($file)
413
+ {
414
+ include $file;
415
+ }
vendor/composer/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
-
2
- Copyright (c) 2016 Nils Adermann, Jordi Boggiano
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
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is furnished
9
- to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all
12
- copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- THE SOFTWARE.
21
-
1
+
2
+ Copyright (c) 2016 Nils Adermann, Jordi Boggiano
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
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
vendor/composer/autoload_classmap.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
-
3
- // autoload_classmap.php @generated by Composer
4
-
5
- $vendorDir = dirname(dirname(__FILE__));
6
- $baseDir = dirname($vendorDir);
7
-
8
- return array(
9
- );
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_namespaces.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
-
3
- // autoload_namespaces.php @generated by Composer
4
-
5
- $vendorDir = dirname(dirname(__FILE__));
6
- $baseDir = dirname($vendorDir);
7
-
8
- return array(
9
- );
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_psr4.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
-
3
- // autoload_psr4.php @generated by Composer
4
-
5
- $vendorDir = dirname(dirname(__FILE__));
6
- $baseDir = dirname($vendorDir);
7
-
8
- return array(
9
- 'MaxMind\\WebService\\' => array($vendorDir . '/maxmind/web-service-common/src/WebService'),
10
- 'MaxMind\\Exception\\' => array($vendorDir . '/maxmind/web-service-common/src/Exception'),
11
- 'MaxMind\\Db\\' => array($vendorDir . '/maxmind-db/reader/src/MaxMind/Db'),
12
- 'IPTools\\' => array($vendorDir . '/s1lentium/iptools/src'),
13
- 'GeoIp2\\' => array($vendorDir . '/geoip2/geoip2/src'),
14
- 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
15
- );
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'MaxMind\\WebService\\' => array($vendorDir . '/maxmind/web-service-common/src/WebService'),
10
+ 'MaxMind\\Exception\\' => array($vendorDir . '/maxmind/web-service-common/src/Exception'),
11
+ 'MaxMind\\Db\\' => array($vendorDir . '/maxmind-db/reader/src/MaxMind/Db'),
12
+ 'IPTools\\' => array($vendorDir . '/s1lentium/iptools/src'),
13
+ 'GeoIp2\\' => array($vendorDir . '/geoip2/geoip2/src'),
14
+ 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
15
+ );
vendor/composer/autoload_real.php CHANGED
@@ -1,52 +1,52 @@
1
- <?php
2
-
3
- // autoload_real.php @generated by Composer
4
-
5
- class ComposerAutoloaderInit9d8833294cc7806cc2c9e043ead23c40
6
- {
7
- private static $loader;
8
-
9
- public static function loadClassLoader($class)
10
- {
11
- if ('Composer\Autoload\ClassLoader' === $class) {
12
- require __DIR__ . '/ClassLoader.php';
13
- }
14
- }
15
-
16
- public static function getLoader()
17
- {
18
- if (null !== self::$loader) {
19
- return self::$loader;
20
- }
21
-
22
- spl_autoload_register(array('ComposerAutoloaderInit9d8833294cc7806cc2c9e043ead23c40', 'loadClassLoader'), true, true);
23
- self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit9d8833294cc7806cc2c9e043ead23c40', 'loadClassLoader'));
25
-
26
- $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
- if ($useStaticLoader) {
28
- require_once __DIR__ . '/autoload_static.php';
29
-
30
- call_user_func(\Composer\Autoload\ComposerStaticInit9d8833294cc7806cc2c9e043ead23c40::getInitializer($loader));
31
- } else {
32
- $map = require __DIR__ . '/autoload_namespaces.php';
33
- foreach ($map as $namespace => $path) {
34
- $loader->set($namespace, $path);
35
- }
36
-
37
- $map = require __DIR__ . '/autoload_psr4.php';
38
- foreach ($map as $namespace => $path) {
39
- $loader->setPsr4($namespace, $path);
40
- }
41
-
42
- $classMap = require __DIR__ . '/autoload_classmap.php';
43
- if ($classMap) {
44
- $loader->addClassMap($classMap);
45
- }
46
- }
47
-
48
- $loader->register(true);
49
-
50
- return $loader;
51
- }
52
- }
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit9d8833294cc7806cc2c9e043ead23c40
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit9d8833294cc7806cc2c9e043ead23c40', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit9d8833294cc7806cc2c9e043ead23c40', 'loadClassLoader'));
25
+
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
29
+
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit9d8833294cc7806cc2c9e043ead23c40::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
+
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
+ }
47
+
48
+ $loader->register(true);
49
+
50
+ return $loader;
51
+ }
52
+ }
vendor/composer/autoload_static.php CHANGED
@@ -1,65 +1,65 @@
1
- <?php
2
-
3
- // autoload_static.php @generated by Composer
4
-
5
- namespace Composer\Autoload;
6
-
7
- class ComposerStaticInit9d8833294cc7806cc2c9e043ead23c40
8
- {
9
- public static $prefixLengthsPsr4 = array (
10
- 'M' =>
11
- array (
12
- 'MaxMind\\WebService\\' => 19,
13
- 'MaxMind\\Exception\\' => 18,
14
- 'MaxMind\\Db\\' => 11,
15
- ),
16
- 'I' =>
17
- array (
18
- 'IPTools\\' => 8,
19
- ),
20
- 'G' =>
21
- array (
22
- 'GeoIp2\\' => 7,
23
- ),
24
- 'C' =>
25
- array (
26
- 'Composer\\CaBundle\\' => 18,
27
- ),
28
- );
29
-
30
- public static $prefixDirsPsr4 = array (
31
- 'MaxMind\\WebService\\' =>
32
- array (
33
- 0 => __DIR__ . '/..' . '/maxmind/web-service-common/src/WebService',
34
- ),
35
- 'MaxMind\\Exception\\' =>
36
- array (
37
- 0 => __DIR__ . '/..' . '/maxmind/web-service-common/src/Exception',
38
- ),
39
- 'MaxMind\\Db\\' =>
40
- array (
41
- 0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db',
42
- ),
43
- 'IPTools\\' =>
44
- array (
45
- 0 => __DIR__ . '/..' . '/s1lentium/iptools/src',
46
- ),
47
- 'GeoIp2\\' =>
48
- array (
49
- 0 => __DIR__ . '/..' . '/geoip2/geoip2/src',
50
- ),
51
- 'Composer\\CaBundle\\' =>
52
- array (
53
- 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
54
- ),
55
- );
56
-
57
- public static function getInitializer(ClassLoader $loader)
58
- {
59
- return \Closure::bind(function () use ($loader) {
60
- $loader->prefixLengthsPsr4 = ComposerStaticInit9d8833294cc7806cc2c9e043ead23c40::$prefixLengthsPsr4;
61
- $loader->prefixDirsPsr4 = ComposerStaticInit9d8833294cc7806cc2c9e043ead23c40::$prefixDirsPsr4;
62
-
63
- }, null, ClassLoader::class);
64
- }
65
- }
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit9d8833294cc7806cc2c9e043ead23c40
8
+ {
9
+ public static $prefixLengthsPsr4 = array (
10
+ 'M' =>
11
+ array (
12
+ 'MaxMind\\WebService\\' => 19,
13
+ 'MaxMind\\Exception\\' => 18,
14
+ 'MaxMind\\Db\\' => 11,
15
+ ),
16
+ 'I' =>
17
+ array (
18
+ 'IPTools\\' => 8,
19
+ ),
20
+ 'G' =>
21
+ array (
22
+ 'GeoIp2\\' => 7,
23
+ ),
24
+ 'C' =>
25
+ array (
26
+ 'Composer\\CaBundle\\' => 18,
27
+ ),
28
+ );
29
+
30
+ public static $prefixDirsPsr4 = array (
31
+ 'MaxMind\\WebService\\' =>
32
+ array (
33
+ 0 => __DIR__ . '/..' . '/maxmind/web-service-common/src/WebService',
34
+ ),
35
+ 'MaxMind\\Exception\\' =>
36
+ array (
37
+ 0 => __DIR__ . '/..' . '/maxmind/web-service-common/src/Exception',
38
+ ),
39
+ 'MaxMind\\Db\\' =>
40
+ array (
41
+ 0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db',
42
+ ),
43
+ 'IPTools\\' =>
44
+ array (
45
+ 0 => __DIR__ . '/..' . '/s1lentium/iptools/src',
46
+ ),
47
+ 'GeoIp2\\' =>
48
+ array (
49
+ 0 => __DIR__ . '/..' . '/geoip2/geoip2/src',
50
+ ),
51
+ 'Composer\\CaBundle\\' =>
52
+ array (
53
+ 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
54
+ ),
55
+ );
56
+
57
+ public static function getInitializer(ClassLoader $loader)
58
+ {
59
+ return \Closure::bind(function () use ($loader) {
60
+ $loader->prefixLengthsPsr4 = ComposerStaticInit9d8833294cc7806cc2c9e043ead23c40::$prefixLengthsPsr4;
61
+ $loader->prefixDirsPsr4 = ComposerStaticInit9d8833294cc7806cc2c9e043ead23c40::$prefixDirsPsr4;
62
+
63
+ }, null, ClassLoader::class);
64
+ }
65
+ }
vendor/composer/ca-bundle/LICENSE CHANGED
@@ -1,19 +1,19 @@
1
- Copyright (C) 2016 Composer
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
- of the Software, and to permit persons to whom the Software is furnished to do
8
- so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
1
+ Copyright (C) 2016 Composer
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
vendor/composer/ca-bundle/README.md CHANGED
@@ -1,70 +1,70 @@
1
- composer/ca-bundle
2
- ==================
3
-
4
- Small utility library that lets you find a path to the system CA bundle,
5
- and includes a fallback to the Mozilla CA bundle.
6
-
7
- Originally written as part of [composer/composer](https://github.com/composer/composer),
8
- now extracted and made available as a stand-alone library.
9
-
10
-
11
- Installation
12
- ------------
13
-
14
- Install the latest version with:
15
-
16
- ```bash
17
- $ composer require composer/ca-bundle
18
- ```
19
-
20
-
21
- Requirements
22
- ------------
23
-
24
- * PHP 5.3.2 is required but using the latest version of PHP is highly recommended.
25
-
26
-
27
- Basic usage
28
- -----------
29
-
30
- # `Composer\CaBundle\CaBundle`
31
-
32
- - `CaBundle::getSystemCaRootBundlePath()`: Returns the system CA bundle path, or a path to the bundled one as fallback
33
- - `CaBundle::getBundledCaBundlePath()`: Returns the path to the bundled CA file
34
- - `CaBundle::validateCaFile($filename)`: Validates a CA file using opensl_x509_parse only if it is safe to use
35
- - `CaBundle::isOpensslParseSafe()`: Test if it is safe to use the PHP function openssl_x509_parse()
36
- - `CaBundle::reset()`: Resets the static caches
37
-
38
-
39
- ## To use with curl
40
-
41
- ```php
42
- $curl = curl_init("https://example.org/");
43
- curl_setopt($curl, CURLOPT_CAINFO, \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath());
44
- $result = curl_exec($curl);
45
- ```
46
-
47
- ## To use with php streams
48
-
49
- ```php
50
- $opts = array(
51
- 'http' => array(
52
- 'method' => "GET"
53
- )
54
- );
55
-
56
- $caPath = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
57
- if (is_dir($caPath)) {
58
- $opts['ssl']['capath'] = $caPath;
59
- } else {
60
- $opts['ssl']['cafile'] = $caPath;
61
- }
62
-
63
- $context = stream_context_create($opts);
64
- $result = file_get_contents('https://example.com', false, $context);
65
- ```
66
-
67
- License
68
- -------
69
-
70
- composer/ca-bundle is licensed under the MIT License, see the LICENSE file for details.
1
+ composer/ca-bundle
2
+ ==================
3
+
4
+ Small utility library that lets you find a path to the system CA bundle,
5
+ and includes a fallback to the Mozilla CA bundle.
6
+
7
+ Originally written as part of [composer/composer](https://github.com/composer/composer),
8
+ now extracted and made available as a stand-alone library.
9
+
10
+
11
+ Installation
12
+ ------------
13
+
14
+ Install the latest version with:
15
+
16
+ ```bash
17
+ $ composer require composer/ca-bundle
18
+ ```
19
+
20
+
21
+ Requirements
22
+ ------------
23
+
24
+ * PHP 5.3.2 is required but using the latest version of PHP is highly recommended.
25
+
26
+
27
+ Basic usage
28
+ -----------
29
+
30
+ # `Composer\CaBundle\CaBundle`
31
+
32
+ - `CaBundle::getSystemCaRootBundlePath()`: Returns the system CA bundle path, or a path to the bundled one as fallback
33
+ - `CaBundle::getBundledCaBundlePath()`: Returns the path to the bundled CA file
34
+ - `CaBundle::validateCaFile($filename)`: Validates a CA file using opensl_x509_parse only if it is safe to use
35
+ - `CaBundle::isOpensslParseSafe()`: Test if it is safe to use the PHP function openssl_x509_parse()
36
+ - `CaBundle::reset()`: Resets the static caches
37
+
38
+
39
+ ## To use with curl
40
+
41
+ ```php
42
+ $curl = curl_init("https://example.org/");
43
+ curl_setopt($curl, CURLOPT_CAINFO, \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath());
44
+ $result = curl_exec($curl);
45
+ ```
46
+
47
+ ## To use with php streams
48
+
49
+ ```php
50
+ $opts = array(
51
+ 'http' => array(
52
+ 'method' => "GET"
53
+ )
54
+ );
55
+
56
+ $caPath = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
57
+ if (is_dir($caPath)) {
58
+ $opts['ssl']['capath'] = $caPath;
59
+ } else {
60
+ $opts['ssl']['cafile'] = $caPath;
61
+ }
62
+
63
+ $context = stream_context_create($opts);
64
+ $result = file_get_contents('https://example.com', false, $context);
65
+ ```
66
+
67
+ License
68
+ -------
69
+
70
+ composer/ca-bundle is licensed under the MIT License, see the LICENSE file for details.
vendor/composer/ca-bundle/src/CaBundle.php CHANGED
@@ -1,291 +1,291 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of composer/ca-bundle.
5
- *
6
- * (c) Composer <https://github.com/composer>
7
- *
8
- * For the full copyright and license information, please view
9
- * the LICENSE file that was distributed with this source code.
10
- */
11
-
12
- namespace Composer\CaBundle;
13
-
14
- use Psr\Log\LoggerInterface;
15
- use Symfony\Component\Process\PhpProcess;
16
-
17
- /**
18
- * @author Chris Smith <chris@cs278.org>
19
- * @author Jordi Boggiano <j.boggiano@seld.be>
20
- */
21
- class CaBundle
22
- {
23
- private static $caPath;
24
- private static $caFileValidity = array();
25
- private static $useOpensslParse;
26
-
27
- /**
28
- * Returns the system CA bundle path, or a path to the bundled one
29
- *
30
- * This method was adapted from Sslurp.
31
- * https://github.com/EvanDotPro/Sslurp
32
- *
33
- * (c) Evan Coury <me@evancoury.com>
34
- *
35
- * For the full copyright and license information, please see below:
36
- *
37
- * Copyright (c) 2013, Evan Coury
38
- * All rights reserved.
39
- *
40
- * Redistribution and use in source and binary forms, with or without modification,
41
- * are permitted provided that the following conditions are met:
42
- *
43
- * * Redistributions of source code must retain the above copyright notice,
44
- * this list of conditions and the following disclaimer.
45
- *
46
- * * Redistributions in binary form must reproduce the above copyright notice,
47
- * this list of conditions and the following disclaimer in the documentation
48
- * and/or other materials provided with the distribution.
49
- *
50
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
51
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
52
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
53
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
54
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
55
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
56
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
57
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60
- *
61
- * @param LoggerInterface $logger optional logger for information about which CA files were loaded
62
- * @return string path to a CA bundle file or directory
63
- */
64
- public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
65
- {
66
- if (self::$caPath !== null) {
67
- return self::$caPath;
68
- }
69
-
70
- // If SSL_CERT_FILE env variable points to a valid certificate/bundle, use that.
71
- // This mimics how OpenSSL uses the SSL_CERT_FILE env variable.
72
- $envCertFile = getenv('SSL_CERT_FILE');
73
- if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
74
- return self::$caPath = $envCertFile;
75
- }
76
-
77
- // If SSL_CERT_DIR env variable points to a valid certificate/bundle, use that.
78
- // This mimics how OpenSSL uses the SSL_CERT_FILE env variable.
79
- $envCertDir = getenv('SSL_CERT_DIR');
80
- if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
81
- return self::$caPath = $envCertDir;
82
- }
83
-
84
- $configured = ini_get('openssl.cafile');
85
- if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
86
- return self::$caPath = $configured;
87
- }
88
-
89
- $configured = ini_get('openssl.capath');
90
- if ($configured && is_dir($configured) && is_readable($configured)) {
91
- return self::$caPath = $configured;
92
- }
93
-
94
- $caBundlePaths = array(
95
- '/etc/pki/tls/certs/ca-bundle.crt', // Fedora, RHEL, CentOS (ca-certificates package)
96
- '/etc/ssl/certs/ca-certificates.crt', // Debian, Ubuntu, Gentoo, Arch Linux (ca-certificates package)
97
- '/etc/ssl/ca-bundle.pem', // SUSE, openSUSE (ca-certificates package)
98
- '/usr/local/share/certs/ca-root-nss.crt', // FreeBSD (ca_root_nss_package)
99
- '/usr/ssl/certs/ca-bundle.crt', // Cygwin
100
- '/opt/local/share/curl/curl-ca-bundle.crt', // OS X macports, curl-ca-bundle package
101
- '/usr/local/share/curl/curl-ca-bundle.crt', // Default cURL CA bunde path (without --with-ca-bundle option)
102
- '/usr/share/ssl/certs/ca-bundle.crt', // Really old RedHat?
103
- '/etc/ssl/cert.pem', // OpenBSD
104
- '/usr/local/etc/ssl/cert.pem', // FreeBSD 10.x
105
- '/usr/local/etc/openssl/cert.pem', // OS X homebrew, openssl package
106
- );
107
-
108
- foreach ($caBundlePaths as $caBundle) {
109
- if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
110
- return self::$caPath = $caBundle;
111
- }
112
- }
113
-
114
- foreach ($caBundlePaths as $caBundle) {
115
- $caBundle = dirname($caBundle);
116
- if (@is_dir($caBundle) && glob($caBundle.'/*')) {
117
- return self::$caPath = $caBundle;
118
- }
119
- }
120
-
121
- return self::$caPath = static::getBundledCaBundlePath(); // Bundled CA file, last resort
122
- }
123
-
124
- /**
125
- * Returns the path to the bundled CA file
126
- *
127
- * In case you don't want to trust the user or the system, you can use this directly
128
- *
129
- * @return string path to a CA bundle file
130
- */
131
- public static function getBundledCaBundlePath()
132
- {
133
- return __DIR__.'/../res/cacert.pem';
134
- }
135
-
136
- /**
137
- * Validates a CA file using opensl_x509_parse only if it is safe to use
138
- *
139
- * @param string $filename
140
- * @param LoggerInterface $logger optional logger for information about which CA files were loaded
141
- *
142
- * @return bool
143
- */
144
- public static function validateCaFile($filename, LoggerInterface $logger = null)
145
- {
146
- static $warned = false;
147
-
148
- if (isset(self::$caFileValidity[$filename])) {
149
- return self::$caFileValidity[$filename];
150
- }
151
-
152
- $contents = file_get_contents($filename);
153
-
154
- // assume the CA is valid if php is vulnerable to
155
- // https://www.sektioneins.de/advisories/advisory-012013-php-openssl_x509_parse-memory-corruption-vulnerability.html
156
- if (!static::isOpensslParseSafe()) {
157
- if (!$warned && $logger) {
158
- $logger->warning(sprintf(
159
- 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
160
- PHP_VERSION
161
- ));
162
- $warned = true;
163
- }
164
-
165
- $isValid = !empty($contents);
166
- } else {
167
- $isValid = (bool) openssl_x509_parse($contents);
168
- }
169
-
170
- if ($logger) {
171
- $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
172
- }
173
-
174
- return self::$caFileValidity[$filename] = $isValid;
175
- }
176
-
177
- /**
178
- * Test if it is safe to use the PHP function openssl_x509_parse().
179
- *
180
- * This checks if OpenSSL extensions is vulnerable to remote code execution
181
- * via the exploit documented as CVE-2013-6420.
182
- *
183
- * @return bool
184
- */
185
- public static function isOpensslParseSafe()
186
- {
187
- if (null !== self::$useOpensslParse) {
188
- return self::$useOpensslParse;
189
- }
190
-
191
- if (PHP_VERSION_ID >= 50600) {
192
- return self::$useOpensslParse = true;
193
- }
194
-
195
- // Vulnerable:
196
- // PHP 5.3.0 - PHP 5.3.27
197
- // PHP 5.4.0 - PHP 5.4.22
198
- // PHP 5.5.0 - PHP 5.5.6
199
- if (
200
- (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
201
- || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
202
- || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
203
- ) {
204
- // This version of PHP has the fix for CVE-2013-6420 applied.
205
- return self::$useOpensslParse = true;
206
- }
207
-
208
- if (defined('PHP_WINDOWS_VERSION_BUILD')) {
209
- // Windows is probably insecure in this case.
210
- return self::$useOpensslParse = false;
211
- }
212
-
213
- $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
214
- $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
215
-
216
- if (preg_match($regex, PHP_VERSION, $m)) {
217
- return ((int) $m[1]) >= $fixedVersion;
218
- }
219
-
220
- return false;
221
- };
222
-
223
- // Hard coded list of PHP distributions with the fix backported.
224
- if (
225
- $compareDistroVersionPrefix('5.3.3-7+squeeze', 18) // Debian 6 (Squeeze)
226
- || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7) // Debian 7 (Wheezy)
227
- || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9) // Ubuntu 12.04 (Precise)
228
- ) {
229
- return self::$useOpensslParse = true;
230
- }
231
-
232
- // Symfony Process component is missing so we assume it is unsafe at this point
233
- if (!class_exists('Symfony\Component\Process\PhpProcess')) {
234
- return self::$useOpensslParse = false;
235
- }
236
-
237
- // This is where things get crazy, because distros backport security
238
- // fixes the chances are on NIX systems the fix has been applied but
239
- // it's not possible to verify that from the PHP version.
240
- //
241
- // To verify exec a new PHP process and run the issue testcase with
242
- // known safe input that replicates the bug.
243
-
244
- // Based on testcase in https://github.com/php/php-src/commit/c1224573c773b6845e83505f717fbf820fc18415
245
- // changes in https://github.com/php/php-src/commit/76a7fd893b7d6101300cc656058704a73254d593
246
- $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
247
- $script = <<<'EOT'
248
-
249
- error_reporting(-1);
250
- $info = openssl_x509_parse(base64_decode('%s'));
251
- var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
252
-
253
- EOT;
254
- $script = '<'."?php\n".sprintf($script, $cert);
255
-
256
- try {
257
- $process = new PhpProcess($script);
258
- $process->mustRun();
259
- } catch (\Exception $e) {
260
- // In the case of any exceptions just accept it is not possible to
261
- // determine the safety of openssl_x509_parse and bail out.
262
- return self::$useOpensslParse = false;
263
- }
264
-
265
- $output = preg_split('{\r?\n}', trim($process->getOutput()));
266
- $errorOutput = trim($process->getErrorOutput());
267
-
268
- if (
269
- count($output) === 3
270
- && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
271
- && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
272
- && $output[2] === 'int(-1)'
273
- && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
274
- ) {
275
- // This PHP has the fix backported probably by a distro security team.
276
- return self::$useOpensslParse = true;
277
- }
278
-
279
- return self::$useOpensslParse = false;
280
- }
281
-
282
- /**
283
- * Resets the static caches
284
- */
285
- public static function reset()
286
- {
287
- self::$caFileValidity = array();
288
- self::$caPath = null;
289
- self::$useOpensslParse = null;
290
- }
291
- }
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of composer/ca-bundle.
5
+ *
6
+ * (c) Composer <https://github.com/composer>
7
+ *
8
+ * For the full copyright and license information, please view
9
+ * the LICENSE file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Composer\CaBundle;
13
+
14
+ use Psr\Log\LoggerInterface;
15
+ use Symfony\Component\Process\PhpProcess;
16
+
17
+ /**
18
+ * @author Chris Smith <chris@cs278.org>
19
+ * @author Jordi Boggiano <j.boggiano@seld.be>
20
+ */
21
+ class CaBundle
22
+ {
23
+ private static $caPath;
24
+ private static $caFileValidity = array();
25
+ private static $useOpensslParse;
26
+
27
+ /**
28
+ * Returns the system CA bundle path, or a path to the bundled one
29
+ *
30
+ * This method was adapted from Sslurp.
31
+ * https://github.com/EvanDotPro/Sslurp
32
+ *
33
+ * (c) Evan Coury <me@evancoury.com>
34
+ *
35
+ * For the full copyright and license information, please see below:
36
+ *
37
+ * Copyright (c) 2013, Evan Coury
38
+ * All rights reserved.
39
+ *
40
+ * Redistribution and use in source and binary forms, with or without modification,
41
+ * are permitted provided that the following conditions are met:
42
+ *
43
+ * * Redistributions of source code must retain the above copyright notice,
44
+ * this list of conditions and the following disclaimer.
45
+ *
46
+ * * Redistributions in binary form must reproduce the above copyright notice,
47
+ * this list of conditions and the following disclaimer in the documentation
48
+ * and/or other materials provided with the distribution.
49
+ *
50
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
51
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
52
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
53
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
54
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
55
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
56
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
57
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60
+ *
61
+ * @param LoggerInterface $logger optional logger for information about which CA files were loaded
62
+ * @return string path to a CA bundle file or directory
63
+ */
64
+ public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
65
+ {
66
+ if (self::$caPath !== null) {
67
+ return self::$caPath;
68
+ }
69
+
70
+ // If SSL_CERT_FILE env variable points to a valid certificate/bundle, use that.
71
+ // This mimics how OpenSSL uses the SSL_CERT_FILE env variable.
72
+ $envCertFile = getenv('SSL_CERT_FILE');
73
+ if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
74
+ return self::$caPath = $envCertFile;
75
+ }
76
+
77
+ // If SSL_CERT_DIR env variable points to a valid certificate/bundle, use that.
78
+ // This mimics how OpenSSL uses the SSL_CERT_FILE env variable.
79
+ $envCertDir = getenv('SSL_CERT_DIR');
80
+ if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
81
+ return self::$caPath = $envCertDir;
82
+ }
83
+
84
+ $configured = ini_get('openssl.cafile');
85
+ if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
86
+ return self::$caPath = $configured;
87
+ }
88
+
89
+ $configured = ini_get('openssl.capath');
90
+ if ($configured && is_dir($configured) && is_readable($configured)) {
91
+ return self::$caPath = $configured;
92
+ }
93
+
94
+ $caBundlePaths = array(
95
+ '/etc/pki/tls/certs/ca-bundle.crt', // Fedora, RHEL, CentOS (ca-certificates package)
96
+ '/etc/ssl/certs/ca-certificates.crt', // Debian, Ubuntu, Gentoo, Arch Linux (ca-certificates package)
97
+ '/etc/ssl/ca-bundle.pem', // SUSE, openSUSE (ca-certificates package)
98
+ '/usr/local/share/certs/ca-root-nss.crt', // FreeBSD (ca_root_nss_package)
99
+ '/usr/ssl/certs/ca-bundle.crt', // Cygwin
100
+ '/opt/local/share/curl/curl-ca-bundle.crt', // OS X macports, curl-ca-bundle package
101
+ '/usr/local/share/curl/curl-ca-bundle.crt', // Default cURL CA bunde path (without --with-ca-bundle option)
102
+ '/usr/share/ssl/certs/ca-bundle.crt', // Really old RedHat?
103
+ '/etc/ssl/cert.pem', // OpenBSD
104
+ '/usr/local/etc/ssl/cert.pem', // FreeBSD 10.x
105
+ '/usr/local/etc/openssl/cert.pem', // OS X homebrew, openssl package
106
+ );
107
+
108
+ foreach ($caBundlePaths as $caBundle) {
109
+ if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
110
+ return self::$caPath = $caBundle;
111
+ }
112
+ }
113
+
114
+ foreach ($caBundlePaths as $caBundle) {
115
+ $caBundle = dirname($caBundle);
116
+ if (@is_dir($caBundle) && glob($caBundle.'/*')) {
117
+ return self::$caPath = $caBundle;
118
+ }
119
+ }
120
+
121
+ return self::$caPath = static::getBundledCaBundlePath(); // Bundled CA file, last resort
122
+ }
123
+
124
+ /**
125
+ * Returns the path to the bundled CA file
126
+ *
127
+ * In case you don't want to trust the user or the system, you can use this directly
128
+ *
129
+ * @return string path to a CA bundle file
130
+ */
131
+ public static function getBundledCaBundlePath()
132
+ {
133
+ return __DIR__.'/../res/cacert.pem';
134
+ }
135
+
136
+ /**
137
+ * Validates a CA file using opensl_x509_parse only if it is safe to use
138
+ *
139
+ * @param string $filename
140
+ * @param LoggerInterface $logger optional logger for information about which CA files were loaded
141
+ *
142
+ * @return bool
143
+ */
144
+ public static function validateCaFile($filename, LoggerInterface $logger = null)
145
+ {
146
+ static $warned = false;
147
+
148
+ if (isset(self::$caFileValidity[$filename])) {
149
+ return self::$caFileValidity[$filename];
150
+ }
151
+
152
+ $contents = file_get_contents($filename);
153
+
154
+ // assume the CA is valid if php is vulnerable to
155
+ // https://www.sektioneins.de/advisories/advisory-012013-php-openssl_x509_parse-memory-corruption-vulnerability.html
156
+ if (!static::isOpensslParseSafe()) {
157
+ if (!$warned && $logger) {
158
+ $logger->warning(sprintf(
159
+ 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
160
+ PHP_VERSION
161
+ ));
162
+ $warned = true;
163
+ }
164
+
165
+ $isValid = !empty($contents);
166
+ } else {
167
+ $isValid = (bool) openssl_x509_parse($contents);
168
+ }
169
+
170
+ if ($logger) {
171
+ $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
172
+ }
173
+
174
+ return self::$caFileValidity[$filename] = $isValid;
175
+ }
176
+
177
+ /**
178
+ * Test if it is safe to use the PHP function openssl_x509_parse().
179
+ *
180
+ * This checks if OpenSSL extensions is vulnerable to remote code execution
181
+ * via the exploit documented as CVE-2013-6420.
182
+ *
183
+ * @return bool
184
+ */
185
+ public static function isOpensslParseSafe()
186
+ {
187
+ if (null !== self::$useOpensslParse) {
188
+ return self::$useOpensslParse;
189
+ }
190
+
191
+ if (PHP_VERSION_ID >= 50600) {
192
+ return self::$useOpensslParse = true;
193
+ }
194
+
195
+ // Vulnerable:
196
+ // PHP 5.3.0 - PHP 5.3.27
197
+ // PHP 5.4.0 - PHP 5.4.22
198
+ // PHP 5.5.0 - PHP 5.5.6
199
+ if (
200
+ (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
201
+ || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
202
+ || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
203
+ ) {
204
+ // This version of PHP has the fix for CVE-2013-6420 applied.
205
+ return self::$useOpensslParse = true;
206
+ }
207
+
208
+ if (defined('PHP_WINDOWS_VERSION_BUILD')) {
209
+ // Windows is probably insecure in this case.
210
+ return self::$useOpensslParse = false;
211
+ }
212
+
213
+ $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
214
+ $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
215
+
216
+ if (preg_match($regex, PHP_VERSION, $m)) {
217
+ return ((int) $m[1]) >= $fixedVersion;
218
+ }
219
+
220
+ return false;
221
+ };
222
+
223
+ // Hard coded list of PHP distributions with the fix backported.
224
+ if (
225
+ $compareDistroVersionPrefix('5.3.3-7+squeeze', 18) // Debian 6 (Squeeze)
226
+ || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7) // Debian 7 (Wheezy)
227
+ || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9) // Ubuntu 12.04 (Precise)
228
+ ) {
229
+ return self::$useOpensslParse = true;
230
+ }
231
+
232
+ // Symfony Process component is missing so we assume it is unsafe at this point
233
+ if (!class_exists('Symfony\Component\Process\PhpProcess')) {
234
+ return self::$useOpensslParse = false;
235
+ }
236
+
237
+ // This is where things get crazy, because distros backport security
238
+ // fixes the chances are on NIX systems the fix has been applied but
239
+ // it's not possible to verify that from the PHP version.
240
+ //
241
+ // To verify exec a new PHP process and run the issue testcase with
242
+ // known safe input that replicates the bug.
243
+
244
+ // Based on testcase in https://github.com/php/php-src/commit/c1224573c773b6845e83505f717fbf820fc18415
245
+ // changes in https://github.com/php/php-src/commit/76a7fd893b7d6101300cc656058704a73254d593
246
+ $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
247
+ $script = <<<'EOT'
248
+
249
+ error_reporting(-1);
250
+ $info = openssl_x509_parse(base64_decode('%s'));
251
+ var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
252
+
253
+ EOT;
254
+ $script = '<'."?php\n".sprintf($script, $cert);
255
+
256
+ try {
257
+ $process = new PhpProcess($script);
258
+ $process->mustRun();
259
+ } catch (\Exception $e) {
260
+ // In the case of any exceptions just accept it is not possible to
261
+ // determine the safety of openssl_x509_parse and bail out.
262
+ return self::$useOpensslParse = false;
263
+ }
264
+
265
+ $output = preg_split('{\r?\n}', trim($process->getOutput()));
266
+ $errorOutput = trim($process->getErrorOutput());
267
+
268
+ if (
269
+ count($output) === 3
270
+ && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
271
+ && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
272
+ && $output[2] === 'int(-1)'
273
+ && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
274
+ ) {
275
+ // This PHP has the fix backported probably by a distro security team.
276
+ return self::$useOpensslParse = true;
277
+ }
278
+
279
+ return self::$useOpensslParse = false;
280
+ }
281
+
282
+ /**
283
+ * Resets the static caches
284
+ */
285
+ public static function reset()
286
+ {
287
+ self::$caFileValidity = array();
288
+ self::$caPath = null;
289
+ self::$useOpensslParse = null;
290
+ }
291
+ }
vendor/composer/installed.json CHANGED
@@ -1,275 +1,275 @@
1
- [
2
- {
3
- "name": "s1lentium/iptools",
4
- "version": "v1.1.0",
5
- "version_normalized": "1.1.0.0",
6
- "source": {
7
- "type": "git",
8
- "url": "https://github.com/S1lentium/IPTools.git",
9
- "reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea"
10
- },
11
- "dist": {
12
- "type": "zip",
13
- "url": "https://api.github.com/repos/S1lentium/IPTools/zipball/cb4843d4077872643b5d38d18b8591b4aaf605ea",
14
- "reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea",
15
- "shasum": ""
16
- },
17
- "require": {
18
- "ext-bcmath": "*",
19
- "php": ">=5.4.0"
20
- },
21
- "require-dev": {
22
- "satooshi/php-coveralls": "~1.0"
23
- },
24
- "time": "2016-08-21 15:57:09",
25
- "type": "library",
26
- "installation-source": "dist",
27
- "autoload": {
28
- "psr-4": {
29
- "IPTools\\": "src/"
30
- }
31
- },
32
- "notification-url": "https://packagist.org/downloads/",
33
- "license": [
34
- "MIT"
35
- ],
36
- "authors": [
37
- {
38
- "name": "Safarov Alisher",
39
- "email": "alisher.safarov@outlook.com",
40
- "homepage": "https://github.com/S1lentium"
41
- }
42
- ],
43
- "description": "PHP Library for manipulating network addresses (IPv4 and IPv6)",
44
- "keywords": [
45
- "IP",
46
- "IP-Tools",
47
- "cidr",
48
- "ipv4",
49
- "ipv6",
50
- "network",
51
- "subnet"
52
- ]
53
- },
54
- {
55
- "name": "composer/ca-bundle",
56
- "version": "1.0.7",
57
- "version_normalized": "1.0.7.0",
58
- "source": {
59
- "type": "git",
60
- "url": "https://github.com/composer/ca-bundle.git",
61
- "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12"
62
- },
63
- "dist": {
64
- "type": "zip",
65
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
66
- "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
67
- "shasum": ""
68
- },
69
- "require": {
70
- "ext-openssl": "*",
71
- "ext-pcre": "*",
72
- "php": "^5.3.2 || ^7.0"
73
- },
74
- "require-dev": {
75
- "phpunit/phpunit": "^4.5",
76
- "psr/log": "^1.0",
77
- "symfony/process": "^2.5 || ^3.0"
78
- },
79
- "suggest": {
80
- "symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+"
81
- },
82
- "time": "2017-03-06 11:59:08",
83
- "type": "library",
84
- "extra": {
85
- "branch-alias": {
86
- "dev-master": "1.x-dev"
87
- }
88
- },
89
- "installation-source": "dist",
90
- "autoload": {
91
- "psr-4": {
92
- "Composer\\CaBundle\\": "src"
93
- }
94
- },
95
- "notification-url": "https://packagist.org/downloads/",
96
- "license": [
97
- "MIT"
98
- ],
99
- "authors": [
100
- {
101
- "name": "Jordi Boggiano",
102
- "email": "j.boggiano@seld.be",
103
- "homepage": "http://seld.be"
104
- }
105
- ],
106
- "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
107
- "keywords": [
108
- "cabundle",
109
- "cacert",
110
- "certificate",
111
- "ssl",
112
- "tls"
113
- ]
114
- },
115
- {
116
- "name": "maxmind-db/reader",
117
- "version": "v1.1.3",
118
- "version_normalized": "1.1.3.0",
119
- "source": {
120
- "type": "git",
121
- "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
122
- "reference": "7eeccf61b078bb23bb07b1a151a7e5db52871e65"
123
- },
124
- "dist": {
125
- "type": "zip",
126
- "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/7eeccf61b078bb23bb07b1a151a7e5db52871e65",
127
- "reference": "7eeccf61b078bb23bb07b1a151a7e5db52871e65",
128
- "shasum": ""
129
- },
130
- "require": {
131
- "php": ">=5.3.1"
132
- },
133
- "require-dev": {
134
- "phpunit/phpunit": "4.2.*",
135
- "satooshi/php-coveralls": "1.0.*",
136
- "squizlabs/php_codesniffer": "2.*"
137
- },
138
- "suggest": {
139
- "ext-bcmath": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
140
- "ext-gmp": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
141
- "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
142
- },
143
- "time": "2017-01-19 23:49:38",
144
- "type": "library",
145
- "installation-source": "dist",
146
- "autoload": {
147
- "psr-4": {
148
- "MaxMind\\Db\\": "src/MaxMind/Db"
149
- }
150
- },
151
- "notification-url": "https://packagist.org/downloads/",
152
- "license": [
153
- "Apache-2.0"
154
- ],
155
- "authors": [
156
- {
157
- "name": "Gregory J. Oschwald",
158
- "email": "goschwald@maxmind.com",
159
- "homepage": "http://www.maxmind.com/"
160
- }
161
- ],
162
- "description": "MaxMind DB Reader API",
163
- "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
164
- "keywords": [
165
- "database",
166
- "geoip",
167
- "geoip2",
168
- "geolocation",
169
- "maxmind"
170
- ]
171
- },
172
- {
173
- "name": "maxmind/web-service-common",
174
- "version": "v0.4.0",
175
- "version_normalized": "0.4.0.0",
176
- "source": {
177
- "type": "git",
178
- "url": "https://github.com/maxmind/web-service-common-php.git",
179
- "reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88"
180
- },
181
- "dist": {
182
- "type": "zip",
183
- "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/622f7c732a7f9c4c62497fc103939e042b6bdb88",
184
- "reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88",
185
- "shasum": ""
186
- },
187
- "require": {
188
- "composer/ca-bundle": "^1.0.3",
189
- "ext-curl": "*",
190
- "ext-json": "*",
191
- "php": ">=5.4"
192
- },
193
- "require-dev": {
194
- "friendsofphp/php-cs-fixer": "2.*",
195
- "phpunit/phpunit": "4.*",
196
- "squizlabs/php_codesniffer": "3.*"
197
- },
198
- "time": "2017-07-06 17:48:21",
199
- "type": "library",
200
- "installation-source": "dist",
201
- "autoload": {
202
- "psr-4": {
203
- "MaxMind\\Exception\\": "src/Exception",
204
- "MaxMind\\WebService\\": "src/WebService"
205
- }
206
- },
207
- "notification-url": "https://packagist.org/downloads/",
208
- "license": [
209
- "Apache-2.0"
210
- ],
211
- "authors": [
212
- {
213
- "name": "Gregory Oschwald",
214
- "email": "goschwald@maxmind.com"
215
- }
216
- ],
217
- "description": "Internal MaxMind Web Service API",
218
- "homepage": "https://github.com/maxmind/web-service-common-php"
219
- },
220
- {
221
- "name": "geoip2/geoip2",
222
- "version": "v2.6.0",
223
- "version_normalized": "2.6.0.0",
224
- "source": {
225
- "type": "git",
226
- "url": "https://github.com/maxmind/GeoIP2-php.git",
227
- "reference": "9f6f1edf9901fed5cd692dd260333bf52091acd3"
228
- },
229
- "dist": {
230
- "type": "zip",
231
- "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/9f6f1edf9901fed5cd692dd260333bf52091acd3",
232
- "reference": "9f6f1edf9901fed5cd692dd260333bf52091acd3",
233
- "shasum": ""
234
- },
235
- "require": {
236
- "maxmind-db/reader": "~1.0",
237
- "maxmind/web-service-common": "~0.4",
238
- "php": ">=5.4"
239
- },
240
- "require-dev": {
241
- "apigen/apigen": "*",
242
- "friendsofphp/php-cs-fixer": "2.*",
243
- "phpunit/phpunit": "4.*",
244
- "squizlabs/php_codesniffer": "3.*"
245
- },
246
- "time": "2017-07-10 17:59:43",
247
- "type": "library",
248
- "installation-source": "dist",
249
- "autoload": {
250
- "psr-4": {
251
- "GeoIp2\\": "src"
252
- }
253
- },
254
- "notification-url": "https://packagist.org/downloads/",
255
- "license": [
256
- "Apache-2.0"
257
- ],
258
- "authors": [
259
- {
260
- "name": "Gregory J. Oschwald",
261
- "email": "goschwald@maxmind.com",
262
- "homepage": "http://www.maxmind.com/"
263
- }
264
- ],
265
- "description": "MaxMind GeoIP2 PHP API",
266
- "homepage": "https://github.com/maxmind/GeoIP2-php",
267
- "keywords": [
268
- "IP",
269
- "geoip",
270
- "geoip2",
271
- "geolocation",
272
- "maxmind"
273
- ]
274
- }
275
- ]
1
+ [
2
+ {
3
+ "name": "s1lentium/iptools",
4
+ "version": "v1.1.0",
5
+ "version_normalized": "1.1.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/S1lentium/IPTools.git",
9
+ "reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/S1lentium/IPTools/zipball/cb4843d4077872643b5d38d18b8591b4aaf605ea",
14
+ "reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "ext-bcmath": "*",
19
+ "php": ">=5.4.0"
20
+ },
21
+ "require-dev": {
22
+ "satooshi/php-coveralls": "~1.0"
23
+ },
24
+ "time": "2016-08-21 15:57:09",
25
+ "type": "library",
26
+ "installation-source": "dist",
27
+ "autoload": {
28
+ "psr-4": {
29
+ "IPTools\\": "src/"
30
+ }
31
+ },
32
+ "notification-url": "https://packagist.org/downloads/",
33
+ "license": [
34
+ "MIT"
35
+ ],
36
+ "authors": [
37
+ {
38
+ "name": "Safarov Alisher",
39
+ "email": "alisher.safarov@outlook.com",
40
+ "homepage": "https://github.com/S1lentium"
41
+ }
42
+ ],
43
+ "description": "PHP Library for manipulating network addresses (IPv4 and IPv6)",
44
+ "keywords": [
45
+ "IP",
46
+ "IP-Tools",
47
+ "cidr",
48
+ "ipv4",
49
+ "ipv6",
50
+ "network",
51
+ "subnet"
52
+ ]
53
+ },
54
+ {
55
+ "name": "composer/ca-bundle",
56
+ "version": "1.0.7",
57
+ "version_normalized": "1.0.7.0",
58
+ "source": {
59
+ "type": "git",
60
+ "url": "https://github.com/composer/ca-bundle.git",
61
+ "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12"
62
+ },
63
+ "dist": {
64
+ "type": "zip",
65
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
66
+ "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
67
+ "shasum": ""
68
+ },
69
+ "require": {
70
+ "ext-openssl": "*",
71
+ "ext-pcre": "*",
72
+ "php": "^5.3.2 || ^7.0"
73
+ },
74
+ "require-dev": {
75
+ "phpunit/phpunit": "^4.5",
76
+ "psr/log": "^1.0",
77
+ "symfony/process": "^2.5 || ^3.0"
78
+ },
79
+ "suggest": {
80
+ "symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+"
81
+ },
82
+ "time": "2017-03-06 11:59:08",
83
+ "type": "library",
84
+ "extra": {
85
+ "branch-alias": {
86
+ "dev-master": "1.x-dev"
87
+ }
88
+ },
89
+ "installation-source": "dist",
90
+ "autoload": {
91
+ "psr-4": {
92
+ "Composer\\CaBundle\\": "src"
93
+ }
94
+ },
95
+ "notification-url": "https://packagist.org/downloads/",
96
+ "license": [
97
+ "MIT"
98
+ ],
99
+ "authors": [
100
+ {
101
+ "name": "Jordi Boggiano",
102
+ "email": "j.boggiano@seld.be",
103
+ "homepage": "http://seld.be"
104
+ }
105
+ ],
106
+ "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
107
+ "keywords": [
108
+ "cabundle",
109
+ "cacert",
110
+ "certificate",
111
+ "ssl",
112
+ "tls"
113
+ ]
114
+ },
115
+ {
116
+ "name": "maxmind-db/reader",
117
+ "version": "v1.1.3",
118
+ "version_normalized": "1.1.3.0",
119
+ "source": {
120
+ "type": "git",
121
+ "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
122
+ "reference": "7eeccf61b078bb23bb07b1a151a7e5db52871e65"
123
+ },
124
+ "dist": {
125
+ "type": "zip",
126
+ "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/7eeccf61b078bb23bb07b1a151a7e5db52871e65",
127
+ "reference": "7eeccf61b078bb23bb07b1a151a7e5db52871e65",
128
+ "shasum": ""
129
+ },
130
+ "require": {
131
+ "php": ">=5.3.1"
132
+ },
133
+ "require-dev": {
134
+ "phpunit/phpunit": "4.2.*",
135
+ "satooshi/php-coveralls": "1.0.*",
136
+ "squizlabs/php_codesniffer": "2.*"
137
+ },
138
+ "suggest": {
139
+ "ext-bcmath": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
140
+ "ext-gmp": "bcmath or gmp is requred for decoding larger integers with the pure PHP decoder",
141
+ "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
142
+ },
143
+ "time": "2017-01-19 23:49:38",
144
+ "type": "library",
145
+ "installation-source": "dist",
146
+ "autoload": {
147
+ "psr-4": {
148
+ "MaxMind\\Db\\": "src/MaxMind/Db"
149
+ }
150
+ },
151
+ "notification-url": "https://packagist.org/downloads/",
152
+ "license": [
153
+ "Apache-2.0"
154
+ ],
155
+ "authors": [
156
+ {
157
+ "name": "Gregory J. Oschwald",
158
+ "email": "goschwald@maxmind.com",
159
+ "homepage": "http://www.maxmind.com/"
160
+ }
161
+ ],
162
+ "description": "MaxMind DB Reader API",
163
+ "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
164
+ "keywords": [
165
+ "database",
166
+ "geoip",
167
+ "geoip2",
168
+ "geolocation",
169
+ "maxmind"
170
+ ]
171
+ },
172
+ {
173
+ "name": "maxmind/web-service-common",
174
+ "version": "v0.4.0",
175
+ "version_normalized": "0.4.0.0",
176
+ "source": {
177
+ "type": "git",
178
+ "url": "https://github.com/maxmind/web-service-common-php.git",
179
+ "reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88"
180
+ },
181
+ "dist": {
182
+ "type": "zip",
183
+ "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/622f7c732a7f9c4c62497fc103939e042b6bdb88",
184
+ "reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88",
185
+ "shasum": ""
186
+ },
187
+ "require": {
188
+ "composer/ca-bundle": "^1.0.3",
189
+ "ext-curl": "*",
190
+ "ext-json": "*",
191
+ "php": ">=5.4"
192
+ },
193
+ "require-dev": {
194
+ "friendsofphp/php-cs-fixer": "2.*",
195
+ "phpunit/phpunit": "4.*",
196
+ "squizlabs/php_codesniffer": "3.*"
197
+ },
198
+ "time": "2017-07-06 17:48:21",
199
+ "type": "library",
200
+ "installation-source": "dist",
201
+ "autoload": {
202
+ "psr-4": {
203
+ "MaxMind\\Exception\\": "src/Exception",
204
+ "MaxMind\\WebService\\": "src/WebService"
205
+ }
206
+ },
207
+ "notification-url": "https://packagist.org/downloads/",
208
+ "license": [
209
+ "Apache-2.0"
210
+ ],
211
+ "authors": [
212
+ {
213
+ "name": "Gregory Oschwald",
214
+ "email": "goschwald@maxmind.com"
215
+ }
216
+ ],
217
+ "description": "Internal MaxMind Web Service API",
218
+ "homepage": "https://github.com/maxmind/web-service-common-php"
219
+ },
220
+ {
221
+ "name": "geoip2/geoip2",
222
+ "version": "v2.6.0",
223
+ "version_normalized": "2.6.0.0",
224
+ "source": {
225
+ "type": "git",
226
+ "url": "https://github.com/maxmind/GeoIP2-php.git",
227
+ "reference": "9f6f1edf9901fed5cd692dd260333bf52091acd3"
228
+ },
229
+ "dist": {
230
+ "type": "zip",
231
+ "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/9f6f1edf9901fed5cd692dd260333bf52091acd3",
232
+ "reference": "9f6f1edf9901fed5cd692dd260333bf52091acd3",
233
+ "shasum": ""
234
+ },
235
+ "require": {
236
+ "maxmind-db/reader": "~1.0",
237
+ "maxmind/web-service-common": "~0.4",
238
+ "php": ">=5.4"
239
+ },
240
+ "require-dev": {
241
+ "apigen/apigen": "*",
242
+ "friendsofphp/php-cs-fixer": "2.*",
243
+ "phpunit/phpunit": "4.*",
244
+ "squizlabs/php_codesniffer": "3.*"
245
+ },
246
+ "time": "2017-07-10 17:59:43",
247
+ "type": "library",
248
+ "installation-source": "dist",
249
+ "autoload": {
250
+ "psr-4": {
251
+ "GeoIp2\\": "src"
252
+ }
253
+ },
254
+ "notification-url": "https://packagist.org/downloads/",
255
+ "license": [
256
+ "Apache-2.0"
257
+ ],
258
+ "authors": [
259
+ {
260
+ "name": "Gregory J. Oschwald",
261
+ "email": "goschwald@maxmind.com",
262
+ "homepage": "http://www.maxmind.com/"
263
+ }
264
+ ],
265
+ "description": "MaxMind GeoIP2 PHP API",
266
+ "homepage": "https://github.com/maxmind/GeoIP2-php",
267
+ "keywords": [
268
+ "IP",
269
+ "geoip",
270
+ "geoip2",
271
+ "geolocation",
272
+ "maxmind"
273
+ ]
274
+ }
275
+ ]
vendor/geoip2/geoip2/.gitmodules CHANGED
@@ -1,3 +1,3 @@
1
- [submodule "maxmind-db"]
2
- path = maxmind-db
3
- url = git://github.com/maxmind/MaxMind-DB.git
1
+ [submodule "maxmind-db"]
2
+ path = maxmind-db
3
+ url = git://github.com/maxmind/MaxMind-DB.git
vendor/geoip2/geoip2/.php_cs CHANGED
@@ -1,33 +1,33 @@
1
- <?php
2
-
3
- return PhpCsFixer\Config::create()
4
- ->setRiskyAllowed(true)
5
- ->setRules([
6
- '@Symfony' => true,
7
- '@Symfony:risky' => true,
8
- 'array_syntax' => ['syntax' => 'short'],
9
- 'combine_consecutive_unsets' => true,
10
- 'concat_space' => [ 'spacing' => 'one'],
11
- 'heredoc_to_nowdoc' => true,
12
- 'list_syntax' => ['syntax' => 'long'],
13
- 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
14
- 'no_short_echo_tag' => true,
15
- 'no_unreachable_default_argument_value' => true,
16
- 'no_useless_else' => true,
17
- 'no_useless_return' => true,
18
- 'ordered_imports' => true,
19
- 'pre_increment' => false,
20
- 'php_unit_strict' => true,
21
- 'php_unit_test_class_requires_covers' => true,
22
- 'phpdoc_add_missing_param_annotation' => true,
23
- 'phpdoc_no_alias_tag' => false,
24
- 'phpdoc_order' => true,
25
- 'semicolon_after_instruction' => true,
26
- 'strict_comparison' => true,
27
- 'strict_param' => true,
28
- ])
29
- ->setFinder(
30
- PhpCsFixer\Finder::create()
31
- ->in(__DIR__)
32
- )
33
- ;
1
+ <?php
2
+
3
+ return PhpCsFixer\Config::create()
4
+ ->setRiskyAllowed(true)
5
+ ->setRules([
6
+ '@Symfony' => true,
7
+ '@Symfony:risky' => true,
8
+ 'array_syntax' => ['syntax' => 'short'],
9
+ 'combine_consecutive_unsets' => true,
10
+ 'concat_space' => [ 'spacing' => 'one'],
11
+ 'heredoc_to_nowdoc' => true,
12
+ 'list_syntax' => ['syntax' => 'long'],
13
+ 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
14
+ 'no_short_echo_tag' => true,
15
+ 'no_unreachable_default_argument_value' => true,
16
+ 'no_useless_else' => true,
17
+ 'no_useless_return' => true,
18
+ 'ordered_imports' => true,
19
+ 'pre_increment' => false,
20
+ 'php_unit_strict' => true,
21
+ 'php_unit_test_class_requires_covers' => true,
22
+ 'phpdoc_add_missing_param_annotation' => true,
23
+ 'phpdoc_no_alias_tag' => false,
24
+ 'phpdoc_order' => true,
25
+ 'semicolon_after_instruction' => true,
26
+ 'strict_comparison' => true,
27
+ 'strict_param' => true,
28
+ ])
29
+ ->setFinder(
30
+ PhpCsFixer\Finder::create()
31
+ ->in(__DIR__)
32
+ )
33
+ ;
vendor/geoip2/geoip2/CHANGELOG.md CHANGED
@@ -1,243 +1,243 @@
1
- CHANGELOG
2
- =========
3
-
4
- 2.6.0 (2017-07-10)
5
- -----------------
6
-
7
- * Code clean-up and tidying.
8
- * Set minimum required PHP version to 5.4 in `composer.json`. Previously,
9
- 5.3 would work but was not tested. Now 5.4 is hard minimum version.
10
-
11
- 2.5.0 (2017-05-08)
12
- ------------------
13
-
14
- * Support for PHP 5.3 was dropped.
15
- * Added support for GeoLite2 ASN database.
16
-
17
- 2.4.5 (2017-01-31)
18
- ------------------
19
-
20
- * Additional error checking on the data returned from `MaxMind\Db\Reader`
21
- was added to help detect corrupt databases. GitHub #83.
22
-
23
- 2.4.4 (2016-10-11)
24
- ------------------
25
-
26
- * `isset()` on `mostSpecificSubdivision` attribute now returns the
27
- correct value. Reported by Juan Francisco Giordana. GitHub #81.
28
-
29
- 2.4.3 (2016-10-11)
30
- ------------------
31
-
32
- * `isset()` on `name` attribute now returns the correct value. Reported by
33
- Juan Francisco Giordana. GitHub #79.
34
-
35
- 2.4.2 (2016-08-17)
36
- ------------------
37
-
38
- * Updated documentation to clarify what the accuracy radius refers to.
39
- * Upgraded `maxmind/web-service-common` to 0.3.0. This version uses
40
- `composer/ca-bundle` rather than our own CA bundle. GitHub #75.
41
- * Improved PHP documentation generation.
42
-
43
- 2.4.1 (2016-06-10)
44
- ------------------
45
-
46
- * Corrected type annotations in documentation. GitHub #66.
47
- * Updated documentation to reflect that the accuracy radius is now included
48
- in City.
49
- * Upgraded web service client, which supports setting a proxy. GitHub #59.
50
-
51
- 2.4.0 (2016-04-15)
52
- ------------------
53
-
54
- * Added support for the GeoIP2 Enterprise database.
55
-
56
- 2.3.3 (2015-09-24)
57
- ------------------
58
-
59
- * Corrected case on `JsonSerializable` interface. Reported by Axel Etcheverry.
60
- GitHub #56.
61
-
62
- 2.3.2 (2015-09-23)
63
- ------------------
64
-
65
- * `JsonSerializable` compatibility interface was moved to `GeoIp2\Compat`
66
- rather than the global namespace to prevent autoloading issues. Reported by
67
- Tomas Buteler. GitHub #54.
68
- * Missing documentation for the `$postal` property was added to the
69
- `GeoIp2\Model\City` class. Fix by Roy Sindre Norangshol. GitHub #51.
70
- * In the Phar distribution, source files for this module no longer have their
71
- documentation stripped, allowing IDE introspection to work properly.
72
- Reported by Dominic Black. GitHub #52.
73
-
74
- 2.3.1 (2015-06-30)
75
- ------------------
76
-
77
- * Updated `maxmind/web-service-common` to version with fixes for PHP 5.3 and
78
- 5.4.
79
-
80
- 2.3.0 (2015-06-29)
81
- ------------------
82
-
83
- * Support for demographics fields `averageIncome` and `populationDensity` in
84
- the `Location` record, returned by the Insights endpoint.
85
- * The `isAnonymousProxy` and `isSatelliteProvider` properties on
86
- `GeoIP2\Record\Traits` have been deprecated. Please use our [GeoIP2
87
- Anonymous IP database](https://www.maxmind.com/en/geoip2-anonymous-ip-database)
88
- to determine whether an IP address is used by an anonymizing service.
89
-
90
- 2.2.0-beta1 (2015-06-09)
91
- ------------------------
92
-
93
- * Typo fix in documentation.
94
-
95
- 2.2.0-alpha2 (2015-06-01)
96
- -------------------------
97
-
98
- * `maxmind-ws/web-service-common` was renamed to `maxmind/web-service-common`.
99
-
100
- 2.2.0-alpha1 (2015-05-22)
101
- -------------------------
102
-
103
- * The library no longer uses Guzzle and instead uses curl directly.
104
- * Support for `timeout` and `connectTimout` were added to the `$options` array
105
- passed to the `GeoIp2\WebService\Client` constructor. Pull request by Will
106
- Bradley. GitHub #36.
107
-
108
- 2.1.1 (2014-12-03)
109
- ------------------
110
-
111
- * The 2.1.0 Phar builds included a shebang line, causing issues when loading
112
- it as a library. This has been corrected. GitHub #33.
113
-
114
- 2.1.0 (2014-10-29)
115
- ------------------
116
-
117
- * Update ApiGen dependency to version that isn't broken on case sensitive
118
- file systems.
119
- * Added support for the GeoIP2 Anonymous IP database. The
120
- `GeoIP2\Database\Reader` class now has an `anonymousIp` method which returns
121
- a `GeoIP2\Model\AnonymousIp` object.
122
- * Boolean attributes like those in the `GeoIP2\Record\Traits` class now return
123
- `false` instead of `null` when they were not true.
124
-
125
- 2.0.0 (2014-09-22)
126
- ------------------
127
-
128
- * First production release.
129
-
130
- 0.9.0 (2014-09-15)
131
- ------------------
132
-
133
- * IMPORTANT: The deprecated `omni()` and `cityIspOrg()` methods have been
134
- removed from `GeoIp2\WebService\Client`.
135
-
136
- 0.8.1 (2014-09-12)
137
- ------------------
138
-
139
- * The check added to the `GeoIP2\Database\Reader` lookup methods in 0.8.0 did
140
- not work with the GeoIP2 City Database Subset by Continent with World
141
- Countries. This has been fixed. Fixes GitHub issue #23.
142
-
143
- 0.8.0 (2014-09-10)
144
- ------------------
145
-
146
- * The `GeoIp2\Database\Reader` lookup methods (e.g., `city()`, `isp()`) now
147
- throw a `BadMethodCallException` if they are used with a database that
148
- does not match the method. In particular, doing a `city()` lookup on a
149
- GeoIP2 Country database will result in an exception, and vice versa.
150
- * A `metadata()` method has been added to the `GeoIP2\Database\Reader` class.
151
- This returns a `MaxMind\Db\Reader\Metadata` class with information about the
152
- database.
153
- * The name attribute was missing from the RepresentedCountry class.
154
-
155
- 0.7.0 (2014-07-22)
156
- ------------------
157
-
158
- * The web service client API has been updated for the v2.1 release of the web
159
- service. In particular, the `cityIspOrg` and `omni` methods on
160
- `GeoIp2\WebService\Client` should be considered deprecated. The `city`
161
- method now provides all of the data formerly provided by `cityIspOrg`, and
162
- the `omni` method has been replaced by the `insights` method.
163
- * Support was added for GeoIP2 Connection Type, Domain and ISP databases.
164
-
165
-
166
- 0.6.3 (2014-05-12)
167
- ------------------
168
-
169
- * With the previous Phar builds, some users received `phar error: invalid url
170
- or non-existent phar` errors. The correct alias is now used for the Phar,
171
- and this should no longer be an issue.
172
-
173
- 0.6.2 (2014-05-08)
174
- ------------------
175
-
176
- * The Phar build was broken with Guzzle 3.9.0+. This has been fixed.
177
-
178
- 0.6.1 (2014-05-01)
179
- ------------------
180
-
181
- * This API now officially supports HHVM.
182
- * The `maxmind-db/reader` dependency was updated to a version that does not
183
- require BC Math.
184
- * The Composer compatibility autoload rules are now targeted more narrowly.
185
- * A `box.json` file is included to build a Phar package.
186
-
187
- 0.6.0 (2014-02-19)
188
- ------------------
189
-
190
- * This API is now licensed under the Apache License, Version 2.0.
191
- * Model and record classes now implement `JsonSerializable`.
192
- * `isset` now works with model and record classes.
193
-
194
- 0.5.0 (2013-10-21)
195
- ------------------
196
-
197
- * Renamed $languages constructor parameters to $locales for both the Client
198
- and Reader classes.
199
- * Documentation and code clean-up (Ben Morel).
200
- * Added the interface `GeoIp2\ProviderInterface`, which is implemented by both
201
- `\GeoIp2\Database\Reader` and `\GeoIp2\WebService\Client`.
202
-
203
- 0.4.0 (2013-07-16)
204
- ------------------
205
-
206
- * This is the first release with the GeoIP2 database reader. Please see the
207
- `README.md` file and the `\GeoIp2\Database\Reader` class.
208
- * The general exception classes were replaced with specific exception classes
209
- representing particular types of errors, such as an authentication error.
210
-
211
- 0.3.0 (2013-07-12)
212
- ------------------
213
-
214
- * In namespaces and class names, "GeoIP2" was renamed to "GeoIp2" to improve
215
- consistency.
216
-
217
- 0.2.1 (2013-06-10)
218
- ------------------
219
-
220
- * First official beta release.
221
- * Documentation updates and corrections.
222
-
223
- 0.2.0 (2013-05-29)
224
- ------------------
225
-
226
- * `GenericException` was renamed to `GeoIP2Exception`.
227
- * We now support more languages. The new languages are de, es, fr, and pt-BR.
228
- * The REST API now returns a record with data about your account. There is
229
- a new `GeoIP\Records\MaxMind` class for this data.
230
- * The `continentCode` attribute on `Continent` was renamed to `code`.
231
- * Documentation updates.
232
-
233
- 0.1.1 (2013-05-14)
234
- ------------------
235
-
236
- * Updated Guzzle version requirement.
237
- * Fixed Composer example in README.md.
238
-
239
-
240
- 0.1.0 (2013-05-13)
241
- ------------------
242
-
243
- * Initial release.
1
+ CHANGELOG
2
+ =========
3
+
4
+ 2.6.0 (2017-07-10)
5
+ -----------------
6
+
7
+ * Code clean-up and tidying.
8
+ * Set minimum required PHP version to 5.4 in `composer.json`. Previously,
9
+ 5.3 would work but was not tested. Now 5.4 is hard minimum version.
10
+
11
+ 2.5.0 (2017-05-08)
12
+ ------------------
13
+
14
+ * Support for PHP 5.3 was dropped.
15
+ * Added support for GeoLite2 ASN database.
16
+
17
+ 2.4.5 (2017-01-31)
18
+ ------------------
19
+
20
+ * Additional error checking on the data returned from `MaxMind\Db\Reader`
21
+ was added to help detect corrupt databases. GitHub #83.
22
+
23
+ 2.4.4 (2016-10-11)
24
+ ------------------
25
+
26
+ * `isset()` on `mostSpecificSubdivision` attribute now returns the
27
+ correct value. Reported by Juan Francisco Giordana. GitHub #81.
28
+
29
+ 2.4.3 (2016-10-11)
30
+ ------------------
31
+
32
+ * `isset()` on `name` attribute now returns the correct value. Reported by
33
+ Juan Francisco Giordana. GitHub #79.
34
+
35
+ 2.4.2 (2016-08-17)
36
+ ------------------
37
+
38
+ * Updated documentation to clarify what the accuracy radius refers to.
39
+ * Upgraded `maxmind/web-service-common` to 0.3.0. This version uses
40
+ `composer/ca-bundle` rather than our own CA bundle. GitHub #75.
41
+ * Improved PHP documentation generation.
42
+
43
+ 2.4.1 (2016-06-10)
44
+ ------------------
45
+
46
+ * Corrected type annotations in documentation. GitHub #66.
47
+ * Updated documentation to reflect that the accuracy radius is now included
48
+ in City.
49
+ * Upgraded web service client, which supports setting a proxy. GitHub #59.
50
+
51
+ 2.4.0 (2016-04-15)
52
+ ------------------
53
+
54
+ * Added support for the GeoIP2 Enterprise database.
55
+
56
+ 2.3.3 (2015-09-24)
57
+ ------------------
58
+
59
+ * Corrected case on `JsonSerializable` interface. Reported by Axel Etcheverry.
60
+ GitHub #56.
61
+
62
+ 2.3.2 (2015-09-23)
63
+ ------------------
64
+
65
+ * `JsonSerializable` compatibility interface was moved to `GeoIp2\Compat`
66
+ rather than the global namespace to prevent autoloading issues. Reported by
67
+ Tomas Buteler. GitHub #54.
68
+ * Missing documentation for the `$postal` property was added to the
69
+ `GeoIp2\Model\City` class. Fix by Roy Sindre Norangshol. GitHub #51.
70
+ * In the Phar distribution, source files for this module no longer have their
71
+ documentation stripped, allowing IDE introspection to work properly.
72
+ Reported by Dominic Black. GitHub #52.
73
+
74
+ 2.3.1 (2015-06-30)
75
+ ------------------
76
+
77
+ * Updated `maxmind/web-service-common` to version with fixes for PHP 5.3 and
78
+ 5.4.
79
+
80
+ 2.3.0 (2015-06-29)
81
+ ------------------
82
+
83
+ * Support for demographics fields `averageIncome` and `populationDensity` in
84
+ the `Location` record, returned by the Insights endpoint.
85
+ * The `isAnonymousProxy` and `isSatelliteProvider` properties on
86
+ `GeoIP2\Record\Traits` have been deprecated. Please use our [GeoIP2
87
+ Anonymous IP database](https://www.maxmind.com/en/geoip2-anonymous-ip-database)
88
+ to determine whether an IP address is used by an anonymizing service.
89
+
90
+ 2.2.0-beta1 (2015-06-09)
91
+ ------------------------
92
+
93
+ * Typo fix in documentation.
94
+
95
+ 2.2.0-alpha2 (2015-06-01)
96
+ -------------------------
97
+
98
+ * `maxmind-ws/web-service-common` was renamed to `maxmind/web-service-common`.
99
+
100
+ 2.2.0-alpha1 (2015-05-22)
101
+ -------------------------
102
+
103
+ * The library no longer uses Guzzle and instead uses curl directly.
104
+ * Support for `timeout` and `connectTimout` were added to the `$options` array
105
+ passed to the `GeoIp2\WebService\Client` constructor. Pull request by Will
106
+ Bradley. GitHub #36.
107
+
108
+ 2.1.1 (2014-12-03)
109
+ ------------------
110
+
111
+ * The 2.1.0 Phar builds included a shebang line, causing issues when loading
112
+ it as a library. This has been corrected. GitHub #33.
113
+
114
+ 2.1.0 (2014-10-29)
115
+ ------------------
116
+
117
+ * Update ApiGen dependency to version that isn't broken on case sensitive
118
+ file systems.
119
+ * Added support for the GeoIP2 Anonymous IP database. The
120
+ `GeoIP2\Database\Reader` class now has an `anonymousIp` method which returns
121
+ a `GeoIP2\Model\AnonymousIp` object.
122
+ * Boolean attributes like those in the `GeoIP2\Record\Traits` class now return
123
+ `false` instead of `null` when they were not true.
124
+
125
+ 2.0.0 (2014-09-22)
126
+ ------------------
127
+
128
+ * First production release.
129
+
130
+ 0.9.0 (2014-09-15)
131
+ ------------------
132
+
133
+ * IMPORTANT: The deprecated `omni()` and `cityIspOrg()` methods have been
134
+ removed from `GeoIp2\WebService\Client`.
135
+
136
+ 0.8.1 (2014-09-12)
137
+ ------------------
138
+
139
+ * The check added to the `GeoIP2\Database\Reader` lookup methods in 0.8.0 did
140
+ not work with the GeoIP2 City Database Subset by Continent with World
141
+ Countries. This has been fixed. Fixes GitHub issue #23.
142
+
143
+ 0.8.0 (2014-09-10)
144
+ ------------------
145
+
146
+ * The `GeoIp2\Database\Reader` lookup methods (e.g., `city()`, `isp()`) now
147
+ throw a `BadMethodCallException` if they are used with a database that
148
+ does not match the method. In particular, doing a `city()` lookup on a
149
+ GeoIP2 Country database will result in an exception, and vice versa.
150
+ * A `metadata()` method has been added to the `GeoIP2\Database\Reader` class.
151
+ This returns a `MaxMind\Db\Reader\Metadata` class with information about the
152
+ database.
153
+ * The name attribute was missing from the RepresentedCountry class.
154
+
155
+ 0.7.0 (2014-07-22)
156
+ ------------------
157
+
158
+ * The web service client API has been updated for the v2.1 release of the web
159
+ service. In particular, the `cityIspOrg` and `omni` methods on
160
+ `GeoIp2\WebService\Client` should be considered deprecated. The `city`
161
+ method now provides all of the data formerly provided by `cityIspOrg`, and
162
+ the `omni` method has been replaced by the `insights` method.
163
+ * Support was added for GeoIP2 Connection Type, Domain and ISP databases.
164
+
165
+
166
+ 0.6.3 (2014-05-12)
167
+ ------------------
168
+
169
+ * With the previous Phar builds, some users received `phar error: invalid url
170
+ or non-existent phar` errors. The correct alias is now used for the Phar,
171
+ and this should no longer be an issue.
172
+
173
+ 0.6.2 (2014-05-08)
174
+ ------------------
175
+
176
+ * The Phar build was broken with Guzzle 3.9.0+. This has been fixed.
177
+
178
+ 0.6.1 (2014-05-01)
179
+ ------------------
180
+
181
+ * This API now officially supports HHVM.
182
+ * The `maxmind-db/reader` dependency was updated to a version that does not
183
+ require BC Math.
184
+ * The Composer compatibility autoload rules are now targeted more narrowly.
185
+ * A `box.json` file is included to build a Phar package.
186
+
187
+ 0.6.0 (2014-02-19)
188
+ ------------------
189
+
190
+ * This API is now licensed under the Apache License, Version 2.0.
191
+ * Model and record classes now implement `JsonSerializable`.
192
+ * `isset` now works with model and record classes.
193
+
194
+ 0.5.0 (2013-10-21)
195
+ ------------------
196
+
197
+ * Renamed $languages constructor parameters to $locales for both the Client
198
+ and Reader classes.
199
+ * Documentation and code clean-up (Ben Morel).
200
+ * Added the interface `GeoIp2\ProviderInterface`, which is implemented by both
201
+ `\GeoIp2\Database\Reader` and `\GeoIp2\WebService\Client`.
202
+
203
+ 0.4.0 (2013-07-16)
204
+ ------------------
205
+
206
+ * This is the first release with the GeoIP2 database reader. Please see the
207
+ `README.md` file and the `\GeoIp2\Database\Reader` class.
208
+ * The general exception classes were replaced with specific exception classes
209
+ representing particular types of errors, such as an authentication error.
210
+
211
+ 0.3.0 (2013-07-12)
212
+ ------------------
213
+
214
+ * In namespaces and class names, "GeoIP2" was renamed to "GeoIp2" to improve
215
+ consistency.
216
+
217
+ 0.2.1 (2013-06-10)
218
+ ------------------
219
+
220
+ * First official beta release.
221
+ * Documentation updates and corrections.
222
+
223
+ 0.2.0 (2013-05-29)
224
+ ------------------
225
+
226
+ * `GenericException` was renamed to `GeoIP2Exception`.
227
+ * We now support more languages. The new languages are de, es, fr, and pt-BR.
228
+ * The REST API now returns a record with data about your account. There is
229
+ a new `GeoIP\Records\MaxMind` class for this data.
230
+ * The `continentCode` attribute on `Continent` was renamed to `code`.
231
+ * Documentation updates.
232
+
233
+ 0.1.1 (2013-05-14)
234
+ ------------------
235
+
236
+ * Updated Guzzle version requirement.
237
+ * Fixed Composer example in README.md.
238
+
239
+
240
+ 0.1.0 (2013-05-13)
241
+ ------------------
242
+
243
+ * Initial release.
vendor/geoip2/geoip2/LICENSE CHANGED
@@ -1,202 +1,202 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
vendor/geoip2/geoip2/README.md CHANGED
@@ -1,401 +1,401 @@
1
- # GeoIP2 PHP API #
2
-
3
- ## Description ##
4
-
5
- This package provides an API for the GeoIP2
6
- [web services](http://dev.maxmind.com/geoip/geoip2/web-services) and
7
- [databases](http://dev.maxmind.com/geoip/geoip2/downloadable). The API also
8
- works with the free
9
- [GeoLite2 databases](http://dev.maxmind.com/geoip/geoip2/geolite2/).
10
-
11
- ## Install via Composer ##
12
-
13
- We recommend installing this package with [Composer](http://getcomposer.org/).
14
-
15
- ### Download Composer ###
16
-
17
- To download Composer, run in the root directory of your project:
18
-
19
- ```bash
20
- curl -sS https://getcomposer.org/installer | php
21
- ```
22
-
23
- You should now have the file `composer.phar` in your project directory.
24
-
25
- ### Install Dependencies ###
26
-
27
- Run in your project root:
28
-
29
- ```
30
- php composer.phar require geoip2/geoip2:~2.0
31
- ```
32
-
33
- You should now have the files `composer.json` and `composer.lock` as well as
34
- the directory `vendor` in your project directory. If you use a version control
35
- system, `composer.json` should be added to it.
36
-
37
- ### Require Autoloader ###
38
-
39
- After installing the dependencies, you need to require the Composer autoloader
40
- from your code:
41
-
42
- ```php
43
- require 'vendor/autoload.php';
44
- ```
45
-
46
- ## Install via Phar ##
47
-
48
- Although we strongly recommend using Composer, we also provide a
49
- [phar archive](http://php.net/manual/en/book.phar.php) containing most of the
50
- dependencies for GeoIP2. Our latest phar archive is available on
51
- [our releases page](https://github.com/maxmind/GeoIP2-php/releases).
52
-
53
- ### Install Dependencies ###
54
-
55
- In order to use the phar archive, you must have the PHP
56
- [Phar extension](http://php.net/manual/en/book.phar.php) installed and
57
- enabled.
58
-
59
- If you will be making web service requests, you must have the PHP
60
- [cURL extension](http://php.net/manual/en/book.curl.php)
61
- installed to use this archive. For Debian based distributions, this can
62
- typically be found in the the `php-curl` package. For other operating
63
- systems, please consult the relevant documentation. After installing the
64
- extension you may need to restart your web server.
65
-
66
- If you are missing this extension, you will see errors like the following:
67
-
68
- ```
69
- PHP Fatal error: Uncaught Error: Call to undefined function MaxMind\WebService\curl_version()
70
- ```
71
-
72
- ### Require Package ###
73
-
74
- To use the archive, just require it from your script:
75
-
76
- ```php
77
- require 'geoip2.phar';
78
- ```
79
-
80
- ## Optional C Extension ##
81
-
82
- The [MaxMind DB API](https://github.com/maxmind/MaxMind-DB-Reader-php)
83
- includes an optional C extension that you may install to dramatically increase
84
- the performance of lookups in GeoIP2 or GeoLite2 databases. To install, please
85
- follow the instructions included with that API.
86
-
87
- The extension has no effect on web-service lookups.
88
-
89
- ## IP Geolocation Usage ##
90
-
91
- IP geolocation is inherently imprecise. Locations are often near the center of
92
- the population. Any location provided by a GeoIP2 database or web service
93
- should not be used to identify a particular address or household.
94
-
95
- ## Database Reader ##
96
-
97
- ### Usage ###
98
-
99
- To use this API, you must create a new `\GeoIp2\Database\Reader` object with
100
- the path to the database file as the first argument to the constructor. You
101
- may then call the method corresponding to the database you are using.
102
-
103
- If the lookup succeeds, the method call will return a model class for the
104
- record in the database. This model in turn contains multiple container
105
- classes for the different parts of the data such as the city in which the
106
- IP address is located.
107
-
108
- If the record is not found, a `\GeoIp2\Exception\AddressNotFoundException`
109
- is thrown. If the database is invalid or corrupt, a
110
- `\MaxMind\Db\InvalidDatabaseException` will be thrown.
111
-
112
- See the API documentation for more details.
113
-
114
- ### City Example ###
115
-
116
- ```php
117
- <?php
118
- require_once 'vendor/autoload.php';
119
- use GeoIp2\Database\Reader;
120
-
121
- // This creates the Reader object, which should be reused across
122
- // lookups.
123
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-City.mmdb');
124
-
125
- // Replace "city" with the appropriate method for your database, e.g.,
126
- // "country".
127
- $record = $reader->city('128.101.101.101');
128
-
129
- print($record->country->isoCode . "\n"); // 'US'
130
- print($record->country->name . "\n"); // 'United States'
131
- print($record->country->names['zh-CN'] . "\n"); // '美国'
132
-
133
- print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
134
- print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
135
-
136
- print($record->city->name . "\n"); // 'Minneapolis'
137
-
138
- print($record->postal->code . "\n"); // '55455'
139
-
140
- print($record->location->latitude . "\n"); // 44.9733
141
- print($record->location->longitude . "\n"); // -93.2323
142
-
143
- ```
144
-
145
- ### Anonymous IP Example ###
146
-
147
- ```php
148
- <?php
149
- require_once 'vendor/autoload.php';
150
- use GeoIp2\Database\Reader;
151
-
152
- // This creates the Reader object, which should be reused across
153
- // lookups.
154
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Anonymous-IP.mmdb');
155
-
156
- $record = $reader->anonymousIp('128.101.101.101');
157
-
158
- if ($record->isAnonymous) { print "anon\n"; }
159
- print($record->ipAddress . "\n"); // '128.101.101.101'
160
-
161
- ```
162
-
163
- ### Connection-Type Example ###
164
-
165
- ```php
166
- <?php
167
- require_once 'vendor/autoload.php';
168
- use GeoIp2\Database\Reader;
169
-
170
- // This creates the Reader object, which should be reused across
171
- // lookups.
172
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Connection-Type.mmdb');
173
-
174
- $record = $reader->connectionType('128.101.101.101');
175
-
176
- print($record->connectionType . "\n"); // 'Corporate'
177
- print($record->ipAddress . "\n"); // '128.101.101.101'
178
-
179
- ```
180
-
181
- ### Domain Example ###
182
-
183
- ```php
184
- <?php
185
- require_once 'vendor/autoload.php';
186
- use GeoIp2\Database\Reader;
187
-
188
- // This creates the Reader object, which should be reused across
189
- // lookups.
190
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Domain.mmdb');
191
-
192
- $record = $reader->domain('128.101.101.101');
193
-
194
- print($record->domain . "\n"); // 'umn.edu'
195
- print($record->ipAddress . "\n"); // '128.101.101.101'
196
-
197
- ```
198
-
199
- ### Enterprise Example ###
200
-
201
- ```php
202
- <?php
203
- require_once 'vendor/autoload.php';
204
- use GeoIp2\Database\Reader;
205
-
206
- // This creates the Reader object, which should be reused across
207
- // lookups.
208
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Enterprise.mmdb');
209
-
210
- // Use the ->enterprise method to do a lookup in the Enterprise database
211
- $record = $reader->enterprise('128.101.101.101');
212
-
213
- print($record->country->confidence . "\n"); // 99
214
- print($record->country->isoCode . "\n"); // 'US'
215
- print($record->country->name . "\n"); // 'United States'
216
- print($record->country->names['zh-CN'] . "\n"); // '美国'
217
-
218
- print($record->mostSpecificSubdivision->confidence . "\n"); // 77
219
- print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
220
- print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
221
-
222
- print($record->city->confidence . "\n"); // 60
223
- print($record->city->name . "\n"); // 'Minneapolis'
224
-
225
- print($record->postal->code . "\n"); // '55455'
226
-
227
- print($record->location->accuracyRadius . "\n"); // 50
228
- print($record->location->latitude . "\n"); // 44.9733
229
- print($record->location->longitude . "\n"); // -93.2323
230
-
231
- ```
232
-
233
- ### ISP Example ###
234
-
235
- ```php
236
- <?php
237
- require_once 'vendor/autoload.php';
238
- use GeoIp2\Database\Reader;
239
-
240
- // This creates the Reader object, which should be reused across
241
- // lookups.
242
- $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-ISP.mmdb');
243
-
244
- $record = $reader->isp('128.101.101.101');
245
-
246
- print($record->autonomousSystemNumber . "\n"); // 217
247
- print($record->autonomousSystemOrganization . "\n"); // 'University of Minnesota'
248
- print($record->isp . "\n"); // 'University of Minnesota'
249
- print($record->organization . "\n"); // 'University of Minnesota'
250
-
251
- print($record->ipAddress . "\n"); // '128.101.101.101'
252
-
253
- ```
254
-
255
- ## Web Service Client ##
256
-
257
- ### Usage ###
258
-
259
- To use this API, you must create a new `\GeoIp2\WebService\Client`
260
- object with your `$userId` and `$licenseKey`, then you call the method
261
- corresponding to a specific end point, passing it the IP address you want to
262
- look up.
263
-
264
- If the request succeeds, the method call will return a model class for the end
265
- point you called. This model in turn contains multiple record classes, each of
266
- which represents part of the data returned by the web service.
267
-
268
- If there is an error, a structured exception is thrown.
269
-
270
- See the API documentation for more details.
271
-
272
- ### Example ###
273
-
274
- ```php
275
- <?php
276
- require_once 'vendor/autoload.php';
277
- use GeoIp2\WebService\Client;
278
-
279
- // This creates a Client object that can be reused across requests.
280
- // Replace "42" with your user ID and "license_key" with your license
281
- // key.
282
- $client = new Client(42, 'abcdef123456');
283
-
284
- // Replace "city" with the method corresponding to the web service that
285
- // you are using, e.g., "country", "insights".
286
- $record = $client->city('128.101.101.101');
287
-
288
- print($record->country->isoCode . "\n"); // 'US'
289
- print($record->country->name . "\n"); // 'United States'
290
- print($record->country->names['zh-CN'] . "\n"); // '美国'
291
-
292
- print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
293
- print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
294
-
295
- print($record->city->name . "\n"); // 'Minneapolis'
296
-
297
- print($record->postal->code . "\n"); // '55455'
298
-
299
- print($record->location->latitude . "\n"); // 44.9733
300
- print($record->location->longitude . "\n"); // -93.2323
301
-
302
- ```
303
-
304
- ## Values to use for Database or Array Keys ##
305
-
306
- **We strongly discourage you from using a value from any `names` property as
307
- a key in a database or array.**
308
-
309
- These names may change between releases. Instead we recommend using one of the
310
- following:
311
-
312
- * `GeoIp2\Record\City` - `$city->geonameId`
313
- * `GeoIp2\Record\Continent` - `$continent->code` or `$continent->geonameId`
314
- * `GeoIp2\Record\Country` and `GeoIp2\Record\RepresentedCountry` -
315
- `$country->isoCode` or `$country->geonameId`
316
- * `GeoIp2\Record\Subdivision` - `$subdivision->isoCode` or `$subdivision->geonameId`
317
-
318
- ### What data is returned? ###
319
-
320
- While many of the end points return the same basic records, the attributes
321
- which can be populated vary between end points. In addition, while an end
322
- point may offer a particular piece of data, MaxMind does not always have every
323
- piece of data for any given IP address.
324
-
325
- Because of these factors, it is possible for any end point to return a record
326
- where some or all of the attributes are unpopulated.
327
-
328
- See the
329
- [GeoIP2 Precision web service docs](http://dev.maxmind.com/geoip/geoip2/web-services)
330
- for details on what data each end point may return.
331
-
332
- The only piece of data which is always returned is the `ipAddress`
333
- attribute in the `GeoIp2\Record\Traits` record.
334
-
335
- ## Integration with GeoNames ##
336
-
337
- [GeoNames](http://www.geonames.org/) offers web services and downloadable
338
- databases with data on geographical features around the world, including
339
- populated places. They offer both free and paid premium data. Each
340
- feature is unique identified by a `geonameId`, which is an integer.
341
-
342
- Many of the records returned by the GeoIP2 web services and databases
343
- include a `geonameId` property. This is the ID of a geographical feature
344
- (city, region, country, etc.) in the GeoNames database.
345
-
346
- Some of the data that MaxMind provides is also sourced from GeoNames. We
347
- source things like place names, ISO codes, and other similar data from
348
- the GeoNames premium data set.
349
-
350
- ## Reporting data problems ##
351
-
352
- If the problem you find is that an IP address is incorrectly mapped,
353
- please
354
- [submit your correction to MaxMind](http://www.maxmind.com/en/correction).
355
-
356
- If you find some other sort of mistake, like an incorrect spelling,
357
- please check the [GeoNames site](http://www.geonames.org/) first. Once
358
- you've searched for a place and found it on the GeoNames map view, there
359
- are a number of links you can use to correct data ("move", "edit",
360
- "alternate names", etc.). Once the correction is part of the GeoNames
361
- data set, it will be automatically incorporated into future MaxMind
362
- releases.
363
-
364
- If you are a paying MaxMind customer and you're not sure where to submit
365
- a correction, please
366
- [contact MaxMind support](http://www.maxmind.com/en/support) for help.
367
-
368
- ## Other Support ##
369
-
370
- Please report all issues with this code using the
371
- [GitHub issue tracker](https://github.com/maxmind/GeoIP2-php/issues).
372
-
373
- If you are having an issue with a MaxMind service that is not specific
374
- to the client API, please see
375
- [our support page](http://www.maxmind.com/en/support).
376
-
377
- ## Requirements ##
378
-
379
- This library requires PHP 5.4 or greater. This library works and is tested
380
- with HHVM.
381
-
382
- This library also relies on the [MaxMind DB Reader](https://github.com/maxmind/MaxMind-DB-Reader-php).
383
-
384
- ## Contributing ##
385
-
386
- Patches and pull requests are encouraged. All code should follow the PSR-2
387
- style guidelines. Please include unit tests whenever possible. You may obtain
388
- the test data for the maxmind-db folder by running `git submodule update
389
- --init --recursive` or adding `--recursive` to your initial clone, or from
390
- https://github.com/maxmind/MaxMind-DB
391
-
392
- ## Versioning ##
393
-
394
- The GeoIP2 PHP API uses [Semantic Versioning](http://semver.org/).
395
-
396
- ## Copyright and License ##
397
-
398
- This software is Copyright (c) 2013-2017 by MaxMind, Inc.
399
-
400
- This is free software, licensed under the Apache License, Version 2.0.
401
-
1
+ # GeoIP2 PHP API #
2
+
3
+ ## Description ##
4
+
5
+ This package provides an API for the GeoIP2
6
+ [web services](http://dev.maxmind.com/geoip/geoip2/web-services) and
7
+ [databases](http://dev.maxmind.com/geoip/geoip2/downloadable). The API also
8
+ works with the free
9
+ [GeoLite2 databases](http://dev.maxmind.com/geoip/geoip2/geolite2/).
10
+
11
+ ## Install via Composer ##
12
+
13
+ We recommend installing this package with [Composer](http://getcomposer.org/).
14
+
15
+ ### Download Composer ###
16
+
17
+ To download Composer, run in the root directory of your project:
18
+
19
+ ```bash
20
+ curl -sS https://getcomposer.org/installer | php
21
+ ```
22
+
23
+ You should now have the file `composer.phar` in your project directory.
24
+
25
+ ### Install Dependencies ###
26
+
27
+ Run in your project root:
28
+
29
+ ```
30
+ php composer.phar require geoip2/geoip2:~2.0
31
+ ```
32
+
33
+ You should now have the files `composer.json` and `composer.lock` as well as
34
+ the directory `vendor` in your project directory. If you use a version control
35
+ system, `composer.json` should be added to it.
36
+
37
+ ### Require Autoloader ###
38
+
39
+ After installing the dependencies, you need to require the Composer autoloader
40
+ from your code:
41
+
42
+ ```php
43
+ require 'vendor/autoload.php';
44
+ ```
45
+
46
+ ## Install via Phar ##
47
+
48
+ Although we strongly recommend using Composer, we also provide a
49
+ [phar archive](http://php.net/manual/en/book.phar.php) containing most of the
50
+ dependencies for GeoIP2. Our latest phar archive is available on
51
+ [our releases page](https://github.com/maxmind/GeoIP2-php/releases).
52
+
53
+ ### Install Dependencies ###
54
+
55
+ In order to use the phar archive, you must have the PHP
56
+ [Phar extension](http://php.net/manual/en/book.phar.php) installed and
57
+ enabled.
58
+
59
+ If you will be making web service requests, you must have the PHP
60
+ [cURL extension](http://php.net/manual/en/book.curl.php)
61
+ installed to use this archive. For Debian based distributions, this can
62
+ typically be found in the the `php-curl` package. For other operating
63
+ systems, please consult the relevant documentation. After installing the
64
+ extension you may need to restart your web server.
65
+
66
+ If you are missing this extension, you will see errors like the following:
67
+
68
+ ```
69
+ PHP Fatal error: Uncaught Error: Call to undefined function MaxMind\WebService\curl_version()
70
+ ```
71
+
72
+ ### Require Package ###
73
+
74
+ To use the archive, just require it from your script:
75
+
76
+ ```php
77
+ require 'geoip2.phar';
78
+ ```
79
+
80
+ ## Optional C Extension ##
81
+
82
+ The [MaxMind DB API](https://github.com/maxmind/MaxMind-DB-Reader-php)
83
+ includes an optional C extension that you may install to dramatically increase
84
+ the performance of lookups in GeoIP2 or GeoLite2 databases. To install, please
85
+ follow the instructions included with that API.
86
+
87
+ The extension has no effect on web-service lookups.
88
+
89
+ ## IP Geolocation Usage ##
90
+
91
+ IP geolocation is inherently imprecise. Locations are often near the center of
92
+ the population. Any location provided by a GeoIP2 database or web service
93
+ should not be used to identify a particular address or household.
94
+
95
+ ## Database Reader ##
96
+
97
+ ### Usage ###
98
+
99
+ To use this API, you must create a new `\GeoIp2\Database\Reader` object with
100
+ the path to the database file as the first argument to the constructor. You
101
+ may then call the method corresponding to the database you are using.
102
+
103
+ If the lookup succeeds, the method call will return a model class for the
104
+ record in the database. This model in turn contains multiple container
105
+ classes for the different parts of the data such as the city in which the
106
+ IP address is located.
107
+
108
+ If the record is not found, a `\GeoIp2\Exception\AddressNotFoundException`
109
+ is thrown. If the database is invalid or corrupt, a
110
+ `\MaxMind\Db\InvalidDatabaseException` will be thrown.
111
+
112
+ See the API documentation for more details.
113
+
114
+ ### City Example ###
115
+
116
+ ```php
117
+ <?php
118
+ require_once 'vendor/autoload.php';
119
+ use GeoIp2\Database\Reader;
120
+
121
+ // This creates the Reader object, which should be reused across
122
+ // lookups.
123
+ $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-City.mmdb');
124
+
125
+ // Replace "city" with the appropriate method for your database, e.g.,
126
+ // "country".
127
+ $record = $reader->city('128.101.101.101');
128
+
129
+ print($record->country->isoCode . "\n"); // 'US'
130
+ print($record->country->name . "\n"); // 'United States'
131
+ print($record->country->names['zh-CN'] . "\n"); // '美国'
132
+
133
+ print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
134
+ print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
135
+
136
+ print($record->city->name . "\n"); // 'Minneapolis'
137
+
138
+ print($record->postal->code . "\n"); // '55455'
139
+
140
+ print($record->location->latitude . "\n"); // 44.9733
141
+ print($record->location->longitude . "\n"); // -93.2323
142
+
143
+ ```
144
+
145
+ ### Anonymous IP Example ###
146
+
147
+ ```php
148
+ <?php
149
+ require_once 'vendor/autoload.php';
150
+ use GeoIp2\Database\Reader;
151
+
152
+ // This creates the Reader object, which should be reused across
153
+ // lookups.
154
+ $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Anonymous-IP.mmdb');
155
+
156
+ $record = $reader->anonymousIp('128.101.101.101');
157
+
158
+ if ($record->isAnonymous) { print "anon\n"; }
159
+ print($record->ipAddress . "\n"); // '128.101.101.101'
160
+
161
+ ```
162
+
163
+ ### Connection-Type Example ###
164
+
165
+ ```php
166
+ <?php
167
+ require_once 'vendor/autoload.php';
168
+ use GeoIp2\Database\Reader;
169
+
170
+ // This creates the Reader object, which should be reused across
171
+ // lookups.
172
+ $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Connection-Type.mmdb');
173
+
174
+ $record = $reader->connectionType('128.101.101.101');
175
+
176
+ print($record->connectionType . "\n"); // 'Corporate'
177
+ print($record->ipAddress . "\n"); // '128.101.101.101'
178
+
179
+ ```
180
+
181
+ ### Domain Example ###
182
+
183
+ ```php
184
+ <?php
185
+ require_once 'vendor/autoload.php';
186
+ use GeoIp2\Database\Reader;
187
+
188
+ // This creates the Reader object, which should be reused across
189
+ // lookups.
190
+ $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Domain.mmdb');
191
+
192
+ $record = $reader->domain('128.101.101.101');
193
+
194
+ print($record->domain . "\n"); // 'umn.edu'
195
+ print($record->ipAddress . "\n"); // '128.101.101.101'
196
+
197
+ ```
198
+
199
+ ### Enterprise Example ###
200
+
201
+ ```php
202
+ <?php
203
+ require_once 'vendor/autoload.php';
204
+ use GeoIp2\Database\Reader;
205
+
206
+ // This creates the Reader object, which should be reused across
207
+ // lookups.
208
+ $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-Enterprise.mmdb');
209
+
210
+ // Use the ->enterprise method to do a lookup in the Enterprise database
211
+ $record = $reader->enterprise('128.101.101.101');
212
+
213
+ print($record->country->confidence . "\n"); // 99
214
+ print($record->country->isoCode . "\n"); // 'US'
215
+ print($record->country->name . "\n"); // 'United States'
216
+ print($record->country->names['zh-CN'] . "\n"); // '美国'
217
+
218
+ print($record->mostSpecificSubdivision->confidence . "\n"); // 77
219
+ print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
220
+ print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
221
+
222
+ print($record->city->confidence . "\n"); // 60
223
+ print($record->city->name . "\n"); // 'Minneapolis'
224
+
225
+ print($record->postal->code . "\n"); // '55455'
226
+
227
+ print($record->location->accuracyRadius . "\n"); // 50
228
+ print($record->location->latitude . "\n"); // 44.9733
229
+ print($record->location->longitude . "\n"); // -93.2323
230
+
231
+ ```
232
+
233
+ ### ISP Example ###
234
+
235
+ ```php
236
+ <?php
237
+ require_once 'vendor/autoload.php';
238
+ use GeoIp2\Database\Reader;
239
+
240
+ // This creates the Reader object, which should be reused across
241
+ // lookups.
242
+ $reader = new Reader('/usr/local/share/GeoIP/GeoIP2-ISP.mmdb');
243
+
244
+ $record = $reader->isp('128.101.101.101');
245
+
246
+ print($record->autonomousSystemNumber . "\n"); // 217
247
+ print($record->autonomousSystemOrganization . "\n"); // 'University of Minnesota'
248
+ print($record->isp . "\n"); // 'University of Minnesota'
249
+ print($record->organization . "\n"); // 'University of Minnesota'
250
+
251
+ print($record->ipAddress . "\n"); // '128.101.101.101'
252
+
253
+ ```
254
+
255
+ ## Web Service Client ##
256
+
257
+ ### Usage ###
258
+
259
+ To use this API, you must create a new `\GeoIp2\WebService\Client`
260
+ object with your `$userId` and `$licenseKey`, then you call the method
261
+ corresponding to a specific end point, passing it the IP address you want to
262
+ look up.
263
+
264
+ If the request succeeds, the method call will return a model class for the end
265
+ point you called. This model in turn contains multiple record classes, each of
266
+ which represents part of the data returned by the web service.
267
+
268
+ If there is an error, a structured exception is thrown.
269
+
270
+ See the API documentation for more details.
271
+
272
+ ### Example ###
273
+
274
+ ```php
275
+ <?php
276
+ require_once 'vendor/autoload.php';
277
+ use GeoIp2\WebService\Client;
278
+
279
+ // This creates a Client object that can be reused across requests.
280
+ // Replace "42" with your user ID and "license_key" with your license
281
+ // key.
282
+ $client = new Client(42, 'abcdef123456');
283
+
284
+ // Replace "city" with the method corresponding to the web service that
285
+ // you are using, e.g., "country", "insights".
286
+ $record = $client->city('128.101.101.101');
287
+
288
+ print($record->country->isoCode . "\n"); // 'US'
289
+ print($record->country->name . "\n"); // 'United States'
290
+ print($record->country->names['zh-CN'] . "\n"); // '美国'
291
+
292
+ print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
293
+ print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
294
+
295
+ print($record->city->name . "\n"); // 'Minneapolis'
296
+
297
+ print($record->postal->code . "\n"); // '55455'
298
+
299
+ print($record->location->latitude . "\n"); // 44.9733
300
+ print($record->location->longitude . "\n"); // -93.2323
301
+
302
+ ```
303
+
304
+ ## Values to use for Database or Array Keys ##
305
+
306
+ **We strongly discourage you from using a value from any `names` property as
307
+ a key in a database or array.**
308
+
309
+ These names may change between releases. Instead we recommend using one of the
310
+ following:
311
+
312
+ * `GeoIp2\Record\City` - `$city->geonameId`
313
+ * `GeoIp2\Record\Continent` - `$continent->code` or `$continent->geonameId`
314
+ * `GeoIp2\Record\Country` and `GeoIp2\Record\RepresentedCountry` -
315
+ `$country->isoCode` or `$country->geonameId`
316
+ * `GeoIp2\Record\Subdivision` - `$subdivision->isoCode` or `$subdivision->geonameId`
317
+
318
+ ### What data is returned? ###
319
+
320
+ While many of the end points return the same basic records, the attributes
321
+ which can be populated vary between end points. In addition, while an end
322
+ point may offer a particular piece of data, MaxMind does not always have every
323
+ piece of data for any given IP address.
324
+
325
+ Because of these factors, it is possible for any end point to return a record
326
+ where some or all of the attributes are unpopulated.
327
+
328
+ See the
329
+ [GeoIP2 Precision web service docs](http://dev.maxmind.com/geoip/geoip2/web-services)
330
+ for details on what data each end point may return.
331
+
332
+ The only piece of data which is always returned is the `ipAddress`
333
+ attribute in the `GeoIp2\Record\Traits` record.
334
+
335
+ ## Integration with GeoNames ##
336
+
337
+ [GeoNames](http://www.geonames.org/) offers web services and downloadable
338
+ databases with data on geographical features around the world, including
339
+ populated places. They offer both free and paid premium data. Each
340
+ feature is unique identified by a `geonameId`, which is an integer.
341
+
342
+ Many of the records returned by the GeoIP2 web services and databases
343
+ include a `geonameId` property. This is the ID of a geographical feature
344
+ (city, region, country, etc.) in the GeoNames database.
345
+
346
+ Some of the data that MaxMind provides is also sourced from GeoNames. We
347
+ source things like place names, ISO codes, and other similar data from
348
+ the GeoNames premium data set.
349
+
350
+ ## Reporting data problems ##
351
+
352
+ If the problem you find is that an IP address is incorrectly mapped,
353
+ please
354
+ [submit your correction to MaxMind](http://www.maxmind.com/en/correction).
355
+
356
+ If you find some other sort of mistake, like an incorrect spelling,
357
+ please check the [GeoNames site](http://www.geonames.org/) first. Once
358
+ you've searched for a place and found it on the GeoNames map view, there
359
+ are a number of links you can use to correct data ("move", "edit",
360
+ "alternate names", etc.). Once the correction is part of the GeoNames
361
+ data set, it will be automatically incorporated into future MaxMind
362
+ releases.
363
+
364
+ If you are a paying MaxMind customer and you're not sure where to submit
365
+ a correction, please
366
+ [contact MaxMind support](http://www.maxmind.com/en/support) for help.
367
+
368
+ ## Other Support ##
369
+
370
+ Please report all issues with this code using the
371
+ [GitHub issue tracker](https://github.com/maxmind/GeoIP2-php/issues).
372
+
373
+ If you are having an issue with a MaxMind service that is not specific
374
+ to the client API, please see
375
+ [our support page](http://www.maxmind.com/en/support).
376
+
377
+ ## Requirements ##
378
+
379
+ This library requires PHP 5.4 or greater. This library works and is tested
380
+ with HHVM.
381
+
382
+ This library also relies on the [MaxMind DB Reader](https://github.com/maxmind/MaxMind-DB-Reader-php).
383
+
384
+ ## Contributing ##
385
+
386
+ Patches and pull requests are encouraged. All code should follow the PSR-2
387
+ style guidelines. Please include unit tests whenever possible. You may obtain
388
+ the test data for the maxmind-db folder by running `git submodule update
389
+ --init --recursive` or adding `--recursive` to your initial clone, or from
390
+ https://github.com/maxmind/MaxMind-DB
391
+
392
+ ## Versioning ##
393
+
394
+ The GeoIP2 PHP API uses [Semantic Versioning](http://semver.org/).
395
+
396
+ ## Copyright and License ##
397
+
398
+ This software is Copyright (c) 2013-2017 by MaxMind, Inc.
399
+
400
+ This is free software, licensed under the Apache License, Version 2.0.
401
+
vendor/geoip2/geoip2/composer.json CHANGED
@@ -1,31 +1,31 @@
1
- {
2
- "name": "geoip2/geoip2",
3
- "description": "MaxMind GeoIP2 PHP API",
4
- "keywords": ["geoip", "geoip2", "geolocation", "ip", "maxmind"],
5
- "homepage": "https://github.com/maxmind/GeoIP2-php",
6
- "type": "library",
7
- "license": "Apache-2.0",
8
- "authors": [
9
- {
10
- "name": "Gregory J. Oschwald",
11
- "email": "goschwald@maxmind.com",
12
- "homepage": "http://www.maxmind.com/"
13
- }
14
- ],
15
- "require": {
16
- "maxmind-db/reader": "~1.0",
17
- "maxmind/web-service-common": "~0.4",
18
- "php": ">=5.4"
19
- },
20
- "require-dev": {
21
- "friendsofphp/php-cs-fixer": "2.*",
22
- "phpunit/phpunit": "4.*",
23
- "squizlabs/php_codesniffer": "3.*",
24
- "apigen/apigen": "*"
25
- },
26
- "autoload": {
27
- "psr-4": {
28
- "GeoIp2\\": "src"
29
- }
30
- }
31
- }
1
+ {
2
+ "name": "geoip2/geoip2",
3
+ "description": "MaxMind GeoIP2 PHP API",
4
+ "keywords": ["geoip", "geoip2", "geolocation", "ip", "maxmind"],
5
+ "homepage": "https://github.com/maxmind/GeoIP2-php",
6
+ "type": "library",
7
+ "license": "Apache-2.0",
8
+ "authors": [
9
+ {
10
+ "name": "Gregory J. Oschwald",
11
+ "email": "goschwald@maxmind.com",
12
+ "homepage": "http://www.maxmind.com/"
13
+ }
14
+ ],
15
+ "require": {
16
+ "maxmind-db/reader": "~1.0",
17
+ "maxmind/web-service-common": "~0.4",
18
+ "php": ">=5.4"
19
+ },
20
+ "require-dev": {
21
+ "friendsofphp/php-cs-fixer": "2.*",
22
+ "phpunit/phpunit": "4.*",
23
+ "squizlabs/php_codesniffer": "3.*",
24
+ "apigen/apigen": "*"
25
+ },
26
+ "autoload": {
27
+ "psr-4": {
28
+ "GeoIp2\\": "src"
29
+ }
30
+ }
31
+ }
vendor/geoip2/geoip2/src/Database/Reader.php CHANGED
@@ -1,283 +1,283 @@
1
- <?php
2
-
3
- namespace GeoIp2\Database;
4
-
5
- use GeoIp2\Exception\AddressNotFoundException;
6
- use GeoIp2\ProviderInterface;
7
- use MaxMind\Db\Reader as DbReader;
8
- use MaxMind\Db\Reader\InvalidDatabaseException;
9
-
10
- /**
11
- * Instances of this class provide a reader for the GeoIP2 database format.
12
- * IP addresses can be looked up using the database specific methods.
13
- *
14
- * ## Usage ##
15
- *
16
- * The basic API for this class is the same for every database. First, you
17
- * create a reader object, specifying a file name. You then call the method
18
- * corresponding to the specific database, passing it the IP address you want
19
- * to look up.
20
- *
21
- * If the request succeeds, the method call will return a model class for
22
- * the method you called. This model in turn contains multiple record classes,
23
- * each of which represents part of the data returned by the database. If
24
- * the database does not contain the requested information, the attributes
25
- * on the record class will have a `null` value.
26
- *
27
- * If the address is not in the database, an
28
- * {@link \GeoIp2\Exception\AddressNotFoundException} exception will be
29
- * thrown. If an invalid IP address is passed to one of the methods, a
30
- * SPL {@link \InvalidArgumentException} will be thrown. If the database is
31
- * corrupt or invalid, a {@link \MaxMind\Db\Reader\InvalidDatabaseException}
32
- * will be thrown.
33
- */
34
- class Reader implements ProviderInterface
35
- {
36
- private $dbReader;
37
- private $locales;
38
-
39
- /**
40
- * Constructor.
41
- *
42
- * @param string $filename the path to the GeoIP2 database file
43
- * @param array $locales list of locale codes to use in name property
44
- * from most preferred to least preferred
45
- *
46
- * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
47
- * is corrupt or invalid
48
- */
49
- public function __construct(
50
- $filename,
51
- $locales = ['en']
52
- ) {
53
- $this->dbReader = new DbReader($filename);
54
- $this->locales = $locales;
55
- }
56
-
57
- /**
58
- * This method returns a GeoIP2 City model.
59
- *
60
- * @param string $ipAddress an IPv4 or IPv6 address as a string
61
- *
62
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
63
- * not in the database
64
- * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
65
- * is corrupt or invalid
66
- *
67
- * @return \GeoIp2\Model\City
68
- */
69
- public function city($ipAddress)
70
- {
71
- return $this->modelFor('City', 'City', $ipAddress);
72
- }
73
-
74
- /**
75
- * This method returns a GeoIP2 Country model.
76
- *
77
- * @param string $ipAddress an IPv4 or IPv6 address as a string
78
- *
79
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
80
- * not in the database
81
- * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
82
- * is corrupt or invalid
83
- *
84
- * @return \GeoIp2\Model\Country
85
- */
86
- public function country($ipAddress)
87
- {
88
- return $this->modelFor('Country', 'Country', $ipAddress);
89
- }
90
-
91
- /**
92
- * This method returns a GeoIP2 Anonymous IP model.
93
- *
94
- * @param string $ipAddress an IPv4 or IPv6 address as a string
95
- *
96
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
97
- * not in the database
98
- * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
99
- * is corrupt or invalid
100
- *
101
- * @return \GeoIp2\Model\AnonymousIp
102
- */
103
- public function anonymousIp($ipAddress)
104
- {
105
- return $this->flatModelFor(
106
- 'AnonymousIp',
107
- 'GeoIP2-Anonymous-IP',
108
- $ipAddress
109
- );
110
- }
111
-
112
- /**
113
- * This method returns a GeoLite2 ASN model.
114
- *
115
- * @param string $ipAddress an IPv4 or IPv6 address as a string
116
- *
117
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
118
- * not in the database
119
- * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
120
- * is corrupt or invalid
121
- *
122
- * @return \GeoIp2\Model\Asn
123
- */
124
- public function asn($ipAddress)
125
- {
126
- return $this->flatModelFor(
127
- 'Asn',
128
- 'GeoLite2-ASN',
129
- $ipAddress
130
- );
131
- }
132
-
133
- /**
134
- * This method returns a GeoIP2 Connection Type model.
135
- *
136
- * @param string $ipAddress an IPv4 or IPv6 address as a string
137
- *
138
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
139
- * not in the database
140
- * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
141
- * is corrupt or invalid
142
- *
143
- * @return \GeoIp2\Model\ConnectionType
144
- */
145
- public function connectionType($ipAddress)
146
- {
147
- return $this->flatModelFor(
148
- 'ConnectionType',
149
- 'GeoIP2-Connection-Type',
150
- $ipAddress
151
- );
152
- }
153
-
154
- /**
155
- * This method returns a GeoIP2 Domain model.
156
- *
157
- * @param string $ipAddress an IPv4 or IPv6 address as a string
158
- *
159
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
160
- * not in the database
161
- * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
162
- * is corrupt or invalid
163
- *
164
- * @return \GeoIp2\Model\Domain
165
- */
166
- public function domain($ipAddress)
167
- {
168
- return $this->flatModelFor(
169
- 'Domain',
170
- 'GeoIP2-Domain',
171
- $ipAddress
172
- );
173
- }
174
-
175
- /**
176
- * This method returns a GeoIP2 Enterprise model.
177
- *
178
- * @param string $ipAddress an IPv4 or IPv6 address as a string
179
- *
180
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
181
- * not in the database
182
- * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
183
- * is corrupt or invalid
184
- *
185
- * @return \GeoIp2\Model\Enterprise
186
- */
187
- public function enterprise($ipAddress)
188
- {
189
- return $this->modelFor('Enterprise', 'Enterprise', $ipAddress);
190
- }
191
-
192
- /**
193
- * This method returns a GeoIP2 ISP model.
194
- *
195
- * @param string $ipAddress an IPv4 or IPv6 address as a string
196
- *
197
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
198
- * not in the database
199
- * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
200
- * is corrupt or invalid
201
- *
202
- * @return \GeoIp2\Model\Isp
203
- */
204
- public function isp($ipAddress)
205
- {
206
- return $this->flatModelFor(
207
- 'Isp',
208
- 'GeoIP2-ISP',
209
- $ipAddress
210
- );
211
- }
212
-
213
- private function modelFor($class, $type, $ipAddress)
214
- {
215
- $record = $this->getRecord($class, $type, $ipAddress);
216
-
217
- $record['traits']['ip_address'] = $ipAddress;
218
- $class = 'GeoIp2\\Model\\' . $class;
219
-
220
- return new $class($record, $this->locales);
221
- }
222
-
223
- private function flatModelFor($class, $type, $ipAddress)
224
- {
225
- $record = $this->getRecord($class, $type, $ipAddress);
226
-
227
- $record['ip_address'] = $ipAddress;
228
- $class = 'GeoIp2\\Model\\' . $class;
229
-
230
- return new $class($record);
231
- }
232
-
233
- private function getRecord($class, $type, $ipAddress)
234
- {
235
- if (strpos($this->metadata()->databaseType, $type) === false) {
236
- $method = lcfirst($class);
237
- throw new \BadMethodCallException(
238
- "The $method method cannot be used to open a "
239
- . $this->metadata()->databaseType . ' database'
240
- );
241
- }
242
- $record = $this->dbReader->get($ipAddress);
243
- if ($record === null) {
244
- throw new AddressNotFoundException(
245
- "The address $ipAddress is not in the database."
246
- );
247
- }
248
- if (!is_array($record)) {
249
- // This can happen on corrupt databases. Generally,
250
- // MaxMind\Db\Reader will throw a
251
- // MaxMind\Db\Reader\InvalidDatabaseException, but occasionally
252
- // the lookup may result in a record that looks valid but is not
253
- // an array. This mostly happens when the user is ignoring all
254
- // exceptions and the more frequent InvalidDatabaseException
255
- // exceptions go unnoticed.
256
- throw new InvalidDatabaseException(
257
- "Expected an array when looking up $ipAddress but received: "
258
- . gettype($record)
259
- );
260
- }
261
-
262
- return $record;
263
- }
264
-
265
- /**
266
- * @throws \InvalidArgumentException if arguments are passed to the method
267
- * @throws \BadMethodCallException if the database has been closed
268
- *
269
- * @return \MaxMind\Db\Reader\Metadata object for the database
270
- */
271
- public function metadata()
272
- {
273
- return $this->dbReader->metadata();
274
- }
275
-
276
- /**
277
- * Closes the GeoIP2 database and returns the resources to the system.
278
- */
279
- public function close()
280
- {
281
- $this->dbReader->close();
282
- }
283
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Database;
4
+
5
+ use GeoIp2\Exception\AddressNotFoundException;
6
+ use GeoIp2\ProviderInterface;
7
+ use MaxMind\Db\Reader as DbReader;
8
+ use MaxMind\Db\Reader\InvalidDatabaseException;
9
+
10
+ /**
11
+ * Instances of this class provide a reader for the GeoIP2 database format.
12
+ * IP addresses can be looked up using the database specific methods.
13
+ *
14
+ * ## Usage ##
15
+ *
16
+ * The basic API for this class is the same for every database. First, you
17
+ * create a reader object, specifying a file name. You then call the method
18
+ * corresponding to the specific database, passing it the IP address you want
19
+ * to look up.
20
+ *
21
+ * If the request succeeds, the method call will return a model class for
22
+ * the method you called. This model in turn contains multiple record classes,
23
+ * each of which represents part of the data returned by the database. If
24
+ * the database does not contain the requested information, the attributes
25
+ * on the record class will have a `null` value.
26
+ *
27
+ * If the address is not in the database, an
28
+ * {@link \GeoIp2\Exception\AddressNotFoundException} exception will be
29
+ * thrown. If an invalid IP address is passed to one of the methods, a
30
+ * SPL {@link \InvalidArgumentException} will be thrown. If the database is
31
+ * corrupt or invalid, a {@link \MaxMind\Db\Reader\InvalidDatabaseException}
32
+ * will be thrown.
33
+ */
34
+ class Reader implements ProviderInterface
35
+ {
36
+ private $dbReader;
37
+ private $locales;
38
+
39
+ /**
40
+ * Constructor.
41
+ *
42
+ * @param string $filename the path to the GeoIP2 database file
43
+ * @param array $locales list of locale codes to use in name property
44
+ * from most preferred to least preferred
45
+ *
46
+ * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
47
+ * is corrupt or invalid
48
+ */
49
+ public function __construct(
50
+ $filename,
51
+ $locales = ['en']
52
+ ) {
53
+ $this->dbReader = new DbReader($filename);
54
+ $this->locales = $locales;
55
+ }
56
+
57
+ /**
58
+ * This method returns a GeoIP2 City model.
59
+ *
60
+ * @param string $ipAddress an IPv4 or IPv6 address as a string
61
+ *
62
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
63
+ * not in the database
64
+ * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
65
+ * is corrupt or invalid
66
+ *
67
+ * @return \GeoIp2\Model\City
68
+ */
69
+ public function city($ipAddress)
70
+ {
71
+ return $this->modelFor('City', 'City', $ipAddress);
72
+ }
73
+
74
+ /**
75
+ * This method returns a GeoIP2 Country model.
76
+ *
77
+ * @param string $ipAddress an IPv4 or IPv6 address as a string
78
+ *
79
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
80
+ * not in the database
81
+ * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
82
+ * is corrupt or invalid
83
+ *
84
+ * @return \GeoIp2\Model\Country
85
+ */
86
+ public function country($ipAddress)
87
+ {
88
+ return $this->modelFor('Country', 'Country', $ipAddress);
89
+ }
90
+
91
+ /**
92
+ * This method returns a GeoIP2 Anonymous IP model.
93
+ *
94
+ * @param string $ipAddress an IPv4 or IPv6 address as a string
95
+ *
96
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
97
+ * not in the database
98
+ * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
99
+ * is corrupt or invalid
100
+ *
101
+ * @return \GeoIp2\Model\AnonymousIp
102
+ */
103
+ public function anonymousIp($ipAddress)
104
+ {
105
+ return $this->flatModelFor(
106
+ 'AnonymousIp',
107
+ 'GeoIP2-Anonymous-IP',
108
+ $ipAddress
109
+ );
110
+ }
111
+
112
+ /**
113
+ * This method returns a GeoLite2 ASN model.
114
+ *
115
+ * @param string $ipAddress an IPv4 or IPv6 address as a string
116
+ *
117
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
118
+ * not in the database
119
+ * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
120
+ * is corrupt or invalid
121
+ *
122
+ * @return \GeoIp2\Model\Asn
123
+ */
124
+ public function asn($ipAddress)
125
+ {
126
+ return $this->flatModelFor(
127
+ 'Asn',
128
+ 'GeoLite2-ASN',
129
+ $ipAddress
130
+ );
131
+ }
132
+
133
+ /**
134
+ * This method returns a GeoIP2 Connection Type model.
135
+ *
136
+ * @param string $ipAddress an IPv4 or IPv6 address as a string
137
+ *
138
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
139
+ * not in the database
140
+ * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
141
+ * is corrupt or invalid
142
+ *
143
+ * @return \GeoIp2\Model\ConnectionType
144
+ */
145
+ public function connectionType($ipAddress)
146
+ {
147
+ return $this->flatModelFor(
148
+ 'ConnectionType',
149
+ 'GeoIP2-Connection-Type',
150
+ $ipAddress
151
+ );
152
+ }
153
+
154
+ /**
155
+ * This method returns a GeoIP2 Domain model.
156
+ *
157
+ * @param string $ipAddress an IPv4 or IPv6 address as a string
158
+ *
159
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
160
+ * not in the database
161
+ * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
162
+ * is corrupt or invalid
163
+ *
164
+ * @return \GeoIp2\Model\Domain
165
+ */
166
+ public function domain($ipAddress)
167
+ {
168
+ return $this->flatModelFor(
169
+ 'Domain',
170
+ 'GeoIP2-Domain',
171
+ $ipAddress
172
+ );
173
+ }
174
+
175
+ /**
176
+ * This method returns a GeoIP2 Enterprise model.
177
+ *
178
+ * @param string $ipAddress an IPv4 or IPv6 address as a string
179
+ *
180
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
181
+ * not in the database
182
+ * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
183
+ * is corrupt or invalid
184
+ *
185
+ * @return \GeoIp2\Model\Enterprise
186
+ */
187
+ public function enterprise($ipAddress)
188
+ {
189
+ return $this->modelFor('Enterprise', 'Enterprise', $ipAddress);
190
+ }
191
+
192
+ /**
193
+ * This method returns a GeoIP2 ISP model.
194
+ *
195
+ * @param string $ipAddress an IPv4 or IPv6 address as a string
196
+ *
197
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address is
198
+ * not in the database
199
+ * @throws \MaxMind\Db\Reader\InvalidDatabaseException if the database
200
+ * is corrupt or invalid
201
+ *
202
+ * @return \GeoIp2\Model\Isp
203
+ */
204
+ public function isp($ipAddress)
205
+ {
206
+ return $this->flatModelFor(
207
+ 'Isp',
208
+ 'GeoIP2-ISP',
209
+ $ipAddress
210
+ );
211
+ }
212
+
213
+ private function modelFor($class, $type, $ipAddress)
214
+ {
215
+ $record = $this->getRecord($class, $type, $ipAddress);
216
+
217
+ $record['traits']['ip_address'] = $ipAddress;
218
+ $class = 'GeoIp2\\Model\\' . $class;
219
+
220
+ return new $class($record, $this->locales);
221
+ }
222
+
223
+ private function flatModelFor($class, $type, $ipAddress)
224
+ {
225
+ $record = $this->getRecord($class, $type, $ipAddress);
226
+
227
+ $record['ip_address'] = $ipAddress;
228
+ $class = 'GeoIp2\\Model\\' . $class;
229
+
230
+ return new $class($record);
231
+ }
232
+
233
+ private function getRecord($class, $type, $ipAddress)
234
+ {
235
+ if (strpos($this->metadata()->databaseType, $type) === false) {
236
+ $method = lcfirst($class);
237
+ throw new \BadMethodCallException(
238
+ "The $method method cannot be used to open a "
239
+ . $this->metadata()->databaseType . ' database'
240
+ );
241
+ }
242
+ $record = $this->dbReader->get($ipAddress);
243
+ if ($record === null) {
244
+ throw new AddressNotFoundException(
245
+ "The address $ipAddress is not in the database."
246
+ );
247
+ }
248
+ if (!is_array($record)) {
249
+ // This can happen on corrupt databases. Generally,
250
+ // MaxMind\Db\Reader will throw a
251
+ // MaxMind\Db\Reader\InvalidDatabaseException, but occasionally
252
+ // the lookup may result in a record that looks valid but is not
253
+ // an array. This mostly happens when the user is ignoring all
254
+ // exceptions and the more frequent InvalidDatabaseException
255
+ // exceptions go unnoticed.
256
+ throw new InvalidDatabaseException(
257
+ "Expected an array when looking up $ipAddress but received: "
258
+ . gettype($record)
259
+ );
260
+ }
261
+
262
+ return $record;
263
+ }
264
+
265
+ /**
266
+ * @throws \InvalidArgumentException if arguments are passed to the method
267
+ * @throws \BadMethodCallException if the database has been closed
268
+ *
269
+ * @return \MaxMind\Db\Reader\Metadata object for the database
270
+ */
271
+ public function metadata()
272
+ {
273
+ return $this->dbReader->metadata();
274
+ }
275
+
276
+ /**
277
+ * Closes the GeoIP2 database and returns the resources to the system.
278
+ */
279
+ public function close()
280
+ {
281
+ $this->dbReader->close();
282
+ }
283
+ }
vendor/geoip2/geoip2/src/Exception/AddressNotFoundException.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace GeoIp2\Exception;
4
-
5
- /**
6
- * This class represents a generic error.
7
- */
8
- class AddressNotFoundException extends GeoIp2Exception
9
- {
10
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Exception;
4
+
5
+ /**
6
+ * This class represents a generic error.
7
+ */
8
+ class AddressNotFoundException extends GeoIp2Exception
9
+ {
10
+ }
vendor/geoip2/geoip2/src/Exception/AuthenticationException.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace GeoIp2\Exception;
4
-
5
- /**
6
- * This class represents a generic error.
7
- */
8
- class AuthenticationException extends GeoIp2Exception
9
- {
10
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Exception;
4
+
5
+ /**
6
+ * This class represents a generic error.
7
+ */
8
+ class AuthenticationException extends GeoIp2Exception
9
+ {
10
+ }
vendor/geoip2/geoip2/src/Exception/GeoIp2Exception.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace GeoIp2\Exception;
4
-
5
- /**
6
- * This class represents a generic error.
7
- */
8
- class GeoIp2Exception extends \Exception
9
- {
10
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Exception;
4
+
5
+ /**
6
+ * This class represents a generic error.
7
+ */
8
+ class GeoIp2Exception extends \Exception
9
+ {
10
+ }
vendor/geoip2/geoip2/src/Exception/HttpException.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
-
3
- namespace GeoIp2\Exception;
4
-
5
- /**
6
- * This class represents an HTTP transport error.
7
- */
8
- class HttpException extends GeoIp2Exception
9
- {
10
- /**
11
- * The URI queried.
12
- */
13
- public $uri;
14
-
15
- public function __construct(
16
- $message,
17
- $httpStatus,
18
- $uri,
19
- \Exception $previous = null
20
- ) {
21
- $this->uri = $uri;
22
- parent::__construct($message, $httpStatus, $previous);
23
- }
24
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Exception;
4
+
5
+ /**
6
+ * This class represents an HTTP transport error.
7
+ */
8
+ class HttpException extends GeoIp2Exception
9
+ {
10
+ /**
11
+ * The URI queried.
12
+ */
13
+ public $uri;
14
+
15
+ public function __construct(
16
+ $message,
17
+ $httpStatus,
18
+ $uri,
19
+ \Exception $previous = null
20
+ ) {
21
+ $this->uri = $uri;
22
+ parent::__construct($message, $httpStatus, $previous);
23
+ }
24
+ }
vendor/geoip2/geoip2/src/Exception/InvalidRequestException.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
-
3
- namespace GeoIp2\Exception;
4
-
5
- /**
6
- * This class represents an error returned by MaxMind's GeoIP2
7
- * web service.
8
- */
9
- class InvalidRequestException extends HttpException
10
- {
11
- /**
12
- * The code returned by the MaxMind web service.
13
- */
14
- public $error;
15
-
16
- public function __construct(
17
- $message,
18
- $error,
19
- $httpStatus,
20
- $uri,
21
- \Exception $previous = null
22
- ) {
23
- $this->error = $error;
24
- parent::__construct($message, $httpStatus, $uri, $previous);
25
- }
26
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Exception;
4
+
5
+ /**
6
+ * This class represents an error returned by MaxMind's GeoIP2
7
+ * web service.
8
+ */
9
+ class InvalidRequestException extends HttpException
10
+ {
11
+ /**
12
+ * The code returned by the MaxMind web service.
13
+ */
14
+ public $error;
15
+
16
+ public function __construct(
17
+ $message,
18
+ $error,
19
+ $httpStatus,
20
+ $uri,
21
+ \Exception $previous = null
22
+ ) {
23
+ $this->error = $error;
24
+ parent::__construct($message, $httpStatus, $uri, $previous);
25
+ }
26
+ }
vendor/geoip2/geoip2/src/Exception/OutOfQueriesException.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace GeoIp2\Exception;
4
-
5
- /**
6
- * This class represents a generic error.
7
- */
8
- class OutOfQueriesException extends GeoIp2Exception
9
- {
10
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Exception;
4
+
5
+ /**
6
+ * This class represents a generic error.
7
+ */
8
+ class OutOfQueriesException extends GeoIp2Exception
9
+ {
10
+ }
vendor/geoip2/geoip2/src/Model/AbstractModel.php CHANGED
@@ -1,67 +1,67 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * @ignore
7
- */
8
- abstract class AbstractModel implements \JsonSerializable
9
- {
10
- protected $raw;
11
-
12
- /**
13
- * @ignore
14
- *
15
- * @param mixed $raw
16
- */
17
- public function __construct($raw)
18
- {
19
- $this->raw = $raw;
20
- }
21
-
22
- /**
23
- * @ignore
24
- *
25
- * @param mixed $field
26
- */
27
- protected function get($field)
28
- {
29
- if (isset($this->raw[$field])) {
30
- return $this->raw[$field];
31
- }
32
- if (preg_match('/^is_/', $field)) {
33
- return false;
34
- }
35
-
36
- return null;
37
- }
38
-
39
- /**
40
- * @ignore
41
- *
42
- * @param mixed $attr
43
- */
44
- public function __get($attr)
45
- {
46
- if ($attr !== 'instance' && property_exists($this, $attr)) {
47
- return $this->$attr;
48
- }
49
-
50
- throw new \RuntimeException("Unknown attribute: $attr");
51
- }
52
-
53
- /**
54
- * @ignore
55
- *
56
- * @param mixed $attr
57
- */
58
- public function __isset($attr)
59
- {
60
- return $attr !== 'instance' && isset($this->$attr);
61
- }
62
-
63
- public function jsonSerialize()
64
- {
65
- return $this->raw;
66
- }
67
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * @ignore
7
+ */
8
+ abstract class AbstractModel implements \JsonSerializable
9
+ {
10
+ protected $raw;
11
+
12
+ /**
13
+ * @ignore
14
+ *
15
+ * @param mixed $raw
16
+ */
17
+ public function __construct($raw)
18
+ {
19
+ $this->raw = $raw;
20
+ }
21
+
22
+ /**
23
+ * @ignore
24
+ *
25
+ * @param mixed $field
26
+ */
27
+ protected function get($field)
28
+ {
29
+ if (isset($this->raw[$field])) {
30
+ return $this->raw[$field];
31
+ }
32
+ if (preg_match('/^is_/', $field)) {
33
+ return false;
34
+ }
35
+
36
+ return null;
37
+ }
38
+
39
+ /**
40
+ * @ignore
41
+ *
42
+ * @param mixed $attr
43
+ */
44
+ public function __get($attr)
45
+ {
46
+ if ($attr !== 'instance' && property_exists($this, $attr)) {
47
+ return $this->$attr;
48
+ }
49
+
50
+ throw new \RuntimeException("Unknown attribute: $attr");
51
+ }
52
+
53
+ /**
54
+ * @ignore
55
+ *
56
+ * @param mixed $attr
57
+ */
58
+ public function __isset($attr)
59
+ {
60
+ return $attr !== 'instance' && isset($this->$attr);
61
+ }
62
+
63
+ public function jsonSerialize()
64
+ {
65
+ return $this->raw;
66
+ }
67
+ }
vendor/geoip2/geoip2/src/Model/AnonymousIp.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * This class provides the GeoIP2 Anonymous IP model.
7
- *
8
- * @property-read bool $isAnonymous This is true if the IP address belongs to
9
- * any sort of anonymous network.
10
- * @property-read bool $isAnonymousVpn This is true if the IP address belongs to
11
- * an anonymous VPN system.
12
- * @property-read bool $isHostingProvider This is true if the IP address belongs
13
- * to a hosting provider.
14
- * @property-read bool $isPublicProxy This is true if the IP address belongs to
15
- * a public proxy.
16
- * @property-read bool $isTorExitNode This is true if the IP address is a Tor
17
- * exit node.
18
- * @property-read string $ipAddress The IP address that the data in the model is
19
- * for.
20
- */
21
- class AnonymousIp extends AbstractModel
22
- {
23
- protected $isAnonymous;
24
- protected $isAnonymousVpn;
25
- protected $isHostingProvider;
26
- protected $isPublicProxy;
27
- protected $isTorExitNode;
28
- protected $ipAddress;
29
-
30
- /**
31
- * @ignore
32
- *
33
- * @param mixed $raw
34
- */
35
- public function __construct($raw)
36
- {
37
- parent::__construct($raw);
38
-
39
- $this->isAnonymous = $this->get('is_anonymous');
40
- $this->isAnonymousVpn = $this->get('is_anonymous_vpn');
41
- $this->isHostingProvider = $this->get('is_hosting_provider');
42
- $this->isPublicProxy = $this->get('is_public_proxy');
43
- $this->isTorExitNode = $this->get('is_tor_exit_node');
44
- $this->ipAddress = $this->get('ip_address');
45
- }
46
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * This class provides the GeoIP2 Anonymous IP model.
7
+ *
8
+ * @property-read bool $isAnonymous This is true if the IP address belongs to
9
+ * any sort of anonymous network.
10
+ * @property-read bool $isAnonymousVpn This is true if the IP address belongs to
11
+ * an anonymous VPN system.
12
+ * @property-read bool $isHostingProvider This is true if the IP address belongs
13
+ * to a hosting provider.
14
+ * @property-read bool $isPublicProxy This is true if the IP address belongs to
15
+ * a public proxy.
16
+ * @property-read bool $isTorExitNode This is true if the IP address is a Tor
17
+ * exit node.
18
+ * @property-read string $ipAddress The IP address that the data in the model is
19
+ * for.
20
+ */
21
+ class AnonymousIp extends AbstractModel
22
+ {
23
+ protected $isAnonymous;
24
+ protected $isAnonymousVpn;
25
+ protected $isHostingProvider;
26
+ protected $isPublicProxy;
27
+ protected $isTorExitNode;
28
+ protected $ipAddress;
29
+
30
+ /**
31
+ * @ignore
32
+ *
33
+ * @param mixed $raw
34
+ */
35
+ public function __construct($raw)
36
+ {
37
+ parent::__construct($raw);
38
+
39
+ $this->isAnonymous = $this->get('is_anonymous');
40
+ $this->isAnonymousVpn = $this->get('is_anonymous_vpn');
41
+ $this->isHostingProvider = $this->get('is_hosting_provider');
42
+ $this->isPublicProxy = $this->get('is_public_proxy');
43
+ $this->isTorExitNode = $this->get('is_tor_exit_node');
44
+ $this->ipAddress = $this->get('ip_address');
45
+ }
46
+ }
vendor/geoip2/geoip2/src/Model/Asn.php CHANGED
@@ -1,35 +1,35 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * This class provides the GeoLite2 ASN model.
7
- *
8
- * @property-read int|null $autonomousSystemNumber The autonomous system number
9
- * associated with the IP address.
10
- * @property-read string|null $autonomousSystemOrganization The organization
11
- * associated with the registered autonomous system number for the IP
12
- * address.
13
- * @property-read string $ipAddress The IP address that the data in the model is
14
- * for.
15
- */
16
- class Asn extends AbstractModel
17
- {
18
- protected $autonomousSystemNumber;
19
- protected $autonomousSystemOrganization;
20
- protected $ipAddress;
21
-
22
- /**
23
- * @ignore
24
- *
25
- * @param mixed $raw
26
- */
27
- public function __construct($raw)
28
- {
29
- parent::__construct($raw);
30
- $this->autonomousSystemNumber = $this->get('autonomous_system_number');
31
- $this->autonomousSystemOrganization =
32
- $this->get('autonomous_system_organization');
33
- $this->ipAddress = $this->get('ip_address');
34
- }
35
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * This class provides the GeoLite2 ASN model.
7
+ *
8
+ * @property-read int|null $autonomousSystemNumber The autonomous system number
9
+ * associated with the IP address.
10
+ * @property-read string|null $autonomousSystemOrganization The organization
11
+ * associated with the registered autonomous system number for the IP
12
+ * address.
13
+ * @property-read string $ipAddress The IP address that the data in the model is
14
+ * for.
15
+ */
16
+ class Asn extends AbstractModel
17
+ {
18
+ protected $autonomousSystemNumber;
19
+ protected $autonomousSystemOrganization;
20
+ protected $ipAddress;
21
+
22
+ /**
23
+ * @ignore
24
+ *
25
+ * @param mixed $raw
26
+ */
27
+ public function __construct($raw)
28
+ {
29
+ parent::__construct($raw);
30
+ $this->autonomousSystemNumber = $this->get('autonomous_system_number');
31
+ $this->autonomousSystemOrganization =
32
+ $this->get('autonomous_system_organization');
33
+ $this->ipAddress = $this->get('ip_address');
34
+ }
35
+ }
vendor/geoip2/geoip2/src/Model/City.php CHANGED
@@ -1,133 +1,133 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * Model class for the data returned by GeoIP2 City web service and database.
7
- *
8
- * The only difference between the City and Insights model classes is which
9
- * fields in each record may be populated. See
10
- * http://dev.maxmind.com/geoip/geoip2/web-services more details.
11
- *
12
- * @property-read \GeoIp2\Record\City $city City data for the requested IP
13
- * address.
14
- * @property-read \GeoIp2\Record\Continent $continent Continent data for the
15
- * requested IP address.
16
- * @property-read \GeoIp2\Record\Country $country Country data for the requested
17
- * IP address. This object represents the country where MaxMind believes the
18
- * end user is located.
19
- * @property-read \GeoIp2\Record\Location $location Location data for the
20
- * requested IP address.
21
- * @property-read \GeoIp2\Record\Postal $postal Postal data for the
22
- * requested IP address.
23
- * @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
24
- * account.
25
- * @property-read \GeoIp2\Record\Country $registeredCountry Registered country
26
- * data for the requested IP address. This record represents the country
27
- * where the ISP has registered a given IP block and may differ from the
28
- * user's country.
29
- * @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
30
- * Represented country data for the requested IP address. The represented
31
- * country is used for things like military bases. It is only present when
32
- * the represented country differs from the country.
33
- * @property-read array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
34
- * objects representing the country subdivisions for the requested IP
35
- * address. The number and type of subdivisions varies by country, but a
36
- * subdivision is typically a state, province, county, etc. Subdivisions
37
- * are ordered from most general (largest) to most specific (smallest).
38
- * If the response did not contain any subdivisions, this method returns
39
- * an empty array.
40
- * @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
41
- * representing the most specific subdivision returned. If the response
42
- * did not contain any subdivisions, this method returns an empty
43
- * {@link \GeoIp2\Record\Subdivision} object.
44
- * @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
45
- * requested IP address.
46
- */
47
- class City extends Country
48
- {
49
- /**
50
- * @ignore
51
- */
52
- protected $city;
53
- /**
54
- * @ignore
55
- */
56
- protected $location;
57
- /**
58
- * @ignore
59
- */
60
- protected $postal;
61
- /**
62
- * @ignore
63
- */
64
- protected $subdivisions = [];
65
-
66
- /**
67
- * @ignore
68
- *
69
- * @param mixed $raw
70
- * @param mixed $locales
71
- */
72
- public function __construct($raw, $locales = ['en'])
73
- {
74
- parent::__construct($raw, $locales);
75
-
76
- $this->city = new \GeoIp2\Record\City($this->get('city'), $locales);
77
- $this->location = new \GeoIp2\Record\Location($this->get('location'));
78
- $this->postal = new \GeoIp2\Record\Postal($this->get('postal'));
79
-
80
- $this->createSubdivisions($raw, $locales);
81
- }
82
-
83
- private function createSubdivisions($raw, $locales)
84
- {
85
- if (!isset($raw['subdivisions'])) {
86
- return;
87
- }
88
-
89
- foreach ($raw['subdivisions'] as $sub) {
90
- array_push(
91
- $this->subdivisions,
92
- new \GeoIp2\Record\Subdivision($sub, $locales)
93
- );
94
- }
95
- }
96
-
97
- /**
98
- * @ignore
99
- *
100
- * @param mixed $attr
101
- */
102
- public function __get($attr)
103
- {
104
- if ($attr === 'mostSpecificSubdivision') {
105
- return $this->$attr();
106
- }
107
-
108
- return parent::__get($attr);
109
- }
110
-
111
- /**
112
- * @ignore
113
- *
114
- * @param mixed $attr
115
- */
116
- public function __isset($attr)
117
- {
118
- if ($attr === 'mostSpecificSubdivision') {
119
- // We always return a mostSpecificSubdivision, even if it is the
120
- // empty subdivision
121
- return true;
122
- }
123
-
124
- return parent::__isset($attr);
125
- }
126
-
127
- private function mostSpecificSubdivision()
128
- {
129
- return empty($this->subdivisions) ?
130
- new \GeoIp2\Record\Subdivision([], $this->locales) :
131
- end($this->subdivisions);
132
- }
133
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * Model class for the data returned by GeoIP2 City web service and database.
7
+ *
8
+ * The only difference between the City and Insights model classes is which
9
+ * fields in each record may be populated. See
10
+ * http://dev.maxmind.com/geoip/geoip2/web-services more details.
11
+ *
12
+ * @property-read \GeoIp2\Record\City $city City data for the requested IP
13
+ * address.
14
+ * @property-read \GeoIp2\Record\Continent $continent Continent data for the
15
+ * requested IP address.
16
+ * @property-read \GeoIp2\Record\Country $country Country data for the requested
17
+ * IP address. This object represents the country where MaxMind believes the
18
+ * end user is located.
19
+ * @property-read \GeoIp2\Record\Location $location Location data for the
20
+ * requested IP address.
21
+ * @property-read \GeoIp2\Record\Postal $postal Postal data for the
22
+ * requested IP address.
23
+ * @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
24
+ * account.
25
+ * @property-read \GeoIp2\Record\Country $registeredCountry Registered country
26
+ * data for the requested IP address. This record represents the country
27
+ * where the ISP has registered a given IP block and may differ from the
28
+ * user's country.
29
+ * @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
30
+ * Represented country data for the requested IP address. The represented
31
+ * country is used for things like military bases. It is only present when
32
+ * the represented country differs from the country.
33
+ * @property-read array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
34
+ * objects representing the country subdivisions for the requested IP
35
+ * address. The number and type of subdivisions varies by country, but a
36
+ * subdivision is typically a state, province, county, etc. Subdivisions
37
+ * are ordered from most general (largest) to most specific (smallest).
38
+ * If the response did not contain any subdivisions, this method returns
39
+ * an empty array.
40
+ * @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
41
+ * representing the most specific subdivision returned. If the response
42
+ * did not contain any subdivisions, this method returns an empty
43
+ * {@link \GeoIp2\Record\Subdivision} object.
44
+ * @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
45
+ * requested IP address.
46
+ */
47
+ class City extends Country
48
+ {
49
+ /**
50
+ * @ignore
51
+ */
52
+ protected $city;
53
+ /**
54
+ * @ignore
55
+ */
56
+ protected $location;
57
+ /**
58
+ * @ignore
59
+ */
60
+ protected $postal;
61
+ /**
62
+ * @ignore
63
+ */
64
+ protected $subdivisions = [];
65
+
66
+ /**
67
+ * @ignore
68
+ *
69
+ * @param mixed $raw
70
+ * @param mixed $locales
71
+ */
72
+ public function __construct($raw, $locales = ['en'])
73
+ {
74
+ parent::__construct($raw, $locales);
75
+
76
+ $this->city = new \GeoIp2\Record\City($this->get('city'), $locales);
77
+ $this->location = new \GeoIp2\Record\Location($this->get('location'));
78
+ $this->postal = new \GeoIp2\Record\Postal($this->get('postal'));
79
+
80
+ $this->createSubdivisions($raw, $locales);
81
+ }
82
+
83
+ private function createSubdivisions($raw, $locales)
84
+ {
85
+ if (!isset($raw['subdivisions'])) {
86
+ return;
87
+ }
88
+
89
+ foreach ($raw['subdivisions'] as $sub) {
90
+ array_push(
91
+ $this->subdivisions,
92
+ new \GeoIp2\Record\Subdivision($sub, $locales)
93
+ );
94
+ }
95
+ }
96
+
97
+ /**
98
+ * @ignore
99
+ *
100
+ * @param mixed $attr
101
+ */
102
+ public function __get($attr)
103
+ {
104
+ if ($attr === 'mostSpecificSubdivision') {
105
+ return $this->$attr();
106
+ }
107
+
108
+ return parent::__get($attr);
109
+ }
110
+
111
+ /**
112
+ * @ignore
113
+ *
114
+ * @param mixed $attr
115
+ */
116
+ public function __isset($attr)
117
+ {
118
+ if ($attr === 'mostSpecificSubdivision') {
119
+ // We always return a mostSpecificSubdivision, even if it is the
120
+ // empty subdivision
121
+ return true;
122
+ }
123
+
124
+ return parent::__isset($attr);
125
+ }
126
+
127
+ private function mostSpecificSubdivision()
128
+ {
129
+ return empty($this->subdivisions) ?
130
+ new \GeoIp2\Record\Subdivision([], $this->locales) :
131
+ end($this->subdivisions);
132
+ }
133
+ }
vendor/geoip2/geoip2/src/Model/ConnectionType.php CHANGED
@@ -1,31 +1,31 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * This class provides the GeoIP2 Connection-Type model.
7
- *
8
- * @property-read string|null $connectionType The connection type may take the
9
- * following values: "Dialup", "Cable/DSL", "Corporate", "Cellular".
10
- * Additional values may be added in the future.
11
- * @property-read string $ipAddress The IP address that the data in the model is
12
- * for.
13
- */
14
- class ConnectionType extends AbstractModel
15
- {
16
- protected $connectionType;
17
- protected $ipAddress;
18
-
19
- /**
20
- * @ignore
21
- *
22
- * @param mixed $raw
23
- */
24
- public function __construct($raw)
25
- {
26
- parent::__construct($raw);
27
-
28
- $this->connectionType = $this->get('connection_type');
29
- $this->ipAddress = $this->get('ip_address');
30
- }
31
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * This class provides the GeoIP2 Connection-Type model.
7
+ *
8
+ * @property-read string|null $connectionType The connection type may take the
9
+ * following values: "Dialup", "Cable/DSL", "Corporate", "Cellular".
10
+ * Additional values may be added in the future.
11
+ * @property-read string $ipAddress The IP address that the data in the model is
12
+ * for.
13
+ */
14
+ class ConnectionType extends AbstractModel
15
+ {
16
+ protected $connectionType;
17
+ protected $ipAddress;
18
+
19
+ /**
20
+ * @ignore
21
+ *
22
+ * @param mixed $raw
23
+ */
24
+ public function __construct($raw)
25
+ {
26
+ parent::__construct($raw);
27
+
28
+ $this->connectionType = $this->get('connection_type');
29
+ $this->ipAddress = $this->get('ip_address');
30
+ }
31
+ }
vendor/geoip2/geoip2/src/Model/Country.php CHANGED
@@ -1,71 +1,71 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * Model class for the data returned by GeoIP2 Country web service and database.
7
- *
8
- * The only difference between the City and Insights model classes is which
9
- * fields in each record may be populated. See
10
- * http://dev.maxmind.com/geoip/geoip2/web-services more details.
11
- *
12
- * @property-read \GeoIp2\Record\Continent $continent Continent data for the
13
- * requested IP address.
14
- * @property-read \GeoIp2\Record\Country $country Country data for the requested
15
- * IP address. This object represents the country where MaxMind believes the
16
- * end user is located.
17
- * @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
18
- * account.
19
- * @property-read \GeoIp2\Record\Country $registeredCountry Registered country
20
- * data for the requested IP address. This record represents the country
21
- * where the ISP has registered a given IP block and may differ from the
22
- * user's country.
23
- * @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
24
- * Represented country data for the requested IP address. The represented
25
- * country is used for things like military bases. It is only present when
26
- * the represented country differs from the country.
27
- * @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
28
- * requested IP address.
29
- */
30
- class Country extends AbstractModel
31
- {
32
- protected $continent;
33
- protected $country;
34
- protected $locales;
35
- protected $maxmind;
36
- protected $registeredCountry;
37
- protected $representedCountry;
38
- protected $traits;
39
-
40
- /**
41
- * @ignore
42
- *
43
- * @param mixed $raw
44
- * @param mixed $locales
45
- */
46
- public function __construct($raw, $locales = ['en'])
47
- {
48
- parent::__construct($raw);
49
-
50
- $this->continent = new \GeoIp2\Record\Continent(
51
- $this->get('continent'),
52
- $locales
53
- );
54
- $this->country = new \GeoIp2\Record\Country(
55
- $this->get('country'),
56
- $locales
57
- );
58
- $this->maxmind = new \GeoIp2\Record\MaxMind($this->get('maxmind'));
59
- $this->registeredCountry = new \GeoIp2\Record\Country(
60
- $this->get('registered_country'),
61
- $locales
62
- );
63
- $this->representedCountry = new \GeoIp2\Record\RepresentedCountry(
64
- $this->get('represented_country'),
65
- $locales
66
- );
67
- $this->traits = new \GeoIp2\Record\Traits($this->get('traits'));
68
-
69
- $this->locales = $locales;
70
- }
71
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * Model class for the data returned by GeoIP2 Country web service and database.
7
+ *
8
+ * The only difference between the City and Insights model classes is which
9
+ * fields in each record may be populated. See
10
+ * http://dev.maxmind.com/geoip/geoip2/web-services more details.
11
+ *
12
+ * @property-read \GeoIp2\Record\Continent $continent Continent data for the
13
+ * requested IP address.
14
+ * @property-read \GeoIp2\Record\Country $country Country data for the requested
15
+ * IP address. This object represents the country where MaxMind believes the
16
+ * end user is located.
17
+ * @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
18
+ * account.
19
+ * @property-read \GeoIp2\Record\Country $registeredCountry Registered country
20
+ * data for the requested IP address. This record represents the country
21
+ * where the ISP has registered a given IP block and may differ from the
22
+ * user's country.
23
+ * @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
24
+ * Represented country data for the requested IP address. The represented
25
+ * country is used for things like military bases. It is only present when
26
+ * the represented country differs from the country.
27
+ * @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
28
+ * requested IP address.
29
+ */
30
+ class Country extends AbstractModel
31
+ {
32
+ protected $continent;
33
+ protected $country;
34
+ protected $locales;
35
+ protected $maxmind;
36
+ protected $registeredCountry;
37
+ protected $representedCountry;
38
+ protected $traits;
39
+
40
+ /**
41
+ * @ignore
42
+ *
43
+ * @param mixed $raw
44
+ * @param mixed $locales
45
+ */
46
+ public function __construct($raw, $locales = ['en'])
47
+ {
48
+ parent::__construct($raw);
49
+
50
+ $this->continent = new \GeoIp2\Record\Continent(
51
+ $this->get('continent'),
52
+ $locales
53
+ );
54
+ $this->country = new \GeoIp2\Record\Country(
55
+ $this->get('country'),
56
+ $locales
57
+ );
58
+ $this->maxmind = new \GeoIp2\Record\MaxMind($this->get('maxmind'));
59
+ $this->registeredCountry = new \GeoIp2\Record\Country(
60
+ $this->get('registered_country'),
61
+ $locales
62
+ );
63
+ $this->representedCountry = new \GeoIp2\Record\RepresentedCountry(
64
+ $this->get('represented_country'),
65
+ $locales
66
+ );
67
+ $this->traits = new \GeoIp2\Record\Traits($this->get('traits'));
68
+
69
+ $this->locales = $locales;
70
+ }
71
+ }
vendor/geoip2/geoip2/src/Model/Domain.php CHANGED
@@ -1,31 +1,31 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * This class provides the GeoIP2 Domain model.
7
- *
8
- * @property-read string|null $domain The second level domain associated with the
9
- * IP address. This will be something like "example.com" or
10
- * "example.co.uk", not "foo.example.com".
11
- * @property-read string $ipAddress The IP address that the data in the model is
12
- * for.
13
- */
14
- class Domain extends AbstractModel
15
- {
16
- protected $domain;
17
- protected $ipAddress;
18
-
19
- /**
20
- * @ignore
21
- *
22
- * @param mixed $raw
23
- */
24
- public function __construct($raw)
25
- {
26
- parent::__construct($raw);
27
-
28
- $this->domain = $this->get('domain');
29
- $this->ipAddress = $this->get('ip_address');
30
- }
31
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * This class provides the GeoIP2 Domain model.
7
+ *
8
+ * @property-read string|null $domain The second level domain associated with the
9
+ * IP address. This will be something like "example.com" or
10
+ * "example.co.uk", not "foo.example.com".
11
+ * @property-read string $ipAddress The IP address that the data in the model is
12
+ * for.
13
+ */
14
+ class Domain extends AbstractModel
15
+ {
16
+ protected $domain;
17
+ protected $ipAddress;
18
+
19
+ /**
20
+ * @ignore
21
+ *
22
+ * @param mixed $raw
23
+ */
24
+ public function __construct($raw)
25
+ {
26
+ parent::__construct($raw);
27
+
28
+ $this->domain = $this->get('domain');
29
+ $this->ipAddress = $this->get('ip_address');
30
+ }
31
+ }
vendor/geoip2/geoip2/src/Model/Enterprise.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * Model class for the data returned by GeoIP2 Enterprise database lookups.
7
- *
8
- * The only difference between the City and Enterprise model classes is which
9
- * fields in each record may be populated. See
10
- * http://dev.maxmind.com/geoip/geoip2/web-services more details.
11
- *
12
- * @property-read \GeoIp2\Record\City $city City data for the requested IP
13
- * address.
14
- * @property-read \GeoIp2\Record\Continent $continent Continent data for the
15
- * requested IP address.
16
- * @property-read \GeoIp2\Record\Country $country Country data for the requested
17
- * IP address. This object represents the country where MaxMind believes the
18
- * end user is located.
19
- * @property-read \GeoIp2\Record\Location $location Location data for the
20
- * requested IP address.
21
- * @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
22
- * account.
23
- * @property-read \GeoIp2\Record\Country $registeredCountry Registered country
24
- * data for the requested IP address. This record represents the country
25
- * where the ISP has registered a given IP block and may differ from the
26
- * user's country.
27
- * @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
28
- * Represented country data for the requested IP address. The represented
29
- * country is used for things like military bases. It is only present when
30
- * the represented country differs from the country.
31
- * @property-read array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
32
- * objects representing the country subdivisions for the requested IP
33
- * address. The number and type of subdivisions varies by country, but a
34
- * subdivision is typically a state, province, county, etc. Subdivisions
35
- * are ordered from most general (largest) to most specific (smallest).
36
- * If the response did not contain any subdivisions, this method returns
37
- * an empty array.
38
- * @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
39
- * representing the most specific subdivision returned. If the response
40
- * did not contain any subdivisions, this method returns an empty
41
- * {@link \GeoIp2\Record\Subdivision} object.
42
- * @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
43
- * requested IP address.
44
- */
45
- class Enterprise extends City
46
- {
47
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * Model class for the data returned by GeoIP2 Enterprise database lookups.
7
+ *
8
+ * The only difference between the City and Enterprise model classes is which
9
+ * fields in each record may be populated. See
10
+ * http://dev.maxmind.com/geoip/geoip2/web-services more details.
11
+ *
12
+ * @property-read \GeoIp2\Record\City $city City data for the requested IP
13
+ * address.
14
+ * @property-read \GeoIp2\Record\Continent $continent Continent data for the
15
+ * requested IP address.
16
+ * @property-read \GeoIp2\Record\Country $country Country data for the requested
17
+ * IP address. This object represents the country where MaxMind believes the
18
+ * end user is located.
19
+ * @property-read \GeoIp2\Record\Location $location Location data for the
20
+ * requested IP address.
21
+ * @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
22
+ * account.
23
+ * @property-read \GeoIp2\Record\Country $registeredCountry Registered country
24
+ * data for the requested IP address. This record represents the country
25
+ * where the ISP has registered a given IP block and may differ from the
26
+ * user's country.
27
+ * @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
28
+ * Represented country data for the requested IP address. The represented
29
+ * country is used for things like military bases. It is only present when
30
+ * the represented country differs from the country.
31
+ * @property-read array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
32
+ * objects representing the country subdivisions for the requested IP
33
+ * address. The number and type of subdivisions varies by country, but a
34
+ * subdivision is typically a state, province, county, etc. Subdivisions
35
+ * are ordered from most general (largest) to most specific (smallest).
36
+ * If the response did not contain any subdivisions, this method returns
37
+ * an empty array.
38
+ * @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
39
+ * representing the most specific subdivision returned. If the response
40
+ * did not contain any subdivisions, this method returns an empty
41
+ * {@link \GeoIp2\Record\Subdivision} object.
42
+ * @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
43
+ * requested IP address.
44
+ */
45
+ class Enterprise extends City
46
+ {
47
+ }
vendor/geoip2/geoip2/src/Model/Insights.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * Model class for the data returned by GeoIP2 Precision: Insights web service.
7
- *
8
- * The only difference between the City and Insights model classes is which
9
- * fields in each record may be populated. See
10
- * http://dev.maxmind.com/geoip/geoip2/web-services more details.
11
- *
12
- * @property-read \GeoIp2\Record\City $city City data for the requested IP
13
- * address.
14
- * @property-read \GeoIp2\Record\Continent $continent Continent data for the
15
- * requested IP address.
16
- * @property-read \GeoIp2\Record\Country $country Country data for the requested
17
- * IP address. This object represents the country where MaxMind believes the
18
- * end user is located.
19
- * @property-read \GeoIp2\Record\Location $location Location data for the
20
- * requested IP address.
21
- * @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
22
- * account.
23
- * @property-read \GeoIp2\Record\Country $registeredCountry Registered country
24
- * data for the requested IP address. This record represents the country
25
- * where the ISP has registered a given IP block and may differ from the
26
- * user's country.
27
- * @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
28
- * Represented country data for the requested IP address. The represented
29
- * country is used for things like military bases. It is only present when
30
- * the represented country differs from the country.
31
- * @property-read array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
32
- * objects representing the country subdivisions for the requested IP
33
- * address. The number and type of subdivisions varies by country, but a
34
- * subdivision is typically a state, province, county, etc. Subdivisions
35
- * are ordered from most general (largest) to most specific (smallest).
36
- * If the response did not contain any subdivisions, this method returns
37
- * an empty array.
38
- * @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
39
- * representing the most specific subdivision returned. If the response
40
- * did not contain any subdivisions, this method returns an empty
41
- * {@link \GeoIp2\Record\Subdivision} object.
42
- * @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
43
- * requested IP address.
44
- */
45
- class Insights extends City
46
- {
47
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * Model class for the data returned by GeoIP2 Precision: Insights web service.
7
+ *
8
+ * The only difference between the City and Insights model classes is which
9
+ * fields in each record may be populated. See
10
+ * http://dev.maxmind.com/geoip/geoip2/web-services more details.
11
+ *
12
+ * @property-read \GeoIp2\Record\City $city City data for the requested IP
13
+ * address.
14
+ * @property-read \GeoIp2\Record\Continent $continent Continent data for the
15
+ * requested IP address.
16
+ * @property-read \GeoIp2\Record\Country $country Country data for the requested
17
+ * IP address. This object represents the country where MaxMind believes the
18
+ * end user is located.
19
+ * @property-read \GeoIp2\Record\Location $location Location data for the
20
+ * requested IP address.
21
+ * @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
22
+ * account.
23
+ * @property-read \GeoIp2\Record\Country $registeredCountry Registered country
24
+ * data for the requested IP address. This record represents the country
25
+ * where the ISP has registered a given IP block and may differ from the
26
+ * user's country.
27
+ * @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
28
+ * Represented country data for the requested IP address. The represented
29
+ * country is used for things like military bases. It is only present when
30
+ * the represented country differs from the country.
31
+ * @property-read array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
32
+ * objects representing the country subdivisions for the requested IP
33
+ * address. The number and type of subdivisions varies by country, but a
34
+ * subdivision is typically a state, province, county, etc. Subdivisions
35
+ * are ordered from most general (largest) to most specific (smallest).
36
+ * If the response did not contain any subdivisions, this method returns
37
+ * an empty array.
38
+ * @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
39
+ * representing the most specific subdivision returned. If the response
40
+ * did not contain any subdivisions, this method returns an empty
41
+ * {@link \GeoIp2\Record\Subdivision} object.
42
+ * @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
43
+ * requested IP address.
44
+ */
45
+ class Insights extends City
46
+ {
47
+ }
vendor/geoip2/geoip2/src/Model/Isp.php CHANGED
@@ -1,44 +1,44 @@
1
- <?php
2
-
3
- namespace GeoIp2\Model;
4
-
5
- /**
6
- * This class provides the GeoIP2 ISP model.
7
- *
8
- * @property-read int|null $autonomousSystemNumber The autonomous system number
9
- * associated with the IP address.
10
- * @property-read string|null $autonomousSystemOrganization The organization
11
- * associated with the registered autonomous system number for the IP
12
- * address.
13
- * @property-read string|null $isp The name of the ISP associated with the IP
14
- * address.
15
- * @property-read string|null $organization The name of the organization associated
16
- * with the IP address.
17
- * @property-read string $ipAddress The IP address that the data in the model is
18
- * for.
19
- */
20
- class Isp extends AbstractModel
21
- {
22
- protected $autonomousSystemNumber;
23
- protected $autonomousSystemOrganization;
24
- protected $isp;
25
- protected $organization;
26
- protected $ipAddress;
27
-
28
- /**
29
- * @ignore
30
- *
31
- * @param mixed $raw
32
- */
33
- public function __construct($raw)
34
- {
35
- parent::__construct($raw);
36
- $this->autonomousSystemNumber = $this->get('autonomous_system_number');
37
- $this->autonomousSystemOrganization =
38
- $this->get('autonomous_system_organization');
39
- $this->isp = $this->get('isp');
40
- $this->organization = $this->get('organization');
41
-
42
- $this->ipAddress = $this->get('ip_address');
43
- }
44
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Model;
4
+
5
+ /**
6
+ * This class provides the GeoIP2 ISP model.
7
+ *
8
+ * @property-read int|null $autonomousSystemNumber The autonomous system number
9
+ * associated with the IP address.
10
+ * @property-read string|null $autonomousSystemOrganization The organization
11
+ * associated with the registered autonomous system number for the IP
12
+ * address.
13
+ * @property-read string|null $isp The name of the ISP associated with the IP
14
+ * address.
15
+ * @property-read string|null $organization The name of the organization associated
16
+ * with the IP address.
17
+ * @property-read string $ipAddress The IP address that the data in the model is
18
+ * for.
19
+ */
20
+ class Isp extends AbstractModel
21
+ {
22
+ protected $autonomousSystemNumber;
23
+ protected $autonomousSystemOrganization;
24
+ protected $isp;
25
+ protected $organization;
26
+ protected $ipAddress;
27
+
28
+ /**
29
+ * @ignore
30
+ *
31
+ * @param mixed $raw
32
+ */
33
+ public function __construct($raw)
34
+ {
35
+ parent::__construct($raw);
36
+ $this->autonomousSystemNumber = $this->get('autonomous_system_number');
37
+ $this->autonomousSystemOrganization =
38
+ $this->get('autonomous_system_organization');
39
+ $this->isp = $this->get('isp');
40
+ $this->organization = $this->get('organization');
41
+
42
+ $this->ipAddress = $this->get('ip_address');
43
+ }
44
+ }
vendor/geoip2/geoip2/src/ProviderInterface.php CHANGED
@@ -1,20 +1,20 @@
1
- <?php
2
-
3
- namespace GeoIp2;
4
-
5
- interface ProviderInterface
6
- {
7
- /**
8
- * @param string $ipAddress an IPv4 or IPv6 address to lookup
9
- *
10
- * @return \GeoIp2\Model\Country a Country model for the requested IP address
11
- */
12
- public function country($ipAddress);
13
-
14
- /**
15
- * @param string $ipAddress an IPv4 or IPv6 address to lookup
16
- *
17
- * @return \GeoIp2\Model\City a City model for the requested IP address
18
- */
19
- public function city($ipAddress);
20
- }
1
+ <?php
2
+
3
+ namespace GeoIp2;
4
+
5
+ interface ProviderInterface
6
+ {
7
+ /**
8
+ * @param string $ipAddress an IPv4 or IPv6 address to lookup
9
+ *
10
+ * @return \GeoIp2\Model\Country a Country model for the requested IP address
11
+ */
12
+ public function country($ipAddress);
13
+
14
+ /**
15
+ * @param string $ipAddress an IPv4 or IPv6 address to lookup
16
+ *
17
+ * @return \GeoIp2\Model\City a City model for the requested IP address
18
+ */
19
+ public function city($ipAddress);
20
+ }
vendor/geoip2/geoip2/src/Record/AbstractPlaceRecord.php CHANGED
@@ -1,66 +1,66 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- abstract class AbstractPlaceRecord extends AbstractRecord
6
- {
7
- private $locales;
8
-
9
- /**
10
- * @ignore
11
- *
12
- * @param mixed $record
13
- * @param mixed $locales
14
- */
15
- public function __construct($record, $locales = ['en'])
16
- {
17
- $this->locales = $locales;
18
- parent::__construct($record);
19
- }
20
-
21
- /**
22
- * @ignore
23
- *
24
- * @param mixed $attr
25
- */
26
- public function __get($attr)
27
- {
28
- if ($attr === 'name') {
29
- return $this->name();
30
- }
31
-
32
- return parent::__get($attr);
33
- }
34
-
35
- /**
36
- * @ignore
37
- *
38
- * @param mixed $attr
39
- */
40
- public function __isset($attr)
41
- {
42
- if ($attr === 'name') {
43
- return $this->firstSetNameLocale() === null ? false : true;
44
- }
45
-
46
- return parent::__isset($attr);
47
- }
48
-
49
- private function name()
50
- {
51
- $locale = $this->firstSetNameLocale();
52
-
53
- return $locale === null ? null : $this->names[$locale];
54
- }
55
-
56
- private function firstSetNameLocale()
57
- {
58
- foreach ($this->locales as $locale) {
59
- if (isset($this->names[$locale])) {
60
- return $locale;
61
- }
62
- }
63
-
64
- return null;
65
- }
66
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ abstract class AbstractPlaceRecord extends AbstractRecord
6
+ {
7
+ private $locales;
8
+
9
+ /**
10
+ * @ignore
11
+ *
12
+ * @param mixed $record
13
+ * @param mixed $locales
14
+ */
15
+ public function __construct($record, $locales = ['en'])
16
+ {
17
+ $this->locales = $locales;
18
+ parent::__construct($record);
19
+ }
20
+
21
+ /**
22
+ * @ignore
23
+ *
24
+ * @param mixed $attr
25
+ */
26
+ public function __get($attr)
27
+ {
28
+ if ($attr === 'name') {
29
+ return $this->name();
30
+ }
31
+
32
+ return parent::__get($attr);
33
+ }
34
+
35
+ /**
36
+ * @ignore
37
+ *
38
+ * @param mixed $attr
39
+ */
40
+ public function __isset($attr)
41
+ {
42
+ if ($attr === 'name') {
43
+ return $this->firstSetNameLocale() === null ? false : true;
44
+ }
45
+
46
+ return parent::__isset($attr);
47
+ }
48
+
49
+ private function name()
50
+ {
51
+ $locale = $this->firstSetNameLocale();
52
+
53
+ return $locale === null ? null : $this->names[$locale];
54
+ }
55
+
56
+ private function firstSetNameLocale()
57
+ {
58
+ foreach ($this->locales as $locale) {
59
+ if (isset($this->names[$locale])) {
60
+ return $locale;
61
+ }
62
+ }
63
+
64
+ return null;
65
+ }
66
+ }
vendor/geoip2/geoip2/src/Record/AbstractRecord.php CHANGED
@@ -1,61 +1,61 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- abstract class AbstractRecord implements \JsonSerializable
6
- {
7
- private $record;
8
-
9
- /**
10
- * @ignore
11
- *
12
- * @param mixed $record
13
- */
14
- public function __construct($record)
15
- {
16
- $this->record = isset($record) ? $record : [];
17
- }
18
-
19
- /**
20
- * @ignore
21
- *
22
- * @param mixed $attr
23
- */
24
- public function __get($attr)
25
- {
26
- // XXX - kind of ugly but greatly reduces boilerplate code
27
- $key = $this->attributeToKey($attr);
28
-
29
- if ($this->__isset($attr)) {
30
- return $this->record[$key];
31
- } elseif ($this->validAttribute($attr)) {
32
- if (preg_match('/^is_/', $key)) {
33
- return false;
34
- }
35
-
36
- return null;
37
- }
38
- throw new \RuntimeException("Unknown attribute: $attr");
39
- }
40
-
41
- public function __isset($attr)
42
- {
43
- return $this->validAttribute($attr) &&
44
- isset($this->record[$this->attributeToKey($attr)]);
45
- }
46
-
47
- private function attributeToKey($attr)
48
- {
49
- return strtolower(preg_replace('/([A-Z])/', '_\1', $attr));
50
- }
51
-
52
- private function validAttribute($attr)
53
- {
54
- return in_array($attr, $this->validAttributes, true);
55
- }
56
-
57
- public function jsonSerialize()
58
- {
59
- return $this->record;
60
- }
61
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ abstract class AbstractRecord implements \JsonSerializable
6
+ {
7
+ private $record;
8
+
9
+ /**
10
+ * @ignore
11
+ *
12
+ * @param mixed $record
13
+ */
14
+ public function __construct($record)
15
+ {
16
+ $this->record = isset($record) ? $record : [];
17
+ }
18
+
19
+ /**
20
+ * @ignore
21
+ *
22
+ * @param mixed $attr
23
+ */
24
+ public function __get($attr)
25
+ {
26
+ // XXX - kind of ugly but greatly reduces boilerplate code
27
+ $key = $this->attributeToKey($attr);
28
+
29
+ if ($this->__isset($attr)) {
30
+ return $this->record[$key];
31
+ } elseif ($this->validAttribute($attr)) {
32
+ if (preg_match('/^is_/', $key)) {
33
+ return false;
34
+ }
35
+
36
+ return null;
37
+ }
38
+ throw new \RuntimeException("Unknown attribute: $attr");
39
+ }
40
+
41
+ public function __isset($attr)
42
+ {
43
+ return $this->validAttribute($attr) &&
44
+ isset($this->record[$this->attributeToKey($attr)]);
45
+ }
46
+
47
+ private function attributeToKey($attr)
48
+ {
49
+ return strtolower(preg_replace('/([A-Z])/', '_\1', $attr));
50
+ }
51
+
52
+ private function validAttribute($attr)
53
+ {
54
+ return in_array($attr, $this->validAttributes, true);
55
+ }
56
+
57
+ public function jsonSerialize()
58
+ {
59
+ return $this->record;
60
+ }
61
+ }
vendor/geoip2/geoip2/src/Record/City.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- /**
6
- * City-level data associated with an IP address.
7
- *
8
- * This record is returned by all location services and databases besides
9
- * Country.
10
- *
11
- * @property-read int|null $confidence A value from 0-100 indicating MaxMind's
12
- * confidence that the city is correct. This attribute is only available
13
- * from the Insights service and the GeoIP2 Enterprise database.
14
- * @property-read int|null $geonameId The GeoName ID for the city. This attribute
15
- * is returned by all location services and databases.
16
- * @property-read string|null $name The name of the city based on the locales list
17
- * passed to the constructor. This attribute is returned by all location
18
- * services and databases.
19
- * @property-read array|null $names A array map where the keys are locale codes
20
- * and the values are names. This attribute is returned by all location
21
- * services and databases.
22
- */
23
- class City extends AbstractPlaceRecord
24
- {
25
- /**
26
- * @ignore
27
- */
28
- protected $validAttributes = ['confidence', 'geonameId', 'names'];
29
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ /**
6
+ * City-level data associated with an IP address.
7
+ *
8
+ * This record is returned by all location services and databases besides
9
+ * Country.
10
+ *
11
+ * @property-read int|null $confidence A value from 0-100 indicating MaxMind's
12
+ * confidence that the city is correct. This attribute is only available
13
+ * from the Insights service and the GeoIP2 Enterprise database.
14
+ * @property-read int|null $geonameId The GeoName ID for the city. This attribute
15
+ * is returned by all location services and databases.
16
+ * @property-read string|null $name The name of the city based on the locales list
17
+ * passed to the constructor. This attribute is returned by all location
18
+ * services and databases.
19
+ * @property-read array|null $names A array map where the keys are locale codes
20
+ * and the values are names. This attribute is returned by all location
21
+ * services and databases.
22
+ */
23
+ class City extends AbstractPlaceRecord
24
+ {
25
+ /**
26
+ * @ignore
27
+ */
28
+ protected $validAttributes = ['confidence', 'geonameId', 'names'];
29
+ }
vendor/geoip2/geoip2/src/Record/Continent.php CHANGED
@@ -1,32 +1,32 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- /**
6
- * Contains data for the continent record associated with an IP address.
7
- *
8
- * This record is returned by all location services and databases.
9
- *
10
- * @property-read string|null $code A two character continent code like "NA" (North
11
- * America) or "OC" (Oceania). This attribute is returned by all location
12
- * services and databases.
13
- * @property-read int|null $geonameId The GeoName ID for the continent. This
14
- * attribute is returned by all location services and databases.
15
- * @property-read string|null $name Returns the name of the continent based on the
16
- * locales list passed to the constructor. This attribute is returned by all location
17
- * services and databases.
18
- * @property-read array|null $names An array map where the keys are locale codes
19
- * and the values are names. This attribute is returned by all location
20
- * services and databases.
21
- */
22
- class Continent extends AbstractPlaceRecord
23
- {
24
- /**
25
- * @ignore
26
- */
27
- protected $validAttributes = [
28
- 'code',
29
- 'geonameId',
30
- 'names',
31
- ];
32
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ /**
6
+ * Contains data for the continent record associated with an IP address.
7
+ *
8
+ * This record is returned by all location services and databases.
9
+ *
10
+ * @property-read string|null $code A two character continent code like "NA" (North
11
+ * America) or "OC" (Oceania). This attribute is returned by all location
12
+ * services and databases.
13
+ * @property-read int|null $geonameId The GeoName ID for the continent. This
14
+ * attribute is returned by all location services and databases.
15
+ * @property-read string|null $name Returns the name of the continent based on the
16
+ * locales list passed to the constructor. This attribute is returned by all location
17
+ * services and databases.
18
+ * @property-read array|null $names An array map where the keys are locale codes
19
+ * and the values are names. This attribute is returned by all location
20
+ * services and databases.
21
+ */
22
+ class Continent extends AbstractPlaceRecord
23
+ {
24
+ /**
25
+ * @ignore
26
+ */
27
+ protected $validAttributes = [
28
+ 'code',
29
+ 'geonameId',
30
+ 'names',
31
+ ];
32
+ }
vendor/geoip2/geoip2/src/Record/Country.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- /**
6
- * Contains data for the country record associated with an IP address.
7
- *
8
- * This record is returned by all location services and databases.
9
- *
10
- * @property-read int|null $confidence A value from 0-100 indicating MaxMind's
11
- * confidence that the country is correct. This attribute is only available
12
- * from the Insights service and the GeoIP2 Enterprise database.
13
- * @property-read int|null $geonameId The GeoName ID for the country. This
14
- * attribute is returned by location services and databases.
15
- * @property-read string|null $isoCode The
16
- * {@link * http://en.wikipedia.org/wiki/ISO_3166-1 two-character ISO 3166-1 alpha
17
- * code} for the country. This attribute is returned by all location services
18
- * and databases.
19
- * @property-read string|null $name The name of the country based on the locales
20
- * list passed to the constructor. This attribute is returned by all location
21
- * services and databases.
22
- * @property-read array|null $names An array map where the keys are locale codes
23
- * and the values are names. This attribute is returned by all location
24
- * services and databases.
25
- */
26
- class Country extends AbstractPlaceRecord
27
- {
28
- /**
29
- * @ignore
30
- */
31
- protected $validAttributes = [
32
- 'confidence',
33
- 'geonameId',
34
- 'isoCode',
35
- 'names',
36
- ];
37
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ /**
6
+ * Contains data for the country record associated with an IP address.
7
+ *
8
+ * This record is returned by all location services and databases.
9
+ *
10
+ * @property-read int|null $confidence A value from 0-100 indicating MaxMind's
11
+ * confidence that the country is correct. This attribute is only available
12
+ * from the Insights service and the GeoIP2 Enterprise database.
13
+ * @property-read int|null $geonameId The GeoName ID for the country. This
14
+ * attribute is returned by location services and databases.
15
+ * @property-read string|null $isoCode The
16
+ * {@link * http://en.wikipedia.org/wiki/ISO_3166-1 two-character ISO 3166-1 alpha
17
+ * code} for the country. This attribute is returned by all location services
18
+ * and databases.
19
+ * @property-read string|null $name The name of the country based on the locales
20
+ * list passed to the constructor. This attribute is returned by all location
21
+ * services and databases.
22
+ * @property-read array|null $names An array map where the keys are locale codes
23
+ * and the values are names. This attribute is returned by all location
24
+ * services and databases.
25
+ */
26
+ class Country extends AbstractPlaceRecord
27
+ {
28
+ /**
29
+ * @ignore
30
+ */
31
+ protected $validAttributes = [
32
+ 'confidence',
33
+ 'geonameId',
34
+ 'isoCode',
35
+ 'names',
36
+ ];
37
+ }
vendor/geoip2/geoip2/src/Record/Location.php CHANGED
@@ -1,52 +1,52 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- /**
6
- * Contains data for the location record associated with an IP address.
7
- *
8
- * This record is returned by all location services and databases besides
9
- * Country.
10
- *
11
- * @property-read int|null $averageIncome The average income in US dollars
12
- * associated with the requested IP address. This attribute is only available
13
- * from the Insights service.
14
- * @property-read int|null $accuracyRadius The approximate accuracy radius in
15
- * kilometers around the latitude and longitude for the IP address. This is
16
- * the radius where we have a 67% confidence that the device using the IP
17
- * address resides within the circle centered at the latitude and longitude
18
- * with the provided radius.
19
- * @property-read float|null $latitude The approximate latitude of the location
20
- * associated with the IP address. This value is not precise and should not be
21
- * used to identify a particular address or household.
22
- * @property-read float|null $longitude The approximate longitude of the location
23
- * associated with the IP address. This value is not precise and should not be
24
- * used to identify a particular address or household.
25
- * @property-read int|null $populationDensity The estimated population per square
26
- * kilometer associated with the IP address. This attribute is only available
27
- * from the Insights service.
28
- * @property-read int|null $metroCode The metro code of the location if the location
29
- * is in the US. MaxMind returns the same metro codes as the
30
- * {@link * https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions
31
- * Google AdWords API}.
32
- * @property-read string|null $timeZone The time zone associated with location, as
33
- * specified by the {@link http://www.iana.org/time-zones IANA Time Zone
34
- * Database}, e.g., "America/New_York".
35
- */
36
- class Location extends AbstractRecord
37
- {
38
- /**
39
- * @ignore
40
- */
41
- protected $validAttributes = [
42
- 'averageIncome',
43
- 'accuracyRadius',
44
- 'latitude',
45
- 'longitude',
46
- 'metroCode',
47
- 'populationDensity',
48
- 'postalCode',
49
- 'postalConfidence',
50
- 'timeZone',
51
- ];
52
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ /**
6
+ * Contains data for the location record associated with an IP address.
7
+ *
8
+ * This record is returned by all location services and databases besides
9
+ * Country.
10
+ *
11
+ * @property-read int|null $averageIncome The average income in US dollars
12
+ * associated with the requested IP address. This attribute is only available
13
+ * from the Insights service.
14
+ * @property-read int|null $accuracyRadius The approximate accuracy radius in
15
+ * kilometers around the latitude and longitude for the IP address. This is
16
+ * the radius where we have a 67% confidence that the device using the IP
17
+ * address resides within the circle centered at the latitude and longitude
18
+ * with the provided radius.
19
+ * @property-read float|null $latitude The approximate latitude of the location
20
+ * associated with the IP address. This value is not precise and should not be
21
+ * used to identify a particular address or household.
22
+ * @property-read float|null $longitude The approximate longitude of the location
23
+ * associated with the IP address. This value is not precise and should not be
24
+ * used to identify a particular address or household.
25
+ * @property-read int|null $populationDensity The estimated population per square
26
+ * kilometer associated with the IP address. This attribute is only available
27
+ * from the Insights service.
28
+ * @property-read int|null $metroCode The metro code of the location if the location
29
+ * is in the US. MaxMind returns the same metro codes as the
30
+ * {@link * https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions
31
+ * Google AdWords API}.
32
+ * @property-read string|null $timeZone The time zone associated with location, as
33
+ * specified by the {@link http://www.iana.org/time-zones IANA Time Zone
34
+ * Database}, e.g., "America/New_York".
35
+ */
36
+ class Location extends AbstractRecord
37
+ {
38
+ /**
39
+ * @ignore
40
+ */
41
+ protected $validAttributes = [
42
+ 'averageIncome',
43
+ 'accuracyRadius',
44
+ 'latitude',
45
+ 'longitude',
46
+ 'metroCode',
47
+ 'populationDensity',
48
+ 'postalCode',
49
+ 'postalConfidence',
50
+ 'timeZone',
51
+ ];
52
+ }
vendor/geoip2/geoip2/src/Record/MaxMind.php CHANGED
@@ -1,19 +1,19 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- /**
6
- * Contains data about your account.
7
- *
8
- * This record is returned by all location services and databases.
9
- *
10
- * @property-read int|null $queriesRemaining The number of remaining queries you
11
- * have for the service you are calling.
12
- */
13
- class MaxMind extends AbstractRecord
14
- {
15
- /**
16
- * @ignore
17
- */
18
- protected $validAttributes = ['queriesRemaining'];
19
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ /**
6
+ * Contains data about your account.
7
+ *
8
+ * This record is returned by all location services and databases.
9
+ *
10
+ * @property-read int|null $queriesRemaining The number of remaining queries you
11
+ * have for the service you are calling.
12
+ */
13
+ class MaxMind extends AbstractRecord
14
+ {
15
+ /**
16
+ * @ignore
17
+ */
18
+ protected $validAttributes = ['queriesRemaining'];
19
+ }
vendor/geoip2/geoip2/src/Record/Postal.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- /**
6
- * Contains data for the postal record associated with an IP address.
7
- *
8
- * This record is returned by all location databases and services besides
9
- * Country.
10
- *
11
- * @property-read string|null $code The postal code of the location. Postal codes
12
- * are not available for all countries. In some countries, this will only
13
- * contain part of the postal code. This attribute is returned by all location
14
- * databases and services besides Country.
15
- * @property-read int|null $confidence A value from 0-100 indicating MaxMind's
16
- * confidence that the postal code is correct. This attribute is only
17
- * available from the Insights service and the GeoIP2 Enterprise
18
- * database.
19
- */
20
- class Postal extends AbstractRecord
21
- {
22
- /**
23
- * @ignore
24
- */
25
- protected $validAttributes = ['code', 'confidence'];
26
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ /**
6
+ * Contains data for the postal record associated with an IP address.
7
+ *
8
+ * This record is returned by all location databases and services besides
9
+ * Country.
10
+ *
11
+ * @property-read string|null $code The postal code of the location. Postal codes
12
+ * are not available for all countries. In some countries, this will only
13
+ * contain part of the postal code. This attribute is returned by all location
14
+ * databases and services besides Country.
15
+ * @property-read int|null $confidence A value from 0-100 indicating MaxMind's
16
+ * confidence that the postal code is correct. This attribute is only
17
+ * available from the Insights service and the GeoIP2 Enterprise
18
+ * database.
19
+ */
20
+ class Postal extends AbstractRecord
21
+ {
22
+ /**
23
+ * @ignore
24
+ */
25
+ protected $validAttributes = ['code', 'confidence'];
26
+ }
vendor/geoip2/geoip2/src/Record/RepresentedCountry.php CHANGED
@@ -1,35 +1,35 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- /**
6
- * Contains data for the represented country associated with an IP address.
7
- *
8
- * This class contains the country-level data associated with an IP address
9
- * for the IP's represented country. The represented country is the country
10
- * represented by something like a military base.
11
- *
12
- * @property-read int|null $confidence A value from 0-100 indicating MaxMind's
13
- * confidence that the country is correct. This attribute is only available
14
- * from the Insights service and the GeoIP2 Enterprise database.
15
- * @property-read int|null $geonameId The GeoName ID for the country.
16
- * @property-read string|null $isoCode The {@link http://en.wikipedia.org/wiki/ISO_3166-1
17
- * two-character ISO 3166-1 alpha code} for the country.
18
- * @property-read string|null $name The name of the country based on the locales list
19
- * passed to the constructor.
20
- * @property-read array|null $names An array map where the keys are locale codes and
21
- * the values are names.
22
- * @property-read string|null $type A string indicating the type of entity that is
23
- * representing the country. Currently we only return <code>military</code>
24
- * but this could expand to include other types in the future.
25
- */
26
- class RepresentedCountry extends Country
27
- {
28
- protected $validAttributes = [
29
- 'confidence',
30
- 'geonameId',
31
- 'isoCode',
32
- 'names',
33
- 'type',
34
- ];
35
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ /**
6
+ * Contains data for the represented country associated with an IP address.
7
+ *
8
+ * This class contains the country-level data associated with an IP address
9
+ * for the IP's represented country. The represented country is the country
10
+ * represented by something like a military base.
11
+ *
12
+ * @property-read int|null $confidence A value from 0-100 indicating MaxMind's
13
+ * confidence that the country is correct. This attribute is only available
14
+ * from the Insights service and the GeoIP2 Enterprise database.
15
+ * @property-read int|null $geonameId The GeoName ID for the country.
16
+ * @property-read string|null $isoCode The {@link http://en.wikipedia.org/wiki/ISO_3166-1
17
+ * two-character ISO 3166-1 alpha code} for the country.
18
+ * @property-read string|null $name The name of the country based on the locales list
19
+ * passed to the constructor.
20
+ * @property-read array|null $names An array map where the keys are locale codes and
21
+ * the values are names.
22
+ * @property-read string|null $type A string indicating the type of entity that is
23
+ * representing the country. Currently we only return <code>military</code>
24
+ * but this could expand to include other types in the future.
25
+ */
26
+ class RepresentedCountry extends Country
27
+ {
28
+ protected $validAttributes = [
29
+ 'confidence',
30
+ 'geonameId',
31
+ 'isoCode',
32
+ 'names',
33
+ 'type',
34
+ ];
35
+ }
vendor/geoip2/geoip2/src/Record/Subdivision.php CHANGED
@@ -1,40 +1,40 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- /**
6
- * Contains data for the subdivisions associated with an IP address.
7
- *
8
- * This record is returned by all location databases and services besides
9
- * Country.
10
- *
11
- * @property-read int|null $confidence This is a value from 0-100 indicating
12
- * MaxMind's confidence that the subdivision is correct. This attribute is
13
- * only available from the Insights service and the GeoIP2 Enterprise
14
- * database.
15
- * @property-read int|null $geonameId This is a GeoName ID for the subdivision.
16
- * This attribute is returned by all location databases and services besides
17
- * Country.
18
- * @property-read string|null $isoCode This is a string up to three characters long
19
- * contain the subdivision portion of the
20
- * {@link * http://en.wikipedia.org/wiki/ISO_3166-2 ISO 3166-2 code}. This attribute
21
- * is returned by all location databases and services except Country.
22
- * @property-read string|null $name The name of the subdivision based on the
23
- * locales list passed to the constructor. This attribute is returned by all
24
- * location databases and services besides Country.
25
- * @property-read array|null $names An array map where the keys are locale codes
26
- * and the values are names. This attribute is returned by all location
27
- * databases and services besides Country.
28
- */
29
- class Subdivision extends AbstractPlaceRecord
30
- {
31
- /**
32
- * @ignore
33
- */
34
- protected $validAttributes = [
35
- 'confidence',
36
- 'geonameId',
37
- 'isoCode',
38
- 'names',
39
- ];
40
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ /**
6
+ * Contains data for the subdivisions associated with an IP address.
7
+ *
8
+ * This record is returned by all location databases and services besides
9
+ * Country.
10
+ *
11
+ * @property-read int|null $confidence This is a value from 0-100 indicating
12
+ * MaxMind's confidence that the subdivision is correct. This attribute is
13
+ * only available from the Insights service and the GeoIP2 Enterprise
14
+ * database.
15
+ * @property-read int|null $geonameId This is a GeoName ID for the subdivision.
16
+ * This attribute is returned by all location databases and services besides
17
+ * Country.
18
+ * @property-read string|null $isoCode This is a string up to three characters long
19
+ * contain the subdivision portion of the
20
+ * {@link * http://en.wikipedia.org/wiki/ISO_3166-2 ISO 3166-2 code}. This attribute
21
+ * is returned by all location databases and services except Country.
22
+ * @property-read string|null $name The name of the subdivision based on the
23
+ * locales list passed to the constructor. This attribute is returned by all
24
+ * location databases and services besides Country.
25
+ * @property-read array|null $names An array map where the keys are locale codes
26
+ * and the values are names. This attribute is returned by all location
27
+ * databases and services besides Country.
28
+ */
29
+ class Subdivision extends AbstractPlaceRecord
30
+ {
31
+ /**
32
+ * @ignore
33
+ */
34
+ protected $validAttributes = [
35
+ 'confidence',
36
+ 'geonameId',
37
+ 'isoCode',
38
+ 'names',
39
+ ];
40
+ }
vendor/geoip2/geoip2/src/Record/Traits.php CHANGED
@@ -1,95 +1,95 @@
1
- <?php
2
-
3
- namespace GeoIp2\Record;
4
-
5
- /**
6
- * Contains data for the traits record associated with an IP address.
7
- *
8
- * This record is returned by all location services and databases.
9
- *
10
- * @property-read int|null $autonomousSystemNumber The
11
- * {@link * http://en.wikipedia.org/wiki/Autonomous_system_(Internet) autonomous
12
- * system number} associated with the IP address. This attribute is only
13
- * available from the City and Insights web service and the GeoIP2
14
- * Enterprise database.
15
- * @property-read string|null $autonomousSystemOrganization The organization
16
- * associated with the registered {@link * http://en.wikipedia.org/wiki/Autonomous_system_(Internet) autonomous
17
- * system number} for the IP address. This attribute is only available from
18
- * the City and Insights web service and the GeoIP2 Enterprise
19
- * database.
20
- * @property-read string|null $connectionType The connection type may take the
21
- * following values: "Dialup", "Cable/DSL", "Corporate", "Cellular".
22
- * Additional values may be added in the future. This attribute is only
23
- * available in the GeoIP2 Enterprise database.
24
- * @property-read string|null $domain The second level domain associated with the
25
- * IP address. This will be something like "example.com" or "example.co.uk",
26
- * not "foo.example.com". This attribute is only available from the
27
- * City and Insights web service and the GeoIP2 Enterprise
28
- * database.
29
- * @property-read string $ipAddress The IP address that the data in the model
30
- * is for. If you performed a "me" lookup against the web service, this
31
- * will be the externally routable IP address for the system the code is
32
- * running on. If the system is behind a NAT, this may differ from the IP
33
- * address locally assigned to it. This attribute is returned by all end
34
- * points.
35
- * @property-read bool $isAnonymousProxy *Deprecated.* Please see our
36
- * {@link * https://www.maxmind.com/en/geoip2-anonymous-ip-database GeoIP2
37
- * Anonymous IP database} to determine whether the IP address is used by an
38
- * anonymizing service.
39
- * @property-read bool $isLegitimateProxy This attribute is true if MaxMind
40
- * believes this IP address to be a legitimate proxy, such as an internal
41
- * VPN used by a corporation. This attribute is only available in the GeoIP2
42
- * Enterprise database.
43
- * @property-read bool $isSatelliteProvider *Deprecated.* Due to the
44
- * increased coverage by mobile carriers, very few satellite providers now
45
- * serve multiple countries. As a result, the output does not provide
46
- * sufficiently relevant data for us to maintain it.
47
- * @property-read string|null $isp The name of the ISP associated with the IP
48
- * address. This attribute is only available from the City and Insights web
49
- * services and the GeoIP2 Enterprise database.
50
- * @property-read string|null $organization The name of the organization associated
51
- * with the IP address. This attribute is only available from the City and
52
- * Insights web services and the GeoIP2 Enterprise database.
53
- * @property-read string|null $userType <p>The user type associated with the IP
54
- * address. This can be one of the following values:</p>
55
- * <ul>
56
- * <li>business
57
- * <li>cafe
58
- * <li>cellular
59
- * <li>college
60
- * <li>content_delivery_network
61
- * <li>dialup
62
- * <li>government
63
- * <li>hosting
64
- * <li>library
65
- * <li>military
66
- * <li>residential
67
- * <li>router
68
- * <li>school
69
- * <li>search_engine_spider
70
- * <li>traveler
71
- * </ul>
72
- * <p>
73
- * This attribute is only available from the Insights web service and the
74
- * GeoIP2 Enterprise database.
75
- * </p>
76
- */
77
- class Traits extends AbstractRecord
78
- {
79
- /**
80
- * @ignore
81
- */
82
- protected $validAttributes = [
83
- 'autonomousSystemNumber',
84
- 'autonomousSystemOrganization',
85
- 'connectionType',
86
- 'domain',
87
- 'isAnonymousProxy',
88
- 'isLegitimateProxy',
89
- 'isSatelliteProvider',
90
- 'isp',
91
- 'ipAddress',
92
- 'organization',
93
- 'userType',
94
- ];
95
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\Record;
4
+
5
+ /**
6
+ * Contains data for the traits record associated with an IP address.
7
+ *
8
+ * This record is returned by all location services and databases.
9
+ *
10
+ * @property-read int|null $autonomousSystemNumber The
11
+ * {@link * http://en.wikipedia.org/wiki/Autonomous_system_(Internet) autonomous
12
+ * system number} associated with the IP address. This attribute is only
13
+ * available from the City and Insights web service and the GeoIP2
14
+ * Enterprise database.
15
+ * @property-read string|null $autonomousSystemOrganization The organization
16
+ * associated with the registered {@link * http://en.wikipedia.org/wiki/Autonomous_system_(Internet) autonomous
17
+ * system number} for the IP address. This attribute is only available from
18
+ * the City and Insights web service and the GeoIP2 Enterprise
19
+ * database.
20
+ * @property-read string|null $connectionType The connection type may take the
21
+ * following values: "Dialup", "Cable/DSL", "Corporate", "Cellular".
22
+ * Additional values may be added in the future. This attribute is only
23
+ * available in the GeoIP2 Enterprise database.
24
+ * @property-read string|null $domain The second level domain associated with the
25
+ * IP address. This will be something like "example.com" or "example.co.uk",
26
+ * not "foo.example.com". This attribute is only available from the
27
+ * City and Insights web service and the GeoIP2 Enterprise
28
+ * database.
29
+ * @property-read string $ipAddress The IP address that the data in the model
30
+ * is for. If you performed a "me" lookup against the web service, this
31
+ * will be the externally routable IP address for the system the code is
32
+ * running on. If the system is behind a NAT, this may differ from the IP
33
+ * address locally assigned to it. This attribute is returned by all end
34
+ * points.
35
+ * @property-read bool $isAnonymousProxy *Deprecated.* Please see our
36
+ * {@link * https://www.maxmind.com/en/geoip2-anonymous-ip-database GeoIP2
37
+ * Anonymous IP database} to determine whether the IP address is used by an
38
+ * anonymizing service.
39
+ * @property-read bool $isLegitimateProxy This attribute is true if MaxMind
40
+ * believes this IP address to be a legitimate proxy, such as an internal
41
+ * VPN used by a corporation. This attribute is only available in the GeoIP2
42
+ * Enterprise database.
43
+ * @property-read bool $isSatelliteProvider *Deprecated.* Due to the
44
+ * increased coverage by mobile carriers, very few satellite providers now
45
+ * serve multiple countries. As a result, the output does not provide
46
+ * sufficiently relevant data for us to maintain it.
47
+ * @property-read string|null $isp The name of the ISP associated with the IP
48
+ * address. This attribute is only available from the City and Insights web
49
+ * services and the GeoIP2 Enterprise database.
50
+ * @property-read string|null $organization The name of the organization associated
51
+ * with the IP address. This attribute is only available from the City and
52
+ * Insights web services and the GeoIP2 Enterprise database.
53
+ * @property-read string|null $userType <p>The user type associated with the IP
54
+ * address. This can be one of the following values:</p>
55
+ * <ul>
56
+ * <li>business
57
+ * <li>cafe
58
+ * <li>cellular
59
+ * <li>college
60
+ * <li>content_delivery_network
61
+ * <li>dialup
62
+ * <li>government
63
+ * <li>hosting
64
+ * <li>library
65
+ * <li>military
66
+ * <li>residential
67
+ * <li>router
68
+ * <li>school
69
+ * <li>search_engine_spider
70
+ * <li>traveler
71
+ * </ul>
72
+ * <p>
73
+ * This attribute is only available from the Insights web service and the
74
+ * GeoIP2 Enterprise database.
75
+ * </p>
76
+ */
77
+ class Traits extends AbstractRecord
78
+ {
79
+ /**
80
+ * @ignore
81
+ */
82
+ protected $validAttributes = [
83
+ 'autonomousSystemNumber',
84
+ 'autonomousSystemOrganization',
85
+ 'connectionType',
86
+ 'domain',
87
+ 'isAnonymousProxy',
88
+ 'isLegitimateProxy',
89
+ 'isSatelliteProvider',
90
+ 'isp',
91
+ 'ipAddress',
92
+ 'organization',
93
+ 'userType',
94
+ ];
95
+ }
vendor/geoip2/geoip2/src/WebService/Client.php CHANGED
@@ -1,239 +1,239 @@
1
- <?php
2
-
3
- namespace GeoIp2\WebService;
4
-
5
- use GeoIp2\Exception\AddressNotFoundException;
6
- use GeoIp2\Exception\AuthenticationException;
7
- use GeoIp2\Exception\GeoIp2Exception;
8
- use GeoIp2\Exception\HttpException;
9
- use GeoIp2\Exception\InvalidRequestException;
10
- use GeoIp2\Exception\OutOfQueriesException;
11
- use GeoIp2\ProviderInterface;
12
- use MaxMind\WebService\Client as WsClient;
13
-
14
- /**
15
- * This class provides a client API for all the GeoIP2 Precision web services.
16
- * The services are Country, City, and Insights. Each service returns a
17
- * different set of data about an IP address, with Country returning the
18
- * least data and Insights the most.
19
- *
20
- * Each web service is represented by a different model class, and these model
21
- * classes in turn contain multiple record classes. The record classes have
22
- * attributes which contain data about the IP address.
23
- *
24
- * If the web service does not return a particular piece of data for an IP
25
- * address, the associated attribute is not populated.
26
- *
27
- * The web service may not return any information for an entire record, in
28
- * which case all of the attributes for that record class will be empty.
29
- *
30
- * ## Usage ##
31
- *
32
- * The basic API for this class is the same for all of the web service end
33
- * points. First you create a web service object with your MaxMind `$userId`
34
- * and `$licenseKey`, then you call the method corresponding to a specific end
35
- * point, passing it the IP address you want to look up.
36
- *
37
- * If the request succeeds, the method call will return a model class for
38
- * the service you called. This model in turn contains multiple record
39
- * classes, each of which represents part of the data returned by the web
40
- * service.
41
- *
42
- * If the request fails, the client class throws an exception.
43
- */
44
- class Client implements ProviderInterface
45
- {
46
- private $locales;
47
- private $client;
48
- private static $basePath = '/geoip/v2.1';
49
-
50
- const VERSION = 'v2.6.0';
51
-
52
- /**
53
- * Constructor.
54
- *
55
- * @param int $userId your MaxMind user ID
56
- * @param string $licenseKey your MaxMind license key
57
- * @param array $locales list of locale codes to use in name property
58
- * from most preferred to least preferred
59
- * @param array $options array of options. Valid options include:
60
- * * `host` - The host to use when querying the web service.
61
- * * `timeout` - Timeout in seconds.
62
- * * `connectTimeout` - Initial connection timeout in seconds.
63
- * * `proxy` - The HTTP proxy to use. May include a schema, port,
64
- * username, and password, e.g.,
65
- * `http://username:password@127.0.0.1:10`.
66
- */
67
- public function __construct(
68
- $userId,
69
- $licenseKey,
70
- $locales = ['en'],
71
- $options = []
72
- ) {
73
- $this->locales = $locales;
74
-
75
- // This is for backwards compatibility. Do not remove except for a
76
- // major version bump.
77
- if (is_string($options)) {
78
- $options = ['host' => $options];
79
- }
80
-
81
- if (!isset($options['host'])) {
82
- $options['host'] = 'geoip.maxmind.com';
83
- }
84
-
85
- $options['userAgent'] = $this->userAgent();
86
-
87
- $this->client = new WsClient($userId, $licenseKey, $options);
88
- }
89
-
90
- private function userAgent()
91
- {
92
- return 'GeoIP2-API/' . self::VERSION;
93
- }
94
-
95
- /**
96
- * This method calls the GeoIP2 Precision: City service.
97
- *
98
- * @param string $ipAddress IPv4 or IPv6 address as a string. If no
99
- * address is provided, the address that the web service is called
100
- * from will be used.
101
- *
102
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address you
103
- * provided is not in our database (e.g., a private address).
104
- * @throws \GeoIp2\Exception\AuthenticationException if there is a problem
105
- * with the user ID or license key that you provided
106
- * @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
107
- * of queries
108
- * @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
109
- * invalid for some other reason. This may indicate an issue
110
- * with this API. Please report the error to MaxMind.
111
- * @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error code or message was returned.
112
- * This could indicate a problem with the connection between
113
- * your server and the web service or that the web service
114
- * returned an invalid document or 500 error code.
115
- * @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent
116
- * class to the above exceptions. It will be thrown directly
117
- * if a 200 status code is returned but the body is invalid.
118
- *
119
- * @return \GeoIp2\Model\City
120
- */
121
- public function city($ipAddress = 'me')
122
- {
123
- return $this->responseFor('city', 'City', $ipAddress);
124
- }
125
-
126
- /**
127
- * This method calls the GeoIP2 Precision: Country service.
128
- *
129
- * @param string $ipAddress IPv4 or IPv6 address as a string. If no
130
- * address is provided, the address that the web service is called
131
- * from will be used.
132
- *
133
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address you provided is not in our database (e.g.,
134
- * a private address).
135
- * @throws \GeoIp2\Exception\AuthenticationException if there is a problem
136
- * with the user ID or license key that you provided
137
- * @throws \GeoIp2\Exception\OutOfQueriesException if your account is out of queries
138
- * @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
139
- * invalid for some other reason. This may indicate an
140
- * issue with this API. Please report the error to MaxMind.
141
- * @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error
142
- * code or message was returned. This could indicate a problem
143
- * with the connection between your server and the web service
144
- * or that the web service returned an invalid document or 500
145
- * error code.
146
- * @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent class to the above exceptions. It
147
- * will be thrown directly if a 200 status code is returned but
148
- * the body is invalid.
149
- *
150
- * @return \GeoIp2\Model\Country
151
- */
152
- public function country($ipAddress = 'me')
153
- {
154
- return $this->responseFor('country', 'Country', $ipAddress);
155
- }
156
-
157
- /**
158
- * This method calls the GeoIP2 Precision: Insights service.
159
- *
160
- * @param string $ipAddress IPv4 or IPv6 address as a string. If no
161
- * address is provided, the address that the web service is called
162
- * from will be used.
163
- *
164
- * @throws \GeoIp2\Exception\AddressNotFoundException if the address you
165
- * provided is not in our database (e.g., a private address).
166
- * @throws \GeoIp2\Exception\AuthenticationException if there is a problem
167
- * with the user ID or license key that you provided
168
- * @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
169
- * of queries
170
- * @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
171
- * invalid for some other reason. This may indicate an
172
- * issue with this API. Please report the error to MaxMind.
173
- * @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error code or message was returned.
174
- * This could indicate a problem with the connection between
175
- * your server and the web service or that the web service
176
- * returned an invalid document or 500 error code.
177
- * @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent
178
- * class to the above exceptions. It will be thrown directly
179
- * if a 200 status code is returned but the body is invalid.
180
- *
181
- * @return \GeoIp2\Model\Insights
182
- */
183
- public function insights($ipAddress = 'me')
184
- {
185
- return $this->responseFor('insights', 'Insights', $ipAddress);
186
- }
187
-
188
- private function responseFor($endpoint, $class, $ipAddress)
189
- {
190
- $path = implode('/', [self::$basePath, $endpoint, $ipAddress]);
191
-
192
- try {
193
- $body = $this->client->get('GeoIP2 ' . $class, $path);
194
- } catch (\MaxMind\Exception\IpAddressNotFoundException $ex) {
195
- throw new AddressNotFoundException(
196
- $ex->getMessage(),
197
- $ex->getStatusCode(),
198
- $ex
199
- );
200
- } catch (\MaxMind\Exception\AuthenticationException $ex) {
201
- throw new AuthenticationException(
202
- $ex->getMessage(),
203
- $ex->getStatusCode(),
204
- $ex
205
- );
206
- } catch (\MaxMind\Exception\InsufficientFundsException $ex) {
207
- throw new OutOfQueriesException(
208
- $ex->getMessage(),
209
- $ex->getStatusCode(),
210
- $ex
211
- );
212
- } catch (\MaxMind\Exception\InvalidRequestException $ex) {
213
- throw new InvalidRequestException(
214
- $ex->getMessage(),
215
- $ex->getErrorCode(),
216
- $ex->getStatusCode(),
217
- $ex->getUri(),
218
- $ex
219
- );
220
- } catch (\MaxMind\Exception\HttpException $ex) {
221
- throw new HttpException(
222
- $ex->getMessage(),
223
- $ex->getStatusCode(),
224
- $ex->getUri(),
225
- $ex
226
- );
227
- } catch (\MaxMind\Exception\WebServiceException $ex) {
228
- throw new GeoIp2Exception(
229
- $ex->getMessage(),
230
- $ex->getCode(),
231
- $ex
232
- );
233
- }
234
-
235
- $class = 'GeoIp2\\Model\\' . $class;
236
-
237
- return new $class($body, $this->locales);
238
- }
239
- }
1
+ <?php
2
+
3
+ namespace GeoIp2\WebService;
4
+
5
+ use GeoIp2\Exception\AddressNotFoundException;
6
+ use GeoIp2\Exception\AuthenticationException;
7
+ use GeoIp2\Exception\GeoIp2Exception;
8
+ use GeoIp2\Exception\HttpException;
9
+ use GeoIp2\Exception\InvalidRequestException;
10
+ use GeoIp2\Exception\OutOfQueriesException;
11
+ use GeoIp2\ProviderInterface;
12
+ use MaxMind\WebService\Client as WsClient;
13
+
14
+ /**
15
+ * This class provides a client API for all the GeoIP2 Precision web services.
16
+ * The services are Country, City, and Insights. Each service returns a
17
+ * different set of data about an IP address, with Country returning the
18
+ * least data and Insights the most.
19
+ *
20
+ * Each web service is represented by a different model class, and these model
21
+ * classes in turn contain multiple record classes. The record classes have
22
+ * attributes which contain data about the IP address.
23
+ *
24
+ * If the web service does not return a particular piece of data for an IP
25
+ * address, the associated attribute is not populated.
26
+ *
27
+ * The web service may not return any information for an entire record, in
28
+ * which case all of the attributes for that record class will be empty.
29
+ *
30
+ * ## Usage ##
31
+ *
32
+ * The basic API for this class is the same for all of the web service end
33
+ * points. First you create a web service object with your MaxMind `$userId`
34
+ * and `$licenseKey`, then you call the method corresponding to a specific end
35
+ * point, passing it the IP address you want to look up.
36
+ *
37
+ * If the request succeeds, the method call will return a model class for
38
+ * the service you called. This model in turn contains multiple record
39
+ * classes, each of which represents part of the data returned by the web
40
+ * service.
41
+ *
42
+ * If the request fails, the client class throws an exception.
43
+ */
44
+ class Client implements ProviderInterface
45
+ {
46
+ private $locales;
47
+ private $client;
48
+ private static $basePath = '/geoip/v2.1';
49
+
50
+ const VERSION = 'v2.6.0';
51
+
52
+ /**
53
+ * Constructor.
54
+ *
55
+ * @param int $userId your MaxMind user ID
56
+ * @param string $licenseKey your MaxMind license key
57
+ * @param array $locales list of locale codes to use in name property
58
+ * from most preferred to least preferred
59
+ * @param array $options array of options. Valid options include:
60
+ * * `host` - The host to use when querying the web service.
61
+ * * `timeout` - Timeout in seconds.
62
+ * * `connectTimeout` - Initial connection timeout in seconds.
63
+ * * `proxy` - The HTTP proxy to use. May include a schema, port,
64
+ * username, and password, e.g.,
65
+ * `http://username:password@127.0.0.1:10`.
66
+ */
67
+ public function __construct(
68
+ $userId,
69
+ $licenseKey,
70
+ $locales = ['en'],
71
+ $options = []
72
+ ) {
73
+ $this->locales = $locales;
74
+
75
+ // This is for backwards compatibility. Do not remove except for a
76
+ // major version bump.
77
+ if (is_string($options)) {
78
+ $options = ['host' => $options];
79
+ }
80
+
81
+ if (!isset($options['host'])) {
82
+ $options['host'] = 'geoip.maxmind.com';
83
+ }
84
+
85
+ $options['userAgent'] = $this->userAgent();
86
+
87
+ $this->client = new WsClient($userId, $licenseKey, $options);
88
+ }
89
+
90
+ private function userAgent()
91
+ {
92
+ return 'GeoIP2-API/' . self::VERSION;
93
+ }
94
+
95
+ /**
96
+ * This method calls the GeoIP2 Precision: City service.
97
+ *
98
+ * @param string $ipAddress IPv4 or IPv6 address as a string. If no
99
+ * address is provided, the address that the web service is called
100
+ * from will be used.
101
+ *
102
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address you
103
+ * provided is not in our database (e.g., a private address).
104
+ * @throws \GeoIp2\Exception\AuthenticationException if there is a problem
105
+ * with the user ID or license key that you provided
106
+ * @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
107
+ * of queries
108
+ * @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
109
+ * invalid for some other reason. This may indicate an issue
110
+ * with this API. Please report the error to MaxMind.
111
+ * @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error code or message was returned.
112
+ * This could indicate a problem with the connection between
113
+ * your server and the web service or that the web service
114
+ * returned an invalid document or 500 error code.
115
+ * @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent
116
+ * class to the above exceptions. It will be thrown directly
117
+ * if a 200 status code is returned but the body is invalid.
118
+ *
119
+ * @return \GeoIp2\Model\City
120
+ */
121
+ public function city($ipAddress = 'me')
122
+ {
123
+ return $this->responseFor('city', 'City', $ipAddress);
124
+ }
125
+
126
+ /**
127
+ * This method calls the GeoIP2 Precision: Country service.
128
+ *
129
+ * @param string $ipAddress IPv4 or IPv6 address as a string. If no
130
+ * address is provided, the address that the web service is called
131
+ * from will be used.
132
+ *
133
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address you provided is not in our database (e.g.,
134
+ * a private address).
135
+ * @throws \GeoIp2\Exception\AuthenticationException if there is a problem
136
+ * with the user ID or license key that you provided
137
+ * @throws \GeoIp2\Exception\OutOfQueriesException if your account is out of queries
138
+ * @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
139
+ * invalid for some other reason. This may indicate an
140
+ * issue with this API. Please report the error to MaxMind.
141
+ * @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error
142
+ * code or message was returned. This could indicate a problem
143
+ * with the connection between your server and the web service
144
+ * or that the web service returned an invalid document or 500
145
+ * error code.
146
+ * @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent class to the above exceptions. It
147
+ * will be thrown directly if a 200 status code is returned but
148
+ * the body is invalid.
149
+ *
150
+ * @return \GeoIp2\Model\Country
151
+ */
152
+ public function country($ipAddress = 'me')
153
+ {
154
+ return $this->responseFor('country', 'Country', $ipAddress);
155
+ }
156
+
157
+ /**
158
+ * This method calls the GeoIP2 Precision: Insights service.
159
+ *
160
+ * @param string $ipAddress IPv4 or IPv6 address as a string. If no
161
+ * address is provided, the address that the web service is called
162
+ * from will be used.
163
+ *
164
+ * @throws \GeoIp2\Exception\AddressNotFoundException if the address you
165
+ * provided is not in our database (e.g., a private address).
166
+ * @throws \GeoIp2\Exception\AuthenticationException if there is a problem
167
+ * with the user ID or license key that you provided
168
+ * @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
169
+ * of queries
170
+ * @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
171
+ * invalid for some other reason. This may indicate an
172
+ * issue with this API. Please report the error to MaxMind.
173
+ * @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error code or message was returned.
174
+ * This could indicate a problem with the connection between
175
+ * your server and the web service or that the web service
176
+ * returned an invalid document or 500 error code.
177
+ * @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent
178
+ * class to the above exceptions. It will be thrown directly
179
+ * if a 200 status code is returned but the body is invalid.
180
+ *
181
+ * @return \GeoIp2\Model\Insights
182
+ */
183
+ public function insights($ipAddress = 'me')
184
+ {
185
+ return $this->responseFor('insights', 'Insights', $ipAddress);
186
+ }
187
+
188
+ private function responseFor($endpoint, $class, $ipAddress)
189
+ {
190
+ $path = implode('/', [self::$basePath, $endpoint, $ipAddress]);
191
+
192
+ try {
193
+ $body = $this->client->get('GeoIP2 ' . $class, $path);
194
+ } catch (\MaxMind\Exception\IpAddressNotFoundException $ex) {
195
+ throw new AddressNotFoundException(
196
+ $ex->getMessage(),
197
+ $ex->getStatusCode(),
198
+ $ex
199
+ );
200
+ } catch (\MaxMind\Exception\AuthenticationException $ex) {
201
+ throw new AuthenticationException(
202
+ $ex->getMessage(),
203
+ $ex->getStatusCode(),
204
+ $ex
205
+ );
206
+ } catch (\MaxMind\Exception\InsufficientFundsException $ex) {
207
+ throw new OutOfQueriesException(
208
+ $ex->getMessage(),
209
+ $ex->getStatusCode(),
210
+ $ex
211
+ );
212
+ } catch (\MaxMind\Exception\InvalidRequestException $ex) {
213
+ throw new InvalidRequestException(
214
+ $ex->getMessage(),
215
+ $ex->getErrorCode(),
216
+ $ex->getStatusCode(),
217
+ $ex->getUri(),
218
+ $ex
219
+ );
220
+ } catch (\MaxMind\Exception\HttpException $ex) {
221
+ throw new HttpException(
222
+ $ex->getMessage(),
223
+ $ex->getStatusCode(),
224
+ $ex->getUri(),
225
+ $ex
226
+ );
227
+ } catch (\MaxMind\Exception\WebServiceException $ex) {
228
+ throw new GeoIp2Exception(
229
+ $ex->getMessage(),
230
+ $ex->getCode(),
231
+ $ex
232
+ );
233
+ }
234
+
235
+ $class = 'GeoIp2\\Model\\' . $class;
236
+
237
+ return new $class($body, $this->locales);
238
+ }
239
+ }
vendor/maxmind-db/reader/LICENSE CHANGED
@@ -1,202 +1,202 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
vendor/maxmind-db/reader/ext/config.m4 CHANGED
@@ -1,19 +1,19 @@
1
- PHP_ARG_WITH(maxminddb,
2
- [Whether to enable the MaxMind DB Reader extension],
3
- [ --with-maxminddb Enable MaxMind DB Reader extension support])
4
-
5
- PHP_ARG_ENABLE(maxminddb-debug, for MaxMind DB debug support,
6
- [ --enable-maxminddb-debug Enable enable MaxMind DB deubg support], no, no)
7
-
8
- if test $PHP_MAXMINDDB != "no"; then
9
- PHP_CHECK_LIBRARY(maxminddb, MMDB_open)
10
-
11
- if test $PHP_MAXMINDDB_DEBUG != "no"; then
12
- CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror"
13
- fi
14
-
15
- PHP_ADD_LIBRARY(maxminddb, 1, MAXMINDDB_SHARED_LIBADD)
16
- PHP_SUBST(MAXMINDDB_SHARED_LIBADD)
17
-
18
- PHP_NEW_EXTENSION(maxminddb, maxminddb.c, $ext_shared)
19
- fi
1
+ PHP_ARG_WITH(maxminddb,
2
+ [Whether to enable the MaxMind DB Reader extension],
3
+ [ --with-maxminddb Enable MaxMind DB Reader extension support])
4
+
5
+ PHP_ARG_ENABLE(maxminddb-debug, for MaxMind DB debug support,
6
+ [ --enable-maxminddb-debug Enable enable MaxMind DB deubg support], no, no)
7
+
8
+ if test $PHP_MAXMINDDB != "no"; then
9
+ PHP_CHECK_LIBRARY(maxminddb, MMDB_open)
10
+
11
+ if test $PHP_MAXMINDDB_DEBUG != "no"; then
12
+ CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror"
13
+ fi
14
+
15
+ PHP_ADD_LIBRARY(maxminddb, 1, MAXMINDDB_SHARED_LIBADD)
16
+ PHP_SUBST(MAXMINDDB_SHARED_LIBADD)
17
+
18
+ PHP_NEW_EXTENSION(maxminddb, maxminddb.c, $ext_shared)
19
+ fi
vendor/maxmind-db/reader/ext/maxminddb.c CHANGED
@@ -1,565 +1,565 @@
1
- /* MaxMind, Inc., licenses this file to you under the Apache License, Version
2
- * 2.0 (the "License"); you may not use this file except in compliance with
3
- * the License. You may obtain a copy of the License at
4
- *
5
- * http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software
8
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10
- * License for the specific language governing permissions and limitations
11
- * under the License.
12
- */
13
-
14
- #include "php_maxminddb.h"
15
-
16
- #ifdef HAVE_CONFIG_H
17
- #include "config.h"
18
- #endif
19
-
20
- #include <php.h>
21
- #include <zend.h>
22
- #include "Zend/zend_exceptions.h"
23
- #include <maxminddb.h>
24
-
25
- #ifdef ZTS
26
- #include <TSRM.h>
27
- #endif
28
-
29
- #define __STDC_FORMAT_MACROS
30
- #include <inttypes.h>
31
-
32
- #define PHP_MAXMINDDB_NS ZEND_NS_NAME("MaxMind", "Db")
33
- #define PHP_MAXMINDDB_READER_NS ZEND_NS_NAME(PHP_MAXMINDDB_NS, "Reader")
34
- #define PHP_MAXMINDDB_READER_EX_NS \
35
- ZEND_NS_NAME(PHP_MAXMINDDB_READER_NS, \
36
- "InvalidDatabaseException")
37
-
38
- #ifdef ZEND_ENGINE_3
39
- #define Z_MAXMINDDB_P(zv) php_maxminddb_fetch_object(Z_OBJ_P(zv))
40
- #define _ZVAL_STRING ZVAL_STRING
41
- #define _ZVAL_STRINGL ZVAL_STRINGL
42
- typedef size_t strsize_t;
43
- typedef zend_object free_obj_t;
44
- #else
45
- #define Z_MAXMINDDB_P(zv) (maxminddb_obj *) zend_object_store_get_object(zv TSRMLS_CC)
46
- #define _ZVAL_STRING(a, b) ZVAL_STRING(a, b, 1)
47
- #define _ZVAL_STRINGL(a, b, c) ZVAL_STRINGL(a, b, c, 1)
48
- typedef int strsize_t;
49
- typedef void free_obj_t;
50
- #endif
51
-
52
- #ifdef ZEND_ENGINE_3
53
- typedef struct _maxminddb_obj {
54
- MMDB_s *mmdb;
55
- zend_object std;
56
- } maxminddb_obj;
57
- #else
58
- typedef struct _maxminddb_obj {
59
- zend_object std;
60
- MMDB_s *mmdb;
61
- } maxminddb_obj;
62
- #endif
63
-
64
- PHP_FUNCTION(maxminddb);
65
-
66
- static const MMDB_entry_data_list_s *handle_entry_data_list(
67
- const MMDB_entry_data_list_s *entry_data_list,
68
- zval *z_value
69
- TSRMLS_DC);
70
- static const MMDB_entry_data_list_s *handle_array(
71
- const MMDB_entry_data_list_s *entry_data_list,
72
- zval *z_value TSRMLS_DC);
73
- static const MMDB_entry_data_list_s *handle_map(
74
- const MMDB_entry_data_list_s *entry_data_list,
75
- zval *z_value TSRMLS_DC);
76
- static void handle_uint128(const MMDB_entry_data_list_s *entry_data_list,
77
- zval *z_value TSRMLS_DC);
78
- static void handle_uint64(const MMDB_entry_data_list_s *entry_data_list,
79
- zval *z_value TSRMLS_DC);
80
- static zend_class_entry * lookup_class(const char *name TSRMLS_DC);
81
-
82
- #define CHECK_ALLOCATED(val) \
83
- if (!val ) { \
84
- zend_error(E_ERROR, "Out of memory"); \
85
- return; \
86
- } \
87
-
88
- #define THROW_EXCEPTION(name, ... ) \
89
- { \
90
- zend_class_entry *exception_ce = lookup_class(name TSRMLS_CC); \
91
- zend_throw_exception_ex(exception_ce, 0 TSRMLS_CC, __VA_ARGS__); \
92
- } \
93
-
94
-
95
- #if PHP_VERSION_ID < 50399
96
- #define object_properties_init(zo, class_type) \
97
- { \
98
- zval *tmp; \
99
- zend_hash_copy((*zo).properties, \
100
- &class_type->default_properties, \
101
- (copy_ctor_func_t)zval_add_ref, \
102
- (void *)&tmp, \
103
- sizeof(zval *)); \
104
- }
105
- #endif
106
-
107
- static zend_object_handlers maxminddb_obj_handlers;
108
- static zend_class_entry *maxminddb_ce;
109
-
110
- static inline maxminddb_obj *php_maxminddb_fetch_object(zend_object *obj TSRMLS_DC){
111
- #ifdef ZEND_ENGINE_3
112
- return (maxminddb_obj *)((char*)(obj) - XtOffsetOf(maxminddb_obj, std));
113
- #else
114
- return (maxminddb_obj *)obj;
115
- #endif
116
- }
117
-
118
- PHP_METHOD(MaxMind_Db_Reader, __construct){
119
- char *db_file = NULL;
120
- strsize_t name_len;
121
- zval * _this_zval = NULL;
122
-
123
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
124
- &_this_zval, maxminddb_ce, &db_file, &name_len) == FAILURE) {
125
- THROW_EXCEPTION("InvalidArgumentException",
126
- "The constructor takes exactly one argument.");
127
- return;
128
- }
129
-
130
- if (0 != access(db_file, R_OK)) {
131
- THROW_EXCEPTION("InvalidArgumentException",
132
- "The file \"%s\" does not exist or is not readable.",
133
- db_file);
134
- return;
135
- }
136
-
137
- MMDB_s *mmdb = (MMDB_s *)emalloc(sizeof(MMDB_s));
138
- uint16_t status = MMDB_open(db_file, MMDB_MODE_MMAP, mmdb);
139
-
140
- if (MMDB_SUCCESS != status) {
141
- THROW_EXCEPTION(
142
- PHP_MAXMINDDB_READER_EX_NS,
143
- "Error opening database file (%s). Is this a valid MaxMind DB file?",
144
- db_file);
145
- efree(mmdb);
146
- return;
147
- }
148
-
149
- maxminddb_obj *mmdb_obj = Z_MAXMINDDB_P(getThis());
150
- mmdb_obj->mmdb = mmdb;
151
- }
152
-
153
- PHP_METHOD(MaxMind_Db_Reader, get){
154
- char *ip_address = NULL;
155
- strsize_t name_len;
156
- zval * _this_zval = NULL;
157
-
158
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
159
- &_this_zval, maxminddb_ce, &ip_address, &name_len) == FAILURE) {
160
- THROW_EXCEPTION("InvalidArgumentException",
161
- "Method takes exactly one argument.");
162
- return;
163
- }
164
-
165
- const maxminddb_obj *mmdb_obj =
166
- (maxminddb_obj *)Z_MAXMINDDB_P(getThis());
167
-
168
- MMDB_s *mmdb = mmdb_obj->mmdb;
169
-
170
- if (NULL == mmdb) {
171
- THROW_EXCEPTION("BadMethodCallException",
172
- "Attempt to read from a closed MaxMind DB.");
173
- return;
174
- }
175
-
176
- int gai_error = 0;
177
- int mmdb_error = MMDB_SUCCESS;
178
- MMDB_lookup_result_s result =
179
- MMDB_lookup_string(mmdb, ip_address, &gai_error,
180
- &mmdb_error);
181
-
182
- if (MMDB_SUCCESS != gai_error) {
183
- THROW_EXCEPTION("InvalidArgumentException",
184
- "The value \"%s\" is not a valid IP address.",
185
- ip_address);
186
- return;
187
- }
188
-
189
- if (MMDB_SUCCESS != mmdb_error) {
190
- char *exception_name;
191
- if (MMDB_IPV6_LOOKUP_IN_IPV4_DATABASE_ERROR == mmdb_error) {
192
- exception_name = "InvalidArgumentException";
193
- } else {
194
- exception_name = PHP_MAXMINDDB_READER_EX_NS;
195
- }
196
- THROW_EXCEPTION(exception_name,
197
- "Error looking up %s. %s",
198
- ip_address, MMDB_strerror(mmdb_error));
199
- return;
200
- }
201
-
202
- MMDB_entry_data_list_s *entry_data_list = NULL;
203
-
204
- if (!result.found_entry) {
205
- RETURN_NULL();
206
- }
207
-
208
- int status = MMDB_get_entry_data_list(&result.entry, &entry_data_list);
209
-
210
- if (MMDB_SUCCESS != status) {
211
- THROW_EXCEPTION(PHP_MAXMINDDB_READER_EX_NS,
212
- "Error while looking up data for %s. %s",
213
- ip_address, MMDB_strerror(status));
214
- MMDB_free_entry_data_list(entry_data_list);
215
- return;
216
- } else if (NULL == entry_data_list) {
217
- THROW_EXCEPTION(
218
- PHP_MAXMINDDB_READER_EX_NS,
219
- "Error while looking up data for %s. Your database may be corrupt or you have found a bug in libmaxminddb.",
220
- ip_address);
221
- return;
222
- }
223
-
224
- handle_entry_data_list(entry_data_list, return_value TSRMLS_CC);
225
- MMDB_free_entry_data_list(entry_data_list);
226
- }
227
-
228
- PHP_METHOD(MaxMind_Db_Reader, metadata){
229
- if (ZEND_NUM_ARGS() != 0) {
230
- THROW_EXCEPTION("InvalidArgumentException",
231
- "Method takes no arguments.");
232
- return;
233
- }
234
-
235
- const maxminddb_obj *const mmdb_obj =
236
- (maxminddb_obj *)Z_MAXMINDDB_P(getThis());
237
-
238
- if (NULL == mmdb_obj->mmdb) {
239
- THROW_EXCEPTION("BadMethodCallException",
240
- "Attempt to read from a closed MaxMind DB.");
241
- return;
242
- }
243
-
244
- const char *const name = ZEND_NS_NAME(PHP_MAXMINDDB_READER_NS, "Metadata");
245
- zend_class_entry *metadata_ce = lookup_class(name TSRMLS_CC);
246
-
247
- object_init_ex(return_value, metadata_ce);
248
-
249
- #ifdef ZEND_ENGINE_3
250
- zval _metadata_array;
251
- zval *metadata_array = &_metadata_array;
252
- ZVAL_NULL(metadata_array);
253
- #else
254
- zval *metadata_array;
255
- ALLOC_INIT_ZVAL(metadata_array);
256
- #endif
257
-
258
- MMDB_entry_data_list_s *entry_data_list;
259
- MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
260
-
261
- handle_entry_data_list(entry_data_list, metadata_array TSRMLS_CC);
262
- MMDB_free_entry_data_list(entry_data_list);
263
- #ifdef ZEND_ENGINE_3
264
- zend_call_method_with_1_params(return_value, metadata_ce,
265
- &metadata_ce->constructor,
266
- ZEND_CONSTRUCTOR_FUNC_NAME,
267
- NULL,
268
- metadata_array);
269
- zval_ptr_dtor(metadata_array);
270
- #else
271
- zend_call_method_with_1_params(&return_value, metadata_ce,
272
- &metadata_ce->constructor,
273
- ZEND_CONSTRUCTOR_FUNC_NAME,
274
- NULL,
275
- metadata_array);
276
- zval_ptr_dtor(&metadata_array);
277
- #endif
278
- }
279
-
280
- PHP_METHOD(MaxMind_Db_Reader, close){
281
- if (ZEND_NUM_ARGS() != 0) {
282
- THROW_EXCEPTION("InvalidArgumentException",
283
- "Method takes no arguments.");
284
- return;
285
- }
286
-
287
- maxminddb_obj *mmdb_obj =
288
- (maxminddb_obj *)Z_MAXMINDDB_P(getThis());
289
-
290
- if (NULL == mmdb_obj->mmdb) {
291
- THROW_EXCEPTION("BadMethodCallException",
292
- "Attempt to close a closed MaxMind DB.");
293
- return;
294
- }
295
- MMDB_close(mmdb_obj->mmdb);
296
- efree(mmdb_obj->mmdb);
297
- mmdb_obj->mmdb = NULL;
298
- }
299
-
300
- static const MMDB_entry_data_list_s *handle_entry_data_list(
301
- const MMDB_entry_data_list_s *entry_data_list,
302
- zval *z_value
303
- TSRMLS_DC)
304
- {
305
- switch (entry_data_list->entry_data.type) {
306
- case MMDB_DATA_TYPE_MAP:
307
- return handle_map(entry_data_list, z_value TSRMLS_CC);
308
- case MMDB_DATA_TYPE_ARRAY:
309
- return handle_array(entry_data_list, z_value TSRMLS_CC);
310
- case MMDB_DATA_TYPE_UTF8_STRING:
311
- _ZVAL_STRINGL(z_value,
312
- (char *)entry_data_list->entry_data.utf8_string,
313
- entry_data_list->entry_data.data_size);
314
- break;
315
- case MMDB_DATA_TYPE_BYTES:
316
- _ZVAL_STRINGL(z_value, (char *)entry_data_list->entry_data.bytes,
317
- entry_data_list->entry_data.data_size);
318
- break;
319
- case MMDB_DATA_TYPE_DOUBLE:
320
- ZVAL_DOUBLE(z_value, entry_data_list->entry_data.double_value);
321
- break;
322
- case MMDB_DATA_TYPE_FLOAT:
323
- ZVAL_DOUBLE(z_value, entry_data_list->entry_data.float_value);
324
- break;
325
- case MMDB_DATA_TYPE_UINT16:
326
- ZVAL_LONG(z_value, entry_data_list->entry_data.uint16);
327
- break;
328
- case MMDB_DATA_TYPE_UINT32:
329
- ZVAL_LONG(z_value, entry_data_list->entry_data.uint32);
330
- break;
331
- case MMDB_DATA_TYPE_BOOLEAN:
332
- ZVAL_BOOL(z_value, entry_data_list->entry_data.boolean);
333
- break;
334
- case MMDB_DATA_TYPE_UINT64:
335
- handle_uint64(entry_data_list, z_value TSRMLS_CC);
336
- break;
337
- case MMDB_DATA_TYPE_UINT128:
338
- handle_uint128(entry_data_list, z_value TSRMLS_CC);
339
- break;
340
- case MMDB_DATA_TYPE_INT32:
341
- ZVAL_LONG(z_value, entry_data_list->entry_data.int32);
342
- break;
343
- default:
344
- THROW_EXCEPTION(PHP_MAXMINDDB_READER_EX_NS,
345
- "Invalid data type arguments: %d",
346
- entry_data_list->entry_data.type);
347
- return NULL;
348
- }
349
- return entry_data_list;
350
- }
351
-
352
- static const MMDB_entry_data_list_s *handle_map(
353
- const MMDB_entry_data_list_s *entry_data_list,
354
- zval *z_value TSRMLS_DC)
355
- {
356
- array_init(z_value);
357
- const uint32_t map_size = entry_data_list->entry_data.data_size;
358
-
359
- uint i;
360
- for (i = 0; i < map_size && entry_data_list; i++ ) {
361
- entry_data_list = entry_data_list->next;
362
-
363
- char *key =
364
- estrndup((char *)entry_data_list->entry_data.utf8_string,
365
- entry_data_list->entry_data.data_size);
366
- if (NULL == key) {
367
- THROW_EXCEPTION(PHP_MAXMINDDB_READER_EX_NS,
368
- "Invalid data type arguments");
369
- return NULL;
370
- }
371
-
372
- entry_data_list = entry_data_list->next;
373
- #ifdef ZEND_ENGINE_3
374
- zval _new_value;
375
- zval * new_value = &_new_value;
376
- ZVAL_NULL(new_value);
377
- #else
378
- zval *new_value;
379
- ALLOC_INIT_ZVAL(new_value);
380
- #endif
381
- entry_data_list = handle_entry_data_list(entry_data_list,
382
- new_value TSRMLS_CC);
383
- add_assoc_zval(z_value, key, new_value);
384
- efree(key);
385
- }
386
- return entry_data_list;
387
- }
388
-
389
- static const MMDB_entry_data_list_s *handle_array(
390
- const MMDB_entry_data_list_s *entry_data_list,
391
- zval *z_value TSRMLS_DC)
392
- {
393
- const uint32_t size = entry_data_list->entry_data.data_size;
394
-
395
- array_init(z_value);
396
-
397
- uint i;
398
- for (i = 0; i < size && entry_data_list; i++) {
399
- entry_data_list = entry_data_list->next;
400
- #ifdef ZEND_ENGINE_3
401
- zval _new_value;
402
- zval * new_value = &_new_value;
403
- ZVAL_NULL(new_value);
404
- #else
405
- zval *new_value;
406
- ALLOC_INIT_ZVAL(new_value);
407
- #endif
408
- entry_data_list = handle_entry_data_list(entry_data_list,
409
- new_value TSRMLS_CC);
410
- add_next_index_zval(z_value, new_value);
411
- }
412
- return entry_data_list;
413
- }
414
-
415
- static void handle_uint128(const MMDB_entry_data_list_s *entry_data_list,
416
- zval *z_value TSRMLS_DC)
417
- {
418
- uint64_t high = 0;
419
- uint64_t low = 0;
420
- #if MMDB_UINT128_IS_BYTE_ARRAY
421
- int i;
422
- for (i = 0; i < 8; i++) {
423
- high = (high << 8) | entry_data_list->entry_data.uint128[i];
424
- }
425
-
426
- for (i = 8; i < 16; i++) {
427
- low = (low << 8) | entry_data_list->entry_data.uint128[i];
428
- }
429
- #else
430
- high = entry_data_list->entry_data.uint128 >> 64;
431
- low = (uint64_t)entry_data_list->entry_data.uint128;
432
- #endif
433
-
434
- char *num_str;
435
- spprintf(&num_str, 0, "0x%016" PRIX64 "%016" PRIX64, high, low);
436
- CHECK_ALLOCATED(num_str);
437
-
438
- _ZVAL_STRING(z_value, num_str);
439
- efree(num_str);
440
- }
441
-
442
- static void handle_uint64(const MMDB_entry_data_list_s *entry_data_list,
443
- zval *z_value TSRMLS_DC)
444
- {
445
- // We return it as a string because PHP uses signed longs
446
- char *int_str;
447
- spprintf(&int_str, 0, "%" PRIu64,
448
- entry_data_list->entry_data.uint64);
449
- CHECK_ALLOCATED(int_str);
450
-
451
- _ZVAL_STRING(z_value, int_str);
452
- efree(int_str);
453
- }
454
-
455
- static zend_class_entry *lookup_class(const char *name TSRMLS_DC)
456
- {
457
- #ifdef ZEND_ENGINE_3
458
- zend_string *n = zend_string_init(name, strlen(name), 0);
459
- zend_class_entry *ce = zend_lookup_class(n);
460
- zend_string_release(n);
461
- if( NULL == ce ) {
462
- zend_error(E_ERROR, "Class %s not found", name);
463
- }
464
- return ce;
465
- #else
466
- zend_class_entry **ce;
467
- if (FAILURE ==
468
- zend_lookup_class(name, strlen(name),
469
- &ce TSRMLS_CC)) {
470
- zend_error(E_ERROR, "Class %s not found", name);
471
- }
472
- return *ce;
473
- #endif
474
- }
475
-
476
- static void maxminddb_free_storage(free_obj_t *object TSRMLS_DC)
477
- {
478
- maxminddb_obj *obj = php_maxminddb_fetch_object((zend_object *)object TSRMLS_CC);
479
- if (obj->mmdb != NULL) {
480
- MMDB_close(obj->mmdb);
481
- efree(obj->mmdb);
482
- }
483
-
484
- zend_object_std_dtor(&obj->std TSRMLS_CC);
485
- #ifndef ZEND_ENGINE_3
486
- efree(object);
487
- #endif
488
- }
489
-
490
- #ifdef ZEND_ENGINE_3
491
- static zend_object *maxminddb_create_handler(
492
- zend_class_entry *type TSRMLS_DC)
493
- {
494
- maxminddb_obj *obj = (maxminddb_obj *)ecalloc(1, sizeof(maxminddb_obj));
495
- zend_object_std_init(&obj->std, type TSRMLS_CC);
496
- object_properties_init(&(obj->std), type);
497
-
498
- obj->std.handlers = &maxminddb_obj_handlers;
499
-
500
- return &obj->std;
501
- }
502
- #else
503
- static zend_object_value maxminddb_create_handler(
504
- zend_class_entry *type TSRMLS_DC)
505
- {
506
- zend_object_value retval;
507
-
508
- maxminddb_obj *obj = (maxminddb_obj *)ecalloc(1, sizeof(maxminddb_obj));
509
- zend_object_std_init(&obj->std, type TSRMLS_CC);
510
- object_properties_init(&(obj->std), type);
511
-
512
- retval.handle = zend_objects_store_put(obj, NULL,
513
- maxminddb_free_storage,
514
- NULL TSRMLS_CC);
515
- retval.handlers = &maxminddb_obj_handlers;
516
-
517
- return retval;
518
- }
519
- #endif
520
-
521
- /* *INDENT-OFF* */
522
- static zend_function_entry maxminddb_methods[] = {
523
- PHP_ME(MaxMind_Db_Reader, __construct, NULL,
524
- ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
525
- PHP_ME(MaxMind_Db_Reader, close, NULL, ZEND_ACC_PUBLIC)
526
- PHP_ME(MaxMind_Db_Reader, get, NULL, ZEND_ACC_PUBLIC)
527
- PHP_ME(MaxMind_Db_Reader, metadata, NULL, ZEND_ACC_PUBLIC)
528
- { NULL, NULL, NULL }
529
- };
530
- /* *INDENT-ON* */
531
-
532
- PHP_MINIT_FUNCTION(maxminddb){
533
- zend_class_entry ce;
534
-
535
- INIT_CLASS_ENTRY(ce, PHP_MAXMINDDB_READER_NS, maxminddb_methods);
536
- maxminddb_ce = zend_register_internal_class(&ce TSRMLS_CC);
537
- maxminddb_ce->create_object = maxminddb_create_handler;
538
- maxminddb_ce->ce_flags |= ZEND_ACC_FINAL;
539
- memcpy(&maxminddb_obj_handlers,
540
- zend_get_std_object_handlers(), sizeof(zend_object_handlers));
541
- maxminddb_obj_handlers.clone_obj = NULL;
542
- #ifdef ZEND_ENGINE_3
543
- maxminddb_obj_handlers.offset = XtOffsetOf(maxminddb_obj, std);
544
- maxminddb_obj_handlers.free_obj = maxminddb_free_storage;
545
- #endif
546
-
547
- return SUCCESS;
548
- }
549
-
550
- zend_module_entry maxminddb_module_entry = {
551
- STANDARD_MODULE_HEADER,
552
- PHP_MAXMINDDB_EXTNAME,
553
- NULL,
554
- PHP_MINIT(maxminddb),
555
- NULL,
556
- NULL,
557
- NULL,
558
- NULL,
559
- PHP_MAXMINDDB_VERSION,
560
- STANDARD_MODULE_PROPERTIES
561
- };
562
-
563
- #ifdef COMPILE_DL_MAXMINDDB
564
- ZEND_GET_MODULE(maxminddb)
565
- #endif
1
+ /* MaxMind, Inc., licenses this file to you under the Apache License, Version
2
+ * 2.0 (the "License"); you may not use this file except in compliance with
3
+ * the License. You may obtain a copy of the License at
4
+ *
5
+ * http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10
+ * License for the specific language governing permissions and limitations
11
+ * under the License.
12
+ */
13
+
14
+ #include "php_maxminddb.h"
15
+
16
+ #ifdef HAVE_CONFIG_H
17
+ #include "config.h"
18
+ #endif
19
+
20
+ #include <php.h>
21
+ #include <zend.h>
22
+ #include "Zend/zend_exceptions.h"
23
+ #include <maxminddb.h>
24
+
25
+ #ifdef ZTS
26
+ #include <TSRM.h>
27
+ #endif
28
+
29
+ #define __STDC_FORMAT_MACROS
30
+ #include <inttypes.h>
31
+
32
+ #define PHP_MAXMINDDB_NS ZEND_NS_NAME("MaxMind", "Db")
33
+ #define PHP_MAXMINDDB_READER_NS ZEND_NS_NAME(PHP_MAXMINDDB_NS, "Reader")
34
+ #define PHP_MAXMINDDB_READER_EX_NS \
35
+ ZEND_NS_NAME(PHP_MAXMINDDB_READER_NS, \
36
+ "InvalidDatabaseException")
37
+
38
+ #ifdef ZEND_ENGINE_3
39
+ #define Z_MAXMINDDB_P(zv) php_maxminddb_fetch_object(Z_OBJ_P(zv))
40
+ #define _ZVAL_STRING ZVAL_STRING
41
+ #define _ZVAL_STRINGL ZVAL_STRINGL
42
+ typedef size_t strsize_t;
43
+ typedef zend_object free_obj_t;
44
+ #else
45
+ #define Z_MAXMINDDB_P(zv) (maxminddb_obj *) zend_object_store_get_object(zv TSRMLS_CC)
46
+ #define _ZVAL_STRING(a, b) ZVAL_STRING(a, b, 1)
47
+ #define _ZVAL_STRINGL(a, b, c) ZVAL_STRINGL(a, b, c, 1)
48
+ typedef int strsize_t;
49
+ typedef void free_obj_t;
50
+ #endif
51
+
52
+ #ifdef ZEND_ENGINE_3
53
+ typedef struct _maxminddb_obj {
54
+ MMDB_s *mmdb;
55
+ zend_object std;
56
+ } maxminddb_obj;
57
+ #else
58
+ typedef struct _maxminddb_obj {
59
+ zend_object std;
60
+ MMDB_s *mmdb;
61
+ } maxminddb_obj;
62
+ #endif
63
+
64
+ PHP_FUNCTION(maxminddb);
65
+
66
+ static const MMDB_entry_data_list_s *handle_entry_data_list(
67
+ const MMDB_entry_data_list_s *entry_data_list,
68
+ zval *z_value
69
+ TSRMLS_DC);
70
+ static const MMDB_entry_data_list_s *handle_array(
71
+ const MMDB_entry_data_list_s *entry_data_list,
72
+ zval *z_value TSRMLS_DC);
73
+ static const MMDB_entry_data_list_s *handle_map(
74
+ const MMDB_entry_data_list_s *entry_data_list,
75
+ zval *z_value TSRMLS_DC);
76
+ static void handle_uint128(const MMDB_entry_data_list_s *entry_data_list,
77
+ zval *z_value TSRMLS_DC);
78
+ static void handle_uint64(const MMDB_entry_data_list_s *entry_data_list,
79
+ zval *z_value TSRMLS_DC);
80
+ static zend_class_entry * lookup_class(const char *name TSRMLS_DC);
81
+
82
+ #define CHECK_ALLOCATED(val) \
83
+ if (!val ) { \
84
+ zend_error(E_ERROR, "Out of memory"); \
85
+ return; \
86
+ } \
87
+
88
+ #define THROW_EXCEPTION(name, ... ) \
89
+ { \
90
+ zend_class_entry *exception_ce = lookup_class(name TSRMLS_CC); \
91
+ zend_throw_exception_ex(exception_ce, 0 TSRMLS_CC, __VA_ARGS__); \
92
+ } \
93
+
94
+
95
+ #if PHP_VERSION_ID < 50399
96
+ #define object_properties_init(zo, class_type) \
97
+ { \
98
+ zval *tmp; \
99
+ zend_hash_copy((*zo).properties, \
100
+ &class_type->default_properties, \
101
+ (copy_ctor_func_t)zval_add_ref, \
102
+ (void *)&tmp, \
103
+ sizeof(zval *)); \
104
+ }
105
+ #endif
106
+
107
+ static zend_object_handlers maxminddb_obj_handlers;
108
+ static zend_class_entry *maxminddb_ce;
109
+
110
+ static inline maxminddb_obj *php_maxminddb_fetch_object(zend_object *obj TSRMLS_DC){
111
+ #ifdef ZEND_ENGINE_3
112
+ return (maxminddb_obj *)((char*)(obj) - XtOffsetOf(maxminddb_obj, std));
113
+ #else
114
+ return (maxminddb_obj *)obj;
115
+ #endif
116
+ }
117
+
118
+ PHP_METHOD(MaxMind_Db_Reader, __construct){
119
+ char *db_file = NULL;
120
+ strsize_t name_len;
121
+ zval * _this_zval = NULL;
122
+
123
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
124
+ &_this_zval, maxminddb_ce, &db_file, &name_len) == FAILURE) {
125
+ THROW_EXCEPTION("InvalidArgumentException",
126
+ "The constructor takes exactly one argument.");
127
+ return;
128
+ }
129
+
130
+ if (0 != access(db_file, R_OK)) {
131
+ THROW_EXCEPTION("InvalidArgumentException",
132
+ "The file \"%s\" does not exist or is not readable.",
133
+ db_file);
134
+ return;
135
+ }
136
+
137
+ MMDB_s *mmdb = (MMDB_s *)emalloc(sizeof(MMDB_s));
138
+ uint16_t status = MMDB_open(db_file, MMDB_MODE_MMAP, mmdb);
139
+
140
+ if (MMDB_SUCCESS != status) {
141
+ THROW_EXCEPTION(
142
+ PHP_MAXMINDDB_READER_EX_NS,
143
+ "Error opening database file (%s). Is this a valid MaxMind DB file?",
144
+ db_file);
145
+ efree(mmdb);
146
+ return;
147
+ }
148
+
149
+ maxminddb_obj *mmdb_obj = Z_MAXMINDDB_P(getThis());
150
+ mmdb_obj->mmdb = mmdb;
151
+ }
152
+
153
+ PHP_METHOD(MaxMind_Db_Reader, get){
154
+ char *ip_address = NULL;
155
+ strsize_t name_len;
156
+ zval * _this_zval = NULL;
157
+
158
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
159
+ &_this_zval, maxminddb_ce, &ip_address, &name_len) == FAILURE) {
160
+ THROW_EXCEPTION("InvalidArgumentException",
161
+ "Method takes exactly one argument.");
162
+ return;
163
+ }
164
+
165
+ const maxminddb_obj *mmdb_obj =
166
+ (maxminddb_obj *)Z_MAXMINDDB_P(getThis());
167
+
168
+ MMDB_s *mmdb = mmdb_obj->mmdb;
169
+
170
+ if (NULL == mmdb) {
171
+ THROW_EXCEPTION("BadMethodCallException",
172
+ "Attempt to read from a closed MaxMind DB.");
173
+ return;
174
+ }
175
+
176
+ int gai_error = 0;
177
+ int mmdb_error = MMDB_SUCCESS;
178
+ MMDB_lookup_result_s result =
179
+ MMDB_lookup_string(mmdb, ip_address, &gai_error,
180
+ &mmdb_error);
181
+
182
+ if (MMDB_SUCCESS != gai_error) {
183
+ THROW_EXCEPTION("InvalidArgumentException",
184
+ "The value \"%s\" is not a valid IP address.",
185
+ ip_address);
186
+ return;
187
+ }
188
+
189
+ if (MMDB_SUCCESS != mmdb_error) {
190
+ char *exception_name;
191
+ if (MMDB_IPV6_LOOKUP_IN_IPV4_DATABASE_ERROR == mmdb_error) {
192
+ exception_name = "InvalidArgumentException";
193
+ } else {
194
+ exception_name = PHP_MAXMINDDB_READER_EX_NS;
195
+ }
196
+ THROW_EXCEPTION(exception_name,
197
+ "Error looking up %s. %s",
198
+ ip_address, MMDB_strerror(mmdb_error));
199
+ return;
200
+ }
201
+
202
+ MMDB_entry_data_list_s *entry_data_list = NULL;
203
+
204
+ if (!result.found_entry) {
205
+ RETURN_NULL();
206
+ }
207
+
208
+ int status = MMDB_get_entry_data_list(&result.entry, &entry_data_list);
209
+
210
+ if (MMDB_SUCCESS != status) {
211
+ THROW_EXCEPTION(PHP_MAXMINDDB_READER_EX_NS,
212
+ "Error while looking up data for %s. %s",
213
+ ip_address, MMDB_strerror(status));
214
+ MMDB_free_entry_data_list(entry_data_list);
215
+ return;
216
+ } else if (NULL == entry_data_list) {
217
+ THROW_EXCEPTION(
218
+ PHP_MAXMINDDB_READER_EX_NS,
219
+ "Error while looking up data for %s. Your database may be corrupt or you have found a bug in libmaxminddb.",
220
+ ip_address);
221
+ return;
222
+ }
223
+
224
+ handle_entry_data_list(entry_data_list, return_value TSRMLS_CC);
225
+ MMDB_free_entry_data_list(entry_data_list);
226
+ }
227
+
228
+ PHP_METHOD(MaxMind_Db_Reader, metadata){
229
+ if (ZEND_NUM_ARGS() != 0) {
230
+ THROW_EXCEPTION("InvalidArgumentException",
231
+ "Method takes no arguments.");
232
+ return;
233
+ }
234
+
235
+ const maxminddb_obj *const mmdb_obj =
236
+ (maxminddb_obj *)Z_MAXMINDDB_P(getThis());
237
+
238
+ if (NULL == mmdb_obj->mmdb) {
239
+ THROW_EXCEPTION("BadMethodCallException",
240
+ "Attempt to read from a closed MaxMind DB.");
241
+ return;
242
+ }
243
+
244
+ const char *const name = ZEND_NS_NAME(PHP_MAXMINDDB_READER_NS, "Metadata");
245
+ zend_class_entry *metadata_ce = lookup_class(name TSRMLS_CC);
246
+
247
+ object_init_ex(return_value, metadata_ce);
248
+
249
+ #ifdef ZEND_ENGINE_3
250
+ zval _metadata_array;
251
+ zval *metadata_array = &_metadata_array;
252
+ ZVAL_NULL(metadata_array);
253
+ #else
254
+ zval *metadata_array;
255
+ ALLOC_INIT_ZVAL(metadata_array);
256
+ #endif
257
+
258
+ MMDB_entry_data_list_s *entry_data_list;
259
+ MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
260
+
261
+ handle_entry_data_list(entry_data_list, metadata_array TSRMLS_CC);
262
+ MMDB_free_entry_data_list(entry_data_list);
263
+ #ifdef ZEND_ENGINE_3
264
+ zend_call_method_with_1_params(return_value, metadata_ce,
265
+ &metadata_ce->constructor,
266
+ ZEND_CONSTRUCTOR_FUNC_NAME,
267
+ NULL,
268
+ metadata_array);
269
+ zval_ptr_dtor(metadata_array);
270
+ #else
271
+ zend_call_method_with_1_params(&return_value, metadata_ce,
272
+ &metadata_ce->constructor,
273
+ ZEND_CONSTRUCTOR_FUNC_NAME,
274
+ NULL,
275
+ metadata_array);
276
+ zval_ptr_dtor(&metadata_array);
277
+ #endif
278
+ }
279
+
280
+ PHP_METHOD(MaxMind_Db_Reader, close){
281
+ if (ZEND_NUM_ARGS() != 0) {
282
+ THROW_EXCEPTION("InvalidArgumentException",
283
+ "Method takes no arguments.");
284
+ return;
285
+ }
286
+
287
+ maxminddb_obj *mmdb_obj =
288
+ (maxminddb_obj *)Z_MAXMINDDB_P(getThis());
289
+
290
+ if (NULL == mmdb_obj->mmdb) {
291
+ THROW_EXCEPTION("BadMethodCallException",
292
+ "Attempt to close a closed MaxMind DB.");
293
+ return;
294
+ }
295
+ MMDB_close(mmdb_obj->mmdb);
296
+ efree(mmdb_obj->mmdb);
297
+ mmdb_obj->mmdb = NULL;
298
+ }
299
+
300
+ static const MMDB_entry_data_list_s *handle_entry_data_list(
301
+ const MMDB_entry_data_list_s *entry_data_list,
302
+ zval *z_value
303
+ TSRMLS_DC)
304
+ {
305
+ switch (entry_data_list->entry_data.type) {
306
+ case MMDB_DATA_TYPE_MAP:
307
+ return handle_map(entry_data_list, z_value TSRMLS_CC);
308
+ case MMDB_DATA_TYPE_ARRAY:
309
+ return handle_array(entry_data_list, z_value TSRMLS_CC);
310
+ case MMDB_DATA_TYPE_UTF8_STRING:
311
+ _ZVAL_STRINGL(z_value,
312
+ (char *)entry_data_list->entry_data.utf8_string,
313
+ entry_data_list->entry_data.data_size);
314
+ break;
315
+ case MMDB_DATA_TYPE_BYTES:
316
+ _ZVAL_STRINGL(z_value, (char *)entry_data_list->entry_data.bytes,
317
+ entry_data_list->entry_data.data_size);
318
+ break;
319
+ case MMDB_DATA_TYPE_DOUBLE:
320
+ ZVAL_DOUBLE(z_value, entry_data_list->entry_data.double_value);
321
+ break;
322
+ case MMDB_DATA_TYPE_FLOAT:
323
+ ZVAL_DOUBLE(z_value, entry_data_list->entry_data.float_value);
324
+ break;
325
+ case MMDB_DATA_TYPE_UINT16:
326
+ ZVAL_LONG(z_value, entry_data_list->entry_data.uint16);
327
+ break;
328
+ case MMDB_DATA_TYPE_UINT32:
329
+ ZVAL_LONG(z_value, entry_data_list->entry_data.uint32);
330
+ break;
331
+ case MMDB_DATA_TYPE_BOOLEAN:
332
+ ZVAL_BOOL(z_value, entry_data_list->entry_data.boolean);
333
+ break;
334
+ case MMDB_DATA_TYPE_UINT64:
335
+ handle_uint64(entry_data_list, z_value TSRMLS_CC);
336
+ break;
337
+ case MMDB_DATA_TYPE_UINT128:
338
+ handle_uint128(entry_data_list, z_value TSRMLS_CC);
339
+ break;
340
+ case MMDB_DATA_TYPE_INT32:
341
+ ZVAL_LONG(z_value, entry_data_list->entry_data.int32);
342
+ break;
343
+ default:
344
+ THROW_EXCEPTION(PHP_MAXMINDDB_READER_EX_NS,
345
+ "Invalid data type arguments: %d",
346
+ entry_data_list->entry_data.type);
347
+ return NULL;
348
+ }
349
+ return entry_data_list;
350
+ }
351
+
352
+ static const MMDB_entry_data_list_s *handle_map(
353
+ const MMDB_entry_data_list_s *entry_data_list,
354
+ zval *z_value TSRMLS_DC)
355
+ {
356
+ array_init(z_value);
357
+ const uint32_t map_size = entry_data_list->entry_data.data_size;
358
+
359
+ uint i;
360
+ for (i = 0; i < map_size && entry_data_list; i++ ) {
361
+ entry_data_list = entry_data_list->next;
362
+
363
+ char *key =
364
+ estrndup((char *)entry_data_list->entry_data.utf8_string,
365
+ entry_data_list->entry_data.data_size);
366
+ if (NULL == key) {
367
+ THROW_EXCEPTION(PHP_MAXMINDDB_READER_EX_NS,
368
+ "Invalid data type arguments");
369
+ return NULL;
370
+ }
371
+
372
+ entry_data_list = entry_data_list->next;
373
+ #ifdef ZEND_ENGINE_3
374
+ zval _new_value;
375
+ zval * new_value = &_new_value;
376
+ ZVAL_NULL(new_value);
377
+ #else
378
+ zval *new_value;
379
+ ALLOC_INIT_ZVAL(new_value);
380
+ #endif
381
+ entry_data_list = handle_entry_data_list(entry_data_list,
382
+ new_value TSRMLS_CC);
383
+ add_assoc_zval(z_value, key, new_value);
384
+ efree(key);
385
+ }
386
+ return entry_data_list;
387
+ }
388
+
389
+ static const MMDB_entry_data_list_s *handle_array(
390
+ const MMDB_entry_data_list_s *entry_data_list,
391
+ zval *z_value TSRMLS_DC)
392
+ {
393
+ const uint32_t size = entry_data_list->entry_data.data_size;
394
+
395
+ array_init(z_value);
396
+
397
+ uint i;
398
+ for (i = 0; i < size && entry_data_list; i++) {
399
+ entry_data_list = entry_data_list->next;
400
+ #ifdef ZEND_ENGINE_3
401
+ zval _new_value;
402
+ zval * new_value = &_new_value;
403
+ ZVAL_NULL(new_value);
404
+ #else
405
+ zval *new_value;
406
+ ALLOC_INIT_ZVAL(new_value);
407
+ #endif
408
+ entry_data_list = handle_entry_data_list(entry_data_list,
409
+ new_value TSRMLS_CC);
410
+ add_next_index_zval(z_value, new_value);
411
+ }
412
+ return entry_data_list;
413
+ }
414
+
415
+ static void handle_uint128(const MMDB_entry_data_list_s *entry_data_list,
416
+ zval *z_value TSRMLS_DC)
417
+ {
418
+ uint64_t high = 0;
419
+ uint64_t low = 0;
420
+ #if MMDB_UINT128_IS_BYTE_ARRAY
421
+ int i;
422
+ for (i = 0; i < 8; i++) {
423
+ high = (high << 8) | entry_data_list->entry_data.uint128[i];
424
+ }
425
+
426
+ for (i = 8; i < 16; i++) {
427
+ low = (low << 8) | entry_data_list->entry_data.uint128[i];
428
+ }
429
+ #else
430
+ high = entry_data_list->entry_data.uint128 >> 64;
431
+ low = (uint64_t)entry_data_list->entry_data.uint128;
432
+ #endif
433
+
434
+ char *num_str;
435
+ spprintf(&num_str, 0, "0x%016" PRIX64 "%016" PRIX64, high, low);
436
+ CHECK_ALLOCATED(num_str);
437
+
438
+ _ZVAL_STRING(z_value, num_str);
439
+ efree(num_str);
440
+ }
441
+
442
+ static void handle_uint64(const MMDB_entry_data_list_s *entry_data_list,
443
+ zval *z_value TSRMLS_DC)
444
+ {
445
+ // We return it as a string because PHP uses signed longs
446
+ char *int_str;
447
+ spprintf(&int_str, 0, "%" PRIu64,
448
+ entry_data_list->entry_data.uint64);
449
+ CHECK_ALLOCATED(int_str);
450
+
451
+ _ZVAL_STRING(z_value, int_str);
452
+ efree(int_str);
453
+ }
454
+
455
+ static zend_class_entry *lookup_class(const char *name TSRMLS_DC)
456
+ {
457
+ #ifdef ZEND_ENGINE_3
458
+ zend_string *n = zend_string_init(name, strlen(name), 0);
459
+ zend_class_entry *ce = zend_lookup_class(n);
460
+ zend_string_release(n);
461
+ if( NULL == ce ) {
462
+ zend_error(E_ERROR, "Class %s not found", name);
463
+ }
464
+ return ce;
465
+ #else
466
+ zend_class_entry **ce;
467
+ if (FAILURE ==
468
+ zend_lookup_class(name, strlen(name),
469
+ &ce TSRMLS_CC)) {
470
+ zend_error(E_ERROR, "Class %s not found", name);
471
+ }
472
+ return *ce;
473
+ #endif
474
+ }
475
+
476
+ static void maxminddb_free_storage(free_obj_t *object TSRMLS_DC)
477
+ {
478
+ maxminddb_obj *obj = php_maxminddb_fetch_object((zend_object *)object TSRMLS_CC);
479
+ if (obj->mmdb != NULL) {
480
+ MMDB_close(obj->mmdb);
481
+ efree(obj->mmdb);
482
+ }
483
+
484
+ zend_object_std_dtor(&obj->std TSRMLS_CC);
485
+ #ifndef ZEND_ENGINE_3
486
+ efree(object);
487
+ #endif
488
+ }
489
+
490
+ #ifdef ZEND_ENGINE_3
491
+ static zend_object *maxminddb_create_handler(
492
+ zend_class_entry *type TSRMLS_DC)
493
+ {
494
+ maxminddb_obj *obj = (maxminddb_obj *)ecalloc(1, sizeof(maxminddb_obj));
495
+ zend_object_std_init(&obj->std, type TSRMLS_CC);
496
+ object_properties_init(&(obj->std), type);
497
+
498
+ obj->std.handlers = &maxminddb_obj_handlers;
499
+
500
+ return &obj->std;
501
+ }
502
+ #else
503
+ static zend_object_value maxminddb_create_handler(
504
+ zend_class_entry *type TSRMLS_DC)
505
+ {
506
+ zend_object_value retval;
507
+
508
+ maxminddb_obj *obj = (maxminddb_obj *)ecalloc(1, sizeof(maxminddb_obj));
509
+ zend_object_std_init(&obj->std, type TSRMLS_CC);
510
+ object_properties_init(&(obj->std), type);
511
+
512
+ retval.handle = zend_objects_store_put(obj, NULL,
513
+ maxminddb_free_storage,
514
+ NULL TSRMLS_CC);
515
+ retval.handlers = &maxminddb_obj_handlers;
516
+
517
+ return retval;
518
+ }
519
+ #endif
520
+
521
+ /* *INDENT-OFF* */
522
+ static zend_function_entry maxminddb_methods[] = {
523
+ PHP_ME(MaxMind_Db_Reader, __construct, NULL,
524
+ ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
525
+ PHP_ME(MaxMind_Db_Reader, close, NULL, ZEND_ACC_PUBLIC)
526
+ PHP_ME(MaxMind_Db_Reader, get, NULL, ZEND_ACC_PUBLIC)
527
+ PHP_ME(MaxMind_Db_Reader, metadata, NULL, ZEND_ACC_PUBLIC)
528
+ { NULL, NULL, NULL }
529
+ };
530
+ /* *INDENT-ON* */
531
+
532
+ PHP_MINIT_FUNCTION(maxminddb){
533
+ zend_class_entry ce;
534
+
535
+ INIT_CLASS_ENTRY(ce, PHP_MAXMINDDB_READER_NS, maxminddb_methods);
536
+ maxminddb_ce = zend_register_internal_class(&ce TSRMLS_CC);
537
+ maxminddb_ce->create_object = maxminddb_create_handler;
538
+ maxminddb_ce->ce_flags |= ZEND_ACC_FINAL;
539
+ memcpy(&maxminddb_obj_handlers,
540
+ zend_get_std_object_handlers(), sizeof(zend_object_handlers));
541
+ maxminddb_obj_handlers.clone_obj = NULL;
542
+ #ifdef ZEND_ENGINE_3
543
+ maxminddb_obj_handlers.offset = XtOffsetOf(maxminddb_obj, std);
544
+ maxminddb_obj_handlers.free_obj = maxminddb_free_storage;
545
+ #endif
546
+
547
+ return SUCCESS;
548
+ }
549
+
550
+ zend_module_entry maxminddb_module_entry = {
551
+ STANDARD_MODULE_HEADER,
552
+ PHP_MAXMINDDB_EXTNAME,
553
+ NULL,
554
+ PHP_MINIT(maxminddb),
555
+ NULL,
556
+ NULL,
557
+ NULL,
558
+ NULL,
559
+ PHP_MAXMINDDB_VERSION,
560
+ STANDARD_MODULE_PROPERTIES
561
+ };
562
+
563
+ #ifdef COMPILE_DL_MAXMINDDB
564
+ ZEND_GET_MODULE(maxminddb)
565
+ #endif
vendor/maxmind-db/reader/ext/tests/001-load.phpt CHANGED
@@ -1,10 +1,10 @@
1
- --TEST--
2
- Check for maxminddb presence
3
- --SKIPIF--
4
- <?php if (!extension_loaded("maxminddb")) print "skip"; ?>
5
- --FILE--
6
- <?php
7
- echo "maxminddb extension is available";
8
- ?>
9
- --EXPECT--
10
- maxminddb extension is available
1
+ --TEST--
2
+ Check for maxminddb presence
3
+ --SKIPIF--
4
+ <?php if (!extension_loaded("maxminddb")) print "skip"; ?>
5
+ --FILE--
6
+ <?php
7
+ echo "maxminddb extension is available";
8
+ ?>
9
+ --EXPECT--
10
+ maxminddb extension is available
vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php CHANGED
@@ -1,309 +1,309 @@
1
- <?php
2
-
3
- namespace MaxMind\Db\Reader;
4
-
5
- use MaxMind\Db\Reader\InvalidDatabaseException;
6
- use MaxMind\Db\Reader\Util;
7
-
8
- class Decoder
9
- {
10
-
11
- private $fileStream;
12
- private $pointerBase;
13
- // This is only used for unit testing
14
- private $pointerTestHack;
15
- private $switchByteOrder;
16
-
17
- private $types = array(
18
- 0 => 'extended',
19
- 1 => 'pointer',
20
- 2 => 'utf8_string',
21
- 3 => 'double',
22
- 4 => 'bytes',
23
- 5 => 'uint16',
24
- 6 => 'uint32',
25
- 7 => 'map',
26
- 8 => 'int32',
27
- 9 => 'uint64',
28
- 10 => 'uint128',
29
- 11 => 'array',
30
- 12 => 'container',
31
- 13 => 'end_marker',
32
- 14 => 'boolean',
33
- 15 => 'float',
34
- );
35
-
36
- public function __construct(
37
- $fileStream,
38
- $pointerBase = 0,
39
- $pointerTestHack = false
40
- ) {
41
- $this->fileStream = $fileStream;
42
- $this->pointerBase = $pointerBase;
43
- $this->pointerTestHack = $pointerTestHack;
44
-
45
- $this->switchByteOrder = $this->isPlatformLittleEndian();
46
- }
47
-
48
-
49
- public function decode($offset)
50
- {
51
- list(, $ctrlByte) = unpack(
52
- 'C',
53
- Util::read($this->fileStream, $offset, 1)
54
- );
55
- $offset++;
56
-
57
- $type = $this->types[$ctrlByte >> 5];
58
-
59
- // Pointers are a special case, we don't read the next $size bytes, we
60
- // use the size to determine the length of the pointer and then follow
61
- // it.
62
- if ($type == 'pointer') {
63
- list($pointer, $offset) = $this->decodePointer($ctrlByte, $offset);
64
-
65
- // for unit testing
66
- if ($this->pointerTestHack) {
67
- return array($pointer);
68
- }
69
-
70
- list($result) = $this->decode($pointer);
71
-
72
- return array($result, $offset);
73
- }
74
-
75
- if ($type == 'extended') {
76
- list(, $nextByte) = unpack(
77
- 'C',
78
- Util::read($this->fileStream, $offset, 1)
79
- );
80
-
81
- $typeNum = $nextByte + 7;
82
-
83
- if ($typeNum < 8) {
84
- throw new InvalidDatabaseException(
85
- "Something went horribly wrong in the decoder. An extended type "
86
- . "resolved to a type number < 8 ("
87
- . $this->types[$typeNum]
88
- . ")"
89
- );
90
- }
91
-
92
- $type = $this->types[$typeNum];
93
- $offset++;
94
- }
95
-
96
- list($size, $offset) = $this->sizeFromCtrlByte($ctrlByte, $offset);
97
-
98
- return $this->decodeByType($type, $offset, $size);
99
- }
100
-
101
- private function decodeByType($type, $offset, $size)
102
- {
103
- switch ($type) {
104
- case 'map':
105
- return $this->decodeMap($size, $offset);
106
- case 'array':
107
- return $this->decodeArray($size, $offset);
108
- case 'boolean':
109
- return array($this->decodeBoolean($size), $offset);
110
- }
111
-
112
- $newOffset = $offset + $size;
113
- $bytes = Util::read($this->fileStream, $offset, $size);
114
- switch ($type) {
115
- case 'utf8_string':
116
- return array($this->decodeString($bytes), $newOffset);
117
- case 'double':
118
- $this->verifySize(8, $size);
119
- return array($this->decodeDouble($bytes), $newOffset);
120
- case 'float':
121
- $this->verifySize(4, $size);
122
- return array($this->decodeFloat($bytes), $newOffset);
123
- case 'bytes':
124
- return array($bytes, $newOffset);
125
- case 'uint16':
126
- case 'uint32':
127
- return array($this->decodeUint($bytes), $newOffset);
128
- case 'int32':
129
- return array($this->decodeInt32($bytes), $newOffset);
130
- case 'uint64':
131
- case 'uint128':
132
- return array($this->decodeBigUint($bytes, $size), $newOffset);
133
- default:
134
- throw new InvalidDatabaseException(
135
- "Unknown or unexpected type: " . $type
136
- );
137
- }
138
- }
139
-
140
- private function verifySize($expected, $actual)
141
- {
142
- if ($expected != $actual) {
143
- throw new InvalidDatabaseException(
144
- "The MaxMind DB file's data section contains bad data (unknown data type or corrupt data)"
145
- );
146
- }
147
- }
148
-
149
- private function decodeArray($size, $offset)
150
- {
151
- $array = array();
152
-
153
- for ($i = 0; $i < $size; $i++) {
154
- list($value, $offset) = $this->decode($offset);
155
- array_push($array, $value);
156
- }
157
-
158
- return array($array, $offset);
159
- }
160
-
161
- private function decodeBoolean($size)
162
- {
163
- return $size == 0 ? false : true;
164
- }
165
-
166
- private function decodeDouble($bits)
167
- {
168
- // XXX - Assumes IEEE 754 double on platform
169
- list(, $double) = unpack('d', $this->maybeSwitchByteOrder($bits));
170
- return $double;
171
- }
172
-
173
- private function decodeFloat($bits)
174
- {
175
- // XXX - Assumes IEEE 754 floats on platform
176
- list(, $float) = unpack('f', $this->maybeSwitchByteOrder($bits));
177
- return $float;
178
- }
179
-
180
- private function decodeInt32($bytes)
181
- {
182
- $bytes = $this->zeroPadLeft($bytes, 4);
183
- list(, $int) = unpack('l', $this->maybeSwitchByteOrder($bytes));
184
- return $int;
185
- }
186
-
187
- private function decodeMap($size, $offset)
188
- {
189
-
190
- $map = array();
191
-
192
- for ($i = 0; $i < $size; $i++) {
193
- list($key, $offset) = $this->decode($offset);
194
- list($value, $offset) = $this->decode($offset);
195
- $map[$key] = $value;
196
- }
197
-
198
- return array($map, $offset);
199
- }
200
-
201
- private $pointerValueOffset = array(
202
- 1 => 0,
203
- 2 => 2048,
204
- 3 => 526336,
205
- 4 => 0,
206
- );
207
-
208
- private function decodePointer($ctrlByte, $offset)
209
- {
210
- $pointerSize = (($ctrlByte >> 3) & 0x3) + 1;
211
-
212
- $buffer = Util::read($this->fileStream, $offset, $pointerSize);
213
- $offset = $offset + $pointerSize;
214
-
215
- $packed = $pointerSize == 4
216
- ? $buffer
217
- : (pack('C', $ctrlByte & 0x7)) . $buffer;
218
-
219
- $unpacked = $this->decodeUint($packed);
220
- $pointer = $unpacked + $this->pointerBase
221
- + $this->pointerValueOffset[$pointerSize];
222
-
223
- return array($pointer, $offset);
224
- }
225
-
226
- private function decodeUint($bytes)
227
- {
228
- list(, $int) = unpack('N', $this->zeroPadLeft($bytes, 4));
229
- return $int;
230
- }
231
-
232
- private function decodeBigUint($bytes, $byteLength)
233
- {
234
- $maxUintBytes = log(PHP_INT_MAX, 2) / 8;
235
-
236
- if ($byteLength == 0) {
237
- return 0;
238
- }
239
-
240
- $numberOfLongs = ceil($byteLength / 4);
241
- $paddedLength = $numberOfLongs * 4;
242
- $paddedBytes = $this->zeroPadLeft($bytes, $paddedLength);
243
- $unpacked = array_merge(unpack("N$numberOfLongs", $paddedBytes));
244
-
245
- $integer = 0;
246
-
247
- // 2^32
248
- $twoTo32 = '4294967296';
249
-
250
- foreach ($unpacked as $part) {
251
- // We only use gmp or bcmath if the final value is too big
252
- if ($byteLength <= $maxUintBytes) {
253
- $integer = ($integer << 32) + $part;
254
- } elseif (extension_loaded('gmp')) {
255
- $integer = gmp_strval(gmp_add(gmp_mul($integer, $twoTo32), $part));
256
- } elseif (extension_loaded('bcmath')) {
257
- $integer = bcadd(bcmul($integer, $twoTo32), $part);
258
- } else {
259
- throw new \RuntimeException(
260
- 'The gmp or bcmath extension must be installed to read this database.'
261
- );
262
- }
263
- }
264
- return $integer;
265
- }
266
-
267
- private function decodeString($bytes)
268
- {
269
- // XXX - NOOP. As far as I know, the end user has to explicitly set the
270
- // encoding in PHP. Strings are just bytes.
271
- return $bytes;
272
- }
273
-
274
- private function sizeFromCtrlByte($ctrlByte, $offset)
275
- {
276
- $size = $ctrlByte & 0x1f;
277
- $bytesToRead = $size < 29 ? 0 : $size - 28;
278
- $bytes = Util::read($this->fileStream, $offset, $bytesToRead);
279
- $decoded = $this->decodeUint($bytes);
280
-
281
- if ($size == 29) {
282
- $size = 29 + $decoded;
283
- } elseif ($size == 30) {
284
- $size = 285 + $decoded;
285
- } elseif ($size > 30) {
286
- $size = ($decoded & (0x0FFFFFFF >> (32 - (8 * $bytesToRead))))
287
- + 65821;
288
- }
289
-
290
- return array($size, $offset + $bytesToRead);
291
- }
292
-
293
- private function zeroPadLeft($content, $desiredLength)
294
- {
295
- return str_pad($content, $desiredLength, "\x00", STR_PAD_LEFT);
296
- }
297
-
298
- private function maybeSwitchByteOrder($bytes)
299
- {
300
- return $this->switchByteOrder ? strrev($bytes) : $bytes;
301
- }
302
-
303
- private function isPlatformLittleEndian()
304
- {
305
- $testint = 0x00FF;
306
- $packed = pack('S', $testint);
307
- return $testint === current(unpack('v', $packed));
308
- }
309
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Db\Reader;
4
+
5
+ use MaxMind\Db\Reader\InvalidDatabaseException;
6
+ use MaxMind\Db\Reader\Util;
7
+
8
+ class Decoder
9
+ {
10
+
11
+ private $fileStream;
12
+ private $pointerBase;
13
+ // This is only used for unit testing
14
+ private $pointerTestHack;
15
+ private $switchByteOrder;
16
+
17
+ private $types = array(
18
+ 0 => 'extended',
19
+ 1 => 'pointer',
20
+ 2 => 'utf8_string',
21
+ 3 => 'double',
22
+ 4 => 'bytes',
23
+ 5 => 'uint16',
24
+ 6 => 'uint32',
25
+ 7 => 'map',
26
+ 8 => 'int32',
27
+ 9 => 'uint64',
28
+ 10 => 'uint128',
29
+ 11 => 'array',
30
+ 12 => 'container',
31
+ 13 => 'end_marker',
32
+ 14 => 'boolean',
33
+ 15 => 'float',
34
+ );
35
+
36
+ public function __construct(
37
+ $fileStream,
38
+ $pointerBase = 0,
39
+ $pointerTestHack = false
40
+ ) {
41
+ $this->fileStream = $fileStream;
42
+ $this->pointerBase = $pointerBase;
43
+ $this->pointerTestHack = $pointerTestHack;
44
+
45
+ $this->switchByteOrder = $this->isPlatformLittleEndian();
46
+ }
47
+
48
+
49
+ public function decode($offset)
50
+ {
51
+ list(, $ctrlByte) = unpack(
52
+ 'C',
53
+ Util::read($this->fileStream, $offset, 1)
54
+ );
55
+ $offset++;
56
+
57
+ $type = $this->types[$ctrlByte >> 5];
58
+
59
+ // Pointers are a special case, we don't read the next $size bytes, we
60
+ // use the size to determine the length of the pointer and then follow
61
+ // it.
62
+ if ($type == 'pointer') {
63
+ list($pointer, $offset) = $this->decodePointer($ctrlByte, $offset);
64
+
65
+ // for unit testing
66
+ if ($this->pointerTestHack) {
67
+ return array($pointer);
68
+ }
69
+
70
+ list($result) = $this->decode($pointer);
71
+
72
+ return array($result, $offset);
73
+ }
74
+
75
+ if ($type == 'extended') {
76
+ list(, $nextByte) = unpack(
77
+ 'C',
78
+ Util::read($this->fileStream, $offset, 1)
79
+ );
80
+
81
+ $typeNum = $nextByte + 7;
82
+
83
+ if ($typeNum < 8) {
84
+ throw new InvalidDatabaseException(
85
+ "Something went horribly wrong in the decoder. An extended type "
86
+ . "resolved to a type number < 8 ("
87
+ . $this->types[$typeNum]
88
+ . ")"
89
+ );
90
+ }
91
+
92
+ $type = $this->types[$typeNum];
93
+ $offset++;
94
+ }
95
+
96
+ list($size, $offset) = $this->sizeFromCtrlByte($ctrlByte, $offset);
97
+
98
+ return $this->decodeByType($type, $offset, $size);
99
+ }
100
+
101
+ private function decodeByType($type, $offset, $size)
102
+ {
103
+ switch ($type) {
104
+ case 'map':
105
+ return $this->decodeMap($size, $offset);
106
+ case 'array':
107
+ return $this->decodeArray($size, $offset);
108
+ case 'boolean':
109
+ return array($this->decodeBoolean($size), $offset);
110
+ }
111
+
112
+ $newOffset = $offset + $size;
113
+ $bytes = Util::read($this->fileStream, $offset, $size);
114
+ switch ($type) {
115
+ case 'utf8_string':
116
+ return array($this->decodeString($bytes), $newOffset);
117
+ case 'double':
118
+ $this->verifySize(8, $size);
119
+ return array($this->decodeDouble($bytes), $newOffset);
120
+ case 'float':
121
+ $this->verifySize(4, $size);
122
+ return array($this->decodeFloat($bytes), $newOffset);
123
+ case 'bytes':
124
+ return array($bytes, $newOffset);
125
+ case 'uint16':
126
+ case 'uint32':
127
+ return array($this->decodeUint($bytes), $newOffset);
128
+ case 'int32':
129
+ return array($this->decodeInt32($bytes), $newOffset);
130
+ case 'uint64':
131
+ case 'uint128':
132
+ return array($this->decodeBigUint($bytes, $size), $newOffset);
133
+ default:
134
+ throw new InvalidDatabaseException(
135
+ "Unknown or unexpected type: " . $type
136
+ );
137
+ }
138
+ }
139
+
140
+ private function verifySize($expected, $actual)
141
+ {
142
+ if ($expected != $actual) {
143
+ throw new InvalidDatabaseException(
144
+ "The MaxMind DB file's data section contains bad data (unknown data type or corrupt data)"
145
+ );
146
+ }
147
+ }
148
+
149
+ private function decodeArray($size, $offset)
150
+ {
151
+ $array = array();
152
+
153
+ for ($i = 0; $i < $size; $i++) {
154
+ list($value, $offset) = $this->decode($offset);
155
+ array_push($array, $value);
156
+ }
157
+
158
+ return array($array, $offset);
159
+ }
160
+
161
+ private function decodeBoolean($size)
162
+ {
163
+ return $size == 0 ? false : true;
164
+ }
165
+
166
+ private function decodeDouble($bits)
167
+ {
168
+ // XXX - Assumes IEEE 754 double on platform
169
+ list(, $double) = unpack('d', $this->maybeSwitchByteOrder($bits));
170
+ return $double;
171
+ }
172
+
173
+ private function decodeFloat($bits)
174
+ {
175
+ // XXX - Assumes IEEE 754 floats on platform
176
+ list(, $float) = unpack('f', $this->maybeSwitchByteOrder($bits));
177
+ return $float;
178
+ }
179
+
180
+ private function decodeInt32($bytes)
181
+ {
182
+ $bytes = $this->zeroPadLeft($bytes, 4);
183
+ list(, $int) = unpack('l', $this->maybeSwitchByteOrder($bytes));
184
+ return $int;
185
+ }
186
+
187
+ private function decodeMap($size, $offset)
188
+ {
189
+
190
+ $map = array();
191
+
192
+ for ($i = 0; $i < $size; $i++) {
193
+ list($key, $offset) = $this->decode($offset);
194
+ list($value, $offset) = $this->decode($offset);
195
+ $map[$key] = $value;
196
+ }
197
+
198
+ return array($map, $offset);
199
+ }
200
+
201
+ private $pointerValueOffset = array(
202
+ 1 => 0,
203
+ 2 => 2048,
204
+ 3 => 526336,
205
+ 4 => 0,
206
+ );
207
+
208
+ private function decodePointer($ctrlByte, $offset)
209
+ {
210
+ $pointerSize = (($ctrlByte >> 3) & 0x3) + 1;
211
+
212
+ $buffer = Util::read($this->fileStream, $offset, $pointerSize);
213
+ $offset = $offset + $pointerSize;
214
+
215
+ $packed = $pointerSize == 4
216
+ ? $buffer
217
+ : (pack('C', $ctrlByte & 0x7)) . $buffer;
218
+
219
+ $unpacked = $this->decodeUint($packed);
220
+ $pointer = $unpacked + $this->pointerBase
221
+ + $this->pointerValueOffset[$pointerSize];
222
+
223
+ return array($pointer, $offset);
224
+ }
225
+
226
+ private function decodeUint($bytes)
227
+ {
228
+ list(, $int) = unpack('N', $this->zeroPadLeft($bytes, 4));
229
+ return $int;
230
+ }
231
+
232
+ private function decodeBigUint($bytes, $byteLength)
233
+ {
234
+ $maxUintBytes = log(PHP_INT_MAX, 2) / 8;
235
+
236
+ if ($byteLength == 0) {
237
+ return 0;
238
+ }
239
+
240
+ $numberOfLongs = ceil($byteLength / 4);
241
+ $paddedLength = $numberOfLongs * 4;
242
+ $paddedBytes = $this->zeroPadLeft($bytes, $paddedLength);
243
+ $unpacked = array_merge(unpack("N$numberOfLongs", $paddedBytes));
244
+
245
+ $integer = 0;
246
+
247
+ // 2^32
248
+ $twoTo32 = '4294967296';
249
+
250
+ foreach ($unpacked as $part) {
251
+ // We only use gmp or bcmath if the final value is too big
252
+ if ($byteLength <= $maxUintBytes) {
253
+ $integer = ($integer << 32) + $part;
254
+ } elseif (extension_loaded('gmp')) {
255
+ $integer = gmp_strval(gmp_add(gmp_mul($integer, $twoTo32), $part));
256
+ } elseif (extension_loaded('bcmath')) {
257
+ $integer = bcadd(bcmul($integer, $twoTo32), $part);
258
+ } else {
259
+ throw new \RuntimeException(
260
+ 'The gmp or bcmath extension must be installed to read this database.'
261
+ );
262
+ }
263
+ }
264
+ return $integer;
265
+ }
266
+
267
+ private function decodeString($bytes)
268
+ {
269
+ // XXX - NOOP. As far as I know, the end user has to explicitly set the
270
+ // encoding in PHP. Strings are just bytes.
271
+ return $bytes;
272
+ }
273
+
274
+ private function sizeFromCtrlByte($ctrlByte, $offset)
275
+ {
276
+ $size = $ctrlByte & 0x1f;
277
+ $bytesToRead = $size < 29 ? 0 : $size - 28;
278
+ $bytes = Util::read($this->fileStream, $offset, $bytesToRead);
279
+ $decoded = $this->decodeUint($bytes);
280
+
281
+ if ($size == 29) {
282
+ $size = 29 + $decoded;
283
+ } elseif ($size == 30) {
284
+ $size = 285 + $decoded;
285
+ } elseif ($size > 30) {
286
+ $size = ($decoded & (0x0FFFFFFF >> (32 - (8 * $bytesToRead))))
287
+ + 65821;
288
+ }
289
+
290
+ return array($size, $offset + $bytesToRead);
291
+ }
292
+
293
+ private function zeroPadLeft($content, $desiredLength)
294
+ {
295
+ return str_pad($content, $desiredLength, "\x00", STR_PAD_LEFT);
296
+ }
297
+
298
+ private function maybeSwitchByteOrder($bytes)
299
+ {
300
+ return $this->switchByteOrder ? strrev($bytes) : $bytes;
301
+ }
302
+
303
+ private function isPlatformLittleEndian()
304
+ {
305
+ $testint = 0x00FF;
306
+ $packed = pack('S', $testint);
307
+ return $testint === current(unpack('v', $packed));
308
+ }
309
+ }
vendor/maxmind-db/reader/src/MaxMind/Db/Reader/InvalidDatabaseException.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace MaxMind\Db\Reader;
4
-
5
- /**
6
- * This class should be thrown when unexpected data is found in the database.
7
- */
8
- class InvalidDatabaseException extends \Exception
9
- {
10
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Db\Reader;
4
+
5
+ /**
6
+ * This class should be thrown when unexpected data is found in the database.
7
+ */
8
+ class InvalidDatabaseException extends \Exception
9
+ {
10
+ }
vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Metadata.php CHANGED
@@ -1,77 +1,77 @@
1
- <?php
2
-
3
- namespace MaxMind\Db\Reader;
4
-
5
- /**
6
- * This class provides the metadata for the MaxMind DB file.
7
- *
8
- * @property integer nodeCount This is an unsigned 32-bit integer indicating
9
- * the number of nodes in the search tree.
10
- *
11
- * @property integer recordSize This is an unsigned 16-bit integer. It
12
- * indicates the number of bits in a record in the search tree. Note that each
13
- * node consists of two records.
14
- *
15
- * @property integer ipVersion This is an unsigned 16-bit integer which is
16
- * always 4 or 6. It indicates whether the database contains IPv4 or IPv6
17
- * address data.
18
- *
19
- * @property string databaseType This is a string that indicates the structure
20
- * of each data record associated with an IP address. The actual definition of
21
- * these structures is left up to the database creator.
22
- *
23
- * @property array languages An array of strings, each of which is a language
24
- * code. A given record may contain data items that have been localized to
25
- * some or all of these languages. This may be undefined.
26
- *
27
- * @property integer binaryFormatMajorVersion This is an unsigned 16-bit
28
- * integer indicating the major version number for the database's binary
29
- * format.
30
- *
31
- * @property integer binaryFormatMinorVersion This is an unsigned 16-bit
32
- * integer indicating the minor version number for the database's binary format.
33
- *
34
- * @property integer buildEpoch This is an unsigned 64-bit integer that
35
- * contains the database build timestamp as a Unix epoch value.
36
- *
37
- * @property array description This key will always point to a map
38
- * (associative array). The keys of that map will be language codes, and the
39
- * values will be a description in that language as a UTF-8 string. May be
40
- * undefined for some databases.
41
- */
42
- class Metadata
43
- {
44
- private $binaryFormatMajorVersion;
45
- private $binaryFormatMinorVersion;
46
- private $buildEpoch;
47
- private $databaseType;
48
- private $description;
49
- private $ipVersion;
50
- private $languages;
51
- private $nodeByteSize;
52
- private $nodeCount;
53
- private $recordSize;
54
- private $searchTreeSize;
55
-
56
- public function __construct($metadata)
57
- {
58
- $this->binaryFormatMajorVersion =
59
- $metadata['binary_format_major_version'];
60
- $this->binaryFormatMinorVersion =
61
- $metadata['binary_format_minor_version'];
62
- $this->buildEpoch = $metadata['build_epoch'];
63
- $this->databaseType = $metadata['database_type'];
64
- $this->languages = $metadata['languages'];
65
- $this->description = $metadata['description'];
66
- $this->ipVersion = $metadata['ip_version'];
67
- $this->nodeCount = $metadata['node_count'];
68
- $this->recordSize = $metadata['record_size'];
69
- $this->nodeByteSize = $this->recordSize / 4;
70
- $this->searchTreeSize = $this->nodeCount * $this->nodeByteSize;
71
- }
72
-
73
- public function __get($var)
74
- {
75
- return $this->$var;
76
- }
77
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Db\Reader;
4
+
5
+ /**
6
+ * This class provides the metadata for the MaxMind DB file.
7
+ *
8
+ * @property integer nodeCount This is an unsigned 32-bit integer indicating
9
+ * the number of nodes in the search tree.
10
+ *
11
+ * @property integer recordSize This is an unsigned 16-bit integer. It
12
+ * indicates the number of bits in a record in the search tree. Note that each
13
+ * node consists of two records.
14
+ *
15
+ * @property integer ipVersion This is an unsigned 16-bit integer which is
16
+ * always 4 or 6. It indicates whether the database contains IPv4 or IPv6
17
+ * address data.
18
+ *
19
+ * @property string databaseType This is a string that indicates the structure
20
+ * of each data record associated with an IP address. The actual definition of
21
+ * these structures is left up to the database creator.
22
+ *
23
+ * @property array languages An array of strings, each of which is a language
24
+ * code. A given record may contain data items that have been localized to
25
+ * some or all of these languages. This may be undefined.
26
+ *
27
+ * @property integer binaryFormatMajorVersion This is an unsigned 16-bit
28
+ * integer indicating the major version number for the database's binary
29
+ * format.
30
+ *
31
+ * @property integer binaryFormatMinorVersion This is an unsigned 16-bit
32
+ * integer indicating the minor version number for the database's binary format.
33
+ *
34
+ * @property integer buildEpoch This is an unsigned 64-bit integer that
35
+ * contains the database build timestamp as a Unix epoch value.
36
+ *
37
+ * @property array description This key will always point to a map
38
+ * (associative array). The keys of that map will be language codes, and the
39
+ * values will be a description in that language as a UTF-8 string. May be
40
+ * undefined for some databases.
41
+ */
42
+ class Metadata
43
+ {
44
+ private $binaryFormatMajorVersion;
45
+ private $binaryFormatMinorVersion;
46
+ private $buildEpoch;
47
+ private $databaseType;
48
+ private $description;
49
+ private $ipVersion;
50
+ private $languages;
51
+ private $nodeByteSize;
52
+ private $nodeCount;
53
+ private $recordSize;
54
+ private $searchTreeSize;
55
+
56
+ public function __construct($metadata)
57
+ {
58
+ $this->binaryFormatMajorVersion =
59
+ $metadata['binary_format_major_version'];
60
+ $this->binaryFormatMinorVersion =
61
+ $metadata['binary_format_minor_version'];
62
+ $this->buildEpoch = $metadata['build_epoch'];
63
+ $this->databaseType = $metadata['database_type'];
64
+ $this->languages = $metadata['languages'];
65
+ $this->description = $metadata['description'];
66
+ $this->ipVersion = $metadata['ip_version'];
67
+ $this->nodeCount = $metadata['node_count'];
68
+ $this->recordSize = $metadata['record_size'];
69
+ $this->nodeByteSize = $this->recordSize / 4;
70
+ $this->searchTreeSize = $this->nodeCount * $this->nodeByteSize;
71
+ }
72
+
73
+ public function __get($var)
74
+ {
75
+ return $this->$var;
76
+ }
77
+ }
vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Util.php CHANGED
@@ -1,28 +1,28 @@
1
- <?php
2
-
3
- namespace MaxMind\Db\Reader;
4
-
5
- use MaxMind\Db\Reader\InvalidDatabaseException;
6
-
7
- class Util
8
- {
9
- public static function read($stream, $offset, $numberOfBytes)
10
- {
11
- if ($numberOfBytes == 0) {
12
- return '';
13
- }
14
- if (fseek($stream, $offset) == 0) {
15
- $value = fread($stream, $numberOfBytes);
16
-
17
- // We check that the number of bytes read is equal to the number
18
- // asked for. We use ftell as getting the length of $value is
19
- // much slower.
20
- if (ftell($stream) - $offset === $numberOfBytes) {
21
- return $value;
22
- }
23
- }
24
- throw new InvalidDatabaseException(
25
- "The MaxMind DB file contains bad data"
26
- );
27
- }
28
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Db\Reader;
4
+
5
+ use MaxMind\Db\Reader\InvalidDatabaseException;
6
+
7
+ class Util
8
+ {
9
+ public static function read($stream, $offset, $numberOfBytes)
10
+ {
11
+ if ($numberOfBytes == 0) {
12
+ return '';
13
+ }
14
+ if (fseek($stream, $offset) == 0) {
15
+ $value = fread($stream, $numberOfBytes);
16
+
17
+ // We check that the number of bytes read is equal to the number
18
+ // asked for. We use ftell as getting the length of $value is
19
+ // much slower.
20
+ if (ftell($stream) - $offset === $numberOfBytes) {
21
+ return $value;
22
+ }
23
+ }
24
+ throw new InvalidDatabaseException(
25
+ "The MaxMind DB file contains bad data"
26
+ );
27
+ }
28
+ }
vendor/maxmind/web-service-common/CHANGELOG.md CHANGED
@@ -1,74 +1,74 @@
1
- CHANGELOG
2
- =========
3
-
4
- 0.4.0 (2017-XX-XX)
5
- ------------------
6
-
7
- * PHP 5.4 is now required.
8
-
9
- 0.3.1 (2016-08-10)
10
- ------------------
11
-
12
- * On Mac OS X when using a curl built against SecureTransport, the certs
13
- in the system's keychain will now be used instead of the CA bundle on
14
- the file system.
15
-
16
- 0.3.0 (2016-08-09)
17
- ------------------
18
-
19
- * This package now uses `composer/ca-bundle` by default rather than a CA
20
- bundle distributed with this package. `composer/ca-bundle` will first try
21
- to use the system CA bundle and will fall back to the Mozilla CA bundle
22
- when no system bundle is available. You may still specify your own bundle
23
- using the `caBundle` option.
24
-
25
- 0.2.1 (2016-06-13)
26
- ------------------
27
-
28
- * Fix typo in code to copy cert to temp directory.
29
-
30
- 0.2.0 (2016-06-10)
31
- ------------------
32
-
33
- * Added handling of additional error codes that the web service may return.
34
- * A `USER_ID_UNKNOWN` error will now throw a
35
- `MaxMind\Exception\AuthenticationException`.
36
- * Added support for `proxy` option. Closes #6.
37
-
38
- 0.1.0 (2016-05-23)
39
- ------------------
40
-
41
- * A `PERMISSION_REQUIRED` error will now throw a `PermissionRequiredException`
42
- exception.
43
- * Added a `.gitattributes` file to exclude tests from Composer releases.
44
- GitHub #7.
45
- * Updated included cert bundle.
46
-
47
- 0.0.4 (2015-07-21)
48
- ------------------
49
-
50
- * Added extremely basic tests for the curl calls.
51
- * Fixed broken POSTs.
52
-
53
- 0.0.3 (2015-06-30)
54
- ------------------
55
-
56
- * Floats now work with the `timeout` and `connectTimeout` options. Fix by
57
- Benjamin Pick. GitHub PR #2.
58
- * `curl_error` is now used instead of `curl_strerror`. The latter is only
59
- available for PHP 5.5 or later. Fix by Benjamin Pick. GitHub PR #1.
60
-
61
-
62
- 0.0.2 (2015-06-09)
63
- ------------------
64
-
65
- * An exception is now immediately thrown curl error rather than letting later
66
- status code checks throw an exception. This improves the exception message
67
- greatly.
68
- * If this library is inside a phar archive, the CA certs are copied out of the
69
- archive to a temporary file so that curl can use them.
70
-
71
- 0.0.1 (2015-06-01)
72
- ------------------
73
-
74
- * Initial release.
1
+ CHANGELOG
2
+ =========
3
+
4
+ 0.4.0 (2017-XX-XX)
5
+ ------------------
6
+
7
+ * PHP 5.4 is now required.
8
+
9
+ 0.3.1 (2016-08-10)
10
+ ------------------
11
+
12
+ * On Mac OS X when using a curl built against SecureTransport, the certs
13
+ in the system's keychain will now be used instead of the CA bundle on
14
+ the file system.
15
+
16
+ 0.3.0 (2016-08-09)
17
+ ------------------
18
+
19
+ * This package now uses `composer/ca-bundle` by default rather than a CA
20
+ bundle distributed with this package. `composer/ca-bundle` will first try
21
+ to use the system CA bundle and will fall back to the Mozilla CA bundle
22
+ when no system bundle is available. You may still specify your own bundle
23
+ using the `caBundle` option.
24
+
25
+ 0.2.1 (2016-06-13)
26
+ ------------------
27
+
28
+ * Fix typo in code to copy cert to temp directory.
29
+
30
+ 0.2.0 (2016-06-10)
31
+ ------------------
32
+
33
+ * Added handling of additional error codes that the web service may return.
34
+ * A `USER_ID_UNKNOWN` error will now throw a
35
+ `MaxMind\Exception\AuthenticationException`.
36
+ * Added support for `proxy` option. Closes #6.
37
+
38
+ 0.1.0 (2016-05-23)
39
+ ------------------
40
+
41
+ * A `PERMISSION_REQUIRED` error will now throw a `PermissionRequiredException`
42
+ exception.
43
+ * Added a `.gitattributes` file to exclude tests from Composer releases.
44
+ GitHub #7.
45
+ * Updated included cert bundle.
46
+
47
+ 0.0.4 (2015-07-21)
48
+ ------------------
49
+
50
+ * Added extremely basic tests for the curl calls.
51
+ * Fixed broken POSTs.
52
+
53
+ 0.0.3 (2015-06-30)
54
+ ------------------
55
+
56
+ * Floats now work with the `timeout` and `connectTimeout` options. Fix by
57
+ Benjamin Pick. GitHub PR #2.
58
+ * `curl_error` is now used instead of `curl_strerror`. The latter is only
59
+ available for PHP 5.5 or later. Fix by Benjamin Pick. GitHub PR #1.
60
+
61
+
62
+ 0.0.2 (2015-06-09)
63
+ ------------------
64
+
65
+ * An exception is now immediately thrown curl error rather than letting later
66
+ status code checks throw an exception. This improves the exception message
67
+ greatly.
68
+ * If this library is inside a phar archive, the CA certs are copied out of the
69
+ archive to a temporary file so that curl can use them.
70
+
71
+ 0.0.1 (2015-06-01)
72
+ ------------------
73
+
74
+ * Initial release.
vendor/maxmind/web-service-common/LICENSE CHANGED
@@ -1,202 +1,202 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
vendor/maxmind/web-service-common/README.md CHANGED
@@ -1,26 +1,26 @@
1
- # MaxMind Web Service Common #
2
-
3
- This is _not_ intended for direct use by third parties. Rather, it is for
4
- shared code between MaxMind's various web service APIs.
5
-
6
- ## Requirements ##
7
-
8
- The library requires PHP 5.4 or greater. This library works and is tested
9
- with HHVM.
10
-
11
- There are several other dependencies as defined in the `composer.json` file.
12
-
13
- ## Contributing ##
14
-
15
- Patches and pull requests are encouraged. All code should follow the PSR-2
16
- style guidelines. Please include unit tests whenever possible.
17
-
18
- ## Versioning ##
19
-
20
- This API uses [Semantic Versioning](http://semver.org/).
21
-
22
- ## Copyright and License ##
23
-
24
- This software is Copyright (c) 2015-2017 by MaxMind, Inc.
25
-
26
- This is free software, licensed under the Apache License, Version 2.0.
1
+ # MaxMind Web Service Common #
2
+
3
+ This is _not_ intended for direct use by third parties. Rather, it is for
4
+ shared code between MaxMind's various web service APIs.
5
+
6
+ ## Requirements ##
7
+
8
+ The library requires PHP 5.4 or greater. This library works and is tested
9
+ with HHVM.
10
+
11
+ There are several other dependencies as defined in the `composer.json` file.
12
+
13
+ ## Contributing ##
14
+
15
+ Patches and pull requests are encouraged. All code should follow the PSR-2
16
+ style guidelines. Please include unit tests whenever possible.
17
+
18
+ ## Versioning ##
19
+
20
+ This API uses [Semantic Versioning](http://semver.org/).
21
+
22
+ ## Copyright and License ##
23
+
24
+ This software is Copyright (c) 2015-2017 by MaxMind, Inc.
25
+
26
+ This is free software, licensed under the Apache License, Version 2.0.
vendor/maxmind/web-service-common/composer.json CHANGED
@@ -1,31 +1,31 @@
1
- {
2
- "name": "maxmind/web-service-common",
3
- "description": "Internal MaxMind Web Service API",
4
- "minimum-stability": "stable",
5
- "homepage": "https://github.com/maxmind/web-service-common-php",
6
- "type": "library",
7
- "license": "Apache-2.0",
8
- "authors": [
9
- {
10
- "name": "Gregory Oschwald",
11
- "email": "goschwald@maxmind.com"
12
- }
13
- ],
14
- "require": {
15
- "php": ">=5.4",
16
- "composer/ca-bundle": "^1.0.3",
17
- "ext-curl": "*",
18
- "ext-json": "*"
19
- },
20
- "require-dev": {
21
- "friendsofphp/php-cs-fixer": "2.*",
22
- "phpunit/phpunit": "4.*",
23
- "squizlabs/php_codesniffer": "3.*"
24
- },
25
- "autoload": {
26
- "psr-4": {
27
- "MaxMind\\Exception\\": "src/Exception",
28
- "MaxMind\\WebService\\": "src/WebService"
29
- }
30
- }
31
- }
1
+ {
2
+ "name": "maxmind/web-service-common",
3
+ "description": "Internal MaxMind Web Service API",
4
+ "minimum-stability": "stable",
5
+ "homepage": "https://github.com/maxmind/web-service-common-php",
6
+ "type": "library",
7
+ "license": "Apache-2.0",
8
+ "authors": [
9
+ {
10
+ "name": "Gregory Oschwald",
11
+ "email": "goschwald@maxmind.com"
12
+ }
13
+ ],
14
+ "require": {
15
+ "php": ">=5.4",
16
+ "composer/ca-bundle": "^1.0.3",
17
+ "ext-curl": "*",
18
+ "ext-json": "*"
19
+ },
20
+ "require-dev": {
21
+ "friendsofphp/php-cs-fixer": "2.*",
22
+ "phpunit/phpunit": "4.*",
23
+ "squizlabs/php_codesniffer": "3.*"
24
+ },
25
+ "autoload": {
26
+ "psr-4": {
27
+ "MaxMind\\Exception\\": "src/Exception",
28
+ "MaxMind\\WebService\\": "src/WebService"
29
+ }
30
+ }
31
+ }
vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace MaxMind\Exception;
4
-
5
- /**
6
- * This class represents an error authenticating.
7
- */
8
- class AuthenticationException extends InvalidRequestException
9
- {
10
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Exception;
4
+
5
+ /**
6
+ * This class represents an error authenticating.
7
+ */
8
+ class AuthenticationException extends InvalidRequestException
9
+ {
10
+ }
vendor/maxmind/web-service-common/src/Exception/HttpException.php CHANGED
@@ -1,40 +1,40 @@
1
- <?php
2
-
3
- namespace MaxMind\Exception;
4
-
5
- /**
6
- * This class represents an HTTP transport error.
7
- */
8
- class HttpException extends WebServiceException
9
- {
10
- /**
11
- * The URI queried.
12
- */
13
- private $uri;
14
-
15
- /**
16
- * @param string $message a message describing the error
17
- * @param int $httpStatus the HTTP status code of the response
18
- * @param string $uri the URI used in the request
19
- * @param \Exception $previous the previous exception, if any
20
- */
21
- public function __construct(
22
- $message,
23
- $httpStatus,
24
- $uri,
25
- \Exception $previous = null
26
- ) {
27
- $this->uri = $uri;
28
- parent::__construct($message, $httpStatus, $previous);
29
- }
30
-
31
- public function getUri()
32
- {
33
- return $this->uri;
34
- }
35
-
36
- public function getStatusCode()
37
- {
38
- return $this->getCode();
39
- }
40
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Exception;
4
+
5
+ /**
6
+ * This class represents an HTTP transport error.
7
+ */
8
+ class HttpException extends WebServiceException
9
+ {
10
+ /**
11
+ * The URI queried.
12
+ */
13
+ private $uri;
14
+
15
+ /**
16
+ * @param string $message a message describing the error
17
+ * @param int $httpStatus the HTTP status code of the response
18
+ * @param string $uri the URI used in the request
19
+ * @param \Exception $previous the previous exception, if any
20
+ */
21
+ public function __construct(
22
+ $message,
23
+ $httpStatus,
24
+ $uri,
25
+ \Exception $previous = null
26
+ ) {
27
+ $this->uri = $uri;
28
+ parent::__construct($message, $httpStatus, $previous);
29
+ }
30
+
31
+ public function getUri()
32
+ {
33
+ return $this->uri;
34
+ }
35
+
36
+ public function getStatusCode()
37
+ {
38
+ return $this->getCode();
39
+ }
40
+ }
vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace MaxMind\Exception;
4
-
5
- /**
6
- * Thrown when the account is out of credits.
7
- */
8
- class InsufficientFundsException extends InvalidRequestException
9
- {
10
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Exception;
4
+
5
+ /**
6
+ * Thrown when the account is out of credits.
7
+ */
8
+ class InsufficientFundsException extends InvalidRequestException
9
+ {
10
+ }
vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php CHANGED
@@ -1,12 +1,12 @@
1
- <?php
2
-
3
- namespace MaxMind\Exception;
4
-
5
- /**
6
- * This class represents an error in creating the request to be sent to the
7
- * web service. For example, if the array cannot be encoded as JSON or if there
8
- * is a missing or invalid field.
9
- */
10
- class InvalidInputException extends WebServiceException
11
- {
12
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Exception;
4
+
5
+ /**
6
+ * This class represents an error in creating the request to be sent to the
7
+ * web service. For example, if the array cannot be encoded as JSON or if there
8
+ * is a missing or invalid field.
9
+ */
10
+ class InvalidInputException extends WebServiceException
11
+ {
12
+ }
vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php
2
-
3
- namespace MaxMind\Exception;
4
-
5
- /**
6
- * Thrown when a MaxMind web service returns an error relating to the request.
7
- */
8
- class InvalidRequestException extends HttpException
9
- {
10
- /**
11
- * The code returned by the MaxMind web service.
12
- */
13
- private $error;
14
-
15
- /**
16
- * @param string $message the exception message
17
- * @param int $error the error code returned by the MaxMind web service
18
- * @param int $httpStatus the HTTP status code of the response
19
- * @param string $uri the URI queries
20
- * @param \Exception $previous the previous exception, if any
21
- */
22
- public function __construct(
23
- $message,
24
- $error,
25
- $httpStatus,
26
- $uri,
27
- \Exception $previous = null
28
- ) {
29
- $this->error = $error;
30
- parent::__construct($message, $httpStatus, $uri, $previous);
31
- }
32
-
33
- public function getErrorCode()
34
- {
35
- return $this->error;
36
- }
37
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Exception;
4
+
5
+ /**
6
+ * Thrown when a MaxMind web service returns an error relating to the request.
7
+ */
8
+ class InvalidRequestException extends HttpException
9
+ {
10
+ /**
11
+ * The code returned by the MaxMind web service.
12
+ */
13
+ private $error;
14
+
15
+ /**
16
+ * @param string $message the exception message
17
+ * @param int $error the error code returned by the MaxMind web service
18
+ * @param int $httpStatus the HTTP status code of the response
19
+ * @param string $uri the URI queries
20
+ * @param \Exception $previous the previous exception, if any
21
+ */
22
+ public function __construct(
23
+ $message,
24
+ $error,
25
+ $httpStatus,
26
+ $uri,
27
+ \Exception $previous = null
28
+ ) {
29
+ $this->error = $error;
30
+ parent::__construct($message, $httpStatus, $uri, $previous);
31
+ }
32
+
33
+ public function getErrorCode()
34
+ {
35
+ return $this->error;
36
+ }
37
+ }
vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
-
3
- namespace MaxMind\Exception;
4
-
5
- class IpAddressNotFoundException extends InvalidRequestException
6
- {
7
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Exception;
4
+
5
+ class IpAddressNotFoundException extends InvalidRequestException
6
+ {
7
+ }
vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace MaxMind\Exception;
4
-
5
- /**
6
- * This exception is thrown when the service requires permission to access.
7
- */
8
- class PermissionRequiredException extends InvalidRequestException
9
- {
10
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Exception;
4
+
5
+ /**
6
+ * This exception is thrown when the service requires permission to access.
7
+ */
8
+ class PermissionRequiredException extends InvalidRequestException
9
+ {
10
+ }
vendor/maxmind/web-service-common/src/Exception/WebServiceException.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace MaxMind\Exception;
4
-
5
- /**
6
- * This class represents a generic web service error.
7
- */
8
- class WebServiceException extends \Exception
9
- {
10
- }
1
+ <?php
2
+
3
+ namespace MaxMind\Exception;
4
+
5
+ /**
6
+ * This class represents a generic web service error.
7
+ */
8
+ class WebServiceException extends \Exception
9
+ {
10
+ }
vendor/maxmind/web-service-common/src/WebService/Client.php CHANGED
@@ -1,470 +1,470 @@
1
- <?php
2
-
3
- namespace MaxMind\WebService;
4
-
5
- use Composer\CaBundle\CaBundle;
6
- use MaxMind\Exception\AuthenticationException;
7
- use MaxMind\Exception\HttpException;
8
- use MaxMind\Exception\InsufficientFundsException;
9
- use MaxMind\Exception\InvalidInputException;
10
- use MaxMind\Exception\InvalidRequestException;
11
- use MaxMind\Exception\IpAddressNotFoundException;
12
- use MaxMind\Exception\PermissionRequiredException;
13
- use MaxMind\Exception\WebServiceException;
14
- use MaxMind\WebService\Http\RequestFactory;
15
-
16
- /**
17
- * This class is not intended to be used directly by an end-user of a
18
- * MaxMind web service. Please use the appropriate client API for the service
19
- * that you are using.
20
- *
21
- * @internal
22
- */
23
- class Client
24
- {
25
- const VERSION = '0.2.0';
26
-
27
- private $caBundle;
28
- private $connectTimeout;
29
- private $host = 'api.maxmind.com';
30
- private $httpRequestFactory;
31
- private $licenseKey;
32
- private $proxy;
33
- private $timeout;
34
- private $userAgentPrefix;
35
- private $userId;
36
-
37
- /**
38
- * @param int $userId your MaxMind user ID
39
- * @param string $licenseKey your MaxMind license key
40
- * @param array $options an array of options. Possible keys:
41
- * * `host` - The host to use when connecting to the web service.
42
- * * `userAgent` - The prefix of the User-Agent to use in the request.
43
- * * `caBundle` - The bundle of CA root certificates to use in the request.
44
- * * `connectTimeout` - The connect timeout to use for the request.
45
- * * `timeout` - The timeout to use for the request.
46
- * * `proxy` - The HTTP proxy to use. May include a schema, port,
47
- * username, and password, e.g., `http://username:password@127.0.0.1:10`.
48
- */
49
- public function __construct(
50
- $userId,
51
- $licenseKey,
52
- $options = []
53
- ) {
54
- $this->userId = $userId;
55
- $this->licenseKey = $licenseKey;
56
-
57
- $this->httpRequestFactory = isset($options['httpRequestFactory'])
58
- ? $options['httpRequestFactory']
59
- : new RequestFactory();
60
-
61
- if (isset($options['host'])) {
62
- $this->host = $options['host'];
63
- }
64
- if (isset($options['userAgent'])) {
65
- $this->userAgentPrefix = $options['userAgent'] . ' ';
66
- }
67
-
68
- $this->caBundle = isset($options['caBundle']) ?
69
- $this->caBundle = $options['caBundle'] : $this->getCaBundle();
70
-
71
- if (isset($options['connectTimeout'])) {
72
- $this->connectTimeout = $options['connectTimeout'];
73
- }
74
- if (isset($options['timeout'])) {
75
- $this->timeout = $options['timeout'];
76
- }
77
-
78
- if (isset($options['proxy'])) {
79
- $this->proxy = $options['proxy'];
80
- }
81
- }
82
-
83
- /**
84
- * @param string $service name of the service querying
85
- * @param string $path the URI path to use
86
- * @param array $input the data to be posted as JSON
87
- *
88
- * @throws InvalidInputException when the request has missing or invalid
89
- * data
90
- * @throws AuthenticationException when there is an issue authenticating the
91
- * request
92
- * @throws InsufficientFundsException when your account is out of funds
93
- * @throws InvalidRequestException when the request is invalid for some
94
- * other reason, e.g., invalid JSON in the POST.
95
- * @throws HttpException when an unexpected HTTP error occurs
96
- * @throws WebServiceException when some other error occurs. This also
97
- * serves as the base class for the above exceptions.
98
- *
99
- * @return array The decoded content of a successful response
100
- */
101
- public function post($service, $path, $input)
102
- {
103
- $body = json_encode($input);
104
- if ($body === false) {
105
- throw new InvalidInputException(
106
- 'Error encoding input as JSON: '
107
- . $this->jsonErrorDescription()
108
- );
109
- }
110
-
111
- $request = $this->createRequest(
112
- $path,
113
- ['Content-Type: application/json']
114
- );
115
-
116
- list($statusCode, $contentType, $body) = $request->post($body);
117
-
118
- return $this->handleResponse(
119
- $statusCode,
120
- $contentType,
121
- $body,
122
- $service,
123
- $path
124
- );
125
- }
126
-
127
- public function get($service, $path)
128
- {
129
- $request = $this->createRequest($path);
130
-
131
- list($statusCode, $contentType, $body) = $request->get();
132
-
133
- return $this->handleResponse(
134
- $statusCode,
135
- $contentType,
136
- $body,
137
- $service,
138
- $path
139
- );
140
- }
141
-
142
- private function userAgent()
143
- {
144
- $curlVersion = curl_version();
145
-
146
- return $this->userAgentPrefix . 'MaxMind-WS-API/' . self::VERSION . ' PHP/' . PHP_VERSION .
147
- ' curl/' . $curlVersion['version'];
148
- }
149
-
150
- private function createRequest($path, $headers = [])
151
- {
152
- array_push(
153
- $headers,
154
- 'Authorization: Basic '
155
- . base64_encode($this->userId . ':' . $this->licenseKey),
156
- 'Accept: application/json'
157
- );
158
-
159
- return $this->httpRequestFactory->request(
160
- $this->urlFor($path),
161
- [
162
- 'caBundle' => $this->caBundle,
163
- 'connectTimeout' => $this->connectTimeout,
164
- 'headers' => $headers,
165
- 'proxy' => $this->proxy,
166
- 'timeout' => $this->timeout,
167
- 'userAgent' => $this->userAgent(),
168
- ]
169
- );
170
- }
171
-
172
- /**
173
- * @param int $statusCode the HTTP status code of the response
174
- * @param string $contentType the Content-Type of the response
175
- * @param string $body the response body
176
- * @param string $service the name of the service
177
- * @param string $path the path used in the request
178
- *
179
- * @throws AuthenticationException when there is an issue authenticating the
180
- * request
181
- * @throws InsufficientFundsException when your account is out of funds
182
- * @throws InvalidRequestException when the request is invalid for some
183
- * other reason, e.g., invalid JSON in the POST.
184
- * @throws HttpException when an unexpected HTTP error occurs
185
- * @throws WebServiceException when some other error occurs. This also
186
- * serves as the base class for the above exceptions
187
- *
188
- * @return array The decoded content of a successful response
189
- */
190
- private function handleResponse(
191
- $statusCode,
192
- $contentType,
193
- $body,
194
- $service,
195
- $path
196
- ) {
197
- if ($statusCode >= 400 && $statusCode <= 499) {
198
- $this->handle4xx($statusCode, $contentType, $body, $service, $path);
199
- } elseif ($statusCode >= 500) {
200
- $this->handle5xx($statusCode, $service, $path);
201
- } elseif ($statusCode !== 200) {
202
- $this->handleUnexpectedStatus($statusCode, $service, $path);
203
- }
204
-
205
- return $this->handleSuccess($body, $service);
206
- }
207
-
208
- /**
209
- * @return string describing the JSON error
210
- */
211
- private function jsonErrorDescription()
212
- {
213
- $errno = json_last_error();
214
- switch ($errno) {
215
- case JSON_ERROR_DEPTH:
216
- return 'The maximum stack depth has been exceeded.';
217
- case JSON_ERROR_STATE_MISMATCH:
218
- return 'Invalid or malformed JSON.';
219
- case JSON_ERROR_CTRL_CHAR:
220
- return 'Control character error.';
221
- case JSON_ERROR_SYNTAX:
222
- return 'Syntax error.';
223
- case JSON_ERROR_UTF8:
224
- return 'Malformed UTF-8 characters.';
225
- default:
226
- return "Other JSON error ($errno).";
227
- }
228
- }
229
-
230
- /**
231
- * @param string $path the path to use in the URL
232
- *
233
- * @return string the constructed URL
234
- */
235
- private function urlFor($path)
236
- {
237
- return 'https://' . $this->host . $path;
238
- }
239
-
240
- /**
241
- * @param int $statusCode the HTTP status code
242
- * @param string $contentType the response content-type
243
- * @param string $body the response body
244
- * @param string $service the service name
245
- * @param string $path the path used in the request
246
- *
247
- * @throws AuthenticationException
248
- * @throws HttpException
249
- * @throws InsufficientFundsException
250
- * @throws InvalidRequestException
251
- */
252
- private function handle4xx(
253
- $statusCode,
254
- $contentType,
255
- $body,
256
- $service,
257
- $path
258
- ) {
259
- if (strlen($body) === 0) {
260
- throw new HttpException(
261
- "Received a $statusCode error for $service with no body",
262
- $statusCode,
263
- $this->urlFor($path)
264
- );
265
- }
266
- if (!strstr($contentType, 'json')) {
267
- throw new HttpException(
268
- "Received a $statusCode error for $service with " .
269
- 'the following body: ' . $body,
270
- $statusCode,
271
- $this->urlFor($path)
272
- );
273
- }
274
-
275
- $message = json_decode($body, true);
276
- if ($message === null) {
277
- throw new HttpException(
278
- "Received a $statusCode error for $service but could " .
279
- 'not decode the response as JSON: '
280
- . $this->jsonErrorDescription() . ' Body: ' . $body,
281
- $statusCode,
282
- $this->urlFor($path)
283
- );
284
- }
285
-
286
- if (!isset($message['code']) || !isset($message['error'])) {
287
- throw new HttpException(
288
- 'Error response contains JSON but it does not ' .
289
- 'specify code or error keys: ' . $body,
290
- $statusCode,
291
- $this->urlFor($path)
292
- );
293
- }
294
-
295
- $this->handleWebServiceError(
296
- $message['error'],
297
- $message['code'],
298
- $statusCode,
299
- $path
300
- );
301
- }
302
-
303
- /**
304
- * @param string $message the error message from the web service
305
- * @param string $code the error code from the web service
306
- * @param int $statusCode the HTTP status code
307
- * @param string $path the path used in the request
308
- *
309
- * @throws AuthenticationException
310
- * @throws InvalidRequestException
311
- * @throws InsufficientFundsException
312
- */
313
- private function handleWebServiceError(
314
- $message,
315
- $code,
316
- $statusCode,
317
- $path
318
- ) {
319
- switch ($code) {
320
- case 'IP_ADDRESS_NOT_FOUND':
321
- case 'IP_ADDRESS_RESERVED':
322
- throw new IpAddressNotFoundException(
323
- $message,
324
- $code,
325
- $statusCode,
326
- $this->urlFor($path)
327
- );
328
- case 'AUTHORIZATION_INVALID':
329
- case 'LICENSE_KEY_REQUIRED':
330
- case 'USER_ID_REQUIRED':
331
- case 'USER_ID_UNKNOWN':
332
- throw new AuthenticationException(
333
- $message,
334
- $code,
335
- $statusCode,
336
- $this->urlFor($path)
337
- );
338
- case 'OUT_OF_QUERIES':
339
- case 'INSUFFICIENT_FUNDS':
340
- throw new InsufficientFundsException(
341
- $message,
342
- $code,
343
- $statusCode,
344
- $this->urlFor($path)
345
- );
346
- case 'PERMISSION_REQUIRED':
347
- throw new PermissionRequiredException(
348
- $message,
349
- $code,
350
- $statusCode,
351
- $this->urlFor($path)
352
- );
353
- default:
354
- throw new InvalidRequestException(
355
- $message,
356
- $code,
357
- $statusCode,
358
- $this->urlFor($path)
359
- );
360
- }
361
- }
362
-
363
- /**
364
- * @param int $statusCode the HTTP status code
365
- * @param string $service the service name
366
- * @param string $path the URI path used in the request
367
- *
368
- * @throws HttpException
369
- */
370
- private function handle5xx($statusCode, $service, $path)
371
- {
372
- throw new HttpException(
373
- "Received a server error ($statusCode) for $service",
374
- $statusCode,
375
- $this->urlFor($path)
376
- );
377
- }
378
-
379
- /**
380
- * @param int $statusCode the HTTP status code
381
- * @param string $service the service name
382
- * @param string $path the URI path used in the request
383
- *
384
- * @throws HttpException
385
- */
386
- private function handleUnexpectedStatus($statusCode, $service, $path)
387
- {
388
- throw new HttpException(
389
- 'Received an unexpected HTTP status ' .
390
- "($statusCode) for $service",
391
- $statusCode,
392
- $this->urlFor($path)
393
- );
394
- }
395
-
396
- /**
397
- * @param string $body the successful request body
398
- * @param string $service the service name
399
- *
400
- * @throws WebServiceException if the request body cannot be decoded as
401
- * JSON
402
- *
403
- * @return array the decoded request body
404
- */
405
- private function handleSuccess($body, $service)
406
- {
407
- if (strlen($body) === 0) {
408
- throw new WebServiceException(
409
- "Received a 200 response for $service but did not " .
410
- 'receive a HTTP body.'
411
- );
412
- }
413
-
414
- $decodedContent = json_decode($body, true);
415
- if ($decodedContent === null) {
416
- throw new WebServiceException(
417
- "Received a 200 response for $service but could " .
418
- 'not decode the response as JSON: '
419
- . $this->jsonErrorDescription() . ' Body: ' . $body
420
- );
421
- }
422
-
423
- return $decodedContent;
424
- }
425
-
426
- private function getCaBundle()
427
- {
428
- $curlVersion = curl_version();
429
-
430
- // On OS X, when the SSL version is "SecureTransport", the system's
431
- // keychain will be used.
432
- if ($curlVersion['ssl_version'] === 'SecureTransport') {
433
- return;
434
- }
435
- $cert = CaBundle::getSystemCaRootBundlePath();
436
-
437
- // Check if the cert is inside a phar. If so, we need to copy the cert
438
- // to a temp file so that curl can see it.
439
- if (substr($cert, 0, 7) === 'phar://') {
440
- $tempDir = sys_get_temp_dir();
441
- $newCert = tempnam($tempDir, 'geoip2-');
442
- if ($newCert === false) {
443
- throw new \RuntimeException(
444
- "Unable to create temporary file in $tempDir"
445
- );
446
- }
447
- if (!copy($cert, $newCert)) {
448
- throw new \RuntimeException(
449
- "Could not copy $cert to $newCert: "
450
- . var_export(error_get_last(), true)
451
- );
452
- }
453
-
454
- // We use a shutdown function rather than the destructor as the
455
- // destructor isn't called on a fatal error such as an uncaught
456
- // exception.
457
- register_shutdown_function(
458
- function () use ($newCert) {
459
- unlink($newCert);
460
- }
461
- );
462
- $cert = $newCert;
463
- }
464
- if (!file_exists($cert)) {
465
- throw new \RuntimeException("CA cert does not exist at $cert");
466
- }
467
-
468
- return $cert;
469
- }
470
- }
1
+ <?php
2
+
3
+ namespace MaxMind\WebService;
4
+
5
+ use Composer\CaBundle\CaBundle;
6
+ use MaxMind\Exception\AuthenticationException;
7
+ use MaxMind\Exception\HttpException;
8
+ use MaxMind\Exception\InsufficientFundsException;
9
+ use MaxMind\Exception\InvalidInputException;
10
+ use MaxMind\Exception\InvalidRequestException;
11
+ use MaxMind\Exception\IpAddressNotFoundException;
12
+ use MaxMind\Exception\PermissionRequiredException;
13
+ use MaxMind\Exception\WebServiceException;
14
+ use MaxMind\WebService\Http\RequestFactory;
15
+
16
+ /**
17
+ * This class is not intended to be used directly by an end-user of a
18
+ * MaxMind web service. Please use the appropriate client API for the service
19
+ * that you are using.
20
+ *
21
+ * @internal
22
+ */
23
+ class Client
24
+ {
25
+ const VERSION = '0.2.0';
26
+
27
+ private $caBundle;
28
+ private $connectTimeout;
29
+ private $host = 'api.maxmind.com';
30
+ private $httpRequestFactory;
31
+ private $licenseKey;
32
+ private $proxy;
33
+ private $timeout;
34
+ private $userAgentPrefix;
35
+ private $userId;
36
+
37
+ /**
38
+ * @param int $userId your MaxMind user ID
39
+ * @param string $licenseKey your MaxMind license key
40
+ * @param array $options an array of options. Possible keys:
41
+ * * `host` - The host to use when connecting to the web service.
42
+ * * `userAgent` - The prefix of the User-Agent to use in the request.
43
+ * * `caBundle` - The bundle of CA root certificates to use in the request.
44
+ * * `connectTimeout` - The connect timeout to use for the request.
45
+ * * `timeout` - The timeout to use for the request.
46
+ * * `proxy` - The HTTP proxy to use. May include a schema, port,
47
+ * username, and password, e.g., `http://username:password@127.0.0.1:10`.
48
+ */
49
+ public function __construct(
50
+ $userId,
51
+ $licenseKey,
52
+ $options = []
53
+ ) {
54
+ $this->userId = $userId;
55
+ $this->licenseKey = $licenseKey;
56
+
57
+ $this->httpRequestFactory = isset($options['httpRequestFactory'])
58
+ ? $options['httpRequestFactory']
59
+ : new RequestFactory();
60
+
61
+ if (isset($options['host'])) {
62
+ $this->host = $options['host'];
63
+ }
64
+ if (isset($options['userAgent'])) {
65
+ $this->userAgentPrefix = $options['userAgent'] . ' ';
66
+ }
67
+
68
+ $this->caBundle = isset($options['caBundle']) ?
69
+ $this->caBundle = $options['caBundle'] : $this->getCaBundle();
70
+
71
+ if (isset($options['connectTimeout'])) {
72
+ $this->connectTimeout = $options['connectTimeout'];
73
+ }
74
+ if (isset($options['timeout'])) {
75
+ $this->timeout = $options['timeout'];
76
+ }
77
+
78
+ if (isset($options['proxy'])) {
79
+ $this->proxy = $options['proxy'];
80
+ }
81
+ }
82
+
83
+ /**
84
+ * @param string $service name of the service querying
85
+ * @param string $path the URI path to use
86
+ * @param array $input the data to be posted as JSON
87
+ *
88
+ * @throws InvalidInputException when the request has missing or invalid
89
+ * data
90
+ * @throws AuthenticationException when there is an issue authenticating the
91
+ * request
92
+ * @throws InsufficientFundsException when your account is out of funds
93
+ * @throws InvalidRequestException when the request is invalid for some
94
+ * other reason, e.g., invalid JSON in the POST.
95
+ * @throws HttpException when an unexpected HTTP error occurs
96
+ * @throws WebServiceException when some other error occurs. This also
97
+ * serves as the base class for the above exceptions.
98
+ *
99
+ * @return array The decoded content of a successful response
100
+ */
101
+ public function post($service, $path, $input)
102
+ {
103
+ $body = json_encode($input);
104
+ if ($body === false) {
105
+ throw new InvalidInputException(
106
+ 'Error encoding input as JSON: '
107
+ . $this->jsonErrorDescription()
108
+ );
109
+ }
110
+
111
+ $request = $this->createRequest(
112
+ $path,
113
+ ['Content-Type: application/json']
114
+ );
115
+
116
+ list($statusCode, $contentType, $body) = $request->post($body);
117
+
118
+ return $this->handleResponse(
119
+ $statusCode,
120
+ $contentType,
121
+ $body,
122
+ $service,
123
+ $path
124
+ );
125
+ }
126
+
127
+ public function get($service, $path)
128
+ {
129
+ $request = $this->createRequest($path);
130
+
131
+ list($statusCode, $contentType, $body) = $request->get();
132
+
133
+ return $this->handleResponse(
134
+ $statusCode,
135
+ $contentType,
136
+ $body,
137
+ $service,
138
+ $path
139
+ );
140
+ }
141
+
142
+ private function userAgent()
143
+ {
144
+ $curlVersion = curl_version();
145
+
146
+ return $this->userAgentPrefix . 'MaxMind-WS-API/' . self::VERSION . ' PHP/' . PHP_VERSION .
147
+ ' curl/' . $curlVersion['version'];
148
+ }
149
+
150
+ private function createRequest($path, $headers = [])
151
+ {
152
+ array_push(
153
+ $headers,
154
+ 'Authorization: Basic '
155
+ . base64_encode($this->userId . ':' . $this->licenseKey),
156
+ 'Accept: application/json'
157
+ );
158
+
159
+ return $this->httpRequestFactory->request(
160
+ $this->urlFor($path),
161
+ [
162
+ 'caBundle' => $this->caBundle,
163
+ 'connectTimeout' => $this->connectTimeout,
164
+ 'headers' => $headers,
165
+ 'proxy' => $this->proxy,
166
+ 'timeout' => $this->timeout,
167
+ 'userAgent' => $this->userAgent(),
168
+ ]
169
+ );
170
+ }
171
+
172
+ /**
173
+ * @param int $statusCode the HTTP status code of the response
174
+ * @param string $contentType the Content-Type of the response
175
+ * @param string $body the response body
176
+ * @param string $service the name of the service
177
+ * @param string $path the path used in the request
178
+ *
179
+ * @throws AuthenticationException when there is an issue authenticating the
180
+ * request
181
+ * @throws InsufficientFundsException when your account is out of funds
182
+ * @throws InvalidRequestException when the request is invalid for some
183
+ * other reason, e.g., invalid JSON in the POST.
184
+ * @throws HttpException when an unexpected HTTP error occurs
185
+ * @throws WebServiceException when some other error occurs. This also
186
+ * serves as the base class for the above exceptions
187
+ *
188
+ * @return array The decoded content of a successful response
189
+ */
190
+ private function handleResponse(
191
+ $statusCode,
192
+ $contentType,
193
+ $body,
194
+ $service,
195
+ $path
196
+ ) {
197
+ if ($statusCode >= 400 && $statusCode <= 499) {
198
+ $this->handle4xx($statusCode, $contentType, $body, $service, $path);
199
+ } elseif ($statusCode >= 500) {
200
+ $this->handle5xx($statusCode, $service, $path);
201
+ } elseif ($statusCode !== 200) {
202
+ $this->handleUnexpectedStatus($statusCode, $service, $path);
203
+ }
204
+
205
+ return $this->handleSuccess($body, $service);
206
+ }
207
+
208
+ /**
209
+ * @return string describing the JSON error
210
+ */
211
+ private function jsonErrorDescription()
212
+ {
213
+ $errno = json_last_error();
214
+ switch ($errno) {
215
+ case JSON_ERROR_DEPTH:
216
+ return 'The maximum stack depth has been exceeded.';
217
+ case JSON_ERROR_STATE_MISMATCH:
218
+ return 'Invalid or malformed JSON.';
219
+ case JSON_ERROR_CTRL_CHAR:
220
+ return 'Control character error.';
221
+ case JSON_ERROR_SYNTAX:
222
+ return 'Syntax error.';
223
+ case JSON_ERROR_UTF8:
224
+ return 'Malformed UTF-8 characters.';
225
+ default:
226
+ return "Other JSON error ($errno).";
227
+ }
228
+ }
229
+
230
+ /**
231
+ * @param string $path the path to use in the URL
232
+ *
233
+ * @return string the constructed URL
234
+ */
235
+ private function urlFor($path)
236
+ {
237
+ return 'https://' . $this->host . $path;
238
+ }
239
+
240
+ /**
241
+ * @param int $statusCode the HTTP status code
242
+ * @param string $contentType the response content-type
243
+ * @param string $body the response body
244
+ * @param string $service the service name
245
+ * @param string $path the path used in the request
246
+ *
247
+ * @throws AuthenticationException
248
+ * @throws HttpException
249
+ * @throws InsufficientFundsException
250
+ * @throws InvalidRequestException
251
+ */
252
+ private function handle4xx(
253
+ $statusCode,
254
+ $contentType,
255
+ $body,
256
+ $service,
257
+ $path
258
+ ) {
259
+ if (strlen($body) === 0) {
260
+ throw new HttpException(
261
+ "Received a $statusCode error for $service with no body",
262
+ $statusCode,
263
+ $this->urlFor($path)
264
+ );
265
+ }
266
+ if (!strstr($contentType, 'json')) {
267
+ throw new HttpException(
268
+ "Received a $statusCode error for $service with " .
269
+ 'the following body: ' . $body,
270
+ $statusCode,
271
+ $this->urlFor($path)
272
+ );
273
+ }
274
+
275
+ $message = json_decode($body, true);
276
+ if ($message === null) {
277
+ throw new HttpException(
278
+ "Received a $statusCode error for $service but could " .
279
+ 'not decode the response as JSON: '
280
+ . $this->jsonErrorDescription() . ' Body: ' . $body,
281
+ $statusCode,
282
+ $this->urlFor($path)
283
+ );
284
+ }
285
+
286
+ if (!isset($message['code']) || !isset($message['error'])) {
287
+ throw new HttpException(
288
+ 'Error response contains JSON but it does not ' .
289
+ 'specify code or error keys: ' . $body,
290
+ $statusCode,
291
+ $this->urlFor($path)
292
+ );
293
+ }
294
+
295
+ $this->handleWebServiceError(
296
+ $message['error'],
297
+ $message['code'],
298
+ $statusCode,
299
+ $path
300
+ );
301
+ }
302
+
303
+ /**
304
+ * @param string $message the error message from the web service
305
+ * @param string $code the error code from the web service
306
+ * @param int $statusCode the HTTP status code
307
+ * @param string $path the path used in the request
308
+ *
309
+ * @throws AuthenticationException
310
+ * @throws InvalidRequestException
311
+ * @throws InsufficientFundsException
312
+ */
313
+ private function handleWebServiceError(
314
+ $message,
315
+ $code,
316
+ $statusCode,
317
+ $path
318
+ ) {
319
+ switch ($code) {
320
+ case 'IP_ADDRESS_NOT_FOUND':
321
+ case 'IP_ADDRESS_RESERVED':
322
+ throw new IpAddressNotFoundException(
323
+ $message,
324
+ $code,
325
+ $statusCode,
326
+ $this->urlFor($path)
327
+ );
328
+ case 'AUTHORIZATION_INVALID':
329
+ case 'LICENSE_KEY_REQUIRED':
330
+ case 'USER_ID_REQUIRED':
331
+ case 'USER_ID_UNKNOWN':
332
+ throw new AuthenticationException(
333
+ $message,
334
+ $code,
335
+ $statusCode,
336
+ $this->urlFor($path)
337
+ );
338
+ case 'OUT_OF_QUERIES':
339
+ case 'INSUFFICIENT_FUNDS':
340
+ throw new InsufficientFundsException(
341
+ $message,
342
+ $code,
343
+ $statusCode,
344
+ $this->urlFor($path)
345
+ );
346
+ case 'PERMISSION_REQUIRED':
347
+ throw new PermissionRequiredException(
348
+ $message,
349
+ $code,
350
+ $statusCode,
351
+ $this->urlFor($path)
352
+ );
353
+ default:
354
+ throw new InvalidRequestException(
355
+ $message,
356
+ $code,
357
+ $statusCode,
358
+ $this->urlFor($path)
359
+ );
360
+ }
361
+ }
362
+
363
+ /**
364
+ * @param int $statusCode the HTTP status code
365
+ * @param string $service the service name
366
+ * @param string $path the URI path used in the request
367
+ *
368
+ * @throws HttpException
369
+ */
370
+ private function handle5xx($statusCode, $service, $path)
371
+ {
372
+ throw new HttpException(
373
+ "Received a server error ($statusCode) for $service",
374
+ $statusCode,
375
+ $this->urlFor($path)
376
+ );
377
+ }
378
+
379
+ /**
380
+ * @param int $statusCode the HTTP status code
381
+ * @param string $service the service name
382
+ * @param string $path the URI path used in the request
383
+ *
384
+ * @throws HttpException
385
+ */
386
+ private function handleUnexpectedStatus($statusCode, $service, $path)
387
+ {
388
+ throw new HttpException(
389
+ 'Received an unexpected HTTP status ' .
390
+ "($statusCode) for $service",
391
+ $statusCode,
392
+ $this->urlFor($path)
393
+ );
394
+ }
395
+
396
+ /**
397
+ * @param string $body the successful request body
398
+ * @param string $service the service name
399
+ *
400
+ * @throws WebServiceException if the request body cannot be decoded as
401
+ * JSON
402
+ *
403
+ * @return array the decoded request body
404
+ */
405
+ private function handleSuccess($body, $service)
406
+ {
407
+ if (strlen($body) === 0) {
408
+ throw new WebServiceException(
409
+ "Received a 200 response for $service but did not " .
410
+ 'receive a HTTP body.'
411
+ );
412
+ }
413
+
414
+ $decodedContent = json_decode($body, true);
415
+ if ($decodedContent === null) {
416
+ throw new WebServiceException(
417
+ "Received a 200 response for $service but could " .
418
+ 'not decode the response as JSON: '
419
+ . $this->jsonErrorDescription() . ' Body: ' . $body
420
+ );
421
+ }
422
+
423
+ return $decodedContent;
424
+ }
425
+
426
+ private function getCaBundle()
427
+ {
428
+ $curlVersion = curl_version();
429
+
430
+ // On OS X, when the SSL version is "SecureTransport", the system's
431
+ // keychain will be used.
432
+ if ($curlVersion['ssl_version'] === 'SecureTransport') {
433
+ return;
434
+ }
435
+ $cert = CaBundle::getSystemCaRootBundlePath();
436
+
437
+ // Check if the cert is inside a phar. If so, we need to copy the cert
438
+ // to a temp file so that curl can see it.
439
+ if (substr($cert, 0, 7) === 'phar://') {
440
+ $tempDir = sys_get_temp_dir();
441
+ $newCert = tempnam($tempDir, 'geoip2-');
442
+ if ($newCert === false) {
443
+ throw new \RuntimeException(
444
+ "Unable to create temporary file in $tempDir"
445
+ );
446
+ }
447
+ if (!copy($cert, $newCert)) {
448
+ throw new \RuntimeException(
449
+ "Could not copy $cert to $newCert: "
450
+ . var_export(error_get_last(), true)
451
+ );
452
+ }
453
+
454
+ // We use a shutdown function rather than the destructor as the
455
+ // destructor isn't called on a fatal error such as an uncaught
456
+ // exception.
457
+ register_shutdown_function(
458
+ function () use ($newCert) {
459
+ unlink($newCert);
460
+ }
461
+ );
462
+ $cert = $newCert;
463
+ }
464
+ if (!file_exists($cert)) {
465
+ throw new \RuntimeException("CA cert does not exist at $cert");
466
+ }
467
+
468
+ return $cert;
469
+ }
470
+ }
vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php CHANGED
@@ -1,110 +1,110 @@
1
- <?php
2
-
3
- namespace MaxMind\WebService\Http;
4
-
5
- use MaxMind\Exception\HttpException;
6
-
7
- /**
8
- * This class is for internal use only. Semantic versioning does not not apply.
9
- *
10
- * @internal
11
- */
12
- class CurlRequest implements Request
13
- {
14
- private $url;
15
- private $options;
16
-
17
- /**
18
- * @param $url
19
- * @param $options
20
- */
21
- public function __construct($url, $options)
22
- {
23
- $this->url = $url;
24
- $this->options = $options;
25
- }
26
-
27
- /**
28
- * @param $body
29
- *
30
- * @return array
31
- */
32
- public function post($body)
33
- {
34
- $curl = $this->createCurl();
35
-
36
- curl_setopt($curl, CURLOPT_POST, true);
37
- curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
38
-
39
- return $this->execute($curl);
40
- }
41
-
42
- public function get()
43
- {
44
- $curl = $this->createCurl();
45
-
46
- curl_setopt($curl, CURLOPT_HTTPGET, true);
47
-
48
- return $this->execute($curl);
49
- }
50
-
51
- /**
52
- * @return resource
53
- */
54
- private function createCurl()
55
- {
56
- $curl = curl_init($this->url);
57
-
58
- if (!empty($this->options['caBundle'])) {
59
- $opts[CURLOPT_CAINFO] = $this->options['caBundle'];
60
- }
61
- $opts[CURLOPT_SSL_VERIFYHOST] = 2;
62
- $opts[CURLOPT_FOLLOWLOCATION] = false;
63
- $opts[CURLOPT_SSL_VERIFYPEER] = true;
64
- $opts[CURLOPT_RETURNTRANSFER] = true;
65
-
66
- $opts[CURLOPT_HTTPHEADER] = $this->options['headers'];
67
- $opts[CURLOPT_USERAGENT] = $this->options['userAgent'];
68
- $opts[CURLOPT_PROXY] = $this->options['proxy'];
69
-
70
- // The defined()s are here as the *_MS opts are not available on older
71
- // cURL versions
72
- $connectTimeout = $this->options['connectTimeout'];
73
- if (defined('CURLOPT_CONNECTTIMEOUT_MS')) {
74
- $opts[CURLOPT_CONNECTTIMEOUT_MS] = ceil($connectTimeout * 1000);
75
- } else {
76
- $opts[CURLOPT_CONNECTTIMEOUT] = ceil($connectTimeout);
77
- }
78
-
79
- $timeout = $this->options['timeout'];
80
- if (defined('CURLOPT_TIMEOUT_MS')) {
81
- $opts[CURLOPT_TIMEOUT_MS] = ceil($timeout * 1000);
82
- } else {
83
- $opts[CURLOPT_TIMEOUT] = ceil($timeout);
84
- }
85
-
86
- curl_setopt_array($curl, $opts);
87
-
88
- return $curl;
89
- }
90
-
91
- private function execute($curl)
92
- {
93
- $body = curl_exec($curl);
94
- if ($errno = curl_errno($curl)) {
95
- $errorMessage = curl_error($curl);
96
-
97
- throw new HttpException(
98
- "cURL error ({$errno}): {$errorMessage}",
99
- 0,
100
- $this->url
101
- );
102
- }
103
-
104
- $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
105
- $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
106
- curl_close($curl);
107
-
108
- return [$statusCode, $contentType, $body];
109
- }
110
- }
1
+ <?php
2
+
3
+ namespace MaxMind\WebService\Http;
4
+
5
+ use MaxMind\Exception\HttpException;
6
+
7
+ /**
8
+ * This class is for internal use only. Semantic versioning does not not apply.
9
+ *
10
+ * @internal
11
+ */
12
+ class CurlRequest implements Request
13
+ {
14
+ private $url;
15
+ private $options;
16
+
17
+ /**
18
+ * @param $url
19
+ * @param $options
20
+ */
21
+ public function __construct($url, $options)
22
+ {
23
+ $this->url = $url;
24
+ $this->options = $options;
25
+ }
26
+
27
+ /**
28
+ * @param $body
29
+ *
30
+ * @return array
31
+ */
32
+ public function post($body)
33
+ {
34
+ $curl = $this->createCurl();
35
+
36
+ curl_setopt($curl, CURLOPT_POST, true);
37
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
38
+
39
+ return $this->execute($curl);
40
+ }
41
+
42
+ public function get()
43
+ {
44
+ $curl = $this->createCurl();
45
+
46
+ curl_setopt($curl, CURLOPT_HTTPGET, true);
47
+
48
+ return $this->execute($curl);
49
+ }
50
+
51
+ /**
52
+ * @return resource
53
+ */
54
+ private function createCurl()
55
+ {
56
+ $curl = curl_init($this->url);
57
+
58
+ if (!empty($this->options['caBundle'])) {
59
+ $opts[CURLOPT_CAINFO] = $this->options['caBundle'];
60
+ }
61
+ $opts[CURLOPT_SSL_VERIFYHOST] = 2;
62
+ $opts[CURLOPT_FOLLOWLOCATION] = false;
63
+ $opts[CURLOPT_SSL_VERIFYPEER] = true;
64
+ $opts[CURLOPT_RETURNTRANSFER] = true;
65
+
66
+ $opts[CURLOPT_HTTPHEADER] = $this->options['headers'];
67
+ $opts[CURLOPT_USERAGENT] = $this->options['userAgent'];
68
+ $opts[CURLOPT_PROXY] = $this->options['proxy'];
69
+
70
+ // The defined()s are here as the *_MS opts are not available on older
71
+ // cURL versions
72
+ $connectTimeout = $this->options['connectTimeout'];
73
+ if (defined('CURLOPT_CONNECTTIMEOUT_MS')) {
74
+ $opts[CURLOPT_CONNECTTIMEOUT_MS] = ceil($connectTimeout * 1000);
75
+ } else {
76
+ $opts[CURLOPT_CONNECTTIMEOUT] = ceil($connectTimeout);
77
+ }
78
+
79
+ $timeout = $this->options['timeout'];
80
+ if (defined('CURLOPT_TIMEOUT_MS')) {
81
+ $opts[CURLOPT_TIMEOUT_MS] = ceil($timeout * 1000);
82
+ } else {
83
+ $opts[CURLOPT_TIMEOUT] = ceil($timeout);
84
+ }
85
+
86
+ curl_setopt_array($curl, $opts);
87
+
88
+ return $curl;
89
+ }
90
+
91
+ private function execute($curl)
92
+ {
93
+ $body = curl_exec($curl);
94
+ if ($errno = curl_errno($curl)) {
95
+ $errorMessage = curl_error($curl);
96
+
97
+ throw new HttpException(
98
+ "cURL error ({$errno}): {$errorMessage}",
99
+ 0,
100
+ $this->url
101
+ );
102
+ }
103
+
104
+ $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
105
+ $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
106
+ curl_close($curl);
107
+
108
+ return [$statusCode, $contentType, $body];
109
+ }
110
+ }
vendor/maxmind/web-service-common/src/WebService/Http/Request.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
-
3
- namespace MaxMind\WebService\Http;
4
-
5
- /**
6
- * Interface Request.
7
- *
8
- * @internal
9
- */
10
- interface Request
11
- {
12
- /**
13
- * @param $url
14
- * @param $options
15
- */
16
- public function __construct($url, $options);
17
-
18
- /**
19
- * @param $body
20
- *
21
- * @return mixed
22
- */
23
- public function post($body);
24
-
25
- /**
26
- * @return mixed
27
- */
28
- public function get();
29
- }
1
+ <?php
2
+
3
+ namespace MaxMind\WebService\Http;
4
+
5
+ /**
6
+ * Interface Request.
7
+ *
8
+ * @internal
9
+ */
10
+ interface Request
11
+ {
12
+ /**
13
+ * @param $url
14
+ * @param $options
15
+ */
16
+ public function __construct($url, $options);
17
+
18
+ /**
19
+ * @param $body
20
+ *
21
+ * @return mixed
22
+ */
23
+ public function post($body);
24
+
25
+ /**
26
+ * @return mixed
27
+ */
28
+ public function get();
29
+ }
vendor/maxmind/web-service-common/src/WebService/Http/RequestFactory.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
-
3
- namespace MaxMind\WebService\Http;
4
-
5
- /**
6
- * Class RequestFactory.
7
- *
8
- * @internal
9
- */
10
- class RequestFactory
11
- {
12
- public function __construct()
13
- {
14
- }
15
-
16
- /**
17
- * @param $url
18
- * @param $options
19
- *
20
- * @return CurlRequest
21
- */
22
- public function request($url, $options)
23
- {
24
- return new CurlRequest($url, $options);
25
- }
26
- }
1
+ <?php
2
+
3
+ namespace MaxMind\WebService\Http;
4
+
5
+ /**
6
+ * Class RequestFactory.
7
+ *
8
+ * @internal
9
+ */
10
+ class RequestFactory
11
+ {
12
+ public function __construct()
13
+ {
14
+ }
15
+
16
+ /**
17
+ * @param $url
18
+ * @param $options
19
+ *
20
+ * @return CurlRequest
21
+ */
22
+ public function request($url, $options)
23
+ {
24
+ return new CurlRequest($url, $options);
25
+ }
26
+ }
wp-statistics.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP Statistics
4
  * Plugin URI: http://wp-statistics.com/
5
  * Description: Complete statistics for your WordPress site.
6
- * Version: 12.0.12
7
  * Author: WP-Statistics Team
8
  * Author URI: http://wp-statistics.com/
9
  * Text Domain: wp-statistics
@@ -12,7 +12,7 @@
12
  */
13
 
14
  // These defines are used later for various reasons.
15
- define( 'WP_STATISTICS_VERSION', '12.0.12' );
16
  define( 'WP_STATISTICS_REQUIRED_PHP_VERSION', '5.4.0' );
17
  define( 'WP_STATISTICS_REQUIRED_GEOIP_PHP_VERSION', WP_STATISTICS_REQUIRED_PHP_VERSION );
18
  define( 'WPS_EXPORT_FILE_NAME', 'wp-statistics' );
@@ -704,7 +704,7 @@ function wp_statistics_plugins() {
704
  $response = wp_remote_get( 'https://wp-statistics.com/wp-json/addons/get' );
705
  $response_code = wp_remote_retrieve_response_code( $response );
706
  $error = null;
707
- $plugins = [];
708
  // Check response
709
  if ( is_wp_error( $response ) ) {
710
  $error = $response->get_error_message();
3
  * Plugin Name: WP Statistics
4
  * Plugin URI: http://wp-statistics.com/
5
  * Description: Complete statistics for your WordPress site.
6
+ * Version: 12.0.12.1
7
  * Author: WP-Statistics Team
8
  * Author URI: http://wp-statistics.com/
9
  * Text Domain: wp-statistics
12
  */
13
 
14
  // These defines are used later for various reasons.
15
+ define( 'WP_STATISTICS_VERSION', '12.0.12.1' );
16
  define( 'WP_STATISTICS_REQUIRED_PHP_VERSION', '5.4.0' );
17
  define( 'WP_STATISTICS_REQUIRED_GEOIP_PHP_VERSION', WP_STATISTICS_REQUIRED_PHP_VERSION );
18
  define( 'WPS_EXPORT_FILE_NAME', 'wp-statistics' );
704
  $response = wp_remote_get( 'https://wp-statistics.com/wp-json/addons/get' );
705
  $response_code = wp_remote_retrieve_response_code( $response );
706
  $error = null;
707
+ $plugins = array();
708
  // Check response
709
  if ( is_wp_error( $response ) ) {
710
  $error = $response->get_error_message();