diff --git a/common.inc.php b/common.inc.php index a00dee7..aca2bfc 100644 --- a/common.inc.php +++ b/common.inc.php @@ -119,9 +119,22 @@ if(!mysql_select_db($DBNAME)) //find out the fair year and any other 'year=0' configuration parameters (things that dont change as the years go on) $q=mysql_query("SELECT * FROM config WHERE year='0'"); -while($r=mysql_fetch_object($q)) +if(!mysql_num_rows($q)) { - $config[$r->var]=$r->val; + echo "SFIAB ERROR"; + echo "

Science Fair In A Box - ERROR

"; + echo "SFIAB installation is not complete. Please go to Installer Step 3 to complete the installation process"; + echo "
"; + echo ""; + exit; + +} +else +{ + while($r=mysql_fetch_object($q)) + { + $config[$r->var]=$r->val; + } } //now pull the rest of the configuration diff --git a/db/db.full.7.sql b/db/db.full.7.sql index 8a5f54b..8e21143 100644 --- a/db/db.full.7.sql +++ b/db/db.full.7.sql @@ -786,3 +786,6 @@ INSERT INTO `dates` (`date`, `name`, `description`, `year`) VALUES ('', 'judgere INSERT INTO `dates` (`date`, `name`, `description`, `year`) VALUES ('', 'judgeregclose', 'Judges registration closes', -1); INSERT INTO `dates` (`date`, `name`, `description`, `year`) VALUES ('', 'specawardregopen', 'Special Awards self-nomination opens', -1); INSERT INTO `dates` (`date`, `name`, `description`, `year`) VALUES ('', 'specawardregclose', 'Special Awards self-nomination closes', -1); + +INSERT INTO `languages` (`lang`, `langname`, `active`) VALUES ('en', 'English', 'Y'); +INSERT INTO `languages` (`lang`, `langname`, `active`) VALUES ('fr', 'Français', 'Y'); diff --git a/db/db.update.7.sql b/db/db.update.7.sql index 5d73e09..df827f3 100644 --- a/db/db.update.7.sql +++ b/db/db.update.7.sql @@ -29,3 +29,5 @@ INSERT INTO `dates` (`date`, `name`, `description`, `year`) VALUES ('', 'judgere INSERT INTO `dates` (`date`, `name`, `description`, `year`) VALUES ('', 'judgeregclose', 'Judges registration closes', -1); INSERT INTO `dates` (`date`, `name`, `description`, `year`) VALUES ('', 'specawardregopen', 'Special Awards self-nomination opens', -1); INSERT INTO `dates` (`date`, `name`, `description`, `year`) VALUES ('', 'specawardregclose', 'Special Awards self-nomination closes', -1); +INSERT INTO `languages` (`lang`, `langname`, `active`) VALUES ('en', 'English', 'Y'); +INSERT INTO `languages` (`lang`, `langname`, `active`) VALUES ('fr', 'Français', 'Y'); diff --git a/install3.php b/install3.php index 88b7664..fba6233 100644 --- a/install3.php +++ b/install3.php @@ -84,6 +84,64 @@ if(mysql_num_rows($q)) } echo "Found!
"; +if($_POST['action']=="save") +{ + $err=false; + if(!$_POST['fairyear']) + { + echo "Fair Year is required"; + $err=true; + } + + if(!$_POST['email']) + { + echo "Superuser email address is required"; + $err=true; + } + + if(!( $_POST['pass1'] && $_POST['pass2'])) + { + echo "Superuser password and password confirmation are required"; + $err=true; + } + if($_POST['pass1'] != $_POST['pass2']) + { + echo "Password and Password confirmation do not match"; + $err=true; + } + + if(!$err) + { + echo "Creating configuration settings..."; + mysql_query("INSERT INTO config (var,val,year) VALUES ('FAIRYEAR','".$_POST['fairyear']."','0')"); + mysql_query("INSERT INTO config (var,val,year) VALUES ('SFIABDIRECTORY','".$_POST['sfiabdirectory']."','0')"); + + //copy over the config defautls + $q=mysql_query("SELECT * FROM config WHERE year='-1'"); + while($r=mysql_fetch_object($q)) + { + mysql_query("INSERT INTO config (var,val,description,year) VALUES ('$r->var','$r->val','$r->description','".$_POST['fairyear']."'"); + } + //copy over the dates defautls + $q=mysql_query("SELECT * FROM dates WHERE year='-1'"); + while($r=mysql_fetch_object($q)) + { + mysql_query("INSERT INTO dates (date,name,description,year) VALUES ('$r->date','$r->name','$r->description','".$_POST['fairyear']."'"); + } + echo "Done!
"; + echo "Creating superuser account..."; + mysql_query("INSERT INTO committees_members (email,emailprivate,password) VALUES ('".$_POST['email']."','".$_POST['email']."','".$_POST['pass1']."')"); + echo mysql_error(); + + echo "Done!
"; + echo "Installation is now complete! You can now proceed to the following location:
"; + echo "    Your SFIAB main page
"; + echo ""; + exit; + } + +} + echo "
"; echo "Please enter the following options
"; echo "
"; @@ -91,25 +149,28 @@ echo "
"; $month=date("m"); if($month>4) $fairyearsuggest=date("Y")+1; else $fairyearsuggest=date("Y"); + +$directorysuggest=substr($_SERVER['REQUEST_URI'],0,-13); echo "

Options

"; +echo "
"; +echo ""; echo ""; echo ""; - -$directorysuggest=substr($_SERVER['REQUEST_URI'],0,-13); echo ""; echo "
Fair YearThe year of the fair you are installing SFIAB to run
DirectoryThe directory of this SFIAB installation as seen by the web browser
"; echo "
"; -echo "

Age Categories

"; -echo "Create default age categories (same as CWSF)
"; -echo "Do not create any age categories
"; - +echo "

Superuser Account

"; +echo "Please choose your superuser account which is required to login to SFIAB and configure the system, as well as to add other users.
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
Superuser Email Address
Superuser Password
Superuser Password (Confirm)
"; echo "
"; -echo "

Divisions

"; -echo "Create default divisions (same as CWSF)
"; -echo "Do not create any divisions
"; - +echo ""; +echo "
"; ?>