Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 64 lines (55 sloc) 1.94 KB
<?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/>.
/**
* Callback for mediacapture
*
* @package repository_mediacapture
* @category repository
* @copyright 2012 Ankit Gupta <mailtoankitgupta@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_sesskey();
require_login();
$filename = required_param('filename', PARAM_TEXT);
$filepath = required_param('filepath', PARAM_PATH);
$filetype = required_param('filetype', PARAM_TEXT);
$url = urldecode($filepath);
$thumbnail = '';
$author = 'Unknown'; // Specify default author here.
$license = 'None';
$source = base64_encode(serialize((object)array('url'=>$url, 'filename'=>$filename)));
$filename = $filename . $filetype;
$js =<<<EOD
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript">
window.onload = function() {
var resource = {};
resource.title = "$filename";
resource.source = "$source";
resource.author = "$author";
resource.license = "$license";
parent.M.core_filepicker.select_file(resource);
}
</script>
</head>
<body><noscript></noscript></body>
</html>
EOD;
header('Content-Type: text/html; charset=utf-8');
die($js);