diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 1f5c81cc7cf1bae917d5588e406acb447d72df43..87c8f63e69684ca2760f753ff5496cccbb5161e3 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -534,76 +534,6 @@ class Template extends Response } - /** - * Find template path. - * - * This function locates the given template based on the template name. It will first search for the template in - * the current theme directory, and then the default theme. - * - * The template name may be on the form <module name>:<template path>, in which case it will search for the - * template file in the given module. - * - * @param string $template The relative path from the theme directory to the template file. - * @param bool $throw_exception - * - * @return string|null The absolute path to the template file. - * - * @throws \Exception If the template file couldn't be found. - */ - private function findTemplatePath(string $template, bool $throw_exception = true): ?string - { - list($templateModule, $templateName) = $this->findModuleAndTemplateName($template); - $templateModule = ($templateModule !== null) ? $templateModule : 'default'; - - // first check the current theme - if ($this->theme['module'] !== null) { - // .../module/<themeModule>/themes/<themeName>/<templateModule>/<templateName> - - $filename = Module::getModuleDir($this->theme['module']) . - '/themes/' . $this->theme['name'] . '/' . $templateModule . '/' . $templateName; - } elseif ($templateModule !== 'default') { - // .../module/<templateModule>/templates/<templateName> - $filename = Module::getModuleDir($templateModule) . '/templates/' . $templateName; - } else { - // .../templates/<theme>/<templateName> - $base = $this->configuration->getPathValue('templatedir', 'templates/') ?: 'templates/'; - $filename = $base . $templateName; - } - - $filename = $this->normalizeTemplateName($filename); - - // not found in current theme - Logger::debug( - $_SERVER['PHP_SELF'] . ' - Template: Could not find template file [' . $template . '] at [' . - $filename . '] - now trying the base template' - ); - - // try default theme - if ($templateModule !== 'default') { - // .../module/<templateModule>/templates/<templateName> - $filename = Module::getModuleDir($templateModule) . '/templates/' . $templateName; - } else { - // .../templates/<templateName> - $base = $this->configuration->getPathValue('templatedir', 'templates/') ?: 'templates/'; - $filename = $base . '/' . $templateName; - } - - $filename = $this->normalizeTemplateName($filename); - - // not found in default template - if ($throw_exception) { - // log error and throw exception - $error = 'Template: Could not find template file [' . $template . '] at [' . $filename . ']'; - Logger::critical($_SERVER['PHP_SELF'] . ' - ' . $error); - - throw new \Exception($error); - } else { - // missing template expected, return NULL - return null; - } - } - - /** * Return the internal translator object used by this template. *