forked from science-ation/science-ation
Revert Dennis's commit - improper line endings caused the whole files to be replaced
This commit is contained in:
parent
ce35d4ccee
commit
4ac3a8f974
@ -97,17 +97,12 @@ function account_load($id)
|
||||
link_username_to_email,
|
||||
passwordset,
|
||||
email,
|
||||
pendingemail,
|
||||
superuser,
|
||||
deleted,
|
||||
deleted_datetime,
|
||||
created
|
||||
FROM accounts WHERE id='$id'");
|
||||
// DES dspanogle 2011-02-05 the above failed on installing on windows server.
|
||||
// because pendingemail is in SELECT but not in the table. ??
|
||||
// I deleted pendingemail from the SELECT paramenters and added the next two lines.
|
||||
if (!$q) {
|
||||
return false;
|
||||
}
|
||||
if(mysql_num_rows($q) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -34,23 +34,6 @@ header("Content-Type: text/html; charset=UTF-8");
|
||||
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
|
||||
// DES dspanogle 2011-02-04 Windows based servers use '\' in directories. This code works for WIN servers and or *nix servers.
|
||||
if (stristr(getcwd(), '\\')) { // must look at whole directory because we do no know the SFIABDIRECTORY length
|
||||
// Win
|
||||
if(substr(getcwd(),-6)=="\\admin")
|
||||
$prependdir="..\\";
|
||||
else if(substr(getcwd(),-6)=="\\super")
|
||||
$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")
|
||||
$prependdir="../";
|
||||
else if(substr(getcwd(),-6)=="/super")
|
||||
@ -63,7 +46,7 @@ else if(substr(getcwd(),-8)=="/scripts")
|
||||
$prependdir="../";
|
||||
else
|
||||
$prependdir="";
|
||||
}
|
||||
|
||||
$sfiabversion=@file($prependdir."version.txt");
|
||||
$config['version']=trim($sfiabversion[0]);
|
||||
|
||||
|
@ -72,16 +72,8 @@ var config=<?=json_encode($configjs)?>;
|
||||
</script>
|
||||
<?
|
||||
//if we're under /admin or /config or /super we also want the translation editor
|
||||
// DES dspanogle 2011-02-05 This changed to work in windows servers
|
||||
if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(getcwd(),-6)=="/super") {
|
||||
if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(getcwd(),-6)=="/super")
|
||||
require_once("../translationseditor.inc.php");
|
||||
}
|
||||
else { // for windows servers
|
||||
if(substr(getcwd(),-6)=="\\admin" || substr(getcwd(),-7)=="\\config" || substr(getcwd(),-6)=="\\super") {
|
||||
require_once("../translationseditor.inc.php");
|
||||
// I don't know why the '/' works in the require_once('../tran...) but definately not in string compare
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div id="page-wrapper">
|
||||
<div id="page">
|
||||
@ -242,7 +234,6 @@ if(!is_array($_SESSION['roles'])) {
|
||||
|
||||
if(is_array($_SESSION['roles'])) {
|
||||
foreach($_SESSION['roles'] AS $roletype) {
|
||||
// DES dspanogle 2011-02-05 get a warning Illegal offset type in next line if php.ini shows warnings
|
||||
$roleid=$roles[$roletype]['id'];
|
||||
$q=mysql_query("SELECT * FROM rolestasks WHERE roles_id='$roleid' AND pid=0 AND conferencetype='{$conference['type']}' ORDER BY ord,task");
|
||||
$cl="";
|
||||
@ -455,13 +446,7 @@ global $config;
|
||||
//we only show the debug session variables if we have an ODD numbered version.
|
||||
if(substr($config['version'], -1) % 2 != 0)
|
||||
{
|
||||
// DES dspanogle 2011-02-05 exec crashes some? windows ISP servers installing a version in debug
|
||||
if ( stristr(getcwd(), '\\') ) {
|
||||
$revision="WindowsServer without debug";
|
||||
}
|
||||
else {
|
||||
$revision=exec("svn info |grep Revision");
|
||||
}
|
||||
$extra=" (Development $revision)";
|
||||
if($_SESSION['debug']=="true")
|
||||
$extradebug="<br />DEBUG SESSION: ".print_r($_SESSION,true);
|
||||
@ -498,7 +483,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 @@
|
||||
<?
|
||||
// DES dspanogle 2011-02-06 moved to before system call as test for windows server with alternate code.
|
||||
/*
|
||||
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_once('../data/config.inc.php');
|
||||
@ -86,49 +84,10 @@ if($dbcodeversion && $dbdbversion) {
|
||||
echo "db.update.$ver.sql detected - running...\n";
|
||||
readfile("db.update.$ver.sql");
|
||||
echo "\n";
|
||||
// DES dspanogle 2011-02-05 Test to see if can use system call
|
||||
// if *nix then '/' in working directory. If not then windows - do not even try system
|
||||
if(function_exists("system") and (stristr(substr(getcwd(),-9), '/') ) ) {
|
||||
// Use System call this assumes mysql.exe exists on the server. it may not.
|
||||
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db.update.$ver.sql", $exit_code);
|
||||
}
|
||||
else{
|
||||
// Probably a Windows server. use alternate code.
|
||||
// dspanogle 2011-02-05 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.
|
||||
$exit_code = 0; // assume no errors for now
|
||||
$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
|
||||
if(!mysql_query($templine)){
|
||||
echo('<br/>Error performing query!<br/>'.$templine.'<br/> mysqlerror: '.mysql_error().'<br /><br />');
|
||||
$exit_code = -1; // do we bail out here or keep going? keep going for now, get all errors
|
||||
}
|
||||
// Reset temp variable to empty
|
||||
$templine = '';
|
||||
}
|
||||
}
|
||||
echo "<br />";
|
||||
}
|
||||
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db.update.$ver.sql", $exit_code);
|
||||
if($exit_code != 0) {
|
||||
/* mysql failed!, what now? */
|
||||
echo "<br/><b>mysql failed to execute query(s) without error!<br/>";
|
||||
echo "Update scripts bad or *nix server system('mysql' .. ) call failed!<br/>";
|
||||
echo "This installation is not complete!</b><br/>";
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
90
install2.php
90
install2.php
@ -30,14 +30,13 @@ echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
|
||||
<body>
|
||||
<h1>SFIAB Installation - Step 2</h1>
|
||||
<?
|
||||
// DES dspanogle 2011-02-05 Can do without system! Do tests below.
|
||||
/*
|
||||
|
||||
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>";
|
||||
echo "<a href=\"install.php\">Go back to installation step 1</a><br />";
|
||||
@ -48,6 +47,7 @@ if(!file_exists("data/config.inc.php")) {
|
||||
require_once("data/config.inc.php");
|
||||
mysql_connect($DBHOST,$DBUSER,$DBPASS);
|
||||
mysql_select_db($DBNAME);
|
||||
|
||||
echo "Getting database version requirements for code... ";
|
||||
|
||||
if(file_exists("db/db.code.version.txt")) {
|
||||
@ -88,47 +88,7 @@ mysql_select_db($DBNAME);
|
||||
|
||||
echo "Setting up database tables... ";
|
||||
|
||||
// dspanogle 2011-02-05 if system does not exist use each section of the sql file instead of using system("sql" ...
|
||||
// For windows ISP servers that do not provide system or sql.exe executable - replace system call.
|
||||
// If '/' in working directory then is *nix if not do not even try to call system.
|
||||
if(function_exists("system") and (stristr(substr(getcwd(),-9), '/')) ) {
|
||||
// assume mysql.exe exists
|
||||
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$dbcodeversion.sql",$exit_code);
|
||||
}
|
||||
else // system is not available or is windows server. try to break up the query and just do each part.
|
||||
{
|
||||
$exit_code = 0;
|
||||
$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
|
||||
if(!mysql_query($templine)){
|
||||
echo('<br/>Error performing query!<br/>'.$templine.'<br/> mysqlerror: '.mysql_error().'<br /><br />');
|
||||
$exit_code = -1; // do we bail out here or keep going? keep going for now, get all errors
|
||||
}
|
||||
// Reset temp variable to empty
|
||||
$templine = '';
|
||||
}
|
||||
}
|
||||
echo "<br/><br />";
|
||||
}
|
||||
if($exit_code != 0) {
|
||||
/* mysql failed!, what now? */
|
||||
echo "<br/><b>mysql failed to execute query(s) without error!<b><br/>";
|
||||
}
|
||||
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$dbcodeversion.sql");
|
||||
|
||||
echo "<b>Done! installed database version $dbcodeversion</b><br />\n";
|
||||
|
||||
@ -147,46 +107,8 @@ mysql_select_db($DBNAME);
|
||||
if(file_exists("db/db.full.$x.sql")) {
|
||||
echo "<b>db/db.full.$x.sql found</b><br />";
|
||||
echo "Setting up database tables... ";
|
||||
// dspanogle 2011-02-05 if system does not exist use each section of the sql file instead of using system("sql" ...
|
||||
// For windows ISP servers that do not provide system or sql.exe executable - replace system call.
|
||||
// If '/' in working directory then is *nix if not do not even try to call system.
|
||||
if(function_exists("system") and (stristr(substr(getcwd(),-9), '/'))) {
|
||||
// assume mysql.exe exists
|
||||
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$x.sql",$exit_code);
|
||||
}
|
||||
else { // system is not available. try to break up the query and just do each part.
|
||||
$exit_code = 0;
|
||||
$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
|
||||
if(!mysql_query($templine)){
|
||||
echo('<br/>Error performing query!<br/>'.$templine.'<br/> mysqlerror: '.mysql_error().'<br /><br />');
|
||||
$exit_code = -1; // do we bail out here or keep going? keep going for now, get all errors
|
||||
}
|
||||
// Reset temp variable to empty
|
||||
$templine = '';
|
||||
}
|
||||
}
|
||||
echo "<br/><br />";
|
||||
}
|
||||
if($exit_code != 0) {
|
||||
/* mysql failed!, what now? */
|
||||
echo "<br/><b>mysql failed to execute query(s) without error!<b><br/>";
|
||||
}
|
||||
|
||||
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$x.sql");
|
||||
|
||||
echo "<b>Done! installed database version $x</b><br />\n";
|
||||
|
||||
|
11
install3.php
11
install3.php
@ -105,12 +105,6 @@ if($_POST['action']=="save") {
|
||||
*/
|
||||
|
||||
echo "Creating superuser account... ";
|
||||
// The next line returned $account = false instead of a query result when installing on windows server.
|
||||
// DES dspanogle 2011-02-05 so of course the UPDATE fails Failed on account load..
|
||||
// the problem was in account_load - had SELECT parameter not in the account table.
|
||||
// I did a temporary fix by removing pendingemail parameter from the SELECT .
|
||||
// ALSO... email was not set for the supper user not sure if it should be so I set = to username in the
|
||||
// database accounts entry for superuser.
|
||||
$account = account_create($_POST['email'], $_POST['pass1']);
|
||||
mysql_query("UPDATE accounts SET superuser = 'yes' WHERE id = " . $account['id']);
|
||||
|
||||
@ -130,9 +124,8 @@ echo "<br />";
|
||||
$month=date("m");
|
||||
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