-
Notifications
You must be signed in to change notification settings - Fork 2
/
loader.php
executable file
·97 lines (72 loc) · 2.32 KB
/
loader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
define('AT_INCLUDE_PATH', '../../include/');
require_once(AT_INCLUDE_PATH.'vitals.inc.php');
require_once('lib/ACUser.php');
require_once('lib/ACRoom.php');
require_once('lib/lib.php');
$courseid = $_SESSION['course_id'];
$member = getMemberData();
if (!$member) {
$msg->addError('adobe_connect_wrong_member_sess');
}
$assign = getMemberCourseAssign();
if (!$assign) {
$msg->addError('adobe_connect_no_access');
}
$acuser = new ACUser();
$acroom = new ACRoom();
// admin session
$xsid = $acuser->getAdminSession();
if (!$xsid) {
$msg->addError('adobe_connect_not_connect');
echo '<script>
window.opener.location.reload();
window.close();
</script>';
} else {
// room id
$scoid = $acroom->checkRoom($xsid, $courseid);
if (!$scoid) {
// comprovar que l'usuari té accés al mòdul
$createresult = $acroom->createRoom($xsid, $courseid);
if (!$createresult) {
$msg->addError('adobe_connect_not_create_room');
} else {
$scoid = $acroom->checkRoom($xsid, $courseid);
if (!$scoid) {
$msg->addError('adobe_connect_not_roomid');
}
}
}
// user session
$userexists = $acuser->checkUser($xsid, $member->login);
if (!$userexists) {
$createresult = $acuser->createUser($xsid, $member->login, $member->first_name, $member->last_name);
if (!$createresult) {
$msg->addError('adobe_connect_not_create_user');
} else {
$usid = $acuser->getUserSession($member->login);
if (!$usid) {
$msg->addError('adobe_connect_not_user_session');
}
}
} else {
$usid = $acuser->getUserSession($member->login);
}
// redirect url
$roomurl = $acroom->getRoomUrl($usid, $scoid);
if (!$roomurl) {
$createresult = $acroom->assignUser($xsid, $member->login, $courseid, $assign->role);
if (!$createresult) {
$msg->addError('adobe_connect_not_assign');
} else {
$roomurl = $acroom->getRoomUrl($usid, $scoid);
if (!$roomurl) {
$msg->addError('adobe_connect_not_roomurl');
}
}
}
}
$url = 'http://'.$acroom->getACHost().'/'.$roomurl.'?session='.$usid;
header('location: '.$url);
?>