mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Added hook for more flexible authentication to external url - backwards compatible with existing file resources
This commit is contained in:
parent
e341bb8348
commit
d0cc843ed3
@ -108,11 +108,13 @@ function set_parameters() {
|
||||
'value' => current_language()),
|
||||
'sitename' => array('langstr' => get_string('fullsitename'),
|
||||
'value' => $site->fullname),
|
||||
'serverurl' => array('langstr' => get_string('serverurl'),
|
||||
'value' => $CFG->wwwroot),
|
||||
'currenttime' => array('langstr' => get_string('time'),
|
||||
'value' => time()),
|
||||
'encryptedcode' => array('langstr' => get_string('encryptedcode'),
|
||||
'value' => md5($_SERVER['REMOTE_ADDR'].$CFG->resource_secretphrase)),
|
||||
|
||||
'value' => $this->set_encrypted_parameter()),
|
||||
|
||||
'label6' => array('langstr' => "",
|
||||
'value' =>'/optgroup')
|
||||
);
|
||||
@ -541,6 +543,19 @@ function setup($form) {
|
||||
parent::setup_end();
|
||||
}
|
||||
|
||||
//backwards compatible with existing resources
|
||||
function set_encrypted_parameter() {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($this->resource->reference) && file_exists($CFG->dirroot ."/mod/resource//type/file/externserverfile.php")) {
|
||||
include $CFG->dirroot ."/mod/resource/type/file/externserverfile.php";
|
||||
if (function_exists(extern_server_file)) {
|
||||
return extern_server_file($this->resource->reference);
|
||||
}
|
||||
}
|
||||
return md5($_SERVER['REMOTE_ADDR'].$CFG->resource_secretphrase);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user