Merge branch 'issue-444-theserapher' of https://github.com/TheSerapher/php-mmcfe-ng into issue-444-theserapher
This commit is contained in:
commit
822c643d88
@ -30,13 +30,19 @@ class Api extends Base {
|
||||
* @return string JSON object
|
||||
**/
|
||||
function get_json($data, $force=false) {
|
||||
return json_encode(
|
||||
// Create a request specific memcache key
|
||||
$sMemcacheKey = @$_REQUEST['page'] . '_' . @$_REQUEST['action'] . '_' . __FUNCTION__ . '_' . @$SESSION['USERDATA']['id'] . '_' . $_SESSION['REMOTE_ADDR'];
|
||||
if ($this->setting->getValue('statistics_ajax_cache') && $json_data = $this->memcache->get($sMemcacheKey)) return $json_data;
|
||||
$json_data =json_encode(
|
||||
array( $_REQUEST['action'] => array(
|
||||
'version' => $this->api_version,
|
||||
'runtime' => (microtime(true) - $this->dStartTime) * 1000,
|
||||
'data' => $data
|
||||
)), $force ? JSON_FORCE_OBJECT : 0
|
||||
);
|
||||
if (! $expiration = $this->setting->getValue('statistics_ajax_cache_expiration')) $expiration = 10;
|
||||
if ($this->setting->getValue('statistics_ajax_cache'))
|
||||
return $this->memcache->setCache($sMemcacheKey, $json_data, $expiration);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,4 +69,5 @@ $api = new Api();
|
||||
$api->setConfig($config);
|
||||
$api->setUser($user);
|
||||
$api->setSetting($setting);
|
||||
$api->setMemcache($memcache);
|
||||
$api->setStartTime($dStartTime);
|
||||
|
||||
@ -37,6 +37,9 @@ class Base {
|
||||
public function setSetting($setting) {
|
||||
$this->setting = $setting;
|
||||
}
|
||||
public function setMemcache($memcache) {
|
||||
$this->memcache = $memcache;
|
||||
}
|
||||
public function setBitcoin($bitcoin) {
|
||||
$this->bitcoin = $bitcoin;
|
||||
}
|
||||
|
||||
@ -116,6 +116,20 @@ $aSettings['statistics'][] = array(
|
||||
'name' => 'statistics_ajax_data_interval', 'value' => $setting->getValue('statistics_ajax_data_interval'),
|
||||
'tooltip' => 'Time in minutes, interval for hashrate and sharerate calculations. Higher intervals allow for better accuracy at a higer server load.'
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Ajax Caching', 'type' => 'select',
|
||||
'options' => array('0' => 'No', '1' => 'Yes'),
|
||||
'default' => 0,
|
||||
'name' => 'statistics_ajax_cache', 'value' => $setting->getValue('statistics_ajax_cache'),
|
||||
'tooltip' => 'Enable or disable the Ajax cache for memcache.'
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Ajax Cache Expiration', 'type' => 'select',
|
||||
'options' => array('5' => '5', '10' => '10', '20' => '20', '40' => '40', '60' => '60'),
|
||||
'default' => 10,
|
||||
'name' => 'statistics_ajax_cache_expiration', 'value' => $setting->getValue('statistics_ajax_cache_expiration'),
|
||||
'tooltip' => 'Change expiration time for memcache keys.'
|
||||
);
|
||||
$aSettings['statistics'][] = array(
|
||||
'display' => 'Block Statistics Count', 'type' => 'text',
|
||||
'size' => 25,
|
||||
|
||||
@ -442,18 +442,18 @@ margin-bottom: 8px}
|
||||
|
||||
/* Content Manager */
|
||||
|
||||
.tablesorter {
|
||||
.tablesorter, .tablesorterpager {
|
||||
width: 100%;
|
||||
margin: -5px 0 0 0;
|
||||
}
|
||||
|
||||
.tablesorter td{
|
||||
.tablesorter, .tablesorterpager td{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-bottom: 1px dotted #ccc;
|
||||
}
|
||||
|
||||
.tablesorter thead tr {
|
||||
.tablesorter, .tablesorterpager thead tr {
|
||||
height: 34px;
|
||||
background: url(../images/table_sorter_header.png) repeat-x;
|
||||
text-align: left;
|
||||
@ -461,11 +461,11 @@ text-indent: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tablesorter td {
|
||||
.tablesorter, .tablesorterpager td {
|
||||
padding: 15px 10px;
|
||||
}
|
||||
|
||||
.tablesorter input[type=image] {
|
||||
.tablesorter, .tablesorterpager input[type=image] {
|
||||
margin-right: 10px;}
|
||||
|
||||
ul.tabs {
|
||||
|
||||
@ -97,7 +97,7 @@
|
||||
{/if}
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="{$PATH}/images/icn_alert_{if $NOTIFICATIONS[notification].active}success{else}error{/if}.png" />
|
||||
<i class="icon-{if $NOTIFICATIONS[notification].active}ok{else}cancel{/if}"></i>
|
||||
</td>
|
||||
</tr>
|
||||
{/section}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user