Skip to content

Commit

Permalink
Merge 257a5bb into 6c0d9a1
Browse files Browse the repository at this point in the history
  • Loading branch information
tperalta82 committed Feb 21, 2018
2 parents 6c0d9a1 + 257a5bb commit d263a56
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
20 changes: 14 additions & 6 deletions include/classes/tools.class.php
@@ -1,4 +1,4 @@
<?php
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;

/**
Expand Down Expand Up @@ -48,9 +48,9 @@ public function getApi($url, $target, $auth=NULL) {
}
curl_setopt($ch, CURLOPT_URL, $url . $target);
// curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

// run the query
$res = curl_exec($ch);
if ($res === false) {
Expand All @@ -64,7 +64,7 @@ public function getApi($url, $target, $auth=NULL) {
}
return $dec;
}

/**
* Detect the API to properly extract information
* @param url string API URL
Expand All @@ -86,12 +86,16 @@ private function getApiType($url) {
} else if (preg_match('/c-cex.com/', $url)) {
return 'c-cex';
} else if (preg_match('/bittrex.com/', $url)) {
return 'bittrex';
return 'bittrex';
} else if (preg_match('/yobit.net/', $url)) {
return 'yobit';


}
$this->setErrorMessage("API URL unknown");
return false;
}

/**
* Extract price information from API data
**/
Expand Down Expand Up @@ -131,6 +135,10 @@ public function getPrice() {
case 'bittrex':
return @$aData['result']['Last'];
break;
case 'yobit':
return @$aData[$this->config['price']['target']]['last'];
break;

}
} else {
$this->setErrorMessage("Got an invalid response from ticker API");
Expand Down
2 changes: 2 additions & 0 deletions include/config/global.inc.dist.php 100644 → 100755
Expand Up @@ -313,4 +313,6 @@
* Disable some calls when high system load
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-system-load
**/
$config['system']['load']['remote'] = false;
$config['system']['load']['remote_url'] = "http://sqlhost/load.php";
$config['system']['load']['max'] = 10.0;
11 changes: 10 additions & 1 deletion include/pages/api/getdashboarddata.inc.php
Expand Up @@ -8,7 +8,16 @@
}

// System load check
if ($load = @sys_getloadavg()) {
if( !$config['system']['load']['remote'] )
{
$load = @sys_getloadavg();
}
else
{
$load = json_decode(file_get_contents($config['system']['load']['remote_url']), true);
}

if ( $load ) {
if (isset($config['system']['load']['max']) && $load[0] > $config['system']['load']['max']) {
header('HTTP/1.1 503 Too busy, try again later');
die('Server too busy. Please try again later.');
Expand Down
7 changes: 7 additions & 0 deletions scripts/loadavg.php
@@ -0,0 +1,7 @@
<?php
echo json_encode(@sys_getloadavg());
<?php
// Put this in your MySQL Server if it's external
// sudo apt-get install libapache2-mod-php
// copy to /var/www/html/
echo json_encode(@sys_getloadavg());
2 changes: 1 addition & 1 deletion templates/bootstrap/account/edit/detail.tpl
Expand Up @@ -52,7 +52,7 @@
</br>
<font size="1">{if $GLOBAL.config.ap_threshold.min < 0.0001}{$GLOBAL.config.ap_threshold.min|number_format:"8"}{else}{$GLOBAL.config.ap_threshold.min}{/if} - {if $GLOBAL.config.ap_threshold.max < 0.0001}{$GLOBAL.config.ap_threshold.max|number_format:"8"}{else}{$GLOBAL.config.ap_threshold.max}{/if} {$GLOBAL.config.currency}. Set to '0' for no auto payout.{if $GLOBAL.config.txfee_auto > 0} A {if $GLOBAL.config.txfee_auto > 0.00001}{$GLOBAL.config.txfee_auto}{else}{$GLOBAL.config.txfee_auto|number_format:"8"}{/if} {$GLOBAL.config.currency} TX fee will apply <span id="tt"><img width="15px" height="15px" title="This {if $GLOBAL.config.txfee_auto > 0.00001}{$GLOBAL.config.txfee_auto}{else}{$GLOBAL.config.txfee_auto|number_format:"8"}{/if} automatic payment transaction fee is a network fee and goes back into the network not the pool." src="site_assets/bootstrap/images/questionmark.png"></span>{/if}</font>
</br>
<input class="form-control" type="text" name="payoutThreshold" value="{nocache}{$smarty.request.payoutThreshold|default:$GLOBAL.userdata.ap_threshold|escape}{/nocache}" size="{$GLOBAL.config.ap_threshold.max|strlen+4}" maxlength="{if $GLOBAL.config.ap_threshold.max < 1}10{else}{$GLOBAL.config.ap_threshold.max|strlen}{/if}" {if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.details && !$DETAILSUNLOCKED}id="disabledInput" disabled{/if}/>
<input class="form-control" type="text" name="payoutThreshold" value="{nocache}{$smarty.request.payoutThreshold|default:$GLOBAL.userdata.ap_threshold|escape}{/nocache}" size="{$GLOBAL.config.ap_threshold.max|strlen+4}" maxlength="10" {if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.details && !$DETAILSUNLOCKED}id="disabledInput" disabled{/if}/>
</div>
<div class="form-group">
<label>Anonymous Account</label>
Expand Down

0 comments on commit d263a56

Please sign in to comment.