// 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') {
/**
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 */
.'?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)
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)) {
}
/**
- * 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');
}
/**/