From ffe99faccc82597ded3e0b9e17a61ccc075fb69c Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 22 Jul 2014 10:33:01 +0200 Subject: [PATCH] [FIX] Disable API calls if not enabled --- include/pages/dashboard.inc.php | 1 + templates/bootstrap/dashboard/default.tpl | 2 ++ templates/bootstrap/dashboard/js/api.tpl | 10 ++++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/pages/dashboard.inc.php b/include/pages/dashboard.inc.php index e813c834..b21b7b11 100644 --- a/include/pages/dashboard.inc.php +++ b/include/pages/dashboard.inc.php @@ -52,6 +52,7 @@ if ($user->isAuthenticated()) { $smarty->assign('BLOCKSFOUND', $aLastBlocks); $smarty->assign('DISABLED_DASHBOARD', $setting->getValue('disable_dashboard')); $smarty->assign('DISABLED_DASHBOARD_API', $setting->getValue('disable_dashboard_api')); + $smarty->assign('DISABLED_API', $setting->getValue('disable_api')); $smarty->assign('ESTIMATES', array('shares' => $iEstShares, 'percent' => $dEstPercent)); $smarty->assign('NETWORK', array('difficulty' => $dDifficulty, 'block' => $iBlock, 'EstNextDifficulty' => $dEstNextDifficulty, 'EstTimePerBlock' => $dExpectedTimePerBlock, 'BlocksUntilDiffChange' => $iBlocksUntilDiffChange)); $smarty->assign('INTERVAL', $interval / 60); diff --git a/templates/bootstrap/dashboard/default.tpl b/templates/bootstrap/dashboard/default.tpl index e042fa1e..98646c5e 100644 --- a/templates/bootstrap/dashboard/default.tpl +++ b/templates/bootstrap/dashboard/default.tpl @@ -16,7 +16,9 @@ {include file="dashboard/overview/default.tpl"} {include file="dashboard/round_statistics/$PAYOUT_SYSTEM/default.tpl"} {include file="dashboard/account_data/default.tpl"} + {if !$DISABLED_API} {include file="dashboard/worker_information/default.tpl"} + {/if} {include file="dashboard/blocks/default.tpl"} diff --git a/templates/bootstrap/dashboard/js/api.tpl b/templates/bootstrap/dashboard/js/api.tpl index 731ee9a6..d47278f3 100644 --- a/templates/bootstrap/dashboard/js/api.tpl +++ b/templates/bootstrap/dashboard/js/api.tpl @@ -178,7 +178,7 @@ $(document).ready(function(){ return; } if (blocks[0].height > lastBlock) { - if(canCreateSoundJS) { + if(canCreateSoundJS) { createjs.Sound.play('ding'); } lastBlock = blocks[0].height; @@ -234,6 +234,7 @@ $(document).ready(function(){ }); })(); + {/literal}{if !$DISABLED_API}{literal} // Worker process to update active workers in the account details table (function worker2() { $.ajax({ @@ -250,7 +251,9 @@ $(document).ready(function(){ } }); })(); + {/literal}{/if}{literal} + {/literal}{if !$DISABLED_API}{literal} // Worker process to update user account balances // Our worker process to keep worker information updated (function worker3() { @@ -265,7 +268,8 @@ $(document).ready(function(){ } }); })(); - + {/literal}{/if}{literal} + // Mute Button $('#muteButton').click(function(){ if(muteFlag == 2) { @@ -280,8 +284,6 @@ $(document).ready(function(){ $(this).find($(".fa")).removeClass('fa-volume-up').addClass('fa-volume-off'); } }); - - }); {/literal}