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