--- docman.php 2003/05/05 15:28:02 1.37
+++ docman.php 2003/06/12 18:09:01 1.40
@@ -22,8 +22,31 @@
error_reporting(E_ALL) ; // how verbose ?
- // from where to include auth_*.php modules?
- $gblIncDir = "/data/docman2";
+ // try to do some guessing about configuration
+ $script = $HTTP_SERVER_VARS["SCRIPT_FILENAME"];
+ if (is_link($script)) $script=readlink($script);
+ $gblIncDir = dirname($script);
+ $html = $gblIncDir."/html";
+
+ // location of master docman configuration file
+ $docman_conf = "/etc/docman.conf";
+ if (! file_exists($docman_conf)) {
+ $error = "Can't find master configuration file $docman_conf. See docman2/doc/upgrade.html#docman_conf for more informations";
+
+ error_log("docman: $error");
+ Error("docman not installed completly",$error);
+ }
+ include($docman_conf);
+
+ if (! isset($gblIncDir)) {
+ $error = "Can't findi \$gblIncDir in master configuration file $docman_conf. This variable should point to docman installation directory";
+
+ error_log("docman: $error");
+ Error("docman not installed completly",$error);
+ }
+
+ // location of html files
+ $html = $gblIncDir."/html";
// force download on view (so it won't open in associated application)
$gblForceDownload = 0;
@@ -74,13 +97,10 @@
//////////////////////////////////////////////////////////////////
$gblTitle = "Document Manager";
- $gblVersion = "2.0-pre2";
+ $gblVersion = "2.0-pre4";
$secHash = "";
- // location of html files
- $html = $gblIncDir."/html";
-
// load language
if (isset($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"])) {
LoadLanguage($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]);
@@ -94,9 +114,6 @@
// for security and configuration
$realm=$HTTP_SERVER_VARS["HTTP_HOST"];
- $fsDocumentRoot = dirname($HTTP_SERVER_VARS["SCRIPT_FILENAME"]);
- if ($fsDocumentRoot == "") Error("Configuration error","Can't get SCRIPT_FILENAME from your web server. Please set \$fsDocumentRoot in \$",1);
-
// globals for later
$gblLogin = HTTP_SERVER_VAR("PHP_AUTH_USER");
$gblPasswd = HTTP_SERVER_VAR("PHP_AUTH_PW");
@@ -117,17 +134,19 @@
function StartHTML($title,$text="") {
- global $html,$fsDocumentRoot,$gblTitle,$HTTP_SERVER_VARS;
+ global $html,$gblIncDir,$gblTitle,$HTTP_SERVER_VARS;
$host = $HTTP_SERVER_VARS["HTTP_HOST"] ;
$self = $HTTP_SERVER_VARS["PHP_SELF"] ;
- if (file_exists("$fsDocumentRoot/docman.css")) {
- $css=dirname($self)."/docman.css";
+ if (file_exists("$gblIncDir/docman.css")) {
+ $css = "";
+ $d = dirname($self);
+ if ($d != "/") $css = $d;
+ $css .= "/docman.css";
} else {
$css=$self."?STYLE=get";
}
-
include("$html/head.html");
}
@@ -1584,16 +1603,7 @@
exit;
}
- // location of master docman configuration file
- $docman_conf = "/etc/docman.conf";
- if (! file_exists($docman_conf)) {
- $error = "Can't find master configuration file $docman_conf. See docman2/doc/upgrade.html#docman_conf for more informations";
-
- error_log("docman: $error");
- Error("docman not installed completly",$error);
- }
- include($docman_conf);
-
+ // set fsRealmDir
if (! isset($fsRealmDir)) {
$fsRealmDir = "$gblIncDir/realm";
}