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; } } } } }
$joinURL = BigBlueButton::joinURL($bigbluebutton->meetingid, $username, $modPW, $salt, $url, $userID); redirect($joinURL); } else { // // Login as a viewer, check if we need to wait // // "Viewer"; if ($bigbluebutton->wait) { // check if the session is running; if not, user is not allowed to join // print "MeeingID: #".$bigbluebutton->meetingid."#<br>"; $arr = BigBlueButton::getMeetingInfoArray($bigbluebutton->meetingid, $modPW, $url, $salt); $joinURL = BigBlueButton::joinURL($bigbluebutton->meetingid, $username, $viewerPW, $salt, $url, $userID); // print_object( $arr ); // print "Is Meeting runnign: #".BigBlueButton::isMeetingRunning( $bigbluebutton->meetingid, $url, $salt )."#<br>"; // print "BBB"; if (BigBlueButton::isMeetingRunning($bigbluebutton->meetingid, $url, $salt) == "true") { // // since the meeting is already running, we just join the session // print "<br />" . get_string('view_login_viewer', 'bigbluebutton') . "<br /><br />"; print "<center><img src='loading.gif' /></center>"; redirect($joinURL); } else { print "<br />" . get_string('view_wait', 'bigbluebutton') . "<br /><br />"; print '<center><img src="polling.gif"></center>'; } ?> <p></p> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="heartbeat.js"></script> <!-- script type="text/javascript" src="md5.js"></script -->
function bigbluebutton_sidebar($args) { session_start(); extract($args); echo $before_widget; echo $before_title; ?> BigBlueButton<?php echo $after_title; global $wpdb, $url_name, $salt_name, $meetingID_name, $meetingVersion_name, $attendeePW_name, $moderatorPW_name; //Read in existing option value from database $url_val = get_option($url_name); $salt_val = get_option($salt_name); //Gets all the meetings from wordpress database $table_name = $wpdb->prefix . "bbb_meetingRooms"; $listOfMeetings = $wpdb->get_results("SELECT meetingID, meetingVersion, moderatorPW FROM " . $table_name . " ORDER BY meetingID"); $dataSubmitted = false; $validMeeting = false; $meetingExist = false; if (isset($_POST['Submit']) && $_POST['Submit'] == 'Join') { //The user has submitted his login information $dataSubmitted = true; $meetingExist = true; //Read posted values $name = $_POST['display_name']; $password = $_POST['pwd']; $meetingID = $_POST[$meetingID_name]; $found = $wpdb->get_row("SELECT * FROM " . $table_name . " WHERE meetingID = '" . $meetingID . "'"); if ($found->meetingID == $meetingID && ($found->moderatorPW == $password || $found->attendeePW == $password)) { //Calls create meeting on the bigbluebutton server $response = BigBlueButton::createMeetingArray($name, $meetingID . "[" . $found->meetingVersion . "]", "", $found->moderatorPW, $found->attendeePW, $salt_val, $url_val, get_option('siteurl')); //Analyzes the bigbluebutton server's response if (!$response || $response['returncode'] == 'FAILED') { //If the server is unreachable, or an error occured echo "Sorry an error occured while joining the meeting."; echo $after_widget; return; } else { //The user can join the meeting, as it is valid $bbb_joinURL = BigBlueButton::joinURL($found->meetingID . "[" . $found->meetingVersion . "]", $name, $password, $salt_val, $url_val); //If the meeting is already running or the moderator is trying to join or a viewer is trying to join and the //do not wait for moderator option is set to false then the user is immediately redirected to the meeting if (BigBlueButton::isMeetingRunning($found->meetingID . "[" . $found->meetingVersion . "]", $url_val, $salt_val) && ($found->moderatorPW == $password || $found->attendeePW == $password) || $response['moderatorPW'] == $password || $response['attendeePW'] == $password && !$found->waitForModerator) { //If the password submitted is correct then the user gets redirected ?> <script type="text/javascript"> window.location = "<?php echo $bbb_joinURL; ?> ";</script><?php return; } else { if ($found->attendeePW == $password) { //Stores the url and salt of the bigblubutton server in the session $_SESSION[$url_name] = $url_val; $_SESSION[$salt_name] = $salt_val; //Displays the javascript to automatically redirect the user when the meeting begins bbb_display_redirect_script($bbb_joinURL, $found->meetingID, $found->meetingID . "[" . $found->meetingVersion . "]", $name); echo $after_widget; return; } } } } } //Displays the meetings in the wordpress database. foreach ($listOfMeetings as $meeting) { $validMeeting = true; break; } //If a valid meeting was found the login form is displayed if ($validMeeting) { //Alerts the user if the password they entered does not match //the meeting's password if ($dataSubmitted && !$meetingExist) { echo "***" . $meetingID . " no longer exists.***"; } else { if ($dataSubmitted) { echo "***Incorrect Password***"; } } ?> <form name="form1" method="post" action=""> <table> <tr> <td>Meeting</td> <td> <select name="<?php echo $meetingID_name; ?> "> <?php foreach ($listOfMeetings as $meeting) { echo "<option>" . $meeting->meetingID . "</option>"; } ?> </select> </tr> <tr> <td>Name</td> <td><INPUT type="text" id="name" name="display_name" size="10"></td> </tr> <tr> <td>Password</td> <td><INPUT type="password" name="pwd" size="10"></td> </tr> </table> <INPUT type="submit" name="Submit" value="Join"> </form> <?php } else { if ($dataSubmitted) { //Alerts the user if the password they entered does not match //the meeting's password echo "***" . $meetingID . " no longer exists.***<br />"; echo "No meeting rooms are currently available to join."; } else { echo "No meeting rooms are currently available to join."; } } echo $after_widget; }
" width="100%" height="100%" style="position: absolute: bottom: 0px; border: 0px;overflow:hidden;"></iframe> <?php } else { // // Login as a viewer, check if we need to wait // // "Viewer"; if ($livewebteaching->wait) { // check if the session is running; if not, user is not allowed to join // print "MeeingID: #".$livewebteaching->meetingid."#<br>"; $arr = BigBlueButton::getMeetingInfoArray($livewebteaching->meetingid, $modPW, $url, $salt); $joinURL = BigBlueButton::joinURL($livewebteaching->meetingid, $username, $viewerPW, $salt, $url, $userID); // print_object( $arr ); // print "Is Meeting runnign: #".BigBlueButton::isMeetingRunning( $livewebteaching->meetingid, $url, $salt )."#<br>"; // print "BBB"; if (BigBlueButton::isMeetingRunning($livewebteaching->meetingid, $url, $salt) == "true") { // // since the meeting is already running, we just join the session // //print "<br />".get_string('view_login_viewer', 'livewebteaching' )."<br /><br />"; //print "<center><img src='loading.gif' /></center>"; ?> <iframe src ="<?php echo $joinURL; ?> " width="100%" height="100%" style="position: absolute: bottom: 0px; border: 0px;overflow:hidden;"></iframe> <?php } else { print '<div style="position: absolute; left: 20px; top: 100px; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; border: solid 1px #ccc; background: #fff; color: #000; padding: 20px; text-align: center;">'; print '<br />' . get_string('view_wait', 'livewebteaching') . '<br /><br />'; print '<img src="polling.gif">';
case 'invite': /* * We have an invite to an active meeting. Ask the person for their name so they can join. */ if (trim($_REQUEST['meetingID'])) { $step = 3; } break; case 'enter': /* * The user is now attempting to join the meeting */ if (trim($_REQUEST['username']) && trim($_REQUEST['meetingID'])) { $bbb_joinURL = BigBlueButton::joinURL($_REQUEST['meetingID'], $_REQUEST['username'], "ap", $salt, $url); //$joinURL = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?action=join&username='******'username']).'&meetingToken='.urlencode($_REQUEST['meetingToken']); if (BigBlueButton::isMeetingRunning($_REQUEST['meetingID'], $url, $salt)) { ?> <script language="javascript" type="text/javascript"> window.location.href="<?php echo $bbb_joinURL; ?> "; </script> <?php } else { /* * The meeting has not yet started, so check until we get back the status that the meeting is running */ $step = 4; $checkMeetingStatus = BigBlueButton::getMeetingInfoURL($_REQUEST['meetingID'], 'mp', $url, $salt); }