2009-02-28 18:02:23 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
# This program is free software. It comes without any warranty, to
|
|
|
|
# the extent permitted by applicable law. You can redistribute it
|
|
|
|
# and/or modify it under the terms of the Do What The Fuck You Want
|
|
|
|
# To Public License, Version 2, as published by Sam Hocevar. See
|
|
|
|
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
|
|
|
|
2009-05-17 23:19:07 +02:00
|
|
|
# Authors: Stefan Ritter <xeno@thehappy.de>
|
|
|
|
# Adrian Vondendriesch <disco-stu@disco-stu.de>
|
2009-03-01 13:55:09 +01:00
|
|
|
# Description: A simple blogging software
|
|
|
|
|
2009-04-30 01:25:14 +02:00
|
|
|
import cgi, os, time, glob, re, md5, sys, random
|
2009-02-28 18:02:23 +01:00
|
|
|
import ConfigParser
|
|
|
|
|
2009-03-28 14:30:02 +01:00
|
|
|
def generate_uuid(string):
|
|
|
|
string_md5sum = md5.new(string).hexdigest()
|
|
|
|
string_md5sum_1 = string_md5sum[0:8]
|
|
|
|
string_md5sum_2 = string_md5sum[8:12]
|
|
|
|
string_md5sum_3 = string_md5sum[12:16]
|
|
|
|
string_md5sum_4 = string_md5sum[16:20]
|
|
|
|
string_md5sum_5 = string_md5sum[20:32]
|
|
|
|
string = string_md5sum_1 + '-' + string_md5sum_2 + '-' + string_md5sum_3 + '-' + string_md5sum_4 + '-' + string_md5sum_5
|
|
|
|
return string
|
|
|
|
|
2009-04-10 12:05:01 +02:00
|
|
|
def errorpage(string):
|
|
|
|
print 'Content-type: text/html\n'
|
|
|
|
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
|
|
|
|
print ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
|
|
|
|
print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'
|
|
|
|
print '<head>'
|
|
|
|
print ' <title>Error!</title>'
|
|
|
|
print '</head>'
|
|
|
|
print '<body>'
|
|
|
|
print ' <b>' + string + '</b> is not set in configuration, please check your installation!'
|
|
|
|
print '</body>'
|
|
|
|
print '</html>'
|
|
|
|
sys.exit()
|
2009-03-28 14:30:02 +01:00
|
|
|
|
2009-04-30 10:26:56 +02:00
|
|
|
def document_header(string):
|
|
|
|
if string == "xhtml-transitional":
|
|
|
|
print 'Content-type: text/html\n'
|
|
|
|
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
|
|
|
|
print ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
|
|
|
|
print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'
|
|
|
|
if string == "xhtml-strict":
|
|
|
|
print 'Content-type: text/html\n'
|
|
|
|
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
|
|
|
|
print ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
|
|
|
|
print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'
|
|
|
|
if string == "atom":
|
|
|
|
print 'Content-type: application/atom+xml\n'
|
|
|
|
print '<?xml version="1.0" encoding="utf-8"?>'
|
|
|
|
print '<feed xmlns="http://www.w3.org/2005/Atom">'
|
|
|
|
|
2009-02-28 18:02:23 +01:00
|
|
|
configuration = ConfigParser.ConfigParser()
|
|
|
|
configuration.read('configuration')
|
|
|
|
|
2009-04-10 12:05:01 +02:00
|
|
|
try: blog_title = configuration.get('personal', 'blog_title')
|
|
|
|
except: errorpage("blog_title")
|
|
|
|
try: blog_url = configuration.get('personal', 'blog_url')
|
|
|
|
except: errorpage("blog_url")
|
|
|
|
try: keywords = configuration.get('personal', 'keywords')
|
|
|
|
except: errorpage("keywords")
|
|
|
|
try: entries_dir = configuration.get('personal', 'entries_dir')
|
|
|
|
except: errorpage("entries_dir")
|
|
|
|
try: entries_suffix = configuration.get('personal', 'entries_suffix')
|
|
|
|
except: errorpage("entries_suffix")
|
|
|
|
try: staticpages_dir = configuration.get('personal', 'staticpages_dir')
|
|
|
|
except: errorpage("staticpages_dir")
|
|
|
|
try: style = configuration.get('look', 'style')
|
|
|
|
except: errorpage("style")
|
|
|
|
try: entries_per_page = configuration.getint('look', 'entries_per_page')
|
|
|
|
except: errorpage("entries_per_page")
|
|
|
|
try: monthlist = configuration.get('look', 'monthlist')
|
|
|
|
except: errorpage("monthlist")
|
|
|
|
try: staticpages = configuration.get('look', 'staticpages')
|
|
|
|
except: errorpage("staticpages")
|
|
|
|
try: linklist = configuration.get('look', 'linklist')
|
|
|
|
except: errorpage("linklist")
|
|
|
|
try: permalinks = configuration.get('look', 'permalinks')
|
|
|
|
except: errorpage("permalinks")
|
|
|
|
try: comments = configuration.get('look', 'comments')
|
|
|
|
except: errorpage("comments")
|
|
|
|
try: newest_first = configuration.get('look', 'newest_first')
|
|
|
|
except: errorpage("newest_first")
|
2009-02-28 18:02:23 +01:00
|
|
|
|
2009-03-28 14:30:02 +01:00
|
|
|
# Read POST Variables
|
2009-02-28 18:02:23 +01:00
|
|
|
action = cgi.FieldStorage()
|
|
|
|
month_display = action.getvalue('m')
|
|
|
|
post_display = action.getvalue('p')
|
|
|
|
static_display = action.getvalue('s')
|
2009-03-02 01:50:14 +01:00
|
|
|
allentries_display = action.getvalue('a')
|
2009-03-24 20:37:21 +01:00
|
|
|
feed_display = action.getvalue('feed')
|
2009-02-28 18:02:23 +01:00
|
|
|
if not month_display: month_display = ""
|
|
|
|
if not post_display: post_display = ""
|
|
|
|
if not static_display: static_display = ""
|
2009-03-02 01:50:14 +01:00
|
|
|
if not allentries_display: allentries_display = ""
|
2009-03-24 20:37:21 +01:00
|
|
|
if not feed_display: feed_display = ""
|
2009-02-28 18:02:23 +01:00
|
|
|
|
2009-03-08 19:17:59 +01:00
|
|
|
# Commentstuff
|
|
|
|
ctitle = action.getvalue('ctitle')
|
|
|
|
cname = action.getvalue('cname')
|
|
|
|
ctext = action.getvalue('ctext')
|
2009-04-30 01:25:14 +02:00
|
|
|
cquiz = action.getvalue('cquiz')
|
|
|
|
cquizv = action.getvalue('cquizv')
|
2009-03-08 19:17:59 +01:00
|
|
|
if not ctitle: ctitle = ""
|
|
|
|
if not cname: cname = ""
|
|
|
|
if not ctext: ctext = ""
|
2009-04-30 01:25:14 +02:00
|
|
|
if not cquiz: cquiz = ""
|
|
|
|
if not cquizv: cquizv = ""
|
2009-03-08 19:17:59 +01:00
|
|
|
|
|
|
|
# Comment to commit?
|
|
|
|
if cname and ctext and ctitle:
|
|
|
|
# Prevent XSS hacks
|
2009-03-09 16:17:15 +01:00
|
|
|
cname = cname.replace("<", "<") \
|
|
|
|
.replace(">", ">") \
|
|
|
|
.replace("\"", """)
|
|
|
|
ctext = ctext.replace("<", "<") \
|
|
|
|
.replace(">", ">") \
|
|
|
|
.replace("\"", """)
|
2009-03-08 19:17:59 +01:00
|
|
|
|
|
|
|
# Add comment
|
2009-04-30 01:25:14 +02:00
|
|
|
if not cquiz == cquizv:
|
|
|
|
errorpage("Brainmode")
|
|
|
|
else:
|
2009-03-08 19:39:52 +01:00
|
|
|
comments_file = glob.glob(entries_dir + ctitle + '.comments')
|
2009-04-30 01:25:14 +02:00
|
|
|
if not comments_file:
|
|
|
|
content = open(entries_dir + ctitle + '.comments', "w")
|
|
|
|
content.close()
|
|
|
|
comments_file = glob.glob(entries_dir + ctitle + '.comments')
|
|
|
|
content = open(comments_file[0], "a+")
|
|
|
|
content.write("-." + cname + "\n")
|
|
|
|
content.write("+." + time.asctime() + "\n")
|
|
|
|
ctext = ctext.split("\n")
|
|
|
|
for line in ctext:
|
|
|
|
content.write("." + line + "\n")
|
|
|
|
content.close()
|
2009-03-08 19:17:59 +01:00
|
|
|
|
2009-03-24 20:37:21 +01:00
|
|
|
# Read entries and store their title and timestamp
|
2009-02-28 18:02:23 +01:00
|
|
|
entries = []
|
|
|
|
entries_list = glob.glob(entries_dir + '*.' + entries_suffix)
|
|
|
|
|
|
|
|
for entry in entries_list:
|
|
|
|
timestamp = os.stat(entry)
|
|
|
|
timestamp = time.localtime(timestamp[8])
|
|
|
|
entry = timestamp, entry
|
|
|
|
entries.append(entry)
|
|
|
|
|
|
|
|
if newest_first:
|
|
|
|
entries.sort(reverse=True)
|
|
|
|
else:
|
|
|
|
entries.sort()
|
|
|
|
|
2009-03-24 20:37:21 +01:00
|
|
|
# Generate atom feed
|
|
|
|
if feed_display == "atom":
|
|
|
|
title = str(entries[0][1]).replace('entries/', '', 1).replace('.' + entries_suffix, '')
|
|
|
|
date = entries[0][0]
|
2009-03-28 14:30:02 +01:00
|
|
|
blog_title_md5sum = generate_uuid(blog_title)
|
|
|
|
title_md5sum = generate_uuid(title)
|
2009-03-24 20:37:21 +01:00
|
|
|
|
2009-04-30 13:40:39 +02:00
|
|
|
# Atom need a 2byte string
|
|
|
|
month = str(date[1])
|
|
|
|
day = str(date[2])
|
2009-05-02 04:01:13 +02:00
|
|
|
hour = str(date[3])
|
|
|
|
min = str(date[4])
|
|
|
|
sec = str(date[5])
|
2009-04-30 13:40:39 +02:00
|
|
|
if len(str(date[1])) == 1: month = '0' + str(date[1])
|
|
|
|
if len(str(date[2])) == 1: day = '0' + str(date[2])
|
2009-05-02 04:01:13 +02:00
|
|
|
if len(str(date[3])) == 1: hour = '0' + str(date[3])
|
|
|
|
if len(str(date[4])) == 1: min = '0' + str(date[4])
|
|
|
|
if len(str(date[5])) == 1: sec = '0' + str(date[5])
|
2009-04-30 13:40:39 +02:00
|
|
|
|
2009-04-30 10:26:56 +02:00
|
|
|
document_header("atom")
|
2009-04-08 21:50:54 +02:00
|
|
|
print '<link href="' + blog_url + '/?feed=atom" rel="self" type="application/atom+xml"/>'
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' <author>'
|
|
|
|
print ' <name>' + blog_title + '</name>'
|
|
|
|
print ' </author>'
|
|
|
|
print ' <title>' + blog_title + '</title>'
|
2009-03-28 14:30:02 +01:00
|
|
|
print ' <id>urn:uuid:' + blog_title_md5sum + '</id>'
|
2009-05-02 04:01:13 +02:00
|
|
|
print ' <updated>' + str(date[0]) + '-' + month + '-' + day + 'T' + hour + ':' + min + ':' + sec + 'Z</updated>'
|
2009-03-24 20:37:21 +01:00
|
|
|
print ''
|
|
|
|
print ' <entry>'
|
|
|
|
print ' <title>' + title + '</title>'
|
2009-04-08 21:50:54 +02:00
|
|
|
print ' <link href="' + blog_url + '"/>'
|
|
|
|
print ' <id>urn:uuid:' + title_md5sum + '</id>'
|
2009-05-02 04:01:13 +02:00
|
|
|
print ' <updated>' + str(date[0]) + '-' + month + '-' + day + 'T' + hour + ':' + min + ':' + sec + 'Z</updated>'
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' </entry>'
|
|
|
|
print '</feed>'
|
|
|
|
|
|
|
|
# Generate regular page
|
|
|
|
else:
|
2009-04-30 10:26:56 +02:00
|
|
|
document_header("xhtml-transitional")
|
2009-05-17 23:19:07 +02:00
|
|
|
# XHTML Header
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' <head>'
|
|
|
|
print ' <title>' + blog_title + '</title>'
|
|
|
|
print ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />'
|
|
|
|
print ' <meta name="keywords" content="' + keywords + '" />'
|
|
|
|
print ' <meta name="description" content="' + blog_title + '" />'
|
|
|
|
print ' <link rel="stylesheet" type="text/css" href="styles/' + style + '" />'
|
|
|
|
print ' </head>'
|
|
|
|
print ' <body>'
|
2009-05-17 23:19:07 +02:00
|
|
|
print ''
|
|
|
|
# Site header
|
|
|
|
print ' <div class="header">'
|
|
|
|
print ' <div class="header_title">'
|
|
|
|
print ' <a href="?" class="header_link">' + blog_title + '</a>'
|
|
|
|
print ' </div>'
|
2009-03-25 14:22:56 +01:00
|
|
|
print ' </div>'
|
2009-05-17 23:19:07 +02:00
|
|
|
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 ''
|
2009-03-24 20:37:21 +01:00
|
|
|
|
2009-05-17 23:19:07 +02:00
|
|
|
# Staticpages
|
2009-03-24 20:37:21 +01:00
|
|
|
if staticpages == "True":
|
|
|
|
staticpages = []
|
|
|
|
staticpages_list = glob.glob(staticpages_dir + '*')
|
|
|
|
staticpages_list.sort()
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' <div class="pages">'
|
|
|
|
print ' <div class="pages_title">pages</div>'
|
|
|
|
print ' <div class="pages_list">'
|
|
|
|
print ' <ul class="pages_list">'
|
2009-03-24 20:37:21 +01:00
|
|
|
for staticpage in staticpages_list:
|
|
|
|
title = re.sub('\w+?\/\d+?-', '', staticpage)
|
|
|
|
link = re.sub('\w+?\/', '', staticpage)
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' <li class="pages_list_entry"><a href="?s=' + link + '" class="pages_list_entry">' + title + '</a></li>'
|
|
|
|
print ' </ul>'
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' </div>'
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' <div class="pages_footer"></div>'
|
|
|
|
print ' </div>'
|
|
|
|
print ''
|
2009-03-24 20:37:21 +01:00
|
|
|
|
2009-05-17 23:19:07 +02:00
|
|
|
# Monthlist
|
2009-03-24 20:37:21 +01:00
|
|
|
if monthlist == "True":
|
|
|
|
olddate = ""
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' <div class="months">'
|
|
|
|
print ' <div class="months_title">months</div>'
|
|
|
|
print ' <div class="months_list">'
|
|
|
|
print ' <ul class="months_list">'
|
2009-03-24 20:37:21 +01:00
|
|
|
for entry in entries:
|
|
|
|
date = time.strftime("%m%Y", entry[0])
|
|
|
|
date_display = time.strftime("%h %Y", entry[0])
|
|
|
|
if not olddate == date:
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' <li class="months_list_entry"><a href="?m=' + date + '" class="months_list_entry">' + date_display + '</a></li>'
|
2009-03-24 20:37:21 +01:00
|
|
|
olddate = date
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' </ul>'
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' </div>'
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' <div class="months_footer"></div>'
|
|
|
|
print ' </div>'
|
|
|
|
print ''
|
2009-03-24 20:37:21 +01:00
|
|
|
|
2009-05-17 23:19:07 +02:00
|
|
|
# Linklist
|
2009-03-24 20:37:21 +01:00
|
|
|
if linklist == "True":
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' <div class="linklist">'
|
|
|
|
print ' <div class="linklist_title">links</div>'
|
|
|
|
print ' <div class="linklist_list">'
|
|
|
|
print ' <ul class="linklist_list">'
|
2009-05-14 10:23:42 +02:00
|
|
|
try:
|
|
|
|
content = open("linklist", "r")
|
|
|
|
for line in content:
|
|
|
|
if line.strip() is "":
|
2009-05-17 23:19:07 +02:00
|
|
|
print ''
|
2009-05-14 10:23:42 +02:00
|
|
|
else:
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' <li class="linklist_list_entry"><a href="' + line.split(" ")[0] + '" target="_blank" class="months_list_entry">' + line.split(" ", 1)[1].strip() + '</a></li>'
|
2009-05-14 10:23:42 +02:00
|
|
|
content.close()
|
|
|
|
except:
|
2009-05-17 23:19:07 +02:00
|
|
|
print ''
|
|
|
|
print ' </ul>'
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' </div>'
|
2009-05-17 23:19:07 +02:00
|
|
|
print ' <div class="linklist_footer"></div>'
|
|
|
|
print ' </div>'
|
|
|
|
print ''
|
2009-03-24 20:37:21 +01:00
|
|
|
|
|
|
|
print ' <div class="content">'
|
2009-05-17 23:19:07 +02:00
|
|
|
print '<br><br><br><br><br><br><br>'
|
2009-03-24 20:37:21 +01:00
|
|
|
|
|
|
|
if static_display != "": # Show Staticpage
|
|
|
|
content = open(staticpages_dir + static_display, "r")
|
|
|
|
print ' <div class="entrytitle">' + re.sub('\d+?-', '', static_display) + '</div>'
|
|
|
|
print ' <div class="entry"><p>'
|
|
|
|
for line in content:
|
|
|
|
print ' ' + line.strip() + '<br />'
|
|
|
|
print ' </p></div>'
|
|
|
|
content.close()
|
|
|
|
else: # Show regular entry
|
|
|
|
entry_counter = 0
|
|
|
|
for entry in entries:
|
|
|
|
date = time.strftime("%c", entry[0])
|
|
|
|
date_to_compare = time.strftime("%m%Y", entry[0]) # Needed for permalinks
|
|
|
|
entry = entry[1]
|
|
|
|
title = entry.replace('entries/', '', 1)
|
|
|
|
title = title.replace('.' + entries_suffix, '')
|
|
|
|
|
|
|
|
if month_display == date_to_compare or not month_display:
|
|
|
|
if post_display == title or not post_display:
|
|
|
|
if allentries_display == "1" or entry_counter < entries_per_page:
|
|
|
|
content = open(entry, "r")
|
2009-04-30 01:25:14 +02:00
|
|
|
if permalinks:
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' <div class="entrytitle"><a href="?p=' + title + '" class="entrytitle">' + title + ' <small>(' + date + ')</small></a></div>'
|
2009-04-30 01:25:14 +02:00
|
|
|
else:
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' <div class="entrytitle">' + title + ' <small>(' + date + ')</small></div>'
|
|
|
|
print ' <div class="entry">'
|
|
|
|
for line in content:
|
|
|
|
print ' ' + line.strip() + '<br />'
|
|
|
|
|
|
|
|
# Comments are shown when post_display and comments_file
|
2009-03-03 18:43:37 +01:00
|
|
|
comments_file = glob.glob(entries_dir + title + '.comments')
|
2009-03-24 20:37:21 +01:00
|
|
|
if post_display:
|
|
|
|
if comments_file:
|
|
|
|
print ' <br /><hr />'
|
|
|
|
comments_file = glob.glob(entries_dir + title + '.comments')
|
|
|
|
comments_content = open(comments_file[0], "r")
|
|
|
|
for line in comments_content:
|
|
|
|
if line.split(".", 1)[0] == "-":
|
|
|
|
print ' <br />'
|
|
|
|
print ' <b><i>' + line.split(".", 1)[1].strip() + '</i><small> wrote at '
|
|
|
|
elif line.split(".", 1)[0] == "+":
|
|
|
|
print ' ' + line.split(".", 1)[1].strip() + ':</small></b><br />'
|
|
|
|
else:
|
|
|
|
line = line.split(".", 1)[1]
|
|
|
|
print ' ' + line.strip() + '<br />'
|
|
|
|
comments_content.close()
|
|
|
|
|
|
|
|
# Form for adding comments
|
2009-04-30 01:25:14 +02:00
|
|
|
random_int_a = random.randint(1,9)
|
|
|
|
random_int_b = random.randint(1,9)
|
|
|
|
cquizv = random_int_a + random_int_b
|
|
|
|
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' <br /><br /><br />'
|
|
|
|
print ' <form action="" method="post">'
|
|
|
|
print ' <input type="hidden" name="ctitle" value="' + title + '" />'
|
2009-04-30 01:25:14 +02:00
|
|
|
print ' <input type="hidden" name="cquizv" value="' + str(cquizv) + '" />'
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' <label for="cname">name:</label><input type="text" id="cname" name="cname" />'
|
|
|
|
print ' <br /><label for="ctext">text:</label><textarea rows="5" cols="80" id="ctext" name="ctext"></textarea>'
|
2009-04-30 01:25:14 +02:00
|
|
|
print ' <br /><label for="cquiz">' + str(random_int_a) + '+' + str(random_int_b) + '=</label><input type="text" id="cquiz" name="cquiz" />'
|
2009-03-24 20:37:21 +01:00
|
|
|
print ' <br /><input type="submit" id="submit" value="post comment" />'
|
|
|
|
print ' </form>'
|
|
|
|
|
|
|
|
if comments == "True":
|
|
|
|
comments_file = glob.glob(entries_dir + title + '.comments')
|
|
|
|
if not comments_file and not post_display:
|
|
|
|
print ' <div class="comment">'
|
|
|
|
print ' <ul><li><a href="?p=' + title + '" class="comment">no comments</a></li></ul>'
|
|
|
|
print ' </div>'
|
|
|
|
elif comments_file and not post_display:
|
|
|
|
comments_content = open(comments_file[0], "r")
|
|
|
|
comments_counter = 0
|
|
|
|
for line in comments_content:
|
|
|
|
if line.split(".", 1)[0] == "-": comments_counter += 1
|
|
|
|
print ' <div class="comment">'
|
|
|
|
print ' <ul><li><a href="?p=' + title + '" class="comment">comments (' + str(comments_counter) + ')</a></li></ul>'
|
|
|
|
print ' </div>'
|
|
|
|
comments_content.close()
|
|
|
|
|
|
|
|
print ' </div>'
|
|
|
|
print ' <br /><br />'
|
|
|
|
content.close()
|
|
|
|
entry_counter += 1
|
|
|
|
|
|
|
|
if not month_display and not post_display and not allentries_display and entry_counter == entries_per_page: # Display pagelist
|
|
|
|
print ' <div class="entry"><a href=?a=1>View all entries...</a></div>'
|
|
|
|
|
|
|
|
print ' </div></div>'
|
|
|
|
print ' </body>'
|
|
|
|
print '</html>'
|
2009-02-28 18:02:23 +01:00
|
|
|
|
|
|
|
# vim: set tw=0 ts=4:
|