瀏覽代碼

Right-to-Left fixes by Saleh Madi <webmail@p-i-s.com>

tokul 22 年之前
父節點
當前提交
97ef0e6829
共有 2 個文件被更改,包括 33 次插入2 次删除
  1. 6 2
      functions/mailbox_display.php
  2. 27 0
      functions/set_language_align.php

+ 6 - 2
functions/mailbox_display.php

@@ -16,6 +16,10 @@ require_once(SM_PATH . 'functions/strings.php');
 require_once(SM_PATH . 'functions/html.php');
 require_once(SM_PATH . 'functions/html.php');
 require_once(SM_PATH . 'class/html.class.php');
 require_once(SM_PATH . 'class/html.class.php');
 require_once(SM_PATH . 'functions/imap_mailbox.php');
 require_once(SM_PATH . 'functions/imap_mailbox.php');
+require_once(SM_PATH . 'functions/set_language_align.php');
+
+/* --------------------- Get globals ------------------------------------- */
+$language_align = set_language_align();
 
 
 /* Default value for page_selector_max. */
 /* Default value for page_selector_max. */
 define('PG_SEL_MAX', 10);
 define('PG_SEL_MAX', 10);
@@ -327,7 +331,7 @@ function getSelfSortMessages($imapConnection, $start_msg, $show_num,
 function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
 function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
                                 $start_msg, $sort, $color, $show_num,
                                 $start_msg, $sort, $color, $show_num,
                                 $use_cache, $mode='') {
                                 $use_cache, $mode='') {
-    global $msgs, $msort, $auto_expunge, $thread_sort_messages,
+    global $msgs, $msort, $auto_expunge, $thread_sort_messages, $language_align,
            $allow_server_sort, $server_sort_order;
            $allow_server_sort, $server_sort_order;
 
 
     /* If autoexpunge is turned on, then do it now. */
     /* If autoexpunge is turned on, then do it now. */
@@ -421,7 +425,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
     $msg_cnt_str = get_msgcnt_str($start_msg, $end_msg, $num_msgs);
     $msg_cnt_str = get_msgcnt_str($start_msg, $end_msg, $num_msgs);
 
 
     do_hook('mailbox_index_before');
     do_hook('mailbox_index_before');
-    echo '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
+    echo '<table dir="' . $language_align['dir'] . '" border="0" width="100%" cellpadding="0" cellspacing="0">';
     echo '<tr><td>';
     echo '<tr><td>';
 
 
     mail_message_listing_beginning($imapConnection, $mailbox, $sort, 
     mail_message_listing_beginning($imapConnection, $mailbox, $sort, 

+ 27 - 0
functions/set_language_align.php

@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * set_language_align.php
+ *
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * which return direction and alignments for the table (stuff like the headers
+ * input tags etc. need to be aligned differently in arabic and hebrew).
+ *
+ * $Id$
+ */
+
+    function set_language_align(){
+        GLOBAL $languages, $squirrelmail_language;
+        $text_align = array();
+        if ( isset( $languages[$squirrelmail_language]['DIR']) ) {
+           $text_align['dir']  = $languages[$squirrelmail_language]['DIR'];
+        } else {
+            $text_align['dir'] = 'ltr';
+        }
+        $text_align['left'] = $text_align['dir'] == 'ltr' ? 'left' : 'right';
+        $text_align['right'] = $text_align['dir'] == 'ltr' ? 'right' : 'left';
+        return($text_align);
+    }
+?>