Further cleanup to reduce PHP notice warnings
This commit is contained in:
parent
4c4202bc1b
commit
0817befaaa
@ -311,6 +311,7 @@ class Statistics {
|
|||||||
GROUP BY HOUR(time)
|
GROUP BY HOUR(time)
|
||||||
");
|
");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param("i", $account_id) && $stmt->execute() && $result = $stmt->get_result()) {
|
if ($this->checkStmt($stmt) && $stmt->bind_param("i", $account_id) && $stmt->execute() && $result = $stmt->get_result()) {
|
||||||
|
$aData = array();
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$aData[$row['hour']] = $row['hashrate'];
|
$aData[$row['hour']] = $row['hashrate'];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -552,7 +552,7 @@ class User {
|
|||||||
**/
|
**/
|
||||||
public function isAuthenticated() {
|
public function isAuthenticated() {
|
||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
if ($_SESSION['AUTHENTICATED'] == true && ! $this->isLocked($_SESSION['USERDATA']['id']) && $this->getUserIp($_SESSION['USERDATA']['id']) == $_SERVER['REMOTE_ADDR'])
|
if (@$_SESSION['AUTHENTICATED'] == true && ! $this->isLocked($_SESSION['USERDATA']['id']) && $this->getUserIp($_SESSION['USERDATA']['id']) == $_SERVER['REMOTE_ADDR'])
|
||||||
return true;
|
return true;
|
||||||
// Catchall
|
// Catchall
|
||||||
$this->logoutUser();
|
$this->logoutUser();
|
||||||
|
|||||||
@ -5,10 +5,10 @@ if (!defined('SECURITY'))
|
|||||||
die('Hacking attempt');
|
die('Hacking attempt');
|
||||||
|
|
||||||
if ($user->isAuthenticated()) {
|
if ($user->isAuthenticated()) {
|
||||||
if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST['do']) {
|
if ( ! $user->checkPin($_SESSION['USERDATA']['id'], @$_POST['authPin']) && @$_POST['do']) {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Invalid PIN','TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Invalid PIN','TYPE' => 'errormsg');
|
||||||
} else {
|
} else {
|
||||||
switch ($_POST['do']) {
|
switch (@$_POST['do']) {
|
||||||
case 'cashOut':
|
case 'cashOut':
|
||||||
if ($setting->getValue('manual_payout_active') == 1) {
|
if ($setting->getValue('manual_payout_active') == 1) {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'A manual payout is in progress. Please try again later.', 'TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'A manual payout is in progress. Please try again later.', 'TYPE' => 'errormsg');
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
// Make sure we are called from index.php
|
// Make sure we are called from index.php
|
||||||
if (!defined('SECURITY')) die('Hacking attempt');
|
if (!defined('SECURITY')) die('Hacking attempt');
|
||||||
if ($user->isAuthenticated()) {
|
if ($user->isAuthenticated()) {
|
||||||
if ($_REQUEST['do'] == 'save') {
|
if (@$_REQUEST['do'] == 'save') {
|
||||||
if ($notification->updateSettings($_SESSION['USERDATA']['id'], $_REQUEST['data'])) {
|
if ($notification->updateSettings($_SESSION['USERDATA']['id'], $_REQUEST['data'])) {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Updated notification settings');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Updated notification settings');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
if (!defined('SECURITY')) die('Hacking attempt');
|
if (!defined('SECURITY')) die('Hacking attempt');
|
||||||
|
|
||||||
if ($user->isAuthenticated()) {
|
if ($user->isAuthenticated()) {
|
||||||
switch ($_REQUEST['do']) {
|
switch (@$_REQUEST['do']) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if ($worker->deleteWorker($_SESSION['USERDATA']['id'], $_GET['id'])) {
|
if ($worker->deleteWorker($_SESSION['USERDATA']['id'], $_GET['id'])) {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Worker removed');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Worker removed');
|
||||||
@ -31,7 +31,9 @@ if ($user->isAuthenticated()) {
|
|||||||
$aWorkers = $worker->getWorkers($_SESSION['USERDATA']['id']);
|
$aWorkers = $worker->getWorkers($_SESSION['USERDATA']['id']);
|
||||||
if (!$aWorkers) $_SESSION['POPUP'][] = array('CONTENT' => 'You have no workers configured', 'TYPE' => 'errormsg');
|
if (!$aWorkers) $_SESSION['POPUP'][] = array('CONTENT' => 'You have no workers configured', 'TYPE' => 'errormsg');
|
||||||
|
|
||||||
$smarty->assign('CONTENT', 'default.tpl');
|
|
||||||
$smarty->assign('WORKERS', $aWorkers);
|
$smarty->assign('WORKERS', $aWorkers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$smarty->assign('CONTENT', 'default.tpl');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -12,18 +12,18 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
|||||||
$aRoundShares = $statistics->getRoundShares();
|
$aRoundShares = $statistics->getRoundShares();
|
||||||
|
|
||||||
// Change account lock
|
// Change account lock
|
||||||
if ($_POST['do'] == 'lock') {
|
if (@$_POST['do'] == 'lock') {
|
||||||
$supress_master = 1;
|
$supress_master = 1;
|
||||||
$user->changeLocked($_POST['account_id']);
|
$user->changeLocked($_POST['account_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change account admin
|
// Change account admin
|
||||||
if ($_POST['do'] == 'admin') {
|
if (@$_POST['do'] == 'admin') {
|
||||||
$supress_master = 1;
|
$supress_master = 1;
|
||||||
$user->changeAdmin($_POST['account_id']);
|
$user->changeAdmin($_POST['account_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['query']) {
|
if (@$_POST['query']) {
|
||||||
// Fetch requested users
|
// Fetch requested users
|
||||||
$aUsers = $statistics->getAllUserStats($_POST['query']);
|
$aUsers = $statistics->getAllUserStats($_POST['query']);
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ if ($_POST['query']) {
|
|||||||
$aUser['payout']['est_payout'] = round($aUser['payout']['est_block'] - $aUser['payout']['est_donation'] - $aUser['payout']['est_fee'], 3);
|
$aUser['payout']['est_payout'] = round($aUser['payout']['est_block'] - $aUser['payout']['est_donation'] - $aUser['payout']['est_fee'], 3);
|
||||||
$aUsers[$iKey] = $aUser;
|
$aUsers[$iKey] = $aUser;
|
||||||
}
|
}
|
||||||
|
// Assign our variables
|
||||||
|
$smarty->assign("USERS", $aUsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign our variables
|
|
||||||
$smarty->assign("USERS", $aUsers);
|
|
||||||
|
|
||||||
// Tempalte specifics
|
// Tempalte specifics
|
||||||
$smarty->assign("CONTENT", "default.tpl");
|
$smarty->assign("CONTENT", "default.tpl");
|
||||||
|
|||||||
@ -7,9 +7,10 @@ if (!defined('SECURITY'))
|
|||||||
if ($user->isAuthenticated()) {
|
if ($user->isAuthenticated()) {
|
||||||
$aHourlyHashRates = $statistics->getHourlyHashrateByAccount($_SESSION['USERDATA']['id']);
|
$aHourlyHashRates = $statistics->getHourlyHashrateByAccount($_SESSION['USERDATA']['id']);
|
||||||
$aPoolHourlyHashRates = $statistics->getHourlyHashrateByPool();
|
$aPoolHourlyHashRates = $statistics->getHourlyHashrateByPool();
|
||||||
// Propagate content our template
|
|
||||||
$smarty->assign("YOURHASHRATES", $aHourlyHashRates);
|
|
||||||
$smarty->assign("POOLHASHRATES", $aPoolHourlyHashRates);
|
|
||||||
$smarty->assign("CONTENT", "default.tpl");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Propagate content our template
|
||||||
|
$smarty->assign("YOURHASHRATES", @$aHourlyHashRates);
|
||||||
|
$smarty->assign("POOLHASHRATES", @$aPoolHourlyHashRates);
|
||||||
|
$smarty->assign("CONTENT", "default.tpl");
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -27,6 +27,8 @@ $aBlockData = $aBlocksFoundData[0];
|
|||||||
|
|
||||||
// Estimated time to find the next block
|
// Estimated time to find the next block
|
||||||
$iCurrentPoolHashrate = $statistics->getCurrentHashrate();
|
$iCurrentPoolHashrate = $statistics->getCurrentHashrate();
|
||||||
|
$iCurrentPoolHashrate == 0 ? $iCurrentPoolHashrate = 1 : true;
|
||||||
|
|
||||||
// Time in seconds, not hours, using modifier in smarty to translate
|
// Time in seconds, not hours, using modifier in smarty to translate
|
||||||
$iEstTime = $dDifficulty * pow(2,32) / ($iCurrentPoolHashrate * 1000);
|
$iEstTime = $dDifficulty * pow(2,32) / ($iCurrentPoolHashrate * 1000);
|
||||||
|
|
||||||
|
|||||||
@ -9,9 +9,10 @@ $debug->append('Global smarty variables', 3);
|
|||||||
|
|
||||||
// Defaults to get rid of PHP Notice warnings
|
// Defaults to get rid of PHP Notice warnings
|
||||||
$dDifficulty = 1;
|
$dDifficulty = 1;
|
||||||
|
$aRoundShares = 1;
|
||||||
|
|
||||||
// Only run these if the user is logged in
|
// Only run these if the user is logged in
|
||||||
if ($_SESSION['AUTHENTICATED']) {
|
if (@$_SESSION['AUTHENTICATED']) {
|
||||||
$aRoundShares = $statistics->getRoundShares();
|
$aRoundShares = $statistics->getRoundShares();
|
||||||
if ($bitcoin->can_connect() === true)
|
if ($bitcoin->can_connect() === true)
|
||||||
$dDifficulty = $bitcoin->query('getdifficulty');
|
$dDifficulty = $bitcoin->query('getdifficulty');
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<input type="hidden" name="action" value="{$smarty.request.action|escape}">
|
<input type="hidden" name="action" value="{$smarty.request.action|escape}">
|
||||||
<input type="hidden" name="do" value="cashOut">
|
<input type="hidden" name="do" value="cashOut">
|
||||||
<table>
|
<table>
|
||||||
<tbody><tr><td>Account Balance: </td><td>{$GLOBAL.userdata.balance.confirmed|escape} {$GLOABL.config.currency}</td></tr>
|
<tbody><tr><td>Account Balance: </td><td>{$GLOBAL.userdata.balance.confirmed|escape} {$GLOBAL.config.currency}</td></tr>
|
||||||
<tr><td>Payout to: </td><td><h6>{$GLOBAL.userdata.coin_address|escape}</h6></td></tr>
|
<tr><td>Payout to: </td><td><h6>{$GLOBAL.userdata.coin_address|escape}</h6></td></tr>
|
||||||
<tr><td>4 digit PIN: </td><td><input type="password" name="authPin" size="4" maxlength="4"></td></tr>
|
<tr><td>4 digit PIN: </td><td><input type="password" name="authPin" size="4" maxlength="4"></td></tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
<td>n/a</td>
|
<td>n/a</td>
|
||||||
<td>{$GLOBAL.userdata.username}</td>
|
<td>{$GLOBAL.userdata.username}</td>
|
||||||
<td class="right">{$GLOBAL.userdata.hashrate}</td>
|
<td class="right">{$GLOBAL.userdata.hashrate}</td>
|
||||||
<td class="right">{$estday|number_format:"3"}</td>
|
<td class="right">{$estday|number_format:"3"|default:"n/a"}</td>
|
||||||
<td class="right">{($estday * $GLOBAL.price)|default:"n/a"|number_format:"2"}</td>
|
<td class="right">{($estday * $GLOBAL.price)|default:"n/a"|number_format:"2"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user