A lot CSS classes rewritten, please update all your themes.
[mailer.git] / inc / install-functions.php
index 9e794c2ccd60b2b3b5c5c597fa5c4211881c312a..4f9d8c0da1ce35deb978f37f314e0b50d1131aa4 100644 (file)
  * MA  02110-1301  USA                                                  *
  ************************************************************************/
 
-/************************************************************************
- *      YOU MAY ALSO WANT TO REMOVE THIS FILE AFTER INSTALLTION!        *
- ************************************************************************/
-
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
@@ -49,36 +45,36 @@ if (!defined('__SECURITY')) {
 // Write the local config-local.php file from "template"
 function doInstallWriteLocalConfig () {
        // Copy the config template and verify it
-       copyFileVerified(postRequestParameter('spath') . 'inc/config-local.php.dist', getConfig('CACHE_PATH') . 'config-local.php', 0644);
+       copyFileVerified(postRequestParameter('spath') . 'inc/config-local.php.dist', getCachePath() . 'config-local.php', 0644);
 
        // Ok, all done. So we can write the config data to the php files
-       if (postRequestParameter('spath') != getConfig('PATH')) changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SERVER-PATH', "setConfigEntry('PATH', '", "');", postRequestParameter('spath'), 0);
-       if (postRequestParameter('burl')  != getConfig('URL'))  changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'HOST-URL', "setConfigEntry('URL', '", "');", postRequestParameter('burl'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MAIN-TITLE', "setConfigEntry('MAIN_TITLE', '", "');", postRequestParameter('title'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SLOGAN', "setConfigEntry('SLOGAN', '", "');", postRequestParameter('slogan'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'WEBMASTER', "setConfigEntry('WEBMASTER', '", "');", postRequestParameter('email'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'NULLPASS-WARNING', "setConfigEntry('WARN_NO_PASS', '", "');", postRequestParameter('warn_no_pass'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'WRITE-FOOTER', "setConfigEntry('WRITE_FOOTER', '", "');", postRequestParameter('wfooter'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'BACKLINK', "setConfigEntry('ENABLE_BACKLINK', '", "');", postRequestParameter('blink'), 0);
-       // @TODO DEACTIVATED: changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-HOST', "  'host'     => '", "',", postRequestParameter('mysql','host'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-DBASE', " 'dbase'    => '", "',", postRequestParameter('mysql','dbase'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-LOGIN', " 'login'    => '", "',", postRequestParameter('mysql','login'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-PASSWORD', "      'password' => '", "',", postRequestParameter('mysql','pass1'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'MYSQL-PREFIX', "setConfigEntry('_MYSQL_PREFIX', '", "');", postRequestParameter('mysql','prefix'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'TABLE-TYPE', "setConfigEntry('_TABLE_TYPE', '", "');", postRequestParameter('mysql','type'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SMTP-HOSTNAME', "setConfigEntry('SMTP_HOSTNAME', '", "');", postRequestParameter('smtp_host'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SMTP-USER', "setConfigEntry('SMTP_USER', '", "');", postRequestParameter('smtp_user'), 0);
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SMTP-PASSWORD', "setConfigEntry('SMTP_PASSWORD', '", "');", postRequestParameter('smtp_pass1'), 0);
+       if (postRequestParameter('spath') != getPath()) changeDataInFile(getCachePath() . 'config-local.php', 'SERVER-PATH', "setConfigEntry('PATH', '", "');", postRequestParameter('spath'), 0);
+       if (postRequestParameter('burl')  != getUrl())  changeDataInFile(getCachePath() . 'config-local.php', 'HOST-URL', "setConfigEntry('URL', '", "');", postRequestParameter('burl'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MAIN-TITLE', "setConfigEntry('MAIN_TITLE', '", "');", postRequestParameter('title'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SLOGAN', "setConfigEntry('SLOGAN', '", "');", postRequestParameter('slogan'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'WEBMASTER', "setConfigEntry('WEBMASTER', '", "');", postRequestParameter('email'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'NULLPASS-WARNING', "setConfigEntry('WARN_NO_PASS', '", "');", postRequestParameter('warn_no_pass'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'WRITE-FOOTER', "setConfigEntry('WRITE_FOOTER', '", "');", postRequestParameter('wfooter'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'BACKLINK', "setConfigEntry('ENABLE_BACKLINK', '", "');", postRequestParameter('blink'), 0);
+       // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-HOST', "   'host'     => '", "',", postRequestParameter('mysql','host'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-DBASE', "  'dbase'    => '", "',", postRequestParameter('mysql','dbase'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-LOGIN', "  'login'    => '", "',", postRequestParameter('mysql','login'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-PASSWORD', "       'password' => '", "',", postRequestParameter('mysql','pass1'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-PREFIX', "setConfigEntry('_MYSQL_PREFIX', '", "');", postRequestParameter('mysql','prefix'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'TABLE-TYPE', "setConfigEntry('_TABLE_TYPE', '", "');", postRequestParameter('mysql','type'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SMTP-HOSTNAME', "setConfigEntry('SMTP_HOSTNAME', '", "');", postRequestParameter('smtp_host'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SMTP-USER', "setConfigEntry('SMTP_USER', '", "');", postRequestParameter('smtp_user'), 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SMTP-PASSWORD', "setConfigEntry('SMTP_PASSWORD', '", "');", postRequestParameter('smtp_pass1'), 0);
 
        // Generate a long site key
        $siteKey = generatePassword(50);
 
        // And write it
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'SITE-KEY', "setConfigEntry('SITE_KEY', '", "');", $siteKey, 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'SITE-KEY', "setConfigEntry('SITE_KEY', '", "');", $siteKey, 0);
 
        // Script is now installed
-       changeDataInFile(getConfig('CACHE_PATH') . 'config-local.php', 'INSTALLED', "setConfigEntry('MXCHANGE_INSTALLED', '", "');", 'Y', 0);
+       changeDataInFile(getCachePath() . 'config-local.php', 'INSTALLED', "setConfigEntry('MXCHANGE_INSTALLED', '", "');", 'Y', 0);
 }
 
 // Adds a given template with content to install output stream
@@ -104,12 +100,6 @@ function addToInstallContent ($out) {
 
 // Read a given SQL dump
 function readSqlDump ($FQFN) {
-       // Sanity-check if file is there (should be there, but just to make it sure)
-       if (!isFileReadable($FQFN)) {
-               // This should not happen
-               debug_report_bug(__FUNCTION__.': File ' . basename($FQFN) . ' is not readable!');
-       } // END - if
-
        // Load the file
        $content = readFromFile($FQFN);