Headers separation fix
Fix the header separating character (needs to be \r\n). Merge header creation with sendEmail.
This commit is contained in:
parent
2bd0fd2da1
commit
bebfc4b4e7
@ -103,7 +103,6 @@ $dsondage=$sondage->FetchObject(false);
|
|||||||
|
|
||||||
//si la valeur du nouveau titre est valide et que le bouton est activé
|
//si la valeur du nouveau titre est valide et que le bouton est activé
|
||||||
$adresseadmin = $dsondage->mail_admin;
|
$adresseadmin = $dsondage->mail_admin;
|
||||||
$headers = makeHeaders() ;
|
|
||||||
|
|
||||||
if (isset($_POST["boutonnouveautitre"]) || isset($_POST["boutonnouveautitre_x"])) {
|
if (isset($_POST["boutonnouveautitre"]) || isset($_POST["boutonnouveautitre_x"])) {
|
||||||
if(issetAndNoEmpty('nouveautitre') === false) {
|
if(issetAndNoEmpty('nouveautitre') === false) {
|
||||||
@ -120,8 +119,7 @@ if (isset($_POST["boutonnouveautitre"]) || isset($_POST["boutonnouveautitre_x"])
|
|||||||
_("[ADMINISTRATOR] New title for your poll") . ' ' . NOMAPPLICATION,
|
_("[ADMINISTRATOR] New title for your poll") . ' ' . NOMAPPLICATION,
|
||||||
_("You have changed the title of your poll. \nYou can modify this poll with this link") .
|
_("You have changed the title of your poll. \nYou can modify this poll with this link") .
|
||||||
" :\n\n".getUrlSondage($numsondageadmin, true)."\n\n" .
|
" :\n\n".getUrlSondage($numsondageadmin, true)."\n\n" .
|
||||||
_("Thanks for your confidence.") . "\n" . NOMAPPLICATION,
|
_("Thanks for your confidence.") . "\n" . NOMAPPLICATION );
|
||||||
$headers );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,8 +141,7 @@ if (isset($_POST["boutonnouveauxcommentaires"]) || isset($_POST["boutonnouveauxc
|
|||||||
_("[ADMINISTRATOR] New comments for your poll") . ' ' . NOMAPPLICATION,
|
_("[ADMINISTRATOR] New comments for your poll") . ' ' . NOMAPPLICATION,
|
||||||
_("You have changed the comments of your poll. \nYou can modify this poll with this link") .
|
_("You have changed the comments of your poll. \nYou can modify this poll with this link") .
|
||||||
" :\n\n".getUrlSondage($numsondageadmin, true)." \n\n" .
|
" :\n\n".getUrlSondage($numsondageadmin, true)." \n\n" .
|
||||||
_("Thanks for your confidence.") . "\n" . NOMAPPLICATION,
|
_("Thanks for your confidence.") . "\n" . NOMAPPLICATION );
|
||||||
$headers );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,8 +163,7 @@ if (isset($_POST["boutonnouvelleadresse"]) || isset($_POST["boutonnouvelleadress
|
|||||||
_("[ADMINISTRATOR] New email address for your poll") . ' ' . NOMAPPLICATION,
|
_("[ADMINISTRATOR] New email address for your poll") . ' ' . NOMAPPLICATION,
|
||||||
_("You have changed your email address in your poll. \nYou can modify this poll with this link") .
|
_("You have changed your email address in your poll. \nYou can modify this poll with this link") .
|
||||||
" :\n\n".getUrlSondage($numsondageadmin, true)."\n\n" .
|
" :\n\n".getUrlSondage($numsondageadmin, true)."\n\n" .
|
||||||
_("Thanks for your confidence.") . "\n" . NOMAPPLICATION,
|
_("Thanks for your confidence.") . "\n" . NOMAPPLICATION );
|
||||||
$headers );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,8 +323,7 @@ if (isset($_POST["confirmesuppression"]) || isset($_POST["confirmesuppression_x"
|
|||||||
_("[ADMINISTRATOR] Removing of your poll") . ' ' . NOMAPPLICATION,
|
_("[ADMINISTRATOR] Removing of your poll") . ' ' . NOMAPPLICATION,
|
||||||
_("You have removed your poll. \nYou can make new polls with this link") .
|
_("You have removed your poll. \nYou can make new polls with this link") .
|
||||||
" :\n\n".get_server_name()."index.php \n\n" .
|
" :\n\n".get_server_name()."index.php \n\n" .
|
||||||
_("Thanks for your confidence.") . "\n" . NOMAPPLICATION,
|
_("Thanks for your confidence.") . "\n" . NOMAPPLICATION );
|
||||||
$headers );
|
|
||||||
|
|
||||||
//affichage de l'ecran de confirmation de suppression de sondage
|
//affichage de l'ecran de confirmation de suppression de sondage
|
||||||
print_header();
|
print_header();
|
||||||
@ -471,12 +466,10 @@ if (isset($_POST["ajoutercolonne_x"]) && issetAndNoEmpty('nouvellecolonne') && (
|
|||||||
$sql = $connect->Prepare($sql);
|
$sql = $connect->Prepare($sql);
|
||||||
if ($connect->Execute($sql, array($nouveauxsujets, $numsondage))) {
|
if ($connect->Execute($sql, array($nouveauxsujets, $numsondage))) {
|
||||||
//envoi d'un mail pour prévenir l'administrateur du changement
|
//envoi d'un mail pour prévenir l'administrateur du changement
|
||||||
$headers = makeHeaders() ;
|
|
||||||
|
|
||||||
sendEmail( "$adresseadmin", "" . _("[ADMINISTRATOR] New column for your poll").NOMAPPLICATION, "" .
|
sendEmail( "$adresseadmin", "" . _("[ADMINISTRATOR] New column for your poll").NOMAPPLICATION, "" .
|
||||||
_("You have added a new column in your poll. \nYou can inform the voters of this change with this link") .
|
_("You have added a new column in your poll. \nYou can inform the voters of this change with this link") .
|
||||||
" : \n\n".getUrlSondage($numsondage)." \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION,
|
" : \n\n".getUrlSondage($numsondage)." \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION );
|
||||||
$headers );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,8 +583,7 @@ if (isset($_POST["ajoutercolonne_x"]) && ($dsondage->format == "D" || $dsondage-
|
|||||||
sendEmail( $adresseadmin,
|
sendEmail( $adresseadmin,
|
||||||
_("[ADMINISTRATOR] New column for your poll"),
|
_("[ADMINISTRATOR] New column for your poll"),
|
||||||
_("You have added a new column in your poll. \nYou can inform the voters of this change with this link").
|
_("You have added a new column in your poll. \nYou can inform the voters of this change with this link").
|
||||||
" : \n\n".getUrlSondage($numsondage)." \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION,
|
" : \n\n".getUrlSondage($numsondage)." \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION );
|
||||||
$headers );
|
|
||||||
} else {
|
} else {
|
||||||
$erreur_ajout_date="yes";
|
$erreur_ajout_date="yes";
|
||||||
}
|
}
|
||||||
|
@ -52,15 +52,16 @@ if ((isset($_POST['envoiquestion']) || isset($_POST['envoiquestion_x'])) && isse
|
|||||||
$message=str_replace("\\","",$_POST["question"]);
|
$message=str_replace("\\","",$_POST["question"]);
|
||||||
|
|
||||||
//envoi des mails
|
//envoi des mails
|
||||||
$headers = makeHeaders() ;
|
|
||||||
|
|
||||||
if (isset($_POST['adresse_mail']) && !empty($_POST['adresse_mail']) && validateEmail($_POST['adresse_mail'])) {
|
if (isset($_POST['adresse_mail']) && !empty($_POST['adresse_mail']) && validateEmail($_POST['adresse_mail'])) {
|
||||||
$headers .= "\r\n".'Reply-To: '.$_POST['adresse_mail'];
|
$headers = 'Reply-To: '.$_POST['adresse_mail'];
|
||||||
|
} else {
|
||||||
|
$headers = '' ;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendEmail( ADRESSEMAILADMIN, "" . _("[CONTACT] You have sent a question ") . "".NOMAPPLICATION, "" . _("You have a question from a user ") . " ".NOMAPPLICATION."\n\n" . _("User") . " : ".$_POST["nom"]."\n\n" . _("User's email address") . " : $_POST[adresse_mail]\n\n" . _("Message") . " :".$message,$headers );
|
sendEmail( ADRESSEMAILADMIN, "" . _("[CONTACT] You have sent a question ") . "".NOMAPPLICATION, "" . _("You have a question from a user ") . " ".NOMAPPLICATION."\n\n" . _("User") . " : ".$_POST["nom"]."\n\n" . _("User's email address") . " : $_POST[adresse_mail]\n\n" . _("Message") . " :".$message,$headers );
|
||||||
if (isset($_POST['adresse_mail']) && !empty($_POST['adresse_mail']) && validateEmail($_POST['adresse_mail'])) {
|
if (isset($_POST['adresse_mail']) && !empty($_POST['adresse_mail']) && validateEmail($_POST['adresse_mail'])) {
|
||||||
$headers = makeHeaders() ;
|
sendEmail( "$_POST[adresse_mail]", "" . _("[COPY] Someone has sent a question ") . "".NOMAPPLICATION, "" . _("Here is a copy of your question") . " :\n\n".$message." \n\n" . _("We're going to answer your question shortly.") . "\n\n" . _("Thanks for your confidence.") . "\n".NOMAPPLICATION );
|
||||||
sendEmail( "$_POST[adresse_mail]", "" . _("[COPY] Someone has sent a question ") . "".NOMAPPLICATION, "" . _("Here is a copy of your question") . " :\n\n".$message." \n\n" . _("We're going to answer your question shortly.") . "\n\n" . _("Thanks for your confidence.") . "\n".NOMAPPLICATION,$headers );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//affichage de la page de confirmation d'envoi
|
//affichage de la page de confirmation d'envoi
|
||||||
|
@ -82,8 +82,6 @@ function ajouter_sondage()
|
|||||||
$date_fin = time()+15552000;
|
$date_fin = time()+15552000;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = makeHeaders() ;
|
|
||||||
|
|
||||||
global $connect;
|
global $connect;
|
||||||
|
|
||||||
$sql = 'INSERT INTO sondage
|
$sql = 'INSERT INTO sondage
|
||||||
@ -118,8 +116,8 @@ function ajouter_sondage()
|
|||||||
$message_admin = sprintf($message_admin, getUrlSondage($sondage_admin, true));
|
$message_admin = sprintf($message_admin, getUrlSondage($sondage_admin, true));
|
||||||
|
|
||||||
if (validateEmail($_SESSION['adresse'])) {
|
if (validateEmail($_SESSION['adresse'])) {
|
||||||
sendEmail( "$_SESSION[adresse]", "[".NOMAPPLICATION."][" . _("Author's message") . "] " . _("Poll") . " : ".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES)), $message_admin, $headers );
|
sendEmail( "$_SESSION[adresse]", "[".NOMAPPLICATION."][" . _("Author's message") . "] " . _("Poll") . " : ".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES)), $message_admin );
|
||||||
sendEmail( "$_SESSION[adresse]", "[".NOMAPPLICATION."][" . _("For sending to the polled users") . "] " . _("Poll") . " : ".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES)), $message, $headers );
|
sendEmail( "$_SESSION[adresse]", "[".NOMAPPLICATION."][" . _("For sending to the polled users") . "] " . _("Poll") . " : ".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES)), $message );
|
||||||
}
|
}
|
||||||
|
|
||||||
$date=date('H:i:s d/m/Y:');
|
$date=date('H:i:s d/m/Y:');
|
||||||
|
@ -183,28 +183,21 @@ function sendEmail( $to, $subject, $body, $headers, $param)
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
$subject = '=?UTF-8?B?' . base64_encode( html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' ) ) . '?=' ;
|
$subject = '=?UTF-8?B?' . base64_encode( html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' ) ) . '?=' ;
|
||||||
|
|
||||||
|
$encoded_app = '=?UTF-8?B?' . base64_encode( NOMAPPLICATION ) . '?=' ;
|
||||||
|
|
||||||
|
if ( $headers ) $headers .= "\r\n"
|
||||||
|
$headers .= sprintf( "From: %s <%s>\r\n", $encoded_app, ADRESSEMAILADMIN )
|
||||||
|
$headers .= "MIME-Version: 1.0\r\n"
|
||||||
|
$headers .= "Content-Type: text/plain; charset=UTF-8\r\n"
|
||||||
|
$headers .= "Content-Transfer-Encoding: 8bit"
|
||||||
|
|
||||||
$body = html_entity_decode( $body, ENT_QUOTES, 'UTF-8' ) ;
|
$body = html_entity_decode( $body, ENT_QUOTES, 'UTF-8' ) ;
|
||||||
|
|
||||||
mail( $to, $subject, $body, $headers, $param ) ;
|
mail( $to, $subject, $body, $headers, $param ) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeHeaders() {
|
|
||||||
|
|
||||||
$headers_str = <<<EOF
|
|
||||||
From: %s <%s>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
EOF;
|
|
||||||
|
|
||||||
$encoded_app = '=?UTF-8?B?' . base64_encode( NOMAPPLICATION ) . '?=' ;
|
|
||||||
$headers = sprintf( $headers_str, $encoded_app, ADRESSEMAILADMIN ) ;
|
|
||||||
|
|
||||||
return $headers ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction vérifiant l'existance et la valeur non vide d'une clé d'un tableau
|
* Fonction vérifiant l'existance et la valeur non vide d'une clé d'un tableau
|
||||||
|
@ -171,14 +171,12 @@ if (!is_error(NO_POLL) && (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"]
|
|||||||
$connect->Execute($sql, array($nom, $numsondage, $nouveauchoix));
|
$connect->Execute($sql, array($nom, $numsondage, $nouveauchoix));
|
||||||
|
|
||||||
if ($dsondage->mailsonde || /* compatibility for non boolean DB */ $dsondage->mailsonde=="yes" || $dsondage->mailsonde=="true") {
|
if ($dsondage->mailsonde || /* compatibility for non boolean DB */ $dsondage->mailsonde=="yes" || $dsondage->mailsonde=="true") {
|
||||||
$headers = makeHeaders() ;
|
|
||||||
sendEmail( "$dsondage->mail_admin",
|
sendEmail( "$dsondage->mail_admin",
|
||||||
"[".NOMAPPLICATION."] "._("Poll's participation")." : ".html_entity_decode($dsondage->titre, ENT_QUOTES, 'UTF-8')."",
|
"[".NOMAPPLICATION."] "._("Poll's participation")." : ".html_entity_decode($dsondage->titre, ENT_QUOTES, 'UTF-8')."",
|
||||||
html_entity_decode("\"$nom\" ", ENT_QUOTES, 'UTF-8').
|
html_entity_decode("\"$nom\" ", ENT_QUOTES, 'UTF-8').
|
||||||
_("has filled a line.\nYou can find your poll at the link") . " :\n\n".
|
_("has filled a line.\nYou can find your poll at the link") . " :\n\n".
|
||||||
getUrlSondage($numsondage)." \n\n" .
|
getUrlSondage($numsondage)." \n\n" .
|
||||||
_("Thanks for your confidence.") . "\n". NOMAPPLICATION,
|
_("Thanks for your confidence.") . "\n". NOMAPPLICATION );
|
||||||
$headers );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -307,8 +305,7 @@ if ($testmodifier) {
|
|||||||
$connect->Execute($sql, array($nouveauchoix, $data->nom, $data->id_users));
|
$connect->Execute($sql, array($nouveauchoix, $data->nom, $data->id_users));
|
||||||
|
|
||||||
if ($dsondage->mailsonde=="yes") {
|
if ($dsondage->mailsonde=="yes") {
|
||||||
$headers = makeHeaders() ;
|
sendEmail( "$dsondage->mail_admin", "[".NOMAPPLICATION."] " . _("Poll's participation") . " : ".html_entity_decode($dsondage->titre, ENT_QUOTES, 'UTF-8'), "\"".html_entity_decode($data->nom, ENT_QUOTES, 'UTF-8')."\""."" . _("has filled a line.\nYou can find your poll at the link") . " :\n\n".getUrlSondage($numsondage)." \n\n" . _("Thanks for your confidence.") . "\n".NOMAPPLICATION );
|
||||||
sendEmail( "$dsondage->mail_admin", "[".NOMAPPLICATION."] " . _("Poll's participation") . " : ".html_entity_decode($dsondage->titre, ENT_QUOTES, 'UTF-8'), "\"".html_entity_decode($data->nom, ENT_QUOTES, 'UTF-8')."\""."" . _("has filled a line.\nYou can find your poll at the link") . " :\n\n".getUrlSondage($numsondage)." \n\n" . _("Thanks for your confidence.") . "\n".NOMAPPLICATION,$headers );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user