diff --git a/account.inc.php b/account.inc.php
index 126eecd..f2ac3b8 100644
--- a/account.inc.php
+++ b/account.inc.php
@@ -220,9 +220,7 @@ function account_add_role($accounts_id, $roles_id, $conferences_id, $password =
// we now have the user id that we need, let's check to see whether or not they
// already have the specified role.
- if(is_array(mysql_fetch_array(mysql_query(
- "SELECT * FROM user_roles WHERE users_id = $users_id AND roles_id = $roles_id"
- )))){
+ if(mysql_result(mysql_query("SELECT COUNT(*) FROM user_roles WHERE users_id = $users_id AND roles_id = $roles_id"), 0) != 0){
// they already have this role. shell_exec("man true");
return 'ok';
}
diff --git a/common.inc.bootstrap.php b/common.inc.bootstrap.php
index 00b07b2..d741f8a 100644
--- a/common.inc.bootstrap.php
+++ b/common.inc.bootstrap.php
@@ -193,9 +193,10 @@ if(!$_SESSION['conferences_id']) {
if($r=mysql_fetch_object($q)) {
$_SESSION['conferences_id']=$r->id;
}
+ /*
else {
echo "No conferences defined!";
- }
+ }*/
}
function switchConference($cid) {
@@ -313,6 +314,11 @@ $CWSFDivisions=array(
9=>"Physical & Mathematical Sciences"
);
+$conference_types = array(
+ 'sciencefair' => 'Science Fair',
+ 'scienceolympics' => 'Science Olympics'
+);
+
//take SFIABDIRECTORY off of the current URL
$pageurl=substr($_SERVER['PHP_SELF'],strlen($config['SFIABDIRECTORY']));
diff --git a/common.inc.php b/common.inc.php
index b4ac115..5848910 100644
--- a/common.inc.php
+++ b/common.inc.php
@@ -255,6 +255,9 @@ if(is_array($_SESSION['roles'])) {
?>
+if($_SESSION['superuser'] == 'yes') {
+ echo "
".i18n("System Setup").'';
+}
if(array_key_exists('users_id', $_SESSION)) {
/*
if(in_array('admin', $_SESSION['roles'])) {
@@ -264,9 +267,6 @@ if(array_key_exists('users_id', $_SESSION)) {
echo "".i18n("Configuration").' (old) ';
}
*/
- if($_SESSION['superuser'] == 'yes') {
- echo "".i18n("System Setup").'';
- }
if(in_array('volunteer', $_SESSION['roles'])) {
// echo "".i18n("Volunteer Home").'';
}
diff --git a/db/db.code.version.txt b/db/db.code.version.txt
index 3d4c7bf..7b47338 100644
--- a/db/db.code.version.txt
+++ b/db/db.code.version.txt
@@ -1 +1 @@
-220
+221
diff --git a/db/db.update.221.sql b/db/db.update.221.sql
new file mode 100644
index 0000000..63d12bb
--- /dev/null
+++ b/db/db.update.221.sql
@@ -0,0 +1,2 @@
+ALTER TABLE award_types DROP INDEX id;
+ALTER TABLE `award_types` ADD PRIMARY KEY (`id`, `conferences_id`);
diff --git a/install2.php b/install2.php
index 4e55f10..6fe6ca3 100644
--- a/install2.php
+++ b/install2.php
@@ -62,7 +62,7 @@ mysql_select_db($DBNAME);
echo "Checking for existing SFIAB database... ";
- $q=@mysql_query("SELECT val FROM config WHERE var='DBVERSION' AND year='0'");
+ $q=@mysql_query("SELECT val FROM config WHERE var='DBVERSION' AND conferences_id='0'");
$r=@mysql_fetch_object($q);
$dbdbversion=$r->val;
@@ -93,7 +93,7 @@ mysql_select_db($DBNAME);
echo "Done! installed database version $dbcodeversion
\n";
//now update the db version in the database
- mysql_query("UPDATE config SET val='$dbcodeversion' WHERE var='DBVERSION' AND year='0'");
+ mysql_query("UPDATE config SET val='$dbcodeversion' WHERE var='DBVERSION' AND conferences_id='0'");
echo "
";
echo "Done!
";
@@ -113,13 +113,13 @@ mysql_select_db($DBNAME);
echo "Done! installed database version $x
\n";
//now update the db version in the database
- mysql_query("UPDATE config SET val='$x' WHERE var='DBVERSION' AND year='0'");
+ mysql_query("UPDATE config SET val='$x' WHERE var='DBVERSION' AND conferences_id='0'");
echo "Attempting to update database using standard update script to update from $x to $dbcodeversion
";
echo "
Please scroll to the bottom of this page for the link to the next step of the installation process.
";
chdir ("db");
/* Update the database, but don't update the config variables yet, because
- * We haven't set the FAIRYEAR */
+ * We haven't set the conference id */
$db_update_skip_variables = true;
include "db_update.php";
chdir ("../");
diff --git a/install3.php b/install3.php
index 15b2352..8a2471b 100644
--- a/install3.php
+++ b/install3.php
@@ -46,7 +46,7 @@ mysql_select_db($DBNAME);
echo "Checking for SFIAB database... ";
-$q=@mysql_query("SELECT val FROM config WHERE var='DBVERSION' AND year='0'");
+$q=@mysql_query("SELECT val FROM config WHERE var='DBVERSION' AND conferences_id='0'");
$r=@mysql_fetch_object($q);
$dbdbversion=$r->val;
@@ -57,11 +57,11 @@ if(!$dbdbversion) {
exit;
}
-//a fresh install should ONLY have DBVERSION defined in the config table. If there are others (FAIRYEAR, SFIABDIRECTORY) then this is NOT fresh
-$q=mysql_query("SELECT * FROM config WHERE year='0' AND conferences_id='0' AND ( var='DBVERSION' OR var='FAIRYEAR' OR var='SFIABDIRECTORY') ");
+//a fresh install should ONLY have DBVERSION defined in the config table. If there are others (SFIABDIRECTORY) then this is NOT fresh
+$q=mysql_query("SELECT * FROM config WHERE conferences_id='0' AND ( var='DBVERSION' OR var='SFIABDIRECTORY') ");
//we might get an error if the config table does not exist (ie, installer step 2 failed)
if(mysql_error()) {
- //we say all tables, but really only we check for config where year=0;
+ //we say all tables, but really only we check for config where conferences_id=0;
echo "";
echo "