Allow Public ACL for all round transactions

This commit is contained in:
Sebastian Grewe 2013-09-25 10:34:36 +02:00
parent bb924f82fe
commit 6c3d2d1e96
3 changed files with 12 additions and 5 deletions

View File

@ -102,12 +102,12 @@ class RoundStats {
* @param height int Block Height
* @return data array Block round transactions
**/
public function getAllRoundTransactions($iHeight=0) {
public function getAllRoundTransactions($iHeight=0, $admin) {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("
SELECT
t.id AS id,
a.username AS username,
IF(a.is_anonymous, IF( ? , a.username, 'anonymous'), a.username) AS username,
t.type AS type,
t.amount AS amount
FROM $this->tableTrans AS t
@ -115,7 +115,7 @@ class RoundStats {
LEFT JOIN $this->tableUsers AS a ON t.account_id = a.id
WHERE b.height = ?
ORDER BY id ASC");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $admin, $iHeight) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_all(MYSQLI_ASSOC);
$this->debug->append('Unable to fetch transactions');
return false;

View File

@ -165,6 +165,13 @@ $aSettings['acl'][] = array(
'name' => 'acl_round_statistics', 'value' => $setting->getValue('acl_round_statistics'),
'tooltip' => 'Make the round statistics page private (users only) or public.'
);
$aSettings['acl'][] = array(
'display' => 'Round Transactions', 'type' => 'select',
'options' => array( 0 => 'Admins', 1 => 'Public'),
'default' => 0,
'name' => 'acl_round_transactions', 'value' => $setting->getValue('acl_round_transactions'),
'tooltip' => 'Display all transactions regardless of admin status.'
);
$aSettings['system'][] = array(
'display' => 'Disable e-mail confirmations', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),

View File

@ -22,8 +22,8 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$aDetailsForBlockHeight = $roundstats->getDetailsForBlockHeight($iKey, $user->isAdmin(@$_SESSION['USERDATA']['id']));
$aRoundShareStats = $roundstats->getRoundStatsForAccounts($iKey, $user->isAdmin(@$_SESSION['USERDATA']['id']));
if ($user->isAdmin(@$_SESSION['USERDATA']['id'])) {
$aUserRoundTransactions = $roundstats->getAllRoundTransactions($iKey);
if ($user->isAdmin(@$_SESSION['USERDATA']['id']) || $setting->getValue('acl_round_transactions')) {
$aUserRoundTransactions = $roundstats->getAllRoundTransactions($iKey, @$_SESSION['USERDATA']['id']);
} else {
$aUserRoundTransactions = $roundstats->getUserRoundTransactions($iKey, @$_SESSION['USERDATA']['id']);
}