Even more constants/language strings rewritten, merge_array() now logs debug messages
authorRoland Häder <roland@mxchange.org>
Fri, 20 Feb 2009 15:29:08 +0000 (15:29 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 20 Feb 2009 15:29:08 +0000 (15:29 +0000)
inc/functions.php
inc/install-inc.php
inc/libs/surfbar_functions.php
inc/modules/admin.php

index 2fc50d3..6f668fc 100644 (file)
@@ -2397,10 +2397,15 @@ function merge_array ($array1, $array2) {
                return array_merge($array1, $array2);
        } elseif (is_array($array1)) {
                // Return left array
+               DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2)));
                return $array1;
+       } elseif (is_array($array2)) {
+               // Return right array
+               DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array1 is not an array. array != %s", gettype($array1)));
+               return $array2;
        }
 
-       // Something wired happened here...
+       // Both are not arrays
        print(__FUNCTION__.":<pre>");
        debug_print_backtrace();
        die("</pre>");
index fb50b71..c24f262 100644 (file)
@@ -115,22 +115,22 @@ if ((isset($_GET['page']) && ($_GET['page'] == 5))) {
        // Okay, we have to check it
        if (!empty($_POST['smtp_user']) && (empty($_POST['smtp_host']))) {
                // Hostname not set
-               OUTPUT_HTML(INSTALL_SMTP_HOSTNAME_EMPTY."<br />");
+               OUTPUT_HTML(getMessage('INSTALL_SMTP_HOSTNAME_EMPTY')."<br />");
                $_GET['page'] = 3;
        } // END - if
        if ((empty($_POST['smtp_pass1'])) && (!empty($_POST['smtp_pass2']))) {
                // Password is empty
-               OUTPUT_HTML(INSTALL_SMTP_PASS1_EMPTY."<br />");
+               OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS1_EMPTY')."<br />");
                $_GET['page'] = 3;
        } // END - if
        if ((!empty($_POST['smtp_pass1'])) && (empty($_POST['smtp_pass2']))) {
                // Password repeat is empty
-               OUTPUT_HTML(INSTALL_SMTP_PASS2_EMPTY."<br />");
+               OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS2_EMPTY')."<br />");
                $_GET['page'] = 3;
        } // END - if
        if ($_POST['smtp_pass1'] != $_POST['smtp_pass1']) {
                // Passwords are not matching
-               OUTPUT_HTML(INSTALL_SMTP_PASS_MISMATCH."<br />");
+               OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS_MISMATCH')."<br />");
                $_GET['page'] = 3;
        } // END - if
 } // END - if
@@ -194,10 +194,10 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                define('__EMAIL_VALUE'  , $_POST['email']);
 
                // Use default SMTP data
-               $smtpHost  = SMTP_HOSTNAME;
-               $smtpUser  = SMTP_USER;
-               $smtpPass1 = SMTP_PASSWORD;
-               $smtpPass2 = SMTP_PASSWORD;
+               $smtpHost  = constant('SMTP_HOSTNAME');
+               $smtpUser  = constant('SMTP_USER');
+               $smtpPass1 = constant('SMTP_PASSWORD');
+               $smtpPass2 = constant('SMTP_PASSWORD');
 
                // Overwrite it with the data from sent (failed) form
                if (!empty($_POST['smtp_host'])) $smtpHost = $_POST['smtp_host'];
@@ -275,7 +275,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                if (isBooleanConstantAndTrue('warn_no_pass')) OUTPUT_HTML(" selected=\"selected\"");
                OUTPUT_HTML(">{!YES!}</option>
       <option value=\"false\"");
-               if (!defined('warn_no_pass')) OUTPUT_HTML(" selected=\"selected\"");
+               if (!isBooleanConstantAndTrue('warn_no_pass')) OUTPUT_HTML(" selected=\"selected\"");
                OUTPUT_HTML(">{!NO!}</option>
     </select>
   </td>
@@ -289,7 +289,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                if (isBooleanConstantAndTrue('WRITE_FOOTER')) OUTPUT_HTML(" selected=\"selected\"");
                OUTPUT_HTML(">{!YES!}</option>
       <option value=\"false\"");
-               if (!defined('WRITE_FOOTER')) OUTPUT_HTML(" selected=\"selected\"");
+               if (!isBooleanConstantAndTrue('WRITE_FOOTER')) OUTPUT_HTML(" selected=\"selected\"");
                OUTPUT_HTML(">{!NO!}</option>
     </select>
   </td>
@@ -300,10 +300,10 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
   <td>
     <select name=\"blink\" size=\"1\" class=\"install_select\">
       <option value=\"true\"");
-               if (ENABLE_BACKLINK) OUTPUT_HTML(" selected=\"selected\"");
+               if (isBooleanConstantAndTrue('ENABLE_BACKLINK')) OUTPUT_HTML(" selected=\"selected\"");
                OUTPUT_HTML(">{!YES!}</option>
       <option value=\"false\"");
-               if (!ENABLE_BACKLINK) OUTPUT_HTML(" selected=\"selected\"");
+               if (!isBooleanConstantAndTrue('ENABLE_BACKLINK')) OUTPUT_HTML(" selected=\"selected\"");
                OUTPUT_HTML(">{!NO!}</option>
     </select>
   </td>
@@ -359,7 +359,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                                                // Are some SQLs found?
                                                if (count($SQLs) == 0) {
                                                        // Abort here
-                                                       addFatalMessage(INSTALL_SQL_IMPORT_FAILED);
+                                                       addFatalMessage(getMessage('INSTALL_SQL_IMPORT_FAILED'));
                                                        return;
                                                } // END - if
 
@@ -376,8 +376,8 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                                                } // END - foreach
 
                                                // Ok, all done. So we can write the config data to the php files
-                                               if ($_POST['spath'] != PATH) install_WriteData($_POST['spath']."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", $_POST['spath'], 0);
-                                               if ($_POST['burl']  != URL)  install_WriteData($_POST['spath']."inc/config.php", "HOST-URL", "define('URL', \"", "\");", $_POST['burl'], 0);
+                                               if ($_POST['spath'] != constant('PATH')) install_WriteData($_POST['spath']."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", $_POST['spath'], 0);
+                                               if ($_POST['burl']  != constant('URL'))  install_WriteData($_POST['spath']."inc/config.php", "HOST-URL", "define('URL', \"", "\");", $_POST['burl'], 0);
                                                install_WriteData($_POST['spath']."inc/config.php", "MAIN_TITLE", "define('MAIN_TITLE', \"", "\");", $_POST['title'], 0);
                                                install_WriteData($_POST['spath']."inc/config.php", "SLOGAN", "define('SLOGAN', \"", "\");", $_POST['slogan'], 0);
                                                install_WriteData($_POST['spath']."inc/config.php", "WEBMASTER", "define('WEBMASTER', \"", "\");", $_POST['email'], 0);
@@ -396,7 +396,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                                                install_WriteData($_POST['spath']."inc/config.php", "INSTALLED", "define('mxchange_installed', ", ");", "true", 0);
                                        } else {
                                                // Installation area not found!
-                                               addFatalMessage(INSTALL_MISSING_DUMPS);
+                                               addFatalMessage(getMessage('INSTALL_MISSING_DUMPS'));
                                        }
                                } // END - if
                        } // END - if
@@ -430,7 +430,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                        LOAD_TEMPLATE("install_finished");
                } else {
                        // Something goes wrong during installation! :-(
-                       addFatalMessage(INSTALL_FINALIZER_FAILED);
+                       addFatalMessage(getMessage('INSTALL_FINALIZER_FAILED'));
                        LOAD_INC("inc/fatal_errors.php");
                }
                break;
index d928ad7..d981c7b 100644 (file)
@@ -653,7 +653,7 @@ function SURFBAR_NOTIFY_ADMIN ($messageType, $content) {
        if (defined($constantName)) {
                $subject = constant($constantName);
        } else {
-               addFatalMessage(ADMIN_SURFBAR_NOTIFY_SUBJECT_404, $constantName);
+               addFatalMessage(getMessage('ADMIN_SURFBAR_NOTIFY_SUBJECT_404'), $constantName);
        }
 
        // Translate some data if present
@@ -689,7 +689,7 @@ function SURFBAR_NOTIFY_USER ($messageType, $content) {
        if (defined($constantName)) {
                $subject = constant($constantName);
        } else {
-               addFatalMessage(MEMBER_SURFBAR_NOTIFY_SUBJECT_404, $constantName);
+               addFatalMessage(getMessage('MEMBER_SURFBAR_NOTIFY_SUBJECT_404'), $constantName);
        }
 
        // Translate some data if present
index 2d11145..f61c4ed 100644 (file)
@@ -369,13 +369,13 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
        case "404": // Administrator login not found
                $_POST['ok'] = $ret;
                DESTROY_ADMIN_SESSION();
-               addFatalMessage(ADMIN_NOT_FOUND);
+               addFatalMessage(getMessage('ADMIN_NOT_FOUND'));
                break;
 
        case "pass": // Wrong password
                $_POST['ok'] = $ret;
                DESTROY_ADMIN_SESSION();
-               addFatalMessage(WRONG_PASS);
+               addFatalMessage(getMessage('WRONG_PASS'));
                break;
 
        default: // Others will be logged