From 77f2388ac2523ced782d68f2fa172a5e8f8254a8 Mon Sep 17 00:00:00 2001
From: Denis Walker <dez@sucs.org>
Date: Wed, 8 Jun 2011 12:09:24 +0000
Subject: [PATCH] Moves menu loading to after page actions have been performed

---
 htdocs/index.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/htdocs/index.php b/htdocs/index.php
index 231a10f..0cff964 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -40,7 +40,7 @@ $smarty->assign("baseurl", $baseurl);
 // Initialise the database
 require("/usr/share/php/adodb/adodb.inc.php");
 $DB = NewADOConnection('postgres8');
-$DB->Connect('dbname='.$dbname.' user=apache');
+$DB->Connect('dbname='.$dbname.' user=dez');
 $DB->SetFetchMode(ADODB_FETCH_ASSOC);
 
 // Include the session library
@@ -92,9 +92,8 @@ if (($n=strpos($ssl_path,"?"))!==FALSE) $ssl_path=substr($ssl_path,0,$n);
 $ssl_url = "https://".$preferred_hostname.$ssl_path;
 $smarty->assign("ssl_url", $ssl_url);
 
-
 // Determine which component to run
-$pathlist = explode('/', parse_url(@$_SERVER['PATH_INFO'],PHP_URL_PATH));
+$pathlist = explode('/', parse_url(@$_SERVER['ORIG_PATH_INFO'],PHP_URL_PATH));
 while (end($pathlist) === "") array_pop($pathlist);
 $smarty->assign_by_ref("pathlist", $pathlist);
 $path = '';
@@ -129,7 +128,6 @@ if ($path == "") $path="/";
 $smarty->assign("title", "Set Me");
 $smarty->assign("body", "Empty Body");
 
-include($base."components/menu.php");
 
 // Load the component
 $comppath = $base."components/".$component['component'].".php";
@@ -146,6 +144,8 @@ if (file_exists($comppath)) {
 // Pass error/warning/info messages to the template
 $smarty->assign("user_messages", $messages);
 
+include($base."components/menu.php");
+
 // Render the results
 if (!(isset($no_template)) || (!$no_template)) {
 // Send appropriate Content-Type
-- 
GitLab