--- docman.php 2003/06/11 02:32:50 1.39 +++ docman.php 2004/04/10 21:21:37 1.46 @@ -22,9 +22,31 @@ error_reporting(E_ALL) ; // how verbose ? - // from where to include auth_*.php modules? - // this is defined in global configuration file /etc/docman.conf - //$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; @@ -75,7 +97,7 @@ ////////////////////////////////////////////////////////////////// $gblTitle = "Document Manager"; - $gblVersion = "2.0-pre4"; + $gblVersion = "2.0-rc1"; $secHash = ""; @@ -92,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"); @@ -108,19 +127,19 @@ if (file_exists($gblIncDir."/lang/$lang.php")) { include($gblIncDir."/lang/$lang.php"); $html .= "-$lang"; - } else { + } elseif (file_exists($gblIncDir."/lang/default.php")) { include($gblIncDir."/lang/default.php"); } } 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")) { + if (file_exists("$gblIncDir/docman.css")) { $css = ""; $d = dirname($self); if ($d != "/") $css = $d; @@ -280,9 +299,10 @@ print "

CHANGES TO THIS $whatis
\n"; $bakcount = 0; // start from 0, skip fist backup (it's current) while ($e = array_shift($logarr)) { - if (strstr($e[4],"upload")) { + if (stristr($e[4],"upload") || stristr($e[4],"check-in")) { +print "-- $e[4] -- $bakdir/$bakcount/$name --
\n"; if (file_exists("$bakdir/$bakcount/$name")) { - $e[4]="$e[4]"; + $e[4]="$e[4]"; } $bakcount++; } @@ -831,7 +851,7 @@ } else { if (check_perm($relDir.$file,trperm_w)) { $b.="" ; + $b.="\" TITLE=\"Checkout file for edit\" onClick=\"window.setTimeout('window.location.reload()',3000); return true;\">" ; $b.=$gblIcon("checkout").""; } @@ -1580,23 +1600,13 @@ $gblDirPerms = 0750 ; // default for new dirs if (isset($HTTP_GET_VARS["STYLE"]) && $HTTP_GET_VARS["STYLE"] == "get") { + if (! headers_sent()) { + Header("Content-type: text/css"); + } include("$html/docman.css"); 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); - - // location of html files - $html = $gblIncDir."/html"; - // set fsRealmDir if (! isset($fsRealmDir)) { $fsRealmDir = "$gblIncDir/realm"; @@ -1794,7 +1804,7 @@ Error("Write denied",$RELPATH) ; $fh = fopen($path, "w") ; HTTP_POST_VAR("FILEDATA"); - fwrite($fh,$FILEDATA) ; + fwrite($fh,stripSlashes($FILEDATA)) ; fclose($fh) ; clearstatcache() ; LogIt($path,"saved changes",trperm_r);