X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=eec116f9c7cd0c52b9a87f25ef4dd13ff2a8f696;hp=eb0ba63455b268642061309e2d03b24b16963fac;hb=0715fa7aa8e5e70bcf1d957fb09ae655c3896c4e;hpb=2c0f5aabd4c866f67705f36f7878dbc223daa9d8
diff --git a/inc/functions.php b/inc/functions.php
index eb0ba63455..eec116f9c7 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -45,7 +45,9 @@ if (!defined('__SECURITY')) {
// Output HTML code directly or 'render' it. You addionally switch the new-line character off
function outputHtml ($htmlCode, $newLine = true) {
// Init output
- if (!isset($GLOBALS['output'])) $GLOBALS['output'] = '';
+ if (!isset($GLOBALS['output'])) {
+ $GLOBALS['output'] = '';
+ } // END - if
// Transfer username
$username = getMessage('USERNAME_UNKNOWN');
@@ -134,7 +136,7 @@ function sendHttpHeaders () {
$now = gmdate('D, d M Y H:i:s') . ' GMT';
// Send HTTP header
- sendHeader('HTTP/1.1 200');
+ sendHeader('HTTP/1.1 200 OK');
// General headers for no caching
sendHeader('Expires: ' . $now); // RFC2616 - Section 14.21
@@ -149,19 +151,21 @@ function sendHttpHeaders () {
// Compiles the final output
function compileFinalOutput () {
// Init counter
- $cnt = '0';
+ $cnt = 0;
// Add page header and footer
addPageHeaderFooter();
// Compile all out
- while (((strpos($GLOBALS['output'], '{--') > 0) || (strpos($GLOBALS['output'], '{!') > 0) || (strpos($GLOBALS['output'], '{?') > 0)) && ($cnt < 3)) {
+ while (((strpos($GLOBALS['output'], '{--') !== false) || (strpos($GLOBALS['output'], '{!') !== false) || (strpos($GLOBALS['output'], '{?') !== false) || (strpos($GLOBALS['output'], '{%') !== false)) && ($cnt < 3)) {
// Init common variables
$content = array();
$newContent = '';
// Compile it
- $eval = "\$newContent = \"".compileCode(escapeQuotes($GLOBALS['output']))."\";";
+ //* DEBUG: */ print '
'.htmlentities($GLOBALS['output']).'
';
+ $eval = '$newContent = "' . compileCode(escapeQuotes($GLOBALS['output'])) . '";';
+ //* DEBUG: */ die(''.htmlentities($eval).'
');
eval($eval);
// Was that eval okay?
@@ -169,6 +173,8 @@ function compileFinalOutput () {
// Something went wrong!
debug_report_bug('Evaluation error:' . linenumberCode($eval) . '
', false);
} // END - if
+
+ // Use it again
$GLOBALS['output'] = $newContent;
// Count round
@@ -496,7 +502,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') {
$GLOBALS['tpl_content'] = readFromFile($FQFN);
// Run code
- $GLOBALS['tpl_content'] = "\$newContent = decodeEntities(\"".compileRawCode(escapeQuotes($GLOBALS['tpl_content']))."\");";
+ $GLOBALS['tpl_content'] = '$newContent = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['tpl_content'])) . '");';
eval($GLOBALS['tpl_content']);
} elseif (!empty($template)) {
// Template file not found!
@@ -536,7 +542,7 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "TO={$toEmail},SUBJECT={$subject}
");
// Compile subject line (for POINTS constant etc.)
- eval("\$subject = decodeEntities(\"".compileRawCode(escapeQuotes($subject))."\");");
+ eval('$subject = decodeEntities("' . compileRawCode(escapeQuotes($subject)) . '");');
// Set from header
if ((!isInStringIgnoreCase('@', $toEmail)) && ($toEmail > 0)) {
@@ -582,10 +588,10 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
}
// Compile "TO"
- eval("\$toEmail = \"".compileRawCode(escapeQuotes($toEmail))."\";");
+ eval('$toEmail = "' . compileRawCode(escapeQuotes($toEmail)) . '";');
// Compile "MSG"
- eval("\$message = \"".str_replace('$', '$', compileRawCode(escapeQuotes($message)))."\";");
+ eval('$message = "' . str_replace('$', '$', compileRawCode(escapeQuotes($message))) . '";');
// Fix HTML parameter (default is no!)
if (empty($isHtml)) $isHtml = 'N';
@@ -785,6 +791,9 @@ function translatePoolType ($type) {
// Translates the american decimal dot into a german comma
function translateComma ($dotted, $cut = true, $max = '0') {
+ // First, cast all to double, due to PHP changes
+ $dotted = (double) $dotted;
+
// Default is 3 you can change this in admin area "Misc -> Misc Options"
if (!isConfigEntrySet('max_comma')) setConfigEntry('max_comma', 3);
@@ -1162,30 +1171,30 @@ function addSelectionBox ($type, $default, $prefix = '', $id = '0', $class = 're
if ($type == 'yn') {
// This is a yes/no selection only!
- if ($id > 0) $prefix .= "[" . $id."]";
- $OUT .= "