From: pdontthink Date: Tue, 17 Jul 2007 22:24:57 +0000 (+0000) Subject: Avoid calling javascript check fxn if user is not logged in X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=e39d00e9f71ff23a4e2c8e0c1c065e61d0c73067 Avoid calling javascript check fxn if user is not logged in git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12550 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/include/init.php b/include/init.php index 0e3241a0..28b9eb05 100644 --- a/include/init.php +++ b/include/init.php @@ -60,7 +60,8 @@ if ((bool) ini_get('register_globals') && /** * Used as a dummy value, e.g., for passing as an empty - * hook argument. + * hook argument (where the value is passed by reference, + * and therefore NULL itself is not acceptable). */ global $null; $null = NULL; @@ -562,7 +563,9 @@ if (empty($oTemplate)) { } // We want some variables to always be available to the template -$oTemplate->assign('javascript_on', checkForJavascript()); +$oTemplate->assign('javascript_on', + (sqGetGlobalVar('user_is_logged_in', $user_is_logged_in, SQ_SESSION) + ? checkForJavascript() : 0)); $oTemplate->assign('base_uri', sqm_baseuri()); $always_include = array('sTemplateID', 'icon_theme_path'); foreach ($always_include as $var) { @@ -595,6 +598,7 @@ function checkForJavascript($reset = FALSE) { if ( !$reset && sqGetGlobalVar('javascript_on', $javascript_on, SQ_SESSION) ) return $javascript_on; + $user_is_logged_in = FALSE; if ( ( $reset || !isset($javascript_setting) ) // getPref() not defined (nor is it meaningful) when user not // logged in, but that begs the question if $javascript_on is