/**
	*This method calls isMeetingRunning on the BigBlueButton server.
	*
	*@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
	*@param SALT -- the security salt of the bigbluebutton server
	*@param URL -- the url of the bigbluebutton server
	*
	*@return 
	* 	- If SUCCESS it returns an xml packet
	* 	- If the FAILED or the server is unreachable returns a string of 'false'
	*/
	public function getMeetingXML( $meetingID, $URL, $SALT ) {
		$xml = bbb_wrap_simplexml_load_file( BigBlueButton::isMeetingRunningURL( $meetingID, $URL, $SALT ) );
		if( $xml && $xml->returncode == 'SUCCESS') 
			return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
		else
			return 'false';	
	}
    function join($params)
    {
        $meetingName = JRequest::getVar('meetingName');
        $name = JRequest::getVar('display_name');
        $pwd = JRequest::getVar('pwd');
        $query = "SELECT * FROM #__bbb WHERE meetingName ='" . $meetingName . "'";
        $db =& JFactory::getDBO();
        $db->setQuery($query);
        $meeting = $db->loadObject();
        if (!$meeting || $meeting == null) {
            $msg['message'] = "This meeting no longer exists.";
            return $msg;
        }
        if ($meeting->moderatorPW != $pwd && $meeting->attendeePW != $pwd) {
            $msg['message'] = "Incorrect Password.";
            return $msg;
        }
        // This is the security salt that must match the value set in the BigBlueButton server
        // This is the URL for the BigBlueButton server
        $query = "SELECT * FROM #__bbb_settings WHERE name = 'salt'";
        $db->setQuery($query);
        $salt = $db->loadObject();
        $query = "SELECT * FROM #__bbb_settings WHERE name = 'url'";
        $db->setQuery($query);
        $url = $db->loadObject();
        if (!$salt || $salt->varValue == '' || !$url || $url->varValue == '') {
            $msg['message'] = "You have to fill out the salt and url in the settings menu before you can join a meeting.";
            return $msg;
        }
        for (;;) {
            $response = BigBlueButton::createMeetingArray($name, $meeting->meetingName . "[" . $meeting->meetingVersion . "]", 'Welcome to ' . $meeting->meetingName . '.', $meeting->moderatorPW, $meeting->attendeePW, $salt->varValue, $url->varValue, JURI::base());
            //Analyzes the bigbluebutton server's response
            if (!$response) {
                //If the server is unreachable, then prompts the user of the necessary action
                $msg['message'] = "Unable to join the meeting. Please check the url of the bigbluebutton server AND check to see if the bigbluebutton server is running.";
                return $msg;
            } else {
                if ($response['returncode'] == 'FAILED' && $response['messageKey'] != 'idNotUnique') {
                    //The meeting was not created
                    if ($response['messageKey'] == 'checksumError') {
                        $msg['message'] = "A checksum error occured. Make sure you entered the correct salt.";
                    } else {
                        $msg['message'] = $response['message'];
                    }
                    return $msg;
                } else {
                    if ($response['messageKey'] == 'idNotUnique' || $response['hasBeenForciblyEnded'] == 'true') {
                        $meeting->meetingVersion = time();
                        $db->updateObject('#__bbb', $meeting, 'id', false);
                        if ($db->getErrorNum()) {
                            $msg['message'] = $db->getErrorMsg();
                            return $msg;
                        }
                    } else {
                        //The meeting was created, and the user will now be joined
                        $bbb_joinURL = BigBlueButton::joinURL($meeting->meetingName . "[" . $meeting->meetingVersion . "]", $name, $pwd, $salt->varValue, $url->varValue);
                        if ($meeting->waitForModerator == 'yes' && $meeting->moderatorPW != $pwd && !BigBlueButton::isMeetingRunning($meeting->meetingName . "[" . $meeting->meetingVersion . "]", $url->varValue, $salt->varValue)) {
                            $msg['message'] = "redirect";
                            $msg['bbb_joinURL'] = $bbb_joinURL;
                            $msg['name'] = $name;
                            //$msg['meetingID'] = urlencode($meeting->meetingName."[".$meeting->meetingVersion."]");
                            $msg['meetingID'] = BigBlueButton::isMeetingRunningURL($meeting->meetingName . "[" . $meeting->meetingVersion . "]", $url->varValue, $salt->varValue);
                            return $msg;
                        }
                        ?>
<script type="text/javascript"> window.location = "<?php 
                        echo $bbb_joinURL;
                        ?>
";</script><?php 
                        return;
                    }
                }
            }
        }
    }
Пример #3
0
                $step = 4;
                $checkMeetingStatus = BigBlueButton::getMeetingInfoURL($_REQUEST['meetingID'], 'mp', $url, $salt);
            }
        } else {
            if (!$_REQUEST['username']) {
                $msg = "You must enter your name.";
                $step = 3;
            }
        }
        break;
    case 'isMeetingRunning':
        /*
         * This function proxy the request "isMeetingRunning" through PHP Script to BBB Server so we don't have any AJAX security issue
         */
        ob_clean();
        $checkMeetingStatus = BigBlueButton::isMeetingRunningURL($_REQUEST['meetingID'], $url, $salt);
        echo file_get_contents($checkMeetingStatus);
        die;
        break;
    case 'join':
        /*
         * We have an invite request to join an existing meeting and the meeting is running
         * We don't need to pass a meeting description as it's already been set by the first time the meeting was created.
         */
        $bbb_joinURL = BigBlueButton::joinURL($_REQUEST['meetingID'], $_REQUEST['username'], "ap", $salt, $url);
        ?>
			<script language="javascript" type="text/javascript">window.location.href="<?php 
        echo $bbb_joinURL;
        ?>
";</script>
			<?php