SessionHost.php (mrbs-1.9.4) | : | SessionHost.php (mrbs-1.10.0) | ||
---|---|---|---|---|
<?php | <?php | |||
namespace MRBS\Session; | namespace MRBS\Session; | |||
use MRBS\User; | ||||
/* | /* | |||
* This is a slight variant of session_ip. | * This is a slight variant of session_ip. | |||
* Session management scheme that uses the DNS name of the computer | * Session management scheme that uses the DNS name of the computer | |||
* to identify users and administrators. | * to identify users and administrators. | |||
* Anyone who can access the server can make bookings etc. | * Anyone who can access the server can make bookings etc. | |||
* | * | |||
* To use this authentication scheme set the following | * To use this authentication scheme set the following | |||
* things in config.inc.php: | * things in config.inc.php: | |||
* | * | |||
* $auth['type'] = 'none'; | * $auth['type'] = 'none'; | |||
skipping to change at line 26 | skipping to change at line 28 | |||
* Then, you may configure admin users: | * Then, you may configure admin users: | |||
* | * | |||
* $auth['admin'][] = 'DNSname1'; | * $auth['admin'][] = 'DNSname1'; | |||
* $auth['admin'][] = 'DNSname2'; | * $auth['admin'][] = 'DNSname2'; | |||
*/ | */ | |||
class SessionHost extends SessionWithoutLogin | class SessionHost extends SessionWithoutLogin | |||
{ | { | |||
// No need to prompt for a name: if no DNSname is returned, the IP address is used | // No need to prompt for a name: if no DNSname is returned, the IP address is used | |||
public function getCurrentUser() | public function getCurrentUser() : ?User | |||
{ | { | |||
global $server; | global $server; | |||
if ((!isset($server['REMOTE_ADDR'])) || | if ((!isset($server['REMOTE_ADDR'])) || | |||
(!is_string($server['REMOTE_ADDR'])) || | (!is_string($server['REMOTE_ADDR'])) || | |||
(($server['REMOTE_ADDR'] === ''))) | (($server['REMOTE_ADDR'] === ''))) | |||
{ | { | |||
return null; | return null; | |||
} | } | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added |