blob: c9e28c5dbb1924cd14112a17bd9e2b2f0aec72f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
<?php
use Digitigrade\GlobalSettings;
use Digitigrade\Model\UserAccount;
$user = UserAccount::findByCurrentSession();
$settings = GlobalSettings::getInstance();
$fullTitle = $pageTitle . ' — ' . $settings->get('instance.name');
$loadPartialPage = isset($_SERVER['HTTP_HX_REQUEST']);
if ($loadPartialPage) {
echo '<title>' . htmlspecialchars($fullTitle) . '</title>';
goto skipStart;
}
?>
<!DOCTYPE html>
<html lang="<?= get_ui_language() ?>">
<head>
<title><?= htmlspecialchars($fullTitle) ?></title>
<!-- metadata for link previews -->
<meta property="og:type" content="<?= $ogType ?? 'website' ?>">
<meta name="twitter:card" content="summary">
<meta property="og:title" content="<?= htmlspecialchars($ogTitle ?? $pageTitle) ?>">
<meta name="twitter:title" content="<?= htmlspecialchars($ogTitle ?? $pageTitle) ?>">
<meta property="og:site_name" content="<?= htmlspecialchars($settings->get('instance.name')) ?>">
<?php if (isset($ogDesc)): ?>
<meta name="description" content="<?= htmlspecialchars($ogDesc) ?>">
<meta property="og:description" content="<?= htmlspecialchars($ogDesc) ?>">
<meta name="twitter:description" content="<?= htmlspecialchars($ogDesc) ?>">
<?php endif; ?>
<?php if (isset($ogImage)): ?>
<meta property="og:image" content="<?= htmlspecialchars($ogImage) ?>">
<meta name="twitter:image" content="<?= htmlspecialchars($ogImage) ?>">
<?php endif; ?>
<?php if (isset($ogHandle)): ?>
<meta name="fediverse:creator" content="<?= $ogHandle ?>">
<?php endif; ?>
<!-- any custom links e.g. rss/atom feeds -->
<?php foreach (($headLinks ?? []) as $link): ?>
<link rel="<?= $link['rel'] ?>" type="<?= $link['type'] ?? '' ?>" href="<?= $link['href'] ?>"
title="<?= $link['title'] ?? '' ?>">
<?php endforeach; ?>
<!-- other page resources -->
<?php call_template('head_tags'); ?>
</head>
<body hx-boost="true" hx-indicator="#loadingIndicator" hx-target="#centrePane" hx-swap="outerHTML show:window:top">
<header>
<?php skipStart: ?>
<nav id="nav" <?= $loadPartialPage ? 'hx-swap-oob="true"' : '' ?>>
<?php if ($user != null): ?>
<a id="leftPaneActivator" href="/mobilepane/left" class="inlineIcon material-symbols menu"
hx-boost="false"></a>
<?php else: ?>
<span id="leftPaneActivator"></span>
<?php endif; ?>
<?php
$links = $user == null ? [] : ['/feed/home' => __('timeline.home.shortName')];
$links = array_merge($links, [
'/feed/global' => __('timeline.global.shortName'),
'/feed/local' => __('timeline.local.shortName'),
]);
call_template('navigation/header_links', ['links' => $links]);
?>
<span id="siteTitle"><?= $settings->get('instance.name') ?></span>
<img id="loadingIndicator" class="htmx-indicator" src="/static/tail-spin.svg">
<?php if ($user != null): ?>
<a id="rightPaneActivator" href="/mobilepane/right" class="inlineIcon material-symbols notifications"
hx-boost="false"></a>
<?php endif; ?>
<?php if ($user == null):
call_template('navigation/header_links', ['links' => [
'/login' => __('navigation.login')
]]);
else: ?>
<a href="/@/<?= $user->actor->handle ?>" id="currentUserInfo">
<?php call_template('actor/avatar', ['actor' => $user->actor]) ?>
<?= htmlspecialchars($user->actor->displayName) ?>
</a>
<?php endif; ?>
</nav>
<?php if ($loadPartialPage)
goto skipToMainContent; ?>
</header>
<main>
<div>
<section id="leftPane">
<?php
if ($user != null) {
call_template('note/write_form', ['actor' => $user->actor]);
}
call_template('navigation/left_side');
?>
<p class="versionInfo"><?= __f('version', get_version()) ?></p>
</section>
</div>
<div>
<?php skipToMainContent: ?>
<section id="centrePane">
<?php if (!isset($renderTitleHeading) || $renderTitleHeading): ?>
<h1><?= $pageTitle ?></h1>
<?php endif; ?>
<?php slot(); ?>
</section>
<?php if ($loadPartialPage)
exit; ?>
</div>
<div>
<section id="rightPane">
<?php if ($user != null) {
call_template('notifications_panel', ['user' => $user]);
} ?>
</section>
</div>
</main>
</body>
</html>
|