{'.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 time in microseconds between selected and current timestamp * * @param array $start see details about array format at http://www.php.net/gettimeofday * @return integer time in microseconds * @access private */ function returnTime($start) { $stop = gettimeofday(); $timepassed = 1000000 * ($stop['sec'] - $start['sec']) + $stop['usec'] - $start['usec']; return $timepassed; } /** * Returns actual message details * @param string $mailbox * @param string $passed_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, $stripHTML=FALSE) { global $imapServerAddress, $imapPort, $color,$msgd_8bit_in_hex; $returnValue = ''; sqgetGlobalVar('username', $username, SQ_SESSION); sqgetGlobalVar('key', $key, SQ_COOKIE); $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); $read = sqimap_mailbox_select($imapConnection, $mailbox); $start = gettimeofday(); $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(); session_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 = trim($body[$i]); if ($line == '') { $pre = ''; $end = ''; if ($bnd_end) { $header = true; $mimepart = false; } else if ($messageheader) { if ($header) { $header=false; $end = "\n \n".''."\n \n".'