diff --git a/theme/formal_white/layout/frontpage.php b/theme/formal_white/layout/frontpage.php index edbb42c373d..a58cf65273a 100644 --- a/theme/formal_white/layout/frontpage.php +++ b/theme/formal_white/layout/frontpage.php @@ -30,15 +30,12 @@ if ($hascustommenu) { /************************************************************************************************/ if (!empty($PAGE->theme->settings->frontpagelogourl)) { - $logourl = $PAGE->theme->settings->frontpagelogourl; + $logourl = $PAGE->theme->setting_file_url('frontpagelogourl', 'frontpagelogourl'); } else if (!empty($PAGE->theme->settings->customlogourl)) { - $logourl = $PAGE->theme->settings->customlogourl; + $logourl = $PAGE->theme->setting_file_url('customlogourl', 'customlogourl'); } else { $logourl = $OUTPUT->pix_url('logo', 'theme'); } -if (strtolower(substr($logourl, 0, 4)) != 'http') { - $logourl = $CFG->wwwroot.'/'.$logourl; -} $hasframe = !isset($PAGE->theme->settings->noframe) || !$PAGE->theme->settings->noframe; diff --git a/theme/formal_white/layout/general.php b/theme/formal_white/layout/general.php index b7fbcfe31fc..8b40bf51360 100644 --- a/theme/formal_white/layout/general.php +++ b/theme/formal_white/layout/general.php @@ -40,10 +40,7 @@ if ($hascustommenu) { /************************************************************************************************/ if (!empty($PAGE->theme->settings->customlogourl)) { - $logourl = $PAGE->theme->settings->customlogourl; - if (strtolower(substr($logourl, 0, 4)) != 'http') { - $logourl = $CFG->wwwroot.'/'.$logourl; - } + $logourl = $PAGE->theme->setting_file_url('customlogourl', 'customlogourl'); } else { $logourl = $OUTPUT->pix_url('logo_small', 'theme'); } diff --git a/theme/formal_white/layout/report.php b/theme/formal_white/layout/report.php index 04c2cff3aa9..99275e334cc 100644 --- a/theme/formal_white/layout/report.php +++ b/theme/formal_white/layout/report.php @@ -35,10 +35,7 @@ if ($hascustommenu) { /************************************************************************************************/ if (!empty($PAGE->theme->settings->customlogourl)) { - $logourl = $PAGE->theme->settings->customlogourl; - if (strtolower(substr($logourl, 0, 4)) != 'http') { - $logourl = $CFG->wwwroot.'/'.$logourl; - } + $logourl = $PAGE->theme->setting_file_url('customlogourl', 'customlogourl'); } else { $logourl = $OUTPUT->pix_url('logo_small', 'theme'); } diff --git a/theme/formal_white/settings.php b/theme/formal_white/settings.php index e2583cfe648..ec6680f194e 100644 --- a/theme/formal_white/settings.php +++ b/theme/formal_white/settings.php @@ -50,8 +50,7 @@ if ($ADMIN->fulltree) { $name = 'theme_formal_white/customlogourl'; $title = get_string('customlogourl','theme_formal_white'); $description = get_string('customlogourldesc', 'theme_formal_white'); - $default = ''; - $setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_RAW); // we want it accepting ../ at the beginning. Security is not at its top but Moodle trusts admins. + $setting = new admin_setting_configstoredfile($name, $title, $description, 'customlogourl'); $setting->set_updatedcallback('theme_reset_all_caches'); $settings->add($setting); @@ -59,8 +58,7 @@ if ($ADMIN->fulltree) { $name = 'theme_formal_white/frontpagelogourl'; $title = get_string('frontpagelogourl','theme_formal_white'); $description = get_string('frontpagelogourldesc', 'theme_formal_white'); - $default = ''; - $setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_RAW); // we want it accepting ../ at the beginning. Security is not at its top but Moodle trusts admins. + $setting = new admin_setting_configstoredfile($name, $title, $description, 'frontpagelogourl'); $setting->set_updatedcallback('theme_reset_all_caches'); $settings->add($setting);