From a159b44435bff6efc2ad25c232d163d48eae1044 Mon Sep 17 00:00:00 2001 From: "community.cacert.org" Date: Fri, 12 Jun 2009 05:01:29 +0000 Subject: [PATCH] add reminder functionality git-svn-id: http://svn.cacert.cl/Software/Voting/vote@58 d4452222-2f33-11de-9270-010000000000 --- .htaccess | 2 +- database.php | 5 +++++ remind.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100755 remind.php diff --git a/.htaccess b/.htaccess index 7a803b2..02170ca 100644 --- a/.htaccess +++ b/.htaccess @@ -9,7 +9,7 @@ php_value open_basedir /var/www/board php_value safe_mode_exec_dir /var/empty - + Order Deny,Allow Deny from all diff --git a/database.php b/database.php index f8b5b11..83aec29 100644 --- a/database.php +++ b/database.php @@ -104,6 +104,11 @@ BODY; $header = "References: <".$tag.">\r\nIn-reply-to: <".$tag.">\r\n"; mail($this->notices, mb_encode_mimeheader($subject,"UTF-8", "B", "\n"),$body,$header."From: Voting System "); } + function remind_notify($email,$subject,$body) + { + $header = "Content-Type: text/plain; charset=UTF-8\r\n"; + mail($email,$subject,$body,$header."From: Voting System "); + } function auth() { $stmt = $this->getStatement("get voter"); diff --git a/remind.php b/remind.php new file mode 100755 index 0000000..635c2c7 --- /dev/null +++ b/remind.php @@ -0,0 +1,45 @@ +#!/usr/bin/php +closeVotes(); + +$id = 0; +$page = 1; + +$voters = $db->getStatement('get reminder voters'); +$voters->execute(); + +$outstanding = $db->getStatement('list my unvoted decisions'); +$outstanding->bindParam(':id',$id); +$outstanding->bindParam(':page',$page); + +while ($v = $voters->fetch()) { + $id = $v['id']; + $outstanding->execute(); + $msg =''; + while ($row=$outstanding->fetch()) { + $msg .= ($row['votetype'] ? 'vote ' : 'motion ') . $row['tag'] . ' ' . $row['title'] . "\nDue: " . $row['due'] . "\nhttps://community.cacert.org/board/motions.php?motion=" . $row['tag'] . "\n\n"; + } + if ($msg) { + // form email + $name = $v['name']; + $body = <<remind_notify($v['email'],"Outstanding CAcert board votes",$body); + } +} +?>