Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions libraries/src/Application/AdministratorApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,15 @@ public function getTemplate($params = false)
$db = Factory::getDbo();

$query = $db->getQuery(true)
->select($db->quoteName(['s.template', 's.params', 's.inheritable', 's.parent']))
/*
* It is important to use the asterisk for THIS select query here.
* It is needed due to the core update process.
* Depending on the version before the update new database columns are used before they exist.
* This causes the update to crash with SQL error.
*
* Can be reviewed for Joomla! 5.0
*/
->select('s.*')
->from($db->quoteName('#__template_styles', 's'))
->join(
'LEFT',
Expand Down Expand Up @@ -265,7 +273,18 @@ public function getTemplate($params = false)
$template = $db->loadObject();

$template->template = InputFilter::getInstance()->clean($template->template, 'cmd');
$template->params = new Registry($template->params);
$template->params = new Registry($template->params);

// We have to check required properties which may not exist during the upgrade process
if (!property_exists($template, 'parent'))
{
$template->parent = '';
}

if (!property_exists($template, 'inheritable'))
{
$template->inheritable = 0;
}

// Fallback template
if (!file_exists(JPATH_THEMES . '/' . $template->template . '/index.php')
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/HTML/HTMLHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec
$template = $app->getTemplate(true);
$templaPath = JPATH_THEMES;

if ($template->inheritable || !empty($template->parent))
if (!empty($template->inheritable) || !empty($template->parent))
{
$client = $app->isClient('administrator') === true ? 'administrator' : 'site';
$templaPath = JPATH_ROOT . "/media/templates/$client";
Expand Down
7 changes: 6 additions & 1 deletion libraries/src/Helper/ModuleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ public static function getLayoutPath($module, $layout = 'default')

// Build the template and base path for the layout
$tPath = JPATH_THEMES . '/' . $template . '/html/' . $module . '/' . $layout . '.php';
$iPath = JPATH_THEMES . '/' . $templateObj->parent . '/html/' . $module . '/' . $layout . '.php';

if (!empty($templateObj->parent))
{
$iPath = JPATH_THEMES . '/' . $templateObj->parent . '/html/' . $module . '/' . $layout . '.php';
}

$bPath = JPATH_BASE . '/modules/' . $module . '/tmpl/' . $defaultLayout . '.php';
$dPath = JPATH_BASE . '/modules/' . $module . '/tmpl/default.php';

Expand Down