From 8ad610e75e7419347c18c5a269bb67b78bcbd273 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Thu, 25 Oct 2012 15:45:52 +0000
Subject: [PATCH] Don't attempt to load configuration or count modules in
 installation phase

---
 inc/config-functions.php   | 6 ++++++
 inc/filters.php            | 8 +++++++-
 inc/template-functions.php | 9 +++------
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/inc/config-functions.php b/inc/config-functions.php
index 41505b26dd..310fc6bae3 100644
--- a/inc/config-functions.php
+++ b/inc/config-functions.php
@@ -372,6 +372,12 @@ function updateConfiguration ($entries, $values, $updateMode = '', $config = '0'
 
 // Filter for loading configuration
 function FILTER_LOAD_CONFIGURATION ($no = '0') {
+	// Is installation phase?
+	if (isInstallationPhase()) {
+		// Then don't load any configuration
+		return;
+	} // END - if
+
 	// Is the value null, it comes from the 'init' filter chain
 	if (is_null($no)) {
 		$no = '0';
diff --git a/inc/filters.php b/inc/filters.php
index 91852a46c6..a4adfd44d6 100644
--- a/inc/filters.php
+++ b/inc/filters.php
@@ -711,7 +711,7 @@ function FILTER_DETERMINE_WHAT_ACTION () {
 			// Is the module registered?
 			if (!isModuleRegistered(getRequestElement('module'))) {
 				// Is not a valid module
-				redirectToUrl('index.php');
+				redirectToUrl('modules.php?module=index');
 			} // END - if
 
 			// Is the request element set?
@@ -877,6 +877,12 @@ function FILTER_INIT_RANDOM_NUMBER () {
 
 // Update module counter
 function FILTER_COUNT_MODULE () {
+	// Is installation phase?
+	if (isInstallationPhase()) {
+		// Then don't count any modules
+		return;
+	} // END - if
+
 	//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getModule()=' . getModule() . ' - ENTERED!');
 	// Do count all other modules but not accesses on CSS file css.php!
 	SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `clicks`=`clicks`+1 WHERE `module`='%s' LIMIT 1",
diff --git a/inc/template-functions.php b/inc/template-functions.php
index f296be7355..7bfe4b9ddd 100644
--- a/inc/template-functions.php
+++ b/inc/template-functions.php
@@ -187,11 +187,8 @@ function compileFinalOutput () {
 	// Do the final (general) compilation
 	$GLOBALS['__output'] = doFinalCompilation($GLOBALS['__output']);
 
-	// Is the output mode not HTML?
-	if (!isHtmlOutputMode()) {
-		// Then remove entities
-		$GLOBALS['__output'] = compileUriCode($GLOBALS['__output']);
-	} // END - if
+	// Compile any other things out
+	$GLOBALS['__output'] = compileUriCode($GLOBALS['__output']);
 
 	// Extension 'rewrite' installed?
 	if ((isExtensionActive('rewrite')) && (!isCssOutputMode())) {
@@ -1381,7 +1378,7 @@ function compileUriCode ($code, $simple = TRUE) {
 	} // END - if
 
 	// Compile QUOT and other non-HTML codes
-	$code = str_replace($charsCompile['from'], $charsCompile['to'], decodeEntities($code));
+	$code = str_replace($charsCompile['from'], $charsCompile['to'], $code);
 	//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'code=' . $code);
 
 	// Return compiled code
-- 
2.39.5