indentations

This commit is contained in:
Sebastian Grewe 2013-09-06 10:51:55 +02:00
parent d4ce764d77
commit b656be751d
2 changed files with 50 additions and 50 deletions

View File

@ -31,11 +31,11 @@ class RoundStats {
**/
public function getNextBlock($iHeight=0) {
$stmt = $this->mysqli->prepare("
SELECT height
FROM $this->tableBlocks
WHERE height > ?
ORDER BY height ASC
LIMIT 1");
SELECT height
FROM $this->tableBlocks
WHERE height > ?
ORDER BY height ASC
LIMIT 1");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_object()->height;
return false;
@ -46,11 +46,11 @@ class RoundStats {
**/
public function getPreviousBlock($iHeight=0) {
$stmt = $this->mysqli->prepare("
SELECT height
FROM $this->tableBlocks
WHERE height < ?
ORDER BY height DESC
LIMIT 1");
SELECT height
FROM $this->tableBlocks
WHERE height < ?
ORDER BY height DESC
LIMIT 1");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_object()->height;
return false;
@ -63,12 +63,12 @@ class RoundStats {
**/
public function getDetailsForBlockHeight($iHeight=0, $isAdmin=0) {
$stmt = $this->mysqli->prepare("
SELECT
b.id, height, amount, confirmations, difficulty, FROM_UNIXTIME(time) as time, shares,
IF(a.is_anonymous, IF( ? , a.username, 'anonymous'), a.username) AS finder
FROM $this->tableBlocks as b
LEFT JOIN $this->tableUsers AS a ON b.account_id = a.id
WHERE b.height = ? LIMIT 1");
SELECT
b.id, height, amount, confirmations, difficulty, FROM_UNIXTIME(time) as time, shares,
IF(a.is_anonymous, IF( ? , a.username, 'anonymous'), a.username) AS finder
FROM $this->tableBlocks as b
LEFT JOIN $this->tableUsers AS a ON b.account_id = a.id
WHERE b.height = ? LIMIT 1");
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $isAdmin, $iHeight) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_assoc();
return false;
@ -82,16 +82,16 @@ class RoundStats {
public function getRoundStatsForAccounts($iHeight=0, $isAdmin=0) {
$stmt = $this->mysqli->prepare("
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.invalid
FROM $this->tableStats AS s
LEFT JOIN $this->tableBlocks AS b ON s.block_id = b.id
LEFT JOIN $this->tableUsers AS a ON a.id = s.account_id
WHERE b.height = ?
GROUP BY username ASC
ORDER BY valid DESC
");
FROM $this->tableStats AS s
LEFT JOIN $this->tableBlocks AS b ON s.block_id = b.id
LEFT JOIN $this->tableUsers AS a ON a.id = s.account_id
WHERE b.height = ?
GROUP BY username ASC
ORDER BY valid DESC
");
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $isAdmin, $iHeight) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_all(MYSQLI_ASSOC);
return false;
@ -106,10 +106,10 @@ class RoundStats {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("
SELECT
t.id AS id,
a.username AS username,
t.type AS type,
t.amount AS amount
t.id AS id,
a.username AS username,
t.type AS type,
t.amount AS amount
FROM $this->tableTrans AS t
LEFT JOIN $this->tableBlocks AS b ON t.block_id = b.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);
$stmt = $this->mysqli->prepare("
SELECT
t.id AS id,
a.username AS username,
t.type AS type,
t.amount AS amount
t.id AS id,
a.username AS username,
t.type AS type,
t.amount AS amount
FROM $this->tableTrans AS t
LEFT JOIN $this->tableBlocks AS b ON t.block_id = b.id
LEFT JOIN $this->tableUsers AS a ON t.account_id = a.id

View File

@ -6,28 +6,28 @@ if (!defined('SECURITY')) die('Hacking attempt');
if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$debug->append('No cached version available, fetching from backend', 3);
if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) {
$iKey = $roundstats->getNextBlock($_REQUEST['height']);
} else if (@$_REQUEST['prev'] && !empty($_REQUEST['height'])) {
$iKey = $roundstats->getPreviousBlock($_REQUEST['height']);
} else {
if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) {
$iKey = $roundstats->getNextBlock($_REQUEST['height']);
} else if (@$_REQUEST['prev'] && !empty($_REQUEST['height'])) {
$iKey = $roundstats->getPreviousBlock($_REQUEST['height']);
} else {
if (empty($_REQUEST['height'])) {
$iBlock = $block->getLast();
$iKey = $iBlock['height'];
} else {
$iKey = $_REQUEST['height'];
}
}
echo $iKey;
if (empty($_REQUEST['height'])) {
$iBlock = $block->getLast();
$iKey = $iBlock['height'];
} else {
$iKey = $_REQUEST['height'];
}
}
echo $iKey;
$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);
} else {
$aUserRoundTransactions = $roundstats->getUserRoundTransactions($iKey, $_SESSION['USERDATA']['id']);
}
if ($user->isAdmin($_SESSION['USERDATA']['id'])) {
$aUserRoundTransactions = $roundstats->getAllRoundTransactions($iKey);
} else {
$aUserRoundTransactions = $roundstats->getUserRoundTransactions($iKey, $_SESSION['USERDATA']['id']);
}
// Propagate content our template
$smarty->assign('BLOCKDETAILS', $aDetailsForBlockHeight);