Fix various sections (by Arman)

This commit is contained in:
patrick 2025-02-09 18:41:20 +00:00
parent a6a46ec556
commit 4a19fefe79
37 changed files with 1892 additions and 1556 deletions

@ -1,8 +1,8 @@
-- MariaDB dump 10.19-11.5.2-MariaDB, for debian-linux-gnu (x86_64)
-- MariaDB dump 10.19 Distrib 10.11.6-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: sfiab
-- Host: 127.0.0.1 Database: mariadb
-- ------------------------------------------------------
-- Server version 11.5.2-MariaDB-ubu2404
-- Server version 11.6.2-MariaDB-ubu2404
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@ -13,7 +13,7 @@
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `award_awards`
@ -27,8 +27,8 @@ CREATE TABLE `award_awards` (
`sponsors_id` int(10) unsigned NOT NULL DEFAULT 0,
`award_types_id` int(10) unsigned NOT NULL DEFAULT 0,
`name` varchar(128) NOT NULL DEFAULT '',
`criteria` text NOT NULL,
`description` text NOT NULL,
`criteria` text NOT NULL DEFAULT '',
`description` text NOT NULL DEFAULT '',
`presenter` varchar(128) NOT NULL DEFAULT '',
`order` int(11) NOT NULL DEFAULT 0,
`year` int(11) NOT NULL DEFAULT 0,
@ -38,10 +38,10 @@ CREATE TABLE `award_awards` (
`schedule_judges` enum('yes','no') NOT NULL DEFAULT 'yes',
`external_identifier` varchar(32) DEFAULT NULL,
`external_postback` varchar(128) DEFAULT NULL,
`external_additional_materials` tinyint(1) NOT NULL,
`external_register_winners` tinyint(1) NOT NULL,
`external_additional_materials` tinyint(1) NOT NULL DEFAULT 0,
`external_register_winners` tinyint(1) NOT NULL DEFAULT 0,
`award_source_fairs_id` int(10) unsigned DEFAULT NULL,
`per_fair` enum('no','yes') NOT NULL,
`per_fair` enum('no','yes') NOT NULL DEFAULT 'no',
PRIMARY KEY (`id`),
KEY `award_sponsors_id` (`sponsors_id`),
KEY `award_types_id` (`award_types_id`),
@ -200,8 +200,8 @@ CREATE TABLE `cms` (
`filename` varchar(128) NOT NULL,
`dt` datetime NOT NULL,
`lang` varchar(2) NOT NULL,
`title` varchar(128) NOT NULL,
`text` text NOT NULL,
`title` varchar(128) NOT NULL DEFAULT '',
`text` text NOT NULL DEFAULT '',
`showlogo` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
@ -275,12 +275,12 @@ DROP TABLE IF EXISTS `config`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
`var` varchar(64) NOT NULL DEFAULT '',
`val` text NOT NULL,
`val` text NOT NULL DEFAULT '',
`category` varchar(64) NOT NULL DEFAULT '',
`type` enum('','yesno','number','text','enum','multisel','language','theme') NOT NULL,
`type_values` tinytext NOT NULL,
`type` enum('','yesno','number','text','enum','multisel','language','theme') NOT NULL DEFAULT '',
`type_values` tinytext NOT NULL DEFAULT '',
`ord` int(11) NOT NULL DEFAULT 0,
`description` text NOT NULL,
`description` text NOT NULL DEFAULT '',
`year` int(11) NOT NULL DEFAULT 0,
UNIQUE KEY `var` (`var`,`year`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
@ -799,12 +799,12 @@ INSERT INTO `dates` VALUES
(9,'0000-00-00 00:00:00','specawardregclose','Special Awards self-nomination closes',-1),
(10,'0000-00-00 00:00:00','judgescheduleavailable','Judge assignments and schedule are available to judges',-1),
(11,'0000-00-00 00:00:00','fairdate','Date of the fair',2025),
(12,'0000-00-00 00:00:00','regopen','Registration system opens',2025),
(13,'0000-00-00 00:00:00','regclose','Registration system closes',2025),
(12,'2025-02-01 00:00:00','regopen','Registration system opens',2025),
(13,'2025-02-27 00:00:00','regclose','Registration system closes',2025),
(14,'0000-00-00 00:00:00','postparticipants','Registered participants are posted on the website',2025),
(15,'0000-00-00 00:00:00','postwinners','Winners are posted on the website',2025),
(16,'0000-00-00 00:00:00','judgeregopen','Judges registration opens',2025),
(17,'0000-00-00 00:00:00','judgeregclose','Judges registration closes',2025),
(16,'2025-01-15 00:00:00','judgeregopen','Judges registration opens',2025),
(17,'2025-02-26 00:00:00','judgeregclose','Judges registration closes',2025),
(18,'0000-00-00 00:00:00','specawardregopen','Special Awards self-nomination opens',2025),
(19,'0000-00-00 00:00:00','specawardregclose','Special Awards self-nomination closes',2025),
(20,'0000-00-00 00:00:00','judgescheduleavailable','Judge assignments and schedule are available to judges',2025);
@ -821,7 +821,7 @@ DROP TABLE IF EXISTS `documents`;
CREATE TABLE `documents` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`title` varchar(128) NOT NULL,
`title` varchar(128) NOT NULL DEFAULT '',
`sel_category` varchar(128) NOT NULL,
`filename` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`)
@ -932,22 +932,22 @@ CREATE TABLE `emails` (
LOCK TABLES `emails` WRITE;
/*!40000 ALTER TABLE `emails` DISABLE KEYS */;
INSERT INTO `emails` VALUES
(1,'register_participants_resend_regnum','Participant Registration - Resend Registration Number','Resend the password to the participant if they submit a \'forgot regnum\' request','','Registration for [FAIRNAME]','We have received a request for the retrieval of your registration number from this email address. Please find your existing registration number below\r\n\r\nRegistration Number: [REGNUM]\r\n','','system',NULL,NULL),
(2,'new_participant','New Participant','Email that new participants receive when they are added to the system','','Registration for [FAIRNAME]','A new registration account has been created for you. To access your registration account, please enter the following registration number into the registration website:\r\n\r\nEmail Address: [EMAIL]\r\nRegistration Number: [REGNUM]\r\n','','system',NULL,NULL),
(5,'register_participants_received','Participant Registration - Form Received','Sent to the participant when the admin flags their signature form as received','','Registration for [FAIRNAME] Complete','Dear [FIRSTNAME],\r\nYour registration for the [FAIRNAME] is now complete.\r\nYour project number is [PROJECTNUMBER]. Please write down your project number and bring it with you to the fair in order to expedite the check-in process.\r\n\r\nSincerely,\r\n [FAIRNAME]','','system',NULL,NULL),
(6,'register_participants_paymentpending','Participant Registration - Payment Pending','Sent to the participant when the admin flags their signature form as received but payment pending','','Registration for [FAIRNAME] Not Complete - Payment Pending','Dear [FIRSTNAME],\r\nYour registration for the [FAIRNAME] is not yet complete. We received your registration form however it was missing the required registration fee. Please send the required registration fee in aso soon as possible in order to complete your registration.\r\n\r\nYour project number is [PROJECTNUMBER]. Please write down your project number and bring it with you to the fair in order to expedite the check-in process.\r\n\r\nSincerely,\r\n [FAIRNAME]','','system',NULL,NULL),
(7,'volunteer_welcome','Volunteer Registration - Welcome','Welcome email sent to a volunteer after they have registered for the first time. This email includes their temporary password.','','Volunteer Registration for [FAIRNAME]','Thank you for registering as a volunteer at our fair. Please find your temporary password below. After logging in for the first time you will be prompted to change your password.\n\nVolunteer Email Address: [EMAIL]\nVolunteer Password: [PASSWORD]','','system',NULL,NULL),
(8,'volunteer_recover_password','Volunteer Registration - Recover Password','Recover the password for a volunteer if they submit a \'forgot password\' request','','Volunteer Registration for [FAIRNAME]','We have received a request for the recovery of your password from this email address. Please find your new password below:\n\nVolunteer Email Address: [EMAIL]\nVolunteer Password: [PASSWORD] ','','system',NULL,NULL),
(9,'committee_recover_password','Committee Members - Recover Password','Recover the password for a committee member if they submit a \'forgot password\' request','','Committee Member for [FAIRNAME]','We have received a request for the recovery of your password from this email address. Please find your new password below:\n\nCommittee Member Email Address: [EMAIL]\nCommittee Member Password: [PASSWORD] ','','system',NULL,NULL),
(10,'volunteer_new_invite','Volunteers - New Volunteer Invitation','This is sent to a new volunteer when they are invited using the invite volunteers administration section, only available when the Volunteer Registration Type is set to Invite','','Volunteer Registration for [FAIRNAME]','You have been invited to be a volunteer for the [FAIRNAME]. An account has been created for you to login with and complete your information. You can login to the volunteer registration site with:\n\nEmail Address: [EMAIL]\nPassword: [PASSWORD]\n\nYou can change your password once you login.','','system',NULL,NULL),
(11,'volunteer_add_invite','Volunteers - Add Volunteer Invitation','This is sent to existing users when they are invited using the invite volunteers administration section, only available when the Volunteer Registration Type is set to Invite','','Volunteer Registration for [FAIRNAME]','The role of volunteer for the [FAIRNAME] has been added to your account by a committee member. When you login again, there will be a [Switch Roles] link in the upper right hand area of the page. Clicking on [Switch Roles] will let you switch between being a Volunteer and your other roles without needing to logout.\n','','system',NULL,NULL),
(12,'judge_recover_password','Judges - Recover Password','Recover the password for a judge if they submit a \'forgot password\' request','','Password Recovery for [FAIRNAME]','We have received a request for the recovery of your password from this email address. Please find your new password below:\n\nJudge Email Address: [EMAIL]\nJudge Password: [PASSWORD] ','','system',NULL,NULL),
(13,'judge_welcome','Judges - Welcome','Welcome email sent to a judge after they have registered for the first time. This email includes their temporary password.','','Judge Registration for [FAIRNAME]','Thank you for registering as a judge at our fair. Please find your temporary password below. After logging in for the first time you will be prompted to change your password.\n\nJudge Email Address: [EMAIL]\nJudge Password: [PASSWORD]','','system',NULL,NULL),
(14,'judge_new_invite','Judges - New Judge Invitation','This is sent to a new judge when they are invited using the invite users administration option.','','Judge Registration for [FAIRNAME]','You have been invited to be a judge for the [FAIRNAME]. An account has been created for you to login with and complete your information. You can login to the judge registration site with:\n\nEmail Address: [EMAIL]\nPassword: [PASSWORD]\nYou can change your password once you login.','','system',NULL,NULL),
(15,'judge_add_invite','Judges - Add Judge Invitation','This is sent to existing users when they are invited using the invite users administration option.','','Judge Registration for [FAIRNAME]','The role of judge for the [FAIRNAME] has been added to your account by a committee member. When you login again, there will be a [Switch Roles] link in the upper right hand area of the page. Clicking on [Switch Roles] will let you switch between being a Judge and your other roles without needing to logout.\n','','system',NULL,NULL),
(16,'judge_activate_reminder','Judges - Activation Reminder','This is sent to existing judges who have not yet activated their account for the current fair year.','','Judge Registration for [FAIRNAME]','This message is to let you know that Judge registration for the [FAIRNAME] is now open. If you would like to participate in the fair this year please log in to the registration site using your email address ([EMAIL]) an\n','','system',NULL,NULL),
(17,'volunteer_activate_reminder','Volunteer Registration - Activation Reminder','This is sent to existing volunteers who have not yet activated their account for the current fair year.','','Volunteer Registration for [FAIRNAME]','This message is to let you know that Volunteer registration for the [FAIRNAME] is now open. If you would like to participate in the fair this year please log in to the registration site using your email address ([EMAIL]).\n','','system',NULL,NULL),
(18,'fundraising_thankyou_template','Fundraising Thank You Template','Fundraising thank you template to be used to send thank you emails to individual sponsor/donors once a donation is received','','Thank You for your Contribution','Dear [FIRSTNAME],\r\n\r\nThank you for your contribution to the [FAIRNAME]\r\n\r\nSincerely,\r\n [FAIRNAME] Committee\r\n','','system',NULL,NULL);
(1,'register_participants_resend_regnum','Participant Registration - Resend Registration Number','Resend the password to the participant if they submit a \'forgot regnum\' request','contact@science-ation.ca','Registration for [FAIRNAME]','We have received a request for the retrieval of your registration number from this email address. Please find your existing registration number below\r\n\r\nRegistration Number: [REGNUM]\r\n','','system',NULL,NULL),
(2,'new_participant','New Participant','Email that new participants receive when they are added to the system','contact@science-ation.ca','Registration for [FAIRNAME]','A new registration account has been created for you. To access your registration account, please enter the following registration number into the registration website:\r\n\r\nEmail Address: [EMAIL]\r\nRegistration Number: [REGNUM]\r\n','','system',NULL,NULL),
(5,'register_participants_received','Participant Registration - Form Received','Sent to the participant when the admin flags their signature form as received','contact@science-ation.ca','Registration for [FAIRNAME] Complete','Dear [FIRSTNAME],\r\nYour registration for the [FAIRNAME] is now complete.\r\nYour project number is [PROJECTNUMBER]. Please write down your project number and bring it with you to the fair in order to expedite the check-in process.\r\n\r\nSincerely,\r\n [FAIRNAME]','','system',NULL,NULL),
(6,'register_participants_paymentpending','Participant Registration - Payment Pending','Sent to the participant when the admin flags their signature form as received but payment pending','contact@science-ation.ca','Registration for [FAIRNAME] Not Complete - Payment Pending','Dear [FIRSTNAME],\r\nYour registration for the [FAIRNAME] is not yet complete. We received your registration form however it was missing the required registration fee. Please send the required registration fee in aso soon as possible in order to complete your registration.\r\n\r\nYour project number is [PROJECTNUMBER]. Please write down your project number and bring it with you to the fair in order to expedite the check-in process.\r\n\r\nSincerely,\r\n [FAIRNAME]','','system',NULL,NULL),
(7,'volunteer_welcome','Volunteer Registration - Welcome','Welcome email sent to a volunteer after they have registered for the first time. This email includes their temporary password.','contact@science-ation.ca','Volunteer Registration for [FAIRNAME]','Thank you for registering as a volunteer at our fair. Please find your temporary password below. After logging in for the first time you will be prompted to change your password.\n\nVolunteer Email Address: [EMAIL]\nVolunteer Password: [PASSWORD]','','system',NULL,NULL),
(8,'volunteer_recover_password','Volunteer Registration - Recover Password','Recover the password for a volunteer if they submit a \'forgot password\' request','contact@science-ation.ca','Volunteer Registration for [FAIRNAME]','We have received a request for the recovery of your password from this email address. Please find your new password below:\n\nVolunteer Email Address: [EMAIL]\nVolunteer Password: [PASSWORD] ','','system',NULL,NULL),
(9,'committee_recover_password','Committee Members - Recover Password','Recover the password for a committee member if they submit a \'forgot password\' request','contact@science-ation.ca','Committee Member for [FAIRNAME]','We have received a request for the recovery of your password from this email address. Please find your new password below:\n\nCommittee Member Email Address: [EMAIL]\nCommittee Member Password: [PASSWORD] ','','system',NULL,NULL),
(10,'volunteer_new_invite','Volunteers - New Volunteer Invitation','This is sent to a new volunteer when they are invited using the invite volunteers administration section, only available when the Volunteer Registration Type is set to Invite','contact@science-ation.ca','Volunteer Registration for [FAIRNAME]','You have been invited to be a volunteer for the [FAIRNAME]. An account has been created for you to login with and complete your information. You can login to the volunteer registration site with:\n\nEmail Address: [EMAIL]\nPassword: [PASSWORD]\n\nYou can change your password once you login.','','system',NULL,NULL),
(11,'volunteer_add_invite','Volunteers - Add Volunteer Invitation','This is sent to existing users when they are invited using the invite volunteers administration section, only available when the Volunteer Registration Type is set to Invite','contact@science-ation.ca','Volunteer Registration for [FAIRNAME]','The role of volunteer for the [FAIRNAME] has been added to your account by a committee member. When you login again, there will be a [Switch Roles] link in the upper right hand area of the page. Clicking on [Switch Roles] will let you switch between being a Volunteer and your other roles without needing to logout.\n','','system',NULL,NULL),
(12,'judge_recover_password','Judges - Recover Password','Recover the password for a judge if they submit a \'forgot password\' request','contact@science-ation.ca','Password Recovery for [FAIRNAME]','We have received a request for the recovery of your password from this email address. Please find your new password below:\n\nJudge Email Address: [EMAIL]\nJudge Password: [PASSWORD] ','','system',NULL,NULL),
(13,'judge_welcome','Judges - Welcome','Welcome email sent to a judge after they have registered for the first time. This email includes their temporary password.','contact@science-ation.ca','Judge Registration for [FAIRNAME]','Thank you for registering as a judge at our fair. Please find your temporary password below. After logging in for the first time you will be prompted to change your password.\n\nJudge Email Address: [EMAIL]\nJudge Password: [PASSWORD]','','system',NULL,NULL),
(14,'judge_new_invite','Judges - New Judge Invitation','This is sent to a new judge when they are invited using the invite users administration option.','contact@science-ation.ca','Judge Registration for [FAIRNAME]','You have been invited to be a judge for the [FAIRNAME]. An account has been created for you to login with and complete your information. You can login to the judge registration site [URLLOGIN] with:\n\nEmail Address: [EMAIL]\nPassword: [PASSWORD]\nYou can change your password once you login.','','system',NULL,NULL),
(15,'judge_add_invite','Judges - Add Judge Invitation','This is sent to existing users when they are invited using the invite users administration option.','contact@science-ation.ca','Judge Registration for [FAIRNAME]','The role of judge for the [FAIRNAME] has been added to your account by a committee member. When you login again, there will be a [Switch Roles] link in the upper right hand area of the page. Clicking on [Switch Roles] will let you switch between being a Judge and your other roles without needing to logout.\n','','system',NULL,NULL),
(16,'judge_activate_reminder','Judges - Activation Reminder','This is sent to existing judges who have not yet activated their account for the current fair year.','contact@science-ation.ca','Judge Registration for [FAIRNAME]','This message is to let you know that Judge registration for the [FAIRNAME] is now open. If you would like to participate in the fair this year please log in to the registration site using your email address ([EMAIL]) an\n','','system',NULL,NULL),
(17,'volunteer_activate_reminder','Volunteer Registration - Activation Reminder','This is sent to existing volunteers who have not yet activated their account for the current fair year.','contact@science-ation.ca','Volunteer Registration for [FAIRNAME]','This message is to let you know that Volunteer registration for the [FAIRNAME] is now open. If you would like to participate in the fair this year please log in to the registration site using your email address ([EMAIL]).\n','','system',NULL,NULL),
(18,'fundraising_thankyou_template','Fundraising Thank You Template','Fundraising thank you template to be used to send thank you emails to individual sponsor/donors once a donation is received','contact@science-ation.ca','Thank You for your Contribution','Dear [FIRSTNAME],\r\n\r\nThank you for your contribution to the [FAIRNAME]\r\n\r\nSincerely,\r\n [FAIRNAME] Committee\r\n','','system',NULL,NULL);
/*!40000 ALTER TABLE `emails` ENABLE KEYS */;
UNLOCK TABLES;
@ -972,7 +972,7 @@ CREATE TABLE `emergencycontact` (
`email` varchar(128) NOT NULL DEFAULT '',
`year` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -981,6 +981,8 @@ CREATE TABLE `emergencycontact` (
LOCK TABLES `emergencycontact` WRITE;
/*!40000 ALTER TABLE `emergencycontact` DISABLE KEYS */;
INSERT INTO `emergencycontact` VALUES
(1,2,1,'sfa','rsf','Grandparent','ds','','','','',2025);
/*!40000 ALTER TABLE `emergencycontact` ENABLE KEYS */;
UNLOCK TABLES;
@ -1095,10 +1097,10 @@ CREATE TABLE `fairs_stats` (
`year` int(11) NOT NULL DEFAULT 0,
`start_date` date NOT NULL DEFAULT '0000-00-00',
`end_date` date NOT NULL DEFAULT '0000-00-00',
`address` text NOT NULL,
`address` text NOT NULL DEFAULT '',
`budget` float NOT NULL DEFAULT 0,
`ysf_affiliation_complete` enum('Y','N') NOT NULL DEFAULT 'Y',
`charity` tinytext NOT NULL,
`charity` tinytext NOT NULL DEFAULT '',
`male_1` int(11) NOT NULL DEFAULT 0,
`male_4` int(11) NOT NULL DEFAULT 0,
`male_7` int(11) NOT NULL DEFAULT 0,
@ -1173,13 +1175,13 @@ DROP TABLE IF EXISTS `fundraising_campaigns`;
CREATE TABLE `fundraising_campaigns` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
`type` varchar(64) NOT NULL,
`startdate` date NOT NULL,
`enddate` date NOT NULL,
`type` varchar(64) NOT NULL DEFAULT '',
`startdate` date NOT NULL DEFAULT '0000-00-00',
`enddate` date NOT NULL DEFAULT '0000-00-00',
`followupdate` date DEFAULT NULL,
`active` enum('no','yes') NOT NULL,
`target` int(11) NOT NULL,
`fundraising_goal` varchar(32) NOT NULL,
`active` enum('no','yes') NOT NULL DEFAULT 'no',
`target` int(11) NOT NULL DEFAULT 0,
`fundraising_goal` varchar(32) NOT NULL DEFAULT 0,
`filterparameters` varchar(255) DEFAULT NULL,
`fiscalyear` int(11) NOT NULL,
PRIMARY KEY (`id`)
@ -1604,7 +1606,7 @@ CREATE TABLE `judges_timeslots` (
`date` date NOT NULL DEFAULT '0000-00-00',
`starttime` time NOT NULL DEFAULT '00:00:00',
`endtime` time NOT NULL DEFAULT '00:00:00',
`name` tinytext NOT NULL,
`name` tinytext NOT NULL DEFAULT '',
`year` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
@ -1768,6 +1770,10 @@ CREATE TABLE `projectcategories` (
LOCK TABLES `projectcategories` WRITE;
/*!40000 ALTER TABLE `projectcategories` DISABLE KEYS */;
INSERT INTO `projectcategories` VALUES
(1,'junor','',7,8,2025),
(2,'senior','',11,12,2025),
(3,'int','',9,10,2025);
/*!40000 ALTER TABLE `projectcategories` ENABLE KEYS */;
UNLOCK TABLES;
@ -1861,29 +1867,29 @@ CREATE TABLE `projects` (
`registrations_id` int(10) unsigned NOT NULL DEFAULT 0,
`projectnumber` varchar(16) DEFAULT NULL,
`projectsort` varchar(16) DEFAULT NULL,
`projectnumber_seq` int(11) NOT NULL,
`projectsort_seq` int(11) NOT NULL,
`floornumber` int(11) NOT NULL,
`projectnumber_seq` int(11) NOT NULL DEFAULT 0,
`projectsort_seq` int(11) NOT NULL DEFAULT 0,
`floornumber` int(11) NOT NULL DEFAULT 0,
`projectcategories_id` int(10) unsigned NOT NULL DEFAULT 0,
`projectdivisions_id` int(10) unsigned NOT NULL DEFAULT 0,
`cwsfdivisionid` int(11) DEFAULT NULL,
`title` varchar(255) NOT NULL DEFAULT '',
`shorttitle` varchar(255) NOT NULL,
`shorttitle` varchar(255) NOT NULL DEFAULT '',
`summarycountok` tinyint(1) NOT NULL DEFAULT 1,
`summary` text NOT NULL,
`summary` text NOT NULL DEFAULT '',
`year` int(11) NOT NULL DEFAULT 0,
`req_electricity` enum('no','yes') NOT NULL DEFAULT 'no',
`req_table` enum('no','yes') NOT NULL DEFAULT 'yes',
`req_special` varchar(128) NOT NULL DEFAULT '',
`language` char(2) NOT NULL DEFAULT '',
`fairs_id` int(11) NOT NULL,
`fairs_id` int(11) NOT NULL DEFAULT 0,
`projecttype` varchar(64) DEFAULT NULL,
`feedback` text DEFAULT NULL,
`flagged` tinyint(1) DEFAULT NULL,
`human_participants` enum('no','yes') DEFAULT NULL,
`animal_participants` enum('no','yes') DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -1892,6 +1898,8 @@ CREATE TABLE `projects` (
LOCK TABLES `projects` WRITE;
/*!40000 ALTER TABLE `projects` DISABLE KEYS */;
INSERT INTO `projects` VALUES
(1,2,NULL,NULL,0,0,0,3,0,NULL,'','',1,'',2025,'no','yes','','',0,NULL,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `projects` ENABLE KEYS */;
UNLOCK TABLES;
@ -2178,6 +2186,8 @@ CREATE TABLE `registrations` (
LOCK TABLES `registrations` WRITE;
/*!40000 ALTER TABLE `registrations` DISABLE KEYS */;
INSERT INTO `registrations` VALUES
(2,'964107','test@test.ca',NULL,'2025-02-03 17:51:28','open','0000-00-00 00:00:00',2025,2,NULL);
/*!40000 ALTER TABLE `registrations` ENABLE KEYS */;
UNLOCK TABLES;
@ -3111,7 +3121,7 @@ CREATE TABLE `schools` (
`projectlimitper` enum('total','agecategory') NOT NULL DEFAULT 'total',
`atrisk` enum('no','yes') NOT NULL DEFAULT 'no',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -3120,6 +3130,8 @@ CREATE TABLE `schools` (
LOCK TABLES `schools` WRITE;
/*!40000 ALTER TABLE `schools` DISABLE KEYS */;
INSERT INTO `schools` VALUES
(1,'sd','','','','','','','','','','','','',NULL,NULL,'','','','','',2025,NULL,0,0,0,'',0,'total','no');
/*!40000 ALTER TABLE `schools` ENABLE KEYS */;
UNLOCK TABLES;
@ -3165,23 +3177,23 @@ CREATE TABLE `sponsors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`organization` varchar(128) NOT NULL DEFAULT '',
`phone` varchar(32) NOT NULL DEFAULT '',
`tollfree` varchar(32) NOT NULL,
`tollfree` varchar(32) NOT NULL DEFAULT '',
`fax` varchar(32) NOT NULL DEFAULT '',
`email` varchar(128) NOT NULL DEFAULT '',
`website` varchar(128) NOT NULL,
`website` varchar(128) NOT NULL DEFAULT '',
`year` int(11) NOT NULL DEFAULT 0,
`address` varchar(128) NOT NULL DEFAULT '',
`address2` varchar(128) NOT NULL,
`address2` varchar(128) NOT NULL DEFAULT '',
`city` varchar(64) NOT NULL DEFAULT '',
`province_code` char(2) NOT NULL DEFAULT '',
`postalcode` varchar(8) NOT NULL DEFAULT '',
`notes` text NOT NULL,
`donationpolicyurl` varchar(255) NOT NULL,
`fundingselectiondate` date DEFAULT NULL,
`notes` text NOT NULL DEFAULT '',
`donationpolicyurl` varchar(255) NOT NULL DEFAULT '',
`fundingselectiondate` date DEFAULT '0000-00-00',
`logo` varchar(128) DEFAULT NULL,
`waiveraccepted` enum('no','yes') NOT NULL DEFAULT 'no',
`donortype` enum('organization','individual') NOT NULL DEFAULT 'organization',
`proposalsubmissiondate` date NOT NULL,
`proposalsubmissiondate` date NOT NULL DEFAULT '0000-00-00',
PRIMARY KEY (`id`),
KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
@ -3223,7 +3235,7 @@ CREATE TABLE `students` (
`lang` char(2) NOT NULL DEFAULT '',
`year` int(11) NOT NULL DEFAULT 0,
`schools_id` int(10) unsigned NOT NULL DEFAULT 0,
`fairs_id` int(11) NOT NULL,
`fairs_id` int(11) NOT NULL DEFAULT 0,
`tshirt` varchar(32) NOT NULL DEFAULT 'medium',
`medicalalert` varchar(255) NOT NULL DEFAULT '',
`foodreq` varchar(255) NOT NULL DEFAULT '',
@ -3390,16 +3402,16 @@ DROP TABLE IF EXISTS `users`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`uid` int(11) NOT NULL DEFAULT 0,
`types` set('student','judge','committee','volunteer','fair','sponsor','principal','teacher','parent','mentor','alumni') NOT NULL,
`salutation` varchar(8) NOT NULL,
`salutation` varchar(8) NOT NULL DEFAULT '',
`firstname` varchar(32) NOT NULL DEFAULT '',
`lastname` varchar(32) NOT NULL DEFAULT '',
`sex` enum('male','female') DEFAULT NULL,
`username` varchar(128) NOT NULL DEFAULT '',
`password` varchar(60) NOT NULL DEFAULT '',
`passwordset` date DEFAULT NULL,
`oldpassword` varchar(60) NOT NULL,
`oldpassword` varchar(60) NOT NULL DEFAULT '',
`email` varchar(128) NOT NULL DEFAULT '',
`year` int(11) NOT NULL,
`phonehome` varchar(32) NOT NULL DEFAULT '',
@ -3407,8 +3419,8 @@ CREATE TABLE `users` (
`phonecell` varchar(32) NOT NULL DEFAULT '',
`fax` varchar(32) NOT NULL DEFAULT '',
`organization` varchar(64) NOT NULL DEFAULT '',
`birthdate` date NOT NULL,
`lang` varchar(2) NOT NULL,
`birthdate` date NOT NULL DEFAULT '0000-00-00',
`lang` varchar(2) NOT NULL DEFAULT 'en',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`lastlogin` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`address` varchar(64) NOT NULL DEFAULT '',
@ -3432,8 +3444,8 @@ CREATE TABLE `users` (
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES
(1,1,'fair','','','',NULL,'kvGbxRTM','$2y$10$OYeIx.U53utmuzyZkVTqtukGB0ELi5piz62KtbaYj0uEPN7fD6NtS','0000-00-00','','',2025,'','','','','','0000-00-00','','2009-10-22 12:56:09','0000-00-00 00:00:00','','','','','','no','no','no',NULL),
(2,2,'committee','','Superuser','Account',NULL,'contact@science-ation.ca','$2y$10$ZekjuaS8eV8DrTfMR1ak7OxiFMDEzCEUtm04OiISLcx6uGyx.4TMm','2024-10-16','','contact@science-ation.ca',2025,'','','','','','0000-00-00','','2024-10-16 04:38:47','0000-00-00 00:00:00','','','','','','no','no','no',NULL);
(1,1,'fair','','','',NULL,'fair@science-ation.ca','$2y$10$xCsYhiUwTT/DCwkCFBPzXuH5ZBt0xt0boy3zj8FkdoktbwkmEk7Ta','0000-00-00','','',2025,'','','','','','0000-00-00','','2009-10-22 12:56:09','0000-00-00 00:00:00','','','','','','no','no','no',NULL),
(2,2,'committee','','Superuser','Account',NULL,'contact@science-ation.ca','$2y$10$xCsYhiUwTT/DCwkCFBPzXuH5ZBt0xt0boy3zj8FkdoktbwkmEk7Ta','2024-10-16','','contact@science-ation.ca',2025,'','','','','','0000-00-00','','2024-10-16 04:38:47','0000-00-00 00:00:00','','','','','','no','no','no',NULL);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
@ -3471,8 +3483,8 @@ CREATE TABLE `users_committee` (
`users_id` int(11) NOT NULL,
`committee_active` enum('no','yes') NOT NULL DEFAULT 'no',
`committee_complete` enum('no','yes') NOT NULL DEFAULT 'no',
`emailprivate` varchar(128) NOT NULL,
`ord` int(11) NOT NULL,
`emailprivate` varchar(128) NOT NULL DEFAULT '',
`ord` int(11) NOT NULL DEFAULT 0,
`displayemail` enum('no','yes') NOT NULL DEFAULT 'no',
`access_admin` enum('no','yes') NOT NULL DEFAULT 'no',
`access_config` enum('no','yes') NOT NULL DEFAULT 'no',
@ -3488,7 +3500,7 @@ CREATE TABLE `users_committee` (
LOCK TABLES `users_committee` WRITE;
/*!40000 ALTER TABLE `users_committee` DISABLE KEYS */;
INSERT INTO `users_committee` VALUES
(3,'yes','no','contact@science-ation.ca',0,'no','yes','yes','yes');
(2,'yes','no','contact@science-ation.ca',0,'no','yes','yes','yes');
/*!40000 ALTER TABLE `users_committee` ENABLE KEYS */;
UNLOCK TABLES;
@ -3515,8 +3527,7 @@ CREATE TABLE `users_fair` (
LOCK TABLES `users_fair` WRITE;
/*!40000 ALTER TABLE `users_fair` DISABLE KEYS */;
INSERT INTO `users_fair` VALUES
(1,'yes','no',1),
(2,'yes','no',2);
(1,'yes','no',1);
/*!40000 ALTER TABLE `users_fair` ENABLE KEYS */;
UNLOCK TABLES;
@ -3531,19 +3542,19 @@ CREATE TABLE `users_judge` (
`users_id` int(11) NOT NULL,
`judge_active` enum('no','yes') NOT NULL DEFAULT 'no',
`judge_complete` enum('no','yes') NOT NULL DEFAULT 'no',
`years_school` tinyint(4) NOT NULL,
`years_regional` tinyint(4) NOT NULL,
`years_national` tinyint(4) NOT NULL,
`years_school` tinyint(4) NOT NULL DEFAULT 0,
`years_regional` tinyint(4) NOT NULL DEFAULT 0,
`years_national` tinyint(4) NOT NULL DEFAULT 0,
`willing_chair` enum('yes','no') NOT NULL DEFAULT 'no',
`special_award_only` enum('yes','no') NOT NULL DEFAULT 'no',
`cat_prefs` tinytext NOT NULL,
`div_prefs` text NOT NULL,
`divsub_prefs` tinytext NOT NULL,
`languages` tinytext NOT NULL,
`highest_psd` tinytext NOT NULL,
`expertise_other` tinytext NOT NULL,
`private_info` text DEFAULT NULL,
`flagged_judge` tinyint(1) DEFAULT NULL,
`cat_prefs` tinytext NOT NULL DEFAULT '',
`div_prefs` text NOT NULL DEFAULT '',
`divsub_prefs` tinytext NOT NULL DEFAULT '',
`languages` tinytext NOT NULL DEFAULT '',
`highest_psd` tinytext NOT NULL DEFAULT '',
`expertise_other` tinytext NOT NULL DEFAULT '',
`private_info` text DEFAULT NULL DEFAULT '',
`flagged_judge` tinyint(1) DEFAULT NULL DEFAULT 0,
PRIMARY KEY (`users_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -3788,6 +3799,6 @@ UNLOCK TABLES;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-11-22 2:44:22
-- Dump completed on 2025-02-03 18:47:42

@ -32,6 +32,7 @@ $_GET['action'] = $_GET['action'] ?? '';
switch ($_GET['action']) {
case 'awardinfo_load':
;
$id = intval(get_value_from_array($_GET, 'id'));
$q = $pdo->prepare("SELECT * FROM award_awards WHERE id=?");
$q->execute([$id]);
@ -39,7 +40,6 @@ switch ($_GET['action']) {
// json_encode NEEDS UTF8 DATA, but we store it in the database as ISO :(
foreach ($ret AS $k => $v) {
print ('sdfs');
$ret[$k] = iconv('ISO-8859-1', 'UTF-8', $v);
}
// echo iconv("ISO-8859-1","UTF-8",json_encode($ret));
@ -86,8 +86,7 @@ switch ($_GET['action']) {
$q .= "WHERE id=?";
$q = $pdo->prepare($q);
$q->execute([$id]);
print_r($_POST);
echo $q;
show_pdo_errors_if_any($pdo);
happy_('Award information saved');
exit;
@ -188,7 +187,7 @@ switch ($_GET['action']) {
case 'prizeinfo_load':
$id = intval($_GET['id']);
if ($id == -1) {
$q = $pdo->prepare("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`");
$q = $pdo->prepare("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`");
$q->execute();
} else {
$q = $pdo->prepare("SELECT * FROM award_prizes WHERE award_awards_id=? ORDER BY `order`");
@ -250,16 +249,16 @@ switch ($_GET['action']) {
WHERE id = :id');
$q->bindParam(':prize', stripslashes(iconv('UTF-8', 'ISO-8859-1', $_POST['prize'])), PDO::PARAM_STR);
$q->bindParam(':cash', intval($_POST['cash']), PDO::PARAM_INT);
$q->bindParam(':scholarship', intval($_POST['scholarship']), PDO::PARAM_INT);
$q->bindParam(':value', intval($_POST['value']), PDO::PARAM_INT);
$q->bindParam(':number', intval($_POST['number']), PDO::PARAM_INT);
$q->bindParam(':excludefromac', ($_POST['excludefromac'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindParam(':trophystudentkeeper', ($_POST['trophystudentkeeper'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindParam(':trophystudentreturn', ($_POST['trophystudentreturn'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindParam(':trophyschoolkeeper', ($_POST['trophyschoolkeeper'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindParam(':trophyschoolreturn', ($_POST['trophyschoolreturn'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindParam(':id', $id, PDO::PARAM_INT);
$q->bindValue(':cash', intval($_POST['cash']), PDO::PARAM_INT);
$q->bindValue(':scholarship', intval($_POST['scholarship']), PDO::PARAM_INT);
$q->bindValue(':value', intval($_POST['value']), PDO::PARAM_INT);
$q->bindValue(':number', intval($_POST['number']), PDO::PARAM_INT);
$q->bindValue(':excludefromac', ($_POST['excludefromac'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindValue(':trophystudentkeeper', ($_POST['trophystudentkeeper'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindValue(':trophystudentreturn', ($_POST['trophystudentreturn'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindValue(':trophyschoolkeeper', ($_POST['trophyschoolkeeper'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindValue(':trophyschoolreturn', ($_POST['trophyschoolreturn'] == 1) ? 1 : 0, PDO::PARAM_INT);
$q->bindValue(':id', $id, PDO::PARAM_INT);
$q->execute();
@ -394,8 +393,10 @@ send_header('Awards Management',
var award_id = 0;
var award_tab_update = new Array();
function update_awardinfo()
{
{
if(award_tab_update['awardinfo'] == award_id) return;
award_tab_update['awardinfo'] = award_id;
// alert(award_id);
@ -634,7 +635,7 @@ function update_feeder_enable()
/* Setup the popup window */
$(document).ready(function() {
console.log('first');
$("#popup_editor").dialog({
bgiframe: true, autoOpen: false,
modal: true, resizable: false,
@ -649,13 +650,18 @@ $(document).ready(function() {
});
$("#editor_tabs").tabs({
create: function( event, ui ) {
create: function(event, ui) {
update_awardinfo();
update_eligibility();
update_prizeinfo();
update_feeder();
},
activate: function( event, ui ) {
update_awardinfo();
update_eligibility();
update_prizeinfo();
update_feeder();
},
collapsible: true,
active: -1
});
@ -680,6 +686,7 @@ $(document).ready(function() {
// collapsible: true,
// selected: -1 /* None selected */
// });
})
</script>
@ -912,15 +919,15 @@ function popup_editor(id, mode)
switch(mode) {
case 'new':
$('#editor_tabs').tabs('option', 'disabled', [1, 2, 3]);
$('#editor_tabs').tabs('select', 0);
$('#editor_tabs').tabs('option','active', 0);
break;
case 'template':
$('#editor_tabs').tabs('option', 'disabled', [0, 1, 3]);
$('#editor_tabs').tabs('select', 2);
$('#editor_tabs').tabs('option', 'active', 2);
break;
default:
$('#editor_tabs').tabs('option', 'disabled', []);
$('#editor_tabs').tabs('select', 0);
$('#editor_tabs').tabs('option','active', 0);
break;
}
/* Don't let anything collapse */

@ -25,14 +25,15 @@
function award_delete($award_awards_id)
{
global $pdo;
/* Delete all winners attached to this award */
$q = $pdo->prepare("SELECT id FROM award_prizes WHERE award_awards_id=?");
$q = $pdo->prepare('SELECT id FROM award_prizes WHERE award_awards_id=?');
$q->execute([$award_awards_id]);
while (($p = $q->fetch(PDO::FETCH_ASSOC))) {
$q = $pdo->prepare();
$q->execute("DELETE FROM winners WHERE award_prizes_id='{$p['id']}'");
$q = $pdo->prepare("DELETE FROM winners WHERE awards_prizes_id='{$p['id']}'");
$q->execute();
}
/* FIXME: maybe delte judging teams and judge
@ -40,25 +41,26 @@ function award_delete($award_awards_id)
/* Delete the award */
$q = $pdo->prepare("DELETE FROM award_prizes WHERE award_awards_id=?");
$q = $pdo->prepare('DELETE FROM award_prizes WHERE award_awards_id=?');
$q->execute([$award_awards_id]);
$q = $pdo->prepare("DELETE FROM award_awards_projectcategories WHERE award_awards_id=?");
$q = $pdo->prepare('DELETE FROM award_awards_projectcategories WHERE award_awards_id=?');
$q->execute([$award_awards_id]);
$q = $pdo->prepare("DELETE FROM award_awards_projectdivisions WHERE award_awards_id=?");
$q = $pdo->prepare('DELETE FROM award_awards_projectdivisions WHERE award_awards_id=?');
$q->execute([$award_awards_id]);
$q = $pdo->prepare("DELETE FROM award_awards WHERE id=?");
$q = $pdo->prepare('DELETE FROM award_awards WHERE id=?');
$q->execute([$award_awards_id]);
}
function award_prize_delete($award_prizes_id)
{
$q = $pdo->prepare("DELETE FROM winners WHERE award_prizes_id=?");
global $pdo;
$q = $pdo->prepare('DELETE FROM winners WHERE award_prizes_id=?');
$q->execute([$award_prizes_id]);
$q = $pdo->prepare("DELETE FROM award_prizes WHERE id=?");
$q = $pdo->prepare('DELETE FROM award_prizes WHERE id=?');
$q->execute([$award_prizes_id]);
}

@ -208,7 +208,7 @@ if (get_value_from_array($_GET, 'filename', '') || get_value_from_array($_GET, '
while ($r = $q->fetch(PDO::FETCH_ASSOC)) {
echo '<tr><td><a href="cms.php?filename=' . rawurlencode($r->filename) . "\">/web/$r->filename</a></td>";
$q2 = $pdo->prepare("SELECT dt FROM cms WHERE filename=? ORDER BY dt DESC LIMIT 1");
$q->execute($r->filename);
$q->execute([$r->filename]);
$r2 = $q2->fetch(PDO::FETCH_OBJ);
if ($r2->dt == '0000-00-00 00:00:00')
$dt = 'Never';

@ -46,7 +46,7 @@ function launchQueue()
switch (get_value_from_array($_GET, 'action')) {
case 'dialog_choose_load':
$emails_id = intval($_GET['emails_id']);
$q = $pdo->prepare("SELECT * FROM emails WHERE id=?");
$q = $pdo->prepare('SELECT * FROM emails WHERE id=?');
$q->execute([$emails_id]);
$e = $q->fetch(PDO::FETCH_ASSOC);
?>
@ -70,7 +70,7 @@ case 'dialog_choose':
<option value="-1">-- <?= i18n('Choose a Communication') ?> --</option>
<?
$type = $pdo->quote($_GET['type']);
$q = $pdo->prepare("SELECT * FROM emails WHERE type=?");
$q = $pdo->prepare('SELECT * FROM emails WHERE type=?');
$q->execute([$type]);
while ($e = $q->fetch(PDO::FETCH_ASSOC)) {
echo "<option value=\"{$e['id']}\">{$e['name']}</option>";
@ -173,10 +173,10 @@ case 'email_save':
if ($id == 0) {
if ($key && $name) {
$q = $pdo->prepare("INSERT INTO emails(type,val) VALUES(?,?)");
$q->execute([$type,$key]);
$q = $pdo->prepare('INSERT INTO emails(type,val) VALUES(?,?)');
$q->execute([$type, $key]);
show_pdo_errors_if_any($pdo);
$id = lastInsertId();
$id = $pdo->lastInsertId();
} else {
error_('Email Key and Name are required');
exit;
@ -187,7 +187,7 @@ case 'email_save':
$fcstr = ($fcid == 0) ? 'NULL' : "'$fcid'";
$body = getTextFromHtml($bodyhtml);
$q = $pdo->prepare("UPDATE emails SET
$q = $pdo->prepare('UPDATE emails SET
name=?,
description=?,
`from`=?,
@ -195,8 +195,8 @@ case 'email_save':
body=?,
bodyhtml=?,
fundraising_campaigns_id=?
WHERE id=?");
$q->execute([$name,$description,$from,$subject,$body,$bodyhtml,$fcstr,$id]);
WHERE id=?');
$q->execute([$name, $description, $from, $subject, $body, $bodyhtml, $fcstr, $id]);
show_pdo_errors_if_any($pdo);
happy_('Email Saved');
exit;
@ -215,7 +215,7 @@ case 'dialog_edit':
if (array_key_exists('fundraising_campaigns_id', $_GET)) {
$fcid = intval($_GET['fundraising_campaigns_id']);
$type = 'fundraising';
$q = $pdo->prepare("SELECT * FROM fundraising_campaigns WHERE id=?");
$q = $pdo->prepare('SELECT * FROM fundraising_campaigns WHERE id=?');
$q->execute([$fcid]);
$fc = $q->fetch(PDO::FETCH_OBJ);
$name = i18n('%1 communication for %2', array(ucfirst($key), $fc->name));
@ -227,7 +227,7 @@ case 'dialog_edit':
$from = $_SESSION['name'] . ' <' . $_SESSION['email'] . '>';
}
if ($id) {
$q = $pdo->prepare("SELECT * FROM emails WHERE id=?");
$q = $pdo->prepare('SELECT * FROM emails WHERE id=?');
$q->execute([$id]);
if ($q->rowCount() != 1) {
echo 'Ambiguous edit';
@ -408,11 +408,11 @@ case 'dialog_send':
$fcid = intval($_GET['fundraising_campaigns_id']);
$emailid = intval($_GET['emails_id']);
$fcq = $pdo->prepare("SELECT * FROM fundraising_campaigns WHERE id=?");
$fcq = $pdo->prepare('SELECT * FROM fundraising_campaigns WHERE id=?');
$fcq->execute([$fcid]);
$fc = $fcq->fetch(PDO::FETCH_OBJ);
$emailq = $pdo->prepare("SELECT * FROM emails WHERE id=?");
$emailq = $pdo->prepare('SELECT * FROM emails WHERE id=?');
$emailq->execute([$emailid]);
$email = $email->fetch(PDO::FETCH_OBJ);
@ -420,7 +420,7 @@ case 'dialog_send':
<form id="send">
<table style="width:100%">
<?
$q = $pdo->prepare("SELECT COUNT(*) AS num FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id=?");
$q = $pdo->prepare('SELECT COUNT(*) AS num FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id=?');
$q->execute([$fcid]);
$r = $q->fetch(PDO::FETCH_OBJ);
$numrecipients = $r->num;
@ -513,7 +513,7 @@ case 'dialog_sender':
$u = user_load_by_uid(intval($_GET['uid']));
if ($_GET['template']) {
$emailq = $pdo->prepare("SELECT * FROM emails WHERE `val`=?");
$emailq = $pdo->prepare('SELECT * FROM emails WHERE `val`=?');
$emailq->execute([$_GET['template']]);
$e = $emailq->fetch(PDO::FETCH_ASSOC);
} else
@ -657,7 +657,7 @@ case 'dialog_sender':
case 'cancel':
if ($_GET['cancel']) {
$q = $pdo->prepare("UPDATE emailqueue SET finished=NOW() WHERE id=?");
$q = $pdo->prepare('UPDATE emailqueue SET finished=NOW() WHERE id=?');
$q->execute([intval($_GET['cancel'])]);
$q = $pdo->prepare("UPDATE emailqueue_recipients SET result='cancelled' WHERE emailqueue_id=? AND sent IS NULL AND result IS NULL");
@ -686,23 +686,23 @@ if (get_value_from_array($_GET, 'action') == 'sendqueue') {
$fcid = intval($_POST['fundraising_campaigns_id']);
$emailid = intval($_POST['emails_id']);
$fcq = $pdo->prepare("SELECT * FROM fundraising_campaigns WHERE id=?");
$fcq = $pdo->prepare('SELECT * FROM fundraising_campaigns WHERE id=?');
$fcq->execute([$fcid]);
$fc = $fcq->fetch(PDO::FETCH_OBJ);
$emailq = $pdo->prepare("SELECT * FROM emails WHERE id=?");
$emailq = $pdo->prepare('SELECT * FROM emails WHERE id=?');
$emailq->execute([$emailid]);
$email = $emailq->fetch(PDO::FETCH_OBJ);
$recipq = $pdo->prepare("SELECT * FROM fundraising_campaigns_users_link
WHERE fundraising_campaigns_id=?");
$recipq = $pdo->prepare('SELECT * FROM fundraising_campaigns_users_link
WHERE fundraising_campaigns_id=?');
$recipq->execute([$fcid]);
show_pdo_errors_if_any($pdo);
$numtotal = $recipq->rowCount();
$q = $pdo->prepare("INSERT INTO emailqueue (val, name, users_uid, `from`, subject, body, bodyhtml, `type`, fundraising_campaigns_id, started, finished, numtotal, numsent)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NULL, ?, 0)");
\tVALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NULL, ?, 0)");
$q->execute([
$email->val,
@ -728,8 +728,8 @@ if (get_value_from_array($_GET, 'action') == 'sendqueue') {
// we only send school access codes to science heads or principals
$acq = $pdo->prepare("SELECT accesscode FROM schools WHERE (sciencehead_uid=? OR principal_uid=? AND `year`=?");
$acq->execute([$u['uid'],$config['FAIRYEAR']]);
$acq = $pdo->prepare('SELECT accesscode FROM schools WHERE (sciencehead_uid=? OR principal_uid=? AND `year`=?');
$acq->execute([$u['uid'], $config['FAIRYEAR']]);
$acr = $acq->fetch(PDO::FETCH_OBJ);
$accesscode = $acr->accesscode;
@ -747,7 +747,7 @@ if (get_value_from_array($_GET, 'action') == 'sendqueue') {
);
if ($u['email'] && $u['email'][0] != '*') {
$q = $pdo->prepare("INSERT INTO emailqueue_recipients (emailqueue_id, toemail, toname, replacements, sent) VALUES (?, ?, ?, ?, NULL)");
$q = $pdo->prepare('INSERT INTO emailqueue_recipients (emailqueue_id, toemail, toname, replacements, sent) VALUES (?, ?, ?, ?, NULL)');
$q->execute([
$emailqueueid,
@ -758,7 +758,7 @@ if (get_value_from_array($_GET, 'action') == 'sendqueue') {
show_pdo_errors_if_any($pdo);
}
$q = $pdo->prepare("UPDATE emails SET lastsent=NOW() WHERE id=?");
$q = $pdo->prepare('UPDATE emails SET lastsent=NOW() WHERE id=?');
$q->execute([$emailid]);
}
echo 'ok';
@ -797,8 +797,8 @@ if (get_value_from_array($_GET, 'action') == 'delete' && get_value_from_array($_
if (get_value_from_array($_GET, 'action') == 'send' && get_value_from_array($_GET, 'send')) {
show_pdo_errors_if_any($pdo);
$q = $pdo->prepare("SELECT * FROM emails WHERE id=?");
$q->execute($_GET['send']);
$q = $pdo->prepare('SELECT * FROM emails WHERE id=?');
$q->execute([$_GET['send']]);
$r = $q->fetch(PDO::FETCH_OBJ);
@ -862,7 +862,7 @@ if (get_value_from_array($_GET, 'action') == 'send' && get_value_from_array($_GE
// echo $str;
} else if (get_value_from_array($_POST, 'action') == 'reallysend' && get_value_from_array($_POST, 'reallysend') && get_value_from_array($_POST, 'to')) {
$emailid = intval($_POST['reallysend']);
$emailq = $pdo->prepare("SELECT * FROM emails WHERE id=?");
$emailq = $pdo->prepare('SELECT * FROM emails WHERE id=?');
$emailq->execute([$emailid]);
$email = $emailq->fetch(PDO::FETCH_OBJ);
$to = $_POST['to'];
@ -873,7 +873,7 @@ if (get_value_from_array($_GET, 'action') == 'send' && get_value_from_array($_GE
}
$numtotal = $recipq->rowCount();
$q = $pdo->prepare("INSERT INTO emailqueue (val, name, users_uid, `from`, subject, body, bodyhtml, `type`, fundraising_campaigns_id, started, finished, numtotal, numsent) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL, NOW(), NULL, ?, 0)");
$q = $pdo->prepare('INSERT INTO emailqueue (val, name, users_uid, `from`, subject, body, bodyhtml, `type`, fundraising_campaigns_id, started, finished, numtotal, numsent) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL, NOW(), NULL, ?, 0)');
$q->execute([
$email->val,
@ -886,8 +886,8 @@ if (get_value_from_array($_GET, 'action') == 'send' && get_value_from_array($_GE
$email->type,
$numtotal
]);
$emailqueueid = lastInsertId();
$emailqueueid = $pdo->lastInsertId();
show_pdo_errors_if_any($pdo);
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
@ -917,8 +917,8 @@ if (get_value_from_array($_GET, 'action') == 'send' && get_value_from_array($_GE
}
if ($u) {
// we only send school access codes to science heads or principals
$acq = $pdo->prepare("SELECT accesscode FROM schools WHERE (sciencehead_uid=? OR principal_uid=?) AND `year`=?");
$acq->execute([$u['uid'],$u['uid'],$config['FAIRYEAR']]);
$acq = $pdo->prepare('SELECT accesscode FROM schools WHERE (sciencehead_uid=? OR principal_uid=?) AND `year`=?');
$acq->execute([$u['uid'], $u['uid'], $config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
$acr = $acq->fetch(PDO::FETCH_OBJ);
$accesscode = $acr->accesscode;
@ -941,7 +941,7 @@ if (get_value_from_array($_GET, 'action') == 'send' && get_value_from_array($_GE
}
if ($toemail) {
$q = $pdo->prepare("INSERT INTO emailqueue_recipients (emailqueue_id, toemail, toname, replacements, sent) VALUES (?, ?, ?, ?, NULL)");
$q = $pdo->prepare('INSERT INTO emailqueue_recipients (emailqueue_id, toemail, toname, replacements, sent) VALUES (?, ?, ?, ?, NULL)');
$q->execute([
$emailqueueid,
@ -953,7 +953,7 @@ if (get_value_from_array($_GET, 'action') == 'send' && get_value_from_array($_GE
show_pdo_errors_if_any($pdo);
}
$q = $pdo->prepare("UPDATE emails SET lastsent=NOW() WHERE id=?");
$q = $pdo->prepare('UPDATE emails SET lastsent=NOW() WHERE id=?');
$q->execute([$emailid]);
}
launchQueue();

File diff suppressed because it is too large Load Diff

@ -630,7 +630,7 @@ print_r($projects);
/* Assign floor numbers */
$q = $pdo->prepare("UPDATE projects SET floornumber=0 WHERE year=?");
$q->execute($config['FAIRYEAR']);
$q->execute([$config['FAIRYEAR']]);
foreach ($projects as $pid => $p) {
$q = $pdo->prepare("UPDATE projects SET floornumber=? WHERE id=?");

@ -178,7 +178,7 @@ case 'managelist':
$recq = $pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id=? AND fiscalyear=? AND status='received'");
$recq->execute([$r->id,$config['FISCALYEAR']]);
show_pdo_errors_if_any($pdo);
$recr = recq->fetch(PDO::FETCH_OBJ);
$recr = $recq->fetch(PDO::FETCH_OBJ);
$received = $recr->received;
if ($r->target)
$percent = round($received / $r->target * 100, 1);
@ -223,8 +223,8 @@ case 'managelist':
echo '</tr>';
echo "</thead>\n";
$q = $pdo->prepare("SELECT * FROM fundraising_donations WHERE fundraising_campaigns_id='$campaign_id'
\t\t\tAND status='received' ORDER BY datereceived DESC");
$q = $pdo->prepare("SELECT * FROM fundraising_donations WHERE fundraising_campaigns_id='$campaign_id' AND status='received' ORDER BY datereceived DESC");
$q->execute();
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$goal = getGoal($r->fundraising_goal);
$sq = $pdo->prepare("SELECT * FROM sponsors WHERE id=?");
@ -438,7 +438,7 @@ case 'managelist':
echo "<input type=\"button\" onclick=\"return opensendemaildialog($campaign_id,$email->id)\" value=\"" . i18n('Send as email') . '" />';
echo "<br />\n";
if ($email->lastsent) {
list($date, $time) = split(' ', $email->lastsent);
list($date, $time) = explode(' ', $email->lastsent);
echo i18n('Last Sent');
echo '<br />' . format_date($date);
echo '<br />' . format_time($time);
@ -590,13 +590,15 @@ function modifycampaignsfinish(){
});
}
function managecampaignsfinish() {
}
function managecampaignfinish() {
$("#editor_tabs").tabs({
create: function( event, ui ) {
$("#campaign_tabs").tabs({
create: function(event, ui) {
update_tab_overview();
update_tab_donations();
update_tab_prospects();
update_tab_communications();
},
activate: function( event, ui ) {
update_tab_overview();
update_tab_donations();
update_tab_prospects();

@ -34,14 +34,14 @@ if (!$q->rowCount()) {
$q = $pdo->prepare("SELECT * FROM fundraising_donor_levels WHERE fiscalyear='-1'");
$q->execute();
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$pdo->prepare("INSERT INTO fundraising_donor_levels (`level`,`min`,`max`,`description`,`fiscalyear`) VALUES (
$stmt = $pdo->prepare("INSERT INTO fundraising_donor_levels (`level`,`min`,`max`,`description`,`fiscalyear`) VALUES (
?,
?,
?,
?,
?)')");
$pdo->execute([$r->level,$r->min,$r->max,$r->description,$config['FISCALYEAR']]);
$stmt->execute([$r->level,$r->min,$r->max,$r->description,$config['FISCALYEAR']]);
}
}
@ -346,12 +346,17 @@ send_header('Fundraising Setup',
$(document).ready(function() {
$("#editor_tabs").tabs({
create: function( event, ui ) {
create: function(event, ui) {
update_levels();
update_goals();
update_setup();
},
activate: function( event, ui ) {
update_levels();
update_goals();
update_setup();
},
selected: 0
selected: 1
});
// $("#editor_tabs").tabs({

@ -199,8 +199,8 @@ if ($action == 'savemultiple') {
show_pdo_errors_if_any($pdo);
$r = $q->fetch(PDO::FETCH_OBJ);
list($ed, $et) = split(' ', $r->endtime);
list($nd, $nt) = split(' ', $r->startnext);
list($ed, $et) = explode(' ', $r->endtime);
list($nd, $nt) = explode(' ', $r->startnext);
$starttime = sprintf('%02d:%02d:00', $hr, $min);
@ -211,8 +211,8 @@ if ($action == 'savemultiple') {
$stmt->execute([$date,$round_data['id'],$starttime,$et,$config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
$date = $nd;
list($s_h, $s_m, $s_s) = split(':', $nt);
list($e_h, $e_m, $e_s) = split(':', $et);
list($s_h, $s_m, $s_s) = explode(':', $nt);
list($e_h, $e_m, $e_s) = explode(':', $et);
message_push(happy(i18n('Adding timeslot: %1', array("$date $hr:$min - $e_h:$e_m"))));
$hr = $s_h;
$min = $s_m;

@ -46,12 +46,12 @@ if ($auth_type == 'fair') {
} else {
/* Make sure they have permission to laod this student, check
the master copy of the fairs_id in the project */
$q = $pdo->prepare("SELECT * FROM projects WHERE
$q = $pdo->prepare('SELECT * FROM projects WHERE
registrations_id=?
AND year=?
AND fairs_id=?");
AND fairs_id=?');
$q->execute([$registrations_id,$config['FAIRYEAR'],$fairs_id]);
$q->execute([$registrations_id, $config['FAIRYEAR'], $fairs_id]);
if ($q->rowCount() != 1) {
echo 'permission denied.';
exit;
@ -69,9 +69,10 @@ switch ($action) {
project_save();
/* Now generate */
$q = $pdo->prepare("SELECT id FROM projects WHERE registrations_id=? AND year=?");
$q->execute([$registrations_id,$config['FAIRYEAR']]);
$q = $pdo->prepare('SELECT id FROM projects WHERE registrations_id=? AND year=?');
$q->execute([$registrations_id, $config['FAIRYEAR']]);
$i = $q->fetch(PDO::FETCH_ASSOC);
$id = $i['id'];
$stmt = $pdo->prepare("UPDATE projects SET projectnumber=NULL,projectsort=NULL,
@ -80,12 +81,14 @@ switch ($action) {
$stmt->execute([$id]);
show_pdo_errors_if_any($pdo);
list($pn, $ps, $pns, $pss) = generateProjectNumber($registrations_id);
// print("Generated Project Number [$pn]");
$stmt = $pdo->prepare("UPDATE projects SET projectnumber=?,projectsort=?,
$stmt = $pdo->prepare('UPDATE projects SET projectnumber=?,projectsort=?,
projectnumber_seq=?,projectsort_seq=?
WHERE id=?");
$stmt->execute([$pn,$ps,$pns,$pss,$id]);
WHERE id=?');
$stmt->execute([$pn, $ps, $pns, $pss, $id]);
happy_("Generated and Saved Project Number: $pn");
break;
case 'project_save':
@ -102,10 +105,10 @@ function project_save()
global $registrations_id, $config, $pdo;
// first, lets make sure this project really does belong to them
$q = $pdo->prepare("SELECT * FROM projects WHERE registrations_id=? AND year=?");
$q->execute([$registrations_id,$config['FAIRYEAR']]);
$q = $pdo->prepare('SELECT * FROM projects WHERE registrations_id=? AND year=?');
$q->execute([$registrations_id, $config['FAIRYEAR']]);
$projectinfo = $q->fetch(PDO::FETCH_OBJ);
if (!projectinfo) {
if (!$projectinfo) {
echo error(i18n('Invalid project to update'));
}
@ -121,12 +124,12 @@ function project_save()
if (empty($_POST['feedback'])) {
$stmt = $pdo->prepare('UPDATE projects SET '
. "flagged='0'"
. "WHERE id=?");
. 'WHERE id=?');
$stmt->execute([intval($_POST['id'])]);
} else {
$stmt = $pdo->prepare('UPDATE projects SET '
. "flagged='1'"
. "WHERE id=?");
. 'WHERE id=?');
$stmt->execute([intval($_POST['id'])]);
}
show_pdo_errors_if_any($pdo);
@ -138,39 +141,41 @@ function project_save()
} else
$title = stripslashes($_POST['title']);
$stmt = $pdo->prepare("UPDATE projects SET
title=?,
projectdivisions_id=?,
projecttype=?,
language=?,
req_table=?,
req_electricity=?,
req_special=?,
human_participants=?,
animal_participants=?,
summary=?,
summarycountok=?,
feedback=?,
projectsort=?
WHERE id=?");
$stmt->execute([
iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $_POST['title']),
intval($_POST['projectdivisions_id']),
$_POST['projecttype'],
$_POST['language'],
$_POST['req_table'],
$_POST['req_electricity'],
$_POST['req_special'],
$_POST['human_participants'],
$_POST['animal_participants'],
iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $_POST['summary']),
$_POST['summarycountok'],
iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $_POST['feedback']),
$_POST['projectsort'],
intval($_POST['id'])
]);
$stmt = $pdo->prepare(
'UPDATE projects SET
title = :title,
projectdivisions_id = :projectdivisions_id,
projecttype = :projecttype,
language = :language,
req_table = :req_table,
req_electricity = :req_electricity,
req_special = :req_special,
human_participants = :human_participants,
animal_participants = :animal_participants,
summary = :summary,
summarycountok = :summarycountok,
feedback = :feedback,
projectsort = :projectsort
WHERE id = :id'
);
$stmt->bindValue(':title', $_POST['title']);
$stmt->bindValue(':projectdivisions_id', intval($_POST['projectdivisions_id']));
$stmt->bindValue(':projecttype', $_POST['projecttype']);
$stmt->bindValue(':language', $_POST['language']);
$stmt->bindValue(':req_table', $_POST['req_table']);
$stmt->bindValue(':req_electricity', $_POST['req_electricity']);
$stmt->bindValue(':req_special', $_POST['req_special']);
$stmt->bindValue(':human_participants', $_POST['human_participants']);
$stmt->bindValue(':animal_participants', $_POST['animal_participants']);
$stmt->bindValue(':summary', $_POST['summary']);
$stmt->bindValue(':summarycountok', $summarycountok);
$stmt->bindValue(':feedback', $_POST['feedback']);
$stmt->bindValue(':projectsort', $_POST['projectsort']);
$stmt->bindValue(':id', intval($_POST['id']));
$stmt->execute();
show_pdo_errors_if_any($pdo);
happy_('Project information successfully updated');
@ -178,14 +183,14 @@ function project_save()
if ($_POST['projectnumber'] != $projectinfo->projectnumber) {
// check if hte new one is available
$q = $pdo->prepare("SELECT * FROM projects WHERE year=?' AND projectnumber=?");
$q->execute([$config['FAIRYEAR'],$_POST['projectnumber']]);
$q->execute([$config['FAIRYEAR'], $_POST['projectnumber']]);
if ($q->rowCount()) {
error_('Could not change project number. %1 is already in use', array($_POST['projectnumber']));
} else {
$stmt = $pdo->prepare("UPDATE projects SET
$stmt = $pdo->prepare('UPDATE projects SET
projectnumber=?
WHERE id=?");
$stmt->execute([$_POST['projectnumber'],$_POST['id']]);
WHERE id=?');
$stmt->execute([$_POST['projectnumber'], $_POST['id']]);
happy_('Project number successfully changed to %1', array($_POST['projectnumber']));
}
}
@ -193,15 +198,16 @@ function project_save()
function project_load()
{
global $registrations_id, $config, $pdo, $projectcategories_id;
global $registrations_id, $config, $pdo;
// $projectcategories_id=null;
// now lets find out their MAX grade, so we can pre-set the Age Category
$q = $pdo->prepare("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id=?");
$q = $pdo->prepare('SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id=?');
$q->execute([$registrations_id]);
$gradeinfo = $q->fetch(PDO::FETCH_OBJ);
// now lets grab all the age categories, so we can choose one based on the max grade
$q = $pdo->prepare("SELECT * FROM projectcategories WHERE year=? ORDER BY id");
$q = $pdo->prepare('SELECT * FROM projectcategories WHERE year=? ORDER BY id');
$q->execute([$config['FAIRYEAR']]);
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
// save these in an array, just incase we need them later (FIXME: remove this array if we dont need it)
@ -214,24 +220,24 @@ function project_load()
}
// now select their project info
$q = $pdo->prepare("SELECT * FROM projects WHERE registrations_id=? AND year=?");
$q = $pdo->prepare('SELECT * FROM projects WHERE registrations_id=? AND year=?');
// check if it exists, if we didnt find any record, lets insert one
$q->execute([$registrations_id,$config['FAIRYEAR']]);
$q->execute([$registrations_id, $config['FAIRYEAR']]);
$projectinfo = $q->fetch(PDO::FETCH_OBJ);
if (!$projectinfo) {
$stmt = $pdo->prepare("INSERT INTO projects (registrations_id,projectcategories_id,year) VALUES (?,?,?)");
$stmt = $pdo->prepare('INSERT INTO projects (registrations_id,projectcategories_id,year) VALUES (?,?,?)');
// and then pull it back out
$stmt->execute([$registrations_id,$projectcategories_id,$config['FAIRYEAR']]);
$q = $pdo->prepare("SELECT * FROM projects WHERE registrations_id=? AND year=?");
$q->execute([ $registrations_id,$config['FAIRYEAR']]);
$stmt->execute([$registrations_id, $projectcategories_id, $config['FAIRYEAR']]);
$q = $pdo->prepare('SELECT * FROM projects WHERE registrations_id=? AND year=?');
$q->execute([$registrations_id, $config['FAIRYEAR']]);
$projectinfo = $q->fetch(PDO::FETCH_OBJ);
}
// make sure that if they changed their grade on the student page, we update their projectcategories_id accordingly
if ($projectcategories_id && $projectinfo->projectcategories_id != $projectcategories_id) {
echo notice(i18n('Age category changed, updating to %1', array($agecategories[$projectcategories_id]['category'])));
$stmt = $pdo->prepare("UPDATE projects SET projectcategories_id=? WHERE id=?");
$stmt->execute([$projectcategories_id,$projectinfo->id]);
$stmt = $pdo->prepare('UPDATE projects SET projectcategories_id=? WHERE id=?');
$stmt->execute([$projectcategories_id, $projectinfo->id]);
}
// output the current status
@ -267,8 +273,9 @@ function countwords()
<form id="project_form">
<input type="hidden" name="id" value="<?= $projectinfo->id ?>">
<table>
<tr> <td><?= i18n('Project Title') ?>: </td>
<td><input type="text" name="title" size="50" value="<?= htmlspecialchars($projectinfo->title, null, 'ISO8859-1') ?>" /><?= REQUIREDFIELD ?>
<tr>
<td><?= i18n('Project Title') ?>: </td>
<td><input type="text" name="title" size="50" value="<?= htmlspecialchars($projectinfo->title) ?>" /><?= REQUIREDFIELD ?>
<?
if ($config['participant_project_title_charmax'])
echo i18n('(Max %1 characters)', array($config['participant_project_title_charmax']));
@ -297,14 +304,14 @@ function countwords()
} else {
$sel = '';
}
echo "<option $sel value=\"$r->type\">" . htmlspecialchars(i18n($r->type), null, 'ISO8859-1') . "</option>\n";
echo "<option $sel value=\"$r->type\">" . htmlspecialchars(i18n($r->type)) . "</option>\n";
}
echo '</select>' . REQUIREDFIELD . '</td></tr>';
}
?>
<tr>
<td><?= i18n('Age Category') ?>: </td>
<td><?= i18n(get_value_from_2d_array($agecategories, $projectcategories_id, 'category')) ?> (<?= i18n('Grades %1-%2', array($agecategories[$projectcategories_id]['mingrade'], $agecategories[$projectcategories_id]['maxgrade'])) ?>)</td>
<td><?= i18n($agecategories[$projectcategories_id]['category']) ?> (<?= i18n('Grades %1-%2', array($agecategories[$projectcategories_id]['mingrade'], $agecategories[$projectcategories_id]['maxgrade'])) ?>)</td>
</tr><tr>
<td><?= i18n('Division') ?>: </td>
<td>
@ -312,12 +319,12 @@ function countwords()
// ###### Feature Specific - filtering divisions by category
if ($config['filterdivisionbycategory'] == 'yes') {
$q = $pdo->prepare('SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=? AND projectdivisions.year=? AND projectcategoriesdivisions_link.year=? ORDER BY division');
$q->execute([$projectcategories_id,$config['FAIRYEAR'],$config['FAIRYEAR']]);
$q->execute([$projectcategories_id, $config['FAIRYEAR'], $config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
// ###
} else
$q = $pdo->prepare("SELECT * FROM projectdivisions WHERE year=? ORDER BY division");
$q->execute([$config['FAIRYEAR']]);
} else {
$q = $pdo->prepare('SELECT * FROM projectdivisions WHERE year=? ORDER BY division');
$q->execute([$config['FAIRYEAR']]);
}
echo '<select name="projectdivisions_id">';
echo '<option value="">' . i18n('Select a division') . "</option>\n";
@ -326,7 +333,7 @@ function countwords()
$sel = 'selected="selected"';
else
$sel = '';
echo "<option $sel value=\"$r->id\">" . htmlspecialchars(i18n($r->division), null, 'ISO8859-1') . "</option>\n";
echo "<option $sel value=\"$r->id\">" . htmlspecialchars(i18n($r->division)) . "</option>\n";
}
echo '</select>' . REQUIREDFIELD;
@ -468,7 +475,7 @@ function countwords()
echo i18n('%1 words maximum', array($config['participant_project_summary_wordmax']));
echo '</div>';
echo '<tr><td>' . i18n('Feedback') . ': </td><td><textarea cols="60" rows="4" id="feedback" name="feedback">' . htmlspecialchars($projectinfo->feedback, null, 'ISO8859-1') . '</textarea><br />';
echo '<tr><td>' . i18n('Feedback') . ': </td><td><textarea cols="60" rows="4" id="feedback" name="feedback">' . htmlspecialchars($projectinfo->feedback) . '</textarea><br />';
?>
</td></tr>

@ -313,7 +313,13 @@ $(document).ready(function() {
$("#editor_tabs").tabs({
create: function( event, ui ) {
create: function(event, ui) {
update_students();
update_project();
update_reg();
},
activate: function( event, ui ) {
update_students();
update_project();
update_reg();
@ -499,14 +505,25 @@ function print_row($r)
$pcl = 'style="cursor:pointer;" onclick="popup_editor(\'' . get_value_property_or_default($r, 'reg_id') . "','project');\"";
echo "<td $scl>{$status_text}</td>";
echo "<td $scl>" . get_value_property_or_default($r, 'email') . '</td>';
echo "<td $scl>" . get_value_property_or_default($r, 'reg_num') . '</td>';
$pn = str_replace(' ', '&nbsp;', get_value_property_or_default($r, 'projectnumber', ''));
echo "<td $scl>$pn</td>";
echo "<td $pcl>" . get_value_property_or_default($r, 'title') . '</td>';
// echo "<td $scl>" . get_value_property_or_default($r, 'email') . '</td>';
// echo "<td $scl>" . get_value_property_or_default($r, 'reg_num') . '</td>';
// $pn = str_replace(' ', '&nbsp;', get_value_property_or_default($r, 'projectnumber', ''));
// echo "<td $scl>$pn</td>";
// echo "<td $pcl>" . get_value_property_or_default($r, 'title') . '</td>';
// echo "<td $scl>" . i18n(get_value_from_array($cats, get_value_property_or_default($r, 'projectcategories_id'), '')) . '</td>';
// echo "<td $scl>" . i18n(get_value_from_array($divs, get_value_property_or_default($r, 'projectdivisions_id', ''))) . '</td>';
echo "<td $scl>{$r->email}</td>";
echo "<td $scl>{$r->reg_num}</td>";
$pn = str_replace(' ', '&nbsp;', $r->projectnumber);
echo "<td $scl>$pn</td>";
echo "<td $pcl>{$r->title}</td>";
echo "<td $scl>".i18n($cats[$r->projectcategories_id])."</td>";
echo "<td $scl>".i18n($divs[$r->projectdivisions_id])."</td>";
echo "<td $scl>" . i18n(get_value_from_array($cats, get_value_property_or_default($r, 'projectcategories_id'), '')) . '</td>';
echo "<td $scl>" . i18n(get_value_from_array($divs, get_value_property_or_default($r, 'projectdivisions_id', ''))) . '</td>';
$sq = $pdo->prepare("SELECT students.firstname,
students.lastname,

@ -208,7 +208,8 @@ if (get_value_from_array($_POST, 'action') == 'received' && get_value_from_array
list($projectnumber, $ps, $pns, $pss) = generateProjectNumber($reg_id);
$stmt = $pdo->prepare("UPDATE projects SET projectnumber='$projectnumber',
projectsort='$ps',projectnumber_seq='$pns',projectsort_seq='$pss'
WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'");
WHERE registrations_id='$reg_id' AND year=$config{['FAIRYEAR']}");
$stmt->execute();
echo happy(i18n('Assigned Project Number: %1', array($projectnumber)));
} else
$projectnumber = $projectnum;
@ -298,9 +299,9 @@ if ($showformatbottom) {
echo '</table>';
echo '<br>';
echo i18n(" <lh>'Receive All' notes:</lh> <ul><li>The button will mark all open-status students that have completed registration as having their $signatureformpermissionform received.
\t \t\t\t\t\t\t\t\t\t\t\t\t <li> Students with above status will be emailed a \"$signatureformpermissionform received\" confirmation.
\t \t\t\t\t\t\t\t\t\t\t\t\t <li> Project numbers will be assigned to these students' projects.
\t \t\t\t\t\t\t\t\t\t\t\t\t</ul>");
<li> Students with above status will be emailed a \"$signatureformpermissionform received\" confirmation.
<li> Project numbers will be assigned to these students' projects.
</ul>");
}
if (get_value_from_array($_POST, 'action') == 'receive_all') {

@ -33,7 +33,7 @@ user_auth_required('committee', 'admin');
if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POST, 'save') == 'add') {
if (get_value_from_array($_POST, 'save') == 'add') {
$q = $pdo->prepare("INSERT INTO schools (year) VALUES (?)");
$q = $pdo->prepare('INSERT INTO schools (year) VALUES (?)');
$q->execute([$config['FAIRYEAR']]);
$id = $pdo->lastInsertId();
} else
@ -49,7 +49,7 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS
*/
/* Get the uids for principal/science head */
$q = $pdo->prepare("SELECT principal_uid,sciencehead_uid FROM schools WHERE id=?");
$q = $pdo->prepare('SELECT principal_uid,sciencehead_uid FROM schools WHERE id=?');
$q->execute([$id]);
$i = $q->fetch(PDO::FETCH_ASSOC);
@ -177,31 +177,32 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS
atrisk=?
WHERE id=?';
$stmt = $pdo->prepare($exec);
$stmt->execute([
get_value_from_array($_POST, 'school'),
get_value_from_array($_POST, 'schoollang'),
get_value_from_array($_POST, 'designate'), // FIXED: Corrected key name
get_value_from_array($_POST, 'schoollevel'),
get_value_from_array($_POST, 'board'),
get_value_from_array($_POST, 'district'),
get_value_from_array($_POST, 'address'),
get_value_from_array($_POST, 'city'),
get_value_from_array($_POST, 'province_code'),
get_value_from_array($_POST, 'postalcode'),
get_value_from_array($_POST, 'schoolemail'),
get_value_from_array($_POST, 'phone'),
get_value_from_array($_POST, 'fax'),
get_value_from_array($_POST, 'registration_password'),
get_value_from_array($_POST, 'projectlimit'),
get_value_from_array($_POST, 'projectlimitper'),
get_value_from_array($_POST, 'accesscode'),
get_value_from_array($_POST, 'sciencehead'), // FIXED: Using function for consistency
get_value_from_array($_POST, 'principal'),
get_value_from_array($_POST, 'atrisk'),
get_value_from_array($_POST, 'id')
]);
$stmt = $pdo->prepare($exec);
$stmt->execute([
get_value_from_array($_POST, 'school'),
get_value_from_array($_POST, 'schoollang'),
get_value_from_array($_POST, 'designate'), // FIXED: Corrected key name
get_value_from_array($_POST, 'schoollevel'),
get_value_from_array($_POST, 'board'),
get_value_from_array($_POST, 'district'),
get_value_from_array($_POST, 'address'),
get_value_from_array($_POST, 'city'),
get_value_from_array($_POST, 'province_code'),
get_value_from_array($_POST, 'postalcode'),
get_value_from_array($_POST, 'schoolemail'),
get_value_from_array($_POST, 'phone'),
get_value_from_array($_POST, 'fax'),
get_value_from_array($_POST, 'registration_password'),
get_value_from_array($_POST, 'projectlimit'),
get_value_from_array($_POST, 'projectlimitper'),
get_value_from_array($_POST, 'accesscode'),
get_value_from_array($_POST, 'sciencehead'), // FIXED: Using function for consistency
get_value_from_array($_POST, 'principal'),
get_value_from_array($_POST, 'atrisk'),
get_value_from_array($_POST, 'id')
]);
show_pdo_errors_if_any($pdo);
if (get_value_from_array($_POST, 'save') == 'add')
$notice = 'added';
@ -210,13 +211,13 @@ $stmt->execute([
}
if (get_value_from_array($_GET, 'action') == 'delete' && get_value_from_array($_GET, 'delete', '')) {
$stmt = $pdo->prepare("DELETE FROM schools WHERE id=?");
$stmt = $pdo->prepare('DELETE FROM schools WHERE id=?');
$stmt->execute([$_GET['delete']]);
$notice = 'deleted';
}
if (get_value_from_array($_GET, 'action') == 'clearaccesscodes') {
$stmt = $pdo->prepare("UPDATE schools SET accesscode=NULL WHERE year=?");
$stmt = $pdo->prepare("UPDATE schools SET accesscode='' WHERE year=?");
$stmt->execute([$config['FAIRYEAR']]);
$notice = 'clearaccess';
}
@ -226,8 +227,8 @@ if (get_value_from_array($_GET, 'action') == 'makeaccesscodes') {
$q->execute([$config['FAIRYEAR']]);
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$ac = generatePassword(5);
$stmt = $pdo->prepare("UPDATE schools SET accesscode=? WHERE id=? AND year=?");
$stmt->execute([$ac,$r->id,$config['FAIRYEAR']]);
$stmt = $pdo->prepare('UPDATE schools SET accesscode=? WHERE id=? AND year=?');
$stmt->execute([$ac, $r->id, $config['FAIRYEAR']]);
}
$notice = 'makeaccess';
}
@ -240,7 +241,7 @@ if (get_value_from_array($_GET, 'action') == 'edit' || get_value_from_array($_GE
'schools_management');
if (get_value_from_array($_GET, 'action') == 'edit') {
$buttontext = 'Save School';
$q = $pdo->prepare("SELECT * FROM schools WHERE id=?");
$q = $pdo->prepare('SELECT * FROM schools WHERE id=?');
$q->execute([get_value_from_array($_GET, 'edit', '')]);
$r = $q->fetch(PDO::FETCH_OBJ);
} else if (get_value_from_array($_GET, 'action') == 'add') {
@ -260,8 +261,9 @@ if (get_value_from_array($_GET, 'action') == 'edit' || get_value_from_array($_GE
echo '<tr><td>' . i18n('School Language') . '</td><td>';
echo '<select name="schoollang">';
echo '<option value="">' . i18n('Choose') . "</option>\n";
foreach ($config['languages'] AS $k => $l) {
echo "<option $sel value=\"$k\">" . i18n($limportant_dates) . "</option>\n";
echo "<option $sel value=\"$k\">" . i18n($l) . "</option>\n";
}
echo '</select>';
@ -394,7 +396,7 @@ if (get_value_from_array($_GET, 'action') == 'edit' || get_value_from_array($_GE
echo ' <th>' . i18n('Action') . '</th>';
echo "</tr></thead>\n";
$q = $pdo->prepare("SELECT * FROM schools WHERE year=? ORDER BY school");
$q = $pdo->prepare('SELECT * FROM schools WHERE year=? ORDER BY school');
$q->execute([$config['FAIRYEAR']]);
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
echo "<tr>\n";

@ -93,9 +93,11 @@ switch ($action) {
$q = $pdo->prepare("SELECT id FROM emergencycontact WHERE students_id=? AND registrations_id=? AND year=?");
$q->execute([$remove_id,$registrations_id,$config['FAIRYEAR']]);
// no need to error message if this doesnt exist
if ($q->rowCount() == 1)
if ($q->rowCount() == 1) {
$stmt = $do->prepare("DELETE FROM emergencycontact WHERE students_id=? AND registrations_id=? AND year=?");
$stmt->execute([$remove_id,$registrations_id,$config['FAIRYEAR']]);
$stmt->execute([$remove_id,$registrations_id,$config['FAIRYEAR']]);
}
if ($q->rowCount() != 1) {
error_('Invalid student to remove');
exit;
@ -107,10 +109,12 @@ switch ($action) {
// now see if they have an emergency contact that also needs to be removed
$q = $pdo->prepare("SELECT id FROM emergencycontact WHERE students_id=? AND registrations_id=? AND year=?");
$q->execute([$remove_id,$registrations_id,$config['FAIRYEAR']]);
// no need to error message if this doesnt exist
if ($q->rowCount() == 1)
if ($q->rowCount() == 1) {
$stmt = $do->prepare("DELETE FROM emergencycontact WHERE students_id=? AND registrations_id=? AND year=?");
$stmt->execute([$remove_id,$registrations_id,$config['FAIRYEAR']]);
$stmt->execute([$remove_id,$registrations_id,$config['FAIRYEAR']]);
}
$stmt = $pdo->prepare("DELETE FROM students WHERE id=? AND registrations_id=?");
$stmt->execute([$remove_id,$registrations_id]);
@ -119,9 +123,10 @@ switch ($action) {
$q = $pdo->prepare("SELECT id FROM emergencycontact WHERE students_id=? AND registrations_id=? AND year=?");
$q->execute([$remove_id,$registrations_id,$config['FAIRYEAR']]);
// no need to error message if this doesnt exist
if ($q->rowCount() == 1)
if ($q->rowCount() == 1) {
$stmt = $do->prepare("DELETE FROM emergencycontact WHERE students_id=? AND registrations_id=? AND year=?");
$stmt->execute([$remove_id,$registrations_id,$config['FAIRYEAR']]);
$stmt->execute([$remove_id,$registrations_id,$config['FAIRYEAR']]);
}
happy_('Student successfully removed');
exit;
@ -501,10 +506,11 @@ function registration_load()
do {
$regnum = rand(100000, 999999);
$q = $pdo->prepare("SELECT * FROM registrations WHERE num=? AND year=?");
$q->execute([$regnum,$config['FAIRYEAR']]);
$q->execute([$regnum, $config['FAIRYEAR']]);
} while ($q->rowCount() > 0);
$r['num'] = $regnum;
echo notice(i18n('New registration number generated.'));
echo notice(i18n('This new registration will added when the "Save Registration Information" button is pressed below. At that time the other tabs will become available.'));
} else {

@ -29,9 +29,9 @@ header('Content-Type: text/html; charset=utf8');
include_once ('helper.inc.php');
// set error reporting to not show notices, for some reason some people's installation dont set this by default
// so we will set it in the code instead just to make sure
error_reporting(E_ALL);
// error_reporting(E_ALL);
// error_reporting( E_ALL ^ E_WARNING );
// error_reporting( E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED );
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED);
define('REQUIREDFIELD', '<span class="requiredfield">*</span>');
@ -383,7 +383,6 @@ function send_header($title = '', $nav = null, $icon = null, $titletranslated =
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.32.0/js/jquery.tablesorter.min.js" integrity="sha512-O/JP2r8BG27p5NOtVhwqsSokAwEP5RwYgvEzU9G6AfNjLYqyt2QT8jqU1XrXCiezS50Qp1i3ZtCQWkHZIRulGA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- <script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/js/jqueryui/1.7.2/jquery-ui.min.js"></script> -->
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/js/sfiab.js"></script>
<script type="text/javascript" src="<?= $config['SFIABDIRECTORY'] ?>/theme/<?= $config['theme'] ?>/theme-script.js"></script>
@ -957,7 +956,8 @@ function email_send($val, $to, $sub_subject = array(), $sub_body = array())
}
$q = $pdo->prepare('SELECT * FROM emails WHERE val=?');
if ($r = $q->fetch(PDO::FETCH_ASSOC)) {
$q->execute([$val]);
if ($r = $q->fetch(PDO::FETCH_OBJ)) {
// we dont want to translate these, the messages themselves shoudl contain whatever languages they need
$subject = $r->subject;
$body = $r->body;
@ -966,18 +966,18 @@ function email_send($val, $to, $sub_subject = array(), $sub_body = array())
/* Eventually we should just do this with communication_replace_vars() */
if (count($sub_subject)) {
foreach ($sub_subject as $sub_k => $sub_v) {
$subject = preg_replace("\[$sub_k\]", "$sub_v", $subject);
$subject = preg_replace("/\[$sub_k\]/", "$sub_v", $subject);
}
}
if (count($sub_body)) {
foreach ($sub_body as $sub_k => $sub_v) {
$body = preg_replace("\[$sub_k\]", "$sub_v", $body);
$body = preg_replace("/\[$sub_k\]/", "$sub_v", $body);
}
}
if (count($sub_body)) {
foreach ($sub_body as $sub_k => $sub_v) {
$bodyhtml = preg_replace("\[$sub_k\]", "$sub_v", $bodyhtml);
$bodyhtml = preg_replace("/\[$sub_k\]/", "$sub_v", $bodyhtml);
}
}
@ -991,8 +991,7 @@ function email_send($val, $to, $sub_subject = array(), $sub_body = array())
// only send the email if we have a from
if ($fr) {
// send using RMail
// FIXME EMAIL
// //email_send_new($to, $fr, $subject, $body, $bodyhtml);
email_send_new($to, $fr, $subject, $body, $bodyhtml);
} else
echo error(i18n("CRITICAL ERROR: email '%1' does not have a 'From' and the Fair Manager Email is not configured", array($val), array('email key name')));
} else {
@ -1000,6 +999,70 @@ function email_send($val, $to, $sub_subject = array(), $sub_body = array())
}
}
function curl_request($to, $from, $subject, $text, $bodyhtml)
{
global $EMAIL_TRANSPORTER_URL;
$url = $EMAIL_TRANSPORTER_URL;
// The data you want to send via POST
// $fields = [
// '__VIEWSTATE ' => $state,
// '__EVENTVALIDATION' => $valid,
// 'btnSubmit' => 'Submit'
// ];
// $fields = '{
// "from" :"' . $from . '",
// "to" :"' . $to . '",
// "subject" :"' . $subject . '",
// "text" :"' . $text . '",
// "html": "' . $bodyhtml . '"
// }';
$fields = [
'from' => $from,
'to' => $to,
'subject' => $subject,
'text' => $text,
'html' => $bodyhtml
];
$fields_json = json_encode($fields);
error_log($fields_json);
// url-ify the data for the POST
// $fields_string = http_build_query($fields);
// open connection
$ch = curl_init();
// set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Connection: Keep-Alive'
));
curl_setopt($ch, CURLOPT_VERBOSE, true);
// So that curl_exec returns the contents of the cURL; rather than echoing it
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// execute post
$result = curl_exec($ch);
error_log('cURL Error: ' . curl_error($ch));
error_log('result_from_function' . $result);
return $result;
}
function email_send_new($to, $from, $subject, $text, $bodyhtml)
{
curl_request($to, $from, $subject, $text, $bodyhtml);
}
/*
* require_once("Rmail/Rmail.php");
* require_once("Rmail/RFC822.php");
@ -1078,7 +1141,7 @@ function output_page_text($textname)
global $config;
global $pdo;
$q = $pdo->prepare("SELECT * FROM pagetext WHERE textname=? AND year=? AND lang=?");
$q = $pdo->prepare('SELECT * FROM pagetext WHERE textname=? AND year=? AND lang=?');
$q->execute([$textname, $config['FAIRYEAR'], $_SESSION['lang']]);
if ($q->rowCount())
$r = $q->fetch();
@ -1103,7 +1166,7 @@ function output_page_cms($filename)
global $config;
global $pdo;
$q = $pdo->prepare("SELECT * FROM cms WHERE filename=? AND lang=? ORDER BY dt DESC LIMIT 1");
$q = $pdo->prepare('SELECT * FROM cms WHERE filename=? AND lang=? ORDER BY dt DESC LIMIT 1');
$q->execute([$filename, $_SESSION['lang']]);
if ($q->rowCount()) {
$r = $q->fetch();
@ -1199,8 +1262,14 @@ function format_date($d)
global $config;
if (is_numeric($d))
return date($config['dateformat'], $d);
else
return date($config['dateformat'], strtotime($d));
else {
if ($d != '0000-00-00')
return date($config['dateformat'], strtotime($d));
else {
return i18n('Not set.');
// return '0000-00-00';
}
}
}
// $t can be a unix timestamp integer, or a text string, eg 10:23:48

@ -51,6 +51,11 @@ if (get_value_from_array($_POST, 'action') == 'save' && get_value_from_array($_P
}
if (get_value_from_array($_POST, 'action') == 'new') {
if ($_POST['ord'] == ''){
$_POST['ord'] = 0;
}
if ($_POST['question']) {
$stmt = $pdo->prepare("INSERT INTO safetyquestions (question,type,required,ord,year) VALUES (
?,
@ -91,15 +96,19 @@ if ((get_value_from_array($_GET, 'action') == 'edit' && get_value_from_array($_G
$showform = false;
echo error(i18n('Invalid safety question'));
}
}
if ($showform) {
$r = array();
echo '<table class="summarytable">';
echo '<tr><td>' . i18n('Question') . '</td><td>';
echo '<input size="60" type="text" name="question" value="' . htmlspecialchars(get_value_from_array($r, 'question', '')) . "\">\n";
echo '<input size="60" type="text" name="question" value="' . htmlspecialchars($r->question) . "\">\n";
echo '</td></tr>';
echo '<tr><td>' . i18n('Type') . '</td><td>';
echo '<select name="type">';
if ($r->type == 'check')
$sel = 'selected="selected"';
else
@ -127,7 +136,7 @@ if ((get_value_from_array($_GET, 'action') == 'edit' && get_value_from_array($_G
echo '</select>';
echo '</td>';
echo '<tr><td>' . i18n('Display Order') . '</td><td>';
echo '<input size="5" type="text" name="ord" value="' . htmlspecialchars(get_value_from_array($r, 'ord', '')) . "\">\n";
echo '<input size="5" type="text" name="ord" value="' . htmlspecialchars($r->ord) . "\">\n";
echo '</td></tr>';
echo '<tr><td colspan="2" align="center">';
echo '<input type="submit" value="' . i18n($buttontext) . "\" />\n";
@ -139,6 +148,7 @@ if ((get_value_from_array($_GET, 'action') == 'edit' && get_value_from_array($_G
} else {
}
}
echo '<br />';
echo '<a href="safetyquestions.php?action=new">' . i18n('Add new safety question') . '</a>';

@ -67,7 +67,11 @@ if (get_value_from_array($_POST, 'action') == 'save') {
$stmt->execute();
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`=?, `text`=? WHERE name='postamble'");
$stmt->execute([$usepa,get_value_from_array($_POST, 'postamble')]);
$stmt->execute([$usepa, get_value_from_array($_POST, 'postamble')]);
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`=?, `text`=? WHERE name='useteacherdeclaration'");
$stmt->execute([$usete, get_value_from_array($_POST, 'useteacherdeclaration')]);
$stmt = $pdo->prepare("UPDATE signaturepage SET `use`=?, `text`='' WHERE name='regfee'");
$stmt->execute([$userf]);
echo happy(i18n("$sentence_begin_participationform text successfully saved"));

@ -33,7 +33,7 @@ global $stats_totalstudents;
// first, lets make sure someone isnt tryint to see something that they arent allowed to!
$q = $pdo->prepare("SELECT (NOW()>? AS test");
$q->execute($config['dates']['postparticipants']);
$q->execute([$config['dates']['postparticipants']]);
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->test != 1) {
list($d, $t) = explode(' ', $config['dates']['postparticipants']);

@ -80,8 +80,11 @@ switch (get_value_from_array($_GET, 'action')) {
$u['flagged_judge'] = '1';
}
user_save($u);
questions_save_answers('judgereg', $u['id'], $_POST['questions']);
user_save($u);
if($POST['questions'])
questions_save_answers('judgereg', $u['id'], $_POST['questions']);
happy_('Preferences successfully saved');
$u = user_load($eid);

@ -52,7 +52,7 @@ function getProjectsEligibleForAward($award_id)
ORDER BY
projectsort
");
$prjq->execute($award_id, [$config['FAIRYEAR']]);
$prjq->execute([$award_id, $config['FAIRYEAR']]);
$projects = array();
while ($prjr = $prjq->fetch(PDO::FETCH_OBJ)) {
$projects[$prjr->projectnumber] = array(
@ -146,7 +146,7 @@ function getSpecialAwardsEligibleForProject($projectid)
AND award_types.id=award_awards.award_types_id
AND award_awards.id=award_awards_projectcategories.award_awards_id
AND award_awards.id=award_awards_projectdivisions.award_awards_id
AND projects.projectcategories_ipreparequeryd=award_awards_projectcategories.projectcategories_id
AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id
AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id
AND award_awards.id is not null
AND projects.year=?
@ -328,7 +328,7 @@ function getSpecialAwardsNominatedByRegistrationID($id)
");
$awardq->execute([$award_id, $config['FAIRYEAR']]);
$projects = array();
while ($prjr = $prjq->fetch(PDO::FETCH_OBJ)) {
while ($prjr = $awardq->fetch(PDO::FETCH_OBJ)) {
$projects[$prjr->projectnumber] = array(
'id' => $prjr->projects_id,
'projectnumber' => $prjr->projectnumber,

@ -27,14 +27,14 @@
function questions_load_answers($section, $users_id)
{
global $pdo, $config;
$yearq = $pdo->prepare("SELECT `year` FROM users WHERE id=?");
$yearq = $pdo->prepare('SELECT `year` FROM users WHERE id=?');
$yearq->execute([$users_id]);
$yearr = $yearq->fetch(PDO::FETCH_OBJ);
$ans = array();
$qs = questions_load_questions($section, $yearr->year);
foreach ($qs AS $id => $question) {
$q = $pdo->prepare("SELECT * FROM question_answers WHERE users_id=? AND questions_id=?");
$q = $pdo->prepare('SELECT * FROM question_answers WHERE users_id=? AND questions_id=?');
$q->execute([$users_id, $id]);
$r = $q->fetch(PDO::FETCH_OBJ);
$ans[$id] = get_value_or_default($r, 'answer', '');
@ -46,8 +46,8 @@ function questions_load_questions($section, $year)
{
global $pdo;
$q = $pdo->prepare('SELECT * FROM questions '
. "WHERE year=?"
. " AND section=?"
. 'WHERE year=?'
. ' AND section=?'
. 'ORDER BY ord ASC');
$q->execute([$year, $section]);
@ -63,18 +63,20 @@ function questions_load_questions($section, $year)
$qs[$r->id]['required'] = $r->required;
$qs[$r->id]['question'] = $r->question;
}
return $qs;
}
function questions_save_answers($section, $id, $answers)
{
global $config, $pdo;
$qs = questions_load_questions($section, $config['FAIRYEAR']);
$keys = array_keys($answers);
$q = $pdo->prepare("SELECT * FROM questions WHERE year=?");
$q = $pdo->prepare('SELECT * FROM questions WHERE year=?');
$q->execute([$config['FAIRYEAR']]);
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$stmt = $pdo->prepare("DELETE FROM question_answers WHERE users_id=? AND questions_id=?");
$stmt = $pdo->prepare('DELETE FROM question_answers WHERE users_id=? AND questions_id=?');
$stmt->execute([$id, $r->id]);
show_pdo_errors_if_any($pdo);
}
@ -82,8 +84,8 @@ function questions_save_answers($section, $id, $answers)
$keys = array_keys($answers);
foreach ($keys as $qid) {
/* Poll key */
$stmt = $pdo->prepare("INSERT INTO question_answers
(users_id,questions_id,answer) VALUES(?,?,?)");
$stmt = $pdo->prepare('INSERT INTO question_answers
(users_id,questions_id,answer) VALUES(?,?,?)');
$stmt->execute([$id, $qid, $answers[$qid]]);
}
}
@ -92,8 +94,8 @@ function questions_find_question_id($section, $dbheading)
{
global $pdo;
$q = $pdo->prepare('SELECT id FROM questions WHERE '
. " section=?"
. " AND db_heading=?");
. ' section=?'
. ' AND db_heading=?');
$q->execute([$section, $dbheading]);
if ($q->rowCount() == 1) {
$r = $q->fetch(PDO::FETCH_OBJ);
@ -107,21 +109,23 @@ function questions_print_answer_editor($section, &$u, $array_name)
$ans = questions_load_answers($section, $u['id']);
$qs = questions_load_questions($section, $u['year']);
$keys = array_keys($qs);
foreach ($keys as $qid) {
$required = $qs[$qid]['required'] == 'yes' ? '<span class="requiredfield" style="float:right">&nbsp;*</span>' : '';
print ("<tr>\n");
print (" <td colspan=\"2\">$required" . i18n($qs[$qid]['question']) . "</td>\n");
print (' <td colspan="2">');
$iname = "{$array_name}[{$qid}]";
switch ($qs[$qid]['type']) {
case 'yesno':
if ($ans[$qid] == 'yes')
if ($ans[$qid]->answer == 'yes')
$ch = 'checked="checked"';
else
$ch = '';
print ("<input onclick=\"fieldChanged()\" $ch type=\"radio\" name=\"$iname\" value=\"yes\" />" . i18n('Yes'));
print ('&nbsp; &nbsp; ');
if ($ans[$qid] == 'no')
if ($ans[$qid]->answer == 'no')
$ch = 'checked="checked"';
else
$ch = '';
@ -133,14 +137,14 @@ function questions_print_answer_editor($section, &$u, $array_name)
. "value=\"{$ans[$qid]}\" >\n");
break;
case 'check':
if ($ans[$qid] == 'yes')
if ($ans[$qid]->answer == 'yes')
$ch = 'checked="checked"';
else
$ch = '';
print ("<input $ch type=\"checkbox\" name=\"$iname\" value=\"yes\">\n");
break;
case 'text':
print ("<input type=\"text\" name=\"$iname\" value=\"{$ans[$qid]}\">\n");
print ("<input type=\"text\" name=\"$iname\" value=\"{$ans[$qid]->answer}\">\n");
break;
}
print ("</td>\n");
@ -179,13 +183,13 @@ function questions_update_question($qs)
{
global $pdo;
$qs['ord'] = $qs['ord'] ?? '';
$stmt = $pdo->prepare("UPDATE questions SET
$stmt = $pdo->prepare('UPDATE questions SET
question=?,
type=?,
db_heading=?,
required=?,
ord=?
WHERE id=?");
WHERE id=?');
$stmt->execute([$qs['question'], $qs['type'], $qs['db_heading'], $qs['required'], intval($qs['ord']), $qs['id']]);
show_pdo_errors_if_any($pdo);
}
@ -194,7 +198,7 @@ function questions_save_new_question($qs, $year)
{
global $pdo;
$stmt = $pdo->prepare('INSERT INTO questions (question,type,section,db_heading,required,ord,year) VALUES (?,?,?,?,?,?,?)');
$stmt->execute([$qs['question'],$qs['type'],$qs['section'],$qs['db_heading'],$qs['required'],$year]);
$stmt->execute([$qs['question'], $qs['type'], $qs['section'], $qs['db_heading'], $qs['required'], $year]);
show_pdo_errors_if_any($pdo);
}
@ -241,7 +245,7 @@ function questions_editor($section, $year, $array_name, $self)
$qs = questions_load_questions($section, $year);
/* Delete this question */
$stmt = $pdo->prepare("DELETE FROM questions WHERE id=?");
$stmt = $pdo->prepare('DELETE FROM questions WHERE id=?');
$stmt->execute([$qid]);
/* Update the order of all questions after this one */
@ -260,17 +264,19 @@ function questions_editor($section, $year, $array_name, $self)
if (get_value_from_array($_GET, 'action') == 'import' && get_value_from_array($_GET, 'impyear')) {
$x = 0;
$q = $pdo->prepare("SELECT * FROM questions WHERE year=?");
$q = $pdo->prepare('SELECT * FROM questions WHERE year=?');
$q->execute([$_GET['impyear']]);
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$x++;
$stmt = $pdo->prepare("INSERT INTO questions (id,year,section,db_heading,question,type,required,ord)
VALUES (?,?,?,?,?,?,?)");
$stmt->execute([$year,$r->section,$r->question,$r->type,$r->required,$r->ord]);
\t\t\t\t\t\t\t\tVALUES (?,?,?,?,?,?,?)");
$stmt->execute([$year, $r->section, $r->question, $r->type, $r->required, $r->ord]);
}
echo happy(i18n('%1 question(s) successfully imported',
array($x)));
echo happy(i18n(
'%1 question(s) successfully imported',
array($x)
));
}
/*
@ -314,7 +320,7 @@ function questions_editor($section, $year, $array_name, $self)
if ($qdir != 0) {
$qs[$qid]['ord'] += $qdir;
/* Update the db */
$stmt = $pdo->prepare("UPDATE questions SET ord=? WHERE id=?");
$stmt = $pdo->prepare('UPDATE questions SET ord=? WHERE id=?');
$stmt->execute([$qs[$qid]['ord'], $qid]);
$keys = array_keys($qs);
$originalq = $qs[$qid];
@ -326,11 +332,11 @@ function questions_editor($section, $year, $array_name, $self)
continue;
if ($qdir == 1) {
$qs[$q]['ord']--;
$stmt = $pdo->prepare("UPDATE questions SET ord=? WHERE id=?");
$stmt = $pdo->prepare('UPDATE questions SET ord=? WHERE id=?');
$stmt->execute([$qs[$q]['ord'], $q]);
} else {
$qs[$q]['ord']++;
$stmt = $pdo->prepare("UPDATE questions SET ord=? WHERE id=?");
$stmt = $pdo->prepare('UPDATE questions SET ord=? WHERE id=?');
$stmt->execute([$qs[$q]['ord'], $q]);
}
@ -438,10 +444,12 @@ function questions_editor($section, $year, $array_name, $self)
. '<th width=10%>' . i18n('Actions') . '</th></tr>';
$keys = array_keys($qs);
$types = array('check' => i18n('Check box'),
$types = array(
'check' => i18n('Check box'),
'yesno' => i18n('Yes/No'),
'text' => i18n('Text'),
'int' => i18n('Number'));
'int' => i18n('Number')
);
foreach ($keys as $qid) {
echo "<tr><td>{$qs[$qid]['ord']}</td>";

@ -1,244 +1,242 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
* This file is part of the 'Science Fair In A Box' project
* SFIAB Website: http://www.sfiab.ca
*
* Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
* Copyright (C) 2005 James Grant <james@lightbox.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, version 2.
*
* 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
?>
<?
function registrationFormsReceived($reg_id="")
{ global $pdo;
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
$q=$pdo->prepare("SELECT status FROM registrations WHERE id=?");
function registrationFormsReceived($reg_id = '')
{
global $pdo;
if ($reg_id)
$rid = $reg_id;
else
$rid = $_SESSION['registration_id'];
$q = $pdo->prepare('SELECT status FROM registrations WHERE id=?');
$q->execute([$rid]);
$r=$q->fetch(PDO::FETCH_OBJ);
if($r->status=="complete" || $r->status=="paymentpending")
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->status == 'complete' || $r->status == 'paymentpending')
return true;
else
return false;
}
function registrationDeadlinePassed()
{
global $config, $pdo;
$q=$pdo->prepare("SELECT (NOW()<?) AS datecheck");
$q = $pdo->prepare('SELECT (NOW()<?) AS datecheck');
$q->execute([$config['dates']['regclose']]);
$datecheck=$q->fetch(PDO::FETCH_OBJ);
if($datecheck->datecheck==1)
$datecheck = $q->fetch(PDO::FETCH_OBJ);
if ($datecheck->datecheck == 1)
return false;
else
return true;
}
function studentStatus($reg_id="")
function studentStatus($reg_id = '')
{
global $config, $pdo;
if($config['participant_student_personal']=="yes")
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id","sex");
if ($config['participant_student_personal'] == 'yes')
$required_fields = array('firstname', 'lastname', 'address', 'city', 'postalcode', 'phone', 'email', 'grade', 'dateofbirth', 'schools_id', 'sex');
else
$required_fields=array("firstname","lastname","email","grade","schools_id");
$required_fields = array('firstname', 'lastname', 'email', 'grade', 'schools_id');
if($config['participant_student_tshirt']=="yes")
$required_fields[]="tshirt";
if ($config['participant_student_tshirt'] == 'yes')
$required_fields[] = 'tshirt';
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
if ($reg_id)
$rid = $reg_id;
else
$rid = $_SESSION['registration_id'];
$q=$pdo->prepare("SELECT * FROM students WHERE registrations_id=? AND year=?");
$q->execute([$rid,$config['FAIRYEAR']]);
//if we dont have the minimum, return incomplete
if($q->rowCount()<$config['minstudentsperproject'])
return "incomplete";
$q = $pdo->prepare('SELECT * FROM students WHERE registrations_id=? AND year=?');
$q->execute([$rid, $config['FAIRYEAR']]);
// if we dont have the minimum, return incomplete
if ($q->rowCount() < $config['minstudentsperproject'])
return 'incomplete';
while($r=$q->fetch(PDO::FETCH_OBJ))
{
foreach ($required_fields AS $req)
{
if($req=="dateofbirth")
{
if($r->$req=="0000-00-00" || !$r->$req)
return "incomplete";
}
else
{
if(!$r->$req)
return "incomplete";
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
foreach ($required_fields as $req) {
if ($req == 'dateofbirth') {
if ($r->$req == '0000-00-00' || !$r->$req)
return 'incomplete';
} else {
if (!$r->$req)
return 'incomplete';
}
}
}
//if it made it through without returning incomplete, then we must be complete
return "complete";
// if it made it through without returning incomplete, then we must be complete
return 'complete';
}
function emergencycontactStatus($reg_id="")
function emergencycontactStatus($reg_id = '')
{
global $config, $pdo;
$required_fields=array("firstname","lastname","relation","phone1");
$required_fields = array('firstname', 'lastname', 'relation', 'phone1');
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
if ($reg_id)
$rid = $reg_id;
else
$rid = $_SESSION['registration_id'];
$sq=$pdo->prepare("SELECT id FROM students WHERE registrations_id=? AND year=?");
$sq = $pdo->prepare('SELECT id FROM students WHERE registrations_id=? AND year=?');
$sq->execute([$rid, $config['FAIRYEAR']]);
$numstudents=$sq->rowCount();
$numstudents = $sq->rowCount();
while($sr=$sq->fetch(PDO::FETCH_OBJ))
{
$q=$pdo->prepare("SELECT * FROM emergencycontact WHERE registrations_id=? AND year=? AND students_id=?");
while ($sr = $sq->fetch(PDO::FETCH_OBJ)) {
$q = $pdo->prepare('SELECT * FROM emergencycontact WHERE registrations_id=? AND year=? AND students_id=?');
$q->execute([$rid, $config['FAIRYEAR'], $sr->id]);
$r=$q->fetch(PDO::FETCH_OBJ);
$r = $q->fetch(PDO::FETCH_OBJ);
foreach ($required_fields AS $req)
{
if(!$r->$req)
{
return "incomplete";
foreach ($required_fields as $req) {
if (!$r->$req) {
return 'incomplete';
}
}
}
//if it made it through without returning incomplete, then we must be complete
return "complete";
// if it made it through without returning incomplete, then we must be complete
return 'complete';
}
function projectStatus($reg_id="")
function projectStatus($reg_id = '')
{
global $config, $pdo;
$required_fields=array("title","projectcategories_id","projectdivisions_id","language","req_table","req_electricity","summarycountok");
$required_fields = array('title', 'projectcategories_id', 'projectdivisions_id', 'language', 'req_table', 'req_electricity', 'summarycountok');
if($config['participant_short_title_enable'] == 'yes')
if ($config['participant_short_title_enable'] == 'yes')
$required_fields[] = 'shorttitle';
if($config['ethics_questions'] == 'yes'){
if ($config['ethics_questions'] == 'yes') {
$required_fields[] = 'human_participants';
$required_fields[] = 'animal_participants';
}
if($config['participant_project_summary_wordmin'] > 0)
if ($config['participant_project_summary_wordmin'] > 0)
$required_fields[] = 'summary';
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
if ($reg_id)
$rid = $reg_id;
else
$rid = $_SESSION['registration_id'];
$q=$pdo->prepare("SELECT * FROM projects WHERE registrations_id=? AND year=?");
$q = $pdo->prepare('SELECT * FROM projects WHERE registrations_id=? AND year=?');
$q->execute([$rid, $config['FAIRYEAR']]);
//if we dont have a project entry yet, return empty
if(!$q->rowCount())
return "empty";
// if we dont have a project entry yet, return empty
if (!$q->rowCount())
return 'empty';
while($r=$q->fetch(PDO::FETCH_OBJ))
{
foreach ($required_fields AS $req)
{
if(!$r->$req) {
return "incomplete";
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
foreach ($required_fields as $req) {
if (!$r->$req) {
return 'incomplete';
}
}
}
//if it made it through without returning incomplete, then we must be complete
return "complete";
// if it made it through without returning incomplete, then we must be complete
return 'complete';
}
function mentorStatus($reg_id="")
function mentorStatus($reg_id = '')
{
global $config, $pdo;
$required_fields=array("firstname","lastname","phone","email","organization","description");
$required_fields = array('firstname', 'lastname', 'phone', 'email', 'organization', 'description');
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
if ($reg_id)
$rid = $reg_id;
else
$rid = $_SESSION['registration_id'];
//first check the registrations table to see if 'nummentors' is set, or if its null
$q=$pdo->prepare("SELECT nummentors FROM registrations WHERE id=? AND year=?");
// first check the registrations table to see if 'nummentors' is set, or if its null
$q = $pdo->prepare('SELECT nummentors FROM registrations WHERE id=? AND year=?');
$q->execute([$rid, $config['FAIRYEAR']]);
$r=$q->fetch(PDO::FETCH_OBJ);
if($r->nummentors==null)
return "incomplete";
$q=$pdo->prepare("SELECT * FROM mentors WHERE registrations_id=? AND year=?");
$q->execute([$rid, $config['FAIRYEAR']]);
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->nummentors === -1) {
return 'incomplete';
}
//if we dont have the minimum, return incomplete
if($q->rowCount()<get_value_from_array($config, 'minmentorserproject'))
return "incomplete";
$q = $pdo->prepare('SELECT * FROM mentors WHERE registrations_id=? AND year=?');
$q->execute([$rid, $config['FAIRYEAR']]);
while($r=$q->fetch(PDO::FETCH_OBJ))
{
foreach ($required_fields AS $req)
{
if(!$r->$req)
{
return "incomplete";
// if we dont have the minimum, return incomplete
if ($q->rowCount() < get_value_from_array($config, 'minmentorserproject'))
return 'incomplete';
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
foreach ($required_fields as $req) {
if (!$r->$req) {
return 'incomplete';
}
}
}
//if it made it through without returning incomplete, then we must be complete
return "complete";
// if it made it through without returning incomplete, then we must be complete
return 'complete';
}
function safetyStatus($reg_id="")
function safetyStatus($reg_id = '')
{
global $config, $pdo;
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
if ($reg_id)
$rid = $reg_id;
else
$rid = $_SESSION['registration_id'];
//grab all of their answers
$q=$pdo->prepare("SELECT * FROM safety WHERE registrations_id=?");
// grab all of their answers
$q = $pdo->prepare('SELECT * FROM safety WHERE registrations_id=?');
$q->execute([$rid]);
while($r=$q->fetch(PDO::FETCH_OBJ))
{
$safetyanswers[$r->safetyquestions_id]=$r->answer;
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$safetyanswers[$r->safetyquestions_id] = $r->answer;
}
//now grab all the questions
$q=$pdo->prepare("SELECT * FROM safetyquestions WHERE year=? ORDER BY ord");
// now grab all the questions
$q = $pdo->prepare('SELECT * FROM safetyquestions WHERE year=? ORDER BY ord');
$q->execute([$config['FAIRYEAR']]);
while($r=$q->fetch(PDO::FETCH_OBJ))
{
if($r->required=="yes" && !$safetyanswers[$r->id])
{
return "incomplete";
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
if ($r->required == 'yes' && !$safetyanswers[$r->id]) {
return 'incomplete';
}
}
return "complete";
return 'complete';
}
function spawardStatus($reg_id="")
function spawardStatus($reg_id = '')
{
global $config, $pdo;
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
if ($reg_id)
$rid = $reg_id;
else
$rid = $_SESSION['registration_id'];
$q=$pdo->prepare("SELECT * FROM projects WHERE registrations_id=?");
$q->execute([$rid]);
$project=$q->fetch(PDO::FETCH_OBJ);
$q = $pdo->prepare("SELECT * FROM projects WHERE registrations_id='$rid'");
$q->execute();
$project = $q->fetch(PDO::FETCH_OBJ);
/* We want this query to get any awards with a NULL award_awards_id */
$awardsq=$pdo->prepare("SELECT
$awardsq = $pdo->prepare('SELECT
projects.id AS projects_id
FROM
project_specialawards_link,
@ -246,87 +244,89 @@ function spawardStatus($reg_id="")
WHERE
project_specialawards_link.projects_id=?
AND projects.year=?
");
$awardsq->execute([$project->id,$config['FAIRYEAR']]);
');
$awardsq->execute([$project->id, $config['FAIRYEAR']]);
if($awardsq->rowCount())
return "complete";
if ($awardsq->rowCount())
return 'complete';
else
return "incomplete";
return 'incomplete';
}
function tourStatus($reg_id="")
function tourStatus($reg_id = '')
{
global $config, $pdo;
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
if ($reg_id)
$rid = $reg_id;
else
$rid = $_SESSION['registration_id'];
/* Get the students for this project */
$q=$pdo->prepare("SELECT * FROM students WHERE registrations_id=? AND year=?");
$q->execute([$rid,$config['FAIRYEAR']]);
$q = $pdo->prepare('SELECT * FROM students WHERE registrations_id=? AND year=?');
$q->execute([$rid, $config['FAIRYEAR']]);
$num_found = $q->rowCount();
$ret = "complete";
while($s=$q->fetch(PDO::FETCH_OBJ)) {
//grab all of their tour prefs
$ret = 'complete';
while ($s = $q->fetch(PDO::FETCH_OBJ)) {
// grab all of their tour prefs
$sid = $s->id;
$qq=$pdo->prepare("SELECT * FROM tours_choice WHERE students_id=? and year=? ORDER BY rank");
$qq = $pdo->prepare('SELECT * FROM tours_choice WHERE students_id=? and year=? ORDER BY rank');
$qq->execute([$sid, $config['FAIRYEAR']]);
$n_tours = $qq->rowCount();
if($n_tours > 0) {
if ($n_tours > 0) {
/* See if there's a rank 0 tour (rank 0 == their tour assignment) */
$i = $qq->fetch(PDO::FETCH_OBJ);
if($i->rank == 0) {
/* Yes, there is, no matter what, this student's tour
* selection is complete. */
if ($i->rank == 0) {
/*
* Yes, there is, no matter what, this student's tour
* selection is complete.
*/
continue;
}
}
/* Else, they haven't been assigned a tour, see if they've made
* the appropraite selection(s) */
if( ($n_tours >= $config['tours_choices_min']) && ($n_tours <= $config['tours_choices_max']) ){
/*
* Else, they haven't been assigned a tour, see if they've made
* the appropraite selection(s)
*/
if (($n_tours >= $config['tours_choices_min']) && ($n_tours <= $config['tours_choices_max'])) {
continue;
}
$ret = "incomplete";
$ret = 'incomplete';
break;
}
return $ret;
}
function namecheckStatus($reg_id="")
function namecheckStatus($reg_id = '')
{
global $config, $pdo;
if($reg_id) {
$q=$pdo->prepare("SELECT * FROM students WHERE
registrations_id=?
AND year=?");
$q->execute([$config['FAIRYEAR']]);
if ($reg_id) {
$q = $pdo->prepare('SELECT * FROM students WHERE registrations_id=? AND year=?');
$q->execute([$reg_id, $config['FAIRYEAR']]);
} else {
$q=$pdo->prepare("SELECT * FROM students WHERE
id=?");
$q->execute([$reg_id, $_SESSION['students_id']]);
}
$q = $pdo->prepare('SELECT * FROM students WHERE id=?');
$q->execute([$_SESSION['students_id']]);
}
/* Get the students for this project */
while($s=$q->fetch(PDO::FETCH_OBJ)) {
if($s->namecheck_complete == 'no') {
while ($s = $q->fetch(PDO::FETCH_OBJ)) {
if ($s->namecheck_complete == 'no') {
return 'incomplete';
}
}
return 'complete';
}
function generateProjectNumber($registration_id)
{
global $config, $pdo;
$reg_id = $registration_id;
$q=$pdo->prepare("SELECT projects.projectcategories_id,
$q = $pdo->prepare("SELECT projects.projectcategories_id,
projects.projectdivisions_id,
projectcategories.category_shortform,
projectdivisions.division_shortform
@ -336,54 +336,60 @@ function generateProjectNumber($registration_id)
projectdivisions
WHERE
registrations_id=?
AND projects.projectdivisions_id=projectdivisions.id
AND projects.projectcategories_id=projectcategories.id
AND projectcategories.year=?
AND projectdivisions.year=?
AND\tprojects.projectdivisions_id=projectdivisions.id
AND\tprojects.projectcategories_id=projectcategories.id
AND\tprojectcategories.year=?
AND\tprojectdivisions.year=?
");
$q->execute([$reg_id,$config['FAIRYEAR'],$config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
$r=$q->fetch(PDO::FETCH_OBJ);
$q->execute([$reg_id, $config['FAIRYEAR'], $config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
$r = $q->fetch(PDO::FETCH_OBJ);
$p=array('number'=>array(), 'sort'=>array() );
$p = array('number' => array(), 'sort' => array());
$p['number']['str'] = $config['project_num_format'];
$p['sort']['str'] = trim($config['project_sort_format']);
if($p['sort']['str'] == '') $p['sort']['str'] = $p['number']['str'];
if ($p['sort']['str'] == '')
$p['sort']['str'] = $p['number']['str'];
/* Replace each letter with {letter}, so that we can do additional
/*
* Replace each letter with {letter}, so that we can do additional
* replacements below, without risking subsituting in a letter that may
* get replaced. */
foreach(array('number','sort') as $x) {
$p[$x]['str']=preg_replace('[CcDd]', '{\\0}', $p[$x]['str']);
$p[$x]['str']=preg_replace('(N|X)([0-9])?', '{\\0}', $p[$x]['str']);
* get replaced.
*/
foreach (array('number', 'sort') as $x) {
$p[$x]['str'] = preg_replace('[CcDd]', '{\0}', $p[$x]['str']);
$p[$x]['str'] = preg_replace('(N|X)([0-9])?', '{\0}', $p[$x]['str']);
}
/* Do some replacements that we don' thave to do anything fancy with,
* and setup some variables for future queries */
foreach(array('number','sort') as $x) {
$p[$x]['str']=str_replace('{D}',$r->projectdivisions_id,$p[$x]['str']);
$p[$x]['str']=str_replace('{C}',$r->projectcategories_id,$p[$x]['str']);
$p[$x]['str']=str_replace('{d}',$r->division_shortform,$p[$x]['str']);
$p[$x]['str']=str_replace('{c}',$r->category_shortform,$p[$x]['str']);
/*
* Do some replacements that we don' thave to do anything fancy with,
* and setup some variables for future queries
*/
foreach (array('number', 'sort') as $x) {
$p[$x]['str'] = str_replace('{D}', $r->projectdivisions_id, $p[$x]['str']);
$p[$x]['str'] = str_replace('{C}', $r->projectcategories_id, $p[$x]['str']);
$p[$x]['str'] = str_replace('{d}', $r->division_shortform, $p[$x]['str']);
$p[$x]['str'] = str_replace('{c}', $r->category_shortform, $p[$x]['str']);
$p[$x]['n_used'] = array();
$p[$x]['x_used'] = array();
}
/* Build a total list of projects for finding a global number, and
* while constructing the list, build a list for the division/cat
* sequence number */
/*
* Build a total list of projects for finding a global number, and
* while constructing the list, build a list for the division/cat
* sequence number
*/
$q = $pdo->prepare("SELECT projectnumber_seq,projectsort_seq,
projectdivisions_id,projectcategories_id
FROM projects
WHERE year=?
AND projectnumber_seq!='0'
AND projectnumber IS NOT NULL");
projectdivisions_id,projectcategories_id FROM projects
WHERE year=?
AND projectnumber_seq!='0'
AND projectnumber IS NOT NULL");
$q->execute([$config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
while($i = $q->fetch(PDO::FETCH_OBJ)) {
if( ($r->projectdivisions_id == $i->projectdivisions_id)
&&($r->projectcategories_id == $i->projectcategories_id) ) {
while ($i = $q->fetch(PDO::FETCH_OBJ)) {
if (($r->projectdivisions_id == $i->projectdivisions_id) &&
($r->projectcategories_id == $i->projectcategories_id)) {
$p['number']['n_used'][] = $i->projectnumber_seq;
$p['sort']['n_used'][] = $i->projectsort_seq;
}
@ -391,151 +397,179 @@ function generateProjectNumber($registration_id)
$p['number']['x_used'][] = $i->projectnumber_seq;
$p['sort']['x_used'][] = $i->projectsort_seq;
}
/* We only support one N or X to keep things simple, find which
* one we need and how much to pad it */
foreach(array('number','sort') as $x) {
if(preg_match("(N|X)([0-9])?", $p[$x]['str'], $regs)) {
/*
* We only support one N or X to keep things simple, find which
* one we need and how much to pad it
*/
foreach (array('number', 'sort') as $x) {
if (preg_match('(N|X)([0-9])?', $p[$x]['str'], $regs)) {
$p[$x]['seq_type'] = $regs[1];
if($regs[2] != '')
if ($regs[2] != '')
$p[$x]['seq_pad'] = $regs[2];
else
$p[$x]['seq_pad'] = ($regs[1] == 'N') ? 2 : 3;
if($regs[1] == 'N')
if ($regs[1] == 'N')
$p[$x]['used'] = $p[$x]['n_used'];
else
else
$p[$x]['used'] = $p[$x]['x_used'];
} else {
/* FIXME: maybe we should error here? Not having an N
/*
* FIXME: maybe we should error here? Not having an N
* or an X in the projectnumber or projectsort is a bad
* thing */
* thing
*/
$p[$x]['seq_type'] = '';
$p[$x]['seq_pad'] = 0;
$p[$x]['used'] = array();
}
}
/* Find the lowest unused number. FIXME: this could be a config
/*
* Find the lowest unused number. FIXME: this could be a config
* option, we could search for the lowest unused number (if projects
* get deleted), or we could just go +1 beyond the highest */
foreach(array('number','sort') as $x) {
if($p[$x]['seq_type'] == '') continue;
* get deleted), or we could just go +1 beyond the highest
*/
foreach (array('number', 'sort') as $x) {
if ($p[$x]['seq_type'] == '')
continue;
$n = 0;
while(1) {
while (1) {
$n++;
if(in_array($n, $p[$x]['used'])) continue;
if (in_array($n, $p[$x]['used']))
continue;
$r = sprintf("%'0{$p[$x]['seq_pad']}d", $n);
$str = preg_replace("{(N|X)([0-9])?}", $r, $p[$x]['str']);
$str = preg_replace('{(N|X)([0-9])?}', $r, $p[$x]['str']);
$p[$x]['str'] = $str;
$p[$x]['n'] = $n;
break;
}
/* If we're using the same number type for sorting, then we, in
/*
* If we're using the same number type for sorting, then we, in
* theory, know what that number is, so we can go ahead and
* blindly use it */
if($p['number']['seq_type'] == $p['sort']['seq_type']) {
* blindly use it
*/
if ($p['number']['seq_type'] == $p['sort']['seq_type']) {
$r = sprintf("%'0{$p['sort']['seq_pad']}d", $n);
$p['sort']['str'] = preg_replace("{(N|X)([0-9])?}", $r, $p['sort']['str']);
$p['sort']['str'] = preg_replace('{(N|X)([0-9])?}', $r, $p['sort']['str']);
$p['sort']['n'] = $n;
break;
}
}
return array($p['number']['str'], $p['sort']['str'],
$p['number']['n'], $p['sort']['n']);
return array(
$p['number']['str'],
$p['sort']['str'],
$p['number']['n'],
$p['sort']['n']
);
}
function computeRegistrationFee($regid)
{
global $config, $pdo;
global $config, $pdo;
$ret = array();
$regfee_items = array();
$q = $pdo->prepare("SELECT * FROM regfee_items
WHERE year=?");
$q = $pdo->prepare('SELECT * FROM regfee_items WHERE year=?');
$q->execute([$config['FAIRYEAR']]);
while($i = $q->fetch(PDO::FETCH_ASSOC)) $regfee_items[] = $i;
while ($i = $q->fetch(PDO::FETCH_ASSOC))
$regfee_items[] = $i;
$q=$pdo->prepare("SELECT * FROM students WHERE registrations_id=? AND year=?");
$q = $pdo->prepare('SELECT * FROM students WHERE registrations_id=? AND year=?');
$q->execute([$regid, $config['FAIRYEAR']]);
$n_students = $q->rowCount();
$n_tshirts = 0;
$sel = array();
while($s = $q->fetch(PDO::FETCH_OBJ)) {
if($s->tshirt != 'none') $n_tshirts++;
while ($s = $q->fetch(PDO::FETCH_OBJ)) {
if ($s->tshirt != 'none')
$n_tshirts++;
/* Check their regfee items too */
if($config['participant_regfee_items_enable'] != 'yes') continue;
if ($config['participant_regfee_items_enable'] != 'yes')
continue;
$sel_q = $pdo->prepare("SELECT * FROM regfee_items_link
WHERE students_id=?");
$sel_q = $pdo->prepare('SELECT * FROM regfee_items_link WHERE students_id=?');
$sel_q->execute([$s->id]);
while($info_q = $sel_q->fetch(PDO::FETCH_ASSOC)) {
while ($info_q = $sel_q->fetch(PDO::FETCH_ASSOC)) {
$sel[] = $info_q['regfee_items_id'];
}
}
$regfee = $regfee ?? 0;
if($config['regfee_per'] == 'student') {
$f = $config['regfee'] * $n_students;
$ret[] = array( 'id' => 'regfee',
'text' => "Fair Registration (per student)",
'base' => $config['regfee'],
'num' => $n_students,
'ext' => $f );
$regfee += $f;
if ($config['regfee_per'] == 'student') {
if ($config['regfee'] == '') {
$config['regfee'] = 0;
}
$f = $config['regfee'] * $n_students;
$ret[] = array(
'id' => 'regfee',
'text' => 'Fair Registration (per student)',
'base' => $config['regfee'],
'num' => $n_students,
'ext' => $f
);
$regfee += $f;
} else {
$ret[] = array( 'id' => 'regfee',
'text' => "Fair Registration (per project)",
'base' => $config['regfee'],
'num' => 1,
'ext' => $config['regfee'] );
$ret[] = array(
'id' => 'regfee',
'text' => 'Fair Registration (per project)',
'base' => $config['regfee'],
'num' => 1,
'ext' => $config['regfee']
);
$regfee += $config['regfee'];
}
if($config['participant_student_tshirt'] == 'yes') {
if ($config['participant_student_tshirt'] == 'yes') {
$tsc = floatval($config['participant_student_tshirt_cost']);
if($tsc != 0.0) {
if ($tsc != 0.0) {
$f = $n_tshirts * $tsc;
$regfee += $f;
if($n_tshirts != 0) {
$ret[] = array( 'id' => 'tshirt',
'text' => "T-Shirts",
'base' => $tsc,
'num' => $n_tshirts,
'ext' => $f);
}
if ($n_tshirts != 0) {
$ret[] = array(
'id' => 'tshirt',
'text' => 'T-Shirts',
'base' => $tsc,
'num' => $n_tshirts,
'ext' => $f
);
}
}
}
/* $sel will be empty if regfee_items is disabled */
foreach($regfee_items as $rfi) {
foreach ($regfee_items as $rfi) {
$cnt = 0;
foreach($sel as $s) if($rfi['id'] == $s) $cnt++;
foreach ($sel as $s)
if ($rfi['id'] == $s)
$cnt++;
if($cnt == 0) continue;
if ($cnt == 0)
continue;
$tsc = floatval($rfi['cost']);
/* If it's per project, force the count to 1 */
if($rfi['per'] == 'project') {
if ($rfi['per'] == 'project') {
$cnt = 1;
}
$f = $tsc * $cnt;
$ret[] = array( 'id' => "regfee_item_{$rfi['id']}",
'text' => "{$rfi['name']} (per {$rfi['per']})" ,
'base' => $tsc,
'num' => $cnt,
'ext' => $f);
$ret[] = array(
'id' => "regfee_item_{$rfi['id']}",
'text' => "{$rfi['name']} (per {$rfi['per']})",
'base' => $tsc,
'num' => $cnt,
'ext' => $f
);
$regfee += $f;
}
return array($regfee, $ret);
}
?>

@ -39,6 +39,8 @@ if (get_value_from_array($_POST, 'action') == 'new') {
$r = $q->fetch(PDO::FETCH_OBJ);
$_SESSION['registration_number'] = $r->num;
$_SESSION['registration_id'] = $r->id;
$r->schools_id = $r->schools_id ?? 0;
$stmt = $pdo->prepare('INSERT INTO students (registrations_id,email,schools_id,year) VALUES (?,?,?,?)');
$stmt->execute([$r->id, $_SESSION['email'], $r->schools_id, $config['FAIRYEAR']]);
@ -136,7 +138,7 @@ send_header('Participant Registration');
if (get_value_from_array($_POST, 'action') == 'login' && (get_value_from_array($_POST, 'email') || get_value_from_array($_SESSION, 'email'))) {
if (get_value_from_array($_POST, 'email'))
$_SESSION['email'] = stripslashes($pdo->quote($_POST['email']));
$_SESSION['email'] = stripslashes($_POST['email']);
echo '<form method="post" action="register_participants.php">';
@ -302,14 +304,14 @@ if (get_value_from_array($_POST, 'action') == 'login' && (get_value_from_array($
$schoolidquery = 'null';
// actually insert it
$stmt = $pdo->prepare('INSERT INTO registrations (num, email, start, status, schools_id, year)
VALUES (?, ?, NOW(), ?, ?, ?)');
$stmt = $pdo->prepare("INSERT INTO registrations (num, email, start, status, schools_id, year)
\t\t\t\t\t\t\t\t\tVALUES (?, ?, NOW(), ?, ?, ?)");
$stmt->execute([
$regnum,
$_SESSION['email'],
'new',
$schoolidquery,
$schoolidquery,
$config['FAIRYEAR']
]);

@ -40,13 +40,13 @@ if (!$_SESSION['registration_number']) {
global $pdo;
$q = $pdo->prepare('SELECT registrations.id AS regid, students.id AS studentid, students.firstname FROM registrations,students '
. "WHERE students.email=?"
. "AND registrations.num=?"
. "AND registrations.id=?"
. 'WHERE students.email=?'
. 'AND registrations.num=?'
. 'AND registrations.id=?'
. 'AND students.registrations_id=registrations.id '
. 'AND registrations.year=?'
. 'AND students.year=?');
$q->execute([$_SESSION['email'],$_SESSION['registration_number'],$_SESSION['registration_id'],$config['FAIRYEAR'],$config['FAIRYEAR']]);
$q->execute([$_SESSION['email'], $_SESSION['registration_number'], $_SESSION['registration_id'], $config['FAIRYEAR'], $config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
if ($q->rowCount() == 0) {
@ -76,7 +76,7 @@ if ($_POST['action'] == 'save') {
} else {
// first, lets make sure this emergency contact really does belong to them
foreach ($_POST['ids'] AS $id) {
$q = $pdo->prepare("SELECT * FROM emergencycontact WHERE id=? AND registrations_id=? AND year=?");
$q = $pdo->prepare('SELECT * FROM emergencycontact WHERE id=? AND registrations_id=? AND year=?');
$q->execute([$id, $_SESSION['registration_id'], $config['FAIRYEAR']]);
if ($q->rowCount() == 1) {
$e = stripslashes($_POST['email'][$id]);
@ -101,16 +101,16 @@ if ($_POST['action'] == 'save') {
}
$stmt = $pdo->prepare('UPDATE emergencycontact SET '
. "firstname=?, "
. "lastname=?, "
. "relation=?, "
. "phone1=?, "
. "phone2=?, "
. "phone3=?, "
. "phone4=?, "
. "email=? "
. "WHERE id=?");
$stmt->execute([stripslashes($_POST['firstname'][$id]),stripslashes($_POST['lastname'][$id]),stripslashes($_POST['relation'][$id]),stripslashes($_POST['phone1'][$id]),stripslashes($_POST['phone2'][$id]),stripslashes($_POST['phone3'][$id]),stripslashes($_POST['phone4'][$id]),stripslashes($_POST['email'][$id]),$id]);
. 'firstname=?, '
. 'lastname=?, '
. 'relation=?, '
. 'phone1=?, '
. 'phone2=?, '
. 'phone3=?, '
. 'phone4=?, '
. 'email=? '
. 'WHERE id=?');
$stmt->execute([stripslashes($_POST['firstname'][$id]), stripslashes($_POST['lastname'][$id]), stripslashes($_POST['relation'][$id]), stripslashes($_POST['phone1'][$id]), stripslashes($_POST['phone2'][$id]), stripslashes($_POST['phone3'][$id]), stripslashes($_POST['phone4'][$id]), stripslashes($_POST['email'][$id]), $id]);
show_pdo_errors_if_any($pdo);
echo notice(i18n('Emergency contact information successfully updated'));
} else {
@ -128,7 +128,7 @@ if ($newstatus != 'complete') {
echo happy(i18n('Emergency Contact Information Complete'));
}
$sq = $pdo->prepare("SELECT id,firstname,lastname FROM students WHERE registrations_id=? AND year=?");
$sq = $pdo->prepare('SELECT id,firstname,lastname FROM students WHERE registrations_id=? AND year=?');
$sq->execute([$_SESSION['registration_id'], $config['FAIRYEAR']]);
$numstudents = $sq->rowCount();
@ -136,11 +136,14 @@ echo "<form name=\"emergencycontactform\" method=\"post\" action=\"register_part
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
while ($sr = $sq->fetch(PDO::FETCH_OBJ)) {
$q = $pdo->prepare("SELECT * FROM emergencycontact WHERE registrations_id=? AND year=? AND students_id=?");
$q = $pdo->prepare('SELECT * FROM emergencycontact WHERE registrations_id=? AND year=? AND students_id=?');
$q->execute([$_SESSION['registration_id'], $config['FAIRYEAR'], $sr->id]);
if ($q->rowCount() == 0) {
$stmt = $pdo->prepare("INSERT INTO emergencycontact (registrations_id,students_id,year) VALUES (?,?,?)");
$stmt->execute([$_SESSION['registration_id'], $sr->id, ]);
$stmt = $pdo->prepare('INSERT INTO emergencycontact (registrations_id,students_id,year) VALUES (?,?,?)');
$stmt->execute([
$_SESSION['registration_id'],
$sr->id,
]);
$id = $pdo->lastInsertId();
unset($r);
} else {

@ -179,6 +179,7 @@ $statusnamecheck = namecheckStatus($_SESSION['registration_id']);
echo outputStatus($statusnamecheck);
echo '</td></tr>';
// FIXME: this should be a global detection so we can use the results elsewhere, especially for all the reports!
if (function_exists('pdf_new'))
$sigfile = 'register_participants_signature.php';
@ -193,17 +194,23 @@ if ($statusstudent == 'complete' && $statusproject == 'complete' && $statusmento
else
$all_complete = false;
echo '<tr><td>';
if ($all_complete == true) {
if ($sigfile)
echo "<a href=\"$sigfile\">";
else
echo error(i18n('No PDF generation library detected'), true);
}
echo i18n("$participationform");
if ($all_complete == true)
if ($all_complete == true){
echo "<a href=\"/content/register_participants_signature.php\">";
echo i18n("$participationform");
echo '</a>';
else
echo '<br /><font color="red">(' . i18n('Available when ALL above sections are "Complete"') . ')</font>';
}
else{
echo "Complete the above information to access ".$participationform;
}
// echo i18n("$participationform");
// if ($all_complete == true)
// echo '</a>';
// else
// echo '<br /><font color="red">(' . i18n('Available when ALL above sections are "Complete"') . ')</font>';
echo '</td><td>';
echo i18n('Print');
@ -211,14 +218,14 @@ echo i18n('Print');
echo '</td></tr>';
// received information
echo '<tr><td>' . i18n("$participationform Received") . '</td><td>';
if (registrationFormsReceived())
echo outputStatus('complete');
else
echo outputStatus('incomplete');
// echo '<tr><td>' . i18n("$participationform Received") . '</td><td>';
// if (registrationFormsReceived())
// echo outputStatus('complete');
// else
// echo outputStatus('incomplete');
// check to see if its complete
echo '</td></tr>';
// // check to see if its complete
// echo '</td></tr>';
echo '</table>';

@ -147,7 +147,9 @@ if (isset($_GET['nummentors'])) {
$numtoshow = $numfound;
// output the current status
$newstatus = mentorStatus();
if ($newstatus != 'complete') {
echo error(i18n('Mentor Information Incomplete'));
} else if ($newstatus == 'complete') {
@ -157,17 +159,19 @@ if ($newstatus != 'complete') {
echo '<form name="nummentorsform" method="get" action="register_participants_mentor.php">';
echo i18n('Number of mentors that helped with the project: ');
echo "<select name=\"nummentors\" onchange=\"document.forms.nummentorsform.submit()\">\n";
if ($registrations_nummentors == null)
if ($registrations_nummentors === -1) {
$sel = 'selected="selected"';
else
} else
$sel = '';
echo "<option $sel value=\"\">" . i18n('Choose') . "</option>\n";
echo "<option $sel value=\"-1\">" . i18n('Choose') . "</option>\n";
for ($x = $config['minmentorsperproject']; $x <= $config['maxmentorsperproject']; $x++) {
// dont let them go less than the number we found. to go less, they must delete each record individually
if ($x < $numfound)
continue;
if ($numtoshow == $x && $registrations_nummentors != null)
if ($numtoshow == $x && $registrations_nummentors !== -1)
$selected = 'selected="selected"';
else
$selected = '';
@ -221,7 +225,7 @@ for ($x = 1; $x <= $numtoshow; $x++) {
echo '<br />';
echo '<br />';
}
if ($numtoshow) {
if ($numtoshow != -1) {
echo '<input type="submit" value="' . i18n('Save Mentor Information') . "\" />\n";
}
echo '</form>';

@ -39,7 +39,7 @@ if (!$_SESSION['registration_number']) {
global $pdo;
$q = $pdo->prepare("SELECT * FROM students WHERE registrations_id=?");
$q = $pdo->prepare('SELECT * FROM students WHERE registrations_id=?');
$q->execute([$_SESSION['registration_id']]);
show_pdo_errors_if_any($pdo);

@ -43,13 +43,13 @@ if (!$_SESSION['registration_number']) {
global $pdo;
$q = $pdo->prepare('SELECT registrations.id AS regid, students.id AS studentid, students.firstname FROM registrations,students '
. "WHERE students.email=?"
. "AND registrations.num=?"
. "AND registrations.id=?"
. 'WHERE students.email=?'
. 'AND registrations.num=?'
. 'AND registrations.id=?'
. 'AND students.registrations_id=registrations.id '
. 'AND registrations.year=?'
. 'AND students.year=?');
$q->execute([$_SESSION['email'],$_SESSION['registration_number'],$_SESSION['registration_id'],$config['FAIRYEAR'],$config['FAIRYEAR']]);
$q->execute([$_SESSION['email'], $_SESSION['registration_number'], $_SESSION['registration_id'], $config['FAIRYEAR'], $config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
if ($q->rowCount() == 0) {
@ -78,7 +78,7 @@ if (get_value_from_array($_POST, 'action') == 'save') {
echo error(i18n('Cannot make changes to forms after registration deadline'));
} else {
// first, lets make sure this project really does belong to them
$q = $pdo->prepare("SELECT * FROM projects WHERE id=? AND registrations_id=? AND year=?");
$q = $pdo->prepare('SELECT * FROM projects WHERE id=? AND registrations_id=? AND year=?');
$q->execute([$_POST['id'], $_SESSION['registration_id'], $config['FAIRYEAR']]);
if ($q->rowCount() == 1) {
$summarywords = preg_split('/[\s,]+/', $_POST['summary']);
@ -118,10 +118,10 @@ if (get_value_from_array($_POST, 'action') == 'save') {
summary=?,
summarycountok=?
WHERE id=?');
$stmt->execute([$title,$shorttitle,intval($_POST['projectdivisions_id']),stripslashes($_POST['projecttype']),
stripslashes($_POST['language']),stripslashes($_POST['req_table']),stripslashes($_POST['req_electricity']),
stripslashes($_POST['req_special']),stripslashes($_POST['human_participants']),stripslashes($_POST['animal_participants']),
stripslashes($_POST['summary']),$summarycountok,$_POST['id']]);
$stmt->execute([$title, $shorttitle, intval($_POST['projectdivisions_id']), stripslashes($_POST['projecttype']),
stripslashes($_POST['language']), stripslashes($_POST['req_table']), stripslashes($_POST['req_electricity']),
stripslashes($_POST['req_special']), stripslashes($_POST['human_participants']), stripslashes($_POST['animal_participants']),
stripslashes($_POST['summary']), $summarycountok, $_POST['id']]);
show_pdo_errors_if_any($pdo);
echo notice(i18n('Project information successfully updated'));
} else {
@ -131,12 +131,12 @@ if (get_value_from_array($_POST, 'action') == 'save') {
}
// now lets find out their MAX grade, so we can pre-set the Age Category
$q = $pdo->prepare("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id=?");
$q = $pdo->prepare('SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id=?');
$q->execute([$_SESSION['registration_id']]);
$gradeinfo = $q->fetch(PDO::FETCH_OBJ);
// now lets grab all the age categories, so we can choose one based on the max grade
$q = $pdo->prepare("SELECT * FROM projectcategories WHERE year=? ORDER BY id");
$q = $pdo->prepare('SELECT * FROM projectcategories WHERE year=? ORDER BY id');
$q->execute([$config['FAIRYEAR']]);
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
// save these in an array, just incase we need them later (FIXME: remove this array if we dont need it)
@ -149,15 +149,18 @@ while ($r = $q->fetch(PDO::FETCH_OBJ)) {
}
}
// now select their project info
$q = $pdo->prepare("SELECT * FROM projects WHERE registrations_id=? AND year=?");
$q = $pdo->prepare('SELECT * FROM projects WHERE registrations_id=? AND year=?');
$q->execute([$_SESSION['registration_id'], $config['FAIRYEAR']]);
if ($projectcategories_id == '') {
echo error(i18n('No project age categories'));
}
// check if it exists, if we didnt find any record, lets insert one
if ($q->rowCount() == 0) {
$stmt = $pdo->prepare("INSERT INTO projects (registrations_id,projectcategories_id,year) VALUES (?,?,?)");
$stmt->execute([$_SESSION['registration_id'],$projectcategories_id,$config['FAIRYEAR']]);
$stmt = $pdo->prepare('INSERT INTO projects (registrations_id,projectcategories_id,year) VALUES (?,?,?)');
$stmt->execute([$_SESSION['registration_id'], $projectcategories_id, $config['FAIRYEAR']]);
// now query the one we just inserted
$q = $pdo->prepare("SELECT * FROM projects WHERE registrations_id=? AND year=?");
$q = $pdo->prepare('SELECT * FROM projects WHERE registrations_id=? AND year=?');
$q->execute([$_SESSION['registration_id'], $config['FAIRYEAR']]);
}
$projectinfo = $q->fetch(PDO::FETCH_OBJ);
@ -165,7 +168,7 @@ $projectinfo = $q->fetch(PDO::FETCH_OBJ);
// make sure that if they changed their grade on the student page, we update their projectcategories_id accordingly
if ($projectcategories_id && $projectinfo->projectcategories_id != $projectcategories_id) {
echo notice(i18n('Age category changed, updating to %1', array($agecategories[$projectcategories_id]['category'])));
$stmt = $pdo->prepare("UPDATE projects SET projectcategories_id=? WHERE id=?");
$stmt = $pdo->prepare('UPDATE projects SET projectcategories_id=? WHERE id=?');
$stmt->execute([$projectcategories_id, $projectinfo->id]);
}
@ -222,11 +225,11 @@ echo '<tr><td>' . i18n('Division') . ': </td><td>';
// ###### Feature Specific - filtering divisions by category
if ($config['filterdivisionbycategory'] == 'yes') {
$q = $pdo->prepare('SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=' . $projectcategories_id . " AND projectdivisions.year=? AND projectcategoriesdivisions_link.year=? ORDER BY division");
$q->execute([$config['FAIRYEAR'],$config['FAIRYEAR']]);
$q = $pdo->prepare('SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=' . $projectcategories_id . ' AND projectdivisions.year=? AND projectcategoriesdivisions_link.year=? ORDER BY division');
$q->execute([$config['FAIRYEAR'], $config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
} else
$q = $pdo->prepare("SELECT * FROM projectdivisions WHERE year=? ORDER BY division");
$q = $pdo->prepare('SELECT * FROM projectdivisions WHERE year=? ORDER BY division');
$q->execute([$config['FAIRYEAR']]);
echo '<select name="projectdivisions_id">';
echo '<option value="">' . i18n('Select a division') . "</option>\n";

@ -0,0 +1,330 @@
<?
/*
* This file is part of the 'Science Fair In A Box' project
* SFIAB Website: http://www.sfiab.ca
*
* Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
* Copyright (C) 2005 James Grant <james@lightbox.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, version 2.
*
* 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
?>
<?
require ('common.inc.php');
include 'register_participants.inc.php';
include './config/signaturepage_or_permissionform.php';
require ('lpdf.php');
global $pdo;
// anyone can access a sample, we dont need to be authenticated or anything for that
if ($_GET['sample']) {
$registration_number = 12345;
$registration_id = 0;
} else {
// authenticate based on email address and registration number from the SESSION
if (!$_SESSION['email']) {
header('Location: register_participants.php');
exit;
}
if (!$_SESSION['registration_number']) {
header('Location: register_participants.php');
exit;
}
$q = $pdo->prepare('SELECT registrations.id AS regid, students.id AS studentid, students.firstname FROM registrations,students '
. "WHERE students.email='" . $_SESSION['email'] . "' "
. "AND registrations.num='" . $_SESSION['registration_number'] . "' "
. "AND registrations.id='" . $_SESSION['registration_id'] . "' "
. 'AND students.registrations_id=registrations.id '
. 'AND registrations.year=' . $config['FAIRYEAR'] . ' '
. 'AND students.year=' . $config['FAIRYEAR']);
$q->execute();
$registration_number = $_SESSION['registration_number'];
$registration_id = $_SESSION['registration_id'];
show_pdo_errors_if_any($pdo);
if ($q->rowCount() == 0) {
header('Location: register_participants.php');
exit;
}
$authinfo = $q->fetch(PDO::FETCH_OBJ);
}
// END OF AUTH, now lets try to generate a PDF using only PHP :) this should be fun!
$pdf = new lpdf(i18n($config['fairname']),
i18n("Participant $participationform (" . $registration_number . ')'),
$_SERVER['DOCUMENT_ROOT'] . $config['SFIABDIRECTORY'] . '/data/logo-200.gif');
$pdf->newPage();
$height['sigspace'] = 0.4;
$pdf->setFontSize(11);
/*
* //The title of the fair
* $yloc=10.25;
* $height['title']=0.25;
* $height['subtitle']=0.22;
* $height['topbox']=0.8;
* $height['exhibitortitle']=0.2;
* $height['exhibitorbox']=1.3;
* $height['exhibitorsigtext']=0.13;
* $height['parenttitle']=0.2;
* $height['parentbox']=2.80;
* $height['parentsigtext']=0.13;
*/
if ($_GET['sample']) {
$projectinfo->title = 'Sample Project Title';
$projectinfo->division = 'Proj Division';
$projectinfo->category = 'Proj Category';
$studentinfo->firstname = 'SampleFirst';
$studentinfo->lastname = 'SampleLast';
$studentinfo->grade = '10';
$studentinfoarray[] = $studentinfo;
$rr->school = 'SampleSchool';
} else {
// grab the project info
$q = $pdo->prepare("SELECT projects.*,
projectcategories.category,
projectdivisions.division
FROM projects
JOIN projectdivisions ON projects.projectdivisions_id=projectdivisions.id
JOIN projectcategories ON projects.projectcategories_id=projectcategories.id
WHERE registrations_id='" . $_SESSION['registration_id'] . "'
AND projects.year='" . $config['FAIRYEAR'] . "'
AND projectdivisions.year='" . $config['FAIRYEAR'] . "'
AND projectcategories.year='" . $config['FAIRYEAR'] . "'
");
$q->execute();
$projectinfo = $q->fetch(PDO::FETCH_OBJ);
$q = $pdo->prepare("SELECT * FROM students WHERE registrations_id='" . $_SESSION['registration_id'] . "' AND year='" . $config['FAIRYEAR'] . "'");
$q->execute();
while ($si = $q->fetch(PDO::FETCH_OBJ))
$studentinfoarray[] = $si;
}
$topboxtext = i18n('Registration Number') . ': ' . $registration_number . "\n"
. i18n('Project Title') . ": $projectinfo->title\n"
. i18n($projectinfo->category) . ' / ' . i18n($projectinfo->division) . "\n";
if (count($studentinfoarray) > 1)
$plural = 's';
else
$plural = '';
$pdf->heading(i18n('Registration Summary'));
$pdf->addText($topboxtext);
$pdf->nextline();
$pdf->addTextX("Exhibitor$plural: ", 0.75);
foreach ($studentinfoarray AS $studentinfo) {
if (!$_GET['sample']) {
$qq = $pdo->prepare("SELECT school FROM schools WHERE id={$studentinfo->schools_id}");
$qq->execute();
$rr = $qq->fetch(PDO::FETCH_OBJ);
}
$pdf->addTextX("$studentinfo->firstname $studentinfo->lastname, Grade {$studentinfo->grade}, {$rr->school}", 1.5);
$pdf->nextline();
}
// strip off the last comma
// add the newline
// $topboxtext.="\n";
$pdf->hr();
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='exhibitordeclaration'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
$pdf->heading(i18n('Exhibitor Declaration'));
$studentbox = $r->text;
/*
* $studentbox="The following section is to be read and signed by the exhibitor$plural.\n\n".
* ($plural?"We":"I")." certify that:\n".
* " - The preparation of this project is mainly ".($plural?"our":"my")." own work\n".
* " - ".($plural?"We":"I")." have read the rules and regulations and agree to abide by them\n".
* " - ".($plural?"We":"I")." agree that the decision of the judges will be final\n";
*/
$pdf->addText($studentbox);
foreach ($studentinfoarray AS $studentinfo) {
// we want to make sure the vspace, line, and text under the line dont
// get wrapped onto multiple pages, so make sure we have enough space for the whole thing before we
// start, and if we dont, make a new page. normal stop for footer is at 0.9, so 1.65 gives 0.75 inches
// which should be enough... i think :)
if ($pdf->yloc < 1.65)
$pdf->newPage();
$pdf->vspace($height['sigspace']);
// signature line
$pdf->hline(1, 4.5);
// date line
$pdf->hline(5, 7);
// go to next line
$pdf->nextLine();
// show their name
$pdf->addTextX(i18n('%1 %2 (signature)', array($studentinfo->firstname, $studentinfo->lastname)), 1.25);
// show the Date text
$pdf->addTextX(i18n('Date'), 5.25);
// go to next line
$pdf->nextLine();
}
$pdf->hr();
}
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='parentdeclaration'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
// now for the parent/guardian signatures
$pdf->heading(i18n('Parent/Guardian Declaration'));
$parentbox = $r->text;
$pdf->addText($parentbox);
foreach ($studentinfoarray AS $studentinfo) {
// we want to make sure the vspace, line, and text under the line dont
// get wrapped onto multiple pages, so make sure we have enough space for the whole thing before we
// start, and if we dont, make a new page. normal stop for footer is at 0.9, so 1.65 gives 0.75 inches
// which should be enough... i think :)
if ($pdf->yloc < 1.65)
$pdf->newPage();
$pdf->vspace($height['sigspace']);
// signature line
$pdf->hline(1, 4.5);
// date line
$pdf->hline(5, 7);
$pdf->nextLine();
// show their name
$pdf->addTextX(i18n('Parent/Guardian of %1 %2 (signature)', array($studentinfo->firstname, $studentinfo->lastname)), 1.25);
// show the Date text
$pdf->addTextX(i18n('Date'), 5.25);
$pdf->nextLine();
}
$pdf->hr();
}
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='teacherdeclaration'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
// now for the teacher signature
$pdf->heading(i18n('Teacher Declaration'));
$teacherbox = $r->text;
$pdf->addText($teacherbox);
// we want to make sure the vspace, line, and text under the line dont
// get wrapped onto multiple pages, so make sure we have enough space for the whole thing before we
// start, and if we dont, make a new page. normal stop for footer is at 0.9, so 1.65 gives 0.75 inches
// which should be enough... i think :)
if ($pdf->yloc < 1.65)
$pdf->newPage();
// we only need 1 teacher signature line, we can assume (maybe incorrectly) that both students
// have the same teacher.. if they are not the same, then they can get the best teacher to sign
// it doesnt matter.
$pdf->vspace($height['sigspace']);
// signature line
$pdf->hline(1, 4.5);
// date line
$pdf->hline(5, 7);
$pdf->nextLine();
// show their name
$pdf->addTextX(i18n('Teacher Signature'), 1.25);
// show the Date text
$pdf->addTextX(i18n('Date'), 5.25);
$pdf->nextLine();
$pdf->hr();
}
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='regfee'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
// now for the teacher signature
$pdf->heading(i18n('Registration Fee Summary'));
$pdf->nextLine();
list($regfee, $rfeedata) = computeRegistrationFee($registration_id);
$pdf->addTextX(i18n('Item'), 3.5);
$pdf->addTextX(i18n('Unit'), 5.1);
$pdf->addTextX(i18n('Qty'), 5.5);
$pdf->addTextX(i18n('Extended'), 5.9);
$pdf->vspace(0.05);
$pdf->hline(1.75, 6.75);
foreach ($rfeedata as $rf) {
$pdf->nextLine();
$u = '$' . sprintf('%.02f', $rf['base']);
$e = '$' . sprintf('%.02f', $rf['ext']);
$pdf->addTextX($rf['text'], 2);
$pdf->addTextX("$u", 5);
$pdf->addTextX($rf['num'], 5.6);
$pdf->addTextX("$e", 6);
}
$pdf->vspace(0.05);
$pdf->hline(1.75, 6.75);
$pdf->nextLine();
$t = '$' . sprintf('%.02f', $regfee);
$pdf->addTextX(i18n('Total (including all taxes)'), 4.2);
$pdf->addTextX("$t", 6);
$pdf->nextLine();
$pdf->hr();
}
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='postamble'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
// now for the teacher signature
$pdf->heading(i18n('Additional Information'));
$box = $r->text;
$pdf->addText($box);
}
/*
* header("Content-type: application/pdf");
* header("Content-disposition: inline; filename=sfiab_sig_".$_SESSION['registration_id'].".pdf");
* header("Content-length: ".strlen($pdfdata));
*/
echo $pdf->output();
?>

@ -1,338 +1,19 @@
<?
/*
* This file is part of the 'Science Fair In A Box' project
* SFIAB Website: http://www.sfiab.ca
*
* Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
* Copyright (C) 2005 James Grant <james@lightbox.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, version 2.
*
* 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
include 'data/config.inc.php';
?>
<?
require ('common.inc.php');
include 'register_participants.inc.php';
include './config/signaturepage_or_permissionform.php';
require ('lpdf.php');
global $pdo;
<script src="https://cdn.docuseal.com/js/form.js"></script>
// anyone can access a sample, we dont need to be authenticated or anything for that
if ($_GET['sample']) {
$registration_number = 12345;
$registration_id = 0;
} else {
// authenticate based on email address and registration number from the SESSION
if (!$_SESSION['email']) {
header('Location: register_participants.php');
exit;
}
if (!$_SESSION['registration_number']) {
header('Location: register_participants.php');
exit;
}
$q = $pdo->prepare('SELECT
registrations.id AS regid,
students.id AS studentid,
students.firstname
FROM registrations
JOIN students ON students.registrations_id = registrations.id
WHERE students.email = ?
AND registrations.num = ?
AND registrations.id = ?
AND registrations.year = ?
AND students.year = ?');
<docuseal-form
id="docusealForm"
data-src=<? echo "$SIGNATURES_URL" ?>
data-email="">
</docuseal-form>
$q->execute([
$_SESSION['email'],
$_SESSION['registration_number'],
$_SESSION['registration_id'],
$config['FAIRYEAR'],
$config['FAIRYEAR']
]);
<script>
window.docusealForm.addEventListener('completed', (e) => e.detail)
</script>
show_pdo_errors_if_any($pdo);
if ($q->rowCount() == 0) {
header('Location: register_participants.php');
exit;
}
$authinfo = $q->fetch(PDO::FETCH_OBJ);
}
// END OF AUTH, now lets try to generate a PDF using only PHP :) this should be fun!
$pdf = new lpdf(i18n($config['fairname']),
i18n("Participant $participationform (" . $registration_number . ')'),
$_SERVER['DOCUMENT_ROOT'] . $config['SFIABDIRECTORY'] . '/data/logo-200.gif');
$pdf->newPage();
$height['sigspace'] = 0.4;
$pdf->setFontSize(11);
/*
* //The title of the fair
* $yloc=10.25;
* $height['title']=0.25;
* $height['subtitle']=0.22;
* $height['topbox']=0.8;
* $height['exhibitortitle']=0.2;
* $height['exhibitorbox']=1.3;
* $height['exhibitorsigtext']=0.13;
* $height['parenttitle']=0.2;
* $height['parentbox']=2.80;
* $height['parentsigtext']=0.13;
*/
if ($_GET['sample']) {
$projectinfo->title = 'Sample Project Title';
$projectinfo->division = 'Proj Division';
$projectinfo->category = 'Proj Category';
$studentinfo->firstname = 'SampleFirst';
$studentinfo->lastname = 'SampleLast';
$studentinfo->grade = '10';
$studentinfoarray[] = $studentinfo;
$rr->school = 'SampleSchool';
} else {
// grab the project info
$q = $pdo->prepare('SELECT projects.*,
projectcategories.category,
projectdivisions.division
FROM projects
JOIN projectdivisions ON projects.projectdivisions_id=projectdivisions.id
JOIN projectcategories ON projects.projectcategories_id=projectcategories.id
WHERE registrations_id=?
AND projects.year=?
AND projectdivisions.year=?
AND projectcategories.year=?
');
$q->execute([$_SESSION['registration_id'], $config['FAIRYEAR'], $config['FAIRYEAR'], $config['FAIRYEAR']]);
$projectinfo = $q->fetch(PDO::FETCH_OBJ);
$q = $pdo->prepare('SELECT * FROM students WHERE registrations_id=? AND year=?');
$q->execute([$_SESSION['registration_id'], $config['FAIRYEAR']]);
while ($si = $q->fetch(PDO::FETCH_OBJ))
$studentinfoarray[] = $si;
}
$topboxtext = i18n('Registration Number') . ': ' . $registration_number . "\n"
. i18n('Project Title') . ": $projectinfo->title\n"
. i18n($projectinfo->category) . ' / ' . i18n($projectinfo->division) . "\n";
if (count($studentinfoarray) > 1)
$plural = 's';
else
$plural = '';
$pdf->heading(i18n('Registration Summary'));
$pdf->addText($topboxtext);
$pdf->nextline();
$pdf->addTextX("Exhibitor$plural: ", 0.75);
foreach ($studentinfoarray AS $studentinfo) {
if (!$_GET['sample']) {
$qq = $pdo->prepare('SELECT school FROM schools WHERE id=?');
$qq->execute([$studentinfo->schools_id]);
$rr = $qq->fetch(PDO::FETCH_OBJ);
}
$pdf->addTextX("$studentinfo->firstname $studentinfo->lastname, Grade {$studentinfo->grade}, {$rr->school}", 1.5);
$pdf->nextline();
}
// strip off the last comma
// add the newline
// $topboxtext.="\n";
$pdf->hr();
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='exhibitordeclaration'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
$pdf->heading(i18n('Exhibitor Declaration'));
$studentbox = $r->text;
/*
* $studentbox="The following section is to be read and signed by the exhibitor$plural.\n\n".
* ($plural?"We":"I")." certify that:\n".
* " - The preparation of this project is mainly ".($plural?"our":"my")." own work\n".
* " - ".($plural?"We":"I")." have read the rules and regulations and agree to abide by them\n".
* " - ".($plural?"We":"I")." agree that the decision of the judges will be final\n";
*/
$pdf->addText($studentbox);
foreach ($studentinfoarray AS $studentinfo) {
// we want to make sure the vspace, line, and text under the line dont
// get wrapped onto multiple pages, so make sure we have enough space for the whole thing before we
// start, and if we dont, make a new page. normal stop for footer is at 0.9, so 1.65 gives 0.75 inches
// which should be enough... i think :)
if ($pdf->yloc < 1.65)
$pdf->newPage();
$pdf->vspace($height['sigspace']);
// signature line
$pdf->hline(1, 4.5);
// date line
$pdf->hline(5, 7);
// go to next line
$pdf->nextLine();
// show their name
$pdf->addTextX(i18n('%1 %2 (signature)', array($studentinfo->firstname, $studentinfo->lastname)), 1.25);
// show the Date text
$pdf->addTextX(i18n('Date'), 5.25);
// go to next line
$pdf->nextLine();
}
$pdf->hr();
}
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='parentdeclaration'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
// now for the parent/guardian signatures
$pdf->heading(i18n('Parent/Guardian Declaration'));
$parentbox = $r->text;
$pdf->addText($parentbox);
foreach ($studentinfoarray AS $studentinfo) {
// we want to make sure the vspace, line, and text under the line dont
// get wrapped onto multiple pages, so make sure we have enough space for the whole thing before we
// start, and if we dont, make a new page. normal stop for footer is at 0.9, so 1.65 gives 0.75 inches
// which should be enough... i think :)
if ($pdf->yloc < 1.65)
$pdf->newPage();
$pdf->vspace($height['sigspace']);
// signature line
$pdf->hline(1, 4.5);
// date line
$pdf->hline(5, 7);
$pdf->nextLine();
// show their name
$pdf->addTextX(i18n('Parent/Guardian of %1 %2 (signature)', array($studentinfo->firstname, $studentinfo->lastname)), 1.25);
// show the Date text
$pdf->addTextX(i18n('Date'), 5.25);
$pdf->nextLine();
}
$pdf->hr();
}
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='teacherdeclaration'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
// now for the teacher signature
$pdf->heading(i18n('Teacher Declaration'));
$teacherbox = $r->text;
$pdf->addText($teacherbox);
// we want to make sure the vspace, line, and text under the line dont
// get wrapped onto multiple pages, so make sure we have enough space for the whole thing before we
// start, and if we dont, make a new page. normal stop for footer is at 0.9, so 1.65 gives 0.75 inches
// which should be enough... i think :)
if ($pdf->yloc < 1.65)
$pdf->newPage();
// we only need 1 teacher signature line, we can assume (maybe incorrectly) that both students
// have the same teacher.. if they are not the same, then they can get the best teacher to sign
// it doesnt matter.
$pdf->vspace($height['sigspace']);
// signature line
$pdf->hline(1, 4.5);
// date line
$pdf->hline(5, 7);
$pdf->nextLine();
// show their name
$pdf->addTextX(i18n('Teacher Signature'), 1.25);
// show the Date text
$pdf->addTextX(i18n('Date'), 5.25);
$pdf->nextLine();
$pdf->hr();
}
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='regfee'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
// now for the teacher signature
$pdf->heading(i18n('Registration Fee Summary'));
$pdf->nextLine();
list($regfee, $rfeedata) = computeRegistrationFee($registration_id);
$pdf->addTextX(i18n('Item'), 3.5);
$pdf->addTextX(i18n('Unit'), 5.1);
$pdf->addTextX(i18n('Qty'), 5.5);
$pdf->addTextX(i18n('Extended'), 5.9);
$pdf->vspace(0.05);
$pdf->hline(1.75, 6.75);
foreach ($rfeedata as $rf) {
$pdf->nextLine();
$u = '$' . sprintf('%.02f', $rf['base']);
$e = '$' . sprintf('%.02f', $rf['ext']);
$pdf->addTextX($rf['text'], 2);
$pdf->addTextX("$u", 5);
$pdf->addTextX($rf['num'], 5.6);
$pdf->addTextX("$e", 6);
}
$pdf->vspace(0.05);
$pdf->hline(1.75, 6.75);
$pdf->nextLine();
$t = '$' . sprintf('%.02f', $regfee);
$pdf->addTextX(i18n('Total (including all taxes)'), 4.2);
$pdf->addTextX("$t", 6);
$pdf->nextLine();
$pdf->hr();
}
$q = $pdo->prepare("SELECT * FROM signaturepage WHERE name='postamble'");
$q->execute();
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->use) {
// now for the teacher signature
$pdf->heading(i18n('Additional Information'));
$box = $r->text;
$pdf->addText($box);
}
/*
* header("Content-type: application/pdf");
* header("Content-disposition: inline; filename=sfiab_sig_".$_SESSION['registration_id'].".pdf");
* header("Content-length: ".strlen($pdfdata));
*/
echo $pdf->output();
?>

@ -74,8 +74,7 @@ echo '<a href="register_participants_main.php">&lt;&lt; ' . i18n('Back to Partic
echo '<br />';
$regfee_items = array();
$items_q = $pdo->prepare("SELECT * FROM regfee_items
\t\t\t\tWHERE year=?");
$items_q = $pdo->prepare('SELECT * FROM regfee_items WHERE year=?');
$items_q->execute([$config['FAIRYEAR']]);
while ($items_i = $items_q->fetch(PDO::FETCH_ASSOC)) {
$regfee_items[] = $items_i;
@ -503,7 +502,7 @@ for ($x = 1; $x <= $numtoshow; $x++) {
echo "<tr>\n";
echo ' <td>' . i18n('Teacher Name') . "</td><td><input type=\"text\" name=\"teachername[$x]\" value=\"" . get_value_property_or_default($studentinfo, 'teachername') . "\" /></td>\n";
echo ' <td>' . i18n('Teacher Email') . "</td><td><input type=\"text\" name=\"teacheremail[$x]\" value=\"" . get_value_property_or_default($studentinfo, 'teacheremail') . "\" /></td>\n";
echo ' <td>' . i18n('TeacherEmail') . "</td><td><input type=\"text\" name=\"teacheremail[$x]\" value=\"" . get_value_property_or_default($studentinfo, 'teacheremail') . "\" /></td>\n";
echo "</tr>\n";
if ($config['participant_regfee_items_enable'] == 'yes') {

@ -510,7 +510,7 @@ class TableEditor
if ($this->DEBUG)
echo $query;
$stmt = $pdo->prepare($query);
$stmt->execute($keyval);
$stmt->execute([$keyval]);
}
function defaultDelete($keyval)

@ -54,7 +54,6 @@ function user_valid_type($type)
return true;
}
function generatePassword($pwlen = 16)
{
$available = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@ -65,6 +64,7 @@ function generatePassword($pwlen = 16)
$key .= $available[rand(0, $len)];
return $key;
}
/*
* Separate user_load_type functions, these could make additional database
* calls if required
@ -111,7 +111,7 @@ function user_load_judge(&$u)
}
$specialawards = array();
if ($u['special_award_only'] == 'yes') {
$q = $pdo->prepare("SELECT * FROM judges_specialaward_sel WHERE users_id=?");
$q = $pdo->prepare('SELECT * FROM judges_specialaward_sel WHERE users_id=?');
$q->execute([$u['id']]);
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$specialawards[] = $r->award_awards_id;
@ -149,7 +149,7 @@ function user_load_sponsor(&$u)
$u['sponsor_complete'] = ($u['sponsor_complete'] == 'yes') ? 'yes' : 'no';
$u['sponsor_active'] = ($u['sponsor_active'] == 'yes') ? 'yes' : 'no';
if ($u['sponsors_id']) {
$q = $pdo->prepare("SELECT * FROM sponsors WHERE id=?");
$q = $pdo->prepare('SELECT * FROM sponsors WHERE id=?');
$q->execute([$u['sponsors_id']]);
$u['sponsor'] = $q->fetch(PDO::FETCH_ASSOC);
}
@ -317,7 +317,7 @@ function user_load_by_email($email)
global $pdo;
/* Find the most recent uid for the email, regardless of deleted status */
$e = $email;
$q = $pdo->prepare("SELECT uid FROM users WHERE email=? OR username=? ORDER BY year DESC LIMIT 1");
$q = $pdo->prepare('SELECT uid FROM users WHERE email=? OR username=? ORDER BY year DESC LIMIT 1');
$q->execute([$e, $e]);
if ($q->rowCount() == 1) {
$i = $q->fetch(PDO::FETCH_ASSOC);
@ -329,7 +329,7 @@ function user_load_by_email($email)
function user_load_by_uid_year($uid, $year)
{
global $pdo;
$q = $pdo->prepare("SELECT id FROM users WHERE uid=? AND year <= ?");
$q = $pdo->prepare('SELECT id FROM users WHERE uid=? AND year <= ?');
$q->execute([$uid, $year]);
if (!$q->rowCount())
return false;
@ -343,7 +343,7 @@ function user_set_password($id, $password = NULL)
/* pass $u by reference so we can update it */
$save_old = false;
if ($password == NULL) {
$q = $pdo->prepare("SELECT passwordset FROM users WHERE id=?");
$q = $pdo->prepare('SELECT passwordset FROM users WHERE id=?');
$q->execute([$id]);
$u = $q->fetch(PDO::FETCH_ASSOC);
/* Generate a new password */
@ -364,7 +364,7 @@ function user_set_password($id, $password = NULL)
$set = ($save_old == true) ? 'oldpassword=password, ' : '';
$set .= "password='" . password_hash($p, PASSWORD_BCRYPT) . "', passwordset=$save_set ";
////FIXME This one may be tricky
// //FIXME This one may be tricky
$query = "UPDATE users SET $set WHERE id=?";
$stmt = $pdo->prepare($query);
$stmt->execute([$id]);
@ -402,12 +402,10 @@ function user_save_type_list($u, $db, $fields)
$set .= "`$f`='$data'";
}
if ($set != '') {
$query = "UPDATE ? SET ? WHERE users_id=?";
$query = "UPDATE $db SET $set WHERE users_id=?";
$stmt = $pdo->prepare($query);
$stmt->execute([$db,$set,$u['id']]);
if ($pdo->errorInfo()) {
show_pdo_errors_if_any($pdo);
}
$stmt->execute([$u['id']]);
show_pdo_errors_if_any($pdo);
}
}
@ -510,7 +508,6 @@ function user_save(&$u)
show_pdo_errors_if_any($pdo);
}
/* Save the password if it changed */
if ($u['password'] != $u['orig']['password'])
user_set_password($u['id'], $u['password']);
@ -539,7 +536,7 @@ function user_save(&$u)
function user_delete_committee($u)
{
global $pdo;
$stmt = $pdo->prepare("DELETE FROM committees_link WHERE users_uid=?");
$stmt = $pdo->prepare('DELETE FROM committees_link WHERE users_uid=?');
$stmt->execute([$u['uid']]);
}
@ -550,16 +547,16 @@ function user_delete_judge($u)
global $config;
global $pdo;
$ids = array();
$q = $pdo->prepare("SELECT id FROM users WHERE uid =?");
$q = $pdo->prepare('SELECT id FROM users WHERE uid =?');
$q->execute([$u['uid']]);
while ($row = $q->fetch(PDO::FETCH_ASSOC))
$ids[] = $row['id'];
if (count($ids) > 0) {
$idlist = implode(',', $ids);
$stmt = $pdo->prepare("DELETE FROM judges_teams_link WHERE users_id IN (?)");
$stmt = $pdo->prepare('DELETE FROM judges_teams_link WHERE users_id IN (?)');
$stmt->execute([$idlist]);
$stmt = $pdo->prepare("DELETE FROM judges_specialaward_sel WHERE users_id IN(?)");
$stmt = $pdo->prepare('DELETE FROM judges_specialaward_sel WHERE users_id IN(?)');
$stmt->execute([$idlist]);
}
}
@ -660,7 +657,7 @@ function user_purge($u, $type = false)
$types .= ',';
$types .= $t;
}
$stmt = $pdo->prepare("UPDATE users SET types=? WHERE id=?");
$stmt = $pdo->prepare('UPDATE users SET types=? WHERE id=?');
$stmt->execute([$types, $u['id']]);
} else {
$finish_purge = true;
@ -685,7 +682,7 @@ function user_purge($u, $type = false)
$finish_purge = true;
}
if ($finish_purge == true) {
$stmt = $pdo->prepare("DELETE FROM users WHERE id=?");
$stmt = $pdo->prepare('DELETE FROM users WHERE id=?');
$stmt->execute([$u['id']]);
}
}
@ -694,7 +691,7 @@ function user_purge($u, $type = false)
function user_dupe_row($table, $key, $val, $newval)
{
global $config, $pdo;
$nullfields = array('id','sex','deleteddatetime'); /* Fields that can be null */
$nullfields = array('id', 'sex', 'deleteddatetime'); /* Fields that can be null */
$q = $pdo->prepare("SELECT * FROM $table WHERE $key='$val'");
$q->execute();
if ($q->rowCount() != 1) {
@ -718,7 +715,7 @@ function user_dupe_row($table, $key, $val, $newval)
$q = "INSERT INTO $table (?) VALUES (?)";
$r = $pdo->prepare($q);
$r->execute([$keys,$vals]);
$r->execute([$keys, $vals]);
show_pdo_errors_if_any($pdo);
$id = $pdo->lastInsertId();
@ -740,8 +737,8 @@ function user_dupe($u, $new_year)
*/
/* Find the last entry */
$q = $pdo->prepare("SELECT id,uid,year,deleted FROM users WHERE uid=?
ORDER BY year DESC LIMIT 1");
$q = $pdo->prepare('SELECT id,uid,year,deleted FROM users WHERE uid=?
ORDER BY year DESC LIMIT 1');
$q->execute([$u['uid']]);
$r = $q->fetch(PDO::FETCH_OBJ);
@ -757,7 +754,7 @@ function user_dupe($u, $new_year)
$id = user_dupe_row('users', 'id', $u['id'], NULL);
$q = $pdo->prepare("UPDATE users SET year =? WHERE id =?");
$q = $pdo->prepare('UPDATE users SET year =? WHERE id =?');
$q->execute([$new_year, $id]);
/* Load the new user */
$u2 = user_load($id);
@ -809,24 +806,24 @@ function user_create($type, $username, $u = NULL)
if (!is_array($u)) {
$stmt = $pdo->prepare("INSERT INTO users (`types`,`username`,`passwordset`,`created`,`year`,`deleted`)
VALUES (?,?,'0000-00-00', NOW(),?,'no')");
$stmt->execute([$type,$username,$config['FAIRYEAR']]);
$stmt->execute([$type, $username, $config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
$uid = $pdo->lastInsertId();
if (user_valid_email($username)) {
$stmt = $pdo->prepare("UPDATE users SET email=? WHERE id=?");
$stmt->execute([$username,$uid]);
$stmt = $pdo->prepare('UPDATE users SET email=? WHERE id=?');
$stmt->execute([$username, $uid]);
}
$stmt = $pdo->prepare("UPDATE users SET uid=? WHERE id=?");
$stmt->execute([$uid,$uid]);
$stmt = $pdo->prepare('UPDATE users SET uid=? WHERE id=?');
$stmt->execute([$uid, $uid]);
show_pdo_errors_if_any($pdo);
/*
* Since the user already has a type, user_save won't create this
* entry for us, so do it here
*/
$stmt = $pdo->prepare("INSERT INTO users_? (users_id) VALUES(?)");
$stmt = $pdo->prepare('INSERT INTO users_? (users_id) VALUES(?)');
$stmt->execute([$type, $uid]);
show_pdo_errors_if_any($pdo);
/* Load the complete user */

@ -109,10 +109,10 @@ if ($reg_mode == 'invite') {
*/
switch ($action) {
case 'new':
$data_fn = $pdo->quote(stripslashes($_POST['fn']));
$data_ln = $pdo->quote(stripslashes($_POST['ln']));
$data_fn = stripslashes($_POST['fn']);
$data_ln = stripslashes($_POST['ln']);
$data_email = stripslashes($_POST['email']);
$sql_email = $pdo->quote($data_email);
$sql_email = $data_email;
$registrationpassword = $_POST['registrationpassword'];
/* Check the registration singlepassword */

@ -86,6 +86,7 @@ if ($eid != $_SESSION['users_id']) {
$type = $_SESSION['users_type'];
$u = user_load($eid);
/* Load the fields the user can edit, and theones that are required */
$fields = array();
$required = array();
@ -185,10 +186,11 @@ if (get_value_from_array($_SESSION, 'embed') == true) {
$newstatus = user_personal_info_status($u);
?>
<script type="text/javascript">
function personal_save()
{
{
$("#debug").load("<?= $config['SFIABDIRECTORY'] ?>/user_personal.php?action=save", $("#personal_form").serializeArray());
return false;
return false;
}
function personal_update_status(s) {
@ -390,6 +392,7 @@ if (in_array('committee', $u['types'])) {
}
echo '<input type="submit" onclick="personal_save();return false;" value="' . i18n('Save Personal Information') . "\" />\n";
echo '</form>';
echo '<br />';

@ -50,10 +50,11 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
echo '<h2>' . i18n('%1 ' . $type . ' Award Winners', array($_GET['year'])) . '</h2>';
$ok = true;
// first, lets make sure someone isnt tryint to see something that they arent allowed to!
// but only if the year they want is the FAIRYEAR. If they want a past year, thats cool
if ($_GET['year'] >= $config['FAIRYEAR']) {
$q = $pdo->prepare("SELECT (NOW()>?) AS test");
$q = $pdo->prepare('SELECT (NOW()>?) AS test');
$q->execute([$config['dates']['postwinners']]);
$r = $q->fetch(PDO::FETCH_OBJ);
if ($r->test != 1) {
@ -63,7 +64,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
}
if ($ok) {
$q = $pdo->prepare("SELECT
$q = $pdo->prepare('SELECT
award_awards.id,
award_awards.name,
award_awards.order AS awards_order,
@ -73,18 +74,19 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
award_types
WHERE
award_awards.year=?
AND\taward_awards.award_types_id=award_types.id
AND\taward_types.type=?
AND\taward_types.year=?
AND award_awards.award_types_id=award_types.id
AND award_types.type=?
AND award_types.year=?
ORDER BY
awards_order");
awards_order');
$q->execute([$year,$type,$year]);
$q->execute([$year, $type, $year]);
show_pdo_errors_if_any($pdo);
if ($q->rowCount()) {
echo '<a href="winners.php">' . i18n('Back to Winners main page') . '</a>';
echo '<br />';
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$pq = $pdo->prepare("SELECT
award_prizes.prize,
@ -101,11 +103,12 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
LEFT JOIN winners ON winners.awards_prizes_id=award_prizes.id
LEFT JOIN projects ON projects.id=winners.projects_id
WHERE
award_awards_id=?
AND award_prizes.year=?
award_awards_id='$r->id '
AND award_prizes.year='$year'
ORDER BY
`order`");
$pq->execute([$r->id,$year]);
$pq->execute();
show_pdo_errors_if_any($pdo);
$awarded_count = 0;
if ($show_unawarded_awards == 'no') {
@ -114,9 +117,31 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
$awarded_count++;
}
}
$pq->fetch(PDO::FETCH_ORI_ABS, 0);
}
$pq = $pdo->prepare("SELECT
award_prizes.prize,
award_prizes.number,
award_prizes.id,
award_prizes.cash,
award_prizes.scholarship,
winners.projects_id,
projects.projectnumber,
projects.title,
projects.registrations_id AS reg_id
FROM
award_prizes
LEFT JOIN winners ON winners.awards_prizes_id=award_prizes.id
LEFT JOIN projects ON projects.id=winners.projects_id
WHERE
award_awards_id='$r->id'
AND award_prizes.year='$year'
ORDER BY
`order`");
$pq->execute();
if ($show_unawarded_awards == 'yes' || $awarded_count > 0) {
echo '<h3>' . i18n($r->name) . "</h3> \n";
}
@ -150,7 +175,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
echo '&nbsp&nbsp;&nbsp;&nbsp;';
echo "($pr->projectnumber) " . htmlspecialchars($pr->title);
$sq = $pdo->prepare("SELECT students.firstname,
$sq = $pdo->prepare('SELECT students.firstname,
students.lastname,
students.schools_id,
students.webfirst,
@ -163,7 +188,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
WHERE
students.registrations_id=?
AND students.schools_id=schools.id
");
');
$sq->execute([$pr->reg_id]);
$studnum = 0;
@ -251,7 +276,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
// do this each time, because each year the names of the award types could change, along with what is actually given out.
//
$tq = $pdo->prepare("SELECT
$tq = $pdo->prepare('SELECT
DISTINCT(award_types.type) AS type
FROM
winners,
@ -265,7 +290,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
AND winners.year=?
ORDER BY
award_types.order
");
');
$tq->execute([$r->year]);
$errorInfo = $pdo->errorInfo();
if ($errorInfo[0] != '00000') {