blob: 7512267c42811e21fd2c1228e6f8e5fc62aaf060 (
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
123
124
125
126
127
128
129
130
131
132
|
<?php $this->layout('layout', ['title' => 'user', 'css' => $css . 'home.css']) ?>
<?php $this->start('page') ?>
<body>
<?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'user']) ?>
<main class="user">
<section>
<article>
<h1>User : <?= $user->id() ?></h1>
<form action="<?= $this->url('userpref') ?>" method="post">
<h2>Preferences</h2>
<input type="number" name="cookie" value="<?= $getuser->cookie() ?>" id="cookie" min="0" max="365">
<label for="cookie">Cookie conservation time <i>(In days)</i></label>
<input type="submit" value="submit">
</form>
</article>
<?php if($user->isadmin()) { ?>
<article>
<h1>Admin panel</h1>
<table>
<tr>
<th>id</th><th>password</th><th>hash</th><th>level</th><th>action</th>
</tr>
<tr>
<form action="<?= $this->url('useradd') ?>" method="post">
<td>
<input type="text" name="id" maxlength="128" required>
</td>
<td>
<input type="password" name="password" minlength="4" maxlength="64" required>
</td>
<td>
<input type="hidden" name="passwordhashed" value="0">
<input type="checkbox" name="passwordhashed" value="1">
</td>
<td>
<select name="level" id="level">
<option value="1">reader</option>
<option value="2">invite</option>
<option value="3">editor</option>
<option value="4">super editor</option>
<option value="10">admin</option>
</select>
</td>
<td>
<input type="submit" value="add">
</td>
</form>
</tr>
<?php
foreach ($userlist as $user ) {
?>
<tr>
<form action="<?= $this->url('userupdate') ?>" method="post">
<td>
<?= $user->id() ?>
</td>
<td>
<input type="password" name="password" minlength="4" maxlength="64" >
</td>
<td>
<?= $user->passwordhashed() ? '🔑' : '<input type="hidden" name="passwordhashed" value="0"><input type="checkbox" name="passwordhashed" value="1">' ?>
</td>
<td>
<select name="level" id="level">
<option value="1" <?= $user->level() === 1 ? 'selected' : '' ?>>reader</option>
<option value="2" <?= $user->level() === 2 ? 'selected' : '' ?>>invite</option>
<option value="3" <?= $user->level() === 3 ? 'selected' : '' ?>>editor</option>
<option value="4" <?= $user->level() === 4 ? 'selected' : '' ?>>super editor</option>
<option value="10" <?= $user->level() === 10 ? 'selected' : '' ?>>admin</option>
</select>
</td>
<td>
<input type="hidden" name="id" value="<?= $user->id() ?>">
<input type="submit" name="action" value="update">
<input type="submit" name="action" value="delete">
</form>
</td>
</tr>
<?php
}
?>
</table>
</article>
<?php } ?>
</section>
</main>
</body>
<?php $this->stop('page') ?>
|