]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
More fixes for installation and extension registration
[mailer.git] / inc / functions.php
index 41789fdc06a81327de61bfeda17cd4ff9d6afa9c..eb36b77d60840cef80982cc30d907c83fb9cbdd9 100644 (file)
@@ -229,7 +229,6 @@ function addFatalMessage ($F, $L, $message, $extra = '') {
        $GLOBALS['fatal_messages'][] = $message;
 
        // Log fatal messages away
        $GLOBALS['fatal_messages'][] = $message;
 
        // Log fatal messages away
-       debug_report_bug($message);
        logDebugMessage($F, $L, 'Fatal error message: ' . $message);
 }
 
        logDebugMessage($F, $L, 'Fatal error message: ' . $message);
 }
 
@@ -427,12 +426,15 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') {
        // Is content an array?
        if (is_array($content)) {
                // Add expiration to array
        // Is content an array?
        if (is_array($content)) {
                // Add expiration to array
-               if (getConfig('auto_purge') == '0') {
+               if ((isConfigEntrySet('auto_purge')) && (getConfig('auto_purge') == '0')) {
                        // Will never expire!
                        $content['expiration'] = getMessage('MAIL_WILL_NEVER_EXPIRE');
                        // Will never expire!
                        $content['expiration'] = getMessage('MAIL_WILL_NEVER_EXPIRE');
-               } else {
+               } elseif (isConfigEntrySet('auto_purge')) {
                        // Create nice date string
                        $content['expiration'] = createFancyTime(getConfig('auto_purge'));
                        // Create nice date string
                        $content['expiration'] = createFancyTime(getConfig('auto_purge'));
+               } else {
+                       // Missing entry
+                       $content['expiration'] = getMessage('MAIL_NO_CONFIG_AUTO_PURGE');
                }
        } // END - if
 
                }
        } // END - if
 
@@ -586,10 +588,10 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
        if (isDebugModeEnabled()) {
                // In debug mode we want to display the mail instead of sending it away so we can debug this part
                outputHtml('<pre>
        if (isDebugModeEnabled()) {
                // In debug mode we want to display the mail instead of sending it away so we can debug this part
                outputHtml('<pre>
-Headers : ' . htmlentities(trim($mailHeader)) . '
-To      : ' . htmlentities($toEmail) . '
-Subject : ' . htmlentities($subject) . '
-Message : ' . htmlentities($message) . '
+Headers : ' . htmlentities(utf8_decode(trim($mailHeader))) . '
+To      : ' . htmlentities(utf8_decode($toEmail)) . '
+Subject : ' . htmlentities(utf8_decode($subject)) . '
+Message : ' . htmlentities(utf8_decode($message)) . '
 </pre>');
        } elseif (($isHtml == 'Y') && (isExtensionActive('html_mail'))) {
                // Send mail as HTML away
 </pre>');
        } elseif (($isHtml == 'Y') && (isExtensionActive('html_mail'))) {
                // Send mail as HTML away
@@ -1382,6 +1384,16 @@ function generateImageOrCode ($img_code, $headerSent = true) {
 }
 // Create selection box or array of splitted timestamp
 function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $return_array=false) {
 }
 // Create selection box or array of splitted timestamp
 function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $return_array=false) {
+       // Do not continue if ONE_DAY is absend
+       if (!isConfigEntrySet('ONE_DAY')) {
+               // And return the timestamp itself or empty array
+               if ($return_array === true) {
+                       return array();
+               } else {
+                       return $timestamp;
+               }
+       } // END - if
+
        // Calculate 2-seconds timestamp
        $stamp = round($timestamp);
        //* DEBUG: */ print("*" . $stamp.'/' . $timestamp."*<br />");
        // Calculate 2-seconds timestamp
        $stamp = round($timestamp);
        //* DEBUG: */ print("*" . $stamp.'/' . $timestamp."*<br />");
@@ -2079,6 +2091,9 @@ function scrambleString($str) {
                $scrambleNums = explode(':', genScrambleString(strlen($str)));
        }
 
                $scrambleNums = explode(':', genScrambleString(strlen($str)));
        }
 
+       // Compare both lengths and abort if different
+       if (strlen($str) != count($scrambleNums)) return $str;
+
        // Scramble string here
        //* DEBUG: */ outputHtml('***Original=' . $str.'***<br />');
        for ($idx = '0'; $idx < strlen($str); $idx++) {
        // Scramble string here
        //* DEBUG: */ outputHtml('***Original=' . $str.'***<br />');
        for ($idx = '0'; $idx < strlen($str); $idx++) {
@@ -2577,7 +2592,7 @@ function debug_report_bug ($message = '', $sendEmail = true) {
        $debug .= "Thank you for finding bugs.";
 
        // Send an email? (e.g. not wanted for evaluation errors)
        $debug .= "Thank you for finding bugs.";
 
        // Send an email? (e.g. not wanted for evaluation errors)
-       if ($sendEmail === true) {
+       if (($sendEmail === true) && (!isInstallationPhase())) {
                // Prepare content
                $content = array(
                        'message'     => trim($message),
                // Prepare content
                $content = array(
                        'message'     => trim($message),
@@ -3163,7 +3178,8 @@ function shutdown () {
        // Call the filter chain 'shutdown'
        runFilterChain('shutdown', null);
 
        // Call the filter chain 'shutdown'
        runFilterChain('shutdown', null);
 
-       if (SQL_IS_LINK_UP()) {
+       // Check if not in installation phase and the link is up
+       if ((!isInstallationPhase()) && (SQL_IS_LINK_UP())) {
                // Close link
                SQL_CLOSE(__FILE__, __LINE__);
        } elseif (!isInstallationPhase()) {
                // Close link
                SQL_CLOSE(__FILE__, __LINE__);
        } elseif (!isInstallationPhase()) {
@@ -3823,7 +3839,7 @@ function encodeUrl ($url, $outputMode = '0') {
        if (strpos($url, session_name()) !== false) return $url;
 
        // Do we have a valid session?
        if (strpos($url, session_name()) !== false) return $url;
 
        // Do we have a valid session?
-       if ((($GLOBALS['valid_session'] === false) || (!isset($_COOKIE[session_name()]))) && (isSpider() === false)) {
+       if (((!isset($GLOBALS['valid_session'])) || ($GLOBALS['valid_session'] === false) || (!isset($_COOKIE[session_name()]))) && (isSpider() === false)) {
                // Invalid session
                // Determine right seperator
                $seperator = '&amp;';
                // Invalid session
                // Determine right seperator
                $seperator = '&amp;';