forked from science-ation/science-ation
Dennis. Changes allow 'installation' in windows servers (and others) Complete functionality in windows servers still 'in work'
This commit is contained in:
parent
6c0e0cb0ca
commit
ee657d49a1
@ -34,15 +34,17 @@ header("Content-Type: text/html; charset=UTF-8");
|
|||||||
define('REQUIREDFIELD','<span class="requiredfield">*</span>');
|
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
|
//figure out the directory to prepend to directoroy names, depending on if we are in a subdirectory or not
|
||||||
if(substr(getcwd(),-6)=="/admin")
|
// Dennis Fix so works in windows servers.
|
||||||
|
// Windows based servers use '\' in directories. This code works for WIN servers and or *nix servers.
|
||||||
|
if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-6)=="\\admin")
|
||||||
$prependdir="../";
|
$prependdir="../";
|
||||||
else if(substr(getcwd(),-6)=="/super")
|
else if(substr(getcwd(),-6)=="/super" || substr(getcwd(),-6)=="\\super")
|
||||||
$prependdir="../";
|
$prependdir="../";
|
||||||
else if(substr(getcwd(),-7)=="/config")
|
else if(substr(getcwd(),-7)=="/config" || substr(getcwd(),-7)=="\\config")
|
||||||
$prependdir="../";
|
$prependdir="../";
|
||||||
else if(substr(getcwd(),-3)=="/db")
|
else if(substr(getcwd(),-3)=="/db" || substr(getcwd(),-3)=="\\db")
|
||||||
$prependdir="../";
|
$prependdir="../";
|
||||||
else if(substr(getcwd(),-8)=="/scripts")
|
else if(substr(getcwd(),-8)=="/scripts" || substr(getcwd(),-8)=="\\scripts")
|
||||||
$prependdir="../";
|
$prependdir="../";
|
||||||
else
|
else
|
||||||
$prependdir="";
|
$prependdir="";
|
||||||
|
@ -72,7 +72,9 @@ var config=<?=json_encode($configjs)?>;
|
|||||||
</script>
|
</script>
|
||||||
<?
|
<?
|
||||||
//if we're under /admin or /config or /super we also want the translation editor
|
//if we're under /admin or /config or /super we also want the translation editor
|
||||||
if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(getcwd(),-6)=="/super")
|
// Dennis Required for windows or *nix servers
|
||||||
|
if((substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(getcwd(),-6)=="/super") ||
|
||||||
|
(substr(getcwd(),-6)=="\\admin" || substr(getcwd(),-7)=="\\config" || substr(getcwd(),-6)=="\\super") )
|
||||||
require_once("../translationseditor.inc.php");
|
require_once("../translationseditor.inc.php");
|
||||||
?>
|
?>
|
||||||
<div id="page-wrapper">
|
<div id="page-wrapper">
|
||||||
@ -234,6 +236,7 @@ if(!is_array($_SESSION['roles'])) {
|
|||||||
|
|
||||||
if(is_array($_SESSION['roles'])) {
|
if(is_array($_SESSION['roles'])) {
|
||||||
foreach($_SESSION['roles'] AS $roletype) {
|
foreach($_SESSION['roles'] AS $roletype) {
|
||||||
|
// Dennis 2011-02-18 get a warning Illegal offset type in next line if php.ini shows warnings
|
||||||
$roleid=$roles[$roletype]['id'];
|
$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");
|
$q=mysql_query("SELECT * FROM rolestasks WHERE roles_id='$roleid' AND pid=0 AND conferencetype='{$conference['type']}' ORDER BY ord,task");
|
||||||
$cl="";
|
$cl="";
|
||||||
@ -411,7 +414,11 @@ if($icon && theme_icon($icon)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if we're under /admin or /config then we want to show the ? help icon
|
//if we're under /admin or /config then we want to show the ? help icon
|
||||||
if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(getcwd(),-6)=="/super") {
|
// Dennis 2011-02-18 Required for *nix and Windows servers
|
||||||
|
if ((substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(getcwd(),-6)=="/super") ||
|
||||||
|
(substr(getcwd(),-6)=="\\admin" || substr(getcwd(),-7)=="\\config" || substr(getcwd(),-6)=="\\super") )
|
||||||
|
|
||||||
|
{
|
||||||
if($_SERVER['REDIRECT_SCRIPT_URL'])
|
if($_SERVER['REDIRECT_SCRIPT_URL'])
|
||||||
$fname=substr($_SERVER['REDIRECT_SCRIPT_URL'],strlen($config['SFIABDIRECTORY'])+1);
|
$fname=substr($_SERVER['REDIRECT_SCRIPT_URL'],strlen($config['SFIABDIRECTORY'])+1);
|
||||||
else
|
else
|
||||||
@ -446,6 +453,7 @@ global $config;
|
|||||||
//we only show the debug session variables if we have an ODD numbered version.
|
//we only show the debug session variables if we have an ODD numbered version.
|
||||||
if(substr($config['version'], -1) % 2 != 0)
|
if(substr($config['version'], -1) % 2 != 0)
|
||||||
{
|
{
|
||||||
|
// Dennis 2011-02-18 Just Info Next line does not work in Windows (no grep etc.)
|
||||||
$revision=exec("svn info |grep Revision");
|
$revision=exec("svn info |grep Revision");
|
||||||
$extra=" (Development $revision)";
|
$extra=" (Development $revision)";
|
||||||
if($_SESSION['debug']=="true")
|
if($_SESSION['debug']=="true")
|
||||||
|
@ -334,7 +334,13 @@ function config_editor($category, $conference_id, $array_name, $self)
|
|||||||
print("<select name=\"$name\">");
|
print("<select name=\"$name\">");
|
||||||
/* Find all theme directories */
|
/* Find all theme directories */
|
||||||
$cwd=getcwd();
|
$cwd=getcwd();
|
||||||
$themeroot = $cwd."/../theme";
|
// Dennis 2011-02-18 Added test for windows servers
|
||||||
|
if (stristr($cwd,'/')) {
|
||||||
|
$themeroot = $cwd."/../theme"; //*nix directories from getcwd()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$themeroot = $cwd."\\..\\theme"; // ?? not sure this will work yet
|
||||||
|
}
|
||||||
// $themeroot = "{$_SERVER['DOCUMENT_ROOT']}{$config['SFIABDIRECTORY']}/theme";
|
// $themeroot = "{$_SERVER['DOCUMENT_ROOT']}{$config['SFIABDIRECTORY']}/theme";
|
||||||
$d = opendir($themeroot);
|
$d = opendir($themeroot);
|
||||||
while(($f = readdir($d))) {
|
while(($f = readdir($d))) {
|
||||||
|
@ -84,10 +84,50 @@ if($dbcodeversion && $dbdbversion) {
|
|||||||
echo "db.update.$ver.sql detected - running...\n";
|
echo "db.update.$ver.sql detected - running...\n";
|
||||||
readfile("db.update.$ver.sql");
|
readfile("db.update.$ver.sql");
|
||||||
echo "\n";
|
echo "\n";
|
||||||
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db.update.$ver.sql", $exit_code);
|
// Dennis If 'system' and 'mysql' do not exist use each section of the sql files not system("sql"
|
||||||
|
// i.e. for windows ISP servers that do not provide system and sql.exe executable
|
||||||
|
exec("mysql -q --help", $outputnotused, $exec_sqlstatus);
|
||||||
|
if(function_exists("system") and $exec_sqlstatus == 0 ) {
|
||||||
|
// echo "<b><br />** db_update USING system('mysql ..) on this server!<b><br />";
|
||||||
|
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db.update.$ver.sql", $exit_code);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// Dennis 'system' and 'mysql' not both available
|
||||||
|
// Use each section of the sql files instead of using system("sql" ...
|
||||||
|
$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 />";
|
||||||
|
}
|
||||||
if($exit_code != 0) {
|
if($exit_code != 0) {
|
||||||
/* mysql failed!, what now? */
|
/* mysql failed!, what now? */
|
||||||
|
|
||||||
|
$error_count += 1;
|
||||||
|
echo "<br /><b>ERROR in db_update: Failed to execute query(s) without error!<br />";
|
||||||
|
echo "Update scripts bad or system('mysql' .. ) call failed!</b><br /><br />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
28
install.php
28
install.php
@ -38,7 +38,35 @@ if(file_exists("data/config.inc.php"))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
<?php
|
||||||
|
// Dennis 2011-02-21 Added all these checks prior to install
|
||||||
|
if(!function_exists("system")) {
|
||||||
|
echo "<br />Warning: Function 'system' is not available in this server! Installation may not work!<br /><br />";
|
||||||
|
}
|
||||||
|
if(!function_exists("exec")) {
|
||||||
|
echo "Warning: Function 'exec' is not available in this server! Installation may not work!<br /><br />";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$status = 99;
|
||||||
|
exec("mysql -q --help", $output, $status);
|
||||||
|
if(!$status == 0){
|
||||||
|
echo "Warning: Functions 'system' and 'exec' are available but 'mysql.exe' is not setup for use in system() calls<br />Install on this server may not have full funtionality!<br /><br />";
|
||||||
|
}
|
||||||
|
$status = 99;
|
||||||
|
exec("php -v",$output,$status);
|
||||||
|
if ($status == 0){
|
||||||
|
//echo "Good: php is callable from exec and system!<br />";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "Warning: Functions 'system' and 'exec' are available but 'php.exe' is not setup for use in system() calls<br />Install on this server may not have full funtionality!<br /><br />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// This check can be eliminated after all pdf reports are converted to tcpdf
|
||||||
|
if (!function_exists("pdf_new")){
|
||||||
|
echo "Warning: pdflib is not installed on this server! Most pdf reports will fail!<br /><br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
$showform=true;
|
$showform=true;
|
||||||
|
106
install2.php
106
install2.php
@ -36,6 +36,9 @@ if(!function_exists("system")) {
|
|||||||
echo "</body></html>";
|
echo "</body></html>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
// Dennis see if mysql is available from cli
|
||||||
|
$exec_sqlstatus = 99; // will be set to 0 if following works. I test this prior to system("mysql...) calls
|
||||||
|
exec("mysql -q --help", $outputnotused, $exec_sqlstatus);
|
||||||
|
|
||||||
if(!file_exists("data/config.inc.php")) {
|
if(!file_exists("data/config.inc.php")) {
|
||||||
echo "<div class=\"error\">SFIAB Installation Step 1 is not yet complete.</div>";
|
echo "<div class=\"error\">SFIAB Installation Step 1 is not yet complete.</div>";
|
||||||
@ -87,8 +90,47 @@ mysql_select_db($DBNAME);
|
|||||||
echo "<b>db/db.full.$dbcodeversion.sql found</b><br />";
|
echo "<b>db/db.full.$dbcodeversion.sql found</b><br />";
|
||||||
|
|
||||||
echo "Setting up database tables... ";
|
echo "Setting up database tables... ";
|
||||||
|
// Dennis If 'system' and 'mysql' do not exist use each section of the sql files not system("sql" ...
|
||||||
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$dbcodeversion.sql");
|
// i.e. for windows ISP servers that do not provide system and sql.exe executable
|
||||||
|
if(function_exists("system") and $exec_sqlstatus == 0 ) {
|
||||||
|
echo "<b><br />** USING system('mysql ..) on this server!<b><br />";
|
||||||
|
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$dbcodeversion.sql",$exit_code);
|
||||||
|
}
|
||||||
|
else // 'system' and 'mysql' not both available. 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? */
|
||||||
|
$error_count += 1;
|
||||||
|
echo "<br /><b>mysql failed to execute query(s) without error!<b><br />";
|
||||||
|
}
|
||||||
|
|
||||||
echo "<b>Done! installed database version $dbcodeversion</b><br />\n";
|
echo "<b>Done! installed database version $dbcodeversion</b><br />\n";
|
||||||
|
|
||||||
@ -97,6 +139,14 @@ mysql_select_db($DBNAME);
|
|||||||
|
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<b>Done!</b><br />";
|
echo "<b>Done!</b><br />";
|
||||||
|
// Dennis Allert if errors! 2011-02-18
|
||||||
|
if ($error_count > 0){
|
||||||
|
echo "<b>THERE WERE ERRORS! The database was not created correctly!</b><br />";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<b>DATABASE CREATED SUCCESSFULLY!</b><br />";
|
||||||
|
}
|
||||||
|
|
||||||
echo "<a href=\"install3.php\">Proceed to installation step 3</a><br />";
|
echo "<a href=\"install3.php\">Proceed to installation step 3</a><br />";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -107,9 +157,47 @@ mysql_select_db($DBNAME);
|
|||||||
if(file_exists("db/db.full.$x.sql")) {
|
if(file_exists("db/db.full.$x.sql")) {
|
||||||
echo "<b>db/db.full.$x.sql found</b><br />";
|
echo "<b>db/db.full.$x.sql found</b><br />";
|
||||||
echo "Setting up database tables... ";
|
echo "Setting up database tables... ";
|
||||||
|
// Dennis If 'system' and 'mysql' do not exist use each section of the sql files not system("sql" ...
|
||||||
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$x.sql");
|
// i.e. for windows ISP servers that do not provide system and sql.exe executable
|
||||||
|
if(function_exists("system") and $exec_sqlstatus == 0 ) {
|
||||||
|
echo "<b><br />** USING system('mysql ..) on this server!<b><br />";
|
||||||
|
system("mysql --default-character-set=utf8 -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$x.sql",$exit_code);
|
||||||
|
}
|
||||||
|
else // 'system' and 'mysql' not both 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? */
|
||||||
|
$error_count += 1;
|
||||||
|
echo "<br/><b>mysql failed to execute query(s) without error!<b><br/>";
|
||||||
|
}
|
||||||
echo "<b>Done! installed database version $x</b><br />\n";
|
echo "<b>Done! installed database version $x</b><br />\n";
|
||||||
|
|
||||||
//now update the db version in the database
|
//now update the db version in the database
|
||||||
@ -126,6 +214,14 @@ mysql_select_db($DBNAME);
|
|||||||
|
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<b>Done!</b><br />";
|
echo "<b>Done!</b><br />";
|
||||||
|
// Dennis Allert if errors! 2011-02-18
|
||||||
|
if ($error_count > 0){
|
||||||
|
echo "<b>THERE WERE ERRORS! The database was not created correctly!</b><br />";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<b>DATABASE CREATED SUCCESSFULLY!</b><br />";
|
||||||
|
}
|
||||||
|
|
||||||
echo "<a href=\"install3.php\">Proceed to installation step 3</a><br />";
|
echo "<a href=\"install3.php\">Proceed to installation step 3</a><br />";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -124,8 +124,9 @@ echo "<br />";
|
|||||||
$month=date("m");
|
$month=date("m");
|
||||||
if($month>6) $fiscalyearsuggest=date("Y")+1;
|
if($month>6) $fiscalyearsuggest=date("Y")+1;
|
||||||
else $fiscalyearsuggest=date("Y");
|
else $fiscalyearsuggest=date("Y");
|
||||||
|
// Dennis $_SERVER['REQUEST_URI'] is not available on many Windows servers
|
||||||
$directorysuggest=substr($_SERVER['REQUEST_URI'],0,-13);
|
//$directorysuggest = substr($_SERVER['REQUEST_URI'],0,-13);
|
||||||
|
$directorysuggest = substr(getenv("SCRIPT_NAME"),0,-13);
|
||||||
echo "<h3>Options</h3>";
|
echo "<h3>Options</h3>";
|
||||||
echo "<form method=\"post\" action=\"install3.php\">";
|
echo "<form method=\"post\" action=\"install3.php\">";
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\" />";
|
echo "<input type=\"hidden\" name=\"action\" value=\"save\" />";
|
||||||
|
@ -640,8 +640,9 @@ function create_conference($params){
|
|||||||
if($errorMessage){
|
if($errorMessage){
|
||||||
return "SQL Error:<br/>$errorMessage";
|
return "SQL Error:<br/>$errorMessage";
|
||||||
}
|
}
|
||||||
$conferences_id = mysql_insert_id();
|
// Dennis mysql_insert_id returns 0 because it follows an update query (no auto increment done)
|
||||||
|
//$conferences_id = mysql_insert_id();
|
||||||
|
$conferences_id = $id;
|
||||||
//copy over the award_types defaults
|
//copy over the award_types defaults
|
||||||
$q=mysql_query("SELECT * FROM award_types WHERE conferences_id='-1'");
|
$q=mysql_query("SELECT * FROM award_types WHERE conferences_id='-1'");
|
||||||
while($r=mysql_fetch_object($q)) {
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user