\n";
$bakcount = 0; // start from 0, skip fist backup (it's current)
while ($e = array_shift($logarr)) {
if (strstr($e[4],"upload")) {
@@ -680,23 +694,36 @@
1) {
+ $out.="s";
+ }
+ return $out;
+}
+
// output subdirs
if (sizeof($dirList) > 0) {
sort($dirList) ;
?>
- | DIRECTORY NAME |
+ | DIRECTORY NAME (= plural("dir",sizeof($dirList)) ?>) | DIRECTORY NOTE |
" . $dir . "/" ;
+ $note_html="".$gblIcon("note")."".ReadNote($fsDir.$dir);
?>
-= $gblIcon("fldr") ?> |
-= $tstr ?> |
+
+
+= $gblIcon("fldr") ?> |
+= $tstr ?> |
+= $note_html ?> |
| = $webRoot . $relDir ?>
|
- | DOCUMENT NAME |
+
| DOCUMENT NAME (= plural("file",sizeof($fileList)) ?>) |
= $gblIcon("blank").$gblIcon("blank") ?> |
NOTE |
LAST UPDATE | FILE SIZE |
@@ -837,7 +864,8 @@
NAME
-
+
+
OR UPLOAD A FILE
@@ -1038,12 +1066,40 @@
//////////////////////////////////////////////////////////////////
-function safe_rename($from,$to) {
- if (file_exists($from) && is_writable(dirname($to))) {
- rename($from,$to);
+function safe_rename($fromdir,$fromfile,$tofile) {
+ function try_rename($from,$to) {
+# print "$from -> $to\n";
+ if (file_exists($from) && is_writeable(dirname($to))) {
+ rename($from,$to);
+ }
+ }
+
+ function try_dir($todir) {
+ if (! file_exists($todir)) {
+ mkdir($todir,0700);
+ }
+ }
+
+ $to="$fromdir/$tofile";
+ $todir=dirname($to);
+ $tofile=basename($to);
+
+# print "$fromdir / $fromfile -> $todir / $tofile\n\n";
+
+ try_rename("$fromdir/$fromfile","$todir/$tofile");
+ try_dir("$todir/.log");
+ try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile");
+ try_dir("$todir/.note");
+ try_rename("$fromdir/.note/$fromfile","$todir/.note/$tofile");
+ try_dir("$todir/.lock");
+ try_rename("$fromdir/.lock/$fromfile","$todir/.lock/$tofile");
+ try_dir("$todir/.bak");
+ for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) {
+ try_rename("$fromdir/.bak/$i/$fromfile","$todir/.bak/$i/$tofile");
}
}
+
//////////////////////////////////////////////////////////////////
// recursivly delete directory
@@ -1121,11 +1177,13 @@
$htusers_file=dirname($SCRIPT_FILENAME)."/.htusers";
if (! file_exists($htusers_file)) {
- if (is_writable($htuser_file)) {
+ if (is_writeable(dirname($SCRIPT_FILENAME))) {
$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);
+ Error("Proto user file created!","Please edit $htusers_file and set it correct permissions (not writable by web server as it is now!). You can add users using adduser.pl script!");
+ exit;
} else {
Error("Can't create proto user file!","Please make directory ".dirname($htusers_file)." writable or create .htusers file by hand using adduser.pl script!");
exit;
@@ -1165,6 +1223,8 @@
$relDir = urldecode($D) ; // then use GET
}
+ $relDir=stripSlashes($relDir);
+
if ($relDir == "/") $relDir = "" ;
// default : website root = ""
@@ -1199,6 +1259,10 @@
$FN=stripSlashes($FN);
+ if (file_exists("$fsScriptDir/.docman.conf")) {
+ include("$fsScriptDir/.docman.conf");
+ }
+
switch ($POSTACTION) {
case "UPLOAD" :
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ;
@@ -1274,7 +1338,7 @@
// this functionality is doubled in DetailView().
// better keep it here altogether
// chmod perms to $gblFilePerms
- if ( file_exists($path) && !is_writable($path) )
+ if ( file_exists($path) && !is_writeable($path) )
Error("File not writable", $relPath) ;
$fh = fopen($path, "w+") ;
if ($fh) {
@@ -1346,14 +1410,7 @@
if ( $CONFIRM != "on" ) break ;
Logit("$fsDir/$FN","renamed $FN to $NEWNAME");
- safe_rename("$fsDir/$FN","$fsDir/$NEWNAME");
- 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");
- }
-
+ safe_rename($fsDir,$FN,$NEWNAME);
break ;
case "NOTE" :
@@ -1399,7 +1456,7 @@
case "E" :
$F=stripSlashes($F);
// detail of $relDir/$F
- if (is_file("$gblFsRoot/$relDir/$F")) DetailPage($gblFsRoot, $relDir, $F) ;
+ if (is_file("$gblFsRoot/$relDir/$F") || is_dir("$gblFsRoot/$relDir/$F")) DetailPage($gblFsRoot, $relDir, $F) ;
exit ;
case "C" :
$F=stripSlashes($F);