Modified INTERNAL_ERROR to support inclusion of the blank layout, since all the javascript is lost otherwise. This should only matter for development. Also, fixed a bug with rendering when redirect is called but headers have already been output.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@560 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-14 21:10:16 +00:00
parent 41321481c7
commit 778bb43895
3 changed files with 32 additions and 11 deletions

View File

@@ -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 " <cell><![CDATA[$data]]></cell>\n";
}
function INTERNAL_ERROR($msg, $depth = 0) {
INTERNAL_ERROR($msg, false, $depth+1);
$this->render_empty();
$this->_stop();
}
function render_empty() {
$this->render('/empty');
}
}
?>

View File

@@ -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();
}
}

View File

@@ -32,16 +32,17 @@
*
*/
function INTERNAL_ERROR($message) {
echo '<DIV class="internal-error" style="color:#000; background:#c22; padding:0.5em 1.5em 0.5em 1.5em;">';
echo '<H1 style="margin-bottom:0.2em">INTERNAL ERROR:</H1>';
echo '<H2 style="margin-top:0; margin-left:1.5em">' . $message . '</H2>';
echo '<H4>This error was not caused by anything that you did wrong.';
echo '<BR>It is a problem within the application itself and should be reported to the administrator.</H4>';
function INTERNAL_ERROR($message, $exit = true, $drop = 0) {
echo '<DIV class="internal-error" style="color:#000; background:#c22; padding:0.5em 1.5em 0.5em 1.5em;">' . "\n";
echo '<H1 style="color:#000; margin-bottom:0.2em; font-size:2em;">INTERNAL ERROR:</H1>' . "\n";
echo '<H2 style="color:#000; margin-top:0; margin-left:1.5em; font-size:1.5em">' . $message . '</H2>' . "\n";
echo '<H4 style="color:#000;">This error was not caused by anything that you did wrong.' . "\n";
echo '<BR>It is a problem within the application itself and should be reported to the administrator.</H4>' . "\n";
// Print out the entire stack trace
echo "\n<HR>Stack Trace:<OL>\n";
$trace = debug_backtrace(false);
echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\nStack Trace:\n";
echo '<OL style="margin-left:1.5em";>' . "\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 "</OL>\n";
echo "\n<HR>HTTP Request<P><PRE>\n";
echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\nHTTP Request:\n";
echo '<P><PRE style="color:#000; background:#c22;">' . "\n";
print_r($_REQUEST);
echo "\n</PRE>\n";
echo '</DIV>';
die();
if ($exit)
die();
}
/**