222 |
Error("Creation denied",$relDir) ; |
Error("Creation denied",$relDir) ; |
223 |
|
|
224 |
$text = "Use this page to view, modify or " ; |
$text = "Use this page to view, modify or " ; |
225 |
$text .= "delete a single document on this " ; |
if (is_dir($fsPath)) { |
226 |
|
$text .="delete a directory on this " ; |
227 |
|
} else { |
228 |
|
$text .= "delete a single document on this " ; |
229 |
|
}; |
230 |
$text .= "web site." ; |
$text .= "web site." ; |
231 |
$title = "(Detail Page)" ; |
$title = "(Detail Page)" ; |
232 |
StartHTML($title, $text) ; |
StartHTML($title, $text) ; |
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 |
echo "<PRE> file size: " . $fsize . " Bytes<BR>" ; |
$fuid=fileowner($fsPath); |
240 |
|
$fgid=filegroup($fsPath); |
241 |
|
$userinfo = posix_getpwuid($fuid); |
242 |
|
$grpinfo = posix_getgrgid($fgid); |
243 |
|
echo "<PRE>"; |
244 |
|
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>" . fileowner($fsPath) . "</B><BR>" ; |
echo " owner: <B>" . $userinfo["name"] . " [$fuid]</B><BR>" ; |
248 |
echo " group: <B>" . filegroup($fsPath) . "</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>" ; |
252 |
|
|
253 |
} |
} |
254 |
|
|
255 |
if ( $editable && ($writable || !$exists) && !$file_lock ) { |
if ( !is_dir($fsPath) && $editable && ($writable || !$exists) && !$file_lock ) { |
256 |
$fh = fopen($fsPath,"a+") ; |
$fh = fopen($fsPath,"a+") ; |
257 |
rewind($fh) ; |
rewind($fh) ; |
258 |
$fstr = fread($fh,filesize($fsPath)) ; |
$fstr = fread($fh,filesize($fsPath)) ; |
359 |
array_unshift($logarr,array($cl,$line[0],$line[1],$line[2],$line[3])); |
array_unshift($logarr,array($cl,$line[0],$line[1],$line[2],$line[3])); |
360 |
} |
} |
361 |
fclose($log); |
fclose($log); |
362 |
print "<hr><br><b>CHANGES TO THIS FILE</b><br><table border=0 width=100%>\n"; |
if (is_dir("$fsDir/$fn")) { |
363 |
|
$whatis="DIRECTORY"; |
364 |
|
} else { |
365 |
|
$whatis="FILE"; |
366 |
|
} |
367 |
|
print "<hr><br><b>CHANGES TO THIS $whatis</b><br><table border=0 width=100%>\n"; |
368 |
$bakcount = 0; // start from 0, skip fist backup (it's current) |
$bakcount = 0; // start from 0, skip fist backup (it's current) |
369 |
while ($e = array_shift($logarr)) { |
while ($e = array_shift($logarr)) { |
370 |
if (strstr($e[4],"upload")) { |
if (strstr($e[4],"upload")) { |
699 |
sort($dirList) ; |
sort($dirList) ; |
700 |
?> |
?> |
701 |
|
|
702 |
<TR><TD></TD><TD COLSPAN=5 CLASS=TOP><HR>DIRECTORY NAME</TD></TR> |
<TR><TD></TD><TD COLSPAN=2 CLASS=TOP>DIRECTORY NAME</TD><TD COLSPAN=3 CLASS=TOP>DIRECTORY NOTE</TR> |
703 |
|
|
704 |
<?php |
<?php |
705 |
while (list($key,$dir) = each($dirList)) { |
while (list($key,$dir) = each($dirList)) { |
706 |
|
|
707 |
|
$info_url=$self."?A=E&F=".urlencode($dir)."&D=".urlencode($relDir); |
708 |
$tstr = "<A HREF=\"" . $self . "?D=" ; |
$tstr = "<A HREF=\"" . $self . "?D=" ; |
709 |
$tstr .= urlencode($relDir."/".$dir) ; |
$tstr .= urlencode($relDir."/".$dir) ; |
710 |
$tstr .= "\">" . $dir . "/</A>" ; |
$tstr .= "\">" . $dir . "/</A>" ; |
711 |
|
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".ReadNote($fsDir.$dir); |
712 |
?> |
?> |
713 |
|
|
714 |
<TR><TD><?= $gblIcon("fldr") ?></TD> |
<TR><TD> |
715 |
<TD COLSPAN=5 CLASS=LST><?= $tstr ?></TD></TR> |
<A HREF="<?= $info_url ?>" TITLE="View/Edit"> |
716 |
|
<?= $gblIcon("fldr") ?></A></TD> |
717 |
|
<TD COLSPAN=2 CLASS=LST><?= $tstr ?></TD> |
718 |
|
<TD COLSPAN=3 CLASS=LST><?= $note_html ?></TD></TR> |
719 |
|
|
720 |
<?php |
<?php |
721 |
} // iterate over dirs |
} // iterate over dirs |
1057 |
|
|
1058 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1059 |
|
|
1060 |
function safe_rename($from,$to) { |
function safe_rename($fromdir,$fromfile,$tofile) { |
1061 |
if (file_exists($from) && is_writable(dirname($to))) { |
function try_rename($from,$to) { |
1062 |
rename($from,$to); |
print "$from -> $to\n"; |
1063 |
|
if (file_exists($from) && is_writeable(dirname($to))) { |
1064 |
|
rename($from,$to); |
1065 |
|
} |
1066 |
|
} |
1067 |
|
|
1068 |
|
function try_dir($todir) { |
1069 |
|
if (! file_exists($todir)) { |
1070 |
|
mkdir($todir,0700); |
1071 |
|
} |
1072 |
|
} |
1073 |
|
|
1074 |
|
$to="$fromdir/$tofile"; |
1075 |
|
$todir=dirname($to); |
1076 |
|
$tofile=basename($to); |
1077 |
|
|
1078 |
|
print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n"; |
1079 |
|
|
1080 |
|
try_rename("$fromdir/$fromfile","$todir/$tofile"); |
1081 |
|
try_dir("$todir/.log"); |
1082 |
|
try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile"); |
1083 |
|
try_dir("$todir/.note"); |
1084 |
|
try_rename("$fromdir/.note/$fromfile","$todir/.note/$tofile"); |
1085 |
|
try_dir("$todir/.lock"); |
1086 |
|
try_rename("$fromdir/.lock/$fromfile","$todir/.lock/$tofile"); |
1087 |
|
try_dir("$todir/.bak"); |
1088 |
|
for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) { |
1089 |
|
try_rename("$fromdir/.bak/$i/$fromfile","$todir/.bak/$i/$tofile"); |
1090 |
} |
} |
1091 |
} |
} |
1092 |
|
|
1093 |
|
|
1094 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1095 |
|
|
1096 |
// recursivly delete directory |
// recursivly delete directory |
1168 |
|
|
1169 |
$htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; |
$htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; |
1170 |
if (! file_exists($htusers_file)) { |
if (! file_exists($htusers_file)) { |
1171 |
if (is_writable(dirname($SCRIPT_FILENAME))) { |
if (is_writeable(dirname($SCRIPT_FILENAME))) { |
1172 |
$htusers=fopen($htusers_file,"a+"); |
$htusers=fopen($htusers_file,"a+"); |
1173 |
fputs($htusers,"# Change owner of $htusers_file to root !!\n"); |
fputs($htusers,"# Change owner of $htusers_file to root !!\n"); |
1174 |
fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n"); |
fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n"); |
1214 |
$relDir = urldecode($D) ; // then use GET |
$relDir = urldecode($D) ; // then use GET |
1215 |
} |
} |
1216 |
|
|
1217 |
|
$relDir=stripSlashes($relDir); |
1218 |
|
|
1219 |
if ($relDir == "/") $relDir = "" ; |
if ($relDir == "/") $relDir = "" ; |
1220 |
// default : website root = "" |
// default : website root = "" |
1221 |
|
|
1250 |
|
|
1251 |
$FN=stripSlashes($FN); |
$FN=stripSlashes($FN); |
1252 |
|
|
1253 |
|
if (file_exists("$fsScriptDir/.docman.conf")) { |
1254 |
|
include("$fsScriptDir/.docman.conf"); |
1255 |
|
} |
1256 |
|
|
1257 |
switch ($POSTACTION) { |
switch ($POSTACTION) { |
1258 |
case "UPLOAD" : |
case "UPLOAD" : |
1259 |
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ; |
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ; |
1329 |
// this functionality is doubled in DetailView(). |
// this functionality is doubled in DetailView(). |
1330 |
// better keep it here altogether |
// better keep it here altogether |
1331 |
// chmod perms to $gblFilePerms |
// chmod perms to $gblFilePerms |
1332 |
if ( file_exists($path) && !is_writable($path) ) |
if ( file_exists($path) && !is_writeable($path) ) |
1333 |
Error("File not writable", $relPath) ; |
Error("File not writable", $relPath) ; |
1334 |
$fh = fopen($path, "w+") ; |
$fh = fopen($path, "w+") ; |
1335 |
if ($fh) { |
if ($fh) { |
1401 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1402 |
|
|
1403 |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
1404 |
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"); |
|
|
} |
|
|
|
|
1405 |
break ; |
break ; |
1406 |
|
|
1407 |
case "NOTE" : |
case "NOTE" : |
1447 |
case "E" : |
case "E" : |
1448 |
$F=stripSlashes($F); |
$F=stripSlashes($F); |
1449 |
// detail of $relDir/$F |
// detail of $relDir/$F |
1450 |
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) ; |
1451 |
exit ; |
exit ; |
1452 |
case "C" : |
case "C" : |
1453 |
$F=stripSlashes($F); |
$F=stripSlashes($F); |