~ubuntu-branches/ubuntu/quantal/squirrelmail/quantal

« back to all changes in this revision

Viewing changes to functions/mailbox_display.php

  • Committer: Bazaar Package Importer
  • Author(s): Thijs Kinkhorst
  • Date: 2008-09-28 16:33:48 UTC
  • mfrom: (11.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080928163348-hgxf8au2d4zspabg
Tags: 2:1.4.15-3
Cookies sent over HTTPS will now be confined to HTTPS only
(cookie secure flag) and more support for the HTTPOnly cookie
attribute. Patch taken from upstream release.
(CVE-2008-3663, closes: #499942)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * This contains functions that display mailbox information, such as the
7
7
 * table row that has sender, date, subject, etc...
8
8
 *
9
 
 * @copyright © 1999-2006 The SquirrelMail Project Team
 
9
 * @copyright © 1999-2007 The SquirrelMail Project Team
10
10
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
11
 
 * @version $Id: mailbox_display.php,v 1.321.2.37 2006/10/20 08:59:34 kink Exp $
 
11
 * @version $Id: mailbox_display.php 12932 2008-02-10 16:49:47Z kink $
12
12
 * @package squirrelmail
13
13
 */
14
14
 
41
41
 
42
42
function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
43
43
                          $start_msg, $where, $what) {
44
 
    global $checkall,
 
44
    global $checkall, $preselected,
45
45
           $color, $msgs, $msort, $td_str, $msg,
46
46
           $default_use_priority,
47
47
           $message_highlight_list,
194
194
    if (!isset($hlt_color)) {
195
195
        $hlt_color = $color_string;
196
196
    }
197
 
    $checked = ($checkall == 1) ? ' CHECKED' : '';
 
197
    if ($checkall == 1 || in_array($msg['ID'], $preselected))
 
198
        $checked = ' checked="checked"';
 
199
    else
 
200
        $checked = '';
198
201
    $col = 0;
199
202
    $msg['SUBJECT'] = decodeHeader($msg['SUBJECT']);
200
203
//    $subject = processSubject($msg['SUBJECT'], $indent_array[$msg['ID']]);
261
264
                    $td_str .= _("A");
262
265
                    $stuff = true;
263
266
                }
264
 
                if ($msg['TYPE0'] == 'multipart') {
 
267
                if ($msg['TYPE0'] == 'multipart' && $msg['TYPE1'] == 'mixed') {
265
268
                    $td_str .= '+';
266
269
                    $stuff = true;
267
270
                }
342
345
    $msgs = array();
343
346
    if ($num_msgs >= 1) {
344
347
        $id = sqimap_get_php_sort_order ($imapConnection, $mbxresponse);
345
 
        if ($sort < 6 ) {
 
348
        if ($sort != 6 ) {
346
349
            $end = $num_msgs;
347
350
            $end_loop = $end;
348
351
            /* set shownum to 999999 to fool sqimap_get_small_header_list
451
454
                $id   = get_thread_sort($imapConnection);
452
455
                $msgs = getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id);
453
456
                if ($msgs === false) {
454
 
                    echo '<b><small><center><font color=red>' .
 
457
                    echo '<b><small><center><font color="red">' .
455
458
                        _("Thread sorting is not supported by your IMAP server.") . '<br />' .
456
459
                        _("Please contact your system administrator and report this error.") .
457
 
                        '</center></small></b>';
 
460
                        '</font></center></small></b>';
458
461
                    $thread_sort_messages = 0;
459
462
                    $msort = $msgs = array();
460
463
                } else {
466
469
                $id   = sqimap_get_sort_order($imapConnection, $sort, $mbxresponse);
467
470
                $msgs = getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id);
468
471
                if ($msgs === false) {
469
 
                    echo '<b><small><center><font color=red>' .
 
472
                    echo '<b><small><center><font color="red">' .
470
473
                        _( "Server-side sorting is not supported by your IMAP server.") . '<br />' .
471
474
                        _("Please contact your system administrator and report this error.") .
472
 
                        '</center></small></b>';
 
475
                        '</font></center></small></b>';
473
476
                    $sort = $server_sort_order;
474
477
                    $allow_server_sort = FALSE;
475
478
                    $msort = $msgs = array();
506
509
    $msg_cnt_str = get_msgcnt_str($start_msg, $end_msg, $num_msgs);
507
510
 
508
511
    do_hook('mailbox_index_before');
 
512
 
 
513
    $safe_name = preg_replace("/[^0-9A-Za-z_]/", '_', $mailbox);
 
514
    $form_name = "FormMsgs" . $safe_name;
 
515
    echo '<form name="' . $form_name . '" method="post" action="move_messages.php">' ."\n" .
 
516
        '<input type="hidden" name="mailbox" value="'.htmlspecialchars($mailbox).'">' . "\n" .
 
517
        '<input type="hidden" name="startMessage" value="'.htmlspecialchars($start_msg).'">' . "\n";
 
518
    
509
519
    echo '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
510
520
    echo '<tr><td>';
511
521
 
512
522
    mail_message_listing_beginning($imapConnection, $mailbox, $sort,
513
523
                                  $msg_cnt_str, $paginator_str, $start_msg);
514
 
    echo '</td></tr>';
515
524
    /* line between the button area and the list */
516
525
    echo '<tr><td height="5" bgcolor="'.$color[4].'"></td></tr>';
517
526
 
519
528
    echo '    <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
520
529
    echo '     <tr><td>';
521
530
    echo '       <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[5].'">';
522
 
    echo '<tr><td>';
523
531
    printHeader($mailbox, $srt, $color, !$thread_sort_messages);
524
532
 
525
533
    displayMessageArray($imapConnection, $num_msgs, $start_msg,
526
534
                        $msort, $mailbox, $sort, $color, $show_num,0,0);
527
 
    echo '</td></tr></table></td></tr></table>';
 
535
    echo '</table></td></tr></table>';
528
536
 
529
537
    mail_message_listing_end($num_msgs, $paginator_str, $msg_cnt_str, $color);
530
 
    echo '</td></tr></table>';
 
538
    echo '</table>';
 
539
 
 
540
    echo "\n</form>\n\n";
 
541
    
531
542
    //$t = elapsed($start);
532
543
    //echo("elapsed time = $t seconds\n");
533
544
}
541
552
     * 3 = Name (dn)
542
553
     * 4 = Subject (up)
543
554
     * 5 = Subject (dn)
 
555
     * 6 = default no sort
 
556
     * 7 - UNUSED
 
557
     * 8 = Size (up)
 
558
     * 9 = Size (dn)
544
559
     */
545
560
 
546
561
    if (($sort == 0) || ($sort == 1)) {
555
570
        foreach ($msgs as $item) {
556
571
            $msort[] = $item['SUBJECT-SORT'];
557
572
        }
 
573
    } elseif (($sort == 8) || ($sort == 9)) {
 
574
       foreach ($msgs as $item) {
 
575
           $msort[] = $item['SIZE'];
 
576
       }
558
577
    } else {
559
578
        $msort = $msgs;
560
579
    }
561
 
    if ($sort < 6) {
 
580
    if ($sort != 6) {
562
581
        if ($sort % 2) {
563
582
            asort($msort);
564
583
        } else {
693
712
        $source_url = $php_self;
694
713
    }
695
714
 
696
 
    if (!isset($msg)) {
697
 
        $msg = '';
698
 
    }
699
 
    $moveFields = '<input type="hidden" name="msg" value="'.htmlspecialchars($msg).'">' . "\n" .
700
 
        '<input type="hidden" name="mailbox" value="'.htmlspecialchars($mailbox).'">' . "\n" .
701
 
        '<input type="hidden" name="startMessage" value="'.htmlspecialchars($start_msg).'">' . "\n";
702
 
 
703
715
    /*
704
716
     * This is the beginning of the message list table.
705
717
     * It wraps around all messages
706
718
     */
707
 
    $safe_name = preg_replace("/[^0-9A-Za-z_]/", '_', $mailbox);
708
 
    $form_name = "FormMsgs" . $safe_name;
709
 
    echo '<form name="' . $form_name . '" method="post" action="move_messages.php">' ."\n"
710
 
        . $moveFields . "\n";
711
719
 
712
720
    if (!empty($paginator) && !empty($msg_cnt_str)) {
713
721
 
727
735
    /* line between header and button area */
728
736
        echo '</td></tr><tr><td height="5" bgcolor="'.$color[4].'"></td></tr>';
729
737
 
730
 
        echo '<tr><td>';
731
738
        echo html_tag( 'tr' ) . "\n"
732
739
        . html_tag( 'td' ,'' , 'left', '', '' )
733
740
         . html_tag( 'table' ,'' , '', $color[9], 'border="0" width="100%" cellpadding="1"  cellspacing="0"' )
742
749
            getMbxList($imapConnection);
743
750
            echo getButton('SUBMIT', 'moveButton',_("Move")) . "\n";
744
751
            echo getButton('SUBMIT', 'attache',_("Forward")) . "\n";
 
752
            do_hook('mailbox_display_buttons');
745
753
 
746
 
  echo "      </small></td>\n"
 
754
    echo "      </small></td>\n"
747
755
         . html_tag( 'td', '', 'right', '', 'nowrap' );
748
756
 
749
 
 
750
 
 
751
757
    if (!$auto_expunge) {
752
 
        echo getButton('SUBMIT', 'expungeButton',_("Expunge"))
753
 
             ."&nbsp;\n";
 
758
        echo getButton('SUBMIT', 'expungeButton',_("Expunge")) ."\n";
754
759
    }
755
760
 
756
 
    echo getButton('SUBMIT', 'markRead',_("Read"));
757
 
    echo getButton('SUBMIT', 'markUnread',_("Unread"));
 
761
    echo getButton('SUBMIT', 'markRead',_("Read")) . "\n";
 
762
    echo getButton('SUBMIT', 'markUnread',_("Unread")) . "\n";
758
763
    echo getButton('SUBMIT', 'delete',_("Delete")) ."&nbsp;\n";
759
764
    if (!strpos($php_self,'mailbox')) {
760
765
        $location = $php_self.'?mailbox=INBOX&amp;startMessage=1';
824
829
    /* End of message-list table */
825
830
 
826
831
    do_hook('mailbox_index_after');
827
 
    echo "</form>\n";
828
832
}
829
833
 
830
834
function printHeader($mailbox, $sort, $color, $showsort=true) {
875
879
            echo "</td>\n";
876
880
            break;
877
881
        case 6: /* size */
878
 
            echo html_tag( 'td', '<b>' . _("Size") . '</b>', 'center', '', 'width="5%" nowrap' );
 
882
            echo html_tag( 'td' ,'' , 'left', '', 'width="5%" nowrap' )
 
883
                 . '<b>' . _("Size") . '</b>';
 
884
            if ($showsort) {
 
885
                ShowSortButton($sort, $mailbox, 8, 9);
 
886
            }
 
887
            echo "</td>\n";
879
888
            break;
880
889
        }
881
890
    }
961
970
        } else {
962
971
            $result .= _("Select All");
963
972
        }
964
 
        $result .= "</A>\n";
 
973
        $result .= "</a>\n";
965
974
    }
966
975
 
967
976
    /* Return our final result. */
1318
1327
    return $handleAsSent_result;
1319
1328
}
1320
1329
 
1321
 
// vim: et ts=4
1322
 
?>