diff --git a/README.md b/README.md index adee886..47532f2 100755 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ This contactMailTemplate.php should create the HTML email content : $msgH. It wi ### Versions ### -* 1.5 - xx/03/2020 : Master mode +* 1.6 - 07/10/2020 : Admin can reply to email field if exists. User reply to Admin (no change). +* 1.5 - 24/03/2020 : Master mode * 1.4 - 08/01/2020 : Fix PHPMailer issue - Custom template - Copy to sender - Custom subject * 1.3 - 27/12/2017 : W3.css compatibility * 1.2.2 - 15/03/2017 : Fix issue when unknow lang diff --git a/contact.js b/contact.js index 77fa668..50ead8f 100755 --- a/contact.js +++ b/contact.js @@ -7,12 +7,14 @@ function f_contact_load(){ jQuery.post('uno/plugins/contact/contact.php',{'action':'load','unox':Unox},function(r){ r=JSON.parse(r); if(r.mail)document.getElementById('contactAdmin').value=r.mail; + if(r.name)document.getElementById('contactName').value=r.name; if(r.send)document.getElementById('contactSend').value=r.send; if(r.happy)document.getElementById('contactHappy').value=r.happy; if(r.subject)document.getElementById('contactSubject').value=r.subject; if(r.captcha==1)document.getElementById('contactCaptcha').checked=true;else document.getElementById('contactCaptcha').checked=false; if(r.copy==1)document.getElementById('contactCopy').checked=true;else document.getElementById('contactCopy').checked=false; if(r.master==1)document.getElementById('contactMaster').checked=true;else document.getElementById('contactMaster').checked=false; + if(r.reply==1)document.getElementById('contactReply').checked=true;else document.getElementById('contactReply').checked=false; jQuery("#contactResult").empty(); jQuery.each(r.frm,function(k,v){f_contact_add(v.l,v.t);}); }); @@ -24,12 +26,14 @@ function f_contact_save(){ h.push({name:'action',value:'save'}); h.push({name:'unox',value:Unox}); h.push({name:'contactAdmin',value:document.getElementById('contactAdmin').value}); + h.push({name:'contactName',value:document.getElementById('contactName').value}); h.push({name:'contactSend',value:document.getElementById('contactSend').value}); h.push({name:'contactHappy',value:document.getElementById('contactHappy').value}); h.push({name:'contactSubject',value:document.getElementById('contactSubject').value}); h.push({name:'contactCaptcha',value:document.getElementById('contactCaptcha').checked}); h.push({name:'contactCopy',value:document.getElementById('contactCopy').checked}); h.push({name:'contactMaster',value:document.getElementById('contactMaster').checked}); + h.push({name:'contactReply',value:document.getElementById('contactReply').checked}); jQuery.post('uno/plugins/contact/contact.php',h,function(r){f_alert(r);}); }); } diff --git a/contact.php b/contact.php index c5636f8..9f50453 100755 --- a/contact.php +++ b/contact.php @@ -36,6 +36,11 @@ + + + + + @@ -53,19 +58,24 @@ - + - + - + + + + + +

@@ -105,14 +115,17 @@ } else $a['mail'] = $_POST['contactAdmin']; $a['send'] = (stripslashes($_POST['contactSend'])?stripslashes($_POST['contactSend']):'OK'); + $a['name'] = (!empty($_POST['contactName'])?stripslashes($_POST['contactName']):'No Reply'); $a['happy'] = stripslashes($_POST['contactHappy']); $a['subject'] = stripslashes($_POST['contactSubject']); if($_POST['contactMaster']=="true" && !file_exists('../../data/contactMaster.txt')) file_put_contents('../../data/contactMaster.txt', '1'); else if($_POST['contactMaster']!="true" && file_exists('../../data/contactMaster.txt')) unlink('../../data/contactMaster.txt'); if($_POST['contactCaptcha']=="true") $a['captcha']=1; else $a['captcha']=0; if($_POST['contactCopy']=="true") $a['copy']=1; else $a['copy']=0; + if($_POST['contactReply']=="true") $a['reply']=1; else $a['reply']=0; + $b = array('action','unox','contactAdmin','contactName','contactSend','contactHappy','contactCaptcha','contactSubject','contactCopy','contactMaster','contactReply'); foreach($_POST as $k=>$v) { - if($k!='action' && $k!='unox' && $k!='contactAdmin' && $k!='contactSend' && $k!='contactHappy' && $k!='contactCaptcha' && $k!='contactSubject' && $k!='contactCopy' && $k!='contactMaster') { + if(!in_array($k,$b)) { $a['frm'][$c]['t'] = substr($k,0,2); $a['frm'][$c]['l'] = stripslashes(substr($k,2)); } diff --git a/contactCall.php b/contactCall.php index 6d50f2a..8f463e3 100755 --- a/contactCall.php +++ b/contactCall.php @@ -32,19 +32,26 @@ $mailadm = (!empty($c['mail'])?$c['mail']:$a['mel']); if(!filter_var($mailadm, FILTER_VALIDATE_EMAIL)) die; $happy = (!empty($c['happy'])?$c['happy']:''); + $name = (!empty($c['name'])?$c['name']:'No Reply'); $copy = array(); $l = 0; + $reply = (!empty($c['reply'])?'':false); foreach($_POST as $k=>$v) { if($k!='action') { $v = strip_tags($v); $kk = $k; - if(substr($k,0,5)=='mail0' && filter_var($v,FILTER_VALIDATE_EMAIL)) $copy[] = $v; + if(substr($k,0,5)=='mail0' && filter_var($v,FILTER_VALIDATE_EMAIL)) { + $copy[] = $v; + if($reply==='') $reply = $v; + } if(substr($k,0,5)=='text0' || substr($k,0,5)=='area0' || substr($k,0,5)=='mail0') $kk = substr($k,5); $msgT .= $kk.' : '.$v."\r\n"; $msgH .= ''; $l += strlen($v); } } + $name2 = (!empty($reply)?'User':$name); + if(empty($reply)) $reply = $mailadm; $msgH .= "
'.$kk.' : '.$v.'
" . $bottom; if(file_exists('../../template/'.$b['tem'].'/contactMailTemplate.php')) include('../../template/'.$b['tem'].'/contactMailTemplate.php'); // custom template with custom methods - $msgH if(empty($a['subject'])) $sujet = $b['tit'] . " - Contact"; @@ -55,7 +62,7 @@ $phm = new PHPMailer(); $phm->CharSet = "UTF-8"; $phm->Encoding = "base64"; - $phm->setFrom($mailadm, 'No Reply'); + $phm->setFrom($reply, $name2); $phm->addAddress($mailadm); $phm->isHTML(true); $phm->Subject = stripslashes($sujet); @@ -69,7 +76,7 @@ $phm->ClearAllRecipients(); $phm->CharSet = "UTF-8"; $phm->Encoding = "base64"; - $phm->setFrom($mail, 'No Reply'); + $phm->setFrom($mailadm, $name); foreach($copy as $r) { if(filter_var($r, FILTER_VALIDATE_EMAIL)) $phm->addAddress($r); ++$ncopy; @@ -85,9 +92,9 @@ } else { $boundary = "-----=".md5(rand()); - if(!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mailadm)) $rn = "\r\n"; + if(!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $reply)) $rn = "\r\n"; else $rn = "\n"; - $header = "From: \"No reply\"<".$mailadm.">".$rn; + $header = "From: \"".$name2."\"<".$reply.">".$rn; $header.= "MIME-Version: 1.0".$rn; $header.= "Content-Type: multipart/alternative;".$rn." boundary=\"$boundary\"".$rn; $msg= $rn."--".$boundary.$rn; @@ -104,6 +111,21 @@ if(!$happy) echo T_('OK'); else echo " ".$happy; if(!empty($c['copy']) && !empty($copy)) { + if(!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mailadm)) $rn = "\r\n"; + else $rn = "\n"; + $header = "From: \"".$name."\"<".$mailadm.">".$rn; + $header.= "MIME-Version: 1.0".$rn; + $header.= "Content-Type: multipart/alternative;".$rn." boundary=\"$boundary\"".$rn; + $msg= $rn."--".$boundary.$rn; + $msg.= "Content-Type: text/plain; charset=\"utf-8\"".$rn; + $msg.= "Content-Transfer-Encoding: 8bit".$rn; + $msg.= $rn.$msgT.$rn; + $msg.= $rn."--".$boundary.$rn; + $msg.= "Content-Type: text/html; charset=\"utf-8\"".$rn; + $msg.= "Content-Transfer-Encoding: 8bit".$rn; + $msg.= $rn.$msgH.$rn; + $msg.= $rn."--".$boundary."--".$rn; + $msg.= $rn."--".$boundary."--".$rn; foreach($copy as $r) if(filter_var($r, FILTER_VALIDATE_EMAIL)) mail($r, stripslashes($sujet), stripslashes($msg), $header); } } diff --git a/lang/es_ES.utf8/LC_MESSAGES/contact.mo b/lang/es_ES.utf8/LC_MESSAGES/contact.mo index f50aeaa..f1069b8 100755 Binary files a/lang/es_ES.utf8/LC_MESSAGES/contact.mo and b/lang/es_ES.utf8/LC_MESSAGES/contact.mo differ diff --git a/lang/es_ES.utf8/LC_MESSAGES/contact.po b/lang/es_ES.utf8/LC_MESSAGES/contact.po index 771394e..7b0cc9e 100755 --- a/lang/es_ES.utf8/LC_MESSAGES/contact.po +++ b/lang/es_ES.utf8/LC_MESSAGES/contact.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: CmsUno\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-01-08 11:50+0100\n" -"PO-Revision-Date: 2020-01-08 11:51+0100\n" +"POT-Creation-Date: 2020-10-07 19:24+0200\n" +"PO-Revision-Date: 2020-10-07 19:27+0200\n" "Last-Translator: malgrange \n" "Language-Team: Jacques Malgrange \n" "Language: es_ES\n" @@ -18,7 +18,7 @@ msgstr "" "X-Generator: Poedit 1.8.7.1\n" "X-Poedit-SearchPath-0: ../../..\n" -#: ../../../contact.php:19 +#: ../../../contact.php:22 msgid "" "This plugin allows you to create a contact form that can be installed at any " "location of the site." @@ -26,11 +26,11 @@ msgstr "" "Este plugin te permite crear un formulario de contacto que se puede instalar " "en cualquier ubicación del sitio." -#: ../../../contact.php:20 +#: ../../../contact.php:23 msgid "Just insert the code" msgstr "Sólo tiene que insertar el código" -#: ../../../contact.php:20 +#: ../../../contact.php:23 msgid "" "in the text of your page or directly into the template. This code will be " "replaced by the form." @@ -38,29 +38,45 @@ msgstr "" "en el texto de su página o directamente en la plantilla. Este código será " "reemplazado por el formulario." -#: ../../../contact.php:23 +#: ../../../contact.php:26 +msgid "Master mode activated." +msgstr "Modo maestro activado." + +#: ../../../contact.php:28 +msgid "Config the plugin in the master page : " +msgstr "Configure el plugin en la página maestra :" + +#: ../../../contact.php:35 msgid "Admin email" msgstr "Admin email" -#: ../../../contact.php:25 +#: ../../../contact.php:37 msgid "E-mail address of destination : Your email address or the contact site." msgstr "" "E-mail de destino : Tu dirección de correo electrónico o en el sitio de " "contacto." -#: ../../../contact.php:28 +#: ../../../contact.php:40 +msgid "Name" +msgstr "Nombre" + +#: ../../../contact.php:42 +msgid "The name for your email address." +msgstr "El nombre de su dirección de email." + +#: ../../../contact.php:45 msgid "Send button" msgstr "Enviar botón" -#: ../../../contact.php:30 +#: ../../../contact.php:47 msgid "The word that should appear on the 'Send' button." msgstr "La palabra que debe aparecer en el botón 'Enviar'." -#: ../../../contact.php:33 +#: ../../../contact.php:50 msgid "Thank you" msgstr "Gracias" -#: ../../../contact.php:35 +#: ../../../contact.php:52 msgid "" "The sentence of thanks that will be displayed on the screen after sending " "the message." @@ -68,73 +84,94 @@ msgstr "" "La frase de agradecimiento que se mostrará en la pantalla después de enviar " "el mensaje." -#: ../../../contact.php:38 +#: ../../../contact.php:55 msgid "Subject" msgstr "Tema" -#: ../../../contact.php:40 +#: ../../../contact.php:57 msgid "The title of the email for sending. Empty => Site title - Contact" msgstr "El título del email para enviar. Vacío => Título del sitio - Contacto" -#: ../../../contact.php:43 +#: ../../../contact.php:60 msgid "Enable Captcha" msgstr "Habilitar Captcha" -#: ../../../contact.php:45 +#: ../../../contact.php:62 msgid "Code image to enter to block the automatic sending of email by robots." msgstr "" "La imagen del código para entrar en bloquear el envío de la automática de " "correo electrónico por robots." -#: ../../../contact.php:48 +#: ../../../contact.php:65 msgid "Mail to author" msgstr "Enviar al autor" -#: ../../../contact.php:50 +#: ../../../contact.php:67 msgid "Send a copy to the emails of the form." msgstr "Envíe una copia a los email del formulario" -#: ../../../contact.php:50 ../../../contact.php:61 +#: ../../../contact.php:67 ../../../contact.php:88 msgid "Text email" msgstr "Text email" -#: ../../../contact.php:53 +#: ../../../contact.php:70 +msgid "Master mode" +msgstr "Modo maestro" + +#: ../../../contact.php:72 +msgid "" +"In multipage site, the configuration will be centralized on the master page." +msgstr "" +"En un sitio de varias páginas, la configuración se centralizará en la página " +"maestra." + +#: ../../../contact.php:75 +msgid "Reply to the email" +msgstr "Responder al email" + +#: ../../../contact.php:77 +msgid "Reply to the first email field if exists. Default is admin email." +msgstr "" +"Responda al primer campo de email si existe. El valor predeterminado es el " +"email de admin." + +#: ../../../contact.php:80 msgid "Add a field :" msgstr "Añadir un campo :" -#: ../../../contact.php:56 +#: ../../../contact.php:83 msgid "Label" msgstr "Label" -#: ../../../contact.php:60 +#: ../../../contact.php:87 msgid "Text" msgstr "Texto" -#: ../../../contact.php:62 +#: ../../../contact.php:89 msgid "Textarea" msgstr "Textarea" -#: ../../../contact.php:65 ../../../contact.php:72 +#: ../../../contact.php:92 ../../../contact.php:99 msgid "Save settings" msgstr "Guardar ajustes" -#: ../../../contact.php:65 +#: ../../../contact.php:92 msgid "Add" msgstr "Añadir" -#: ../../../contact.php:68 +#: ../../../contact.php:95 msgid "Result :" msgstr "Resultado :" -#: ../../../contact.php:72 +#: ../../../contact.php:99 msgid "Save" msgstr "Guardar" -#: ../../../contact.php:106 +#: ../../../contact.php:135 msgid "Backup performed" msgstr "Copia de seguridad realizada" -#: ../../../contact.php:107 +#: ../../../contact.php:136 msgid "Impossible backup" msgstr "Copia de seguridad Imposible" @@ -142,11 +179,11 @@ msgstr "Copia de seguridad Imposible" msgid "Captcha error" msgstr "Error de CAPTCHA" -#: ../../../contactCall.php:66 ../../../contactCall.php:104 +#: ../../../contactCall.php:72 ../../../contactCall.php:111 msgid "OK" msgstr "OK" -#: ../../../contactCall.php:82 ../../../contactCall.php:111 +#: ../../../contactCall.php:91 ../../../contactCall.php:132 msgid "Failed to send" msgstr "Fallo al enviar" diff --git a/lang/fr_FR.utf8/LC_MESSAGES/contact.mo b/lang/fr_FR.utf8/LC_MESSAGES/contact.mo index 732b2df..76748c2 100755 Binary files a/lang/fr_FR.utf8/LC_MESSAGES/contact.mo and b/lang/fr_FR.utf8/LC_MESSAGES/contact.mo differ diff --git a/lang/fr_FR.utf8/LC_MESSAGES/contact.po b/lang/fr_FR.utf8/LC_MESSAGES/contact.po index 67f4d78..a1be214 100755 --- a/lang/fr_FR.utf8/LC_MESSAGES/contact.po +++ b/lang/fr_FR.utf8/LC_MESSAGES/contact.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: CmsUno\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-01-08 11:47+0100\n" -"PO-Revision-Date: 2020-01-08 11:49+0100\n" +"POT-Creation-Date: 2020-10-07 19:19+0200\n" +"PO-Revision-Date: 2020-10-07 19:23+0200\n" "Last-Translator: malgrange \n" "Language-Team: Jacques Malgrange \n" "Language: fr_FR\n" @@ -18,7 +18,7 @@ msgstr "" "X-Generator: Poedit 1.8.7.1\n" "X-Poedit-SearchPath-0: ../../..\n" -#: ../../../contact.php:19 +#: ../../../contact.php:22 msgid "" "This plugin allows you to create a contact form that can be installed at any " "location of the site." @@ -26,11 +26,11 @@ msgstr "" "Ce plugin permet de créer un formulaire de contact pouvant " "s'installer à n'importe quel endroit du site." -#: ../../../contact.php:20 +#: ../../../contact.php:23 msgid "Just insert the code" msgstr "Il suffit d'insérer le code" -#: ../../../contact.php:20 +#: ../../../contact.php:23 msgid "" "in the text of your page or directly into the template. This code will be " "replaced by the form." @@ -38,28 +38,44 @@ msgstr "" "dans le texte de votre page ou bien directement dans le template. Ce code " "sera remplacé par le formulaire." -#: ../../../contact.php:23 +#: ../../../contact.php:26 +msgid "Master mode activated." +msgstr "Mode maître activé." + +#: ../../../contact.php:28 +msgid "Config the plugin in the master page : " +msgstr "Configurez le plugin dans la page maître :" + +#: ../../../contact.php:35 msgid "Admin email" msgstr "Admin email" -#: ../../../contact.php:25 +#: ../../../contact.php:37 msgid "E-mail address of destination : Your email address or the contact site." msgstr "" "Adresse mail de destination : Votre adresse mail ou celle de contact du site." -#: ../../../contact.php:28 +#: ../../../contact.php:40 +msgid "Name" +msgstr "Nom" + +#: ../../../contact.php:42 +msgid "The name for your email address." +msgstr "Le nom pour votre adresse email." + +#: ../../../contact.php:45 msgid "Send button" msgstr "Bouton Envoyer" -#: ../../../contact.php:30 +#: ../../../contact.php:47 msgid "The word that should appear on the 'Send' button." msgstr "Le mot qui doit apparaître sur le bouton pour envoyer." -#: ../../../contact.php:33 +#: ../../../contact.php:50 msgid "Thank you" msgstr "Merci" -#: ../../../contact.php:35 +#: ../../../contact.php:52 msgid "" "The sentence of thanks that will be displayed on the screen after sending " "the message." @@ -67,73 +83,94 @@ msgstr "" "La phrase de remerciement qui s'affichera à l'écran aprè" "s envoi du message." -#: ../../../contact.php:38 +#: ../../../contact.php:55 msgid "Subject" msgstr "Sujet" -#: ../../../contact.php:40 +#: ../../../contact.php:57 msgid "The title of the email for sending. Empty => Site title - Contact" msgstr "Le titre du mail. Vide => Titre du site - Contact" -#: ../../../contact.php:43 +#: ../../../contact.php:60 msgid "Enable Captcha" msgstr "Activer Captcha" -#: ../../../contact.php:45 +#: ../../../contact.php:62 msgid "Code image to enter to block the automatic sending of email by robots." msgstr "" "Code image à entrer pour bloquer l'envoi automatique de mail par des " "robots." -#: ../../../contact.php:48 +#: ../../../contact.php:65 msgid "Mail to author" msgstr "Email vers l'auteur" -#: ../../../contact.php:50 +#: ../../../contact.php:67 msgid "Send a copy to the emails of the form." msgstr "Envoi une copie du mail vers le rédacteur." -#: ../../../contact.php:50 ../../../contact.php:61 +#: ../../../contact.php:67 ../../../contact.php:88 msgid "Text email" msgstr "Text email" -#: ../../../contact.php:53 +#: ../../../contact.php:70 +msgid "Master mode" +msgstr "Mode Maître" + +#: ../../../contact.php:72 +msgid "" +"In multipage site, the configuration will be centralized on the master page." +msgstr "" +"Dans un site multi-page, la configuration sera centralisée sur la page " +"maître." + +#: ../../../contact.php:75 +msgid "Reply to the email" +msgstr "Répondre à l'email" + +#: ../../../contact.php:77 +msgid "Reply to the first email field if exists. Default is admin email." +msgstr "" +"Répondre au premier champ email s'il existe. La valeur par défaut est " +"l'adresse email de l'admin." + +#: ../../../contact.php:80 msgid "Add a field :" msgstr "Ajouter un champ :" -#: ../../../contact.php:56 +#: ../../../contact.php:83 msgid "Label" msgstr "Label" -#: ../../../contact.php:60 +#: ../../../contact.php:87 msgid "Text" msgstr "Text" -#: ../../../contact.php:62 +#: ../../../contact.php:89 msgid "Textarea" msgstr "Textarea" -#: ../../../contact.php:65 ../../../contact.php:72 +#: ../../../contact.php:92 ../../../contact.php:99 msgid "Save settings" msgstr "Enregistre les paramètres" -#: ../../../contact.php:65 +#: ../../../contact.php:92 msgid "Add" msgstr "Ajouter" -#: ../../../contact.php:68 +#: ../../../contact.php:95 msgid "Result :" msgstr "Résultat :" -#: ../../../contact.php:72 +#: ../../../contact.php:99 msgid "Save" msgstr "Enregistrer" -#: ../../../contact.php:106 +#: ../../../contact.php:135 msgid "Backup performed" msgstr "Sauvegarde effectuée" -#: ../../../contact.php:107 +#: ../../../contact.php:136 msgid "Impossible backup" msgstr "Sauvegarde impossible" @@ -141,11 +178,11 @@ msgstr "Sauvegarde impossible" msgid "Captcha error" msgstr "Erreur du Captcha" -#: ../../../contactCall.php:66 ../../../contactCall.php:104 +#: ../../../contactCall.php:72 ../../../contactCall.php:111 msgid "OK" msgstr "OK" -#: ../../../contactCall.php:82 ../../../contactCall.php:111 +#: ../../../contactCall.php:91 ../../../contactCall.php:132 msgid "Failed to send" msgstr "Echec de l'envoi" diff --git a/version.json b/version.json index b8a859b..ee7b52d 100755 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{"version":"1.5","host":"https://github.com/cmsunoPlugins/contact/"} +{"version":"1.6","host":"https://github.com/cmsunoPlugins/contact/"}