// 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)));
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'));
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 {