diff --git a/adminstuds.php b/adminstuds.php index 45c7c0b3df11693a8ef75820db85e9cb3e48cb2a..9ee5b9d17273b5759899508a7c2652a6c559bd91 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -103,7 +103,6 @@ $dsondage=$sondage->FetchObject(false); //si la valeur du nouveau titre est valide et que le bouton est activé $adresseadmin = $dsondage->mail_admin; -$headers = makeHeaders() ; if (isset($_POST["boutonnouveautitre"]) || isset($_POST["boutonnouveautitre_x"])) { if(issetAndNoEmpty('nouveautitre') === false) { @@ -120,8 +119,7 @@ if (isset($_POST["boutonnouveautitre"]) || isset($_POST["boutonnouveautitre_x"]) _("[ADMINISTRATOR] New title for your poll") . ' ' . NOMAPPLICATION, _("You have changed the title of your poll. \nYou can modify this poll with this link") . " :\n\n".getUrlSondage($numsondageadmin, true)."\n\n" . - _("Thanks for your confidence.") . "\n" . NOMAPPLICATION, - $headers ); + _("Thanks for your confidence.") . "\n" . NOMAPPLICATION ); } } } @@ -143,8 +141,7 @@ if (isset($_POST["boutonnouveauxcommentaires"]) || isset($_POST["boutonnouveauxc _("[ADMINISTRATOR] New comments for your poll") . ' ' . NOMAPPLICATION, _("You have changed the comments of your poll. \nYou can modify this poll with this link") . " :\n\n".getUrlSondage($numsondageadmin, true)." \n\n" . - _("Thanks for your confidence.") . "\n" . NOMAPPLICATION, - $headers ); + _("Thanks for your confidence.") . "\n" . NOMAPPLICATION ); } } } @@ -166,8 +163,7 @@ if (isset($_POST["boutonnouvelleadresse"]) || isset($_POST["boutonnouvelleadress _("[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") . " :\n\n".getUrlSondage($numsondageadmin, true)."\n\n" . - _("Thanks for your confidence.") . "\n" . NOMAPPLICATION, - $headers ); + _("Thanks for your confidence.") . "\n" . NOMAPPLICATION ); } } } @@ -327,8 +323,7 @@ if (isset($_POST["confirmesuppression"]) || isset($_POST["confirmesuppression_x" _("[ADMINISTRATOR] Removing of your poll") . ' ' . NOMAPPLICATION, _("You have removed your poll. \nYou can make new polls with this link") . " :\n\n".get_server_name()."index.php \n\n" . - _("Thanks for your confidence.") . "\n" . NOMAPPLICATION, - $headers ); + _("Thanks for your confidence.") . "\n" . NOMAPPLICATION ); //affichage de l'ecran de confirmation de suppression de sondage print_header(); @@ -471,12 +466,10 @@ if (isset($_POST["ajoutercolonne_x"]) && issetAndNoEmpty('nouvellecolonne') && ( $sql = $connect->Prepare($sql); if ($connect->Execute($sql, array($nouveauxsujets, $numsondage))) { //envoi d'un mail pour prévenir l'administrateur du changement - $headers = makeHeaders() ; 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") . - " : \n\n".getUrlSondage($numsondage)." \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION, - $headers ); + " : \n\n".getUrlSondage($numsondage)." \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION ); } } @@ -590,8 +583,7 @@ if (isset($_POST["ajoutercolonne_x"]) && ($dsondage->format == "D" || $dsondage- sendEmail( $adresseadmin, _("[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"). - " : \n\n".getUrlSondage($numsondage)." \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION, - $headers ); + " : \n\n".getUrlSondage($numsondage)." \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION ); } else { $erreur_ajout_date="yes"; } diff --git a/contacts.php b/contacts.php index ef6c9a3ffda11115106fdabbf28c1d49ed4826f3..d1d72c4bbe3b03cbef6fdd653459b56e2b2307ce 100644 --- a/contacts.php +++ b/contacts.php @@ -52,15 +52,16 @@ if ((isset($_POST['envoiquestion']) || isset($_POST['envoiquestion_x'])) && isse $message=str_replace("\\","",$_POST["question"]); //envoi des mails - $headers = makeHeaders() ; 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 ); 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,$headers ); + 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 ); } //affichage de la page de confirmation d'envoi diff --git a/creation_sondage.php b/creation_sondage.php index 648be34dcf34e72edfccb3dddc4e808ae675ef2b..f0e2d409c299561c7a8393de6fc2116514527a7f 100644 --- a/creation_sondage.php +++ b/creation_sondage.php @@ -82,8 +82,6 @@ function ajouter_sondage() $date_fin = time()+15552000; } - $headers = makeHeaders() ; - global $connect; $sql = 'INSERT INTO sondage @@ -118,8 +116,8 @@ function ajouter_sondage() $message_admin = sprintf($message_admin, getUrlSondage($sondage_admin, true)); 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."][" . _("For sending to the polled users") . "] " . _("Poll") . " : ".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES)), $message, $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 ); } $date=date('H:i:s d/m/Y:'); diff --git a/fonctions.php b/fonctions.php index 169a538dd032f1a5dfa981b930e67246aebfe252..89aa52b85a0ac08647678950f50c9cc8cc15902f 100644 --- a/fonctions.php +++ b/fonctions.php @@ -183,25 +183,18 @@ function sendEmail( $to, $subject, $body, $headers, $param) } ; $subject = '=?UTF-8?B?' . base64_encode( html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' ) ) . '?=' ; - $body = html_entity_decode( $body, ENT_QUOTES, 'UTF-8' ) ; - - mail( $to, $subject, $body, $headers, $param ) ; - -} -function makeHeaders() { + $encoded_app = '=?UTF-8?B?' . base64_encode( NOMAPPLICATION ) . '?=' ; - $headers_str = <<<EOF -From: %s <%s> -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit -EOF; + 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" - $encoded_app = '=?UTF-8?B?' . base64_encode( NOMAPPLICATION ) . '?=' ; - $headers = sprintf( $headers_str, $encoded_app, ADRESSEMAILADMIN ) ; + $body = html_entity_decode( $body, ENT_QUOTES, 'UTF-8' ) ; - return $headers ; + mail( $to, $subject, $body, $headers, $param ) ; } diff --git a/studs.php b/studs.php index c74052b11b7a16f82c45255996bf4a1c147d4163..fd89460dd39f6301b4ca7a1567b644699e4c834c 100644 --- a/studs.php +++ b/studs.php @@ -171,14 +171,12 @@ if (!is_error(NO_POLL) && (isset($_POST["boutonp"]) || isset($_POST["boutonp_x"] $connect->Execute($sql, array($nom, $numsondage, $nouveauchoix)); if ($dsondage->mailsonde || /* compatibility for non boolean DB */ $dsondage->mailsonde=="yes" || $dsondage->mailsonde=="true") { - $headers = makeHeaders() ; sendEmail( "$dsondage->mail_admin", "[".NOMAPPLICATION."] "._("Poll's participation")." : ".html_entity_decode($dsondage->titre, 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". getUrlSondage($numsondage)." \n\n" . - _("Thanks for your confidence.") . "\n". NOMAPPLICATION, - $headers ); + _("Thanks for your confidence.") . "\n". NOMAPPLICATION ); } } } else { @@ -307,8 +305,7 @@ if ($testmodifier) { $connect->Execute($sql, array($nouveauchoix, $data->nom, $data->id_users)); 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,$headers ); + 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 ); } }