Nearly finished install3 - I think the installer is almost ready to be used.

also updated DB version 7 to include the language entries
also update common.inc.php to make sure install3 is installed (make sure there's entries in the config table!)
This commit is contained in:
james 2005-06-07 01:23:15 +00:00
parent 0f4616c2da
commit 5ef9051c0a
4 changed files with 91 additions and 12 deletions

View File

@ -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 "<html><head><title>SFIAB ERROR</title></head><body>";
echo "<h1>Science Fair In A Box - ERROR</h1>";
echo "SFIAB installation is not complete. Please go to <A href=\"install3.php\">Installer Step 3</a> to complete the installation process";
echo "<br>";
echo "</body></html>";
exit;
}
else
{
while($r=mysql_fetch_object($q))
{
$config[$r->var]=$r->val;
}
}
//now pull the rest of the configuration

View File

@ -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');

View File

@ -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');

View File

@ -84,6 +84,64 @@ if(mysql_num_rows($q))
}
echo "<b>Found!</b><br />";
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 "<b>Done!</b><br />";
echo "Creating superuser account...";
mysql_query("INSERT INTO committees_members (email,emailprivate,password) VALUES ('".$_POST['email']."','".$_POST['email']."','".$_POST['pass1']."')");
echo mysql_error();
echo "<b>Done!</b><br />";
echo "Installation is now complete! You can now proceed to the following location: <br />";
echo "&nbsp; &nbsp; <a href=\"".$_POST['sfiabdirectory']."\">Your SFIAB main page</a><br />";
echo "</body></html>";
exit;
}
}
echo "<br />";
echo "Please enter the following options <br />";
echo "<br />";
@ -91,25 +149,28 @@ echo "<br />";
$month=date("m");
if($month>4) $fairyearsuggest=date("Y")+1;
else $fairyearsuggest=date("Y");
$directorysuggest=substr($_SERVER['REQUEST_URI'],0,-13);
echo "<h3>Options</h3>";
echo "<form method=\"post\" action=\"install3.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"save\" />";
echo "<table>";
echo "<tr><td>Fair Year</td><td><input size=\"8\" type=\"text\" name=\"fairyear\" value=\"$fairyearsuggest\"></td><td>The year of the fair you are installing SFIAB to run</td></tr>";
$directorysuggest=substr($_SERVER['REQUEST_URI'],0,-13);
echo "<tr><td>Directory</td><td><input size=\"25\" type=\"text\" name=\"sfiabdirectory\" value=\"$directorysuggest\"></td><td>The directory of this SFIAB installation as seen by the web browser</td></tr>";
echo "</table>";
echo "<br />";
echo "<h3>Age Categories</h3>";
echo "<input checked=\"checked\" type=\"radio\" name=\"categories\" value=\"default\">Create default age categories (same as CWSF) <br />";
echo "<input type=\"radio\" name=\"categories\" value=\"none\">Do not create any age categories <br />";
echo "<h3>Superuser Account</h3>";
echo "Please choose your superuser account which is required to login to SFIAB and configure the system, as well as to add other users. <br />";
echo "<table>";
echo "<tr><td>Superuser Email Address</td><td><input size=\"40\" type=\"text\" name=\"email\"></td></tr>";
echo "<tr><td>Superuser Password</td><td><input size=\"15\" type=\"password\" name=\"pass1\"></td></tr>";
echo "<tr><td>Superuser Password (Confirm)</td><td><input size=\"15\" type=\"password\" name=\"pass2\"></td></tr>";
echo "</table>";
echo "<br />";
echo "<h3>Divisions</h3>";
echo "<input checked=\"checked\" type=\"radio\" name=\"divisions\" value=\"default\">Create default divisions (same as CWSF) <br />";
echo "<input type=\"radio\" name=\"divisions\" value=\"none\">Do not create any divisions<br />";
echo "<input type=\"submit\" value=\"Complete Installation\">";
echo "</form>";
?>