Commit Graph

92 Commits

Author SHA1 Message Date
Claudio Sanches d48f1d4e2e Fixed package tag usage 2020-08-05 13:36:24 -03:00
Claudio Sanches f9c31589c6 Fixed conditional code 2020-01-14 16:44:01 -03:00
Claudio Sanches 992e13fb08 Updated implementation of geolite2 2020-01-14 16:24:07 -03:00
Claudio Sanches 46110fa39c Introduced woocommerce_get_geolocation filter 2020-01-14 15:54:24 -03:00
Claudio Sanches 49aed6f6ca Remove alternatives for deprecated methods 2020-01-10 16:31:27 -03:00
Claudio Sanches 48547143f4 Fixed integration ID 2020-01-10 15:02:56 -03:00
Claudio Sanches 8aa7e62a21 Fixed fatal error in system status page 2020-01-10 12:22:42 -03:00
Claudio Sanches 0e119cb97a Fixed missing methods, added deprecated notices and @since 2020-01-10 11:58:53 -03:00
Christopher Allford 19ded6609d Refactored the MaxMind database class to not use static methods in order to make testing the integration class easier 2020-01-10 02:09:51 -08:00
Christopher Allford 26e0b71fce Added support for mod_maxminddb's MM_COUNTRY_CODE server variable 2020-01-10 01:23:06 -08:00
Christopher Allford 0f6da046a1 Refactored the IP geolocation method 2020-01-10 00:08:24 -08:00
Christopher Allford bbbfc3bfab Moved the MaxMind geolocation lookup into the integration class 2020-01-09 23:46:25 -08:00
Christopher Allford 02ee3f695e Moved the database update from the WC_Geolocation class to the MaxMind-specific integration 2020-01-09 23:22:42 -08:00
Christopher Allford 2df3af1e63 Deprecated the WC_Geolocation::get_local_database_path method 2020-01-09 21:31:12 -08:00
Christopher Allford f91ff82806 Moved the loading of the database class into the integration 2020-01-09 21:29:47 -08:00
Christopher Allford d45a3541f4 Removed the unnecessary GeoLite2 version check 2020-01-09 20:58:42 -08:00
Christopher Allford 6af0edfd94 Added a deprecation notice for the GEOLITE2_DB constant 2020-01-09 16:21:33 -08:00
Christopher Allford 7cdd19da3f Fixed the erroneous return in WC_Geolocation::get_local_database_path 2020-01-09 16:16:34 -08:00
Christopher Allford bf057927ae Moved the loading of integration classes into the WC_Autoloader 2020-01-09 15:46:01 -08:00
Christopher Allford 98119047bf Added back the WC_Geolocation's get_local_database_path method since it was publicly used 2020-01-09 00:56:22 -08:00
Christopher Allford 3e597e6f68 Replaced the Geolocation database fetching functionality with MaxMind integration 2020-01-09 00:31:51 -08:00
Mike Jolley 9bd38c496e Delete method 2019-03-11 10:46:57 +00:00
Mike Jolley 15f0d2566d Use filesystem and hardcoded upload dir 2019-03-08 18:20:17 +00:00
Mike Jolley 113534a882 Set fallback false 2019-02-07 13:40:50 +00:00
Mike Jolley 1ba0194685 Remove external lookup of ips on localhost 2019-01-30 15:59:02 +00:00
Rodrigo Primo 2c8d006c37 Update PHPCompatibility sniff names
The name of some sniffs changed in the most recent PHPCompatiblity version. This commit update all instances where those names are used in WooCommerce codebase.
2018-11-21 11:08:26 -02:00
Mohammad Jangda 0590522180
Use wp_get_upload_dir for geolite DB path
By default, `wp_upload_dir` will "will create a subfolder in your Uploads folder corresponding to the queried month (or current month, if no $time argument is provided" (https://developer.wordpress.org/reference/functions/wp_upload_dir/).

This is not necessary in our case since all we want is the `basedir` value.

We're switching to `wp_get_upload_dir`, which is a wrapper for `wp_upload_dir` that turns of the folder create behaviour.
2018-10-13 01:27:45 -04:00
Gerhard Potgieter 43de3d00cd Remove icanhazip service from ip lookup, their DNS is blacklisted and blocked by most servers. 2018-08-27 11:21:37 +02:00
Gerhard Potgieter 90a9fd49e6 X_FORWARDED_FOR standard states either just an IP or a comma seperated list of IP, Proxy, Proxy, ... 2018-06-11 10:49:03 +02:00
Claudio Sanches 574c829096 Introduced function to check if geolocation is enabled 2018-04-24 15:22:12 -03:00
Mike Jolley 6d9bacb982 Removes freegeoip service 2018-04-24 14:32:21 +01:00
Claudio Sanches 9ac00e1986 Use trailingslashit() instead of DIRECTORY_SEPARATOR
This will avoid any double `/` and should work on Windows too.
2018-04-23 14:19:42 -03:00
Shiva Poudel 0c5d6dd285 Tweak - Use of trailingslashit instead 2018-04-23 22:07:14 +05:45
Shiva Poudel a4b5f0bef4 Fix - Notice while downloding GeoIP database on Windows
DIRECTORY_SEPARATOR was the culprit :)

CC @claudiosanches

Closes #19742
2018-04-21 02:43:37 +05:45
Mike Jolley 01be034279 Disable geolocation if using legacy php #19548 2018-03-29 17:04:31 +01:00
Mike Jolley 69a3a78a4c Typo 2018-03-29 16:46:11 +01:00
Claudio Sanches 6405e8645a Removed legacy private methods from WC_Geolocation 2018-03-15 14:01:36 -03:00
Claudio Sanches a731135cae Removed outdated IP lookup service and improved check for valid IPs 2018-03-15 13:45:49 -03:00
Claudio Sanches 4a638c60bb Reschedule download of GeoLite2 database when something goes wrong 2018-03-14 16:07:00 -03:00
Claudio Sanches 51cfb9b03e Updated how GeoLite2 database is downloaded 2018-03-14 16:01:33 -03:00
Claudio Sanches 1791a192d8 Check for PHP version before try use GeoLite2 2018-03-14 14:07:20 -03:00
Claudio Sanches 7f6f4b848d Created WC_Geolite_Integration class to handle with GeoLite2 integration 2018-03-14 13:57:07 -03:00
Claudio Sanches 29b9e9c085 GeoLite2 Reader integration 2018-03-14 12:42:53 -03:00
Claudio Sanches 6fdc1a547d Download new GeoLite2 and deprecated legacy GeoLite 2018-03-13 15:57:32 -03:00
Pathurs 119d3485b1
Remove port from string before checking IP
Fix a bug where if `$_['HTTP_X_FORWARDED_FOR']` contains a port, an `rest_is_ip_address()` returns `bool(false)`.

WooCommerce Version: 3.1.2

Observed results of functions and variables:
```
WC_Geolocation::get_ip_address())	                                  string(0) ""
$_SERVER['X-Real-IP']	                                              string(7) "Not set"
$_SERVER['HTTP_X_FORWARDED_FOR']	                                  string(18) "203.41.99.98:50986"
trim( current( explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) )	  string(18) "203.41.99.98:50986"
$_SERVER['REMOTE_ADDR']	                                              string(12) "203.41.99.98"
```

Old result of calling `WC_Geolocation::geolocate_ip()`:
```array(2) { ["country"]=> string(0) "" ["state"]=> string(0) "" }```

New result of calling `WC_Geolocation::geolocate_ip()`:
```array(2) { ["country"]=> string(2) "AU" ["state"]=> string(0) "" }```
2018-01-02 11:54:26 +11:00
Claudio Sanches 4fb3624604 Fixed coding standards 2017-11-22 14:13:59 -02:00
Claudio Sanches d39a034f14 Drop support for legacy WP versions 2017-11-22 13:55:48 -02:00
Gerhard Potgieter a3fd99ddd9 GeoDB empty file handling (#17541)
* Make sure we do not save empty geodb files, also add checks to ensure we do not read form an empty geodb file.

* Add logger message when deleting file on checking size
2017-11-08 14:28:03 +00:00
claudiulodro 48f03b15ed Use correct server variable 2017-08-04 14:27:22 -07:00
dixitadusara ebe831ccec Issue Missing $ip Variable #15213 2017-05-23 11:50:30 +05:30