~ubuntu-branches/ubuntu/breezy/moodle/breezy

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2005-10-13 02:00:59 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051013020059-y2qcyo41t7nqppcg
Tags: 1.5.2-1ubuntu1
* Resync with debian (security update)
* changed dependencys to php5
* changed apache dependency to apache2 
* References
  CAN-2005-2247

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
 
1
<?php  // $Id: index.php,v 1.12 2005/03/27 11:36:54 stronk7 Exp $
 
2
 
2
3
    require_once('../../../config.php');
3
4
    require_once('../lib.php');
4
5
 
5
 
    require_variable($id);
6
 
    optional_variable($groupid, -1);
 
6
    $id      = required_param('id', PARAM_INT);
 
7
    $groupid = optional_param('groupid', 0, PARAM_INT); //only for teachers
7
8
 
8
9
    if (!$chat = get_record('chat', 'id', $id)) {
9
10
        error('Could not find that chat room!');
17
18
        error('Course Module ID was incorrect');
18
19
    }
19
20
 
20
 
    require_login($course->id);
 
21
    require_login($course->id, false, $cm);
21
22
 
22
23
    if (isguest()) {
23
24
        error('Guest does not have access to chat rooms');
24
25
    }
25
26
 
 
27
    if (!$cm->visible and !isteacher($course->id)) {
 
28
        print_header();
 
29
        notice(get_string("activityiscurrentlyhidden"));
 
30
    }
 
31
 
26
32
/// 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!");
 
33
     if ($groupmode = groupmode($course, $cm)) {   // Groups are being used
 
34
        if ($groupid = get_and_set_current_group($course, $groupmode, $groupid)) {
 
35
            if (!$group = get_record('groups', 'id', $groupid)) {
 
36
                error("That group (id $groupid) doesn't exist!");
31
37
            }
32
38
            $groupname = ': '.$group->name;
33
39
        } else {
34
40
            $groupname = ': '.get_string('allparticipants');
35
41
        }
36
42
    } else {
37
 
        $currentgroup = false;
 
43
        $groupid = 0;
38
44
        $groupname = '';
39
45
    }
40
46
 
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
 
 
 
47
    $strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!!
 
48
 
 
49
    if (!$chat_sid = chat_login_user($chat->id, 'sockets', $groupid, $course)) {
 
50
        error('Could not log in to chat room!!');
 
51
    }
 
52
 
 
53
    $params = "chat_sid=$chat_sid";
53
54
 
54
55
?>
55
56
 
56
57
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
57
58
<html>
58
59
 <head>
 
60
  <meta http-equiv="content-type" content="text/html; charset=<?php echo get_string('thischarset'); ?>" />
59
61
  <title>
60
 
   <?php echo "$strchat: $course->shortname: $chat->name$groupname" ?>
 
62
   <?php echo "$strchat: $course->shortname: ".format_string($chat->name,true)."$groupname" ?>
61
63
  </title>
62
64
 </head>
63
65
 <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">
 
66
  <frameset rows="0,*,50" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1">
65
67
   <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">
 
68
   <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
69
   <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1">
68
70
  </frameset>
69
71
  <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
 
  -->
73
72
 </frameset>
74
73
 <noframes>
75
74
  Sorry, this version of Moodle Chat needs a browser that handles frames.