diff --git a/modules/aggregator/hooks/hook_frontpage.php b/modules/aggregator/hooks/hook_frontpage.php index d8fa136cb1cf25a01d76c9db3b5e27fa4323e905..eaf8e5608a456d17bdca11905b31a120216e0143 100644 --- a/modules/aggregator/hooks/hook_frontpage.php +++ b/modules/aggregator/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function aggregator_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['federation'][] = array( 'href' => SimpleSAML_Module::getModuleURL('aggregator/'), 'text' => '{aggregator:dict:frontpage_link}', ); diff --git a/modules/consentAdmin/hooks/hook_frontpage.php b/modules/consentAdmin/hooks/hook_frontpage.php index 7bf7138f3a421d030f3f9269834222db64e078e8..a87fb1e07522ed4a8a2552a1314d4544e5c8cdf7 100644 --- a/modules/consentAdmin/hooks/hook_frontpage.php +++ b/modules/consentAdmin/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function consentAdmin_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['config'][] = array( 'href' => SimpleSAML_Module::getModuleURL('consentAdmin/consentAdmin.php'), 'text' => '{consentAdmin:consentadmin:consentadmin_header}', ); diff --git a/modules/consentSimpleAdmin/hooks/hook_frontpage.php b/modules/consentSimpleAdmin/hooks/hook_frontpage.php index 743ef22f087a07b296bf6b753097125b8da141bf..432fdcb36764a72417c5cd498ae2439bce013421 100644 --- a/modules/consentSimpleAdmin/hooks/hook_frontpage.php +++ b/modules/consentSimpleAdmin/hooks/hook_frontpage.php @@ -8,11 +8,11 @@ function consentSimpleAdmin_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['config'][] = array( 'href' => SimpleSAML_Module::getModuleURL('consentSimpleAdmin/consentAdmin.php'), 'text' => '{consentSimpleAdmin:consentsimpleadmin:header}', ); - $links['links'][] = array( + $links['config'][] = array( 'href' => SimpleSAML_Module::getModuleURL('consentSimpleAdmin/consentStats.php'), 'text' => '{consentSimpleAdmin:consentsimpleadmin:headerstats}', ); diff --git a/dictionaries/frontpage.php b/modules/core/dictionaries/frontpage.php similarity index 100% rename from dictionaries/frontpage.php rename to modules/core/dictionaries/frontpage.php diff --git a/modules/core/hooks/hook_frontpage.php b/modules/core/hooks/hook_frontpage.php new file mode 100644 index 0000000000000000000000000000000000000000..54ec267cc851f69d9e1b02fb42cd9b1ac569e503 --- /dev/null +++ b/modules/core/hooks/hook_frontpage.php @@ -0,0 +1,33 @@ +<?php +/** + * Hook to add the modinfo module to the frontpage. + * + * @param array &$links The links on the frontpage, split into sections. + */ +function core_hook_frontpage(&$links) { + assert('is_array($links)'); + assert('array_key_exists("links", $links)'); + + $links['links']['frontpage_welcome'] = array( + 'href' => SimpleSAML_Module::getModuleURL('core/frontpage_welcome.php'), + 'text' => '{core:frontpage:welcome}', + 'shorttext' => '{core:frontpage:welcome}', + ); + $links['links']['frontpage_config'] = array( + 'href' => SimpleSAML_Module::getModuleURL('core/frontpage_config.php'), + 'text' => '{core:frontpage:configuration}', + 'shorttext' => '{core:frontpage:configuration}', + ); + $links['links']['frontpage_auth'] = array( + 'href' => SimpleSAML_Module::getModuleURL('core/frontpage_auth.php'), + 'text' => '{core:frontpage:auth}', + 'shorttext' => '{core:frontpage:auth}', + ); + $links['links']['frontpage_federation'] = array( + 'href' => SimpleSAML_Module::getModuleURL('core/frontpage_federation.php'), + 'text' => '{core:frontpage:federation}', + 'shorttext' => '{core:frontpage:federation}', + ); + +} +?> \ No newline at end of file diff --git a/modules/core/templates/frontpage_auth.tpl.php b/modules/core/templates/frontpage_auth.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..8c9764fd306902e84b043867b22494284059b1b4 --- /dev/null +++ b/modules/core/templates/frontpage_auth.tpl.php @@ -0,0 +1,29 @@ +<?php + +$this->includeAtTemplateBase('includes/header.php'); + +?> + +<?php +if ($this->data['isadmin']) { + echo '<p style="float: right">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; +} else { + echo '<p style="float: right"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; +} +?> + + + +<!-- <h2><?php echo $this->t('{core:frontpage:useful_links_header}'); ?></h2> --> +<ul> +<?php + foreach ($this->data['links_auth'] AS $link) { + echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a></li>'; + } +?> +</ul> + + + + +<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file diff --git a/modules/core/templates/frontpage_config.tpl.php b/modules/core/templates/frontpage_config.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..33f702efbbc3e71c5449c48d4a7461015c91f679 --- /dev/null +++ b/modules/core/templates/frontpage_config.tpl.php @@ -0,0 +1,106 @@ +<?php + + + +$this->includeAtTemplateBase('includes/header.php'); + + + +?> + + +<!-- +<div id="tabdiv"> +<ul> + <li><a href="#welcome"><?php echo $this->t('{core:frontpage:welcome}'); ?></a></li> + <li><a href="#configuration"><?php echo $this->t('{core:frontpage:configuration}'); ?></a></li> + <li><a href="#metadata"><?php echo $this->t('{core:frontpage:metadata}'); ?></a></li> +</ul> --> +<?php +if ($this->data['isadmin']) { + echo '<p style="float: right">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; +} else { + echo '<p style="float: right"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; +} +?> + + + + +<div style="margin-top: 1em;"> + <code style="background: white; background: #f5f5f5; border: 1px dotted #bbb; padding: 1em; color: #555" ><?php + echo $this->data['directory'] . ' (' . $this->data['version'] . ')'; + ?></code> +</div> + + + +<div style="clear: both" class="enablebox mini"> + <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" />'; + ?> + + <tr class="<?php echo $this->data['enablematrix']['saml20-sp'] ? 'enabled' : 'disabled'; ?>"><td>SAML 2.0 SP</td> + <td><?php echo $this->data['enablematrix']['saml20-sp'] ? $icon_enabled : $icon_disabled; ?></td></tr> + + <tr class="<?php echo $this->data['enablematrix']['saml20-idp'] ? 'enabled' : 'disabled'; ?>"><td>SAML 2.0 IdP</td> + <td><?php echo $this->data['enablematrix']['saml20-idp'] ? $icon_enabled : $icon_disabled; ?></td></tr> + + <tr class="<?php echo $this->data['enablematrix']['shib13-sp'] ? 'enabled' : 'disabled'; ?>"><td>Shib 1.3 SP</td> + <td><?php echo $this->data['enablematrix']['shib13-sp'] ? $icon_enabled : $icon_disabled; ?></td></tr> + + <tr class="<?php echo $this->data['enablematrix']['shib13-idp'] ? 'enabled' : 'disabled'; ?>"><td>Shib 1.3 IdP</td> + <td><?php echo $this->data['enablematrix']['shib13-idp'] ? $icon_enabled : $icon_disabled; ?></td></tr> + + </table> +</div> + + + +<h2><?php echo $this->t('{core:frontpage:configuration}'); ?></h2> +<ul> +<?php + foreach ($this->data['links_config'] 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'])) { + + echo '<h2>' . $this->t('{core:frontpage:warnings}') . '</h2>'; + + foreach($this->data['warnings'] AS $warning) { + echo '<div class="caution">' . $this->t($warning) . '</div>'; + } + } +?> +<?php +if ($this->data['isadmin']) { + + echo '<h2>'. $this->t('{core:frontpage: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('{core:frontpage:' . $func['required']. '}') . '</td><td>' . $func['descr'] . '</td></tr>'; + } + echo('</table></div>'); +} + +?> + + + + +<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file diff --git a/modules/core/templates/frontpage_federation.tpl.php b/modules/core/templates/frontpage_federation.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..ba809c07fc418067ec4d3418b1c331c8fee1854b --- /dev/null +++ b/modules/core/templates/frontpage_federation.tpl.php @@ -0,0 +1,132 @@ +<?php + + + +$this->includeAtTemplateBase('includes/header.php'); + + + +?> + + +<!-- +<div id="tabdiv"> +<ul> + <li><a href="#welcome"><?php echo $this->t('{core:frontpage:welcome}'); ?></a></li> + <li><a href="#configuration"><?php echo $this->t('{core:frontpage:configuration}'); ?></a></li> + <li><a href="#metadata"><?php echo $this->t('{core:frontpage:metadata}'); ?></a></li> +</ul> --> +<?php +if ($this->data['isadmin']) { + echo '<p style="float: right">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; +} else { + echo '<p style="float: right"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; +} +?> + + + + + + + + + +<?php + + +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}'; + } +} + +$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 '<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('{core:frontpage:show_metadata}') . '</a> ]'; + + echo '</dd>'; +} +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 '<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']; + } + + if (array_key_exists('expire', $entry)) { + if ($entry['expire'] < $now) { + echo('<span style="color: #500; font-weight: bold"> (expired ' . number_format(($now - $entry['expire'])/3600, 1) . ' hours ago)</span>'); + } else { + echo(' (expires in ' . number_format(($entry['expire'] - $now)/3600, 1) . ' hours)'); + } + } + echo '</li>'; + } + echo '</ul>'; + echo '</fieldset>'; +} + + + + +?> + + + + + +<h2><?php echo $this->t('{core:frontpage:tools}'); ?></h2> +<ul> +<?php + foreach ($this->data['links_federation'] AS $link) { + echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a></li>'; + } +?> +</ul> + + + + + + + + + + + + + + + + + + +<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file diff --git a/modules/core/templates/frontpage_welcome.tpl.php b/modules/core/templates/frontpage_welcome.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..4d36927ad44c8d9b78c3ddd917dfa0387c8c63ea --- /dev/null +++ b/modules/core/templates/frontpage_welcome.tpl.php @@ -0,0 +1,35 @@ +<?php + +$this->includeAtTemplateBase('includes/header.php'); + +?> + + +<?php +if ($this->data['isadmin']) { + echo '<p style="float: right">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; +} else { + echo '<p style="float: right"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; +} +?> + +<p><?php echo $this->t('{core:frontpage:intro}'); ?></p> + + +<ul> +<?php + foreach ($this->data['links_welcome'] AS $link) { + echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a></li>'; + } +?> +</ul> + + + + <h2><?php echo $this->t('{core:frontpage:about_header}'); ?></h2> + <p><?php echo $this->t('{core:frontpage:about_text}'); ?></p> + + + + +<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file diff --git a/www/example-simple/authsource-example.php b/modules/core/www/authenticate.php similarity index 87% rename from www/example-simple/authsource-example.php rename to modules/core/www/authenticate.php index 631542d5404b7de3c97489f317cac08b967ea6c9..75d48136b70df409efe47febc4e06a9c3c282d36 100644 --- a/www/example-simple/authsource-example.php +++ b/modules/core/www/authenticate.php @@ -1,10 +1,6 @@ <?php -/** - * The _include script registers a autoloader for the simpleSAMLphp libraries. It also - * initializes the simpleSAMLphp config class with the correct path. - */ -require_once('../_include.php'); + $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getInstance(); @@ -51,6 +47,3 @@ $t->data['logouturl'] = SimpleSAML_Utilities::selfURLNoQuery() . '?logout'; $t->data['icon'] = 'bino.png'; $t->show(); - - -?> \ No newline at end of file diff --git a/modules/core/www/frontpage_auth.php b/modules/core/www/frontpage_auth.php new file mode 100644 index 0000000000000000000000000000000000000000..0620fc21fd2609c1728c396804442ad3145a93d3 --- /dev/null +++ b/modules/core/www/frontpage_auth.php @@ -0,0 +1,72 @@ +<?php + + +/* Load simpleSAMLphp, configuration */ +$config = SimpleSAML_Configuration::getInstance(); +$session = SimpleSAML_Session::getInstance(); + +/* Check if valid local session exists.. */ +if ($config->getBoolean('admin.protectindexpage', false)) { + SimpleSAML_Utilities::requireAdmin(); +} +$loginurl = SimpleSAML_Utilities::getAdminLoginURL(); +$isadmin = SimpleSAML_Utilities::isAdmin(); + + + + + +$links = array(); +$links_welcome = array(); +$links_config = array(); +$links_auth = array(); +$links_federation = array(); + + +$links_auth[] = array( + 'href' => 'authenticate.php', + 'text' => '{core:frontpage:authtest}', +); + + +if ($config->getValue('enable.saml20-sp') === true) + $links_auth[] = array( + 'href' => 'example-simple/saml2-example.php', + 'text' => '{core:frontpage:link_saml2example}'); + +if ($config->getValue('enable.shib13-sp') === true) + $links_auth[] = array( + 'href' => 'example-simple/shib13-example.php', + 'text' => '{core:frontpage:link_shib13example}'); + + +$allLinks = array( + 'links' => &$links, + 'welcome' => &$links_welcome, + 'config' => &$links_config, + 'auth' => &$links_auth, + 'federation' => &$links_federation, +); +SimpleSAML_Module::callHooks('frontpage', $allLinks); + + + +$t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_auth.tpl.php'); +$t->data['pageid'] = 'frontpage_auth'; +$t->data['isadmin'] = $isadmin; +$t->data['loginurl'] = $loginurl; +$t->data['header'] = 'simpleSAMLphp installation page'; +$t->data['icon'] = 'compass_l.png'; + + +$t->data['links'] = $links; +$t->data['links_welcome'] = $links_welcome; +$t->data['links_config'] = $links_config; +$t->data['links_auth'] = $links_auth; +$t->data['links_federation'] = $links_federation; + + + +$t->show(); + + diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php new file mode 100644 index 0000000000000000000000000000000000000000..faaf2f8fbd01846ac8165637f21575916c63e500 --- /dev/null +++ b/modules/core/www/frontpage_config.php @@ -0,0 +1,158 @@ +<?php + + + +/* Load simpleSAMLphp, configuration */ +$config = SimpleSAML_Configuration::getInstance(); +$session = SimpleSAML_Session::getInstance(); + +/* Check if valid local session exists.. */ +if ($config->getBoolean('admin.protectindexpage', false)) { + SimpleSAML_Utilities::requireAdmin(); +} +$loginurl = SimpleSAML_Utilities::getAdminLoginURL(); +$isadmin = SimpleSAML_Utilities::isAdmin(); + + +$warnings = array(); + +if (SimpleSAML_Utilities::getSelfProtocol() != 'https') { + $warnings[] = '{core:frontpage:warnings_https}'; +} + + + + + + +$links = array(); +$links_welcome = array(); +$links_config = array(); +$links_auth = array(); +$links_federation = array(); + + + +$links_config[] = array( + 'href' => 'example-simple/hostnames.php?dummy=1', + 'text' => '{core:frontpage:link_diagnostics}' +); + +$links_config[] = array( + 'href' => 'admin/phpinfo.php', + 'text' => '{core:frontpage:link_phpinfo}' +); + +$links_config[] = array( + 'href' => 'admin/config.php', + 'text' => '{core:frontpage:link_configcheck}', +); + + + + + +$allLinks = array( + 'links' => &$links, + 'welcome' => &$links_welcome, + 'config' => &$links_config, + 'auth' => &$links_auth, + 'federation' => &$links_federation, +); +SimpleSAML_Module::callHooks('frontpage', $allLinks); + + + + + + + +$enablematrix = array( + 'saml20-sp' => $config->getBoolean('enable.saml20-sp', TRUE), + 'saml20-idp' => $config->getBoolean('enable.saml20-idp', false), + 'shib13-sp' => $config->getBoolean('enable.shib13-sp', false), + 'shib13-idp' => $config->getBoolean('enable.shib13-idp', false), +); + + +$functionchecks = array( + 'hash' => array('required', 'Hashing function'), + 'gzinflate' => array('required', 'ZLib'), + 'openssl_sign' => array('required', 'OpenSSL'), + 'simplexml_import_dom' => array('required', 'SimpleXML'), + 'dom_import_simplexml' => array('required', 'XML DOM'), + 'preg_match' => array('required', 'RegEx support'), + 'ldap_bind' => array('required_ldap', 'LDAP Extension'), + 'radius_auth_open' => array('required_radius', 'Radius Extension'), + 'mcrypt_module_open'=> array('optional', 'MCrypt'), + 'mysql_connect' => array('optional', 'MySQL support'), +); +$funcmatrix = array(); +$funcmatrix[] = array( + 'required' => 'required', + 'descr' => 'PHP Version >= 5.1.2. You run: ' . phpversion(), + 'enabled' => version_compare(phpversion(), '5.1.2', '>=')); +$funcmatrix[] = array( + 'required' => 'reccomended', + 'descr' => 'PHP Version >= 5.2 (Required for Shibboleth 1.3 SP)', + 'enabled' => version_compare(phpversion(), '5.2', '>=')); +foreach ($functionchecks AS $func => $descr) { + $funcmatrix[] = array('descr' => $descr[1], 'required' => $descr[0], 'enabled' => function_exists($func)); +} + + +/* Some basic configuration checks */ + +if($config->getString('technicalcontact_email', 'na@example.org') === 'na@example.org') { + $mail_ok = FALSE; +} else { + $mail_ok = TRUE; +} +$funcmatrix[] = array( + 'required' => 'reccomended', + 'descr' => 'technicalcontact_email option set', + 'enabled' => $mail_ok + ); +if($config->getString('auth.adminpassword', '123') === '123') { + $password_ok = FALSE; +} else { + $password_ok = TRUE; +} +$funcmatrix[] = array( + 'required' => 'required', + 'descr' => 'auth.adminpassword option set', + 'enabled' => $password_ok +); + +$funcmatrix[] = array( + 'required' => 'reccomended', + 'descr' => 'Magic Quotes should be turned off', + 'enabled' => (get_magic_quotes_runtime() === 0) +); + + +$t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_config.tpl.php'); +$t->data['pageid'] = 'frontpage_config'; +$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_welcome'] = $links_welcome; +$t->data['links_config'] = $links_config; +$t->data['links_auth'] = $links_auth; +$t->data['links_federation'] = $links_federation; + + + +$t->data['enablematrix'] = $enablematrix; +$t->data['funcmatrix'] = $funcmatrix; +$t->data['version'] = $config->getVersion(); +$t->data['directory'] = dirname(dirname(__FILE__)); + +$t->show(); + + diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php new file mode 100644 index 0000000000000000000000000000000000000000..fd4194aafc49600f8beb79844c06f4c3cdfeb241 --- /dev/null +++ b/modules/core/www/frontpage_federation.php @@ -0,0 +1,152 @@ +<?php + + + +/* Load simpleSAMLphp, configuration */ +$config = SimpleSAML_Configuration::getInstance(); +$session = SimpleSAML_Session::getInstance(); + +/* Check if valid local session exists.. */ +if ($config->getBoolean('admin.protectindexpage', false)) { + SimpleSAML_Utilities::requireAdmin(); +} +$loginurl = SimpleSAML_Utilities::getAdminLoginURL(); +$isadmin = SimpleSAML_Utilities::isAdmin(); + + + + + + + +$links = array(); +$links_welcome = array(); +$links_config = array(); +$links_auth = array(); +$links_federation = array(); + + + + +if($config->getBoolean('idpdisco.enableremember', FALSE)) { + $links_federation[] = array( + 'href' => 'cleardiscochoices.php', + 'text' => '{core:frontpage:link_cleardiscochoices}', + ); +} + +$publishURL = $config->getString('metashare.publishurl', NULL); +if ($publishURL !== NULL) { + $metadataSources = array( + 'saml20-idp' => 'saml2/idp/metadata.php', + 'saml20-sp' => 'saml2/sp/metadata.php', + 'shib13-idp' => 'shib13/idp/metadata.php', + 'shib13-sp' => 'shib13/sp/metadata.php', + ); + foreach($metadataSources as $name => $url) { + if(!$config->getBoolean('enable.' . $name, FALSE)) continue; + + $url = SimpleSAML_Utilities::resolveURL($url); + $linkTarget = SimpleSAML_Utilities::addURLparameter($publishURL, array('url' => $url)); + $links_federation[] = array( + 'href' => $linkTarget, + 'text' => '{core:frontpage:link_publish_' . $name . '}', + ); + } +} + + +$links_federation[] = array( + 'href' => 'admin/metadata.php', + 'text' => '{core:frontpage:link_meta_overview}' +); + +$links_federation[] = array( + 'href' => 'admin/metadata-converter.php', + 'text' => '{core:frontpage:link_xmlconvert}', +); + + + + +$allLinks = array( + 'links' => &$links, + 'welcome' => &$links_welcome, + 'config' => &$links_config, + 'auth' => &$links_auth, + 'federation' => &$links_federation, +); +SimpleSAML_Module::callHooks('frontpage', $allLinks); + + + + + + + + + + + + +$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); + +$metaentries = array('hosted' => array(), 'remote' => array() ); +if ($config->getBoolean('enable.saml20-sp', TRUE) === 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->getBoolean('enable.saml20-idp', FALSE) === 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->getBoolean('enable.shib13-sp', FALSE) === 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->getBoolean('enable.shib13-idp', FALSE) === 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) {} +} + + + + + +$t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_federation.tpl.php'); +$t->data['pageid'] = 'frontpage_federation'; +$t->data['isadmin'] = $isadmin; +$t->data['loginurl'] = $loginurl; +$t->data['header'] = 'simpleSAMLphp installation page'; +$t->data['icon'] = 'compass_l.png'; + + +$t->data['links'] = $links; +$t->data['links_welcome'] = $links_welcome; +$t->data['links_config'] = $links_config; +$t->data['links_auth'] = $links_auth; +$t->data['links_federation'] = $links_federation; + + + +$t->data['metaentries'] = $metaentries; + + +$t->show(); + diff --git a/modules/core/www/frontpage_welcome.php b/modules/core/www/frontpage_welcome.php new file mode 100644 index 0000000000000000000000000000000000000000..169f22e4bb965a62b51733ab6e62755a8f400d00 --- /dev/null +++ b/modules/core/www/frontpage_welcome.php @@ -0,0 +1,68 @@ +<?php + + +/* Load simpleSAMLphp, configuration */ +$config = SimpleSAML_Configuration::getInstance(); +$session = SimpleSAML_Session::getInstance(); + +/* Check if valid local session exists.. */ +if ($config->getBoolean('admin.protectindexpage', false)) { + SimpleSAML_Utilities::requireAdmin(); +} +$loginurl = SimpleSAML_Utilities::getAdminLoginURL(); +$isadmin = SimpleSAML_Utilities::isAdmin(); + + + + + +$links = array(); +$links_welcome = array(); +$links_config = array(); +$links_auth = array(); +$links_federation = array(); + + + +$allLinks = array( + 'links' => &$links, + 'welcome' => &$links_welcome, + 'config' => &$links_config, + 'auth' => &$links_auth, + 'federation' => &$links_federation, +); + +$links_welcome[] = array( + 'href' => 'https://rnd.feide.no/view/simplesamlphpdocs', + 'text' => '{core:frontpage:doc_header}', +); + +SimpleSAML_Module::callHooks('frontpage', $allLinks); + + + + + + + + + +$t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_welcome.tpl.php'); +$t->data['pageid'] = 'frontpage_welcome'; +$t->data['isadmin'] = $isadmin; +$t->data['loginurl'] = $loginurl; +$t->data['header'] = 'simpleSAMLphp installation page'; +$t->data['icon'] = 'compass_l.png'; + +$t->data['links'] = $links; +$t->data['links_welcome'] = $links_welcome; +$t->data['links_config'] = $links_config; +$t->data['links_auth'] = $links_auth; +$t->data['links_federation'] = $links_federation; + + + + +$t->show(); + + diff --git a/modules/cron/hooks/hook_frontpage.php b/modules/cron/hooks/hook_frontpage.php index 869019f70ceef180d78e5823b76c587b2500e80d..76738b81869240d5d7d23bbf92758895010418c7 100644 --- a/modules/cron/hooks/hook_frontpage.php +++ b/modules/cron/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function cron_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['config'][] = array( 'href' => SimpleSAML_Module::getModuleURL('cron/croninfo.php'), 'text' => array('en' => 'Cron module information page'), ); diff --git a/modules/ldapstatus/hooks/hook_frontpage.php b/modules/ldapstatus/hooks/hook_frontpage.php index 2c27677d2a6f62e74a34f0683973fd341ffc7b59..81184fc8879181e2e761812d2dd6bf7d83ef6777 100644 --- a/modules/ldapstatus/hooks/hook_frontpage.php +++ b/modules/ldapstatus/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function ldapstatus_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['auth'][] = array( 'href' => SimpleSAML_Module::getModuleURL('ldapstatus/'), 'text' => array('en' => 'LDAP Status page', 'no' => 'LDAP statusoversikt'), ); diff --git a/modules/logpeek/hooks/hook_frontpage.php b/modules/logpeek/hooks/hook_frontpage.php index 96af12acf0a7cb7329c6fc73ac8803526ddf0439..c92e43bee7315ef2eb3e9eb67e3799cb279974a0 100644 --- a/modules/logpeek/hooks/hook_frontpage.php +++ b/modules/logpeek/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function logpeek_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['config'][] = array( 'href' => SimpleSAML_Module::getModuleURL('logpeek/'), 'text' => array('en' => 'SimpleSAMLphp logs access (Log peek)', 'no' => 'Vis simpleSAMLphp log'), ); diff --git a/modules/memcacheMonitor/hooks/hook_frontpage.php b/modules/memcacheMonitor/hooks/hook_frontpage.php index 16fb4aaaee0942687c1d7f42af248f6d87f0962e..048cc6d9187641a0503d8c541f260ff997bc4d1f 100644 --- a/modules/memcacheMonitor/hooks/hook_frontpage.php +++ b/modules/memcacheMonitor/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function memcacheMonitor_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['config'][] = array( 'href' => SimpleSAML_Module::getModuleURL('memcacheMonitor/memcachestat.php'), 'text' => array('en' => 'MemCache Statistics'), ); diff --git a/modules/metaedit/hooks/hook_frontpage.php b/modules/metaedit/hooks/hook_frontpage.php index 21ca8be7ce22347c87f099c8c6a647f63770875e..9c9a6646fe43adfa66d98cd14ed16ceb6d807cc3 100644 --- a/modules/metaedit/hooks/hook_frontpage.php +++ b/modules/metaedit/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function metaedit_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links']['metaedit'] = array( + $links['federation']['metaedit'] = array( 'href' => SimpleSAML_Module::getModuleURL('metaedit/index.php'), 'text' => array('en' => 'Metadata registry', 'no' => 'Metadata registrering'), 'shorttext' => array('en' => 'Metadata registry', 'no' => 'Metadata registrering'), diff --git a/modules/modinfo/hooks/hook_frontpage.php b/modules/modinfo/hooks/hook_frontpage.php index 2f8b5ccb25c54ae209de1e0527624ce893145e60..1895bcf82a80f5ba6b302fec18422d05b1053663 100644 --- a/modules/modinfo/hooks/hook_frontpage.php +++ b/modules/modinfo/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function modinfo_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['config'][] = array( 'href' => SimpleSAML_Module::getModuleURL('modinfo/'), 'text' => '{modinfo:dict:modlist_header}', ); diff --git a/modules/openid/hooks/hook_frontpage.php b/modules/openid/hooks/hook_frontpage.php index aec1e20c3a42e90b3d9f2a1fd079b2e4c37acb84..73303a9f8dc85eac126ec834a85b39609b5af469 100644 --- a/modules/openid/hooks/hook_frontpage.php +++ b/modules/openid/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function openid_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['auth'][] = array( 'href' => SimpleSAML_Module::getModuleURL('openid/openidtest.php'), 'text' => '{openid:dictopenid:openidtestpage}', ); diff --git a/modules/portal/config-templates/module_portal.php b/modules/portal/config-templates/module_portal.php index ebcba744fe4bfaef0de50d69f9a2d05c9f511b3f..ad77d62ccb7d79b6b1cce03e02e62fb97baf1566 100644 --- a/modules/portal/config-templates/module_portal.php +++ b/modules/portal/config-templates/module_portal.php @@ -8,6 +8,7 @@ $config = array ( 'pagesets' => array( + array('frontpage_welcome', 'frontpage_config', 'frontpage_auth', 'frontpage_federation'), array('santitycheck', 'statistics'), ), diff --git a/modules/portal/default-disable b/modules/portal/default-enable similarity index 100% rename from modules/portal/default-disable rename to modules/portal/default-enable diff --git a/modules/portal/hooks/hook_htmlinject.php b/modules/portal/hooks/hook_htmlinject.php index 1e34ff693664ee6a77ade4774d133370f1812516..7ea115ad0c4b4ae4e6d619c4367ee312bc702229 100644 --- a/modules/portal/hooks/hook_htmlinject.php +++ b/modules/portal/hooks/hook_htmlinject.php @@ -16,11 +16,18 @@ function portal_hook_htmlinject(&$hookinfo) { # echo('<pre>'); print_r($links); exit; - $portalConfig = SimpleSAML_Configuration::getConfig('module_portal.php'); + $portalConfig = SimpleSAML_Configuration::getOptionalConfig('module_portal.php'); - - - $portal = new sspmod_portal_Portal($links['links'], $portalConfig->getValue('pagesets') ); + $allLinks = array(); + foreach($links AS $ls) { + $allLinks = array_merge($allLinks, $ls); + } + + $portal = new sspmod_portal_Portal($allLinks, + $portalConfig->getValue('pagesets', array( + array('frontpage_welcome', 'frontpage_config', 'frontpage_auth', 'frontpage_federation'), + )) + ); if (!$portal->isPortalized($hookinfo['page'])) return; diff --git a/modules/portal/lib/Portal.php b/modules/portal/lib/Portal.php index cd2e8ffeced5294a8a5fce7615eb191d4302b29a..5177421e64b9a3083354ec7b8333ddd31d9baad0 100644 --- a/modules/portal/lib/Portal.php +++ b/modules/portal/lib/Portal.php @@ -21,6 +21,7 @@ class sspmod_portal_Portal { } function isPortalized($thispage) { + foreach($this->config AS $set) { if (in_array($thispage, $set)) { return TRUE; diff --git a/modules/saml2debug/hooks/hook_frontpage.php b/modules/saml2debug/hooks/hook_frontpage.php index 581fd773f4f32c6fd439157be530399e330c4bbf..a59ae67e722685e024ac32d223f1810468f8fc89 100644 --- a/modules/saml2debug/hooks/hook_frontpage.php +++ b/modules/saml2debug/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function saml2debug_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links'][] = array( + $links['federation'][] = array( 'href' => SimpleSAML_Module::getModuleURL('saml2debug/debug.php'), 'text' => array('en' => 'SAML 2.0 Debugger'), ); diff --git a/modules/sanitycheck/hooks/hook_frontpage.php b/modules/sanitycheck/hooks/hook_frontpage.php index 821761910fa698f208298353eed571f65de8a46f..57b3cfce005750ccc927caf44e58144759be600d 100644 --- a/modules/sanitycheck/hooks/hook_frontpage.php +++ b/modules/sanitycheck/hooks/hook_frontpage.php @@ -8,7 +8,7 @@ function sanitycheck_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links']['santitycheck'] = array( + $links['config']['santitycheck'] = array( 'href' => SimpleSAML_Module::getModuleURL('sanitycheck/index.php'), 'text' => array('en' => 'Sanity check of your simpleSAMLphp setup'), 'shorttext' => array('en' => 'SanityCheck'), diff --git a/modules/sanitycheck/www/index.php b/modules/sanitycheck/www/index.php index 3f94e004002e144d7a77db985ecb8dadb11a15c3..99a236f8df0b63531f504cf45d535b8d4e34f00b 100644 --- a/modules/sanitycheck/www/index.php +++ b/modules/sanitycheck/www/index.php @@ -23,16 +23,9 @@ if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'text') { exit; } -$htmlContentPre = array(); $htmlContentPost = array(); $htmlContentHead = array(); $jquery = array(); -$hookinfo = array('pre' => &$htmlContentPre, 'post' => &$htmlContentPost, 'head' => &$htmlContentHead, 'jquery' => &$jquery, 'page' => 'santitycheck'); -SimpleSAML_Module::callHooks('htmlinject', $hookinfo); - - $t = new SimpleSAML_XHTML_Template($config, 'sanitycheck:check-tpl.php'); +$t->data['pageid'] = 'statistics'; $t->data['errors'] = $errors; $t->data['info'] = $info; -$t->data['htmlContentPre'] = $htmlContentPre; -$t->data['htmlContentPost'] = $htmlContentPost; -$t->data['htmlContentHead'] = $htmlContentHead; $t->data['jquery'] = $jquery; $t->show(); diff --git a/modules/statistics/hooks/hook_frontpage.php b/modules/statistics/hooks/hook_frontpage.php index ac58b8237aab6dd9cdcab11328c710afbd45c102..b6a2f73ebd33c98051c008a2f92e175b35479fe4 100644 --- a/modules/statistics/hooks/hook_frontpage.php +++ b/modules/statistics/hooks/hook_frontpage.php @@ -8,12 +8,12 @@ function statistics_hook_frontpage(&$links) { assert('is_array($links)'); assert('array_key_exists("links", $links)'); - $links['links']['statistics'] = array( + $links['config']['statistics'] = array( 'href' => SimpleSAML_Module::getModuleURL('statistics/showstats.php'), 'text' => array('en' => 'Show statistics', 'no' => 'Vis statistikk'), 'shorttext' => array('en' => 'Statistics', 'no' => 'Statistikk'), ); - $links['links']['statisticsmeta'] = array( + $links['config']['statisticsmeta'] = array( 'href' => SimpleSAML_Module::getModuleURL('statistics/statmeta.php'), 'text' => array('en' => 'Show statistics metadata', 'no' => 'Vis statistikk metadata'), 'shorttext' => array('en' => 'Statistics metadata', 'no' => 'Statistikk metadata'), diff --git a/modules/statistics/www/showstats.php b/modules/statistics/www/showstats.php index db434ee8df45c31589c9ae422c0dec52f5e57444..ac8287a534b836e1cda16509eec8407e8fcf9c5c 100644 --- a/modules/statistics/www/showstats.php +++ b/modules/statistics/www/showstats.php @@ -154,12 +154,23 @@ $dimx = $statconfig->getValue('dimension.x', 800); $dimy = $statconfig->getValue('dimension.y', 350); $grapher = new sspmod_statistics_Graph_GoogleCharts($dimx, $dimy); -$htmlContentPre = array(); $htmlContentPost = array(); $htmlContentHead = array(); $jquery = array(); -$hookinfo = array('pre' => &$htmlContentPre, 'post' => &$htmlContentPost, 'head' => &$htmlContentHead, 'jquery' => &$jquery, 'page' => 'statistics'); -SimpleSAML_Module::callHooks('htmlinject', $hookinfo); +if (array_key_exists('output', $_REQUEST) && $_REQUEST['output'] === 'csv') { + + header('Content-type: text/csv'); + header('Content-Disposition: attachment; filename="simplesamlphp-data.csv"'); + $data = $dataset->getDebugData(); + foreach($data AS $de) { + if (isset($de[1])) { + echo('"' . $de[0] . '",' . $de[1] . "\n"); + } + } + exit; +} + $t = new SimpleSAML_XHTML_Template($config, 'statistics:statistics-tpl.php'); +$t->data['pageid'] = 'statistics'; $t->data['header'] = 'stat'; $t->data['imgurl'] = $grapher->show($axis['axis'], $axis['axispos'], $datasets, $maxes); if (isset($piedata)) { @@ -170,10 +181,7 @@ $t->data['available.times'] = $statrule->availableFileSlots($timeres); $t->data['available.timeres'] = $statrule->availableTimeRes(); $t->data['available.times.prev'] = $timeNavigation['prev']; $t->data['available.times.next'] = $timeNavigation['next']; -$t->data['htmlContentPre'] = $htmlContentPre; -$t->data['htmlContentPost'] = $htmlContentPost; -$t->data['htmlContentHead'] = $htmlContentHead; -$t->data['jquery'] = $jquery; + $t->data['selected.rule']= $rule; $t->data['selected.rule2']= $preferRule2; $t->data['selected.time'] = $fileslot; @@ -186,8 +194,6 @@ $t->data['summaryDataset'] = $dataset->getSummary(); $t->data['topdelimiters'] = $dataset->getTopDelimiters(); $t->data['availdelimiters'] = $dataset->availDelimiters(); - - $t->data['delimiterPresentation'] = $dataset->getDelimiterPresentation(); $t->show(); diff --git a/templates/frontpage.php b/templates/frontpage.php index 054ebd674959d26ee20636d18d197d08585c4676..37cfb9f7100c90b6ac3974f840e93f25c66569f7 100644 --- a/templates/frontpage.php +++ b/templates/frontpage.php @@ -1,15 +1,10 @@ <?php -# $this->data['icon'] = 'compass_l.png'; - -// $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['jquery'] = array('version' => '1.6', 'core' => TRUE, 'ui' => TRUE, 'css' => TRUE); $this->data['head'] = '<script type="text/javascript"> - $(document).ready(function() { $("#tabdiv").tabs(); }); diff --git a/templates/includes/footer.php b/templates/includes/footer.php index 329bc68f70f585c1e2bfd59e5421878cd4b39c3e..7f6fe648ce5598437efe376e1c08fa217bf38afe 100644 --- a/templates/includes/footer.php +++ b/templates/includes/footer.php @@ -2,8 +2,8 @@ <?php -if(array_key_exists('htmlContentPost', $this->data)) { - foreach(array_reverse($this->data['htmlContentPost']) AS $c) { +if(isset($htmlContentPost)) { + foreach($htmlContentPost AS $c) { echo $c; } } diff --git a/templates/includes/header.php b/templates/includes/header.php index c9c4351c07df2f73b9ce27bbec6ea425cfd914c2..c537af760cfb88dc1e60440593af6970f612e627 100644 --- a/templates/includes/header.php +++ b/templates/includes/header.php @@ -1,4 +1,27 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<?php + + + +/** + * Support the htmlinject hook, which allows modules to change header, pre and post body on all pages. + */ +$htmlContentPre = array(); $htmlContentPost = array(); $htmlContentHead = array(); + +$jquery = array(); +if (array_key_exists('jquery', $this->data)) $jquery = $this->data['jquery']; + + +if (array_key_exists('pageid', $this->data)) { + $hookinfo = array('pre' => &$htmlContentPre, 'post' => &$htmlContentPost, 'head' => &$htmlContentHead, 'jquery' => &$jquery, 'page' => $this->data['pageid']); + SimpleSAML_Module::callHooks('htmlinject', $hookinfo); +} +// - o - o - o - o - o - o - o - o - o - o - o - o - + + + + +?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> @@ -16,35 +39,37 @@ if(array_key_exists('header', $this->data)) { <?php -if(array_key_exists('jquery', $this->data)) { - +if(!empty($jquery)) { $version = '1.5'; - if (array_key_exists('version', $this->data['jquery'])) - $version = $this->data['jquery']['version']; + if (array_key_exists('version', $jquery)) + $version = $jquery['version']; if ($version == '1.5') { - if (isset($this->data['jquery']['core']) && $this->data['jquery']['core']) + if (isset($jquery['core']) && $jquery['core']) echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery.js"></script>' . "\n"); - if (isset($this->data['jquery']['ui']) && $this->data['jquery']['ui']) + if (isset($jquery['ui']) && $jquery['ui']) echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-ui.js"></script>' . "\n"); - if (isset($this->data['jquery']['css']) && $this->data['jquery']['css']) - echo('<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . 'resources/uitheme/jquery-ui-themeroller.css" />' . "\n"); + if (isset($jquery['css']) && $jquery['css']) + echo('<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . + 'resources/uitheme/jquery-ui-themeroller.css" />' . "\n"); } else if ($version == '1.6') { - if (isset($this->data['jquery']['core']) && $this->data['jquery']['core']) + if (isset($jquery['core']) && $jquery['core']) echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-16.js"></script>' . "\n"); - if (isset($this->data['jquery']['ui']) && $this->data['jquery']['ui']) + if (isset($jquery['ui']) && $jquery['ui']) echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-ui-16.js"></script>' . "\n"); - if (isset($this->data['jquery']['css']) && $this->data['jquery']['css']) - echo('<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . 'resources/uitheme16/ui.all.css" />' . "\n"); + if (isset($jquery['css']) && $jquery['css']) + echo('<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . + 'resources/uitheme16/ui.all.css" />' . "\n"); } - } + + ?> @@ -140,8 +165,9 @@ if($onLoad !== '') { <?php -if(array_key_exists('htmlContentPre', $this->data)) { - foreach($this->data['htmlContentPre'] AS $c) { + +if(isset($htmlContentPre)) { + foreach($htmlContentPre AS $c) { echo $c; } } diff --git a/www/index.php b/www/index.php index 9d88920a64e995c4490cefc1a575f3da443b2f57..017a0d7375816850a3fea1c5ca390a2ed5bd1846 100644 --- a/www/index.php +++ b/www/index.php @@ -2,272 +2,5 @@ require_once('_include.php'); -/* Load simpleSAMLphp, configuration */ -$config = SimpleSAML_Configuration::getInstance(); -$session = SimpleSAML_Session::getInstance(); -/* Check if valid local session exists.. */ -if ($config->getBoolean('admin.protectindexpage', false)) { - SimpleSAML_Utilities::requireAdmin(); -} -$loginurl = SimpleSAML_Utilities::getAdminLoginURL(); -$isadmin = SimpleSAML_Utilities::isAdmin(); - - -$warnings = array(); - -if (SimpleSAML_Utilities::getSelfProtocol() != 'https') { - $warnings[] = 'warnings_https'; -} - - -$links = array(); - - -if ($config->getBoolean('enable.saml20-sp', TRUE) === true) - $links[] = array( - 'href' => 'example-simple/saml2-example.php', - 'text' => 'link_saml2example'); - -if ($config->getBoolean('enable.shib13-sp', FALSE) === true) - $links[] = array( - 'href' => 'example-simple/shib13-example.php', - 'text' => 'link_shib13example' - ); - -if($config->getBoolean('idpdisco.enableremember', FALSE)) { - $links[] = array( - 'href' => 'cleardiscochoices.php', - 'text' => 'link_cleardiscochoices', - ); -} - -$publishURL = $config->getString('metashare.publishurl', NULL); -if ($publishURL !== NULL) { - $metadataSources = array( - 'saml20-idp' => 'saml2/idp/metadata.php', - 'saml20-sp' => 'saml2/sp/metadata.php', - 'shib13-idp' => 'shib13/idp/metadata.php', - 'shib13-sp' => 'shib13/sp/metadata.php', - ); - foreach($metadataSources as $name => $url) { - if(!$config->getBoolean('enable.' . $name, FALSE)) continue; - - $url = SimpleSAML_Utilities::resolveURL($url); - $linkTarget = SimpleSAML_Utilities::addURLparameter($publishURL, array('url' => $url)); - $links[] = array( - 'href' => $linkTarget, - 'text' => 'link_publish_' . $name, - ); - } -} - - - -$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'); - -$linksmeta[] = array( - 'href' => 'admin/metadata-converter.php', - 'text' => 'link_xmlconvert', - ); - - -$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); - -$metaentries = array('hosted' => array(), 'remote' => array() ); -if ($config->getBoolean('enable.saml20-sp', TRUE) === 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->getBoolean('enable.saml20-idp', FALSE) === 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->getBoolean('enable.shib13-sp', FALSE) === 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->getBoolean('enable.shib13-idp', FALSE) === 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(); - -$linksdoc[] = array( - 'href' => 'http://rnd.feide.no/content/installing-simplesamlphp', - 'text' => 'link_doc_install'); - -if ($config->getBoolean('enable.saml20-sp', TRUE) || $config->getBoolean('enable.shib13-sp', false)) - $linksdoc[] = array( - 'href' => 'http://rnd.feide.no/content/using-simplesamlphp-service-provider', - 'text' => 'link_doc_sp'); - -if ($config->getBoolean('enable.saml20-idp', false ) || $config->getBoolean('enable.shib13-idp', false)) - $linksdoc[] = array( - 'href' => 'http://rnd.feide.no/content/using-simplesamlphp-identity-provider', - 'text' => 'link_doc_idp'); - -if ($config->getBoolean('enable.shib13-idp', false)) - $linksdoc[] = array( - 'href' => 'http://rnd.feide.no/content/configure-shibboleth-13-sp-work-simplesamlphp-idp', - 'text' => 'link_doc_shibsp'); - -if ($config->getBoolean('enable.saml20-idp', false )) - $linksdoc[] = array( - 'href' => 'http://rnd.feide.no/content/simplesamlphp-idp-google-apps-education', - 'text' => 'link_doc_googleapps'); - -$linksdoc[] = array( - 'href' => 'http://rnd.feide.no/content/simplesamlphp-advanced-features', - 'text' => 'link_doc_advanced', -); - - - -$linksdoc[] = array( - 'href' => 'http://rnd.feide.no/content/simplesamlphp-maintenance-and-configuration', - 'text' => 'link_doc_maintenance'); - - -$allLinks = array( - 'links' => &$links, - 'metadata' => &$linksmeta, - 'doc' => &$linksdoc, - ); - -SimpleSAML_Module::callHooks('frontpage', $allLinks); - -$enablematrix = array( - 'saml20-sp' => $config->getBoolean('enable.saml20-sp', TRUE), - 'saml20-idp' => $config->getBoolean('enable.saml20-idp', false), - 'shib13-sp' => $config->getBoolean('enable.shib13-sp', false), - 'shib13-idp' => $config->getBoolean('enable.shib13-idp', false), -); - - -$functionchecks = array( - 'hash' => array('required', 'Hashing function'), - 'gzinflate' => array('required', 'ZLib'), - 'openssl_sign' => array('required', 'OpenSSL'), - 'simplexml_import_dom' => array('required', 'SimpleXML'), - 'dom_import_simplexml' => array('required', 'XML DOM'), - 'preg_match' => array('required', 'RegEx support'), - 'ldap_bind' => array('required_ldap', 'LDAP Extension'), - 'radius_auth_open' => array('required_radius', 'Radius Extension'), - 'mcrypt_module_open'=> array('optional', 'MCrypt'), - 'mysql_connect' => array('optional', 'MySQL support'), -); -$funcmatrix = array(); -$funcmatrix[] = array( - 'required' => 'required', - 'descr' => 'PHP Version >= 5.1.2. You run: ' . phpversion(), - 'enabled' => version_compare(phpversion(), '5.1.2', '>=')); -$funcmatrix[] = array( - 'required' => 'reccomended', - 'descr' => 'PHP Version >= 5.2 (Required for Shibboleth 1.3 SP)', - 'enabled' => version_compare(phpversion(), '5.2', '>=')); -foreach ($functionchecks AS $func => $descr) { - $funcmatrix[] = array('descr' => $descr[1], 'required' => $descr[0], 'enabled' => function_exists($func)); -} - - -/* Some basic configuration checks */ - -if($config->getString('technicalcontact_email', 'na@example.org') === 'na@example.org') { - $mail_ok = FALSE; -} else { - $mail_ok = TRUE; -} -$funcmatrix[] = array( - 'required' => 'reccomended', - 'descr' => 'technicalcontact_email option set', - 'enabled' => $mail_ok - ); -if($config->getString('auth.adminpassword', '123') === '123') { - $password_ok = FALSE; -} else { - $password_ok = TRUE; -} -$funcmatrix[] = array( - 'required' => 'required', - 'descr' => 'auth.adminpassword option set', - 'enabled' => $password_ok -); - -$funcmatrix[] = array( - 'required' => 'required', - 'descr' => 'Magic Quotes should be turned off', - 'enabled' => (get_magic_quotes_runtime() === 0) -); - - -$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(); -$t->data['directory'] = dirname(dirname(__FILE__)); - -$t->show(); - - - -?> \ No newline at end of file +SimpleSAML_Utilities::redirect(SimpleSAML_Module::getModuleURL('core/frontpage_welcome.php'));