This repository has been archived by the owner on Nov 11, 2022. It is now read-only.
forked from remotelearner/moodle-mod_adobeconnect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conntest.php
111 lines (82 loc) · 3.58 KB
/
conntest.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package mod_adobeconnect
* @author Akinsaya Delamarre (adelamarre@remote-learner.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net
*/
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once(dirname(__FILE__) . '/locallib.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/accesslib.php');
require_login(SITEID, false);
global $USER, $CFG, $DB, $OUTPUT;
$checkifempty = true; // Check for uninitialized variable
$url = new moodle_url('/mod/adobeconnect/conntest.php');
$PAGE->set_url($url);
$admins = explode(',', $CFG->siteadmins);
if (false === array_search($USER->id, $admins)) {
print_error('error1', 'adobeconnect', $CFG->wwwroot);
}
$ac = new stdClass();
$param = array('name' => 'adobeconnect_admin_login');
$ac->login = $DB->get_field('config', 'value', $param);
$param = array('name' => 'adobeconnect_host');
$ac->host = $DB->get_field('config', 'value', $param);
$param = array('name' => 'adobeconnect_port');
$ac->port = $DB->get_field('config', 'value', $param);
$param = array('name' => 'adobeconnect_admin_password');
$ac->pass = $DB->get_field('config', 'value', $param);
$param = array('name' => 'adobeconnect_admin_httpauth');
$ac->httpauth = $DB->get_field('config', 'value', $param);
$param = array('name' => 'adobeconnect_email_login');
$ac->emaillogin = $DB->get_field('config', 'value', $param);
$param = array('name' => 'adobeconnect_https');
$ac->https = $DB->get_field('config', 'value', $param);
foreach ($ac as $propertyname => $propertyvalue) {
// Check if the property is equal to email login or https check boxes
// These are the only values allowed to be empty
$isnotemaillogin = strcmp($propertyname, 'emaillogin');
$isnothttps = strcmp($propertyname, 'https');
$checkifempty = $isnotemaillogin && $isnothttps;
// If this property is empty
if ($checkifempty and empty($propertyvalue)) {
print_error('error2', 'adobeconnect', '', $propertyname);
die();
}
}
$strtitle = get_string('connectiontesttitle', 'adobeconnect');
$systemcontext = context_system::instance();
$PAGE->set_context($systemcontext);
$PAGE->set_title($strtitle);
//$PAGE->set_heading($strtitle);
echo $OUTPUT->header();
echo $OUTPUT->box_start('center');
$param = new stdClass();
$param->url = 'http://docs.moodle.org/en/Remote_learner_adobe_connect_pro';
print_string('conntestintro', 'adobeconnect', $param);
if (!empty($ac->https)) {
$https = true;
} else {
$https = false;
}
adobe_connection_test($ac->host, $ac->port, $ac->login,
$ac->pass, $ac->httpauth,
$ac->emaillogin, $ac->https);
echo '<center>'. "\n";
echo '<input type="button" onclick="self.close();" value="' . get_string('closewindow') . '" />';
echo '</center>';
echo $OUTPUT->box_end();