/** * The render function will take a DatabaseException and output a * HTML page. * * @param DatabaseException $e * The Exception object * @return string * An HTML string */ public static function render($e) { $trace = NULL; $odd = true; foreach ($e->getTrace() as $t) { $trace .= sprintf('<li%s><code>[%s:%d] <strong>%s%s%s();</strong></code></li>', $odd == true ? ' class="odd"' : NULL, $t['file'], $t['line'], isset($t['class']) ? $t['class'] : NULL, isset($t['type']) ? $t['type'] : NULL, $t['function']); $odd = !$odd; } $queries = NULL; $odd = true; if (is_object(Symphony::Database())) { $debug = Symphony::Database()->debug(); if (count($debug['query']) > 0) { foreach ($debug['query'] as $query) { $queries .= sprintf('<li%s><code>%s;</code> <small>[%01.4f]</small></li>', $odd == true ? ' class="odd"' : NULL, htmlspecialchars($query['query']), isset($query['time']) ? $query['time'] : NULL); $odd = !$odd; } } } return sprintf(file_get_contents(TEMPLATE . '/fatalerror.tpl'), $e->getDatabaseErrorMessage(), $e->getQuery(), $trace, $queries); }