Skip to content

Commit

Permalink
Merge pull request #2458 from MPOS/development
Browse files Browse the repository at this point in the history
UPDATE : Development to Master
  • Loading branch information
TheSerapher committed Mar 11, 2016
2 parents 53533e4 + 21dbe36 commit b7b45eb
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 22 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
@@ -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)
---------------------

* Honor anonymous attribute when sending block finder mails
* Display admin warning if no transfer fees are set
* Moved admin_checks.php into the admin panel/system/setup
Expand Down
13 changes: 13 additions & 0 deletions include/classes/bitcoinwrapper.class.php
Expand Up @@ -66,6 +66,19 @@ public function getestimatedtime($iCurrentPoolHashrate) {
$dDifficulty = $this->getdifficulty();
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() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
Expand Down
7 changes: 6 additions & 1 deletion include/classes/tools.class.php
Expand Up @@ -83,6 +83,8 @@ private function getApiType($url) {
return 'cryptorush';
} else if (preg_match('/mintpal.com/', $url)) {
return 'mintpal';
} else if (preg_match('/c-cex.com/', $url)) {
return 'c-cex';
} else if (preg_match('/bittrex.com/', $url)) {
return 'bittrex';
}
Expand Down Expand Up @@ -123,7 +125,10 @@ public function getPrice() {
case 'mintpal':
return @$aData['0']['last_price'];
break;
case 'bittrex':
case 'c-cex':
return @$aData['ticker']['lastprice'];
break;
case 'bittrex':
return @$aData['result']['Last'];
break;
}
Expand Down
5 changes: 3 additions & 2 deletions include/classes/user.class.php
Expand Up @@ -189,7 +189,7 @@ public function getTopInviters($limit=10,$start=0) {
return $result->fetch_all(MYSQLI_ASSOC);
}
}

/**
* Check user login
* @param username string Username
Expand Down Expand Up @@ -718,7 +718,8 @@ public function getUserData($userID) {
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $userID) && $stmt->execute() && $result = $stmt->get_result()) {
$aData = $result->fetch_assoc();
$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();
return $aData;
}
Expand Down
15 changes: 13 additions & 2 deletions include/pages/admin/checks/check_daemon.inc.php
Expand Up @@ -13,8 +13,7 @@
$newerror['helplink'] = "https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc";
$error[] = $newerror;
$newerror = null;
}
else {
} else {
// validate that the wallet service is not in test mode
if ($bitcoin->is_testnet() == true) {
$newerror = array();
Expand All @@ -27,6 +26,18 @@
$error[] = $newerror;
$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
$accounts = $bitcoin->listaccounts();
if (count($accounts) > 1 && $accounts[''] <= 0) {
Expand Down
3 changes: 3 additions & 0 deletions include/pages/admin/wallet.inc.php
Expand Up @@ -23,6 +23,9 @@

$aGetInfo = $bitcoin->getinfo();
$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));
if (is_array($aGetInfo) && array_key_exists('newmint', $aGetInfo)) {
$dNewmint = $aGetInfo['newmint'];
Expand Down
2 changes: 1 addition & 1 deletion include/smarty_globals.inc.php
Expand Up @@ -227,7 +227,7 @@
// Lets check for our cron status and render a message
require_once(INCLUDE_DIR . '/config/monitor_crons.inc.php');
$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) {
if ($monitoring->isDisabled($strCron) == 1) {
$bMessage = true;
Expand Down
2 changes: 1 addition & 1 deletion include/version.inc.php
@@ -1,7 +1,7 @@
<?php
$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('CONFIG_VERSION', '1.0.1');
define('HASH_VERSION', 1);
Expand Down
7 changes: 0 additions & 7 deletions public/index.php
Expand Up @@ -99,13 +99,6 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
}
}

// 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
if (is_dir(INCLUDE_DIR . '/pages/')) {
foreach (glob(INCLUDE_DIR . '/pages/*.inc.php') as $filepath) {
Expand Down
35 changes: 35 additions & 0 deletions public/site_assets/bootstrap/css/mpos.css
Expand Up @@ -584,6 +584,7 @@ div.fade {
.table > tbody > tr > td
{
padding:4px;
vertical-align: middle;
}

.panel > .table,
Expand Down Expand Up @@ -625,3 +626,37 @@ div.fade {
}

/* 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 */
4 changes: 2 additions & 2 deletions templates/bootstrap/account/workers/default.tpl
Expand Up @@ -54,9 +54,9 @@
{assign var="username" value="."|escape|explode:$WORKERS[worker].username:2}
<tr>
<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>
<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>
</td>
<td><input class="form-control" type="text" name="data[{$WORKERS[worker].id}][password]" value="{$WORKERS[worker].password|escape}" size="10" required></td>
Expand Down
4 changes: 3 additions & 1 deletion templates/bootstrap/admin/setup/default.tpl
Expand Up @@ -3,7 +3,6 @@
<div class="panel panel-info">
<div class="panel-heading">
<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 class="panel-body">
{if $ERRORS|@count > 0}
Expand All @@ -30,6 +29,9 @@
{/section}
{/if}
</div>
<div class="panel-footer">
<li>To disable these checks, set skip_config_tests to true in global.inc.php</li>
</div>
</div>
</div>
<!-- /.col-lg-12 -->
Expand Down
6 changes: 3 additions & 3 deletions templates/bootstrap/admin/user/default.tpl
Expand Up @@ -95,7 +95,7 @@
<th class="h6" style="padding-right:10px">Est. Donation</th>
<th class="h6" style="padding-right:10px">Est. Payout</th>
{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}
<th class="h6" style="padding-right:10px">Balance</th>
<th class="h6" style="padding-right:10px">Reg. Date</th>
Expand All @@ -118,7 +118,7 @@
<td>{$USERS[user].estimates.donation|number_format:"8"}</td>
<td>{$USERS[user].estimates.payout|number_format:"8"}</td>
{else}
<td colspan="2">{$USERS[user].estimates.hours24|number_format:"8"}</td>
<td>{$USERS[user].estimates.hours24|number_format:"8"}</td>
{/if}
<td>{$USERS[user].balance|number_format:"8"}</td>
<td>{$USERS[user].signup_timestamp|date_format:$GLOBAL.config.date}</td>
Expand Down Expand Up @@ -147,4 +147,4 @@
</div>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion templates/bootstrap/global/navigation.tpl
Expand Up @@ -27,7 +27,7 @@
<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>
<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>
<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>
Expand Down
2 changes: 1 addition & 1 deletion upgrade/definitions/0.0.11_to_0.0.12.inc.php
Expand Up @@ -11,7 +11,7 @@ function run_0012() {
// 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[] = "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'";

if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) {
Expand Down

0 comments on commit b7b45eb

Please sign in to comment.