Skip to content

Commit

Permalink
MDL-42834 admin: Removal of httpswwwroot
Browse files Browse the repository at this point in the history
  • Loading branch information
xow authored and mdjnelson committed Oct 23, 2017
1 parent cd1eb7c commit 672f483
Show file tree
Hide file tree
Showing 42 changed files with 111 additions and 133 deletions.
2 changes: 1 addition & 1 deletion admin/tool/mobile/classes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static function get_public_config() {
list($maintenancemessage, $notusedformat) = external_format_text($CFG->maintenance_message, FORMAT_MOODLE, $context->id);
$settings = array(
'wwwroot' => $CFG->wwwroot,
'httpswwwroot' => $CFG->httpswwwroot,
'httpswwwroot' => $CFG->wwwroot,
'sitename' => external_format_string($SITE->fullname, $context->id, true),
'guestlogin' => $CFG->guestloginbutton,
'rememberusername' => $CFG->rememberusername,
Expand Down
1 change: 0 additions & 1 deletion admin/tool/mobile/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ public function test_get_autologin_key_missing_https() {

// Need to simulate a non HTTPS site here.
$CFG->wwwroot = str_replace('https:', 'http:', $CFG->wwwroot);
$CFG->httpswwwroot = str_replace('https:', 'http:', $CFG->wwwroot);

$this->resetAfterTest(true);
$this->setAdminUser();
Expand Down
4 changes: 2 additions & 2 deletions auth/classes/output/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public function __construct(array $authsequence, $username = '') {
$this->autofocusform = !empty($CFG->loginpageautofocus);
$this->rememberusername = isset($CFG->rememberusername) and $CFG->rememberusername == 2;

$this->forgotpasswordurl = new moodle_url($CFG->httpswwwroot . '/login/forgot_password.php');
$this->loginurl = new moodle_url($CFG->httpswwwroot . '/login/index.php');
$this->forgotpasswordurl = new moodle_url($CFG->wwwroot . '/login/forgot_password.php');
$this->loginurl = new moodle_url($CFG->wwwroot . '/login/index.php');
$this->signupurl = new moodle_url('/login/signup.php');

// Authentication instructions.
Expand Down
8 changes: 4 additions & 4 deletions auth/ldap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -1671,8 +1671,8 @@ function loginpage_hook() {
if ($referer &&
$referer != $CFG->wwwroot &&
$referer != $CFG->wwwroot . '/' &&
$referer != $CFG->httpswwwroot . '/login/' &&
$referer != $CFG->httpswwwroot . '/login/index.php') {
$referer != $CFG->wwwroot . '/login/' &&
$referer != $CFG->wwwroot . '/login/index.php') {
$SESSION->wantsurl = $referer;
}
}
Expand All @@ -1684,7 +1684,7 @@ function loginpage_hook() {
$sesskey = sesskey();
redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_magic.php?sesskey='.$sesskey);
} else if ($this->config->ntlmsso_ie_fastpath == AUTH_NTLM_FASTPATH_YESFORM) {
redirect($CFG->httpswwwroot.'/login/index.php?authldap_skipntlmsso=1');
redirect($CFG-wwwroot.'/login/index.php?authldap_skipntlmsso=1');
}
}
redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_attempt.php');
Expand All @@ -1699,7 +1699,7 @@ function loginpage_hook() {
// we don't want to use at all. As we can't get rid of it, just point
// $SESSION->wantsurl to $CFG->wwwroot (after all, we came from there).
if (empty($SESSION->wantsurl)
&& (get_local_referer() == $CFG->httpswwwroot.'/auth/ldap/ntlmsso_finish.php')) {
&& (get_local_referer() == $CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php')) {

$SESSION->wantsurl = $CFG->wwwroot;
}
Expand Down
4 changes: 2 additions & 2 deletions auth/ldap/ntlmsso_attempt.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@

$msg = '<p>'.get_string('ntlmsso_attempting', 'auth_ldap').'</p>'
. '<img width="1", height="1" '
. ' src="' . $CFG->httpswwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
. ' src="' . $CFG->wwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
. $sesskey . '" />';
redirect($CFG->httpswwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
2 changes: 1 addition & 1 deletion auth/ldap/ntlmsso_finish.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
redirect($CFG->httpswwwroot . '/login/index.php?authldap_skipntlmsso=1',
redirect($CFG->wwwroot . '/login/index.php?authldap_skipntlmsso=1',
get_string('ntlmsso_failed','auth_ldap'), 3);
}
2 changes: 1 addition & 1 deletion auth/ldap/ntlmsso_magic.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if ($authplugin->ntlmsso_magic($sesskey) && file_exists($file)) {
if (!empty($authplugin->config->ntlmsso_ie_fastpath)) {
if (core_useragent::is_ie()) {
redirect($CFG->httpswwwroot.'/auth/ldap/ntlmsso_finish.php');
redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php');
}
}

Expand Down
2 changes: 1 addition & 1 deletion auth/mnet/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ function loginpage_idp_list($wantsurl) {
global $DB, $CFG;

// strip off wwwroot, since the remote site will prefix it's return url with this
$wantsurl = preg_replace('/(' . preg_quote($CFG->wwwroot, '/') . '|' . preg_quote($CFG->httpswwwroot, '/') . ')/', '', $wantsurl);
$wantsurl = preg_replace('/(' . preg_quote($CFG->wwwroot, '/') . ')/', '', $wantsurl);

$sql = "SELECT DISTINCT h.id, h.wwwroot, h.name, a.sso_jump_url, a.name as application
FROM {mnet_host} h
Expand Down
18 changes: 9 additions & 9 deletions auth/oauth2/classes/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public function print_confirm_required($title, $message) {
$PAGE->set_title($title);
$PAGE->set_heading($PAGE->course->fullname);
echo $OUTPUT->header();
notice($message, "$CFG->httpswwwroot/index.php");
notice($message, "$CFG->wwwroot/index.php");
}

/**
Expand All @@ -363,7 +363,7 @@ public function complete_login(client $client, $redirecturl) {
$errormsg = get_string('loginerror_nouserinfo', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php'));
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
}
if (empty($userinfo['username']) || empty($userinfo['email'])) {
// Trigger login failed event.
Expand All @@ -375,7 +375,7 @@ public function complete_login(client $client, $redirecturl) {
$errormsg = get_string('loginerror_userincomplete', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php'));
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
}

$userinfo['username'] = trim(core_text::strtolower($userinfo['username']));
Expand Down Expand Up @@ -416,7 +416,7 @@ public function complete_login(client $client, $redirecturl) {
$errormsg = get_string('confirmationpending', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php'));
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
}
} else if (!empty($linkedlogin)) {
// Trigger login failed event.
Expand All @@ -428,7 +428,7 @@ public function complete_login(client $client, $redirecturl) {
$errormsg = get_string('confirmationpending', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php'));
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
}

$issuer = $client->get_issuer();
Expand All @@ -442,7 +442,7 @@ public function complete_login(client $client, $redirecturl) {
$errormsg = get_string('notloggedindebug', 'auth_oauth2', get_string('loginerror_invaliddomain', 'auth_oauth2'));
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php'));
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
}

if (!$userwasmapped) {
Expand Down Expand Up @@ -481,7 +481,7 @@ public function complete_login(client $client, $redirecturl) {
$errormsg = get_string('accountexists', 'auth_oauth2');
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php'));
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
}

if (email_is_not_allowed($userinfo['email'])) {
Expand All @@ -495,7 +495,7 @@ public function complete_login(client $client, $redirecturl) {
$errormsg = get_string('notloggedindebug', 'auth_oauth2', $reason);
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php'));
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
}

if (!empty($CFG->authpreventaccountcreation)) {
Expand All @@ -509,7 +509,7 @@ public function complete_login(client $client, $redirecturl) {
$errormsg = get_string('notloggedindebug', 'auth_oauth2', $reason);
$SESSION->loginerrormsg = $errormsg;
$client->log_out();
redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php'));
redirect(new moodle_url($CFG->wwwroot . '/login/index.php'));
}

if ($issuer->get('requireconfirmation')) {
Expand Down
8 changes: 4 additions & 4 deletions auth/shibboleth/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
// Redirect to SessionInitiator with entityID as argument
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])) {
// For Shibbolet 1.x Service Providers
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));

// For Shibbolet 2.x Service Providers
// header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
// header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));

} else {
// For Shibbolet 1.x Service Providers
header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));

// For Shibboleth 2.x Service Providers
// header('Location: /Shibboleth.sso/DS?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
// header('Location: /Shibboleth.sso/DS?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
}
} elseif (isset($_POST['idp']) && !isset($IdPs[$_POST['idp']])) {
$errormsg = get_string('auth_shibboleth_errormsg', 'auth_shibboleth');
Expand Down
4 changes: 2 additions & 2 deletions comment/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
die;
} else {
if ($manager->delete_comment($commentid)) {
redirect($CFG->httpswwwroot.'/comment/');
redirect($CFG->wwwroot.'/comment/');
} else {
$err = 'cannotdeletecomment';
}
Expand All @@ -81,7 +81,7 @@
echo $OUTPUT->heading(get_string('comments'));
echo $OUTPUT->box_start('generalbox commentsreport');
if (!empty($err)) {
print_error($err, 'error', $CFG->httpswwwroot.'/comment/');
print_error($err, 'error', $CFG->wwwroot.'/comment/');
}
if (empty($action)) {
echo '<form method="post">';
Expand Down
3 changes: 0 additions & 3 deletions lib/deprecatedlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,6 @@ function get_file_url($path, $options=null, $type='coursefile') {
case 'rssfile':
$url = $CFG->wwwroot."/rss/file.php";
break;
case 'httpscoursefile':
$url = $CFG->httpswwwroot."/file.php";
break;
case 'coursefile':
default:
$url = $CFG->wwwroot."/file.php";
Expand Down
10 changes: 5 additions & 5 deletions lib/editor/tinymce/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public function use_editor($elementid, array $options=null, $fpoptions=null) {
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->httpswwwroot.'/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce_src.js'));
$PAGE->requires->js(new moodle_url($CFG->wwwroot.'/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce_src.js'));
} else {
$PAGE->requires->js(new moodle_url($CFG->httpswwwroot.'/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce.js'));
$PAGE->requires->js(new moodle_url($CFG->wwwroot.'/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) {
Expand Down Expand Up @@ -127,8 +127,8 @@ protected function get_init_params($elementid, array $options=null) {
'mode' => "exact",
'elements' => $elementid,
'relative_urls' => false,
'document_base_url' => $CFG->httpswwwroot,
'moodle_plugin_base' => "$CFG->httpswwwroot/lib/editor/tinymce/plugins/",
'document_base_url' => $CFG->wwwroot,
'moodle_plugin_base' => "$CFG->wwwroot/lib/editor/tinymce/plugins/",
'content_css' => $contentcss,
'language' => $lang,
'directionality' => $directionality,
Expand Down Expand Up @@ -257,7 +257,7 @@ public function get_plugin($plugin) {
*/
public function get_tinymce_base_url() {
global $CFG;
return new moodle_url("$CFG->httpswwwroot/lib/editor/tinymce/tiny_mce/$this->version/");
return new moodle_url("$CFG->wwwroot/lib/editor/tinymce/tiny_mce/$this->version/");
}

}
2 changes: 1 addition & 1 deletion lib/editor/tinymce/plugins/spellchecker/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function update_init_params(array &$params, context $context,

// Add JS file, which uses default name.
$this->add_js_plugin($params);
$params['spellchecker_rpc_url'] = $CFG->httpswwwroot .
$params['spellchecker_rpc_url'] = $CFG->wwwroot .
'/lib/editor/tinymce/plugins/spellchecker/rpc.php';
$params['spellchecker_languages'] = $spelllanguagelist;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/editor/tinymce/tests/editor_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function test_add_button() {
'xhtmlxtras,template,pagebreak',
'gecko_spellcheck' => true,
'theme_advanced_font_sizes' => "1,2,3,4,5,6,7",
'moodle_plugin_base' => "$CFG->httpswwwroot/lib/editor/tinymce/plugins/",
'moodle_plugin_base' => "$CFG->wwwroot/lib/editor/tinymce/plugins/",
'theme_advanced_font_sizes' => "1,2,3,4,5,6,7",
'theme_advanced_layout_manager' => "SimpleLayout",
'theme_advanced_buttons1' => 'one,two,|,three,four',
Expand Down
2 changes: 1 addition & 1 deletion lib/filelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ function file_prepare_draft_area(&$draftitemid, $contextid, $component, $fileare
// at this point there should not be any draftfile links yet,
// because this is a new text from database that should still contain the @@pluginfile@@ links
// this happens when developers forget to post process the text
$text = str_replace("\"$CFG->httpswwwroot/draftfile.php", "\"$CFG->httpswwwroot/brokenfile.php#", $text);
$text = str_replace("\"$CFG->wwwroot/draftfile.php", "\"$CFG->wwwroot/brokenfile.php#", $text);
}
} else {
// nothing to do
Expand Down
2 changes: 1 addition & 1 deletion lib/filterlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ function filter_add_javascript($text) {
<script type=\"text/javascript\">
<!--
function openpopup(url,name,options,fullscreen) {
fullurl = \"".$CFG->httpswwwroot."\" + url;
fullurl = \"".$CFG->wwwroot."\" + url;
windowobj = window.open(fullurl,name,options);
if (fullscreen) {
windowobj.moveTo(0,0);
Expand Down
6 changes: 3 additions & 3 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4445,7 +4445,7 @@ function complete_user_login($user) {
} else {
require_once($CFG->dirroot . '/login/lib.php');
$SESSION->wantsurl = core_login_get_return_url();
redirect($CFG->httpswwwroot.'/login/change_password.php');
redirect($CFG->wwwroot.'/login/change_password.php');
}
} else {
print_error('nopasswordchangeforced', 'auth');
Expand Down Expand Up @@ -6160,7 +6160,7 @@ function reset_password_and_mail($user) {
$a->sitename = format_string($site->fullname);
$a->username = $user->username;
$a->newpassword = $newpassword;
$a->link = $CFG->httpswwwroot .'/login/change_password.php';
$a->link = $CFG->wwwroot .'/login/change_password.php';
$a->signoff = generate_email_signoff();

$message = get_string('newpasswordtext', '', $a);
Expand Down Expand Up @@ -6241,7 +6241,7 @@ function send_password_change_confirmation_email($user, $resetrecord) {
$data->lastname = $user->lastname;
$data->username = $user->username;
$data->sitename = format_string($site->fullname);
$data->link = $CFG->httpswwwroot .'/login/forgot_password.php?token='. $resetrecord->token;
$data->link = $CFG->wwwroot .'/login/forgot_password.php?token='. $resetrecord->token;
$data->admin = generate_email_signoff();
$data->resetminutes = $pwresetmins;

Expand Down
3 changes: 1 addition & 2 deletions lib/outputcomponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ public function get_url(moodle_page $page, renderer_base $renderer = null) {
// If the currently requested page is https then we'll return an
// https gravatar page.
if (is_https()) {
$gravatardefault = str_replace($CFG->wwwroot, $CFG->httpswwwroot, $gravatardefault); // Replace by secure url.
return new moodle_url("https://secure.gravatar.com/avatar/{$md5}", array('s' => $size, 'd' => $gravatardefault));
} else {
return new moodle_url("http://www.gravatar.com/avatar/{$md5}", array('s' => $size, 'd' => $gravatardefault));
Expand Down Expand Up @@ -520,7 +519,7 @@ public function export_for_template(renderer_base $output) {
$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->httpswwwroot . '/help.php', [
$data->url = (new moodle_url($CFG->wwwroot . '/help.php', [
'component' => $this->component,
'identifier' => $this->identifier,
'lang' => current_language()
Expand Down
Loading

0 comments on commit 672f483

Please sign in to comment.