ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
frontpage_config.php
Go to the documentation of this file.
1 <?php
2 
3 // Load SimpleSAMLphp, configuration
6 
7 // Check if valid local session exists.
8 if ($config->getBoolean('admin.protectindexpage', false)) {
10 }
13 
14 
15 $warnings = array();
16 
17 if (!\SimpleSAML\Utils\HTTP::isHTTPS()) {
18  $warnings[] = '{core:frontpage:warnings_https}';
19 }
20 
21 if ($config->getValue('secretsalt') === 'defaultsecretsalt') {
22  $warnings[] = '{core:frontpage:warnings_secretsalt}';
23 }
24 
25 if (extension_loaded('suhosin')) {
26  $suhosinLength = ini_get('suhosin.get.max_value_length');
27  if (empty($suhosinLength) || (int)$suhosinLength < 2048) {
28  $warnings[] = '{core:frontpage:warnings_suhosin_url_length}';
29  }
30 }
31 
32 $links = array();
33 $links_welcome = array();
34 $links_config = array();
35 $links_auth = array();
37 
38 $links_config[] = array(
39  'href' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'admin/hostnames.php',
40  'text' => '{core:frontpage:link_diagnostics}'
41 );
42 
43 $links_config[] = array(
44  'href' => \SimpleSAML\Utils\HTTP::getBaseURL() . 'admin/phpinfo.php',
45  'text' => '{core:frontpage:link_phpinfo}'
46 );
47 
48 $allLinks = array(
49  'links' => &$links,
50  'welcome' => &$links_welcome,
51  'config' => &$links_config,
52  'auth' => &$links_auth,
53  'federation' => &$links_federation,
54 );
56 
57 // Check for updates. Store the remote result in the session so we
58 // don't need to fetch it on every access to this page.
59 $current = $config->getVersion();
60 if ($config->getBoolean('admin.checkforupdates', true) && $current !== 'master') {
61  if (!function_exists('curl_init')) {
62  $warnings[] = [ '{core:frontpage:warnings_curlmissing}' ];
63  } else {
64  $latest = $session->getData("core:latest_simplesamlphp_version", "version");
65 
66  if (!$latest) {
67  $api_url = 'https://api.github.com/repos/simplesamlphp/simplesamlphp/releases';
68  $ch = curl_init($api_url.'/latest');
69  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
70  curl_setopt($ch, CURLOPT_USERAGENT, 'SimpleSAMLphp');
71  curl_setopt($ch, CURLOPT_TIMEOUT, 2);
72  curl_setopt($ch, CURLOPT_PROXY, $config->getString('proxy', null));
73  curl_setopt($ch, CURLOPT_PROXYUSERPWD, $config->getValue('proxy.auth', null));
74  $response = curl_exec($ch);
75 
76  if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
77  $latest = json_decode($response, true);
78  $session->setData("core:latest_simplesamlphp_version", "version", $latest);
79  }
80  curl_close($ch);
81  }
82 
83  if ($latest && version_compare($current, ltrim($latest['tag_name'], 'v'), 'lt')) {
84  $outdated = true;
85  $warnings[] = array(
86  '{core:frontpage:warnings_outdated}',
87  array('%LATEST_URL%' => $latest['html_url'])
88  );
89  }
90  }
91 }
92 
93 $enablematrix = array(
94  'saml20-idp' => $config->getBoolean('enable.saml20-idp', false),
95  'shib13-idp' => $config->getBoolean('enable.shib13-idp', false),
96 );
97 
98 
100  'time' => array('required', 'Date/Time Extension'),
101  'hash' => array('required', 'Hashing function'),
102  'gzinflate' => array('required', 'ZLib'),
103  'openssl_sign' => array('required', 'OpenSSL'),
104  'dom_import_simplexml' => array('required', 'XML DOM'),
105  'preg_match' => array('required', 'RegEx support'),
106  'json_decode' => array('required', 'JSON support'),
107  'class_implements' => array('required', 'Standard PHP Library (SPL)'),
108  'mb_strlen' => array('required', 'Multibyte String Extension'),
109  'curl_init' => array('optional', 'cURL (required if automatic version checks are used, also by some modules.'),
110  'session_start' => array('optional', 'Session Extension (required if PHP sessions are used)'),
111  'pdo_drivers' => array('optional', 'PDO Extension (required if a database backend is used)'),
112 );
113 if (SimpleSAML\Module::isModuleEnabled('ldap')) {
114  $functionchecks['ldap_bind'] = array('optional', 'LDAP Extension (required if an LDAP backend is used)');
115 }
116 if (SimpleSAML\Module::isModuleEnabled('radius')) {
117  $functionchecks['radius_auth_open'] = array('optional', 'Radius Extension (required if a Radius backend is used)');
118 }
119 
120 $funcmatrix = array();
121 $funcmatrix[] = array(
122  'required' => 'required',
123  'descr' => 'PHP Version >= 5.4. You run: ' . phpversion(),
124  'enabled' => version_compare(phpversion(), '5.4', '>=')
125 );
126 foreach ($functionchecks as $func => $descr) {
127  $funcmatrix[] = array('descr' => $descr[1], 'required' => $descr[0], 'enabled' => function_exists($func));
128 }
129 
130 $funcmatrix[] = array(
131  'required' => 'optional',
132  'descr' => 'predis/predis (required if the redis data store is used)',
133  'enabled' => class_exists('\Predis\Client'),
134 );
135 
136 $funcmatrix[] = array(
137  'required' => 'optional',
138  'descr' => 'Memcache or Memcached Extension (required if a Memcached backend is used)',
139  'enabled' => class_exists('Memcache') || class_exists('Memcached'),
140 );
141 
142 /* Some basic configuration checks */
143 
144 if ($config->getString('technicalcontact_email', 'na@example.org') === 'na@example.org') {
145  $mail_ok = false;
146 } else {
147  $mail_ok = true;
148 }
149 $funcmatrix[] = array(
150  'required' => 'recommended',
151  'descr' => 'technicalcontact_email option set',
152  'enabled' => $mail_ok
153 );
154 if ($config->getString('auth.adminpassword', '123') === '123') {
155  $password_ok = false;
156 } else {
157  $password_ok = true;
158 }
159 $funcmatrix[] = array(
160  'required' => 'required',
161  'descr' => 'auth.adminpassword option set',
162  'enabled' => $password_ok
163 );
164 
165 $t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_config.tpl.php');
166 $translator = $t->getTranslator();
167 $t->data['pageid'] = 'frontpage_config';
168 $t->data['isadmin'] = $isadmin;
169 $t->data['loginurl'] = $loginurl;
170 $t->data['warnings'] = $warnings;
171 
172 
173 $t->data['links'] = $links;
174 $t->data['links_welcome'] = $links_welcome;
175 $t->data['links_config'] = $links_config;
176 $t->data['links_auth'] = $links_auth;
177 $t->data['links_federation'] = $links_federation;
178 
179 
180 $t->data['enablematrix'] = $enablematrix;
181 $t->data['funcmatrix'] = $funcmatrix;
182 $t->data['requiredmap'] = array(
183  'recommended' => $translator->noop('{core:frontpage:recommended}'),
184  'required' => $translator->noop('{core:frontpage:required}'),
185  'optional' => $translator->noop('{core:frontpage:optional}'),
186 );
187 $t->data['version'] = $config->getVersion();
188 $t->data['directory'] = dirname(dirname(dirname(dirname(__FILE__))));
189 
190 $t->show();
static requireAdmin()
Require admin access to the current page.
Definition: Auth.php:60
$links_federation
static isAdmin()
Check whether the current user is admin.
Definition: Auth.php:42
static getAdminLoginURL($returnTo=null)
Retrieve a admin login URL.
Definition: Auth.php:22
$links_auth
static callHooks($hook, &$data=null)
Call a hook in all enabled modules.
Definition: Module.php:281
$functionchecks
if($config->getBoolean('admin.protectindexpage', false)) $loginurl
Attribute-related utility methods.
getBaseURL($t, $type='get', $key=null, $value=null)
Definition: showstats.php:145
$links_welcome
if($config->getBoolean('admin.checkforupdates', true) && $current !=='master') $enablematrix
$links_config
if(!\SimpleSAML\Utils\HTTP::isHTTPS()) if($config->getValue('secretsalt')==='defaultsecretsalt') if(extension_loaded('suhosin')) $links
$session
$response
static getSessionFromRequest()
Retrieves the current session.
Definition: Session.php:241
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
if(SimpleSAML\Module::isModuleEnabled('ldap')) if(SimpleSAML\Module::isModuleEnabled('radius')) $funcmatrix