]> git.mjollnir.org Git - moodle.git/commitdiff
Fix the submission of null entries when using the HTML editor.
authorrkingdon <rkingdon>
Thu, 24 Jun 2004 17:11:51 +0000 (17:11 +0000)
committerrkingdon <rkingdon>
Thu, 24 Jun 2004 17:11:51 +0000 (17:11 +0000)
mod/dialogue/dialogues.php

index f7d29b8383a34133cfabc783748857341caa3658..2af6ac9b8ef9287be4813daa5ba0fa271439327e 100644 (file)
                if ($conversations = dialogue_get_conversations($dialogue, $USER, "closed = 0")) {
                        foreach ($conversations as $conversation) {
                                $textarea_name = "reply$conversation->id";
-                               if (!empty($_POST[$textarea_name])) {
+                $stripped_text = '';
+                if (isset($_POST[$textarea_name])) {
+                    $stripped_text = strip_tags(trim($_POST[$textarea_name]));
+                }
+                               if ($stripped_text) {
                     unset($item);
                                        $item->dialogueid = $dialogue->id;
                                        $item->conversationid = $conversation->id;
 
                if ($_POST['recipientid'] == 0) {
                        redirect("view.php?id=$cm->id", get_string("nopersonchosen", "dialogue"));
-        } elseif (empty($_POST['firstentry'])) {
-                       redirect("view.php?id=$cm->id", get_string("notextentered", "dialogue"));
         } else {
+            $stripped_text = strip_tags(trim($_POST['firstentry']));
+            if (!$stripped_text) {
+                           redirect("view.php?id=$cm->id", get_string("notextentered", "dialogue"));
+            }
                        $conversation->dialogueid = $dialogue->id;
                        $conversation->userid = $USER->id;
                        $conversation->recipientid = $_POST['recipientid'];