From 88b9d95ff26aa13184c71492e188261487669b05 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 13 Jun 2013 16:41:38 +0200 Subject: [PATCH] Only run some globals for smarty if loggedin * Do not check for round shares if user is not logged in * Will prevent a long page load for new users trying to register * Only needed on statistics page that is not available to guests --- public/include/smarty_globals.inc.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index d7712942..257d33d4 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -7,16 +7,19 @@ if (!defined('SECURITY')) // Globally available variables $debug->append('Global smarty variables', 3); +// Only run these if the user is logged in +if ($_SESSION['AUTHENTICATED']) { + $aRoundShares = $statistics->getRoundShares(); + if ($bitcoin->can_connect() === true){ + $dDifficulty = $bitcoin->query('getdifficulty'); + } else { + $dDifficulty = 1; + } +} // Fetch some data -$aRoundShares = $statistics->getRoundShares(); $iCurrentActiveWorkers = $worker->getCountAllActiveWorkers(); $iCurrentPoolHashrate = $statistics->getCurrentHashrate(); $iCurrentPoolShareRate = $statistics->getCurrentShareRate(); -if ($bitcoin->can_connect() === true){ - $dDifficulty = $bitcoin->query('getdifficulty'); -} else { - $dDifficulty = 1; -} // Global data for Smarty $aGlobal = array(