function bh_exception_handler(Exception $exception) { $config = server_get_config(); if (isset($config['error_report_verbose']) && $config['error_report_verbose'] == true) { $error_report_verbose = true; } else { $error_report_verbose = false; } cache_disable(); while (@ob_end_clean()) { } ob_start(); ob_implicit_flush(0); bh_error_send_email($exception); $error_msg_array = bh_error_process($exception); $error_log_message = sprintf('BEEHIVE_ERROR: %s', strip_tags(implode(". ", $error_msg_array))); @error_log($error_log_message); header_status(500, 'Internal Server Error'); if ($exception->getCode() == MYSQL_ERROR_NO_SUCH_TABLE || $exception->getCode() == MYSQL_ERROR_WRONG_COLUMN_NAME) { if (function_exists('install_incomplete') && !defined('BEEHIVE_DEVELOPER_MODE')) { install_incomplete(); } } if (preg_match('/include|include_once/u', $exception->getMessage()) > 0) { if (function_exists('install_missing_files') && !defined('BEEHIVE_DEVELOPER_MODE')) { install_missing_files(); } } $forum_path = server_get_forum_path(); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"utf-8\" lang=\"en\" dir=\"ltr\">\n"; echo "<head>\n"; echo "<title>Beehive Forum - Error Handler</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; echo "<link rel=\"icon\" href=\"images/favicon.ico\" type=\"image/ico\" />\n"; echo "<link rel=\"stylesheet\" href=\"", $forum_path, "/styles/default/style.css?", md5(uniqid(rand())), "\" type=\"text/css\" />\n"; echo "</head>\n"; echo "<body>\n"; echo "<h1>Error</h1>\n"; echo "<br />\n"; if (defined('BEEHIVEMODE_LIGHT') && !defined('BEEHIVE_DEVELOPER_MODE')) { echo '<p>An error has occured. Please wait a few moments before trying again.</p>'; echo '<p>Details of the error have been saved to the default error log.</p>'; if (isset($error_report_verbose) && $error_report_verbose == true) { echo '<p>When reporting a bug in Project Beehive or when requesting support please include the details below.</p>'; echo "<table cellpadding=\"0\" cellspacing=\"0\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><img src=\"styles/default/images/warning.png\" alt=\"Warning\" title=\"Warning\" /></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">Please note that there may be sensitive information such as passwords displayed here.</td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "<p>", implode("</p><p>", $error_msg_array), "</p>\n"; } } else { echo "<div align=\"center\">\n"; echo "<form accept-charset=\"utf-8\" name=\"f_error\" method=\"post\" action=\"\" target=\"_self\">\n"; echo " ", form_input_hidden_array($_POST), "\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">Error</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"posthead\" width=\"95%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">An error has occured. Please wait a few moments and then click the Retry button below. Details of the error have been saved to the default error log.</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; if (isset($error_report_verbose) && $error_report_verbose == true || defined('BEEHIVE_DEVELOPER_MODE')) { echo " <br />\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">Error Details</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"posthead\" width=\"95%\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><img src=\"styles/default/images/warning.png\" alt=\"Warning\" title=\"Warning\" /></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">When reporting a bug in Project Beehive or when requesting support please include the details below.</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><img src=\"styles/default/images/warning.png\" alt=\"Warning\" title=\"Warning\" /></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">Please note that there may be sensitive information such as passwords displayed here.</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td>\n"; echo " <div class=\"error_handler_details\">", implode("\n", $error_msg_array), "</div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; } echo " <br />\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n"; echo " <tr>\n"; echo " <td align=\"center\"><input class=\"button\" type=\"submit\" name=\"", md5(uniqid(mt_rand())), "\" value=\"Retry\" /></td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</form>\n"; echo "</div>\n"; } echo "</body>\n"; echo "</html>\n"; exit; }
function bh_exception_handler(Exception $exception) { try { $config = server_get_config(); if (isset($config['error_report_verbose']) && $config['error_report_verbose'] == true) { $error_report_verbose = true; } else { $error_report_verbose = false; } cache_disable(); while (@ob_end_clean()) { } ob_start(); ob_implicit_flush(0); bh_error_send_email($exception); $error_msg_array = bh_error_process($exception); $error_log_message = sprintf('BEEHIVE_ERROR: %s', strip_tags(implode(". ", $error_msg_array))); @error_log($error_log_message); header_status(500, 'Internal Server Error'); $forum_path = server_get_forum_path(); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-gb\" lang=\"en-gb\" dir=\"ltr\">\n"; echo "<head>\n"; echo "<title>Beehive Forum - Error Handler</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; echo "<link rel=\"icon\" href=\"", rtrim($forum_path, '/'), "/styles/images/favicon.ico\" type=\"image/ico\" />\n"; echo "<link rel=\"stylesheet\" href=\"", rtrim($forum_path, '/'), "/styles/default/style.css?", md5(uniqid(rand())), "\" type=\"text/css\" />\n"; echo "<link rel=\"stylesheet\" href=\"", rtrim($forum_path, '/'), "/styles/default/images.css?", md5(uniqid(rand())), "\" type=\"text/css\" />\n"; echo "</head>\n"; echo "<body>\n"; echo "<h1>Error</h1>\n"; echo "<br />\n"; if (defined('BEEHIVEMODE_LIGHT') && !defined('BEEHIVE_DEVELOPER_MODE')) { echo '<p>An error has occurred. Please wait a few moments before trying again.</p>'; echo '<p>Details of the error have been saved to the default error log.</p>'; if (isset($error_report_verbose) && $error_report_verbose == true) { echo '<p>When reporting a bug in Project Beehive or when requesting support please include the details below.</p>'; echo "<table cellpadding=\"0\" cellspacing=\"0\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><span class=\"image warning\"></span></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">Please note that there may be sensitive information such as passwords displayed here.</td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "<p>", implode("</p><p>", $error_msg_array), "</p>\n"; } } else { echo "<div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"800\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">Error</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"posthead\" width=\"98%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">An error has occured. Please wait a few moments and then click the Retry button below. Details of the error have been saved to the default error log.</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; if (isset($error_report_verbose) && $error_report_verbose == true || defined('BEEHIVE_DEVELOPER_MODE')) { echo " <br />\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"800\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">Error Details</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"posthead\" width=\"98%\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><span class=\"image warning\"></span></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">When reporting a bug in Project Beehive or when requesting support please include the details below.</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><span class=\"image warning\"></span></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">Please note that there may be sensitive information such as passwords displayed here.</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td>\n"; echo " <div class=\"error_handler_details\">", implode("\n", $error_msg_array), "</div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; } echo " <br />\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"800\">\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <button class=\"button\" type=\"button\" onclick=\"window.location.reload()\">Retry</button>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</div>\n"; } echo "</body>\n"; echo "</html>\n"; exit; } catch (Exception $e) { printf('Exception thrown when handling an exception: %s', $exception->getMessage()); exit; } }