GeoIP Detection - Version 3.0

Version Description

If you use Maxmind "Automatic download" then you need to upgrade to this plugin version in order to continue to receive database update. The Database licence changed and you will need to register at their website and agree to the EULA.

Download this release

Release Info

Developer benjamin4
Plugin Icon 128x128 GeoIP Detection
Version 3.0
Comparing to
See all releases

Code changes from version 2.13.0 to 3.0

Files changed (52) hide show
  1. admin-ui.php +5 -2
  2. composer.json +2 -3
  3. composer.lock +35 -31
  4. data-sources/auto.php +58 -8
  5. data-sources/hostinfo.php +1 -1
  6. geoip-detect.php +2 -2
  7. init.php +6 -13
  8. lib/composer.lock +12 -12
  9. readme.txt +17 -3
  10. vendor/composer/ClassLoader.php +3 -3
  11. vendor/composer/ca-bundle/composer.json +1 -1
  12. vendor/composer/ca-bundle/res/cacert.pem +2 -46
  13. vendor/composer/ca-bundle/src/CaBundle.php +1 -0
  14. vendor/composer/installed.json +60 -56
  15. vendor/geoip2/geoip2/CHANGELOG.md +20 -0
  16. vendor/geoip2/geoip2/README.md +25 -17
  17. vendor/geoip2/geoip2/composer.json +6 -5
  18. vendor/geoip2/geoip2/examples/benchmark.php +25 -0
  19. vendor/geoip2/geoip2/src/Database/Reader.php +13 -9
  20. vendor/geoip2/geoip2/src/Model/AnonymousIp.php +14 -4
  21. vendor/geoip2/geoip2/src/Model/Asn.php +9 -1
  22. vendor/geoip2/geoip2/src/Model/City.php +4 -21
  23. vendor/geoip2/geoip2/src/Model/ConnectionType.php +9 -1
  24. vendor/geoip2/geoip2/src/Model/Country.php +1 -1
  25. vendor/geoip2/geoip2/src/Model/Domain.php +9 -1
  26. vendor/geoip2/geoip2/src/Model/Enterprise.php +1 -34
  27. vendor/geoip2/geoip2/src/Model/Insights.php +1 -34
  28. vendor/geoip2/geoip2/src/Model/Isp.php +9 -1
  29. vendor/geoip2/geoip2/src/Record/AbstractRecord.php +1 -1
  30. vendor/geoip2/geoip2/src/Record/Country.php +3 -4
  31. vendor/geoip2/geoip2/src/Record/Location.php +4 -4
  32. vendor/geoip2/geoip2/src/Record/RepresentedCountry.php +0 -13
  33. vendor/geoip2/geoip2/src/Record/Subdivision.php +3 -3
  34. vendor/geoip2/geoip2/src/Record/Traits.php +43 -17
  35. vendor/geoip2/geoip2/src/Util.php +37 -0
  36. vendor/geoip2/geoip2/src/WebService/Client.php +4 -4
  37. vendor/maxmind-db/reader/CHANGELOG.md +21 -0
  38. vendor/maxmind-db/reader/composer.json +8 -0
  39. vendor/maxmind-db/reader/ext/maxminddb.c +19 -12
  40. vendor/maxmind-db/reader/ext/php_maxminddb.h +1 -1
  41. vendor/maxmind-db/reader/src/MaxMind/Db/Reader.php +11 -12
  42. vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php +6 -13
  43. vendor/maxmind/web-service-common/CHANGELOG.md +7 -0
  44. vendor/maxmind/web-service-common/README.md +2 -3
  45. vendor/maxmind/web-service-common/composer.json +2 -2
  46. vendor/maxmind/web-service-common/src/WebService/Client.php +17 -17
  47. vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php +35 -9
  48. vendor/maxmind/web-service-common/src/WebService/Http/Request.php +3 -3
  49. vendor/maxmind/web-service-common/src/WebService/Http/RequestFactory.php +20 -3
  50. vendor/symfony/http-foundation/IpUtils.php +32 -0
  51. views/options.php +1 -0
  52. yarn.lock +3 -3
admin-ui.php CHANGED
@@ -21,7 +21,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
  use YellowTree\GeoipDetect\DataSources\DataSourceRegistry;
22
 
23
  function geoip_detect_menu() {
24
- require_once ABSPATH . '/wp-admin/admin.php';
 
 
 
25
  add_submenu_page('tools.php', __('GeoIP Detection Lookup', 'geoip-detect'), __('GeoIP Lookup', 'geoip-detect'), 'activate_plugins', GEOIP_PLUGIN_BASENAME, 'geoip_detect_lookup_page');
26
  add_options_page(__('GeoIP Detection', 'geoip-detect'), __('GeoIP Detection', 'geoip-detect'), 'manage_options', GEOIP_PLUGIN_BASENAME, 'geoip_detect_option_page');
27
  }
@@ -227,4 +230,4 @@ function _geoip_detect_improve_data_for_lookup($data, $shorten_attributes = fals
227
  });
228
 
229
  return $data;
230
- }
21
  use YellowTree\GeoipDetect\DataSources\DataSourceRegistry;
22
 
23
  function geoip_detect_menu() {
24
+ if (!function_exists('add_submenu_page')) {
25
+ require_once ABSPATH . '/wp-admin/admin.php';
26
+ }
27
+
28
  add_submenu_page('tools.php', __('GeoIP Detection Lookup', 'geoip-detect'), __('GeoIP Lookup', 'geoip-detect'), 'activate_plugins', GEOIP_PLUGIN_BASENAME, 'geoip_detect_lookup_page');
29
  add_options_page(__('GeoIP Detection', 'geoip-detect'), __('GeoIP Detection', 'geoip-detect'), 'manage_options', GEOIP_PLUGIN_BASENAME, 'geoip_detect_option_page');
30
  }
230
  });
231
 
232
  return $data;
233
+ }
composer.json CHANGED
@@ -4,8 +4,7 @@
4
  "type": "wordpress-plugin",
5
  "authors": [
6
  {
7
- "name": "Benjamin Pick",
8
- "email": "b.pick@yellowtree.de"
9
  }
10
  ],
11
  "keywords": [],
@@ -15,6 +14,6 @@
15
  ],
16
  "require": {
17
  "geoip2/geoip2": "~2.0",
18
- "php": ">=5.4"
19
  }
20
  }
4
  "type": "wordpress-plugin",
5
  "authors": [
6
  {
7
+ "name": "Benjamin Pick (wp-geoip-detect| |posteo.de)"
 
8
  }
9
  ],
10
  "keywords": [],
14
  ],
15
  "require": {
16
  "geoip2/geoip2": "~2.0",
17
+ "php": ">=5.6"
18
  }
19
  }
composer.lock CHANGED
@@ -1,23 +1,23 @@
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#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
- "content-hash": "1469024a23af7d9facb99a4208b34160",
8
  "packages": [
9
  {
10
  "name": "composer/ca-bundle",
11
- "version": "1.2.4",
12
  "source": {
13
  "type": "git",
14
  "url": "https://github.com/composer/ca-bundle.git",
15
- "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527"
16
  },
17
  "dist": {
18
  "type": "zip",
19
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/10bb96592168a0f8e8f6dcde3532d9fa50b0b527",
20
- "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527",
21
  "shasum": ""
22
  },
23
  "require": {
@@ -28,7 +28,7 @@
28
  "require-dev": {
29
  "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
30
  "psr/log": "^1.0",
31
- "symfony/process": "^2.5 || ^3.0 || ^4.0"
32
  },
33
  "type": "library",
34
  "extra": {
@@ -60,30 +60,31 @@
60
  "ssl",
61
  "tls"
62
  ],
63
- "time": "2019-08-30T08:44:50+00:00"
64
  },
65
  {
66
  "name": "geoip2/geoip2",
67
- "version": "v2.9.0",
68
  "source": {
69
  "type": "git",
70
  "url": "https://github.com/maxmind/GeoIP2-php.git",
71
- "reference": "a807fbf65212eef5d8d2db1a1b31082b53633d77"
72
  },
73
  "dist": {
74
  "type": "zip",
75
- "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/a807fbf65212eef5d8d2db1a1b31082b53633d77",
76
- "reference": "a807fbf65212eef5d8d2db1a1b31082b53633d77",
77
  "shasum": ""
78
  },
79
  "require": {
80
- "maxmind-db/reader": "~1.0",
81
- "maxmind/web-service-common": "~0.5",
82
- "php": ">=5.4"
 
83
  },
84
  "require-dev": {
85
  "friendsofphp/php-cs-fixer": "2.*",
86
- "phpunit/phpunit": "4.*",
87
  "squizlabs/php_codesniffer": "3.*"
88
  },
89
  "type": "library",
@@ -100,7 +101,7 @@
100
  {
101
  "name": "Gregory J. Oschwald",
102
  "email": "goschwald@maxmind.com",
103
- "homepage": "http://www.maxmind.com/"
104
  }
105
  ],
106
  "description": "MaxMind GeoIP2 PHP API",
@@ -112,25 +113,28 @@
112
  "geolocation",
113
  "maxmind"
114
  ],
115
- "time": "2018-04-10T15:32:59+00:00"
116
  },
117
  {
118
  "name": "maxmind-db/reader",
119
- "version": "v1.5.0",
120
  "source": {
121
  "type": "git",
122
  "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
123
- "reference": "bd436094fc0a9b0558a899fb80b0ae34fe1808a0"
124
  },
125
  "dist": {
126
  "type": "zip",
127
- "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/bd436094fc0a9b0558a899fb80b0ae34fe1808a0",
128
- "reference": "bd436094fc0a9b0558a899fb80b0ae34fe1808a0",
129
  "shasum": ""
130
  },
131
  "require": {
132
  "php": ">=5.6"
133
  },
 
 
 
134
  "require-dev": {
135
  "friendsofphp/php-cs-fixer": "2.*",
136
  "php-coveralls/php-coveralls": "^2.1",
@@ -169,31 +173,31 @@
169
  "geolocation",
170
  "maxmind"
171
  ],
172
- "time": "2019-09-30T22:56:38+00:00"
173
  },
174
  {
175
  "name": "maxmind/web-service-common",
176
- "version": "v0.5.0",
177
  "source": {
178
  "type": "git",
179
  "url": "https://github.com/maxmind/web-service-common-php.git",
180
- "reference": "61a9836fa3bb1743ab89752bae5005d71e78c73b"
181
  },
182
  "dist": {
183
  "type": "zip",
184
- "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/61a9836fa3bb1743ab89752bae5005d71e78c73b",
185
- "reference": "61a9836fa3bb1743ab89752bae5005d71e78c73b",
186
  "shasum": ""
187
  },
188
  "require": {
189
  "composer/ca-bundle": "^1.0.3",
190
  "ext-curl": "*",
191
  "ext-json": "*",
192
- "php": ">=5.4"
193
  },
194
  "require-dev": {
195
  "friendsofphp/php-cs-fixer": "2.*",
196
- "phpunit/phpunit": "4.*",
197
  "squizlabs/php_codesniffer": "3.*"
198
  },
199
  "type": "library",
@@ -215,7 +219,7 @@
215
  ],
216
  "description": "Internal MaxMind Web Service API",
217
  "homepage": "https://github.com/maxmind/web-service-common-php",
218
- "time": "2018-02-12T22:31:54+00:00"
219
  }
220
  ],
221
  "packages-dev": [],
@@ -225,7 +229,7 @@
225
  "prefer-stable": false,
226
  "prefer-lowest": false,
227
  "platform": {
228
- "php": ">=5.4"
229
  },
230
  "platform-dev": []
231
  }
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
+ "content-hash": "0fca66929c538deaa8bc2efa2ae4932f",
8
  "packages": [
9
  {
10
  "name": "composer/ca-bundle",
11
+ "version": "1.2.5",
12
  "source": {
13
  "type": "git",
14
  "url": "https://github.com/composer/ca-bundle.git",
15
+ "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149"
16
  },
17
  "dist": {
18
  "type": "zip",
19
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/62e8fc2dc550e5d6d8c9360c7721662670f58149",
20
+ "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149",
21
  "shasum": ""
22
  },
23
  "require": {
28
  "require-dev": {
29
  "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
30
  "psr/log": "^1.0",
31
+ "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0"
32
  },
33
  "type": "library",
34
  "extra": {
60
  "ssl",
61
  "tls"
62
  ],
63
+ "time": "2019-12-11T14:44:42+00:00"
64
  },
65
  {
66
  "name": "geoip2/geoip2",
67
+ "version": "v2.10.0",
68
  "source": {
69
  "type": "git",
70
  "url": "https://github.com/maxmind/GeoIP2-php.git",
71
+ "reference": "419557cd21d9fe039721a83490701a58c8ce784a"
72
  },
73
  "dist": {
74
  "type": "zip",
75
+ "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/419557cd21d9fe039721a83490701a58c8ce784a",
76
+ "reference": "419557cd21d9fe039721a83490701a58c8ce784a",
77
  "shasum": ""
78
  },
79
  "require": {
80
+ "ext-json": "*",
81
+ "maxmind-db/reader": "~1.5",
82
+ "maxmind/web-service-common": "~0.6",
83
+ "php": ">=5.6"
84
  },
85
  "require-dev": {
86
  "friendsofphp/php-cs-fixer": "2.*",
87
+ "phpunit/phpunit": "5.*",
88
  "squizlabs/php_codesniffer": "3.*"
89
  },
90
  "type": "library",
101
  {
102
  "name": "Gregory J. Oschwald",
103
  "email": "goschwald@maxmind.com",
104
+ "homepage": "https://www.maxmind.com/"
105
  }
106
  ],
107
  "description": "MaxMind GeoIP2 PHP API",
113
  "geolocation",
114
  "maxmind"
115
  ],
116
+ "time": "2019-12-12T18:48:39+00:00"
117
  },
118
  {
119
  "name": "maxmind-db/reader",
120
+ "version": "v1.6.0",
121
  "source": {
122
  "type": "git",
123
  "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
124
+ "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4"
125
  },
126
  "dist": {
127
  "type": "zip",
128
+ "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/febd4920bf17c1da84cef58e56a8227dfb37fbe4",
129
+ "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4",
130
  "shasum": ""
131
  },
132
  "require": {
133
  "php": ">=5.6"
134
  },
135
+ "conflict": {
136
+ "ext-maxminddb": "<1.6.0,>=2.0.0"
137
+ },
138
  "require-dev": {
139
  "friendsofphp/php-cs-fixer": "2.*",
140
  "php-coveralls/php-coveralls": "^2.1",
173
  "geolocation",
174
  "maxmind"
175
  ],
176
+ "time": "2019-12-19T22:59:03+00:00"
177
  },
178
  {
179
  "name": "maxmind/web-service-common",
180
+ "version": "v0.6.0",
181
  "source": {
182
  "type": "git",
183
  "url": "https://github.com/maxmind/web-service-common-php.git",
184
+ "reference": "40c928bb0194c45088b369a17f9baef9c3fc7460"
185
  },
186
  "dist": {
187
  "type": "zip",
188
+ "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/40c928bb0194c45088b369a17f9baef9c3fc7460",
189
+ "reference": "40c928bb0194c45088b369a17f9baef9c3fc7460",
190
  "shasum": ""
191
  },
192
  "require": {
193
  "composer/ca-bundle": "^1.0.3",
194
  "ext-curl": "*",
195
  "ext-json": "*",
196
+ "php": ">=5.6"
197
  },
198
  "require-dev": {
199
  "friendsofphp/php-cs-fixer": "2.*",
200
+ "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0",
201
  "squizlabs/php_codesniffer": "3.*"
202
  },
203
  "type": "library",
219
  ],
220
  "description": "Internal MaxMind Web Service API",
221
  "homepage": "https://github.com/maxmind/web-service-common-php",
222
+ "time": "2019-12-12T15:56:05+00:00"
223
  }
224
  ],
225
  "packages-dev": [],
229
  "prefer-stable": false,
230
  "prefer-lowest": false,
231
  "platform": {
232
+ "php": ">=5.6"
233
  },
234
  "platform-dev": []
235
  }
data-sources/auto.php CHANGED
@@ -28,8 +28,9 @@ class AutoDataSource extends ManualDataSource
28
  {
29
  public function getId() { return 'auto'; }
30
  public function getLabel() { return __('Automatic download & update of Maxmind GeoIP Lite City', 'geoip-detect'); }
31
- public function getShortLabel() { return sprintf(__('%s (updated monthly)', 'geoip-detect'), parent::getShortLabel()); }
32
- public function getDescriptionHTML() { return __('(License: Creative Commons Attribution-ShareAlike 3.0 Unported. See <a href="https://github.com/yellowtree/wp-geoip-detect/wiki/FAQ#the-maxmind-lite-databases-are-licensed-creative-commons-sharealike-attribution-when-do-i-need-to-give-attribution" target="_blank">Licensing FAQ</a> for more details.)', 'geoip-detect'); }
 
33
 
34
  public function getStatusInformationHTML() {
35
  $html = parent::getStatusInformationHTML();
@@ -45,23 +46,64 @@ class AutoDataSource extends ManualDataSource
45
  $html .= '<br />' . sprintf(__('Next update: %s', 'geoip-detect'), $next_cron_update !== false ? date_i18n($date_format, $next_cron_update) : __('Never', 'geoip-detect'));
46
  $html .= $rescheduled;
47
 
 
 
48
  return $html;
49
  }
50
 
51
  public function getParameterHTML() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  $text_update = __('Update now', 'geoip-detect');
53
  $nonce_field = wp_nonce_field( 'geoip_detect_update' );
54
- $html = <<<HTML
55
  <form method="post" action="#">
56
  $nonce_field
57
  <input type="hidden" name="action" value="update" />
58
- <input type="submit" class="button button-secondary" value="$text_update" />
59
  </form>
60
  HTML;
61
- return $html;
62
  }
63
 
64
- public function saveParameters($post) {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  public function __construct() {
67
  parent::__construct();
@@ -123,9 +165,17 @@ HTML;
123
  {
124
  require_once(ABSPATH.'/wp-admin/includes/file.php');
125
 
126
- $download_url = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz';
127
- //$download_url = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz';
 
128
  $download_url = apply_filters('geoip_detect2_download_url', $download_url);
 
 
 
 
 
 
 
129
 
130
  $outFile = $this->maxmindGetUploadFilename();
131
  $modified = 0;
28
  {
29
  public function getId() { return 'auto'; }
30
  public function getLabel() { return __('Automatic download & update of Maxmind GeoIP Lite City', 'geoip-detect'); }
31
+ public function getShortLabel() { return sprintf(__('%s (updated weekly)', 'geoip-detect'), parent::getShortLabel()); }
32
+ public function getDescriptionHTML() {
33
+ return __('(License: See <a href="https://www.maxmind.com/en/site-license-overview" target="_blank">Site Licence Overview</a> or <a href="https://www.maxmind.com/en/end-user-license-agreement" target="_blank">End User Licence Agreement</a>.)', 'geoip-detect'); }
34
 
35
  public function getStatusInformationHTML() {
36
  $html = parent::getStatusInformationHTML();
46
  $html .= '<br />' . sprintf(__('Next update: %s', 'geoip-detect'), $next_cron_update !== false ? date_i18n($date_format, $next_cron_update) : __('Never', 'geoip-detect'));
47
  $html .= $rescheduled;
48
 
49
+ $html .= $this->updateHTML();
50
+
51
  return $html;
52
  }
53
 
54
  public function getParameterHTML() {
55
+ $key = esc_attr(get_option('geoip-detect-auto_license_key', ''));
56
+
57
+ $label_key = __('License key:', 'geoip-detect');
58
+
59
+ $html = <<<HTML
60
+ $label_key <input type="text" autocomplete="off" size="20" name="options_auto[license_key]" value="$key" /><br />
61
+ HTML;
62
+
63
+ return $html;
64
+ }
65
+
66
+ protected function updateHTML() {
67
+ $html = $error = '';
68
+ $disabled = '';
69
+
70
+ $keyAvailable = !! get_option('geoip-detect-auto_license_key', '');
71
+ if (!$keyAvailable) {
72
+ $error = '<div class="geoip_detect_error" style="margin-top: 10px;">' .
73
+ __('Maxmind Automatic Download only works with a given license key.', 'geoip-detect') .
74
+ '<p>' . sprintf(__('You can signup for a free Maxmind-Account here: <a href="%s" target="_blank">Sign Up</a>.', 'geoip-detect'), 'https://www.maxmind.com/en/geolite2/signup') . '<br>' .
75
+ __('After logging in, generate a license key and copy it to the options below.', 'geoip-detect') . '</p>' .
76
+ '</div>';
77
+ $disabled = ' disabled="disabled"';
78
+ }
79
+
80
  $text_update = __('Update now', 'geoip-detect');
81
  $nonce_field = wp_nonce_field( 'geoip_detect_update' );
82
+ $html .= <<<HTML
83
  <form method="post" action="#">
84
  $nonce_field
85
  <input type="hidden" name="action" value="update" />
86
+ <input type="submit" class="button button-secondary" value="$text_update" $disabled />
87
  </form>
88
  HTML;
89
+ return $html . $error;
90
  }
91
 
92
+ public function saveParameters($post) {
93
+ $message = '';
94
+
95
+ if (isset($post['options_auto']['license_key'])) {
96
+ $key = trim($post['options_auto']['license_key']);
97
+ if (mb_strlen($key) < 16) {
98
+ $message = __('The license key usually is a 16-char alphanumeric string. Are you sure this is the right key? Do not use the "unhashed format" when generating the license key.', 'geoip-detect');
99
+ // Unhashed: 13char alphanumeric
100
+ }
101
+ update_option('geoip-detect-auto_license_key', $key);
102
+ }
103
+
104
+ return $message;
105
+
106
+ }
107
 
108
  public function __construct() {
109
  parent::__construct();
165
  {
166
  require_once(ABSPATH.'/wp-admin/includes/file.php');
167
 
168
+ $download_url = 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&suffix=tar.gz';
169
+ //$download_url = 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&suffix=tar.gz';
170
+
171
  $download_url = apply_filters('geoip_detect2_download_url', $download_url);
172
+ if (strpos($download_url, 'license_key=') === false) {
173
+ $key = get_option('geoip-detect-auto_license_key', '');
174
+ if (!$key) {
175
+ return __('Error: Before updating, you need to enter a license key from maxmind.com.', 'geoip-detect');
176
+ }
177
+ $download_url = add_query_arg('license_key', $key, $download_url);
178
+ }
179
 
180
  $outFile = $this->maxmindGetUploadFilename();
181
  $modified = 0;
data-sources/hostinfo.php CHANGED
@@ -98,7 +98,7 @@ class HostInfoDataSource extends AbstractDataSource {
98
  public function getId() { return 'hostinfo'; }
99
  public function getLabel() { return __('HostIP.info Web-API', 'geoip-detect'); }
100
 
101
- public function getDescriptionHTML() { return __('Free (Licence: GPL)<br />(only English names, does only have the following fields: country name, country ID and city name)', 'geoip-detect'); }
102
  public function getStatusInformationHTML() { return __('You can choose a Maxmind database below.', 'geoip-detect'); }
103
  public function getParameterHTML() { return ''; }
104
 
98
  public function getId() { return 'hostinfo'; }
99
  public function getLabel() { return __('HostIP.info Web-API', 'geoip-detect'); }
100
 
101
+ public function getDescriptionHTML() { return __('Free (Licence: GPL)<br />(only English names, does only have some fields)', 'geoip-detect'); }
102
  public function getStatusInformationHTML() { return __('You can choose a Maxmind database below.', 'geoip-detect'); }
103
  public function getParameterHTML() { return ''; }
104
 
geoip-detect.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.yellowtree.de
5
  Description: Retrieving Geo-Information using the Maxmind GeoIP (Lite) Database.
6
  Author: Yellow Tree (Benjamin Pick)
7
  Author URI: http://www.yellowtree.de
8
- Version: 2.13.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Text Domain: geoip-detect
@@ -16,7 +16,7 @@ Requires WP: 4.0
16
  Requires PHP: 5.6
17
  */
18
 
19
- define('GEOIP_DETECT_VERSION', '2.13.0');
20
 
21
  /*
22
  Copyright 2013-2019 Yellow Tree, Siegen, Germany
5
  Description: Retrieving Geo-Information using the Maxmind GeoIP (Lite) Database.
6
  Author: Yellow Tree (Benjamin Pick)
7
  Author URI: http://www.yellowtree.de
8
+ Version: 3.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Text Domain: geoip-detect
16
  Requires PHP: 5.6
17
  */
18
 
19
+ define('GEOIP_DETECT_VERSION', '3.0');
20
 
21
  /*
22
  Copyright 2013-2019 Yellow Tree, Siegen, Germany
init.php CHANGED
@@ -71,20 +71,13 @@ function geoip_detect_admin_notice_database_missing() {
71
 
72
 
73
  <h3><?php _e( 'GeoIP Detection: No database installed', 'geoip-detect' ); ?></h3>
74
- <p><?php printf(__('The Plugin %s is currently using the Webservice <a href="http://hostip.info" target="_blank">hostip.info</a> as data source. <br />You can click on the button below to download and install Maxmind GeoIPv2 Lite City now.', 'geoip-detect' ), $url); ?></p>
75
- <p><?php printf(__('This database is licenced <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA</a>. See <a href="http://dev.maxmind.com/geoip/geoip2/geolite2/#License">License</a> for details.', 'geoip-detect')); ?>
76
 
77
-
78
-
79
- <form action="options-general.php?page=<?php echo GEOIP_PLUGIN_BASENAME; ?>" method="post">
80
- <?php wp_nonce_field( 'geoip_detect_update' ); ?>
81
- <input type="hidden" name="source" value="auto" />
82
- <input type="hidden" name="action" value="update" />
83
- <p>
84
- <input type="submit" value="<?php esc_attr_e('Install now', 'geoip-detect');?>" class="button button-primary" /> &nbsp;&nbsp;
85
- <a href="?geoip_detect_dismiss_notice=hostinfo_used"><?php _e('Keep using hostip.info', 'geoip-detect'); ?></a>
86
- </p>
87
- </form>
88
  </div>
89
  <?php
90
  }
71
 
72
 
73
  <h3><?php _e( 'GeoIP Detection: No database installed', 'geoip-detect' ); ?></h3>
74
+ <p><?php printf(__('The Plugin %s is currently using the Webservice <a href="http://hostip.info" target="_blank">hostip.info</a> as data source. <br />You can choose a different data source in the options page.', 'geoip-detect' ), $url); ?></p>
75
+ <p><?php printf(__('For comparison of the different options, see <a href="https://github.com/yellowtree/geoip-detect/wiki/FAQ#which-data-source-should-i-choose" target="_blank">Which data source should I choose?</a>.', 'geoip-detect')); ?>
76
 
77
+ <p>
78
+ <a class="button button-primary" href="options-general.php?page=geoip-detect/geoip-detect.php#choose-source"><?php _e('Options', 'geoip-detect'); ?></a>
79
+ <a class="button button-secondary" href="?geoip_detect_dismiss_notice=hostinfo_used"><?php _e('Keep using hostip.info', 'geoip-detect'); ?></a>
80
+ </p>
 
 
 
 
 
 
 
81
  </div>
82
  <?php
83
  }
lib/composer.lock CHANGED
@@ -1,23 +1,23 @@
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
  "content-hash": "689f4cbd126b0807e8268f1cfd775a98",
8
  "packages": [
9
  {
10
  "name": "symfony/http-foundation",
11
- "version": "v4.2.3",
12
  "source": {
13
  "type": "git",
14
  "url": "https://github.com/symfony/http-foundation.git",
15
- "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39"
16
  },
17
  "dist": {
18
  "type": "zip",
19
- "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8d2318b73e0a1bc75baa699d00ebe2ae8b595a39",
20
- "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39",
21
  "shasum": ""
22
  },
23
  "require": {
@@ -58,20 +58,20 @@
58
  ],
59
  "description": "Symfony HttpFoundation Component",
60
  "homepage": "https://symfony.com",
61
- "time": "2019-01-29T09:49:29+00:00"
62
  },
63
  {
64
  "name": "symfony/polyfill-mbstring",
65
- "version": "v1.10.0",
66
  "source": {
67
  "type": "git",
68
  "url": "https://github.com/symfony/polyfill-mbstring.git",
69
- "reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
70
  },
71
  "dist": {
72
  "type": "zip",
73
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
74
- "reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
75
  "shasum": ""
76
  },
77
  "require": {
@@ -83,7 +83,7 @@
83
  "type": "library",
84
  "extra": {
85
  "branch-alias": {
86
- "dev-master": "1.9-dev"
87
  }
88
  },
89
  "autoload": {
@@ -117,7 +117,7 @@
117
  "portable",
118
  "shim"
119
  ],
120
- "time": "2018-09-21T13:07:52+00:00"
121
  }
122
  ],
123
  "packages-dev": [],
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#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
  "content-hash": "689f4cbd126b0807e8268f1cfd775a98",
8
  "packages": [
9
  {
10
  "name": "symfony/http-foundation",
11
+ "version": "v4.2.12",
12
  "source": {
13
  "type": "git",
14
  "url": "https://github.com/symfony/http-foundation.git",
15
+ "reference": "2ae778ff4a1f8baba7724db1ca977ada3b796749"
16
  },
17
  "dist": {
18
  "type": "zip",
19
+ "url": "https://api.github.com/repos/symfony/http-foundation/zipball/2ae778ff4a1f8baba7724db1ca977ada3b796749",
20
+ "reference": "2ae778ff4a1f8baba7724db1ca977ada3b796749",
21
  "shasum": ""
22
  },
23
  "require": {
58
  ],
59
  "description": "Symfony HttpFoundation Component",
60
  "homepage": "https://symfony.com",
61
+ "time": "2019-11-11T12:54:47+00:00"
62
  },
63
  {
64
  "name": "symfony/polyfill-mbstring",
65
+ "version": "v1.13.1",
66
  "source": {
67
  "type": "git",
68
  "url": "https://github.com/symfony/polyfill-mbstring.git",
69
+ "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
70
  },
71
  "dist": {
72
  "type": "zip",
73
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
74
+ "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
75
  "shasum": ""
76
  },
77
  "require": {
83
  "type": "library",
84
  "extra": {
85
  "branch-alias": {
86
+ "dev-master": "1.13-dev"
87
  }
88
  },
89
  "autoload": {
117
  "portable",
118
  "shim"
119
  ],
120
+ "time": "2019-11-27T14:18:11+00:00"
121
  }
122
  ],
123
  "packages-dev": [],
readme.txt CHANGED
@@ -25,10 +25,10 @@ as a shortcode, or via CSS body classes. The city & country names are translated
25
  * `geoip_detect2_get_external_ip_adress()`: Fetch the internet adress of the webserver
26
  * `geoip_detect2_get_client_ip()`: Get client IP (even if it is behind a reverse proxy)
27
  * You can use one of these data sources (see [comparison](https://github.com/yellowtree/geoip-detect/wiki/FAQ#which-data-source-should-i-choose)):
28
- * Free: [Maxmind GeoIP2 Lite City](http://dev.maxmind.com/geoip/geoip2/geolite2/), automatically updated every month (licensed CC BY-SA. See [FAQ](https://github.com/yellowtree/geoip-detect/wiki/FAQ).)
 
29
  * Commercial: [Maxmind GeoIP2 City](https://www.maxmind.com/en/geoip2-country-database) or [Maxmind GeoIP2 Country](https://www.maxmind.com/en/geoip2-city)
30
  * Commercial Web-API: [Maxmind GeoIP2 Precision](https://www.maxmind.com/en/geoip2-precision-services) (City, Country or Insights)
31
- * Free (default source): [HostIP.info](http://www.hostip.info/) (IPv4 only)
32
  * Hosting-Provider dependent: [Cloudflare](https://support.cloudflare.com/hc/en-us/articles/200168236-What-does-CloudFlare-IP-Geolocation-do-) or [Amazon AWS CloudFront](https://aws.amazon.com/blogs/aws/enhanced-cloudfront-customization/) (Country)
33
  * Free or Commercial Web-API: [Ipstack](https://ipstack.com)
34
  * For the property names, see the results of a specific IP in the wordpress backend (under *Tools > GeoIP Detection*).
@@ -82,10 +82,12 @@ Does `geoip_detect2_get_info_from_current_ip()` return the same country, regardl
82
 
83
  [Can I change the time period how long the data is cached?](https://github.com/yellowtree/geoip-detect/wiki/FAQ#can-i-change-the-time-period-how-long-the-data-is-cached)
84
 
85
- [The Maxmind Lite databases are licensed Creative Commons ShareAlike-Attribution. When do I need to give attribution?](https://github.com/yellowtree/geoip-detect/wiki/FAQ#the-maxmind-lite-databases-are-licensed-creative-commons-sharealike-attribution-when-do-i-need-to-give-attribution)
86
 
87
  [Does this plugin work in a MultiSite-Network environment?](https://github.com/yellowtree/geoip-detect/wiki/FAQ#does-this-plugin-work-in-a-multisite-network-environment)
88
 
 
 
89
  [What do you mean by "This plugin is charity-ware"?](https://github.com/yellowtree/geoip-detect/wiki/FAQ#what-do-you-mean-by-this-plugin-is-charity-ware)
90
 
91
  **Further documentation**
@@ -109,6 +111,10 @@ Does `geoip_detect2_get_info_from_current_ip()` return the same country, regardl
109
 
110
  == Upgrade Notice ==
111
 
 
 
 
 
112
  = 2.13.0 =
113
 
114
  PHP 5.6 is required now. If you are using the AJAX mode, this version will drastically reduce the number of requests as it will store the visitor's geo-information in a cookie.
@@ -136,6 +142,14 @@ New: Shortcode for showing/hiding content!
136
 
137
  == Changelog ==
138
 
 
 
 
 
 
 
 
 
139
  = 2.13 =
140
  * NEW: JS/AJAX mode now caches the response as a cookie so that every user only needs to call the AJAX requests once
141
  * NEW: If you install the plugin [SVG Flags](https://wordpress.org/plugins/svg-flags-lite/), you can use this shortcode to show the flag of the current country: `[geoip_detect2_current_flag]`. See [Documentation](https://github.com/yellowtree/geoip-detect/wiki/API:-Shortcodes#add-a-flag-of-the-visitors-country) for more infos.
25
  * `geoip_detect2_get_external_ip_adress()`: Fetch the internet adress of the webserver
26
  * `geoip_detect2_get_client_ip()`: Get client IP (even if it is behind a reverse proxy)
27
  * You can use one of these data sources (see [comparison](https://github.com/yellowtree/geoip-detect/wiki/FAQ#which-data-source-should-i-choose)):
28
+ * Free (default source): [HostIP.info](http://www.hostip.info/) (IPv4 only)
29
+ * Free with registration: [Maxmind GeoIP2 Lite City](http://dev.maxmind.com/geoip/geoip2/geolite2/), automatically updated weekly
30
  * Commercial: [Maxmind GeoIP2 City](https://www.maxmind.com/en/geoip2-country-database) or [Maxmind GeoIP2 Country](https://www.maxmind.com/en/geoip2-city)
31
  * Commercial Web-API: [Maxmind GeoIP2 Precision](https://www.maxmind.com/en/geoip2-precision-services) (City, Country or Insights)
 
32
  * Hosting-Provider dependent: [Cloudflare](https://support.cloudflare.com/hc/en-us/articles/200168236-What-does-CloudFlare-IP-Geolocation-do-) or [Amazon AWS CloudFront](https://aws.amazon.com/blogs/aws/enhanced-cloudfront-customization/) (Country)
33
  * Free or Commercial Web-API: [Ipstack](https://ipstack.com)
34
  * For the property names, see the results of a specific IP in the wordpress backend (under *Tools > GeoIP Detection*).
82
 
83
  [Can I change the time period how long the data is cached?](https://github.com/yellowtree/geoip-detect/wiki/FAQ#can-i-change-the-time-period-how-long-the-data-is-cached)
84
 
85
+ [The Maxmind Lite databases are restricted by an EULA. Can I host a form where users can look-up the geographic information of an IP?](https://github.com/yellowtree/geoip-detect/wiki/FAQ#the-maxmind-lite-databases-are-restricted-by-an-eula-can-i-host-a-form-where-users-can-look-up-the-geographic-information-of-an-ip)
86
 
87
  [Does this plugin work in a MultiSite-Network environment?](https://github.com/yellowtree/geoip-detect/wiki/FAQ#does-this-plugin-work-in-a-multisite-network-environment)
88
 
89
+ [Is this plugin GDPR-compliant?](https://github.com/yellowtree/geoip-detect/wiki/FAQ#is-this-plugin-gdpr-compliant)
90
+
91
  [What do you mean by "This plugin is charity-ware"?](https://github.com/yellowtree/geoip-detect/wiki/FAQ#what-do-you-mean-by-this-plugin-is-charity-ware)
92
 
93
  **Further documentation**
111
 
112
  == Upgrade Notice ==
113
 
114
+ = 3.0 =
115
+
116
+ If you use Maxmind "Automatic download" then you need to upgrade to this plugin version in order to continue to receive database update. The Database licence changed and you will need to register at their website and agree to the EULA.
117
+
118
  = 2.13.0 =
119
 
120
  PHP 5.6 is required now. If you are using the AJAX mode, this version will drastically reduce the number of requests as it will store the visitor's geo-information in a cookie.
142
 
143
  == Changelog ==
144
 
145
+ = 3.0 =
146
+ * MAJOR CHANGE: Due to legal reasons, Maxmind now requires registration and some use cases are no longer allowed with the free data. If you use the Maxmind data source with automatic update, the update will fail for versions < 3.0 or if you have not entered a license key yet.
147
+ * Updated the Maxmind update mechanism
148
+ * Updated Maxmind vendor code
149
+
150
+ The code of the plugin has not changed much, I have named this version 3.0 to indicate the major change on Maxmind's side of things. They explain it in this blog post:
151
+ https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/
152
+
153
  = 2.13 =
154
  * NEW: JS/AJAX mode now caches the response as a cookie so that every user only needs to call the AJAX requests once
155
  * NEW: If you install the plugin [SVG Flags](https://wordpress.org/plugins/svg-flags-lite/), you can use this shortcode to show the flag of the current country: `[geoip_detect2_current_flag]`. See [Documentation](https://github.com/yellowtree/geoip-detect/wiki/API:-Shortcodes#add-a-flag-of-the-visitors-country) for more infos.
vendor/composer/ClassLoader.php CHANGED
@@ -377,11 +377,11 @@ class ClassLoader
377
  $subPath = $class;
378
  while (false !== $lastPos = strrpos($subPath, '\\')) {
379
  $subPath = substr($subPath, 0, $lastPos);
380
- $search = $subPath . '\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
382
- $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
- if (file_exists($file = $dir . $pathEnd)) {
 
385
  return $file;
386
  }
387
  }
377
  $subPath = $class;
378
  while (false !== $lastPos = strrpos($subPath, '\\')) {
379
  $subPath = substr($subPath, 0, $lastPos);
380
+ $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
 
382
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
383
+ $length = $this->prefixLengthsPsr4[$first][$search];
384
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
385
  return $file;
386
  }
387
  }
vendor/composer/ca-bundle/composer.json CHANGED
@@ -29,7 +29,7 @@
29
  "require-dev": {
30
  "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
31
  "psr/log": "^1.0",
32
- "symfony/process": "^2.5 || ^3.0 || ^4.0"
33
  },
34
  "autoload": {
35
  "psr-4": {
29
  "require-dev": {
30
  "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
31
  "psr/log": "^1.0",
32
+ "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0"
33
  },
34
  "autoload": {
35
  "psr-4": {
vendor/composer/ca-bundle/res/cacert.pem CHANGED
@@ -1,7 +1,7 @@
1
  ##
2
  ## Bundle of CA Root Certificates
3
  ##
4
- ## Certificate data from Mozilla as of: Wed Aug 28 03:12:10 2019 GMT
5
  ##
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -14,7 +14,7 @@
14
  ## Just configure this file as the SSLCACertificateFile.
15
  ##
16
  ## Conversion done with mk-ca-bundle.pl version 1.27.
17
- ## SHA256: fffa309937c3be940649293f749b8207fabc6eb224e50e4bb3f2c5e44e0d6a6b
18
  ##
19
 
20
 
@@ -592,28 +592,6 @@ mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
592
  vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
593
  -----END CERTIFICATE-----
594
 
595
- Certplus Class 2 Primary CA
596
- ===========================
597
- -----BEGIN CERTIFICATE-----
598
- MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
599
- BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
600
- OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
601
- dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
602
- ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
603
- 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
604
- Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
605
- YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
606
- e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
607
- CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
608
- YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
609
- L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
610
- P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
611
- TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
612
- 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
613
- //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
614
- l7+ijrRU
615
- -----END CERTIFICATE-----
616
-
617
  DST Root CA X3
618
  ==============
619
  -----BEGIN CERTIFICATE-----
@@ -921,28 +899,6 @@ PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
921
  WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
922
  -----END CERTIFICATE-----
923
 
924
- Deutsche Telekom Root CA 2
925
- ==========================
926
- -----BEGIN CERTIFICATE-----
927
- MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
928
- RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
929
- A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
930
- MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
931
- A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
932
- b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
933
- bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
934
- KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
935
- AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
936
- Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
937
- jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
938
- HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
939
- E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
940
- zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
941
- rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
942
- dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
943
- Cm26OWMohpLzGITY+9HPBVZkVw==
944
- -----END CERTIFICATE-----
945
-
946
  Cybertrust Global Root
947
  ======================
948
  -----BEGIN CERTIFICATE-----
1
  ##
2
  ## Bundle of CA Root Certificates
3
  ##
4
+ ## Certificate data from Mozilla as of: Wed Nov 27 04:12:10 2019 GMT
5
  ##
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
14
  ## Just configure this file as the SSLCACertificateFile.
15
  ##
16
  ## Conversion done with mk-ca-bundle.pl version 1.27.
17
+ ## SHA256: 607309057d0ec70f8e4e97b03906bafb2fcebb24cd37b5e8293e681ae26ceae0
18
  ##
19
 
20
 
592
  vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
593
  -----END CERTIFICATE-----
594
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
595
  DST Root CA X3
596
  ==============
597
  -----BEGIN CERTIFICATE-----
899
  WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
900
  -----END CERTIFICATE-----
901
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
902
  Cybertrust Global Root
903
  ======================
904
  -----BEGIN CERTIFICATE-----
vendor/composer/ca-bundle/src/CaBundle.php CHANGED
@@ -92,6 +92,7 @@ class CaBundle
92
  '/etc/ssl/cert.pem', // OpenBSD
93
  '/usr/local/etc/ssl/cert.pem', // FreeBSD 10.x
94
  '/usr/local/etc/openssl/cert.pem', // OS X homebrew, openssl package
 
95
  );
96
 
97
  foreach($otherLocations as $location) {
92
  '/etc/ssl/cert.pem', // OpenBSD
93
  '/usr/local/etc/ssl/cert.pem', // FreeBSD 10.x
94
  '/usr/local/etc/openssl/cert.pem', // OS X homebrew, openssl package
95
+ '/usr/local/etc/openssl@1.1/cert.pem', // OS X homebrew, openssl@1.1 package
96
  );
97
 
98
  foreach($otherLocations as $location) {
vendor/composer/installed.json CHANGED
@@ -1,17 +1,17 @@
1
  [
2
  {
3
  "name": "composer/ca-bundle",
4
- "version": "1.2.4",
5
- "version_normalized": "1.2.4.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/ca-bundle.git",
9
- "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/10bb96592168a0f8e8f6dcde3532d9fa50b0b527",
14
- "reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527",
15
  "shasum": ""
16
  },
17
  "require": {
@@ -22,9 +22,9 @@
22
  "require-dev": {
23
  "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
24
  "psr/log": "^1.0",
25
- "symfony/process": "^2.5 || ^3.0 || ^4.0"
26
  },
27
- "time": "2019-08-30T08:44:50+00:00",
28
  "type": "library",
29
  "extra": {
30
  "branch-alias": {
@@ -58,36 +58,38 @@
58
  ]
59
  },
60
  {
61
- "name": "geoip2/geoip2",
62
- "version": "v2.9.0",
63
- "version_normalized": "2.9.0.0",
64
  "source": {
65
  "type": "git",
66
- "url": "https://github.com/maxmind/GeoIP2-php.git",
67
- "reference": "a807fbf65212eef5d8d2db1a1b31082b53633d77"
68
  },
69
  "dist": {
70
  "type": "zip",
71
- "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/a807fbf65212eef5d8d2db1a1b31082b53633d77",
72
- "reference": "a807fbf65212eef5d8d2db1a1b31082b53633d77",
73
  "shasum": ""
74
  },
75
  "require": {
76
- "maxmind-db/reader": "~1.0",
77
- "maxmind/web-service-common": "~0.5",
78
- "php": ">=5.4"
 
79
  },
80
  "require-dev": {
81
  "friendsofphp/php-cs-fixer": "2.*",
82
- "phpunit/phpunit": "4.*",
83
  "squizlabs/php_codesniffer": "3.*"
84
  },
85
- "time": "2018-04-10T15:32:59+00:00",
86
  "type": "library",
87
  "installation-source": "dist",
88
  "autoload": {
89
  "psr-4": {
90
- "GeoIp2\\": "src"
 
91
  }
92
  },
93
  "notification-url": "https://packagist.org/downloads/",
@@ -96,39 +98,34 @@
96
  ],
97
  "authors": [
98
  {
99
- "name": "Gregory J. Oschwald",
100
- "email": "goschwald@maxmind.com",
101
- "homepage": "http://www.maxmind.com/"
102
  }
103
  ],
104
- "description": "MaxMind GeoIP2 PHP API",
105
- "homepage": "https://github.com/maxmind/GeoIP2-php",
106
- "keywords": [
107
- "IP",
108
- "geoip",
109
- "geoip2",
110
- "geolocation",
111
- "maxmind"
112
- ]
113
  },
114
  {
115
  "name": "maxmind-db/reader",
116
- "version": "v1.5.0",
117
- "version_normalized": "1.5.0.0",
118
  "source": {
119
  "type": "git",
120
  "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
121
- "reference": "bd436094fc0a9b0558a899fb80b0ae34fe1808a0"
122
  },
123
  "dist": {
124
  "type": "zip",
125
- "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/bd436094fc0a9b0558a899fb80b0ae34fe1808a0",
126
- "reference": "bd436094fc0a9b0558a899fb80b0ae34fe1808a0",
127
  "shasum": ""
128
  },
129
  "require": {
130
  "php": ">=5.6"
131
  },
 
 
 
132
  "require-dev": {
133
  "friendsofphp/php-cs-fixer": "2.*",
134
  "php-coveralls/php-coveralls": "^2.1",
@@ -141,7 +138,7 @@
141
  "ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
142
  "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
143
  },
144
- "time": "2019-09-30T22:56:38+00:00",
145
  "type": "library",
146
  "installation-source": "dist",
147
  "autoload": {
@@ -171,38 +168,37 @@
171
  ]
172
  },
173
  {
174
- "name": "maxmind/web-service-common",
175
- "version": "v0.5.0",
176
- "version_normalized": "0.5.0.0",
177
  "source": {
178
  "type": "git",
179
- "url": "https://github.com/maxmind/web-service-common-php.git",
180
- "reference": "61a9836fa3bb1743ab89752bae5005d71e78c73b"
181
  },
182
  "dist": {
183
  "type": "zip",
184
- "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/61a9836fa3bb1743ab89752bae5005d71e78c73b",
185
- "reference": "61a9836fa3bb1743ab89752bae5005d71e78c73b",
186
  "shasum": ""
187
  },
188
  "require": {
189
- "composer/ca-bundle": "^1.0.3",
190
- "ext-curl": "*",
191
  "ext-json": "*",
192
- "php": ">=5.4"
 
 
193
  },
194
  "require-dev": {
195
  "friendsofphp/php-cs-fixer": "2.*",
196
- "phpunit/phpunit": "4.*",
197
  "squizlabs/php_codesniffer": "3.*"
198
  },
199
- "time": "2018-02-12T22:31:54+00:00",
200
  "type": "library",
201
  "installation-source": "dist",
202
  "autoload": {
203
  "psr-4": {
204
- "MaxMind\\Exception\\": "src/Exception",
205
- "MaxMind\\WebService\\": "src/WebService"
206
  }
207
  },
208
  "notification-url": "https://packagist.org/downloads/",
@@ -211,11 +207,19 @@
211
  ],
212
  "authors": [
213
  {
214
- "name": "Gregory Oschwald",
215
- "email": "goschwald@maxmind.com"
 
216
  }
217
  ],
218
- "description": "Internal MaxMind Web Service API",
219
- "homepage": "https://github.com/maxmind/web-service-common-php"
 
 
 
 
 
 
 
220
  }
221
  ]
1
  [
2
  {
3
  "name": "composer/ca-bundle",
4
+ "version": "1.2.5",
5
+ "version_normalized": "1.2.5.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/composer/ca-bundle.git",
9
+ "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/62e8fc2dc550e5d6d8c9360c7721662670f58149",
14
+ "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149",
15
  "shasum": ""
16
  },
17
  "require": {
22
  "require-dev": {
23
  "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
24
  "psr/log": "^1.0",
25
+ "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0"
26
  },
27
+ "time": "2019-12-11T14:44:42+00:00",
28
  "type": "library",
29
  "extra": {
30
  "branch-alias": {
58
  ]
59
  },
60
  {
61
+ "name": "maxmind/web-service-common",
62
+ "version": "v0.6.0",
63
+ "version_normalized": "0.6.0.0",
64
  "source": {
65
  "type": "git",
66
+ "url": "https://github.com/maxmind/web-service-common-php.git",
67
+ "reference": "40c928bb0194c45088b369a17f9baef9c3fc7460"
68
  },
69
  "dist": {
70
  "type": "zip",
71
+ "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/40c928bb0194c45088b369a17f9baef9c3fc7460",
72
+ "reference": "40c928bb0194c45088b369a17f9baef9c3fc7460",
73
  "shasum": ""
74
  },
75
  "require": {
76
+ "composer/ca-bundle": "^1.0.3",
77
+ "ext-curl": "*",
78
+ "ext-json": "*",
79
+ "php": ">=5.6"
80
  },
81
  "require-dev": {
82
  "friendsofphp/php-cs-fixer": "2.*",
83
+ "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0",
84
  "squizlabs/php_codesniffer": "3.*"
85
  },
86
+ "time": "2019-12-12T15:56:05+00:00",
87
  "type": "library",
88
  "installation-source": "dist",
89
  "autoload": {
90
  "psr-4": {
91
+ "MaxMind\\Exception\\": "src/Exception",
92
+ "MaxMind\\WebService\\": "src/WebService"
93
  }
94
  },
95
  "notification-url": "https://packagist.org/downloads/",
98
  ],
99
  "authors": [
100
  {
101
+ "name": "Gregory Oschwald",
102
+ "email": "goschwald@maxmind.com"
 
103
  }
104
  ],
105
+ "description": "Internal MaxMind Web Service API",
106
+ "homepage": "https://github.com/maxmind/web-service-common-php"
 
 
 
 
 
 
 
107
  },
108
  {
109
  "name": "maxmind-db/reader",
110
+ "version": "v1.6.0",
111
+ "version_normalized": "1.6.0.0",
112
  "source": {
113
  "type": "git",
114
  "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
115
+ "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4"
116
  },
117
  "dist": {
118
  "type": "zip",
119
+ "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/febd4920bf17c1da84cef58e56a8227dfb37fbe4",
120
+ "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4",
121
  "shasum": ""
122
  },
123
  "require": {
124
  "php": ">=5.6"
125
  },
126
+ "conflict": {
127
+ "ext-maxminddb": "<1.6.0,>=2.0.0"
128
+ },
129
  "require-dev": {
130
  "friendsofphp/php-cs-fixer": "2.*",
131
  "php-coveralls/php-coveralls": "^2.1",
138
  "ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
139
  "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
140
  },
141
+ "time": "2019-12-19T22:59:03+00:00",
142
  "type": "library",
143
  "installation-source": "dist",
144
  "autoload": {
168
  ]
169
  },
170
  {
171
+ "name": "geoip2/geoip2",
172
+ "version": "v2.10.0",
173
+ "version_normalized": "2.10.0.0",
174
  "source": {
175
  "type": "git",
176
+ "url": "https://github.com/maxmind/GeoIP2-php.git",
177
+ "reference": "419557cd21d9fe039721a83490701a58c8ce784a"
178
  },
179
  "dist": {
180
  "type": "zip",
181
+ "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/419557cd21d9fe039721a83490701a58c8ce784a",
182
+ "reference": "419557cd21d9fe039721a83490701a58c8ce784a",
183
  "shasum": ""
184
  },
185
  "require": {
 
 
186
  "ext-json": "*",
187
+ "maxmind-db/reader": "~1.5",
188
+ "maxmind/web-service-common": "~0.6",
189
+ "php": ">=5.6"
190
  },
191
  "require-dev": {
192
  "friendsofphp/php-cs-fixer": "2.*",
193
+ "phpunit/phpunit": "5.*",
194
  "squizlabs/php_codesniffer": "3.*"
195
  },
196
+ "time": "2019-12-12T18:48:39+00:00",
197
  "type": "library",
198
  "installation-source": "dist",
199
  "autoload": {
200
  "psr-4": {
201
+ "GeoIp2\\": "src"
 
202
  }
203
  },
204
  "notification-url": "https://packagist.org/downloads/",
207
  ],
208
  "authors": [
209
  {
210
+ "name": "Gregory J. Oschwald",
211
+ "email": "goschwald@maxmind.com",
212
+ "homepage": "https://www.maxmind.com/"
213
  }
214
  ],
215
+ "description": "MaxMind GeoIP2 PHP API",
216
+ "homepage": "https://github.com/maxmind/GeoIP2-php",
217
+ "keywords": [
218
+ "IP",
219
+ "geoip",
220
+ "geoip2",
221
+ "geolocation",
222
+ "maxmind"
223
+ ]
224
  }
225
  ]
vendor/geoip2/geoip2/CHANGELOG.md CHANGED
@@ -1,6 +1,26 @@
1
  CHANGELOG
2
  =========
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  2.9.0 (2018-04-10)
5
  ------------------
6
 
1
  CHANGELOG
2
  =========
3
 
4
+ 2.10.0 (2019-12-12)
5
+ -------------------
6
+
7
+ * PHP 5.6 or greater is now required.
8
+ * The `network` property was added to `GeoIp2\Record\Traits`,
9
+ `GeoIp2\Model\AnonymousIp`, `GeoIp2\Model\Asn`,
10
+ `GeoIp2\Model\ConnectionType`, `Geoip2\Model\Domain`,
11
+ and `GeoIp2\Model\Isp`. This is a string in CIDR format representing the
12
+ largest network where all of the properties besides `ipAddress` have the
13
+ same value.
14
+ * Updated documentation of anonymizer properties - `isAnonymousVpn`
15
+ and `isHostingProvider` - to be more descriptive.
16
+ * The `userCount` property was added to `GeoIp2\Record\Traits`. This is an
17
+ integer which indicates the estimated number of users sharing the
18
+ IP/network during the past 24 hours. This output is available from GeoIP2
19
+ Precision Insights.
20
+ * The `staticIpScore` property was added to `GeoIp2\Record\Traits`. This is
21
+ a float which indicates how static or dynamic an IP address is. This
22
+ output is available from GeoIP2 Precision Insights.
23
+
24
  2.9.0 (2018-04-10)
25
  ------------------
26
 
vendor/geoip2/geoip2/README.md CHANGED
@@ -3,14 +3,14 @@
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
 
@@ -46,18 +46,18 @@ require 'vendor/autoload.php';
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
@@ -140,6 +140,8 @@ print($record->postal->code . "\n"); // '55455'
140
  print($record->location->latitude . "\n"); // 44.9733
141
  print($record->location->longitude . "\n"); // -93.2323
142
 
 
 
143
  ```
144
 
145
  ### Anonymous IP Example ###
@@ -157,6 +159,7 @@ $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
 
@@ -175,6 +178,7 @@ $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
 
@@ -193,6 +197,7 @@ $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
 
@@ -228,6 +233,8 @@ 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 ###
@@ -249,6 +256,7 @@ 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
 
@@ -299,6 +307,8 @@ print($record->postal->code . "\n"); // '55455'
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 ##
@@ -326,7 +336,7 @@ 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`
@@ -334,7 +344,7 @@ 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.
@@ -351,10 +361,10 @@ the GeoNames premium data set.
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
@@ -363,7 +373,7 @@ 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
 
@@ -372,12 +382,11 @@ Please report all issues with this code using the
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
 
@@ -391,11 +400,10 @@ 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-2019 by MaxMind, Inc.
399
 
400
  This is free software, licensed under the Apache License, Version 2.0.
401
-
3
  ## Description ##
4
 
5
  This package provides an API for the GeoIP2
6
+ [web services](https://dev.maxmind.com/geoip/geoip2/web-services) and
7
+ [databases](https://dev.maxmind.com/geoip/geoip2/downloadable). The API also
8
  works with the free
9
+ [GeoLite2 databases](https://dev.maxmind.com/geoip/geoip2/geolite2/).
10
 
11
  ## Install via Composer ##
12
 
13
+ We recommend installing this package with [Composer](https://getcomposer.org/).
14
 
15
  ### Download Composer ###
16
 
46
  ## Install via Phar ##
47
 
48
  Although we strongly recommend using Composer, we also provide a
49
+ [phar archive](https://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](https://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](https://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
140
  print($record->location->latitude . "\n"); // 44.9733
141
  print($record->location->longitude . "\n"); // -93.2323
142
 
143
+ print($record->traits->network . "\n"); // '128.101.101.101/32'
144
+
145
  ```
146
 
147
  ### Anonymous IP Example ###
159
 
160
  if ($record->isAnonymous) { print "anon\n"; }
161
  print($record->ipAddress . "\n"); // '128.101.101.101'
162
+ print($record->network . "\n"); // '128.101.101.101/32'
163
 
164
  ```
165
 
178
 
179
  print($record->connectionType . "\n"); // 'Corporate'
180
  print($record->ipAddress . "\n"); // '128.101.101.101'
181
+ print($record->network . "\n"); // '128.101.101.101/32'
182
 
183
  ```
184
 
197
 
198
  print($record->domain . "\n"); // 'umn.edu'
199
  print($record->ipAddress . "\n"); // '128.101.101.101'
200
+ print($record->network . "\n"); // '128.101.101.101/32'
201
 
202
  ```
203
 
233
  print($record->location->latitude . "\n"); // 44.9733
234
  print($record->location->longitude . "\n"); // -93.2323
235
 
236
+ print($record->traits->network . "\n"); // '128.101.101.101/32'
237
+
238
  ```
239
 
240
  ### ISP Example ###
256
  print($record->organization . "\n"); // 'University of Minnesota'
257
 
258
  print($record->ipAddress . "\n"); // '128.101.101.101'
259
+ print($record->network . "\n"); // '128.101.101.101/32'
260
 
261
  ```
262
 
307
  print($record->location->latitude . "\n"); // 44.9733
308
  print($record->location->longitude . "\n"); // -93.2323
309
 
310
+ print($record->traits->network . "\n"); // '128.101.101.101/32'
311
+
312
  ```
313
 
314
  ## Values to use for Database or Array Keys ##
336
  where some or all of the attributes are unpopulated.
337
 
338
  See the
339
+ [GeoIP2 Precision web service docs](https://dev.maxmind.com/geoip/geoip2/web-services)
340
  for details on what data each end point may return.
341
 
342
  The only piece of data which is always returned is the `ipAddress`
344
 
345
  ## Integration with GeoNames ##
346
 
347
+ [GeoNames](https://www.geonames.org/) offers web services and downloadable
348
  databases with data on geographical features around the world, including
349
  populated places. They offer both free and paid premium data. Each
350
  feature is unique identified by a `geonameId`, which is an integer.
361
 
362
  If the problem you find is that an IP address is incorrectly mapped,
363
  please
364
+ [submit your correction to MaxMind](https://www.maxmind.com/en/correction).
365
 
366
  If you find some other sort of mistake, like an incorrect spelling,
367
+ please check the [GeoNames site](https://www.geonames.org/) first. Once
368
  you've searched for a place and found it on the GeoNames map view, there
369
  are a number of links you can use to correct data ("move", "edit",
370
  "alternate names", etc.). Once the correction is part of the GeoNames
373
 
374
  If you are a paying MaxMind customer and you're not sure where to submit
375
  a correction, please
376
+ [contact MaxMind support](https://www.maxmind.com/en/support) for help.
377
 
378
  ## Other Support ##
379
 
382
 
383
  If you are having an issue with a MaxMind service that is not specific
384
  to the client API, please see
385
+ [our support page](https://www.maxmind.com/en/support).
386
 
387
  ## Requirements ##
388
 
389
+ This library requires PHP 5.6 or greater.
 
390
 
391
  This library also relies on the [MaxMind DB Reader](https://github.com/maxmind/MaxMind-DB-Reader-php).
392
 
400
 
401
  ## Versioning ##
402
 
403
+ The GeoIP2 PHP API uses [Semantic Versioning](https://semver.org/).
404
 
405
  ## Copyright and License ##
406
 
407
  This software is Copyright (c) 2013-2019 by MaxMind, Inc.
408
 
409
  This is free software, licensed under the Apache License, Version 2.0.
 
vendor/geoip2/geoip2/composer.json CHANGED
@@ -9,17 +9,18 @@
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.5",
18
- "php": ">=5.4"
 
19
  },
20
  "require-dev": {
21
  "friendsofphp/php-cs-fixer": "2.*",
22
- "phpunit/phpunit": "4.*",
23
  "squizlabs/php_codesniffer": "3.*"
24
  },
25
  "autoload": {
9
  {
10
  "name": "Gregory J. Oschwald",
11
  "email": "goschwald@maxmind.com",
12
+ "homepage": "https://www.maxmind.com/"
13
  }
14
  ],
15
  "require": {
16
+ "maxmind-db/reader": "~1.5",
17
+ "maxmind/web-service-common": "~0.6",
18
+ "php": ">=5.6",
19
+ "ext-json": "*"
20
  },
21
  "require-dev": {
22
  "friendsofphp/php-cs-fixer": "2.*",
23
+ "phpunit/phpunit": "5.*",
24
  "squizlabs/php_codesniffer": "3.*"
25
  },
26
  "autoload": {
vendor/geoip2/geoip2/examples/benchmark.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require __DIR__ . '/../vendor/autoload.php';
4
+
5
+ use GeoIp2\Database\Reader;
6
+
7
+ srand(0);
8
+
9
+ $reader = new Reader('GeoIP2-City.mmdb');
10
+ $count = 500000;
11
+ $startTime = microtime(true);
12
+ for ($i = 0; $i < $count; ++$i) {
13
+ $ip = long2ip(rand(0, pow(2, 32) - 1));
14
+ try {
15
+ $t = $reader->city($ip);
16
+ } catch (\GeoIp2\Exception\AddressNotFoundException $e) {
17
+ }
18
+ if ($i % 10000 === 0) {
19
+ echo $i . ' ' . $ip . "\n";
20
+ }
21
+ }
22
+ $endTime = microtime(true);
23
+
24
+ $duration = $endTime - $startTime;
25
+ echo 'Requests per second: ' . $count / $duration . "\n";
vendor/geoip2/geoip2/src/Database/Reader.php CHANGED
@@ -34,6 +34,7 @@ use MaxMind\Db\Reader\InvalidDatabaseException;
34
  class Reader implements ProviderInterface
35
  {
36
  private $dbReader;
 
37
  private $locales;
38
 
39
  /**
@@ -51,6 +52,7 @@ class Reader implements ProviderInterface
51
  $locales = ['en']
52
  ) {
53
  $this->dbReader = new DbReader($filename);
 
54
  $this->locales = $locales;
55
  }
56
 
@@ -212,9 +214,11 @@ class Reader implements ProviderInterface
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);
@@ -222,9 +226,10 @@ class Reader implements ProviderInterface
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);
@@ -232,20 +237,19 @@ class Reader implements ProviderInterface
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
@@ -255,11 +259,11 @@ class Reader implements ProviderInterface
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
  /**
34
  class Reader implements ProviderInterface
35
  {
36
  private $dbReader;
37
+ private $dbType;
38
  private $locales;
39
 
40
  /**
52
  $locales = ['en']
53
  ) {
54
  $this->dbReader = new DbReader($filename);
55
+ $this->dbType = $this->dbReader->metadata()->databaseType;
56
  $this->locales = $locales;
57
  }
58
 
214
 
215
  private function modelFor($class, $type, $ipAddress)
216
  {
217
+ list($record, $prefixLen) = $this->getRecord($class, $type, $ipAddress);
218
 
219
  $record['traits']['ip_address'] = $ipAddress;
220
+ $record['traits']['prefix_len'] = $prefixLen;
221
+
222
  $class = 'GeoIp2\\Model\\' . $class;
223
 
224
  return new $class($record, $this->locales);
226
 
227
  private function flatModelFor($class, $type, $ipAddress)
228
  {
229
+ list($record, $prefixLen) = $this->getRecord($class, $type, $ipAddress);
230
 
231
  $record['ip_address'] = $ipAddress;
232
+ $record['prefix_len'] = $prefixLen;
233
  $class = 'GeoIp2\\Model\\' . $class;
234
 
235
  return new $class($record);
237
 
238
  private function getRecord($class, $type, $ipAddress)
239
  {
240
+ if (strpos($this->dbType, $type) === false) {
241
  $method = lcfirst($class);
242
  throw new \BadMethodCallException(
243
+ "The $method method cannot be used to open a {$this->dbType} database"
 
244
  );
245
  }
246
+ list($record, $prefixLen) = $this->dbReader->getWithPrefixLen($ipAddress);
247
  if ($record === null) {
248
  throw new AddressNotFoundException(
249
  "The address $ipAddress is not in the database."
250
  );
251
  }
252
+ if (!\is_array($record)) {
253
  // This can happen on corrupt databases. Generally,
254
  // MaxMind\Db\Reader will throw a
255
  // MaxMind\Db\Reader\InvalidDatabaseException, but occasionally
259
  // exceptions go unnoticed.
260
  throw new InvalidDatabaseException(
261
  "Expected an array when looking up $ipAddress but received: "
262
+ . \gettype($record)
263
  );
264
  }
265
 
266
+ return [$record, $prefixLen];
267
  }
268
 
269
  /**
vendor/geoip2/geoip2/src/Model/AnonymousIp.php CHANGED
@@ -2,21 +2,28 @@
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
  {
@@ -26,6 +33,7 @@ class AnonymousIp extends AbstractModel
26
  protected $isPublicProxy;
27
  protected $isTorExitNode;
28
  protected $ipAddress;
 
29
 
30
  /**
31
  * @ignore
@@ -41,6 +49,8 @@ class AnonymousIp extends AbstractModel
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
  }
2
 
3
  namespace GeoIp2\Model;
4
 
5
+ use GeoIp2\Util;
6
+
7
  /**
8
  * This class provides the GeoIP2 Anonymous IP model.
9
  *
10
  * @property-read bool $isAnonymous This is true if the IP address belongs to
11
  * any sort of anonymous network.
12
+ * @property-read bool $isAnonymousVpn This is true if the IP address is
13
+ * registered to an anonymous VPN provider. If a VPN provider does not
14
+ * register subnets under names associated with them, we will likely only
15
+ * flag their IP ranges using the isHostingProvider property.
16
  * @property-read bool $isHostingProvider This is true if the IP address belongs
17
+ * to a hosting or VPN provider (see description of isAnonymousVpn property).
18
  * @property-read bool $isPublicProxy This is true if the IP address belongs to
19
  * a public proxy.
20
  * @property-read bool $isTorExitNode This is true if the IP address is a Tor
21
  * exit node.
22
  * @property-read string $ipAddress The IP address that the data in the model is
23
  * for.
24
+ * @property-read string $network The network in CIDR notation associated with
25
+ * the record. In particular, this is the largest network where all of the
26
+ * fields besides $ipAddress have the same value.
27
  */
28
  class AnonymousIp extends AbstractModel
29
  {
33
  protected $isPublicProxy;
34
  protected $isTorExitNode;
35
  protected $ipAddress;
36
+ protected $network;
37
 
38
  /**
39
  * @ignore
49
  $this->isHostingProvider = $this->get('is_hosting_provider');
50
  $this->isPublicProxy = $this->get('is_public_proxy');
51
  $this->isTorExitNode = $this->get('is_tor_exit_node');
52
+ $ipAddress = $this->get('ip_address');
53
+ $this->ipAddress = $ipAddress;
54
+ $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
55
  }
56
  }
vendor/geoip2/geoip2/src/Model/Asn.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace GeoIp2\Model;
4
 
 
 
5
  /**
6
  * This class provides the GeoLite2 ASN model.
7
  *
@@ -12,12 +14,16 @@ namespace GeoIp2\Model;
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
@@ -30,6 +36,8 @@ class Asn extends AbstractModel
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
  }
2
 
3
  namespace GeoIp2\Model;
4
 
5
+ use GeoIp2\Util;
6
+
7
  /**
8
  * This class provides the GeoLite2 ASN model.
9
  *
14
  * address.
15
  * @property-read string $ipAddress The IP address that the data in the model is
16
  * for.
17
+ * @property-read string $network The network in CIDR notation associated with
18
+ * the record. In particular, this is the largest network where all of the
19
+ * fields besides $ipAddress have the same value.
20
  */
21
  class Asn extends AbstractModel
22
  {
23
  protected $autonomousSystemNumber;
24
  protected $autonomousSystemOrganization;
25
  protected $ipAddress;
26
+ protected $network;
27
 
28
  /**
29
  * @ignore
36
  $this->autonomousSystemNumber = $this->get('autonomous_system_number');
37
  $this->autonomousSystemOrganization =
38
  $this->get('autonomous_system_organization');
39
+ $ipAddress = $this->get('ip_address');
40
+ $this->ipAddress = $ipAddress;
41
+ $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
42
  }
43
  }
vendor/geoip2/geoip2/src/Model/City.php CHANGED
@@ -7,42 +7,25 @@ namespace GeoIp2\Model;
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
  {
7
  *
8
  * The only difference between the City and Insights model classes is which
9
  * fields in each record may be populated. See
10
+ * https://dev.maxmind.com/geoip/geoip2/web-services for more details.
11
  *
12
  * @property-read \GeoIp2\Record\City $city City data for the requested IP
13
  * address.
 
 
 
 
 
14
  * @property-read \GeoIp2\Record\Location $location Location data for the
15
  * requested IP address.
16
  * @property-read \GeoIp2\Record\Postal $postal Postal data for the
17
  * requested IP address.
18
+ * @property-read array $subdivisions An array \GeoIp2\Record\Subdivision
 
 
 
 
 
 
 
 
 
 
19
  * objects representing the country subdivisions for the requested IP
20
  * address. The number and type of subdivisions varies by country, but a
21
  * subdivision is typically a state, province, county, etc. Subdivisions
22
  * are ordered from most general (largest) to most specific (smallest).
23
  * If the response did not contain any subdivisions, this method returns
24
  * an empty array.
25
+ * @property-read \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
26
  * representing the most specific subdivision returned. If the response
27
  * did not contain any subdivisions, this method returns an empty
28
+ * \GeoIp2\Record\Subdivision object.
 
 
29
  */
30
  class City extends Country
31
  {
vendor/geoip2/geoip2/src/Model/ConnectionType.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace GeoIp2\Model;
4
 
 
 
5
  /**
6
  * This class provides the GeoIP2 Connection-Type model.
7
  *
@@ -10,11 +12,15 @@ namespace GeoIp2\Model;
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
@@ -26,6 +32,8 @@ class ConnectionType extends AbstractModel
26
  parent::__construct($raw);
27
 
28
  $this->connectionType = $this->get('connection_type');
29
- $this->ipAddress = $this->get('ip_address');
 
 
30
  }
31
  }
2
 
3
  namespace GeoIp2\Model;
4
 
5
+ use GeoIp2\Util;
6
+
7
  /**
8
  * This class provides the GeoIP2 Connection-Type model.
9
  *
12
  * Additional values may be added in the future.
13
  * @property-read string $ipAddress The IP address that the data in the model is
14
  * for.
15
+ * @property-read string $network The network in CIDR notation associated with
16
+ * the record. In particular, this is the largest network where all of the
17
+ * fields besides $ipAddress have the same value.
18
  */
19
  class ConnectionType extends AbstractModel
20
  {
21
  protected $connectionType;
22
  protected $ipAddress;
23
+ protected $network;
24
 
25
  /**
26
  * @ignore
32
  parent::__construct($raw);
33
 
34
  $this->connectionType = $this->get('connection_type');
35
+ $ipAddress = $this->get('ip_address');
36
+ $this->ipAddress = $ipAddress;
37
+ $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
38
  }
39
  }
vendor/geoip2/geoip2/src/Model/Country.php CHANGED
@@ -7,7 +7,7 @@ namespace GeoIp2\Model;
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.
7
  *
8
  * The only difference between the City and Insights model classes is which
9
  * fields in each record may be populated. See
10
+ * https://dev.maxmind.com/geoip/geoip2/web-services for more details.
11
  *
12
  * @property-read \GeoIp2\Record\Continent $continent Continent data for the
13
  * requested IP address.
vendor/geoip2/geoip2/src/Model/Domain.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace GeoIp2\Model;
4
 
 
 
5
  /**
6
  * This class provides the GeoIP2 Domain model.
7
  *
@@ -10,11 +12,15 @@ namespace GeoIp2\Model;
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
@@ -26,6 +32,8 @@ class Domain extends AbstractModel
26
  parent::__construct($raw);
27
 
28
  $this->domain = $this->get('domain');
29
- $this->ipAddress = $this->get('ip_address');
 
 
30
  }
31
  }
2
 
3
  namespace GeoIp2\Model;
4
 
5
+ use GeoIp2\Util;
6
+
7
  /**
8
  * This class provides the GeoIP2 Domain model.
9
  *
12
  * "example.co.uk", not "foo.example.com".
13
  * @property-read string $ipAddress The IP address that the data in the model is
14
  * for.
15
+ * @property-read string $network The network in CIDR notation associated with
16
+ * the record. In particular, this is the largest network where all of the
17
+ * fields besides $ipAddress have the same value.
18
  */
19
  class Domain extends AbstractModel
20
  {
21
  protected $domain;
22
  protected $ipAddress;
23
+ protected $network;
24
 
25
  /**
26
  * @ignore
32
  parent::__construct($raw);
33
 
34
  $this->domain = $this->get('domain');
35
+ $ipAddress = $this->get('ip_address');
36
+ $this->ipAddress = $ipAddress;
37
+ $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
38
  }
39
  }
vendor/geoip2/geoip2/src/Model/Enterprise.php CHANGED
@@ -7,40 +7,7 @@ namespace GeoIp2\Model;
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
  {
7
  *
8
  * The only difference between the City and Enterprise model classes is which
9
  * fields in each record may be populated. See
10
+ * https://dev.maxmind.com/geoip/geoip2/web-services for more details.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  */
12
  class Enterprise extends City
13
  {
vendor/geoip2/geoip2/src/Model/Insights.php CHANGED
@@ -7,40 +7,7 @@ namespace GeoIp2\Model;
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
  {
7
  *
8
  * The only difference between the City and Insights model classes is which
9
  * fields in each record may be populated. See
10
+ * https://dev.maxmind.com/geoip/geoip2/web-services for more details.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  */
12
  class Insights extends City
13
  {
vendor/geoip2/geoip2/src/Model/Isp.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace GeoIp2\Model;
4
 
 
 
5
  /**
6
  * This class provides the GeoIP2 ISP model.
7
  *
@@ -16,6 +18,9 @@ namespace GeoIp2\Model;
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
  {
@@ -24,6 +29,7 @@ class Isp extends AbstractModel
24
  protected $isp;
25
  protected $organization;
26
  protected $ipAddress;
 
27
 
28
  /**
29
  * @ignore
@@ -39,6 +45,8 @@ class Isp extends AbstractModel
39
  $this->isp = $this->get('isp');
40
  $this->organization = $this->get('organization');
41
 
42
- $this->ipAddress = $this->get('ip_address');
 
 
43
  }
44
  }
2
 
3
  namespace GeoIp2\Model;
4
 
5
+ use GeoIp2\Util;
6
+
7
  /**
8
  * This class provides the GeoIP2 ISP model.
9
  *
18
  * with the IP address.
19
  * @property-read string $ipAddress The IP address that the data in the model is
20
  * for.
21
+ * @property-read string $network The network in CIDR notation associated with
22
+ * the record. In particular, this is the largest network where all of the
23
+ * fields besides $ipAddress have the same value.
24
  */
25
  class Isp extends AbstractModel
26
  {
29
  protected $isp;
30
  protected $organization;
31
  protected $ipAddress;
32
+ protected $network;
33
 
34
  /**
35
  * @ignore
45
  $this->isp = $this->get('isp');
46
  $this->organization = $this->get('organization');
47
 
48
+ $ipAddress = $this->get('ip_address');
49
+ $this->ipAddress = $ipAddress;
50
+ $this->network = Util::cidr($ipAddress, $this->get('prefix_len'));
51
  }
52
  }
vendor/geoip2/geoip2/src/Record/AbstractRecord.php CHANGED
@@ -51,7 +51,7 @@ abstract class AbstractRecord implements \JsonSerializable
51
 
52
  private function validAttribute($attr)
53
  {
54
- return in_array($attr, $this->validAttributes, true);
55
  }
56
 
57
  public function jsonSerialize()
51
 
52
  private function validAttribute($attr)
53
  {
54
+ return \in_array($attr, $this->validAttributes, true);
55
  }
56
 
57
  public function jsonSerialize()
vendor/geoip2/geoip2/src/Record/Country.php CHANGED
@@ -15,10 +15,9 @@ namespace GeoIp2\Record;
15
  * @property-read bool $isInEuropeanUnion This is true if the country is a
16
  * member state of the European Union. This attribute is returned by all
17
  * location services and databases.
18
- * @property-read string|null $isoCode The
19
- * {@link * http://en.wikipedia.org/wiki/ISO_3166-1 two-character ISO 3166-1 alpha
20
- * code} for the country. This attribute is returned by all location services
21
- * and databases.
22
  * @property-read string|null $name The name of the country based on the locales
23
  * list passed to the constructor. This attribute is returned by all location
24
  * services and databases.
15
  * @property-read bool $isInEuropeanUnion This is true if the country is a
16
  * member state of the European Union. This attribute is returned by all
17
  * location services and databases.
18
+ * @property-read string|null $isoCode The two-character ISO 3166-1 alpha code
19
+ * for the country. See https://en.wikipedia.org/wiki/ISO_3166-1. This
20
+ * attribute is returned by all location services and databases.
 
21
  * @property-read string|null $name The name of the country based on the locales
22
  * list passed to the constructor. This attribute is returned by all location
23
  * services and databases.
vendor/geoip2/geoip2/src/Record/Location.php CHANGED
@@ -27,11 +27,11 @@ namespace GeoIp2\Record;
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
  {
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
+ * Google AdWords API. See
31
+ * https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions.
32
  * @property-read string|null $timeZone The time zone associated with location, as
33
+ * specified by the IANA Time Zone Database, e.g., "America/New_York". See
34
+ * https://www.iana.org/time-zones.
35
  */
36
  class Location extends AbstractRecord
37
  {
vendor/geoip2/geoip2/src/Record/RepresentedCountry.php CHANGED
@@ -9,19 +9,6 @@ namespace GeoIp2\Record;
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 bool $isInEuropeanUnion This is true if the country is a
17
- * member state of the European Union. This attribute is returned by all
18
- * location services and databases.
19
- * @property-read string|null $isoCode The {@link http://en.wikipedia.org/wiki/ISO_3166-1
20
- * two-character ISO 3166-1 alpha code} for the country.
21
- * @property-read string|null $name The name of the country based on the locales list
22
- * passed to the constructor.
23
- * @property-read array|null $names An array map where the keys are locale codes and
24
- * the values are names.
25
  * @property-read string|null $type A string indicating the type of entity that is
26
  * representing the country. Currently we only return <code>military</code>
27
  * but this could expand to include other types in the future.
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 string|null $type A string indicating the type of entity that is
13
  * representing the country. Currently we only return <code>military</code>
14
  * but this could expand to include other types in the future.
vendor/geoip2/geoip2/src/Record/Subdivision.php CHANGED
@@ -16,9 +16,9 @@ namespace GeoIp2\Record;
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.
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 ISO 3166-2 code. See
20
+ * https://en.wikipedia.org/wiki/ISO_3166-2. This attribute is returned by all
21
+ * 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.
vendor/geoip2/geoip2/src/Record/Traits.php CHANGED
@@ -2,21 +2,23 @@
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
@@ -35,16 +37,18 @@ namespace GeoIp2\Record;
35
  * @property-read bool $isAnonymous This is true if the IP address belongs to
36
  * any sort of anonymous network. This property is only available from GeoIP2
37
  * Precision Insights.
38
- * @property-read bool $isAnonymousProxy *Deprecated.* Please see our
39
- * {@link * https://www.maxmind.com/en/geoip2-anonymous-ip-database GeoIP2
40
- * Anonymous IP database} to determine whether the IP address is used by an
41
- * anonymizing service.
42
- * @property-read bool $isAnonymousVpn This is true if the IP address belongs to
43
- * an anonymous VPN system. This property is only available from GeoIP2
44
- * Precision Insights.
 
 
45
  * @property-read bool $isHostingProvider This is true if the IP address belongs
46
- * to a hosting provider. This property is only available from GeoIP2
47
- * Precision Insights.
48
  * @property-read bool $isLegitimateProxy This attribute is true if MaxMind
49
  * believes this IP address to be a legitimate proxy, such as an internal
50
  * VPN used by a corporation. This attribute is only available in the GeoIP2
@@ -61,9 +65,19 @@ namespace GeoIp2\Record;
61
  * @property-read string|null $isp The name of the ISP associated with the IP
62
  * address. This attribute is only available from the City and Insights web
63
  * services and the GeoIP2 Enterprise database.
 
 
 
64
  * @property-read string|null $organization The name of the organization associated
65
  * with the IP address. This attribute is only available from the City and
66
  * Insights web services and the GeoIP2 Enterprise database.
 
 
 
 
 
 
 
67
  * @property-read string|null $userType <p>The user type associated with the IP
68
  * address. This can be one of the following values:</p>
69
  * <ul>
@@ -108,7 +122,19 @@ class Traits extends AbstractRecord
108
  'isPublicProxy',
109
  'isSatelliteProvider',
110
  'isTorExitNode',
 
111
  'organization',
 
 
112
  'userType',
113
  ];
 
 
 
 
 
 
 
 
 
114
  }
2
 
3
  namespace GeoIp2\Record;
4
 
5
+ use GeoIp2\Util;
6
+
7
  /**
8
  * Contains data for the traits record associated with an IP address.
9
  *
10
  * This record is returned by all location services and databases.
11
  *
12
+ * @property-read int|null $autonomousSystemNumber The autonomous system number
13
+ * associated with the IP address. See
14
+ * https://en.wikipedia.org/wiki/Autonomous_system_(Internet%29. This attribute
15
+ * is only available from the City and Insights web service and the GeoIP2
16
  * Enterprise database.
17
  * @property-read string|null $autonomousSystemOrganization The organization
18
+ * associated with the registered autonomous system number for the IP address.
19
+ * See https://en.wikipedia.org/wiki/Autonomous_system_(Internet%29. This
20
+ * attribute is only available from the City and Insights web service and the
21
+ * GeoIP2 Enterprise database.
22
  * @property-read string|null $connectionType The connection type may take the
23
  * following values: "Dialup", "Cable/DSL", "Corporate", "Cellular".
24
  * Additional values may be added in the future. This attribute is only
37
  * @property-read bool $isAnonymous This is true if the IP address belongs to
38
  * any sort of anonymous network. This property is only available from GeoIP2
39
  * Precision Insights.
40
+ * @property-read bool $isAnonymousProxy *Deprecated.* Please see our GeoIP2
41
+ * Anonymous IP database
42
+ * (https://www.maxmind.com/en/geoip2-anonymous-ip-database) to determine
43
+ * whether the IP address is used by an anonymizing service.
44
+ * @property-read bool $isAnonymousVpn This is true if the IP address is
45
+ * registered to an anonymous VPN provider. If a VPN provider does not register
46
+ * subnets under names associated with them, we will likely only flag their IP
47
+ * ranges using the isHostingProvider property. This property is only available
48
+ * from GeoIP2 Precision Insights.
49
  * @property-read bool $isHostingProvider This is true if the IP address belongs
50
+ * to a hosting or VPN provider (see description of isAnonymousVpn property).
51
+ * This property is only available from GeoIP2 Precision Insights.
52
  * @property-read bool $isLegitimateProxy This attribute is true if MaxMind
53
  * believes this IP address to be a legitimate proxy, such as an internal
54
  * VPN used by a corporation. This attribute is only available in the GeoIP2
65
  * @property-read string|null $isp The name of the ISP associated with the IP
66
  * address. This attribute is only available from the City and Insights web
67
  * services and the GeoIP2 Enterprise database.
68
+ * @property-read string $network The network in CIDR notation associated with
69
+ * the record. In particular, this is the largest network where all of the
70
+ * fields besides $ipAddress have the same value.
71
  * @property-read string|null $organization The name of the organization associated
72
  * with the IP address. This attribute is only available from the City and
73
  * Insights web services and the GeoIP2 Enterprise database.
74
+ * @property-read float|null $staticIPScore An indicator of how static or
75
+ * dynamic an IP address is. This property is only available from GeoIP2
76
+ * Precision Insights.
77
+ * @property-read int|null $userCount The estimated number of users sharing
78
+ * the IP/network during the past 24 hours. For IPv4, the count is for the
79
+ * individual IP. For IPv6, the count is for the /64 network. This property is
80
+ * only available from GeoIP2 Precision Insights.
81
  * @property-read string|null $userType <p>The user type associated with the IP
82
  * address. This can be one of the following values:</p>
83
  * <ul>
122
  'isPublicProxy',
123
  'isSatelliteProvider',
124
  'isTorExitNode',
125
+ 'network',
126
  'organization',
127
+ 'staticIpScore',
128
+ 'userCount',
129
  'userType',
130
  ];
131
+
132
+ public function __construct($record)
133
+ {
134
+ if (!isset($record['network']) && isset($record['ip_address']) && isset($record['prefix_len'])) {
135
+ $record['network'] = Util::cidr($record['ip_address'], $record['prefix_len']);
136
+ }
137
+
138
+ parent::__construct($record);
139
+ }
140
  }
vendor/geoip2/geoip2/src/Util.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace GeoIp2;
4
+
5
+ class Util
6
+ {
7
+ /**
8
+ * This returns the network in CIDR notation for the given IP and prefix
9
+ * length. This is for internal use only.
10
+ *
11
+ * @internal
12
+ * @ignore
13
+ *
14
+ * @param mixed $ipAddress
15
+ * @param mixed $prefixLen
16
+ */
17
+ public static function cidr($ipAddress, $prefixLen)
18
+ {
19
+ $ipBytes = inet_pton($ipAddress);
20
+ $networkBytes = str_repeat("\0", \strlen($ipBytes));
21
+
22
+ $curPrefix = $prefixLen;
23
+ for ($i = 0; $i < \strlen($ipBytes) && $curPrefix > 0; $i++) {
24
+ $b = $ipBytes[$i];
25
+ if ($curPrefix < 8) {
26
+ $shiftN = 8 - $curPrefix;
27
+ $b = \chr(0xFF & (\ord($b) >> $shiftN) << $shiftN);
28
+ }
29
+ $networkBytes[$i] = $b;
30
+ $curPrefix -= 8;
31
+ }
32
+
33
+ $network = inet_ntop($networkBytes);
34
+
35
+ return "$network/$prefixLen";
36
+ }
37
+ }
vendor/geoip2/geoip2/src/WebService/Client.php CHANGED
@@ -47,7 +47,7 @@ class Client implements ProviderInterface
47
  private $client;
48
  private static $basePath = '/geoip/v2.1';
49
 
50
- const VERSION = 'v2.9.0';
51
 
52
  /**
53
  * Constructor.
@@ -74,7 +74,7 @@ class Client implements ProviderInterface
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
 
@@ -111,7 +111,7 @@ class Client implements ProviderInterface
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.
@@ -173,7 +173,7 @@ class Client implements ProviderInterface
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.
47
  private $client;
48
  private static $basePath = '/geoip/v2.1';
49
 
50
+ const VERSION = 'v2.10.0';
51
 
52
  /**
53
  * Constructor.
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
 
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.
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.
vendor/maxmind-db/reader/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
  CHANGELOG
2
  =========
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  1.5.0 (2019-09-30)
5
  ------------------
6
 
1
  CHANGELOG
2
  =========
3
 
4
+ 1.6.0 (2019-12-19)
5
+ ------------------
6
+
7
+ * 1.5.0 and 1.5.1 contained a possible memory corruptions when using
8
+ `getWithPrefixLen`. This has been fixed. Reported by proton-ab.
9
+ GitHub #96.
10
+ * The `composer.json` file now conflicts with all versions of the
11
+ `maxminddb` C extension less than the Composer version. This is to
12
+ reduce the chance of having an older, conflicting version of the
13
+ extension installed. You will need to upgrade the extension before
14
+ running `composer update`. Pull request by Benoît Burnichon. GitHub
15
+ #97.
16
+
17
+ 1.5.1 (2019-12-12)
18
+ ------------------
19
+
20
+ * Minor performance improvements.
21
+ * Make tests pass with older versions of libmaxminddb. PR by Remi
22
+ Collet. GitHub #90.
23
+ * Test enhancements. PR by Chun-Sheng, Li. GitHub #91.
24
+
25
  1.5.0 (2019-09-30)
26
  ------------------
27
 
vendor/maxmind-db/reader/composer.json CHANGED
@@ -20,6 +20,9 @@
20
  "ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
21
  "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
22
  },
 
 
 
23
  "require-dev": {
24
  "friendsofphp/php-cs-fixer": "2.*",
25
  "phpunit/phpunit": "5.*",
@@ -31,5 +34,10 @@
31
  "psr-4": {
32
  "MaxMind\\Db\\": "src/MaxMind/Db"
33
  }
 
 
 
 
 
34
  }
35
  }
20
  "ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
21
  "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
22
  },
23
+ "conflict": {
24
+ "ext-maxminddb": "<1.6.0,>=2.0.0"
25
+ },
26
  "require-dev": {
27
  "friendsofphp/php-cs-fixer": "2.*",
28
  "phpunit/phpunit": "5.*",
34
  "psr-4": {
35
  "MaxMind\\Db\\": "src/MaxMind/Db"
36
  }
37
+ },
38
+ "autoload-dev": {
39
+ "psr-4": {
40
+ "MaxMind\\Db\\Test\\Reader\\": "tests/MaxMind/Db/Test/Reader"
41
+ }
42
  }
43
  }
vendor/maxmind-db/reader/ext/maxminddb.c CHANGED
@@ -79,7 +79,7 @@ typedef struct _maxminddb_obj {
79
 
80
  PHP_FUNCTION(maxminddb);
81
 
82
- static void
83
  get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len);
84
  static const MMDB_entry_data_list_s *
85
  handle_entry_data_list(const MMDB_entry_data_list_s *entry_data_list,
@@ -163,7 +163,7 @@ PHP_METHOD(MaxMind_Db_Reader, __construct) {
163
  return;
164
  }
165
 
166
- MMDB_s *mmdb = (MMDB_s *)emalloc(sizeof(MMDB_s));
167
  uint16_t status = MMDB_open(db_file, MMDB_MODE_MMAP, mmdb);
168
 
169
  if (MMDB_SUCCESS != status) {
@@ -200,7 +200,9 @@ PHP_METHOD(MaxMind_Db_Reader, getWithPrefixLen) {
200
  #endif
201
 
202
  int prefix_len = 0;
203
- get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, record, &prefix_len);
 
 
204
 
205
  array_init(return_value);
206
  add_next_index_zval(return_value, record);
@@ -209,7 +211,7 @@ PHP_METHOD(MaxMind_Db_Reader, getWithPrefixLen) {
209
  add_next_index_zval(return_value, z_prefix_len);
210
  }
211
 
212
- static void
213
  get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len) {
214
  char *ip_address = NULL;
215
  strsize_t name_len;
@@ -224,7 +226,7 @@ get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len) {
224
  &name_len) == FAILURE) {
225
  THROW_EXCEPTION("InvalidArgumentException",
226
  "Method takes exactly one argument.");
227
- return;
228
  }
229
 
230
  const maxminddb_obj *mmdb_obj = (maxminddb_obj *)Z_MAXMINDDB_P(getThis());
@@ -234,7 +236,7 @@ get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len) {
234
  if (NULL == mmdb) {
235
  THROW_EXCEPTION("BadMethodCallException",
236
  "Attempt to read from a closed MaxMind DB.");
237
- return;
238
  }
239
 
240
  struct addrinfo hints = {
@@ -249,13 +251,13 @@ get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len) {
249
  THROW_EXCEPTION("InvalidArgumentException",
250
  "The value \"%s\" is not a valid IP address.",
251
  ip_address);
252
- return;
253
  }
254
  if (!addresses || !addresses->ai_addr) {
255
  THROW_EXCEPTION(
256
  "InvalidArgumentException",
257
  "getaddrinfo was successful but failed to set the addrinfo");
258
- return;
259
  }
260
 
261
  int sa_family = addresses->ai_addr->sa_family;
@@ -277,7 +279,7 @@ get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len) {
277
  "Error looking up %s. %s",
278
  ip_address,
279
  MMDB_strerror(mmdb_error));
280
- return;
281
  }
282
 
283
  *prefix_len = result.netmask;
@@ -290,7 +292,7 @@ get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len) {
290
 
291
  if (!result.found_entry) {
292
  ZVAL_NULL(record);
293
- return;
294
  }
295
 
296
  MMDB_entry_data_list_s *entry_data_list = NULL;
@@ -302,17 +304,18 @@ get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len) {
302
  ip_address,
303
  MMDB_strerror(status));
304
  MMDB_free_entry_data_list(entry_data_list);
305
- return;
306
  } else if (NULL == entry_data_list) {
307
  THROW_EXCEPTION(PHP_MAXMINDDB_READER_EX_NS,
308
  "Error while looking up data for %s. Your database may "
309
  "be corrupt or you have found a bug in libmaxminddb.",
310
  ip_address);
311
- return;
312
  }
313
 
314
  handle_entry_data_list(entry_data_list, record TSRMLS_CC);
315
  MMDB_free_entry_data_list(entry_data_list);
 
316
  }
317
 
318
  ZEND_BEGIN_ARG_INFO_EX(arginfo_maxmindbreader_void, 0, 0, 0)
@@ -665,6 +668,10 @@ PHP_MINIT_FUNCTION(maxminddb) {
665
  maxminddb_obj_handlers.offset = XtOffsetOf(maxminddb_obj, std);
666
  maxminddb_obj_handlers.free_obj = maxminddb_free_storage;
667
  #endif
 
 
 
 
668
 
669
  return SUCCESS;
670
  }
79
 
80
  PHP_FUNCTION(maxminddb);
81
 
82
+ static int
83
  get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len);
84
  static const MMDB_entry_data_list_s *
85
  handle_entry_data_list(const MMDB_entry_data_list_s *entry_data_list,
163
  return;
164
  }
165
 
166
+ MMDB_s *mmdb = (MMDB_s *)ecalloc(1, sizeof(MMDB_s));
167
  uint16_t status = MMDB_open(db_file, MMDB_MODE_MMAP, mmdb);
168
 
169
  if (MMDB_SUCCESS != status) {
200
  #endif
201
 
202
  int prefix_len = 0;
203
+ if (get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, record, &prefix_len)) {
204
+ return;
205
+ }
206
 
207
  array_init(return_value);
208
  add_next_index_zval(return_value, record);
211
  add_next_index_zval(return_value, z_prefix_len);
212
  }
213
 
214
+ static int
215
  get_record(INTERNAL_FUNCTION_PARAMETERS, zval *record, int *prefix_len) {
216
  char *ip_address = NULL;
217
  strsize_t name_len;
226
  &name_len) == FAILURE) {
227
  THROW_EXCEPTION("InvalidArgumentException",
228
  "Method takes exactly one argument.");
229
+ return 1;
230
  }
231
 
232
  const maxminddb_obj *mmdb_obj = (maxminddb_obj *)Z_MAXMINDDB_P(getThis());
236
  if (NULL == mmdb) {
237
  THROW_EXCEPTION("BadMethodCallException",
238
  "Attempt to read from a closed MaxMind DB.");
239
+ return 1;
240
  }
241
 
242
  struct addrinfo hints = {
251
  THROW_EXCEPTION("InvalidArgumentException",
252
  "The value \"%s\" is not a valid IP address.",
253
  ip_address);
254
+ return 1;
255
  }
256
  if (!addresses || !addresses->ai_addr) {
257
  THROW_EXCEPTION(
258
  "InvalidArgumentException",
259
  "getaddrinfo was successful but failed to set the addrinfo");
260
+ return 1;
261
  }
262
 
263
  int sa_family = addresses->ai_addr->sa_family;
279
  "Error looking up %s. %s",
280
  ip_address,
281
  MMDB_strerror(mmdb_error));
282
+ return 1;
283
  }
284
 
285
  *prefix_len = result.netmask;
292
 
293
  if (!result.found_entry) {
294
  ZVAL_NULL(record);
295
+ return 0;
296
  }
297
 
298
  MMDB_entry_data_list_s *entry_data_list = NULL;
304
  ip_address,
305
  MMDB_strerror(status));
306
  MMDB_free_entry_data_list(entry_data_list);
307
+ return 1;
308
  } else if (NULL == entry_data_list) {
309
  THROW_EXCEPTION(PHP_MAXMINDDB_READER_EX_NS,
310
  "Error while looking up data for %s. Your database may "
311
  "be corrupt or you have found a bug in libmaxminddb.",
312
  ip_address);
313
+ return 1;
314
  }
315
 
316
  handle_entry_data_list(entry_data_list, record TSRMLS_CC);
317
  MMDB_free_entry_data_list(entry_data_list);
318
+ return 0;
319
  }
320
 
321
  ZEND_BEGIN_ARG_INFO_EX(arginfo_maxmindbreader_void, 0, 0, 0)
668
  maxminddb_obj_handlers.offset = XtOffsetOf(maxminddb_obj, std);
669
  maxminddb_obj_handlers.free_obj = maxminddb_free_storage;
670
  #endif
671
+ zend_declare_class_constant_string(maxminddb_ce,
672
+ "MMDB_LIB_VERSION",
673
+ sizeof("MMDB_LIB_VERSION") - 1,
674
+ MMDB_lib_version() TSRMLS_CC);
675
 
676
  return SUCCESS;
677
  }
vendor/maxmind-db/reader/ext/php_maxminddb.h CHANGED
@@ -15,7 +15,7 @@
15
 
16
  #ifndef PHP_MAXMINDDB_H
17
  #define PHP_MAXMINDDB_H 1
18
- #define PHP_MAXMINDDB_VERSION "1.5.0"
19
  #define PHP_MAXMINDDB_EXTNAME "maxminddb"
20
 
21
  extern zend_module_entry maxminddb_module_entry;
15
 
16
  #ifndef PHP_MAXMINDDB_H
17
  #define PHP_MAXMINDDB_H 1
18
+ #define PHP_MAXMINDDB_VERSION "1.6.0"
19
  #define PHP_MAXMINDDB_EXTNAME "maxminddb"
20
 
21
  extern zend_module_entry maxminddb_module_entry;
vendor/maxmind-db/reader/src/MaxMind/Db/Reader.php CHANGED
@@ -242,7 +242,7 @@ class Reader
242
  {
243
  $resolved = $pointer - $this->metadata->nodeCount
244
  + $this->metadata->searchTreeSize;
245
- if ($resolved > $this->fileSize) {
246
  throw new InvalidDatabaseException(
247
  "The MaxMind DB file's search tree is corrupt"
248
  );
@@ -265,19 +265,18 @@ class Reader
265
  $fileSize = $fstat['size'];
266
  $marker = self::$METADATA_START_MARKER;
267
  $markerLength = self::$METADATA_START_MARKER_LENGTH;
268
- $metadataMaxLengthExcludingMarker
269
- = min(self::$METADATA_MAX_SIZE, $fileSize) - $markerLength;
270
-
271
- for ($i = 0; $i <= $metadataMaxLengthExcludingMarker; ++$i) {
272
- for ($j = 0; $j < $markerLength; ++$j) {
273
- fseek($handle, $fileSize - $i - $j - 1);
274
- $matchBit = fgetc($handle);
275
- if ($matchBit !== $marker[$markerLength - $j - 1]) {
276
- continue 2;
277
- }
278
  }
279
 
280
- return $fileSize - $i;
 
 
 
281
  }
282
  throw new InvalidDatabaseException(
283
  "Error opening database file ($filename). " .
242
  {
243
  $resolved = $pointer - $this->metadata->nodeCount
244
  + $this->metadata->searchTreeSize;
245
+ if ($resolved >= $this->fileSize) {
246
  throw new InvalidDatabaseException(
247
  "The MaxMind DB file's search tree is corrupt"
248
  );
265
  $fileSize = $fstat['size'];
266
  $marker = self::$METADATA_START_MARKER;
267
  $markerLength = self::$METADATA_START_MARKER_LENGTH;
268
+
269
+ $minStart = $fileSize - min(self::$METADATA_MAX_SIZE, $fileSize);
270
+
271
+ for ($offset = $fileSize - $markerLength; $offset >= $minStart; --$offset) {
272
+ if (fseek($handle, $offset) !== 0) {
273
+ break;
 
 
 
 
274
  }
275
 
276
+ $value = fread($handle, $markerLength);
277
+ if ($value === $marker) {
278
+ return $offset + $markerLength;
279
+ }
280
  }
281
  throw new InvalidDatabaseException(
282
  "Error opening database file ($filename). " .
vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php CHANGED
@@ -70,10 +70,7 @@ class Decoder
70
 
71
  public function decode($offset)
72
  {
73
- list(, $ctrlByte) = unpack(
74
- 'C',
75
- Util::read($this->fileStream, $offset, 1)
76
- );
77
  ++$offset;
78
 
79
  $type = $ctrlByte >> 5;
@@ -95,10 +92,7 @@ class Decoder
95
  }
96
 
97
  if ($type === self::_EXTENDED) {
98
- list(, $nextByte) = unpack(
99
- 'C',
100
- Util::read($this->fileStream, $offset, 1)
101
- );
102
 
103
  $type = $nextByte + 7;
104
 
@@ -255,17 +249,17 @@ class Decoder
255
 
256
  switch ($pointerSize) {
257
  case 1:
258
- $packed = (pack('C', $ctrlByte & 0x7)) . $buffer;
259
  list(, $pointer) = unpack('n', $packed);
260
  $pointer += $this->pointerBase;
261
  break;
262
  case 2:
263
- $packed = "\x00" . (pack('C', $ctrlByte & 0x7)) . $buffer;
264
  list(, $pointer) = unpack('N', $packed);
265
  $pointer += $this->pointerBase + 2048;
266
  break;
267
  case 3:
268
- $packed = (pack('C', $ctrlByte & 0x7)) . $buffer;
269
 
270
  // It is safe to use 'N' here, even on 32 bit machines as the
271
  // first bit is 0.
@@ -341,8 +335,7 @@ class Decoder
341
  $size = 285 + $adjust;
342
  } elseif ($size > 30) {
343
  list(, $adjust) = unpack('N', "\x00" . $bytes);
344
- $size = ($adjust & (0x0FFFFFFF >> (32 - (8 * $bytesToRead))))
345
- + 65821;
346
  }
347
 
348
  return [$size, $offset + $bytesToRead];
70
 
71
  public function decode($offset)
72
  {
73
+ $ctrlByte = \ord(Util::read($this->fileStream, $offset, 1));
 
 
 
74
  ++$offset;
75
 
76
  $type = $ctrlByte >> 5;
92
  }
93
 
94
  if ($type === self::_EXTENDED) {
95
+ $nextByte = \ord(Util::read($this->fileStream, $offset, 1));
 
 
 
96
 
97
  $type = $nextByte + 7;
98
 
249
 
250
  switch ($pointerSize) {
251
  case 1:
252
+ $packed = \chr($ctrlByte & 0x7) . $buffer;
253
  list(, $pointer) = unpack('n', $packed);
254
  $pointer += $this->pointerBase;
255
  break;
256
  case 2:
257
+ $packed = "\x00" . \chr($ctrlByte & 0x7) . $buffer;
258
  list(, $pointer) = unpack('N', $packed);
259
  $pointer += $this->pointerBase + 2048;
260
  break;
261
  case 3:
262
+ $packed = \chr($ctrlByte & 0x7) . $buffer;
263
 
264
  // It is safe to use 'N' here, even on 32 bit machines as the
265
  // first bit is 0.
335
  $size = 285 + $adjust;
336
  } elseif ($size > 30) {
337
  list(, $adjust) = unpack('N', "\x00" . $bytes);
338
+ $size = $adjust + 65821;
 
339
  }
340
 
341
  return [$size, $offset + $bytesToRead];
vendor/maxmind/web-service-common/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
  CHANGELOG
2
  =========
3
 
 
 
 
 
 
 
 
4
  0.5.0 (2018-02-12)
5
  ------------------
6
 
1
  CHANGELOG
2
  =========
3
 
4
+ 0.6.0 (2019-12-12)
5
+ ------------------
6
+
7
+ * Curl handles are now reused across requests. Pull request by Willem
8
+ Stuursma-Ruwen. GitHub #24.
9
+ * PHP 5.6 is now required.
10
+
11
  0.5.0 (2018-02-12)
12
  ------------------
13
 
vendor/maxmind/web-service-common/README.md CHANGED
@@ -5,8 +5,7 @@ shared code between MaxMind's various web service client 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
 
@@ -21,6 +20,6 @@ This API uses [Semantic Versioning](http://semver.org/).
21
 
22
  ## Copyright and License ##
23
 
24
- This software is Copyright (c) 2015-2018 by MaxMind, Inc.
25
 
26
  This is free software, licensed under the Apache License, Version 2.0.
5
 
6
  ## Requirements ##
7
 
8
+ The library requires PHP 5.6 or greater.
 
9
 
10
  There are several other dependencies as defined in the `composer.json` file.
11
 
20
 
21
  ## Copyright and License ##
22
 
23
+ This software is Copyright (c) 2015-2019 by MaxMind, Inc.
24
 
25
  This is free software, licensed under the Apache License, Version 2.0.
vendor/maxmind/web-service-common/composer.json CHANGED
@@ -12,14 +12,14 @@
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": {
12
  }
13
  ],
14
  "require": {
15
+ "php": ">=5.6",
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.8.36 || ^5.7 || ^6.5 || ^7.0",
23
  "squizlabs/php_codesniffer": "3.*"
24
  },
25
  "autoload": {
vendor/maxmind/web-service-common/src/WebService/Client.php CHANGED
@@ -100,8 +100,8 @@ class Client
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()
@@ -113,12 +113,12 @@ class Client
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
  );
@@ -128,12 +128,12 @@ class Client
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
  );
@@ -170,11 +170,11 @@ class Client
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
@@ -190,19 +190,19 @@ class Client
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
  /**
@@ -256,7 +256,7 @@ class Client
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,
@@ -406,7 +406,7 @@ class Client
406
  */
407
  private function handleSuccess($body, $service)
408
  {
409
- if (strlen($body) === 0) {
410
  throw new WebServiceException(
411
  "Received a 200 response for $service but did not " .
412
  'receive a HTTP body.'
@@ -432,7 +432,7 @@ class Client
432
  // On OS X, when the SSL version is "SecureTransport", the system's
433
  // keychain will be used.
434
  if ($curlVersion['ssl_version'] === 'SecureTransport') {
435
- return;
436
  }
437
  $cert = CaBundle::getSystemCaRootBundlePath();
438
 
100
  */
101
  public function post($service, $path, $input)
102
  {
103
+ $requestBody = json_encode($input);
104
+ if ($requestBody === false) {
105
  throw new InvalidInputException(
106
  'Error encoding input as JSON: '
107
  . $this->jsonErrorDescription()
113
  ['Content-Type: application/json']
114
  );
115
 
116
+ list($statusCode, $contentType, $responseBody) = $request->post($requestBody);
117
 
118
  return $this->handleResponse(
119
  $statusCode,
120
  $contentType,
121
+ $responseBody,
122
  $service,
123
  $path
124
  );
128
  {
129
  $request = $this->createRequest($path);
130
 
131
+ list($statusCode, $contentType, $responseBody) = $request->get();
132
 
133
  return $this->handleResponse(
134
  $statusCode,
135
  $contentType,
136
+ $responseBody,
137
  $service,
138
  $path
139
  );
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 $responseBody 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
190
  private function handleResponse(
191
  $statusCode,
192
  $contentType,
193
+ $responseBody,
194
  $service,
195
  $path
196
  ) {
197
  if ($statusCode >= 400 && $statusCode <= 499) {
198
+ $this->handle4xx($statusCode, $contentType, $responseBody, $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($responseBody, $service);
206
  }
207
 
208
  /**
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,
406
  */
407
  private function handleSuccess($body, $service)
408
  {
409
+ if (\strlen($body) === 0) {
410
  throw new WebServiceException(
411
  "Received a 200 response for $service but did not " .
412
  'receive a HTTP body.'
432
  // On OS X, when the SSL version is "SecureTransport", the system's
433
  // keychain will be used.
434
  if ($curlVersion['ssl_version'] === 'SecureTransport') {
435
+ return null;
436
  }
437
  $cert = CaBundle::getSystemCaRootBundlePath();
438
 
vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php CHANGED
@@ -11,21 +11,36 @@ use MaxMind\Exception\HttpException;
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
  */
@@ -53,11 +68,16 @@ class CurlRequest implements Request
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;
@@ -70,24 +90,31 @@ class CurlRequest implements Request
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);
@@ -103,7 +130,6 @@ class CurlRequest implements Request
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
  }
11
  */
12
  class CurlRequest implements Request
13
  {
14
+ /**
15
+ * @var resource
16
+ */
17
+ private $ch;
18
+
19
+ /**
20
+ * @var string
21
+ */
22
  private $url;
23
+
24
+ /**
25
+ * @var array
26
+ */
27
  private $options;
28
 
29
  /**
30
+ * @param string $url
31
+ * @param array $options
32
  */
33
  public function __construct($url, $options)
34
  {
35
  $this->url = $url;
36
  $this->options = $options;
37
+ $this->ch = $options['curlHandle'];
38
  }
39
 
40
  /**
41
+ * @param string $body
42
+ *
43
+ * @throws HttpException
44
  *
45
  * @return array
46
  */
68
  */
69
  private function createCurl()
70
  {
71
+ curl_reset($this->ch);
72
+
73
+ $opts = [];
74
+ $opts[CURLOPT_URL] = $this->url;
75
 
76
  if (!empty($this->options['caBundle'])) {
77
  $opts[CURLOPT_CAINFO] = $this->options['caBundle'];
78
  }
79
+
80
+ $opts[CURLOPT_ENCODING] = '';
81
  $opts[CURLOPT_SSL_VERIFYHOST] = 2;
82
  $opts[CURLOPT_FOLLOWLOCATION] = false;
83
  $opts[CURLOPT_SSL_VERIFYPEER] = true;
90
  // The defined()s are here as the *_MS opts are not available on older
91
  // cURL versions
92
  $connectTimeout = $this->options['connectTimeout'];
93
+ if (\defined('CURLOPT_CONNECTTIMEOUT_MS')) {
94
  $opts[CURLOPT_CONNECTTIMEOUT_MS] = ceil($connectTimeout * 1000);
95
  } else {
96
  $opts[CURLOPT_CONNECTTIMEOUT] = ceil($connectTimeout);
97
  }
98
 
99
  $timeout = $this->options['timeout'];
100
+ if (\defined('CURLOPT_TIMEOUT_MS')) {
101
  $opts[CURLOPT_TIMEOUT_MS] = ceil($timeout * 1000);
102
  } else {
103
  $opts[CURLOPT_TIMEOUT] = ceil($timeout);
104
  }
105
 
106
+ curl_setopt_array($this->ch, $opts);
107
 
108
+ return $this->ch;
109
  }
110
 
111
+ /**
112
+ * @param resource $curl
113
+ *
114
+ * @throws HttpException
115
+ *
116
+ * @return array
117
+ */
118
  private function execute($curl)
119
  {
120
  $body = curl_exec($curl);
130
 
131
  $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
132
  $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
 
133
 
134
  return [$statusCode, $contentType, $body];
135
  }
vendor/maxmind/web-service-common/src/WebService/Http/Request.php CHANGED
@@ -10,13 +10,13 @@ namespace MaxMind\WebService\Http;
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
  */
10
  interface Request
11
  {
12
  /**
13
+ * @param string $url
14
+ * @param array $options
15
  */
16
  public function __construct($url, $options);
17
 
18
  /**
19
+ * @param string $body
20
  *
21
  * @return mixed
22
  */
vendor/maxmind/web-service-common/src/WebService/Http/RequestFactory.php CHANGED
@@ -9,18 +9,35 @@ namespace MaxMind\WebService\Http;
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
  }
9
  */
10
  class RequestFactory
11
  {
12
+ /**
13
+ * Keep the cURL resource here, so that if there are multiple API requests
14
+ * done the connection is kept alive, SSL resumption can be used
15
+ * etcetera.
16
+ *
17
+ * @var resource
18
+ */
19
+ private $ch;
20
+
21
  public function __construct()
22
  {
23
+ $this->ch = curl_init();
24
+ }
25
+
26
+ public function __destruct()
27
+ {
28
+ curl_close($this->ch);
29
  }
30
 
31
  /**
32
+ * @param string $url
33
+ * @param array $options
34
  *
35
+ * @return Request
36
  */
37
  public function request($url, $options)
38
  {
39
+ $options['curlHandle'] = $this->ch;
40
+
41
  return new CurlRequest($url, $options);
42
  }
43
  }
vendor/symfony/http-foundation/IpUtils.php CHANGED
@@ -153,4 +153,36 @@ class IpUtils
153
 
154
  return self::$checkedIps[$cacheKey] = true;
155
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
153
 
154
  return self::$checkedIps[$cacheKey] = true;
155
  }
156
+
157
+ /**
158
+ * Anonymizes an IP/IPv6.
159
+ *
160
+ * Removes the last byte for v4 and the last 8 bytes for v6 IPs
161
+ */
162
+ public static function anonymize(string $ip): string
163
+ {
164
+ $wrappedIPv6 = false;
165
+ if ('[' === substr($ip, 0, 1) && ']' === substr($ip, -1, 1)) {
166
+ $wrappedIPv6 = true;
167
+ $ip = substr($ip, 1, -1);
168
+ }
169
+
170
+ $packedAddress = inet_pton($ip);
171
+ if (4 === \strlen($packedAddress)) {
172
+ $mask = '255.255.255.0';
173
+ } elseif ($ip === inet_ntop($packedAddress & inet_pton('::ffff:ffff:ffff'))) {
174
+ $mask = '::ffff:ffff:ff00';
175
+ } elseif ($ip === inet_ntop($packedAddress & inet_pton('::ffff:ffff'))) {
176
+ $mask = '::ffff:ff00';
177
+ } else {
178
+ $mask = 'ffff:ffff:ffff:ffff:0000:0000:0000:0000';
179
+ }
180
+ $ip = inet_ntop($packedAddress & inet_pton($mask));
181
+
182
+ if ($wrappedIPv6) {
183
+ $ip = '['.$ip.']';
184
+ }
185
+
186
+ return $ip;
187
+ }
188
  }
views/options.php CHANGED
@@ -33,6 +33,7 @@ $currentSourceId = $currentSource->getId();
33
  <?php endif; ?>
34
  <br/>
35
 
 
36
  <br /><br />
37
  <form method="post" action="#">
38
  <input type="hidden" name="action" value="choose" />
33
  <?php endif; ?>
34
  <br/>
35
 
36
+ <a name="choose-source" />
37
  <br /><br />
38
  <form method="post" action="#">
39
  <input type="hidden" name="action" value="choose" />
yarn.lock CHANGED
@@ -5154,9 +5154,9 @@ send@0.17.1:
5154
  statuses "~1.5.0"
5155
 
5156
  serialize-to-js@^3.0.0:
5157
- version "3.0.0"
5158
- resolved "https://registry.yarnpkg.com/serialize-to-js/-/serialize-to-js-3.0.0.tgz#1fd8736744819a4df29dc85e9d04a44a4984edc3"
5159
- integrity sha512-WdGgi0jGnWCQXph2p3vkxceDnTfvfyXfYxherQMRcZjSaJzMQdMBAW6i0nojsBKIZ3fFOztZKKVbbm05VbIdRA==
5160
 
5161
  serve-static@^1.12.4:
5162
  version "1.14.1"
5154
  statuses "~1.5.0"
5155
 
5156
  serialize-to-js@^3.0.0:
5157
+ version "3.0.1"
5158
+ resolved "https://registry.yarnpkg.com/serialize-to-js/-/serialize-to-js-3.0.1.tgz#7bece9cb910c5ee1433f56500db4a5303bca6a02"
5159
+ integrity sha512-TokHD6rY0yQxMmZCjeL8Oj+XuQK6uEx8JnBjt7PuqwWa2qY79Wb/KyhEDduTUC8Gl3S7c40jefWve7f5t4L8Lw==
5160
 
5161
  serve-static@^1.12.4:
5162
  version "1.14.1"