summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcommunity.cacert.org <community.cacert.org@d4452222-2f33-11de-9270-010000000000>2009-06-12 05:06:03 +0000
committercommunity.cacert.org <community.cacert.org@d4452222-2f33-11de-9270-010000000000>2009-06-12 05:06:03 +0000
commit9355a999efbba7f7fbc6800a1cc15cdc33926c5a (patch)
treefe47da43d68fe8c78ab4d469ea9abfe39ae6ce51
parenta159b44435bff6efc2ad25c232d163d48eae1044 (diff)
downloadcacert-boardvoting-9355a999efbba7f7fbc6800a1cc15cdc33926c5a.tar.gz
cacert-boardvoting-9355a999efbba7f7fbc6800a1cc15cdc33926c5a.tar.xz
cacert-boardvoting-9355a999efbba7f7fbc6800a1cc15cdc33926c5a.zip
add reminder query + fix UTF-8 on email
git-svn-id: http://svn.cacert.cl/Software/Voting/vote@59 d4452222-2f33-11de-9270-010000000000
-rw-r--r--database.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/database.php b/database.php
index 83aec29..a4063f8 100644
--- a/database.php
+++ b/database.php
@@ -15,6 +15,7 @@
$this->statement['get voter'] = $this->dbh->prepare("SELECT voters.id, voters.name FROM voters, emails WHERE voters.id=emails.voter AND emails.address=? AND voters.enabled=1");
$this->statement['get voter by id'] = $this->dbh->prepare("SELECT voters.id, voters.name FROM voters WHERE id=:id;");
$this->statement['get voters'] = $this->dbh->prepare("SELECT voters.id, voters.name FROM voters WHERE voters.enabled=1 ORDER BY name ASC;");
+ $this->statement['get reminder voters'] = $this->dbh->prepare("SELECT voters.id, voters.name, voters.reminder AS email FROM voters WHERE voters.enabled=1 AND voters.reminder!='' ORDER BY name ASC;");
$this->statement['del vote'] = $this->dbh->prepare("DELETE FROM votes WHERE decision=:decision AND voter=:voter;");
$this->statement['do vote'] = $this->dbh->prepare("INSERT INTO votes (decision, voter, vote, voted, notes) VALUES (:decision, :voter, :vote, datetime('now','utc'), :notes);");
$this->statement['stats'] = $this->dbh->prepare("SELECT COUNT(*) AS voters FROM voters WHERE enabled=1;");
@@ -23,6 +24,7 @@
$this->statement['post create'] = $this->dbh->prepare(" UPDATE decisions SET tag='m' || strftime('%Y%m%d','now') || '.' || id WHERE id=last_insert_rowid();");
$this->statement['update decision'] = $this->dbh->prepare("UPDATE decisions SET proposed=datetime('now','utc'), proponent=:proponent, title=:title, content=:content, votetype=:votetype, status=0, due=datetime('now','utc',:due), modified=datetime('now','utc') WHERE id=:id;");
$this->statement['close decision'] = $this->dbh->prepare("UPDATE decisions SET status=:status, modified=datetime('now','utc') WHERE id=:decision");
+ ini_set('mbstring.internal_encoding', 'UTF-8');
}
function getStatement($name) {
return $this->statement[$name];
@@ -91,17 +93,18 @@ BODY;
}
function notify($subject,$body,$tag,$first=FALSE)
{
+ $header = "Content-Type: text/plain; charset=UTF-8\r\n";
if ($first) {
- $header = "Message-id: <".$tag.">\r\n";
+ $header .= "Message-id: <".$tag.">\r\n";
} else {
- $header = "References: <".$tag.">\r\nIn-reply-to: <".$tag.">\r\n";
+ $header .= "References: <".$tag.">\r\nIn-reply-to: <".$tag.">\r\n";
}
mail($this->board, mb_encode_mimeheader($subject,"UTF-8", "B", "\n"),$body,$header."From: Voting System <returns@cacert.org>");
- //mail("testsympa@lists.cacert.org",$subject,$body,"From: Voting System <returns@cacert.org>");
}
function vote_notify($subject,$body,$tag)
{
- $header = "References: <".$tag.">\r\nIn-reply-to: <".$tag.">\r\n";
+ $header = "Content-Type: text/plain; charset=UTF-8\r\n";
+ $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 <returns@cacert.org>");
}
function remind_notify($email,$subject,$body)