236 |
$fsize = filesize($fsPath) ; |
$fsize = filesize($fsPath) ; |
237 |
$fmodified = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", filemtime($fsPath)) ; |
$fmodified = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", filemtime($fsPath)) ; |
238 |
$faccessed = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", fileatime($fsPath)) ; |
$faccessed = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", fileatime($fsPath)) ; |
239 |
$userinfo = posix_getpwuid(fileowner($fsPath)); |
$fuid=fileowner($fsPath); |
240 |
$grpinfo = posix_getgrgid(filegroup($fsPath)); |
$fgid=filegroup($fsPath); |
241 |
|
$userinfo = posix_getpwuid($fuid); |
242 |
|
$grpinfo = posix_getgrgid($fgid); |
243 |
echo "<PRE>"; |
echo "<PRE>"; |
244 |
if (!is_dir($fsPath)) echo "file size: " . $fsize . " Bytes<BR>" ; |
if (!is_dir($fsPath)) echo " file size: " . $fsize . " Bytes<BR>" ; |
245 |
echo "last modified: <B>" . $fmodified . "</B><BR>" ; |
echo "last modified: <B>" . $fmodified . "</B><BR>" ; |
246 |
echo "last accessed: <B>" . $faccessed . "</B><BR>" ; |
echo "last accessed: <B>" . $faccessed . "</B><BR>" ; |
247 |
echo " owner: <B>" . $userinfo["name"] . "</B><BR>" ; |
echo " owner: <B>" . $userinfo["name"] . " [$fuid]</B><BR>" ; |
248 |
echo " group: <B>" . $grpinfo["name"] . "</B><BR>" ; |
echo " group: <B>" . $grpinfo["name"] . " [$fgid]</B><BR>" ; |
249 |
echo " permissions: <B>" ; |
echo " permissions: <B>" ; |
250 |
echo printf( "%o", fileperms($fsPath) ) . "</B>" ; |
echo printf( "%o", fileperms($fsPath) ) . "</B>" ; |
251 |
echo "</PRE>" ; |
echo "</PRE>" ; |
694 |
<?php |
<?php |
695 |
} |
} |
696 |
|
|
697 |
|
function plural($name,$count) { |
698 |
|
$out="$count $name"; |
699 |
|
if ($count > 1) { |
700 |
|
$out.="s"; |
701 |
|
} |
702 |
|
return $out; |
703 |
|
} |
704 |
|
|
705 |
// output subdirs |
// output subdirs |
706 |
if (sizeof($dirList) > 0) { |
if (sizeof($dirList) > 0) { |
707 |
sort($dirList) ; |
sort($dirList) ; |
708 |
?> |
?> |
709 |
|
|
710 |
<TR><TD></TD><TD COLSPAN=2 CLASS=TOP>DIRECTORY NAME</TD><TD COLSPAN=3 CLASS=TOP>DIRECTORY NOTE</TR> |
<TR><TD></TD><TD COLSPAN=2 CLASS=TOP>DIRECTORY NAME (<?= plural("dir",sizeof($dirList)) ?>)</TD><TD COLSPAN=3 CLASS=TOP>DIRECTORY NOTE</TR> |
711 |
|
|
712 |
<?php |
<?php |
713 |
while (list($key,$dir) = each($dirList)) { |
while (list($key,$dir) = each($dirList)) { |
732 |
|
|
733 |
<TR><TD></TD><TD COLSPAN=5><HR><B><?= $webRoot . $relDir ?> |
<TR><TD></TD><TD COLSPAN=5><HR><B><?= $webRoot . $relDir ?> |
734 |
</B></TD></TR> |
</B></TD></TR> |
735 |
<TR><TD></TD><TD CLASS=TOP>DOCUMENT NAME</TD> |
<TR><TD></TD><TD CLASS=TOP>DOCUMENT NAME (<?= plural("file",sizeof($fileList)) ?>)</TD> |
736 |
<TD><?= $gblIcon("blank").$gblIcon("blank") ?></TD> |
<TD><?= $gblIcon("blank").$gblIcon("blank") ?></TD> |
737 |
<TD CLASS=TOP>NOTE</TD> |
<TD CLASS=TOP>NOTE</TD> |
738 |
<TD CLASS=TOP>LAST UPDATE</TD><TD CLASS=TOP>FILE SIZE</TD></TR> |
<TD CLASS=TOP>LAST UPDATE</TD><TD CLASS=TOP>FILE SIZE</TD></TR> |
864 |
<NOBR>NAME <INPUT TYPE="TEXT" NAME="FN" SIZE=14> |
<NOBR>NAME <INPUT TYPE="TEXT" NAME="FN" SIZE=14> |
865 |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE"> |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE"> |
866 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
867 |
<INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR> |
<INPUT TYPE="SUBMIT" VALUE="CREATE" NAME="CREATE"> |
868 |
|
</NOBR> |
869 |
<NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE |
<NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE |
870 |
</NOBR> |
</NOBR> |
871 |
</TD></TR> |
</TD></TR> |
1066 |
|
|
1067 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1068 |
|
|
1069 |
function safe_rename($from,$to) { |
function safe_rename($fromdir,$fromfile,$tofile) { |
1070 |
if (file_exists($from) && is_writable(dirname($to))) { |
function try_rename($from,$to) { |
1071 |
rename($from,$to); |
# print "$from -> $to\n"; |
1072 |
|
if (file_exists($from) && is_writeable(dirname($to))) { |
1073 |
|
rename($from,$to); |
1074 |
|
} |
1075 |
|
} |
1076 |
|
|
1077 |
|
function try_dir($todir) { |
1078 |
|
if (! file_exists($todir)) { |
1079 |
|
mkdir($todir,0700); |
1080 |
|
} |
1081 |
|
} |
1082 |
|
|
1083 |
|
$to="$fromdir/$tofile"; |
1084 |
|
$todir=dirname($to); |
1085 |
|
$tofile=basename($to); |
1086 |
|
|
1087 |
|
# print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n"; |
1088 |
|
|
1089 |
|
try_rename("$fromdir/$fromfile","$todir/$tofile"); |
1090 |
|
try_dir("$todir/.log"); |
1091 |
|
try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile"); |
1092 |
|
try_dir("$todir/.note"); |
1093 |
|
try_rename("$fromdir/.note/$fromfile","$todir/.note/$tofile"); |
1094 |
|
try_dir("$todir/.lock"); |
1095 |
|
try_rename("$fromdir/.lock/$fromfile","$todir/.lock/$tofile"); |
1096 |
|
try_dir("$todir/.bak"); |
1097 |
|
for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) { |
1098 |
|
try_rename("$fromdir/.bak/$i/$fromfile","$todir/.bak/$i/$tofile"); |
1099 |
} |
} |
1100 |
} |
} |
1101 |
|
|
1102 |
|
|
1103 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1104 |
|
|
1105 |
// recursivly delete directory |
// recursivly delete directory |
1177 |
|
|
1178 |
$htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; |
$htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; |
1179 |
if (! file_exists($htusers_file)) { |
if (! file_exists($htusers_file)) { |
1180 |
if (is_writable(dirname($SCRIPT_FILENAME))) { |
if (is_writeable(dirname($SCRIPT_FILENAME))) { |
1181 |
$htusers=fopen($htusers_file,"a+"); |
$htusers=fopen($htusers_file,"a+"); |
1182 |
fputs($htusers,"# Change owner of $htusers_file to root !!\n"); |
fputs($htusers,"# Change owner of $htusers_file to root !!\n"); |
1183 |
fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n"); |
fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n"); |
1223 |
$relDir = urldecode($D) ; // then use GET |
$relDir = urldecode($D) ; // then use GET |
1224 |
} |
} |
1225 |
|
|
1226 |
|
$relDir=stripSlashes($relDir); |
1227 |
|
|
1228 |
if ($relDir == "/") $relDir = "" ; |
if ($relDir == "/") $relDir = "" ; |
1229 |
// default : website root = "" |
// default : website root = "" |
1230 |
|
|
1259 |
|
|
1260 |
$FN=stripSlashes($FN); |
$FN=stripSlashes($FN); |
1261 |
|
|
1262 |
|
if (file_exists("$fsScriptDir/.docman.conf")) { |
1263 |
|
include("$fsScriptDir/.docman.conf"); |
1264 |
|
} |
1265 |
|
|
1266 |
switch ($POSTACTION) { |
switch ($POSTACTION) { |
1267 |
case "UPLOAD" : |
case "UPLOAD" : |
1268 |
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ; |
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ; |
1338 |
// this functionality is doubled in DetailView(). |
// this functionality is doubled in DetailView(). |
1339 |
// better keep it here altogether |
// better keep it here altogether |
1340 |
// chmod perms to $gblFilePerms |
// chmod perms to $gblFilePerms |
1341 |
if ( file_exists($path) && !is_writable($path) ) |
if ( file_exists($path) && !is_writeable($path) ) |
1342 |
Error("File not writable", $relPath) ; |
Error("File not writable", $relPath) ; |
1343 |
$fh = fopen($path, "w+") ; |
$fh = fopen($path, "w+") ; |
1344 |
if ($fh) { |
if ($fh) { |
1410 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1411 |
|
|
1412 |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
1413 |
safe_rename("$fsDir/$FN","$fsDir/$NEWNAME"); |
safe_rename($fsDir,$FN,$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"); |
|
|
} |
|
|
|
|
1414 |
break ; |
break ; |
1415 |
|
|
1416 |
case "NOTE" : |
case "NOTE" : |