exceptions.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * This is an optional script used to override Elgg's default handling of
  4. * uncaught exceptions.
  5. * This is defined in the global $CONFIG->exception_include in settings.php
  6. *
  7. * The script will have access to the following variables as part of the scope
  8. * global $CONFIG
  9. * $exception - the unhandled exception
  10. *
  11. * @warning - the database may not be available
  12. *
  13. */
  14. // notify some important people that a problem has occurred
  15. // remember we can't rely on the database being available so everything here
  16. // should be hard coded
  17. $emails = array(
  18. 'admin@example.com',
  19. 'expert@example.com'
  20. );
  21. $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  22. $subject = "Exception: $url";
  23. $message = $exception->getMessage();
  24. foreach ($emails as $email) {
  25. mail($email, $subject, $message);
  26. }
  27. // output a custom error page to match the theme or give a custom message
  28. $html = <<<HTML
  29. <html>
  30. <body>
  31. Oops, a problem occurred. The authorities have been notified.
  32. Sorry for the inconvenience.
  33. </body>
  34. </html>
  35. HTML;
  36. // any output will prevent the default views from rendering allowing
  37. // this script to control the entire page output
  38. echo $html;