Changeset a1fc8d2 in github for program/include/rcube_imap.php


Ignore:
Timestamp:
May 28, 2009 2:19:45 AM (4 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
36e5264
Parents:
7328469
Message:
  • removed unused and declared in PHP-5.3 quoted_printable_encode function (#1485879)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_imap.php

    r8234b4c ra1fc8d2  
    30763076   } 
    30773077} 
    3078  
    3079  
    3080 /** 
    3081  * Add quoted-printable encoding to a given string 
    3082  *  
    3083  * @param string   String to encode 
    3084  * @param int      Add new line after this number of characters 
    3085  * @param boolean  True if spaces should be converted into =20 
    3086  * @return string Encoded string 
    3087  */ 
    3088 function quoted_printable_encode($input, $line_max=76, $space_conv=false) 
    3089   { 
    3090   $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); 
    3091   $lines = preg_split("/(?:\r\n|\r|\n)/", $input); 
    3092   $eol = "\r\n"; 
    3093   $escape = "="; 
    3094   $output = ""; 
    3095  
    3096   while( list(, $line) = each($lines)) 
    3097     { 
    3098     //$line = rtrim($line); // remove trailing white space -> no =20\r\n necessary 
    3099     $linlen = strlen($line); 
    3100     $newline = ""; 
    3101     for($i = 0; $i < $linlen; $i++) 
    3102       { 
    3103       $c = substr( $line, $i, 1 ); 
    3104       $dec = ord( $c ); 
    3105       if ( ( $i == 0 ) && ( $dec == 46 ) ) // convert first point in the line into =2E 
    3106         { 
    3107         $c = "=2E"; 
    3108         } 
    3109       if ( $dec == 32 ) 
    3110         { 
    3111         if ( $i == ( $linlen - 1 ) ) // convert space at eol only 
    3112           { 
    3113           $c = "=20"; 
    3114           } 
    3115         else if ( $space_conv ) 
    3116           { 
    3117           $c = "=20"; 
    3118           } 
    3119         } 
    3120       else if ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) )  // always encode "\t", which is *not* required 
    3121         { 
    3122         $h2 = floor($dec/16); 
    3123         $h1 = floor($dec%16); 
    3124         $c = $escape.$hex["$h2"].$hex["$h1"]; 
    3125         } 
    3126           
    3127       if ( (strlen($newline) + strlen($c)) >= $line_max )  // CRLF is not counted 
    3128         { 
    3129         $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay 
    3130         $newline = ""; 
    3131         // check if newline first character will be point or not 
    3132         if ( $dec == 46 ) 
    3133           { 
    3134           $c = "=2E"; 
    3135           } 
    3136         } 
    3137       $newline .= $c; 
    3138       } // end of for 
    3139     $output .= $newline.$eol; 
    3140     } // end of while 
    3141  
    3142   return trim($output); 
    3143   } 
    3144  
    3145  
Note: See TracChangeset for help on using the changeset viewer.