From 83aff890068d5c8dc46f58b5dd1d6cc756e012fb Mon Sep 17 00:00:00 2001 From: pdontthink Date: Wed, 3 Jan 2007 09:26:44 +0000 Subject: [PATCH] Use checkForJavascript() instead of $javascript_on. Except I did not change mailbox_display.php because $javascript_on comes from $aProps, not sure if it could be changed - Marc? git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12050 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mailbox_display.php | 1 + functions/options.php | 6 ++---- functions/page_header.php | 9 +++++---- functions/strings.php | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 0f50c06e..280c1873 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -1154,6 +1154,7 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { $aTemplate['thread_link_str'] = $thread_link_str; $aTemplate['php_self'] = str_replace('&','&',$php_self); $aTemplate['mailbox'] = $sMailbox; +//FIXME: javascript_on is always assigned to the template object in places like init.php; is there some reason to reassign it here? is there some chance that it was changed? if not, please remove this line! $aTemplate['javascript_on'] = (isset($aProps['config']['javascript_on'])) ? $aProps['config']['javascript_on'] : false; $aTemplate['enablesort'] = (isset($aProps['config']['enablesort'])) ? $aProps['config']['enablesort'] : false; $aTemplate['icon_theme'] = (isset($aProps['config']['icon_theme'])) ? $aProps['config']['icon_theme'] : false; diff --git a/functions/options.php b/functions/options.php index ccd40206..b3ef7864 100644 --- a/functions/options.php +++ b/functions/options.php @@ -463,11 +463,10 @@ class SquirrelOption { * @return string html formated option field */ function createWidget_Integer() { - global $javascript_on; // add onChange javascript handler to a regular string widget // which will strip out all non-numeric chars - if ($javascript_on) + if (checkForJavascript()) return preg_replace('/\/>/', ' onChange="origVal=this.value; newVal=\'\'; ' . 'for (i=0;i=\'0\' ' . '&& origVal.charAt(i)<=\'9\') newVal += origVal.charAt(i); } ' @@ -482,11 +481,10 @@ class SquirrelOption { * @return string html formated option field */ function createWidget_Float() { - global $javascript_on; // add onChange javascript handler to a regular string widget // which will strip out all non-numeric (period also OK) chars - if ($javascript_on) + if (checkForJavascript()) return preg_replace('/\/>/', ' onChange="origVal=this.value; newVal=\'\'; ' . 'for (i=0;i=\'0\' ' . '&& origVal.charAt(i)<=\'9\') || origVal.charAt(i)==\'.\') ' diff --git a/functions/page_header.php b/functions/page_header.php index 27fa23a0..f324b74d 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -186,7 +186,7 @@ function displayPageHeader($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { global $reply_focus, $hide_sm_attributions, $frame_top, $provider_name, $provider_uri, $startMessage, - $javascript_on, $action, $oTemplate; + $action, $oTemplate; if (empty($sBodyTagJs)) { if (strpos($action, 'reply') !== FALSE && $reply_focus) { @@ -210,7 +210,8 @@ function displayPageHeader($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { $frame_top = '_top'; } - if( $javascript_on || strpos($sHeaderJs, 'new_js_autodetect_results.value') ) { +//FIXME: does checkForJavascript() make the 2nd part of the if() below unneccessary?? + if( checkForJavascript() || strpos($sHeaderJs, 'new_js_autodetect_results.value') ) { $js_includes = $oTemplate->get_javascript_includes(TRUE); $sJsBlock = ''; foreach ($js_includes as $js_file) { @@ -271,7 +272,7 @@ function displayPageHeader($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { */ function compose_Header($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { - global $reply_focus, $javascript_on, $action, $oTemplate; + global $reply_focus, $action, $oTemplate; if (empty($sBodyTagJs)) { if (strpos($action, 'reply') !== FALSE && $reply_focus) { @@ -290,7 +291,7 @@ function compose_Header($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { /* * Locate the first displayable form element (only when JavaScript on) */ - if($javascript_on) { + if(checkForJavascript()) { if ($sHeaderJs) { $sJsBlock = "\n