X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=eb36b77d60840cef80982cc30d907c83fb9cbdd9;hp=d81847800247afa6b9d8babb914eee11fe86bf88;hb=0cbe2bfe902d26f0e99be6005140a9d8c350f017;hpb=3deb4216cd947c4eb14b0a9e3b9f637ca25e77d3 diff --git a/inc/functions.php b/inc/functions.php index d818478002..eb36b77d60 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -85,7 +85,7 @@ function outputHtml ($htmlCode, $newLine = true) { app_die(__FUNCTION__, __LINE__, '{--FATAL_ERROR--}: {--LANG_NO_RENDER_DIRECT--}'); break; } // END - switch - } elseif (getPhpCaching() == 'on') { + } elseif ((getPhpCaching() == 'on') && ((!isset($GLOBALS['header'])) || (count($GLOBALS['header']) == 0))) { // Output cached HTML code $GLOBALS['output'] = ob_get_contents(); @@ -121,6 +121,9 @@ function outputHtml ($htmlCode, $newLine = true) { // Output code here, DO NOT REMOVE! ;-) outputRawCode($GLOBALS['output']); + } else { + // And flush all headers + flushHeaders(); } } @@ -170,12 +173,18 @@ function compileFinalOutput () { // Compress it? if (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos('gzip', $_SERVER['HTTP_ACCEPT_ENCODING']) !== null)) { - // Compress it + // Compress it for HTTP gzip $GLOBALS['output'] = gzencode($GLOBALS['output'], 9, true); // Add header sendHeader('Content-Encoding: gzip'); - } // END - if + } elseif (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos('deflate', $_SERVER['HTTP_ACCEPT_ENCODING']) !== null)) { + // Compress it for HTTP deflate + $GLOBALS['output'] = gzcompress($GLOBALS['output'], 9); + + // Add header + sendHeader('Content-Encoding: deflate'); + } // Add final length sendHeader('Content-Length: ' . strlen($GLOBALS['output'])); @@ -220,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); } @@ -418,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 @@ -577,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 : ' . str_replace('<', '<', str_replace('>', '>', secureString(trim($mailHeader)))) . '
-To      : ' . $toEmail . '
-Subject : ' . $subject . '
-Message : ' . $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 @@ -741,7 +752,7 @@ function translateYesNo ($yn) { // Translates the "pool type" into human-readable function translatePoolType ($type) { // Default?type is unknown - $translated = sprintf(getMessage('POOL_TYPE_UNKNOWN'), $type); + $translated = getMaskedMessage('POOL_TYPE_UNKNOWN', $type); // Generate constant $constName = sprintf("POOL_TYPE_%s", $type); @@ -832,7 +843,7 @@ function translateUserStatus ($status) { default: logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status)); - $ret = sprintf(getMessage('UNKNOWN_STATUS'), $status); + $ret = getMaskedMessage('UNKNOWN_STATUS', $status); break; } // END - switch @@ -1373,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."*
"); @@ -1467,7 +1488,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = if (ereg('Y', $display) || (empty($display))) { // Generate year selection - $OUT .= " \n"; for ($idx = '0'; $idx <= 10; $idx++) { $OUT .= "