Files
meetletacbfree/download_content.php

52 lines
2.0 KiB
PHP

<?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/>.
/**
* Serve uploaded meeting content via Moodle (Adobe Connect SSO proxy).
*
* Authenticated, current-user bound. The URL carries an opaque HMAC token.
*
* @package mod_meetletacbfree
* @copyright 2026 MeetLet <info@meetlet.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(__DIR__ . '/../../config.php');
$k = required_param('k', PARAM_RAW_TRIMMED);
$claims = \mod_meetletacbfree\local\content::unpack_download_token($k);
$cm = get_coursemodule_from_id('meetletacbfree', $claims['cmid'], 0, false, MUST_EXIST);
$course = $DB->get_record('course', ['id' => $cm->course], '*', MUST_EXIST);
$instance = $DB->get_record('meetletacbfree', ['id' => $cm->instance], '*', MUST_EXIST);
require_login($course, false, $cm);
if ((int)$USER->id !== (int)$claims['userid'] || isguestuser()) {
throw new moodle_exception('errorbadcontenttoken', 'meetletacbfree');
}
$context = context_module::instance($cm->id);
require_capability('mod/meetletacbfree:view', $context);
\mod_meetletacbfree\registration\manager::require_registered();
\mod_meetletacbfree\local\featureaccess::require_feature(
\mod_meetletacbfree\local\featureaccess::CONTENT,
$context,
$instance
);
$inst = \mod_meetletacbfree\local\instance::get_from_cmid((int)$cm->id);
\mod_meetletacbfree\local\content::serve_download($inst, (int)$claims['cid']);