X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Finstall-inc.php;h=cf051fd03384f6a6329f25f7bb45882ab73bd72a;hp=b1aeb83b02054f9accd16ad8604953a17712c9ca;hb=aea4f2a51ffa6f483056c6ce167c8c6fd8ca6129;hpb=67a9828dd27cb5119292e5ac99042b3fcedb0d6b diff --git a/inc/install-inc.php b/inc/install-inc.php index b1aeb83b02..cf051fd033 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')); @@ -123,11 +127,11 @@ if ((!isInstalled()) || (!isAdminRegistered())) case "3": // Set more values - define('__SPATH_VALUE' , REQUEST_POST('spath')); - define('__BURL_VALUE' , REQUEST_POST('burl')); - define('__TITLE_VALUE' , REQUEST_POST('title')); - define('__SLOGAN_VALUE' , REQUEST_POST('slogan')); - define('__EMAIL_VALUE' , REQUEST_POST('email')); + define('__SPATH_VALUE' , REQUEST_POST('spath')); + define('__BURL_VALUE' , REQUEST_POST('burl')); + define('__TITLE_VALUE' , REQUEST_POST('title')); + define('__SLOGAN_VALUE', REQUEST_POST('slogan')); + define('__EMAIL_VALUE' , REQUEST_POST('email')); // Use default SMTP data $smtpHost = constant('SMTP_HOSTNAME'); @@ -140,18 +144,19 @@ if ((!isInstalled()) || (!isAdminRegistered())) if (REQUEST_ISSET_POST(('smtp_user'))) $smtpUser = REQUEST_POST('smtp_user'); // MySQL settings - define('__MYSQL_HOST' , $mysql['host']); - define('__MYSQL_DBASE' , $mysql['dbase']); - define('__MYSQL_PREFIX' , $mysql['prefix']); - define('__MYSQL_LOGIN' , $mysql['login']); - define('__MYSQL_PASS1' , $mysql['pass1']); - define('__MYSQL_PASS2' , $mysql['pass2']); + 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']); // Set constants for SMTP data - define('__SMTP_HOST' , $smtpHost); - define('__SMTP_USER' , $smtpUser); - define('__SMTP_PASS1' , $smtpPass1); - define('__SMTP_PASS2' , $smtpPass2); + define('__SMTP_HOST' , $smtpHost); + define('__SMTP_USER' , $smtpUser); + define('__SMTP_PASS1', $smtpPass1); + define('__SMTP_PASS2', $smtpPass2); // Load template LOAD_TEMPLATE("install_page3"); @@ -159,24 +164,25 @@ if ((!isInstalled()) || (!isAdminRegistered())) case "5": // Misc settings // General settings - define('__SPATH_VALUE' , REQUEST_POST('spath')); - define('__BURL_VALUE' , REQUEST_POST('burl')); - define('__TITLE_VALUE' , REQUEST_POST('title')); - define('__SLOGAN_VALUE' , REQUEST_POST('slogan')); - define('__EMAIL_VALUE' , REQUEST_POST('email')); + define('__SPATH_VALUE' , REQUEST_POST('spath')); + define('__BURL_VALUE' , REQUEST_POST('burl')); + define('__TITLE_VALUE' , REQUEST_POST('title')); + define('__SLOGAN_VALUE', REQUEST_POST('slogan')); + define('__EMAIL_VALUE' , REQUEST_POST('email')); // MySQL settings - define('__MYSQL_HOST' , $mysql['host']); - define('__MYSQL_DBASE' , $mysql['dbase']); - define('__MYSQL_PREFIX' , $mysql['prefix']); - define('__MYSQL_LOGIN' , $mysql['login']); + 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 - define('__SMTP_HOST' , REQUEST_POST('smtp_host')); - define('__SMTP_USER' , REQUEST_POST('smtp_user')); - define('__SMTP_PASS' , REQUEST_POST('smtp_pass1')); + define('__SMTP_HOST', REQUEST_POST('smtp_host')); + 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(" @@ -277,19 +283,23 @@ if ((!isInstalled()) || (!isAdminRegistered())) // Seems to work, also right database? if (SQL_SELECT_DB($mysql['dbase'], __FILE__, __LINE__) === true) { // Automatically run install.sql - if ((FILE_READABLE(REQUEST_POST('spath')."install/tables.sql")) && (FILE_READABLE(REQUEST_POST('spath')."install/menu-".GET_LANGUAGE().".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'; + + // Is the file readable? 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 {!prefix/type!} with actual one + foreach (array('prefix', 'type') as $replace) { + while (strpos($fileContent, '{!' . $replace . '!}') !== false) { + $fileContent = str_replace('{!' . $replace . '!}', $mysql[$replace], $fileContent); + } // END - while + } // END - foreach // And split it up against ;\n ... SET_SQLS(merge_array(GET_SQLS(), explode(";\n", $fileContent))); @@ -324,6 +334,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); @@ -336,14 +347,14 @@ 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"; + $OUT .= " \n"; } // END foreach define('__MYSQL_DATA' , $OUT); define('__SPATH_VALUE' , REQUEST_POST('spath')); @@ -354,24 +365,24 @@ 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; default: DEBUG_LOG(__FILE__, __LINE__, sprintf("Wrong page %s detected", REQUEST_GET('page'))); - OUTPUT_HTML("
    {--WRONG_PAGE--}"); + OUTPUT_HTML("
    {--WRONG_PAGE--}
    "); break; } } else {