incorrect use of preg_quote(), add '/' to list of quoted chars - see man page; merged...
[moodle.git] / mod / chat / gui_sockets / index.php
CommitLineData
1515a89e 1<?php
fbabbd23 2 require_once('../../../config.php');
b19cad7f 3 require_once('../lib.php');
4
5 require_variable($id);
6 optional_variable($groupid, -1);
7
fbabbd23 8 if (!$chat = get_record('chat', 'id', $id)) {
9 error('Could not find that chat room!');
b19cad7f 10 }
11
fbabbd23 12 if (!$course = get_record('course', 'id', $chat->course)) {
13 error('Could not find the course this belongs to!');
b19cad7f 14 }
15
fbabbd23 16 if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
17 error('Course Module ID was incorrect');
b19cad7f 18 }
19
20 require_login($course->id);
21
22 if (isguest()) {
fbabbd23 23 error('Guest does not have access to chat rooms');
b19cad7f 24 }
25
26/// Check to see if groups are being used here
27 if ($groupmode = groupmode($course, $cm)) { // Groups are being used
28 if ($currentgroup = get_and_set_current_group($course, $groupmode, $groupid)) {
29 if (!$group = get_record('groups', 'id', $currentgroup)) {
30 error("That group (id $currentgroup) doesn't exist!");
31 }
32 $groupname = ': '.$group->name;
33 } else {
34 $groupname = ': '.get_string('allparticipants');
35 }
36 } else {
37 $currentgroup = false;
38 $groupname = '';
39 }
40
41 if (!$chat_sid = chat_login_user($chat->id, 'sockets', $currentgroup)) {
42 error("Could not log in to chat room!!");
43 }
44
45 if ($currentgroup !== false) {
46 $params = "chat_enter=true&amp;chat_sid=$chat_sid&amp;groupid=$currentgroup";
47 } else {
48 $params = "chat_enter=true&amp;chat_sid=$chat_sid&amp;groupid=0";
49 }
50
51 $strchat = get_string("modulename", "chat");
52
53
1515a89e 54?>
b19cad7f 55
1515a89e 56<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
57<html>
58 <head>
59 <title>
b19cad7f 60 <?php echo "$strchat: $course->shortname: $chat->name$groupname" ?>
1515a89e 61 </title>
62 </head>
b19cad7f 63 <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
64 <frameset rows="0,*,40" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1">
65 <frame src="empty.php" name="empty" scrolling="auto" noresize marginwidth="2" marginheight="0">
1c61c8d6 66 <frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=chat&amp;$params"; ?>" name="msg" scrolling="auto" noresize marginwidth="2" marginheight="0">
b19cad7f 67 <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1">
1515a89e 68 </frameset>
e2b5964e 69 <frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=users&amp;$params"; ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
70 <!--
82a524ef 71 <frame src="../users.php?<?php echo $params ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
b19cad7f 72 -->
1515a89e 73 </frameset>
74 <noframes>
b19cad7f 75 Sorry, this version of Moodle Chat needs a browser that handles frames.
1515a89e 76 </noframes>
77</html>