url - Add a domain prefix to a $relativepath string in a Moodle PHP file -


this php snippet in moodle:-

require_once(dirname(dirname(__file__)) . '/config.php'); require_once($cfg->libdir . '/filelib.php'); require_once($cfg->dirroot . '/webservice/lib.php');  // allow cors requests. header('access-control-allow-origin: *');  //authenticate user $token = required_param('token', param_alphanum); $webservicelib = new webservice(); $authenticationinfo = $webservicelib->authenticate_user($token);  //check service allows file download $enabledfiledownload = (int) ($authenticationinfo['service']->downloadfiles); if (empty($enabledfiledownload)) {     throw new webservice_access_exception('web service file downloading must enabled in external service settings'); }  //finally can serve file :) $relativepath = get_file_argument(); file_pluginfile($relativepath, 0); 

this made relevant file resolved index.html without direct path.

what trying modify line

$relativepath = get_file_argument(); 

and line

file_pluginfile($relativepath, 0); 

by adding fixed prefix of domain name example, output file domain.com/index.html

your appreciated,

regards.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -