Code formatting

This commit is contained in:
Miraty 2023-05-09 20:23:52 +02:00
parent f026b8b02d
commit cbf49408d1
2 changed files with 14 additions and 15 deletions

View file

@ -139,7 +139,6 @@ if ($_POST !== []) {
// Protect against cross-site request forgery if a POST request is received
if (isset($_SERVER['HTTP_SEC_FETCH_SITE']) !== true)
output(403, 'The <code>Sec-Fetch-Site</code> HTTP header is required when submitting a POST request to prevent Cross-Site Request Forgery (<abbr>CSRF</abbr>).');
if ($_SERVER['HTTP_SEC_FETCH_SITE'] !== 'same-origin')
if (!in_array($_SERVER['HTTP_SEC_FETCH_SITE'], ['none', 'same-origin'], true))
output(403, 'The <code>Sec-Fetch-Site</code> HTTP header must be <code>same-origin</code> or <code>none</code> when submitting a POST request to prevent Cross-Site Request Forgery (<abbr>CSRF</abbr>).');

View file

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="<?= LOCALE ?>"<?php if (!empty(SERVICE)) echo ' class="' . SERVICE . '"'; ?>>
<html lang="<?= LOCALE ?>"<?= empty(SERVICE) ? '' : ' class="' . SERVICE . '"' ?>>
<head>
<meta charset="utf-8">
<title><?php
foreach (array_reverse(TITLES_LINEAGE) as $id => $title)
foreach (array_reverse(TITLES_LINEAGE) as $id => $title)
echo strip_tags($title) . (array_key_last(TITLES_LINEAGE) === $id ? '' : ' < ');
?></title>
<?php
foreach (glob('css/*.css') as $css_path)
foreach (glob('css/*.css') as $css_path)
echo ' <link type="text/css" rel="stylesheet" media="screen" href="' . CONF['common']['prefix'] . '/' . $css_path . '">' . LF;
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -23,11 +23,11 @@
</p>
<nav>
<?php
foreach (TITLES_LINEAGE as $id => $title) {
foreach (TITLES_LINEAGE as $id => $title) {
$lastTitle = (TITLES_LINEAGE[array_key_last(TITLES_LINEAGE)] === $title);
echo '<ul><li>' . ($lastTitle ? '<h1>' : '') . '<a' . (($id === 0) ? ' class="common"' : '') . ' href="' . CONF['common']['prefix'] . ($lastTitle ? '/' . PAGE_URL : '/' . implode('/', array_slice(PAGE_LINEAGE, 0, $id)) . (($lastTitle OR $id === 0) ? '' : '/')) . '">' . $title . '</a>' . ($lastTitle ? '</h1>' : '') . LF;
}
echo str_repeat('</li></ul>', count(TITLES_LINEAGE));
}
echo str_repeat('</li></ul>', count(TITLES_LINEAGE));
?>
</nav>
@ -38,12 +38,12 @@
if (in_array(SERVICE, SERVICES_USER, true) AND CONF['common']['services'][SERVICE] === 'error')
echo '<p><strong>' . _('This service is currently under maintenance. No action can be taken on it until an administrator finishes repairing it.') . '</strong></p>';
require ROOT_PATH . '/pg-view/' . PAGE_ADDRESS . '.php';
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);
displayFinalMessage($data);
?>
</main>