- } // END - foreach
-
- // Ok, all done. So we can write the config data to the php files
- if ($_POST['spath'] != constant('PATH')) changeDataInFile($_POST['spath']."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", $_POST['spath'], 0);
- if ($_POST['burl'] != constant('URL')) changeDataInFile($_POST['spath']."inc/config.php", "HOST-URL", "define('URL', \"", "\");", $_POST['burl'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "MAIN_TITLE", "define('MAIN_TITLE', \"", "\");", $_POST['title'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "SLOGAN", "define('SLOGAN', \"", "\");", $_POST['slogan'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "WEBMASTER", "define('WEBMASTER', \"", "\");", $_POST['email'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "NULLPASS-WARNING", "define('warn_no_pass', ", ");", $_POST['warn_no_pass'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "WRITE-FOOTER", "define('WRITE_FOOTER', ", ");", $_POST['wfooter'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "BACKLINK", "define('ENABLE_BACKLINK', ", ");", $_POST['blink'], 0);
- // changeDataInFile($_POST['spath']."inc/config.php", "OUTPUT-MODE", "define('OUTPUT_MODE', \"", "\");", $_POST['omode'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-HOST", " 'host' => \"", "\",", $mysql['host'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-DBASE", " 'dbase' => \"", "\",", $mysql['dbase'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-LOGIN", " 'login' => \"", "\",", $mysql['login'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-PASSWORD", " 'password' => \"", "\",", $mysql['pass1'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-PREFIX", "define('_MYSQL_PREFIX', \"", "\");", $mysql['prefix'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "SMTP-HOSTNAME", "define('SMTP_HOSTNAME', \"", "\");", $_POST['smtp_host'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "SMTP-USER", "define('SMTP_USER', \"", "\");", $_POST['smtp_user'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "SMTP-PASSWORD", "define('SMTP_PASSWORD', \"", "\");", $_POST['smtp_pass'], 0);
- changeDataInFile($_POST['spath']."inc/config.php", "INSTALLED", "define('mxchange_installed', ", ");", "true", 0);
- } else {
- // Installation area not found!
- addFatalMessage(getMessage('INSTALL_MISSING_DUMPS'));
- }
+
+ // Now run all queries through and try to keep out empty or comment queries
+ runFilterChain('run_sqls');
+
+ // Copy the config template and verify it
+ copyFileVerified(REQUEST_POST('spath') . 'inc/config-local.php.dist', REQUEST_POST('spath') . 'inc/cache/config-local.php', 0644);
+
+ // Ok, all done. So we can write the config data to the php files
+ if (REQUEST_POST('spath') != constant('PATH')) changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'SERVER-PATH', "define('PATH', '", "');", REQUEST_POST('spath'), 0);
+ if (REQUEST_POST('burl') != constant('URL')) changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'HOST-URL', "define('URL', '", "');", REQUEST_POST('burl'), 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'MAIN-TITLE', "define('MAIN_TITLE', '", "');", REQUEST_POST('title'), 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'SLOGAN', "define('SLOGAN', '", "');", REQUEST_POST('slogan'), 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'WEBMASTER', "define('WEBMASTER', '", "');", REQUEST_POST('email'), 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'NULLPASS-WARNING', "setConfigEntry('WARN_NO_PASS', '", "');", REQUEST_POST('warn_no_pass'), 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'WRITE-FOOTER', "setConfigEntry('WRITE_FOOTER', '", "');", REQUEST_POST('wfooter'), 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'BACKLINK', "setConfigEntry('ENABLE_BACKLINK', '", "');", REQUEST_POST('blink'), 0);
+ // DEACTIVATED: changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'OUTPUT-MODE', "define('OUTPUT_MODE', '", "');", REQUEST_POST('omode'), 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'MYSQL-HOST', " 'host' => '", "',", $mysql['host'], 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'MYSQL-DBASE', " 'dbase' => '", "',", $mysql['dbase'], 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'MYSQL-LOGIN', " 'login' => '", "',", $mysql['login'], 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'MYSQL-PASSWORD', " 'password' => '", "',", $mysql['pass1'], 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'MYSQL-PREFIX', "setConfigEntry('_MYSQL_PREFIX', '", "');", $mysql['prefix'], 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'TABLE-TYPE', "setConfigEntry('_TABLE_TYPE', '", "');", $mysql['type'], 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'SMTP-HOSTNAME', "setConfigEntry('SMTP_HOSTNAME', '", "');", REQUEST_POST('smtp_host'), 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'SMTP-USER', "setConfigEntry('SMTP_USER', '", "');", REQUEST_POST('smtp_user'), 0);
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'SMTP-PASSWORD', "setConfigEntry('SMTP_PASSWORD', '", "');", REQUEST_POST('smtp_pass1'), 0);
+
+ // Generate a long site key
+ $siteKey = generatePassword(50);
+
+ // And write it
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'SITE-KEY', "setConfigEntry('SITE_KEY', '", "');", $siteKey, 0);
+
+ // Script is now installed
+ changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', 'INSTALLED', "setConfigEntry('MXCHANGE_INSTALLED', '", "');", 'Y', 0);
+ } // END - if
+ } // END - if