From 25e7cc7a0964b0419b639faaade6580caf5fd64a Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Thu, 14 Jul 2011 12:12:43 +0200 Subject: * Add some comments * Parts of new comment mail now in blog_locale[] --- blogthon.cgi | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/blogthon.cgi b/blogthon.cgi index 5130e20..2457273 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -44,14 +44,16 @@ no_break = re.compile("^\s*(||||") @@ -67,6 +69,7 @@ def errorpage(string): print("") sys.exit() +# Header for html, atom and rss def document_header(string): if string == "html": print("Content-type: text/html\n") @@ -145,7 +148,19 @@ if not os.path.exists("linklist"): errorpage("File \"linklist\" does not exist!") if language == "de": - blog_locale = ("Seiten", "Monate", "Links", "Keine Kommentare", "Kommentare", "Alle Einträge anzeigen...", "Name", "Text", "Absenden") + blog_locale = ( + "Seiten", + "Monate", + "Links", + "Keine Kommentare", + "Kommentare", + "Alle Einträge anzeigen...", + "Name", + "Text", + "Absenden", + "Neuer Kommentar zu", + "Jemand hat einen Kommentar zu diesem Beitrag verfasst:" + ) locales_de = ("de_DE.UTF-8", "de_DE.@euro", "de_DE") for i in locales_de: try: @@ -157,7 +172,17 @@ if language == "de": locale.setlocale(locale.LC_TIME, None) else: - blog_locale = ("pages", "months", "links", "no comments", "comments", "View all entries...", "name", "text", "commit") + blog_locale = ( + "pages", + "months", + "links", + "no comments", + "comments", + "View all entries...", + "name", "text", + "commit", "New comment on", + "Someone wrote a comment to this entry:" + ) locales_en = ("en_US.UTF-8", "en_US.ISO-8859-15", "en_US") for i in locales_en: try: @@ -168,7 +193,7 @@ else: else: locale.setlocale(locale.LC_TIME, None) -# Read POST Variables +# Read POST variables action = FieldStorage() month_display = action.getvalue("m") @@ -198,7 +223,6 @@ if not allentries_display: if not feed_display: feed_display = "" -# Commentstuff ctitle = action.getvalue("ctitle") cname = action.getvalue("cname") ctext = action.getvalue("ctext") @@ -216,15 +240,14 @@ if not cquiz: if not cquizv: cquizv = "" -# Comment to commit? +# Commit comment if cname and ctext and ctitle: # Prevent XSS hacks cname = cname.replace("<", "<").replace(">", ">").replace("\'", """) ctext = ctext.replace("<", "<").replace(">", ">").replace("\'", """) - # Add comment if not cquiz == cquizv: - errorpage("Brainmode") + errorpage("Brainmode") # Captcha not solved else: comments_file = os.path.join(entries_dir, ctitle + ".comments") if not os.path.exists(comments_file): @@ -245,9 +268,9 @@ if cname and ctext and ctitle: content.write("." + line + "\n") content.close() - # Send mail? + # Send mail if not new_comment_mail == "False": - msg = "From: Blogthon\nTo: %s\nSubject: New comment on %s\n\nSomeone wrote a comment to this entry: %s?p=%s" % (mail_to, blog_title, blog_url, ctitle.replace(" ", "-")) + msg = "From: Blogthon\nTo: %s\nSubject: %s %s\n\n%s %s?p=%s" % (mail_to, blog_locale[9], blog_title, blog_locale[10], blog_url, ctitle.replace(" ", "-")) smtp = SMTP(smtp_host) smtp.starttls() smtp.sendmail(blog_title, mail_to, msg) -- cgit v1.2.3