X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/ff81ee6e8304a1982a3ec4f5b134764a29d502cf..022dfbbbe3215917d84708eb09acca93b21ae9e0:/wp-includes/wp-db.php diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 97238c39..790ddcfd 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -40,6 +40,12 @@ class wpdb { // DB Constructor - connects to the server and selects a database function wpdb($dbuser, $dbpassword, $dbname, $dbhost) { + return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost); + } + + function __construct($dbuser, $dbpassword, $dbname, $dbhost) { + register_shutdown_function(array(&$this, "__destruct")); + $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword); if (!$this->dbh) { $this->bail(" @@ -57,6 +63,10 @@ class wpdb { $this->select($dbname); } + function __destruct() { + return true; + } + // ================================================================== // Select a DB (if another one needs to be selected) @@ -93,12 +103,14 @@ class wpdb { $EZSQL_ERROR[] = array ('query' => $this->last_query, 'error_str' => $str); + $str = htmlspecialchars($str, ENT_QUOTES); + $query = htmlspecialchars($this->last_query, ENT_QUOTES); // Is error output turned on or not.. if ( $this->show_errors ) { // If there is an error then take note of it print "
WordPress database error: [$str]
- $this->last_query
$query