Newer
Older
Andreas Åkre Solberg
committed
<?php $this->includeAtTemplateBase('includes/header.php'); ?>
<div id="content">
Andreas Åkre Solberg
committed
<p>To look at the details for an SAML entity, click on the SAML entity header.</p>
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
<?php
Andreas Åkre Solberg
committed
function showEntry($header, $list, $baseurl) {
Andreas Åkre Solberg
committed
echo '<h3>' . $header . '</h3>';
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
foreach ($list AS $entityid => $entity) {
Andreas Åkre Solberg
committed
$encodedEntityID = preg_replace('/=/', '_', base64_encode($entityid . $header));
Andreas Åkre Solberg
committed
$name = $entityid;
if (isset($entity['optional.found']['name'])) $name = $entity['optional.found']['name'];
//print_r($entity);
Andreas Åkre Solberg
committed
$warning = false;
if (count($entity['leftovers']) > 0) $warning = TRUE;
if (count($entity['required.notfound']) > 0) $warning = TRUE;
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
echo '<h4 style="padding-left: 2em; clear: both;" onclick="document.getElementById(\'metadatasection-' . $encodedEntityID . '\').style.display=\'block\';">' . htmlspecialchars($name) . '</h4>';
Andreas Åkre Solberg
committed
if ($warning) {
echo '<div><img src="/' . $baseurl . 'resources/icons/caution.png" style="float: left; margin-right: 1em" />';
echo 'Error in this metadata entry.</div>';
}
Andreas Åkre Solberg
committed
echo '<div id="metadatasection-' . $encodedEntityID . '" style="display: none">';
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
if (isset($entity['optional.found']['description'])) {
Olav Morken
committed
echo '<p>' . htmlspecialchars($entity['optional.found']['description']) . '</p>';
Andreas Åkre Solberg
committed
}
Andreas Åkre Solberg
committed
echo '<div style="margin-left: 1em">';
echo '<div class="efieldlist"><h5>Required fields</h5>';
Andreas Åkre Solberg
committed
echo '<dl>';
Andreas Åkre Solberg
committed
foreach ($entity['required.found'] AS $key => $value) {
Andreas Åkre Solberg
committed
echo '<dt>' . htmlspecialchars($key) . '</dt><dd>' . htmlspecialchars(var_export($value, TRUE)) . '</dd>';
Andreas Åkre Solberg
committed
}
echo '</dl>' . "\n\n";
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
if (count($entity['required.notfound']) > 0) {
Andreas Åkre Solberg
committed
echo '</div><div class="efieldlist warning">';
echo '<h5>The following required fields was not found</h5><ul>';
Andreas Åkre Solberg
committed
foreach ($entity['required.notfound'] AS $key) {
Olav Morken
committed
echo '<li>' . htmlspecialchars($key) . '</li>';
Andreas Åkre Solberg
committed
}
echo '</ul>';
}
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
if (count($entity['optional.found']) > 0) {
Andreas Åkre Solberg
committed
echo '</div><div class="efieldlist">';
echo '<h5>Optional fields</h5>';
echo '<dl>';
Andreas Åkre Solberg
committed
foreach ($entity['optional.found'] AS $key => $value) {
Andreas Åkre Solberg
committed
echo '<dt>' . htmlspecialchars($key) . '</dt><dd>' . htmlspecialchars(var_export($value, TRUE)) . '</dd>';
Andreas Åkre Solberg
committed
}
Andreas Åkre Solberg
committed
echo '</dl>';
Andreas Åkre Solberg
committed
}
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
if (count($entity['optional.notfound']) > 0) {
Andreas Åkre Solberg
committed
echo '</div><div class="efieldlist info">';
echo '<h5>The following optional fields was not found:</h5><ul>';
Andreas Åkre Solberg
committed
foreach ($entity['optional.notfound'] AS $key) {
Olav Morken
committed
echo '<li>' . htmlspecialchars($key) . '</li>';
Andreas Åkre Solberg
committed
}
echo '</ul>';
}
if (count($entity['leftovers']) > 0) {
Andreas Åkre Solberg
committed
echo '</div><div class="efieldlist warning">';
echo '<h5>The following fields was not reckognized</h5><ul>';
Andreas Åkre Solberg
committed
foreach ($entity['leftovers'] AS $key => $value) {
Olav Morken
committed
echo '<li>' . htmlspecialchars($key) . '</li>';
Andreas Åkre Solberg
committed
}
echo '</ul>';
}
Andreas Åkre Solberg
committed
echo '</div></div>';
echo '</div>' . "\n\n";;
Andreas Åkre Solberg
committed
}
}
Andreas Åkre Solberg
committed
if (array_key_exists('metadata.saml20-sp-hosted', $this->data))
showEntry('SAML 2.0 Service Provider (Hosted)', $this->data['metadata.saml20-sp-hosted'], $this->data['baseurlpath']);
if (array_key_exists('metadata.saml20-sp-remote', $this->data))
showEntry('SAML 2.0 Service Provider (Remote)', $this->data['metadata.saml20-sp-remote'], $this->data['baseurlpath']);
if (array_key_exists('metadata.saml20-idp-hosted', $this->data))
showEntry('SAML 2.0 Identity Provider (Hosted)', $this->data['metadata.saml20-idp-hosted'], $this->data['baseurlpath']);
if (array_key_exists('metadata.saml20-idp-remote', $this->data))
showEntry('SAML 2.0 Identity Provider (Remote)', $this->data['metadata.saml20-idp-remote'], $this->data['baseurlpath']);
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
if (array_key_exists('metadata.shib13-sp-hosted', $this->data))
showEntry('Shib 1.3 Service Provider (Hosted)', $this->data['metadata.shib13-sp-hosted'], $this->data['baseurlpath']);
if (array_key_exists('metadata.shib13-sp-remote', $this->data))
showEntry('Shib 1.3 Service Provider (Remote)', $this->data['metadata.shib13-sp-remote'], $this->data['baseurlpath']);
if (array_key_exists('metadata.shib13-idp-hosted', $this->data))
showEntry('Shib 1.3 Identity Provider (Hosted)', $this->data['metadata.shib13-idp-hosted'], $this->data['baseurlpath']);
if (array_key_exists('metadata.shib13-idp-remote', $this->data))
showEntry('Shib 1.3 Identity Provider (Remote)', $this->data['metadata.shib13-idp-remote'], $this->data['baseurlpath']);
Andreas Åkre Solberg
committed
Andreas Åkre Solberg
committed
?>
<?php $this->includeAtTemplateBase('includes/footer.php'); ?>