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>" ; |
$userinfo = posix_getpwuid(fileowner($fsPath)); |
240 |
|
$grpinfo = posix_getgrgid(filegroup($fsPath)); |
241 |
|
echo "<PRE>"; |
242 |
|
if (!is_dir($fsPath)) echo "file size: " . $fsize . " Bytes<BR>" ; |
243 |
echo "last modified: <B>" . $fmodified . "</B><BR>" ; |
echo "last modified: <B>" . $fmodified . "</B><BR>" ; |
244 |
echo "last accessed: <B>" . $faccessed . "</B><BR>" ; |
echo "last accessed: <B>" . $faccessed . "</B><BR>" ; |
245 |
echo " owner: <B>" . fileowner($fsPath) . "</B><BR>" ; |
echo " owner: <B>" . $userinfo["name"] . "</B><BR>" ; |
246 |
echo " group: <B>" . filegroup($fsPath) . "</B><BR>" ; |
echo " group: <B>" . $grpinfo["name"] . "</B><BR>" ; |
247 |
echo " permissions: <B>" ; |
echo " permissions: <B>" ; |
248 |
echo printf( "%o", fileperms($fsPath) ) . "</B>" ; |
echo printf( "%o", fileperms($fsPath) ) . "</B>" ; |
249 |
echo "</PRE>" ; |
echo "</PRE>" ; |
250 |
|
|
251 |
} |
} |
252 |
|
|
253 |
if ( $editable && ($writable || !$exists) && !$file_lock ) { |
if ( !is_dir($fsPath) && $editable && ($writable || !$exists) && !$file_lock ) { |
254 |
$fh = fopen($fsPath,"a+") ; |
$fh = fopen($fsPath,"a+") ; |
255 |
rewind($fh) ; |
rewind($fh) ; |
256 |
$fstr = fread($fh,filesize($fsPath)) ; |
$fstr = fread($fh,filesize($fsPath)) ; |
357 |
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])); |
358 |
} |
} |
359 |
fclose($log); |
fclose($log); |
360 |
print "<hr><br><b>CHANGES TO THIS FILE</b><br><table border=0 width=100%>\n"; |
if (is_dir("$fsDir/$fn")) { |
361 |
|
$whatis="DIRECTORY"; |
362 |
|
} else { |
363 |
|
$whatis="FILE"; |
364 |
|
} |
365 |
|
print "<hr><br><b>CHANGES TO THIS $whatis</b><br><table border=0 width=100%>\n"; |
366 |
$bakcount = 0; // start from 0, skip fist backup (it's current) |
$bakcount = 0; // start from 0, skip fist backup (it's current) |
367 |
while ($e = array_shift($logarr)) { |
while ($e = array_shift($logarr)) { |
368 |
if (strstr($e[4],"upload")) { |
if (strstr($e[4],"upload")) { |
697 |
sort($dirList) ; |
sort($dirList) ; |
698 |
?> |
?> |
699 |
|
|
700 |
<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> |
701 |
|
|
702 |
<?php |
<?php |
703 |
while (list($key,$dir) = each($dirList)) { |
while (list($key,$dir) = each($dirList)) { |
704 |
|
|
705 |
|
$info_url=$self."?A=E&F=".urlencode($dir)."&D=".urlencode($relDir); |
706 |
$tstr = "<A HREF=\"" . $self . "?D=" ; |
$tstr = "<A HREF=\"" . $self . "?D=" ; |
707 |
$tstr .= urlencode($relDir."/".$dir) ; |
$tstr .= urlencode($relDir."/".$dir) ; |
708 |
$tstr .= "\">" . $dir . "/</A>" ; |
$tstr .= "\">" . $dir . "/</A>" ; |
709 |
|
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".ReadNote($fsDir.$dir); |
710 |
?> |
?> |
711 |
|
|
712 |
<TR><TD><?= $gblIcon("fldr") ?></TD> |
<TR><TD> |
713 |
<TD COLSPAN=5 CLASS=LST><?= $tstr ?></TD></TR> |
<A HREF="<?= $info_url ?>" TITLE="View/Edit"> |
714 |
|
<?= $gblIcon("fldr") ?></A></TD> |
715 |
|
<TD COLSPAN=2 CLASS=LST><?= $tstr ?></TD> |
716 |
|
<TD COLSPAN=3 CLASS=LST><?= $note_html ?></TD></TR> |
717 |
|
|
718 |
<?php |
<?php |
719 |
} // iterate over dirs |
} // iterate over dirs |
1055 |
|
|
1056 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1057 |
|
|
1058 |
function safe_rename($from,$to) { |
function safe_rename($fromdir,$fromfile,$tofile) { |
1059 |
if (file_exists($from) && is_writable(dirname($to))) { |
function try_rename($from,$to) { |
1060 |
rename($from,$to); |
print "$from -> $to\n"; |
1061 |
|
if (file_exists($from) && is_writeable(dirname($to))) { |
1062 |
|
rename($from,$to); |
1063 |
|
} |
1064 |
|
} |
1065 |
|
|
1066 |
|
function try_dir($todir) { |
1067 |
|
if (! file_exists($todir)) { |
1068 |
|
mkdir($todir,0700); |
1069 |
|
} |
1070 |
|
} |
1071 |
|
|
1072 |
|
$to="$fromdir/$tofile"; |
1073 |
|
$todir=dirname($to); |
1074 |
|
$tofile=basename($to); |
1075 |
|
|
1076 |
|
print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n"; |
1077 |
|
|
1078 |
|
try_rename("$fromdir/$fromfile","$todir/$tofile"); |
1079 |
|
try_dir("$todir/.log"); |
1080 |
|
try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile"); |
1081 |
|
try_dir("$todir/.note"); |
1082 |
|
try_rename("$fromdir/.note/$fromfile","$todir/.note/$tofile"); |
1083 |
|
try_dir("$todir/.lock"); |
1084 |
|
try_rename("$fromdir/.lock/$fromfile","$todir/.lock/$tofile"); |
1085 |
|
try_dir("$todir/.bak"); |
1086 |
|
for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) { |
1087 |
|
try_rename("$fromdir/.bak/$i/$fromfile","$todir/.bak/$i/$tofile"); |
1088 |
} |
} |
1089 |
} |
} |
1090 |
|
|
1091 |
|
|
1092 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1093 |
|
|
1094 |
// recursivly delete directory |
// recursivly delete directory |
1166 |
|
|
1167 |
$htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; |
$htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; |
1168 |
if (! file_exists($htusers_file)) { |
if (! file_exists($htusers_file)) { |
1169 |
if (is_writable(dirname($SCRIPT_FILENAME))) { |
if (is_writeable(dirname($SCRIPT_FILENAME))) { |
1170 |
$htusers=fopen($htusers_file,"a+"); |
$htusers=fopen($htusers_file,"a+"); |
1171 |
fputs($htusers,"# Change owner of $htusers_file to root !!\n"); |
fputs($htusers,"# Change owner of $htusers_file to root !!\n"); |
1172 |
fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n"); |
fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n"); |
1321 |
// this functionality is doubled in DetailView(). |
// this functionality is doubled in DetailView(). |
1322 |
// better keep it here altogether |
// better keep it here altogether |
1323 |
// chmod perms to $gblFilePerms |
// chmod perms to $gblFilePerms |
1324 |
if ( file_exists($path) && !is_writable($path) ) |
if ( file_exists($path) && !is_writeable($path) ) |
1325 |
Error("File not writable", $relPath) ; |
Error("File not writable", $relPath) ; |
1326 |
$fh = fopen($path, "w+") ; |
$fh = fopen($path, "w+") ; |
1327 |
if ($fh) { |
if ($fh) { |
1393 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1394 |
|
|
1395 |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
1396 |
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"); |
|
|
} |
|
|
|
|
1397 |
break ; |
break ; |
1398 |
|
|
1399 |
case "NOTE" : |
case "NOTE" : |
1439 |
case "E" : |
case "E" : |
1440 |
$F=stripSlashes($F); |
$F=stripSlashes($F); |
1441 |
// detail of $relDir/$F |
// detail of $relDir/$F |
1442 |
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) ; |
1443 |
exit ; |
exit ; |
1444 |
case "C" : |
case "C" : |
1445 |
$F=stripSlashes($F); |
$F=stripSlashes($F); |