Commit 7eb50b32 authored by John Okely's avatar John Okely Committed by Mark Nelson
Browse files

MDL-42834 admin: Remove wwwroot if used with moodle_url

parent 672f4836
......@@ -333,7 +333,7 @@
if (has_capability('moodle/user:update', $sitecontext)) {
// prevent editing of admins by non-admins
if (is_siteadmin($USER) or !is_siteadmin($user)) {
$url = new moodle_url($CFG->wwwroot.'/user/editadvanced.php', array('id'=>$user->id, 'course'=>$site->id));
$url = new moodle_url('/user/editadvanced.php', array('id'=>$user->id, 'course'=>$site->id));
$buttons[] = html_writer::link($url, $OUTPUT->pix_icon('t/edit', $stredit));
}
}
......@@ -392,7 +392,7 @@
echo $OUTPUT->paging_bar($usercount, $page, $perpage, $baseurl);
}
if (has_capability('moodle/user:create', $sitecontext)) {
$url = new moodle_url($CFG->wwwroot . '/user/editadvanced.php', array('id' => -1));
$url = new moodle_url('/user/editadvanced.php', array('id' => -1));
echo $OUTPUT->single_button($url, get_string('addnewuser'), 'get');
}
......
......@@ -90,8 +90,8 @@ class login implements renderable, templatable {
$this->autofocusform = !empty($CFG->loginpageautofocus);
$this->rememberusername = isset($CFG->rememberusername) and $CFG->rememberusername == 2;
$this->forgotpasswordurl = new moodle_url($CFG->wwwroot . '/login/forgot_password.php');
$this->loginurl = new moodle_url($CFG->wwwroot . '/login/index.php');
$this->forgotpasswordurl = new moodle_url('/login/forgot_password.php');
$this->loginurl = new moodle_url('/login/index.php');
$this->signupurl = new moodle_url('/login/signup.php');
// Authentication instructions.
......
......@@ -363,7 +363,7 @@ class auth extends \auth_plugin_base {
$errormsg = get_string('loginerror_nouserinfo', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
redirect(new moodle_url('/login/index.php'));
}
if (empty($userinfo['username']) || empty($userinfo['email'])) {
// Trigger login failed event.
......@@ -375,7 +375,7 @@ class auth extends \auth_plugin_base {
$errormsg = get_string('loginerror_userincomplete', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
redirect(new moodle_url('/login/index.php'));
}
$userinfo['username'] = trim(core_text::strtolower($userinfo['username']));
......@@ -416,7 +416,7 @@ class auth extends \auth_plugin_base {
$errormsg = get_string('confirmationpending', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
redirect(new moodle_url('/login/index.php'));
}
} else if (!empty($linkedlogin)) {
// Trigger login failed event.
......@@ -428,7 +428,7 @@ class auth extends \auth_plugin_base {
$errormsg = get_string('confirmationpending', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
redirect(new moodle_url('/login/index.php'));
}
$issuer = $client->get_issuer();
......@@ -442,7 +442,7 @@ class auth extends \auth_plugin_base {
$errormsg = get_string('notloggedindebug', 'auth_oauth2', get_string('loginerror_invaliddomain', 'auth_oauth2'));
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
redirect(new moodle_url('/login/index.php'));
}
if (!$userwasmapped) {
......@@ -481,7 +481,7 @@ class auth extends \auth_plugin_base {
$errormsg = get_string('accountexists', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
redirect(new moodle_url('/login/index.php'));
}
if (email_is_not_allowed($userinfo['email'])) {
......@@ -495,7 +495,7 @@ class auth extends \auth_plugin_base {
$errormsg = get_string('notloggedindebug', 'auth_oauth2', $reason);
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
redirect(new moodle_url('/login/index.php'));
}
if (!empty($CFG->authpreventaccountcreation)) {
......@@ -509,7 +509,7 @@ class auth extends \auth_plugin_base {
$errormsg = get_string('notloggedindebug', 'auth_oauth2', $reason);
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
redirect(new moodle_url('/login/index.php'));
}
if ($issuer->get('requireconfirmation')) {
......@@ -542,5 +542,3 @@ class auth extends \auth_plugin_base {
redirect($redirecturl);
}
}
......@@ -80,9 +80,9 @@ class tinymce_texteditor extends texteditor {
global $PAGE, $CFG;
// Note: use full moodle_url instance to prevent standard JS loader, make sure we are using https on profile page if required.
if ($CFG->debugdeveloper) {
$PAGE->requires->js(new moodle_url($CFG->wwwroot.'/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce_src.js'));
$PAGE->requires->js(new moodle_url('/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce_src.js'));
} else {
$PAGE->requires->js(new moodle_url($CFG->wwwroot.'/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce.js'));
$PAGE->requires->js(new moodle_url('/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce.js'));
}
$PAGE->requires->js_init_call('M.editor_tinymce.init_editor', array($elementid, $this->get_init_params($elementid, $options)), true);
if ($fpoptions) {
......@@ -257,7 +257,7 @@ class tinymce_texteditor extends texteditor {
*/
public function get_tinymce_base_url() {
global $CFG;
return new moodle_url("$CFG->wwwroot/lib/editor/tinymce/tiny_mce/$this->version/");
return new moodle_url("/lib/editor/tinymce/tiny_mce/$this->version/");
}
}
......@@ -519,7 +519,7 @@ class help_icon implements renderable, templatable {
$data->icon = (new pix_icon('help', $alt, 'core', ['class' => 'iconhelp']))->export_for_template($output);
$data->linktext = $this->linktext;
$data->title = get_string('helpprefix2', '', trim($title, ". \t"));
$data->url = (new moodle_url($CFG->wwwroot . '/help.php', [
$data->url = (new moodle_url('/help.php', [
'component' => $this->component,
'identifier' => $this->identifier,
'lang' => current_language()
......
......@@ -894,7 +894,7 @@ class theme_config {
global $CFG;
$rev = theme_get_revision();
if ($rev > -1) {
$url = new moodle_url("$CFG->wwwroot/theme/styles.php");
$url = new moodle_url("/theme/styles.php");
if (!empty($CFG->slasharguments)) {
$url->set_slashargument('/'.$this->name.'/'.$rev.'/editor', 'noparam', true);
} else {
......@@ -902,7 +902,7 @@ class theme_config {
}
} else {
$params = array('theme'=>$this->name, 'type'=>'editor');
$url = new moodle_url($CFG->wwwroot.'/theme/styles_debug.php', $params);
$url = new moodle_url('/theme/styles_debug.php', $params);
}
return $url;
}
......@@ -966,7 +966,7 @@ class theme_config {
if ($rev > -1) {
$filename = right_to_left() ? 'all-rtl' : 'all';
$url = new moodle_url("$CFG->wwwroot/theme/styles.php");
$url = new moodle_url("/theme/styles.php");
$themesubrevision = theme_get_sub_revision_for_theme($this->name);
// Provide the sub revision to allow us to invalidate cached theme CSS
......@@ -1002,7 +1002,7 @@ class theme_config {
$urls[] = $url;
} else {
$baseurl = new moodle_url($CFG->wwwroot.'/theme/styles_debug.php');
$baseurl = new moodle_url('/theme/styles_debug.php');
$css = $this->get_css_files(true);
if (!$svg) {
......@@ -1686,11 +1686,11 @@ class theme_config {
}
if (!empty($CFG->slasharguments) and $rev > 0) {
$url = new moodle_url("$CFG->wwwroot/theme/javascript.php");
$url = new moodle_url("/theme/javascript.php");
$url->set_slashargument('/'.$this->name.'/'.$rev.'/'.$params['type'], 'noparam', true);
return $url;
} else {
return new moodle_url($CFG->wwwroot.'/theme/javascript.php', $params);
return new moodle_url('/theme/javascript.php', $params);
}
}
......@@ -1922,7 +1922,7 @@ class theme_config {
$params['image'] = $imagename;
$url = new moodle_url("$CFG->wwwroot/theme/image.php");
$url = new moodle_url("/theme/image.php");
if (!empty($CFG->slasharguments) and $rev > 0) {
$path = '/'.$params['theme'].'/'.$params['component'].'/'.$params['rev'].'/'.$params['image'];
if (!$svg) {
......@@ -1968,7 +1968,7 @@ class theme_config {
$params['font'] = $font;
$url = new moodle_url("$CFG->wwwroot/theme/font.php");
$url = new moodle_url("/theme/font.php");
if (!empty($CFG->slasharguments) and $rev > 0) {
$path = '/'.$params['theme'].'/'.$params['component'].'/'.$params['rev'].'/'.$params['font'];
$url->set_slashargument($path, 'noparam', true);
......
......@@ -551,7 +551,7 @@ class page_requirements_manager {
continue;
}
if (!empty($CFG->slasharguments)) {
$url = new moodle_url("$CFG->wwwroot/theme/jquery.php");
$url = new moodle_url("/theme/jquery.php");
$url->set_slashargument("/$component/$file");
} else {
......@@ -705,14 +705,14 @@ class page_requirements_manager {
if (substr($url, -3) === '.js') {
$jsrev = $this->get_jsrev();
if (empty($CFG->slasharguments)) {
return new moodle_url($CFG->wwwroot.'/lib/javascript.php', array('rev'=>$jsrev, 'jsfile'=>$url));
return new moodle_url('/lib/javascript.php', array('rev'=>$jsrev, 'jsfile'=>$url));
} else {
$returnurl = new moodle_url($CFG->wwwroot.'/lib/javascript.php');
$returnurl = new moodle_url('/lib/javascript.php');
$returnurl->set_slashargument('/'.$jsrev.$url);
return $returnurl;
}
} else {
return new moodle_url($CFG->wwwroot.$url);
return new moodle_url($url);
}
} else {
throw new coding_exception('Invalid JS url, it has to be shortened url starting with / or moodle_url instance.', $url);
......@@ -911,7 +911,7 @@ class page_requirements_manager {
if ($stylesheet instanceof moodle_url) {
// ok
} else if (strpos($stylesheet, '/') === 0) {
$stylesheet = new moodle_url($CFG->wwwroot.$stylesheet);
$stylesheet = new moodle_url($stylesheet);
} else {
throw new coding_exception('Invalid stylesheet parameter.', $stylesheet);
}
......@@ -1315,9 +1315,9 @@ class page_requirements_manager {
$output = '';
$jsrev = $this->get_jsrev();
$jsloader = new moodle_url($CFG->wwwroot . '/lib/javascript.php');
$jsloader = new moodle_url('/lib/javascript.php');
$jsloader->set_slashargument('/' . $jsrev . '/');
$requirejsloader = new moodle_url($CFG->wwwroot . '/lib/requirejs.php');
$requirejsloader = new moodle_url('/lib/requirejs.php');
$requirejsloader->set_slashargument('/' . $jsrev . '/');
$requirejsconfig = file_get_contents($CFG->dirroot . '/lib/requirejs/moodle-config.js');
......
......@@ -328,7 +328,7 @@ if (!empty($SESSION->loginerrormsg)) {
if ($errormsg) {
$SESSION->loginerrormsg = $errormsg;
}
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
redirect(new moodle_url('/login/index.php'));
}
$PAGE->set_title("$site->fullname: $loginsite");
......@@ -339,7 +339,7 @@ echo $OUTPUT->header();
if (isloggedin() and !isguestuser()) {
// prevent logging when already logged in, we do not want them to relogin by accident because sesskey would be changed
echo $OUTPUT->box_start();
$logout = new single_button(new moodle_url($CFG->wwwroot.'/login/logout.php', array('sesskey'=>sesskey(),'loginpage'=>1)), get_string('logout'), 'post');
$logout = new single_button(new moodle_url('/login/logout.php', array('sesskey'=>sesskey(),'loginpage'=>1)), get_string('logout'), 'post');
$continue = new single_button(new moodle_url('/'), get_string('cancel'), 'get');
echo $OUTPUT->confirm(get_string('alreadyloggedin', 'error', fullname($USER)), $logout, $continue);
echo $OUTPUT->box_end();
......
......@@ -50,7 +50,7 @@ if (isloggedin() and !isguestuser()) {
// Prevent signing up when already logged in.
echo $OUTPUT->header();
echo $OUTPUT->box_start();
$logout = new single_button(new moodle_url($CFG->wwwroot . '/login/logout.php',
$logout = new single_button(new moodle_url('/login/logout.php',
array('sesskey' => sesskey(), 'loginpage' => 1)), get_string('logout'), 'post');
$continue = new single_button(new moodle_url('/'), get_string('cancel'), 'get');
echo $OUTPUT->confirm(get_string('cannotsignup', 'error', fullname($USER)), $logout, $continue);
......
......@@ -73,7 +73,7 @@ $fs = get_file_storage();
$params = array('ctx_id' => $contextid, 'itemid' => $itemid, 'env' => $env, 'course'=>$courseid, 'maxbytes'=>$maxbytes, 'areamaxbytes'=>$areamaxbytes, 'maxfiles'=>$maxfiles, 'subdirs'=>$subdirs, 'sesskey'=>sesskey());
$PAGE->set_url('/repository/draftfiles_manager.php', $params);
$filepicker_url = new moodle_url($CFG->wwwroot."/repository/filepicker.php", $params);
$filepicker_url = new moodle_url("/repository/filepicker.php", $params);
$params['action'] = 'browse';
$home_url = new moodle_url('/repository/draftfiles_manager.php', $params);
......
......@@ -591,7 +591,7 @@ class repository_dropbox extends repository {
public static function get_oauth2callbackurl() {
global $CFG;
return new moodle_url($CFG->wwwroot . '/admin/oauth2callback.php');
return new moodle_url('/admin/oauth2callback.php');
}
/**
......
......@@ -101,7 +101,7 @@ $home_url = new moodle_url('/repository/draftfiles_manager.php', $params);
$params['savepath'] = $savepath;
$params['repo_id'] = $repo_id;
$url = new moodle_url($CFG->wwwroot."/repository/filepicker.php", $params);
$url = new moodle_url("/repository/filepicker.php", $params);
$PAGE->set_url('/repository/filepicker.php', $params);
switch ($action) {
......@@ -212,7 +212,7 @@ case 'sign':
// TODO MDL-28482: need a better solution
// paging_bar is not a good option because it starts page numbering from 0 and
// repositories number pages starting from 1.
$pagingurl = new moodle_url("$CFG->wwwroot/repository/filepicker.php?action=list&itemid=$itemid&ctx_id=$contextid&repo_id=$repo_id&course=$courseid&sesskey=". sesskey());
$pagingurl = new moodle_url("/repository/filepicker.php?action=list&itemid=$itemid&ctx_id=$contextid&repo_id=$repo_id&course=$courseid&sesskey=". sesskey());
if (!isset($list['perpage']) && !isset($list['total'])) {
$list['perpage'] = 10; // instead of setting perpage&total we use number of pages, the result is the same
}
......
......@@ -56,7 +56,7 @@ if ($type === 'editor') {
css_send_uncached_css($csscontent);
}
$chunkurl = new moodle_url($CFG->wwwroot . '/theme/styles_debug.php', array('theme' => $themename,
$chunkurl = new moodle_url('/theme/styles_debug.php', array('theme' => $themename,
'type' => $type, 'subtype' => $subtype, 'sheet' => $sheet, 'usesvg' => $usesvg, 'rtl' => $rtl));
// We need some kind of caching here because otherwise the page navigation becomes
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment