Ignore:
Timestamp:
10/10/13 11:39:53 (11 years ago)
Author:
angelo
Message:

Ticket #3491 - Compatibilizar Expresso com novas versoes do PHP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.5.1-evolucao/library/mime/mimeDecode.php

    r7673 r8235  
    6363 * This package depends on PEAR to raise errors. 
    6464 */ 
    65 //require_once 'PEAR.php'; 
     65require_once 'PEAR.php'; 
    6666 
    6767 
     
    8989 * @link       http://pear.php.net/package/Mail_mime 
    9090 */ 
    91 class Mail_mimeDecode  
     91class Mail_mimeDecode extends PEAR 
    9292{ 
    9393    /** 
     
    194194     * @return object Decoded results 
    195195     * @access public 
    196      */  
     196     */ 
    197197    function decode($params = null) 
    198198    { 
     
    326326 
    327327                    $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++) { 
    330329                        list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]); 
    331330                        $part = $this->_decode($part_header, $part_body, $default_ctype); 
     
    337336 
    338337                case 'message/rfc822': 
    339                     if ($this->_rfc822_bodies) { 
    340                             $encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit'; 
    341                             $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding) : $body); 
    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                                        } 
    343342                    $obj = new Mail_mimeDecode($body); 
    344343                    $return->parts[] = $obj->decode(array('include_bodies' => $this->_include_bodies, 
     
    348347                    break; 
    349348 
    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                       
    356349                default: 
    357350                    if(!isset($content_transfer_encoding['value'])) 
     
    387380                $return[$prepend . $mime_number] = &$structure; 
    388381            } 
    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 
    391384             
    392385                if (!empty($structure->headers['content-type']) AND substr(strtolower($structure->headers['content-type']), 0, 8) == 'message/') { 
     
    522515            $escaped = false; 
    523516            if ($c == '\\') { 
    524                 ++$i; 
     517                $i++; 
    525518                if ($i == $l-1) { // end of string. 
    526519                    break; 
     
    536529                    $val = ''; 
    537530                    $key = trim($key); 
    538                     ++$i; 
     531                    $i++; 
    539532                    continue; 
    540533                } 
     
    548541                } 
    549542                $key .= $c; 
    550                 ++$i; 
     543                $i++; 
    551544                continue; 
    552545            } 
     
    557550                // not in quote yet. 
    558551                if ((!strlen($val) || $lq !== false) && $c == ' ' ||  $c == "\t") { 
    559                     ++$i; 
     552                    $i++; 
    560553                    continue; // skip leading spaces after '=' or after '"' 
    561554                } 
     
    566559                    // but we will handle it as a merged part of the string.. 
    567560                    $val = !strlen(trim($val)) ? '' : trim($val); 
    568                     ++$i; 
     561                    $i++; 
    569562                    continue; 
    570563                } 
     
    594587                    $key = ''; 
    595588                    $lq = false; 
    596                     ++$i; 
     589                    $i++; 
    597590                    continue; 
    598591                } 
    599592 
    600593                $val .= $c; 
    601                 ++$i; 
     594                $i++; 
    602595                continue; 
    603596            } 
     
    609602                $lq = $q; 
    610603                $q = false; 
    611                 ++$i; 
     604                $i++; 
    612605                continue; 
    613606            } 
     
    615608            // normal char inside of quoted string.. 
    616609            $val.= $c; 
    617             ++$i; 
     610            $i++; 
    618611        } 
    619612         
     
    669662 
    670663        $len = count($tmp) -1; 
    671         for ($i = 1; $i < $len; ++$i) { 
     664        for ($i = 1; $i < $len; $i++) { 
    672665            if (strlen(trim($tmp[$i]))) { 
    673666                $parts[] = $tmp[$i]; 
     
    789782    function &uudecode($input) 
    790783    { 
    791  
    792784        // Find all uuencoded sections 
    793785        preg_match_all("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", $input, $matches); 
    794786 
    795         $matches_count = count($matches[3]); 
    796         for ($j = 0; $j < $matches_count; ++$j) { 
     787        for ($j = 0; $j < count($matches[3]); $j++) { 
    797788 
    798789            $str      = $matches[3][$j]; 
     
    801792 
    802793            $file = ''; 
    803             $str = preg_split('/\r?\n/', trim($str)); 
     794            $str = preg_split("/\r?\n/", trim($str)); 
    804795            $strlen = count($str); 
    805796 
    806             for ($i = 0; $i < $strlen; ++$i) { 
     797            for ($i = 0; $i < $strlen; $i++) { 
    807798                $pos = 1; 
    808799                $d = 0; 
     
    945936            // Multiple headers with this name 
    946937            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++) { 
    949939                    $output .= Mail_mimeDecode::_getXML_helper($hdr_name, $hdr_value[$i], $indent); 
    950940                } 
     
    957947 
    958948        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++) { 
    961950                $output .= $crlf . str_repeat($htab, $indent) . '<mimepart>' . $crlf . 
    962951                           Mail_mimeDecode::_getXML($input->parts[$i], $indent+1) . 
Note: See TracChangeset for help on using the changeset viewer.