]> git.mxchange.org Git - mailer.git/commitdiff
HTML fixes and rewritten install finalizer
authorRoland Häder <roland@mxchange.org>
Thu, 2 Apr 2009 18:01:24 +0000 (18:01 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 2 Apr 2009 18:01:24 +0000 (18:01 +0000)
inc/install-inc.php

index 6994276a42326fd1b68177fff21c297a58deee21..91eab08c8bcb1b4d4e1a97b9d5c1d066a9967000 100644 (file)
@@ -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 .= "    <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'));
@@ -383,7 +382,7 @@ if ((!isInstalled()) || (!isAdminRegistered()))
 
        default:
                DEBUG_LOG(__FILE__, __LINE__, sprintf("Wrong page %s detected", REQUEST_GET('page')));
-               OUTPUT_HTML("    <div class=\"install_error\">{--WRONG_PAGE--}</strong>");
+               OUTPUT_HTML("    <div class=\"install_error\">{--WRONG_PAGE--}</div>");
                break;
        }
 } else {