Merge pull request #2458 from MPOS/development

UPDATE : Development to Master
This commit is contained in:
Sebastian Grewe 2016-03-11 18:52:56 +01:00
commit b7b45eb580
15 changed files with 96 additions and 22 deletions

View File

@ -1,5 +1,16 @@
1.0.5 (XXX XXth XXXX)
---------------------
* Fixed worker name scaling issues on mobile devices (Thanks @nrpatten)
* Fixed user information table formatting (Thanks @pokari1986)
* Fixed empty auto-payout threshold value for accounts page
* Removed config disable check popup for admins on all pages
* Added blockchain download status for admin feedback (admin setup check)
* Added peer state to wallet info state if no peers are connected
1.0.4 (Jun 19th 2015) 1.0.4 (Jun 19th 2015)
--------------------- ---------------------
* Honor anonymous attribute when sending block finder mails * Honor anonymous attribute when sending block finder mails
* Display admin warning if no transfer fees are set * Display admin warning if no transfer fees are set
* Moved admin_checks.php into the admin panel/system/setup * Moved admin_checks.php into the admin panel/system/setup

View File

@ -66,6 +66,19 @@ class BitcoinWrapper extends BitcoinClient {
$dDifficulty = $this->getdifficulty(); $dDifficulty = $this->getdifficulty();
return $this->memcache->setCache(__FUNCTION__, $dDifficulty * pow(2,32) / $iCurrentPoolHashrate, 30); return $this->memcache->setCache(__FUNCTION__, $dDifficulty * pow(2,32) / $iCurrentPoolHashrate, 30);
} }
public function getblockchaindownload() {
$aPeerInfo = $this->getpeerinfo();
$aInfo = $this->getinfo();
$iStartingHeight = 0;
foreach ($aPeerInfo as $aPeerData) {
if ($iStartingHeight < $aPeerData['startingheight']) $iStartingHeight = $aPeerData['startingheight'];
}
if ($iStartingHeight > $aInfo['blocks']) {
return number_format(round($aInfo['blocks'] / $iStartingHeight * 100, 2), 2);
} else {
return false;
}
}
public function getnetworkhashps() { public function getnetworkhashps() {
$this->oDebug->append("STA " . __METHOD__, 4); $this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data; if ($data = $this->memcache->get(__FUNCTION__)) return $data;

View File

@ -83,6 +83,8 @@ class Tools extends Base {
return 'cryptorush'; return 'cryptorush';
} else if (preg_match('/mintpal.com/', $url)) { } else if (preg_match('/mintpal.com/', $url)) {
return 'mintpal'; return 'mintpal';
} else if (preg_match('/c-cex.com/', $url)) {
return 'c-cex';
} else if (preg_match('/bittrex.com/', $url)) { } else if (preg_match('/bittrex.com/', $url)) {
return 'bittrex'; return 'bittrex';
} }
@ -123,7 +125,10 @@ class Tools extends Base {
case 'mintpal': case 'mintpal':
return @$aData['0']['last_price']; return @$aData['0']['last_price'];
break; break;
case 'bittrex': case 'c-cex':
return @$aData['ticker']['lastprice'];
break;
case 'bittrex':
return @$aData['result']['Last']; return @$aData['result']['Last'];
break; break;
} }

View File

@ -189,7 +189,7 @@ class User extends Base {
return $result->fetch_all(MYSQLI_ASSOC); return $result->fetch_all(MYSQLI_ASSOC);
} }
} }
/** /**
* Check user login * Check user login
* @param username string Username * @param username string Username
@ -718,7 +718,8 @@ class User extends Base {
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $userID) && $stmt->execute() && $result = $stmt->get_result()) { if ($this->checkStmt($stmt) && $stmt->bind_param('i', $userID) && $stmt->execute() && $result = $stmt->get_result()) {
$aData = $result->fetch_assoc(); $aData = $result->fetch_assoc();
$aData['coin_address'] = $this->coin_address->getCoinAddress($userID); $aData['coin_address'] = $this->coin_address->getCoinAddress($userID);
$aData['ap_threshold'] = $this->coin_address->getAPThreshold($userID); if (! $aData['ap_threshold'] = $this->coin_address->getAPThreshold($userID))
$aData['ap_threshold'] = 0;
$stmt->close(); $stmt->close();
return $aData; return $aData;
} }

View File

@ -13,8 +13,7 @@ try {
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc"; $newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
$error[] = $newerror; $error[] = $newerror;
$newerror = null; $newerror = null;
} } else {
else {
// validate that the wallet service is not in test mode // validate that the wallet service is not in test mode
if ($bitcoin->is_testnet() == true) { if ($bitcoin->is_testnet() == true) {
$newerror = array(); $newerror = array();
@ -27,6 +26,18 @@ try {
$error[] = $newerror; $error[] = $newerror;
$newerror = null; $newerror = null;
} }
// Check if chain is currently downloading
if ($dDownloadPercentage = $bitcoin->getblockchaindownload()) {
$newerror = array();
$newerror['name'] = "Coin daemon";
$newerror['level'] = 1;
$newerror['extdesc'] = "Your coin daemon is currently downloading the blockchain. Your miners won't be able to connect until this is completed.";
$newerror['description'] = "Blockchain download progress is at an estimated $dDownloadPercentage%. It may take a while to complete.";
$newerror['configvalue'] = "wallet.host";
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
$error[] = $newerror;
$newerror = null;
}
// check if there is more than one account set on wallet // check if there is more than one account set on wallet
$accounts = $bitcoin->listaccounts(); $accounts = $bitcoin->listaccounts();
if (count($accounts) > 1 && $accounts[''] <= 0) { if (count($accounts) > 1 && $accounts[''] <= 0) {

View File

@ -23,6 +23,9 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$aGetInfo = $bitcoin->getinfo(); $aGetInfo = $bitcoin->getinfo();
$aGetPeerInfo = $bitcoin->getpeerinfo(); $aGetPeerInfo = $bitcoin->getpeerinfo();
if ($aGetInfo['connections'] == 0) $aGetInfo['errors'] = 'No peers';
# Check if daemon is downloading the blockchain, estimated
if ($dDownloadPercentage = $bitcoin->getblockchaindownload()) $aGetInfo['errors'] = "Downloading: $dDownloadPercentage%";
$aGetTransactions = $bitcoin->listtransactions('', (int)$setting->getValue('wallet_transaction_limit', 25)); $aGetTransactions = $bitcoin->listtransactions('', (int)$setting->getValue('wallet_transaction_limit', 25));
if (is_array($aGetInfo) && array_key_exists('newmint', $aGetInfo)) { if (is_array($aGetInfo) && array_key_exists('newmint', $aGetInfo)) {
$dNewmint = $aGetInfo['newmint']; $dNewmint = $aGetInfo['newmint'];

View File

@ -227,7 +227,7 @@ $smarty->assign('DEBUG', $config['DEBUG']);
// Lets check for our cron status and render a message // Lets check for our cron status and render a message
require_once(INCLUDE_DIR . '/config/monitor_crons.inc.php'); require_once(INCLUDE_DIR . '/config/monitor_crons.inc.php');
$bMessage = false; $bMessage = false;
$aCronMessage[] = 'We are investingating issues in the backend. Your shares and hashrate are safe and we will fix things ASAP.</br><br/>'; $aCronMessage[] = 'We are investigating issues in the backend. Your shares and hashrate are safe and we will fix things ASAP.</br><br/>';
foreach ($aMonitorCrons as $strCron) { foreach ($aMonitorCrons as $strCron) {
if ($monitoring->isDisabled($strCron) == 1) { if ($monitoring->isDisabled($strCron) == 1) {
$bMessage = true; $bMessage = true;

View File

@ -1,7 +1,7 @@
<?php <?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
define('MPOS_VERSION', '1.0.4'); define('MPOS_VERSION', '1.0.5');
define('DB_VERSION', '1.0.1'); define('DB_VERSION', '1.0.1');
define('CONFIG_VERSION', '1.0.1'); define('CONFIG_VERSION', '1.0.1');
define('HASH_VERSION', 1); define('HASH_VERSION', 1);

View File

@ -99,13 +99,6 @@ if (count(@$_SESSION['last_ip_pop']) == 2) {
} }
} }
// version check and config check if not disabled
if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA']['id'])) {
if (!@$config['skip_config_tests'] && @$_GET['action'] != 'setup') {
$_SESSION['POPUP'][] = array('CONTENT' => "You haven't turned off config checks, visit the <b><a href='?page=admin&action=setup'>setup page</a></b> for further information.", 'DISMISS' => 'yes', 'ID' => 'lastlogin', 'TYPE' => 'alert alert-info');
}
}
// Create our pages array from existing files // Create our pages array from existing files
if (is_dir(INCLUDE_DIR . '/pages/')) { if (is_dir(INCLUDE_DIR . '/pages/')) {
foreach (glob(INCLUDE_DIR . '/pages/*.inc.php') as $filepath) { foreach (glob(INCLUDE_DIR . '/pages/*.inc.php') as $filepath) {

View File

@ -584,6 +584,7 @@ div.fade {
.table > tbody > tr > td .table > tbody > tr > td
{ {
padding:4px; padding:4px;
vertical-align: middle;
} }
.panel > .table, .panel > .table,
@ -625,3 +626,37 @@ div.fade {
} }
/* End Footer */ /* End Footer */
/* EDIT */
.name {
float: left;
margin-bottom: 0;
min-width: 100%;
position: relative;
width: auto;
z-index: 2;
transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
display: block;
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
margin-right: 25px;
}
.name:focus {
border-color: #66afe9;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
outline: 0 none;
}
.navbar-right {
float: right !important;
margin-right: 0;
}
.clear {
padding: 0px;
}
/* END EDIT */

View File

@ -54,9 +54,9 @@
{assign var="username" value="."|escape|explode:$WORKERS[worker].username:2} {assign var="username" value="."|escape|explode:$WORKERS[worker].username:2}
<tr> <tr>
<td> <td>
<div class="input-group input-group-sm"> <div class="input-group input-group-sm clear">
<span {if $WORKERS[worker].hashrate > 0}style="color: orange"{/if} class="input-group-addon">{$username.0|escape}.</span> <span {if $WORKERS[worker].hashrate > 0}style="color: orange"{/if} class="input-group-addon">{$username.0|escape}.</span>
<input type="text" name="data[{$WORKERS[worker].id}][username]" value="{$username.1|escape}" size="10" required class="form-control" /> <input type="text" name="data[{$WORKERS[worker].id}][username]" value="{$username.1|escape}" size="10" required class="name" />
</div> </div>
</td> </td>
<td><input class="form-control" type="text" name="data[{$WORKERS[worker].id}][password]" value="{$WORKERS[worker].password|escape}" size="10" required></td> <td><input class="form-control" type="text" name="data[{$WORKERS[worker].id}][password]" value="{$WORKERS[worker].password|escape}" size="10" required></td>

View File

@ -3,7 +3,6 @@
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-question fa-fw"></i> Setup Checks<br /> <i class="fa fa-question fa-fw"></i> Setup Checks<br />
<i>To disable these checks, set skip_config_tests to true in global.inc.php</i>
</div> </div>
<div class="panel-body"> <div class="panel-body">
{if $ERRORS|@count > 0} {if $ERRORS|@count > 0}
@ -30,6 +29,9 @@
{/section} {/section}
{/if} {/if}
</div> </div>
<div class="panel-footer">
<li>To disable these checks, set skip_config_tests to true in global.inc.php</li>
</div>
</div> </div>
</div> </div>
<!-- /.col-lg-12 --> <!-- /.col-lg-12 -->

View File

@ -95,7 +95,7 @@
<th class="h6" style="padding-right:10px">Est. Donation</th> <th class="h6" style="padding-right:10px">Est. Donation</th>
<th class="h6" style="padding-right:10px">Est. Payout</th> <th class="h6" style="padding-right:10px">Est. Payout</th>
{else} {else}
<th class="h6" colspan="2" style="padding-right:10px">Est. 24 Hours</th> <th class="h6" style="padding-right:10px">Est. 24 Hours</th>
{/if} {/if}
<th class="h6" style="padding-right:10px">Balance</th> <th class="h6" style="padding-right:10px">Balance</th>
<th class="h6" style="padding-right:10px">Reg. Date</th> <th class="h6" style="padding-right:10px">Reg. Date</th>
@ -118,7 +118,7 @@
<td>{$USERS[user].estimates.donation|number_format:"8"}</td> <td>{$USERS[user].estimates.donation|number_format:"8"}</td>
<td>{$USERS[user].estimates.payout|number_format:"8"}</td> <td>{$USERS[user].estimates.payout|number_format:"8"}</td>
{else} {else}
<td colspan="2">{$USERS[user].estimates.hours24|number_format:"8"}</td> <td>{$USERS[user].estimates.hours24|number_format:"8"}</td>
{/if} {/if}
<td>{$USERS[user].balance|number_format:"8"}</td> <td>{$USERS[user].balance|number_format:"8"}</td>
<td>{$USERS[user].signup_timestamp|date_format:$GLOBAL.config.date}</td> <td>{$USERS[user].signup_timestamp|date_format:$GLOBAL.config.date}</td>
@ -147,4 +147,4 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -27,7 +27,7 @@
<li {if $smarty.get.page|default:"0" eq "admin"}class="active"{/if}> <li {if $smarty.get.page|default:"0" eq "admin"}class="active"{/if}>
<a href="#"><i class="fa fa-wrench fa-fw"></i> Admin Panel<span class="fa arrow"></span></a> <a href="#"><i class="fa fa-wrench fa-fw"></i> Admin Panel<span class="fa arrow"></span></a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li {if $smarty.get.action|default:"0" eq "dashboard" || $smarty.get.action|default:"0" eq "monitoring" || $smarty.get.action|default:"0" eq "settings"}class="active"{/if}> <li {if $smarty.get.action|default:"0" eq "dashboard" || $smarty.get.action|default:"0" eq "monitoring" || $smarty.get.action|default:"0" eq "settings" || $smarty.get.action|default:"0" eq "setup"}class="active"{/if}>
<a href="#"><i class="fa fa-linux fa-fw"></i> System <span class="fa arrow"></span></a> <a href="#"><i class="fa fa-linux fa-fw"></i> System <span class="fa arrow"></span></a>
<ul class="nav nav-third-level"> <ul class="nav nav-third-level">
<li><a href="{$smarty.server.SCRIPT_NAME}?page=admin&action=setup"><i class="fa fa-book fa-fw"></i> Setup</a></li> <li><a href="{$smarty.server.SCRIPT_NAME}?page=admin&action=setup"><i class="fa fa-book fa-fw"></i> Setup</a></li>

View File

@ -11,7 +11,7 @@ function run_0012() {
// Upgrade specific variables // Upgrade specific variables
$aSql[] = "CREATE TABLE `coin_addresses` ( `id` int(11) NOT NULL AUTO_INCREMENT, `account_id` int(11) NOT NULL, `currency` varchar(5) NOT NULL, `coin_address` varchar(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `coin_address` (`coin_address`), KEY `account_id` (`account_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8"; $aSql[] = "CREATE TABLE `coin_addresses` ( `id` int(11) NOT NULL AUTO_INCREMENT, `account_id` int(11) NOT NULL, `currency` varchar(5) NOT NULL, `coin_address` varchar(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `coin_address` (`coin_address`), KEY `account_id` (`account_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8";
$aSql[] = "INSERT IGNORE INTO coin_addresses (account_id, currency, coin_address) SELECT id, '" . $config['currency'] . "', coin_address FROM " . $user->getTableName() . " WHERE coin_address IS NOT NULL"; $aSql[] = "INSERT IGNORE INTO coin_addresses (account_id, currency, coin_address) SELECT id, '" . $config['currency'] . "', coin_address FROM " . $user->getTableName() . " WHERE coin_address IS NOT NULL";
$aSql[] = "ALTER TABLE `" . $user->getTableName() . "` DROP `coin_address`"; $aSql[] = "ALTER TABLE " . $user->getTableName() . " DROP `coin_address`";
$aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '0.0.12' WHERE name = 'DB_VERSION'"; $aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '0.0.12' WHERE name = 'DB_VERSION'";
if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) {