From 25f83964554ccc64277ee52efec3b51b8e4981d8 Mon Sep 17 00:00:00 2001
From: Bertrand
Date: Wed, 23 May 2012 14:05:08 +0200
Subject: [PATCH] Discovery of php
---
questions.php | 154 +++++++++++++++++++++++++++-----------------------
1 file changed, 84 insertions(+), 70 deletions(-)
diff --git a/questions.php b/questions.php
index 79967a3..c7204bd 100755
--- a/questions.php
+++ b/questions.php
@@ -1,4 +1,79 @@
+
+ $value)
+ {
+ if ($key == "question")
+ $question = $value;
+ else if ($key == "course")
+ $course = $value;
+ else if (preg_match("#^answer#", $key))
+ $answers[] = $value;
+ }
+
+ //Check we have at least a question and an answer
+ if (empty($question))
+ die("Veuillez indiquer une question !");
+ else if (count($answers) <= 0)
+ die("Veuillez indiquer au moins une réponse correcte !");
+ else
+ {
+ $quest = Question::new_Question($question, $answers, $course);
+/* $quest->print_test();*/
+
+ // @TODO: Create/Load a QuestionFile and add the question (it must be unique)
+ $file = new QuestionsFile('questions.xml');
+ $file->add_question($quest);
+ $file->save();
+/*
+ echo "
";
+ echo "
C'est ici pour valider";
+ echo "
"
+ . "http://178.170.101.82/~Cccompany/nemubot_askweb/validation.php?id="
+ . $quest->getId();
+*/
+
+ // @TODO: Find a validator (from the list of previous senders for example?)
+
+ // @TODO: Update the question and save the file
+
+ // @TODO: Send mail to the selected validator
+
+/* This code works, perhaps should be placed in a method in Question class?
+ $to = "bertrand.cournaud@gmail.com";
+ $subject = "[Nemubot] Validation d'une question";
+ $headers = "From: Nemubot ";
+ $message = "Bonjour,\n";
+
+ if (mail($to, $subject, $message, $headers))
+ {
+ echo ("Email sent");
+ }
+ else
+ echo ("Error with the email");
+//*/
+ }
+
+}
+else
+ header("Location: ./");
+
+?>
+
@@ -25,76 +100,15 @@
La partie ci dessous est uniquement réservée au debug
Merci de ne pas en tenir compte
- $value)
- {
- if ($key == "question")
- $question = $value;
- else if ($key == "course")
- $course = $value;
- else if (preg_match("#^answer#", $key))
- $answers[] = $value;
- }
-
- //Check we have at least a question and an answer
- if (empty($question))
- die("Veuillez indiquer une question !");
- else if (count($answers) <= 0)
- die("Veuillez indiquer au moins une réponse correcte !");
- else
- {
- $quest = Question::new_Question($question, $answers, $course);
- $quest->print_test();
-
- // @TODO: Create/Load a QuestionFile and add the question (it must be unique)
- $file = new QuestionsFile('questions.xml');
- $file->add_question($quest);
- $file->save();
-
- echo "
";
- echo "
C'est ici pour valider";
- echo "
"
- . "http://178.170.101.82/~Cccompany/nemubot_askweb/validation.php?id="
- . $quest->getId();
-
- // @TODO: Find a validator (from the list of previous senders for example?)
-
- // @TODO: Update the question and save the file
-
- // @TODO: Send mail to the selected validator
-
-/* This code works, perhaps should be placed in a method in Question class?
- $to = "bertrand.cournaud@gmail.com";
- $subject = "[Nemubot] Validation d'une question";
- $headers = "From: Nemubot ";
- $message = "Bonjour,\n";
-
- if (mail($to, $subject, $message, $headers))
- {
- echo ("Email sent");
- }
- else
- echo ("Error with the email");
-//*/
- }
-}
-else
- header("Location: ./");
-
-?>
+
+ Rappels de la questions
+ print_test() ?>
+
+
+ URL de validation:
+ Valider la question
+