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")) { |
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=5 CLASS=TOP><HR>DIRECTORY NAME</TD></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)) { |
714 |
|
|
715 |
|
$info_url=$self."?A=E&F=".urlencode($dir)."&D=".urlencode($relDir); |
716 |
$tstr = "<A HREF=\"" . $self . "?D=" ; |
$tstr = "<A HREF=\"" . $self . "?D=" ; |
717 |
$tstr .= urlencode($relDir."/".$dir) ; |
$tstr .= urlencode($relDir."/".$dir) ; |
718 |
$tstr .= "\">" . $dir . "/</A>" ; |
$tstr .= "\">" . $dir . "/</A>" ; |
719 |
|
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".ReadNote($fsDir.$dir); |
720 |
?> |
?> |
721 |
|
|
722 |
<TR><TD><?= $gblIcon("fldr") ?></TD> |
<TR><TD> |
723 |
<TD COLSPAN=5 CLASS=LST><?= $tstr ?></TD></TR> |
<A HREF="<?= $info_url ?>" TITLE="View/Edit"> |
724 |
|
<?= $gblIcon("fldr") ?></A></TD> |
725 |
|
<TD COLSPAN=2 CLASS=LST><?= $tstr ?></TD> |
726 |
|
<TD COLSPAN=3 CLASS=LST><?= $note_html ?></TD></TR> |
727 |
|
|
728 |
<?php |
<?php |
729 |
} // iterate over dirs |
} // iterate over dirs |
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> |
985 |
$msg=fgets($note,4096); |
$msg=fgets($note,4096); |
986 |
fclose($note); |
fclose($note); |
987 |
} |
} |
988 |
return StripSlashes($msg); |
return HtmlSpecialChars(StripSlashes($msg)); |
989 |
|
|
990 |
} |
} |
991 |
|
|
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" : |
1456 |
case "E" : |
case "E" : |
1457 |
$F=stripSlashes($F); |
$F=stripSlashes($F); |
1458 |
// detail of $relDir/$F |
// detail of $relDir/$F |
1459 |
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) ; |
1460 |
exit ; |
exit ; |
1461 |
case "C" : |
case "C" : |
1462 |
$F=stripSlashes($F); |
$F=stripSlashes($F); |