bugfix + also check the titles of new polls

This commit is contained in:
phear 2013-02-23 13:31:17 +00:00
parent ae791b40e5
commit dd00012758

View file

@ -578,8 +578,11 @@ def is_spam_submitter_name(name, errors_dict):
(len(name) >= 8) and (not name.startswith(upper_text)):
errors_dict["submitter"] = "Spam-Verdacht: bitte den Namen korrigieren"
return True
else:
return False
if check_spam_content(name) == True:
return True
return False
def count_urls(text):
hits = re.findall(r"(\swww\.|http://|https://)", text)
@ -596,9 +599,10 @@ def check_spam_content(text):
"vigrx", "viagra", "vimax", "xanax",
"Electronic cigarette", "online blackjack", "Online Bingo",
"Online casino", "online gambling", "Online roulette", "roulette online",
"poker online", "payday loans", "pokies", "reverse phone", "preteen", "lolitas")
"poker online", "payday loans", "pokies", "reverse phone",
"preteen", "lolitas", "lolita", "teen nude")
for keyword in blacklist:
if keyword.lower() in text.lower):
if keyword.lower() in text.lower():
return True
return False
@ -752,6 +756,8 @@ def new_poll(bobo_request, submit=None, cancel=None, author=None, title=None,
data = forms.PollForm.to_python(data)
except formencode.Invalid, errors_packed:
errors = errors_packed.unpack_errors()
if check_spam_content(title):
return bobo.redirect(BASE_DICT["base_url"])
if errors:
if not hide_errors:
value_dict["errors"] = errors