X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=eb36b77d60840cef80982cc30d907c83fb9cbdd9;hp=41789fdc06a81327de61bfeda17cd4ff9d6afa9c;hb=0cbe2bfe902d26f0e99be6005140a9d8c350f017;hpb=039203d5428c9c6a3bed61fb3a9a16958c6fd44c diff --git a/inc/functions.php b/inc/functions.php index 41789fdc06..eb36b77d60 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -229,7 +229,6 @@ function addFatalMessage ($F, $L, $message, $extra = '') { $GLOBALS['fatal_messages'][] = $message; // Log fatal messages away - debug_report_bug($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 - if (getConfig('auto_purge') == '0') { + if ((isConfigEntrySet('auto_purge')) && (getConfig('auto_purge') == '0')) { // 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')); + } else { + // Missing entry + $content['expiration'] = getMessage('MAIL_NO_CONFIG_AUTO_PURGE'); } } // 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('
-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)) . '
 
'); } 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) { + // 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."*
"); @@ -2079,6 +2091,9 @@ function scrambleString($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.'***
'); 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) - if ($sendEmail === true) { + if (($sendEmail === true) && (!isInstallationPhase())) { // Prepare content $content = array( 'message' => trim($message), @@ -3163,7 +3178,8 @@ function shutdown () { // 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()) { @@ -3823,7 +3839,7 @@ function encodeUrl ($url, $outputMode = '0') { 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 = '&';