From fe419c06e4995168f330c54d979b6cb6ef413089 Mon Sep 17 00:00:00 2001
From: Denis Walker <dez@sucs.org>
Date: Sun, 30 Nov 2008 19:22:15 +0000
Subject: [PATCH] Adds election reminder for those who haven't voted. Separates
 election config into settings.php

---
 components/election.php         | 6 ------
 components/electionreminder.php | 8 ++++++++
 components/front.php            | 2 ++
 3 files changed, 10 insertions(+), 6 deletions(-)
 create mode 100644 components/electionreminder.php

diff --git a/components/election.php b/components/election.php
index 3661ed5..ed681a0 100644
--- a/components/election.php
+++ b/components/election.php
@@ -1,10 +1,4 @@
 <?php 
-# Settings for this particular election:
-define('ELECTION_YEAR', '2009');
-define('ELECTION_START', '2008-12-01 00:00');
-define('ELECTION_END', '2008-12-08 00:00');
-define('ELECTION_NO_MANIFESTO', 'http://sucs.org/vote/None.html');
-
 $smarty->assign("election_year", ELECTION_YEAR);
 $smarty->assign("title", "Executive Election ".ELECTION_YEAR);
 
diff --git a/components/electionreminder.php b/components/electionreminder.php
new file mode 100644
index 0000000..61cd43c
--- /dev/null
+++ b/components/electionreminder.php
@@ -0,0 +1,8 @@
+<?php
+
+if (strtotime('now') > strtotime(ELECTION_START) && strtotime('now') < strtotime(ELECTION_END) && !$DB->GetOne("SELECT username FROM election_votes where username=?", $session->username)) {
+ 	$messages['info'][] = "<strong>You haven't voted yet</strong><br />\nThe SUCS Executive Election is in progress. <a href=\"/Vote\">Vote now!</a>\n";
+}
+
+
+?>
diff --git a/components/front.php b/components/front.php
index e11783f..d138ecf 100644
--- a/components/front.php
+++ b/components/front.php
@@ -11,6 +11,8 @@ if (!$session->loggedin) {
 	$output = "<div class=\"cbb\"><h3>You are logged in</h3><p>If you would like to contribute to the site or report a bug, please contact chckens or dez.</p></div>";
 //include('users.php');
 //$output .= $result;
+include('electionreminder.php');
+$output .= $result;
 include('planetposts.php');
 $output .= $result;
 include('forumposts.php');
-- 
GitLab