summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndjelko Horvat <comel@vingd.com>2013-01-08 11:56:19 +0000
committerAndjelko Horvat <comel@vingd.com>2013-01-08 11:56:19 +0000
commitc74c356ff4dfa80ff5cfd5aec754d0775a28e116 (patch)
treea6cf7d2a153a6f7186ce5b6914f47cfdf2b3ac37
parent50b177833c222d41d195398cb48efb476e1ea2ef (diff)
downloadsimplesamlphp-c74c356ff4dfa80ff5cfd5aec754d0775a28e116.zip
simplesamlphp-c74c356ff4dfa80ff5cfd5aec754d0775a28e116.tar.gz
simplesamlphp-c74c356ff4dfa80ff5cfd5aec754d0775a28e116.tar.bz2
SimpleSAML_XHTML_Template: add language parameter options (issue #530).
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3217 44740490-163a-0410-bde0-09ae8108e29a
-rw-r--r--config-templates/config.php6
-rw-r--r--lib/SimpleSAML/XHTML/Template.php13
-rw-r--r--templates/includes/header.php2
3 files changed, 17 insertions, 4 deletions
diff --git a/config-templates/config.php b/config-templates/config.php
index dc63b94..0e82fb1 100644
--- a/config-templates/config.php
+++ b/config-templates/config.php
@@ -278,6 +278,12 @@ $config = array (
'language.default' => 'en',
/*
+ * Options to override the default settings for the language parameter
+ */
+ 'language.parameter.name' => 'language',
+ 'language.parameter.setcookie' => TRUE,
+
+ /*
* Options to override the default settings for the language cookie
*/
'language.cookie.name' => 'language',
diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index b58af7e..9bb4759 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -39,6 +39,12 @@ class SimpleSAML_XHTML_Template {
/**
+ * HTTP GET language parameter name.
+ */
+ private $languageParameterName = 'language';
+
+
+ /**
* Constructor
*
* @param $configuration Configuration object
@@ -52,9 +58,10 @@ class SimpleSAML_XHTML_Template {
$this->data['baseurlpath'] = $this->configuration->getBaseURL();
$this->availableLanguages = $this->configuration->getArray('language.available', array('en'));
-
- if (isset($_GET['language'])) {
- $this->setLanguage($_GET['language']);
+
+ $this->languageParameterName = $this->configuration->getString('language.parameter.name', 'language');
+ if (isset($_GET[$this->languageParameterName])) {
+ $this->setLanguage($_GET[$this->languageParameterName], $this->configuration->getBoolean('language.parameter.setcookie', TRUE));
}
if($defaultDictionary !== NULL && substr($defaultDictionary, -4) === '.php') {
diff --git a/templates/includes/header.php b/templates/includes/header.php
index 692f21f..4dd83e4 100644
--- a/templates/includes/header.php
+++ b/templates/includes/header.php
@@ -193,7 +193,7 @@ if($onLoad !== '') {
if ($current) {
$textarray[] = $langnames[$lang];
} else {
- $textarray[] = '<a href="' . htmlspecialchars(SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(), array('language' => $lang))) . '">' .
+ $textarray[] = '<a href="' . htmlspecialchars(SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(), array($this->languageParameterName => $lang))) . '">' .
$langnames[$lang] . '</a>';
}
}