Commit 4c24fbf7 authored by Alex ORLUC's avatar Alex ORLUC

Merge branch 'develop' into 'master'

Develop

See merge request !22
parents 14ad3bd5 72035964
......@@ -19,8 +19,8 @@ before_script:
- bash ci/docker_install_mail_server.sh > /dev/null
- bash ci/send_simple_mail.sh > /dev/null
job_php-7.1:
image: php:7.1-apache
job_php-7.3:
image: php:7.3-apache
stage: test
script:
- mkdir -p /opt/maarch/
......
......@@ -48,7 +48,9 @@ class Response
}
// Get the protocol version from apache server
$protocol = strtok($_SERVER['SERVER_PROTOCOL'], '/');
if (isset($_SERVER['SERVER_PROTOCOL'])) {
$protocol = strtok($_SERVER['SERVER_PROTOCOL'], '/');
}
$this->protocolVersion = strtok('');
}
......
......@@ -72,13 +72,17 @@ class MaarchWSClient extends DOMXPath
if ($WSConfig->hasAttribute('cacheUse')) {
$cacheUse = $WSConfig->getAttribute('cacheUse');
} else {
$cacheUse = WSDL_CACHE_USE;
if (defined('WSDL_CACHE_USE')) {
$cacheUse = WSDL_CACHE_USE;
}
}
if ($WSConfig->hasAttribute('cacheMaxAge')) {
$cacheMaxAge = $WSConfig->getAttribute('cacheMaxAge');
} else {
$cacheMaxAge = WSDL_CACHE_MAX_AGE;
if (defined('WSDL_CACHE_MAX_AGE')) {
$cacheMaxAge = WSDL_CACHE_MAX_AGE;
}
}
$SSL = $WSConfig->getAttribute('SSL');
......@@ -168,7 +172,7 @@ class MaarchWSClient extends DOMXPath
$parentInstruction
);
$l = $instructions->length;
if ($this->log) {
if (isset($this->log) && $this->log) {
$_SESSION['capture']->logEvent("Process $l instructions on "
. $Element->nodeName . " " . $Element->id);
}
......@@ -217,7 +221,7 @@ class MaarchWSClient extends DOMXPath
) {
$serviceName = $service->getAttribute('name');
if ($this->log) {
if (isset($this->log) && $this->log) {
$_SESSION['capture']->logEvent("Process Call of service '"
. $serviceName . "' for " . $Element->nodeName . " " . $Element->id);
}
......@@ -272,7 +276,7 @@ class MaarchWSClient extends DOMXPath
$args,
$serviceMethod = "GET"
) {
if ($this->log) {
if (isset($this->log) && $this->log) {
$_SESSION['capture']->logEvent("Call service '" . $serviceName . "'...");
}
......
......@@ -1139,7 +1139,7 @@ class MailCapture
switch(strtoupper($part->disposition)) {
case 'BODY':
$isThereAnyBodyHere = true;
if($html_body) continue;
if($html_body) break;
$this->writeLog("Disposition is BODY");
if($part->subtype == 'html') {
$this->createHtml($part);
......@@ -1148,7 +1148,7 @@ class MailCapture
elseif ($part->subtype == 'plain') {
$plain_body = true;
}
if(!$Document && ($html_body || $plain_body)) {
if(!isset($Document) && ($html_body || $plain_body)) {
$content = file_get_contents($part->filepath);
if ( empty($content) ) {
echo "ERROR: file_get_contents({$part->filepath}) failed\n";
......@@ -1219,7 +1219,10 @@ class MailCapture
$metadatas_doc_date = $doc->createElement("p", "");
$body->item(0)->insertBefore($metadatas_doc_date, $body->item(0)->firstChild);
$body->item(0)->insertBefore($metadatas_doc_date, $body->item(0)->firstChild);
if($metadatas_doc_date !== $body->item(0)->firstChild) {
//$newnode->parentNode->insertBefore( $newnode, $firstSibling );
$body->item(0)->insertBefore($metadatas_doc_date, $body->item(0)->firstChild);
}
$metadatas_ccaddress = $doc->createElement("div", "Cc : ".$ccaddress);
$body->item(0)->insertBefore($metadatas_ccaddress, $body->item(0)->firstChild);
......@@ -1336,7 +1339,7 @@ class MailCapture
"Attachment part ".$part->section." (mimetype ".$part->mimetype.", extension ".$part->extension.") excluded by rule..."
);
continue 2;
break 2;
}
}
......@@ -1550,7 +1553,7 @@ class MailCapture
#*********************************************************************
if($part->subtype == 'plain')
$part->extension = 'txt';
else if(is_array($part->dparameters) && isset($part->dparameters['filename']))
else if(isset($part->dparameters) && is_array($part->dparameters) && isset($part->dparameters['filename']))
$part->extension = substr(strrchr($part->dparameters['filename'], '.'), 1);
else if(is_array($part->parameters) && isset($part->parameters['name']))
$part->extension = substr(strrchr($part->parameters['name'], '.'), 1);
......@@ -1767,8 +1770,10 @@ class MailCapture
$infopath = explode('/', $info);
$value = $structure;
foreach($infopath as $infostep) {
//echo "eval " . '$value = $value->' . $infostep . ";" . PHP_EOL;
eval('$value = $value->' . $infostep . ";");
if (isset($value->$infostep)) {
//echo "eval " . '$value = $value->' . $infostep . ";" . PHP_EOL;
eval('$value = $value->' . $infostep . ";");
}
}
if(is_scalar($value)) {
......
......@@ -158,7 +158,7 @@ class LoggerPatternParser {
// In literal state, the last char is always a literal.
if($this->i == $this->patternLength) {
$this->currentLiteral .= $c;
continue;
break;
}
if($c == self::ESCAPE_CHAR) {
// peek at the next char.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment