check.php: use null coalescing operator ("??") more
This commit is contained in:
parent
c40f52a21e
commit
bb937526a7
3 changed files with 7 additions and 7 deletions
|
@ -141,10 +141,10 @@ function authDeleteUser(string $user_id): void {
|
|||
}
|
||||
|
||||
function rateLimit(): void {
|
||||
if (PAGE_METADATA['tokens_account_cost'] ?? 0 > 0)
|
||||
if ((PAGE_METADATA['tokens_account_cost'] ?? 0) > 0)
|
||||
rateLimitAccount(PAGE_METADATA['tokens_account_cost']);
|
||||
|
||||
if (PAGE_METADATA['tokens_instance_cost'] ?? 0 > 0)
|
||||
if ((PAGE_METADATA['tokens_instance_cost'] ?? 0) > 0)
|
||||
rateLimitInstance(PAGE_METADATA['tokens_instance_cost']);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ function testReg(): string {
|
|||
'ns' => 'ns1.servnest.invalid.',
|
||||
]);
|
||||
$results = kdig(name: $domain, type: 'NS', server: CONF['reg']['address']);
|
||||
if ($results['authorityRRs'][0]['rdataNS'] !== 'ns1.servnest.invalid.')
|
||||
if (($results['authorityRRs'][0]['rdataNS'] ?? NULL) !== 'ns1.servnest.invalid.')
|
||||
exit('Error: /reg/ns: NS record not set' . LF);
|
||||
|
||||
curlTest('/reg/ns', [
|
||||
|
@ -189,9 +189,9 @@ function testNs(string $domain): void {
|
|||
'value' => 'letsencrypt.org',
|
||||
]);
|
||||
$results = kdig(name: $domain, type: 'CAA', server: CONF['reg']['address']);
|
||||
if ($results['answerRRs'][0]['TTL'] !== 7200)
|
||||
if (($results['answerRRs'][0]['TTL'] ?? NULL) !== 7200)
|
||||
exit('Error: /ns/caa: wrong TTL' . LF);
|
||||
if ($results['answerRRs'][0]['rdataCAA'] !== '0 issue "letsencrypt.org" ')
|
||||
if (($results['answerRRs'][0]['rdataCAA'] ?? NULL) !== '0 issue "letsencrypt.org" ')
|
||||
exit('Error: /ns/caa: CAA record not set' . LF);
|
||||
|
||||
curlTest('/ns/edit', [
|
||||
|
@ -200,7 +200,7 @@ function testNs(string $domain): void {
|
|||
. '@ 86400 NS ' . CONF['ns']['servers'][0] . "\r\n",
|
||||
]);
|
||||
$results = kdig(name: 'aaaa.' . $domain, type: 'AAAA', server: CONF['reg']['address']);
|
||||
if ($results['answerRRs'][0]['rdataAAAA'] !== CONF['ht']['ipv6_address'])
|
||||
if (($results['answerRRs'][0]['rdataAAAA'] ?? NULL) !== CONF['ht']['ipv6_address'])
|
||||
exit('Error: /ns/edit: AAAA record not set' . LF);
|
||||
}
|
||||
|
||||
|
|
2
view.php
2
view.php
|
@ -41,7 +41,7 @@ if (CONF['common']['services']['auth'] === 'error' OR (in_array(SERVICE, SERVICE
|
|||
|
||||
require ROOT_PATH . '/pg-view/' . PAGE_ADDRESS . '.php';
|
||||
|
||||
if ($_POST === [] AND PAGE_METADATA['require-login'] ?? true !== false AND !isset($_SESSION['id']) AND PAGE_TERMINAL)
|
||||
if ($_POST === [] AND (PAGE_METADATA['require-login'] ?? true) !== false AND !isset($_SESSION['id']) AND PAGE_TERMINAL)
|
||||
echo '<p>' . sprintf(_('This form won\'t be accepted because you need to %slog in%s first.'), '<a class="auth" href="' . redirUrl('auth/login') . '">', '</a>') . '</p>';
|
||||
|
||||
displayFinalMessage($data);
|
||||
|
|
Loading…
Reference in a new issue