[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 18 /** 19 * A script to serve files from web service client 20 * 21 * @package core_webservice 22 * @copyright 2011 Dongsheng Cai <[email protected]> 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 /** 27 * AJAX_SCRIPT - exception will be converted into JSON 28 */ 29 define('AJAX_SCRIPT', true); 30 31 /** 32 * NO_MOODLE_COOKIES - we don't want any cookie 33 */ 34 define('NO_MOODLE_COOKIES', true); 35 36 37 require_once(dirname(dirname(__FILE__)) . '/config.php'); 38 require_once($CFG->libdir . '/filelib.php'); 39 require_once($CFG->dirroot . '/webservice/lib.php'); 40 41 //authenticate the user 42 $token = required_param('token', PARAM_ALPHANUM); 43 $webservicelib = new webservice(); 44 $authenticationinfo = $webservicelib->authenticate_user($token); 45 46 //check the service allows file download 47 $enabledfiledownload = (int) ($authenticationinfo['service']->downloadfiles); 48 if (empty($enabledfiledownload)) { 49 throw new webservice_access_exception('Web service file downloading must be enabled in external service settings'); 50 } 51 52 //finally we can serve the file :) 53 $relativepath = get_file_argument(); 54 file_pluginfile($relativepath, 0);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |