|
@@ -1000,8 +1000,10 @@ class EmailCollector extends CommonObject
|
|
|
} else {
|
|
|
// Nothing can be done for this param
|
|
|
$errorforthisaction++;
|
|
|
- $this->error = 'The extract rule to use has on an unknown source (must be HEADER, SUBJECT or BODY)';
|
|
|
+ $this->error = 'The extract rule to use to overwrite properties has on an unknown source (must be HEADER, SUBJECT or BODY)';
|
|
|
$this->errors[] = $this->error;
|
|
|
+
|
|
|
+ $operationslog .= '<br>'.$this->error;
|
|
|
}
|
|
|
} elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $regforregex)) {
|
|
|
$valuecurrent = '';
|
|
@@ -1754,7 +1756,15 @@ class EmailCollector extends CommonObject
|
|
|
//$htmlmsg,$plainmsg,$charset,$attachments
|
|
|
$messagetext = $plainmsg ? $plainmsg : dol_string_nohtmltag($htmlmsg, 0);
|
|
|
// Removed emojis
|
|
|
- $messagetext = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $messagetext);
|
|
|
+
|
|
|
+ if (utf8_valid($messagetext)) {
|
|
|
+ //$messagetext = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $messagetext);
|
|
|
+ $messagetext = $this->removeEmoji($messagetext);
|
|
|
+ } else {
|
|
|
+ $operationslog .= '<br>Discarded - Email body is not valid utf8';
|
|
|
+ dol_syslog(" Discarded - Email body is not valid utf8");
|
|
|
+ continue; // Exclude email
|
|
|
+ }
|
|
|
|
|
|
if ($searchfilterexcludebody) {
|
|
|
if (preg_match('/'.preg_quote($searchfilterexcludebody, '/').'/ms', $messagetext)) {
|
|
@@ -2268,8 +2278,10 @@ class EmailCollector extends CommonObject
|
|
|
} else {
|
|
|
// Nothing can be done for this param
|
|
|
$errorforactions++;
|
|
|
- $this->error = 'The extract rule to use to load thirdparty has an unknown source (must be HEADER, SUBJECT or BODY)';
|
|
|
+ $this->error = 'The extract rule to use to load thirdparty for email '.$msgid.' has an unknown source (must be HEADER, SUBJECT or BODY)';
|
|
|
$this->errors[] = $this->error;
|
|
|
+
|
|
|
+ $operationslog .= '<br>'.$this->error;
|
|
|
}
|
|
|
} elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $reg)) {
|
|
|
//if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $reg[1];
|
|
@@ -3499,4 +3511,24 @@ class EmailCollector extends CommonObject
|
|
|
|
|
|
return $subject;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Remove EMoji from email content
|
|
|
+ *
|
|
|
+ * @param string $text String to sanitize
|
|
|
+ * @return string Sanitized string
|
|
|
+ */
|
|
|
+ protected function removeEmoji($text)
|
|
|
+ {
|
|
|
+ // Supprimer les caractères emoji en utilisant une expression régulière
|
|
|
+ $text = preg_replace('/[\x{1F600}-\x{1F64F}]/u', '', $text);
|
|
|
+ $text = preg_replace('/[\x{1F300}-\x{1F5FF}]/u', '', $text);
|
|
|
+ $text = preg_replace('/[\x{1F680}-\x{1F6FF}]/u', '', $text);
|
|
|
+ $text = preg_replace('/[\x{2600}-\x{26FF}]/u', '', $text);
|
|
|
+ $text = preg_replace('/[\x{2700}-\x{27BF}]/u', '', $text);
|
|
|
+ $text = preg_replace('/[\x{1F900}-\x{1F9FF}]/u', '', $text);
|
|
|
+ $text = preg_replace('/[\x{1F1E0}-\x{1F1FF}]/u', '', $text);
|
|
|
+
|
|
|
+ return $text;
|
|
|
+ }
|
|
|
}
|