forked from science-ation/science-ation

The config and dates pages now need to be updated to read defaults, and insert new config parameters as FAIRYEAR if they dont exist already Bumped version to 7
117 lines
4.3 KiB
PHP
117 lines
4.3 KiB
PHP
<?
|
|
/*
|
|
This file is part of the 'Science Fair In A Box' project
|
|
SFIAB Website: http://www.sfiab.ca
|
|
|
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
|
Copyright (C) 2005 James Grant <james@lightbox.org>
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public
|
|
License as published by the Free Software Foundation, version 2.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; see the file COPYING. If not, write to
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA.
|
|
*/
|
|
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
|
|
?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
|
<head><title>SFIAB Installation</title>
|
|
<link rel="stylesheet" href="sfiab.css" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<h1>SFIAB Installation - Step 3</h1>
|
|
<?
|
|
if(!file_exists("data/config.inc.php"))
|
|
{
|
|
echo "<div class=\"error\">SFIAB Installation Step 1 is not yet complete.</div>";
|
|
echo "<a href=\"install.php\">Go back to installation step 1</a><br />";
|
|
echo "</body></html>";
|
|
exit;
|
|
}
|
|
|
|
require_once("data/config.inc.php");
|
|
mysql_connect($DBHOST,$DBUSER,$DBPASS);
|
|
mysql_select_db($DBNAME);
|
|
|
|
echo "Checking for SFIAB database... ";
|
|
if(file_exists("db/db.db.version.txt"))
|
|
{
|
|
$dbdbversion_file=file("db/db.db.version.txt");
|
|
$dbdbversion=trim($dbdbversion_file[0]);
|
|
if(!$dbdbversion)
|
|
{
|
|
echo "<div class=\"error\">SFIAB Installation Step 2 is not yet complete.</div>";
|
|
echo "<a href=\"install2.php\">Go back to installation step 2</a><br />";
|
|
echo "</body></html>";
|
|
exit;
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
echo "<div class=\"error\">SFIAB Installation Step 2 is not yet complete.</div>";
|
|
echo "<a href=\"install2.php\">Go back to installation step 2</a><br />";
|
|
echo "</body></html>";
|
|
exit;
|
|
}
|
|
|
|
//if there are entries in the config table for year=0, then this is NOT a fresh install, so error out
|
|
$q=mysql_query("SELECT * FROM config WHERE year='0'");
|
|
//we might get an error if the config table does not exist (ie, step 2 failed)
|
|
if(mysql_error())
|
|
{
|
|
//we say all tables, but really only we check for config where year=0;
|
|
echo "<div class=\"error\">ERROR: No SFIAB tables detected, It seems like step 2 failed. Please go <a href=\"install2.php\">Back to Installation Step 2</a> and try again.</div>";
|
|
echo "</body></html>";
|
|
exit;
|
|
|
|
}
|
|
if(mysql_num_rows($q))
|
|
{
|
|
//we say all tables, but really only we check for config where year=0;
|
|
echo "<div class=\"error\">ERROR: Detected existing table data, SFIAB Installation Step 3 requires all tables to be empty.</div>";
|
|
echo "</body></html>";
|
|
exit;
|
|
}
|
|
echo "<b>Found!</b><br />";
|
|
|
|
echo "<br />";
|
|
echo "Please enter the following options <br />";
|
|
echo "<br />";
|
|
|
|
$month=date("m");
|
|
if($month>4) $fairyearsuggest=date("Y")+1;
|
|
else $fairyearsuggest=date("Y");
|
|
echo "<h3>Options</h3>";
|
|
|
|
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 "<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 />";
|
|
|
|
|
|
?>
|
|
|
|
</body></html>
|