Compare commits

...

14 Commits

Author SHA1 Message Date
Sebastian Grewe
f3914098fd
Merge pull request #2776 from lubuzzo/development
Recents Bitcoin's Change (> v0.17)
2019-07-27 12:11:01 +02:00
lubuzzo
480cefab68 Added coin_c11.class to fix the diffbits to Chaincoin (C11) based coins 2019-03-06 15:21:51 -03:00
lubuzzo
2cdfc9e46d Typo 2019-03-06 15:07:21 -03:00
lubuzzo
fd0f0fd656 Adding support for the latest Bitcoin's changes
- Accounts was removed, instead, now, we have labels
2019-03-06 15:04:51 -03:00
Sebastian Grewe
ffa5bb326d
Merge pull request #2746 from phiten/development
added 1500ms curl timeout for the push_notifications
2018-06-06 08:37:51 +02:00
Philipp
1fcc88a2c1 added 1500ms curl timeout for the push_notifications
added 1500ms curl timeout for the push_notifications. otherwise the findblock cron will run default 300s timeout if a service goes down. (notifymyandroid is down.)

300ms are not enough for pushover working fine with fine with 1000ms increased it to 1500ms for high ping connections.
2018-06-05 23:22:28 +02:00
Philipp
52780f7c9d
Revert "added 300ms curl timeout for the push_notifications" 2018-06-05 23:16:43 +02:00
Sebastian Grewe
a643a8960f
Merge pull request #2744 from phiten/development
added 300ms curl timeout for the push_notifications
2018-06-03 13:02:43 +02:00
Philipp
dad8c07ec3 added 300ms curl timeout for the push_notifications
added 300ms curl timeout for the push_notifications. otherwise the findblock cron will run default 300s timeout if a service goes down. (notifymyandroid is down.)
2018-06-03 12:58:09 +02:00
Sebastian Grewe
3a14e9fd3a [FIX] Dashboard last block updates if sounds are globally disabled 2018-05-25 11:05:58 +02:00
Sebastian Grewe
bbe7ac16a6 [UPDATE] Send proper header when ajax calls are rate-limited 2018-05-25 11:05:24 +02:00
Sebastian Grewe
47f5a9df11 [UPDATE] Only check for wrong mode string in MySQL 5.7 2018-05-24 13:42:32 +02:00
Sebastian Grewe
bbb008eb7a Merge branch 'development' of github.com:MPOS/php-mpos into development 2018-05-24 13:26:47 +02:00
Sebastian Grewe
817c8f2492 [ADDED] Check MySQL 5.7 in version string for admin setup page 2018-05-24 13:26:36 +02:00
14 changed files with 146 additions and 41 deletions

View File

@ -55,15 +55,21 @@ class BitcoinWrapper extends BitcoinClient {
// Wrapper method to get the real main account balance // Wrapper method to get the real main account balance
public function getrealbalance() { public function getrealbalance() {
$this->oDebug->append("STA " . __METHOD__, 4); $this->oDebug->append("STA " . __METHOD__, 4);
$aAccounts = [];
try {
$aAccounts = parent::listaccounts(); $aAccounts = parent::listaccounts();
$dBalance = parent::getbalance(''); } catch (Exception $e) {
if ($e->getCode() == 404)
$aAccounts = array( '*' => parent::getbalance("*") );
}
// Account checks // Account checks
if (count($aAccounts) == 1) { if (count($aAccounts) == 1) {
// We only have a single account so getbalance will be fine // We only have a single account so getbalance will be fine
return $dBalance; return parent::getbalance("*");
} else { } else {
$dMainBalance = $aAccounts['']; return $aAccounts[0];
return $dMainBalance;
} }
} }
public function getdifficulty() { public function getdifficulty() {

View File

@ -0,0 +1,12 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* We extend our CoinBase class
* No need to change anything, base class supports
* scrypt and sha256d
**/
class Coin extends CoinBase {
protected $target_bits = 32;
protected $share_difficulty_precision = 6;
}

View File

@ -24,6 +24,7 @@ class Notifications_NotifyMyAndroid implements IPushNotification {
public function notify($message, $severity = 'info', $event = null){ public function notify($message, $severity = 'info', $event = null){
global $setting; global $setting;
curl_setopt_array($ch = curl_init(), array( curl_setopt_array($ch = curl_init(), array(
CURLOPT_TIMEOUT_MS => 1500,
CURLOPT_URL => "https://www.notifymyandroid.com/publicapi/notify", CURLOPT_URL => "https://www.notifymyandroid.com/publicapi/notify",
CURLOPT_POST => true, CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true, CURLOPT_RETURNTRANSFER => true,

View File

@ -27,6 +27,7 @@
public function notify($message, $severity = 'info', $event = null){ public function notify($message, $severity = 'info', $event = null){
curl_setopt_array($ch = curl_init(), array( curl_setopt_array($ch = curl_init(), array(
CURLOPT_TIMEOUT_MS => 1500,
CURLOPT_URL => "https://api.pushover.net/1/messages.json", CURLOPT_URL => "https://api.pushover.net/1/messages.json",
CURLOPT_POST => true, CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true, CURLOPT_RETURNTRANSFER => true,

View File

@ -7,7 +7,7 @@ $aErrorCodes['E0002'] = 'Upstream shares not found';
$aErrorCodes['E0003'] = 'Failed to change shares order'; $aErrorCodes['E0003'] = 'Failed to change shares order';
$aErrorCodes['E0004'] = 'Failed to reset previous block'; $aErrorCodes['E0004'] = 'Failed to reset previous block';
$aErrorCodes['E0005'] = 'Unable to fetch blocks upstream share'; $aErrorCodes['E0005'] = 'Unable to fetch blocks upstream share';
$aErrorCodes['E0006'] = 'Unable to conenct to RPC server backend'; $aErrorCodes['E0006'] = 'Unable to connect to RPC server backend';
$aErrorCodes['E0007'] = 'Out of Order Share detected, autofixed'; $aErrorCodes['E0007'] = 'Out of Order Share detected, autofixed';
$aErrorCodes['E0008'] = 'Failed to delete archived shares'; $aErrorCodes['E0008'] = 'Failed to delete archived shares';
$aErrorCodes['E0009'] = 'Cron disabled by admin'; $aErrorCodes['E0009'] = 'Cron disabled by admin';

View File

@ -97,7 +97,7 @@ class jsonRPCClient {
'id' => $this->id 'id' => $this->id
); );
$request = json_encode($request); $request = json_encode($request);
if ($this->debug) $this->debug_output[] = 'Request: '.$request; if ($this->debug) $this->debug_output = 'Request: '.$request[0];
// performs the HTTP POST // performs the HTTP POST
// extract information from URL for proper authentication // extract information from URL for proper authentication
@ -112,12 +112,12 @@ class jsonRPCClient {
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$response = curl_exec($ch); $response = curl_exec($ch);
if (curl_errno($ch)) throw new Exception('RPC call failed: ' . curl_error($ch)); if (curl_errno($ch)) throw new Exception('RPC call failed: ' . curl_error($ch));
if ($this->debug) $this->debug_output[] = 'Response: ' . $response; if ($this->debug) $this->debug_output = 'Response: ' . $response[0];
$response = json_decode($response, true); $response = json_decode($response, true);
$resultStatus = curl_getinfo($ch); $resultStatus = curl_getinfo($ch);
if ($resultStatus['http_code'] != '200') { if ($resultStatus['http_code'] != '200') {
if ($resultStatus['http_code'] == '401') throw new Exception('RPC call did not return 200: Authentication failed'); if ($resultStatus['http_code'] == '401') throw new Exception('RPC call did not return 200: Authentication failed');
throw new Exception('RPC call did not return 200: HTTP error: ' . $resultStatus['http_code'] . ' - JSON Response: [' . @$response['error']['code'] . '] ' . @$response['error']['message']); throw new Exception('RPC call did not return 200: HTTP error: ' . $resultStatus['http_code'] . ' - JSON Response: [' . @$response['error']['code'] . '] ' . @$response['error']['message'], $resultStatus['http_code']);
} }
curl_close($ch); curl_close($ch);

View File

@ -39,7 +39,13 @@ try {
$newerror = null; $newerror = null;
} }
// check if there is more than one account set on wallet // check if there is more than one account set on wallet
try {
$accounts = $bitcoin->listaccounts(); $accounts = $bitcoin->listaccounts();
} catch (Exception $e) {
if ($e->getCode() == 404)
$accounts = $bitcoin->listwallets();
}
if (count($accounts) > 1 && $accounts[''] <= 0) { if (count($accounts) > 1 && $accounts[''] <= 0) {
$newerror = array(); $newerror = array();
$newerror['name'] = "Coin daemon"; $newerror['name'] = "Coin daemon";

View File

@ -0,0 +1,21 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// MPOS has issues with version 5.7 so lets fetch this installs version
$mysql_version = $mysqli->query('SELECT VERSION() AS version')->fetch_object()->version;
// This should be set if we are running on 5.7
$mysql_mode = $mysqli->query('SELECT @@GLOBAL.sql_mode AS sql_mode')->fetch_object()->sql_mode;
// see if it includes 5.7
if (strpos($mysql_version, '5.7') !== false && strpos($mysql_mode, 'ONLY_FULL_GROUP_BY') !== false) {
$newerror = array();
$newerror['name'] = "MySQL Version";
$newerror['level'] = 3;
$newerror['description'] = "SQL version not fully supported.";
$newerror['configvalue'] = "db.*";
$newerror['extdesc'] = "You are using MySQL Version $mysql_version which is not fully supported. You may run into issues during payout when using this version of MySQL. Please see our Wiki FAQ on how to workaround any potential issues. This check only matches your version string against `5.7` so you may still be fine.";
$newerror['helplink'] = "";
$error[] = $newerror;
$newerror = null;
}

View File

@ -11,14 +11,32 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$debug->append('No cached version available, fetching from backend', 3); $debug->append('No cached version available, fetching from backend', 3);
if ($bitcoin->can_connect() === true) { if ($bitcoin->can_connect() === true) {
$dBalance = $bitcoin->getrealbalance(); $dBalance = $bitcoin->getrealbalance();
$labelsCommand = false;
try {
$dWalletAccounts = $bitcoin->listaccounts(); $dWalletAccounts = $bitcoin->listaccounts();
} catch (Exception $e) {
if ($e->getCode() == 404) {
$dWalletAccounts = $bitcoin->listlabels();
$labelsCommand = true;
}
}
$dAddressCount = count($dWalletAccounts); $dAddressCount = count($dWalletAccounts);
$dAccountAddresses = array(); $dAccountAddresses = array();
foreach($dWalletAccounts as $key => $value) foreach($dWalletAccounts as $key => $value)
{ {
if (!($labelsCommand))
$dAccountAddresses[$key] = $bitcoin->getaddressesbyaccount((string)$key); $dAccountAddresses[$key] = $bitcoin->getaddressesbyaccount((string)$key);
else {
if (strlen($value) == 0)
$value = "";
foreach ($bitcoin->getaddressesbylabel((string)$value) as $key2 => $value2) {
$dAccountAddresses[$key][$key2] = $value2;
}
}
} }
$aGetInfo = $bitcoin->getinfo(); $aGetInfo = $bitcoin->getinfo();
@ -26,7 +44,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
if ($aGetInfo['connections'] == 0) $aGetInfo['errors'] = 'No peers'; if ($aGetInfo['connections'] == 0) $aGetInfo['errors'] = 'No peers';
# Check if daemon is downloading the blockchain, estimated # Check if daemon is downloading the blockchain, estimated
if ($dDownloadPercentage = $bitcoin->getblockchaindownload()) $aGetInfo['errors'] = "Downloading: $dDownloadPercentage%"; 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'];
} else { } else {
@ -69,6 +87,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$smarty->assign("PEERINFO", $aGetPeerInfo); $smarty->assign("PEERINFO", $aGetPeerInfo);
$smarty->assign('PRECISION', $coin->getCoinValuePrevision()); $smarty->assign('PRECISION', $coin->getCoinValuePrevision());
$smarty->assign("TRANSACTIONS", $aGetTransactions); $smarty->assign("TRANSACTIONS", $aGetTransactions);
$smarty->assign("LABELSCOMMAND", $labelsCommand);
} else { } else {
$debug->append('Using cached page', 3); $debug->append('Using cached page', 3);
} }

View File

@ -71,7 +71,7 @@ if ($config['memcache']['enabled'] && $config['mc_antidos']['enabled']) {
if (!$skip_check) { if (!$skip_check) {
$mcad = new MemcacheAntiDos($config, $memcache, $per_page); $mcad = new MemcacheAntiDos($config, $memcache, $per_page);
if ($config['mc_antidos']['protect_ajax'] && $is_ajax_call && $mcad->rate_limit_api_request) { if ($config['mc_antidos']['protect_ajax'] && $is_ajax_call && $mcad->rate_limit_api_request) {
exit(header('HTTP/1.1 401 Unauthorized')); exit(header('HTTP/1.1 429 Too Many Requests'));
} }
$error_page = $config['mc_antidos']['error_push_page']; $error_page = $config['mc_antidos']['error_push_page'];
if ($mcad->rate_limit_site_request) { if ($mcad->rate_limit_site_request) {

View File

@ -2,16 +2,25 @@
<div class="col-lg-12"> <div class="col-lg-12">
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
{if $LABELSCOMMAND}
<i class="fa fa-users fa-fw"></i> Wallet Labels
{else}
<i class="fa fa-users fa-fw"></i> Wallet Accounts <i class="fa fa-users fa-fw"></i> Wallet Accounts
{/if}
</div> </div>
<div class="panel-body "> <div class="panel-body ">
<div class="panel-group"> <div class="panel-group">
{foreach key=NAME item=VALUE from=$ACCOUNTS} {foreach key=NAME item=VALUE from=$ACCOUNTS}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
{if $LABELSCOMMAND}
<i class="fa fa-user fa-fw"></i> Label: {$VALUE|default:"Default"}
{else}
<i class="fa fa-user fa-fw"></i> Account: {$NAME|default:"Default"} <i class="fa fa-user fa-fw"></i> Account: {$NAME|default:"Default"}
{/if}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{if (not ($LABELSCOMMAND))}
<div class="col-lg-4"> <div class="col-lg-4">
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
@ -27,19 +36,28 @@
</div> </div>
</div> </div>
</div> </div>
{/if}
{foreach key=ACCOUNT item=ADDRESS from=$ACCOUNTADDRESSES} {foreach key=ACCOUNT item=ADDRESS from=$ACCOUNTADDRESSES}
{if $ACCOUNT == $NAME} {if $ACCOUNT == $NAME}
{if $LABELSCOMMAND}
<div class="col-lg-12">
{else}
<div class="col-lg-8"> <div class="col-lg-8">
{/if}
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
{if $LABELSCOMMAND}
<i class="fa fa-book fa-fw"></i> Addresses assigned to Label {$VALUE|default:"Default"}
{else}
<i class="fa fa-book fa-fw"></i> Addresses assigned to Account {$ACCOUNT|default:"Default"} <i class="fa fa-book fa-fw"></i> Addresses assigned to Account {$ACCOUNT|default:"Default"}
{/if}
</div> </div>
<div class="table-responsive panel-body no-padding"> <div class="table-responsive panel-body no-padding">
<table class="table table-striped table-bordered table-hover"> <table class="table table-striped table-bordered table-hover">
<tbody> <tbody>
{foreach from=$ACCOUNTADDRESSES[$ACCOUNT] key=ACCOUNT1 item=ADDRESS1} {foreach from=$ACCOUNTADDRESSES[$ACCOUNT] key=ACCOUNT1 item=ADDRESS1}
{if not $LABELSCOMMAND}
{if $ADDRESS1@iteration is even by 1} {if $ADDRESS1@iteration is even by 1}
<td>{$ADDRESS1}</td> <td>{$ADDRESS1}</td>
</tr> </tr>
@ -47,6 +65,13 @@
<tr> <tr>
<td>{$ADDRESS1}</td> <td>{$ADDRESS1}</td>
{/if} {/if}
{else}
{foreach from=$ACCOUNT1 key=ACCOUNT2 item=ADDRESS2}
<tr>
<td>{$ADDRESS2}</td>
</tr>
{/foreach}
{/if}
{/foreach} {/foreach}
<tbody> <tbody>
</table> </table>

View File

@ -14,7 +14,11 @@
<th>Peers</th> <th>Peers</th>
<th>Status</th> <th>Status</th>
<th>Blocks</th> <th>Blocks</th>
{if $LABELSCOMMAND}
<th>Labels</th>
{else}
<th>Accounts</th> <th>Accounts</th>
{/if}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -9,7 +9,11 @@
<table class="table table-striped table-bordered table-hover"> <table class="table table-striped table-bordered table-hover">
<thead> <thead>
<tr> <tr>
{if $LABELSCOMMAND}
<th class="text-center">Label</th>
{else}
<th class="text-center">Account</th> <th class="text-center">Account</th>
{/if}
<th class="text-center">Address</th> <th class="text-center">Address</th>
<th class="text-center">Category</th> <th class="text-center">Category</th>
<th class="text-right">Amount</th> <th class="text-right">Amount</th>

View File

@ -193,9 +193,15 @@ $(document).ready(function(){
return; return;
} }
if (blocks[0].height > lastBlock) { if (blocks[0].height > lastBlock) {
{/literal}
{if $GLOBAL.website.blockfindersound.enabled|default:"1"}
{literal}
if(canCreateSoundJS) { if(canCreateSoundJS) {
createjs.Sound.play('ding'); createjs.Sound.play('ding');
} }
{/literal}
{/if}
{literal}
lastBlock = blocks[0].height; lastBlock = blocks[0].height;
var table_content = '<tbody id="b-blocks">'; var table_content = '<tbody id="b-blocks">';
for (index = 0; index < blocks.length; ++index) { for (index = 0; index < blocks.length; ++index) {