Simplify url building for update_link_stylesheet_parse() #179.

This commit is contained in:
Mikhail Golenkov
2020-02-07 14:25:33 +11:00
parent 7a1fa1f91b
commit a361ae4008

View File

@@ -156,25 +156,8 @@ class maintenance_static_page_generator {
if (maintenance_static_page_io::is_url($originalurl)) {
$fullurl = $originalurl;
} else if ($originalurl[0] == '/') {
if (strpos($CFG->wwwroot, 'http://') === 0) {
$domain = substr($CFG->wwwroot, 7);
if (strpos($domain, '/') > 0) {
$base = substr($domain, 0, strpos($domain, '/'));
} else {
$base = $domain;
}
$fullurl = 'http://'.$base.$originalurl;
} else if (strpos($CFG->wwwroot, 'https://') === 0) {
$domain = substr($CFG->wwwroot, 8);
if (strpos($domain, '/') > 0) {
$base = substr($domain, 0, strpos($domain, '/'));
} else {
$base = $domain;
}
$fullurl = 'https://'.$base.$originalurl;
} else {
$fullurl = $CFG->wwwroot.$originalurl;
}
$rooturl = parse_url($CFG->wwwroot);
$fullurl = $rooturl['scheme'].'://'.$rooturl['host'].$originalurl;
} else {
$fullurl = $baseref.'/'.$originalurl;
}