mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 02:31:58 +01:00
gui fixes
Change-Id: I5592a96f486f64404f044b2199e74284fd2e46fd Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
parent
338571d299
commit
91fbeebc0f
@ -92,6 +92,10 @@ class Zend_Mail_Protocol_Imap
|
|||||||
$errno = 0;
|
$errno = 0;
|
||||||
$errstr = '';
|
$errstr = '';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* http://stackoverflow.com/questions/32211301/ssl-error-ssl3-get-server-certificatecertificate-verify-failed
|
||||||
|
*/
|
||||||
|
|
||||||
$contextOptions = array(
|
$contextOptions = array(
|
||||||
'ssl' => array(
|
'ssl' => array(
|
||||||
'verify_peer' => false,
|
'verify_peer' => false,
|
||||||
|
@ -124,43 +124,7 @@ class Zend_Mime_Decode
|
|||||||
$message, &$headers, &$body, $EOL = Zend_Mime::LINEEND
|
$message, &$headers, &$body, $EOL = Zend_Mime::LINEEND
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// check for valid header at first line
|
self::splitMessageRaw($message, $headers, $body, $EOL);
|
||||||
$firstline = strtok($message, "\n");
|
|
||||||
if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) {
|
|
||||||
$headers = array();
|
|
||||||
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
|
|
||||||
$body = str_replace(
|
|
||||||
array(
|
|
||||||
"\r",
|
|
||||||
"\n"
|
|
||||||
), array(
|
|
||||||
'',
|
|
||||||
$EOL
|
|
||||||
), $message
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find an empty line between headers and body
|
|
||||||
// default is set new line
|
|
||||||
if (strpos($message, $EOL . $EOL)) {
|
|
||||||
list($headers, $body) = explode($EOL . $EOL, $message, 2);
|
|
||||||
// next is the standard new line
|
|
||||||
} else {
|
|
||||||
if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) {
|
|
||||||
list($headers, $body) = explode("\r\n\r\n", $message, 2);
|
|
||||||
// next is the other "standard" new line
|
|
||||||
} else {
|
|
||||||
if ($EOL != "\n" && strpos($message, "\n\n")) {
|
|
||||||
list($headers, $body) = explode("\n\n", $message, 2);
|
|
||||||
// at last resort find anything that looks like a new line
|
|
||||||
} else {
|
|
||||||
@list($headers, $body) =
|
|
||||||
@preg_split("%([\r\n]+)\\1%U", $message, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$headers = iconv_mime_decode_headers(
|
$headers = iconv_mime_decode_headers(
|
||||||
$headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR
|
$headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR
|
||||||
@ -273,4 +237,53 @@ class Zend_Mime_Decode
|
|||||||
{
|
{
|
||||||
return quoted_printable_decode($string);
|
return quoted_printable_decode($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
cut the original splitMessage() function to get the raw headers, SJ
|
||||||
|
*/
|
||||||
|
public static function splitMessageRaw(
|
||||||
|
$message, &$headers, &$body, $EOL = Zend_Mime::LINEEND
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// check for valid header at first line
|
||||||
|
$firstline = strtok($message, "\n");
|
||||||
|
if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) {
|
||||||
|
$headers = array();
|
||||||
|
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
|
||||||
|
$body = str_replace(
|
||||||
|
array(
|
||||||
|
"\r",
|
||||||
|
"\n"
|
||||||
|
), array(
|
||||||
|
'',
|
||||||
|
$EOL
|
||||||
|
), $message
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find an empty line between headers and body
|
||||||
|
// default is set new line
|
||||||
|
if (strpos($message, $EOL . $EOL)) {
|
||||||
|
list($headers, $body) = explode($EOL . $EOL, $message, 2);
|
||||||
|
// next is the standard new line
|
||||||
|
} else {
|
||||||
|
if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) {
|
||||||
|
list($headers, $body) = explode("\r\n\r\n", $message, 2);
|
||||||
|
// next is the other "standard" new line
|
||||||
|
} else {
|
||||||
|
if ($EOL != "\n" && strpos($message, "\n\n")) {
|
||||||
|
list($headers, $body) = explode("\n\n", $message, 2);
|
||||||
|
// at last resort find anything that looks like a new line
|
||||||
|
} else {
|
||||||
|
@list($headers, $body) =
|
||||||
|
@preg_split("%([\r\n]+)\\1%U", $message, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require 'Zend/Mime/Decode.php';
|
||||||
|
|
||||||
class ModelSearchMessage extends Model {
|
class ModelSearchMessage extends Model {
|
||||||
|
|
||||||
public $encoding_aliases = array(
|
public $encoding_aliases = array(
|
||||||
@ -192,32 +194,24 @@ class ModelSearchMessage extends Model {
|
|||||||
|
|
||||||
|
|
||||||
public function get_message_headers($id = '') {
|
public function get_message_headers($id = '') {
|
||||||
$data = '';
|
$headers = '';
|
||||||
|
|
||||||
$this->connect_to_pilergetd();
|
$this->connect_to_pilergetd();
|
||||||
$msg = $this->get_raw_message($id);
|
$msg = $this->get_raw_message($id);
|
||||||
$this->disconnect_from_pilergetd();
|
$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) {
|
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");
|
$headers = preg_replace("/\</", "<", $headers);
|
||||||
if($pos == false) {
|
$headers = preg_replace("/\>/", ">", $headers);
|
||||||
$pos = strpos($msg, "\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if($pos == false) { return $msg; }
|
return array('headers' => $headers, 'has_journal' => $has_journal);
|
||||||
|
|
||||||
$data = substr($msg, 0, $pos);
|
|
||||||
$msg = '';
|
|
||||||
|
|
||||||
$data = preg_replace("/\</", "<", $data);
|
|
||||||
$data = preg_replace("/\>/", ">", $data);
|
|
||||||
|
|
||||||
return array('headers' => $data, 'has_journal' => $has_journal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -350,7 +350,11 @@ class ModelUserAuth extends Model {
|
|||||||
$session = Registry::get('session');
|
$session = Registry::get('session');
|
||||||
$emails = array($username);
|
$emails = array($username);
|
||||||
|
|
||||||
if(!strchr($username, '@')) { return 0; }
|
/*
|
||||||
|
* usernames without the domain part are allowed, though
|
||||||
|
* they won't see any emails unless a post auth hook is run
|
||||||
|
* to assign some email addresses to them
|
||||||
|
*/
|
||||||
|
|
||||||
$login = $username;
|
$login = $username;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user