From 13c06715fc0542c3bfef69f8eff6a361da1d3e7a Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 19 Oct 2013 09:16:57 +0200 Subject: [PATCH 1/2] [IMPROVED] Adding customizable error page to MPOS * `.htaccess` is used to re-define the error documents * redirects to `index.php?page=error&action=` * does not work for MPOS inside subfolders yet Addresses #734. If this works we can add this to all the other themes. --- public/.htaccess | 1 + public/include/pages/error.inc.php | 9 +++++++++ public/include/pages/error/404.inc.php | 9 +++++++++ public/templates/mpos/error/404/default.tpl | 6 ++++++ public/templates/mpos/error/default.tpl | 6 ++++++ 5 files changed, 31 insertions(+) create mode 100644 public/include/pages/error.inc.php create mode 100644 public/include/pages/error/404.inc.php create mode 100644 public/templates/mpos/error/404/default.tpl create mode 100644 public/templates/mpos/error/default.tpl diff --git a/public/.htaccess b/public/.htaccess index 1caaddc0..9750f3bb 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,3 +1,4 @@ +ErrorDocument 404 /index.php?page=error&action=404 RedirectMatch 404 /templates(/|$) RedirectMatch 404 /include(/|$) RedirectMatch 404 /.git(/|$) diff --git a/public/include/pages/error.inc.php b/public/include/pages/error.inc.php new file mode 100644 index 00000000..aecab054 --- /dev/null +++ b/public/include/pages/error.inc.php @@ -0,0 +1,9 @@ +assign("CONTENT", "default.tpl"); +?> diff --git a/public/include/pages/error/404.inc.php b/public/include/pages/error/404.inc.php new file mode 100644 index 00000000..aecab054 --- /dev/null +++ b/public/include/pages/error/404.inc.php @@ -0,0 +1,9 @@ +assign("CONTENT", "default.tpl"); +?> diff --git a/public/templates/mpos/error/404/default.tpl b/public/templates/mpos/error/404/default.tpl new file mode 100644 index 00000000..36f017b7 --- /dev/null +++ b/public/templates/mpos/error/404/default.tpl @@ -0,0 +1,6 @@ +
+

{$GLOBAL.website.name}

+
+

The page you requested was not found.

+
+
diff --git a/public/templates/mpos/error/default.tpl b/public/templates/mpos/error/default.tpl new file mode 100644 index 00000000..36f017b7 --- /dev/null +++ b/public/templates/mpos/error/default.tpl @@ -0,0 +1,6 @@ +
+

{$GLOBAL.website.name}

+
+

The page you requested was not found.

+
+
From bbbd5eda5217a93ad02295640d186c7347e7c360 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 22 Oct 2013 16:05:55 +0200 Subject: [PATCH 2/2] [IMPROVE] 404 handling * [ADDED] Error/404 templates to mmcFE & mobile themes * [IMPROVED] Make 404 default error with unknown page parameter --- public/index.php | 8 +++++++- public/templates/mmcFE/error/404/default.tpl | 3 +++ public/templates/mmcFE/error/default.tpl | 3 +++ public/templates/mmcFE/global/login.tpl | 2 +- public/templates/mobile/error/404/default.tpl | 1 + public/templates/mobile/error/default.tpl | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 public/templates/mmcFE/error/404/default.tpl create mode 100644 public/templates/mmcFE/error/default.tpl create mode 100644 public/templates/mobile/error/404/default.tpl create mode 100644 public/templates/mobile/error/default.tpl diff --git a/public/index.php b/public/index.php index f8ccb438..db94059e 100644 --- a/public/index.php +++ b/public/index.php @@ -51,7 +51,13 @@ if (is_dir(INCLUDE_DIR . '/pages/')) { } // Set a default action here if no page has been requested -$page = isset($_REQUEST['page']) && isset($arrPages[$_REQUEST['page']]) ? $_REQUEST['page'] : 'home'; +if (isset($_REQUEST['page']) && isset($arrPages[$_REQUEST['page']])) { + $page = $_REQUEST['page']; +} else if (isset($_REQUEST['page']) && ! isset($arrPages[$_REQUEST['page']])) { + $page = 'error'; +} else { + $page = 'home'; +} // Create our pages array from existing files if (is_dir(INCLUDE_DIR . '/pages/' . $page)) { diff --git a/public/templates/mmcFE/error/404/default.tpl b/public/templates/mmcFE/error/404/default.tpl new file mode 100644 index 00000000..a951eb30 --- /dev/null +++ b/public/templates/mmcFE/error/404/default.tpl @@ -0,0 +1,3 @@ +{include file="global/block_header.tpl" BLOCK_HEADER="{$GLOBAL.website.name}" BLOCK_STYLE="clear:none; margin-left:13px; margin-top:15px;"} +

The page you requested was not found.

+{include file="global/block_footer.tpl"} diff --git a/public/templates/mmcFE/error/default.tpl b/public/templates/mmcFE/error/default.tpl new file mode 100644 index 00000000..a951eb30 --- /dev/null +++ b/public/templates/mmcFE/error/default.tpl @@ -0,0 +1,3 @@ +{include file="global/block_header.tpl" BLOCK_HEADER="{$GLOBAL.website.name}" BLOCK_STYLE="clear:none; margin-left:13px; margin-top:15px;"} +

The page you requested was not found.

+{include file="global/block_footer.tpl"} diff --git a/public/templates/mmcFE/global/login.tpl b/public/templates/mmcFE/global/login.tpl index 363f403e..9df043a0 100644 --- a/public/templates/mmcFE/global/login.tpl +++ b/public/templates/mmcFE/global/login.tpl @@ -1,4 +1,4 @@ -{include file="global/block_header.tpl" BLOCK_HEADER="Login" BLOCK_STYLE="clear:none; margin-left:13px; margin-top:15px;"} +{include file="global/block_header.tpl" BLOCK_HEADER="Login" BLOCK_STYLE="clear:none; margin-left:13px; margin-top:15px;"}

diff --git a/public/templates/mobile/error/404/default.tpl b/public/templates/mobile/error/404/default.tpl new file mode 100644 index 00000000..c423d2fa --- /dev/null +++ b/public/templates/mobile/error/404/default.tpl @@ -0,0 +1 @@ +

The page you requested was not found.

diff --git a/public/templates/mobile/error/default.tpl b/public/templates/mobile/error/default.tpl new file mode 100644 index 00000000..c423d2fa --- /dev/null +++ b/public/templates/mobile/error/default.tpl @@ -0,0 +1 @@ +

The page you requested was not found.