aboutsummaryrefslogtreecommitdiff
path: root/cgi/weabot.py
diff options
context:
space:
mode:
Diffstat (limited to 'cgi/weabot.py')
-rwxr-xr-xcgi/weabot.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/cgi/weabot.py b/cgi/weabot.py
index 1406707..0f59654 100755
--- a/cgi/weabot.py
+++ b/cgi/weabot.py
@@ -323,9 +323,8 @@ class weabot(object):
self.output += '<html xmlns="http://www.w3.org/1999/xhtml"><meta http-equiv="refresh" content="0;url=%s" /><body><p>...</p></body></html>' % url
elif path_split[1] == "banned":
OpenDb()
- packed_ip = inet_aton(self.environ["REMOTE_ADDR"])
- bans = FetchAll("SELECT * FROM `bans` WHERE (`netmask` IS NULL AND `ip` = '"+str(
- packed_ip)+"') OR (`netmask` IS NOT NULL AND '"+str(packed_ip)+"' & `netmask` = `ip`)")
+ packed_ip = self.environ["REMOTE_ADDR"]
+ bans = FetchAll("SELECT * FROM `bans` WHERE `ip` = INET6_ATON('"+str(packed_ip)+"')")
if bans:
for ban in bans:
if ban["boards"] != "":
@@ -385,7 +384,7 @@ class weabot(object):
def make_post(self, ip, boarddir, parent, trap1, trap2, name, email, subject, message, file, file_original, spoil, oek_file, password, noimage, mobile):
_STARTTIME = time.clock() # Comment if not debug
- if addressIsUS(ip):
+ if hostIsBanned(ip):
raise UserError, "Host en lista negra."
# open database
@@ -429,7 +428,7 @@ class weabot(object):
raise UserError, '<meta http-equiv="refresh" content="0; url=/cgi/banned/%s">' % board["dir"]
# Disallow posting if the site OR board is in maintenance
- if Settings.MAINTENANCE:
+ if Settings.MAINTENANCE and board["dir"] != 'polka':
raise UserError, _(
"%s is currently under maintenance. We'll be back.") % Settings.SITE_TITLE
if board["locked"] == '1':
@@ -437,7 +436,7 @@ class weabot(object):
# create post object
post = Post(board["id"])
- post["ip"] = inet_aton(ip)
+ post["ip"] = ip
post["timestamp"] = post["bumped"] = int(t)
post["timestamp_formatted"] = formatTimestamp(t)
@@ -519,7 +518,7 @@ class weabot(object):
post["name"] = post["name"].replace('◆', '◇')
# process capcodes
- cap_id = hide_end = None
+ cap_id = hide_end = use_icon = None
if post["name"] in Settings.CAPCODES:
capcode = Settings.CAPCODES[post["name"]]
if post["tripcode"] == (Settings.TRIP_CHAR + capcode[0]):
@@ -530,12 +529,17 @@ class weabot(object):
# post["name"] = post["tripcode"] = ''
# post["message"] = ('[<span style="color:red">%s</span>]<br />' % capcode[2]) + post["message"]
- cap_id, hide_end = capcode[3], capcode[4]
+ cap_id, hide_end, use_icon = capcode[3], capcode[4], capcode[5]
# hide ip if necessary
if hide_end:
post["ip"] = 0
+ # insert icon
+ if use_icon:
+ img_src = '<img src="%s" alt="ico" /><br />' % use_icon
+ post["message"] = img_src + post["message"]
+
# use password
post["password"] = password
@@ -964,7 +968,7 @@ class weabot(object):
message = cgi.escape(self.formdata["reason"]).strip()[0:8000]
message = message.replace("\n", "<br />")
- UpdateDb("INSERT INTO `reports` (board, postid, parentid, link, ip, reason, reporterip, timestamp, timestamp_formatted) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')" % (
+ UpdateDb("INSERT INTO `reports` (board, postid, parentid, link, ip, reason, reporterip, timestamp, timestamp_formatted) VALUES ('%s', '%s', '%s', '%s', INET6_ATON('%s'), '%s', INET6_ATON('%s'), '%s', '%s')" % (
board["dir"], post['id'], post['parentid'], link, post['ip'], _mysql.escape_string(message), _mysql.escape_string(self.environ["REMOTE_ADDR"]), str(t), formatTimestamp(t)))
self.output = renderTemplate("report.html", {'finished': True})