diff --git a/site/app_controller.php b/site/app_controller.php index 42ae8b4..af2d4d0 100644 --- a/site/app_controller.php +++ b/site/app_controller.php @@ -108,7 +108,7 @@ class AppController extends Controller { // the debug output. So, since we can't redirect // anyway, we may as well go with the flow and just // render this page instead, using an empty template - $this->render('/empty'); + echo $this->render('/empty'); if ($exit) $this->_stop(); } @@ -862,5 +862,15 @@ class AppController extends Controller { echo " \n"; } + function INTERNAL_ERROR($msg, $depth = 0) { + INTERNAL_ERROR($msg, false, $depth+1); + $this->render_empty(); + $this->_stop(); + } + + function render_empty() { + $this->render('/empty'); + } + } ?> \ No newline at end of file diff --git a/site/app_model.php b/site/app_model.php index 456b381..65470ba 100644 --- a/site/app_model.php +++ b/site/app_model.php @@ -476,4 +476,12 @@ class AppModel extends Model { return date('Y-m-d', strtotime($dateString)); } + function INTERNAL_ERROR($msg, $depth = 0) { + INTERNAL_ERROR($msg, false, $depth+1); + echo $this->requestAction(array('controller' => 'accounts', + 'action' => 'render_empty'), + array('return', 'bare' => false) + ); + $this->_stop(); + } } diff --git a/site/config/bootstrap.php b/site/config/bootstrap.php index 3bf5e01..06af98a 100644 --- a/site/config/bootstrap.php +++ b/site/config/bootstrap.php @@ -32,16 +32,17 @@ * */ -function INTERNAL_ERROR($message) { - echo '
'; - echo '

INTERNAL ERROR:

'; - echo '

' . $message . '

'; - echo '

This error was not caused by anything that you did wrong.'; - echo '
It is a problem within the application itself and should be reported to the administrator.

'; +function INTERNAL_ERROR($message, $exit = true, $drop = 0) { + echo '
' . "\n"; + echo '

INTERNAL ERROR:

' . "\n"; + echo '

' . $message . '

' . "\n"; + echo '

This error was not caused by anything that you did wrong.' . "\n"; + echo '
It is a problem within the application itself and should be reported to the administrator.

' . "\n"; // Print out the entire stack trace - echo "\n
Stack Trace:
    \n"; - $trace = debug_backtrace(false); + echo '
    ' . "\nStack Trace:\n"; + echo '
      ' . "\n"; + $trace = array_slice(debug_backtrace(false), $drop); for ($i = 0; $i < count($trace); ++$i) { $bline = $trace[$i]['line']; $bfile = $trace[$i]['file']; @@ -60,12 +61,14 @@ function INTERNAL_ERROR($message) { } echo "
    \n"; - echo "\n
    HTTP Request

    \n";
    +  echo '
    ' . "\nHTTP Request:\n"; + echo '

    ' . "\n";
       print_r($_REQUEST);
       echo "\n
    \n"; echo '
'; - die(); + if ($exit) + die(); } /**