formatting

This commit is contained in:
Miles Lott 2002-05-26 20:32:54 +00:00
parent 3861b64b16
commit f8ee781c06
2 changed files with 231 additions and 230 deletions

View File

@ -1,7 +1,7 @@
<?php
/**************************************************************************\
* phpGroupWare Email - POP3 Mail Wrapper for Imap Enabled PHP *
* http://www.phpgroupware.org/ * *
* phpGroupWare Email - POP3 Mail Wrapper for Imap Enabled PHP *
* http://www.phpgroupware.org/ *
* -------------------------------------------------------------------------*
* This library is part of phpGroupWare (http://www.phpgroupware.org) *
* This library is free software; you can redistribute it and/or modify it *
@ -248,5 +248,4 @@
$folder_str = $GLOBALS['phpgw']->msg->get_folder_short($folder);
return $folder_str;
}
} // end of class msg

View File

@ -2,8 +2,8 @@
/**************************************************************************\
* phpGroupWare API - POP3 *
* This file written by Mark Peters <skeeter@phpgroupware.org> *
* Handles specific operations in dealing with POP3 *
* Copyright (C) 2001 Mark Peters and Angelo "Angles" Puglisi *
* Handles specific operations in dealing with POP3 *
* Copyright (C) 2001 Mark Peters and Angelo "Angles" Puglisi *
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
@ -21,6 +21,8 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
/*!
@class msg (sockets)
@abstract part of mail Data Communications class
@ -248,7 +250,6 @@
return $return_num_msg;
}
/**************************************************************************\
* Message Sorting
\**************************************************************************/
@ -1060,81 +1061,82 @@
}
switch ($keyword)
{
case 'content-type:' :
// this will fill type and (hopefully) subtype
// NOTE: first param to parse_type_subtype is a REFERENCE
$this->parse_type_subtype(&$info,$content);
// ALSO, typically Paramaters are on this line as well
$pos_param = strpos($content,';');
if ($pos_param > 0)
{
if ($this->debug >= 2) { echo 'pop3: sub_get_structure: apparent params exist in content ['.$content.']<br>'; }
// feed the whole param line into this function
$content = substr($content,$pos_param+1);
if ($this->debug >= 2) { echo 'pop3: sub_get_structure: calling parse_msg_params, feeding content ['.$content.']<br>'; }
// False = this is NOT a disposition param, this is the more common regular param
// NOTE: first param to parse_msg_params is a REFERENCE
$this->parse_msg_params(&$info,$content,False);
}
break;
case 'content-transfer-encoding:' :
$info->encoding = $this->encoding_str_to_int($content);
break;
case 'content-description:' :
$info->description = $content;
//$i = $this->more_info($msg_part,$i,&$info,"description");
$info->ifdescription = true;
break;
case 'content-disposition:' :
// disposition MAY have Paramaters on this line as well
$pos_param = strpos($content,';');
if ($pos_param > 0)
{
$content = substr($content,0,$pos_param);
}
$info->disposition = $content;
$info->ifdisposition = True;
// parse paramaters if any
if ($pos_param > 0)
{
// feed the whole param line into this function
$content = substr($content,$pos_param+1);
// NOTE: first param to parse_msg_params is a REFERENCE
$this->parse_msg_params(&$info,$content,False);
}
break;
case 'content-identifier:' :
case 'content-id:' :
case 'message-id:' :
if ((strstr($content, '<'))
&& (strstr($content, '>')))
{
$content = str_replace('<','',$content);
$content = str_replace('>','',$content);
}
//$i = $this->more_info($msg_part,$i,&$info,"id");
$info->id = $content;
$info->ifid = true;
break;
case 'content-length:' :
$info->bytes = (int)$content;
break;
case 'content-disposition:' :
$info->disposition = $content;
//$i = $this->more_info($msg_part,$i,&$info,"disposition");
$info->ifdisposition = true;
break;
case 'lines:' :
$info->lines = (int)$content;
break;
/*
case 'mime-version:' :
$new_idx = count($info->parameters);
$info->parameters[$new_idx] = new msg_params("Mime-Version",$content);
$info->ifparameters = true;
break;
*/
default : break;
case 'content-type:' :
// this will fill type and (hopefully) subtype
// NOTE: first param to parse_type_subtype is a REFERENCE
$this->parse_type_subtype(&$info,$content);
// ALSO, typically Paramaters are on this line as well
$pos_param = strpos($content,';');
if ($pos_param > 0)
{
if ($this->debug >= 2) { echo 'pop3: sub_get_structure: apparent params exist in content ['.$content.']<br>'; }
// feed the whole param line into this function
$content = substr($content,$pos_param+1);
if ($this->debug >= 2) { echo 'pop3: sub_get_structure: calling parse_msg_params, feeding content ['.$content.']<br>'; }
// False = this is NOT a disposition param, this is the more common regular param
// NOTE: first param to parse_msg_params is a REFERENCE
$this->parse_msg_params(&$info,$content,False);
}
break;
case 'content-transfer-encoding:' :
$info->encoding = $this->encoding_str_to_int($content);
break;
case 'content-description:' :
$info->description = $content;
//$i = $this->more_info($msg_part,$i,&$info,"description");
$info->ifdescription = true;
break;
case 'content-disposition:' :
// disposition MAY have Paramaters on this line as well
$pos_param = strpos($content,';');
if ($pos_param > 0)
{
$content = substr($content,0,$pos_param);
}
$info->disposition = $content;
$info->ifdisposition = True;
// parse paramaters if any
if ($pos_param > 0)
{
// feed the whole param line into this function
$content = substr($content,$pos_param+1);
// NOTE: first param to parse_msg_params is a REFERENCE
$this->parse_msg_params(&$info,$content,False);
}
break;
case 'content-identifier:' :
case 'content-id:' :
case 'message-id:' :
if ((strstr($content, '<'))
&& (strstr($content, '>')))
{
$content = str_replace('<','',$content);
$content = str_replace('>','',$content);
}
//$i = $this->more_info($msg_part,$i,&$info,"id");
$info->id = $content;
$info->ifid = true;
break;
case 'content-length:' :
$info->bytes = (int)$content;
break;
case 'content-disposition:' :
$info->disposition = $content;
//$i = $this->more_info($msg_part,$i,&$info,"disposition");
$info->ifdisposition = true;
break;
case 'lines:' :
$info->lines = (int)$content;
break;
/*
case 'mime-version:' :
$new_idx = count($info->parameters);
$info->parameters[$new_idx] = new msg_params("Mime-Version",$content);
$info->ifparameters = true;
break;
*/
default:
break;
}
}
@ -1352,15 +1354,15 @@
$type_int = TYPEOTHER;
switch ($type_str)
{
case 'text' : $type_int = TYPETEXT; break;
case 'multipart' : $type_int = TYPEMULTIPART; break;
case 'message' : $type_int = TYPEMESSAGE; break;
case 'application' : $type_int = TYPEAPPLICATION; break;
case 'audio' : $type_int = TYPEAUDIO; break;
case 'image' : $type_int = TYPEIMAGE; break;
case 'video' : $type_int = TYPEVIDEO; break;
case 'text' : $type_int = TYPETEXT; break;
case 'multipart' : $type_int = TYPEMULTIPART; break;
case 'message' : $type_int = TYPEMESSAGE; break;
case 'application' : $type_int = TYPEAPPLICATION; break;
case 'audio' : $type_int = TYPEAUDIO; break;
case 'image' : $type_int = TYPEIMAGE; break;
case 'video' : $type_int = TYPEVIDEO; break;
// this causes errors under php 4.0.6, but used to work before that, I think
//defaut : $type_int = TYPEOTHER; break;
//default : $type_int = TYPEOTHER; break;
}
return $type_int;
}
@ -1382,12 +1384,12 @@
// APPLICATION/OCTET-STREAM is the default when NO info is available
switch ($type_int)
{
case TYPETEXT : return 'plain'; break;
case TYPEMULTIPART : return 'mixed'; break;
case TYPEMESSAGE : return 'rfc822'; break;
case TYPEAPPLICATION : return 'octet-stream'; break;
case TYPEAUDIO : return 'basic'; break;
default : return 'unknown'; break;
case TYPETEXT : return 'plain'; break;
case TYPEMULTIPART : return 'mixed'; break;
case TYPEMESSAGE : return 'rfc822'; break;
case TYPEAPPLICATION : return 'octet-stream'; break;
case TYPEAUDIO : return 'basic'; break;
default : return 'unknown'; break;
}
}
@ -1417,14 +1419,14 @@
{
switch (strtolower($encoding_str))
{
case '7bit' : $encoding_int = ENC7BIT; break;
case '8bit' : $encoding_int = ENC8BIT; break;
case 'binary' : $encoding_int = ENCBINARY; break;
case 'base64' : $encoding_int = ENCBASE64; break;
case 'quoted-printable' : $encoding_int = ENCQUOTEDPRINTABLE; break;
case 'other' : $encoding_int = ENCOTHER; break;
case 'uu' : $encoding_int = ENCUU; break;
default : $encoding_int = ENCOTHER; break;
case '7bit' : $encoding_int = ENC7BIT; break;
case '8bit' : $encoding_int = ENC8BIT; break;
case 'binary' : $encoding_int = ENCBINARY; break;
case 'base64' : $encoding_int = ENCBASE64; break;
case 'quoted-printable': $encoding_int = ENCQUOTEDPRINTABLE; break;
case 'other' : $encoding_int = ENCOTHER; break;
case 'uu' : $encoding_int = ENCUU; break;
default : $encoding_int = ENCOTHER; break;
}
return $encoding_int;
}
@ -1489,74 +1491,74 @@
$content = trim(substr($header_array[$i],$pos+1));
switch ($keyword)
{
case 'date:' :
$info->date = $content;
$info->udate = $this->make_udate($content);
break;
case 'subject' :
case 'subject:' :
$pos = strpos($header_array[$i+1],' ');
if (is_int($pos) && !$pos)
{
$i++; $content .= chop($header_array[$i]);
}
$info->subject = htmlspecialchars($content);
$info->Subject = htmlspecialchars($content);
break;
case 'in-reply-to:' :
$info->in_reply_to = htmlspecialchars($content);
break;
case 'message-id' :
case 'message-id:' :
$info->message_id = htmlspecialchars($content);
break;
case 'newsgroups:' :
$info->newsgroups = htmlspecialchars($content);
break;
case 'followup-to:' :
$info->follow_up_to = htmlspecialchars($content);
break;
case 'references:' :
$info->references = htmlspecialchars($content);
break;
case 'to' :
case 'to:' :
// following two lines need to be put into a loop!
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->to = $this->get_addr_details('to',$content,&$header_array,&$i);
break;
case 'from' :
case 'from:' :
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->from = $this->get_addr_details('from',$content,&$header_array,&$i);
break;
case 'cc' :
case 'cc:' :
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->cc = $this->get_addr_details('cc',$content,&$header_array,&$i);
break;
case 'bcc' :
case 'bcc:' :
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->bcc = $this->get_addr_details('bcc',$content,&$header_array,&$i);
break;
case 'reply-to' :
case 'reply-to:' :
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->reply_to = $this->get_addr_details('reply_to',$content,&$header_array,&$i);
break;
case 'sender' :
case 'sender:' :
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->sender = $this->get_addr_details('sender',$content,&$header_array,&$i);
break;
case 'return-path' :
case 'return-path:' :
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->return_path = $this->get_addr_details('return_path',$content,&$header_array,&$i);
break;
default :
break;
case 'date:':
$info->date = $content;
$info->udate = $this->make_udate($content);
break;
case 'subject':
case 'subject:':
$pos = strpos($header_array[$i+1],' ');
if (is_int($pos) && !$pos)
{
$i++; $content .= chop($header_array[$i]);
}
$info->subject = htmlspecialchars($content);
$info->Subject = htmlspecialchars($content);
break;
case 'in-reply-to:':
$info->in_reply_to = htmlspecialchars($content);
break;
case 'message-id':
case 'message-id:':
$info->message_id = htmlspecialchars($content);
break;
case 'newsgroups:':
$info->newsgroups = htmlspecialchars($content);
break;
case 'followup-to:':
$info->follow_up_to = htmlspecialchars($content);
break;
case 'references:':
$info->references = htmlspecialchars($content);
break;
case 'to':
case 'to:':
// following two lines need to be put into a loop!
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->to = $this->get_addr_details('to',$content,&$header_array,&$i);
break;
case 'from':
case 'from:':
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->from = $this->get_addr_details('from',$content,&$header_array,&$i);
break;
case 'cc':
case 'cc:':
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->cc = $this->get_addr_details('cc',$content,&$header_array,&$i);
break;
case 'bcc':
case 'bcc:':
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->bcc = $this->get_addr_details('bcc',$content,&$header_array,&$i);
break;
case 'reply-to':
case 'reply-to:':
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->reply_to = $this->get_addr_details('reply_to',$content,&$header_array,&$i);
break;
case 'sender':
case 'sender:':
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->sender = $this->get_addr_details('sender',$content,&$header_array,&$i);
break;
case 'return-path':
case 'return-path:':
// NOTE: 3rd and 4th params to get_addr_details are REFERENCES
$info->return_path = $this->get_addr_details('return_path',$content,&$header_array,&$i);
break;
default:
break;
}
}
if ($this->debug >= 1)