From: tokul Date: Mon, 13 Feb 2006 17:23:51 +0000 (+0000) Subject: restoring globalization of text alignment vars. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f549a7069891846f86ee287bc3afd09f47fbf8b9;p=squirrelmail.git restoring globalization of text alignment vars. moving text alignment setup from $languages to GET request. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10739 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/i18n.php b/functions/i18n.php index de0115f9..a56f4f42 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -415,8 +415,13 @@ function set_up_language($sm_language, $do_search = false, $default = false) { // Many functions expect English conversion rules. if ($sm_notAlias=='tr_TR') setlocale(LC_CTYPE,'C'); - // Set text direction/alignment variables - // These don't appear to be used... are they safe to remove? + /** + * Set text direction/alignment variables + * When language environment is setup, scripts can use these globals + * without accessing $languages directly and making checks for optional + * array key. + */ + global $text_direction, $left_align, $right_align; if (isset($languages[$sm_notAlias]['DIR']) && $languages[$sm_notAlias]['DIR'] == 'rtl') { /** diff --git a/functions/page_header.php b/functions/page_header.php index 93b7d8b3..bfdc5872 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -39,7 +39,7 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE if ( !sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) { global $base_uri; } - global $theme_css, $custom_css, $pageheader_sent, $theme, $theme_default, + global $theme_css, $custom_css, $pageheader_sent, $theme, $theme_default, $text_direction, $default_fontset, $chosen_fontset, $default_fontsize, $chosen_fontsize, $chosen_theme; /* add no cache headers here */ @@ -68,7 +68,8 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE .'?themeid='.$used_theme .'&templateid='.basename($sTplDir) .(!empty($used_fontset) ? '&fontset='.$used_fontset : '') - .(!empty($used_fontsize) ? '&fontsize='.$used_fontsize : '')."\">\n"; + .(!empty($used_fontsize) ? '&fontsize='.$used_fontsize : '') + .(!empty($text_direction) ? '&dir='.$text_direction : '')."\">\n"; // load custom style sheet (deprecated) diff --git a/src/style.php b/src/style.php index 58c2ad64..15853436 100644 --- a/src/style.php +++ b/src/style.php @@ -23,7 +23,6 @@ define('SM_PATH','../'); require_once(SM_PATH . 'functions/global.php'); require_once(SM_PATH . 'functions/strings.php'); require_once(SM_PATH . 'config/config.php'); -require_once(SM_PATH . 'functions/i18n.php'); /* safety check for older config.php */ if (!isset($fontsets) || !is_array($fontsets)) { @@ -75,18 +74,13 @@ if (sqgetGlobalVar('themeid',$themeid,SQ_GET) && } /** - * TODO: tokul. $languages are not loaded here. - * get alignment variable from language settings... - * MOVE THIS to a central init section !!!! + * Get text direction */ -if (!sqgetGlobalVar('align',$align,SQ_SESSION)) { - $dir = ( isset( $languages[$squirrelmail_language]['DIR']) ) ? $languages[$squirrelmail_language]['DIR'] : 'ltr'; - if ( $dir == 'ltr' ) { - $align = array('left' => 'left', 'right' => 'right'); - } else { - $align = array('left' => 'right', 'right' => 'left'); - } - sqsession_register($align, 'align'); +if (sqgetGlobalVar('dir',$text_direction,SQ_GET) && + $text_direction == 'rtl') { + $align = array('left' => 'right', 'right' => 'left'); +} else { + $align = array('left' => 'left', 'right' => 'right'); } /**/