Merge pull request #413 from TheSerapher/issue-408

Issue 408
This commit is contained in:
Sebastian Grewe 2013-07-09 14:22:33 -07:00
commit 70644b4299
8 changed files with 36 additions and 6 deletions

View File

@ -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

View File

@ -18,3 +18,4 @@ if ($bitcoin->can_connect() === true){
$smarty->assign("CURRENTBLOCK", $iBlock);
$smarty->assign("DIFFICULTY", $dDifficulty);
$smarty->assign("CONTENT", "default.tpl");
?>

View File

@ -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");
}
?>

View File

@ -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");

View File

@ -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'],

View File

@ -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>

View File

@ -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>

View File

@ -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>