{'.dechex(ord('\\1')).'}'",$string); } /** * Calculates id of MIME entity * @param string $entString * @param integer $direction * @return string * @access private */ function CalcEntity($entString, $direction) { $result = $entString; if ($direction == -1) { $pos = strrpos($entString,'.'); $result = substr($entString,0,$pos); } switch ($direction) { case 0: $pos = strrpos($entString,'.'); if ($pos === false) { $entString++; $result= $entString; } else { $level = substr($entString,0,$pos); $sublevel = substr($entString,$pos+1); $sublevel++; $result = "$level".'.'."$sublevel"; } break; case 1: $result = "$entString".".0"; break; default: break; } return ($result); } /** * Returns actual message details * @param string $mailbox * @param string $passed_id * @param string $passed_ent_id * @param boolean $stripHTML If TRUE, only plain text is returned, * default is FALSE, wherein output contains * pretty-HTMLification of message body * @return string The formatted message details * @access public */ function get_message_details($mailbox, $passed_id, $passed_ent_id=0, $stripHTML=FALSE) { global $imapServerAddress, $imapPort, $imap_stream_options, $color,$msgd_8bit_in_hex, $username; $returnValue = ''; $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options); $read = sqimap_mailbox_select($imapConnection, $mailbox); if (!empty($passed_ent_id)) $body = sqimap_run_command($imapConnection, "FETCH $passed_id BODY[$passed_ent_id]",true, $response, $readmessage, TRUE); else $body = sqimap_run_command($imapConnection, "FETCH $passed_id RFC822",true, $response, $readmessage, TRUE); $message_body = ''; $header = false; $mimepart = false; $bnd_end = false; $messageheader = true; $messageheaderstart=false; $boundaries = array(); $entities = array(); sqsession_unregister("entities"); $pre = ''; $end = ''; $entStr = ''; $bla =''; $content = array (); $content_indx = -1; $contentset = false; $count=count($body); $body[$count-1] = substr($body[$count-1], -1); for ($i=1; $i < $count; $i++) { $line = rtrim($body[$i]); if ($line == '') { $pre = ''; $end = ''; if ($bnd_end) { $header = true; $mimepart = false; } else if ($messageheader) { if ($header) { $header=false; $end = '
'._("Entity").' | '. ''._("Content-Type").' | '. ''._("Name").' | '. ''._("Encoding").' | '. '
'; $returnValue .= $content[$i]['ent'].' | '; if (isset($content[$i]['type'])) { $returnValue .= $content[$i]['type']; } else $returnValue .= 'TEXT/PLAIN'; $returnValue .= ' | '; if (isset($content[$i]['name'])) { $returnValue .= $content[$i]['name']; } else $returnValue .= ' '; $returnValue .= ' | '; if (isset($content[$i]['encoding'])) { $returnValue .= $content[$i]['encoding']; } else $returnValue .= ' '; $returnValue .= ' |
'; } else { $returnValue .= ''; } $returnValue .= $message_body; if (!$stripHTML) { $returnValue .= '