From e765d3c396e8818dd50c232e589ddccb7efae5dc Mon Sep 17 00:00:00 2001 From: Kordan Date: Tue, 4 Sep 2012 09:49:51 +0200 Subject: [PATCH] MDL-34916 theme_formal_white: added support for relative path of logos --- theme/formal_white/layout/frontpage.php | 3 +++ theme/formal_white/layout/general.php | 3 +++ theme/formal_white/layout/report.php | 3 +++ theme/formal_white/settings.php | 4 ++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/theme/formal_white/layout/frontpage.php b/theme/formal_white/layout/frontpage.php index 29644e1dd81..3f577e66baa 100644 --- a/theme/formal_white/layout/frontpage.php +++ b/theme/formal_white/layout/frontpage.php @@ -36,6 +36,9 @@ if (!empty($PAGE->theme->settings->frontpagelogourl)) { } 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 3cebe1c0763..31e373eee79 100644 --- a/theme/formal_white/layout/general.php +++ b/theme/formal_white/layout/general.php @@ -31,6 +31,9 @@ if ($hascustommenu) { /************************************************************************************************/ if (!empty($PAGE->theme->settings->customlogourl)) { $logourl = $PAGE->theme->settings->customlogourl; + if (strtolower(substr($logourl, 0, 4)) != 'http') { + $logourl = $CFG->wwwroot.'/'.$logourl; + } } 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 9bb7ca1299f..ed64bd7cd3b 100644 --- a/theme/formal_white/layout/report.php +++ b/theme/formal_white/layout/report.php @@ -26,6 +26,9 @@ if ($hascustommenu) { /************************************************************************************************/ if (!empty($PAGE->theme->settings->customlogourl)) { $logourl = $PAGE->theme->settings->customlogourl; + if (strtolower(substr($logourl, 0, 4)) != 'http') { + $logourl = $CFG->wwwroot.'/'.$logourl; + } } else { $logourl = $OUTPUT->pix_url('logo_small', 'theme'); } diff --git a/theme/formal_white/settings.php b/theme/formal_white/settings.php index 81db472545a..67938d096f3 100644 --- a/theme/formal_white/settings.php +++ b/theme/formal_white/settings.php @@ -47,7 +47,7 @@ if ($ADMIN->fulltree) { $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_URL); + $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. $settings->add($setting); // Custom front page site logo setting @@ -55,7 +55,7 @@ if ($ADMIN->fulltree) { $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_URL); + $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. $settings->add($setting); // page header background colour setting -- 2.43.0