Преглед на файлове

Right-to-left fixes from Saleh Madi <webmail@p-i-s.com> (part 2)

tokul преди 22 години
родител
ревизия
d8e5167c05
променени са 2 файла, в които са добавени 56 реда и са изтрити 49 реда
  1. 33 31
      src/compose.php
  2. 23 18
      src/read_body.php

+ 33 - 31
src/compose.php

@@ -29,6 +29,7 @@ require_once(SM_PATH . 'functions/plugin.php');
 require_once(SM_PATH . 'functions/display_messages.php');
 require_once(SM_PATH . 'class/deliver/Deliver.class.php');
 require_once(SM_PATH . 'functions/addressbook.php');
+require_once(SM_PATH . 'functions/set_language_align.php');
 
 /* --------------------- Get globals ------------------------------------- */
 $username = $_SESSION['username'];
@@ -36,6 +37,8 @@ $onetimepad = $_SESSION['onetimepad'];
 $base_uri = $_SESSION['base_uri'];
 $delimiter = $_SESSION['delimiter'];
 
+$language_align = set_language_align();
+
 if (isset($_POST['return'])) {
     $html_addr_search_done = 'Use Addresses';
 }
@@ -804,7 +807,7 @@ function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
 }
 
 function showInputForm ($session, $values=false) {
-    global $send_to, $send_to_cc, $body,
+    global $send_to, $send_to_cc, $body, $language_align, 
            $passed_body, $color, $use_signature, $signature, $prefix_sig,
            $editor_size, $attachments, $subject, $newmail,
            $use_javascript_addr_book, $send_to_bcc, $passed_id, $mailbox,
@@ -838,6 +841,7 @@ function showInputForm ($session, $values=false) {
              '// --></SCRIPT>' . "\n\n";
     }
 
+
     echo "\n" . '<FORM name=compose action="compose.php" METHOD=POST ' .
          'ENCTYPE="multipart/form-data"';
     do_hook("compose_form");
@@ -864,10 +868,10 @@ function showInputForm ($session, $values=false) {
     if ($mail_sent == 'yes') {
         echo '<BR><CENTER><B>'. _("Your Message has been sent").'</CENTER></B>';
     }
-    echo '<TABLE ALIGN=center CELLSPACING=0 BORDER=0>' . "\n";
+    echo '<TABLE dir="' . $language_align['dir'] . '" ALIGN=center CELLSPACING=0 BORDER=0>' . "\n";
     if ($compose_new_win == '1') {
-        echo '<TABLE ALIGN=CENTER BGCOLOR="'.$color[0].'" WIDTH="100%" BORDER=0>'."\n" .
-             '   <TR><TD></TD><TD ALIGN="RIGHT"><INPUT TYPE="BUTTON" NAME="Close" onClick="return self.close()" VALUE='._("Close").'></TD></TR>'."\n";
+        echo '<TABLE dir="' . $language_align['dir'] . '" ALIGN=CENTER BGCOLOR="'.$color[0].'" WIDTH="100%" BORDER=0>'."\n" .
+             '   <TR dir="' . $language_align['dir'] . '"><TD dir="' . $language_align['dir'] . '"></TD><TD dir="' . $language_align['dir'] . '" ALIGN="' . $language_align['right'] . '"><INPUT TYPE="BUTTON" NAME="Close" onClick="return self.close()" VALUE='._("Close").'></TD></TR>'."\n";
     }
     if ($location_of_buttons == 'top') {
         showComposeButtonRow();
@@ -875,10 +879,10 @@ function showInputForm ($session, $values=false) {
 
     $idents = getPref($data_dir, $username, 'identities', 0);
     if ($idents > 1) {
-        echo '   <TR>' . "\n" .
-             '      <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' .
+        echo '   <TR dir="' . $language_align['dir'] . '">' . "\n" .
+             '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN="' . $language_align['right'] . '">' .
                     _("From:") . '</TD>' . "\n" .
-             '      <TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" .
+             '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" WIDTH="90%" ALIGN="' . $language_align['left'] . '">' . "\n" .
              '         <select name=identity>' . "\n" .
              '         <option value=default>' .
                        htmlspecialchars(getPref($data_dir, $username, 'full_name'));
@@ -903,34 +907,34 @@ function showInputForm ($session, $values=false) {
              '      </TD>' . "\n" .
              '   </TR>' . "\n";
     }
-    echo '   <TR>' . "\n" .
-         '      <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' .
+    echo '   <TR dir="' . $language_align['dir'] . '">' . "\n" .
+         '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN="' . $language_align['right'] . '">' .
                 _("To:") . '</TD>' . "\n" .
-         '      <TD BGCOLOR="' . $color[4] . '" WIDTH="90%">' . "\n" .
+         '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" WIDTH="90%" ALIGN="' . $language_align['left'] . '">' . "\n" .
          '         <INPUT TYPE=text NAME="send_to" VALUE="' .
                    htmlspecialchars($send_to) . '" SIZE=60><BR>' . "\n" .
          '      </TD>' . "\n" .
          '   </TR>' . "\n" .
-         '   <TR>' . "\n" .
-         '      <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' .
+         '   <TR dir="' . $language_align['dir'] . '">' . "\n" .
+         '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['right'] . '">' .
                 _("CC:") . '</TD>' . "\n" .
-         '      <TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" .
+         '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['left'] . '">' . "\n" .
          '         <INPUT TYPE=text NAME="send_to_cc" SIZE=60 VALUE="' .
                    htmlspecialchars($send_to_cc) . '"><BR>' . "\n" .
          '      </TD>' . "\n" .
          '   </TR>' . "\n" .
-         '   <TR>' . "\n" .
-         '      <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' .
+         '   <TR dir="' . $language_align['dir'] . '">' . "\n" .
+         '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['right'] . '">' .
                 _("BCC:") . '</TD>' . "\n" .
-         '      <TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n" .
+         '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['left'] . '">' . "\n" .
          '         <INPUT TYPE=text NAME="send_to_bcc" VALUE="' .
                 htmlspecialchars($send_to_bcc) . '" SIZE=60><BR>' . "\n" .
          '      </TD>' . "\n" .
          '   </TR>' . "\n" .
-         '   <TR>' . "\n" .
-         '      <TD BGCOLOR="' . $color[4] . '" ALIGN=RIGHT>' .
+         '   <TR dir="' . $language_align['dir'] . '">' . "\n" .
+         '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['right'] . '">' .
                 _("Subject:") . '</TD>' . "\n" .
-         '      <TD BGCOLOR="' . $color[4] . '" ALIGN=LEFT>' . "\n";
+         '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" ALIGN="' . $language_align['left'] . '">' . "\n";
     echo '         <INPUT TYPE=text NAME=subject SIZE=60 VALUE="' .
                    htmlspecialchars($subject) . '">' . "\n" .
          '      </TD>' . "\n" .
@@ -941,14 +945,14 @@ function showInputForm ($session, $values=false) {
     }
 
     if ($compose_new_win == '1') {
-        echo '   <TR>' . "\n" .
-             '      <TD BGCOLOR="' . $color[0] . '" COLSPAN=2 ALIGN=CENTER>' . "\n" .
+        echo '   <TR dir="' . $language_align['dir'] . '">' . "\n" .
+             '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[0] . '" COLSPAN=2 ALIGN=CENTER>' . "\n" .
              '         <TEXTAREA NAME=body ROWS=20 COLS="' .
                        $editor_size . '" WRAP="VIRTUAL">';
     }
     else {
-        echo '   <TR>' . "\n" .
-            '      <TD BGCOLOR="' . $color[4] . '" COLSPAN=2>' . "\n" .
+        echo '   <TR dir="' . $language_align['dir'] . '">' . "\n" .
+            '      <TD dir="' . $language_align['dir'] . '" BGCOLOR="' . $color[4] . '" COLSPAN=2>' . "\n" .
             '         &nbsp;&nbsp;<TEXTAREA NAME=body ROWS=20 COLS="' .
                       $editor_size . '" WRAP="VIRTUAL">';
     }
@@ -1001,11 +1005,11 @@ function showInputForm ($session, $values=false) {
 	if ((bool) ini_get('file_uploads')) {
     echo '   <TR>' . "\n" .
          '      <TD COLSPAN=2>' . "\n" .
-         '         <table width="100%" cellpadding="1" cellspacing="0" align="center"'.
+         '         <table dir="' . $language_align['dir'] . '" width="100%" cellpadding="1" cellspacing="0" align="center"'.
                    ' border="0" bgcolor="'.$color[9].'">' . "\n" .
          '            <TR>' . "\n" .
          '               <TD>' . "\n" .
-         '                 <table width="100%" cellpadding="3" cellspacing="0" align="center"'.
+         '                 <table dir="' . $language_align['dir'] . '" width="100%" cellpadding="3" cellspacing="0" align="center"'.
                            ' border="0">' . "\n" .
          '                    <TR>' . "\n" .
          '                       <TD VALIGN=MIDDLE ALIGN=RIGHT>' .
@@ -1026,16 +1030,14 @@ function showInputForm ($session, $values=false) {
 		$attached_filename = decodeHeader($attachment->mime_header->getParameter('name'));
 		$type = $attachment->mime_header->type0.'/'.
 		        $attachment->mime_header->type1;
-        	$s_a[] = '<input type="checkbox" name="delete[]" value="' . 
-		         $key . "\">\n" . $attached_filename . ' - ' . $type . 
-		         ' ('.show_readable_size( filesize( $attached_file ) ) 
-		         . ')<br>'."\n";
+        	$s_a[] = '<table><tr><td><input type="checkbox" name="delete[]" value="' . 
+		         $key . "\"></td><td>\n" . $attached_filename . '</td><td>-</td><td> ' . $type . '</td><td>('.show_readable_size( filesize( $attached_file ) ) . ')</td></tr></table>'."\n";
            }
         }
     }
     if (count($s_a)) {
-       foreach ($s_a as $s) {
-          echo '<tr><td align=left colspan="2" bgcolor="' . $color[0] . '">'.$s.'</td></tr>';
+     foreach ($s_a as $s) {
+       echo '<tr><td align="' . $language_align['left'] . '" colspan="2" bgcolor="' . $color[0] . '">'.$s.'</td></tr>';
        }         
        echo '<tr><td colspan="2"><input type="submit" name="do_delete" value="' .
             _("Delete selected attachments") . "\">\n" .

+ 23 - 18
src/read_body.php

@@ -22,6 +22,11 @@ require_once(SM_PATH . 'functions/mime.php');
 require_once(SM_PATH . 'functions/date.php');
 require_once(SM_PATH . 'functions/url_parser.php');
 require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/set_language_align.php');
+
+
+/* --------------------- Get globals ------------------------------------- */
+$language_align = set_language_align();
 
 /**
  * Given an IMAP message id number, this will look it up in the cached
@@ -388,7 +393,7 @@ function formatRecipientString($recipients, $item ) {
 
 function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, 
                          $color, $FirstTimeSee) {
-    global $msn_user_support, $default_use_mdn, $default_use_priority,
+    global $msn_user_support, $default_use_mdn, $default_use_priority, $language_align,
            $show_xmailer_default, $mdn_user_support, $PHP_SELF, $javascript_on,
 	   $squirrelmail_language;
 
@@ -448,7 +453,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
         }
     }
 
-    $s  = '<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="2" BORDER="0"';
+    $s  = '<TABLE dir="' . $language_align['dir'] . '" WIDTH="100%" CELLPADDING="0" CELLSPACING="2" BORDER="0"';
     $s .= ' ALIGN="center" BGCOLOR="'.$color[0].'">';
     foreach ($env as $key => $val) {
         if ($val) {
@@ -458,27 +463,27 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
             $s .= '</TR>';
         }
     }
-    echo '<TABLE BGCOLOR="'.$color[9].'" WIDTH="100%" CELLPADDING="1"'.
+    echo '<TABLE dir="' . $language_align['dir'] . '" BGCOLOR="'.$color[9].'" WIDTH="100%" CELLPADDING="1"'.
          ' CELLSPACING="0" BORDER="0" ALIIGN="center">'."\n";
-    echo '<TR><TD HEIGHT="5" COLSPAN="2" BGCOLOR="'.
-          $color[4].'"></TD></TR><TR><TD align=center>'."\n";
+    echo '<TR dir="' . $language_align['dir'] . '"><TD dir="' . $language_align['dir'] . '" HEIGHT="5" COLSPAN="2" BGCOLOR="'.
+          $color[4].'"></TD></TR><TR><TD dir="' . $language_align['dir'] . '" align=center>'."\n";
     echo $s;
     do_hook('read_body_header');
     formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color);
     echo '</TABLE>';
-    echo '</TD></TR><TR><TD HEIGHT="5" COLSPAN="2" BGCOLOR="'.$color[4].'"></TD></TR>'."\n";
+    echo '</TD></TR><TR dir="' . $language_align['dir'] . '"><TD dir="' . $language_align['dir'] . '" HEIGHT="5" COLSPAN="2" BGCOLOR="'.$color[4].'"></TD></TR>'."\n";
     echo '</TABLE>';
 }
 
 function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response) {
-    global $base_uri, $draft_folder, $where, $what, $color, $sort,
+    global $base_uri, $draft_folder, $where, $what, $color, $sort, $language_align,
            $startMessage, $compose_new_win, $PHP_SELF, $save_as_draft,
            $enable_forward_as_attachment;
 
     $topbar_delimiter = '&nbsp;|&nbsp;';
     $urlMailbox = urlencode($mailbox);
-    $s = '<table width="100%" cellpadding="3" cellspacing="0" align="center"'.
-         ' border="0" bgcolor="'.$color[9].'"><tr><td align="left" width="33%"><small>';
+    $s = '<table dir=' . $language_align['dir'] . ' width="100%" cellpadding="3" cellspacing="0" align="center"'.
+         ' border="0" bgcolor="'.$color[9].'"><tr><td align="' . $language_align['left'] . '" width="33%"><small>';
 
     $msgs_url = $base_uri . 'src/';
     if (isset($where) && isset($what)) {
@@ -614,14 +619,14 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
 }
 
 function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
-    global $base_uri;
+    global $base_uri, $language_align;
 
     $urlMailbox = urlencode($mailbox);
     $url = $base_uri.'src/view_header.php?'.$_SERVER['QUERY_STRING'];
 
-    $s  = "<TR>\n" .
-          '<TD VALIGN="MIDDLE" ALIGN="RIGHT" WIDTH="20%"><B>' . _("Options") . ":&nbsp;&nbsp;</B></TD>\n" .
-          '<TD VALIGN="MIDDLE" ALIGN="LEFT" WIDTH="80%"><SMALL>' .
+    $s  = "<TR dir=" . $language_align['dir'] . ">\n" .
+          '<TD dir=' . $language_align['dir'] . ' VALIGN="MIDDLE" ALIGN=' . $language_align['right'] . ' WIDTH="20%"><B>' . _("Options") . ":&nbsp;&nbsp;</B></TD>\n" .
+          '<TD dir=' . $language_align['dir'] . ' VALIGN="MIDDLE" ALIGN=' . $language_align['left'] . ' WIDTH="80%"><SMALL>' .
           '<a href="'.$url.'">'._("View Full Header").'</a>';
 
     /* Output the printer friendly link if we are in subtle mode. */
@@ -822,13 +827,13 @@ for ($i = 0; $i < $cnt; $i++) {
 displayPageHeader($color, $mailbox);
 formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response);
 formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
-echo '<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0">';
+echo '<table dir="' . $language_align['dir'] . '" width="100%" cellpadding="0" cellspacing="0" align="center" border="0">';
 echo '  <tr><td>';
-echo '    <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[9].'">';
+echo '    <table dir="' . $language_align['dir'] . '" width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[9].'">';
 echo '      <tr><td>';
-echo '        <table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
+echo '        <table dir="' . $language_align['dir'] . '" width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
 echo '          <tr bgcolor="'.$color[4].'"><td>';
-echo '            <table cellpadding="1" cellspacing="5" align="left" border="0">';
+echo '            <table dir="' . $language_align['dir'] . '" cellpadding="1" cellspacing="5" align="' . $language_align['left'] . '" border="0">';
 echo '              <tr>' . html_tag( 'td', '<br>'. $messagebody."\n", 'left')
                         . '</tr>';
 echo '            </table>';
@@ -846,7 +851,7 @@ if ($attachmentsdisplay) {
    echo '    <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
    echo '     <tr><td>';
    echo '       <table width="100%" cellpadding="0" cellspacing="0" align="center" border="0" bgcolor="'.$color[4].'">';
-   echo '        <tr><td ALIGN="left" bgcolor="'.$color[9].'">';
+   echo '        <tr><td align="' . $language_align['left'] . '" bgcolor="'.$color[9].'">';
    echo '           <b>' . _("Attachments") . ':</b>';
    echo '        </td></tr>';
    echo '        <tr><td>';