From: Roland Häder Date: Thu, 2 Apr 2009 18:01:24 +0000 (+0000) Subject: HTML fixes and rewritten install finalizer X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b2fff4de774cc58dfae0b8dd2a291af28f254833;p=mailer.git HTML fixes and rewritten install finalizer --- diff --git a/inc/install-inc.php b/inc/install-inc.php index 6994276a42..91eab08c8b 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -283,24 +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", "menu-".GET_LANGUAGE()) 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 = REQUEST_POST('spath') . "install/" . $dump . ".sql"; + $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 {!type!} with actual one - while (strpos($fileContent, "{!type!}") !== false) { - $fileContent = str_replace("{!type!}", $mysql['type'], $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))); @@ -355,7 +354,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) define('__FATAL_ERROR_LI', $OUT); $OUT = ''; foreach ($mysql as $key => $value) { - $OUT .= " \n"; + $OUT .= " \n"; } // END foreach define('__MYSQL_DATA' , $OUT); define('__SPATH_VALUE' , REQUEST_POST('spath')); @@ -383,7 +382,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) default: DEBUG_LOG(__FILE__, __LINE__, sprintf("Wrong page %s detected", REQUEST_GET('page'))); - OUTPUT_HTML("
{--WRONG_PAGE--}"); + OUTPUT_HTML("
{--WRONG_PAGE--}
"); break; } } else {