-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paththread.cgi
executable file
·47 lines (39 loc) · 899 Bytes
/
thread.cgi
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
#!/bin/bash
. ./config
. ./param.sh
. ./admins.sh
. ./threads.sh
. ./html.sh
thid=${QUERY_STRING/[^0-9]//g}
if [ -z "$thid" ] || [ ! -d "$THREAD_DIR/$thid" ]; then
echo "Status: 404 Not Found"
echo "Content-Type: text-plain"
echo
html_page <<EOF
<h1>Thread Not Found</h1>
<p>Sorry, I can't seem to find that thread.</p>
EOF
exit
fi
echo "Content-Type: text/html"
echo
html_page "Thread $thid – $SITE_TITLE" <<EOF
<h1>Thread $thid</h1>
$(ban_notice)
<a href="$INDEX_URL">Back to thread list</a>
<h2>Posts</h2>
$(
for post in $(list_posts "$thid"); do
post_html "$thid" "$post"
done
)
<h2>New Post</h2>
<form method="POST" action="$URL_ROOT/new-post.cgi">
Type your post below and press post.
<br/>
<input type="hidden" name="thread" value="$thid">
<textarea name="content"></textarea>
<br/>
<input type="submit" value="Post">
</form>
EOF