Commit ee6a4086 authored by Pat Kira's avatar Pat Kira Committed by Cecilia Vela Gurovic
Browse files

Bug 1694158 - Fix site logo not loading allowed extensions within the

selected custom theme

Fixed the site logo falls the back to mahara logo (svg version) instead of
displaying the png version. This happens after adding svg in as an
allowed file extension.

behatnotneeded

Change-Id: I6cf22bed466b8b7ec86aa1386b8edd54112d37ac
parent d32b9ced
......@@ -1344,10 +1344,25 @@ class Theme {
$extensions = array('svg', 'png', 'gif', 'jpg');
// Check for all images extension in the correct order.
$temps = array();
foreach ($extensions as $ext) {
$temploc = $this->_get_path("images/$filename.$ext", false, $plugindirectory, '', false);
if (is_readable(get_config('docroot') . $temploc)) {
$loc = $temploc;
$temps["images/$filename.$ext"] = $temploc;
}
// Now check for which image exists by theme order
$inheritance = $this->inheritance;
array_unshift($inheritance, 'local'); // Add local dir to be checked first
foreach ($inheritance as $theme) {
foreach ($temps as $key => $temploc) {
$pluginpath = $plugindirectory ? 'plugintype/' . $plugindirectory . '/' : '';
$tplfile = 'theme/' . $theme . '/' . $pluginpath . $key;
if ($temploc == $tplfile && is_readable(get_config('docroot') . $temploc)) {
$loc = $temploc;
break;
}
}
if ($loc != '') {
// we've found a valid file in the theme
break;
}
}
......
Markdown is supported
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