Allow guest access to pages with config options
This will allow pool owners to make certain pages public accessible without user registration or login. Please check the config dist file for details. Fixes #408
This commit is contained in:
parent
b33f572774
commit
5acebc37d3
@ -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
|
||||
|
||||
@ -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");
|
||||
}
|
||||
?>
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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'],
|
||||
|
||||
@ -31,6 +31,14 @@
|
||||
</li>
|
||||
{else}
|
||||
<li><a href="{$smarty.server.PHP_SELF}?page=statistics">Statistics</a>
|
||||
<ul>
|
||||
{if $GLOBAL.config.website.acl.statistics.pool == 'public'}
|
||||
<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=pool">Pool Stats</a></li>
|
||||
{/if}
|
||||
{if $GLOBAL.config.website.acl.statistics.blocks == 'public'}
|
||||
<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=blocks">Block Stats</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
{/if}
|
||||
<li><a href="{$smarty.server.PHP_SELF}?page=gettingstarted">Getting Started</a></li>
|
||||
<li><a href="{$smarty.server.PHP_SELF}?page=support">Support</a></li>
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
{if $GLOBAL.config.price.currency}<td class="right">{($estday * $GLOBAL.price)|default:"n/a"|number_format:"2"}</td>{/if}
|
||||
</tr>
|
||||
{/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}
|
||||
<tr style="background-color:#99EB99;">
|
||||
<td>n/a</td>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<td class="right">{$CONTRIBSHARES[hashrate].shares|number_format}</td>
|
||||
</tr>
|
||||
{/section}
|
||||
{if $listed != 1}
|
||||
{if $listed != 1 && $GLOBAL.userdata.username|default:""}
|
||||
<tr style="background-color:#99EB99;">
|
||||
<td>n/a</td>
|
||||
<td>{$GLOBAL.userdata.username}</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user