Esempio n. 1
0
function aconnect_login()
{
    global $CFG, $USER, $COURSE;
    if (!isset($CFG->adobeconnect_host) or !isset($CFG->adobeconnect_admin_login) or !isset($CFG->adobeconnect_admin_password)) {
        if (is_siteadmin($USER->id)) {
            notice(get_string('adminnotsetupproperty', 'adobeconnect'), $CFG->wwwroot . '/admin/settings.php?section=modsettingadobeconnect');
        } else {
            notice(get_string('notsetupproperty', 'adobeconnect'), '', $COURSE);
        }
    }
    if (isset($CFG->adobeconnect_port) and !empty($CFG->adobeconnect_port) and (80 != $CFG->adobeconnect_port and 0 != $CFG->adobeconnect_port)) {
        $port = $CFG->adobeconnect_port;
    } else {
        $port = 80;
    }
    $aconnect = new connect_class_dom($CFG->adobeconnect_host, $CFG->adobeconnect_port, $CFG->adobeconnect_admin_login, $CFG->adobeconnect_admin_password);
    $params = array('action' => 'common-info');
    $aconnect->create_request($params);
    $aconnect->read_cookie_xml($aconnect->_xmlresponse);
    $params = array('action' => 'login', 'login' => $aconnect->get_username(), 'password' => $aconnect->get_password());
    $aconnect->create_request($params);
    if ($aconnect->call_success()) {
        $aconnect->set_connection(1);
    } else {
        $aconnect->set_connection(0);
    }
    return $aconnect;
}
Esempio n. 2
0
            }
        }
    } else {
        $validuser = false;
        notice(get_string('unableretrdetails', 'adobeconnect'));
    }
    aconnect_logout($aconnect);
    // User is either valid or invalid, if valid redirect user to the meeting url
    if (empty($validuser)) {
        notice(get_string('notparticipant', 'adobeconnect'));
    } else {
        $protocol = 'http://';
        $https = false;
        $login = $usrobj->username;
        if (isset($CFG->adobeconnect_https) and !empty($CFG->adobeconnect_https)) {
            $protocol = 'https://';
            $https = true;
        }
        $aconnect = new connect_class_dom($CFG->adobeconnect_host, $CFG->adobeconnect_port, '', '', '', $https);
        $aconnect->request_http_header_login(1, $login);
        // Include the port number only if it is a port other than 80
        $port = '';
        if (!empty($CFG->adobeconnect_port) and 80 != $CFG->adobeconnect_port) {
            $port = ':' . $CFG->adobeconnect_port;
        }
        add_to_log($course->id, 'adobeconnect', 'join meeting', "join.php?id={$cm->id}&groupid={$groupid}&sesskey={$sesskey}", "Joined {$adobeconnect->name} meeting", $cm->id);
        redirect($protocol . $CFG->adobeconnect_meethost . $port . $meeting->url . '?session=' . $aconnect->get_cookie());
    }
} else {
    notice(get_string('usernotenrolled', 'adobeconnect'));
}
            echo $renderer->display_edit_recording($recscoid, $recording, $id, $groupid, $adobeconnect->name);
            echo $OUTPUT->footer();
            add_to_log($course->id, 'adobeconnect', 'update recording', "view.php?id={$cm->id}", "Edit recording, id: {$recscoid}; name: {$recording->name}; ", $cm->id);
        } else {
            add_to_log($course->id, 'adobeconnect', 'view recording', "view.php?id={$cm->id}", "{$mode}, id: {$recscoid}; name: {$recording->name}", $cm->id);
            // Log the fact that the user has watched the recording
            if (strcasecmp($mode, 'normal') == 0) {
                $userid = empty($USER->id) ? '0' : $USER->id;
                $exists = $DB->record_exists('adobeconnect_watched', array('scoid' => $recscoid, 'instanceid' => $cm->id, 'userid' => $userid));
                if (!$exists) {
                    $record = new stdClass();
                    $record->scoid = $recscoid;
                    $record->instanceid = $cm->id;
                    $record->userid = $userid;
                    $DB->insert_record('adobeconnect_watched', $record);
                }
            }
            // Get HTTPS setting.
            $https = false;
            $protocol = 'http://';
            if (isset($CFG->adobeconnect_https) and !empty($CFG->adobeconnect_https)) {
                $https = true;
                $protocol = 'https://';
            }
            $aconnect = new connect_class_dom($CFG->adobeconnect_host, $CFG->adobeconnect_port, '', '', '', $https);
            $aconnect->request_http_header_login(1, $usrobj->username);
            $adobesession = $aconnect->get_cookie();
            redirect($protocol . $CFG->adobeconnect_meethost . $port . $recording->url . '?session=' . $aconnect->get_cookie() . '&pbMode=' . $mode);
        }
    }
}
    error('Course module is incorrect');
}
require_login($course, true, $cm);
// ---------- //
// Get HTTPS setting
$https = false;
$protocol = 'http://';
if (isset($CFG->adobeconnect_https) and !empty($CFG->adobeconnect_https)) {
    $https = true;
    $protocol = 'https://';
}
// Create a Connect Pro login session for this user
$usrobj = new stdClass();
$usrobj = clone $USER;
$login = $usrobj->username;
$aconnect = new connect_class_dom($CFG->adobeconnect_host, $CFG->adobeconnect_port, '', '', '', $https);
$aconnect->request_http_header_login(1, $login);
$adobesession = $aconnect->get_cookie();
$params = array('instanceid' => $cm->instance, 'groupid' => $groupid);
$sql = "SELECT meetingscoid FROM {adobeconnect_meeting_groups} amg WHERE " . "amg.instanceid = :instanceid AND amg.groupid = :groupid";
$meetscoid = $DB->get_record_sql($sql, $params);
// Get the Meeting recording details
$aconnect = aconnect_login();
$recordings = array();
$fldid = aconnect_get_folder($aconnect, 'content');
$data = aconnect_get_recordings($aconnect, $fldid, $meetscoid->meetingscoid);
if (!empty($data)) {
    $recordings = $data;
}
// If at first you don't succeed ...
$data2 = aconnect_get_recordings($aconnect, $meetscoid->meetingscoid, $meetscoid->meetingscoid);
Esempio n. 5
0
function adobe_connection_test($host = '', $port = 80, $username = '', $password = '', $httpheader = '', $emaillogin, $https = false)
{
    if (empty($host) or empty($port) or 0 == $port or empty($username) or empty($password) or empty($httpheader)) {
        echo "</p>One of the required parameters is blank or incorrect: <br />" . "Host: {$host}<br /> Port: {$port}<br /> Username: {$username}<br /> Password: {$password}" . "<br /> HTTP Header: {$httpheader}</p>";
        die;
    }
    $aconnect = new connect_class_dom($host, $port, $username, $password, '', $https);
    $params = array('action' => 'common-info');
    // Send common-info call to obtain the session key.
    echo '<p>Sending common-info call:</p>';
    $aconnect->create_request($params);
    $response = $aconnect->get_xmlresponse();
    if (!empty($response)) {
        // Get the session key from the XML response.
        $aconnect->read_cookie_xml($response);
        $cookie = $aconnect->get_cookie();
        if (empty($cookie)) {
            echo '<p>unable to obtain session key from common-info call</p>';
            echo '<p>xmlrequest:</p>';
            $doc = new DOMDocument();
            if ($doc->loadXML($aconnect->get_xmlrequest())) {
                echo '<p>' . htmlspecialchars($doc->saveXML()) . '</p>';
            } else {
                echo '<p>unable to display the XML request</p>';
            }
            echo '<p>xmlresponse:</p>';
            $doc = new DOMDocument();
            if ($doc->loadXML($aconnect->get_xmlresponse())) {
                echo '<p>' . htmlspecialchars($doc->saveHTML()) . '</p>';
            } else {
                echo '<p>unable to display the XML response</p>';
            }
        } else {
            // Print success.
            echo '<p style="color:#006633">successfully obtained the session key: ' . $aconnect->get_cookie() . '</p>';
            // Test logging in as the administrator.
            $params = array('action' => 'login', 'login' => $aconnect->get_username(), 'password' => $aconnect->get_password());
            if ($aconnect->request($params)) {
                echo '<p style="color:#006633">successfully logged in as admin user</p>';
                // Test retrieval of folders.
                echo '<p>Testing retrevial of shared content, recording and meeting folders:</p>';
                $folderscoid = aconnect_get_folder($aconnect, 'content');
                if ($folderscoid) {
                    echo '<p style="color:#006633">successfully obtained shared content folder scoid: ' . $folderscoid . '</p>';
                } else {
                    echo '<p>error obtaining shared content folder</p>';
                    echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>';
                    echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>';
                }
                $folderscoid = aconnect_get_folder($aconnect, 'forced-archives');
                if ($folderscoid) {
                    echo '<p style="color:#006633">successfully obtained forced-archives (meeting recordings) folder scoid: ' . $folderscoid . '</p>';
                } else {
                    echo '<p>error obtaining forced-archives (meeting recordings) folder</p>';
                    echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>';
                    echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>';
                }
                $folderscoid = aconnect_get_folder($aconnect, 'meetings');
                if ($folderscoid) {
                    echo '<p style="color:#006633">successfully obtained meetings folder scoid: ' . $folderscoid . '</p>';
                } else {
                    echo '<p>error obtaining meetings folder</p>';
                    echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>';
                    echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>';
                }
                // Test creating a meeting.
                $folderscoid = aconnect_get_folder($aconnect, 'meetings');
                $meeting = new stdClass();
                $meeting->name = 'testmeetingtest';
                $time = time();
                $meeting->starttime = $time;
                $time = $time + 60 * 60;
                $meeting->endtime = $time;
                if ($meetingscoid = aconnect_create_meeting($aconnect, $meeting, $folderscoid)) {
                    echo '<p style="color:#006633">successfully created meeting <b>testmeetingtest</b> scoid: ' . $meetingscoid . '</p>';
                } else {
                    echo '<p>error creating meeting <b>testmeetingtest</b> folder</p>';
                    echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>';
                    echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>';
                }
                // Test creating a user.
                $user = new stdClass();
                $user->username = '******';
                $user->firstname = 'testusertest';
                $user->lastname = 'testusertest';
                $user->email = '*****@*****.**';
                if (!empty($emaillogin)) {
                    $user->username = $user->email;
                }
                $skipdeletetest = false;
                if (!($usrprincipal = aconnect_user_exists($aconnect, $user))) {
                    $usrprincipal = aconnect_create_user($aconnect, $user);
                    if ($usrprincipal) {
                        echo '<p style="color:#006633">successfully created user <b>testusertest</b> principal-id: ' . $usrprincipal . '</p>';
                    } else {
                        echo '<p>error creating user  <b>testusertest</b></p>';
                        echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>';
                        echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>';
                        aconnect_logout($aconnect);
                        die;
                    }
                } else {
                    echo '<p>user <b>testusertest</b> already exists skipping delete user test</p>';
                    $skipdeletetest = true;
                }
                // Test assigning a user a role to the meeting.
                if (aconnect_check_user_perm($aconnect, $usrprincipal, $meetingscoid, ADOBE_PRESENTER, true)) {
                    echo '<p style="color:#006633">successfully assigned user <b>testusertest</b>' . ' presenter role in meeting <b>testmeetingtest</b>: ' . $usrprincipal . '</p>';
                } else {
                    echo '<p>error assigning user <b>testusertest</b> presenter role in meeting <b>testmeetingtest</b></p>';
                    echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>';
                    echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>';
                }
                // Test removing role from meeting.
                if (aconnect_check_user_perm($aconnect, $usrprincipal, $meetingscoid, ADOBE_REMOVE_ROLE, true)) {
                    echo '<p style="color:#006633">successfully removed presenter role for user <b>testusertest</b>' . ' in meeting <b>testmeetingtest</b>: ' . $usrprincipal . '</p>';
                } else {
                    echo '<p>error remove presenter role for user <b>testusertest</b> in meeting <b>testmeetingtest</b></p>';
                    echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>';
                    echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>';
                }
                // Test removing user from server.
                if (!$skipdeletetest) {
                    if (aconnect_delete_user($aconnect, $usrprincipal)) {
                        echo '<p style="color:#006633">successfully removed user <b>testusertest</b> principal-id: ' . $usrprincipal . '</p>';
                    } else {
                        echo '<p>error removing user <b>testusertest</b></p>';
                        echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>';
                        echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>';
                    }
                }
                // Test removing meeting from server.
                if ($meetingscoid) {
                    if (aconnect_remove_meeting($aconnect, $meetingscoid)) {
                        echo '<p style="color:#006633">successfully removed meeting <b>testmeetingtest</b> scoid: ' . $meetingscoid . '</p>';
                    } else {
                        echo '<p>error removing meeting <b>testmeetingtest</b> folder</p>';
                        echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>';
                        echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>';
                    }
                }
            } else {
                echo '<p style="color:#680000">logging in as ' . $username . ' was not successful, check to see if the' . ' username and password are correct </p>';
            }
        }
    } else {
        echo '<p style="color:#680000">common-info API call returned an empty document.' . ' Please check your settings and try again </p>';
    }
    aconnect_logout($aconnect);
}