entities)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3103
7612ce4b-ef26-0410-bec9-
ea0150e637f0
$msg = $msg->entities[0];
}
}
$msg = $msg->entities[0];
}
}
- if ($msg->type0 == 'message') {
+ if ($msg->type0 == 'message' && $msg->type1 == 'rfc822') {
/*this is a header for a message/rfc822 entity */
$msg = $msg->entities[0];
}
}
/*this is a header for a message/rfc822 entity */
$msg = $msg->entities[0];
}
}
- if ($msg->type0 == 'message') {
+
+ if ($msg->type0 == 'message' && $msg->type1 == 'rfc822') {
/*this is a header for a message/rfc822 entity */
$msg = $msg->entities[0];
}
/*this is a header for a message/rfc822 entity */
$msg = $msg->entities[0];
}
if (isset($msg->entities[($ent_a[$cnt-1])-1])) {
$msg = $msg->entities[($ent_a[$cnt-1]-1)];
}
if (isset($msg->entities[($ent_a[$cnt-1])-1])) {
$msg = $msg->entities[($ent_a[$cnt-1]-1)];
}
* Ask for me (Marc Groot Koerkamp, stekkel@users.sourceforge.net.
*
*/
* Ask for me (Marc Groot Koerkamp, stekkel@users.sourceforge.net.
*
*/
- function parseStructure($read, $i=0, $message = false) {
+ function &parseStructure($read, $i=0, $message = false) {
$arg_no = 0;
$arg_a = array();
$cnt = strlen($read);
$arg_no = 0;
$arg_a = array();
$cnt = strlen($read);
+ case 3:
+ if (isset($msg->type0) && $msg->type0 == 'multipart') {
+ $i++;
+ $arg_a[]= $msg->parseLanguage($read,&$i);
+ }
case 7:
if ($arg_a[0] == 'message' && $arg_a[1] == 'rfc822') {
case 7:
if ($arg_a[0] == 'message' && $arg_a[1] == 'rfc822') {
break;
case 'N':
/* probably NIL argument */
break;
case 'N':
/* probably NIL argument */
- if (strtolower(substr($read,$i,3)) == 'nil') {
+ if (strtoupper(substr($read,$i,4)) == 'NIL ' ||
+ strtoupper(substr($read,$i,4)) == 'NIL)') {
$arg_a[] = '';
$arg_no++;
$i = $i+2;
$arg_a[] = '';
$arg_no++;
$i = $i+2;
break;
case 'N':
/* probably NIL argument */
break;
case 'N':
/* probably NIL argument */
- if (strtolower(substr($read,$i,3)) == 'nil') {
+ if (strtoupper(substr($read,$i,3)) == 'NIL') {
$arg_a[] = '';
$arg_no++;
$i = $i+2;
$arg_a[] = '';
$arg_no++;
$i = $i+2;
$hdr->inreplyto = $arg_a[8];
/* argument 10: message-id */
$hdr->message_id = $arg_a[9];
$hdr->inreplyto = $arg_a[8];
/* argument 10: message-id */
$hdr->message_id = $arg_a[9];
}
function parseLiteral($read, $i) {
}
function parseLiteral($read, $i) {
function parseQuote($read, $i) {
$i++;
$s = '';
function parseQuote($read, $i) {
$i++;
$s = '';
- $cnt = strlen($read);
- while ($i < $cnt && $read{$i} != '"') {
+ while ($read{$i} != '"') {
if ($read{$i} == '\\') {
$i++;
}
if ($read{$i} == '\\') {
$i++;
}
function parseAddress($read, $i) {
$arg_a = array();
function parseAddress($read, $i) {
$arg_a = array();
- while ($read{$i} != ')') {
+ while ($read{$i} != ')' ) { //&& $i < count($read)) {
$char = strtoupper($read{$i});
switch ($char) {
case '"':
$char = strtoupper($read{$i});
switch ($char) {
case '"':
$arg_a[] = '';
$i = $i+2;
}
$arg_a[] = '';
$i = $i+2;
}
$adr->adl = $arg_a[1];
$adr->mailbox = $arg_a[2];
$adr->host = $arg_a[3];
$adr->adl = $arg_a[1];
$adr->mailbox = $arg_a[2];
$adr->host = $arg_a[3];
+ } else {
+ $adr = '';
+ }
- function parseDisposition($read,$i) {
+ function parseDisposition($read,&$i) {
$arg_a = array();
while ($read{$i} != ')') {
switch ($read{$i}) {
$arg_a = array();
while ($read{$i} != ')') {
switch ($read{$i}) {
$disp->properties = $arg_a[1];
}
}
$disp->properties = $arg_a[1];
}
}
- if (is_object($disp)) return $disp;
+ if (is_object($disp)) {
+ return $disp;
+ }
}
function parseLanguage($read,&$i) {
}
function parseLanguage($read,&$i) {
- /* no idea how to process this one without examples */
- return '';
+ /* no idea how to process this one without examples */
+ $arg = '';
+ while ($read{$i} != ')') {
+ switch ($read{$i}) {
+ case '"':
+ $arg = $this->parseQuote($read,&$i);
+ break;
+ case '{':
+ $arg = $this->parseLiteral($read,&$i);
+ break;
+ case '(':
+ $arg = $this->parseProperties($read,&$i);
+ break;
+ default:
+ break;
+ }
+ $i++;
+ }
+ return $arg;;
}
function parseParenthesis($read,&$i) {
}
function parseParenthesis($read,&$i) {
}
function findDisplayEntity ($entity = array(), $alt_order = array('text/plain','text/html')) {
}
function findDisplayEntity ($entity = array(), $alt_order = array('text/plain','text/html')) {
$found = false;
$type = $this->type0.'/'.$this->type1;
if ( $type == 'multipart/alternative') {
$found = false;
$type = $this->type0.'/'.$this->type1;
if ( $type == 'multipart/alternative') {
}
} else if ( $this->type0 == 'text' &&
( $this->type1 == 'plain' ||
}
} else if ( $this->type0 == 'text' &&
( $this->type1 == 'plain' ||
- $this->type1 == 'html' ) &&
+ $this->type1 == 'html' ||
+ $this->type1 == 'message') &&
isset($this->entity_id) ) {
if (count($this->entities) == 0) {
if (!$this->header->disposition->name == 'attachment') {
isset($this->entity_id) ) {
if (count($this->entities) == 0) {
if (!$this->header->disposition->name == 'attachment') {