From d62b62874b6735cc5aa93b5e057c489e468610b6 Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Thu, 30 Apr 2009 01:25:14 +0200 Subject: Spam: * Removed blacklist * Added an addition to solve before adding a comment --- blacklist | 3 --- blogthon.cgi | 43 +++++++++++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 19 deletions(-) delete mode 100644 blacklist diff --git a/blacklist b/blacklist deleted file mode 100644 index b2ef86d..0000000 --- a/blacklist +++ /dev/null @@ -1,3 +0,0 @@ -viagra -sex tape -penis enlargement diff --git a/blogthon.cgi b/blogthon.cgi index 14dafdb..f5d68d1 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -9,7 +9,7 @@ # Author: Stefan Ritter # Description: A simple blogging software -import cgi, os, time, glob, re, md5, sys +import cgi, os, time, glob, re, md5, sys, random import ConfigParser def generate_uuid(string): @@ -85,9 +85,13 @@ if not feed_display: feed_display = "" ctitle = action.getvalue('ctitle') cname = action.getvalue('cname') ctext = action.getvalue('ctext') +cquiz = action.getvalue('cquiz') +cquizv = action.getvalue('cquizv') if not ctitle: ctitle = "" if not cname: cname = "" if not ctext: ctext = "" +if not cquiz: cquiz = "" +if not cquizv: cquizv = "" # Comment to commit? if cname and ctext and ctitle: @@ -99,21 +103,22 @@ if cname and ctext and ctitle: .replace(">", ">") \ .replace("\"", """) - # TODO: Read file with spam words - # Add comment - comments_file = glob.glob(entries_dir + ctitle + '.comments') - if not comments_file: - content = open(entries_dir + ctitle + '.comments', "w") - content.close() + if not cquiz == cquizv: + errorpage("Brainmode") + else: 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() + 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() # Read entries and store their title and timestamp entries = [] @@ -249,9 +254,9 @@ else: if post_display == title or not post_display: if allentries_display == "1" or entry_counter < entries_per_page: content = open(entry, "r") - if permalinks: # Title as permalink... + if permalinks: print ' ' - else: # ... or not + else: print '
' + title + ' (' + date + ')
' print '
' for line in content: @@ -276,11 +281,17 @@ else: comments_content.close() # Form for adding comments + random_int_a = random.randint(1,9) + random_int_b = random.randint(1,9) + cquizv = random_int_a + random_int_b + print '


' print '
' print ' ' + print ' ' print ' ' print '
' + print '
' print '
' print '
' -- cgit v1.2.3