~ubuntu-branches/ubuntu/hoary/moodle/hoary

« back to all changes in this revision

Viewing changes to mod/chat/gui_sockets/index.php

  • Committer: Bazaar Package Importer
  • Author(s): Isaac Clerencia
  • Date: 2004-12-29 00:49:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041229004952-gliyqzpj2w3e7clx
Tags: 1.4.3-1
* Urgency high as upstream release fixes several security bugs
* New upstream release
* Write database creation errors and warn the user about it, 
closes: #285842, #285842

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
include("../config.inc.php");
3
 
include("../functions.inc.php");
 
2
    require_once('../../../config.php');
 
3
    require_once('../lib.php');
 
4
 
 
5
    require_variable($id);
 
6
    optional_variable($groupid, -1);
 
7
 
 
8
    if (!$chat = get_record('chat', 'id', $id)) {
 
9
        error('Could not find that chat room!');
 
10
    }
 
11
 
 
12
    if (!$course = get_record('course', 'id', $chat->course)) {
 
13
        error('Could not find the course this belongs to!');
 
14
    }
 
15
 
 
16
    if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
 
17
        error('Course Module ID was incorrect');
 
18
    }
 
19
 
 
20
    require_login($course->id);
 
21
 
 
22
    if (isguest()) {
 
23
        error('Guest does not have access to chat rooms');
 
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
 
4
54
?>
 
55
 
5
56
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
6
57
<html>
7
58
 <head>
8
59
  <title>
9
 
   <?php echo $arsc_parameters["title"]; ?>
 
60
   <?php echo "$strchat: $course->shortname: $chat->name$groupname" ?>
10
61
  </title>
11
62
 </head>
12
 
 <frameset cols="193,*" border="0" framespacing="no" frameborder="0" marginwidth="2" marginheight="1">
13
 
  <frame src="../shared/roomlist.php?arsc_sid=<?php echo $arsc_sid; ?>" name="roomlist" scrolling="auto" noresize marginwidth="0" marginheight="0">
14
 
  <frameset cols="*,120" border="0" framespacing="no" frameborder="0" marginwidth="2" marginheight="1">
15
 
   <frameset rows="1,*,40" border="1" framespacing="no" frameborder="0" marginwidth="2" marginheight="1">
16
 
    <frame src="../shared/empty.php" NAME="empty" scrolling="no" noresize marginwidth="0" marginheight="0">
17
 
    <frame src="http://<?php echo $arsc_parameters["socketserver_adress"].":".$arsc_parameters["socketserver_port"]; ?>/?arsc_sid=<?php echo $arsc_sid; ?>" NAME="msg" scrolling="auto" noresize marginwidth="2" marginheight="0">
18
 
    <frame src="chatinput.php?arsc_sid=<?php echo $arsc_sid; ?>" name="input" scrolling="no" noresize marginwidth="2" marginheight="1">
19
 
   </frameset>
20
 
   <frame src="../shared/userlist.php?arsc_sid=<?php echo $arsc_sid; ?>&arsc_enter=true" name="users" scrolling="auto" noresize marginwidth="2" marginheight="2">
 
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">
 
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">
 
67
   <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1">
21
68
  </frameset>
 
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
  <!--
 
71
  <frame src="../users.php?<?php echo $params ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
 
72
  -->
22
73
 </frameset>
23
74
 <noframes>
24
 
  Sorry, this version of ARSC needs a browser that understands framesets. But we have a lynx-friendly version too.
 
75
  Sorry, this version of Moodle Chat needs a browser that handles frames.
25
76
 </noframes>
26
77
</html>