--- docman.php 2000/08/04 10:43:23 1.9
+++ docman.php 2000/09/07 10:19:34 1.19
@@ -66,6 +66,8 @@
mixed file/directory output (add type to each entry,
real support for links)
retrieve old versions of files (overwritten)
+ show last lock date
+
*/
//////////////////////////////////////////////////////////////////
@@ -106,6 +108,7 @@
if ($user[0] == $GLOBALS["PHP_AUTH_USER"]) {
$gblUserName=$user[1];
$gblPw=$user[2];
+ $gblEmail=$user[3];
continue ;
}
}
@@ -118,8 +121,11 @@
$gblDateFmt="Y-m-d";
$gblTimeFmt="H:i:s";
-// Number of backup files to keep
- $gblNumBackups=5;
+ // Number of backup files to keep
+ $gblNumBackups=3;
+
+ // show red star if newer than ... days
+ $gblModDays=1;
// choose GifIcon below unless you have the M$
// WingDings font installed on your system
@@ -293,7 +299,7 @@
CHANGES TO THIS FILE
\n";
$log=fopen($logname,"r");
$cl1=" class=lst"; $cl2="";
+ $logarr = array();
while($line = fgetcsv($log,255,"\t")) {
$cl=$cl1; $cl1=$cl2; $cl2=$cl;
- print "$line[0] | $line[1] | $line[2] | $line[3] |
\n";
+ array_unshift($logarr,array($cl,$line[0],$line[1],$line[2],$line[3]));
}
fclose($log);
+ print "
CHANGES TO THIS FILE
\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]";
+ }
+ $bakcount++;
+ }
+ print "$e[1] | $e[2] | $e[3] | $e[4] |
\n";
+ }
print "
";
}
@@ -628,7 +646,7 @@
function Navigate($fsRoot,$relDir) {
- global $gblEditable, $gblIcon ;
+ global $gblEditable, $gblIcon, $gblModDays ;
$self = $GLOBALS["PHP_SELF"] ;
if (isset($GLOBALS["HTTPS"]) && $GLOBALS["HTTPS"] == "on") {
@@ -677,6 +695,7 @@
$text .= ", undelete";
}
$text .= " or revise files on this web site." ;
+ $text .= "
Examine list of files changed in last day or all changes.";
StartHTML("(Navigate)",$text) ;
echo " time() ) {
+ if ( ($mod + $gblModDays*86400) > time() ) {
$a = " * " ;
+ $a .= " than $gblModDays days\"> * " ;
}
$file_lock=CheckLock($path);
@@ -831,11 +850,11 @@
|
|
|
-To just view file without editing, select it's filename (don't edit files which are opened this way!)
-To edit file select = $gblIcon("checkout") ?> to check-out
-and edit it locally. After editing is over, select filename or = $gblIcon("checkin") ?> to check-in (update copy of file on server).
-If you select icon left from filename, you will get detailed information
-about file, as well as delete, rename and annotation options.
+
+if (file_exists(".info.inc")) {
+ include(".info.inc");
+}
+?>
|
|
|
@@ -1086,6 +1105,62 @@
//////////////////////////////////////////////////////////////////
+// recursivly delete directory
+
+function rrmdir($dir) {
+ $handle=opendir($dir);
+ while ($file = readdir($handle)) {
+ if ($file != "." && $file != "..") {
+ if (is_dir("$dir/$file"))
+ rrmdir("$dir/$file");
+ else
+ if (! @unlink("$dir/$file")) return(0);
+ }
+ }
+ closedir($handle);
+ return @rmdir($dir);
+}
+
+//////////////////////////////////////////////////////////////////
+
+function ChangeLog($target,$msg) {
+
+ global $gblFsRoot;
+ $log=fopen("$gblFsRoot/.changelog","a+");
+ if (substr($target,0,strlen($gblFsRoot)) == $gblFsRoot)
+ $target=substr($target,strlen($gblFsRoot),strlen($target)-strlen($gblFsRoot));
+ fputs($log,time()."\t$target\t$GLOBALS[gblUserName]\t$msg\n");
+ fclose($log);
+
+}
+
+function DisplayChangeLog($day) {
+
+ global $gblFsRoot;
+ if (!file_exists("gblFsRoot/.changelog")) return;
+ $log=fopen("$gblFsRoot/.changelog","r");
+ $logarr = array();
+ while($line = fgetcsv($log,255,"\t")) {
+ if ($day!=1 || $day==1 && $line[0]-time() < 24*60) {
+ array_unshift($logarr,array($line[0],$line[1],$line[2],$line[3]));
+ }
+ }
+ fclose($log);
+ $cl1=" class=lst"; $cl2="";
+ print "\n";
+ while ($e = array_shift($logarr)) {
+ $cl=$cl1; $cl1=$cl2; $cl2=$cl;
+ $date = date("$GLOBALS[gblDateFmt]", $e[0]);
+ $time = date("$GLOBALS[gblTimeFmt]", $e[0]);
+ $dir = dirname($e[1]);
+ $file = basename($e[1]);
+ print "$date | $time | $dir/$file | $e[2] | $e[3] |
\n";
+ }
+ print "
";
+}
+
+//////////////////////////////////////////////////////////////////
+
// MAIN PROGRAM
// ============
// query parameters: capital letters
@@ -1179,10 +1254,11 @@
if (isset($FILENAME)) {
Unlock($target);
}
+ ChangeLog($target,"updated");
break ;
case "SAVE" :
- $path = $gblFsRoot . escapeshellcmd($RELPATH) ;
+ $path = $gblFsRoot . $RELPATH ;
$writable = is_writeable($path) ;
$legaldir = is_writeable(dirname($path)) ;
$exists = (file_exists($path)) ? 1 : 0 ;
@@ -1194,6 +1270,7 @@
fclose($fh) ;
clearstatcache() ;
Logit($path,"saved changes");
+ ChangeLog($path,"saved changes");
break ;
case "CREATE" :
@@ -1224,6 +1301,7 @@
}
$tstr = "$PHP_SELF?A=E&D=".urlencode($relDir)."&F=".urlencode($FN) ;
header("Location: " . $tstr) ;
+ ChangeLog($target,"created");
exit ;
}
break ;
@@ -1256,7 +1334,7 @@
}
}
else { // delete directory
- if ( ! @rmdir($fsDir) ) {
+ if ( ! @rrmdir($fsDir) ) {
Error("Rmdir failed", $tstr . $fsDir) ;
}
else {
@@ -1287,6 +1365,9 @@
safe_rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME");
safe_rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME");
safe_rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME");
+ for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) {
+ safe_rename("$fsDir/.bak/$i/$FN","$fsDir/.bak/$i/$NEWNAME");
+ }
break ;
@@ -1341,6 +1422,7 @@
case "Co" :
// checkout
Lock("$gblFsRoot/$relDir/$F");
+ header("Content-Disposition: attachment; filename=$F" );
Header("Location: ".urlpath("$relDir/$F"));
exit;
case "Ci" :
@@ -1356,8 +1438,19 @@
case "V" :
// view
LogIt("$gblFsRoot/$relDir/$F","viewed");
+ header("Content-Disposition: attachment; filename=$F" );
Header("Location: ".urlpath("$relDir/$F"));
exit;
+ case "Ch" :
+ StartHTML("(File changes)","All changes chronologicaly...");
+ DisplayChangeLog(0); // all
+ EndHTML() ;
+ exit;
+ case "Ch1" :
+ StartHTML("(File changes)","Changes to files in last day...");
+ DisplayChangeLog(1);
+ EndHTML() ;
+ exit;
}
// default: display directory $relDir