<?php
+/**
+ * index.php
+ *
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This file simply takes any attempt to view source files and sends those
+ * people to the login screen. At this point no attempt is made to see if
+ * the person is logged or not.
+ *
+ * @version $Id$
+ * @package squirrelmail
+ */
header('Location: ../index.php');
?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * index.php
+ *
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This file simply takes any attempt to view source files and sends those
+ * people to the login screen. At this point no attempt is made to see if
+ * the person is logged or not.
+ *
+ * @version $Id$
+ * @package squirrelmail
+ */
+header('Location: ../index.php');
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * index.php
+ *
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This file simply takes any attempt to view source files and sends those
+ * people to the login screen. At this point no attempt is made to see if
+ * the person is logged or not.
+ *
+ * @version $Id$
+ * @package squirrelmail
+ */
+header('Location: ../index.php');
+?>
\ No newline at end of file
* Copyright (c) 2003-2005 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
- * This contains functions needed to handle mime messages.
+ * This file loads classes needed to handle mime messages.
*
* @version $Id$
* @package squirrelmail
+ * @subpackage mime
*/
/** @ignore */
* Copyright (c) 2003-2005 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
- * This contains functions needed to handle mime messages.
+ * This file contains functions needed to extract email address headers from
+ * mime messages.
*
* @version $Id$
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.2
*/
/**
- * Undocumented class
+ * Class used to work with email address headers
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.2
*/
class AddressStructure {
- var $personal = '',
- $adl = '',
- $mailbox = '',
- $host = '',
- $group = '';
+ /**
+ * Personal information
+ * @var string
+ */
+ var $personal = '';
+ /**
+ * @todo check use of this variable. var is not used in class.
+ * @var string
+ */
+ var $adl = '';
+ /**
+ * Mailbox name.
+ * @var string
+ */
+ var $mailbox = '';
+ /**
+ * Server address.
+ * @var string
+ */
+ var $host = '';
+ /**
+ * @todo check use of this variable. var is not used in class.
+ * @var string
+ */
+ var $group = '';
+ /**
+ * Return address information from mime headers.
+ * @param boolean $full return full address (true) or only email (false)
+ * @param boolean $encoded (since 1.4.0) return rfc2047 encoded address (true) or plain text (false).
+ * @return string
+ */
function getAddress($full = true, $encoded = false) {
$result = '';
if (is_object($this)) {
return $result;
}
+ /**
+ * Shorter version of getAddress() function
+ * Returns full encoded address.
+ * @return string
+ * @since 1.4.0
+ */
function getEncodedAddress() {
return $this->getAddress(true, true);
}
}
-
?>
\ No newline at end of file
* Copyright (c) 2003-2005 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
- * This contains functions needed to handle mime messages.
+ * This file contains functions needed to handle content type headers
+ * (rfc2045) in mime messages.
*
* @version $Id$
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.2
*/
/**
- * Undocumented class
+ * Class that handles content-type headers
+ * Class was named content_type in 1.3.0 and 1.3.1. It is used internally
+ * by rfc822header class.
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.2
*/
class ContentType {
- var $type0 = 'text',
- $type1 = 'plain',
- $properties = '';
+ /**
+ * Media type
+ * @var string
+ */
+ var $type0 = 'text';
+ /**
+ * Media subtype
+ * @var string
+ */
+ var $type1 = 'plain';
+ /**
+ * Auxiliary header information
+ * prepared with parseContentType() function in rfc822header class.
+ * @var array
+ */
+ var $properties = '';
+ /**
+ * Constructor function.
+ * Prepared type0 and type1 properties
+ * @param string $type content type string without auxiliary information
+ */
function ContentType($type) {
$pos = strpos($type, '/');
if ($pos > 0) {
* Copyright (c) 2003-2005 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
- * This contains functions needed to handle mime messages.
+ * This file contains functions needed to handle content disposition headers
+ * in mime messages.
*
* @version $Id$
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.2
+ * @todo find rfc number
*/
/**
- * Undocumented class
+ * Class that handles content disposition header
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.0
+ * @todo FIXME: do we have to declare vars ($name and $properties)?
*/
class Disposition {
+ /**
+ * Constructor function
+ * @param string $name
+ */
function Disposition($name) {
$this->name = $name;
$this->properties = array();
}
+ /**
+ * Returns value of content disposition property
+ * @param string $par content disposition property name
+ * @return string
+ * @since 1.3.1
+ */
function getProperty($par) {
$value = strtolower($par);
if (isset($this->properties[$par])) {
*
* @version $Id$
* @package squirrelmail
+ * @subpackage mime
* @since 1.3.2
*/
* Class that can be used to handle language properties in MIME headers.
*
* @package squirrelmail
+ * @subpackage mime
* @since 1.3.0
*/
class Language {
*
* @version $Id$
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.2
*/
/**
* more objects of type message. See documentation in mime.txt for
* a better description of how this works.
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.0
*/
class Message {
var $rfc822_header = '',
$att_local_name = ''; /* location where the tempory attachment
is stored. For future usage in smtp.php */
+ /**
+ * @param mixed $ent entity id
+ */
function setEnt($ent) {
$this->entity_id= $ent;
}
+ /**
+ * @param mixed $msg
+ */
function addEntity ($msg) {
$this->entities[] = $msg;
}
+ /**
+ * Get file name used for mime part
+ * @return string file name
+ * @since 1.3.2
+ */
function getFilename() {
$filename = '';
$header = $this->header;
return $filename;
}
-
+ /**
+ * Add header object to message object.
+ * WARNING: Unfinished code. Don't expect it to work in older sm versions.
+ * @param mixed $read array or string with message headers
+ * @todo FIXME: rfc822header->parseHeader() does not return rfc822header object
+ */
function addRFC822Header($read) {
$header = new Rfc822Header();
$this->rfc822_header = $header->parseHeader($read);
}
+ /**
+ * @param string $ent
+ */
function getEntity($ent) {
$cur_ent = $this->entity_id;
$msg = $this;
return $msg;
}
+ /**
+ * Set message body
+ * @param string $s message body
+ */
function setBody($s) {
$this->body_part = $s;
}
+ /**
+ * Clean message object
+ */
function clean_up() {
$msg = $this;
$msg->body_part = '';
}
}
+ /**
+ * @return string
+ */
function getMailbox() {
$msg = $this;
while (is_object($msg->parent)) {
* Question/Bugs:
*
* Ask for me (Marc Groot Koerkamp, stekkel@users.sourceforge.net)
- *
+ * @param string $read
+ * @param integer $i
+ * @param mixed $sub_msg
+ * @return object Message object
+ * @todo define argument and return types
*/
function parseStructure($read, &$i, $sub_msg = '') {
$msg = Message::parseBodyStructure($read, $i, $sub_msg);
return $msg;
}
+ /**
+ * @param object $msg
+ * @param mixed $init
+ * @param integer $i
+ * @todo document me
+ * @since 1.4.0
+ */
function setEntIds(&$msg,$init=false,$i=0) {
$iCnt = count($msg->entities);
if ($init !==false) {
}
}
+ /**
+ * @param string $read
+ * @param integer $i
+ * @param mixed $sub_msg
+ * @return object Message object
+ * @todo document me
+ * @since 1.4.0 (code was part of parseStructure() in 1.3.x)
+ */
function parseBodyStructure($read, &$i, $sub_msg = '') {
$arg_no = 0;
$arg_a = array();
} /* for */
} /* parsestructure */
+ /**
+ * @param string $read
+ * @param integer $i
+ * @return array
+ */
function parseProperties($read, &$i) {
$properties = array();
$prop_name = '';
return $properties;
}
+ /**
+ * @param string $read
+ * @param integer $i
+ * @param object $hdr MessageHeader object
+ * @return object MessageHeader object
+ */
function parseEnvelope($read, &$i, $hdr) {
$arg_no = 0;
$arg_a = array();
return $hdr;
}
+ /**
+ * @param string $read
+ * @param integer $i
+ * @return string
+ * @todo document me
+ */
function parseLiteral($read, &$i) {
$lit_cnt = '';
++$i;
return $s;
}
+ /**
+ * @param string $read
+ * @param integer $i
+ * @return string
+ * @todo document me
+ */
function parseQuote($read, &$i) {
$s = '';
$iPos = ++$i;
return $s;
}
+ /**
+ * @param string $read
+ * @param integer $i
+ * @return object AddressStructure object
+ */
function parseAddress($read, &$i) {
$arg_a = array();
for (; $read{$i} != ')'; ++$i) {
return $adr;
}
+ /**
+ * @param string $read
+ * @param integer $i
+ * @param object Disposition object or empty string
+ */
function parseDisposition($read, &$i) {
$arg_a = array();
for (; $read{$i} != ')'; ++$i) {
return (is_object($disp) ? $disp : '');
}
+ /**
+ * @param string $read
+ * @param integer $i
+ * @return object Language object or empty string
+ */
function parseLanguage($read, &$i) {
/* no idea how to process this one without examples */
$arg_a = array();
return (is_object($lang) ? $lang : '');
}
+ /**
+ * Parse message text enclosed in parenthesis
+ * @param string $read
+ * @param integer $i
+ * @return integer
+ */
function parseParenthesis($read, $i) {
for (; $read{$i} != ')'; ++$i) {
switch ($read{$i}) {
return $i;
}
- /* Function to fill the message structure in case the */
- /* bodystructure is not available NOT FINISHED YET */
+ /**
+ * Function to fill the message structure in case the
+ * bodystructure is not available
+ * NOT FINISHED YET
+ * @param string $read
+ * @param string $type0 message part type
+ * @param string $type1 message part subtype
+ * @return string
+ */
function parseMessage($read, $type0, $type1) {
switch ($type0) {
case 'message':
}
}
+ /**
+ * @param array $entity
+ * @param array $alt_order
+ * @param boolean $strict
+ * @return array
+ */
function findDisplayEntity($entity = array(), $alt_order = array('text/plain', 'text/html'), $strict=false) {
$found = false;
if ($this->type0 == 'multipart') {
return $entity;
}
+ /**
+ * @param array $alt_order
+ * @return array
+ */
function findAlternativeEntity($alt_order) {
/* If we are dealing with alternative parts then we */
/* choose the best viewable message supported by SM. */
return $entity;
}
+ /**
+ * @return array
+ */
function findRelatedEntity() {
$msgs = array();
$related_type = $this->header->getParameter('type');
return $msgs;
}
+ /**
+ * @param array $exclude_id
+ * @param array $result
+ * @return array
+ */
function getAttachments($exclude_id=array(), $result = array()) {
/*
if (($this->type0 == 'message') &&
return $result;
}
+ /**
+ * Add attachment to message object
+ * @param string $type attachment type
+ * @param string $name attachment name
+ * @param string $location path to attachment
+ */
function initAttachment($type, $name, $location) {
$attachment = new Message();
$mime_header = new MessageHeader();
$mime_header->setParameter('name', $name);
+ // FIXME: duplicate code. see ContentType class
$pos = strpos($type, '/');
if ($pos > 0) {
$mime_header->type0 = substr($type, 0, $pos);
* Copyright (c) 2003-2005 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
- * This contains functions needed to handle mime messages.
+ * This file contains functions needed to handle headers in mime messages.
*
* @version $Id$
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.2
*/
/**
- * Contains all variables available in a bodystructure
+ * Message header class
+ * Class contains all variables available in a bodystructure
+ * entity like described in rfc2060
+ * It was called msg_header in 1.3.0 and 1.3.1.
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.2
+ * @todo document vars
*/
class MessageHeader {
- /** msg_header contains all variables available in a bodystructure **/
- /** entity like described in rfc2060 **/
-
var $type0 = '',
$type1 = '',
$parameters = array(),
$disposition = '',
$language='';
- /*
- * returns addres_list of supplied argument
- * arguments: array('to', 'from', ...) or just a string like 'to'.
- * result: string: address1, addres2, ....
+ /**
+ * Sets header variable
+ * @param string $var
+ * @param mixed $value
*/
-
function setVar($var, $value) {
$this->{$var} = $value;
}
+ /**
+ * Gets parameter value from $parameters array
+ * @param string $p
+ * @return mixed
+ */
function getParameter($p) {
$value = strtolower($p);
return (isset($this->parameters[$p]) ? $this->parameters[$p] : '');
}
+ /**
+ * Sets parameter value in $parameters array
+ * @param string $parameter
+ * @param mixed $value
+ */
function setParameter($parameter, $value) {
$this->parameters[strtolower($parameter)] = $value;
}
* Copyright (c) 2003-2005 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
- * This contains functions needed to handle mime messages.
+ * This file contains functions needed to handle headers in mime messages.
*
* @version $Id$
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.2
*/
/**
+ * MIME header class
* input: header_string or array
+ * You must call parseHeader() function after creating object in order to fill object's
+ * parameters.
+ * @todo FIXME: there is no constructor function and class should ignore all input args.
* @package squirrelmail
+ * @subpackage mime
+ * @since 1.3.0
*/
class Rfc822Header {
var $date = -1,
$mlist = array(),
$more_headers = array(); /* only needed for constructing headers
in smtp.php */
+ /**
+ * @param mixed $hdr string or array with message headers
+ */
function parseHeader($hdr) {
if (is_array($hdr)) {
$hdr = implode('', $hdr);
}
/* First we replace \r\n by \n and unfold the header */
+ /* FIXME: unfolding header with multiple spaces "\n( +)" */
$hdr = trim(str_replace(array("\r\n", "\n\t", "\n "),array("\n", ' ', ' '), $hdr));
/* Now we can make a new header array with */
}
}
+ /**
+ * @param string $value
+ * @return string
+ */
function stripComments($value) {
$result = '';
$cnt = strlen($value);
return $result;
}
+ /**
+ * Parse header field according to field type
+ * @param string $field field name
+ * @param string $value field value
+ */
function parseField($field, $value) {
$field = strtolower($field);
switch($field) {
}
}
+ /**
+ * @param string $address
+ * @return array
+ */
function getAddressTokens($address) {
$aTokens = array();
$aSpecials = array('(' ,'<' ,',' ,';' ,':');
}
return $aTokens;
}
+
+ /**
+ * @param array $aStack
+ * @param array $aComment
+ * @param string $sEmail
+ * @param string $sGroup
+ * @return object AddressStructure object
+ */
function createAddressObject(&$aStack,&$aComment,&$sEmail,$sGroup='') {
//$aStack=explode(' ',implode('',$aStack));
if (!$sEmail) {
return $oAddr;
}
- /*
- * parseAddress: recursive function for parsing address strings and store
- * them in an address stucture object.
- * input: $address = string
- * $ar = boolean (return array instead of only the
- * first element)
- * $addr_ar = array with parsed addresses // obsolete
- * $group = string // obsolete
- * $host = string (default domainname in case of
- * addresses without a domainname)
- * $lookup = callback function (for lookup address
- * strings which are probably nicks
- * (without @ ) )
- * output: array with addressstructure objects or only one
- * address_structure object.
+ /**
+ * recursive function for parsing address strings and storing them in an address stucture object.
* personal name: encoded: =?charset?Q|B?string?=
* quoted: "string"
* normal: string
* : mailbox@host
* This function is also used for validating addresses returned from compose
* That's also the reason that the function became a little bit huge
+ * @param string $address
+ * @param boolean $ar return array instead of only the first element
+ * @param array $addr_ar (obsolete) array with parsed addresses
+ * @param string $group (obsolete)
+ * @param string $host default domainname in case of addresses without a domainname
+ * @param string $lookup (since) callback function for lookup of address strings which are probably nicks (without @)
+ * @return mixed array with AddressStructure objects or only one address_structure object.
*/
-
function parseAddress($address,$ar=false,$aAddress=array(),$sGroup='',$sHost='',$lookup=false) {
$aTokens = $this->getAddressTokens($address);
$sPersonal = $sEmail = $sGroup = '';
/**
* Normalise the different Priority headers into a uniform value,
* namely that of the X-Priority header (1, 3, 5). Supports:
- * Prioirty, X-Priority, Importance.
+ * Priority, X-Priority, Importance.
* X-MS-Mail-Priority is not parsed because it always coincides
* with one of the other headers.
*
* NOTE: this is actually a duplicate from the function in
* functions/imap_messages. I'm not sure if it's ok here to call
* that function?
+ * @param string $value literal priority name
+ * @return integer
*/
function parsePriority($value) {
$value = strtolower(array_shift(split('/\w/',trim($value))));
return 3;
}
+ /**
+ * @param string $value content type header
+ */
function parseContentType($value) {
$pos = strpos($value, ';');
$props = '';
$this->content_type = $content_type;
}
- /* RFC2184 */
+ /**
+ * RFC2184
+ * @param array $aParameters
+ * @return array
+ */
function processParameters($aParameters) {
$aResults = array();
$aCharset = array();
$value = substr($value,strlen($charset)+1);
$language = substr($value,0,strpos($value,"'"));
$value = substr($value,strlen($charset)+1);
- // FIX ME What's the status of charset decode with language information ????
+ /* FIXME: What's the status of charset decode with language information ????
+ * Maybe language information contains only ascii text and charset_decode()
+ * only runs htmlspecialchars() on it. If it contains 8bit information, you
+ * get html encoded text in charset used by selected translation.
+ */
$value = charset_decode($charset,$value);
$aResults[$key] = $value;
}
return $aResults;
}
+ /**
+ * @param string $value
+ * @return array
+ */
function parseProperties($value) {
$propArray = explode(';', $value);
$propResultArray = array();
return $this->processParameters($propResultArray);
}
+ /**
+ * Fills disposition object in rfc822Header object
+ * @param string $value
+ */
function parseDisposition($value) {
$pos = strpos($value, ';');
$props = '';
$this->disposition = $disp;
}
+ /**
+ * Fills mlist array keys in rfc822Header object
+ * @param string $field
+ * @param string $value
+ */
function mlist($field, $value) {
$res_a = array();
$value_a = explode(',', $value);
$this->mlist[$field] = $res_a;
}
- /*
- * function to get the addres strings out of the header.
- * Arguments: string or array of strings !
+ /**
+ * function to get the address strings out of the header.
* example1: header->getAddr_s('to').
* example2: header->getAddr_s(array('to', 'cc', 'bcc'))
+ * @param mixed $arr string or array of strings
+ * @param string $separator
+ * @param boolean $encoded (since 1.4.0) return encoded or plain text addresses
+ * @return string
*/
function getAddr_s($arr, $separator = ',',$encoded=false) {
$s = '';
return $s;
}
+ /**
+ * function to get the array of addresses out of the header.
+ * @param mixed $arg string or array of strings
+ * @param array $excl_arr array of excluded email addresses
+ * @param array $arr array of added email addresses
+ * @return array
+ */
function getAddr_a($arg, $excl_arr = array(), $arr = array()) {
if (is_array($arg)) {
foreach($arg as $argument) {
return $arr;
}
+ /**
+ * @param mixed $address array or string
+ * @param boolean $recurs
+ * @return mixed array, boolean
+ * @since 1.3.2
+ */
function findAddress($address, $recurs = false) {
$result = false;
if (is_array($address)) {
}
}
}
- foreach ($this->cc as $cc) {
+ foreach ($this->cc as $cc) {
if ($cc->host == $srch_addr->host) {
if ($cc->mailbox == $srch_addr->mailbox) {
$results[] = $srch_addr;
return $result;
}
+ /**
+ * @param string $type0 media type
+ * @param string $type1 media subtype
+ * @return array media properties
+ * @todo check use of media type arguments
+ */
function getContentType($type0, $type1) {
$type0 = $this->content_type->type0;
$type1 = $this->content_type->type1;
* @link http://www.ietf.org/html.charters/smime-charter.html
* @version $Id$
* @package squirrelmail
+ * @subpackage mime
* @since 1.3.2
*/
/**
* Unimplemented class.
* @package squirrelmail
+ * @subpackage mime
* @todo implement smime parsing
*/
class SMimeMessage {
<?php
+/**
+ * index.php
+ *
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This file simply takes any attempt to view source files and sends those
+ * people to the login screen. At this point no attempt is made to see if
+ * the person is logged or not.
+ *
+ * @version $Id$
+ * @package squirrelmail
+ */
header('Location: ../index.php');
?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * index.php
+ *
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This file simply takes any attempt to view source files and sends those
+ * people to the login screen. At this point no attempt is made to see if
+ * the person is logged or not.
+ *
+ * @version $Id$
+ * @package squirrelmail
+ */
+header('Location: ../index.php');
+?>
\ No newline at end of file