Fix for endless loop in outputHtml()
authorRoland Häder <roland@mxchange.org>
Tue, 27 Oct 2009 21:49:16 +0000 (21:49 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 27 Oct 2009 21:49:16 +0000 (21:49 +0000)
inc/extensions-functions.php
inc/filter-functions.php
inc/functions.php
inc/modules/admin/what-extensions.php

index daac4a8..1d90276 100644 (file)
@@ -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
index 274ded1..ce4d302 100644 (file)
@@ -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 <strong>' . $filterName . '</strong> 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 <strong>' . $filterName . '</strong> not found!');
+               //* Only for tracking: */ }
+               /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Filter chain ' . $filterName . ' not found!');
 
                // Abort here and return content
                return $data;
index fd2eab7..60efa31 100644 (file)
@@ -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:<pre>' . htmlentities($eval) . '</pre>');
                        } // 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;
index c6cecbd..2f0b03a 100644 (file)
@@ -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