From 04efea1833c5f2ae910e85d2616119f102c01e35 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 8 Sep 2012 17:54:56 +0000 Subject: fix time format and commentar submission mail notification --- index.cgi | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'index.cgi') diff --git a/index.cgi b/index.cgi index 28a0737..d4569aa 100755 --- a/index.cgi +++ b/index.cgi @@ -138,7 +138,7 @@ sub output_rss { description => $item->{'body'}, author => $item->{'author'}, comments => "${link}#comments", - pubDate => POSIX::strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime($item->{'epoch'})), + pubDate => POSIX::strftime("%a, %d %b %Y %H:%M:%S %z (%Z)", gmtime($item->{'epoch'})), category => @{[split(/, */, $item->{'tags'})]}, ); } else { @@ -149,7 +149,7 @@ sub output_rss { dc => { subject => $blog_title, creator => $item->{'author'}, - date => POSIX::strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime($item->{'epoch'})), + date => POSIX::strftime("%a, %d %b %Y %H:%M:%S %z (%Z)", gmtime($item->{'epoch'})), }, ); } @@ -354,16 +354,21 @@ sub read_comment { # send email notification my $smtp = Net::SMTP->new($smtp_server); + my $date = POSIX::strftime("%a, %d %b %Y %H:%M:%S %z (%Z)", localtime); $smtp->mail($ENV{USER}); $smtp->to("$blog_owner\n"); $smtp->data(); $smtp->datasend("From: $smtp_sender\n"); $smtp->datasend("To: $blog_owner\n"); - $smtp->datasend("Subject: $blog_title comment submission\n\n"); - $smtp->datasend("You have received a new comment submission.\n\n"); - $smtp->datasend(sprintf("From: %s\n", $comment_name)); - $smtp->datasend(sprintf("Date: %s\n", scalar(localtime))); - $smtp->datasend(sprintf("Comment:\n\"%s\"\n\n", $comment_body)); + $smtp->datasend("Date: $date\n"); + $smtp->datasend("Subject: $blog_title comment submission\n"); + $smtp->datasend("\n"); + $smtp->datasend("You have received a new comment submission.\n"); + $smtp->datasend("\n"); + $smtp->datasend("From: $comment_name\n"); + $smtp->datasend("Date: $date\n"); + $smtp->datasend("Comment: \"$comment_body\"\n"); + $smtp->datasend("\n"); $smtp->datasend("Moderate comments at ${blog_url}admin.cgi?view=moderate\n"); $smtp->dataend(); $smtp->quit; -- cgit v1.2.3