Changeset 77799d8 in github


Ignore:
Timestamp:
Apr 27, 2012 3:24:24 AM (14 months ago)
Author:
alecpl <alec@…>
Branches:
release-0.7
Children:
9899abc
Parents:
cba69dd
Message:
  • Applied some fixes from trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    rf451a1c r77799d8  
    22=========================== 
    33 
     4- Fix redirect to mail/compose on re-login (#1488226) 
     5- Add IE8 hack for messages list issue (#1487821) 
     6- Fix handling errors on draft auto-save 
     7- Fix importing vCard photo with ENCODING param specified (#1488432) 
     8- Fix issue where draft auto-save wasn't executed after some inactivity time 
    49- Fix lack of warning when switching task in compose window (#1488399) 
    510- Fix bug where it wasn't possible to enter ( or & characters in autocomplete fields 
  • index.php

    r315993e r77799d8  
    120120      if ($query['_task'] == 'login') 
    121121        unset($query['_task']); 
     122 
     123      // prevent redirect to compose with specified ID (#1488226) 
     124      if ($query['_action'] == 'compose' && !empty($query['_id'])) 
     125        $query = array(); 
    122126    } 
    123127 
  • program/include/rcube_vcard.php

    r4c4fe69 r77799d8  
    293293        if (strpos($value, 'http:') === 0) { 
    294294            // TODO: fetch file from URL and save it locally? 
    295             $this->raw['PHOTO'][0] = array(0 => $value, 'URL' => true); 
     295            $this->raw['PHOTO'][0] = array(0 => $value, 'url' => true); 
    296296        } 
    297297        else { 
    298             $encoded = !preg_match('![^a-z0-9/=+-]!i', $value); 
    299             $this->raw['PHOTO'][0] = array(0 => $encoded ? $value : base64_encode($value), 'BASE64' => true); 
     298            $this->raw['PHOTO'][0] = array(0 => $value, 'base64' => (bool) preg_match('![^a-z0-9/=+-]!i', $value)); 
    300299        } 
    301300        break; 
     
    550549        $entry = array(); 
    551550        $field = strtoupper($regs2[1][0]); 
     551        $enc   = null; 
    552552 
    553553        foreach($regs2[1] as $attrid => $attr) { 
     
    556556            if ($key == 'ENCODING') { 
    557557              // add next line(s) to value string if QP line end detected 
    558               while ($value == 'QUOTED-PRINTABLE' && preg_match('/=$/', $lines[$i])) 
     558              if ($value == 'QUOTED-PRINTABLE') { 
     559                while (preg_match('/=$/', $lines[$i])) 
    559560                  $line[2] .= "\n" . $lines[++$i]; 
    560  
    561               $line[2] = self::decode_value($line[2], $value); 
     561              } 
     562              $enc = $value; 
    562563            } 
    563             else 
    564               $entry[strtolower($key)] = array_merge((array)$entry[strtolower($key)], (array)self::vcard_unquote($value, ',')); 
     564            else { 
     565              $lc_key = strtolower($key); 
     566              $entry[$lc_key] = array_merge((array)$entry[$lc_key], (array)self::vcard_unquote($value, ',')); 
     567            } 
    565568          } 
    566569          else if ($attrid > 0) { 
    567             $entry[$key] = true;  // true means attr without =value 
     570            $entry[strtolower($key)] = true;  // true means attr without =value 
    568571          } 
    569572        } 
    570573 
    571         $entry = array_merge($entry, (array)self::vcard_unquote($line[2])); 
     574        // decode value 
     575        if ($enc || !empty($entry['base64'])) { 
     576          // save encoding type (#1488432) 
     577          if ($enc == 'B') { 
     578            $entry['encoding'] = 'B'; 
     579            // should we use vCard 3.0 instead? 
     580            // $entry['base64'] = true; 
     581          } 
     582          $line[2] = self::decode_value($line[2], $enc ? $enc : 'base64'); 
     583        } 
     584 
     585        if ($enc != 'B' && empty($entry['base64'])) { 
     586          $line[2] = self::vcard_unquote($line[2]); 
     587        } 
     588 
     589        $entry = array_merge($entry, (array) $line[2]); 
    572590        $data[$field][] = $entry; 
    573591      } 
     
    594612 
    595613      case 'base64': 
     614      case 'b': 
    596615        self::$values_decoded = true; 
    597616        return base64_decode($value); 
     
    625644          $value = array(); 
    626645          foreach($entry as $attrname => $attrvalues) { 
    627             if (is_int($attrname)) 
     646            if (is_int($attrname)) { 
     647              if (!empty($entry['base64']) || $entry['encoding'] == 'B') { 
     648                $attrvalues = base64_encode($attrvalues); 
     649              } 
    628650              $value[] = $attrvalues; 
    629             elseif ($attrvalues === true) 
    630               $attr .= ";$attrname";    // true means just tag, not tag=value, as in PHOTO;BASE64:... 
     651            } 
     652            else if (is_bool($attrvalues)) { 
     653              if ($attrvalues) { 
     654                $attr .= strtoupper(";$attrname");    // true means just tag, not tag=value, as in PHOTO;BASE64:... 
     655              } 
     656            } 
    631657            else { 
    632658              foreach((array)$attrvalues as $attrvalue) 
    633                 $attr .= ";$attrname=" . self::vcard_quote($attrvalue, ','); 
     659                $attr .= strtoupper(";$attrname=") . self::vcard_quote($attrvalue, ','); 
    634660            } 
    635661          } 
  • program/js/app.js

    rf451a1c r77799d8  
    270270        else if (this.env.action == 'print' && this.env.uid) 
    271271          if (bw.safari) 
    272             window.setTimeout('window.print()', 10); 
     272            setTimeout('window.print()', 10); 
    273273          else 
    274274            window.print(); 
     
    747747        if (this.env.uid && this.env.sender) { 
    748748          this.add_contact(urlencode(this.env.sender)); 
    749           window.setTimeout(function(){ ref.command('load-images'); }, 300); 
     749          setTimeout(function(){ ref.command('load-images'); }, 300); 
    750750          break; 
    751751        } 
     
    765765          this.attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment'); 
    766766          if (this.attachment_win) { 
    767             window.setTimeout(function(){ ref.attachment_win.focus(); }, 10); 
     767            setTimeout(function(){ ref.attachment_win.focus(); }, 10); 
    768768            break; 
    769769          } 
     
    880880 
    881881      case 'savedraft': 
     882        var form = this.gui_objects.messageform, msgid; 
     883 
    882884        // Reset the auto-save timer 
    883         self.clearTimeout(this.save_timer); 
    884  
    885         if (!this.gui_objects.messageform) 
     885        clearTimeout(this.save_timer); 
     886 
     887        // saving Drafts is disabled 
     888        if (!form) 
    886889          break; 
    887890 
    888         // if saving Drafts is disabled in main.inc.php 
    889         // or if compose form did not change 
    890         if (!this.env.drafts_mailbox || this.cmp_hash == this.compose_field_hash()) 
     891        // compose form did not change 
     892        if (this.cmp_hash == this.compose_field_hash()) { 
     893          this.auto_save_start(); 
    891894          break; 
    892  
    893         var form = this.gui_objects.messageform, 
    894           msgid = this.set_busy(true, 'savingmessage'); 
     895        } 
     896 
     897        // re-set keep-alive timeout 
     898        this.start_keepalive(); 
     899 
     900        msgid = this.set_busy(true, 'savingmessage'); 
    895901 
    896902        form.target = "savetarget"; 
     
    908914 
    909915        // Reset the auto-save timer 
    910         self.clearTimeout(this.save_timer); 
     916        clearTimeout(this.save_timer); 
    911917 
    912918        // all checks passed, send message 
     
    927933      case 'send-attachment': 
    928934        // Reset the auto-save timer 
    929         self.clearTimeout(this.save_timer); 
     935        clearTimeout(this.save_timer); 
    930936 
    931937        this.upload_file(props) 
     
    965971          ref.printwin = window.open(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : '')); 
    966972          if (this.printwin) { 
    967             window.setTimeout(function(){ ref.printwin.focus(); }, 20); 
     973            setTimeout(function(){ ref.printwin.focus(); }, 20); 
    968974            if (this.env.action != 'show') 
    969975              this.mark_message('read', uid); 
     
    976982          ref.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)); 
    977983          if (this.sourcewin) 
    978             window.setTimeout(function(){ ref.sourcewin.focus(); }, 20); 
     984            setTimeout(function(){ ref.sourcewin.focus(); }, 20); 
    979985          } 
    980986        break; 
     
    11211127    // set timer for requests 
    11221128    if (a && this.env.request_timeout) 
    1123       this.request_timer = window.setTimeout(function(){ ref.request_timed_out(); }, this.env.request_timeout * 1000); 
     1129      this.request_timer = setTimeout(function(){ ref.request_timed_out(); }, this.env.request_timeout * 1000); 
    11241130 
    11251131    return id; 
     
    11731179      parent.rcmail.reload(delay); 
    11741180    else if (delay) 
    1175       window.setTimeout(function(){ rcmail.reload(); }, delay); 
     1181      setTimeout(function(){ rcmail.reload(); }, delay); 
    11761182    else if (window.location) 
    11771183      location.href = this.env.comm_path + (this.env.action ? '&_action='+this.env.action : ''); 
     
    13061312 
    13071313    if (this.folder_auto_timer) { 
    1308       window.clearTimeout(this.folder_auto_timer); 
     1314      clearTimeout(this.folder_auto_timer); 
    13091315      this.folder_auto_timer = null; 
    13101316      this.folder_auto_expand = null; 
     
    13591365            if (div.hasClass('collapsed')) { 
    13601366              if (this.folder_auto_timer) 
    1361                 window.clearTimeout(this.folder_auto_timer); 
     1367                clearTimeout(this.folder_auto_timer); 
    13621368 
    13631369              this.folder_auto_expand = this.env.mailboxes[k].id; 
    1364               this.folder_auto_timer = window.setTimeout(function() { 
     1370              this.folder_auto_timer = setTimeout(function() { 
    13651371                rcmail.command('collapse-folder', rcmail.folder_auto_expand); 
    13661372                rcmail.drag_start(null); 
    13671373              }, 1000); 
    13681374            } else if (this.folder_auto_timer) { 
    1369               window.clearTimeout(this.folder_auto_timer); 
     1375              clearTimeout(this.folder_auto_timer); 
    13701376              this.folder_auto_timer = null; 
    13711377              this.folder_auto_expand = null; 
     
    15191525    // start timer for message preview (wait for double click) 
    15201526    if (selected && this.env.contentframe && !list.multi_selecting && !this.dummy_select) 
    1521       this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, 200); 
     1527      this.preview_timer = setTimeout(function(){ ref.msglist_get_preview(); }, 200); 
    15221528    else if (this.env.contentframe) 
    15231529      this.show_contentframe(false); 
     
    15361542        if (this.preview_read_timer) 
    15371543          clearTimeout(this.preview_read_timer); 
    1538         this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, 200); 
     1544        this.preview_timer = setTimeout(function(){ ref.msglist_get_preview(); }, 200); 
    15391545      } 
    15401546    } 
     
    18051811        html = expando; 
    18061812      else if (c == 'subject') { 
    1807         if (bw.ie) 
     1813        if (bw.ie) { 
    18081814          col.onmouseover = function() { rcube_webmail.long_subject_title_ie(this, message.depth+1); }; 
     1815          if (bw.ie8) 
     1816            tree = '<span></span>' + tree; // #1487821 
     1817        } 
    18091818        html = tree + cols[c]; 
    18101819      } 
     
    19171926      // mark as read and change mbox unread counter 
    19181927      if (action == 'preview' && this.message_list && this.message_list.rows[id] && this.message_list.rows[id].unread && this.env.preview_pane_mark_read >= 0) { 
    1919         this.preview_read_timer = window.setTimeout(function() { 
     1928        this.preview_read_timer = setTimeout(function() { 
    19201929          ref.set_message(id, 'unread', false); 
    19211930          ref.update_thread_root(id, 'read'); 
     
    31323141  { 
    31333142    if (this.env.draft_autosave) 
    3134       this.save_timer = self.setTimeout(function(){ ref.command("savedraft"); }, this.env.draft_autosave * 1000); 
     3143      this.save_timer = setTimeout(function(){ ref.command("savedraft"); }, this.env.draft_autosave * 1000); 
    31353144 
    31363145    // Unlock interface now that saving is complete 
     
    34163425  this.upload_progress_start = function(action, name) 
    34173426  { 
    3418     window.setTimeout(function() { rcmail.http_request(action, {_progress: name}); }, 
     3427    setTimeout(function() { rcmail.http_request(action, {_progress: name}); }, 
    34193428      this.env.upload_progress_time * 1000); 
    34203429  }; 
     
    35163525    this.display_message(msg, type); 
    35173526    // before redirect we need to wait some time for Chrome (#1486177) 
    3518     window.setTimeout(function(){ ref.list_mailbox(); }, 500); 
     3527    setTimeout(function(){ ref.list_mailbox(); }, 500); 
    35193528  }; 
    35203529 
     
    35743583      case 39:  // right 
    35753584        if (mod != SHIFT_KEY) 
    3576               return; 
     3585          return; 
    35773586    } 
    35783587 
    35793588    // start timer 
    3580     this.ksearch_timer = window.setTimeout(function(){ ref.ksearch_get_results(props); }, 200); 
     3589    this.ksearch_timer = setTimeout(function(){ ref.ksearch_get_results(props); }, 200); 
    35813590    this.ksearch_input = obj; 
    35823591 
     
    38863895 
    38873896    if (id = list.get_single_selection()) 
    3888       this.preview_timer = window.setTimeout(function(){ ref.load_contact(id, 'show'); }, 200); 
     3897      this.preview_timer = setTimeout(function(){ ref.load_contact(id, 'show'); }, 200); 
    38893898    else if (this.env.contentframe) 
    38903899      this.show_contentframe(false); 
     
    53755384      // add element and set timeout 
    53765385      this.messages[key].elements.push(id); 
    5377       window.setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout); 
     5386      setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout); 
    53785387      return id; 
    53795388    } 
     
    53935402 
    53945403    if (timeout > 0) 
    5395       window.setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout); 
     5404      setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout); 
    53965405    return id; 
    53975406  }; 
  • program/steps/mail/sendmail.inc

    r4ffa559 r77799d8  
    689689      $mailbody_file = null; 
    690690    } 
    691  
    692     // raise error if saving failed 
    693     if (!$saved) { 
    694       raise_error(array('code' => 800, 'type' => 'imap', 
    695             'file' => __FILE__, 'line' => __LINE__, 
    696             'message' => "Could not save message in $store_target"), TRUE, FALSE); 
    697  
    698       if ($savedraft) { 
    699         $OUTPUT->show_message('errorsaving', 'error'); 
    700         $OUTPUT->send('iframe'); 
    701       } 
     691  } 
     692 
     693  // raise error if saving failed 
     694  if (!$saved) { 
     695    raise_error(array('code' => 800, 'type' => 'imap', 
     696       'file' => __FILE__, 'line' => __LINE__, 
     697       'message' => "Could not save message in $store_target"), TRUE, FALSE); 
     698 
     699    if ($savedraft) { 
     700      $OUTPUT->show_message('errorsaving', 'error'); 
     701      // start the auto-save timer again 
     702      $OUTPUT->command('auto_save_start'); 
     703      $OUTPUT->send('iframe'); 
    702704    } 
    703705  } 
  • tests/vcards.php

    r0fbadeb r77799d8  
    4545     
    4646    $vcards = rcube_vcard::import($input); 
    47      
     47 
    4848    $this->assertEqual(2, count($vcards), "Detected 2 vcards"); 
    4949    $this->assertEqual("Apple Computer AG", $vcards[0]->displayname, "FN => displayname"); 
Note: See TracChangeset for help on using the changeset viewer.