From: Roland Häder Date: Tue, 27 Oct 2009 21:49:16 +0000 (+0000) Subject: Fix for endless loop in outputHtml() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f1308369312b448023e572dc12dec0da6a9b5e52;p=mailer.git Fix for endless loop in outputHtml() --- diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index daac4a8218..1d9027656f 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -610,17 +610,23 @@ function updateExtension ($ext_name, $ext_ver, $dry_run = false) { if (count($depencies) > 0) { // Apply all extension depencies foreach ($depencies as $ext_depend) { - // Set it as current - setCurrentExtensionName($ext_depend); - - // Is the extension there? - if (isExtensionInstalled($ext_depend)) { - // Update another extension first! - $test = updateExtension($ext_depend, getExtensionVersion($ext_depend), getExtensionDryRun()); - } else { - // Register new extension - $test = registerExtension($ext_depend, 0, getExtensionDryRun(), false); - } + // Did we already update/register this? + if (!isset($GLOBALS['ext_updated'][$ext_depend])) { + // Set it as current + setCurrentExtensionName($ext_depend); + + // Mark it as already updated before we update it + $GLOBALS['ext_updated'][$ext_depend] = true; + + // Is the extension there? + if (isExtensionInstalled($ext_depend)) { + // Update another extension first! + $test = updateExtension($ext_depend, getExtensionVersion($ext_depend), getExtensionDryRun()); + } else { + // Register new extension + $test = registerExtension($ext_depend, 0, getExtensionDryRun(), false); + } + } // END - if } // END - foreach // Set name back diff --git a/inc/filter-functions.php b/inc/filter-functions.php index 274ded1875..ce4d30276e 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -234,10 +234,10 @@ function runFilterChain ($filterName, $data = null) { // Is that filter chain there? if (!isset($GLOBALS['cache_array']['filter']['chains'][$filterName])) { // We should find all these non-existing filter chains - /* Only for tracking: */ if ($filterName != 'sql_admin_extra_data') { - /* Only for tracking: */ debug_report_bug('Filter chain ' . $filterName . ' not found!'); - /* Only for tracking: */ } - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Filter chain ' . $filterName . ' not found!'); + //* Only for tracking: */ if ($filterName != 'sql_admin_extra_data') { + //* Only for tracking: */ debug_report_bug('Filter chain ' . $filterName . ' not found!'); + //* Only for tracking: */ } + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Filter chain ' . $filterName . ' not found!'); // Abort here and return content return $data; diff --git a/inc/functions.php b/inc/functions.php index fd2eab7f3d..60efa3138e 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -119,8 +119,11 @@ function outputHtml ($htmlCode, $newLine = true) { $GLOBALS['output'] = rewriteLinksInCode($GLOBALS['output']); } // END - if + // Init counter + $cnt = 0; + // Compile and run finished rendered HTML code - while ((strpos($GLOBALS['output'], '{!') > 0) || (strpos($GLOBALS['output'], '{?') > 0)) { + while (((strpos($GLOBALS['output'], '{!') > 0) || (strpos($GLOBALS['output'], '{?') > 0)) && ($cnt < 3)) { // Prepare the content and eval() it... $content = array(); $newContent = ''; @@ -135,6 +138,9 @@ function outputHtml ($htmlCode, $newLine = true) { debug_report_bug('Evaluation error:
' . htmlentities($eval) . '
'); } // END - if $GLOBALS['output'] = $newContent; + + // Count round + $cnt++; } // END - while // Output code here, DO NOT REMOVE! ;-) @@ -732,9 +738,9 @@ function generateDateTime ($time, $mode = '0') { case 'de': // German date / time format switch ($mode) { case '0': $ret = date("d.m.Y \u\m H:i \U\h\\r", $time); break; - case '1': $ret = strtolower(date("d.m.Y - H:i", $time)); break; - case '2': $ret = date("d.m.Y|H:i", $time); break; - case '3': $ret = date("d.m.Y", $time); break; + case '1': $ret = strtolower(date('d.m.Y - H:i', $time)); break; + case '2': $ret = date('d.m.Y|H:i', $time); break; + case '3': $ret = date('d.m.Y', $time); break; default: logDebugMessage(__FUNCTION__, __LINE__, sprintf("Invalid date mode %s detected.", $mode)); break; @@ -743,10 +749,10 @@ function generateDateTime ($time, $mode = '0') { default: // Default is the US date / time format! switch ($mode) { - case '0': $ret = date("r", $time); break; - case '1': $ret = date("Y-m-d - g:i A", $time); break; - case '2': $ret = date("y-m-d|H:i", $time); break; - case '3': $ret = date("y-m-d", $time); break; + case '0': $ret = date('r', $time); break; + case '1': $ret = date('Y-m-d - g:i A', $time); break; + case '2': $ret = date('y-m-d|H:i', $time); break; + case '3': $ret = date('y-m-d', $time); break; default: logDebugMessage(__FUNCTION__, __LINE__, sprintf("Invalid date mode %s detected.", $mode)); break; @@ -760,7 +766,7 @@ function generateDateTime ($time, $mode = '0') { // Translates Y/N to yes/no function translateYesNo ($yn) { // Default - $translated = "??? (" . $yn.')'; + $translated = '??? (' . $yn . ')'; switch ($yn) { case 'Y': $translated = getMessage('YES'); break; case 'N': $translated = getMessage('NO'); break; diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index c6cecbd8e5..2f0b03a870 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -105,8 +105,8 @@ if (isGetRequestElementSet('reg_ext')) { // Run SQLs on activation / deactivation switch ($active) { - case 'Y': getExtensionMode('activate'); break; - case 'N': getExtensionMode('deactivate'); break; + case 'Y': setExtensionMode('activate'); break; + case 'N': setExtensionMode('deactivate'); break; } // END - if // Run embeded SQL commands