Changeset 510ca28 in github
- Timestamp:
- Sep 4, 2008 7:02:22 AM (5 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 1518702
- Parents:
- 30276ce
- File:
-
- 1 edited
-
program/lib/mime.inc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/lib/mime.inc
r1b5deba r510ca28 33 33 $MIME_OTHER = 7; 34 34 35 function iml_ClosingParenPos($str, $start) {35 function iml_ClosingParenPos($str, $start) { 36 36 $level=0; 37 37 $len = strlen($str); 38 38 $in_quote = 0; 39 for ($i=$start;$i<$len;$i++){ 40 if ($str[$i]=="\"") $in_quote = ($in_quote + 1) % 2; 41 if (!$in_quote){ 39 40 for ($i=$start; $i<$len; $i++) { 41 if ($str[$i] == '"' && $str[$i-1] != "\\") 42 $in_quote = ($in_quote + 1) % 2; 43 if (!$in_quote) { 42 44 if ($str[$i]=="(") $level++; 43 45 else if (($level > 0) && ($str[$i]==")")) $level--; … … 52 54 $a = array(); 53 55 $len = strlen($str); 54 55 56 $in_quote = 0; 56 for ($i=0; $i<$len; $i++){ 57 if ($str[$i] == "\"") $in_quote = ($in_quote + 1) % 2; 58 else if (!$in_quote){ 59 if ($str[$i] == " "){ //space means new element 57 58 for ($i=0; $i<$len; $i++) { 59 if ($str[$i] == '"') { 60 $in_quote = ($in_quote + 1) % 2; 61 } else if (!$in_quote) { 62 if ($str[$i] == " ") { //space means new element 60 63 $id++; 61 64 while ($str[$i+1] == " ") $i++; // skip additional spaces 62 } else if ($str[$i]=="(") { //new part65 } else if ($str[$i]=="(") { //new part 63 66 $i++; 64 67 $endPos = iml_ClosingParenPos($str, $i); … … 68 71 $a[$id] = iml_ParseBSString($part); //send part string 69 72 $i = $endPos; 70 }else $a[$id].=$str[$i]; //add to current element in array 71 }else if ($in_quote){ 72 if ($str[$i]=="\\") $i++; //escape backslashes 73 else $a[$id].=$str[$i]; //add to current element in array 73 } else 74 $a[$id].=$str[$i]; //add to current element in array 75 } else if ($in_quote) { 76 if ($str[$i]=="\\") { 77 $i++; //escape backslashes 78 if ($str[$i] == '"' || $str[$i] == "\\") 79 $a[$id] .= $str[$i]; 80 } else 81 $a[$id] .= $str[$i]; //add to current element in array 74 82 } 75 83 } … … 82 90 $line=substr($str, 1, strlen($str) - 2); 83 91 $line = str_replace(")(", ") (", $line); 84 92 85 93 $struct = iml_ParseBSString($line); 86 94 if ((strcasecmp($struct[0], "message")==0) && (strcasecmp($struct[1], "rfc822")==0)){
Note: See TracChangeset
for help on using the changeset viewer.
