From: pdontthink Date: Wed, 3 Jan 2007 09:23:56 +0000 (+0000) Subject: Use checkForJavascrip() instead of $javascript_on X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=457e85930298524fc08003d262c71ab621470ab4 Use checkForJavascrip() instead of $javascript_on git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12049 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/include/init.php b/include/init.php index 17b4d23a..054f3a7b 100644 --- a/include/init.php +++ b/include/init.php @@ -572,7 +572,8 @@ if (empty($oTemplate)) { } // We want some variables to always be available to the template -$always_include = array('sTemplateID', 'icon_theme_path', 'javascript_on'); +$oTemplate->assign('javascript_on', checkForJavascript()); +$always_include = array('sTemplateID', 'icon_theme_path'); foreach ($always_include as $var) { $oTemplate->assign($var, (isset($$var) ? $$var : NULL)); } @@ -603,7 +604,12 @@ function checkForJavascript($reset = FALSE) { if ( !$reset && sqGetGlobalVar('javascript_on', $javascript_on, SQ_SESSION) ) return $javascript_on; - if ( $reset || !isset($javascript_setting) ) + 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 + // not in the session in that case, where do we get it from? + && ( sqGetGlobalVar('user_is_logged_in', $user_is_logged_in, SQ_SESSION) + && $user_is_logged_in) ) $javascript_setting = getPref($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT); if ( !sqGetGlobalVar('new_js_autodetect_results', $js_autodetect_results) && diff --git a/src/addrbook_search_html.php b/src/addrbook_search_html.php index a22da9a7..0c649961 100644 --- a/src/addrbook_search_html.php +++ b/src/addrbook_search_html.php @@ -65,7 +65,7 @@ function addr_insert_hidden() { * @param bool $includesource If true, adds backend column to address listing */ function addr_display_result($res, $includesource = true) { - global $color, $javascript_on, $PHP_SELF, $squirrelmail_language; + global $color, $PHP_SELF, $squirrelmail_language; global $oTemplate, $oErrorHandler; diff --git a/src/options.php b/src/options.php index a3dece04..f07752e2 100644 --- a/src/options.php +++ b/src/options.php @@ -331,7 +331,7 @@ if ($optpage == SMOPT_PAGE_MAIN) { foreach ($optpage_blocks as $cur_optpage) { if (!isset($cur_optpage['js']) || !$cur_optpage['js']) { $reg_optpage_blocks[] = $cur_optpage; - } else if ($javascript_on == SMPREF_JS_ON) { + } else if (checkForJavascript()) { $js_optpage_blocks[] = $cur_optpage; } } diff --git a/src/read_body.php b/src/read_body.php index 0705f962..e19fe13e 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -354,7 +354,7 @@ function formatRecipientString($recipients, $item ) { function formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee) { global $default_use_mdn, $default_use_priority, - $show_xmailer_default, $mdn_user_support, $PHP_SELF, $javascript_on, + $show_xmailer_default, $mdn_user_support, $PHP_SELF, $squirrelmail_language, $oTemplate; $mailbox = $aMailbox['NAME']; @@ -420,7 +420,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox, $delete_prev_next_display, $show_copy_buttons, - $compose_new_win, $javascript_on, $compose_width, $compose_height, + $compose_new_win, $compose_width, $compose_height, $oTemplate; //FIXME cleanup argument list, use $aMailbox where possible @@ -535,7 +535,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) { $compose_height = '550'; } - if ( $javascript_on ) { + if ( checkForJavascript() ) { $on_click=' onclick="comp_in_new_form(\''.$comp_uri.'\', this, this.form,'. $compose_width .',' . $compose_height .')"'; $comp_uri = 'javascript:void(0)'; $method='method="get" '; @@ -616,7 +616,7 @@ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removed function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) { global $base_uri, $where, $what, $show_html_default, - $oTemplate, $javascript_on, $download_href, + $oTemplate, $download_href, $unsafe_image_toggle_href, $unsafe_image_toggle_text; $urlMailbox = urlencode($mailbox); diff --git a/src/right_main.php b/src/right_main.php index 5f5c1e71..bd6fbab4 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -308,7 +308,7 @@ if ($aMailbox['EXISTS'] > 0) { $oTemplate->assign('page_selector', $page_selector); $oTemplate->assign('page_selector_max', $page_selector_max); $oTemplate->assign('compact_paginator', $compact_paginator); - $oTemplate->assign('javascript_on', $javascript_on); + $oTemplate->assign('javascript_on', checkForJavascript()); $oTemplate->assign('enablesort', (isset($aProps['config']['enablesort'])) ? $aProps['config']['enablesort'] : false); $oTemplate->assign('icon_theme_path', $icon_theme_path); $oTemplate->assign('aOrder', array_keys($aColumns)); diff --git a/src/search.php b/src/search.php index 5622b460..d17a13d9 100644 --- a/src/search.php +++ b/src/search.php @@ -1606,7 +1606,7 @@ if ($submit == $search_button_text) { $oTemplate->assign('page_selector', $page_selector); $oTemplate->assign('page_selector_max', $page_selector_max); $oTemplate->assign('compact_paginator', $compact_paginator); - $oTemplate->assign('javascript_on', $javascript_on); + $oTemplate->assign('javascript_on', checkForJavascript()); $oTemplate->assign('enablesort', (isset($aProps['config']['enablesort'])) ? $aProps['config']['enablesort'] : false); $oTemplate->assign('icon_theme_path', $icon_theme_path); $oTemplate->assign('use_icons', (isset($use_icons)) ? $use_icons : false); diff --git a/src/signout.php b/src/signout.php index 655b2660..30180a09 100644 --- a/src/signout.php +++ b/src/signout.php @@ -57,7 +57,8 @@ if ( !isset($oTemplate) || !is_object($oTemplate) ) { $oTemplate = Template::construct_template($sTemplateID); // We want some variables to always be available to the template - $always_include = array('sTemplateID', 'icon_theme_path', 'javascript_on'); + $oTemplate->assign('javascript_on', checkForJavascript()); + $always_include = array('sTemplateID', 'icon_theme_path'); foreach ($always_include as $var) { $oTemplate->assign($var, (isset($$var) ? $$var : NULL)); }