autoloader for egulias lib needed by swiftmailer
This commit is contained in:
parent
359f2c6e81
commit
8c23b41f9a
@ -352,71 +352,55 @@ class CMailFile
|
|||||||
elseif ($this->sendmode == 'swiftmailer')
|
elseif ($this->sendmode == 'swiftmailer')
|
||||||
{
|
{
|
||||||
// Use Swift Mailer library
|
// Use Swift Mailer library
|
||||||
// ------------------------------------------
|
|
||||||
|
|
||||||
$host = dol_getprefix('email');
|
$host = dol_getprefix('email');
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Exception/InvalidEmail.php';
|
// egulias autoloader lib
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Exception/NoDomainPart.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/autoload.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailParser.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailLexer.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailValidator.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/Warning.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/Parser.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/DomainPart.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/LocalPart.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/EmailValidation.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/RFCValidation.php';
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/InputByteStream.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/Signer.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php';
|
// Create the message
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php';
|
//$this->message = Swift_Message::newInstance();
|
||||||
//require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/SignedMessage.php';
|
$this->message = new Swift_Message();
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
|
||||||
// Create the message
|
|
||||||
//$this->message = Swift_Message::newInstance();
|
|
||||||
$this->message = new Swift_Message();
|
|
||||||
//$this->message = new Swift_SignedMessage();
|
//$this->message = new Swift_SignedMessage();
|
||||||
// Adding a trackid header to a message
|
// Adding a trackid header to a message
|
||||||
$headers = $this->message->getHeaders();
|
$headers = $this->message->getHeaders();
|
||||||
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid . '@' . $host);
|
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid . '@' . $host);
|
||||||
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host;
|
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host;
|
||||||
$msgid = $headers->get('Message-ID');
|
$msgid = $headers->get('Message-ID');
|
||||||
$msgid->setId($headerID);
|
$msgid->setId($headerID);
|
||||||
$headers->addIdHeader('References', $headerID);
|
$headers->addIdHeader('References', $headerID);
|
||||||
// TODO if (! empty($moreinheader)) ...
|
// TODO if (! empty($moreinheader)) ...
|
||||||
|
|
||||||
// Give the message a subject
|
// Give the message a subject
|
||||||
try {
|
try {
|
||||||
$result = $this->message->setSubject($subject);
|
$result = $this->message->setSubject($subject);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the From address with an associative array
|
// Set the From address with an associative array
|
||||||
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
|
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
|
||||||
if (! empty($from)) {
|
if (! empty($from)) {
|
||||||
try {
|
try {
|
||||||
$result = $this->message->setFrom($this->getArrayAddress($from));
|
$result = $this->message->setFrom($this->getArrayAddress($from));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the To addresses with an associative array
|
// Set the To addresses with an associative array
|
||||||
if (! empty($to)) {
|
if (! empty($to)) {
|
||||||
try {
|
try {
|
||||||
$result = $this->message->setTo($this->getArrayAddress($to));
|
$result = $this->message->setTo($this->getArrayAddress($to));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($replyto)) {
|
if (! empty($replyto)) {
|
||||||
try {
|
try {
|
||||||
$result = $this->message->SetReplyTo($this->getArrayAddress($replyto));
|
$result = $this->message->SetReplyTo($this->getArrayAddress($replyto));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -424,16 +408,14 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$result = $this->message->setCharSet($conf->file->character_set_client);
|
$result = $this->message->setCharSet($conf->file->character_set_client);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($this->html))
|
if (! empty($this->html)) {
|
||||||
{
|
if (!empty($css)) {
|
||||||
if (!empty($css))
|
|
||||||
{
|
|
||||||
$this->css = $css;
|
$this->css = $css;
|
||||||
$this->buildCSS();
|
$this->buildCSS();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,11 +183,11 @@ class FormFile
|
|||||||
else {
|
else {
|
||||||
$rename='checked';
|
$rename='checked';
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= '<tr>';
|
$out .= '<tr>';
|
||||||
if (! empty($options)) $out .= '<td>'.$options.'</td>';
|
if (! empty($options)) $out .= '<td>'.$options.'</td>';
|
||||||
$out .= '<td valign="middle" class="nowrap">';
|
$out .= '<td valign="middle" class="nowrap">';
|
||||||
$out .= '<input type="checkbox" '.$rename.' class="savingdocmask" name="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/',$langs->transnoentitiesnoconv("OriginFileName"),$savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
|
$out .= '<input type="checkbox" '.$rename.' class="savingdocmask" name="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/', $langs->transnoentitiesnoconv("OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
|
||||||
$out .= '</td>';
|
$out .= '</td>';
|
||||||
$out .= '</tr>';
|
$out .= '</tr>';
|
||||||
}
|
}
|
||||||
@ -1571,7 +1571,7 @@ class FormFile
|
|||||||
{
|
{
|
||||||
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');
|
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $id && ! $ref) continue;
|
if (! $id && ! $ref) continue;
|
||||||
$found=0;
|
$found=0;
|
||||||
if (! empty($this->cache_objects[$modulepart.'_'.$id.'_'.$ref]))
|
if (! empty($this->cache_objects[$modulepart.'_'.$id.'_'.$ref]))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user