Commit 66ac1ad0209567c27849c812ff0b6384109d5c03

Authored by Neil Blakey-Milner
1 parent 7973a6d7

When pathInfoSupport is turned off, explicitly remove whatever PATH_INFO

is passed in.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4939 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 24 additions and 18 deletions
config/dmsDefaults.php
@@ -217,25 +217,31 @@ class KTInit { @@ -217,25 +217,31 @@ class KTInit {
217 217
218 // {{{ setupServerVariables 218 // {{{ setupServerVariables
219 function setupServerVariables() { 219 function setupServerVariables() {
220 - // KTS-21: Some environments (FastCGI only?) don't set PATH_INFO  
221 - // correctly, but do set ORIG_PATH_INFO.  
222 - $path_info = KTUtil::arrayGet($_SERVER, 'PATH_INFO');  
223 - $orig_path_info = KTUtil::arrayGet($_SERVER, 'ORIG_PATH_INFO');  
224 - if (empty($path_info) && !empty($orig_path_info)) {  
225 - $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];  
226 - $_SERVER["PHP_SELF"] .= $_SERVER['PATH_INFO'];  
227 - }  
228 - $env_path_info = KTUtil::arrayGet($_SERVER, 'REDIRECT_kt_path_info');  
229 - if (empty($path_info) && !empty($env_path_info)) {  
230 - $_SERVER['PATH_INFO'] = $env_path_info;  
231 - $_SERVER["PHP_SELF"] .= $_SERVER['PATH_INFO'];  
232 - } 220 + $oKTConfig =& KTConfig::getSingleton();
  221 + $bPathInfoSupport = $oKTConfig->get("KnowledgeTree/pathInfoSupport");
  222 + if ($bPathInfoSupport) {
  223 + // KTS-21: Some environments (FastCGI only?) don't set PATH_INFO
  224 + // correctly, but do set ORIG_PATH_INFO.
  225 + $path_info = KTUtil::arrayGet($_SERVER, 'PATH_INFO');
  226 + $orig_path_info = KTUtil::arrayGet($_SERVER, 'ORIG_PATH_INFO');
  227 + if (empty($path_info) && !empty($orig_path_info)) {
  228 + $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
  229 + $_SERVER["PHP_SELF"] .= $_SERVER['PATH_INFO'];
  230 + }
  231 + $env_path_info = KTUtil::arrayGet($_SERVER, 'REDIRECT_kt_path_info');
  232 + if (empty($path_info) && !empty($env_path_info)) {
  233 + $_SERVER['PATH_INFO'] = $env_path_info;
  234 + $_SERVER["PHP_SELF"] .= $_SERVER['PATH_INFO'];
  235 + }
233 236
234 - // KTS-50: IIS (and probably most non-Apache web servers) don't  
235 - // set REQUEST_URI. Fake it.  
236 - $request_uri = KTUtil::arrayGet($_SERVER, 'REQUEST_URI');  
237 - if (empty($request_uri)) {  
238 - $_SERVER['REQUEST_URI'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']); 237 + // KTS-50: IIS (and probably most non-Apache web servers) don't
  238 + // set REQUEST_URI. Fake it.
  239 + $request_uri = KTUtil::arrayGet($_SERVER, 'REQUEST_URI');
  240 + if (empty($request_uri)) {
  241 + $_SERVER['REQUEST_URI'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']);
  242 + }
  243 + } else {
  244 + unset($_SERVER['PATH_INFO']);
239 } 245 }
240 246
241 $script_name = KTUtil::arrayGet($_SERVER, 'SCRIPT_NAME'); 247 $script_name = KTUtil::arrayGet($_SERVER, 'SCRIPT_NAME');