From 13c06715fc0542c3bfef69f8eff6a361da1d3e7a Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 19 Oct 2013 09:16:57 +0200 Subject: [PATCH 1/5] [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/5] [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.

From f42d4205618de9847bec2bcec354a4928d294d83 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 22 Oct 2013 16:17:12 +0200 Subject: [PATCH 3/5] [FIX] Contirbutor detection Fixes #745 once merged. --- .../templates/mmcFE/statistics/pool/contributors_hashrate.tpl | 2 +- public/templates/mmcFE/statistics/pool/contributors_shares.tpl | 2 +- public/templates/mpos/statistics/pool/contributors_hashrate.tpl | 2 +- public/templates/mpos/statistics/pool/contributors_shares.tpl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl index 212a4695..5be84abe 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl @@ -15,7 +15,7 @@ {assign var=listed value=0} {section contrib $CONTRIBHASHES} {math assign="estday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} - + {$rank++} {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} {($CONTRIBHASHES[contrib].hashrate * $GLOBAL.hashmods.personal)|number_format:"2"} diff --git a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl index 6dd36eb8..948d2abf 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl @@ -12,7 +12,7 @@ {assign var=rank value=1} {assign var=listed value=0} {section shares $CONTRIBSHARES} - + {$rank++} {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} {$CONTRIBSHARES[shares].shares|number_format} diff --git a/public/templates/mpos/statistics/pool/contributors_hashrate.tpl b/public/templates/mpos/statistics/pool/contributors_hashrate.tpl index aa121749..6f738777 100644 --- a/public/templates/mpos/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mpos/statistics/pool/contributors_hashrate.tpl @@ -17,7 +17,7 @@ {assign var=listed value=0} {section contrib $CONTRIBHASHES} {math assign="estday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} - + {$rank++} {if $CONTRIBHASHES[contrib].donate_percent > 0}{/if} {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} diff --git a/public/templates/mpos/statistics/pool/contributors_shares.tpl b/public/templates/mpos/statistics/pool/contributors_shares.tpl index 5af2b911..e4a0194a 100644 --- a/public/templates/mpos/statistics/pool/contributors_shares.tpl +++ b/public/templates/mpos/statistics/pool/contributors_shares.tpl @@ -13,7 +13,7 @@ {assign var=rank value=1} {assign var=listed value=0} {section shares $CONTRIBSHARES} - + {$rank++} {if $CONTRIBSHARES[shares].donate_percent > 0}{/if} {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} From d3d183cfe0cecbf69d49eb1d5c2f8be4537d5d86 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 22 Oct 2013 16:27:37 +0200 Subject: [PATCH 4/5] [FIX] Next attempt to fix #745 --- .../templates/mmcFE/statistics/pool/contributors_hashrate.tpl | 2 +- public/templates/mmcFE/statistics/pool/contributors_shares.tpl | 2 +- public/templates/mpos/statistics/pool/contributors_hashrate.tpl | 2 +- public/templates/mpos/statistics/pool/contributors_shares.tpl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl index 5be84abe..f971fcc3 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl @@ -15,7 +15,7 @@ {assign var=listed value=0} {section contrib $CONTRIBHASHES} {math assign="estday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} - + {$rank++} {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} {($CONTRIBHASHES[contrib].hashrate * $GLOBAL.hashmods.personal)|number_format:"2"} diff --git a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl index 948d2abf..a628c75b 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl @@ -12,7 +12,7 @@ {assign var=rank value=1} {assign var=listed value=0} {section shares $CONTRIBSHARES} - + {$rank++} {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} {$CONTRIBSHARES[shares].shares|number_format} diff --git a/public/templates/mpos/statistics/pool/contributors_hashrate.tpl b/public/templates/mpos/statistics/pool/contributors_hashrate.tpl index 6f738777..9c9142f7 100644 --- a/public/templates/mpos/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mpos/statistics/pool/contributors_hashrate.tpl @@ -17,7 +17,7 @@ {assign var=listed value=0} {section contrib $CONTRIBHASHES} {math assign="estday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} - + {$rank++} {if $CONTRIBHASHES[contrib].donate_percent > 0}{/if} {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} diff --git a/public/templates/mpos/statistics/pool/contributors_shares.tpl b/public/templates/mpos/statistics/pool/contributors_shares.tpl index e4a0194a..4032007d 100644 --- a/public/templates/mpos/statistics/pool/contributors_shares.tpl +++ b/public/templates/mpos/statistics/pool/contributors_shares.tpl @@ -13,7 +13,7 @@ {assign var=rank value=1} {assign var=listed value=0} {section shares $CONTRIBSHARES} - + {$rank++} {if $CONTRIBSHARES[shares].donate_percent > 0}{/if} {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} From f4c68d721bf4243c6199b745aaff6a50efc744b9 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 22 Oct 2013 16:45:53 +0200 Subject: [PATCH 5/5] Revert "[FIX] Next attempt to fix #745" This reverts commit d3d183cfe0cecbf69d49eb1d5c2f8be4537d5d86. --- .../templates/mmcFE/statistics/pool/contributors_hashrate.tpl | 2 +- public/templates/mmcFE/statistics/pool/contributors_shares.tpl | 2 +- public/templates/mpos/statistics/pool/contributors_hashrate.tpl | 2 +- public/templates/mpos/statistics/pool/contributors_shares.tpl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl index f971fcc3..5be84abe 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl @@ -15,7 +15,7 @@ {assign var=listed value=0} {section contrib $CONTRIBHASHES} {math assign="estday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} - + {$rank++} {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} {($CONTRIBHASHES[contrib].hashrate * $GLOBAL.hashmods.personal)|number_format:"2"} diff --git a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl index a628c75b..948d2abf 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl @@ -12,7 +12,7 @@ {assign var=rank value=1} {assign var=listed value=0} {section shares $CONTRIBSHARES} - + {$rank++} {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} {$CONTRIBSHARES[shares].shares|number_format} diff --git a/public/templates/mpos/statistics/pool/contributors_hashrate.tpl b/public/templates/mpos/statistics/pool/contributors_hashrate.tpl index 9c9142f7..6f738777 100644 --- a/public/templates/mpos/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mpos/statistics/pool/contributors_hashrate.tpl @@ -17,7 +17,7 @@ {assign var=listed value=0} {section contrib $CONTRIBHASHES} {math assign="estday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} - + {$rank++} {if $CONTRIBHASHES[contrib].donate_percent > 0}{/if} {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} diff --git a/public/templates/mpos/statistics/pool/contributors_shares.tpl b/public/templates/mpos/statistics/pool/contributors_shares.tpl index 4032007d..e4a0194a 100644 --- a/public/templates/mpos/statistics/pool/contributors_shares.tpl +++ b/public/templates/mpos/statistics/pool/contributors_shares.tpl @@ -13,7 +13,7 @@ {assign var=rank value=1} {assign var=listed value=0} {section shares $CONTRIBSHARES} - + {$rank++} {if $CONTRIBSHARES[shares].donate_percent > 0}{/if} {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if}