Skip to content
Snippets Groups Projects
Commit 580be5fe authored by Hanne Moa's avatar Hanne Moa
Browse files

Get rid of the mtype-function

For #454, #455
parent 6cedf278
No related branches found
No related tags found
No related merge requests found
...@@ -10,41 +10,11 @@ if ($this->data['isadmin']) { ...@@ -10,41 +10,11 @@ if ($this->data['isadmin']) {
$this->t('{core:frontpage:login_as_admin}').'</a></p>'; $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(); $now = time();
echo '<dl>'; echo '<dl>';
if (is_array($this->data['metaentries']['hosted']) && count($this->data['metaentries']['hosted']) > 0) { if (is_array($this->data['metaentries']['hosted']) && count($this->data['metaentries']['hosted']) > 0) {
foreach ($this->data['metaentries']['hosted'] as $hm) { 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 '<dd>';
echo '<p>Entity ID: '.$hm['entityid']; echo '<p>Entity ID: '.$hm['entityid'];
if (isset($hm['deprecated']) && $hm['deprecated']) { if (isset($hm['deprecated']) && $hm['deprecated']) {
...@@ -74,7 +44,7 @@ echo '</dl>'; ...@@ -74,7 +44,7 @@ echo '</dl>';
if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) { if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) {
foreach ($this->data['metaentries']['remote'] as $setkey => $set) { 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>'; echo '<ul>';
foreach ($set as $entry) { foreach ($set as $entry) {
echo '<li>'; echo '<li>';
...@@ -128,7 +98,7 @@ if (is_array($this->data['metaentries']['remote']) && count($this->data['metaent ...@@ -128,7 +98,7 @@ if (is_array($this->data['metaentries']['remote']) && count($this->data['metaent
<select name="set"><?php <select name="set"><?php
if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) { if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) {
foreach ($this->data['metaentries']['remote'] as $setkey => $set) { 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>';
} }
} }
?> ?>
......
...@@ -109,8 +109,21 @@ foreach ($metaentries['remote'] as $key => $value) { ...@@ -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 = new SimpleSAML_XHTML_Template($config, 'core:frontpage_federation.tpl.php');
$t->data['pageid'] = 'frontpage_federation'; $t->data['pageid'] = 'frontpage_federation';
...@@ -127,6 +140,7 @@ $t->data['links_federation'] = $links_federation; ...@@ -127,6 +140,7 @@ $t->data['links_federation'] = $links_federation;
$t->data['metaentries'] = $metaentries; $t->data['metaentries'] = $metaentries;
$t->data['mtype'] = $mtype;
$t->show(); $t->show();
......
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