]> git.mxchange.org Git - mailer.git/blobdiff - inc/install-inc.php
Filter support added to template engine, functions renamed
[mailer.git] / inc / install-inc.php
index d4afebe5dfad810ef936fbf17166a88de827967b..01c7ca8e0836c06f81f04376ed4cc987aad3aabe 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 08/29/2003 *
- * ===============                              Last change: 11/11/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 08/29/2003 *
+ * ===================                          Last change: 11/11/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : install-inc.php                                  *
@@ -47,37 +47,40 @@ if (!defined('__SECURITY')) {
 
 // Init variables
 $mysql = array();
-if ((isPostRequestElementSet('mysql')) && (is_array(postRequestElement('mysql')))) $mysql = postRequestElement('mysql');
+if ((isPostRequestElementSet('mysql')) && (is_array(postRequestElement('mysql')))) {
+       // Transfer 'mysql' array
+       $mysql = postRequestElement('mysql');
+} // END - if
 
 // Check if both passwords from SMTP are matching
 if ((isGetRequestElementSet('page') && (getRequestElement('page') == 5))) {
        // Okay, we have to check it
        if (isPostRequestElementSet('smtp_user') && (!isPostRequestElementSet('smtp_host'))) {
                // Hostname not set
-               addToInstallContent(getMessage('INSTALL_SMTP_HOSTNAME_EMPTY') . '<br />');
+               addToInstallContent('<div class="para">' . getMessage('INSTALL_SMTP_HOSTNAME_EMPTY') . '</div>');
                setRequestGetElement('page', 3);
        } // END - if
 
        if ((!isPostRequestElementSet('smtp_pass1')) && (isPostRequestElementSet('smtp_pass2'))) {
                // Password is empty
-               addToInstallContent(getMessage('INSTALL_SMTP_PASS1_EMPTY') . '<br />');
+               addToInstallContent('<div class="para">' . getMessage('INSTALL_SMTP_PASS1_EMPTY') . '</div>');
                setRequestGetElement('page', 3);
        } // END - if
 
        if ((isPostRequestElementSet('smtp_pass1')) && (!isPostRequestElementSet('smtp_pass2'))) {
                // Password repeat is empty
-               addToInstallContent(getMessage('INSTALL_SMTP_PASS2_EMPTY') . '<br />');
+               addToInstallContent('<div class="para">' . getMessage('INSTALL_SMTP_PASS2_EMPTY') . '</div>');
                setRequestGetElement('page', 3);
        } // END - if
 
        if (postRequestElement('smtp_pass1') != postRequestElement('smtp_pass1')) {
                // Passwords are not matching
-               addToInstallContent(getMessage('INSTALL_SMTP_PASS_MISMATCH') . '<br />');
+               addToInstallContent('<div class="para">' . getMessage('INSTALL_SMTP_PASS_MISMATCH') . '</div>');
                setRequestGetElement('page', 3);
        } // END - if
 } // END - if
 
-// Is MXChange installed or no admin registered so far?
+// Is the mailer installed or no admin registered so far?
 if ((!isInstalled()) || (!isAdminRegistered())) {
        // Output page for entered value
        switch (getRequestElement('page')) {
@@ -97,11 +100,11 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                        if (empty($mysql['prefix'])) $mysql['prefix'] = 'mxchange';
                        if (empty($mysql['type']))   $mysql['type']   = 'MyISAM';
                        if (getTotalFatalErrors() > 0) {
-                               addToInstallContent('<span class="install_fatal">');
+                               addToInstallContent('<div class="install_fatal">');
                                foreach (getFatalArray() as $key => $err) {
-                                       addToInstallContent('<strong>&middot;</strong>&nbsp;{--FATAL_NO--}' . ($key + 1) . ':&nbsp;' . $err . '<br />');
+                                       addToInstallContent('<div class="para"><strong>&middot;</strong>&nbsp;{--FATAL_NO--}' . ($key + 1) . ':&nbsp;' . $err . '</div>');
                                }
-                               addToInstallContent('</span><br />');
+                               addToInstallContent('</div>');
                        }
                        $content['mysql_host']   = $mysql['host'];
                        $content['mysql_dbase']  = $mysql['dbase'];
@@ -115,7 +118,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                        $content['email']        = postRequestElement('email');
 
                        // Load template
-                       addTemplateToInstallContent('install_page2', false, $content);
+                       addTemplateToInstallContent('install_page2', $content);
                        break;
 
                case '3':
@@ -156,7 +159,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                        $content['smtp_pass2'] = $smtpPass2;
 
                        // Load template
-                       addTemplateToInstallContent('install_page3', false, $content);
+                       addTemplateToInstallContent('install_page3', $content);
                        break;
 
                case '5': // Misc settings
@@ -167,13 +170,6 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                        $content['slogan'] = postRequestElement('slogan');
                        $content['email']  = postRequestElement('email');
 
-                       // MySQL settings
-                       $content['mysql_host']   = $mysql['host'];
-                       $content['mysql_dbase']  = $mysql['dbase'];
-                       $content['mysql_prefix'] = $mysql['prefix'];
-                       $content['mysql_login']  = $mysql['login'];
-                       $content['table_type']   = $mysql['type'];
-
                        // SMTP settings
                        $content['smtp_host'] = postRequestElement('smtp_host');
                        $content['smtp_user'] = postRequestElement('smtp_user');
@@ -183,11 +179,11 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                        $OUT = '';
                        foreach ($mysql as $key => $value) {
                                $OUT .= "    <input type=\"hidden\" name=\"mysql[" . $key . "]\" value=\"" . $value . "\" />\n";
-                       }
+                       } // END - foreach
                        $content['mysql_hidden'] = $OUT;
 
                        // Load template
-                       addTemplateToInstallContent('install_page5', false, $content);
+                       addTemplateToInstallContent('install_page5', $content);
                        break;
 
                case 'finalize': // Write captured data to files
@@ -206,7 +202,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                                                        addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_MISSING_DUMPS'));
                                                } // END - if
 
-                                               if (getTotalFatalErrors() == 0) {
+                                               if (getTotalFatalErrors() == '0') {
                                                        // Set type and prefix from POST data
                                                        setConfigEntry('_TABLE_TYPE'  , postRequestElement('mysql', 'type'));
                                                        setConfigEntry('_MYSQL_PREFIX', postRequestElement('mysql', 'prefix'));
@@ -221,9 +217,6 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                                                                        // Read the file
                                                                        $fileContent = readFromFile($FQFN, true);
 
-                                                                       // Compile all config entries (we use a filter here, yes...)
-                                                                       $fileContent = FILTER_COMPILE_CONFIG($fileContent);
-
                                                                        // Split it up against ";\n" and merge it into existing SQLs
                                                                        mergeSqls(explode(";\n", $fileContent), 'install');
                                                                } else {
@@ -234,7 +227,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                                                        //* DEBUG: */ die('<pre>'.print_r(getSqls(), true).'</pre>');
 
                                                        // Are some SQLs found?
-                                                       if (countSqls() == 0) {
+                                                       if (countSqls() == '0') {
                                                                // Abort here
                                                                addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_SQL_IMPORT_FAILED'));
                                                                return;
@@ -252,12 +245,12 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                                if (getTotalFatalErrors() > 0) {
                                        $OUT = '';
                                        foreach (getFatalArray() as $value) {
-                                               $OUT .= "    <li>" . $value . "</li>\n";
+                                               $OUT .= '    <li>' . $value . '</li>';
                                        } // END foreach
                                        $content['fatal_errors'] = $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 . '" />';
                                        } // END foreach
                                        $content['mysql_hidden'] = $OUT;
                                        $content['spath']      = postRequestElement('spath');
@@ -268,7 +261,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
                                        $content['smtp_pass']  = postRequestElement('smtp_pass1');
 
                                        // Load template
-                                       addTemplateToInstallContent('install_fatal_errors', false, $content);
+                                       addTemplateToInstallContent('install_fatal_errors', $content);
                                } else {
                                        // Installation is done!
                                        redirectToUrl('install.php?page=finished');
@@ -291,7 +284,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) {
 
                default:
                        logDebugMessage(__FILE__, __LINE__, sprintf("Wrong page %s detected", getRequestElement('page')));
-                       addTemplateToInstallContent('admin_settings_saved', "<div class=\"install_error\">{--WRONG_PAGE--}</div>");
+                       addTemplateToInstallContent('admin_settings_saved', '<div class="install_error">{--WRONG_PAGE--}</div>');
                        break;
        } // END - switch
 } else {