Mercurial > hg > Blog
changeset 39:e6872b8d42e2
do not genereate captchas: the comments script sends comment notification mails now
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Tue, 30 Sep 2014 03:30:03 +0200 |
parents | 96084c11584a (diff) ee16c7218357 (current diff) |
children | 74d42171a531 |
files | pelicanconf.py |
diffstat | 4 files changed, 63 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pelicanconf.py Thu Aug 21 17:39:35 2014 +0200 +++ b/pelicanconf.py Tue Sep 30 03:30:03 2014 +0200 @@ -10,8 +10,9 @@ TIMEZONE = 'Europe/Berlin' TYPOGRIFY = True -PLUGIN_PATHS = [ '../simple_comments' ] -PLUGINS = [ 'simple_comments', 'pelicaptcha' ] +PLUGIN_PATHS = ['../simple_comments'] +#PLUGINS = ['simple_comments', 'pelicaptcha'] +PLUGINS = ['simple_comments'] # simple_comments plugin config COMMENT_PATH = 'comments'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/staged_content/suspend-to-disk-gentoo.md Tue Sep 30 03:30:03 2014 +0200 @@ -0,0 +1,10 @@ +Title: Suspend to disk with a swapfile on Gentoo +Date: 2014-09-01 +Lang: en + +Links: +[Gentoo's wiki page on a custom initramfs](http://wiki.gentoo.org/wiki/Custom_Initramfs) +[Entry on the Ubuntu forums that explains how to setup hibernate with a swap file](http://ubuntuforums.org/showthread.php?t=1042946) +[Slackware documentation on hibernate with a swapfile](http://docs.slackware.com/howtos:slackware_admin:swapfile_hibernation) +https://raw.githubusercontent.com/alonbl/gentoo-wiki-alonbl/master/wiki/Userspace_software_suspend.wiki +http://forums.gentoo.org/viewtopic-t-960952-highlight-hibernate+swapfile.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/submit_comment.php Tue Sep 30 03:30:03 2014 +0200 @@ -0,0 +1,45 @@ +<?php +function get_slug() +{ + $slug = htmlspecialchars($_POST['Slug']); + if (empty($slug)) + { + die('POST request did not include value for required key "Slug"'); + } + return $slug; +} + +if ($_SERVER['REQUEST_METHOD'] == 'POST') +{ + $recipient = 'blog@xanthippe.ping.de'; + $slug = get_slug(); + + $author = htmlspecialchars($_POST['Author']); + $comment = htmlspecialchars($_POST['Comment']); + $date = date('Y-m-d H:i:s'); + + $message = 'Author: ' . $author . PHP_EOL + . 'Date: ' . $date . PHP_EOL . PHP_EOL + . $comment; + + $subject = 'New blog post comment on article ' . $slug; + mail($recipient, $subject, $message); + +?> + +<html> + <head> + <title>Your comment was posted</title> + </head> + <body> + <h1>Thank you</h1> + <p> + Your comment was posted and will appear on the blog as soon as a moderator has reviewed it. + </p> + <a href="http://xanthippe.duckdns.org/blog/">Back to the blog</a> + </body> +</html> + +<?php +} +?>
--- a/themes/tuxlite_tbs/templates/simple_comments.html Thu Aug 21 17:39:35 2014 +0200 +++ b/themes/tuxlite_tbs/templates/simple_comments.html Tue Sep 30 03:30:03 2014 +0200 @@ -18,7 +18,10 @@ <div style="font-size: 120%;"> Leave a comment </div> +{% if False %} <form action="http://xanthippe.duckdns.org/blog-comments/simple_comments.php" method="POST"> +{% endif %} + <form action="http://xanthippe.duckdns.org/blog-comments/submit_comment.php" method="POST"> <input type="hidden" name="Slug" value="{{ article.slug }}"> <table style="padding: 10px 0px 0px 0px;"> <tr> @@ -37,6 +40,7 @@ <textarea rows="5" cols="60" name="Comment"></textarea> </td> </tr> +{% if False %} <tr> <td colspan="2"> Please type the characters you see in this image: @@ -51,6 +55,7 @@ <input type="text" name="Challenge"> </td> </tr> +{% endif %} <tr> <td> <input type="submit" value="Submit">