Changeset 4883
- Timestamp:
- 02/04/2017 03:25:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/events/1.0/index.php
r4882 r4883 67 67 // The FIELD() orderings give preference to rows that match the country and/or timezone, without excluding rows that don't match. 68 68 // And we sort by population desc, assuming that the biggest matching location is the most likely one. 69 $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM geoname WHERE MATCH(name,asciiname,alternatenames) AGAINST(%s) ORDER BY FIELD(%s, country) DESC, FIELD(%s, timezone) DESC, population DESC LIMIT 1", $location_name, $country, $timezone ) ); 69 70 // Strip quotes from the search query and enclose it in double quotes, to force an exact literal search 71 $location_name = '"' . strtr( $location_name, [ '"' => '', "'" => '' ] ) . '"'; 72 $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM geoname WHERE MATCH(name,asciiname,alternatenames) AGAINST(%s IN BOOLEAN MODE) ORDER BY FIELD(%s, country) DESC, FIELD(%s, timezone) DESC, population DESC LIMIT 1", $location_name, $country, $timezone ) ); 70 73 return $row; 71 74 }
Note: See TracChangeset
for help on using the changeset viewer.