--- docman.php 2001/01/26 09:32:48 1.29 +++ docman.php 2001/12/17 10:00:51 1.51 @@ -76,37 +76,18 @@ // error_reporting(4) ; // how verbose ? // from where to include auth_*.php modules? - $gblIncDir = "/data/docman"; + $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 !! $gblPw = ""; - $htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; - if (! file_exists($htusers_file)) { - $htusers=fopen($htusers_file,"a+"); - fputs($htusers,"# Change owner of $htusers_file to root !!\n"); - fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n"); - fclose($htusers); - } - $htusers=fopen($htusers_file,"r"); - while($user = fgetcsv($htusers,255,":")) { - if ($user[0] == $GLOBALS["PHP_AUTH_USER"]) { - $gblUserName=$user[1]; - $gblPw=$user[2]; - if (substr($gblPw,0,5) == "auth_" && file_exists("$gblIncDir/$gblPw.php")) { - require("$gblIncDir/$gblPw.php"); - if ($gblPw($user)) { - $gblPw=md5($PHP_AUTH_USER.$PHP_AUTH_PW); - } - } - $gblEmail=$user[3]; - continue ; - } - } - fclose($htusers); - // date format // $gblDateFmt="D, F d, Y"; $gblDateFmt="Y-m-d"; @@ -144,8 +125,16 @@ $gblImages = array( ".jpg",".jpeg",".gif",".png",".ico", ".bmp",".xbm") ; + // which files to hide (separated by ,) + $gblHide = ""; + + // Where are users? (by default in .htusers file) + $gblUsers = "htusers_file"; + ////////////////////////////////////////////////////////////////// + $gblVersion = "1.8-dev"; + function StartHTML($title,$text="") { $title = "Document Manager " . $title ; @@ -156,7 +145,7 @@
-= date($GLOBALS[gblDateFmt]) ?> -
-= date($GLOBALS[gblTimeFmt]) ?> -
-= $GLOBALS[gblUserName] ?>
- [?relogin== $GLOBALS[gblPw] ?>">logout]
+= date($gblDateFmt) ?> -
+= date($gblTimeFmt) ?> -
+= $gblUserName ?>
+
+ [= $url_title ?>]
-
ANYPORTAL(php) Site Manager
-
+
+Document Manager = $gblVersion ?>, based on ANYPORTAL(php) Site Manager
+
© 1999 by ANYPORTAL,
© 2000 by d@nger.org,
© 2000 by DbP
@@ -227,7 +234,7 @@
function DetailPage($fsRoot,$relDir,$fn) {
- global $gblEditable, $gblImages ;
+ global $gblEditable, $gblImages, $webRoot ;
$self = $GLOBALS["PHP_SELF"] ;
$relPath = $relDir . "/" . $fn ;
@@ -246,7 +253,11 @@
Error("Creation denied",$relDir) ;
$text = "Use this page to view, modify or " ;
- $text .= "delete a single document on this " ;
+ if (is_dir($fsPath)) {
+ $text .="delete a directory on this " ;
+ } else {
+ $text .= "delete a single document on this " ;
+ };
$text .= "web site." ;
$title = "(Detail Page)" ;
StartHTML($title, $text) ;
@@ -256,18 +267,23 @@
$fsize = filesize($fsPath) ;
$fmodified = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", filemtime($fsPath)) ;
$faccessed = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", fileatime($fsPath)) ;
- echo " file size: " . $fsize . " Bytes
" ;
+ $fuid=fileowner($fsPath);
+ $fgid=filegroup($fsPath);
+ $userinfo = posix_getpwuid($fuid);
+ $grpinfo = posix_getgrgid($fgid);
+ echo "";
+ if (!is_dir($fsPath)) echo " file size: " . $fsize . " Bytes
" ;
}
- if ( $editable && ($writable || !$exists) && !$file_lock ) {
+ if ( !is_dir($fsPath) && $editable && ($writable || !$exists) && !$file_lock ) {
$fh = fopen($fsPath,"a+") ;
rewind($fh) ;
$fstr = fread($fh,filesize($fsPath)) ;
@@ -295,7 +311,7 @@
}
if ( !$file_lock && $ext!="" && strstr(join(' ',$gblImages),$ext) ) {
$info = getimagesize($fsPath) ;
- $tstr = "" ;
// echo htmlentities($tstr) . "
" ;
echo "last modified: " . $fmodified . "
" ;
echo "last accessed: " . $faccessed . "
" ;
- echo " owner: " . fileowner($fsPath) . "
" ;
- echo " group: " . filegroup($fsPath) . "
" ;
+ echo " owner: " . $userinfo["name"] . " [$fuid]
" ;
+ echo " group: " . $grpinfo["name"] . " [$fgid]
" ;
echo " permissions: " ;
echo printf( "%o", fileperms($fsPath) ) . "" ;
echo "
" . $tstr ;
@@ -369,17 +385,22 @@
$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]));
}
fclose($log);
- print "
CHANGES TO THIS FILE\n";
+ if (is_dir("$fsDir/$fn")) {
+ $whatis="DIRECTORY";
+ } else {
+ $whatis="FILE";
+ }
+ 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 (file_exists("$bakdir/$bakcount/$name")) {
- $e[4]="$e[4]";
+ $e[4]="$e[4]";
}
$bakcount++;
}
@@ -640,23 +661,21 @@
function Navigate($fsRoot,$relDir) {
- global $gblEditable, $gblIcon, $gblModDays ;
+ global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide ;
$self = $GLOBALS["PHP_SELF"] ;
- if (isset($GLOBALS["HTTPS"]) && $GLOBALS["HTTPS"] == "on") {
- $webRoot = "https://" . $GLOBALS["HTTP_HOST"] ;
- } else {
- $webRoot = "http://" . $GLOBALS["HTTP_HOST"] ;
- }
- $fsDir = $fsRoot . $relDir . "/" ; // current directory
+
+ $fsDir = $fsRoot . $relDir . "/" ; // current directory
if (!is_dir($fsDir)) Error("Dir not found",$relDir) ;
+ $hide_items=",$gblHide,";
+
// read directory contents
if ( !($dir = @opendir($fsDir)) )
Error("Read Access denied",$relDir) ;
while ($item = readdir($dir)) {
- if ( $item == ".." || $item == "." || substr($item,0,1) == "." ) continue ;
+ if ( substr($item,0,1) == "." || strstr($hide_items,",$item,") ) continue ;
if ( is_dir($fsDir . $item) ) {
$dirList[] = $item ;
} else if ( is_file($fsDir . $item) ) {
@@ -675,7 +694,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) ;
@@ -696,7 +715,7 @@
CELLSPACING=3 WIDTH=\"100%\">" ;
// updir bar
- if ($fsDir != $fsRoot) {
+ if (chopsl($fsDir) != chopsl($fsRoot)) {
$parent = dirname($relDir) ;
if ($parent == "") $parent = "/" ;
?>
@@ -708,23 +727,36 @@
1) {
+ $out.="s";
+ }
+ return $out;
+}
+
// output subdirs
if (sizeof($dirList) > 0) {
sort($dirList) ;
?>
-
+
DIRECTORY NAME
" . $dir . "/" ;
+ $note_html="".$gblIcon("note")."".ReadNote($fsDir.$dir);
?>
-DIRECTORY NAME (= plural("dir",sizeof($dirList)) ?>) DIRECTORY NOTE
+= $gblIcon("fldr") ?>
-= $tstr ?>
+
+= $gblIcon("fldr") ?>
+= $tstr ?>
+= $note_html ?>
-
= $webRoot . $relDir ?>
DOCUMENT NAME
+
@@ -831,7 +863,7 @@
}
- if ($emptyDir) {
+ if ($emptyDir && $relDir != "") {
?>
DOCUMENT NAME (= plural("file",sizeof($fileList)) ?>)
= $gblIcon("blank").$gblIcon("blank") ?>
NOTE
LAST UPDATE FILE SIZE