Spam:
* Removed blacklist * Added an addition to solve before adding a comment
This commit is contained in:
parent
d82a5f6347
commit
d62b62874b
21
blogthon.cgi
21
blogthon.cgi
@ -9,7 +9,7 @@
|
|||||||
# Author: Stefan Ritter <xeno@thehappy.de>
|
# Author: Stefan Ritter <xeno@thehappy.de>
|
||||||
# Description: A simple blogging software
|
# Description: A simple blogging software
|
||||||
|
|
||||||
import cgi, os, time, glob, re, md5, sys
|
import cgi, os, time, glob, re, md5, sys, random
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
|
||||||
def generate_uuid(string):
|
def generate_uuid(string):
|
||||||
@ -85,9 +85,13 @@ if not feed_display: feed_display = ""
|
|||||||
ctitle = action.getvalue('ctitle')
|
ctitle = action.getvalue('ctitle')
|
||||||
cname = action.getvalue('cname')
|
cname = action.getvalue('cname')
|
||||||
ctext = action.getvalue('ctext')
|
ctext = action.getvalue('ctext')
|
||||||
|
cquiz = action.getvalue('cquiz')
|
||||||
|
cquizv = action.getvalue('cquizv')
|
||||||
if not ctitle: ctitle = ""
|
if not ctitle: ctitle = ""
|
||||||
if not cname: cname = ""
|
if not cname: cname = ""
|
||||||
if not ctext: ctext = ""
|
if not ctext: ctext = ""
|
||||||
|
if not cquiz: cquiz = ""
|
||||||
|
if not cquizv: cquizv = ""
|
||||||
|
|
||||||
# Comment to commit?
|
# Comment to commit?
|
||||||
if cname and ctext and ctitle:
|
if cname and ctext and ctitle:
|
||||||
@ -99,9 +103,10 @@ if cname and ctext and ctitle:
|
|||||||
.replace(">", ">") \
|
.replace(">", ">") \
|
||||||
.replace("\"", """)
|
.replace("\"", """)
|
||||||
|
|
||||||
# TODO: Read file with spam words
|
|
||||||
|
|
||||||
# Add comment
|
# Add comment
|
||||||
|
if not cquiz == cquizv:
|
||||||
|
errorpage("Brainmode")
|
||||||
|
else:
|
||||||
comments_file = glob.glob(entries_dir + ctitle + '.comments')
|
comments_file = glob.glob(entries_dir + ctitle + '.comments')
|
||||||
if not comments_file:
|
if not comments_file:
|
||||||
content = open(entries_dir + ctitle + '.comments', "w")
|
content = open(entries_dir + ctitle + '.comments', "w")
|
||||||
@ -249,9 +254,9 @@ else:
|
|||||||
if post_display == title or not post_display:
|
if post_display == title or not post_display:
|
||||||
if allentries_display == "1" or entry_counter < entries_per_page:
|
if allentries_display == "1" or entry_counter < entries_per_page:
|
||||||
content = open(entry, "r")
|
content = open(entry, "r")
|
||||||
if permalinks: # Title as permalink...
|
if permalinks:
|
||||||
print ' <div class="entrytitle"><a href="?p=' + title + '" class="entrytitle">' + title + ' <small>(' + date + ')</small></a></div>'
|
print ' <div class="entrytitle"><a href="?p=' + title + '" class="entrytitle">' + title + ' <small>(' + date + ')</small></a></div>'
|
||||||
else: # ... or not
|
else:
|
||||||
print ' <div class="entrytitle">' + title + ' <small>(' + date + ')</small></div>'
|
print ' <div class="entrytitle">' + title + ' <small>(' + date + ')</small></div>'
|
||||||
print ' <div class="entry">'
|
print ' <div class="entry">'
|
||||||
for line in content:
|
for line in content:
|
||||||
@ -276,11 +281,17 @@ else:
|
|||||||
comments_content.close()
|
comments_content.close()
|
||||||
|
|
||||||
# Form for adding comments
|
# 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 ' <br /><br /><br />'
|
print ' <br /><br /><br />'
|
||||||
print ' <form action="" method="post">'
|
print ' <form action="" method="post">'
|
||||||
print ' <input type="hidden" name="ctitle" value="' + title + '" />'
|
print ' <input type="hidden" name="ctitle" value="' + title + '" />'
|
||||||
|
print ' <input type="hidden" name="cquizv" value="' + str(cquizv) + '" />'
|
||||||
print ' <label for="cname">name:</label><input type="text" id="cname" name="cname" />'
|
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>'
|
print ' <br /><label for="ctext">text:</label><textarea rows="5" cols="80" id="ctext" name="ctext"></textarea>'
|
||||||
|
print ' <br /><label for="cquiz">' + str(random_int_a) + '+' + str(random_int_b) + '=</label><input type="text" id="cquiz" name="cquiz" />'
|
||||||
print ' <br /><input type="submit" id="submit" value="post comment" />'
|
print ' <br /><input type="submit" id="submit" value="post comment" />'
|
||||||
print ' </form>'
|
print ' </form>'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user