X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Finstall-inc.php;h=6994276a42326fd1b68177fff21c297a58deee21;hb=2f0357c7ac9da6c17d361b8e7cb0b1ad09eb85f6;hp=fd5572b0331c83bc458a3fb2c796b0a9652b6034;hpb=b8c86fa12322603c24a88ea2b0fd3dbeba612752;p=mailer.git diff --git a/inc/install-inc.php b/inc/install-inc.php index fd5572b033..6994276a42 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -10,7 +10,12 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Funktionen fuer die Installationsroutine * * -------------------------------------------------------------------- * - * * + * $Revision:: $ * + * $Date:: $ * + * $Tag:: 0.2.1-FINAL $ * + * $Author:: $ * + * Needs to be in all Files and every File needs "svn propset * + * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2008 by Roland Haeder * * For more information visit: http://www.mxchange.org * @@ -37,19 +42,16 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; + $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php'; require($INC); } -// Load sql_patches here -LOAD_EXTENSION("sql_patches"); - // Init variables -$mysql = ""; +$mysql = array(); if ((REQUEST_ISSET_POST(('mysql'))) && (is_array(REQUEST_POST('mysql')))) $mysql = REQUEST_POST('mysql'); // Check if both passwords from SMTP are matching -if ((REQUEST_ISSET_GET(('page')) && (REQUEST_GET('page') == 5))) { +if ((REQUEST_ISSET_GET('page') && (REQUEST_GET('page') == 5))) { // Okay, we have to check it if (REQUEST_ISSET_POST(('smtp_user')) && (!REQUEST_ISSET_POST(('smtp_host')))) { // Hostname not set @@ -99,7 +101,8 @@ if ((!isInstalled()) || (!isAdminRegistered())) if (empty($mysql['dbase'])) $mysql['dbase'] = "your_database"; if (empty($mysql['login'])) $mysql['login'] = "your_login"; if (empty($mysql['host'])) $mysql['host'] = "localhost"; - if (empty($mysql['prefix'])) $mysql['prefix'] = "mxchange_"; + if (empty($mysql['prefix'])) $mysql['prefix'] = "mxchange"; + if (empty($mysql['type'])) $mysql['type'] = "MyISAM"; if (getTotalFatalErrors() > 0) { OUTPUT_HTML(""); foreach (getFatalArray() as $key => $err) { @@ -110,6 +113,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) define('__MYSQL_HOST' , $mysql['host']); define('__MYSQL_DBASE' , $mysql['dbase']); define('__MYSQL_PREFIX', $mysql['prefix']); + define('__TABLE_TYPE' , $mysql['type']); define('__MYSQL_LOGIN' , $mysql['login']); define('__SPATH_VALUE' , REQUEST_POST('spath')); define('__BURL_VALUE' , REQUEST_POST('burl')); @@ -143,6 +147,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) define('__MYSQL_HOST' , $mysql['host']); define('__MYSQL_DBASE' , $mysql['dbase']); define('__MYSQL_PREFIX' , $mysql['prefix']); + define('__TABLE_TYPE' , $mysql['type']); define('__MYSQL_LOGIN' , $mysql['login']); define('__MYSQL_PASS1' , $mysql['pass1']); define('__MYSQL_PASS2' , $mysql['pass2']); @@ -169,6 +174,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) define('__MYSQL_HOST' , $mysql['host']); define('__MYSQL_DBASE' , $mysql['dbase']); define('__MYSQL_PREFIX' , $mysql['prefix']); + define('__TABLE_TYPE' , $mysql['type']); define('__MYSQL_LOGIN' , $mysql['login']); // SMTP settings @@ -176,7 +182,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) define('__SMTP_USER' , REQUEST_POST('smtp_user')); define('__SMTP_PASS' , REQUEST_POST('smtp_pass1')); OUTPUT_HTML("
- +
- @@ -194,10 +200,10 @@ if ((!isInstalled()) || (!isAdminRegistered())) @@ -208,10 +214,10 @@ if ((!isInstalled()) || (!isAdminRegistered())) @@ -222,10 +228,10 @@ if ((!isInstalled()) || (!isAdminRegistered())) @@ -236,10 +242,10 @@ if ((!isInstalled()) || (!isAdminRegistered())) @@ -248,9 +254,9 @@ if ((!isInstalled()) || (!isAdminRegistered()))
{--HEADER_TEXT_PAGE5--} @@ -184,7 +190,7 @@ if ((!isInstalled()) || (!isAdminRegistered()))
 
+ {--TEXT_PAGE_5--}
"); foreach ($mysql as $key => $value) { - OUTPUT_HTML(" "); + OUTPUT_HTML(" "); } - OUTPUT_HTML(" + OUTPUT_HTML(" @@ -268,8 +274,8 @@ if ((!isInstalled()) || (!isAdminRegistered())) case "finalize": // Write captured data to files if ((REQUEST_ISSET_POST(('finalize'))) && (!isInstalled())) { - // You have submitted data then we have to reset the fatal messages - $SQLs = array(); + // You have submitted data then we have to reset the SQLs + INIT_SQLS(); // Connect to MySQL server SQL_CONNECT($mysql['host'], $mysql['login'], $mysql['pass1'], __FILE__, __LINE__); @@ -279,15 +285,25 @@ if ((!isInstalled()) || (!isAdminRegistered())) // Automatically run install.sql if ((FILE_READABLE(REQUEST_POST('spath')."install/tables.sql")) && (FILE_READABLE(REQUEST_POST('spath')."install/menu-".GET_LANGUAGE().".sql"))) { // Both exists so import them - foreach (array("tables.sql", "menu-".GET_LANGUAGE().".sql") as $dump) { + foreach (array("tables", "menu-".GET_LANGUAGE()) as $dump) { // Should be save here because file_exists() is there but we check it again. :) - $FQFN = secureString(REQUEST_POST('spath')) . "install/" . $dump; + $FQFN = REQUEST_POST('spath') . "install/" . $dump . ".sql"; if (FILE_READABLE($FQFN)) { // Read the file $fileContent = READ_FILE($FQFN, true); + // Replace the {!prefix!} with actual one + while (strpos($fileContent, "{!prefix!}") !== false) { + $fileContent = str_replace("{!prefix!}", $mysql['prefix'], $fileContent); + } // END - while + + // Replace the {!type!} with actual one + while (strpos($fileContent, "{!type!}") !== false) { + $fileContent = str_replace("{!type!}", $mysql['type'], $fileContent); + } // END - while + // And split it up against ;\n ... - $SQLs = merge_array($SQLs, explode(";\n", $fileContent)); + SET_SQLS(merge_array(GET_SQLS(), explode(";\n", $fileContent))); } else { // Not readable! debug_report_bug(sprintf("SQL dump %s is not readable!", $dump)); @@ -295,23 +311,14 @@ if ((!isInstalled()) || (!isAdminRegistered())) } // END - foreach // Are some SQLs found? - if (count($SQLs) == 0) { + if (COUNT_SQLS() == 0) { // Abort here addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_SQL_IMPORT_FAILED')); return; } // END - if // Now run all queries through and try to keep out empty or comment queries - foreach ($SQLs as $sql) { - // Trim spaces away - $sql = trim($sql); - - // Is this query not empty and not a comment? - if ((!empty($sql)) && (substr($sql, 0, 2) != "--") && (substr($sql, 0, 1) != "#")) { - // Then run it! - SQL_QUERY($sql, __FILE__, __LINE__); - } // END - if - } // END - foreach + runFilterChain('run_sqls'); // Ok, all done. So we can write the config data to the php files if (REQUEST_POST('spath') != constant('PATH')) changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", REQUEST_POST('spath'), 0); @@ -328,6 +335,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) changeDataInFile(REQUEST_POST('spath')."inc/config.php", "MYSQL-LOGIN", " 'login' => \"", "\",", $mysql['login'], 0); changeDataInFile(REQUEST_POST('spath')."inc/config.php", "MYSQL-PASSWORD", " 'password' => \"", "\",", $mysql['pass1'], 0); changeDataInFile(REQUEST_POST('spath')."inc/config.php", "MYSQL-PREFIX", "define('_MYSQL_PREFIX', \"", "\");", $mysql['prefix'], 0); + changeDataInFile(REQUEST_POST('spath')."inc/config.php", "TABLE-TYPE", "define('_TABLE_TYPE', \"", "\");", $mysql['type'], 0); changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SMTP-HOSTNAME", "define('SMTP_HOSTNAME', \"", "\");", REQUEST_POST('smtp_host'), 0); changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SMTP-USER", "define('SMTP_USER', \"", "\");", REQUEST_POST('smtp_user'), 0); changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SMTP-PASSWORD", "define('SMTP_PASSWORD', \"", "\");", REQUEST_POST('smtp_pass1'), 0); @@ -340,12 +348,12 @@ if ((!isInstalled()) || (!isAdminRegistered())) } // END - if if (getTotalFatalErrors() > 0) { - $OUT = ""; + $OUT = ''; foreach (getFatalArray() as $value) { $OUT .= "
  • ".$value."
  • \n"; } // END foreach define('__FATAL_ERROR_LI', $OUT); - $OUT = ""; + $OUT = ''; foreach ($mysql as $key => $value) { $OUT .= " \n"; } // END foreach @@ -358,18 +366,18 @@ if ((!isInstalled()) || (!isAdminRegistered())) define('__SMTP_PASS' , REQUEST_POST('smtp_pass1')); // Load template - LOAD_TEMPLATE("install_fatal_errors"); + LOAD_TEMPLATE('install_fatal_errors'); } else { // Installation is done! - LOAD_URL("install.php?page=finalize"); + LOAD_URL('install.php?page=finalize'); } } elseif (isInstalled()) { // Redirection after writing data... :-) - LOAD_TEMPLATE("install_finished"); + LOAD_TEMPLATE('install_finished'); } else { // Something goes wrong during installation! :-( addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_FINALIZER_FAILED')); - LOAD_INC("inc/fatal_errors.php"); + LOAD_INC('inc/fatal_errors.php'); } break;