translator moved to other address
[squirrelmail.git] / src / read_body.php
index 0f3b214435d44059221170fc5a932cffd562a688..77f34d873e47f805811365095a3c1ff5ce48251e 100644 (file)
@@ -8,11 +8,14 @@
  * This file is used for reading the msgs array and displaying
  * the resulting emails in the right frame.
  *
- * $Id$
+ * @version $Id$
  * @package squirrelmail
  */
 
-/** Path for SquirrelMail required files. */
+/**
+ * Path for SquirrelMail required files.
+ * @ignore
+ */
 define('SM_PATH','../');
 
 /* SquirrelMail required files. */
@@ -90,10 +93,9 @@ function findPreviousMessage($numMessages, $passed_id) {
     if ($thread_sort_messages || $allow_server_sort ) {
         foreach($server_sort_array as $key=>$value) {
             if ($passed_id == $value) {
-                if ($key == 0) {
-                    break;
+                if ($key != 0) {
+                    $result = $server_sort_array[$key - 1];
                 }
-                $result = $server_sort_array[$key - 1];
                 break;
             }
         }
@@ -123,9 +125,9 @@ function findPreviousMessage($numMessages, $passed_id) {
 function printer_friendly_link($mailbox, $passed_id, $passed_ent_id) {
     global $javascript_on, $color;
 
-    $params = '?passed_ent_id=' . $passed_ent_id .
+    $params = '?passed_ent_id=' . urlencode($passed_ent_id) .
               '&mailbox=' . urlencode($mailbox) .
-              '&passed_id=' . $passed_id;
+              '&passed_id=' . urlencode($passed_id);
 
     $print_text = _("View Printable Version");
 
@@ -623,18 +625,18 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
     // Start form for reply/reply all/forward.. 
     $target = '';
     $on_click='';
-    $method='method="get" ';
+    $method='method="post" ';
     if ($compose_new_win == '1') {
         if ( $javascript_on ) {
           $on_click=' onclick="comp_in_new_form(\''.$comp_uri.'\', this, this.form)"';
           $comp_uri = 'javascript:void(0)';
+          $method='method="get" ';
         } else {
           $target = 'target="_blank"';
-          $method='method="post" ';
         }
     }
 
-    $menu_row .= "\n".'<form name="composeForm" action="'.$comp_uri.'" '.$method.$target.'><small>'."\n";
+    $menu_row .= "\n".'<form name="composeForm" action="'.$comp_uri.'" '.$method.$target.' style="display: inline">'."\n";
 
     // If Draft folder - create Resume link
     if (($mailbox == $draft_folder) && ($save_as_draft)) {
@@ -653,23 +655,23 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
     $menu_row .= getButton('SUBMIT', 'smaction_reply_all', _("Reply All"), $on_click) ."\n";
     $menu_row .= getButton('SUBMIT', 'smaction_forward', _("Forward"), $on_click);
     if ($enable_forward_as_attachment)
-        $menu_row .= '<input type="checkbox" name="smaction_attache">' . _("Attachment") ."\n";
+        $menu_row .= '<input type="checkbox" name="smaction_attache">' . _("As Attachment") .'&nbsp;&nbsp;'."\n";
 
-    $menu_row .= '</form>'.'&nbsp;&nbsp;'."\n";
+    $menu_row .= '</form>&nbsp;';
 
     // Form for deletion
     $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox;
-    $menu_row .= '<form action="'.$delete_url.'" method="post" style="display: inline"><small>';
+    $menu_row .= '<form action="'.$delete_url.'" method="post" style="display: inline">';
 
     if (!(isset($passed_ent_id) && $passed_ent_id)) {
-        $menu_row .= '<input type="hidden" name="message" value="'.$passed_id.'" />';
+        $menu_row .= addHidden('message', $passed_id);
 
         if ($where && $what) {
-            $menu_row .= '<input type="hidden" name="where" value="'.$where.'" />';
-            $menu_row .= '<input type="hidden" name="what" value="'.$what.'" />';
+           $menu_row .= addHidden('where', $where);
+           $menu_row .= addHidden('what',  $what);
         } else {
-            $menu_row .= '<input type="hidden" name="sort" value="'.$sort.'" />';
-            $menu_row .= '<input type="hidden" name="startMessage" value="'.$startMessage.'" />';
+           $menu_row .= addHidden('sort',  $sort);
+           $menu_row .= addHidden('startMessage', $startMessage);
         }
         $menu_row .= getButton('SUBMIT', 'delete', _("Delete"));
         $menu_row .= '<input type="checkbox" name="bypass_trash">' . _("Bypass Trash");
@@ -677,7 +679,7 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
     else
       $menu_row .= getButton('SUBMIT', 'delete', _("Delete"), '', FALSE) . "\n"; // delete button is disabled
 
-    $menu_row .= '</form>' . "\n";
+    $menu_row .= '</form>';
 
 
     // Add top move link
@@ -688,15 +690,19 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
 
         // Set subsequent location based on whether or not there is a 'next' message.
         if ( isset($next) && $next >= 0 ) {
-          $location = $base_uri . 'src/read_body.php?passed_id='.$next.'&';
+            $location = $base_uri . 'src/read_body.php?passed_id='.$next.'&';
+        } elseif (isset($prev) && $prev >= 0) {
+            $location = $base_uri . 'src/read_body.php?passed_id='.$prev.'&';
         } else {
-          $location = $base_uri . 'src/right_main.php?';
+            $location = $base_uri . 'src/right_main.php?';
         }
 
-        $menu_row .= '<form action="'.$base_uri.'src/move_messages.php?'.$current_box.'" method="post">'.
-              '<small><input type="hidden" name="show_more" value="0" />'.
-              '<input type="hidden" name="location" value="'.$location.$current_box.'" />'.
-              '<input type="hidden" name="msg[0]" value="'.$passed_id.'" />'._("Move to:") .
+        $menu_row .= '<form action="'.$base_uri.'src/move_messages.php?'.$current_box.'" method="post" style="display: inline">'.
+              '<small>'.
+             addHidden('show_more', '0' ).
+             addHidden('dmn', '1').
+             addHidden('location', $location.$current_box).
+             addHidden('msg[0]', $passed_id) . _("Move to:") .
               '<select name="targetMailbox" style="padding: 0px; margin: 0px">';
 
         if (isset($lastTargetMailbox) && !empty($lastTargetMailbox)) {
@@ -727,10 +733,22 @@ 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, $where, $what;
     $urlMailbox = urlencode($mailbox);
-    sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER);
+    $urlPassed_id = urlencode($passed_id);
+    $urlPassed_ent_id = urlencode($passed_ent_id);
+    $query_string = 'mailbox=' . $urlMailbox . '&amp;passed_id=' . $urlPassed_id . '&amp;passed_ent_id=' . $urlPassed_ent_id;
+    if (!empty($where)) {
+        $query_string .= '&amp;where=' . urlencode($where);
+    }
+
+    if (!empty($what)) {
+        $query_string .= '&amp;what=' . urlencode($what);
+    }
+
     $url = $base_uri.'src/view_header.php?'.$query_string;
 
     $s  = "<TR>\n" .