Advertisement
Guest User

Untitled

a guest
Apr 12th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2.  
  3. function catch_db_error( $errno, $errstr, $errfile, $errline )
  4. {
  5. global $db;
  6. static $failures;
  7. if ( strstr( $errstr, "Lost connection" ) && $failures < 5 ) {
  8. $failures++;
  9. return null;
  10. }
  11. if ( is_object( $db ) ) {
  12. $db->halt( '' . $errstr . "
  13. " . "
  14. " . $errfile . " on line " . $errline );
  15. return null;
  16. }
  17. vb_error_handler( $errno, $errstr, $errfile, $errline );
  18. return null;
  19. }
  20.  
  21. function vb_error_handler( $errno, $errstr, $errfile, $errline )
  22. {
  23. global $vbulletin;
  24. switch ( $errno ) {
  25. case E_WARNING:
  26. case E_USER_WARNING: {
  27. if ( !error_reporting() || !ini_get( "display_errors" ) ) {
  28. return null;
  29. }
  30. $errfile = str_replace( DIR, "[path]", $errfile );
  31. $errstr = str_replace( DIR, "[path]", $errstr );
  32. echo '' . "<br /><strong>Warning</strong>: " . $errstr . " in <strong>" . $errfile . "</strong> on line <strong>" . $errline . "</strong><br />";
  33. break;
  34. }
  35. .........................................................
  36. ............................
  37. ..........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement