Changeset 3e5c709 in github


Ignore:
Timestamp:
Nov 26, 2011 8:10:27 AM (18 months ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.8
Children:
0829b76
Parents:
6a61686
Message:
  • Fix so TEXT key will remove all HEADER keys in IMAP SEARCH (#1488208)
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r6a61686 r3e5c709  
    22=========================== 
    33 
     4- Fix so TEXT key will remove all HEADER keys in IMAP SEARCH (#1488208) 
    45- Fix handling contact photo url with https:// prefix (#1488202) 
    56- Prevent from memory_limit exceeding when trying to parse big messages bodies (#1487424) 
  • program/steps/mail/search.inc

    rb1f0846 r3e5c709  
    3232$filter  = get_input_value('_filter', RCUBE_INPUT_GET); 
    3333$headers = get_input_value('_headers', RCUBE_INPUT_GET); 
     34$subject = array(); 
    3435 
    3536$search_request = md5($mbox.$filter.$str); 
     
    7172  $subject['text'] = "TEXT"; 
    7273} 
    73 else if(trim($str)) 
     74else if (strlen(trim($str))) 
    7475{ 
    7576  if ($headers) { 
    76     foreach(explode(',', $headers) as $header) 
    77       switch ($header) { 
    78         case 'text': $subject['text'] = 'TEXT'; break; 
    79         default:     $subject[$header] = 'HEADER '.strtoupper($header); 
     77    foreach (explode(',', $headers) as $header) { 
     78      if ($header == 'text') { 
     79        // #1488208: get rid of other headers when searching by "TEXT" 
     80        $subject = array('text' => 'TEXT'); 
     81        break; 
    8082      } 
     83      else { 
     84        $subject[$header] = 'HEADER '.strtoupper($header); 
     85      } 
     86    } 
    8187 
    8288    // save search modifiers for the current folder to user prefs 
     
    9096} 
    9197 
    92 $search = $srch ? trim($srch) : trim($str); 
     98$search = isset($srch) ? trim($srch) : trim($str); 
    9399 
    94 if ($subject) { 
     100if (!empty($subject)) { 
    95101  $search_str .= str_repeat(' OR', count($subject)-1); 
    96102  foreach ($subject as $sub) 
  • skins/default/functions.js

    r4b09fb6 r3e5c709  
    193193  if (show && ref) { 
    194194    var pos = $(ref).offset(); 
    195     obj.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)}) 
    196         .find(':checked').prop('checked', false); 
     195    obj.css({left:pos.left, top:(pos.top + ref.offsetHeight + 2)}); 
    197196 
    198197    if (rcmail.env.search_mods) { 
    199       var n, mbox = rcmail.env.mailbox, mods = rcmail.env.search_mods; 
    200  
    201       if (rcmail.env.task != 'addressbook') { 
     198      var n, all, 
     199        list = $('input:checkbox[name="s_mods[]"]', obj), 
     200        mbox = rcmail.env.mailbox, 
     201        mods = rcmail.env.search_mods; 
     202 
     203      if (rcmail.env.task == 'mail') { 
    202204        mods = mods[mbox] ? mods[mbox] : mods['*']; 
    203  
     205        all = 'text'; 
     206      } 
     207      else { 
     208        all = '*'; 
     209      } 
     210 
     211      if (mods[all]) 
     212        list.map(function() { 
     213          this.checked = true; 
     214          this.disabled = this.value != all; 
     215        }); 
     216      else { 
     217        list.prop('disabled', false).prop('checked', false); 
    204218        for (n in mods) 
    205219          $('#s_mod_' + n).prop('checked', true); 
    206220      } 
    207       else { 
    208         if (mods['*']) 
    209           $('input:checkbox[name="s_mods[]"]').map(function() { 
    210             this.checked = true; 
    211             this.disabled = this.value != '*'; 
    212           }); 
    213         else { 
    214           for (n in mods) 
    215             $('#s_mod_' + n).prop('checked', true); 
    216         } 
    217       } 
    218221    } 
    219222  } 
     
    223226set_searchmod: function(elem) 
    224227{ 
    225   var task = rcmail.env.task, 
     228  var all, m, task = rcmail.env.task, 
    226229    mods = rcmail.env.search_mods, 
    227230    mbox = rcmail.env.mailbox; 
     
    233236    if (!mods[mbox]) 
    234237      mods[mbox] = rcube_clone_object(mods['*']); 
    235     if (!elem.checked) 
    236       delete(mods[mbox][elem.value]); 
    237     else 
    238       mods[mbox][elem.value] = 1; 
     238    m = mods[mbox]; 
     239    all = 'text'; 
    239240  } 
    240241  else { //addressbook 
    241     if (!elem.checked) 
    242       delete(mods[elem.value]); 
    243     else 
    244       mods[elem.value] = 1; 
    245  
    246     // mark all fields 
    247     if (elem.value == '*') { 
    248       $('input:checkbox[name="s_mods[]"]').map(function() { 
    249         if (this == elem) 
    250           return; 
    251  
    252         if (elem.checked) { 
    253           mods[this.value] = 1; 
    254           this.checked = true; 
    255           this.disabled = true; 
    256         } 
    257         else { 
    258           this.disabled = false; 
    259         } 
    260       }); 
    261     } 
    262   } 
    263  
    264   rcmail.env.search_mods = mods; 
     242    m = mods; 
     243    all = '*'; 
     244  } 
     245 
     246  if (!elem.checked) 
     247    delete(m[elem.value]); 
     248  else 
     249    m[elem.value] = 1; 
     250 
     251  // mark all fields 
     252  if (elem.value != all) 
     253    return; 
     254 
     255  $('input:checkbox[name="s_mods[]"]').map(function() { 
     256    if (this == elem) 
     257      return; 
     258 
     259    this.checked = true; 
     260    if (elem.checked) { 
     261      this.disabled = true; 
     262      delete m[this.value]; 
     263    } 
     264    else { 
     265      this.disabled = false; 
     266      m[this.value] = 1; 
     267    } 
     268  }); 
    265269}, 
    266270 
Note: See TracChangeset for help on using the changeset viewer.