]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
More language strings rewritten
[mailer.git] / inc / functions.php
index 6fc7d1bd973a8ba0d198ba0ee07953477b315bee..831e497a069561a1f289424d747e3edd6a9682cd 100644 (file)
@@ -185,15 +185,17 @@ function OUTPUT_RAW ($HTML) {
 function addFatalMessage ($message, $extra="") {
        global $FATAL;
 
-       if (empty($extra)) {
-               // Regular text message to add to $FATAL
-               $FATAL[] = $message;
-       } else {
+       if (is_array($extra)) {
+               // Multiple extras for a message with masks
+               $message = call_user_func_array('sprintf', $extra);
+       } elseif (!empty($extra)) {
                // $message is text with a mask plus extras to insert into the text
                $message = sprintf($message, $extra);
-               $FATAL[] = $message;
        }
 
+       // Add message to $FATAL
+       $FATAL[] = $message;
+
        // Log fatal messages away
        DEBUG_LOG(__FUNCTION__, __LINE__, " message={$message}");
 }
@@ -1599,7 +1601,7 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) {
                if ($aid == "-1") {
                        if (EXT_IS_ACTIVE("events")) {
                                // Add line to user events
-                               USERLOG_ADD_LINE($subj, $msg, $UID);
+                               EVENTS_ADD_LINE($subj, $msg, $UID);
                        } else {
                                // Log error for debug
                                DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension 'events' missing: tpl=%s,subj=%s,UID=%s",
@@ -2390,13 +2392,13 @@ function merge_array ($array1, $array2) {
        }
 
        // Both are not arrays
-       debug_report_bug(__FUNCTION__.":");
+       debug_report_bug(__FUNCTION__.": No arrays provided!");
 }
 
 // Debug message logger
 function DEBUG_LOG ($file, $line, $message, $force=true) {
        // Is debug mode enabled?
-       if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force)) {
+       if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force === true)) {
                // Log this message away
                $fp = fopen(PATH."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!");
                fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename($file)."|".$line."|".strip_tags($message)."\n");
@@ -2670,7 +2672,7 @@ function TRANSLATE_POOL_TYPE ($type) {
        // Does it exist?
        if (defined($constName)) {
                // Then use it
-               $translated = constant($constName);
+               $translated = getMessage($constName);
        } // END - if
 
        // Return "translation"
@@ -2833,6 +2835,12 @@ function IF_APACHE_MODULE_LOADED ($apacheModule) {
        return (((function_exists('apache_get_modules')) && (in_array($apacheModule, apache_get_modules()))) || (!function_exists('apache_get_modules')));
 }
 
+// Merges $_CONFIG with data in given array
+function mergeConfig ($newConfig) {
+       global $_CONFIG;
+       $_CONFIG = merge_array($_CONFIG, $newConfig);
+}
+
 // Getter for $_CONFIG entries
 function getConfig ($entry) {
        global $_CONFIG;
@@ -3233,7 +3241,7 @@ function convertCodeToMessage ($code) {
                case constant('CODE_COOKIES_DISABLED') : $msg = getMessage('LOGIN_NO_COOKIES'); break;
                case constant('CODE_BEG_SAME_AS_OWN')  : $msg = getMessage('BEG_SAME_UID_AS_OWN'); break;
                case constant('CODE_LOGIN_FAILED')     : $msg = getMessage('LOGIN_FAILED_GENERAL'); break;
-               default                                : $msg = UNKNOWN_MAILID_CODE_1.$code.UNKNOWN_MAILID_CODE_2; break;
+               default                                : $msg = sprintf(getMessage('UNKNOWN_MAILID_CODE'), $code); break;
        } // END - switch
 
        // Return the message
@@ -3270,7 +3278,7 @@ function GENERATE_AID_LINK ($aid) {
                        }
                } else {
                        // Maybe deleted?
-                       $admin = "<div class=\"admin_note\">".ADMIN_ID_404_1.$aid.ADMIN_ID_404_2."</div>";
+                       $admin = "<div class=\"admin_note\">".sprintf(getMessage('ADMIN_ID_404'), $aid)."</div>";
                }
        } // END - if