mirror of
				https://bitbucket.org/jsuto/piler.git
				synced 2025-10-31 17:42:26 +01:00 
			
		
		
		
	| @@ -105,12 +105,13 @@ class ModelSearchMessage extends Model { | ||||
|  | ||||
|    public function get_message_headers($id = '') { | ||||
|       $headers = ''; | ||||
|       $has_journal = 0; | ||||
|  | ||||
|       $msg = $this->get_raw_message($id); | ||||
|  | ||||
|       Piler_Mime_Decode::splitMessageRaw($msg, $headers, $body); | ||||
|       Piler_Mime_Decode::splitMessageRaw($msg, $headers, $journal, $body); | ||||
|  | ||||
|       $has_journal = $this->remove_journal($headers); | ||||
|       if($journal) { $has_journal = 1; } | ||||
|  | ||||
|       $headers = Piler_Mime_Decode::escape_lt_gt_symbols($headers); | ||||
|  | ||||
| @@ -119,87 +120,11 @@ class ModelSearchMessage extends Model { | ||||
|  | ||||
|  | ||||
|    public function get_message_journal($id = '') { | ||||
|       $data = '< >'; | ||||
|       $boundary = ''; | ||||
|  | ||||
|       $msg = $this->get_raw_message($id); | ||||
|  | ||||
|       $hdr = substr($msg, 0, 8192); | ||||
|       Piler_Mime_Decode::splitMessageRaw($msg, $headers, $journal, $body); | ||||
|  | ||||
|       $s = preg_split("/\n/", $hdr); | ||||
|       while(list($k, $v) = each($s)) { | ||||
|          if(preg_match("/boundary\s{0,}=\s{0,}\"{0,}([\w\_\-\@\.]+)\"{0,}/i", $v, $m)) { | ||||
|             if(isset($m[1])) { $boundary = $m[1]; break; } | ||||
|          } | ||||
|       } | ||||
|  | ||||
|  | ||||
|       $p = strstr($msg, "\nX-MS-Journal-Report:"); | ||||
|       $msg = ''; | ||||
|  | ||||
|       if($p) { | ||||
|  | ||||
|          $s = preg_split("/\n/", $p); | ||||
|  | ||||
|          $i=0; $j=0; $data = ''; | ||||
|  | ||||
|          while(list($k, $v) = each($s)) { | ||||
|             if(strstr($v, $boundary)) { $i++; } | ||||
|             if($i > 0 && preg_match("/^\s{1,}$/", $v)) { $j++; } | ||||
|  | ||||
|             if($j == 1) { | ||||
|                $data .= "$v\n"; | ||||
|             } | ||||
|  | ||||
|             if($i >= 2) { break; }  | ||||
|          } | ||||
|  | ||||
|          $p = ''; | ||||
|  | ||||
|          $data = Piler_Mime_Decode::escape_lt_gt_symbols($data); | ||||
|       } | ||||
|  | ||||
|       return $data; | ||||
|    } | ||||
|  | ||||
|  | ||||
|    public function remove_journal(&$msg = '') { | ||||
|       $p = $q = ''; | ||||
|       $boundary = ''; | ||||
|       $has_journal = 0; | ||||
|  | ||||
|       $hdr = substr($msg, 0, 4096); | ||||
|  | ||||
|       $s = preg_split("/\n/", $hdr); | ||||
|       while(list($k, $v) = each($s)) { | ||||
|          if(preg_match("/boundary\s{0,}=\s{0,}\"{0,}([\w\_\-\@\.]+)\"{0,}/i", $v, $m)) { | ||||
|             if(isset($m[1])) { $boundary = $m[1]; break; } | ||||
|          } | ||||
|       } | ||||
|  | ||||
|       $p = strstr($msg, "\nX-MS-Journal-Report:"); | ||||
|  | ||||
|       if($p) { | ||||
|          $has_journal = 1; | ||||
|  | ||||
|          $msg = ''; | ||||
|          $q = strstr($p, "Received: from"); | ||||
|          if($q) { | ||||
|             $p = ''; | ||||
|             $msg = $q; | ||||
|             $q = ''; | ||||
|          } | ||||
|          else { | ||||
|             $msg = $p; | ||||
|             $p = ''; | ||||
|          } | ||||
|  | ||||
|          if($boundary) { | ||||
|             $msg = substr($msg, 0, strlen($msg) - strlen($boundary) - 6); | ||||
|          } | ||||
|       } | ||||
|  | ||||
|       return $has_journal; | ||||
|       return Piler_Mime_Decode::escape_lt_gt_symbols($journal); | ||||
|    } | ||||
|  | ||||
|  | ||||
| @@ -212,7 +137,7 @@ class ModelSearchMessage extends Model { | ||||
|  | ||||
|       $msg = $this->get_raw_message($id); | ||||
|  | ||||
|       $has_journal = $this->remove_journal($msg); | ||||
|       $has_journal = Piler_Mime_Decode::removeJournal($msg); | ||||
|  | ||||
|       Piler_Mime_Decode::splitMessage($msg, $headers, $body); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user