X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ftemplate-functions.php;h=7422b6e4478298c6c8aba7a3149bd5e0856a4ea3;hb=fc741216b12245da56b5de93d1f967586b0848d7;hp=c05eb5d06247b10892638aacacc58c9e17e1904a;hpb=839c74c5882de11b95046f6bca0ea0e02ea139c8;p=mailer.git
diff --git a/inc/template-functions.php b/inc/template-functions.php
index c05eb5d062..7422b6e447 100644
--- a/inc/template-functions.php
+++ b/inc/template-functions.php
@@ -16,7 +16,7 @@
* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -180,6 +180,15 @@ function outputHtml ($htmlCode = NULL, $newLine = TRUE) {
// Compiles the final output
function compileFinalOutput () {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '__output(length)=' . strlen($GLOBALS['__output']) . ',getScriptOutputMode()=' . getScriptOutputMode() . ' - ENTERED!');
+ // Is this function called?
+ if (isset($GLOBALS[__FUNCTION__])) {
+ // Abort here
+ reportBug(__FUNCTION__, __LINE__, 'Double call of ' . __FUNCTION__ . ' causes problems with sent headers.');
+ } // END - if
+
+ // Mark this function as called
+ $GLOBALS[__FUNCTION__] = TRUE;
+
// Add page header and footer
addPageHeaderFooter();
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '__output(length)=' . strlen($GLOBALS['__output']) . ' - After addPageHeaderFooter() call.');
@@ -226,26 +235,26 @@ function doFinalCompilation ($code, $insertComments = TRUE, $enableCodes = TRUE)
enableTemplateHtml($insertComments);
// Init counter
- $count = 0;
+ $totalCompilations = 0;
// Compile all out
- while (((isInString('{--', $code)) || (isInString('{DQUOTE}', $code)) || (isInString('{?', $code)) || (isInString('{%', $code) !== FALSE)) && ($count < 7)) {
+ while (((isInString('{--', $code)) || (isInString('{DQUOTE}', $code)) || (isInString('{?', $code)) || (isInString('{%', $code) !== FALSE)) && ($totalCompilations < 7)) {
// Init common variables
$content = array();
$newContent = '';
// Compile it
- //* DEBUG: */ debugOutput('
'.linenumberCode($code).'
');
+ //* DEBUG: */ debugOutput(''.lineNumberCode($code).'
');
$eval = '$newContent = "' . str_replace('{DQUOTE}', '"', compileCode(escapeQuotes($code), $enableCodes)) . '";';
- //* DEBUG: */ if (!$insertComments) print('EVAL='.linenumberCode($eval).'
');
+ //* DEBUG: */ if (!$insertComments) print('EVAL='.lineNumberCode($eval).'
');
eval($eval);
- //* DEBUG: */ if (!$insertComments) print('NEW='.linenumberCode($newContent).'
');
+ //* DEBUG: */ if (!$insertComments) print('NEW='.lineNumberCode($newContent).'
');
//* DEBUG: */ die(''.encodeEntities($newContent).'
');
// Was that eval okay?
if (empty($newContent)) {
// Something went wrong!
- reportBug(__FUNCTION__, __LINE__, 'Evaluation error:' . linenumberCode($eval) . '
', FALSE);
+ reportBug(__FUNCTION__, __LINE__, 'Evaluation error:' . lineNumberCode($eval) . '
', FALSE);
} // END - if
// Use it again
@@ -258,13 +267,14 @@ function doFinalCompilation ($code, $insertComments = TRUE, $enableCodes = TRUE)
} // END - if
// Count round
- $count++;
+ $totalCompilations++;
} // END - while
// Add debugging data in HTML code, if mode is enabled
- if ((isDebugModeEnabled()) && ($insertComments === TRUE) && ((isHtmlOutputMode()) || (isCssOutputMode()))) {
+ if ((isDebugModeEnabled()) && ($insertComments === TRUE) && (isHtmlOutputMode())) {
// Add loop count
- $code .= '';
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isDebugModeEnabled()=' . intval(isDebugModeEnabled()) . ',insertComments=' . intval($insertComments) . ',isHtmlOutputMode()=' . intval(isHtmlOutputMode()));
+ $code .= '';
} // END - if
// Return the compiled code
@@ -606,7 +616,7 @@ function getMenuCssClasses ($data) {
// Generate XHTML code for the CAPTCHA
function generateCaptchaCode ($code, $type, $urlId, $userid) {
- return '';
+ return '';
}
// Compiles the given HTML/mail code
@@ -754,46 +764,30 @@ function compileRawCode ($code, $full = TRUE, $compileCode = TRUE) {
}
//
-function addSelectionBox ($type, $default, $prefix = '', $id = '0', $class = 'form_select') {
+function addSelectionBox ($type, $default, $prefix = '', $id = NULL, $class = 'form_select') {
$OUT = '';
if ($type == 'yn') {
// This is a yes/no selection only!
- if ($id > 0) $prefix .= '[' . $id . ']';
+ if (isValidId($id)) $prefix .= '[' . $id . ']';
$OUT .= '