summaryrefslogtreecommitdiffstats
path: root/application/errors/error_general.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/errors/error_general.php')
-rw-r--r--application/errors/error_general.php52
1 files changed, 51 insertions, 1 deletions
diff --git a/application/errors/error_general.php b/application/errors/error_general.php
index fd63ce2c5..be495e4f6 100644
--- a/application/errors/error_general.php
+++ b/application/errors/error_general.php
@@ -1,3 +1,51 @@
+<?php
+
+// fancy error page only works if we can load helpers
+if (class_exists("CI_Controller") && !isset($GLOBALS["is_error_page"])) {
+ if (!isset($title)) {
+ $title = "Error";
+ }
+ $GLOBALS["is_error_page"] = true;
+
+ $CI =& get_instance();
+ $CI->load->helper("filebin");
+ $CI->load->helper("url");
+
+ if ($CI->input->is_cli_request()) {
+ is_cli_client(true);
+ }
+
+ if (static_storage("response_type") == "json") {
+ $message = str_replace("</p>", "</p>\n", $message);
+ $array = array(
+ "status" => "error",
+ "message" => strip_tags($message),
+ );
+ header('Content-type: application/json');
+ echo json_encode($array);
+ exit();
+ }
+
+ if (is_cli_client()) {
+ $message = str_replace("</p>", "</p>\n", $message);
+ $message = strip_tags($message);
+ echo "$heading: $message\n";
+ exit();
+ }
+
+ include 'application/views/header.php';
+
+ ?>
+ <div class="error">
+ <h1><?php echo $heading; ?></h1>
+ <?php echo $message; ?>
+ </div>
+
+ <?php
+ include 'application/views/footer.php';
+} else {
+ // default CI error page
+?>
<!DOCTYPE html>
<html lang="en">
<head>
@@ -59,4 +107,6 @@ p {
<?php echo $message; ?>
</div>
</body>
-</html> \ No newline at end of file
+</html>
+<?php
+}