From ebeb3ba032915b53d5f87c97418aa5f6325c6297 Mon Sep 17 00:00:00 2001
From: Denis Walker <dez@sucs.org>
Date: Sun, 12 Jun 2011 10:06:35 +0000
Subject: [PATCH] Fixes static inclusion of db username Moves menu generation
 after component runs

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

diff --git a/htdocs/index.php b/htdocs/index.php
index 0cff964..f41ee8a 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -14,6 +14,7 @@ if (@$displaytime) {
     Settings
    -------------------------------------------------------- */
 
+$dbuser="apache"; // Temporary bodge by dez - should be in settings.php
 include("settings.php");
 if (!(isset($base) && isset($preferred_hostname) && isset($dbname))) {
 	echo "Website unconfigured";
@@ -40,7 +41,7 @@ $smarty->assign("baseurl", $baseurl);
 // Initialise the database
 require("/usr/share/php/adodb/adodb.inc.php");
 $DB = NewADOConnection('postgres8');
-$DB->Connect('dbname='.$dbname.' user=dez');
+$DB->Connect('dbname='.$dbname.' user='.$dbuser);
 $DB->SetFetchMode(ADODB_FETCH_ASSOC);
 
 // Include the session library
@@ -92,8 +93,9 @@ 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['ORIG_PATH_INFO'],PHP_URL_PATH));
+$pathlist = explode('/', parse_url(@$_SERVER['PATH_INFO'],PHP_URL_PATH));
 while (end($pathlist) === "") array_pop($pathlist);
 $smarty->assign_by_ref("pathlist", $pathlist);
 $path = '';
@@ -128,7 +130,6 @@ if ($path == "") $path="/";
 $smarty->assign("title", "Set Me");
 $smarty->assign("body", "Empty Body");
 
-
 // Load the component
 $comppath = $base."components/".$component['component'].".php";
 $compoutput = "";
-- 
GitLab