--- docman.php 2001/06/21 08:54:54 1.44 +++ docman.php 2001/12/14 16:58:27 1.48 @@ -78,6 +78,11 @@ // from where to include auth_*.php modules? $gblIncDir = "/home/httpd/docman"; + // do we want to force download? (default is 0 for backward + // compatibility, but it's defined as 1 in docman.conf for all + // future applications! + $gblForceDownload = 0; + // username/password should not be system // usernames/passwords !! @@ -128,6 +133,8 @@ ////////////////////////////////////////////////////////////////// + $gblVersion = "1.8-dev"; + function StartHTML($title,$text="") { $title = "Document Manager " . $title ; @@ -138,7 +145,7 @@ <?= $host . " " . $title ?> - + @@ -157,17 +164,21 @@ ////////////////////////////////////////////////////////////////// function EndHTML() { + +global $gblDateFmt, $gblTimeFmt, $gblUserName, $PHP_SELF, $gblPw, $gblVersion; + ?>

- - - - - - [?relogin=">logout] + - + - + + [logout] -
ANYPORTAL(php) Site Manager -
+
+Document Manager , based on ANYPORTAL(php) Site Manager +
© 1999 by ANYPORTAL, © 2000 by d@nger.org, © 2000 by DbP @@ -360,7 +371,7 @@ $log=fopen($logname,"r"); $cl1=" class=LST"; $cl2=""; $logarr = array(); - while($line = fgetcsv($log,255,"\t")) { + while($line = fgetcsv($log,512,"\t")) { $cl=$cl1; $cl1=$cl2; $cl2=$cl; array_unshift($logarr,array($cl,$line[0],$line[1],$line[2],$line[3])); } @@ -669,7 +680,7 @@ // scan deleted files if ( $GLOBALS[show_deleted] == 1 && ($dir = @opendir("$fsDir/.del")) ) { while ($item = readdir($dir)) { - if ( substr($item,0,1) == "." ) continue ; + if ( substr($item,0,1) == "." || strstr($hide_items,",$item,") ) continue ; $fileList[] = ".del/$item" ; } closedir($dir) ; @@ -838,7 +849,7 @@

@@ -1134,6 +1145,7 @@ $log=fopen("$gblFsRoot/.changelog","a+"); if (substr($target,0,strlen($gblFsRoot)) == $gblFsRoot) $target=substr($target,strlen($gblFsRoot),strlen($target)-strlen($gblFsRoot)); + $msg=str_replace("\t"," ",$msg); fputs($log,time()."\t$target\t$GLOBALS[gblUserName]\t$msg\n"); fclose($log); @@ -1145,7 +1157,12 @@ if (!file_exists("$gblFsRoot/.changelog")) return; $log=fopen("$gblFsRoot/.changelog","r"); $logarr = array(); - while($line = fgetcsv($log,255,"\t")) { + while($line = fgetcsv($log,512,"\t")) { + $line[0] .= sizeof($line); + while (sizeof($line) > 4) { + $tmp = array_pop($line); + $line.=" $tmp"; + } if ($day!=1 || ($day==1 && (time()-$line[0] < 24*60*60))) { array_unshift($logarr,array($line[0],$line[1],$line[2],$line[3])); } @@ -1167,6 +1184,27 @@ ////////////////////////////////////////////////////////////////// +function Download($path) { + global $HTTP_USER_AGENT; + $file=basename($path); + $size = filesize($path); + //header("Content-Type: application/octet-stream"); + header("Content-Type: application/force-download"); + header("Content-Length: $size"); + // IE5.5 just downloads index.php if we don't do this + if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT)) { + header("Content-Disposition: filename=$file"); + } else { + header("Content-Disposition: attachment; filename=$file"); + } + header("Content-Transfer-Encoding: binary"); + $fh = fopen($path, "r"); + fpassthru($fh); +} + + +////////////////////////////////////////////////////////////////// + // MAIN PROGRAM // ============ // query parameters: capital letters @@ -1450,8 +1488,7 @@ case "Co" : // checkout Lock("$gblFsRoot/$relDir/$F"); - header("Content-Disposition: attachment; filename=$F" ); - Header("Location: $webRoot".urlpath("$relDir/$F")); + Download("$gblFsRoot/$relDir/$F"); exit; case "Ci" : $F=stripSlashes($F); @@ -1467,8 +1504,12 @@ case "V" : // view LogIt("$gblFsRoot/$relDir/$F","viewed"); - header("Content-Disposition: attachment; filename=$F" ); - Header("Location: $webRoot".urlpath("$relDir/$F")); + if ($gblForceDownload) { + Download("$gblFsRoot/$relDir/$F"); + } else { + header("Content-Disposition: attachment; filename=$F" ); + Header("Location: $webRoot".urlpath("$relDir/$F")); + } exit; case "Ch" : StartHTML("(File changes)","All changes chronologicaly...");