summaryrefslogtreecommitdiff
path: root/inc/display.php
diff options
context:
space:
mode:
authorjove <no@no.com>2016-08-22 23:39:36 +0100
committerjove <no@no.com>2016-08-22 23:39:36 +0100
commit77b99b2c4f64b73b062f2d542fbf04903a1d814d (patch)
tree5a834aec99967d1a7c24c6b7dd93de76b2ff8cde /inc/display.php
parentd0d83ab8d7669a38700dfc04229a279f6c0e482c (diff)
Finishes error reworking.
Diffstat (limited to 'inc/display.php')
-rw-r--r--inc/display.php58
1 files changed, 0 insertions, 58 deletions
diff --git a/inc/display.php b/inc/display.php
index d7cb3355..ce39197c 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -71,64 +71,6 @@ function createBoardlist($mod=false) {
);
}
-function error($message, $priority = true, $debug_stuff = false) {
- global $board, $mod, $config, $db_error;
-
- if ($config['syslog'] && $priority !== false) {
- // Use LOG_NOTICE instead of LOG_ERR or LOG_WARNING because most error message are not significant.
- _syslog($priority !== true ? $priority : LOG_NOTICE, $message);
- }
-
- if (defined('STDIN')) {
- // Running from CLI
- echo('Error: ' . $message . "\n");
- debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
- die();
- }
-
- if ($config['debug']) {
- $debug_stuff=array();
- if(isset($db_error)){
- $debug_stuff = array_combine(array('SQLSTATE', 'Error code', 'Error message'), $db_error);
- }
- $debug_stuff['backtrace'] = debug_backtrace();
- $pw = $config['db']['password'];
- $debug_callback = function(&$item) use (&$debug_callback, $pw) {
- if (is_array($item)) {
- return array_map($item, $debug_callback);
- }
- return ($item == $pw ? 'hunter2' : $item);
- };
- $debug_stuff = array_map($debug_stuff, $debug_callback);
- }
-
- header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
-
- // Is there a reason to disable this?
- if (isset($_POST['json_response'])) {
- header('Content-Type: text/json; charset=utf-8');
- $data=array('error'=>$message);
- if($config['debug']){
- $data['debug']=$debug_stuff;
- }
- print json_encode($data);
- exit();
- }
-
-
- die(Element('page.html', array(
- 'config' => $config,
- 'title' => _('Error'),
- 'subtitle' => _('An error has occured.'),
- 'body' => Element('error.html', array(
- 'config' => $config,
- 'message' => $message,
- 'mod' => $mod,
- 'board' => isset($board) ? $board : false,
- 'debug' => str_replace("\n", '&#10;', utf8tohtml(print_r($debug_stuff, true)))
- ))
- )));
-}
function loginForm($error=false, $username=false, $redirect=false) {
global $config;