Changeset 3726 in subversion


Ignore:
Timestamp:
Jun 8, 2010 8:46:05 AM (3 years ago)
Author:
alec
Message:
  • Fix some IMAP errors handling when opening the message (#1485443)
Location:
trunk/roundcubemail
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r3717 r3726  
    22=========================== 
    33 
     4- Fix some IMAP errors handling when opening the message (#1485443) 
    45- Fix related parts aren't displayed when got mimetype other than image/* (#1486432) 
    56- Multiple identity and database support for squirrelmail_usercopy plugin (#1486517) 
  • trunk/roundcubemail/program/include/rcube_imap.php

    r3718 r3726  
    20622062 
    20632063        // convert charset (if text or message part) 
    2064         if ($o_part->ctype_primary == 'text' || $o_part->ctype_primary == 'message') { 
     2064        if ($body && ($o_part->ctype_primary == 'text' || $o_part->ctype_primary == 'message')) { 
    20652065            // assume default if no charset specified 
    20662066            if (empty($o_part->charset) || strtolower($o_part->charset) == 'us-ascii') 
     
    26292629            $a_mboxes = $this->conn->listMailboxes($this->mod_mailbox($root), $filter); 
    26302630        } 
    2631          
     2631 
    26322632        $a_folders = array(); 
    26332633        if (!is_array($a_mboxes)) 
  • trunk/roundcubemail/program/include/rcube_imap_generic.php

    r3725 r3726  
    17781778            } 
    17791779 
     1780        // format request 
    17801781                $reply_key = '* ' . $id; 
    1781         $result = false; 
    1782  
    1783         // format request 
    1784                 $key     = 'ftch0'; 
    1785                 $request = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])"; 
     1782                $key       = 'ftch0'; 
     1783                $request   = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])"; 
     1784 
    17861785        // send request 
    17871786                if (!$this->putLine($request)) { 
     
    17951794                } while (!($end = $this->startsWith($line, $key, true)) && $a[2] != 'FETCH'); 
    17961795 
    1797                 $len = strlen($line); 
     1796                $len    = strlen($line); 
     1797        $result = false; 
    17981798 
    17991799                // handle empty "* X FETCH ()" response 
     
    18911891                        } while (!$this->startsWith($line, $key, true)); 
    18921892 
    1893                 if ($result) { 
     1893                if ($result !== false) { 
    18941894                if ($file) { 
    18951895                        fwrite($file, $result); 
  • trunk/roundcubemail/program/include/rcube_message.php

    r3716 r3726  
    66 |                                                                       | 
    77 | This file is part of the RoundCube Webmail client                     | 
    8  | Copyright (C) 2008-2009, RoundCube Dev. - Switzerland                 | 
     8 | Copyright (C) 2008-2010, RoundCube Dev. - Switzerland                 | 
    99 | Licensed under the GNU GPL                                            | 
    1010 |                                                                       | 
     
    6464        $this->app = rcmail::get_instance(); 
    6565        $this->imap = $this->app->imap; 
    66      
     66 
    6767        $this->uid = $uid; 
    6868        $this->headers = $this->imap->get_headers($uid, NULL, true, true); 
     69 
     70        if (!$this->headers) 
     71            return; 
    6972 
    7073        $this->subject = rcube_imap::decode_mime_string( 
    7174            $this->headers->subject, $this->headers->charset); 
    7275        list(, $this->sender) = each($this->imap->decode_address_list($this->headers->from)); 
    73      
     76 
    7477        $this->set_safe((intval($_GET['_safe']) || $_SESSION['safe_messages'][$uid])); 
    7578        $this->opt = array( 
  • trunk/roundcubemail/program/js/app.js

    r3704 r3726  
    204204 
    205205        if (this.env.action=='show' || this.env.action=='preview') { 
    206           this.enable_command(this.env.message_commands, true); 
     206          this.enable_command(this.env.message_commands, this.env.uid); 
    207207 
    208208          if (this.env.next_uid) { 
     
    244244        } 
    245245        // show printing dialog 
    246         else if (this.env.action == 'print') 
     246        else if (this.env.action == 'print' && this.env.uid) 
    247247          window.print(); 
    248248 
  • trunk/roundcubemail/program/steps/mail/func.inc

    r3710 r3726  
    964964        if (!isset($part->body)) 
    965965          $part->body = $MESSAGE->get_part_content($part->mime_id); 
     966 
     967        // message is cached but not exists (#1485443), or other error 
     968        if ($part->body === false) { 
     969          rcmail_message_error($MESSAGE->uid); 
     970        } 
    966971 
    967972        // re-format format=flowed content 
     
    15511556} 
    15521557 
     1558function rcmail_message_error($uid=null) 
     1559{ 
     1560  global $RCMAIL; 
     1561 
     1562  // Set env variables for messageerror.html template 
     1563  if ($RCMAIL->action == 'show') { 
     1564    $mbox_name = $RCMAIL->imap->get_mailbox_name(); 
     1565    $RCMAIL->output->set_env('mailbox', $mbox_name); 
     1566    $RCMAIL->output->set_env('uid', null); 
     1567  } 
     1568  // display error message 
     1569  $RCMAIL->output->show_message('messageopenerror', 'error'); 
     1570  // ... display message error page 
     1571  $RCMAIL->output->send('messageerror'); 
     1572} 
    15531573 
    15541574// register UI objects 
  • trunk/roundcubemail/program/steps/mail/headers.inc

    r3223 r3726  
    2121if ($uid = get_input_value('_uid', RCUBE_INPUT_POST)) 
    2222{ 
    23   $source = $IMAP->get_raw_headers($uid); 
     23    $source = $IMAP->get_raw_headers($uid); 
    2424 
    25   if ($source) 
    26     { 
    27     $source = htmlspecialchars(trim($source)); 
    28     $source = preg_replace( 
    29       array( 
    30         '/\n[\t\s]+/', 
    31         '/^([a-z0-9_:-]+)/im', 
    32         '/\r?\n/' 
    33       ), 
    34       array( 
    35         "\n    ", 
    36         '<font class="bold">\1</font>', 
    37         '<br />' 
    38       ), $source); 
    39      
    40     $OUTPUT->command('set_headers', $source); 
     25    if ($source !== false) { 
     26        $source = htmlspecialchars(trim($source)); 
     27        $source = preg_replace( 
     28            array( 
     29                '/\n[\t\s]+/', 
     30                '/^([a-z0-9_:-]+)/im', 
     31                '/\r?\n/' 
     32            ), 
     33            array( 
     34                "\n&nbsp;&nbsp;&nbsp;&nbsp;", 
     35                '<font class="bold">\1</font>', 
     36                '<br />' 
     37            ), $source); 
     38 
     39        $OUTPUT->command('set_headers', $source); 
     40    } 
     41    else { 
     42        $RCMAIL->output->show_message('messageopenerror', 'error'); 
     43    } 
     44 
    4145    $OUTPUT->send(); 
    42     } 
    4346} 
    44    
     47 
    4548exit; 
    4649 
  • trunk/roundcubemail/program/steps/mail/show.inc

    r3589 r3726  
    2323 
    2424// similar code as in program/steps/mail/get.inc 
    25 if ($_GET['_uid']) { 
    26   $MESSAGE = new rcube_message(get_input_value('_uid', RCUBE_INPUT_GET)); 
     25if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) { 
     26  $MESSAGE = new rcube_message($uid); 
    2727 
    2828  // if message not found (wrong UID)... 
    2929  if (empty($MESSAGE->headers)) { 
    30     $OUTPUT->show_message('messageopenerror', 'error'); 
    31     // ... display error or preview page 
    32     if ($RCMAIL->action=='preview' && $OUTPUT->template_exists('messageerror')) 
    33       $OUTPUT->send('messageerror'); 
    34     else if ($RCMAIL->action=='preview' && $OUTPUT->template_exists('messagepreview')) 
    35       $OUTPUT->send('messagepreview'); 
    36     // ... go back to the list 
    37     else { 
    38       rcmail_overwrite_action(''); 
    39       return; 
    40     } 
     30    rcmail_message_error($uid); 
    4131  } 
    4232 
     
    4434 
    4535  $mbox_name = $IMAP->get_mailbox_name(); 
    46    
     36 
    4737  // show images? 
    4838  rcmail_check_safe($MESSAGE); 
     
    5343 
    5444  $OUTPUT->set_pagetitle($MESSAGE->subject); 
    55    
     45 
    5646  // give message uid to the client 
    5747  $OUTPUT->set_env('uid', $MESSAGE->uid); 
  • trunk/roundcubemail/skins/default/templates/messageerror.html

    r2723 r3726  
    22<html xmlns="http://www.w3.org/1999/xhtml"> 
    33<head> 
    4 <title></title> 
     4<title><roundcube:object name='productname' /> :: <roundcube:label name='servererror' /></title> 
    55<roundcube:include file="/includes/links.html" /> 
     6 
     7<roundcube:if condition="env:action!='show'" /> 
     8 
    69</head> 
    710<body class="iframe" style="background-color:#F2F2F2;"> 
     
    1215 
    1316</body> 
     17 
     18<roundcube:else /> 
     19 
     20<script type="text/javascript" src="/splitter.js"></script> 
     21<script type="text/javascript" src="/functions.js"></script> 
     22<style type="text/css"> 
     23#mailboxlist-container { width: <roundcube:exp expression="!empty(cookie:mailviewsplitterv) ? cookie:mailviewsplitterv-5 : 170" />px; } 
     24#messageframe { left: <roundcube:exp expression="!empty(cookie:mailviewsplitterv) ? cookie:mailviewsplitterv+5 : 180" />px; 
     25<roundcube:exp expression="browser:ie ? ('width: expression((parseInt(this.parentNode.offsetWidth)-'.(!empty(cookie:mailviewsplitterv) ? cookie:mailviewsplitterv+5 : 180).')+\\'px\\');') : ''" /> 
     26} 
     27</style> 
     28</head> 
     29 
     30<body onload="rcube_init_mail_ui()"> 
     31 
     32<roundcube:include file="/includes/taskbar.html" /> 
     33<roundcube:include file="/includes/header.html" /> 
     34 
     35<div id="messagetoolbar"> 
     36<roundcube:button command="list" type="link" class="button back" classAct="button back" classSel="button backSel" title="backtolist" content=" " /> 
     37<roundcube:button command="compose" type="link" class="button compose" classAct="button compose" classSel="button composeSel" title="writenewmessage" content=" " /> 
     38</div> 
     39 
     40<div id="mainscreen"> 
     41<div id="mailleftcontainer"> 
     42<div id="mailboxlist-container"> 
     43<div class="boxtitle"><roundcube:label name="mailboxlist" /></div> 
     44<roundcube:object name="mailboxlist" id="mailboxlist" maxlength="25" /> 
     45</div> 
     46</div> 
     47 
     48<div id="messageframe" style="background-color:#F2F2F2;"> 
     49<div style="margin:20px auto; text-align:center"> 
     50<img src="/images/watermark.gif" width="260" height="228" alt="" /> 
     51</div> 
     52</div> 
     53 
     54</div> 
     55 
     56<script type="text/javascript"> 
     57    var mailviewsplitv = new rcube_splitter({id:'mailviewsplitterv', p1: 'mailboxlist-container', p2: 'messageframe', orientation: 'v', relative: true, start: 165}); 
     58    rcmail.add_onload('mailviewsplitv.init()'); 
     59</script> 
     60 
     61</body> 
     62<roundcube:endif /> 
     63 
    1464</html> 
Note: See TracChangeset for help on using the changeset viewer.