gui fixes

Change-Id: I5592a96f486f64404f044b2199e74284fd2e46fd
Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
SJ
2016-09-15 22:08:04 +02:00
parent 338571d299
commit 91fbeebc0f
4 changed files with 69 additions and 54 deletions

View File

@ -1,5 +1,7 @@
<?php
require 'Zend/Mime/Decode.php';
class ModelSearchMessage extends Model {
public $encoding_aliases = array(
@ -192,32 +194,24 @@ class ModelSearchMessage extends Model {
public function get_message_headers($id = '') {
$data = '';
$headers = '';
$this->connect_to_pilergetd();
$msg = $this->get_raw_message($id);
$this->disconnect_from_pilergetd();
$has_journal = $this->remove_journal($msg);
Zend_Mime_Decode::splitMessageRaw($msg, $headers, $body);
$has_journal = $this->remove_journal($headers);
if(Registry::get('auditor_user') == 0 && HEADER_LINE_TO_HIDE) {
$msg = preg_replace("/" . HEADER_LINE_TO_HIDE . ".{1,}(\n(\ |\t){1,}.{1,}){0,}" . "\n/i", "", $msg);
$headers = preg_replace("/" . HEADER_LINE_TO_HIDE . ".{1,}(\n(\ |\t){1,}.{1,}){0,}" . "\n/i", "", $headers);
}
$pos = strpos($msg, "\n\r\n");
if($pos == false) {
$pos = strpos($msg, "\n\n");
}
$headers = preg_replace("/\</", "&lt;", $headers);
$headers = preg_replace("/\>/", "&gt;", $headers);
if($pos == false) { return $msg; }
$data = substr($msg, 0, $pos);
$msg = '';
$data = preg_replace("/\</", "&lt;", $data);
$data = preg_replace("/\>/", "&gt;", $data);
return array('headers' => $data, 'has_journal' => $has_journal);
return array('headers' => $headers, 'has_journal' => $has_journal);
}