From 949448f09d477f3101139330c3b6013a91f19094 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Tue, 10 Jun 2008 06:13:13 +0000 Subject: [PATCH] Made IdP discovery service translateable. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@623 44740490-163a-0410-bde0-09ae8108e29a --- dictionaries/disco.php | 21 +++++++++++++++++++++ templates/default/selectidp-dropdown.php | 16 +++++++++++----- templates/default/selectidp-links.php | 15 +++++++++++---- www/saml2/sp/idpdisco.php | 7 +++---- www/shib13/sp/idpdisco.php | 10 ++++------ 5 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 dictionaries/disco.php diff --git a/dictionaries/disco.php b/dictionaries/disco.php new file mode 100644 index 000000000..071aa09a3 --- /dev/null +++ b/dictionaries/disco.php @@ -0,0 +1,21 @@ +<?php + +$lang = array( + 'selectidp' => array ( + 'en' => 'Select your identity privider', + 'no' => 'Velg din identitetsleverandør', + ), + + 'selectidp_full' => array ( + 'en' => 'Please select the identity provider where you want to authenticate:', + 'no' => 'Vennligst velg hvilken identitetsleverandør du vil bruke for å logge inn:', + ), + + 'select' => array ( + 'en' => 'Select', + 'no' => 'Velg', + ), + +); + +?> \ No newline at end of file diff --git a/templates/default/selectidp-dropdown.php b/templates/default/selectidp-dropdown.php index 614b8e4d6..ff27869b6 100644 --- a/templates/default/selectidp-dropdown.php +++ b/templates/default/selectidp-dropdown.php @@ -1,12 +1,18 @@ -<?php $this->includeAtTemplateBase('includes/header.php'); ?> +<?php +if(!array_key_exists('header', $this->data)) { + $this->data['header'] = 'selectidp'; +} +$this->data['header'] = $this->t($this->data['header']); - +$this->includeAtTemplateBase('includes/header.php'); + +?> <div id="content"> - <h2><?php if (isset($this->data['header'])) { echo $this->data['header']; } else { echo "Select your IdP"; } ?></h2> + <h2><?php echo $this->data['header']; ?></h2> - <p>Please select the identity provider where you want to authenticate:</p> + <p><?php echo $this->t('selectidp_full'); ?></p> <form method="get" action="<?php echo $this->data['urlpattern']; ?>"> <input type="hidden" name="entityID" value="<?php echo htmlspecialchars($this->data['entityID']); ?>" /> @@ -27,7 +33,7 @@ } ?> </select> - <input type="submit" value="Select"/> + <input type="submit" value="<?php echo $this->t('select'); ?>"/> </form> diff --git a/templates/default/selectidp-links.php b/templates/default/selectidp-links.php index e57cdf6d0..c0a5a0ed7 100644 --- a/templates/default/selectidp-links.php +++ b/templates/default/selectidp-links.php @@ -1,11 +1,18 @@ -<?php $this->includeAtTemplateBase('includes/header.php'); ?> +<?php - +if(!array_key_exists('header', $this->data)) { + $this->data['header'] = 'selectidp'; +} +$this->data['header'] = $this->t($this->data['header']); + +$this->includeAtTemplateBase('includes/header.php'); + +?> <div id="content"> - <h2><?php if (isset($this->data['header'])) { echo $this->data['header']; } else { echo "Select your IdP"; } ?></h2> + <h2><?php echo $this->data['header']; ?></h2> - <p>Please select the identity provider where you want to authenticate:</p> + <p><?php echo $this->t('selectidp_full'); ?></p> <?php diff --git a/www/saml2/sp/idpdisco.php b/www/saml2/sp/idpdisco.php index 0e3202de5..add6a3620 100644 --- a/www/saml2/sp/idpdisco.php +++ b/www/saml2/sp/idpdisco.php @@ -62,8 +62,7 @@ if (!empty($_COOKIE['preferedidp'])) { * Currently the supported options is either a drop down menu or a list view. */ $templatefile = ($config->getValue('idpdisco.layout') == 'dropdown' ? 'selectidp-dropdown.php' : 'selectidp-links.php'); -$t = new SimpleSAML_XHTML_Template($config, $templatefile); -$t->data['header'] = 'Select your identity provider'; +$t = new SimpleSAML_XHTML_Template($config, $templatefile, 'disco.php'); $t->data['idplist'] = $idplist; $t->data['preferredidp'] = $preferredidp; @@ -71,11 +70,11 @@ if ($config->getValue('idpdisco.layout') == 'dropdown') { $t->data['return']= $return; $t->data['returnIDParam'] = $returnidparam; $t->data['entityID'] = $spentityid; - $t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURLNoQuery()); + $t->data['urlpattern'] = htmlspecialchars(SimpleSAML_Utilities::selfURLNoQuery()); $t->show(); } else { - $t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid='); + $t->data['urlpattern'] = htmlspecialchars(SimpleSAML_Utilities::selfURL() . '&idpentityid='); $t->show(); } diff --git a/www/shib13/sp/idpdisco.php b/www/shib13/sp/idpdisco.php index ea3aa5037..6f7e5c3c0 100644 --- a/www/shib13/sp/idpdisco.php +++ b/www/shib13/sp/idpdisco.php @@ -48,22 +48,20 @@ try { } if ($config->getValue('idpdisco.layout') == 'dropdown') { - $t = new SimpleSAML_XHTML_Template($config, 'selectidp-dropdown.php'); - $t->data['header'] = 'Select your identity provider'; + $t = new SimpleSAML_XHTML_Template($config, 'selectidp-dropdown.php', 'disco.php'); $t->data['idplist'] = $idplist; $t->data['return']= $return; $t->data['returnIDParam'] = $returnidparam; $t->data['entityID'] = $spentityid; $t->data['preferedidp'] = (!empty($_COOKIE['preferedidp'])) ? $_COOKIE['preferedidp'] : null; - $t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURLNoQuery()); + $t->data['urlpattern'] = htmlspecialchars(SimpleSAML_Utilities::selfURLNoQuery()); $t->show(); } else { - $t = new SimpleSAML_XHTML_Template($config, 'selectidp-links.php'); - $t->data['header'] = 'Select your identity provider'; + $t = new SimpleSAML_XHTML_Template($config, 'selectidp-links.php', 'disco.php'); $t->data['idplist'] = $idplist; - $t->data['urlpattern'] = htmlentities(SimpleSAML_Utilities::selfURL() . '&idpentityid='); + $t->data['urlpattern'] = htmlspecialchars(SimpleSAML_Utilities::selfURL() . '&idpentityid='); $t->show(); } -- GitLab