From 997888bc5358ed7e9434773c8a8a1366d9c0cc56 Mon Sep 17 00:00:00 2001 From: Graham Cole <chckens@sucs.org> Date: Fri, 30 Sep 2011 13:49:13 +0000 Subject: [PATCH] automagically figure out whether to use [ORIG_]PATH_INFO, and move dbuser to settings --- htdocs/index.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index d6456b0..9ee2aad 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -14,7 +14,6 @@ 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"; @@ -93,9 +92,15 @@ 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); +// Need to use ORIG_PATH_INFO in user homedirs +if (isset($_SERVER['PATH_INFO'])) { + $pathinfo = $_SERVER['PATH_INFO']; +} else { + $pathinfo = @$_SERVER['ORIG_PATH_INFO']; +} // Determine which component to run -$pathlist = explode('/', parse_url(@$_SERVER['PATH_INFO'],PHP_URL_PATH)); +$pathlist = explode('/', parse_url($pathinfo,PHP_URL_PATH)); while (end($pathlist) === "") array_pop($pathlist); $smarty->assign_by_ref("pathlist", $pathlist); $path = ''; @@ -131,6 +136,7 @@ $smarty->assign("title", "Set Me"); $smarty->assign("body", "Empty Body"); include($base."components/menu.php"); +//include($base."components/search.php"); // Load the component $comppath = $base."components/".$component['component'].".php"; @@ -174,7 +180,7 @@ if (@$displaytime) { $smarty->assign("totaltime", $totaltime); } -$smarty->display("foot".$language['file'].".tpl"); + $smarty->display("foot".$language['file'].".tpl"); } else { echo $compoutput; } -- GitLab