diff --git a/include/text.php b/include/text.php index d1ccb3c96c..e8384123c4 100644 --- a/include/text.php +++ b/include/text.php @@ -652,14 +652,14 @@ function get_template_file($a, $filename, $root = '') { $theme = current_theme(); // Make sure $root ends with a slash / - if ($root !== '' && $root[strlen($root) - 1] !== '/') { + if ($root !== '' && substr($root, -1, 1) !== '/') { $root = $root . '/'; } if (file_exists("{$root}view/theme/$theme/$filename")) { $template_file = "{$root}view/theme/$theme/$filename"; - } elseif (x($a->theme_info, "extends") && file_exists("{$root}view/theme/{$a->theme_info[\"extends\"]}/$filename")) { - $template_file = "{$root}view/theme/{$a->theme_info[\"extends\"]}/$filename"; + } elseif (x($a->theme_info, "extends") && file_exists(sprintf('%sview/theme/%s}/%s', $root, $a->theme_info["extends"], $filename))) { + $template_file = sprintf('%sview/theme/%s}/%s', $root, $a->theme_info["extends"], $filename); } elseif (file_exists("{$root}/$filename")) { $template_file = "{$root}/$filename"; } else {