summaryrefslogtreecommitdiff
path: root/cgi-bin/nest.py
diff options
context:
space:
mode:
Diffstat (limited to 'cgi-bin/nest.py')
-rwxr-xr-xcgi-bin/nest.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/cgi-bin/nest.py b/cgi-bin/nest.py
new file mode 100755
index 0000000..a2080ee
--- /dev/null
+++ b/cgi-bin/nest.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+# -*- coding: utf8 -*-
+
+import cgi, cgitb, re, display, config
+
+print ("Content-Type: text/html")
+print ("")
+# Enable CGI debugging
+cgitb.enable()
+
+query = cgi.FieldStorage()
+param = query.getvalue("f")
+page = query.getvalue("p")
+
+print ("<!DOCTYPE html>")
+print ("<html>")
+print ("<head>")
+print ("<meta charset=\"UTF-8\">")
+print ("<title>HnĂ­zdo</title>")
+print ("<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/style.css\">")
+print ("</head>")
+print ("<body>")
+
+if param == "latest":
+ body=display.Body("latest", "")
+if param == "index":
+ if re.match("^[0-9]+$", str(page)):
+ body=display.Body("index", str(page))
+ else:
+ body=display.Body("index", "0")
+elif re.match("^20[0-9]{2}(0[0-9]|1[1-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])([0-5][0-9])$", str(param)):
+ body=display.Body(param, "")
+else:
+ body=display.Body("latest", "")
+
+body.page()
+
+print("</body>")
+print("</html>")