fix from Dimitar Pashev
[squirrelmail.git] / src / style.php
index 58c2ad6411fa01aba808d9d1dcec9b96f8bd6643..2f510033e9356c54734f6262003660468e2018a9 100644 (file)
@@ -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)) {
@@ -35,9 +34,13 @@ if (!isset($fontsets) || !is_array($fontsets)) {
 /** start block copy from right_main.php */
 include_once(SM_PATH . 'class/template/template.class.php');
 
-/* get template name and set used template directory */
-if (sqgetGlobalVar('templateid',$templateid,SQ_GET) &&
-    file_exists(SM_PATH.'templates/'.basename($templateid).'/stylesheet.tpl')) {
+/**
+ *  get template name and set used template directory
+ * 
+ *  Existing file check has been moved into the template object, so it is
+ *  not neccesary to do file_exists() here. 
+ * */
+if (sqgetGlobalVar('templateid',$templateid,SQ_GET)) {
     $sTplDir = SM_PATH.'templates/'.basename($templateid).'/';
 } else {
     $sTplDir = SM_PATH.'templates/default/';
@@ -75,18 +78,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');
 }
 
 /**/