Moving HTML out of strings and updating some tags to XHTML
[squirrelmail.git] / functions / mailbox_display.php
index 4df1e22d955a73d50bf92d6bb7a97092ce1bc8be..107d2d968f0e2a8c8d662b7808b5838e54754359 100644 (file)
@@ -20,6 +20,7 @@ require_once(SM_PATH . 'class/html.class.php');
 require_once(SM_PATH . 'functions/imap_mailbox.php');
 require_once(SM_PATH . 'functions/imap_messages.php');
 require_once(SM_PATH . 'functions/mime.php');
+require_once(SM_PATH . 'functions/forms.php');
 
 /**
  * default value for page_selector_max
@@ -228,7 +229,6 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
     if (!isset($hlt_color)) {
         $hlt_color = $color_string;
     }
-    $checked = ($checkall == 1) ? ' checked' : '';
     $col = 0;
     $msg['SUBJECT'] = str_replace(' ', ' ', decodeHeader($msg['SUBJECT']));
     $subject = processSubject($msg['SUBJECT'], $indent_array[$msg['ID']]);
@@ -237,7 +237,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
             switch ($index_order_part) {
             case 1: /* checkbox */
                 echo html_tag( 'td',
-                               "<input type=\"checkbox\" name=\"msg[$t]\" value=\"".$msg['ID']."\"$checked />",
+                              addCheckBox("msg[$t]", $checkall, $msg['ID']), 
                                'center',
                                $hlt_color );
                 break;
@@ -598,7 +598,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
                 $msgs = getThreadMessages($imapConnection, $start_msg, $show_num, $num_msgs);
                 if ($msgs === false) {
                     echo '<b><small><center><font color=red>' .
-                         _("Thread sorting is not supported by your IMAP server.") . "<br />" .
+                         _("Thread sorting is not supported by your IMAP server.") . '<br />' .
                         _("Please report this to the system administrator.").
                          '</center></small></b>';
                     $thread_sort_messages = 0;
@@ -613,7 +613,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
                                               $num_msgs, $sort, $mbxresponse);
                 if ($msgs === false) {
                     echo '<b><small><center><font color=red>' .
-                         _( "Server-side sorting is not supported by your IMAP server.") . "<br />" .
+                         _( "Server-side sorting is not supported by your IMAP server.") . '<br />' .
                         _("Please report this to the system administrator.").
                          '</center></small></b>';
                     $sort = $server_sort_order;
@@ -889,10 +889,10 @@ function mail_message_listing_beginning ($imapConnection,
         $location = $php_self;
     }
 
-    $moveFields = '<input type="hidden" name="msg" value="'.htmlspecialchars($msg).'" />' .
-                         '<input type="hidden" name="mailbox" value="'.htmlspecialchars($mailbox).'" />' .
-                         '<input type="hidden" name="startMessage" value="'.htmlspecialchars($start_msg).'" />'.
-                  '<input type="hidden" name="location" value="'.$location.'" />';
+    $moveFields = addHidden('msg', $msg).
+                  addHidden('mailbox', $mailbox).
+                 addHidden('startMessage', $start_msg).
+                 addHidden('location', $location);
 
     /* build thread sorting links */
     if ($allow_thread_sort == TRUE) {
@@ -926,12 +926,7 @@ function mail_message_listing_beginning ($imapConnection,
           <td>
             <table bgcolor="<?php echo $color[4]; ?>" border="0" width="100%" cellpadding="1"  cellspacing="0">
               <tr>
-                <td align="left"><small>
-                   <?php
-                       echo $paginator; 
-                       echo $thread_link_str; 
-                   ?>
-               </small></td>
+                <td align="left"><small><?php echo $paginator . $thread_link_str; ?></small></td>
                 <td align="center"></td>
                 <td align="right"><small><?php echo $msg_cnt_str; ?></small></td>
               </tr>
@@ -1132,7 +1127,7 @@ function ShowSortButton($sort, $mailbox, $Down, $Up ) {
          . '&amp;startMessage=1&amp;mailbox=' . urlencode($mailbox)
          . '"><img src="../images/' . $img
          . '" border="0" width="12" height="10" alt="sort" title="'
-         . _("Click here to change the sorting of the message list") .'"></a>';
+         . _("Click here to change the sorting of the message list") .' /"></a>';
 }
 
 /**
@@ -1156,7 +1151,7 @@ function get_selectall_link($start_msg, $sort, $mailbox) {
                 . "function " . $func_name . "() {\n"
                 . "  for (var i = 0; i < document." . $form_name . ".elements.length; i++) {\n"
                 . "    if(document." . $form_name . ".elements[i].type == 'checkbox' && "
-                . "document." . $form_name . ".elements[i].name != 'bypass_trash'){\n"
+                . "       document." . $form_name . ".elements[i].name.substring(0,3) == 'msg'){\n"
                 . "      document." . $form_name . ".elements[i].checked = "
                 . "        !(document." . $form_name . ".elements[i].checked);\n"
                 . "    }\n"
@@ -1360,7 +1355,7 @@ function get_paginator_str($box, $start_msg, $end_msg, $num_msgs,
          * I am leaving this debug code here, commented out, because
          * it is a really nice way to see what the above code is doing.
          * echo "qts =  $q1_pgs/$q2_pgs/$q3_pgs/$q4_pgs = "
-         *    . ($q1_pgs + $q2_pgs + $q3_pgs + $q4_pgs) . '<br>';
+         *    . ($q1_pgs + $q2_pgs + $q3_pgs + $q4_pgs) . '<br />';
          */
 
         /* Print out the page links from the compute page quarters. */
@@ -1591,4 +1586,4 @@ function handleAsSent($mailbox) {
     return $handleAsSent_result;
 }
 
-?>
\ No newline at end of file
+?>