diff options
| author | 2024-06-05 22:04:06 +0200 | |
|---|---|---|
| committer | 2024-06-05 22:04:06 +0200 | |
| commit | f99c8d5f54c67e0abc3f3189b4f5e3e4571e114c (patch) | |
| tree | d7d74a628cd9614dd4093220139b6c073f3a5c54 /p/api/pshb.php | |
| parent | 8fc8ac3aefca73a4cd509313a2f1ad73ef7f2e1a (diff) | |
Modernize code to php7.4 (#6043)
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Modernize code to php7.4
* Consistency
---------
Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'p/api/pshb.php')
| -rw-r--r-- | p/api/pshb.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/p/api/pshb.php b/p/api/pshb.php index b4d553430..18aa0ebbf 100644 --- a/p/api/pshb.php +++ b/p/api/pshb.php @@ -3,7 +3,7 @@ declare(strict_types=1); require(__DIR__ . '/../../constants.php'); require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader -const MAX_PAYLOAD = 3145728; +const MAX_PAYLOAD = 3_145_728; header('Content-Type: text/plain; charset=UTF-8'); header('X-Content-Type-Options: nosniff'); @@ -30,7 +30,7 @@ if ($canonical === false) { if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'unsubscribe') { Minz_Log::warning('Warning: Accept unknown unsubscribe', PSHB_LOG); header('Connection: close'); - exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); + exit($_REQUEST['hub_challenge'] ?? ''); } // https://github.com/w3c/websub/issues/106 , https://w3c.github.io/websub/#content-distribution header('HTTP/1.1 410 Gone'); @@ -67,7 +67,7 @@ if (empty($users)) { } if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') { - $leaseSeconds = empty($_REQUEST['hub_lease_seconds']) ? 0 : intval($_REQUEST['hub_lease_seconds']); + $leaseSeconds = empty($_REQUEST['hub_lease_seconds']) ? 0 : (int) $_REQUEST['hub_lease_seconds']; if ($leaseSeconds > 60) { $hubJson['lease_end'] = time() + $leaseSeconds; } else { @@ -79,13 +79,13 @@ if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') { } file_put_contents('./!hub.json', json_encode($hubJson)); header('Connection: close'); - exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); + exit($_REQUEST['hub_challenge'] ?? ''); } if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'unsubscribe') { if (empty($hubJson['lease_end']) || $hubJson['lease_end'] < time()) { header('Connection: close'); - exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : ''); + exit($_REQUEST['hub_challenge'] ?? ''); } else { header('HTTP/1.1 422 Unprocessable Entity'); die('We did not ask to unsubscribe!'); @@ -103,7 +103,7 @@ $simplePie->init(); unset($ORIGINAL_INPUT); $links = $simplePie->get_links('self'); -$self = isset($links[0]) ? $links[0] : null; +$self = $links[0] ?? null; if ($self !== $canonical) { //header('HTTP/1.1 422 Unprocessable Entity'); |
