blob: aacae31dd22f3fd2ea9500ef4276f5c0f72e7f80 (
plain) (
blame)
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
123
124
125
126
127
128
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Markup Language of Saddness</title>
<link rel="stylesheet" href="src/style.css" />
</head>
<?php
session_start();
require_once "src/data.php";
$eid = $_SESSION["eid"];
[$data, $count] = get_data();
function is_pos(): bool
{
return $_GET["m"] === "pos" || $_GET["m"] === "" || !$_GET["m"];
}
?>
<body>
<header>
<button type="button"><a href="?m=pos">Positions</a></button>
<button type="button"><a href="?m=pre">Preview</a></button>
</header>
<table>
<thead>
<tr>
<th></th>
<th></th>
<th>Game name</th>
<th>Thumbnail</th>
<th>Author</th>
<th>Magazine</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php if (is_pos()) { ?>
<?php foreach ($data as $d) {
$id = $d['id']; ?>
<tr>
<form action="api/change-order.php" method="post">
<td>
<?php if ($d["order"] !== "$count" && $eid === null) { ?>
<input type="hidden" name="old-order" value="<?= $d["order"] ?>">
<input type="hidden" name="new-order" value="<?= intval($d["order"]) + 1 ?>">
<input type="submit" value="pos -" />
<?php } ?>
</td>
</form>
<?php if ("$eid" === $d["id"]) { ?>
<td></td>
<form action="api/add.php" method="post">
<td><input type="text" name="name" value="<?= htmlspecialchars($d["name"]) ?>" /></td>
<td><input type="text" name="thumbnail" value="<?= htmlspecialchars($d["thumbnail"]) ?>" /></td>
<td><input type="text" name="author" value="<?= htmlspecialchars($d["author"]) ?>" /></td>
<td><input type="text" name="magazine" value="<?= $d["magazine"] ?>" /></td>
<td><input type="submit" value="Edit"></td>
<input type="hidden" name="id" value="<?= $d['id'] ?>" />
</form>
<?php } else { ?>
<td>
<form action="api/set-session.php?eid=<?= $id ?>" method="post"><input type="submit" value="E"></form>
</td>
<form action="api/remove.php" method="post">
<td><?= htmlspecialchars($d["name"]) ?></td>
<td><?= htmlspecialchars($d["thumbnail"]) ?></td>
<td><?= htmlspecialchars($d["author"]) ?></td>
<td><?= $d["magazine"] ?></td>
<td><input type="submit" value="Remove"></td>
<input type="hidden" name="id" value="<?= $d['id'] ?>" />
</form>
<?php } ?>
<form action="api/change-order.php" method="post">
<td>
<?php if ($d["order"] !== "1" && $eid === null) { ?>
<input type="hidden" name="old-order" value="<?= $d["order"] ?>">
<input type="hidden" name="new-order" value="<?= intval($d["order"]) - 1 ?>">
<input type="submit" value="pos +" />
<?php } ?>
</td>
</form>
</tr>
<?php } ?>
<?php } ?>
<?php if ($_GET["m"] === "pre") { ?>
<?php foreach ($data as $d) { ?>
<tr>
<form action="api/remove.php" method="post">
<td></td>
<td></td>
<td><?= htmlspecialchars($d["name"]) ?></td>
<td><img src="imgs/<?= htmlspecialchars($d["thumbnail"]) ?>" width="200" /></td>
<td><?= htmlspecialchars($d["author"]) ?></td>
<td><?= $d["magazine"] ?></td>
<td></td>
<td></td>
</form>
</tr>
<?php } ?>
<?php } ?>
<?php if (is_pos()) { ?>
<tr>
<form action="api/add.php" method="post">
<td></td>
<td></td>
<td><input type="text" name="name"></td>
<td><input type="text" name="thumbnail"></td>
<td><input type="text" name="author"></td>
<td><input type="text" name="magazine"></td>
<td><input type="submit" value="Add"></td>
</form>
</tr>
<?php } ?>
</tbody>
</table>
<?php if (is_pos()) { ?>
<a href="api/export.php">Export to xlsx</a><br>
<a href="../mlos.zip">Sources</a>
<?php } ?>
<!-- <script src="/src/main.js"></script> -->
</body>
</html>
|