]> git.mjollnir.org Git - moodle.git/commitdiff
Keep guests out of chat
authormoodler <moodler>
Mon, 3 Nov 2003 10:22:24 +0000 (10:22 +0000)
committermoodler <moodler>
Mon, 3 Nov 2003 10:22:24 +0000 (10:22 +0000)
mod/chat/gui_header_js/index.php
mod/chat/report.php
mod/chat/view.php

index f19e37b4be9e7b2ad57b128aa9112775e33e70e9..c74eac2de06ce565c63d567aa697d5c3e959f46a 100644 (file)
@@ -15,6 +15,10 @@ if (!$course = get_record("course", "id", $chat->course)) {
 
 require_login($course->id);
 
+if (isguest()) {
+    error("Guest does not have access to chat rooms");
+}
+
 if (!$chat_sid = chat_login_user($chat->id, "header_js")) {
     error("Could not log in to chat room!!");
 }
index 3a64c0629ba5e4e2e7ecfef699d562d25175db9d..1581dc2db49c1a554298123ff787b248673e85ec 100644 (file)
@@ -21,8 +21,8 @@
 
     require_login($course->id);
 
-    if (!isteacher($course->id) and !$chat->studentlogs) {
-        error("Only teachers are allowed to view these chat reports");
+    if (isguest() or (!isteacher($course->id) and !$chat->studentlogs)) {
+        error("You can not view these chat reports");
     }
 
     add_to_log($course->id, "chat", "view", "view.php?id=$cm->id", "$chat->id");
index b55c1257836826decf0ba75a6fcbb117f559f8d8..4cea37c128574313517be331a71d45b115b97437 100644 (file)
@@ -59,7 +59,7 @@
                   "", "", true, update_module_button($cm->id, $course->id, $strchat), 
                   navmenu($course, $cm));
 
-    if ($chat->studentlogs or isteacher($course->id)) {
+    if (($chat->studentlogs or isteacher($course->id)) and !isguest()) {
         echo "<p align=right><a href=\"report.php?id=$chat->id\">".
               get_string("viewreport", "chat")."</a></p>";
     }
     print_heading($chat->name);
 
 
-    print_simple_box_start("center");
-    link_to_popup_window ("/mod/chat/gui_$chatversion/index.php?id=$chat->id", 
-                          "chat$course->id$chat->id", "$strenterchat", 500, 700, $strchat);
-    print_simple_box_end();
+    if (!isguest()) {
+        print_simple_box_start("center");
+        link_to_popup_window ("/mod/chat/gui_$chatversion/index.php?id=$chat->id", 
+                              "chat$course->id$chat->id", "$strenterchat", 500, 700, $strchat);
+        print_simple_box_end();
+    }
 
 
     if ($chat->chattime and $chat->schedule) {  // A chat is scheduled