-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
120 lines (112 loc) · 3.34 KB
/
index.php
File metadata and controls
120 lines (112 loc) · 3.34 KB
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
<?php
declare(strict_types=1);
require __DIR__ . '/src/bootstrap.php';
if (!is_installed()) {
http_response_code(503);
echo 'LexNova is not installed.';
exit;
}
$hash = trim((string) ($_GET['hash'] ?? ''));
$mode = (string) ($_GET['mode'] ?? 'imprint');
$mode = $mode === 'privacy' ? 'privacy' : 'imprint';
$entity = null;
$document = null;
$error = null;
if ($hash === '') {
http_response_code(400);
$error = 'Missing required parameter: hash.';
} else {
$entity = get_entity_by_hash($hash);
if (!$entity) {
http_response_code(404);
$error = 'Entity not found.';
} else {
$document = get_latest_document((int) $entity['id'], $mode);
if (!$document) {
http_response_code(404);
$error = 'No document found for this entity.';
}
}
}
$title = $mode === 'privacy' ? 'Privacy Policy' : 'Imprint';
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo h($title); ?> | LexNova</title>
<style>
:root {
color-scheme: light;
}
body {
font-family: "Georgia", "Times New Roman", serif;
margin: 0;
background: #f4f1ea;
color: #1f1f1f;
}
.wrap {
max-width: 900px;
margin: 0 auto;
padding: 48px 20px 80px;
}
header {
margin-bottom: 32px;
}
h1 {
font-size: 32px;
margin: 0 0 8px;
}
.meta {
font-size: 14px;
color: #4a4a4a;
}
.card {
background: #ffffff;
padding: 28px;
border: 1px solid #e0d7c9;
border-radius: 12px;
box-shadow: 0 12px 30px rgba(39, 34, 28, 0.06);
}
.section-title {
font-size: 18px;
text-transform: uppercase;
letter-spacing: 0.08em;
margin: 28px 0 12px;
color: #5c4a34;
}
.content {
line-height: 1.6;
white-space: pre-wrap;
}
.error {
background: #fff4f2;
border: 1px solid #f3b7a8;
color: #7b1c0e;
padding: 16px;
border-radius: 10px;
}
</style>
</head>
<body>
<div class="wrap">
<header>
<div class="meta">LexNova Legal Documents</div>
<h1><?php echo h($title); ?></h1>
</header>
<div class="card">
<?php if ($error): ?>
<div class="error"><?php echo h($error); ?></div>
<?php else: ?>
<div class="meta">Entity: <?php echo h((string) $entity['name']); ?> · Hash: <?php echo h((string) $entity['hash']); ?></div>
<div class="section-title">Contact</div>
<div class="content"><?php echo render_text((string) $entity['contact_data']); ?></div>
<div class="section-title">Document</div>
<div class="content"><?php echo render_text((string) $document['content']); ?></div>
<div class="meta">Version <?php echo h((string) $document['version']); ?> · Updated <?php echo h((string) $document['updated_at']); ?></div>
<?php endif; ?>
</div>
</div>
</body>
</html>