Fix: EMail test feature to make a test without html must not include any

html.
This commit is contained in:
Laurent Destailleur 2014-06-21 01:26:41 +02:00
parent 5fd6bb94b9
commit 5c0813e865
3 changed files with 21 additions and 6 deletions

View File

@ -33,20 +33,28 @@ $langs->load("mails");
$langs->load("other"); $langs->load("other");
$langs->load("errors"); $langs->load("errors");
$action=GETPOST('action','alpha');
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
$usersignature=$user->signature;
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
if ($action == 'test' || $action == 'send')
{
$usersignature=dol_string_nohtmltag($usersignature);
}
$substitutionarrayfortest=array( $substitutionarrayfortest=array(
'__LOGIN__' => $user->login, '__LOGIN__' => $user->login,
'__ID__' => 'TESTIdRecord', '__ID__' => 'TESTIdRecord',
'__EMAIL__' => 'TESTEMail', '__EMAIL__' => 'TESTEMail',
'__LASTNAME__' => 'TESTLastname', '__LASTNAME__' => 'TESTLastname',
'__FIRSTNAME__' => 'TESTFirstname', '__FIRSTNAME__' => 'TESTFirstname',
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''), '__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''),
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet //'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
); );
complete_substitutions_array($substitutionarrayfortest, $langs); complete_substitutions_array($substitutionarrayfortest, $langs);
$action=GETPOST('action');
/* /*

View File

@ -102,7 +102,7 @@ class FormMail
$this->withfilereadonly=0; $this->withfilereadonly=0;
$this->withbodyreadonly=0; $this->withbodyreadonly=0;
$this->withdeliveryreceiptreadonly=0; $this->withdeliveryreceiptreadonly=0;
$this->withfckeditor=0; $this->withfckeditor=-1; // -1 = Auto
return 1; return 1;
} }
@ -619,9 +619,12 @@ class FormMail
// Editor wysiwyg // Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { if ($this->withfckeditor == -1)
$this->withfckeditor=1; {
if (! empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $this->withfckeditor=1;
else $this->withfckeditor=0;
} }
$doleditor=new DolEditor('message',$defaultmessage,'',280,$this->ckeditortoolbar,'In',true,true,$this->withfckeditor,8,72); $doleditor=new DolEditor('message',$defaultmessage,'',280,$this->ckeditortoolbar,'In',true,true,$this->withfckeditor,8,72);
$out.= $doleditor->Create(1); $out.= $doleditor->Create(1);
} }

View File

@ -457,6 +457,8 @@ function dol_escape_js($stringtoescape, $mode=0)
* @param string $stringtoescape String to escape * @param string $stringtoescape String to escape
* @param int $keepb Do not clean b tags * @param int $keepb Do not clean b tags
* @return string Escaped string * @return string Escaped string
*
* @see dol_string_nohtmltag
*/ */
function dol_escape_htmltag($stringtoescape,$keepb=0) function dol_escape_htmltag($stringtoescape,$keepb=0)
{ {
@ -3436,6 +3438,8 @@ function picto_required()
* @param string $removelinefeed Replace also all lines feeds by a space, otherwise only last one are removed * @param string $removelinefeed Replace also all lines feeds by a space, otherwise only last one are removed
* @param string $pagecodeto Encoding of input/output string * @param string $pagecodeto Encoding of input/output string
* @return string String cleaned * @return string String cleaned
*
* @see dol_escape_htmltag
*/ */
function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8') function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
{ {