Further cleanup to reduce PHP notice warnings

This commit is contained in:
Sebastian Grewe 2013-06-14 13:51:06 +02:00
parent 4c4202bc1b
commit 0817befaaa
11 changed files with 25 additions and 18 deletions

View File

@ -311,6 +311,7 @@ class Statistics {
GROUP BY HOUR(time)
");
if ($this->checkStmt($stmt) && $stmt->bind_param("i", $account_id) && $stmt->execute() && $result = $stmt->get_result()) {
$aData = array();
while ($row = $result->fetch_assoc()) {
$aData[$row['hour']] = $row['hashrate'];
}

View File

@ -552,7 +552,7 @@ class User {
**/
public function isAuthenticated() {
$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;
// Catchall
$this->logoutUser();

View File

@ -5,10 +5,10 @@ if (!defined('SECURITY'))
die('Hacking attempt');
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');
} else {
switch ($_POST['do']) {
switch (@$_POST['do']) {
case 'cashOut':
if ($setting->getValue('manual_payout_active') == 1) {
$_SESSION['POPUP'][] = array('CONTENT' => 'A manual payout is in progress. Please try again later.', 'TYPE' => 'errormsg');

View File

@ -3,7 +3,7 @@
// Make sure we are called from index.php
if (!defined('SECURITY')) die('Hacking attempt');
if ($user->isAuthenticated()) {
if ($_REQUEST['do'] == 'save') {
if (@$_REQUEST['do'] == 'save') {
if ($notification->updateSettings($_SESSION['USERDATA']['id'], $_REQUEST['data'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Updated notification settings');
} else {

View File

@ -4,7 +4,7 @@
if (!defined('SECURITY')) die('Hacking attempt');
if ($user->isAuthenticated()) {
switch ($_REQUEST['do']) {
switch (@$_REQUEST['do']) {
case 'delete':
if ($worker->deleteWorker($_SESSION['USERDATA']['id'], $_GET['id'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Worker removed');
@ -31,7 +31,9 @@ if ($user->isAuthenticated()) {
$aWorkers = $worker->getWorkers($_SESSION['USERDATA']['id']);
if (!$aWorkers) $_SESSION['POPUP'][] = array('CONTENT' => 'You have no workers configured', 'TYPE' => 'errormsg');
$smarty->assign('CONTENT', 'default.tpl');
$smarty->assign('WORKERS', $aWorkers);
}
$smarty->assign('CONTENT', 'default.tpl');
?>

View File

@ -12,18 +12,18 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
$aRoundShares = $statistics->getRoundShares();
// Change account lock
if ($_POST['do'] == 'lock') {
if (@$_POST['do'] == 'lock') {
$supress_master = 1;
$user->changeLocked($_POST['account_id']);
}
// Change account admin
if ($_POST['do'] == 'admin') {
if (@$_POST['do'] == 'admin') {
$supress_master = 1;
$user->changeAdmin($_POST['account_id']);
}
if ($_POST['query']) {
if (@$_POST['query']) {
// Fetch requested users
$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);
$aUsers[$iKey] = $aUser;
}
// Assign our variables
$smarty->assign("USERS", $aUsers);
}
// Assign our variables
$smarty->assign("USERS", $aUsers);
// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");

View File

@ -7,9 +7,10 @@ if (!defined('SECURITY'))
if ($user->isAuthenticated()) {
$aHourlyHashRates = $statistics->getHourlyHashrateByAccount($_SESSION['USERDATA']['id']);
$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");
?>

View File

@ -27,6 +27,8 @@ $aBlockData = $aBlocksFoundData[0];
// Estimated time to find the next block
$iCurrentPoolHashrate = $statistics->getCurrentHashrate();
$iCurrentPoolHashrate == 0 ? $iCurrentPoolHashrate = 1 : true;
// Time in seconds, not hours, using modifier in smarty to translate
$iEstTime = $dDifficulty * pow(2,32) / ($iCurrentPoolHashrate * 1000);

View File

@ -9,9 +9,10 @@ $debug->append('Global smarty variables', 3);
// Defaults to get rid of PHP Notice warnings
$dDifficulty = 1;
$aRoundShares = 1;
// Only run these if the user is logged in
if ($_SESSION['AUTHENTICATED']) {
if (@$_SESSION['AUTHENTICATED']) {
$aRoundShares = $statistics->getRoundShares();
if ($bitcoin->can_connect() === true)
$dDifficulty = $bitcoin->query('getdifficulty');

View File

@ -23,7 +23,7 @@
<input type="hidden" name="action" value="{$smarty.request.action|escape}">
<input type="hidden" name="do" value="cashOut">
<table>
<tbody><tr><td>Account Balance: &nbsp;&nbsp;&nbsp;</td><td>{$GLOBAL.userdata.balance.confirmed|escape} {$GLOABL.config.currency}</td></tr>
<tbody><tr><td>Account Balance: &nbsp;&nbsp;&nbsp;</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>4 digit PIN: </td><td><input type="password" name="authPin" size="4" maxlength="4"></td></tr>
</tbody></table>

View File

@ -28,7 +28,7 @@
<td>n/a</td>
<td>{$GLOBAL.userdata.username}</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>
</tr>
{/if}