From 3245a3750ee2ea6341fe23f07573237ba179b350 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Sun, 29 Nov 2020 15:18:57 +0100 Subject: [PATCH] Internal: Update from 1.11.x --- public/plugin/bbb/README.md | 9 ++- public/plugin/bbb/lib/bbb.lib.php | 14 +++-- public/plugin/bbb/lib/bbb_plugin.class.php | 2 +- public/plugin/bbb/listing.php | 64 ++++++++++++++-------- public/plugin/bbb/start.php | 9 ++- public/plugin/zoom/endpoint.php | 3 +- public/plugin/zoom/lib/ZoomPlugin.php | 14 +++++ 7 files changed, 82 insertions(+), 33 deletions(-) diff --git a/public/plugin/bbb/README.md b/public/plugin/bbb/README.md index d7ff9fa812..c6d1c0aebf 100644 --- a/public/plugin/bbb/README.md +++ b/public/plugin/bbb/README.md @@ -63,8 +63,15 @@ For version 2.8 ```sql ALTER TABLE plugin_bbb_meeting ADD COLUMN internal_meeting_id VARCHAR(255) DEFAULT NULL; -ALTER TABLE plugin_bbb_room ADD close INT NOT NULL DEFAULT 0 +ALTER TABLE plugin_bbb_room ADD close INT NOT NULL DEFAULT 0; ``` ## Improve access tracking in BBB You need to configure the cron using the *cron_close_meeting.php* file. +# Digital ocean VM + +In order to use DigitalOceanVM classes a new package is required: + +``` +composer requires toin0u/digitalocean +``` diff --git a/public/plugin/bbb/lib/bbb.lib.php b/public/plugin/bbb/lib/bbb.lib.php index 72870774db..317a41e520 100644 --- a/public/plugin/bbb/lib/bbb.lib.php +++ b/public/plugin/bbb/lib/bbb.lib.php @@ -1221,7 +1221,7 @@ class bbb // Update users with in_at y ou_at field equal $roomTable = Database::get_main_table('plugin_bbb_room'); - $conditions['where'] = ['meeting_id=? AND in_at=out_at' => [$id]]; + $conditions['where'] = ['meeting_id=? AND in_at=out_at AND close=?' => [$id, BBBPlugin::ROOM_OPEN]]; $roomList = Database::select( '*', $roomTable, @@ -1230,11 +1230,13 @@ class bbb foreach ($roomList as $roomDB) { $roomId = $roomDB['id']; - Database::update( - $roomTable, - ['out_at' => api_get_utc_datetime(), 'close' => BBBPlugin::ROOM_CLOSE], - ['id = ? ' => $roomId] - ); + if (!empty($roomId)) { + Database::update( + $roomTable, + ['out_at' => api_get_utc_datetime(), 'close' => BBBPlugin::ROOM_CLOSE], + ['id = ? ' => $roomId] + ); + } } // Close all meeting rooms with meeting ID diff --git a/public/plugin/bbb/lib/bbb_plugin.class.php b/public/plugin/bbb/lib/bbb_plugin.class.php index 877583c26a..276cf09fed 100644 --- a/public/plugin/bbb/lib/bbb_plugin.class.php +++ b/public/plugin/bbb/lib/bbb_plugin.class.php @@ -214,7 +214,7 @@ class BBBPlugin extends Plugin ); $fieldLabel = 'plugin_bbb_course_users_limit'; $fieldType = ExtraField::FIELD_TYPE_INTEGER; - $fieldTitle = 'MaxUsersInConferenceRoom'; + $fieldTitle = $this->get_lang('MaxUsersInConferenceRoom'); $fieldDefault = '0'; $extraField = new ExtraField('course'); $fieldId = CourseManager::create_course_extra_field( diff --git a/public/plugin/bbb/listing.php b/public/plugin/bbb/listing.php index c6b27ff4eb..4748cf0c23 100644 --- a/public/plugin/bbb/listing.php +++ b/public/plugin/bbb/listing.php @@ -6,6 +6,13 @@ * This script initiates a video conference session, calling the BigBlueButton API. */ $course_plugin = 'bbb'; //needed in order to load the plugin lang variables +$isGlobal = isset($_GET['global']) ? true : false; +$isGlobalPerUser = isset($_GET['user_id']) ? (int) $_GET['user_id'] : false; + +// If global setting is used then we delete the course sessions (cidReq/id_session) +if ($isGlobalPerUser || $isGlobal) { + $cidReset = true; +} require_once __DIR__.'/config.php'; $plugin = BBBPlugin::create(); @@ -14,8 +21,6 @@ $roomTable = Database::get_main_table('plugin_bbb_room'); $htmlHeadXtra[] = api_get_js_simple(api_get_path(WEB_PLUGIN_PATH).'bbb/resources/utils.js'); -$isGlobal = isset($_GET['global']) ? true : false; -$isGlobalPerUser = isset($_GET['user_id']) ? (int) $_GET['user_id'] : false; $action = isset($_GET['action']) ? $_GET['action'] : ''; $userId = api_get_user_id(); @@ -212,11 +217,13 @@ if ($conferenceManager) { if (!empty($roomData)) { $roomId = $roomData['id']; - Database::update( - $roomTable, - ['out_at' => api_get_utc_datetime()], - ['id = ? ' => $roomId] - ); + if (!empty($roomId)) { + Database::update( + $roomTable, + ['out_at' => api_get_utc_datetime()], + ['id = ? ' => $roomId] + ); + } } $i++; } @@ -239,11 +246,13 @@ if ($conferenceManager) { if (!empty($roomData)) { $roomId = $roomData['id']; - Database::update( - $roomTable, - ['out_at' => api_get_utc_datetime(), 'close' => BBBPlugin::ROOM_CLOSE], - ['id = ? ' => $roomId] - ); + if (!empty($roomId)) { + Database::update( + $roomTable, + ['out_at' => api_get_utc_datetime(), 'close' => BBBPlugin::ROOM_CLOSE], + ['id = ? ' => $roomId] + ); + } } $message = Display::return_message( @@ -293,17 +302,19 @@ if ($conferenceManager) { $i = 0; foreach ($roomData as $item) { - $roomId = $roomData['id']; - if (0 == $i) { - Database::update( - $roomTable, - ['out_at' => api_get_utc_datetime()], - ['id = ? ' => $roomId] - ); - } else { - Database::update($roomTable, ['close' => BBBPlugin::ROOM_CLOSE], ['id = ? ' => $roomId]); - } + $roomId = $item['id']; + if (!empty($roomId)) { + if ($i == 0) { + Database::update( + $roomTable, + ['out_at' => api_get_utc_datetime(), 'close' => BBBPlugin::ROOM_CLOSE], + ['id = ? ' => $roomId] + ); + } else { + Database::update($roomTable, ['close' => BBBPlugin::ROOM_CLOSE], ['id = ? ' => $roomId]); + } $i++; + } } $message = Display::return_message( @@ -367,6 +378,15 @@ if (false === $bbb->isGlobalConference() && if ($conferenceManager) { $groups = GroupManager::get_groups(); } else { + if (!empty($groupId)) { + $groupInfo = GroupManager::get_group_properties($groupId); + if ($groupInfo) { + $isSubscribed = GroupManager::is_user_in_group(api_get_user_id(), $groupInfo); + if (false === $isSubscribed) { + api_not_allowed(true); + } + } + } $groups = GroupManager::getAllGroupPerUserSubscription( api_get_user_id(), api_get_course_int_id(), diff --git a/public/plugin/bbb/start.php b/public/plugin/bbb/start.php index 4ebf57e22c..e183704c53 100644 --- a/public/plugin/bbb/start.php +++ b/public/plugin/bbb/start.php @@ -7,6 +7,13 @@ require_once __DIR__.'/../../vendor/autoload.php'; $course_plugin = 'bbb'; //needed in order to load the plugin lang variables +$isGlobal = isset($_GET['global']) ? true : false; +$isGlobalPerUser = isset($_GET['user_id']) ? (int) $_GET['user_id'] : false; + +// If global setting is used then we delete the course sessions (cidReq/id_session) +if ($isGlobalPerUser || $isGlobal) { + $cidReset = true; +} require_once __DIR__.'/config.php'; $logInfo = [ @@ -20,8 +27,6 @@ $tpl = new Template($tool_name); $vmIsEnabled = false; $host = ''; $salt = ''; -$isGlobal = isset($_GET['global']) ? true : false; -$isGlobalPerUser = isset($_GET['user_id']) ? (int) $_GET['user_id'] : false; $interface = isset($_GET['interface']) ? (int) $_GET['interface'] : 0; $bbb = new bbb('', '', $isGlobal, $isGlobalPerUser); diff --git a/public/plugin/zoom/endpoint.php b/public/plugin/zoom/endpoint.php index cd2374c84d..4b5ca1dc30 100644 --- a/public/plugin/zoom/endpoint.php +++ b/public/plugin/zoom/endpoint.php @@ -8,6 +8,7 @@ use Chamilo\PluginBundle\Zoom\MeetingActivity; use Chamilo\PluginBundle\Zoom\Recording; use Symfony\Component\HttpFoundation\Response; +require_once __DIR__.'/config.php'; if ('POST' !== $_SERVER['REQUEST_METHOD']) { http_response_code(Response::HTTP_NOT_FOUND); // Not found exit; @@ -16,9 +17,9 @@ if ('POST' !== $_SERVER['REQUEST_METHOD']) { // @todo handle non-apache installations $authorizationHeaderValue = apache_request_headers()['Authorization']; -require_once __DIR__.'/config.php'; if (api_get_plugin_setting('zoom', 'verificationToken') !== $authorizationHeaderValue) { + error_log('verificationToken not valid, please check your zoom configuration'); http_response_code(Response::HTTP_UNAUTHORIZED); exit; } diff --git a/public/plugin/zoom/lib/ZoomPlugin.php b/public/plugin/zoom/lib/ZoomPlugin.php index 594abacea2..5b893a4d95 100644 --- a/public/plugin/zoom/lib/ZoomPlugin.php +++ b/public/plugin/zoom/lib/ZoomPlugin.php @@ -180,6 +180,20 @@ class ZoomPlugin extends Plugin */ public function install() { + $schemaManager = Database::getManager()->getConnection()->getSchemaManager(); + + $tablesExists = $schemaManager->tablesExist( + [ + 'plugin_zoom_meeting', + 'plugin_zoom_meeting_activity', + 'plugin_zoom_recording', + 'plugin_zoom_registrant', + ] + ); + + if ($tablesExists) { + return; + } (new SchemaTool(Database::getManager()))->createSchema( [ Database::getManager()->getClassMetadata(Meeting::class),