Skip to content

Commit a685593

Browse files
committed
MDL-21233 moodle_url improvemewnts, code simplification, more diagnostics; fixed several regressions
1 parent 5192a21 commit a685593

File tree

424 files changed

+950
-901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

424 files changed

+950
-901
lines changed

admin/dbperformance.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
$site = get_site();
2323

2424
if (!empty($topframe)) {
25-
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/admin/dbperformance.php'));
26-
$PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/admin/index.php'));
25+
$PAGE->set_url('/admin/dbperformance.php');
26+
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php'));
2727
$PAGE->navbar->add($strdatabaseperformance);
2828
$PAGE->set_title("$site->shortname: $strdatabaseperformance");
2929
$PAGE->set_heading($site->fullname);

admin/generator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ function definition_after_data() {
13331333
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
13341334
require_capability('moodle/site:config', $systemcontext);
13351335

1336-
$PAGE->set_url($CFG->wwwroot.'/admin/generator.php');
1336+
$PAGE->set_url('/admin/generator.php');
13371337
$PAGE->set_pagelayout('base');
13381338
$generator = new generator_web();
13391339
$generator->setup();

admin/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
// Check some PHP server settings
5656

57-
$PAGE->set_url($CFG->admin . '/index.php');
57+
$PAGE->set_url('/admin/index.php');
5858

5959
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
6060

admin/mnet/access_control.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
if (!empty($table)) {
187187
echo $OUTPUT->table($table);
188188
echo '<p>&nbsp;</p>';
189-
$baseurl = new moodle_url(null, array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
189+
$baseurl = new moodle_url('/admin/mnet/access_control.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
190190
$pagingbar = moodle_paging_bar::make($aclcount, $page, $perpage, $baseurl);
191191
echo $OUTPUT->paging_bar($pagingbar);
192192
}

admin/mnet/delete.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
if ($live_users > 0) {
3939
$warn[] = get_string('usersareonline', 'mnet', $live_users);
4040
}
41-
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/admin/mnet/delete.php'));
42-
$PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
43-
$PAGE->navbar->add(get_string('mnetsettings', 'mnet'), new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/mnet/index.php'));
41+
$PAGE->set_url('/admin/mnet/delete.php');
42+
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php'));
43+
$PAGE->navbar->add(get_string('mnetsettings', 'mnet'), new moodle_url('/admin/mnet/index.php'));
4444
$PAGE->navbar->add(get_string('deletehost', 'mnet'));
4545

4646
$PAGE->set_title("$site->shortname: $strmnetsettings");

admin/mnet/mnet_review.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
admin_externalpage_print_header();
44

55
$currenttab = 'mnetdetails';
6-
require_once($CFG->dirroot .'/admin/mnet/tabs.php');
6+
require_once($CFG->dirroot .'/'.$CFG->admin.'/mnet/tabs.php');
77

88
echo $OUTPUT->box_start();
99
?>

admin/mnet/mnet_review_allhosts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
admin_externalpage_print_header();
33
$currenttab = 'mnetdetails';
4-
require_once($CFG->dirroot .'/admin/mnet/tabs.php');
4+
require_once($CFG->dirroot .'/'.$CFG->admin.'/mnet/tabs.php');
55

66
echo $OUTPUT->box_start();
77
?>

admin/mnet/mnet_services.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
admin_externalpage_print_header();
33

44
$currenttab = 'mnetservices';
5-
require_once($CFG->dirroot .'/admin/mnet/tabs.php');
5+
require_once($CFG->dirroot .'/'.$CFG->admin.'/mnet/tabs.php');
66
echo $OUTPUT->box_start();
77

88
?>

admin/mnet/mnet_themes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
echo $OUTPUT->heading(get_string('themes'));
77
$original_theme = fullclone($THEME);
88
$currenttab = 'mnetthemes';
9-
require_once($CFG->dirroot .'/admin/mnet/tabs.php');
9+
require_once($CFG->dirroot .'/'.$CFG->admin.'/mnet/tabs.php');
1010

1111
$themes = get_list_of_plugins("theme");
1212
$sesskey = sesskey();

admin/report/courseoverview/reportsgraph.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
$courses = $DB->get_records_sql($sql, $param->$params, 0, $numcourses);
3131

3232
if (empty($courses)) {
33-
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/index.php'));
33+
$PAGE->set_url('/admin/report/courseoverview/index.php');
3434
print_error('statsnodata', 'error', $PAGE->url->out());
3535
}
3636

admin/roles/assign.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
if ($returnurl) {
5555
$urlparams['returnurl'] = $returnurl;
5656
}
57-
$PAGE->set_url($CFG->admin . '/roles/assign.php', $urlparams);
57+
$PAGE->set_url('/admin/roles/assign.php', $urlparams);
5858
$baseurl = $PAGE->url->out();
5959

6060
if (! $context = get_context_instance_by_id($contextid)) {
@@ -266,7 +266,7 @@
266266
$PAGE->set_title($title);
267267
if ($courseid != SITEID) {
268268
if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $courseid))) {
269-
$PAGE->navbar->add(get_string('participants'), new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid)));
269+
$PAGE->navbar->add(get_string('participants'), new moodle_url('/user/index.php', array('id'=>$courseid)));
270270
}
271271
$PAGE->set_heading($fullname);
272272
} else {

admin/roles/check.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
if ($returnurl) {
4949
$urlparams['returnurl'] = $returnurl;
5050
}
51-
$PAGE->set_url($CFG->admin . '/roles/check.php', $urlparams);
51+
$PAGE->set_url('/admin/roles/check.php', $urlparams);
5252

5353
if (! $context = get_context_instance_by_id($contextid)) {
5454
print_error('wrongcontextid', 'error');
@@ -108,7 +108,7 @@
108108
$PAGE->set_title($title);
109109
if ($courseid != SITEID) {
110110
if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $courseid))) {
111-
$PAGE->navbar->add(get_string('participants'), new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid)));
111+
$PAGE->navbar->add(get_string('participants'), new moodle_url('/user/index.php', array('id'=>$courseid)));
112112
}
113113
$PAGE->set_heading($fullname);
114114
} else {

admin/roles/explain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
$contextid = required_param('contextid', PARAM_INTEGER);
3838
$capability = required_param('capability', PARAM_CAPABILITY);
3939

40-
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/admin/roles/explain.php', array('user'=>$userid, 'contextid'=>$contextid, 'capability'=>$capability)));
40+
$PAGE->set_url('/admin/roles/explain.php', array('user'=>$userid, 'contextid'=>$contextid, 'capability'=>$capability));
4141

4242
// Get the context and its parents.
4343
$context = get_context_instance_by_id($contextid);

admin/roles/override.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
if ($returnurl) {
5151
$urlparams['returnurl'] = $returnurl;
5252
}
53-
$PAGE->set_url($CFG->admin . '/roles/override.php', $urlparams);
53+
$PAGE->set_url('/admin/roles/override.php', $urlparams);
5454
$baseurl = $PAGE->url->out();
5555

5656
/// Validate the contextid parameter.
@@ -151,7 +151,7 @@
151151
$PAGE->set_title($title);
152152
if ($courseid != SITEID) {
153153
if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id))) {
154-
$PAGE->navbar->add(get_string('participants'), new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$course->id)));
154+
$PAGE->navbar->add(get_string('participants'), new moodle_url('/user/index.php', array('id'=>$course->id)));
155155
}
156156
$PAGE->set_heading($fullname);
157157
} else {

admin/roles/tabs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
if (empty($title)) {
5353
$title = $SITE->fullname;
5454
}
55-
$PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/admin/'), navigation_node::TYPE_SETTING);
55+
$PAGE->navbar->add($stradministration, new moodle_url('/admin/'), navigation_node::TYPE_SETTING);
5656
$PAGE->navbar->add($straction);
5757
$PAGE->set_title($title);
5858
$PAGE->set_heading($SITE->fullname);
@@ -73,8 +73,8 @@
7373
$title = "$SITE->shortname: $category->name";
7474
}
7575

76-
$PAGE->navbar->add($strcategories, new moodle_url($CFG->wwwroot.'/course/index.php'), navigation_node::TYPE_SETTING);
77-
$PAGE->navbar->add($category->name, new moodle_url($CFG->wwwroot.'/course/category.php', array('id'=>$category->id)), navigation_node::TYPE_SETTING);
76+
$PAGE->navbar->add($strcategories, new moodle_url('/course/index.php'), navigation_node::TYPE_SETTING);
77+
$PAGE->navbar->add($category->name, new moodle_url('/course/category.php', array('id'=>$category->id)), navigation_node::TYPE_SETTING);
7878
$PAGE->navbar->add(get_string("roles"));
7979
$PAGE->set_title($title);
8080
$PAGE->set_heading("$SITE->fullname: $strcourses");

admin/roles/usersroles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
if ($courseid != SITEID) {
127127
$PAGE->set_heading($fullname);
128128
if (has_capability('moodle/course:viewparticipants', $coursecontext)) {
129-
$PAGE->navbar->add(get_string('participants'),new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid)));
129+
$PAGE->navbar->add(get_string('participants'),new moodle_url('/user/index.php', array('id'=>$courseid)));
130130
}
131131
} else {
132132
$PAGE->set_heading($course->fullname);

admin/settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/// no guest autologin
1111
require_login(0, false);
1212
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
13-
$PAGE->set_url($CFG->admin . '/settings.php', array('section' => $section));
13+
$PAGE->set_url('/admin/settings.php', array('section' => $section));
1414
$PAGE->set_pagetype('admin-setting-' . $section);
1515
$PAGE->set_pagelayout('admin');
1616
$PAGE->navigation->clear_cache();

admin/timezone.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
$strusers = get_string("users");
1919
$strall = get_string("all");
2020

21-
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/admin/timezone.php'));
21+
$PAGE->set_url('/admin/timezone.php');
2222
$PAGE->set_title($strtimezone);
2323
$PAGE->set_heading($strtimezone);
2424
$PAGE->navbar->add($strtimezone);

admin/webservice/protocols.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
require_once($CFG->libdir.'/adminlib.php');
2828
require_once($CFG->libdir.'/tablelib.php');
2929

30-
$PAGE->set_url('/admin/webservice/protocols.php', array());
30+
$PAGE->set_url('/admin/webservice/protocols.php');
3131
//TODO: disable the blocks here or better make the page layout default to no blocks!
3232

3333
require_login();

admin/webservice/service.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
$action = optional_param('action', '', PARAM_ACTION);
3232
$confirm = optional_param('confirm', 0, PARAM_BOOL);
3333

34-
$PAGE->set_url('admin/external_service.php', array('id'=>$id));
34+
$PAGE->set_url('/admin/external_service.php', array('id'=>$id));
3535

3636
admin_externalpage_setup('externalservice');
3737

@@ -57,7 +57,7 @@
5757
$DB->delete_records('external_services_users', array('externalserviceid'=>$service->id));
5858
$DB->delete_records('external_services_functions', array('externalserviceid'=>$service->id));
5959
$DB->delete_records('external_services', array('id'=>$service->id));
60-
add_to_log(1, 'webservice', 'delete', $CFG->wwwroot."/admin/settings.php?section=externalservices", get_string('deleteservice', 'webservice', $service));
60+
add_to_log(1, 'webservice', 'delete', $CFG->wwwroot."/$CFG->admin/settings.php?section=externalservices", get_string('deleteservice', 'webservice', $service));
6161
redirect($returnurl);
6262
}
6363

@@ -76,11 +76,11 @@
7676
if (empty($data->id)) {
7777
$data->timecreated = mktime();
7878
$data->id = $DB->insert_record('external_services', $data);
79-
add_to_log(1, 'webservice', 'add', $CFG->wwwroot."/admin/settings.php?section=externalservices", get_string('addservice', 'webservice', $data));
79+
add_to_log(1, 'webservice', 'add', $CFG->wwwroot."/$CFG->admin/settings.php?section=externalservices", get_string('addservice', 'webservice', $data));
8080
} else {
8181
$data->timemodified = mktime();
8282
$DB->update_record('external_services', $data);
83-
add_to_log(1, 'webservice', 'edit', $CFG->wwwroot."/admin/settings.php?section=externalservices", get_string('editservice', 'webservice', $data));
83+
add_to_log(1, 'webservice', 'edit', $CFG->wwwroot."/$CFG->admin/settings.php?section=externalservices", get_string('editservice', 'webservice', $data));
8484
}
8585

8686
redirect($returnurl);

admin/webservice/service_functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
$action = optional_param('action', '', PARAM_ACTION);
3434
$confirm = optional_param('confirm', 0, PARAM_BOOL);
3535

36-
$PAGE->set_url('admin/websevice/service_functions.php', array('id'=>$id));
36+
$PAGE->set_url('/admin/websevice/service_functions.php', array('id'=>$id));
3737

3838
admin_externalpage_setup('externalservicefunctions');
3939

admin/webservice/service_users.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
$id = required_param('id', PARAM_INT);
3131

32-
$PAGE->set_url('admin/webservice/service_users.php', array('id'=>$id));
32+
$PAGE->set_url('/admin/webservice/service_users.php', array('id'=>$id));
3333
$PAGE->requires->js($CFG->admin.'/webservice/script.js');
3434

3535
admin_externalpage_setup('externalserviceusers');

admin/webservice/tokens.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
require_once($CFG->libdir.'/adminlib.php');
2929
require_once('forms.php');
3030

31-
$PAGE->set_url('/admin/webservice/tokens.php', array());
31+
$PAGE->set_url('/admin/webservice/tokens.php');
3232

3333
admin_externalpage_setup('addwebservicetoken');
3434

auth/ldap/ntlmsso_attempt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//HTTPS is potentially required in this page
66
httpsrequired();
77

8-
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/ldap/ntlmsso_attempt.php'));
8+
$PAGE->set_url('/auth/ldap/ntlmsso_attempt.php');
99

1010
/// Define variables used in page
1111
$site = get_site();

auth/ldap/ntlmsso_finish.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//HTTPS is potentially required in this page
66
httpsrequired();
77

8-
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php'));
8+
$PAGE->set_url('/auth/ldap/ntlmsso_finish.php');
99

1010
/// Define variables used in page
1111
$site = get_site();

auth/mnet/jump.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
$hostwwwroot = optional_param('hostwwwroot', '', PARAM_URL);
2121
$wantsurl = optional_param('wantsurl', '', PARAM_RAW);
2222

23-
$url = new moodle_url($CFG->wwwroot.'/auth/mnet/jump.php');
23+
$url = new moodle_url('/auth/mnet/jump.php');
2424
if ($hostid !== '0') $url->param('hostid', $hostid);
2525
if ($hostwwwroot !== '') $url->param('hostwwwroot', $hostwwwroot);
2626
if ($wantsurl !== '') $url->param('wantsurl', $wantsurl);

auth/mnet/land.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
$wantsurl = required_param('wantsurl', PARAM_LOCALURL);
2222
$wantsremoteurl = optional_param('remoteurl', false, PARAM_BOOL);
2323

24-
$url = new moodle_url($CFG->wwwroot.'/auth/mnet/jump.php', array('token'=>$token, 'idp'=>$remotewwwroot, 'wantsurl'=>$wantsurl));
24+
$url = new moodle_url('/auth/mnet/jump.php', array('token'=>$token, 'idp'=>$remotewwwroot, 'wantsurl'=>$wantsurl));
2525
if ($wantsremoteurl !== false) $url->param('remoteurl', $wantsremoteurl);
2626
$PAGE->set_url($url);
2727

auth/shibboleth/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
require('../../config.php');
66

7-
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/shibboleth/index.php'));
7+
$PAGE->set_url('/auth/shibboleth/index.php');
88

99
if (isloggedin() && $USER->username != 'guest') { // Nothing to do
1010
if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) {

auth/shibboleth/login.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
$loginsite = get_string("loginsite");
6868

69-
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/shibboleth/login.php'));
69+
$PAGE->set_url('/auth/shibboleth/login.php');
7070
$PAGE->navbar->add($loginsite);
7171
$PAGE->set_title("$site->fullname: $loginsite");
7272
$PAGE->set_heading($site->fullname);

backup/backup.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
$cancel = optional_param('cancel', '', PARAM_RAW);
1414
$launch = optional_param('launch', '', PARAM_ACTION);
1515

16-
$url = new moodle_url();
16+
$url = new moodle_url('/backup/backup.php');
1717
if ($id !== 0) {
1818
$url->param('id', $id);
1919
}
@@ -75,7 +75,7 @@
7575
$PAGE->set_title("$site->shortname: $strcoursebackup");
7676
$PAGE->set_heading($site->fullname);
7777
if (!$id) {
78-
$PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
78+
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php'));
7979
$PAGE->navbar->add($strcoursebackup);
8080
echo $OUTPUT->header();
8181
if ($courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname')) {
@@ -100,12 +100,12 @@
100100

101101
//Print header
102102
if (has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
103-
$PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
104-
$PAGE->navbar->add($strcoursebackup, new moodle_url($CFG->wwwroot.'/backup/backup.php'));
103+
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php'));
104+
$PAGE->navbar->add($strcoursebackup, new moodle_url('/backup/backup.php'));
105105
$PAGE->navbar->add("$course->fullname ($course->shortname)");
106106
echo $OUTPUT->header();
107107
} else {
108-
$PAGE->navbar->add($course->fullname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
108+
$PAGE->navbar->add($course->fullname, new moodle_url('/course/view.php', array('id'=>$course->id)));
109109
$PAGE->navbar->add($strcoursebackup);
110110
echo $OUTPUT->header();
111111
}

backup/restore.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
$method = optional_param('method', '', PARAM_ACTION);
2323
$backup_unique_code = optional_param('backup_unique_code',0,PARAM_INT);
2424

25-
$url = new moodle_url($CFG->wwwroot.'/backup/restore.php');
25+
$url = new moodle_url('/backup/restore.php');
2626
if ($id !== 0) {
2727
$url->param('id', $id);
2828
}
@@ -109,7 +109,7 @@
109109
$PAGE->set_title("$site->shortname: $strcourserestore");
110110
$PAGE->set_heading($site->fullname);
111111
if (!$file) {
112-
$PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
112+
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php'));
113113
$PAGE->navbar->add($strcourserestore);
114114
echo $OUTPUT->header();
115115
echo $OUTPUT->heading(get_string("nofilesselected"));
@@ -120,7 +120,7 @@
120120

121121
//If cancel has been selected, inform and end
122122
if ($cancel) {
123-
$PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
123+
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php'));
124124
$PAGE->navbar->add($strcourserestore);
125125
echo $OUTPUT->header();
126126
echo $OUTPUT->heading(get_string("restorecancelled"));
@@ -141,7 +141,7 @@
141141
$PAGE->navbar->add(basename($file));
142142
echo $OUTPUT->header();
143143
} else {
144-
$PAGE->navbar->add($course->shortname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
144+
$PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php', array('id'=>$course->id)));
145145
$PAGE->navbar->add($strcourserestore);
146146
echo $OUTPUT->header();
147147
}

0 commit comments

Comments
 (0)