* @package squirrelmail
*/
class Rfc822Header {
- var $date = '',
+ var $date = -1,
$subject = '',
$from = array(),
$sender = '',
if (is_array($hdr)) {
$hdr = implode('', $hdr);
}
- /* First we unfold the header */
- $hdr = trim(str_replace(array("\r\n\t", "\r\n "),array(' ', ' '), $hdr));
+ /* First we replace \r\n by \n and unfold the header */
+ $hdr = trim(str_replace(array("\r\n", "\n\t", "\n "),array("\n", ' ', ' '), $hdr));
/* Now we can make a new header array with */
/* each element representing a headerline */
- $hdr = explode("\r\n" , $hdr);
+ $hdr = explode("\n" , $hdr);
foreach ($hdr as $line) {
$pos = strpos($line, ':');
if ($pos > 0) {
$i = 0;
foreach ($read_list as $r) {
+ /* initialize/reset vars */
$subject = _("(no subject)");
$from = _("Unknown sender");
$priority = 0;
$messageid = '<>';
- $cc = $to = $date = $type[0] = $type[1] = $inrepto = '';
+ $type = array('','');
+ $cc = $to = $inrepto = '';
+ // use unset because we do isset below
+ unset($date);
$flag_seen = $flag_answered = $flag_deleted = $flag_flagged = false;
$read = implode('',$r);
$i = strpos($read,'{',$i);
$header = parseString($read,$i);
if ($header === false) break 3;
- /* First we unfold the header */
- $hdr = trim(str_replace(array("\r\n\t", "\r\n "),array(' ', ' '), $header));
+ /* First we replace all \r\n by \n, and unfold the header */
+ $hdr = trim(str_replace(array("\r\n", "\n\t", "\n "),array("\n", ' ', ' '), $header));
/* Now we can make a new header array with */
/* each element representing a headerline */
- $hdr = explode("\r\n" , $hdr);
+ $hdr = explode("\n" , $hdr);
foreach ($hdr as $line) {
$pos = strpos($line, ':');
if ($pos > 0) {
if(!is_array($type)) {
$type[0] = 'text';
}
- if (!isset($type[1])) {
- $type[1] = '';
- }
break;
default: break;
}
$date = str_replace(' ', ' ', $date);
$tmpdate = explode(' ', trim($date));
} else {
- $tmpdate = $date = array('', '', '', '', '', '');
+ $tmpdate = $date = array();
}
if ($uid_support) {
$msgi ="$unique_id";