Skip to content
Snippets Groups Projects
Commit 60a98386 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Making tabs on frontpage and links to login as an administrator

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1199 44740490-163a-0410-bde0-09ae8108e29a
parent fddd10c2
No related branches found
No related tags found
No related merge requests found
<?php
# $this->data['icon'] = 'compass_l.png';
$this->includeAtTemplateBase('includes/header.php');
$this->data['head'] = '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery.js"></script>';
$this->data['head'] .= '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-ui.js"></script>';
$this->data['head'] .= '<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . 'resources/uitheme/jquery-ui-themeroller.css" />';
$this->data['head'] .= '<script type="text/javascript">
$(document).ready(function() {
$("#tabdiv > ul").tabs();
});
</script>';
$this->includeAtTemplateBase('includes/header.php');
if ($this->data['isadmin']) {
echo '<p style="float: right">You are logged in as administrator</p>';
} else {
echo '<p style="float: right"><a href="' . $this->data['loginurl'] . '">Log in as administrator</a></p>';
}
?>
<div id="tabdiv">
<ul>
<li><a href="#welcome"><?php echo $this->t('welcome'); ?></a></li>
<li><a href="#configuration"><?php echo $this->t('configuration'); ?></a></li>
<li><a href="#metadata"><?php echo $this->t('metadata'); ?></a></li>
</ul>
<div id="welcome">
<div class="enablebox mini">
<table>
......@@ -30,12 +65,6 @@
<p><?php echo $this->t('intro'); ?></p>
<div>
<code style="background: white; border: 1px solid #ccc; padding: 1em; color: #555" ><?php
echo $this->data['directory'] . ' (' . $this->data['version'] . ')';
?></code>
</div>
<h2><?php echo $this->t('useful_links_header'); ?></h2>
<ul>
<?php
......@@ -47,26 +76,41 @@
</ul>
<h2><?php echo $this->t('metadata_header'); ?></h2>
<h2><?php echo $this->t('doc_header'); ?></h2>
<ul>
<?php
foreach ($this->data['links_meta'] AS $link) {
foreach ($this->data['links_doc'] AS $link) {
echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a></li>';
}
?>
</ul>
<h2><?php echo $this->t('doc_header'); ?></h2>
<h2><?php echo $this->t('about_header'); ?></h2>
<p><?php echo $this->t('about_text'); ?></p>
</div> <!-- #welcome -->
<div id="configuration">
<div>
<code style="background: white; border: 1px solid #ccc; padding: 1em; color: #555" ><?php
echo $this->data['directory'] . ' (' . $this->data['version'] . ')';
?></code>
</div>
<h2><?php echo $this->t('configuration'); ?></h2>
<ul>
<?php
foreach ($this->data['links_doc'] AS $link) {
foreach ($this->data['links_conf'] AS $link) {
echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a></li>';
}
?>
</ul>
<?php
if (array_key_exists('warnings', $this->data) && is_array($this->data['warnings']) && !empty($this->data['warnings'])) {
......@@ -77,31 +121,117 @@
}
}
?>
<?php
if ($this->data['isadmin']) {
echo '<h2>'. $this->t('checkphp') . '</h2>';
echo '<div class="enablebox"><table>';
$icon_enabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/accept.png" alt="enabled" />';
$icon_disabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/delete.png" alt="disabled" />';
foreach ($this->data['funcmatrix'] AS $func) {
echo '<tr class="' . ($func['enabled'] ? 'enabled' : 'disabled') . '"><td>' . ($func['enabled'] ? $icon_enabled : $icon_disabled) . '</td>
<td>' . $this->t($func['required']) . '</td><td>' . $func['descr'] . '</td></tr>';
}
}
?>
</table>
</div>
<h2><?php echo $this->t('checkphp'); ?></h2>
</div> <!-- #configuration -->
<div id="metadata">
<div class="enablebox">
<table>
<?php
$icon_enabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/accept.png" alt="enabled" />';
$icon_disabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/delete.png" alt="disabled" />';
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}';
}
}
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'])) . '</tt></dt>';
echo '<dd>';
echo '<p>Entity ID: ' . $hm['entityid'];
if ($hm['entityid'] !== $hm['metadata-index'])
echo '<br />Index: ' . $hm['metadata-index'];
if (array_key_exists('name', $hm))
echo '<br /><strong>' . $this->getTranslation(SimpleSAML_Utilities::arrayize($hm['name'], 'en')) . '</strong>';
if (array_key_exists('descr', $hm))
echo '<br /><strong>' . $this->getTranslation(SimpleSAML_Utilities::arrayize($hm['descr'], 'en')) . '</strong>';
echo '<br />[ <a href="' . $hm['metadata-url'] . '">' . $this->t('show_metadata') . '</a> ]';
echo '</dd>';
}
echo '</dl>';
foreach ($this->data['funcmatrix'] AS $func) {
echo '<tr class="' . ($func['enabled'] ? 'enabled' : 'disabled') . '"><td>' . ($func['enabled'] ? $icon_enabled : $icon_disabled) . '</td>
<td>' . $this->t($func['required']) . '</td><td>' . $func['descr'] . '</td></tr>';
if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0)
foreach($this->data['metaentries']['remote'] AS $setkey => $set) {
echo '<fieldset><legend>' . $this->t(mtype($setkey)) . ' (Trusted)</legend>';
echo '<ul>';
foreach($set AS $entry) {
echo '<li>';
if (array_key_exists('name', $entry)) {
echo $this->getTranslation(SimpleSAML_Utilities::arrayize($entry['name'], 'en'));
} else {
echo $entry['entityid'];
}
echo '</li>';
}
echo '</ul>';
echo '</fieldset>';
}
?>
</table>
</div>
<h2><?php echo $this->t('metadata_header'); ?></h2>
<ul>
<?php
foreach ($this->data['links_meta'] AS $link) {
echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a></li>';
}
?>
</ul>
<h2><?php echo $this->t('about_header'); ?></h2>
<p><?php echo $this->t('about_text'); ?></p>
</div> <!-- #metadata -->
</div> <!-- #tabdiv -->
<?php $this->includeAtTemplateBase('includes/footer.php'); ?>
\ No newline at end of file
......@@ -14,6 +14,9 @@ if ($config->getValue('admin.protectindexpage', false)) {
);
}
}
$loginurl = '/' . $config->getBaseURL() . 'auth/login-admin.php?RelayState=' . SimpleSAML_Utilities::selfURL();
$isadmin = $session->isValid('login-admin');
$warnings = array();
......@@ -36,21 +39,6 @@ if ($config->getValue('enable.shib13-sp') === true)
'text' => 'link_shib13example'
);
$links[] = array(
'href' => 'example-simple/hostnames.php?dummy=1',
'text' => 'link_diagnostics'
);
$links[] = array(
'href' => 'admin/phpinfo.php',
'text' => 'link_phpinfo'
);
$links[] = array(
'href' => 'admin/config.php',
'text' => 'link_configcheck',
);
if($config->getBoolean('idpdisco.enableremember', FALSE)) {
$links[] = array(
'href' => 'cleardiscochoices.php',
......@@ -58,7 +46,6 @@ if($config->getBoolean('idpdisco.enableremember', FALSE)) {
);
}
$publishURL = $config->getString('metashare.publishurl', NULL);
if ($publishURL !== NULL) {
$metadataSources = array(
......@@ -80,31 +67,54 @@ if ($publishURL !== NULL) {
}
$linksconf = array();
$linksconf[] = array(
'href' => 'example-simple/hostnames.php?dummy=1',
'text' => 'link_diagnostics'
);
$linksconf[] = array(
'href' => 'admin/phpinfo.php',
'text' => 'link_phpinfo'
);
$linksconf[] = array(
'href' => 'admin/config.php',
'text' => 'link_configcheck',
);
$linksmeta = array();
$linksmeta[] = array(
'href' => 'admin/metadata.php',
'text' => 'link_meta_overview');
if ($config->getValue('enable.saml20-sp') === true)
$linksmeta[] = array(
'href' => 'saml2/sp/metadata.php?output=xhtml',
'text' => 'link_meta_saml2sphosted');
if ($config->getValue('enable.saml20-idp') === true)
$linksmeta[] = array(
'href' => 'saml2/idp/metadata.php?output=xhtml',
'text' => 'link_meta_saml2idphosted');
if ($config->getValue('enable.shib13-sp') === true)
$linksmeta[] = array(
'href' => 'shib13/sp/metadata.php?output=xhtml',
'text' => 'link_meta_shib13sphosted');
if ($config->getValue('enable.shib13-idp') === true)
$linksmeta[] = array(
'href' => 'shib13/idp/metadata.php?output=xhtml',
'text' => 'link_meta_shib13idphosted');
// if ($config->getValue('enable.saml20-sp') === true)
// $linksmeta[] = array(
// 'href' => 'saml2/sp/metadata.php?output=xhtml',
// 'text' => 'link_meta_saml2sphosted');
//
// if ($config->getValue('enable.saml20-idp') === true)
// $linksmeta[] = array(
// 'href' => 'saml2/idp/metadata.php?output=xhtml',
// 'text' => 'link_meta_saml2idphosted');
//
// if ($config->getValue('enable.shib13-sp') === true)
// $linksmeta[] = array(
// 'href' => 'shib13/sp/metadata.php?output=xhtml',
// 'text' => 'link_meta_shib13sphosted');
//
// if ($config->getValue('enable.shib13-idp') === true)
// $linksmeta[] = array(
// 'href' => 'shib13/idp/metadata.php?output=xhtml',
// 'text' => 'link_meta_shib13idphosted');
$linksmeta[] = array(
......@@ -113,6 +123,46 @@ $linksmeta[] = array(
);
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
$metaentries = array('hosted' => array(), 'remote' => array() );
if ($config->getValue('enable.saml20-sp') === true) {
try {
$metaentries['hosted']['saml20-sp'] = $metadata->getMetaDataCurrent('saml20-sp-hosted');
$metaentries['hosted']['saml20-sp']['metadata-url'] = '/' . $config->getBaseURL() . 'saml2/sp/metadata.php?output=xhtml';
if ($isadmin)
$metaentries['remote']['saml20-idp-remote'] = $metadata->getList('saml20-idp-remote');
} catch(Exception $e) {}
}
if ($config->getValue('enable.saml20-idp') === true) {
try {
$metaentries['hosted']['saml20-idp'] = $metadata->getMetaDataCurrent('saml20-idp-hosted');
$metaentries['hosted']['saml20-idp']['metadata-url'] = '/' . $config->getBaseURL() . 'saml2/idp/metadata.php?output=xhtml';
if ($isadmin)
$metaentries['remote']['saml20-sp-remote'] = $metadata->getList('saml20-sp-remote');
} catch(Exception $e) {}
}
if ($config->getValue('enable.shib13-sp') === true) {
try {
$metaentries['hosted']['shib13-sp'] = $metadata->getMetaDataCurrent('shib13-sp-hosted');
$metaentries['hosted']['shib13-sp']['metadata-url'] = '/' . $config->getBaseURL() . 'shib13/sp/metadata.php?output=xhtml';
if ($isadmin)
$metaentries['remote']['shib13-idp-remote'] = $metadata->getList('shib13-idp-remote');
} catch(Exception $e) {}
}
if ($config->getValue('enable.shib13-idp') === true) {
try {
$metaentries['hosted']['shib13-idp'] = $metadata->getMetaDataCurrent('shib13-idp-hosted');
$metaentries['hosted']['shib13-idp']['metadata-url'] = '/' . $config->getBaseURL() . 'shib13/idp/metadata.php?output=xhtml';
if ($isadmin)
$metaentries['remote']['shib13-sp-remote'] = $metadata->getList('shib13-sp-remote');
} catch(Exception $e) {}
}
#echo '<pre>'; print_r($metaentries); exit;
$linksdoc = array();
......@@ -218,12 +268,17 @@ $funcmatrix[] = array(
);
$t = new SimpleSAML_XHTML_Template($config, 'frontpage.php', 'frontpage');
$t->data['isadmin'] = $isadmin;
$t->data['loginurl'] = $loginurl;
$t->data['header'] = 'simpleSAMLphp installation page';
$t->data['icon'] = 'compass_l.png';
$t->data['warnings'] = $warnings;
$t->data['links'] = $links;
$t->data['links_meta'] = $linksmeta;
$t->data['links_doc'] = $linksdoc;
$t->data['links_conf'] = $linksconf;
$t->data['metaentries'] = $metaentries;
$t->data['enablematrix'] = $enablematrix;
$t->data['funcmatrix'] = $funcmatrix;
$t->data['version'] = $config->getVersion();
......
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