--- docman.php 2002/07/28 11:39:59 1.13 +++ docman.php 2002/07/28 12:14:18 1.14 @@ -1523,7 +1523,7 @@ // try to add dir to script name to realm var if (is_dir("$fsRealmDir/$realm/".dirname($HTTP_SERVER_VARS[SCRIPT_NAME]))) { - $realm .= "/".dirname($HTTP_SERVER_VARS[SCRIPT_NAME]); + $realm .= dirname($HTTP_SERVER_VARS[SCRIPT_NAME]); $realm_sep = "/"; } else { $realm_sep = "."; @@ -1818,7 +1818,7 @@ // $A=Co : checkout file $D/$F // $A=Ci : checkin file $D/$F // $A=V : view file (do nothing except log) - // $A=I : include file .$F.php from $gblFsRoot + // $A=I : include file .$F.php from [$gblIncDir|realm]/include_php // default : display directory $D switch ($A) { @@ -1873,11 +1873,17 @@ EndHTML() ; exit; case "I" : - $F=stripSlashes($F); - $inc_file="${gblFsRoot}/.${F}.php"; - if (!isset($F) || $F == "" || !file_exists($inc_file)) Error("Fatal error $inc_file"); // can't find file to include + if (! isset($F) || $F == "") + Error("Can't find file to include","Your request didn't specify file to include which should be in variable F like $HTTP_SERVER_VARS[REQUEST_URI]&F=include_php_file",1); + if (file_exists("$gblIncDir/include_php/$F.php")) { + $inc_file="$gblIncDir/include_php/${F}.php"; + } elseif (file_exists("$fsRealmDir/$realm/$F.php")) { + $inc_file="$fsRealmDir/$realm/${F}.php"; + } else { + Error("Can't find file to include","Can't find include file $F.php in $gblIncDir/include_php/ nor $fsRealmDir/$realm/",1); + } if (!is_readable($inc_file)) - Error("Read access to include file denied",".${F}.php"); + Error("Read access to include file denied","Can't read PHP include file $inc_file. Fix permissions on it."); $text = "Your include file should define \$text variable which holds this text and \$title variable which is page title"; $title = "You should define \$title variable with page title"; include($inc_file);