| @@ 431-453 (lines=23) @@ | ||
| 428 | } |
|
| 429 | ||
| 430 | // Debugging. |
|
| 431 | if (isset($db_show_debug) && $db_show_debug === true) |
|
| 432 | { |
|
| 433 | // Get the file and line number this function was called. |
|
| 434 | list ($file, $line) = smf_db_error_backtrace('', '', 'return', __FILE__, __LINE__); |
|
| 435 | ||
| 436 | // Initialize $db_cache if not already initialized. |
|
| 437 | if (!isset($db_cache)) |
|
| 438 | $db_cache = array(); |
|
| 439 | ||
| 440 | if (!empty($_SESSION['debug_redirect'])) |
|
| 441 | { |
|
| 442 | $db_cache = array_merge($_SESSION['debug_redirect'], $db_cache); |
|
| 443 | $db_count = count($db_cache) + 1; |
|
| 444 | $_SESSION['debug_redirect'] = array(); |
|
| 445 | } |
|
| 446 | ||
| 447 | // Don't overload it. |
|
| 448 | $st = microtime(true); |
|
| 449 | $db_cache[$db_count]['q'] = $db_count < 50 ? $db_string : '...'; |
|
| 450 | $db_cache[$db_count]['f'] = $file; |
|
| 451 | $db_cache[$db_count]['l'] = $line; |
|
| 452 | $db_cache[$db_count]['s'] = $st - $time_start; |
|
| 453 | } |
|
| 454 | ||
| 455 | // First, we clean strings out of the query, reduce whitespace, lowercase, and trim - so we can check it over. |
|
| 456 | if (empty($modSettings['disableQueryCheck'])) |
|
| @@ 395-417 (lines=23) @@ | ||
| 392 | } |
|
| 393 | ||
| 394 | // Debugging. |
|
| 395 | if (isset($db_show_debug) && $db_show_debug === true) |
|
| 396 | { |
|
| 397 | // Get the file and line number this function was called. |
|
| 398 | list ($file, $line) = smf_db_error_backtrace('', '', 'return', __FILE__, __LINE__); |
|
| 399 | ||
| 400 | // Initialize $db_cache if not already initialized. |
|
| 401 | if (!isset($db_cache)) |
|
| 402 | $db_cache = array(); |
|
| 403 | ||
| 404 | if (!empty($_SESSION['debug_redirect'])) |
|
| 405 | { |
|
| 406 | $db_cache = array_merge($_SESSION['debug_redirect'], $db_cache); |
|
| 407 | $db_count = count($db_cache) + 1; |
|
| 408 | $_SESSION['debug_redirect'] = array(); |
|
| 409 | } |
|
| 410 | ||
| 411 | $st = microtime(true); |
|
| 412 | // Don't overload it. |
|
| 413 | $db_cache[$db_count]['q'] = $db_count < 50 ? $db_string : '...'; |
|
| 414 | $db_cache[$db_count]['f'] = $file; |
|
| 415 | $db_cache[$db_count]['l'] = $line; |
|
| 416 | $db_cache[$db_count]['s'] = $st - $time_start; |
|
| 417 | } |
|
| 418 | ||
| 419 | // First, we clean strings out of the query, reduce whitespace, lowercase, and trim - so we can check it over. |
|
| 420 | if (empty($modSettings['disableQueryCheck'])) |
|