Bonjour,

Je ne sais pas si c'est l'endroit adéquat, je vous soumets mes modifications concernant le bug#9705 concernant un pb d'interpretation lors de la création d'un email via le mailing adherents. Cette modif prends en compte les magic quotes, les retours à la ligne et la prévisualisation des mails html (auparavant les codes html créés étaient sniffés chez moi lors de l'edit d'un message déjà prévisualisé).


NB: la version utilisée et la 0.63 bugfix. Je vous joins également les fichiers modifiés.

En ésperant que ça fasse avancer le schmilblick pour une v.0.63 finale ;)

Cordialement,

Kevin Klein

Les fichiers modifiés sont: mailing_adherents.php et mailing_adhrents.tpl

Modifs mailing adherents.php

   * Lignes 76 à 94 supprimées et remplacées par:

if (isset($_POST["mailing_go"]) || isset($_POST["mailing_reset"]) || isset($_POST["mailing_confirm"]))
   {
       if ($_POST['mailing_objet']=="")
$error_detected[] = _T("Please type an object for the message.");
       else
           If (get_magic_quotes_gpc()==1) {
$data['mailing_objet']=htmlentities(stripslashes($_POST['mailing_objet'])); $data['mailing_objet_to_send']=html_entity_decode($data['mailing_objet']);
           } else {
$data['mailing_objet']=htmlentities($_POST['mailing_objet']); $data['mailing_objet_to_send']=html_entity_decode($data['mailing_objet']);
           }

       if ($_POST['mailing_corps']=="") {
           $error_detected[] = _T("Please enter a message.");
       } else {
           #si le mail est en html
           if (isset($_POST['mailing_html'])) {
               $data['mailing_html']=$_POST['mailing_html'];
               If (get_magic_quotes_gpc()==1) {
$data['mailing_corps'] = htmlentities(stripslashes($_POST['mailing_corps'])); $data['mailing_corps_display']=nl2br(html_entity_decode($data['mailing_corps'])); $data['mailing_corps_to_send']=$data['mailing_corps_display'];
               } else {
$data['mailing_corps'] = htmlentities($_POST['mailing_corps']); $data['mailing_corps_display']=nl2br(html_entity_decode($data['mailing_corps'])); $data['mailing_corps_to_send']=$data['mailing_corps_display'];
               }
           } else {
               #si le mail est en texte
               $data['mailing_html']=0;
               If (get_magic_quotes_gpc()==1) {
$data['mailing_corps'] = htmlentities(stripslashes($_POST['mailing_corps']));
                   $data['mailing_corps_display']=$data['mailing_corps'];
$data['mailing_corps_to_send']=html_entity_decode($data['mailing_corps_display']);
               } else {
$data['mailing_corps'] = htmlentities($_POST['mailing_corps']);
                   $data['mailing_corps_display']=$data['mailing_corps'];
$data['mailing_corps_to_send']=html_entity_decode($data['mailing_corps_display']);
               }
           }
       }

   * Lignes 120 et 121 supprimée et remplacées par:

$data['mailing_objet_to_send'],
$data['mailing_corps_to_send'],


Modif faite dans mailing_adherents.tpl:

   * Lignes 55 à 59 supprimée et remplacées par:

<pre>{$data.mailing_corps_display}</pre>


Execute($sql); while (!$result_members->EOF) { if ($result_members->fields[1]=='') $unreachable_members[]=$result_members->fields[0]; else $reachable_members[]=$result_members->fields[0]; $result_members->MoveNext(); } if (isset($_POST["mailing_done"])) header("location: gestion_adherents.php"); $etape = 0; if (isset($_POST["mailing_go"]) || isset($_POST["mailing_reset"]) || isset($_POST["mailing_confirm"])) { if ($_POST['mailing_objet']=="") $error_detected[] = _T("Please type an object for the message."); else If (get_magic_quotes_gpc()==1) { $data['mailing_objet']=htmlentities(stripslashes($_POST['mailing_objet'])); $data['mailing_objet_to_send']=html_entity_decode($data['mailing_objet']); } else { $data['mailing_objet']=htmlentities($_POST['mailing_objet']); $data['mailing_objet_to_send']=html_entity_decode($data['mailing_objet']); } if ($_POST['mailing_corps']=="") { $error_detected[] = _T("Please enter a message."); } else { #si le mail est en html if (isset($_POST['mailing_html'])) { $data['mailing_html']=$_POST['mailing_html']; If (get_magic_quotes_gpc()==1) { $data['mailing_corps'] = htmlentities(stripslashes($_POST['mailing_corps'])); $data['mailing_corps_display']=nl2br(html_entity_decode($data['mailing_corps'])); $data['mailing_corps_to_send']=$data['mailing_corps_display']; } else { $data['mailing_corps'] = htmlentities($_POST['mailing_corps']); $data['mailing_corps_display']=nl2br(html_entity_decode($data['mailing_corps'])); $data['mailing_corps_to_send']=$data['mailing_corps_display']; } } else { #si le mail est en texte $data['mailing_html']=0; If (get_magic_quotes_gpc()==1) { $data['mailing_corps'] = htmlentities(stripslashes($_POST['mailing_corps'])); $data['mailing_corps_display']=$data['mailing_corps']; $data['mailing_corps_to_send']=html_entity_decode($data['mailing_corps_display']); } else { $data['mailing_corps'] = htmlentities($_POST['mailing_corps']); $data['mailing_corps_display']=$data['mailing_corps']; $data['mailing_corps_to_send']=html_entity_decode($data['mailing_corps_display']); } } } if (count($error_detected)==0 && !isset($_POST["mailing_reset"])) $etape = 1; } if (isset($_POST["mailing_confirm"]) && count($error_detected)==0) { $etape = 2; $member_id_string = ""; foreach ($reachable_members as $id_adh) $member_id_string .= $id_adh.","; $member_id_string = substr($member_id_string,0,-1); // TODO : interpret cutom tags to include personal data in mails $sql = "SELECT id_adh, email_adh, nom_adh, prenom_adh FROM ".PREFIX_DB."adherents WHERE id_adh IN ($member_id_string)"; $result_members = &$DB->Execute($sql); if ($data['mailing_html']==0) $content_type = "text/plain"; else $content_type = "text/html"; $mail_result = ""; $email_adh = ""; while (!$result_members->EOF) { $mail_result = custom_mail($result_members->fields[1], $data['mailing_objet_to_send'], $data['mailing_corps_to_send'], $content_type); if( $mail_result == 1) { $email_adh = $result_members->fields[1]; dblog("Send mail to :"." \"" . $email_adh . "\"", $sql); $warning_detected[] = _T("Mail sent to :")." \"" . $email_adh . "\""; } else { switch ($mail_result) { case 2 : dblog("Email sent is disabled in the preferences. Ask galette admin."); $error_detected[] = _T("Email sent is disabled in the preferences. Ask galette admin"); break; case 3 : dblog("A problem happened while sending mail to :"." \"" . $email_adh . "\""); $error_detected[] = _T("A problem happened while sending mail to :")." \"" . $email_adh . "\""; break; case 4 : dblog("The mail server filled in the preferences cannot be reached. Ask Galette admin"); $error_detected[] = _T("The mail server filled in the preferences cannot be reached. Ask Galette admin"); break; case 5 : dblog("**IMPORTANT** There was a probably breaking attempt when sending mail to :"." \"" . $email_adh . "\""); $error_detected[] = _T("**IMPORTANT** There was a probably breaking attempt when sending mail to :")." \"" . $email_adh . "\""; break; default : dblog("A problem happened while sending mail to :"." \"" . $email_adh . "\""); $error_detected[] = _T("A problem happened while sending mail to :")." \"" . $email_adh . "\""; break; } } $result_members->MoveNext(); } } $_SESSION['galette']['labels']=$unreachable_members; $nb_reachable_members = count($reachable_members); $nb_unreachable_members = count($unreachable_members); $tpl->assign("warning_detected",$warning_detected); $tpl->assign("error_detected",$error_detected); $tpl->assign("nb_reachable_members",$nb_reachable_members); $tpl->assign("nb_unreachable_members",$nb_unreachable_members); $tpl->assign("data",$data); $tpl->assign("etape",$etape); $content = $tpl->fetch("mailing_adherents.tpl"); $tpl->assign("content",$content); $tpl->display("page.tpl"); ?>

{_T("Mailing")}

{if $error_detected|@count != 0}

{_T("- ERROR -")}

    {foreach from=$error_detected item=error}
  • {$error}
  • {/foreach}
{/if} {if $warning_detected|@count != 0}

{_T("- WARNING -")}

    {foreach from=$warning_detected item=warning}
  • {$warning}
  • {/foreach}
{/if} {if $nb_reachable_members > 0}

{if $etape==2} {_T("Your e-mail was sent to")} {else} {_T("You are about to send an e-mail to")} {/if} {$nb_reachable_members} {if $nb_reachable_members != 1}{_T("members")}{else}{_T("member")}{/if}
{if $etape==0} {_T("Please compose your mail.")} {/if}

{$data.mailing_corps}


{if $etape>0}

{_T("Message preview:")}

{_T("Object:")}{$data.mailing_objet}

{_T("Message:")}

{$data.mailing_corps_display}

{/if}

{else} {_T("None of the selected members has an email address.")} {/if} {if $nb_unreachable_members > 0}

{$nb_unreachable_members} {if $nb_unreachable_members != 1}{_T("unreachable members:")}{else}{_T("unreachable member")}{/if}
{_T("Some members you have selected have no e-mail address. However, you can generate envelope labels to contact them by snail mail.")}

{/if}
_______________________________________________
Galette-devel mailing list
Galette-devel@gna.org
https://mail.gna.org/listinfo/galette-devel

Répondre à