Add question in confirmation email
This commit is contained in:
parent
b056fee4d8
commit
c4c75ea083
7
TODO
7
TODO
@ -4,9 +4,12 @@
|
||||
# #
|
||||
#=====================================================#
|
||||
|
||||
-> Display on #epitagueule the new questions
|
||||
and the rejected questions (using the ID)
|
||||
|
||||
|
||||
<==================== DONE ===========================>
|
||||
-> Multiple possible answer
|
||||
-> Send email for confirmation
|
||||
-> One answer / one word
|
||||
-> Special ID for a question
|
||||
-> Display on #epitagueule the new questions
|
||||
and the rejected questions (using the ID)
|
||||
|
@ -20,7 +20,7 @@ else
|
||||
$validationAddress = "/validation.php?id=".$question->getId();
|
||||
|
||||
// Uncomment the following part for random email
|
||||
/*
|
||||
|
||||
while ($dest_mail == $question->get_validator())
|
||||
{
|
||||
$file = fopen('email.txt', 'r');
|
||||
@ -34,7 +34,7 @@ else
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
*/
|
||||
|
||||
/* This code works, perhaps should be placed in a method in Question class?*/
|
||||
$to = $dest_mail;
|
||||
$subject = "[Nemubot] Validation d'une question";
|
||||
|
@ -1,6 +1,5 @@
|
||||
2
|
||||
4
|
||||
bertrand.cournaud@gmail.com
|
||||
bertrand.cournaud@epita.fr
|
||||
|
||||
ircquizz@23.tf
|
||||
ircquizz@p0m.fr
|
||||
|
@ -9,6 +9,26 @@ define("FILENAME", "questions_file.nemubot");
|
||||
include("Question.class.php");
|
||||
include("QuestionsFile.class.php");
|
||||
|
||||
function isInList($mail)
|
||||
{
|
||||
$file = fopen('email.txt', 'r');
|
||||
$number = fgets($file);
|
||||
$i = 0;
|
||||
$file_mail = fgets($file);
|
||||
|
||||
while ($i < $number)
|
||||
{
|
||||
if (trim($mail) == trim($file_mail))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$file_mail = fgets($file);
|
||||
$i++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Change this variable depending on the server
|
||||
$confirmationAddress = "confirmation.php?id=";
|
||||
@ -33,7 +53,7 @@ if (isset ($_POST['send']))
|
||||
die("Veuillez indiquer une question !");
|
||||
else if (count($answers) <= 0)
|
||||
die("Veuillez indiquer au moins une réponse correcte !");
|
||||
else if (count($_POST['email']) <= 0)
|
||||
else if (count($_POST['email']) <= 0 || !isInList($_POST['email']))
|
||||
die("Veuillez indiquer une adresse mail valide");
|
||||
else
|
||||
{
|
||||
@ -61,6 +81,11 @@ if (isset ($_POST['send']))
|
||||
."Une nouvelle question a été proposée à Nemubot en utilisant
|
||||
cette adresse email.\n\n"
|
||||
|
||||
."Rappels de la questions:\n"
|
||||
.'Cours concerné : ' . $course . "\n"
|
||||
.'La question est : ' . $question . "\n"
|
||||
.'Les réponses sont : ' . print_r($answers, true) . "\n"
|
||||
|
||||
."Si vous avez effectivement posé cette question, merci "
|
||||
."de cliquer sur le lien ci-dessous pour confirmer.\n"
|
||||
."Si vous ne comprenez rien à cet email ou que vous n'avez pas "
|
||||
|
Reference in New Issue
Block a user