Changeset 8235 for sandbox/2.5.1-evolucao/library/mime/mimeDecode.php
- Timestamp:
- 10/10/13 11:39:53 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.5.1-evolucao/library/mime/mimeDecode.php
r7673 r8235 63 63 * This package depends on PEAR to raise errors. 64 64 */ 65 //require_once 'PEAR.php';65 require_once 'PEAR.php'; 66 66 67 67 … … 89 89 * @link http://pear.php.net/package/Mail_mime 90 90 */ 91 class Mail_mimeDecode 91 class Mail_mimeDecode extends PEAR 92 92 { 93 93 /** … … 194 194 * @return object Decoded results 195 195 * @access public 196 */ 196 */ 197 197 function decode($params = null) 198 198 { … … 326 326 327 327 $parts = $this->_boundarySplit($body, $content_type['other']['boundary']); 328 $parts_count = count($parts); 329 for ($i = 0; $i < $parts_count; ++$i) { 328 for ($i = 0; $i < count($parts); $i++) { 330 329 list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]); 331 330 $part = $this->_decode($part_header, $part_body, $default_ctype); … … 337 336 338 337 case 'message/rfc822': 339 340 341 342 338 if ($this->_rfc822_bodies) { 339 $encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit'; 340 $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding) : $body); 341 } 343 342 $obj = new Mail_mimeDecode($body); 344 343 $return->parts[] = $obj->decode(array('include_bodies' => $this->_include_bodies, … … 348 347 break; 349 348 350 case 'message/delivery-status':351 if(!isset($content_transfer_encoding['value']))352 $content_transfer_encoding['value'] = '7bit';353 $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $content_transfer_encoding['value']) : $body) : null;354 break;355 356 349 default: 357 350 if(!isset($content_transfer_encoding['value'])) … … 387 380 $return[$prepend . $mime_number] = &$structure; 388 381 } 389 $structure_parts_count = count($structure->parts);390 for ($i = 0; $i < $structure_parts_count; ++$i) { 382 for ($i = 0; $i < count($structure->parts); $i++) { 383 391 384 392 385 if (!empty($structure->headers['content-type']) AND substr(strtolower($structure->headers['content-type']), 0, 8) == 'message/') { … … 522 515 $escaped = false; 523 516 if ($c == '\\') { 524 ++$i;517 $i++; 525 518 if ($i == $l-1) { // end of string. 526 519 break; … … 536 529 $val = ''; 537 530 $key = trim($key); 538 ++$i;531 $i++; 539 532 continue; 540 533 } … … 548 541 } 549 542 $key .= $c; 550 ++$i;543 $i++; 551 544 continue; 552 545 } … … 557 550 // not in quote yet. 558 551 if ((!strlen($val) || $lq !== false) && $c == ' ' || $c == "\t") { 559 ++$i;552 $i++; 560 553 continue; // skip leading spaces after '=' or after '"' 561 554 } … … 566 559 // but we will handle it as a merged part of the string.. 567 560 $val = !strlen(trim($val)) ? '' : trim($val); 568 ++$i;561 $i++; 569 562 continue; 570 563 } … … 594 587 $key = ''; 595 588 $lq = false; 596 ++$i;589 $i++; 597 590 continue; 598 591 } 599 592 600 593 $val .= $c; 601 ++$i;594 $i++; 602 595 continue; 603 596 } … … 609 602 $lq = $q; 610 603 $q = false; 611 ++$i;604 $i++; 612 605 continue; 613 606 } … … 615 608 // normal char inside of quoted string.. 616 609 $val.= $c; 617 ++$i;610 $i++; 618 611 } 619 612 … … 669 662 670 663 $len = count($tmp) -1; 671 for ($i = 1; $i < $len; ++$i) {664 for ($i = 1; $i < $len; $i++) { 672 665 if (strlen(trim($tmp[$i]))) { 673 666 $parts[] = $tmp[$i]; … … 789 782 function &uudecode($input) 790 783 { 791 792 784 // Find all uuencoded sections 793 785 preg_match_all("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", $input, $matches); 794 786 795 $matches_count = count($matches[3]); 796 for ($j = 0; $j < $matches_count; ++$j) { 787 for ($j = 0; $j < count($matches[3]); $j++) { 797 788 798 789 $str = $matches[3][$j]; … … 801 792 802 793 $file = ''; 803 $str = preg_split( '/\r?\n/', trim($str));794 $str = preg_split("/\r?\n/", trim($str)); 804 795 $strlen = count($str); 805 796 806 for ($i = 0; $i < $strlen; ++$i) {797 for ($i = 0; $i < $strlen; $i++) { 807 798 $pos = 1; 808 799 $d = 0; … … 945 936 // Multiple headers with this name 946 937 if (is_array($headers[$hdr_name])) { 947 $hdr_value_count = count($hdr_value); 948 for ($i = 0; $i < $hdr_value_count; ++$i) { 938 for ($i = 0; $i < count($hdr_value); $i++) { 949 939 $output .= Mail_mimeDecode::_getXML_helper($hdr_name, $hdr_value[$i], $indent); 950 940 } … … 957 947 958 948 if (!empty($input->parts)) { 959 $parts_count = count($input->parts); 960 for ($i = 0; $i < $parts_count; ++$i) { 949 for ($i = 0; $i < count($input->parts); $i++) { 961 950 $output .= $crlf . str_repeat($htab, $indent) . '<mimepart>' . $crlf . 962 951 Mail_mimeDecode::_getXML($input->parts[$i], $indent+1) .
Note: See TracChangeset
for help on using the changeset viewer.