summaryrefslogtreecommitdiffstats
path: root/application/views/errors/html/error_general.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/views/errors/html/error_general.php')
-rw-r--r--application/views/errors/html/error_general.php44
1 files changed, 42 insertions, 2 deletions
diff --git a/application/views/errors/html/error_general.php b/application/views/errors/html/error_general.php
index fc3b2ebad..0f809dccd 100644
--- a/application/views/errors/html/error_general.php
+++ b/application/views/errors/html/error_general.php
@@ -1,5 +1,43 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
+
+// fancy error page only works if we can load helpers
+if (class_exists("CI_Controller") && !isset($GLOBALS["is_error_page"]) && isset(get_instance()->load)) {
+ if (!isset($title)) {
+ $title = "Error";
+ }
+ $GLOBALS["is_error_page"] = true;
+
+ $CI =& get_instance();
+ $CI->load->helper("filebin");
+ $CI->load->helper("url");
+
+ if (is_cli()) {
+ $message = str_replace("</p>", "</p>\n", $message);
+ $message = strip_tags($message);
+ echo "$heading: $message\n";
+ exit();
+ }
+
+ include APPPATH.'views/header.php';
+
+ ?>
+ <div class="error">
+ <h1><?php echo $heading; ?></h1>
+ <?php echo $message; ?>
+ </div>
+
+ <?php
+ include APPPATH.'views/footer.php';
+} elseif (php_sapi_name() === 'cli' OR defined('STDIN')) {
+ echo "# $heading\n";
+ $msg = strip_tags(str_replace("<br>", "\n", $message));
+ foreach (explode("\n", $msg) as $line) {
+ echo "# $line\n";
+ }
+ exit(255);
+} else {
+ // default CI error page
?><!DOCTYPE html>
<html lang="en">
<head>
@@ -50,7 +88,7 @@ code {
box-shadow: 0 0 8px #D0D0D0;
}
-p {
+p, div {
margin: 12px 15px 12px 15px;
}
</style>
@@ -61,4 +99,6 @@ p {
<?php echo $message; ?>
</div>
</body>
-</html> \ No newline at end of file
+</html>
+<?php
+}