X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=c727a3bf64ffe0cd73f0e22fb022a5db79922761;hp=0d11b7f068a7c2b06f0409adfcabe0e0710e16aa;hb=258bb8c82f21617f7f90bff8023602a11b986f7e;hpb=aaf81b8f35512782d34f78c1a0dac8b42d745393
diff --git a/inc/functions.php b/inc/functions.php
index 0d11b7f068..c727a3bf64 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -184,7 +184,7 @@ function compileFinalOutput () {
// Output the raw HTML code
function outputRawCode ($htmlCode) {
// Output stripped HTML code to avoid broken JavaScript code, etc.
- print($htmlCode);
+ print(str_replace('{BACK}', "\\", $htmlCode));
// Flush the output if only getPhpCaching() is not 'on'
if (getPhpCaching() != 'on') {
@@ -288,20 +288,20 @@ function loadTemplate ($template, $return = false, $content = array()) {
// Normal HTML output?
if (getOutputMode() == '0') {
// Add surrounding HTML comments to help finding bugs faster
- $ret = "\n" . $GLOBALS['tpl_content'] . "\n";
+ $ret = '\n" . $GLOBALS['tpl_content'] . '\n";
// Prepare eval() command
$eval = '$ret = "' . compileCode(escapeQuotes($ret)) . '";';
} elseif (substr($template, 0, 3) == 'js_') {
// JavaScripts don't like entities and timings
- $eval = '$ret = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['tpl_content'])) . '");';
+ $eval = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['tpl_content'])) . '");';
} else {
- // Prepare eval() command
- $eval = '$ret = "' . compileCode(escapeQuotes($GLOBALS['tpl_content'])) . '";';
+ // Prepare eval() command, other output doesn't like entities, maybe
+ $eval = '$ret = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['tpl_content'])) . '");';
}
} else {
// Add surrounding HTML comments to help finding bugs faster
- $ret = "\n" . $GLOBALS['tpl_content'] . "\n";
+ $ret = '\n" . $GLOBALS['tpl_content'] . '\n";
$eval = '$ret = "' . escapeQuotes($ret) . '";';
} // END - if
@@ -602,7 +602,7 @@ Message : ' . $message . '
}
}
-// Check if legacy or PHPMailer command
+// Check to use wether legacy mail() command or PHPMailer class
// @TODO Rewrite this to an extension 'smtp'
// @private
function checkPhpMailerUsage() {
@@ -611,6 +611,12 @@ function checkPhpMailerUsage() {
// Send out a raw email with PHPMailer class or legacy mail() command
function sendRawEmail ($toEmail, $subject, $message, $from) {
+ // Just compile all again, to put out all configs, etc.
+ eval('$toEmail = decodeEntities("' . compileRawCode(escapeQuotes($toEmail)) . '");');
+ eval('$subject = decodeEntities("' . compileRawCode(escapeQuotes($subject)) . '");');
+ eval('$message = decodeEntities("' . compileRawCode(escapeQuotes($message)) . '");');
+ eval('$from = decodeEntities("' . compileRawCode(escapeQuotes($from)) . '");');
+
// Shall we use PHPMailer class or legacy mode?
if (checkPhpMailerUsage()) {
// Use PHPMailer class with SMTP enabled
@@ -1076,13 +1082,13 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true
// Replace it in the code
//* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):key={$key},match={$match}
");
$newMatch = str_replace('[', "['", str_replace(']', "']", $match));
- $code = str_replace($match, "\"." . $newMatch.".\"", $code);
+ $code = str_replace($match, '".' . $newMatch . '."', $code);
$matchesFound[$key . '_' . $matches[4][$key]] = 1;
$matchesFound[$match] = 1;
} elseif (!isset($matchesFound[$match])) {
// Not yet replaced!
//* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):match={$match}
");
- $code = str_replace($match, "\"." . $match.".\"", $code);
+ $code = str_replace($match, '".' . $match . '."', $code);
$matchesFound[$match] = 1;
}
} // END - foreach
@@ -1335,7 +1341,7 @@ function bigintval ($num, $castValue = true) {
function generateImageOrCode ($img_code, $headerSent = true) {
// Is the code size oversized or shouldn't we display it?
if ((strlen($img_code) > 6) || (empty($img_code)) || (getConfig('code_length') == '0')) {
- // Stop execution of function here because of over-sized code length
+ // Stop2 execution of function here because of over-sized code length
debug_report_bug('img_code ' . $img_code .' has invalid length. img_code()=' . strlen($img_code) . ' code_length=' . getConfig('code_length'));
} elseif ($headerSent === false) {
// Return an HTML code here
@@ -1448,35 +1454,35 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align =
} else {
// Generate table
$OUT = "
{--_YEARS--} | \n";
+ $OUT .= " {--_YEARS--} | \n";
}
if (ereg('M', $display) || (empty($display))) {
- $OUT .= " {--_MONTHS--} | \n";
+ $OUT .= " {--_MONTHS--} | \n";
}
- if (ereg("W", $display) || (empty($display))) {
- $OUT .= " {--_WEEKS--} | \n";
+ if (ereg('W', $display) || (empty($display))) {
+ $OUT .= " {--_WEEKS--} | \n";
}
- if (ereg("D", $display) || (empty($display))) {
- $OUT .= " {--_DAYS--} | \n";
+ if (ereg('D', $display) || (empty($display))) {
+ $OUT .= " {--_DAYS--} | \n";
}
- if (ereg("h", $display) || (empty($display))) {
- $OUT .= " {--_HOURS--} | \n";
+ if (ereg('h', $display) || (empty($display))) {
+ $OUT .= " {--_HOURS--} | \n";
}
if (ereg('m', $display) || (empty($display))) {
- $OUT .= " {--_MINUTES--} | \n";
+ $OUT .= " {--_MINUTES--} | \n";
}
- if (ereg("s", $display) || (empty($display))) {
- $OUT .= " {--_SECONDS--} | \n";
+ if (ereg('s', $display) || (empty($display))) {
+ $OUT .= " {--_SECONDS--} | \n";
}
$OUT .= "\n"; } else { - $OUT .= "\n"; + $OUT .= "\n"; } - if (ereg("D", $display) || (empty($display))) { + if (ereg('D', $display) || (empty($display))) { // Generate day selection $OUT .= " | \n"; } else { - $OUT .= "\n"; + $OUT .= "\n"; } - if (ereg("h", $display) || (empty($display))) { + if (ereg('h', $display) || (empty($display))) { // Generate hour selection $OUT .= " | \n"; } else { - $OUT .= "\n"; + $OUT .= "\n"; } if (ereg('m', $display) || (empty($display))) { @@ -1558,10 +1564,10 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = } $OUT .= " \n"; } else { - $OUT .= "\n"; + $OUT .= "\n"; } - if (ereg("s", $display) || (empty($display))) { + if (ereg('s', $display) || (empty($display))) { // Generate second selection $OUT .= " | \n"; } else { - $OUT .= "\n"; + $OUT .= "\n"; } $OUT .= "\n"; $OUT .= " |