Skip to content

Commit

Permalink
MDL-53945 mnet: replace hardcoded admin dir with cfg
Browse files Browse the repository at this point in the history
Several places in admin/mnet pull in required files using a hardcoded
admin dir string, as this is configurable it needs to use $CFG->admin
instead.

Places where the url is passed through moodle_url don't need to be
updated as that already automatically translates the urls for us.
  • Loading branch information
aolley committed Nov 3, 2016
1 parent cad8adc commit 20ec565
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion admin/mnet/peer_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function validation($data, $files) {
}
if ($host = $DB->get_record('mnet_host', array('wwwroot' => $wwwroot))) {
global $CFG;
return array('wwwroot' => get_string('hostexists', 'mnet', $CFG->wwwroot . '/admin/mnet/peers.php?hostid=' . $host->id));
return array('wwwroot' => get_string('hostexists', 'mnet',
$CFG->wwwroot . '/' . $CFG->admin . '/mnet/peers.php?hostid=' . $host->id));
}
return array();
}
Expand Down
4 changes: 2 additions & 2 deletions admin/mnet/peers.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
$mnet_peer->set_id($hostid);
echo $OUTPUT->header();
$currenttab = 'mnetdetails';
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');

if ($hostid != $CFG->mnet_all_hosts_id) {
$mnet_peer->currentkey = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application);
Expand Down Expand Up @@ -144,7 +144,7 @@
// we're editing an existing one, so set up the tabs
$currenttab = 'mnetdetails';
$mnet_peer->set_id($id);
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
} else if (empty($noreviewform) && ($wwwroot = optional_param('wwwroot', '', PARAM_URL)) && ($applicationid = optional_param('applicationid', 0, PARAM_INT))) {
$application = $DB->get_field('mnet_application', 'name', array('id'=>$applicationid));
$mnet_peer->bootstrap($wwwroot, null, $application);
Expand Down
2 changes: 1 addition & 1 deletion admin/mnet/profilefields.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot . '/admin/mnet/profilefields_form.php');
require_once($CFG->dirroot . '/' . $CFG->admin .'/mnet/profilefields_form.php');
$mnet = get_mnet_environment();

require_login();
Expand Down
4 changes: 2 additions & 2 deletions admin/mnet/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot . '/admin/mnet/services_form.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/services_form.php');
$mnet = get_mnet_environment();

require_login();
Expand Down Expand Up @@ -82,7 +82,7 @@

echo $OUTPUT->header();
$currenttab = 'mnetservices';
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
echo $OUTPUT->box_start();
$s = mnet_get_service_info($mnet_peer, false); // basic data only
$mform->set_data($s);
Expand Down

0 comments on commit 20ec565

Please sign in to comment.