| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | +//phpcs:ignoreFile | |
| 3 | +//this class is used to dump the complete database to a file when creating snapshots and uses multiple non-WordPress functions in order to imporove performance and compatibility with various servers even when dumping large databases | |
| 2 | 4 | /** |
| 3 | 5 | * Abstract dump file: provides common interface for writing |
| 4 | 6 | * data to dump files. |
| 5 | 7 | * (c) 2create Studio, Bulgaria |
| @@ -274,9 +276,9 @@ | ||
| 274 | 276 | |
| 275 | 277 | if ($return_val !== 0) { |
| 276 | 278 | $error_text = file_get_contents($error_file); |
| 277 | 279 | unlink($error_file); |
| 278 | - throw new WPR_Shuttle_Exception('Couldn\'t export database: ' . $error_text); | |
| 280 | + throw new WPR_Shuttle_Exception('Couldn\'t export database: ' . esc_html($error_text)); | |
| 279 | 281 | } |
| 280 | 282 | |
| 281 | 283 | unlink($error_file); |
| 282 | 284 | } |
| @@ -396,14 +398,14 @@ | ||
| 396 | 398 | class WPR_Shuttle_DBConn_Mysql extends WPR_Shuttle_DBConn { |
| 397 | 399 | function connect() { |
| 398 | 400 | $this->connection = @mysql_connect($this->host, $this->username, $this->password); |
| 399 | 401 | if (!$this->connection) { |
| 400 | - throw new WPR_Shuttle_Exception("Couldn't connect to the database: " . mysql_error()); | |
| 402 | + throw new WPR_Shuttle_Exception("Couldn't connect to the database: " . esc_html(mysql_error())); | |
| 401 | 403 | } |
| 402 | 404 | |
| 403 | 405 | $select_db_res = mysql_select_db($this->name, $this->connection); |
| 404 | 406 | if (!$select_db_res) { |
| 405 | - throw new WPR_Shuttle_Exception("Couldn't select database: " . mysql_error($this->connection)); | |
| 407 | + throw new WPR_Shuttle_Exception("Couldn't select database: " . esc_html(mysql_error($this->connection))); | |
| 406 | 408 | } |
| 407 | 409 | |
| 408 | 410 | return true; |
| 409 | 411 | } |
| @@ -413,9 +415,9 @@ | ||
| 413 | 415 | $this->connect(); |
| 414 | 416 | } |
| 415 | 417 | $res = mysql_query($q); |
| 416 | 418 | if (!$res) { |
| 417 | - throw new WPR_Shuttle_Exception("SQL error: " . mysql_error($this->connection)); | |
| 419 | + throw new WPR_Shuttle_Exception("SQL error: " . esc_html(mysql_error($this->connection))); | |
| 418 | 420 | } |
| 419 | 421 | return $res; |
| 420 | 422 | } |
| 421 | 423 | |
| @@ -459,9 +461,9 @@ | ||
| 459 | 461 | function connect() { |
| 460 | 462 | $this->connection = @new MySQLi($this->host, $this->username, $this->password, $this->name); |
| 461 | 463 | |
| 462 | 464 | if ($this->connection->connect_error) { |
| 463 | - throw new WPR_Shuttle_Exception("Couldn't connect to the database: " . $this->connection->connect_error); | |
| 465 | + throw new WPR_Shuttle_Exception("Couldn't connect to the database: " . esc_html($this->connection->connect_error)); | |
| 464 | 466 | } |
| 465 | 467 | |
| 466 | 468 | return true; |
| 467 | 469 | } |
| @@ -472,9 +474,9 @@ | ||
| 472 | 474 | } |
| 473 | 475 | $res = $this->connection->query($q); |
| 474 | 476 | |
| 475 | 477 | if (!$res) { |
| 476 | - throw new WPR_Shuttle_Exception("SQL error: " . $this->connection->error); | |
| 478 | + throw new WPR_Shuttle_Exception("SQL error: " . esc_html($this->connection->error)); | |
| 477 | 479 | } |
| 478 | 480 | |
| 479 | 481 | return $res; |
| 480 | 482 | } |