Many updates of queries, switching from usage of FAIRYEAR to conference_id.

This commit is contained in:
jacob 2010-11-01 15:24:59 +00:00
parent 4f35702bbf
commit 21261a99af
42 changed files with 312 additions and 266 deletions

View File

@ -215,7 +215,7 @@ TRACE("Grid size: {$grid_size}m\n");
$div = array();
TRACE("Loading Project Divisions...\n");
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q))
{
$divshort[$r->id]=$r->division_shortform;
@ -225,7 +225,7 @@ while($r=mysql_fetch_object($q))
TRACE("Loading Project Age Categories...\n");
$cat = array();
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q)) {
$catshort[$r->id]=$r->category_shortform;
$cat[$r->id]=$r->category;
@ -236,7 +236,7 @@ TRACE("Loading Projects...\n");
$projects = array();
$q = mysql_query("SELECT projects.* FROM projects, registrations
WHERE
projects.year='{$config['FAIRYEAR']}'
projects.conferences_id='{$conference['id']}'
AND registrations.id = projects.registrations_id
".getJudgingEligibilityCode());
while($p = mysql_fetch_object($q)) {
@ -597,7 +597,7 @@ for($x=0;$x<$a->num_buckets; $x++) {
print_r($projects);
/* Assign floor numbers */
mysql_query("UPDATE projects SET floornumber=0 WHERE year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE projects SET floornumber=0 WHERE conferences_id='{$conference['id']}'");
foreach($projects as $pid=>$p) {
mysql_query("UPDATE projects SET floornumber='{$p['floornumber']}' WHERE id='$pid'");

View File

@ -27,7 +27,7 @@
user_auth_required('admin');
require("../lpdf.php");
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$_GET['cat']."'");
$catq=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' AND id='".$_GET['cat']."'");
if($catr=mysql_fetch_object($catq))
{
@ -48,7 +48,7 @@ if($catr=mysql_fetch_object($catq))
registrations
left outer join projects on projects.registrations_id=registrations.id
WHERE
registrations.year='".$config['FAIRYEAR']."'
registrations.conferences_id='".$conference['id']."'
AND ( registrations.status='complete' OR registrations.status='paymentpending' )
AND projects.projectcategories_id='$catr->id'
ORDER BY
@ -74,7 +74,7 @@ if($catr=mysql_fetch_object($catq))
}
while($r=mysql_fetch_object($q))
{
$divq=mysql_query("SELECT division,division_shortform FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'");
$divq=mysql_query("SELECT division,division_shortform FROM projectdivisions WHERE conferences_id='".$conference['id']."' AND id='".$r->projectdivisions_id."'");
$divr=mysql_fetch_object($divq);
$sq=mysql_query("SELECT students.firstname,

View File

@ -56,14 +56,14 @@ function newbuttonclicked(jdivs)
$div = array();
$divshort = array();
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) {
$divshort[$r->id]=$r->division_shortform;
$div[$r->id]=$r->division;
}
$cat = array();
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) {
$cat[$r->id]=$r->category;
}
@ -72,7 +72,7 @@ function newbuttonclicked(jdivs)
$ckeys = array_keys($cat);
if($config['filterdivisionbycategory']=="yes") {
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id");
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE conferences_id='".$conference['id']."' ORDER BY projectdivisions_id,projectcategories_id");
$divcat=array();
while($r=mysql_fetch_object($q)) {
$divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id);
@ -97,7 +97,7 @@ function newbuttonclicked(jdivs)
function get_all_divs()
{
global $config;
global $config, $conference;
global $divshort, $div,$cat, $langr;
global $divcat;
@ -157,7 +157,7 @@ function get_all_divs()
" projectdivisions_id='{$cdl[$id]['div']}' ".
" AND projectcategories_id='{$cdl[$id]['cat']}' ".
" AND language='{$cdl[$id]['lang']}' ".
" AND registrations.year='{$config['FAIRYEAR']}'".
" AND registrations.conferences_id='{$conference['id']}'".
" AND projects.registrations_id=registrations.id".
" AND (registrations.status='complete' OR registrations.status='paymentpending')");

View File

@ -87,11 +87,11 @@ if($_GET['action']=="delete" && $_GET['delete'] && $_GET['edit'])
if($_POST['action']=="assign" && $_POST['edit'] && $_POST['timeslot'] && $_POST['project_id'])
{
mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,year) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,conferences_id) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$conference['id']."')");
echo happy(i18n("Project assigned to team timeslot"));
}
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)>1)
$show_date=true;
else
@ -212,7 +212,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
projectnumber is not null
" . getJudgingEligibilityCode(). " AND
projects.registrations_id=registrations.id AND
projects.year='".$config['FAIRYEAR']."'
projects.conferences_id='".$conference['id']."'
ORDER BY
projectnumber";
}
@ -232,7 +232,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
" . getJudgingEligibilityCode(). " AND
projects.registrations_id=registrations.id AND
judges_teams_timeslots_projects_link.projects_id IS NULL AND
projects.year='".$config['FAIRYEAR']."'
projects.conferences_id='".$conference['id']."'
ORDER BY
projectnumber";
}
@ -300,7 +300,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND
judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND
judges_teams_timeslots_projects_link.projects_id=projects.id AND
judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."'
judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."'
ORDER BY
projectnumber
");
@ -407,7 +407,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND
judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND
judges_teams_timeslots_projects_link.projects_id=projects.id AND
judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."'
judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."'
ORDER BY
projectnumber
");

View File

@ -32,7 +32,6 @@
'Judging Score Entry' => 'admin/judging_score_entry.php')
);
$year=$config['FAIRYEAR'];
$project_id = NULL;
if($_GET['projectid']) {
$project_id = $_GET['projectid'];
@ -50,7 +49,7 @@
mysql_query("UPDATE judges_teams_timeslots_projects_link
SET score=" . $score .
" WHERE judges_teams_id = " . mysql_real_escape_string($_POST["team_" . $curr_team . "_id"]) .
" and projects_id =$project_id and year=$year");
" and projects_id =$project_id and conferences_id={$conference['id']}");
echo mysql_error();
}
$curr_team--;
@ -60,11 +59,11 @@
?>
<?
if($project_id) {
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']} ORDER BY id");
while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']} ORDER BY id");
$q=mysql_query("SELECT judges_teams_timeslots_projects_link.judges_teams_id,

View File

@ -27,8 +27,8 @@
require_once("judges.inc.php");
user_auth_required('admin');
if($_GET['year']) $year=$_GET['year'];
else $year=$config['FAIRYEAR'];
if($_GET['conferences_id']) $conferences_id=$_GET['conferences_id'];
else $conferences_id=$conference['id'];
if($_GET['csv'] == 'yes') {
header("Content-type: text/csv");
@ -42,11 +42,11 @@
}
?>
<?
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id = '$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id = '$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q))
$divs[$r->id]=$r->division;
@ -73,7 +73,7 @@ $ORDERBY="projects.projectcategories_id, projects.projectdivisions_id, projects.
left outer join projects on projects.registrations_id=registrations.id
left outer join judges_teams_timeslots_projects_link on projects.id=judges_teams_timeslots_projects_link.projects_id
WHERE
registrations.year='$year' "
registrations.conferences_id='$conferences_id' "
. getJudgingEligibilityCode() . "
GROUP BY projectid
ORDER BY
@ -163,7 +163,7 @@ $(document).ready(function() {
}
echo number_format($r->score_count, 0) . "/" . number_format($r->score_total_count, 0) . "</td>\n";
echo "<td align=\"center\">";
if($year==$config['FAIRYEAR']) {
if($conferences_id == $conference['id']){
echo "<a href=\"judging_score_edit.php?projectid=$r->projectid\">";
echo i18n("Edit Scores");
echo "</a>";

View File

@ -42,7 +42,7 @@ if($auth_type == 'fair') {
the master copy of the fairs_id in the project */
$q=mysql_query("SELECT * FROM projects WHERE
registrations_id='$registrations_id'
AND year='{$config['FAIRYEAR']}'
AND conferences_id='{$conference['id']}'
AND fairs_id=$fairs_id");
if(mysql_num_rows($q) != 1) {
echo "permission denied.";
@ -62,7 +62,7 @@ case 'project_regenerate_number':
project_save();
/* Now generate */
$q=mysql_query("SELECT id FROM projects WHERE registrations_id='{$registrations_id}' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT id FROM projects WHERE registrations_id='{$registrations_id}' AND conferences_id='{$conference['id']}'");
$i=mysql_fetch_assoc($q);
$id = $i['id'];
@ -89,10 +89,10 @@ exit;
function project_save()
{
global $registrations_id, $config;
global $registrations_id, $config, $conference;
//first, lets make sure this project really does belong to them
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='{$registrations_id}' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='{$registrations_id}' AND conferences_id='{$conference['id']}'");
$projectinfo=mysql_fetch_object($q);
if(!projectinfo) {
echo error(i18n("Invalid project to update"));
@ -128,7 +128,7 @@ function project_save()
//check if they changed the project number
if($_POST['projectnumber']!=$projectinfo->projectnumber) {
//check if hte new one is available
$q=mysql_query("SELECT * FROM projects WHERE year='".$config['FAIRYEAR']."' AND projectnumber='".$_POST['projectnumber']."'");
$q=mysql_query("SELECT * FROM projects WHERE conferences_id='".$conference['id']."' AND projectnumber='".$_POST['projectnumber']."'");
if(mysql_num_rows($q)) {
error_("Could not change project number. %1 is already in use",array($_POST['projectnumber']));
} else {
@ -143,14 +143,14 @@ function project_save()
function project_load()
{
global $registrations_id, $config;
global $registrations_id, $config, $conference;
//now lets find out their MAX grade, so we can pre-set the Age Category
$q=mysql_query("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id='".$registrations_id."'");
$gradeinfo=mysql_fetch_object($q);
//now lets grab all the age categories, so we can choose one based on the max grade
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) {
//save these in an array, just incase we need them later (FIXME: remove this array if we dont need it)
$agecategories[$r->id]['category']=$r->category;
@ -162,7 +162,7 @@ function project_load()
}
//now select their project info
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND conferences_id='".$conference['id']."'");
//check if it exists, if we didnt find any record, lets insert one
$projectinfo=mysql_fetch_object($q);
@ -229,11 +229,11 @@ function countwords()
<?
//###### Feature Specific - filtering divisions by category
if($config['filterdivisionbycategory']=="yes"){
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectcategoriesdivisions_link.year='".$config['FAIRYEAR']."' ORDER BY division");
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.conferences_id='".$conference['id']."' AND projectcategoriesdivisions_link.conferences_id='".$conference['id']."' ORDER BY division");
echo mysql_error();
//###
} else
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY division");
echo "<select name=\"projectdivisions_id\">";
echo "<option value=\"\">".i18n("Select a division")."</option>\n";

View File

@ -38,7 +38,7 @@
'cost' => 'Cost',
'per' => 'Cost Per',
), null,
array('year' => $config['FAIRYEAR'])
array('conference' => $conference['name'])
);
$editor->setPrimaryKey("id");
@ -48,7 +48,7 @@
array('key' => 'project', 'val' => "Project")
) );
$editor->setFieldInputType("per", 'select');
$editor->filterList('year',$config['FAIRYEAR']);
$editor->filterList('conference',$conference['name']);
$editor->execute();

View File

@ -29,14 +29,14 @@ $auth_type = user_auth_required(array(), array('fair', 'admin'));
//require_once('../register_participants.inc.php');
if($_GET['year']) $year=$_GET['year'];
else $year=$config['FAIRYEAR'];
if($_GET['conference_id']) $conference_id=$_GET['conference_id'];
else $conference_id=$conference['id']
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']} ORDER BY id");
while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']} ORDER BY id");
while($r=mysql_fetch_object($q))
$divs[$r->id]=$r->division;
@ -44,7 +44,7 @@ $action=$_GET['action'];
switch($action) {
case 'load_row':
$id = intval($_GET['id']);
$q = list_query($year, '', $id);
$q = list_query($conference_id, '', $id);
$r = mysql_fetch_object($q);
print_row($r);
exit;
@ -56,13 +56,13 @@ case 'delete':
$p = mysql_fetch_assoc($q);
mysql_query("DELETE FROM winners WHERE projects_id='{$p['id']}'");
}
mysql_query("DELETE FROM registrations WHERE id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM students WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM safety WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM questions_answers WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM mentors WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM emergencycontact WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM registrations WHERE id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM students WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM safety WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
// mysql_query("DELETE FROM questions_answers WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM mentors WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM emergencycontact WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
happy_("Registration and all related data successfully deleted");
exit;
}
@ -347,7 +347,7 @@ if($showstatus) {
}
else $wherestatus="";
$q = list_query($year, $wherestatus, false);
$q = list_query($conference_id, $wherestatus, false);
echo "<table id=\"registration_list\" class=\"tableview\">";
echo "<thead><tr>";
@ -379,7 +379,7 @@ echo "<br/><br/>The statistics have moved here: <a href=\"registration_stats.php
send_footer();
/* Now some helper fucntions we call more than once */
function list_query($year, $wherestatus, $reg_id)
function list_query($conference_id, $wherestatus, $reg_id)
{
global $auth_type;
@ -405,7 +405,7 @@ function list_query($year, $wherestatus, $reg_id)
left outer join projects on projects.registrations_id=registrations.id
WHERE
1
AND registrations.year='$year'
AND registrations.conferences_id='$conference_id'
$wherestatus
$reg $fair
ORDER BY
@ -419,7 +419,7 @@ function list_query($year, $wherestatus, $reg_id)
function print_row($r)
{
global $cats, $divs, $config, $year;
global $cats, $divs, $config, $conference_id, $conference;
switch($r->status) {
case "new": $status_text="New"; break;
case "open": $status_text="Open"; break;
@ -469,7 +469,7 @@ function print_row($r)
echo "<td $scl>$schools</td>";
echo "<td $scl>$students</td>";
echo "<td align=\"center\" >";
if($year==$config['FAIRYEAR']) {
if($conference_id==$conference['id']) {
echo "<a title=\"".i18n("Delete this registration")."\" href=\"#\" onClick=\"delete_registration({$r->reg_id});return false\" >";
echo "<img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=0>";
echo "</a>";

View File

@ -37,7 +37,7 @@
$showformatbottom=true;
if($_POST['action']=="received" && $_POST['registration_number'])
{
$q=mysql_query("SELECT * FROM registrations WHERE num='".$_POST['registration_number']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM registrations WHERE num='".$_POST['registration_number']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==1)
{
$r=mysql_fetch_object($q);
@ -204,11 +204,11 @@ echo mysql_Error();
FROM projects, registrations
WHERE projects.registrations_id = registrations.id
AND num='$regnum'
AND registrations.year='{$config['FAIRYEAR']}'");
AND registrations.conferences_id='{$conference['id']}'");
$checkNumResults=mysql_fetch_object($checkNumQuery);
$projectnum=$checkNumResults->projectnumber;
$q=mysql_query("SELECT id FROM registrations WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT id FROM registrations WHERE num='$regnum' AND conferences_id='{$conference['id']}'");
$r=mysql_fetch_object($q);
$reg_id = $r->id;
@ -217,7 +217,7 @@ echo mysql_Error();
list($projectnumber,$ps,$pns,$pss) = generateProjectNumber($reg_id);
mysql_query("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 conferences_id='{$conference['id']}'");
echo happy(i18n("Assigned Project Number: %1",array($projectnumber)));
}
else
@ -229,7 +229,7 @@ echo mysql_Error();
if($_POST['action']=="receivedyes")
{
//actually set it to 'complete'
mysql_query("UPDATE registrations SET status='complete' WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE registrations SET status='complete' WHERE num='$regnum' AND conferences_id='{$conference['id']}'");
foreach($recipients AS $recip) {
$to=$recip['to'];
@ -251,7 +251,7 @@ echo mysql_Error();
else if($_POST['action']=="receivedyesnocash")
{
//actually set it to 'paymentpending'
mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='$regnum' AND conferences_id='{$conference['id']}'");
foreach($recipients AS $recip) {
$to=$recip['to'];
@ -278,10 +278,10 @@ echo mysql_Error();
}
else if($_GET['action']=="unregister" && $_GET['registration_number']) {
$reg_num=intval(trim($_GET['registration_number']));
$q=mysql_query("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.year='{$config['FAIRYEAR']}' AND registrations.num='$reg_num'");
$q=mysql_query("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.conferences_id='{$conference['id']}' AND registrations.num='$reg_num'");
$r=mysql_fetch_object($q);
mysql_query("UPDATE projects SET projectnumber=null, projectsort=null, projectnumber_seq=0, projectsort_seq=0 WHERE id='$r->proj_id' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE registrations SET status='open' WHERE id='$r->reg_id' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE projects SET projectnumber=null, projectsort=null, projectnumber_seq=0, projectsort_seq=0 WHERE id='$r->proj_id' AND conferences_id='{$conference['id']}'");
mysql_query("UPDATE registrations SET status='open' WHERE id='$r->reg_id' AND conferences_id='{$conference['id']}'");
echo happy(i18n("Successfully unregistered project"));
}

View File

@ -27,8 +27,8 @@
user_auth_required('admin');
require("../register_participants.inc.php");
if($_GET['year']) $year=$_GET['year'];
else $year=$config['FAIRYEAR'];
if($_GET['conferences_id']) $conferences_id=$_GET['conferences_id'];
else $conferences_id=$conference['id'];
send_header("Registration Statistics",
array('Committee Main' => 'committee_main.php',
@ -61,11 +61,11 @@
echo "</select>";
echo "</form>";
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q))
$divs[$r->id]=$r->division;
@ -104,7 +104,7 @@ else $wherestatus="";
left outer join projects on projects.registrations_id=registrations.id
WHERE
1
AND registrations.year='$year'
AND registrations.conferences_id='$conferences_id'
$wherestatus
ORDER BY
$ORDERBY

View File

@ -86,9 +86,9 @@
students.registrations_id=registrations.id
AND ( registrations.status = 'complete' OR registrations.status='paymentpending' )
AND projects.registrations_id=registrations.id
AND registrations.year='".$config['FAIRYEAR']."'
AND projects.year='".$config['FAIRYEAR']."'
AND students.year='".$config['FAIRYEAR']."'
AND registrations.conferences_id='".$conference['id']."'
AND projects.conferences_id='".$conference['id']."'
AND students.conferences_id='".$conference['id']."'
ORDER BY projectnumber
");
echo mysql_error();

View File

@ -20,7 +20,8 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
$parts = explode('-', $config['dates']['fairdate']);
$fairYear = $parts[0];
$report_awards_fields = array(
'name' => array(
'start_option_group' => 'Award Information',
@ -355,7 +356,7 @@ $report_awards_fields = array(
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'table' => $fairYear),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',

View File

@ -20,6 +20,8 @@
Boston, MA 02111-1307, USA.
*/
$parts = explode('-', $config['dates']['fairdate']);
$fairYear = $parts[0];
$report_fairs_fields = array(
'fairinfo_name' => array(
@ -402,7 +404,7 @@ $report_fairs_fields = array(
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'table' => $fairYear),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
@ -418,7 +420,7 @@ $report_fairs_fields = array(
);
function report_fairs_fromwhere($report, $components)
function report_fairs_fromwhere($report, $components) /// FIXME - this isn't updated to use the conference['id'], but I don't see it used anywhere in the code anyway. Delete?
{
global $config, $report_fairs_fields;

View File

@ -30,6 +30,8 @@ function report_fundraisings_languages(&$report, $field, $text)
return join(' ', $l);
}
$parts = explode('-', $config['dates']['fairdate']);
$fairYear = $parts[0];
/* Components: */
@ -164,7 +166,7 @@ $report_fundraisings_fields = array(
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'table' => $fairYear),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',

View File

@ -417,9 +417,9 @@ function email_send_new($to,$from,$subject,$body,$bodyhtml="") {
*/
function getEmailRecipientsForRegistration($reg_id)
{
global $config;
global $config, $conference;
//okay first grab the registration record, to see if we should email the kids, the teacher, and/or the parents
$q=mysql_query("SELECT * FROM registrations WHERE id='$reg_id' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT * FROM registrations WHERE id='$reg_id' AND conferences_id='{$conference['id']}'");
$registration=mysql_fetch_object($q);
if($registration->emailcontact && isEmailAddress($registration->emailcontact)) {
@ -430,7 +430,7 @@ function getEmailRecipientsForRegistration($reg_id)
);
}
$sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'");
$sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND conferences_id='{$conference['id']}'");
$ret=array();
while($sr=mysql_fetch_object($sq)) {
if($sr->email && isEmailAddress($sr->email)) {
@ -454,8 +454,8 @@ function getEmailRecipientsForRegistration($reg_id)
}
function output_page_text($textname) {
global $config;
$q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND year='".$config['FAIRYEAR']."' AND lang='".$_SESSION['lang']."'");
global $config, $conference;
$q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND conferences_id='".$conference['id']."' AND lang='".$_SESSION['lang']."'");
if(mysql_num_rows($q))
$r=mysql_fetch_object($q);
else {
@ -520,7 +520,7 @@ function admin_warnings() {
//warnings to show to both config and/or admin people
function committee_warnings() {
global $config;
global $config, $conference;
//it is vital that each year the system be rolled over before we start it again
//we should do this, say, 4 months after the FAIRDATE, so its soon enough that they should see
//the message as soon as they login to start preparing for hte new year, but not too late to do it
@ -542,7 +542,7 @@ function committee_warnings() {
$qq = mysql_query("SELECT * FROM award_awards
LEFT JOIN fairs ON fairs.id=award_awards.award_source_fairs_id
WHERE award_awards.id='{$p['award_awards_id']}'
AND year='{$config['FAIRYEAR']}'
AND conferences_id='{$conference['id']}'
AND award_awards.award_source_fairs_id IS NOT NULL
AND fairs.type='ysc' ");
echo mysql_error();

View File

@ -1 +1 @@
216
217

41
db/db.update.217.php Normal file
View File

@ -0,0 +1,41 @@
<?
function db_update_217_pre()
{
}
function db_update_217_post()
{
$tables=array(
'pagetext',
'emergencycontact',
'safetyquestions',
'tours',
'tours_choice',
'regfee_items',
'mentors',
'schools',
'project_specialawards_link',
'safety',
'safetyquestions'
);
// add the conferences_id field
foreach($tables as $tableName){
$query = "ALTER TABLE `$tableName` ADD `conferences_id` INT NOT NULL";
mysql_query($query);
echo $query . ";\n";
}
// get the year => conference_id links
$q1 = mysql_query("SELECT year, id FROM conferences WHERE year > 0");
// add the conferences_id field to each table
while($r = mysql_fetch_assoc($q1)){
foreach($tables as $tableName){
$query = "UPDATE `$tableName` SET `conferences_id` = {$r['id']} WHERE `year` = {$r['year']}";
mysql_query($query);
echo $query . ";\n";
}
}
}
?>

View File

@ -131,7 +131,7 @@ echo "<div id=\"expertise_info_status\"></div>\n";
echo "<form name=\"expertiseform\" id=\"judgeexpertise_form\">\n";
echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n";
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY mingrade");
echo "<br /><h4>".i18n("Age Category Preferences")."</h4><br>";
echo "<table class=\"editor\" style=\"width: 300px;\" >";
while($r=mysql_fetch_object($q))
@ -171,7 +171,7 @@ echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n";
echo "<table>\n";
//query all of the categories
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY division");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY division");
$first = true;
while($r=mysql_fetch_object($q)) {
@ -199,7 +199,7 @@ echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n";
//only show the sub-divisions if the 'main' division is scored >=3
if($u['div_prefs'][$r->id]>=3) {
$subq=mysql_query("SELECT * FROM projectsubdivisions WHERE projectdivisions_id='$r->id' AND year='".$config['FAIRYEAR']."' ORDER BY subdivision");
$subq=mysql_query("SELECT * FROM projectsubdivisions WHERE projectdivisions_id='$r->id' AND conferences_id='".$conference['id']."' ORDER BY subdivision");
while($subr=mysql_fetch_object($subq)) {
echo "<tr>";
echo "<td>&nbsp;</td>";

View File

@ -62,7 +62,7 @@
* if there is one, print the judge scheule link in an obvious place,
* it's less obvious below */
$q = mysql_query("SELECT id FROM judges_teams_link WHERE
users_id='{$u['id']}' AND year='{$config['FAIRYEAR']}'");
users_id='{$u['id']}' AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q) > 0) {
echo '<span style="font-size: 1.2em; font-weight: bold;">';
echo i18n("You have been assigned to a judging team. %1Click here%2 to view the judging schedule",

View File

@ -46,7 +46,7 @@ $sq = mysql_query("SELECT firstname,lastname,school FROM students
LEFT JOIN schools ON schools.id = students.schools_id
WHERE
registrations_id='{$pi->registrations_id}'
AND students.year='{$config['FAIRYEAR']}'");
AND students.conferences_id='{$conference['id']}'");
$student = array();
while($si = mysql_fetch_object($sq)) {

View File

@ -75,7 +75,7 @@ if(!$scheduleok) {
$q = mysql_query("SELECT * FROM judges_teams_link
LEFT JOIN judges_teams ON judges_teams.id=judges_teams_link.judges_teams_id
WHERE judges_teams_link.users_id='{$u['id']}'
AND judges_teams_link.year='{$config['FAIRYEAR']}'");
AND judges_teams_link.conferences_id='{$conference['id']}'");
$teams = array();
while($t = mysql_fetch_assoc($q)) {
/* Load timeslot data for this team (team -> judges_timeslots_link -> timeslot -> parent timeslot */

View File

@ -24,7 +24,7 @@
<?
function getProjectsEligibleForAward($award_id)
{
global $config;
global $conference;
$prjq=mysql_query("SELECT
award_awards.id,
@ -46,7 +46,7 @@ function getProjectsEligibleForAward($award_id)
AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id
AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id
AND projects.projectnumber is not null
AND projects.year='".$config['FAIRYEAR']."'
AND projects.conferences_id='".$conference['id']."'
ORDER BY
projectsort
");
@ -92,7 +92,7 @@ function getProjectsEligibleOrNominatedForAwards($awards_ids_array)
function getSpecialAwardsEligibleForProject($projectid)
{
global $config;
global $conference;
$awardsq=mysql_query("SELECT
award_awards.id,
@ -116,10 +116,10 @@ function getSpecialAwardsEligibleForProject($projectid)
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='".$config['FAIRYEAR']."'
AND projects.conferences_id='".$conference['id']."'
AND projects.id='$projectid'
AND award_types.year='".$config['FAIRYEAR']."'
AND award_awards.year='".$config['FAIRYEAR']."'
AND award_types.conferences_id='".$conference['id']."'
AND award_awards.conferences_id='".$conference['id']."'
ORDER BY
award_awards.name
");
@ -139,7 +139,7 @@ function getSpecialAwardsEligibleForProject($projectid)
function getSpecialAwardsNominatedForProject($projectid)
{
global $config;
global $conference;
$awardsq=mysql_query("SELECT
award_awards.id,
@ -154,7 +154,7 @@ function getSpecialAwardsNominatedForProject($projectid)
WHERE
project_specialawards_link.projects_id='$projectid'
AND project_specialawards_link.award_awards_id=award_awards.id
AND projects.year='".$config['FAIRYEAR']."'
AND projects.conferences_id='".$conference['id']."'
AND projects.id='$projectid'
ORDER BY
award_awards.name
@ -175,7 +175,7 @@ function getSpecialAwardsNominatedForProject($projectid)
function getNominatedForNoSpecialAwardsForProject($projectid)
{
global $config;
global $conference;
$awardsq=mysql_query("SELECT
projects.id AS projects_id
FROM
@ -183,7 +183,7 @@ function getNominatedForNoSpecialAwardsForProject($projectid)
projects
WHERE
project_specialawards_link.projects_id='$projectid'
AND projects.year='".$config['FAIRYEAR']."'
AND projects.conferences_id='".$conference['id']."'
AND projects.id='$projectid'
AND project_specialawards_link.award_awards_id IS NULL
");
@ -193,7 +193,7 @@ function getNominatedForNoSpecialAwardsForProject($projectid)
function getProjectsNominatedForSpecialAward($award_id)
{
global $config;
global $config, $conference;
//if they dont use special award nominations, then we will instead get all of the projects that
//are eligible for the award, instead of nominated for it.
@ -210,7 +210,7 @@ function getProjectsNominatedForSpecialAward($award_id)
project_specialawards_link.award_awards_id='$award_id'
AND project_specialawards_link.projects_id=projects.id
AND projects.projectnumber is not null
AND projects.year='".$config['FAIRYEAR']."'
AND projects.conferences_id='".$conference['id']."'
ORDER BY
projectsort
");
@ -235,7 +235,7 @@ function getProjectsNominatedForSpecialAward($award_id)
function getSpecialAwardsNominatedByRegistrationID($id)
{
global $config;
global $conference;
$awardq=mysql_query("SELECT
award_awards.id,
@ -255,7 +255,7 @@ function getSpecialAwardsNominatedByRegistrationID($id)
AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id
AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id
AND projects.projectnumber is not null
AND projects.year='".$config['FAIRYEAR']."'
AND projects.conferences_id='".$conference['id']."'
ORDER BY
projectsort
");
@ -281,7 +281,7 @@ function project_load($pid)
/* Load the students */
$q = mysql_query("SELECT students.*,schools.school FROM students
LEFT JOIN schools ON schools.id=students.schools_id
WHERE registrations_id='{$proj['registrations_id']}' AND students.year='{$proj['year']}' ORDER BY students.id");
WHERE registrations_id='{$proj['registrations_id']}' AND students.conferences_id='{$proj['conferences_id']}' ORDER BY students.id");
$proj['num_students'] = 0;
while($s = mysql_fetch_assoc($q)) {
$proj['num_students']++;

View File

@ -48,7 +48,7 @@ function registrationDeadlinePassed()
function studentStatus($reg_id="")
{
global $config;
global $config, $conference;
if($config['participant_student_personal']=="yes")
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id","sex");
else
@ -60,7 +60,7 @@ function studentStatus($reg_id="")
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
//if we dont have the minimum, return incomplete
if(mysql_num_rows($q)<$config['minstudentsperproject'])
@ -89,18 +89,18 @@ function studentStatus($reg_id="")
function emergencycontactStatus($reg_id="")
{
global $config;
global $conference;
$required_fields=array("firstname","lastname","relation","phone1");
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
$sq=mysql_query("SELECT id FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
$sq=mysql_query("SELECT id FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
$numstudents=mysql_num_rows($sq);
while($sr=mysql_fetch_object($sq))
{
$q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."' AND students_id='$sr->id'");
$q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."' AND students_id='$sr->id'");
$r=mysql_fetch_object($q);
@ -119,7 +119,7 @@ function emergencycontactStatus($reg_id="")
function projectStatus($reg_id="")
{
global $config;
global $config, $conference;
$required_fields=array("title","projectcategories_id","projectdivisions_id","language","req_table","req_electricity","summarycountok");
if($config['participant_short_title_enable'] == 'yes')
@ -131,7 +131,7 @@ function projectStatus($reg_id="")
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
//if we dont have a project entry yet, return empty
if(!mysql_num_rows($q))
@ -154,19 +154,19 @@ function projectStatus($reg_id="")
function mentorStatus($reg_id="")
{
global $config;
global $config, $conference;
$required_fields=array("firstname","lastname","phone","email","organization","description");
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=mysql_query("SELECT nummentors FROM registrations WHERE id='$rid' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT nummentors FROM registrations WHERE id='$rid' AND conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q);
if($r->nummentors==null)
return "incomplete";
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
//if we dont have the minimum, return incomplete
if(mysql_num_rows($q)<$config['minmentorserproject'])
@ -190,7 +190,7 @@ function mentorStatus($reg_id="")
function safetyStatus($reg_id="")
{
global $config;
global $conference;
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
@ -203,7 +203,7 @@ function safetyStatus($reg_id="")
}
//now grab all the questions
$q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord");
$q=mysql_query("SELECT * FROM safetyquestions WHERE conferences_id='".$conference['id']."' ORDER BY ord");
while($r=mysql_fetch_object($q))
{
if($r->required=="yes" && !$safetyanswers[$r->id])
@ -217,7 +217,7 @@ function safetyStatus($reg_id="")
function spawardStatus($reg_id="")
{
global $config;
global $conference;
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
@ -232,7 +232,7 @@ function spawardStatus($reg_id="")
projects
WHERE
project_specialawards_link.projects_id='".$project->id."'
AND projects.year='".$config['FAIRYEAR']."'
AND projects.conferences_id='".$conference['id']."'
");
if(mysql_num_rows($awardsq))
@ -243,20 +243,20 @@ function spawardStatus($reg_id="")
function tourStatus($reg_id="")
{
global $config;
global $config, $conference;
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
/* Get the students for this project */
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
$num_found = mysql_num_rows($q);
$ret = "complete";
while($s=mysql_fetch_object($q)) {
//grab all of their tour prefs
$sid = $s->id;
$qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and year='{$config['FAIRYEAR']}' ORDER BY rank");
$qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and conferences_id='{$conference['id']}' ORDER BY rank");
$n_tours = mysql_num_rows($qq);
if($n_tours > 0) {
@ -281,12 +281,12 @@ function tourStatus($reg_id="")
}
function namecheckStatus($reg_id="")
{
global $config;
global $conference;
if($reg_id) {
$q=mysql_query("SELECT * FROM students WHERE
registrations_id='$reg_id'
AND year='".$config['FAIRYEAR']."'");
AND conferences_id='".$conference['id']."'");
} else {
$q=mysql_query("SELECT * FROM students WHERE
id='{$_SESSION['students_id']}'");
@ -304,7 +304,7 @@ function namecheckStatus($reg_id="")
function generateProjectNumber($registration_id)
{
global $config;
global $config, $conference;
$reg_id = $registration_id;
@ -320,8 +320,8 @@ function generateProjectNumber($registration_id)
registrations_id='$reg_id'
AND projects.projectdivisions_id=projectdivisions.id
AND projects.projectcategories_id=projectcategories.id
AND projectcategories.year='{$config['FAIRYEAR']}'
AND projectdivisions.year='{$config['FAIRYEAR']}'
AND projectcategories.conferences_id='{$conference['id']}'
AND projectdivisions.conferences_id='{$conference['id']}'
");
echo mysql_error();
$r=mysql_fetch_object($q);
@ -357,7 +357,7 @@ function generateProjectNumber($registration_id)
$q = mysql_query("SELECT projectnumber_seq,projectsort_seq,
projectdivisions_id,projectcategories_id
FROM projects
WHERE year='{$config['FAIRYEAR']}'
WHERE conferences_id='{$conference['id']}'
AND projectnumber_seq!='0'
AND projectnumber IS NOT NULL");
echo mysql_error();
@ -430,15 +430,15 @@ function generateProjectNumber($registration_id)
function computeRegistrationFee($regid)
{
global $config;
global $config, $conference;
$ret = array();
$regfee_items = array();
$q = mysql_query("SELECT * FROM regfee_items
WHERE year='{$config['FAIRYEAR']}'");
WHERE conferences_id='{$conference['id']}'");
while($i = mysql_fetch_assoc($q)) $regfee_items[] = $i;
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
$n_students = mysql_num_rows($q);
$n_tshirts = 0;
$sel = array();

View File

@ -30,12 +30,12 @@
$datecheck=mysql_fetch_object($q);
if($_POST['action']=="new") {
$q=mysql_query("SELECT email,num,id,schools_id FROM registrations WHERE email='".$_SESSION['email']."' AND num='".$_POST['regnum']."' AND year=".$config['FAIRYEAR']);
$q=mysql_query("SELECT email,num,id,schools_id FROM registrations WHERE email='".$_SESSION['email']."' AND num='".$_POST['regnum']."' AND conferences_id=".$conference['id']);
if(mysql_num_rows($q)) {
$r=mysql_fetch_object($q);
$_SESSION['registration_number']=$r->num;
$_SESSION['registration_id']=$r->id;
mysql_query("INSERT INTO students (registrations_id,email,schools_id,year) VALUES ('$r->id','".mysql_escape_string($_SESSION['email'])."','".$r->schools_id."','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO students (registrations_id,email,schools_id,conferences_id) VALUES ('$r->id','".mysql_escape_string($_SESSION['email'])."','".$r->schools_id."','".$conference['id']."')");
mysql_query("UPDATE registrations SET status='open' WHERE id='$r->id'");
header("Location: register_participants_main.php");
@ -57,8 +57,8 @@
"WHERE students.email='".$_SESSION['email']."' ".
"AND registrations.num='".intval($_POST['regnum'])."' ".
"AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ".
"AND students.year=".$config['FAIRYEAR']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
if(mysql_num_rows($q)) {
$r=mysql_fetch_object($q);
@ -81,7 +81,7 @@
registrations
WHERE
registrations.email='".$_SESSION['email']."'
AND registrations.year='".$config['FAIRYEAR']."'");
AND registrations.conferences_id='".$conference['id']."'");
if(mysql_num_rows($q))
$r=mysql_fetch_object($q);
else {
@ -93,7 +93,7 @@
WHERE
students.email='".$_SESSION['email']."'
AND students.registrations_id=registrations.id
AND registrations.year='".$config['FAIRYEAR']."'");
AND registrations.conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q);
}
@ -137,7 +137,7 @@
//first, check if they have any registrations waiting to be opened
$q=mysql_query("SELECT * FROM registrations WHERE email='".$_SESSION['email']."' AND status='new' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM registrations WHERE email='".$_SESSION['email']."' AND status='new' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)>0) {
echo i18n("Please enter your <b>registration number</b> that you received in your email, in order to begin your new registration");
echo "<input type=\"hidden\" name=\"action\" value=\"new\">";
@ -154,8 +154,8 @@
registrations
WHERE
students.email='".$_SESSION['email']."'
AND students.year=".$config['FAIRYEAR']."
AND registrations.year=".$config['FAIRYEAR']."
AND students.conferences_id=".$conference['id']."
AND registrations.conferences_id=".$conference['id']."
AND
( registrations.status='open'
OR registrations.status='paymentpending'
@ -216,7 +216,7 @@
else if($config['participant_registration_type']=="schoolpassword") {
$showschoolpasswordform=true;
if($_POST['schoolpassword'] && $_POST['schoolid']) {
$q=mysql_query("SELECT registration_password FROM schools WHERE id='".$_POST['schoolid']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT registration_password FROM schools WHERE id='".$_POST['schoolid']."' AND conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q);
if($_POST['schoolpassword']==$r->registration_password) {
@ -239,7 +239,7 @@
echo "<input type=\"hidden\" name=\"action\" value=\"login\">";
echo i18n("Email Address:")." ".$_SESSION['email']."<br />";
echo i18n("School: ");
$q=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school");
$q=mysql_query("SELECT id,school FROM schools WHERE conferences_id='".$conference['id']."' ORDER BY school");
echo "<select name=\"schoolid\">";
echo "<option value=\"\">".i18n("Choose your school")."</option>\n";
while($r=mysql_fetch_object($q))
@ -292,19 +292,19 @@
//random number between
//100000 and 999999 (six digit integer)
$regnum=rand(100000,999999);
$q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year=".$config['FAIRYEAR']);
$q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND conferences_id=".$conference['id']);
}while(mysql_num_rows($q)>0);
if(!$schoolidquery) $schoolidquery="null";
//actually insert it
mysql_query("INSERT INTO registrations (num,email,start,status,schools_id,year) VALUES (".
mysql_query("INSERT INTO registrations (num,email,start,status,schools_id,conferences_id) VALUES (".
"'$regnum',".
"'".$_SESSION['email']."',".
"NOW(),".
"'new',".
$schoolidquery.",".
$config['FAIRYEAR'].
$conference['id'].
")");
email_send("new_participant",$_SESSION['email'],array(),array("REGNUM"=>$regnum,"EMAIL"=>$_SESSION['email']));

View File

@ -43,8 +43,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0)
@ -82,29 +82,29 @@ echo mysql_error();
//first, lets make sure this emergency contact really does belong to them
foreach($_POST['ids'] AS $id)
{
$q=mysql_query("SELECT * FROM emergencycontact WHERE id='$id' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM emergencycontact WHERE id='$id' AND registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==1) {
$e=stripslashes($_POST['email'][$id]);
if($_POST['relation'][$id]=="Parent" && $e && user_valid_email($e)) {
if($u=user_load_by_email($e)) {
$u['firstname']=stripslashes($_POST['firstname'][$id]);
$u['lastname']=stripslashes($_POST['lastname'][$id]);
$u['phonehome']=stripslashes($_POST['phone1'][$id]);
$u['phonework']=stripslashes($_POST['phone2'][$id]);
$u['email']=$e;
$u['types'][]="parent";
user_save($u);
}
else {
$u=user_create("parent",$e);
$u['firstname']=stripslashes($_POST['firstname'][$id]);
$u['lastname']=stripslashes($_POST['lastname'][$id]);
$u['phonehome']=stripslashes($_POST['phone1'][$id]);
$u['phonework']=stripslashes($_POST['phone2'][$id]);
$u['email']=$e;
user_save($u);
}
}
$e=stripslashes($_POST['email'][$id]);
if($_POST['relation'][$id]=="Parent" && $e && user_valid_email($e)) {
if($u=user_load_by_email($e)) {
$u['firstname']=stripslashes($_POST['firstname'][$id]);
$u['lastname']=stripslashes($_POST['lastname'][$id]);
$u['phonehome']=stripslashes($_POST['phone1'][$id]);
$u['phonework']=stripslashes($_POST['phone2'][$id]);
$u['email']=$e;
$u['types'][]="parent";
user_save($u);
}
else {
$u=user_create("parent",$e);
$u['firstname']=stripslashes($_POST['firstname'][$id]);
$u['lastname']=stripslashes($_POST['lastname'][$id]);
$u['phonehome']=stripslashes($_POST['phone1'][$id]);
$u['phonework']=stripslashes($_POST['phone2'][$id]);
$u['email']=$e;
user_save($u);
}
}
mysql_query("UPDATE emergencycontact SET ".
"firstname='".mysql_escape_string(stripslashes($_POST['firstname'][$id]))."', ".
@ -141,7 +141,7 @@ else if($newstatus=="complete")
}
$sq=mysql_query("SELECT id,firstname,lastname FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$sq=mysql_query("SELECT id,firstname,lastname FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$numstudents=mysql_num_rows($sq);
echo "<form name=\"emergencycontactform\" method=\"post\" action=\"register_participants_emergencycontact.php\">\n";
@ -149,10 +149,10 @@ echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
while($sr=mysql_fetch_object($sq))
{
$q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."' AND students_id='$sr->id'");
$q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."' AND students_id='$sr->id'");
if(mysql_num_rows($q)==0) {
mysql_query("INSERT INTO emergencycontact (registrations_id,students_id,year) VALUES ('".$_SESSION['registration_id']."','".$sr->id."','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO emergencycontact (registrations_id,students_id,conferences_id) VALUES ('".$_SESSION['registration_id']."','".$sr->id."','".$conference['id']."')");
$id=mysql_insert_id();
unset($r);
}

View File

@ -41,8 +41,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0)

View File

@ -43,8 +43,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0)
@ -68,7 +68,7 @@ echo mysql_error();
{
//now select their project number
$q=mysql_query("SELECT projectnumber FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT projectnumber FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$projectinfo=mysql_fetch_object($q);
if($r->status=="complete")
@ -280,7 +280,7 @@ echo "<table><tr><td>";
}
}
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='{$conference['id']}'");
$project=mysql_fetch_object($q);
$nominatedawards=getSpecialAwardsNominatedForProject($project->id);
$num=count($nominatedawards);

View File

@ -42,8 +42,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0)
@ -145,11 +145,11 @@ if($_GET['action']=="removementor")
//now query and display
$q=mysql_query("SELECT nummentors FROM registrations WHERE id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT nummentors FROM registrations WHERE id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q);
$registrations_nummentors=$r->nummentors;
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$numfound=mysql_num_rows($q);

View File

@ -42,8 +42,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0)
@ -82,7 +82,7 @@ echo mysql_error();
else
{
//first, lets make sure this project really does belong to them
$q=mysql_query("SELECT * FROM projects WHERE id='".$_POST['id']."' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM projects WHERE id='".$_POST['id']."' AND registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==1)
{
$summarywords=preg_split("/[\s,]+/",$_POST['summary']);
@ -137,7 +137,7 @@ echo mysql_error();
$gradeinfo=mysql_fetch_object($q);
//now lets grab all the age categories, so we can choose one based on the max grade
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q))
{
//save these in an array, just incase we need them later (FIXME: remove this array if we dont need it)
@ -151,13 +151,13 @@ echo mysql_error();
}
}
//now select their project info
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
//check if it exists, if we didnt find any record, lets insert one
if(mysql_num_rows($q)==0)
{
mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,year) VALUES ('".$_SESSION['registration_id']."','$projectcategories_id','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,conferences_id) VALUES ('".$_SESSION['registration_id']."','$projectcategories_id','".$conference['id']."')");
//now query the one we just inserted
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
}
$projectinfo=mysql_fetch_object($q);
@ -228,11 +228,11 @@ function countwords()
//###### Feature Specific - filtering divisions by category
if($config['filterdivisionbycategory']=="yes"){
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectcategoriesdivisions_link.year='".$config['FAIRYEAR']."' ORDER BY division");
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.conferences_id='".$conference['id']."' AND projectcategoriesdivisions_link.conferences_id='".$conference['id']."' ORDER BY division");
echo mysql_error();
//###
}else
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY division");
echo "<select name=\"projectdivisions_id\">";
echo "<option value=\"\">".i18n("Select a division")."</option>\n";
while($r=mysql_fetch_object($q))

View File

@ -42,8 +42,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0)

View File

@ -40,8 +40,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0) {
@ -65,14 +65,14 @@ echo mysql_error();
}
else {
//first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them
mysql_query("DELETE FROM safety WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM safety WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
if(is_array($_POST['safety'])) {
$safetyids=array_keys($_POST['safety']);
foreach($safetyids AS $key=>$val) {
mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,year,answer) VALUES (".
mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,conferences_id,answer) VALUES (".
"'".$_SESSION['registration_id']."', ".
"'$val', ".
"'".$config['FAIRYEAR']."', ".
"'".$conference['id']."', ".
"'".mysql_escape_string(stripslashes($_POST['safety'][$val]))."')");
echo mysql_error();
}
@ -94,7 +94,7 @@ else if($newstatus=="complete") {
$safetyanswers[$r->safetyquestions_id]=$r->answer;
}
$q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord");
$q=mysql_query("SELECT * FROM safetyquestions WHERE conferences_id='".$conference['id']."' ORDER BY ord");
if(mysql_num_rows($q)) {
echo i18n("Please agree to / answer the following safety questions by checking the box next to the question, or choosing the appropriate answer");
echo "<br />";

View File

@ -47,8 +47,8 @@
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']}");
AND registrations.conferences_id={$conference['id']}
AND students.conferences_id={$conference['id']}");
$registration_number=$_SESSION['registration_number'];
$registration_id=$_SESSION['registration_id'];
@ -93,13 +93,13 @@ $pdf->AddPage();
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']."'
AND projects.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."'
");
$projectinfo=mysql_fetch_object($q);
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
while($si=mysql_fetch_object($q))
$studentinfoarray[]=$si;
}

View File

@ -49,8 +49,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
$registration_number=$_SESSION['registration_number'];
$registration_id=$_SESSION['registration_id'];
@ -112,13 +112,13 @@ $pdf->newPage();
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']."'
AND projects.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."'
");
$projectinfo=mysql_fetch_object($q);
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
while($si=mysql_fetch_object($q))
$studentinfoarray[]=$si;
}

View File

@ -43,8 +43,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0)
@ -126,15 +126,15 @@ function checkboxclicked(b)
}
else
{
mysql_query("DELETE FROM project_specialawards_link WHERE projects_id='$project->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM project_specialawards_link WHERE projects_id='$project->id' AND conferences_id='".$conference['id']."'");
foreach($splist AS $spaward)
{
$s = ($spaward == -1) ? "NULL" : "'$spaward'";
mysql_query("INSERT INTO project_specialawards_link (award_awards_id,projects_id,year) VALUES (".
mysql_query("INSERT INTO project_specialawards_link (award_awards_id,projects_id,conferences_id) VALUES (".
"$s, ".
"'$project->id', ".
"'".$config['FAIRYEAR']."')");
"'".$conference['id']."')");
echo mysql_error();
}
if($num) {

View File

@ -42,8 +42,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0)
@ -60,7 +60,7 @@ echo mysql_error();
$regfee_items = array();
$items_q = mysql_query("SELECT * FROM regfee_items
WHERE year='{$config['FAIRYEAR']}'");
WHERE conferences_id='{$conference['id']}'");
while($items_i = mysql_fetch_assoc($items_q)) {
$regfee_items[] = $items_i;
}
@ -89,7 +89,7 @@ if($_POST['action']=="save")
//if they use schoolpassword or singlepassword, then we need to set the school based on the school stored in the registration record. for anything else they can school the school on their own.
if($config['participant_registration_type']=="schoolpassword" || $config['participant_registration_type']=="invite")
{
$q=mysql_query("SELECT schools_id FROM registrations WHERE id='".$_SESSION['registration_id']."' AND YEAR='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT schools_id FROM registrations WHERE id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q);
$schools_id=$r->schools_id;
@ -101,7 +101,7 @@ if($_POST['action']=="save")
}
//INSERT new record
$dob=$_POST['year'][$x]."-".$_POST['month'][$x]."-".$_POST['day'][$x];
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,pronunciation,sex,email,address,city,province,postalcode,phone,dateofbirth,grade,schools_id,tshirt,medicalalert,foodreq,teachername,teacheremail,year) VALUES (".
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,pronunciation,sex,email,address,city,province,postalcode,phone,dateofbirth,grade,schools_id,tshirt,medicalalert,foodreq,teachername,teacheremail,conferences_id) VALUES (".
"'".$_SESSION['registration_id']."', ".
"'".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ".
"'".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ".
@ -121,7 +121,7 @@ if($_POST['action']=="save")
"'".mysql_escape_string(stripslashes($_POST['foodreq'][$x]))."', ".
"'".mysql_escape_string(stripslashes($_POST['teachername'][$x]))."', ".
"'".mysql_escape_string(stripslashes($_POST['teacheremail'][$x]))."', ".
"'".$config['FAIRYEAR']."')");
"'".$conference['id']."')");
$students_id = mysql_insert_id();
echo notice(i18n("%1 %2 successfully added",array($_POST['firstname'][$x],$_POST['lastname'][$x])));
@ -199,10 +199,10 @@ if($_GET['action']=="removestudent")
//now see if they have an emergency contact that also needs to be removed
$q=mysql_query("SELECT id FROM emergencycontact WHERE students_id='$students_id' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT id FROM emergencycontact WHERE students_id='$students_id' AND registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
//no need to error message if this doesnt exist
if(mysql_num_rows($q)==1)
mysql_query("DELETE FROM emergencycontact WHERE students_id='$students_id' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM emergencycontact WHERE students_id='$students_id' AND registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM regfee_items_link WHERE students_id='$students_id'");
@ -231,14 +231,14 @@ else if($newstatus=="complete")
//now query and display
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==0)
{
//uhh oh, we didnt find any, this isnt possible! lets insert one using the logged in persons email address
//although... this can never really happen, since the above queries only allow the page to view if the student
//is found in the students table... soo... well, lets leave it here as a fallback anyways, just incase
mysql_query("INSERT INTO students (registrations_id,email,year) VALUES ('".$_SESSION['registration_id']."','".mysql_escape_string($_SESSION['email'])."','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO students (registrations_id,email,conferences_id) VALUES ('".$_SESSION['registration_id']."','".mysql_escape_string($_SESSION['email'])."','".$conference['id']."')");
//if we just inserted it, then we will obviously find 1
$numfound=1;
}
@ -351,8 +351,9 @@ if($config['participant_student_personal']=="yes")
echo "</td><td>\n";
//the year selector should be based on the min/max ages possible (as set in $config)
$minyearselect=$config['FAIRYEAR'] - $config['maxage'];
$maxyearselect=$config['FAIRYEAR'] - $config['minage'];
// FIXME - this should be converted to use the year in which the conference occurs
$minyearselect = $config['FAIRYEAR'] - $config['maxage'];
$maxyearselect = $config['FAIRYEAR'] - $config['minage'];
emit_year_selector("year[$x]",$year,$minyearselect,$maxyearselect);
echo "</td><td>".REQUIREDFIELD."</td></tr></table>\n";
echo "</td>\n";
@ -425,7 +426,7 @@ if($config['participant_student_personal']=="yes")
echo " <td>".i18n("School")."</td><td colspan=\"3\">";
if( $config['participant_registration_type']=="open" || $config['participant_registration_type']=="singlepassword" || $config['participant_registration_type']=="openorinvite" || ($studentinfo && !$studentinfo->schools_id) )
{
$schoolq=mysql_query("SELECT id,school,city FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER by city,school");
$schoolq=mysql_query("SELECT id,school,city FROM schools WHERE conferences_id='".$conference['id']."' ORDER by city,school");
echo "<select name=\"schools_id[$x]\">\n";
echo "<option value=\"\">".i18n("Choose School")."</option>\n";
while($r=mysql_fetch_object($schoolq))
@ -443,7 +444,7 @@ if($config['participant_student_personal']=="yes")
}
else
{
$schoolq=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."' AND id='$studentinfo->schools_id'");
$schoolq=mysql_query("SELECT id,school FROM schools WHERE conferences_id='".$conference['id']."' AND id='$studentinfo->schools_id'");
$r=mysql_fetch_object($schoolq);
echo $r->school;
}

View File

@ -42,8 +42,8 @@
"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']);
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0)
@ -77,7 +77,7 @@ echo mysql_error();
//first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them
mysql_query("DELETE FROM tours_choice
WHERE registrations_id='{$_SESSION['registration_id']}'
AND year='{$config['FAIRYEAR']}'
AND conferences_id='{$conference['id']}'
AND rank!='0'");
if(is_array($_POST['toursel']))
{
@ -98,11 +98,11 @@ echo mysql_error();
/* Remember this choice in a format that is easily searchable */
$selarray[] = $x;
mysql_query("INSERT INTO tours_choice (registrations_id,students_id,tour_id,year,rank) VALUES (".
mysql_query("INSERT INTO tours_choice (registrations_id,students_id,tour_id,conferences_id,rank) VALUES (".
"'".$_SESSION['registration_id']."', ".
"'".intval($students_id)."', ".
"'".intval($tid)."', ".
"'".$config['FAIRYEAR']."', ".
"'".$conference['id']."', ".
"'$rank')");
echo mysql_error();
}
@ -140,7 +140,7 @@ else if($newstatus=="complete")
$assigned_tour = array();
$q=mysql_query("SELECT * FROM tours_choice WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM tours_choice WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
while($r=mysql_fetch_object($q))
{
if($r->rank == 0) $assigned_tour[$r->students_id] = $r->tour_id;
@ -148,7 +148,7 @@ else if($newstatus=="complete")
}
$tours = array();
$q=mysql_query("SELECT * FROM tours WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM tours WHERE conferences_id='".$conference['id']."' ORDER BY id");
if(mysql_num_rows($q) == 0)
{
echo notice(i18n("There is not tour information"));
@ -173,7 +173,7 @@ else if($newstatus=="complete")
echo "<form method=\"post\" action=\"register_participants_tours.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$num_found = mysql_num_rows($q);
$print_submit = false;

View File

@ -5,7 +5,7 @@ require_once('user.inc.php');
// authenticate the login
if($_POST['schoolid'] && $_POST['accesscode'])
{
$q=mysql_query("SELECT * FROM schools WHERE id='".$_POST['schoolid']."' AND accesscode='".$_POST['accesscode']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM schools WHERE id='".$_POST['schoolid']."' AND accesscode='".$_POST['accesscode']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==1)
{
$_SESSION['schoolid']=$_POST['schoolid'];
@ -28,7 +28,7 @@ if($_GET['action']=="logout")
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']){
// we're logged in, draw the dashboard
$q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND conferences_id='".$conference['id']."'");
echo mysql_error();
$school=mysql_fetch_object($q);
if($school) {
@ -72,7 +72,7 @@ function draw_dashboard(){
function draw_login(){
send_header("School Home");
global $errormsg, $happymsg, $config;
global $errormsg, $happymsg, $config, $conference;
if($errormsg) echo "<font color=red><b>$errormsg</b></font>";
if($happymsg) echo happy($happymsg);
@ -98,7 +98,7 @@ function draw_login(){
<select name="schoolid">
<option value=""><?=i18n("Choose your school")?></option>
<?
$q=mysql_query("SELECT id,school,city FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school");
$q=mysql_query("SELECT id,school,city FROM schools WHERE conferences_id='".$conference['id']."' ORDER BY school");
$prev="somethingthatdoesnotexist";
while($r=mysql_fetch_object($q))
{

View File

@ -3,7 +3,7 @@ include "common.inc.php";
if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type'] != 'scienceolympics'){
send_header("School Participant Invitations");
$q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM schools WHERE id='".$_SESSION['schoolid']."' AND accesscode='".$_SESSION['schoolaccesscode']."' AND conferences_id='".$conference['id']."'");
echo mysql_error();
$school=mysql_fetch_object($q);
if($school)
@ -42,7 +42,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
if($_POST['firstname'] && $_POST['lastname'] && $_POST['email'] && $_POST['grade'])
{
//make sure they arent already invited!
$q=mysql_query("SELECT firstname, lastname FROM students WHERE year='".$config['FAIRYEAR']."' AND email='".$_POST['email']."'");
$q=mysql_query("SELECT firstname, lastname FROM students WHERE conferences_id='".$conference['id']."' AND email='".$_POST['email']."'");
if(mysql_num_rows($q))
{
echo error(i18n("That students email address has already been invited"));
@ -56,17 +56,17 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
//random number between
//100000 and 999999 (six digit integer)
$regnum=rand(100000,999999);
$q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year=".$config['FAIRYEAR']);
$q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND conferences_id=".$conference['id']);
}while(mysql_num_rows($q)>0);
//actually insert it
mysql_query("INSERT INTO registrations (num,email,emailcontact,start,status,year) VALUES (".
mysql_query("INSERT INTO registrations (num,email,emailcontact,start,status,conferences_id) VALUES (".
"'$regnum',".
"'".$_POST['email']."',".
"'".$_POST['emailcontact']."',".
"NOW(),".
"'open',".
$config['FAIRYEAR'].
$conference['id'].
")");
$regid=mysql_insert_id();
@ -77,7 +77,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
'".mysql_escape_string($_POST['lastname'])."',
'".mysql_escape_string($_SESSION['schoolid'])."',
'".mysql_escape_string($_POST['grade'])."',
'".$config['FAIRYEAR']."')");
'".$conference['id']."')");
email_send("new_participant",$_POST['email'],array(),array("REGNUM"=>$regnum, "EMAIL"=>$_POST['email']));
if($_POST['emailcontact'])
@ -92,7 +92,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
if($_GET['action']=="uninvite")
{
//first, make sure that this is really their student, and it sfor this year.
$q=mysql_query("SELECT * FROM students WHERE id='".$_GET['uninvite']."' AND year='".$config['FAIRYEAR']."' AND schools_id='".$_SESSION['schoolid']."'");
$q=mysql_query("SELECT * FROM students WHERE id='".$_GET['uninvite']."' AND conferences_id='".$conference['id']."' AND schools_id='".$_SESSION['schoolid']."'");
if(mysql_num_rows($q))
{
$r=mysql_fetch_object($q);
@ -126,7 +126,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
registrations
WHERE
students.schools_id='".$school->id."'
AND students.year='".$config['FAIRYEAR']."'
AND students.conferences_id='".$conference['id']."'
AND students.registrations_id=registrations.id
ORDER BY
lastname,
@ -160,7 +160,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
else if($school->projectlimitper=="agecategory")
{
echo "<br />";
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$catq=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($catr=mysql_fetch_object($catq)){
$q2=mysql_query("SELECT COUNT(students.id) AS num
@ -171,7 +171,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'] && $conference['type']
students.schools_id='".$school->id."'
AND students.grade>='$catr->mingrade'
AND students.grade<='$catr->maxgrade'
AND students.year='".$config['FAIRYEAR']."'
AND students.conferences_id='".$conference['id']."'
AND students.registrations_id=registrations.id
");
echo mysql_error();

View File

@ -129,14 +129,14 @@ function tableEditorSave($data)
function tableEditorDelete()
{
global $config;
global $conference;
$id = $this->id;
mysql_query("DELETE FROM tours_choice WHERE tour_id='$id' AND year=".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM tours WHERE id='$id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM tours_choice WHERE tour_id='$id' AND conferences_id=".$conference['id']."'");
mysql_query("DELETE FROM tours WHERE id='$id' AND conferences_id='".$conference['id']."'");
echo happy(i18n("Successfully removed tour from this year's fair"));
echo happy(i18n("Successfully removed tour from this conference"));
}
};

View File

@ -25,9 +25,9 @@
require_once("common.inc.php");
require_once("user.inc.php");
user_auth_required();
echo $config['dates']['fairdate'] . "<hr>";
// find out if this user actually is in this conference
$query = "SELECT COUNT(*) FROM users WHERE conferences_id = {$_SESSION['conferences_id']}"
$query = "SELECT COUNT(*) FROM users WHERE conferences_id = {$conference['id']}"
. " AND accounts_id = " . $_SESSION['accounts_id'];
$data = mysql_fetch_array(mysql_query($query));
if($data[0] == 0){

View File

@ -115,10 +115,10 @@
}
/* See if this email already exists */
$q = mysql_query("SELECT id,types,MAX(year) AS year,deleted FROM users WHERE (email='$sql_email' OR username='$sql_email' )");
//select *, max(year) from users where username=sql_email
//if deleted and year = current yera - just undelete
//if deleted and year != current yera - proceed normally and recreate the user
$q = mysql_query("SELECT id,types,MAX(conferences_id) AS year,deleted FROM users WHERE (email='$sql_email' OR username='$sql_email' )");
//select *, max(conferences_id) from users where username=sql_email
//if deleted and conferences_id = current conference id - just undelete
//if deleted and conferences_id != current conference id - proceed normally and recreate the user
if(mysql_num_rows($q) > 0) {
@ -126,7 +126,7 @@
$r = mysql_fetch_object($q);
$types = explode(',', $r->types);
if($r->year==$config['FAIRYEAR'] && $r->deleted=='yes') {
if($r->year==$conference['id'] && $r->deleted=='yes') {
mysql_query("UPDATE users SET deleted='no' WHERE id='$r->id'");
message_push(happy(i18n("Your account has been undeleted")));
message_push(notice(i18n("Use the 'recover password' option on the %1 {$user_what[$type]} login page %2 if you have forgotten your password",