- Timestamp:
- 11/26/2020 04:26:18 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/events/1.0/index.php
r10341 r10469 1 1 <?php 2 3 2 namespace Dotorg\API\Events; 4 3 use stdClass; … … 358 357 LIMIT 1'; 359 358 360 $prepared_query = $wpdb->prepare( $query, $location_name, $country, $timezone, $location_name ); 361 $db_handle = $wpdb->db_connect( $prepared_query ); 362 363 $wpdb->set_charset( $db_handle, 'utf8' ); // The content in this table requires a UTF8 connection. 364 $row = $wpdb->get_row( $prepared_query ); 365 $wpdb->set_charset( $db_handle, 'latin1' ); // Revert to the default charset to avoid affecting other queries. 359 $row = $wpdb->get_row( $wpdb->prepare( 360 $query, 361 $location_name, 362 $country, 363 $timezone, 364 $location_name 365 ) ); 366 366 367 367 // Wildcard match … … 378 378 LIMIT 1'; 379 379 380 $prepared_query = $wpdb->prepare( $query, $wpdb->esc_like( $location_name ) . '%', $country, $timezone, $location_name, mb_strlen( $location_name ) ); 381 $db_handle = $wpdb->db_connect( $prepared_query ); 382 383 $wpdb->set_charset( $db_handle, 'utf8' ); // The content in this table requires a UTF8 connection. 384 $row = $wpdb->get_row( $prepared_query ); 385 $wpdb->set_charset( $db_handle, 'latin1' ); // Revert to the default charset to avoid affecting other queries. 386 } 387 388 // Suffix the "State", good in some countries (western countries) horrible in others 389 // (where geonames data is not as complete, or region names are similar (but not quite the same) to city names) 390 // LEFT JOIN admin1codes ac ON gs.statecode = ac.code 391 // if ( $row->state && $row->state != $row->name && $row->name NOT CONTAINED WITHIN $row->state? ) { 392 // $row->name .= ', ' . $row->state; 393 // } 380 $row = $wpdb->get_row( $wpdb->prepare( 381 $query, 382 $wpdb->esc_like( $location_name ) . '%', 383 $country, 384 $timezone, 385 $location_name, 386 mb_strlen( $location_name ) 387 ) ); 388 } 394 389 395 390 // Strip off null bytes
Note: See TracChangeset
for help on using the changeset viewer.