forked from science-ation/science-ation
Revert Dennis's invalid line endings commit
This commit is contained in:
parent
19304cf75a
commit
d58e8f4a1e
@ -35,22 +35,7 @@ error_reporting(E_ALL ^ E_NOTICE);
|
||||
define('REQUIREDFIELD','<span class="requiredfield">*</span>');
|
||||
|
||||
//figure out the directory to prepend to directoroy names, depending on if we are in a subdirectory or not
|
||||
// dspanogle 2011-02-04 Windows based servers use '\' in directories. This code works for WIN servers and or *nix servers.
|
||||
if (stristr(substr(getcwd(),-9), '\\')) {
|
||||
// Win
|
||||
if(substr(getcwd(),-6)=="\\admin")
|
||||
$prependdir="..\\";
|
||||
else if(substr(getcwd(),-7)=="\\config")
|
||||
$prependdir="..\\";
|
||||
else if(substr(getcwd(),-3)=="\\db")
|
||||
$prependdir="..\\";
|
||||
else if(substr(getcwd(),-8)=="\\scripts")
|
||||
$prependdir="..\\";
|
||||
else
|
||||
$prependdir="";
|
||||
} else {
|
||||
// Other
|
||||
if(substr(getcwd(),-6)=="/admin")
|
||||
if(substr(getcwd(),-6)=="/admin")
|
||||
$prependdir="../";
|
||||
else if(substr(getcwd(),-7)=="/config")
|
||||
$prependdir="../";
|
||||
@ -60,8 +45,6 @@ else if(substr(getcwd(),-8)=="/scripts")
|
||||
$prependdir="../";
|
||||
else
|
||||
$prependdir="";
|
||||
}
|
||||
|
||||
|
||||
$sfiabversion=@file($prependdir."version.txt");
|
||||
$config['version']=trim($sfiabversion[0]);
|
||||
@ -711,7 +694,7 @@ function send_popup_header($title="")
|
||||
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/theme/<?=$config['theme']?>/sfiab.css" type="text/css" media="all" />
|
||||
<link media=all href="<?=$config['SFIABDIRECTORY']?>/tableeditor.css" type=text/css rel=stylesheet>
|
||||
</head>
|
||||
<body onLoad="window.focus()">
|
||||
<body onload="window.focus()">
|
||||
<script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/js/jquery/1.3.2/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/js/jqueryui/1.7.2/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/js/sfiab.js"></script>
|
||||
|
@ -1,11 +1,9 @@
|
||||
<?
|
||||
// dspanogle 2011-02-04 This is not required since we have removed the system("mysql".. calls to allow Windows servers installs
|
||||
/*
|
||||
if(!function_exists("system")) {
|
||||
echo "DB Update requires php's system() function to be available\n";
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
//include the config.inc.php
|
||||
//so we have the db connection info
|
||||
require("../data/config.inc.php");
|
||||
@ -86,32 +84,7 @@ if($dbcodeversion && $dbdbversion)
|
||||
echo "db.update.$ver.sql detected - running...\n";
|
||||
readfile("db.update.$ver.sql");
|
||||
echo "\n";
|
||||
// dspanogle 2011-02-04 Use each section of the sql file instead of using system("sql" ...
|
||||
// For windows ISP servers that do not provide "sql: executable - replace system call.
|
||||
// system("mysql --default-character-set=latin1 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db.update.$ver.sql");
|
||||
$filename = 'db.update.'.$ver.'.sql';
|
||||
// Temporary variable, used to store current query
|
||||
$templine = '';
|
||||
// Read in entire file
|
||||
$lines = file($filename);
|
||||
// Loop through each line
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
// Skip it if it's a comment
|
||||
if (substr($line, 0, 2) == '--' || $line == '')
|
||||
continue;
|
||||
// Add this line to the current segment
|
||||
$templine .= $line;
|
||||
// If it has a semicolon at the end, it's the end of the query
|
||||
if (substr(trim($line), -1, 1) == ';')
|
||||
{
|
||||
// Perform the query
|
||||
mysql_query($templine) or print('Error performing query \'<strong>' . $templine . '\': ' . mysql_error() . '<br /><br />');
|
||||
// Reset temp variable to empty
|
||||
$templine = '';
|
||||
}
|
||||
}
|
||||
echo "<br />";
|
||||
system("mysql --default-character-set=latin1 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db.update.$ver.sql");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
61
install2.php
61
install2.php
@ -30,14 +30,13 @@ echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
|
||||
<body>
|
||||
<h1>SFIAB Installation - Step 2</h1>
|
||||
<?
|
||||
// dspanogle 2011-02-04 This is not required since we have removed the system("mysql".. calls to allow Windows servers installs
|
||||
/*
|
||||
|
||||
if(!function_exists("system")) {
|
||||
echo "<div class=\"error\">Installation requires php's system() function to be available</div>\n";
|
||||
echo "</body></html>";
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
if(!file_exists("data/config.inc.php"))
|
||||
{
|
||||
echo "<div class=\"error\">SFIAB Installation Step 1 is not yet complete.</div>";
|
||||
@ -95,33 +94,9 @@ mysql_select_db($DBNAME);
|
||||
echo "<b>db/db.full.$dbcodeversion.sql found</b><br />";
|
||||
|
||||
echo "Setting up database tables... ";
|
||||
// dspanogle 2011-02-04 Use each section of the sql file instead of using system("sql" ...
|
||||
// For windows ISP servers that do not provide "sql: executable - replace system call.
|
||||
// system("mysql --default-character-set=latin1 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$dbcodeversion.sql");
|
||||
$filename = 'db/db.full.'.$dbcodeversion.'.sql';
|
||||
// Temporary variable, used to store current query
|
||||
$templine = '';
|
||||
// Read in entire file
|
||||
$lines = file($filename);
|
||||
// Loop through each line
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
// Skip it if it's a comment
|
||||
if (substr($line, 0, 2) == '--' || $line == '')
|
||||
continue;
|
||||
|
||||
// Add this line to the current segment
|
||||
$templine .= $line;
|
||||
// If it has a semicolon at the end, it's the end of the query
|
||||
if (substr(trim($line), -1, 1) == ';')
|
||||
{
|
||||
// Perform the query
|
||||
mysql_query($templine) or print('Error performing query \'<strong>' . $templine . '\': ' . mysql_error() . '<br /><br />');
|
||||
// Reset temp variable to empty
|
||||
$templine = '';
|
||||
}
|
||||
}
|
||||
echo "<br />";
|
||||
system("mysql --default-character-set=latin1 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$dbcodeversion.sql");
|
||||
|
||||
echo "<b>Done! installed database version $dbcodeversion</b><br />\n";
|
||||
|
||||
//now update the db version in the database
|
||||
@ -142,32 +117,8 @@ mysql_select_db($DBNAME);
|
||||
{
|
||||
echo "<b>db/db.full.$x.sql found</b><br />";
|
||||
echo "Setting up database tables... ";
|
||||
// dspanogle 2011-02-04 Use each section of the sql file instead of using system("sql" ...
|
||||
// For windows ISP servers that do not provide "sql: executable - replace system call.
|
||||
// system("mysql --default-character-set=latin1 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$x.sql");
|
||||
$filename = 'db/db.full.'.$x.'.sql';
|
||||
// Temporary variable, used to store current query
|
||||
$templine = '';
|
||||
// Read in entire file
|
||||
$lines = file($filename);
|
||||
// Loop through each line
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
// Skip it if it's a comment
|
||||
if (substr($line, 0, 2) == '--' || $line == '')
|
||||
continue;
|
||||
// Add this line to the current segment
|
||||
$templine .= $line;
|
||||
// If it has a semicolon at the end, it's the end of the query
|
||||
if (substr(trim($line), -1, 1) == ';')
|
||||
{
|
||||
// Perform the query
|
||||
mysql_query($templine) or print('Error performing query \'<strong>' . $templine . '\': ' . mysql_error() . '<br /><br />');
|
||||
// Reset temp variable to empty
|
||||
$templine = '';
|
||||
}
|
||||
}
|
||||
echo "<br />";
|
||||
|
||||
system("mysql --default-character-set=latin1 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$x.sql");
|
||||
|
||||
echo "<b>Done! installed database version $x</b><br />\n";
|
||||
|
||||
|
@ -181,9 +181,8 @@ else $fairyearsuggest=date("Y");
|
||||
|
||||
if($month>6) $fiscalyearsuggest=date("Y")+1;
|
||||
else $fiscalyearsuggest=date("Y");
|
||||
// DES dspanogle 2011-02-05 $_SERVER['REQUEST_URI'] is not available on many Windows servers
|
||||
//$directorysuggest = substr($_SERVER['REQUEST_URI'],0,-13);
|
||||
$directorysuggest = substr(getenv("SCRIPT_NAME"),0,-13);
|
||||
|
||||
$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\" />";
|
||||
|
Loading…
Reference in New Issue
Block a user