diff options
author | Stefan Ritter <xeno@thehappy.de> | 2009-05-17 23:19:07 +0200 |
---|---|---|
committer | Stefan Ritter <xeno@thehappy.de> | 2009-05-17 23:19:07 +0200 |
commit | a38cb989fa843def08fd6d18bc301e62941aa63c (patch) | |
tree | 51dd490feee7ab1a309de477f59e24263e46ac17 /blogthon.cgi | |
parent | af872acbd30f49a6f1a96573b27072d2a4c11de4 (diff) |
Rewrite session Part 1
Diffstat (limited to 'blogthon.cgi')
-rwxr-xr-x | blogthon.cgi | 88 |
1 files changed, 59 insertions, 29 deletions
diff --git a/blogthon.cgi b/blogthon.cgi index bc246ab..4cdfe55 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -6,7 +6,8 @@ # To Public License, Version 2, as published by Sam Hocevar. See # http://sam.zoy.org/wtfpl/COPYING for more details. -# Author: Stefan Ritter <xeno@thehappy.de> +# Authors: Stefan Ritter <xeno@thehappy.de> +# Adrian Vondendriesch <disco-stu@disco-stu.de> # Description: A simple blogging software import cgi, os, time, glob, re, md5, sys, random @@ -190,6 +191,7 @@ if feed_display == "atom": # Generate regular page else: document_header("xhtml-transitional") + # XHTML Header print ' <head>' print ' <title>' + blog_title + '</title>' print ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />' @@ -198,65 +200,93 @@ else: print ' <link rel="stylesheet" type="text/css" href="styles/' + style + '" />' print ' </head>' print ' <body>' - print ' <div class="title"><a href="?" class="title">' + blog_title + '</a></div>' - print ' <div class="feeds">' - print ' <a href="?feed=rss"><img src="styles/images/rss.png" alt="rss" /></a>' - print ' <a href="?feed=atom"><img src="styles/images/atom.png" alt="atom" /></a>' + print '' + # Site header + print ' <div class="header">' + print ' <div class="header_title">' + print ' <a href="?" class="header_link">' + blog_title + '</a>' + print ' </div>' print ' </div>' + print '' + # RSS feed + print ' <div class="rss">' + if os.path.exists('styles/' + style.replace('.css', '') + '_img/rss.jpg'): + print ' <a href="?feed=rss"><img src="styles/' + style.replace('.css', '') + '_img/rss.jpg"></a>' + else: + print ' <a href="?feed=rss" class="rss_link">rss</a>' + print ' </div>' + print '' + # Atom feed + print ' <div class="atom">' + if os.path.exists('styles/' + style.replace('.css', '') + '_img/atom.jpg'): + print ' <a href="?feed=atom"><img src="styles/' + style.replace('.css', '') + '_img/atom.jpg></a>' + else: + print ' <a href="?feed=atom" class="atom_link">atom</a>' + print ' </div>' + print '' - print ' <div class="screen"><div class="sidebar">' - - # Sidebar: Staticpages + # Staticpages if staticpages == "True": staticpages = [] staticpages_list = glob.glob(staticpages_dir + '*') staticpages_list.sort() - print ' <div class="sidebarentry">' - print ' <small>pages</small><br />' + print ' <div class="pages">' + print ' <div class="pages_title">pages</div>' + print ' <div class="pages_list">' + print ' <ul class="pages_list">' for staticpage in staticpages_list: title = re.sub('\w+?\/\d+?-', '', staticpage) link = re.sub('\w+?\/', '', staticpage) - # The ultimative lookshe-hack *g* - if title == "lookshe": - print ' <a href="?s=' + link + '">/me</a> <br />' - else: - print ' <a href="?s=' + link + '">' + title + '</a> <br />' - - if monthlist == "True": print ' <br />' + print ' <li class="pages_list_entry"><a href="?s=' + link + '" class="pages_list_entry">' + title + '</a></li>' + print ' </ul>' print ' </div>' + print ' <div class="pages_footer"></div>' + print ' </div>' + print '' - # Sidebar: Monthlist + # Monthlist if monthlist == "True": olddate = "" - print ' <div class="sidebarentry">' - print ' <small>months</small><br />' + print ' <div class="months">' + print ' <div class="months_title">months</div>' + print ' <div class="months_list">' + print ' <ul class="months_list">' for entry in entries: date = time.strftime("%m%Y", entry[0]) date_display = time.strftime("%h %Y", entry[0]) if not olddate == date: - print ' <a href="?m=' + date + '">' + date_display + '</a> <br />' + print ' <li class="months_list_entry"><a href="?m=' + date + '" class="months_list_entry">' + date_display + '</a></li>' olddate = date - if linklist == "True": print ' <br />' + print ' </ul>' print ' </div>' + print ' <div class="months_footer"></div>' + print ' </div>' + print '' - # Sidebar: Linklist + # Linklist if linklist == "True": - print ' <div class="sidebarentry">' - print ' <small>links</small><br />' + print ' <div class="linklist">' + print ' <div class="linklist_title">links</div>' + print ' <div class="linklist_list">' + print ' <ul class="linklist_list">' try: content = open("linklist", "r") for line in content: if line.strip() is "": - print ' <br />' + print '' else: - print ' <a href="' + line.split(" ")[0] + '" target="_blank">' + line.split(" ", 1)[1].strip() + '</a> <br />' + print ' <li class="linklist_list_entry"><a href="' + line.split(" ")[0] + '" target="_blank" class="months_list_entry">' + line.split(" ", 1)[1].strip() + '</a></li>' content.close() except: - print ' <br />' + print '' + print ' </ul>' print ' </div>' + print ' <div class="linklist_footer"></div>' + print ' </div>' + print '' - print ' </div>' print ' <div class="content">' + print '<br><br><br><br><br><br><br>' if static_display != "": # Show Staticpage content = open(staticpages_dir + static_display, "r") |