aboutsummaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
authorLibravatar junk 2021-04-28 17:45:05 -0400
committerLibravatar junk 2021-04-28 21:56:38 -0400
commitd91ff2e857cb697b69812de017a32032b2ac0db9 (patch)
tree616382ba1108a9ef0d053eb436c0c8c95dceeafc /cgi
parent3961268744867949766239f8d3bd7a4f97cbb0c1 (diff)
downloadweabot-d91ff2e857cb697b69812de017a32032b2ac0db9.tar.gz
weabot-d91ff2e857cb697b69812de017a32032b2ac0db9.tar.xz
weabot-d91ff2e857cb697b69812de017a32032b2ac0db9.zip
Prohibido Tor (2)
Diffstat (limited to 'cgi')
-rw-r--r--cgi/formatting.py5
-rwxr-xr-xcgi/weabot.py17
2 files changed, 9 insertions, 13 deletions
diff --git a/cgi/formatting.py b/cgi/formatting.py
index 47922c9..ead1d0f 100644
--- a/cgi/formatting.py
+++ b/cgi/formatting.py
@@ -47,9 +47,10 @@ def format_post(message, ip, parentid, parent_timestamp=0):
# If not using markdown quotes must be created and \n changed for HTML line breaks
if not using_markdown:
- message = re.compile(r"^(\n)+").sub('', message)
- message = checkQuotes(message)
+ message = re.compile(r"^[\s\t]*(\n)+").sub("", message)
+ message = re.compile(r"\n(\n)+").sub("<br /><br />", message)
message = message.replace("\n", "<br />")
+ message = checkQuotes(message)
return message
diff --git a/cgi/weabot.py b/cgi/weabot.py
index a54fd2b..194339f 100755
--- a/cgi/weabot.py
+++ b/cgi/weabot.py
@@ -405,8 +405,6 @@ class weabot(object):
if hostIsBanned(ip):
raise UserError, "Sufijo de host en lista negra."
- if addressIsTor(ip):
- raise UserError, "Proxy prohibido."
# open database
OpenDb()
@@ -414,9 +412,9 @@ class weabot(object):
# set the board
board = setBoard(boarddir)
- if board["dir"] not in ["world"]:
- if addressIsProxy(ip) or addressIsBannedCountry(ip) or not addressIsES(ip):
- raise UserError, "Proxy prohibido en esta sección."
+ if board["dir"] not in Settings.EXCLUDE_GLOBAL_BANS:
+ if addressIsTor(ip) or addressIsProxy(ip) or addressIsBannedCountry(ip) or not addressIsES(ip):
+ raise UserError, "Proxy prohibido."
# check length of fields
if len(name) > 50:
@@ -438,8 +436,7 @@ class weabot(object):
t = time.time()
# Delete expired bans
- deletedBans = UpdateDb(
- "DELETE FROM `bans` WHERE `until` != 0 AND `until` < " + str(timestamp()))
+ deletedBans = UpdateDb("DELETE FROM `bans` WHERE `until` != 0 AND `until` < " + str(timestamp()))
if deletedBans > 0:
regenerateAccess()
@@ -449,8 +446,7 @@ class weabot(object):
# Disallow posting if the site OR board is in maintenance
if Settings.MAINTENANCE and board["dir"] != 'polka':
- raise UserError, _(
- "%s is currently under maintenance. We'll be back.") % Settings.SITE_TITLE
+ raise UserError, _("%s is currently under maintenance. We'll be back.") % Settings.SITE_TITLE
if board["locked"] == '1':
raise UserError, _("This board is closed. You can't post in it.")
@@ -469,8 +465,7 @@ class weabot(object):
post["parentid"] = parent_post['id']
post["bumped"] = parent_post['bumped']
if parent_post['locked'] == '1':
- raise UserError, _(
- "The thread is closed. You can't post in it.")
+ raise UserError, _("The thread is closed. You can't post in it.")
# check if the user is flooding
flood_check(t, post, board["id"])