From bd90d7979dd34871134dc05fa2189ed4be55c79d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Nov 2012 17:42:37 +0100 Subject: [PATCH] Qual: Removed duplicate code Qual: Removed deprecated warning --- htdocs/admin/mails.php | 66 +++++++----------------------------------- 1 file changed, 10 insertions(+), 56 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 6d869ba7a78..eddb3b7c859 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -591,19 +591,19 @@ else print ''; - // Warning 1 if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') { print '
'; + /* + // Warning 1 if ($linuxlike) { $sendmailoption=ini_get('mail.force_extra_parameters'); - //print 'x'.$sendmailoption; if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption)) { print info_admin($langs->trans("SendmailOptionNotComplete")); } - } + }*/ // Warning 2 print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA")); } @@ -657,11 +657,11 @@ else print '
'; } - // Affichage formulaire de TEST simple - if ($action == 'test') + // Show email send test form + if ($action == 'test' || $action == 'testhtml') { print '
'; - print_titre($langs->trans("DoTestSend")); + print_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend")); // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; @@ -678,62 +678,16 @@ else $formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test")); $formmail->withtopicreadonly=0; $formmail->withfile=2; - $formmail->withbody=(isset($_POST['message'])?$_POST['message']:$langs->trans("PredefinedMailTest")); + $formmail->withbody=(isset($_POST['message'])?$_POST['message']:($action == 'testhtml'?$langs->trans("PredefinedMailTestHtml"):$langs->trans("PredefinedMailTest"))); $formmail->withbodyreadonly=0; $formmail->withcancel=1; $formmail->withdeliveryreceipt=1; - $formmail->withfckeditor=0; - // Tableau des substitutions - $formmail->substit=$substitutionarrayfortest; - // Tableau des parametres complementaires du post - $formmail->param["action"]="send"; - $formmail->param["models"]="body"; - $formmail->param["mailid"]=0; - $formmail->param["returnurl"]=$_SERVER["PHP_SELF"]; - - // Init list of files - if (GETPOST("mode")=='init') - { - $formmail->clear_attached_files(); - } - - $formmail->show_form('addfile','removefile'); - - print '
'; - } - - // Affichage formulaire de TEST HTML - if ($action == 'testhtml') - { - print '
'; - print_titre($langs->trans("DoTestSendHTML")); - - // Cree l'objet formulaire mail - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - $formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM); - $formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM); - $formmail->withfromreadonly=0; - $formmail->withsubstit=0; - $formmail->withfrom=1; - $formmail->witherrorsto=1; - $formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email:1)); - $formmail->withtocc=(! empty($_POST['sendtocc'])?$_POST['sendtocc']:1); // ! empty to keep field if empty - $formmail->withtoccc=(! empty($_POST['sendtoccc'])?$_POST['sendtoccc']:1); // ! empty to keep field if empty - $formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test")); - $formmail->withtopicreadonly=0; - $formmail->withfile=2; - $formmail->withbody=(isset($_POST['message'])?$_POST['message']:$langs->trans("PredefinedMailTestHtml")); - //$formmail->withbody='Test aaa __LOGIN__'; - $formmail->withbodyreadonly=0; - $formmail->withcancel=1; - $formmail->withdeliveryreceipt=1; - $formmail->withfckeditor=1; + $formmail->withfckeditor=($action == 'testhtml'?1:0); $formmail->ckeditortoolbar='dolibarr_mailings'; // Tableau des substitutions $formmail->substit=$substitutionarrayfortest; // Tableau des parametres complementaires du post - $formmail->param["action"]="sendhtml"; + $formmail->param["action"]=($action == 'testhtml'?"sendhtml":"send"); $formmail->param["models"]="body"; $formmail->param["mailid"]=0; $formmail->param["returnurl"]=$_SERVER["PHP_SELF"]; @@ -744,7 +698,7 @@ else $formmail->clear_attached_files(); } - $formmail->show_form('addfilehtml','removefilehtml'); + $formmail->show_form(($action == 'testhtml'?'addfilehtml':'addfile'),($action == 'testhtml'?'removefilehtml':'removefile')); print '
'; }