From b2fff4de774cc58dfae0b8dd2a291af28f254833 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 2 Apr 2009 18:01:24 +0000 Subject: [PATCH 1/1] HTML fixes and rewritten install finalizer --- inc/install-inc.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) 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 { -- 2.39.2