* [FEATURE] Allow in-class checking for user permissions * [FEATURE] Allow in-class creation of the JSON data for coherence * [FEATURE} Added API version in JSON data for client side checks * [IMPROVEMENT] Adjusted all API calls to use the new JSON layout **NOTE**: This is breaking backwads compatibility with the old API! Please adjust your client application to support this new version. The data array should not change much more other than added features.
26 lines
629 B
PHP
26 lines
629 B
PHP
<?php
|
|
|
|
// Make sure we are called from index.php
|
|
if (!defined('SECURITY')) die('Hacking attempt');
|
|
|
|
// Check if the API is activated
|
|
$api->isActive();
|
|
|
|
// Check user token
|
|
$user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']);
|
|
|
|
// Fetch some settings
|
|
if ( ! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300;
|
|
|
|
// Gather un-cached data
|
|
$statistics->setGetCache(false);
|
|
$hashrate = $statistics->getUserHashrate($user_id, $interval);
|
|
$statistics->setGetCache(true);
|
|
|
|
// Output JSON
|
|
echo $api->get_json($hashrate);
|
|
|
|
// Supress master template
|
|
$supress_master = 1;
|
|
?>
|