X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Ffunctions.php;h=aa83e13b74f36e95470fa7f484916cfe7cad024e;hb=7f3f860c580046c17d18f2149f6c24a6bda2c901;hp=b6d40608d3a53662d16bb29357b04d4dc28e2367;hpb=47a45ea9324de396816a9af2d4d12ae8a0d248a7;p=mailer.git
diff --git a/inc/functions.php b/inc/functions.php
index b6d40608d3..aa83e13b74 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -43,6 +43,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'] = '';
+
// Transfer username
$username = getMessage('USERNAME_UNKNOWN');
if (isset($GLOBALS['username'])) $username = getUsername();
@@ -343,20 +346,20 @@ function loadTemplate ($template, $return=false, $content=array()) {
// Eval the code
eval($GLOBALS['template_eval'][$template]);
- } else {
- // No file!
- $GLOBALS['template_eval'][$template] = '404';
- }
- } elseif (((isAdmin()) || ((isInstalling()) && (!isInstalled()))) && ($GLOBALS['template_eval'][$template] == '404')) {
- // Only admins shall see this warning or when installation mode is active
- $ret = '
{--TEMPLATE_404--}
+ } elseif ((isAdmin()) || ((isInstalling()) && (!isInstalled()))) {
+ // Only admins shall see this warning or when installation mode is active
+ $ret = '
{--TEMPLATE_404--}
(' . $template . ')
{--TEMPLATE_CONTENT--}
' . print_r($content, true) . '
{--TEMPLATE_DATA--}
' . print_r($DATA, true) . '
-
\";';
+
';
+ } else {
+ // No file!
+ $GLOBALS['template_eval'][$template] = '404';
+ }
} else {
// Eval the code
eval($GLOBALS['template_eval'][$template]);
@@ -369,7 +372,7 @@ function loadTemplate ($template, $return=false, $content=array()) {
// Return the HTML code
return $ret;
} else {
- // Output direct
+ // Output directly
outputHtml($ret);
}
} elseif (isDebugModeEnabled()) {
@@ -382,9 +385,6 @@ function loadTemplate ($template, $return=false, $content=array()) {
function loadEmailTemplate ($template, $content = array(), $UID = 0) {
global $DATA;
- // Our configuration is kept non-global here
- $_CONFIG = getConfigArray();
-
// Make sure all template names are lowercase!
$template = strtolower($template);
@@ -526,7 +526,7 @@ function loadEmailTemplate ($template, $content = array(), $UID = 0) {
unset($DATA);
// Compile the code and eval it
- $eval = '$newContent = "' . compileCode(smartAddSlashes($newContent)) . '";';
+ $eval = '$newContent = "' . compileRawCode(smartAddSlashes($newContent)) . '";';
eval($eval);
// Return content
@@ -538,7 +538,7 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
//* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):TO={$toEmail},SUBJECT={$subject}
");
// Compile subject line (for POINTS constant etc.)
- eval("\$subject = decodeEntities(\"".compileCode(smartAddSlashes($subject))."\");");
+ eval("\$subject = decodeEntities(\"".compileRawCode(smartAddSlashes($subject))."\");");
// Set from header
if ((!eregi('@', $toEmail)) && ($toEmail > 0)) {
@@ -584,10 +584,10 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
}
// Compile "TO"
- eval("\$toEmail = \"".compileCode(smartAddSlashes($toEmail))."\";");
+ eval("\$toEmail = \"".compileRawCode(smartAddSlashes($toEmail))."\";");
// Compile "MSG"
- eval("\$message = \"".compileCode(smartAddSlashes($message))."\";");
+ eval("\$message = \"".compileRawCode(smartAddSlashes($message))."\";");
// Fix HTML parameter (default is no!)
if (empty($isHtml)) $isHtml = 'N';
@@ -921,7 +921,7 @@ function makeTime ($hours, $minutes, $seconds, $stamp) {
// Redirects to an URL and if neccessarry extends it with own base URL
function redirectToUrl ($URL) {
// Compile out codes
- eval('$URL = "' . compileCode($URL) . '";');
+ eval('$URL = "' . compileRawCode($URL) . '";');
// Check if http(s):// is there
if ((substr($URL, 0, 7) != 'http://') && (substr($URL, 0, 8) != 'https://')) {
@@ -996,6 +996,30 @@ function compileCode ($code, $simple = false, $constants = true, $full = true) {
return $code;
} // END - if
+ // Start couting
+ $startCompile = explode(' ', microtime());
+
+ // Comile the code
+ $code = compileRawCode($code, $simple, $constants, $full);
+
+ // Get timing
+ $compiled = explode(' ', microtime());
+
+ // Add timing
+ $code .= '';
+
+ // Return compiled code
+ return $code;
+}
+
+// Compiles the code (use compileCode() only for HTML because of the comments)
+function compileRawCode ($code, $simple = false, $constants = true, $full = true) {
+ // Is the code a string?
+ if (!is_string($code)) {
+ // Silently return it
+ return $code;
+ } // END - if
+
// Init replacement-array with full security characters
$secChars = $GLOBALS['security_chars'];
@@ -1071,7 +1095,7 @@ function compileCode ($code, $simple = false, $constants = true, $full = true) {
} // END - foreach
} // END - if
- // Return compiled code
+ // Return it
return $code;
}
@@ -1127,19 +1151,19 @@ function array_pk_sort (&$array, $a_sort, $primary_key = 0, $order = -1, $nums =
}
//
-function addSelectionBox ($type, $default, $prefix = '', $id = 0) {
+function addSelectionBox ($type, $default, $prefix = '', $id = 0, $class = 'register_select') {
$OUT = '';
if ($type == 'yn') {
// This is a yes/no selection only!
if ($id > 0) $prefix .= "[" . $id."]";
- $OUT .= "