Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
e20818f9ed
@ -751,6 +751,7 @@ else
|
||||
$formmail->withcancel=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withfckeditor=1;
|
||||
$formmail->ckeditortoolbar='dolibarr_mailings';
|
||||
// Tableau des substitutions
|
||||
$formmail->substit=$substitutionarrayfortest;
|
||||
// Tableau des parametres complementaires du post
|
||||
|
||||
@ -369,7 +369,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
dol_syslog($db->error());
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -561,7 +561,7 @@ if ($action == 'confirm_valid' && $confirm == 'yes')
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->valid($user);
|
||||
|
||||
|
||||
$_SESSION['DolMessage']='<div class="ok">'.$langs->trans("MailingSuccessfullyValidated").'</div>';
|
||||
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
@ -650,7 +650,7 @@ if ($action == 'create')
|
||||
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>';
|
||||
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>';
|
||||
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td><input class="flat" name="errorsto" size="40" value="'.(!empty($conf->global->MAILING_EMAIL_ERRORSTO)?$conf->global->MAILING_EMAIL_ERRORSTO:$conf->global->MAIN_MAIL_ERRORS_TO).'"></td></tr>';
|
||||
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -664,7 +664,7 @@ if ($action == 'create')
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</br><br>';
|
||||
|
||||
@ -773,12 +773,12 @@ else
|
||||
|
||||
// From
|
||||
print '<tr><td>'.$form->editfieldkey("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
|
||||
print $form->editfieldval("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'email');
|
||||
print $form->editfieldval("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'string');
|
||||
print '</td></tr>';
|
||||
|
||||
// Errors to
|
||||
print '<tr><td>'.$form->editfieldkey("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
|
||||
print $form->editfieldval("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'email');
|
||||
print $form->editfieldval("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string');
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
@ -808,7 +808,7 @@ else
|
||||
print $nbemail;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -860,7 +860,7 @@ else
|
||||
}
|
||||
|
||||
//print '<a class="butAction" href="fiche.php?action=test&id='.$object->id.'">'.$langs->trans("PreviewMailing").'</a>';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("TestMailing").'</a>';
|
||||
@ -1042,7 +1042,7 @@ else
|
||||
print $nbemail;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -664,17 +664,14 @@ class CMailFile
|
||||
|
||||
$out='';
|
||||
|
||||
$out.= "--" . $this->mixed_boundary . $this->eol;
|
||||
|
||||
if ($this->atleastoneimage)
|
||||
{
|
||||
$out.= "--" . $this->mixed_boundary . $this->eol;
|
||||
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
||||
$out.= $this->eol;
|
||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= "--" . $this->mixed_boundary . $this->eol;
|
||||
}
|
||||
|
||||
if ($this->msgishtml)
|
||||
{
|
||||
|
||||
@ -597,6 +597,8 @@ class FormMail
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! isset($this->ckeditortoolbar)) $this->ckeditortoolbar = 'dolibarr_notes';
|
||||
|
||||
if(! empty($conf->global->MAIL_USE_SIGN) && $this->fromid > 0)
|
||||
{
|
||||
$fuser=new User($this->db);
|
||||
@ -609,7 +611,7 @@ class FormMail
|
||||
|
||||
// Editor wysiwyg
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('message',$defaultmessage,'',280,'dolibarr_notes','In',true,false,$this->withfckeditor,8,72);
|
||||
$doleditor=new DolEditor('message',$defaultmessage,'',280,$this->ckeditortoolbar,'In',true,true,$this->withfckeditor,8,72);
|
||||
$out.= $doleditor->Create(1);
|
||||
}
|
||||
$out.= "</td></tr>\n";
|
||||
|
||||
@ -165,6 +165,16 @@ class SMTPs
|
||||
*/
|
||||
var $_smtpsBoundary = null;
|
||||
|
||||
/**
|
||||
* Related Boundary
|
||||
*/
|
||||
var $_smtpsRelatedBoundary = null;
|
||||
|
||||
/**
|
||||
* Alternative Boundary
|
||||
*/
|
||||
var $_smtpsAlternativeBoundary = null;
|
||||
|
||||
/**
|
||||
* Determines the method inwhich the message are to be sent.
|
||||
* - 'sockets' [0] - conect via network to SMTP server - default
|
||||
@ -1202,13 +1212,22 @@ class SMTPs
|
||||
* TODO Investigate "nested" boundary message parts
|
||||
*/
|
||||
//$content = 'Content-Type: multipart/related; boundary="' . $this->_getBoundary() . '"' . "\r\n";
|
||||
$content = 'Content-Type: multipart/mixed; boundary="' . $this->_getBoundary() . '"' . "\r\n";
|
||||
$content = 'Content-Type: multipart/mixed; boundary="' . $this->_getBoundary('mixed') . '"' . "\r\n";
|
||||
|
||||
// . "\r\n"
|
||||
// . 'This is a multi-part message in MIME format.' . "\r\n";
|
||||
$content .= "Content-Transfer-Encoding: 8bit\r\n";
|
||||
$content .= "\r\n";
|
||||
|
||||
$content .= "--" . $this->_getBoundary('mixed') . "\r\n";
|
||||
|
||||
if (key_exists('image', $this->_msgContent))
|
||||
{
|
||||
$content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
|
||||
$content .= "\r\n";
|
||||
$content .= "--" . $this->_getBoundary('alternative') . "\r\n";
|
||||
}
|
||||
|
||||
// Loop through message content array
|
||||
foreach ($this->_msgContent as $type => $_content )
|
||||
{
|
||||
@ -1217,7 +1236,7 @@ class SMTPs
|
||||
// loop through all attachments
|
||||
foreach ( $_content as $_file => $_data )
|
||||
{
|
||||
$content .= "--" . $this->_getBoundary() . "\r\n"
|
||||
$content .= "--" . $this->_getBoundary('mixed') . "\r\n"
|
||||
. 'Content-Disposition: attachment; filename="' . $_data['fileName'] . '"' . "\r\n"
|
||||
. 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['fileName'] . '"' . "\r\n"
|
||||
. 'Content-Transfer-Encoding: base64' . "\r\n"
|
||||
@ -1235,7 +1254,7 @@ class SMTPs
|
||||
// loop through all images
|
||||
foreach ( $_content as $_image => $_data )
|
||||
{
|
||||
$content .= "--" . $this->_getBoundary() . "\r\n";
|
||||
$content .= "--" . $this->_getBoundary('related') . "\r\n"; // always related for an inline image
|
||||
|
||||
$content .= 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['imageName'] . '"' . "\r\n"
|
||||
. 'Content-Transfer-Encoding: base64' . "\r\n"
|
||||
@ -1248,11 +1267,25 @@ class SMTPs
|
||||
$content .= "\r\n"
|
||||
. $_data['data'] . "\r\n";
|
||||
}
|
||||
|
||||
// always end related and end alternative after inline images
|
||||
$content.= "--" . $this->_getBoundary('related') . "--" . "\r\n";
|
||||
$content.= "\r\n" . "--" . $this->_getBoundary('alternative') . "--" . "\r\n";
|
||||
$content.= "\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$content .= "--" . $this->_getBoundary() . "\r\n"
|
||||
. 'Content-Type: ' . $_content['mimeType'] . '; '
|
||||
if (key_exists('image', $this->_msgContent))
|
||||
{
|
||||
$content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
|
||||
$content.= "\r\n" . strip_tags($_content['data']) . "\r\n"; // Add plain text message
|
||||
$content.= "--" . $this->_getBoundary('alternative') . "\r\n";
|
||||
$content.= 'Content-Type: multipart/related; boundary="' . $this->_getBoundary('related') . '"' . "\r\n";
|
||||
$content.= "\r\n";
|
||||
$content.= "--" . $this->_getBoundary('related') . "\r\n";
|
||||
}
|
||||
|
||||
$content .= 'Content-Type: ' . $_content['mimeType'] . '; '
|
||||
// . 'charset="' . $this->getCharSet() . '"';
|
||||
. 'charset=' . $this->getCharSet() . '';
|
||||
|
||||
@ -1273,7 +1306,7 @@ class SMTPs
|
||||
|
||||
// Close message boundries
|
||||
// $content .= "\r\n--" . $this->_getBoundary() . '--' . "\r\n" ;
|
||||
$content .= "--" . $this->_getBoundary() . '--' . "\r\n" ;
|
||||
$content .= "--" . $this->_getBoundary('mixed') . '--' . "\r\n" ;
|
||||
}
|
||||
|
||||
return $content;
|
||||
@ -1457,6 +1490,8 @@ class SMTPs
|
||||
function _setBoundary()
|
||||
{
|
||||
$this->_smtpsBoundary = "multipart_x." . time() . ".x_boundary";
|
||||
$this->_smtpsRelatedBoundary = 'mul_'.dol_hash(uniqid("dolibarr2"));
|
||||
$this->_smtpsAlternativeBoundary = 'mul_'.dol_hash(uniqid("dolibarr3"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1464,9 +1499,11 @@ class SMTPs
|
||||
*
|
||||
* @return string $_smtpsBoundary MIME message Boundary
|
||||
*/
|
||||
function _getBoundary()
|
||||
function _getBoundary($type='mixed')
|
||||
{
|
||||
return $this->_smtpsBoundary;
|
||||
if ($type == 'mixed') return $this->_smtpsBoundary;
|
||||
else if ($type == 'related') return $this->_smtpsRelatedBoundary;
|
||||
else if ($type == 'alternative') return $this->_smtpsAlternativeBoundary;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user