<commit_before><?php
/*
 *  UOIT/DC Computer Science Club Elections Website
 *  Copyright (C) 2012 UOIT/DC Computer Science Club
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


require_once 'inc/db_interface.php';
require_once 'inc/election_auth.php';
require_once 'inc/election.php';
require_once 'inc/utility.php';
require_once 'inc/validate.php';
require_once 'inc/verify.php';

$error_msg = array();
$passphrase = "";
$first_name = "";
$last_name = "";
$student_id = "";
$email = "";
$username = "";
$password = "";
$access_account = 0;
//$join_date = date("Y-m-d");
//$last_access = date("Y-m-d");
$active = 1;

/* The test positions I am voting for */
$positions = array( 'President' => '<NAME>',
                    'Vice President' => '<NAME>',
                    'Coordinator' => '<NAME>',
                    'Treasurer' => '<NAME>');

/* The positions that I am voting for in the election */
$election_vote = array( 'President' => '<NAME>',
                    	'Vice President' => '<NAME>',
                    	'Coordinator' => '<NAME>',
                    	'Treasurer' => '<NAME>');

$nominate_myself = array('President', 'Coordinator');

/* Connect to the databases */
$mysqli_accounts = new mysqli("localhost", $db_user, $db_pass, $db_acc_name);
$mysqli_elections = new mysqli("localhost", $db_user, $db_pass, $db_elec_name);

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

/**
 * Handle which page to display based on the current events and whether or not the
 * user has a login cookie set, there are the following conditions.
 * 
 * 1. User is not logged in, display one of the templates if the nomination/election
 * 	  period is open/closed with info about the Computer Science Club
 * 
 * 2. User has submitted login information
 * 		
 * 	  	a) If the login information is valid and it is the first time they have logged in
 * 		   display the first time login page with election information and terms and conditions
 * 
 * 		b) If the login information is invalid dislpay the invalid login page
 * 
 * 3. User has a valid login cookie set / has logged into the site with valid account
 * 
 * 		a) If the user has not already voted display the template for nomination/election 
 * 			 period voting 
 * 
 * 		b) If the user has already voted then dislplay the thank you for voting page with
 * 			 election results/information if applicable
 * 
 * 4. Display the footer template at the bottom of the page regardless
 */

/* 
 * 1. User is not logged in, display one of the templates if the nomination/election
 * 	  period is open/closed with info about the Computer Science Club
 */
if (validate_login_cookie($mysqli_accounts) === false
	&& !isset($_POST['login_username']) 
	&& !isset($_POST['login_password']))
{
	include 'templates/header.php';
	
	/* "Nomination open" template if its between Sept. 1, 12am to Sept 14th 11:59pm */
	if (is_nomination($mysqli_elections))
	{
		include 'templates/nomination-open.php';
	}
	/* "Nomination closed" template if its after the nomination period and before election opens */
	elseif (is_nomination_closed)
	{
		include 'templates/nomination-closed.php';<commit_msg>Fix, forgot to pass arguments to is_nomination_closed<commit_after><?php
/*
 *  UOIT/DC Computer Science Club Elections Website
 *  Copyright (C) 2012 UOIT/DC Computer Science Club
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


require_once 'inc/db_interface.php';
require_once 'inc/election_auth.php';
require_once 'inc/election.php';
require_once 'inc/utility.php';
require_once 'inc/validate.php';
require_once 'inc/verify.php';

$error_msg = array();
$passphrase = "";
$first_name = "";
$last_name = "";
$student_id = "";
$email = "";
$username = "";
$password = "";
$access_account = 0;
//$join_date = date("Y-m-d");
//$last_access = date("Y-m-d");
$active = 1;

/* The test positions I am voting for */
$positions = array( 'President' => '<NAME>',
                    'Vice President' => '<NAME>',
                    'Coordinator' => '<NAME>',
                    'Treasurer' => '<NAME>');

/* The positions that I am voting for in the election */
$election_vote = array( 'President' => '<NAME>',
                    	'Vice President' => '<NAME>',
                    	'Coordinator' => '<NAME>',
                    	'Treasurer' => '<NAME>');

$nominate_myself = array('President', 'Coordinator');

/* Connect to the databases */
$mysqli_accounts = new mysqli("localhost", $db_user, $db_pass, $db_acc_name);
$mysqli_elections = new mysqli("localhost", $db_user, $db_pass, $db_elec_name);

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

/**
 * Handle which page to display based on the current events and whether or not the
 * user has a login cookie set, there are the following conditions.
 * 
 * 1. User is not logged in, display one of the templates if the nomination/election
 * 	  period is open/closed with info about the Computer Science Club
 * 
 * 2. User has submitted login information
 * 		
 * 	  	a) If the login information is valid and it is the first time they have logged in
 * 		   display the first time login page with election information and terms and conditions
 * 
 * 		b) If the login information is invalid dislpay the invalid login page
 * 
 * 3. User has a valid login cookie set / has logged into the site with valid account
 * 
 * 		a) If the user has not already voted display the template for nomination/election 
 * 			 period voting 
 * 
 * 		b) If the user has already voted then dislplay the thank you for voting page with
 * 			 election results/information if applicable
 * 
 * 4. Display the footer template at the bottom of the page regardless
 */

/* 
 * 1. User is not logged in, display one of the templates if the nomination/election
 * 	  period is open/closed with info about the Computer Science Club
 */
if (validate_login_cookie($mysqli_accounts) === false
	&& !isset($_POST['login_username']) 
	&& !isset($_POST['login_password']))
{
	include 'templates/header.php';
	
	/* "Nomination open" template if its between Sept. 1, 12am to Sept 14th 11:59pm */
	if (is_nomination($mysqli_elections))
	{
		include 'templates/nomination-open.php';
	}
	/* "Nomination closed" template if its after the nomination period and before election opens */
	elseif (is_nomination_closed($mysqli_elections))
	{
		include 'templates/nomination-closed.php';
{'fraction_non_alphanumeric': 0.10998068254990341, 'fraction_numerical': 0.00540888602704443, 'mean_word_length': 3.460654796094199, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7071675', 'n_tokens_mistral': 2344, 'n_tokens_neox': 2217, 'n_words': 881}