indentations
This commit is contained in:
parent
d4ce764d77
commit
b656be751d
@ -31,11 +31,11 @@ class RoundStats {
|
|||||||
**/
|
**/
|
||||||
public function getNextBlock($iHeight=0) {
|
public function getNextBlock($iHeight=0) {
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT height
|
SELECT height
|
||||||
FROM $this->tableBlocks
|
FROM $this->tableBlocks
|
||||||
WHERE height > ?
|
WHERE height > ?
|
||||||
ORDER BY height ASC
|
ORDER BY height ASC
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
return $result->fetch_object()->height;
|
return $result->fetch_object()->height;
|
||||||
return false;
|
return false;
|
||||||
@ -46,11 +46,11 @@ class RoundStats {
|
|||||||
**/
|
**/
|
||||||
public function getPreviousBlock($iHeight=0) {
|
public function getPreviousBlock($iHeight=0) {
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT height
|
SELECT height
|
||||||
FROM $this->tableBlocks
|
FROM $this->tableBlocks
|
||||||
WHERE height < ?
|
WHERE height < ?
|
||||||
ORDER BY height DESC
|
ORDER BY height DESC
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
return $result->fetch_object()->height;
|
return $result->fetch_object()->height;
|
||||||
return false;
|
return false;
|
||||||
@ -63,12 +63,12 @@ class RoundStats {
|
|||||||
**/
|
**/
|
||||||
public function getDetailsForBlockHeight($iHeight=0, $isAdmin=0) {
|
public function getDetailsForBlockHeight($iHeight=0, $isAdmin=0) {
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
b.id, height, amount, confirmations, difficulty, FROM_UNIXTIME(time) as time, shares,
|
b.id, height, amount, confirmations, difficulty, FROM_UNIXTIME(time) as time, shares,
|
||||||
IF(a.is_anonymous, IF( ? , a.username, 'anonymous'), a.username) AS finder
|
IF(a.is_anonymous, IF( ? , a.username, 'anonymous'), a.username) AS finder
|
||||||
FROM $this->tableBlocks as b
|
FROM $this->tableBlocks as b
|
||||||
LEFT JOIN $this->tableUsers AS a ON b.account_id = a.id
|
LEFT JOIN $this->tableUsers AS a ON b.account_id = a.id
|
||||||
WHERE b.height = ? LIMIT 1");
|
WHERE b.height = ? LIMIT 1");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $isAdmin, $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $isAdmin, $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
return $result->fetch_assoc();
|
return $result->fetch_assoc();
|
||||||
return false;
|
return false;
|
||||||
@ -82,16 +82,16 @@ class RoundStats {
|
|||||||
public function getRoundStatsForAccounts($iHeight=0, $isAdmin=0) {
|
public function getRoundStatsForAccounts($iHeight=0, $isAdmin=0) {
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
IF(a.is_anonymous, IF( ? , a.username, 'anonymous'), a.username) AS username,
|
IF(a.is_anonymous, IF( ? , a.username, 'anonymous'), a.username) AS username,
|
||||||
s.valid,
|
s.valid,
|
||||||
s.invalid
|
s.invalid
|
||||||
FROM $this->tableStats AS s
|
FROM $this->tableStats AS s
|
||||||
LEFT JOIN $this->tableBlocks AS b ON s.block_id = b.id
|
LEFT JOIN $this->tableBlocks AS b ON s.block_id = b.id
|
||||||
LEFT JOIN $this->tableUsers AS a ON a.id = s.account_id
|
LEFT JOIN $this->tableUsers AS a ON a.id = s.account_id
|
||||||
WHERE b.height = ?
|
WHERE b.height = ?
|
||||||
GROUP BY username ASC
|
GROUP BY username ASC
|
||||||
ORDER BY valid DESC
|
ORDER BY valid DESC
|
||||||
");
|
");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $isAdmin, $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $isAdmin, $iHeight) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
return $result->fetch_all(MYSQLI_ASSOC);
|
return $result->fetch_all(MYSQLI_ASSOC);
|
||||||
return false;
|
return false;
|
||||||
@ -106,10 +106,10 @@ class RoundStats {
|
|||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
t.id AS id,
|
t.id AS id,
|
||||||
a.username AS username,
|
a.username AS username,
|
||||||
t.type AS type,
|
t.type AS type,
|
||||||
t.amount AS amount
|
t.amount AS amount
|
||||||
FROM $this->tableTrans AS t
|
FROM $this->tableTrans AS t
|
||||||
LEFT JOIN $this->tableBlocks AS b ON t.block_id = b.id
|
LEFT JOIN $this->tableBlocks AS b ON t.block_id = b.id
|
||||||
LEFT JOIN $this->tableUsers AS a ON t.account_id = a.id
|
LEFT JOIN $this->tableUsers AS a ON t.account_id = a.id
|
||||||
@ -131,10 +131,10 @@ class RoundStats {
|
|||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
t.id AS id,
|
t.id AS id,
|
||||||
a.username AS username,
|
a.username AS username,
|
||||||
t.type AS type,
|
t.type AS type,
|
||||||
t.amount AS amount
|
t.amount AS amount
|
||||||
FROM $this->tableTrans AS t
|
FROM $this->tableTrans AS t
|
||||||
LEFT JOIN $this->tableBlocks AS b ON t.block_id = b.id
|
LEFT JOIN $this->tableBlocks AS b ON t.block_id = b.id
|
||||||
LEFT JOIN $this->tableUsers AS a ON t.account_id = a.id
|
LEFT JOIN $this->tableUsers AS a ON t.account_id = a.id
|
||||||
|
|||||||
@ -6,28 +6,28 @@ if (!defined('SECURITY')) die('Hacking attempt');
|
|||||||
if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||||
$debug->append('No cached version available, fetching from backend', 3);
|
$debug->append('No cached version available, fetching from backend', 3);
|
||||||
|
|
||||||
if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) {
|
if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) {
|
||||||
$iKey = $roundstats->getNextBlock($_REQUEST['height']);
|
$iKey = $roundstats->getNextBlock($_REQUEST['height']);
|
||||||
} else if (@$_REQUEST['prev'] && !empty($_REQUEST['height'])) {
|
} else if (@$_REQUEST['prev'] && !empty($_REQUEST['height'])) {
|
||||||
$iKey = $roundstats->getPreviousBlock($_REQUEST['height']);
|
$iKey = $roundstats->getPreviousBlock($_REQUEST['height']);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (empty($_REQUEST['height'])) {
|
if (empty($_REQUEST['height'])) {
|
||||||
$iBlock = $block->getLast();
|
$iBlock = $block->getLast();
|
||||||
$iKey = $iBlock['height'];
|
$iKey = $iBlock['height'];
|
||||||
} else {
|
} else {
|
||||||
$iKey = $_REQUEST['height'];
|
$iKey = $_REQUEST['height'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo $iKey;
|
echo $iKey;
|
||||||
$aDetailsForBlockHeight = $roundstats->getDetailsForBlockHeight($iKey, $user->isAdmin($_SESSION['USERDATA']['id']));
|
$aDetailsForBlockHeight = $roundstats->getDetailsForBlockHeight($iKey, $user->isAdmin($_SESSION['USERDATA']['id']));
|
||||||
$aRoundShareStats = $roundstats->getRoundStatsForAccounts($iKey, $user->isAdmin($_SESSION['USERDATA']['id']));
|
$aRoundShareStats = $roundstats->getRoundStatsForAccounts($iKey, $user->isAdmin($_SESSION['USERDATA']['id']));
|
||||||
|
|
||||||
if ($user->isAdmin($_SESSION['USERDATA']['id'])) {
|
if ($user->isAdmin($_SESSION['USERDATA']['id'])) {
|
||||||
$aUserRoundTransactions = $roundstats->getAllRoundTransactions($iKey);
|
$aUserRoundTransactions = $roundstats->getAllRoundTransactions($iKey);
|
||||||
} else {
|
} else {
|
||||||
$aUserRoundTransactions = $roundstats->getUserRoundTransactions($iKey, $_SESSION['USERDATA']['id']);
|
$aUserRoundTransactions = $roundstats->getUserRoundTransactions($iKey, $_SESSION['USERDATA']['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Propagate content our template
|
// Propagate content our template
|
||||||
$smarty->assign('BLOCKDETAILS', $aDetailsForBlockHeight);
|
$smarty->assign('BLOCKDETAILS', $aDetailsForBlockHeight);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user