Skip to content
Snippets Groups Projects
Unverified Commit 0ae0cd11 authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

Fix indentation

parent 0fd08bc9
No related branches found
No related tags found
No related merge requests found
<?php <?php
// Load SimpleSAMLphp, configuration // Load SimpleSAMLphp, configuration
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
$session = SimpleSAML_Session::getSessionFromRequest(); $session = SimpleSAML_Session::getSessionFromRequest();
...@@ -17,48 +15,42 @@ $isadmin = SimpleSAML\Utils\Auth::isAdmin(); ...@@ -17,48 +15,42 @@ $isadmin = SimpleSAML\Utils\Auth::isAdmin();
$warnings = array(); $warnings = array();
if (!\SimpleSAML\Utils\HTTP::isHTTPS()) { if (!\SimpleSAML\Utils\HTTP::isHTTPS()) {
$warnings[] = '{core:frontpage:warnings_https}'; $warnings[] = '{core:frontpage:warnings_https}';
} }
if ($config->getValue('secretsalt') === 'defaultsecretsalt') { if ($config->getValue('secretsalt') === 'defaultsecretsalt') {
$warnings[] = '{core:frontpage:warnings_secretsalt}'; $warnings[] = '{core:frontpage:warnings_secretsalt}';
} }
if (extension_loaded('suhosin')) { if (extension_loaded('suhosin')) {
$suhosinLength = ini_get('suhosin.get.max_value_length'); $suhosinLength = ini_get('suhosin.get.max_value_length');
if (empty($suhosinLength) || (int)$suhosinLength < 2048) { if (empty($suhosinLength) || (int)$suhosinLength < 2048) {
$warnings[] = '{core:frontpage:warnings_suhosin_url_length}'; $warnings[] = '{core:frontpage:warnings_suhosin_url_length}';
} }
} }
$links = array(); $links = array();
$links_welcome = array(); $links_welcome = array();
$links_config = array(); $links_config = array();
$links_auth = array(); $links_auth = array();
$links_federation = array(); $links_federation = array();
$links_config[] = array( $links_config[] = array(
'href' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'admin/hostnames.php', 'href' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'admin/hostnames.php',
'text' => '{core:frontpage:link_diagnostics}' 'text' => '{core:frontpage:link_diagnostics}'
); );
$links_config[] = array( $links_config[] = array(
'href' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'admin/phpinfo.php', 'href' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'admin/phpinfo.php',
'text' => '{core:frontpage:link_phpinfo}' 'text' => '{core:frontpage:link_phpinfo}'
); );
$allLinks = array( $allLinks = array(
'links' => &$links, 'links' => &$links,
'welcome' => &$links_welcome, 'welcome' => &$links_welcome,
'config' => &$links_config, 'config' => &$links_config,
'auth' => &$links_auth, 'auth' => &$links_auth,
'federation' => &$links_federation, 'federation' => &$links_federation,
); );
SimpleSAML\Module::callHooks('frontpage', $allLinks); SimpleSAML\Module::callHooks('frontpage', $allLinks);
...@@ -66,68 +58,69 @@ SimpleSAML\Module::callHooks('frontpage', $allLinks); ...@@ -66,68 +58,69 @@ SimpleSAML\Module::callHooks('frontpage', $allLinks);
// don't need to fetch it on every access to this page. // don't need to fetch it on every access to this page.
$current = $config->getVersion(); $current = $config->getVersion();
if ($config->getBoolean('admin.checkforupdates', true) && $current !== 'master') { if ($config->getBoolean('admin.checkforupdates', true) && $current !== 'master') {
$latest = $session->getData("core:latest_simplesamlphp_version", "version"); $latest = $session->getData("core:latest_simplesamlphp_version", "version");
if (!$latest) { if (!$latest) {
$api_url = 'https://api.github.com/repos/simplesamlphp/simplesamlphp/releases'; $api_url = 'https://api.github.com/repos/simplesamlphp/simplesamlphp/releases';
$ch = curl_init($api_url.'/latest'); $ch = curl_init($api_url.'/latest');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'SimpleSAMLphp'); curl_setopt($ch, CURLOPT_USERAGENT, 'SimpleSAMLphp');
curl_setopt($ch, CURLOPT_TIMEOUT, 2); curl_setopt($ch, CURLOPT_TIMEOUT, 2);
curl_setopt($ch, CURLOPT_PROXY, $config->getString('proxy', null)); curl_setopt($ch, CURLOPT_PROXY, $config->getString('proxy', null));
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $config->getstring('proxy.auth', null)); curl_setopt($ch, CURLOPT_PROXYUSERPWD, $config->getstring('proxy.auth', null));
$response = curl_exec($ch); $response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) { if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
$latest = json_decode($response, true); $latest = json_decode($response, true);
$session->setData("core:latest_simplesamlphp_version", "version", $latest); $session->setData("core:latest_simplesamlphp_version", "version", $latest);
} }
curl_close($ch); curl_close($ch);
} }
if ($latest && version_compare($current, ltrim($latest['tag_name'], 'v'), 'lt')) { if ($latest && version_compare($current, ltrim($latest['tag_name'], 'v'), 'lt')) {
$outdated = true; $outdated = true;
$warnings[] = array( $warnings[] = array(
'{core:frontpage:warnings_outdated}', '{core:frontpage:warnings_outdated}',
array('%LATEST_URL%' => $latest['html_url']) array('%LATEST_URL%' => $latest['html_url'])
); );
} }
} }
$enablematrix = array( $enablematrix = array(
'saml20-idp' => $config->getBoolean('enable.saml20-idp', false), 'saml20-idp' => $config->getBoolean('enable.saml20-idp', false),
'shib13-idp' => $config->getBoolean('enable.shib13-idp', false), 'shib13-idp' => $config->getBoolean('enable.shib13-idp', false),
); );
$functionchecks = array( $functionchecks = array(
'time' => array('required', 'Date/Time Extension'), 'time' => array('required', 'Date/Time Extension'),
'hash' => array('required', 'Hashing function'), 'hash' => array('required', 'Hashing function'),
'gzinflate' => array('required', 'ZLib'), 'gzinflate' => array('required', 'ZLib'),
'openssl_sign' => array('required', 'OpenSSL'), 'openssl_sign' => array('required', 'OpenSSL'),
'dom_import_simplexml' => array('required', 'XML DOM'), 'dom_import_simplexml' => array('required', 'XML DOM'),
'preg_match' => array('required', 'RegEx support'), 'preg_match' => array('required', 'RegEx support'),
'json_decode' => array('required', 'JSON support'), 'json_decode' => array('required', 'JSON support'),
'class_implements' => array('required', 'Standard PHP Library (SPL)'), 'class_implements' => array('required', 'Standard PHP Library (SPL)'),
'mb_strlen' => array('required', 'Multibyte String Extension'), 'mb_strlen' => array('required', 'Multibyte String Extension'),
'curl_init' => array('optional', 'cURL (required if automatic version checks are used, also by some modules.'), 'curl_init' => array('optional', 'cURL (required if automatic version checks are used, also by some modules.'),
'session_start' => array('optional', 'Session Extension (required if PHP sessions are used)'), 'session_start' => array('optional', 'Session Extension (required if PHP sessions are used)'),
'pdo_drivers' => array('optional', 'PDO Extension (required if a database backend is used)'), 'pdo_drivers' => array('optional', 'PDO Extension (required if a database backend is used)'),
); );
if (SimpleSAML\Module::isModuleEnabled('ldap')) { if (SimpleSAML\Module::isModuleEnabled('ldap')) {
$functionchecks['ldap_bind'] = array('optional', 'LDAP Extension (required if an LDAP backend is used)'); $functionchecks['ldap_bind'] = array('optional', 'LDAP Extension (required if an LDAP backend is used)');
} }
if (SimpleSAML\Module::isModuleEnabled('radius')) { if (SimpleSAML\Module::isModuleEnabled('radius')) {
$functionchecks['radius_auth_open'] = array('optional', 'Radius Extension (required if a Radius backend is used)'); $functionchecks['radius_auth_open'] = array('optional', 'Radius Extension (required if a Radius backend is used)');
} }
$funcmatrix = array(); $funcmatrix = array();
$funcmatrix[] = array( $funcmatrix[] = array(
'required' => 'required', 'required' => 'required',
'descr' => 'PHP Version >= 5.4. You run: ' . phpversion(), 'descr' => 'PHP Version >= 5.4. You run: ' . phpversion(),
'enabled' => version_compare(phpversion(), '5.4', '>=')); 'enabled' => version_compare(phpversion(), '5.4', '>=')
foreach ($functionchecks AS $func => $descr) { );
$funcmatrix[] = array('descr' => $descr[1], 'required' => $descr[0], 'enabled' => function_exists($func)); foreach ($functionchecks as $func => $descr) {
$funcmatrix[] = array('descr' => $descr[1], 'required' => $descr[0], 'enabled' => function_exists($func));
} }
$funcmatrix[] = array( $funcmatrix[] = array(
...@@ -144,25 +137,25 @@ $funcmatrix[] = array( ...@@ -144,25 +137,25 @@ $funcmatrix[] = array(
/* Some basic configuration checks */ /* Some basic configuration checks */
if($config->getString('technicalcontact_email', 'na@example.org') === 'na@example.org') { if ($config->getString('technicalcontact_email', 'na@example.org') === 'na@example.org') {
$mail_ok = FALSE; $mail_ok = false;
} else { } else {
$mail_ok = TRUE; $mail_ok = true;
} }
$funcmatrix[] = array( $funcmatrix[] = array(
'required' => 'recommended', 'required' => 'recommended',
'descr' => 'technicalcontact_email option set', 'descr' => 'technicalcontact_email option set',
'enabled' => $mail_ok 'enabled' => $mail_ok
); );
if($config->getString('auth.adminpassword', '123') === '123') { if ($config->getString('auth.adminpassword', '123') === '123') {
$password_ok = FALSE; $password_ok = false;
} else { } else {
$password_ok = TRUE; $password_ok = true;
} }
$funcmatrix[] = array( $funcmatrix[] = array(
'required' => 'required', 'required' => 'required',
'descr' => 'auth.adminpassword option set', 'descr' => 'auth.adminpassword option set',
'enabled' => $password_ok 'enabled' => $password_ok
); );
$t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_config.tpl.php'); $t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_config.tpl.php');
...@@ -179,7 +172,6 @@ $t->data['links_auth'] = $links_auth; ...@@ -179,7 +172,6 @@ $t->data['links_auth'] = $links_auth;
$t->data['links_federation'] = $links_federation; $t->data['links_federation'] = $links_federation;
$t->data['enablematrix'] = $enablematrix; $t->data['enablematrix'] = $enablematrix;
$t->data['funcmatrix'] = $funcmatrix; $t->data['funcmatrix'] = $funcmatrix;
$t->data['requiredmap'] = array( $t->data['requiredmap'] = array(
...@@ -191,5 +183,3 @@ $t->data['version'] = $config->getVersion(); ...@@ -191,5 +183,3 @@ $t->data['version'] = $config->getVersion();
$t->data['directory'] = dirname(dirname(dirname(dirname(__FILE__)))); $t->data['directory'] = dirname(dirname(dirname(dirname(__FILE__))));
$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