diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index cee6d5de..cb6b8fd0 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -121,6 +121,22 @@ $config['website']['theme'] = 'mmcFE'; $config['website']['mobile'] = true; $config['website']['mobile_theme'] = 'mobile'; +/** + * Some basic access restrictions on some pages + * + * Explanation: + * Some pools would like to run a few pages for public access instead + * of enforcing a login. You can change visibility of some pages here. + * + * Options: + * 'public' : Allow guest access and authenticated user to view page + * 'private' : Only allow logged in users access to view page + * + * Defaults: + * 'private' for every page + **/ +$config['website']['acl']['statistics']['pool'] = 'private'; +$config['website']['acl']['statistics']['blocks'] = 'private'; /** * Re-Captcha settings diff --git a/public/include/pages/statistics.inc.php b/public/include/pages/statistics.inc.php index dc27fde6..3307dd21 100644 --- a/public/include/pages/statistics.inc.php +++ b/public/include/pages/statistics.inc.php @@ -18,3 +18,4 @@ if ($bitcoin->can_connect() === true){ $smarty->assign("CURRENTBLOCK", $iBlock); $smarty->assign("DIFFICULTY", $dDifficulty); $smarty->assign("CONTENT", "default.tpl"); +?> diff --git a/public/include/pages/statistics/blocks.inc.php b/public/include/pages/statistics/blocks.inc.php index 6c3b00b8..22eeadff 100644 --- a/public/include/pages/statistics/blocks.inc.php +++ b/public/include/pages/statistics/blocks.inc.php @@ -2,7 +2,6 @@ // Make sure we are called from index.php if (!defined('SECURITY')) die('Hacking attempt'); -if (!$user->isAuthenticated()) header("Location: index.php?page=home"); // Grab the last blocks found $iLimit = 20; @@ -12,5 +11,9 @@ $aBlocksFoundData = $statistics->getBlocksFound($iLimit); $smarty->assign("BLOCKSFOUND", $aBlocksFoundData); $smarty->assign("BLOCKLIMIT", $iLimit); -$smarty->assign("CONTENT", "default.tpl"); +if ($config['website']['acl']['statistics']['blocks'] == 'public') { + $smarty->assign("CONTENT", "default.tpl"); +} else if ($user->isAuthenticated()) { + $smarty->assign("CONTENT", "default.tpl"); +} ?> diff --git a/public/include/pages/statistics/pool.inc.php b/public/include/pages/statistics/pool.inc.php index 1cab1009..27395cc1 100644 --- a/public/include/pages/statistics/pool.inc.php +++ b/public/include/pages/statistics/pool.inc.php @@ -53,7 +53,9 @@ count($aBlockData) > 0 ? $smarty->assign("LASTBLOCK", $aBlockData['height']) : $ $smarty->assign("DIFFICULTY", $dDifficulty); $smarty->assign("REWARD", $config['reward']); -if ($user->isAuthenticated()) { +if ($config['website']['acl']['statistics']['pool'] == 'public') { + $smarty->assign("CONTENT", "authenticated.tpl"); +} else if ($user->isAuthenticated() && $config['website']['acl']['statistics']['pool'] == 'private') { $smarty->assign("CONTENT", "authenticated.tpl"); } else { $smarty->assign("CONTENT", "../default.tpl"); diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index cc162501..e83b1ca3 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -47,7 +47,7 @@ $aGlobal = array( 'blockexplorer' => $config['blockexplorer'], 'chaininfo' => $config['chaininfo'], 'config' => array( - 'website' => array( 'title' => $config['website']['title'] ), + 'website' => array( 'title' => $config['website']['title'], 'acl' => $config['website']['acl'] ), 'price' => array( 'currency' => $config['price']['currency'] ), 'targetdiff' => $config['difficulty'], 'currency' => $config['currency'], diff --git a/public/templates/mmcFE/global/navigation.tpl b/public/templates/mmcFE/global/navigation.tpl index 70619098..6cafd1f6 100644 --- a/public/templates/mmcFE/global/navigation.tpl +++ b/public/templates/mmcFE/global/navigation.tpl @@ -31,6 +31,14 @@ {else}
  • Statistics + {/if}
  • Getting Started
  • Support
  • diff --git a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl index 7b294265..a2a6ed58 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl @@ -23,7 +23,7 @@ {if $GLOBAL.config.price.currency}{($estday * $GLOBAL.price)|default:"n/a"|number_format:"2"}{/if} {/section} -{if $listed != 1} +{if $listed != 1 && $GLOBAL.userdata.username|default:""} {if $GLOBAL.userdata.hashrate > 0}{math assign="myestday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.hashrate}{/if} n/a diff --git a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl index 444effa4..2a482209 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl @@ -18,7 +18,7 @@ {$CONTRIBSHARES[hashrate].shares|number_format} {/section} -{if $listed != 1} +{if $listed != 1 && $GLOBAL.userdata.username|default:""} n/a {$GLOBAL.userdata.username}