* Needs to be in all Files and every File needs "svn propset *
* svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
+ * @TODO Rewrite all constants in this include file *
+ * -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2008 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
* *
define('__BURL_ACTION', constant('URL'));
// Output page for entered value
- switch (REQUEST_GET('page'))
- {
+ switch (REQUEST_GET('page')) {
case 'welcome': // Welcome to the installation!
LOAD_TEMPLATE('install_welcome');
break;
case '1': // Server path, base URL
- // @Profi-Concept: Hab meine Meinung doch geaendert! :-)
// Load template
LOAD_TEMPLATE('install_page1');
break;
break;
case 'finalize': // Write captured data to files
- if ((REQUEST_ISSET_POST(('finalize'))) && (!isInstalled())) {
+ if ((REQUEST_ISSET_POST('finalize')) && (!isInstalled())) {
// You have submitted data then we have to reset the SQLs
INIT_SQLS();
// Seems to work, also right database?
if (SQL_SELECT_DB($mysql['dbase'], __FILE__, __LINE__) === true) {
// Automatically run install.sql
- if ((isFileReadable(REQUEST_POST('spath') . 'install/tables.sql')) && (isFileReadable(REQUEST_POST('spath') . 'install/menu-'.getLanguage().'.sql'))) {
+ if ((!isFileReadable(REQUEST_POST('spath') . 'install/tables.sql')) || (!isFileReadable(REQUEST_POST('spath') . 'install/menu-'.getLanguage().'.sql'))) {
+ // Installation area not found!
+ addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_MISSING_DUMPS'));
+ } // END - if
+
+ if (getTotalFatalErrors() == 0) {
// Both exists so import them
foreach (array('tables', 'menu-'.getLanguage()) as $dump) {
// Should be save here because file_exists() is there but we check it again. :)
// Script is now installed
changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "INSTALLED", "setConfigEntry('MXCHANGE_INSTALLED', \"", "\");", 'Y', 0);
- } else {
- // Installation area not found!
- addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_MISSING_DUMPS'));
- }
+ } // END - if
} // END - if
} // END - if
if (getTotalFatalErrors() > 0) {
$OUT = '';
foreach (getFatalArray() as $value) {
- $OUT .= " <li>".$value."</li>\n";
+ $OUT .= " <li>" . $value . "</li>\n";
} // END foreach
define('__FATAL_ERROR_LI', $OUT);
$OUT = '';
foreach ($mysql as $key => $value) {
- $OUT .= " <input type=\"hidden\" name=\"mysql[".$key."]\" value=\"".$value."\" />\n";
+ $OUT .= " <input type=\"hidden\" name=\"mysql[" . $key . "]\" value=\"" . $value . "\" />\n";
} // END foreach
define('__MYSQL_DATA' , $OUT);
define('__SPATH_VALUE' , REQUEST_POST('spath'));
LOAD_TEMPLATE('install_fatal_errors');
} else {
// Installation is done!
- redirectToUrl('install.php?page=finalize');
+ redirectToUrl('install.php?page=finished');
}
- } elseif (isInstalled()) {
- // Redirection after writing data... :-)
- LOAD_TEMPLATE('install_finished');
} else {
// Something goes wrong during installation! :-(
addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_FINALIZER_FAILED'));
}
break;
+ case 'finished':
+ if (isInstalled()) {
+ // Load template that we are finished
+ LOAD_TEMPLATE('install_finished');
+ } else {
+ // Not finished
+ redirectToUrl('install.php');
+ }
+ break;
+
default:
DEBUG_LOG(__FILE__, __LINE__, sprintf("Wrong page %s detected", REQUEST_GET('page')));
OUTPUT_HTML(" <div class=\"install_error\">{--WRONG_PAGE--}</div>");
function isInstalled () {
return (
(
- // New config file found and loaded
- getConfig('MXCHANGE_INSTALLED') == 'Y'
+ // New config file found and loaded
+ getConfig('MXCHANGE_INSTALLED') == 'Y'
) || (
- // Fall-back!
- isIncludeReadable('inc/config.php')
+ // Fall-back!
+ isIncludeReadable('inc/config.php')
) || (
- (
- // New config file found, but not yet read
- isIncludeReadable('inc/cache/config-local.php')
- ) && (
- (
- // Only new config file is found
- !isIncludeReadable('inc/config.php')
- ) || (
- // Is installation mode
- isInstalling()
- )
- )
+ (
+ // New config file found, but not yet read
+ isIncludeReadable('inc/cache/config-local.php')
+ ) && (
+ (
+ // Only new config file is found
+ !isIncludeReadable('inc/config.php')
+ ) || (
+ // Is installation mode
+ isInstalling()
+ )
+ )
)
);
}
// Load config file
require('inc/config-global.php');
+// Reload page to page=welcome when it is not specified
+if (!REQUEST_ISSET_GET('page')) {
+ redirectToUrl('install.php?page=welcome');
+} // END - if
+
// Already installed?
-if (isInstalled()) {
+if ((isInstalled()) && (REQUEST_GET('page' != 'finished'))) {
// Add fatal message
addFatalMessage(__FILE__, __LINE__, getMessage('ALREADY_INSTALLED'));
} // END - if
// Does something goes wrong?
-if (getTotalFatalErrors() == 0) {
- // Reload page to page=welcome when it is not specified
- if (!REQUEST_ISSET_GET('page')) {
- redirectToUrl('install.php?page=welcome');
- } // END - if
+if (getTotalFatalErrors() > 0) {
+ // Output fatal messages
+ loadInclude('inc/fatal_errors.php');
+} // END - if
- // Load header here
- loadIncludeOnce('inc/header.php');
+// Load header here
+loadIncludeOnce('inc/header.php');
- // Add main installation table
- LOAD_TEMPLATE('install_header');
+// Add main installation table
+LOAD_TEMPLATE('install_header');
- // Here start's our installtion stuff
- loadIncludeOnce('inc/install-inc.php');
+// Here start's our installtion stuff
+loadIncludeOnce('inc/install-inc.php');
- // Close main installation table
- LOAD_TEMPLATE('install_footer');
+// Close main installation table
+LOAD_TEMPLATE('install_footer');
- // Footer
- loadIncludeOnce('inc/footer.php');
-} else {
- // Output fatal messages
- loadInclude('inc/fatal_errors.php');
-}
+// Footer
+loadIncludeOnce('inc/footer.php');
//
?>