Changeset 10597
- Timestamp:
- 02/19/2009 07:01:57 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/wp-db.php
r9935 r10597 274 274 275 275 /** 276 * Whether to use mysql_real_escape_string 277 * 278 * @since 2.8.0 279 * @access public 280 * @var bool 281 */ 282 var $real_escape = false; 283 284 /** 276 285 * Connects to the database server and selects a database 277 286 * … … 334 343 335 344 if ( $this->has_cap( 'collation' ) ) { 336 $collation_query = '';337 345 if ( !empty($this->charset) ) { 338 $collation_query = "SET NAMES '{$this->charset}'"; 339 if (!empty($this->collate) ) 340 $collation_query .= " COLLATE '{$this->collate}'"; 346 if ( function_exists('mysql_set_charset') ) { 347 mysql_set_charset($this->charset, $this->dbh); 348 $this->real_escape = true; 349 } else { 350 $collation_query = "SET NAMES '{$this->charset}'"; 351 if ( !empty($this->collate) ) 352 $collation_query .= " COLLATE '{$this->collate}'"; 353 $this->query($collation_query); 354 } 341 355 } 342 343 if ( !empty($collation_query) )344 $this->query($collation_query);345 346 356 } 347 357 … … 427 437 */ 428 438 function escape($string) { 429 return addslashes( $string ); 430 // Disable rest for now, causing problems 431 /* 432 if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' ) 433 return mysql_escape_string( $string ); 439 if ( $this->dbh && $this->real_escape ) 440 return mysql_real_escape_string( $string, $this->dbh ); 434 441 else 435 return mysql_real_escape_string( $string, $this->dbh ); 436 */ 442 return addslashes( $string ); 437 443 } 438 444
Note: See TracChangeset
for help on using the changeset viewer.