Changeset 5366 in subversion
- Timestamp:
- Oct 26, 2011 7:48:27 AM (19 months ago)
- Location:
- branches/release-0.7/program
- Files:
-
- 5 edited
-
include/rcube_imap.php (modified) (7 diffs)
-
include/rcube_imap_cache.php (modified) (1 diff)
-
include/rcube_imap_generic.php (modified) (3 diffs)
-
steps/mail/func.inc (modified) (2 diffs)
-
steps/settings/func.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-0.7/program/include/rcube_imap.php
r5347 r5366 1509 1509 if (is_array($a_index)) 1510 1510 sort($a_index); 1511 } else if ($max = $this->_messagecount($mailbox )) {1511 } else if ($max = $this->_messagecount($mailbox, 'ALL', true, false)) { 1512 1512 $a_index = range(1, $max); 1513 1513 } … … 1695 1695 1696 1696 if ($orig_criteria == 'ALL') { 1697 $max = $this->_messagecount($mailbox );1697 $max = $this->_messagecount($mailbox, 'ALL', true, false); 1698 1698 $a_messages = $max ? range(1, $max) : array(); 1699 1699 } … … 1962 1962 1963 1963 $headers = $this->get_headers($uid, $mailbox); 1964 1965 // message doesn't exist? 1966 if (empty($headers)) 1967 return null; 1964 1968 1965 1969 // structure might be cached … … 2321 2325 // decode filename 2322 2326 if (!empty($filename_mime)) { 2323 $part->filename = rcube_imap::decode_mime_string($filename_mime, 2324 $part->charset ? $part->charset : ($this->struct_charset ? $this->struct_charset : 2325 rc_detect_encoding($filename_mime, $this->default_charset))); 2327 if (!empty($part->charset)) 2328 $charset = $part->charset; 2329 else if (!empty($this->struct_charset)) 2330 $charset = $this->struct_charset; 2331 else 2332 $charset = rc_detect_encoding($filename_mime, $this->default_charset); 2333 2334 $part->filename = rcube_imap::decode_mime_string($filename_mime, $charset); 2326 2335 } 2327 2336 else if (!empty($filename_encoded)) { … … 2331 2340 $filename_encoded = $fmatches[2]; 2332 2341 } 2342 2333 2343 $part->filename = rcube_charset_convert(urldecode($filename_encoded), $filename_charset); 2334 2344 } … … 2367 2377 function &get_message_part($uid, $part=1, $o_part=NULL, $print=NULL, $fp=NULL, $skip_charset_conv=false) 2368 2378 { 2369 // get part encodingif not provided2379 // get part data if not provided 2370 2380 if (!is_object($o_part)) { 2371 2381 $structure = $this->conn->getStructure($this->mailbox, $uid, true); 2382 $part_data = rcube_imap_generic::getStructurePartData($structure, $part); 2372 2383 2373 2384 $o_part = new rcube_message_part; 2374 $o_part->ctype_primary = strtolower(rcube_imap_generic::getStructurePartType($structure, $part)); 2375 $o_part->encoding = strtolower(rcube_imap_generic::getStructurePartEncoding($structure, $part)); 2376 $o_part->charset = rcube_imap_generic::getStructurePartCharset($structure, $part); 2377 } 2378 2379 // TODO: Add caching for message parts 2380 2381 if (!$part) { 2382 $part = 'TEXT'; 2383 } 2384 2385 $body = $this->conn->handlePartBody($this->mailbox, $uid, true, $part, 2386 $o_part->encoding, $print, $fp); 2385 $o_part->ctype_primary = $part_data['type']; 2386 $o_part->encoding = $part_data['encoding']; 2387 $o_part->charset = $part_data['charset']; 2388 $o_part->size = $part_data['size']; 2389 } 2390 2391 if ($o_part && $o_part->size) { 2392 $body = $this->conn->handlePartBody($this->mailbox, $uid, true, 2393 $part ? $part : 'TEXT', $o_part->encoding, $print, $fp); 2394 } 2387 2395 2388 2396 if ($fp || $print) { … … 2398 2406 if (!$o_part->charset || strtoupper($o_part->charset) == 'US-ASCII') { 2399 2407 // try to extract charset information from HTML meta tag (#1488125) 2400 if ($o_part->ctype_secondary == 'html' && preg_match('/<meta[^>]+charset=([a-z0-9- ]+)/i', $body, $m))2408 if ($o_part->ctype_secondary == 'html' && preg_match('/<meta[^>]+charset=([a-z0-9-_]+)/i', $body, $m)) 2401 2409 $o_part->charset = strtoupper($m[1]); 2402 2410 else -
branches/release-0.7/program/include/rcube_imap_cache.php
r5286 r5366 854 854 if ($is_thread) { 855 855 // check messages number... 856 if ( $mbox_data['EXISTS'] != @max(array_keys($index['depth']))) {856 if (!$this->skip_deleted && $mbox_data['EXISTS'] != @max(array_keys($index['depth']))) { 857 857 return false; 858 858 } -
branches/release-0.7/program/include/rcube_imap_generic.php
r5330 r5366 2394 2394 $result = false; 2395 2395 2396 if ($a[2] != 'FETCH') { 2397 } 2396 2398 // handle empty "* X FETCH ()" response 2397 if ($line[$len-1] == ')' && $line[$len-2] != '(') {2399 else if ($line[$len-1] == ')' && $line[$len-2] != '(') { 2398 2400 // one line response, get everything between first and last quotes 2399 2401 if (substr($line, -4, 3) == 'NIL') { … … 3175 3177 } 3176 3178 3177 static function getStructurePartType($structure, $part) 3179 /** 3180 * Returns data of a message part according to specified structure. 3181 * 3182 * @param array $structure Message structure (getStructure() result) 3183 * @param string $part Message part identifier 3184 * 3185 * @return array Part data as hash array (type, encoding, charset, size) 3186 */ 3187 static function getStructurePartData($structure, $part) 3178 3188 { 3179 3189 $part_a = self::getStructurePartArray($structure, $part); 3180 if (!empty($part_a)) { 3181 if (is_array($part_a[0])) 3182 return 'multipart'; 3183 else if ($part_a[0]) 3184 return $part_a[0]; 3185 } 3186 3187 return 'other'; 3188 } 3189 3190 static function getStructurePartEncoding($structure, $part) 3191 { 3192 $part_a = self::getStructurePartArray($structure, $part); 3193 if ($part_a) { 3194 if (!is_array($part_a[0])) 3195 return $part_a[5]; 3196 } 3197 3198 return ''; 3199 } 3200 3201 static function getStructurePartCharset($structure, $part) 3202 { 3203 $part_a = self::getStructurePartArray($structure, $part); 3204 if ($part_a) { 3205 if (is_array($part_a[0])) 3206 return ''; 3207 else { 3208 if (is_array($part_a[2])) { 3209 $name = ''; 3210 while (list($key, $val) = each($part_a[2])) 3211 if (strcasecmp($val, 'charset') == 0) 3212 return $part_a[2][$key+1]; 3213 } 3214 } 3215 } 3216 3217 return ''; 3190 $data = array(); 3191 3192 if (empty($part_a)) { 3193 return $data; 3194 } 3195 3196 // content-type 3197 if (is_array($part_a[0])) { 3198 $data['type'] = 'multipart'; 3199 } 3200 else { 3201 $data['type'] = strtolower($part_a[0]); 3202 3203 // encoding 3204 $data['encoding'] = strtolower($part_a[5]); 3205 3206 // charset 3207 if (is_array($part_a[2])) { 3208 while (list($key, $val) = each($part_a[2])) { 3209 if (strcasecmp($val, 'charset') == 0) { 3210 $data['charset'] = $part_a[2][$key+1]; 3211 break; 3212 } 3213 } 3214 } 3215 } 3216 3217 // size 3218 $data['size'] = intval($part_a[6]); 3219 3220 return $data; 3218 3221 } 3219 3222 … … 3248 3251 } 3249 3252 3250 3251 3253 /** 3252 3254 * Creates next command identifier (tag) -
branches/release-0.7/program/steps/mail/func.inc
r5266 r5366 560 560 $html_search = array( 561 561 '/(<\/nobr>)(\s+)(<nobr>)/i', // space(s) between <NOBR> 562 '/<title[^>]*> .*<\/title>/i', // PHP bug #32547 workaround: remove title tag562 '/<title[^>]*>[^<]*<\/title>/i', // PHP bug #32547 workaround: remove title tag 563 563 '/^(\0\0\xFE\xFF|\xFF\xFE\0\0|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/', // byte-order mark (only outlook?) 564 564 '/<html\s[^>]+>/i', // washtml/DOMDocument cannot handle xml namespaces … … 591 591 592 592 // charset was converted to UTF-8 in rcube_imap::get_message_part(), 593 // -> change charset specification in HTML accordingly594 $charset_pattern = '(<meta\s+[^>]*content=)[\'"]?(\w+\/\w+;\s*charset=)([a-z0-9-_]+[\'"]?)';595 if (preg_match("/$charset_pattern/Ui", $html)) {596 $html = preg_replace("/$charset_pattern/i", '\\1"\\2'.RCMAIL_CHARSET.'"', $html); 597 }598 else {599 // add meta content-type to malformed messages, washtml cannot work without that600 if (!preg_match('/<head[^>]*>(.*)<\/head>/Uims', $html))601 $html = '<head></head>'. $html;602 $html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '<head>')+6), 0);593 // change/add charset specification in HTML accordingly, 594 // washtml cannot work without that 595 $meta = '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />'; 596 597 // remove old meta tag and add the new one, making sure 598 // that it is placed in the head (#1488093) 599 $html = preg_replace('/<meta[^>]+charset=[a-z0-9-_]+[^>]*>/Ui', '', $html); 600 $html = preg_replace('/(<head[^>]*>)/Ui', '\\1'.$meta, $html, -1, $rcount); 601 if (!$rcount) { 602 $html = '<head>' . $meta . '</head>' . $html; 603 603 } 604 604 -
branches/release-0.7/program/steps/settings/func.inc
r5297 r5366 179 179 if (!isset($no_override['timezone'])) { 180 180 $field_id = 'rcmfd_timezone'; 181 $select_timezone = new html_select(array('name' => '_timezone', 'id' => $field_id, 'onchange' => " document.getElementById('rcmfd_dst').disabled=this.selectedIndex==0"));181 $select_timezone = new html_select(array('name' => '_timezone', 'id' => $field_id, 'onchange' => "$('#rcmfd_dst').attr('disabled', this.selectedIndex==0)")); 182 182 $select_timezone->add(rcube_label('autodetect'), 'auto'); 183 183 $select_timezone->add('(GMT -11:00) Midway Island, Samoa', '-11');
Note: See TracChangeset
for help on using the changeset viewer.
