Skip to content
Snippets Groups Projects
Commit 0cf29c37 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

renaming theme variable

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@430 44740490-163a-0410-bde0-09ae8108e29a
parent 00fc82d4
No related branches found
No related tags found
No related merge requests found
...@@ -116,10 +116,11 @@ $config = array ( ...@@ -116,10 +116,11 @@ $config = array (
'language.default' => 'en', 'language.default' => 'en',
/* /*
* Which template directory should be used? The base is fallback (leave it to default). * Which theme directory should be used? The base is fallback (leave it to default).
*/ */
'template.use' => 'default', 'theme.use' => 'default',
'template.base' => 'default', 'theme.base' => 'default',
/* /*
* Default IdPs. If you do not enter an idpentityid in the SSO initialization endpoints, * Default IdPs. If you do not enter an idpentityid in the SSO initialization endpoints,
......
...@@ -17,6 +17,7 @@ class SimpleSAML_XHTML_Template { ...@@ -17,6 +17,7 @@ class SimpleSAML_XHTML_Template {
private $language = null; private $language = null;
private $langtext = null; private $langtext = null;
private $usebasetheme = false;
public $data = null; public $data = null;
...@@ -71,25 +72,34 @@ class SimpleSAML_XHTML_Template { ...@@ -71,25 +72,34 @@ class SimpleSAML_XHTML_Template {
} }
return $lang; return $lang;
} }
private function includeAtTemplateBase($file) { private function includeAtTemplateBase($file) {
$data = $this->data; $data = $this->data;
$filename = $this->configuration->getPathValue('templatedir') . $this->configuration->getValue('template.use') . '/' . $file; $filename = $this->configuration->getPathValue('templatedir') . $this->configuration->getValue('theme.use') . '/' . $file;
if ($this->usebasetheme) {
SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - Template: Using base for inclusion');
$filename = $this->configuration->getPathValue('templatedir') . $this->configuration->getValue('theme.base') . '/' . $file;
if (!file_exists($filename)) {
SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $file .
'] at [' . $filename . ']');
throw new Exception('Could not load template file [' . $file . ']');
}
} elseif (!file_exists($filename)) {
if (!file_exists($filename)) {
SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $file . SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $file .
'] at [' . $filename . '] - Now trying at base'); '] at [' . $filename . '] - Now trying at base');
$filename = $this->configuration->getPathValue('templatedir') . $this->configuration->getValue('template.base') . '/' . $file; $filename = $this->configuration->getPathValue('templatedir') . $this->configuration->getValue('theme.base') . '/' . $file;
if (!file_exists($filename)) { if (!file_exists($filename)) {
SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $file . SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $file .
'] at [' . $filename . ']'); '] at [' . $filename . ']');
throw new Exception('Could not load template file [' . $file . ']'); throw new Exception('Could not load template file [' . $file . ']');
} }
} }
include($filename); include($filename);
} }
...@@ -210,14 +220,16 @@ class SimpleSAML_XHTML_Template { ...@@ -210,14 +220,16 @@ class SimpleSAML_XHTML_Template {
$filename = $this->configuration->getPathValue('templatedir') . $filename = $this->configuration->getPathValue('templatedir') .
$this->configuration->getValue('template.use') . '/' . $this->template; $this->configuration->getValue('theme.use') . '/' . $this->template;
if (!file_exists($filename)) { if (!file_exists($filename)) {
SimpleSAML_Logger::warning($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $this->template . '] at [' . $filename . '] - now trying the base template'); SimpleSAML_Logger::warning($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $this->template . '] at [' . $filename . '] - now trying the base template');
$this->usebasetheme = true;
$filename = $this->configuration->getPathValue('templatedir') . $filename = $this->configuration->getPathValue('templatedir') .
$this->configuration->getValue('template.base') . '/' . $this->template; $this->configuration->getValue('theme.base') . '/' . $this->template;
if (!file_exists($filename)) { if (!file_exists($filename)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment