Use forms.php functions.
[squirrelmail.git] / src / read_body.php
index bc4a6aba079f9221876a30aec7edf0b179e7a22d..9cce574aeb8d89ab742cfbd0968e8395181669a3 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. */
@@ -661,14 +664,14 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
     $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");
@@ -695,10 +698,11 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
         }
 
         $menu_row .= '<form action="'.$base_uri.'src/move_messages.php?'.$current_box.'" method="post" style="display: inline">'.
-              '<small><input type="hidden" name="show_more" value="0" />'.
-              '<input type="hidden" name="dmn" value="1" />'.
-              '<input type="hidden" name="location" value="'.$location.$current_box.'" />'.
-              '<input type="hidden" name="msg[0]" value="'.$passed_id.'" />'._("Move to:") .
+              '<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)) {
@@ -732,7 +736,11 @@ function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
     global $base_uri;
 
     $urlMailbox = urlencode($mailbox);
-    sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER);
+    if (!sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER)) {
+        // FIX ME !. If this happens there is something else wrong. Falling
+        // back to '' won't help. We should raise an error instead.
+        $query_string = '';                                                                                                         
+    } 
     $url = $base_uri.'src/view_header.php?'.$query_string;
 
     $s  = "<TR>\n" .