diff --git a/modules/core/templates/frontpage_federation.tpl.php b/modules/core/templates/frontpage_federation.tpl.php index b0b7ca22b48ede742ccf6ae5188f5a5b8243f1bd..2d4c8495735af6e4da17c55338136e31dab7adb0 100644 --- a/modules/core/templates/frontpage_federation.tpl.php +++ b/modules/core/templates/frontpage_federation.tpl.php @@ -10,41 +10,11 @@ if ($this->data['isadmin']) { $this->t('{core:frontpage:login_as_admin}').'</a></p>'; } -function mtype($set) -{ - switch ($set) { - case 'saml20-sp-remote': - return '{admin:metadata_saml20-sp}'; - case 'saml20-sp-hosted': - return '{admin:metadata_saml20-sp}'; - case 'saml20-idp-remote': - return '{admin:metadata_saml20-idp}'; - case 'saml20-idp-hosted': - return '{admin:metadata_saml20-idp}'; - case 'shib13-sp-remote': - return '{admin:metadata_shib13-sp}'; - case 'shib13-sp-hosted': - return '{admin:metadata_shib13-sp}'; - case 'shib13-idp-remote': - return '{admin:metadata_shib13-idp}'; - case 'shib13-idp-hosted': - return '{admin:metadata_shib13-idp}'; - case 'adfs-sp-remote': - return '{admin:metadata_adfs-sp}'; - case 'adfs-sp-hosted': - return '{admin:metadata_adfs-sp}'; - case 'adfs-idp-remote': - return '{admin:metadata_adfs-idp}'; - case 'adfs-idp-hosted': - return '{admin:metadata_adfs-idp}'; - } -} - $now = time(); echo '<dl>'; if (is_array($this->data['metaentries']['hosted']) && count($this->data['metaentries']['hosted']) > 0) { foreach ($this->data['metaentries']['hosted'] as $hm) { - echo '<dt>'.$this->t(mtype($hm['metadata-set'])).'</dt>'; + echo '<dt>'.$this->t($this->data['mtype'][$hm['metadata-set']]).'</dt>'; echo '<dd>'; echo '<p>Entity ID: '.$hm['entityid']; if (isset($hm['deprecated']) && $hm['deprecated']) { @@ -74,7 +44,7 @@ echo '</dl>'; if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) { foreach ($this->data['metaentries']['remote'] as $setkey => $set) { - echo '<fieldset class="fancyfieldset"><legend>'.$this->t(mtype($setkey)).' (Trusted)</legend>'; + echo '<fieldset class="fancyfieldset"><legend>'.$this->t($this->data['mtype'][$setkey]).' (Trusted)</legend>'; echo '<ul>'; foreach ($set as $entry) { echo '<li>'; @@ -128,7 +98,7 @@ if (is_array($this->data['metaentries']['remote']) && count($this->data['metaent <select name="set"><?php if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) { foreach ($this->data['metaentries']['remote'] as $setkey => $set) { - echo '<option value="'.htmlspecialchars($setkey).'">'.$this->t(mtype($setkey)).'</option>'; + echo '<option value="'.htmlspecialchars($setkey).'">'.$this->t($this->data['mtype'][$setkey]).'</option>'; } } ?> diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php index 35f31d432b18bfd34ee9ec11a69e9d4a5b57f7b5..e7c1196dbc95316acc754bba68e3572485b47a73 100644 --- a/modules/core/www/frontpage_federation.php +++ b/modules/core/www/frontpage_federation.php @@ -109,8 +109,21 @@ foreach ($metaentries['remote'] as $key => $value) { } } - - +# look up translated string +$mtype = array( + 'saml20-sp-remote' => $t->noop('{admin:metadata_saml20-sp}'), + 'saml20-sp-hosted' => $t->noop('{admin:metadata_saml20-sp}'), + 'saml20-idp-remote' => $t->noop('{admin:metadata_saml20-idp}'), + 'saml20-idp-hosted' => $t->noop('{admin:metadata_saml20-idp}'), + 'shib13-sp-remote' => $t->noop('{admin:metadata_shib13-sp}'), + 'shib13-sp-hosted' => $t->noop('{admin:metadata_shib13-sp}'), + 'shib13-idp-remote' => $t->noop('{admin:metadata_shib13-idp}'), + 'shib13-idp-hosted' => $t->noop('{admin:metadata_shib13-idp}'), + 'adfs-sp-remote' => $t->noop('{admin:metadata_adfs-sp}'), + 'adfs-sp-hosted' => $t->noop('{admin:metadata_adfs-sp}'), + 'adfs-idp-remote' => $t->noop('{admin:metadata_adfs-idp}'), + 'adfs-idp-hosted' => $t->noop('{admin:metadata_adfs-idp}'), +); $t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_federation.tpl.php'); $t->data['pageid'] = 'frontpage_federation'; @@ -127,6 +140,7 @@ $t->data['links_federation'] = $links_federation; $t->data['metaentries'] = $metaentries; +$t->data['mtype'] = $mtype; $t->show();