Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# DB services you need for testing.
services:
postgres:
image: postgres:13
image: postgres:16
env:
POSTGRES_USER: 'postgres'
POSTGRES_HOST_AUTH_METHOD: 'trust'
Expand All @@ -30,7 +30,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3

mariadb:
image: mariadb:10
image: mariadb:10.11
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
Expand All @@ -50,10 +50,13 @@ jobs:
matrix:
include:
- php: '8.4'
moodle-branch: 'main'
database: 'pgsql'
moodle-branch: 'MOODLE_501_STABLE'
database: 'mariadb'
- php: '8.4'
moodle-branch: 'MOODLE_501_STABLE'
database: 'pgsql'
- php: '8.3'
moodle-branch: 'MOODLE_500_STABLE'
database: 'mariadb'
- php: '8.3'
moodle-branch: 'MOODLE_500_STABLE'
Expand All @@ -62,17 +65,8 @@ jobs:
moodle-branch: 'MOODLE_405_STABLE'
database: 'mariadb'
- php: '8.3'
moodle-branch: 'MOODLE_404_STABLE'
database: 'pgsql'
- php: '8.2'
moodle-branch: 'MOODLE_403_STABLE'
database: 'mariadb'
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
moodle-branch: 'MOODLE_405_STABLE'
database: 'pgsql'
- php: '8.1'
moodle-branch: 'MOODLE_401_STABLE'
database: 'mariadb'

steps:
# Check out this repository code in ./plugin directory
Expand Down
5 changes: 4 additions & 1 deletion contentitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

// Check access and capabilities.
$course = get_course($courseid);
require_login($course);

// LTI 1.3 login request.
$config = lti_get_type_type_config($id);
Expand All @@ -61,9 +60,13 @@
if (!isset($SESSION->lti_initiatelogin_status)) {
echo lti_initiate_login($courseid, "tiny_panoptoltibutton, {$callback}", $lti, $config);
exit;
} else {
unset($SESSION->lti_initiatelogin_status);
}
}

require_login($course);

$context = context_course::instance($courseid);

// Set the return URL. We send the launch container along to help us avoid
Expand Down
4 changes: 3 additions & 1 deletion contentitem_return.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

// phpcs:ignore moodle.Files.RequireLogin.Missing -- Login is enforced via tiny_panoptoltibutton_require_login_or_repost() below.
require_once(dirname(__FILE__) . '/../../../../../config.php');
require_once(dirname(__FILE__) . '/locallib.php');
require_once($CFG->dirroot . '/blocks/panopto/lib/panopto_data.php');
require_once($CFG->dirroot . '/blocks/panopto/lib/lti/panoptoblock_lti_utility.php');
require_once($CFG->dirroot . '/mod/lti/lib.php');
Expand All @@ -37,7 +39,7 @@
$callback = required_param('callback', PARAM_ALPHANUMEXT);
$jwt = optional_param('JWT', '', PARAM_RAW);

require_login($courseid);
tiny_panoptoltibutton_require_login_or_repost($courseid);

$context = context_course::instance($courseid);

Expand Down
1 change: 1 addition & 0 deletions lang/en/tiny_panoptoltibutton.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
$string['panopto_button_description'] = 'Add Panopto Video';
$string['panopto_button_long_description'] = 'Add Panopto Video Content to TinyMCE';
$string['panopto_button_unprovisioned_error'] = 'Error: Please use the Panopto Block to provision this course before using this tool';
$string['panoptoltibutton:use'] = 'Use Panopto button';
$string['pluginname'] = 'Add Panopto Video';
$string['privacy:metadata'] = 'No user data is stored by this plugin';
55 changes: 55 additions & 0 deletions locallib.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Local library functions for the Panopto TinyMCE LTI button.
*
* @package tiny_panoptoltibutton
* @copyright 2026 Panopto
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* Ensure the user is logged in, or perform a cross-site repost if cookies were blocked.
*
* @param int $courseid Course to require login for after repost succeeds.
*/
function tiny_panoptoltibutton_require_login_or_repost(int $courseid): void {
global $PAGE, $_POST;

$context = context_course::instance($courseid);
$PAGE->set_pagelayout('popup');
$PAGE->set_context($context);

if (method_exists('panoptoblock_lti_utility', 'require_login_or_repost')) {
panoptoblock_lti_utility::require_login_or_repost($courseid, $context);
return;
}

if (!empty($_POST['repost'])) {
unset($_POST['repost']);
} else if (!isloggedin()) {
header_remove('Set-Cookie');
$output = $PAGE->get_renderer('mod_lti');
$page = new \mod_lti\output\repost_crosssite_page($_SERVER['REQUEST_URI'], $_POST);
echo $output->header();
echo $output->render($page);
echo $output->footer();
exit;
}

require_login($courseid);
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

// The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2025112600;
$plugin->version = 2026060300;

// Requires this Moodle version - 4.1.0.
$plugin->requires = 2022112800;
Expand Down
11 changes: 8 additions & 3 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
require_once(dirname(__FILE__) . '/../../../../../config.php');
}

require_login();

require_once($CFG->dirroot . '/blocks/panopto/lib/block_panopto_lib.php');
require_once($CFG->libdir . '/accesslib.php'); // Access control functions.
require_once($CFG->dirroot . '/mod/lti/lib.php');
Expand Down Expand Up @@ -83,7 +81,6 @@
$courseid = $course->id;
$context = context_course::instance($cleancourseid);
$PAGE->set_context($context);
require_login($course, true);
}
}
}
Expand Down Expand Up @@ -114,9 +111,17 @@
$config
);
exit;
} else {
unset($SESSION->lti_initiatelogin_status);
}
}

if (!empty($courseid)) {
require_login($course, true);
} else {
require_login();
}

echo \panoptoblock_lti_utility::launch_tool($lti);
} else {
echo get_string('invalid_content_host', 'tiny_panoptoltibutton');
Expand Down
Loading