2011-05-15 01:32:47 +02:00
< ? php
2014-07-04 11:21:31 +02:00
/* This software is governed by the CeCILL - B license . If a copy of this license
* is not distributed with this file , you can obtain one at
* http :// www . cecill . info / licences / Licence_CeCILL_V2 . 1 - en . txt
*
* Authors of STUdS ( initial project ) : Guilhem BORGHESI ( borghesi @ unistra . fr ) and Raphaël DROZ
* Authors of OpenSondage : Framasoft ( https :// github . com / framasoft )
*
* =============================
*
* Ce logiciel est régi par la licence CeCILL - B . Si une copie de cette licence
* ne se trouve pas avec ce fichier vous pouvez l ' obtenir sur
* http :// www . cecill . info / licences / Licence_CeCILL_V2 . 1 - fr . txt
*
* Auteurs de STUdS ( projet initial ) : Guilhem BORGHESI ( borghesi @ unistra . fr ) et Raphaël DROZ
* Auteurs d ' OpenSondage : Framasoft ( https :// github . com / framasoft )
*/
2011-05-15 01:32:47 +02:00
session_start ();
include_once ( 'variables.php' );
include_once ( 'i18n.php' );
2011-05-15 03:56:54 +02:00
if ( file_exists ( 'bandeaux_local.php' )) {
include_once ( 'bandeaux_local.php' );
} else {
include_once ( 'bandeaux.php' );
2011-05-15 01:32:47 +02:00
}
2011-05-15 03:56:54 +02:00
// action du bouton annuler
if (( isset ( $_POST [ 'envoiquestion' ]) || isset ( $_POST [ 'envoiquestion_x' ])) && isset ( $_POST [ 'nom' ]) && ! empty ( $_POST [ 'nom' ]) && isset ( $_POST [ 'question' ]) && ! empty ( $_POST [ 'question' ])) {
$message = str_replace ( " \\ " , " " , $_POST [ " question " ]);
//envoi des mails
2012-01-09 02:18:25 +01:00
2011-07-03 01:57:20 +02:00
if ( isset ( $_POST [ 'adresse_mail' ]) && ! empty ( $_POST [ 'adresse_mail' ]) && validateEmail ( $_POST [ 'adresse_mail' ])) {
2012-01-11 20:34:37 +01:00
$headers = 'Reply-To: ' . $_POST [ 'adresse_mail' ];
} else {
$headers = '' ;
2011-07-03 01:57:20 +02:00
}
2012-01-11 20:34:37 +01:00
2012-01-09 01:26:44 +01:00
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 );
2011-05-15 03:56:54 +02:00
if ( isset ( $_POST [ 'adresse_mail' ]) && ! empty ( $_POST [ 'adresse_mail' ]) && validateEmail ( $_POST [ 'adresse_mail' ])) {
2012-01-11 20:34:37 +01:00
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 );
2011-05-15 03:56:54 +02:00
}
//affichage de la page de confirmation d'envoi
2014-06-11 19:19:17 +02:00
echo '<!DOCTYPE html>' . " \n " ;
echo '<html lang="' . $lang . '">' . " \n " ;
2011-05-15 03:56:54 +02:00
echo '<head>' . " \n " ;
2014-06-11 19:19:17 +02:00
echo '<title>' . _ ( " Make your polls " ) . ' - ' . NOMAPPLICATION . '</title>' . " \n " ;
2011-05-15 03:56:54 +02:00
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . " \n " ;
2014-06-11 19:19:17 +02:00
echo '<link rel="stylesheet" type="text/css" href="' . get_server_name () . 'style.css">' . " \n " ;
2011-05-15 03:56:54 +02:00
echo '</head>' . " \n " ;
echo '<body>' . " \n " ;
logo ();
bandeau_tete ();
bandeau_titre ( _ ( " Make your polls " ));
echo '<div class=corpscentre>' . " \n " ;
2014-06-11 19:19:17 +02:00
print " <h2> " . _ ( " Your message has been sent! " ) . " </h2> " . " \n " ;
print " " . _ ( " Back to the homepage of " ) . " <a href= \" " . get_server_name () . " \" > " . NOMAPPLICATION . " </a>. " . " \n " ;
2011-05-15 03:56:54 +02:00
echo '</div>' . " \n " ;
bandeau_pied ();
session_unset ();
} else {
$post_var = array ( 'question' , 'nom' , 'adresse_mail' , );
foreach ( $post_var as $var ) {
if ( isset ( $_POST [ $var ]) && ! empty ( $_POST [ $var ])) {
$_SESSION [ $var ] = $_POST [ $var ];
} else {
$_SESSION [ $var ] = null ;
}
}
//affichage de la page
2014-06-11 19:19:17 +02:00
echo '<!DOCTYPE html>' . " \n " ;
echo '<html lang="' . strtolower ( $_SESSION [ 'langue' ]) . '">' . " \n " ;
2011-05-15 03:56:54 +02:00
echo '<head>' . " \n " ;
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . " \n " ;
2014-06-11 19:19:17 +02:00
echo '<title>' . _ ( " Contact us " ) . ' - ' . NOMAPPLICATION . '</title>' . " \n " ;
echo '<link rel="stylesheet" type="text/css" href="' . get_server_name () . 'style.css">' . " \n " ;
2011-05-15 03:56:54 +02:00
echo '</head>' . " \n " ;
echo '<body>' . " \n " ;
2011-06-23 16:52:10 +02:00
framanav ();
2011-05-15 03:56:54 +02:00
//debut du formulaire
2014-06-11 19:19:17 +02:00
echo '<form name=formulaire action="' . get_server_name () . 'contacts.php" method="POST">' . " \n " ;
2011-05-15 03:56:54 +02:00
//bandeaux de tete
logo ();
bandeau_tete ();
bandeau_titre ( _ ( " Contact us " ));
sous_bandeau ();
echo '<div class=corps>' . " \n " ;
2014-07-04 11:21:31 +02:00
echo _ ( " If you have questions, you can send a message here. " ) . '<br /><br />' . " \n " ;
2011-05-15 03:56:54 +02:00
2014-07-04 11:21:31 +02:00
echo _ ( " Your name " ) . ' :<br />' . " \n " ;
2011-05-15 03:56:54 +02:00
echo '<input type="text" size="40" maxlength="64" name="nom" value="' . $_SESSION [ " nom " ] . '">' ;
if (( isset ( $_POST [ 'envoiquestion' ]) || isset ( $_POST [ 'envoiquestion_x' ])) && $_SESSION [ " nom " ] == " " ) {
2014-07-04 11:21:31 +02:00
echo ' <p class="error">' . _ ( " Enter a name " ) . '</p>' ;
2011-05-15 03:56:54 +02:00
}
2014-07-04 11:21:31 +02:00
echo '<br /><br />' . " \n " ;
echo _ ( " Your email address " ) . ' :<br />' . " \n " ;
2011-05-15 03:56:54 +02:00
echo '<input type="text" size="40" maxlength="64" name="adresse_mail" value="' . $_SESSION [ " adresse_mail " ] . '">' . " \n " ;
2011-07-03 01:57:20 +02:00
if (( isset ( $_POST [ 'envoiquestion' ]) || isset ( $_POST [ 'envoiquestion_x' ])) && empty ( $_SESSION [ " adresse_mail " ]) === false && validateEmail ( $_SESSION [ " adresse_mail " ]) === false ) {
2014-07-04 11:21:31 +02:00
echo ' <p class="error">' . _ ( " The address is not correct! " ) . '</p>' ;
2011-07-03 01:57:20 +02:00
}
2011-05-15 03:56:54 +02:00
2014-07-04 11:21:31 +02:00
echo _ ( " Question " ) . ' :<br />' . " \n " ;
2011-05-15 03:56:54 +02:00
echo '<textarea name="question" rows="7" cols="40">' . $_SESSION [ " question " ] . '</textarea>' ;
if (( isset ( $_POST [ 'envoiquestion' ]) || isset ( $_POST [ 'envoiquestion_x' ])) && $_SESSION [ " question " ] == " " ) {
2014-07-04 11:21:31 +02:00
echo ' <p class="error"> Il faut poser une question !</p>' ;
2011-05-15 03:56:54 +02:00
}
2011-07-03 01:57:20 +02:00
echo '<button type="submit" name="envoiquestion" value="' . _ ( " Send your question " ) . '" class="button green poursuivre" alt="' . _ ( " Send your question " ) . '"><strong>' . _ ( " Send your question " ) . '</strong></button>' ;
2011-05-15 03:56:54 +02:00
echo '</div>' . " \n " ;
echo '</form>' . " \n " ;
//bandeau de pied
bandeau_pied ();
echo '</body>' . " \n " ;
echo '</html>' . " \n " ;
2012-01-09 01:26:44 +01:00
}