/usr/share/squirrelmail/class/mime/AddressStructure.class.php is in squirrelmail 2:1.4.23~svn20120406-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | <?php
/**
* AddressStructure.class.php
*
* This file contains functions needed to extract email address headers from
* mime messages.
*
* @copyright 2003-2012 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: AddressStructure.class.php 14248 2012-01-02 00:18:17Z pdontthink $
* @package squirrelmail
* @subpackage mime
* @since 1.3.2
*/
/**
* Class used to work with email address headers
* @package squirrelmail
* @subpackage mime
* @since 1.3.2
*/
class AddressStructure {
/**
* 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 personal if it exists, otherwise email (false)
* @param boolean $encoded (since 1.4.0) return rfc2047 encoded address (true) or plain text (false).
* @param boolean $unconditionally_quote (since 1.4.21/1.5.2) when TRUE, always quote the personal part, whether or not it is encoded, otherwise quoting is only added if the personal part is not encoded
* @return string
*/
function getAddress($full = true, $encoded = false, $unconditionally_quote = FALSE) {
$result = '';
if (is_object($this)) {
$email = ($this->host ? $this->mailbox.'@'.$this->host
: $this->mailbox);
$personal = trim($this->personal);
$is_encoded = false;
// FIXME: I don't think the U modifier below does anything at all
if (preg_match('/(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)(.*)/Ui',$personal,$reg)) {
$is_encoded = true;
}
if ($personal) {
if ($encoded && !$is_encoded) {
$personal_encoded = encodeHeader('"' . $personal . '"');
if ($personal !== $personal_encoded) {
$personal = $personal_encoded;
} else {
//FIXME: this probably adds quotes around an encoded string which itself is already quoted
$personal = '"'.$this->personal.'"';
}
} else {
if (!$is_encoded || $unconditionally_quote) {
$personal = '"'.$this->personal.'"';
}
}
$addr = ($email ? $personal . ' <' .$email.'>'
: $this->personal);
$best_dpl = $this->personal;
} else {
$addr = $email;
$best_dpl = $email;
}
$result = ($full ? $addr : $best_dpl);
}
return $result;
}
/**
* Shorter version of getAddress() function
* Returns full encoded address.
* @param boolean $unconditionally_quote (since 1.4.21) when TRUE, always quote the personal part, whether or not it is encoded, otherwise quoting is only added if the personal part is not encoded
* @return string
* @since 1.4.0
*/
function getEncodedAddress($unconditionally_quote=FALSE) {
return $this->getAddress(true, true, $unconditionally_quote);
}
}
|