remove obsolet code

This commit is contained in:
Klaus Leithoff 2012-08-20 09:17:54 +00:00
parent e410b46958
commit a11b4213ee

View File

@ -561,6 +561,7 @@ class Net_IMAP extends Net_IMAPProtocol {
return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]); return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
} }
$found = 0; $found = 0;
if (!isset($ret["PARSED"])) return '';
foreach($ret["PARSED"] as $key => $value) foreach($ret["PARSED"] as $key => $value)
{ {
if (isset($ret["PARSED"][$key]["EXT"]["BODY[TEXT]"]["CONTENT"])) {$found = $key; break;} if (isset($ret["PARSED"][$key]["EXT"]["BODY[TEXT]"]["CONTENT"])) {$found = $key; break;}
@ -598,6 +599,8 @@ class Net_IMAP extends Net_IMAPProtocol {
return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]); return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
} }
$found = 0; $found = 0;
if (!isset($ret["PARSED"])) return '';
foreach($ret["PARSED"] as $key => $value) foreach($ret["PARSED"] as $key => $value)
{ {
if (isset($ret["PARSED"][$key]["EXT"]["BODY[$partId]"]["CONTENT"])) {$found = $key; break;} if (isset($ret["PARSED"][$key]["EXT"]["BODY[$partId]"]["CONTENT"])) {$found = $key; break;}
@ -629,34 +632,27 @@ class Net_IMAP extends Net_IMAPProtocol {
} else { } else {
$ret=$this->cmdFetch($msg_id,"BODYSTRUCTURE"); $ret=$this->cmdFetch($msg_id,"BODYSTRUCTURE");
} }
#_debug_array($ret);
if (PEAR::isError($ret)) { if (PEAR::isError($ret)) {
return $ret; return $ret;
} }
if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){ if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){
return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]); return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
} }
$found = 0;
foreach($ret["PARSED"] as $key => $value)
{
if (isset($ret["PARSED"][$key]["EXT"]["BODYSTRUCTURE"][0])) {$found = $key; break;}
}
$ret2=$ret["PARSED"][$found]["EXT"]["BODYSTRUCTURE"][0];
// sometimes we get an [COMMAND] => OK with $ret["PARSED"][0] and no $ret["PARSED"][0]["EXT"]["BODYSTRUCTURE"] // sometimes we get an [COMMAND] => OK with $ret["PARSED"][0] and no $ret["PARSED"][0]["EXT"]["BODYSTRUCTURE"]
// should not happen anymore if (is_array($ret) && isset($ret["PARSED"])) {
if (is_array($ret) && empty($ret2) && isset($ret["PARSED"])) { $found = 0;
foreach($ret["PARSED"] as $substruct) { foreach($ret["PARSED"] as $key => $value)
if ($substruct["COMMAND"] == "FETCH") { {
$ret2=$substruct["EXT"]["BODYSTRUCTURE"][0]; if (isset($ret["PARSED"][$key]["EXT"]["BODYSTRUCTURE"][0])) {$found = $key; break;}
break;
}
} }
$ret2=$ret["PARSED"][$found]["EXT"]["BODYSTRUCTURE"][0];
} }
$structure = array(); $structure = array();
$mimeParts = array(); $mimeParts = array();
$this->_parseStructureArray($ret2, $mimeParts); if (is_array($ret2)) $this->_parseStructureArray($ret2, $mimeParts);
#_debug_array($ret);
return array_shift($mimeParts); return array_shift($mimeParts);
} }