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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
\const{HEIGHT.head}{40}
\const{HEIGHT.foot}{32}
\const{COLOR.private}{#ffffcc}
\const{COLOR.public}{#ffffff}
\const{COLOR.special}{#cccccc}
\const{COLOR.grayed}{#999999}
\def{page}{r}{
\if("GET HEAD" which \req.method){
\output{
\body{bgcolor=\if(\group ne ""){\COLOR.private}{\COLOR.public}}{
\1
}
}
}
}
\def{show.head}{}{
<head>
<title>\server.alias\uri</title>
</head>
}
\def{show.page}{}{
\nif(\req.useragent cnt "Mozilla"){\resp.cont.type.charset{}};
\switch(stat.MIME)
{text/x-htc}{
\if(stat.MOD&1){
\parse.public(stat.REFER)
}{
\if(stat.MOD&8){
\parse.private(stat.REFER)
}{
\parse(stat.REFER)
}
}
}
{text/x-htx}{
\show.latex(stat.REFER)
}
{text/html}{
\resp.cont.type(stat.MIME);
\output{\minilang{\load(stat.REFER)}}
}
}
\def{show.rawpage}{}{
\resp.cont.type(stat.MIME);
\output{\load(stat.REFER)}
}
\def{show.srcpage}{}{
\resp.cont.type{text/plain}
\nif(\req.useragent cnt "Mozilla"){\resp.cont.type.charset{}};
\output{
\switch(stat.MIME)
{text/x-htc}{
\%/SRC\uri HTC/1.2 Last modified \time2http(stat.LASTMOD)
}
{text/html}{
\%/SRC\uri HTML Last modified \time2http(stat.LASTMOD)
}
{text/x-htx}{
\%/SRC\uri HTX/1.2 (LaTeX) Last modified \time2http(stat.LASTMOD)
}
\load(stat.REFER)
}
}
\def{show.banner}{}{
\ldef{shist}{x}{
\find.rec{\1}{
\if(count BANNER){
[ban:=rest BANNER]\run.local{ban}
}{
\if(count PARENT){\shist(PARENT)}
}
}
};
\db{TREE}{\shist(stat.URI rleftand "/")}
}
\def{calc.height}{}{
\ldef{chist}{x}{
\find.rec{\1}{
\if(count BANNER)(first BANNER){\if(count PARENT){\chist(PARENT)}{\HEIGHT.head}}
}{
\HEIGHT.head
}
};
\db{TREE}{\chist(stat.URI rleftand "/")}
}
\def{page.header}{}{
\ldef{hist}{x}{
\find.rec{\1}{
\if(count PARENT){\hist(PARENT)};
\if(URI eq uri){\run.local{ALIAS}}{\href{\andlang;[URI]}{\run.local{ALIAS}}}>
}
}
\page{
\show.banner
\table{width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=\COLOR.special}{
\tr{valign=top align=left}{
\td{width=60%}{
\font{size=3}{
[uri:=stat.URI;dir:=uri rleftand "/";n:=0];
\db{TREE}{
\hist(dir);
\query(PARENT eq dir && URI ne "/"){
\if{\user.allow(X.CLEAR){\now}}{
\if(n){|}[n+=1]\if(URI eq uri){
\run.local{ALIAS}
}{
\href{\andlang;[URI]}{\run.local{ALIAS}}
}
}
}
}\space;
}
};
\td{width=40% align=right}{
\font{size=3}{
\if{\user.id}{\user.name}{\lang{Anonymous}{Anonym}}, \time2htc{\now}
}
}
}
}
}
}
\def{show.icons}{}{}
\def{page.footer}{}{
\output{
\body{bgcolor=\COLOR.special}{
\table{width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=\COLOR.special}{
\td{valign=top align=left}{
\iref{mailto:\server.admin}{\icons/mail.gif}
\if{\user.id}{
\iref{/LOGOUT\uri\andarg}{\icons/logout.gif}
}{
\iref{/LOGIN\uri\andarg}{\icons/login.gif}
}
\on.clear{ADM}{
\iref{\andlang/HTC/admin.htc}{\icons/adm.gif}
}
\iref{
\lang{/sv}{/en}[stat.URI]
}{
\icons/lang.gif
}
\if{\user.id}{
\iref{\andlang/HTC/prefs.htc}{\icons/prefs.gif}
}
\iref{/SRC[stat.URI]}{\icons/source.gif}
[acc:=\upload.clear(stat.URI)]\if((first acc) ne "ROOT"){
\on.clear(acc){
\iref{\server/RAW[stat.URI]}{\icons/transfer.gif}
}
}
\show.icons;
}
\td{valign=center align=right}{
HTCd/1.2 \[\lang{en}{sv}\] \time2htc(stat.LASTMOD)
}
}
}
}
}
\redef{show.register}{}{
\lang{
If your are not a registered user, register first.
}{
Om du inte {\"a}r en registrerad anv{\"a}ndare,
registrera dig f{\"o}rst.
}
}
\def{page.login}{}{
\cond{T.alias}{}
\page{
\h1{\server.alias Login}
\if{\user.id}{
\lang{
You are logged in as \user.name; (\user.alias).
}{
Du {\"a}r inloggad som \user.name; (\user.alias).
}
<p>
\href{\referer}{\lang{Continue}{Forts{\"a}tt}}
}{
\lang{
This server contains information only accessible to registered users.
Each registered user receives a user ID and a PIN code.
}{
Den h{\"a}r servern inneh{\aa}ller information som bara {\"a}r
tillg{\"a}nglig f{\"o}r registrerade anv{\"a}ndare.
Varje registrerad anv{\"a}ndare erh{\aa}ller ett anv{\"a}ndar-ID
och en PIN-kod.
};
<p>
\show.register;
<p>
\lang{
To login, enter your email address and PIN code below.
\it{DO NOT} enter your unix password!
}{
F{\"o}r att logga in, fyll i din epostadress och PIN kod nedan.
An{\"a}nd \it{EJ} ditt unix passord!
};
[remcookie:=0;email:=\T.alias];
\for(i:=0)(i<\ncookie)(i+=1){
\if(\cookie[i].name eq "RESEND"){
[remcookie=1;email=\cookie[i].val];
<p>
\font{color=red}{
\lang{E-mail has been sent to }{E-post har skickats till }[email]
(\lang{provided user exist}{f{\"o}rutsatt anv{\"a}ndaren existerar})
}
}
};
<p>
\form{
\variable{remcookie}(remcookie);
\variable{ref}{\referer};
\table{
\tr{
\td{\lang{E-mail (or alias)}{E-post (eller alias)}:}
\td{\input{email}{28}(email)}
};
\tr{
\td{PIN:}
\td{
\passwd{pin}{6}
}
};
\tr{
\td{colspan=2}{
\check{T.keep}{\endtime}
\lang{
Keep me logged in by storing to disk
}{
H{\aa}ll mig inloggad genom att spara till disk
};
}
};
\tr{
\td{colspan=2}{
\button{Login}
\button{Forgot my PIN code}
\button{Assign a new (4 digit) PIN code}
}
}
}
}
\h3{\lang{Nota bene}{Observera}}
<p>
\li{
\lang{
You must allow a COOKIE containing your user ID and
PIN code to be set. If you normally do not allow cookies,
you need to make an exception in this case, or by some other
means arrange for the cookie to be set.
If you don't know what a cookie is, you can probably ignore
this paragraph.
}{
Du m{\aa}ste till{\aa}ta s{\"a}ttning av en COOKIE med
ditt anv{\"a}ndar-ID och PIN-kod. Om du normalt inte till{\aa}ter
"kakor", m{\aa}ste du antingen g{\"o}ra ett undantag i det
h{\"a}r fallet, eller p{\aa} n{\aa}got annat s{\"a}tt
se till att kakan blir satt p{\aa} r{\"a}tt s{\"a}tt.
Vet du inte vad en kaka {\"a}r, kan du troligtvis bortse
fr{\aa}n denna paragraf.
}
};
<p>
\li{
\lang{
If logging in from a 'shared' browser, don't forget to logout
properly when you're done. Otherwise, the person after you may
enter the server as you.
}{
Om du loggar in fr{\aa}n en 'delad' webbl{\"a}sare, gl{\"o}m
inte att logga ut dig ordentligt. Annars kan n{\"a}sta person
komma in p{\aa} servern som dig.
}
}
}
};
\onpost{
\cond{T.keep}{0};
\cond{T.uid}{\getuser{\T.email}};
\switch(first \T.cmd)
{Login}{
\log{SetID \[\T.uid.\T.pin\] (\T.keep)};
\setcookie{ID}{\T.uid.\T.pin}{\T.keep};
\if{\T.remcookie}{\setcookie{RESEND}{deleted}{1}};
\redirect{\T.ref};
}
{Forgot}{
\su{\T.uid}{
\mail.user{PIN code}{
Your PIN code is \user.pin.
/Admin
}
};
\if(\T.email ne ""){\setcookie{RESEND}{\T.email}};
\redirect{\server\this\andarg};
}
{Assign}{
\su{\T.uid}{
\if(\user.pin eq \T.pin){
\user.pin.set{\random{4}}\user.update;
\mail.user{New PIN code}{
Your new PIN code is \user.pin.
/Admin
}
}
};
\if(\T.email ne ""){\setcookie{RESEND}{\T.email}};
\redirect{\server\this\andarg};
}{
Don't understand "\T.cmd"
}
}
}
\def{page.logout}{}{
\setcookie{ID}{deleted}{1};
\resp.cont.type.charset{};
\redirect{\server/}
}
\def{layout}{}{
\if{\FRAMES}{
[cacheok=1;stat.X.CACHE=\days{14}];
\output{
\show.head;
<frameset rows="\calc.height,*,\HEIGHT.foot" border=0 scrolling=no onload="\killframes">
<frame scrolling=no name=head align=top src="/HEAD\uri\andarg">
<frame scrolling=auto name=body align=left src="/BODY\uri\andarg">
<frame scrolling=no name=foot align=bottom src="/FOOT\uri\andarg">
</frameset>
}
}{
\resp.cont.type.charset{};
\output{\show.head};
\page.header;
\output{<br><br>};
\show.page;
\output{<br><br>};
\page.footer
}
}
\def{show.latex}{x}{
\parse.public{\1}
}
|