/** * Given an ID of an instance of this module, * this function will permanently delete the instance * and any data that depends on it. * * @param int $id Id of the module instance * @return boolean Success/Failure */ function bigbluebutton_delete_instance($id) { global $CFG, $DB; if (!($bigbluebutton = $DB->get_record('bigbluebutton', array('id' => $id)))) { return false; } $result = true; // // End the session associated with this instance (if it's running) // $meetingID = $bigbluebutton->meetingid; $modPW = $bigbluebutton->moderatorpass; $url = trim(trim($CFG->BigBlueButtonServerURL), '/') . '/'; $salt = trim($CFG->BigBlueButtonSecuritySalt); $getArray = BigBlueButton::endMeeting($meetingID, $modPW, $url, $salt); if (!$DB->delete_records('bigbluebutton', array('id' => $bigbluebutton->id))) { $result = false; } return $result; }
/** * Given an ID of an instance of this module, * this function will permanently delete the instance * and any data that depends on it. * * @param int $id Id of the module instance * @return boolean Success/Failure */ function bigbluebutton_delete_instance($id) { global $CFG; if (!($bigbluebutton = get_record('bigbluebutton', 'id', $id))) { return false; } $result = true; // // End the session associated with this instance (if it's running) // $meetingID = $bigbluebutton->meetingid; $modPW = $bigbluebutton->moderatorpass; $url = trim(trim($CFG->BigBlueButtonServerURL), '/') . '/'; $salt = trim($CFG->BigBlueButtonSecuritySalt); $getArray = BigBlueButton::endMeeting($meetingID, $modPW, $url, $salt); if (!delete_records('bigbluebutton', 'id', $bigbluebutton->id)) { //echo $endURL = '<a href='.BBBMeeting::endMeeting( $mToken, "mp", getBBBServerIP(), $salt ).'>'."End Meeting".'</a>'; #switch to remove the meetingname # BBBMeeting::endMeeting( $bigbluebutton->, "mp", getBBBServerIP(), $bigbluebutton->salt ); $result = false; } return $result; }
/** * Ends a meeting */ function end() { //get the meeting $id = JRequest::getVar('id'); $query = ' SELECT * FROM #__bbb WHERE id =' . $id; $db =& JFactory::getDBO(); $db->setQuery($query); $meeting = $db->loadObject(); if (!$meeting || $meeting == null) { $msg = "This meeting no longer exists."; $this->setRedirect('index.php?option=com_bigbluebuttonconferencing', $msg); } // This is the security salt that must match the value set in the BigBlueButton server // This is the URL for the BigBlueButton server $row =& JTable::getInstance('settings', 'Table'); $row->load(1); $row->name == 'salt' ? $salt = $row->varValue : ($url = $row->varValue); $row->load(2); $row->name == 'salt' ? $salt = $row->varValue : ($url = $row->varValue); if (!$salt || $salt == '' || !$url || $url == '') { $msg = "You have to fill out the salt and url in the settings menu before you can delete a meeting."; $this->setRedirect('index.php?option=com_bigbluebuttonconferencing', $msg); return; } $response = BigBlueButton::endMeeting($meeting->meetingName . "[" . $meeting->meetingVersion . "]", $meeting->moderatorPW, $url, $salt); //Analyzes the bigbluebutton server's response if (!$response) { //If the server is unreachable, then prompts the user of the necessary action $msg = "Unable to join the meeting. Please check the url of the bigbluebutton server AND check to see if the bigbluebutton server is running."; $this->setRedirect('index.php?option=com_bigbluebuttonconferencing', $msg); } else { if ($response['returncode'] == 'FAILED') { //The meeting was not created if ($response['messageKey'] == 'checksumError') { $msg = "A checksum error occured. Make sure you entered the correct salt."; } else { $msg = $response['message']; } $this->setRedirect('index.php?option=com_bigbluebuttonconferencing', $msg); } else { //The meeting was created, and the user will now be joined $msg = $meeting->meetingName . " has been terminated."; $this->setRedirect('index.php?option=com_bigbluebuttonconferencing', $msg); } } }
} } $salt = trim($CFG->BigBlueButtonSecuritySalt); $url = trim(trim($CFG->BigBlueButtonServerURL), '/') . '/'; $logoutURL = $CFG->wwwroot; if (isset($_POST['submit']) && $_POST['submit'] == 'end') { // // A request to end the meeting // if (!($bigbluebutton = get_record('bigbluebutton', 'id', $a))) { error("BigBlueButton ID {$a} is incorrect"); } print get_string('index_ending', 'bigbluebutton'); $meetingID = $bigbluebutton->meetingid; $modPW = $bigbluebutton->moderatorpass; $getArray = BigBlueButton::endMeeting($meetingID, $modPW, $url, $salt); // print_object( $getArray ); $bigbluebutton->meetingid = bigbluebutton_rand_string(16); if (!update_record('bigbluebutton', $bigbluebutton)) { notice("Unable to assign a new meetingid"); } else { redirect('index.php?id=' . $id); } } // print_object( $bigbluebuttons ); foreach ($bigbluebuttons as $bigbluebutton) { $info = null; $joinURL = null; $user = null; $result = null; $users = "-";
function bbb_list_meetings() { global $wpdb; $table_name = $wpdb->prefix . "bbb_meetingRooms"; global $url_name, $salt_name, $meetingID_name, $meetingVersion_name, $moderatorPW_name, $current_user, $attendeePW_name; //Displays the title of the page echo "<h2>List of Meeting Rooms</h2>"; $url_val = get_option($url_name); $salt_val = get_option($salt_name); //---------------------------------------------------JOIN----------------------------------------------- if (isset($_POST['Submit'])) { //Creates then joins the meeting. If any problems occur the error is displayed // Read the posted value and delete $meetingID = $_POST[$meetingID_name]; $found = $wpdb->get_row("SELECT * FROM " . $table_name . " WHERE meetingID = '" . $meetingID . "'"); $moderatorPW = $found->moderatorPW; $attendeePW = $found->attendeePW; $meetingVersion = $found->meetingVersion; if ($_POST['Submit'] == 'Join') { //Calls create meeting on the bigbluebutton server $response = BigBlueButton::createMeetingArray($current_user->display_name, $meetingID . "[" . $meetingVersion . "]", "", $moderatorPW, $attendeePW, $salt_val, $url_val, get_option('siteurl')); $createNew = false; //Analyzes the bigbluebutton server's response if (!$response) { //If the server is unreachable, then prompts the user of the necessary action echo '<div class="updated"><p><strong>Unable to join the meeting. Please check the url of the bigbluebutton server AND check to see if the bigbluebutton server is running.</strong></p></div>'; } else { if ($response['returncode'] == 'FAILED') { //The meeting was not created if ($response['messageKey'] == 'idNotUnique') { $createNew = true; } else { if ($response['messageKey'] == 'checksumError') { echo '<div class="updated"><p><strong>A checksum error occured. Make sure you entered the correct salt.</strong></p></div>'; } else { echo '<div class="updated"><p><strong>' . $response['message'] . '</strong></p></div>'; } } } else { $bbb_joinURL = BigBlueButton::joinURL($meetingID . "[" . $meetingVersion . "]", $current_user->display_name, $moderatorPW, $salt_val, $url_val); ?> <script type="text/javascript"> window.location = "<?php echo $bbb_joinURL; ?> ";</script><?php return; } } } else { if ($_POST['Submit'] == 'End') { //Obtains the meeting information of the meeting that is going to be terminated //Calls endMeeting on the bigbluebutton server $response = BigBlueButton::endMeeting($meetingID . "[" . $meetingVersion . "]", $moderatorPW, $url_val, $salt_val); //Analyzes the bigbluebutton server's response if (!$response) { //If the server is unreachable, then prompts the user of the necessary action echo '<div class="updated"><p><strong>Unable to terminate the meeting. Please check the url of the bigbluebutton server AND check to see if the bigbluebutton server is running.</strong></p></div>'; } else { if ($response['returncode'] == 'SUCCESS') { //The meeting was terminated echo '<div class="updated"><p><strong>' . $meetingID . ' meeting has been terminated.</strong></p></div>'; //In case the meeting is created again it sets the meeting version to the time stamp. Therefore the meeting can be recreated before the 1 hour rule without any problems. $meetingVersion = time(); $wpdb->update($table_name, array($meetingVersion_name => $meetingVersion), array($meetingID_name => $meetingID)); } else { //If the meeting was unable to be termindated if ($response['messageKey'] == 'checksumError') { echo '<div class="updated"><p><strong>A checksum error occured. Make sure you entered the correct salt.</strong></p></div>'; } else { echo '<div class="updated"><p><strong>' . $response['message'] . '</strong></p></div>'; } } } } else { if ($_POST['Submit'] == 'Delete') { //Obtains the meeting information of the meeting that is going to be delete //Calls endMeeting on the bigbluebutton server $response = BigBlueButton::endMeeting($meetingID . "[" . $meetingVersion . "]", $moderatorPW, $url_val, $salt_val); //Analyzes the bigbluebutton server's response if (!$response) { //If the server is unreachable, then prompts the user of the necessary action echo '<div class="updated"><p><strong>Unable to delete the meeting. Please check the url of the bigbluebutton server AND check to see if the bigbluebutton server is running.</strong></p></div>'; } else { if ($response['returncode'] != 'SUCCESS' && $response['messageKey'] != 'notFound') { //If the meeting was unable to be deleted due to an error if ($response['messageKey'] == 'checksumError') { echo '<div class="updated"><p><strong>A checksum error occured. Make sure you entered the correct salt.</strong></p></div>'; } else { echo '<div class="updated"><p><strong>' . $response['message'] . '</strong></p></div>'; } } else { //The meeting was terminated $wpdb->query("DELETE FROM " . $table_name . " WHERE meetingID = '" . $meetingID . "'"); echo '<div class="updated"><p><strong>' . $meetingID . ' meeting has been deleted.</strong></p></div>'; } } } } } } //Gets all the meetings from the wordpress db $listOfMeetings = $wpdb->get_results("SELECT meetingID, meetingVersion, attendeePW, moderatorPW, waitForModerator FROM " . $table_name . " ORDER BY meetingID"); //Checks to see if there are no meetings in the wordpress db and if so alerts the user if (count($listOfMeetings) == 0) { echo '<div class="updated"><p><strong>There are no meeting rooms.</strong></p></div>'; return; } //Iinitiallizes the table $printed = false; //Displays the meetings in the wordpress database that have not been created yet. Avoids displaying //duplicate meetings, meaning if the same meeting already exists in the bbb server then it is //not displayed again in this for loop foreach ($listOfMeetings as $meeting) { $info = BigBlueButton::getMeetingInfoArray($meeting->meetingID . "[" . $meeting->meetingVersion . "]", $meeting->moderatorPW, $url_val, $salt_val); //Analyzes the bigbluebutton server's response if (!$info) { //If the server is unreachable, then prompts the user of the necessary action echo '<div class="updated"><p><strong>Unable to display the meetings. Please check the url of the bigbluebutton server AND check to see if the bigbluebutton server is running.</strong></p></div>'; return; } else { if ($info['returncode'] && $info['messageKey'] != 'notFound' && $info['messageKey'] != 'invalidPassword') { //If the meeting was unable to be deleted due to an error if ($info['messageKey'] == 'checksumError') { echo '<div class="updated"><p><strong>A checksum error occured. Make sure you entered the correct salt.</strong></p></div>'; } else { echo '<div class="updated"><p><strong>' . $info['message'] . '</strong></p></div>'; } return; } else { if ($info['returncode'] && ($info['messageKey'] == 'notFound' || $info['messageKey'] != 'invalidPassword')) { //The meeting exists only in the wordpress db if (!$printed) { bbb_print_table_header(); $printed = true; } ?> <form name="form1" method="post" action=""> <input type="hidden" name="<?php echo $meetingID_name; ?> " value="<?php echo $meeting->meetingID; ?> "> <tr> <td><?php echo $meeting->meetingID; ?> </td> <td><?php echo $meeting->attendeePW; ?> </td> <td><?php echo $meeting->moderatorPW; ?> </td> <td> <?php if ($meeting->waitForModerator) { echo "Yes"; } else { echo "No"; } ?> </td> <td>No</td> <td> <input type="submit" name="Submit" class="button-primary" value="Join" /> <input type="submit" name="Submit" onClick="return confirm('Are you sure you want to delete the meeting?')" class="button-primary" value="Delete"/> </td> </tr> </form> <?php } else { //The meeting exists in the bbb server if (!$printed) { bbb_print_table_header(); $printed = true; } ?> <form name="form1" method="post" action=""> <input type="hidden" name="<?php echo $meetingID_name; ?> " value="<?php echo $meeting->meetingID; ?> "> <tr> <td><?php echo $meeting->meetingID; ?> </td> <td><?php echo $meeting->attendeePW; ?> </td> <td><?php echo $meeting->moderatorPW; ?> </td> <td> <?php if ($meeting->waitForModerator) { echo "Yes"; } else { echo "No"; } ?> </td> <td> <?php if ($info['running'] == 'true') { echo "Yes"; } else { echo "No"; } ?> </td> <?php if ($info['hasBeenForciblyEnded'] == 'false') { ?> <td> <input type="submit" name="Submit" class="button-primary" value="Join" /> <input type="submit" name="Submit" onClick="return confirm('Are you sure you want to end the meeting?')" class="button-primary" value="End" /> <input type="submit" name="Submit" onClick="return confirm('Are you sure you want to delete the meeting?')" class="button-primary" value="Delete" /> </td> <?php } else { ?> <td> <!-- Meeting has ended and is temporarily unavailable. --> <input type="submit" name="Submit" class="button-primary" value="Join" /> <input type="submit" name="Submit" onClick="return confirm('Are you sure you want to delete the meeting?')" class="button-primary" value="Delete" /> </td> <?php } ?> </tr> </form> <?php } } } } ?> </table> </div> <?php }
/** * Given an ID of an instance of this module, * this function will permanently delete the instance * and any data that depends on it. * * @param int $id Id of the module instance * @return boolean Success/Failure */ function livewebteaching_delete_instance($id) { global $CFG; if (!($livewebteaching = get_record('livewebteaching', 'id', $id))) { return false; } $result = true; // // End the session associated with this instance (if it's running) // $meetingID = $livewebteaching->meetingid; $modPW = $livewebteaching->moderatorpass; $url = trim(trim($CFG->lwt_server), '/') . '/'; $salt = trim($CFG->lwt_apikey); $getArray = BigBlueButton::endMeeting($meetingID, $modPW, $url, $salt, $CFG->lwt_username); if (!delete_records('livewebteaching', 'id', $livewebteaching->id)) { //echo $endURL = '<a href='.BBBMeeting::endMeeting( $mToken, "mp", getBBBServerIP(), $salt ).'>'."End Meeting".'</a>'; #switch to remove the meetingname # BBBMeeting::endMeeting( $livewebteaching->, "mp", getBBBServerIP(), $livewebteaching->salt ); $result = false; } return $result; }