65 |
TODO: |
TODO: |
66 |
mixed file/directory output (add type to each entry, |
mixed file/directory output (add type to each entry, |
67 |
real support for links) |
real support for links) |
68 |
add more content-management (like cms.sourceforge.net): |
retrieve old versions of files (overwritten) |
69 |
check-out/check-in/reserve |
show last lock date |
70 |
comments to files |
|
71 |
*/ |
*/ |
72 |
|
|
73 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
157 |
|
|
158 |
<HTML> |
<HTML> |
159 |
<HEAD> |
<HEAD> |
160 |
<TITLE><?php echo $host . " " . $title ?></TITLE> |
<TITLE><?= $host . " " . $title ?></TITLE> |
161 |
<META NAME="description" CONTENT="PHP port of AnyPortal Site Manager"> |
<META NAME="description" CONTENT="PHP port of AnyPortal Site Manager"> |
162 |
<META NAME="keywords" CONTENT="site manager, web site maintenance"> |
<META NAME="keywords" CONTENT="site manager, web site maintenance"> |
163 |
<META NAME="robots" CONTENT="noindex"> |
<META NAME="robots" CONTENT="noindex"> |
164 |
<META HTTP-EQUIV="expires" CONTENT="0"> |
<META HTTP-EQUIV="expires" CONTENT="0"> |
165 |
<LINK REL="stylesheet" TYPE="text/css" |
<LINK REL="stylesheet" TYPE="text/css" |
166 |
HREF="<?php echo $self ?>?STYLE=get"> |
HREF="<?= $self ?>?STYLE=get"> |
167 |
</HEAD> |
</HEAD> |
168 |
<BODY BGCOLOR="#FFFFFF"> |
<BODY BGCOLOR="#FFFFFF"> |
169 |
<H3 ALIGN="RIGHT"><?php echo $host ?></H3> |
<H3 ALIGN="RIGHT"><?= $host ?></H3> |
170 |
<TABLE BORDER=0 WIDTH="100%"><TR> |
<TABLE BORDER=0 WIDTH="100%"><TR> |
171 |
<TD CLASS=INV><?php echo $title ?></TD></TR></TABLE> |
<TD CLASS=INV><?= $title ?></TD></TR></TABLE> |
172 |
<P><?php echo $text ?></P> |
<P><?= $text ?></P> |
173 |
|
|
174 |
<?php |
<?php |
175 |
} // end function StartHTML |
} // end function StartHTML |
184 |
<B><?= date($GLOBALS[gblDateFmt]) ?> - |
<B><?= date($GLOBALS[gblDateFmt]) ?> - |
185 |
<?= date($GLOBALS[gblTimeFmt]) ?> - |
<?= date($GLOBALS[gblTimeFmt]) ?> - |
186 |
<?= $GLOBALS[gblUserName] ?> |
<?= $GLOBALS[gblUserName] ?> |
187 |
<small> [<a href="<?= $PHP_SELF ?>?relogin=<?= $GLOBALS[gblPw] ?>">logout</a>]</small> |
<small> [<a href="<?= $GLOBALS["PHP_SELF"] ?>?relogin=<?= $GLOBALS[gblPw] ?>">logout</a>]</small> |
188 |
</B> |
</B> |
189 |
<BR>ANYPORTAL(php) Site Manager |
<BR>ANYPORTAL(php) Site Manager |
190 |
<br><small> |
<br><small> |
194 |
</small> |
</small> |
195 |
</P> |
</P> |
196 |
<BR> |
<BR> |
197 |
<? //include("../debug.inc") ?> |
<? //include(".debug.inc") ?> |
198 |
<BR><BR></BODY></HTML> |
<BR><BR></BODY></HTML> |
199 |
|
|
200 |
<?php |
<?php |
240 |
$ext = strtolower(strrchr($relPath,".")) ; |
$ext = strtolower(strrchr($relPath,".")) ; |
241 |
$editable = ( $ext=="" || strstr(join(" ",$gblEditable),$ext)) ; |
$editable = ( $ext=="" || strstr(join(" ",$gblEditable),$ext)) ; |
242 |
$writable = is_writeable($fsPath) ; |
$writable = is_writeable($fsPath) ; |
243 |
|
$file_lock = CheckLock($fsPath); |
244 |
|
|
245 |
if (!$editable && !$exists) |
if (!$editable && !$exists) |
246 |
Error("Creation unsupported for type",$relPath) ; |
Error("Creation unsupported for type",$relPath) ; |
255 |
|
|
256 |
echo "<H3>" . $relDir . "/" . $fn . "</H3>" ; |
echo "<H3>" . $relDir . "/" . $fn . "</H3>" ; |
257 |
if ($exists) { // get file info |
if ($exists) { // get file info |
258 |
$fsize = filesize($fsPath) ; |
$fsize = filesize($fsPath) ; |
259 |
$fmodified = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", filemtime($fsPath)) ; |
$fmodified = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", filemtime($fsPath)) ; |
260 |
$faccessed = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", fileatime($fsPath)) ; |
$faccessed = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", fileatime($fsPath)) ; |
261 |
echo "<PRE> file size: " . $fsize . " Bytes<BR>" ; |
echo "<PRE> file size: " . $fsize . " Bytes<BR>" ; |
262 |
echo "last modified: <B>" . $fmodified . "</B><BR>" ; |
echo "last modified: <B>" . $fmodified . "</B><BR>" ; |
263 |
echo "last accessed: <B>" . $faccessed . "</B><BR>" ; |
echo "last accessed: <B>" . $faccessed . "</B><BR>" ; |
264 |
echo " owner: <B>" . fileowner($fsPath) . "</B><BR>" ; |
echo " owner: <B>" . fileowner($fsPath) . "</B><BR>" ; |
265 |
echo " group: <B>" . filegroup($fsPath) . "</B><BR>" ; |
echo " group: <B>" . filegroup($fsPath) . "</B><BR>" ; |
266 |
echo " permissions: <B>" ; |
echo " permissions: <B>" ; |
267 |
echo printf( "%o", fileperms($fsPath) ) . "</B>" ; |
echo printf( "%o", fileperms($fsPath) ) . "</B>" ; |
268 |
echo "</PRE>" ; |
echo "</PRE>" ; |
269 |
|
|
270 |
} |
} |
271 |
|
|
272 |
if ( $editable && ($writable || !$exists) ) { |
if ( $editable && ($writable || !$exists) && !$file_lock ) { |
273 |
$fh = fopen($fsPath,"a+") ; |
$fh = fopen($fsPath,"a+") ; |
274 |
rewind($fh) ; |
rewind($fh) ; |
275 |
$fstr = fread($fh,filesize($fsPath)) ; |
$fstr = fread($fh,filesize($fsPath)) ; |
277 |
$fstr = htmlentities( $fstr ) ; |
$fstr = htmlentities( $fstr ) ; |
278 |
?> |
?> |
279 |
|
|
280 |
<FORM ACTION="<?php echo $self ; ?>" METHOD="POST"> |
<FORM ACTION="<?= $self ; ?>" METHOD="POST"> |
281 |
<SPAN TITLE="Click [SAVE] to store updated contents."> |
<SPAN TITLE="Click [SAVE] to store updated contents."> |
282 |
<B>DOCUMENT CONTENTS</B> |
<B>DOCUMENT CONTENTS</B> |
283 |
</SPAN><BR> |
</SPAN><BR> |
284 |
<TEXTAREA NAME="FILEDATA" ROWS=18 COLS=70 WRAP="OFF"><?php |
<TEXTAREA NAME="FILEDATA" ROWS=18 COLS=70 WRAP="OFF"><?php |
285 |
echo($fstr) ; ?></TEXTAREA> |
echo($fstr) ; ?></TEXTAREA> |
286 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?php echo $relDir ; ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ; ?>"> |
287 |
<INPUT TYPE="HIDDEN" NAME="FN" VALUE="<?php echo $fn ; ?>"> |
<INPUT TYPE="HIDDEN" NAME="FN" VALUE="<?= $fn ; ?>"> |
288 |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="SAVE"> |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="SAVE"> |
289 |
<INPUT TYPE="HIDDEN" SIZE=48 MAXLENGTH=255 NAME="RELPATH" |
<INPUT TYPE="HIDDEN" SIZE=48 MAXLENGTH=255 NAME="RELPATH" |
290 |
VALUE="<?php echo $relPath ; ?>"> |
VALUE="<?= $relPath ; ?>"> |
291 |
<br> |
<br> |
292 |
<INPUT TYPE="RESET" VALUE="UNDO ALL CHANGES"> |
<INPUT TYPE="RESET" VALUE="UNDO ALL CHANGES"> |
293 |
<INPUT TYPE="SUBMIT" VALUE="SAVE"> |
<INPUT TYPE="SUBMIT" VALUE="SAVE"> |
295 |
|
|
296 |
<?php |
<?php |
297 |
} |
} |
298 |
else if ( strstr( join(" ",$gblImages), $ext ) ) { |
if ( !$file_lock && strstr(join(" ",$gblImages),$ext) ) { |
299 |
$info = getimagesize($fsPath) ; |
$info = getimagesize($fsPath) ; |
300 |
$tstr = "<IMG SRC=\"". $relPath . "\" BORDER=0 " ; |
$tstr = "<IMG SRC=\"".urlpath($relPath)."\" BORDER=0 " ; |
301 |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
302 |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
303 |
echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
// echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
304 |
|
echo $tstr ; |
305 |
} |
} |
306 |
|
|
307 |
?> |
?> |
308 |
|
|
309 |
<FORM ACTION="<?php echo $self ; ?>" METHOD="POST"> |
<FORM ACTION="<?= $self ; ?>" METHOD="POST"> |
310 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?php echo $relDir ; ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ; ?>"> |
311 |
<INPUT TYPE="HIDDEN" NAME="FN" VALUE="<?php echo $fn ; ?>"> |
<INPUT TYPE="HIDDEN" NAME="FN" VALUE="<?= $fn ; ?>"> |
312 |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"><BR> |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"><BR> |
313 |
|
|
314 |
<?php |
<?php |
315 |
|
|
316 |
|
if ($file_lock) { |
317 |
|
?> |
318 |
|
<hr> |
319 |
|
<SPAN TITLE="Check OK and click UNLOCK to remove lock on file."> |
320 |
|
<B>OK TO FORCE LOCK REMOVAL ON "<?= $fn ; ?>" HELD BY <?= $file_lock ?>? </B></SPAN> |
321 |
|
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
322 |
|
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="UNLOCK"> |
323 |
|
<? |
324 |
|
} // file_lock |
325 |
|
|
326 |
if (substr($fn,0,4) == ".del") { |
if (substr($fn,0,4) == ".del") { |
327 |
$action="UNDELETE"; |
$action="UNDELETE"; |
328 |
$desc="undelete previously deleted file"; |
$desc="undelete previously deleted file"; |
334 |
if ($exists && $writable) { |
if ($exists && $writable) { |
335 |
?> |
?> |
336 |
|
|
337 |
<HR><SPAN TITLE="Check OK and click [<?= $action ?>] to <?= $desc ?>."> |
<HR> |
338 |
<B>OK TO <?= $action ?> "<?php echo $fn ; ?>"? </B></SPAN> |
<a name="undelete"> |
339 |
|
<SPAN TITLE="Check OK and click [<?= $action ?>] to <?= $desc ?>."> |
340 |
|
<B>OK TO <?= $action ?> "<?= $fn ; ?>"? </B></SPAN> |
341 |
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
342 |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="<?= $action ?>"> |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="<?= $action ?>"> |
343 |
|
|
344 |
<HR><SPAN TITLE="Check OK and click [RENAME] to rename."> |
<HR> |
345 |
<B>OK TO RENAME "<?php echo $fn ; ?>" TO |
<a name="rename"> |
346 |
|
<SPAN TITLE="Check OK and click [RENAME] to rename."> |
347 |
|
<B>OK TO RENAME "<?= $fn ; ?>" TO |
348 |
<INPUT TYPE="TEXT" SIZE=24 MAXLENGTH=255 NAME="NEWNAME" VALUE="<?= $fn ?>"> |
<INPUT TYPE="TEXT" SIZE=24 MAXLENGTH=255 NAME="NEWNAME" VALUE="<?= $fn ?>"> |
349 |
? </B></SPAN> |
? </B></SPAN> |
350 |
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
351 |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="RENAME"> |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="RENAME"> |
352 |
|
|
353 |
<?php |
<?php |
354 |
} |
} // exists && writable |
355 |
echo "</FORM>" ; |
?> |
356 |
|
<HR> |
357 |
|
<a name="note"> |
358 |
|
<B>NOTE FOR "<?= $fn ; ?>": |
359 |
|
<INPUT TYPE="TEXT" SIZE=50 MAXLENGTH=255 NAME="NOTE" VALUE="<?= ReadNote($fsPath) ?>"> |
360 |
|
</B></SPAN> |
361 |
|
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="NOTE"> |
362 |
|
|
363 |
|
</FORM> |
364 |
|
|
365 |
$logname=dirname("$fsDir/$fn")."/.log/".basename("$fsDir/$fn"); |
<?php |
366 |
|
|
367 |
|
$name=basename("$fsDir/$fn"); |
368 |
|
$logname=dirname("$fsDir/$fn")."/.log/$name"; |
369 |
|
$bakdir=dirname("$fsDir/$fn")."/.bak"; |
370 |
if (file_exists($logname)) { |
if (file_exists($logname)) { |
|
print "<hr><br><b>CHANGES TO THIS FILE</b><br><table border=0 width=100%>\n"; |
|
371 |
$log=fopen($logname,"r"); |
$log=fopen($logname,"r"); |
372 |
$cl1=" class=lst"; $cl2=""; |
$cl1=" class=lst"; $cl2=""; |
373 |
|
$logarr = array(); |
374 |
while($line = fgetcsv($log,255,"\t")) { |
while($line = fgetcsv($log,255,"\t")) { |
375 |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
376 |
print "<tr><td$cl>$line[0]</td><td$cl>$line[1]</td><td$cl>$line[2]</td><td$cl>$line[3]</td></tr>\n"; |
array_unshift($logarr,array($cl,$line[0],$line[1],$line[2],$line[3])); |
377 |
} |
} |
378 |
fclose($log); |
fclose($log); |
379 |
|
print "<hr><br><b>CHANGES TO THIS FILE</b><br><table border=0 width=100%>\n"; |
380 |
|
$bakcount = 0; // start from 0, skip fist backup (it's current) |
381 |
|
while ($e = array_shift($logarr)) { |
382 |
|
if (strstr($e[4],"upload")) { |
383 |
|
if (file_exists("$bakdir/$bakcount/$name")) { |
384 |
|
$e[4]="<a href=\"".dirname($relPath)."/.bak/$bakcount/$name\">$e[4]</a>"; |
385 |
|
} |
386 |
|
$bakcount++; |
387 |
|
} |
388 |
|
print "<tr><td$e[0]>$e[1]</td><td$e[0]>$e[2]</td><td$e[0]>$e[3]</td><td$e[0]>$e[4]</td></tr>\n"; |
389 |
|
} |
390 |
print "</table>"; |
print "</table>"; |
391 |
} |
} |
392 |
|
|
619 |
case "blank" : |
case "blank" : |
620 |
$d = "blank.gif" ; |
$d = "blank.gif" ; |
621 |
break ; |
break ; |
622 |
|
case "checkout": |
623 |
|
$d = "box2.gif"; |
624 |
|
break; |
625 |
|
case "checkin": |
626 |
|
$d = "hand.up.gif"; |
627 |
|
break; |
628 |
|
case "locked": |
629 |
|
$d = "screw2.gif"; |
630 |
|
break; |
631 |
|
case "note": |
632 |
|
$d = "quill.gif"; |
633 |
|
break; |
634 |
default : |
default : |
635 |
$d = "generic.gif" ; |
$d = "generic.gif" ; |
636 |
} |
} |
688 |
// start navigation page |
// start navigation page |
689 |
$text = "Use this page to add, delete"; |
$text = "Use this page to add, delete"; |
690 |
if (! isset($show_deleted)) { |
if (! isset($show_deleted)) { |
691 |
$text .= ", <a href=".$GLOBALS[PHP_SELF]."?D=".urlencode($relDir)."&show_deleted=1>undelete</a>"; |
$text .= ", <a href=$self?D=".urlencode($relDir)."&show_deleted=1>undelete</a>"; |
692 |
} |
} |
693 |
$text .= " or revise files on this web site." ; |
$text .= " or revise files on this web site." ; |
694 |
StartHTML("(Navigate)",$text) ; |
StartHTML("(Navigate)",$text) ; |
702 |
if ($parent == "") $parent = "/" ; |
if ($parent == "") $parent = "/" ; |
703 |
?> |
?> |
704 |
|
|
705 |
<TR><TD><?php echo $gblIcon("up") ?></TD><TD COLSPAN=4 CLASS=LST> |
<TR><TD><?= $gblIcon("up") ?></TD><TD COLSPAN=5 CLASS=LST> |
706 |
<A HREF="<?php echo $self ?>?D=<?php echo urlencode($parent) ?>"> |
<A HREF="<?= $self ?>?D=<?= urlencode($parent) ?>"> |
707 |
<B><?php echo $parent ?></B></A></TD></TR> |
<B><?= $parent ?></B></A></TD></TR> |
708 |
|
|
709 |
<?php |
<?php |
710 |
} |
} |
714 |
sort($dirList) ; |
sort($dirList) ; |
715 |
?> |
?> |
716 |
|
|
717 |
<TR><TD></TD><TD COLSPAN=4 CLASS=TOP><HR>DIRECTORY NAME</TD></TR> |
<TR><TD></TD><TD COLSPAN=5 CLASS=TOP><HR>DIRECTORY NAME</TD></TR> |
718 |
|
|
719 |
<?php |
<?php |
720 |
while (list($key,$dir) = each($dirList)) { |
while (list($key,$dir) = each($dirList)) { |
724 |
$tstr .= "\">" . $dir . "/</A>" ; |
$tstr .= "\">" . $dir . "/</A>" ; |
725 |
?> |
?> |
726 |
|
|
727 |
<TR><TD><?php echo $gblIcon("fldr") ?></TD> |
<TR><TD><?= $gblIcon("fldr") ?></TD> |
728 |
<TD COLSPAN=4 CLASS=LST><?php echo $tstr ?></TD></TR> |
<TD COLSPAN=5 CLASS=LST><?= $tstr ?></TD></TR> |
729 |
|
|
730 |
<?php |
<?php |
731 |
} // iterate over dirs |
} // iterate over dirs |
732 |
} // end if no dirs |
} // end if no dirs |
733 |
?> |
?> |
734 |
|
|
735 |
<TR><TD></TD><TD COLSPAN=4><HR><B><?php echo $webRoot . $relDir ?> |
<TR><TD></TD><TD COLSPAN=5><HR><B><?= $webRoot . $relDir ?> |
736 |
</B></TD></TR> |
</B></TD></TR> |
737 |
<TR><TD></TD><TD CLASS=TOP>DOCUMENT NAME</TD> |
<TR><TD></TD><TD CLASS=TOP>DOCUMENT NAME</TD> |
738 |
<TD><?php echo $gblIcon("blank") ?></TD> |
<TD><?= $gblIcon("blank").$gblIcon("blank") ?></TD> |
739 |
|
<TD CLASS=TOP>NOTE</TD> |
740 |
<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> |
741 |
|
|
742 |
<?php |
<?php |
743 |
if (sizeof($fileList) > 0) { |
if (sizeof($fileList) > 0) { |
744 |
sort($fileList) ; |
sort($fileList) ; |
745 |
while (list($key,$file) = each($fileList)) { |
while (list($key,$file) = each($fileList)) { |
746 |
$path = $fsDir."/".$file ; |
$path = $fsDir."/".$file ; |
747 |
$mod = filemtime($path) ; |
$mod = filemtime($path) ; |
748 |
$sz = filesize($path) ; |
$sz = filesize($path) ; |
|
|
|
|
if ($sz >= 10240) { |
|
|
$sz = (int)(($sz+1023)/1024) . " k" ; |
|
|
} |
|
|
else { |
|
|
$sz .= " " ; |
|
|
} // end size |
|
|
|
|
|
$a = $b = "" ; |
|
|
|
|
|
if ( ($mod + 30*86400) > time() ) { |
|
|
$a = "<SPAN CLASS=RED TITLE=\"Newer" ; |
|
|
$a .= " than 30 days\"> * </SPAN>" ; |
|
|
} |
|
749 |
|
|
750 |
$tstr = $webRoot . $relDir . "/" . $file ; |
if ($sz >= 10240) { |
751 |
$tstr = "<A HREF=\"" . $tstr . "\">" ; |
$sz = (int)(($sz+1023)/1024) . " k" ; |
752 |
|
} else { |
753 |
|
$sz .= " " ; |
754 |
|
} // end size |
755 |
|
|
756 |
|
$a = $b = "" ; |
757 |
|
|
758 |
|
$info_url=$self."?A=E&F=".urlencode($file)."&D=".urlencode($relDir); |
759 |
|
|
760 |
|
if ( ($mod + 30*86400) > time() ) { |
761 |
|
$a = "<SPAN CLASS=RED TITLE=\"Newer" ; |
762 |
|
$a .= " than 30 days\"> * </SPAN>" ; |
763 |
|
} |
764 |
|
|
765 |
|
$file_lock=CheckLock($path); |
766 |
|
|
767 |
|
$file_url_html="<A HREF=\"$self?A=V&F=".urlencode($file); |
768 |
|
$file_url_html.="&D=".urlencode($relDir); |
769 |
|
$file_url_html.="\" TITLE=\"View file\">" ; |
770 |
|
|
771 |
if (substr($file,0,5) != ".del/") { |
if (substr($file,0,5) != ".del/") { |
772 |
$tstr .= $file . "</A>" . $a ; |
$file_url_html .= $file . "</A>" . $a ; |
773 |
} else { |
} else { |
774 |
$tstr .= substr($file,5,strlen($file)-5) . "</a> <SPAN CLASS=RED TITLE=\"deleted\"> deleted </span>"; |
$file_url_html .= substr($file,5,strlen($file)-5) . "</a> <SPAN CLASS=RED TITLE=\"deleted\"> <a href=\"$info_url#undelete\">deleted</a> </span>"; |
775 |
|
} |
776 |
|
|
777 |
|
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".ReadNote($path); |
778 |
|
|
779 |
|
$ext = strtolower(strrchr($file,".")) ; |
780 |
|
|
781 |
|
if ($file_lock) { |
782 |
|
if ($file_lock == $GLOBALS[gblUserName]) { |
783 |
|
$b.="<A HREF=\"$self?A=Ci&F=".urlencode($file); |
784 |
|
$b.="&D=".urlencode($relDir); |
785 |
|
$b.="\" TITLE=\"Checkin (update) file on server\">" ; |
786 |
|
$file_url_html=$b; |
787 |
|
$b.=$gblIcon("checkin")."</A>" ; |
788 |
|
$b.= $gblIcon("blank"); |
789 |
|
$file_url_html.="$file</a> $a"; |
790 |
|
$note_html = $gblIcon("blank")."<b>Please check-in (update) this file</b>"; |
791 |
|
} else { |
792 |
|
$b = $gblIcon("locked"); |
793 |
|
$b.= $gblIcon("blank"); |
794 |
|
$note_html = $gblIcon("blank")."<b>File locked by $file_lock</b>"; |
795 |
|
$file_url_html = "$file $a"; |
796 |
|
} |
797 |
|
} else { |
798 |
|
$b.="<A HREF=\"$self?A=Co&F=".urlencode($file); |
799 |
|
$b.="&D=".urlencode($relDir); |
800 |
|
$b.="\" TITLE=\"Checkout file for edit\">" ; |
801 |
|
$b.=$gblIcon("checkout")."</A>" ; |
802 |
|
|
803 |
|
if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) { |
804 |
|
$b.="<A HREF=\"$self?A=C&F=".urlencode($file); |
805 |
|
$b.="&D=".urlencode($relDir); |
806 |
|
$b.="\" TITLE=\"List contents\">" ; |
807 |
|
$b.=$gblIcon("view")."</A>" ; |
808 |
|
} else { |
809 |
|
$b.= $gblIcon("blank"); |
810 |
|
} |
811 |
} |
} |
812 |
|
|
|
$ext = strtolower(strrchr($file,".")) ; |
|
|
if ( $ext=="" || |
|
|
strstr(join(" ",$gblEditable),$ext) ) |
|
|
{ |
|
|
$b = "<A HREF=\"" . $self . "?A=C&F=" ; |
|
|
$b .= urlencode($file) . "&D=" . urlencode($relDir) ; |
|
|
$b .= "\" TITLE=\"List contents\">" ; |
|
|
$b .= $gblIcon("view") . "</A>" ; |
|
|
} |
|
813 |
|
|
814 |
?> |
?> |
815 |
|
|
816 |
<TR><TD> |
<TR><TD> |
817 |
<A HREF="<?php echo $self ?>?A=E&F=<?php echo urlencode($file) |
<A HREF="<?= $info_url ?>" TITLE="View/Edit"> |
818 |
?>&D=<?php echo urlencode($relDir) ?>" TITLE="View/Edit"> |
<?= $gblIcon($ext) ?></A></TD> |
819 |
<?php echo $gblIcon($ext) ?></A></TD> |
<TD CLASS=LST><?= $file_url_html ?></TD> |
820 |
<TD CLASS=LST><?php echo $tstr ?></TD> |
<TD CLASS=LST ALIGN=center><?= $b ?></TD> |
821 |
<TD CLASS=LST ALIGN=center><?php echo $b ?></TD> |
<TD CLASS=LST ALIGN=left><?= $note_html ?></TD> |
822 |
<TD CLASS=LST><?php echo date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]",$mod) ?></TD> |
<TD CLASS=LST><?= date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]",$mod) ?></TD> |
823 |
<TD CLASS=LST><?php echo $sz ?>Bytes</TD></TR> |
<TD CLASS=LST><?= $sz ?>Bytes</TD></TR> |
824 |
|
|
825 |
<?php |
<?php |
826 |
} // iterate over files |
} // iterate over files |
829 |
if ($emptyDir) { |
if ($emptyDir) { |
830 |
?> |
?> |
831 |
|
|
832 |
<FORM METHOD="POST" ACTION="<?php echo $self ?>"> |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
833 |
<TR><TD></TD><TD COLSPAN=4 CLASS=BAR> |
<TR><TD></TD><TD COLSPAN=5 CLASS=BAR> |
834 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?php echo $relDir ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
835 |
OK TO DELETE THIS EMPTY FOLDER? |
OK TO DELETE THIS EMPTY FOLDER? |
836 |
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
837 |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="DELETE"> |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="DELETE"> |
842 |
} // end if emptyDir |
} // end if emptyDir |
843 |
?> |
?> |
844 |
|
|
845 |
<TR><TD></TD><TD COLSPAN=4><HR></TD></TR> |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
846 |
|
|
847 |
<FORM METHOD="POST" ACTION="<?php echo $self ?>"> |
<TR><TD></TD><TD COLSPAN=5> |
848 |
<TR><TD></TD><TD COLSPAN=4 CLASS=BAR>CREATE NEW |
<? |
849 |
|
if (file_exists(".info.inc")) { |
850 |
|
include(".info.inc"); |
851 |
|
} |
852 |
|
?> |
853 |
|
</TD></TR> |
854 |
|
|
855 |
|
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
856 |
|
|
857 |
|
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
858 |
|
<TR><TD></TD><TD COLSPAN=5 CLASS=BAR>CREATE NEW |
859 |
<INPUT TYPE="RADIO" NAME="T" VALUE="D" CHECKED>DIRECTORY -OR- |
<INPUT TYPE="RADIO" NAME="T" VALUE="D" CHECKED>DIRECTORY -OR- |
860 |
<INPUT TYPE="RADIO" NAME="T" VALUE="F">FILE : |
<INPUT TYPE="RADIO" NAME="T" VALUE="F">FILE : |
861 |
<NOBR>NAME <INPUT TYPE="TEXT" NAME="FN" SIZE=14> |
<NOBR>NAME <INPUT TYPE="TEXT" NAME="FN" SIZE=14> |
862 |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE"> |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE"> |
863 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?php echo $relDir ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
864 |
<INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR> |
<INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR> |
865 |
<NOBR>OR <A HREF="<?php echo $self |
<NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE |
|
?>?A=U&D=<?php echo urlencode($relDir) ?>">UPLOAD</A> A FILE |
|
866 |
</NOBR> |
</NOBR> |
867 |
</TD></TR> |
</TD></TR> |
868 |
</FORM> |
</FORM> |
874 |
|
|
875 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
876 |
|
|
877 |
function UploadPage($fsRoot, $relDir) { |
function UploadPage($fsRoot, $relDir, $filename) { |
878 |
|
|
879 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $GLOBALS["PHP_SELF"] ; |
880 |
if ($relDir == "") $relDir = "/" ; |
if ($relDir == "") $relDir = "/" ; |
882 |
|
|
883 |
<P><TABLE BORDER=0 CELLPADDING=5><TR><TD WIDTH=5></TD><TD CLASS=BAR> |
<P><TABLE BORDER=0 CELLPADDING=5><TR><TD WIDTH=5></TD><TD CLASS=BAR> |
884 |
<FORM ENCTYPE="multipart/form-data" METHOD="POST" |
<FORM ENCTYPE="multipart/form-data" METHOD="POST" |
885 |
ACTION="<?php echo $self ?>"> |
ACTION="<?= $self ?>"> |
886 |
DESTINATION DIRECTORY:<B><?php echo " " . $relDir ?></B> |
DESTINATION DIRECTORY:<B><?= " " . $relDir ?></B> |
887 |
|
<? if (isset($filename)) { ?> |
888 |
|
<br>DESTINATION FILE:<B><?= " " . $filename ?></B> |
889 |
|
<INPUT TYPE="HIDDEN" NAME="FILENAME" VALUE="<?= $filename ?>"> |
890 |
|
<? } ?> |
891 |
<P>PATHNAME OF LOCAL FILE<BR> |
<P>PATHNAME OF LOCAL FILE<BR> |
892 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?php echo $relDir ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
893 |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="UPLOAD"> |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="UPLOAD"> |
894 |
<INPUT SIZE=30 TYPE="FILE" NAME="FN"></P> |
<INPUT SIZE=30 TYPE="FILE" NAME="FN"></P> |
895 |
<P><INPUT TYPE="SUBMIT" VALUE="UPLOAD"></P> |
<P><INPUT TYPE="SUBMIT" VALUE="UPLOAD"></P> |
896 |
<P>If the <B>[BROWSE...]</B> button is not displayed,<BR> |
<P>If the <B>[BROWSE...]</B> button is not displayed,<BR> |
897 |
you must upgrade to an RFC1867-compliant browser.</P> |
you must upgrade to an RFC1867-compliant browser.</P> |
898 |
<P>Your browser:<BR><?php echo $GLOBALS["HTTP_USER_AGENT"] ?></P> |
<P>Your browser:<BR><?= $GLOBALS["HTTP_USER_AGENT"] ?></P> |
899 |
</FORM> |
</FORM> |
900 |
</TD></TR> |
</TD></TR> |
901 |
<TR><TD></TD><TD> |
<TR><TD></TD><TD> |
902 |
<FORM METHOD="POST" ACTION="<?php echo $self ?>"> |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
903 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?php echo $relDir ?>"><BR> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"><BR> |
904 |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"> |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"> |
905 |
</FORM> |
</FORM> |
906 |
</TD></TR></TABLE></P> |
</TD></TR></TABLE></P> |
953 |
StartHTML($title,$text) ; |
StartHTML($title,$text) ; |
954 |
?> |
?> |
955 |
|
|
956 |
<FORM ACTION="<?php echo $self ?>?HASH=create" METHOD="POST"> |
<FORM ACTION="<?= $self ?>?HASH=create" METHOD="POST"> |
957 |
<INPUT TYPE="HIDDEN" NAME="USER" VALUE="<?php echo $user ?>"> |
<INPUT TYPE="HIDDEN" NAME="USER" VALUE="<?= $user ?>"> |
958 |
<INPUT TYPE="HIDDEN" NAME="PW" VALUE="<?php echo $pw ?>"> |
<INPUT TYPE="HIDDEN" NAME="PW" VALUE="<?= $pw ?>"> |
959 |
|
|
960 |
<BLOCKQUOTE><B>If you are a site administrator:</B><BR><BR> |
<BLOCKQUOTE><B>If you are a site administrator:</B><BR><BR> |
961 |
Click below to <B>generate a password hash</B><BR>from |
Click below to <B>generate a password hash</B><BR>from |
987 |
} |
} |
988 |
|
|
989 |
|
|
990 |
|
////////////////////////////////////////////////////////////////// |
991 |
|
|
992 |
|
function WriteNote($target,$msg) { |
993 |
|
|
994 |
|
$dir=dirname($target); |
995 |
|
if (! file_exists($dir."/.note")) { |
996 |
|
mkdir($dir."/.note",0700); |
997 |
|
} |
998 |
|
$file=basename($target); |
999 |
|
|
1000 |
|
$note=fopen("$dir/.note/$file","w"); |
1001 |
|
fputs($note,"$msg\n"); |
1002 |
|
fclose($note); |
1003 |
|
|
1004 |
|
Logit($target,"added note $msg"); |
1005 |
|
|
1006 |
|
} |
1007 |
|
|
1008 |
|
function ReadNote($target) { |
1009 |
|
|
1010 |
|
$dir=dirname($target); |
1011 |
|
$file=basename($target); |
1012 |
|
$msg=""; |
1013 |
|
if (file_exists($dir."/.note/$file")) { |
1014 |
|
$note=fopen("$dir/.note/$file","r"); |
1015 |
|
$msg=fgets($note,4096); |
1016 |
|
fclose($note); |
1017 |
|
} |
1018 |
|
return StripSlashes($msg); |
1019 |
|
|
1020 |
|
} |
1021 |
|
|
1022 |
|
////////////////////////////////////////////////////////////////// |
1023 |
|
|
1024 |
|
function MoveTo($source,$folder) { |
1025 |
|
|
1026 |
|
$file=basename($source); |
1027 |
|
if (! file_exists($folder)) { |
1028 |
|
mkdir($folder,0700); |
1029 |
|
} |
1030 |
|
if (file_exists($source)) { |
1031 |
|
rename($source,"$folder/$file"); |
1032 |
|
} |
1033 |
|
} |
1034 |
|
|
1035 |
|
////////////////////////////////////////////////////////////////// |
1036 |
|
|
1037 |
|
function Lock($target) { |
1038 |
|
|
1039 |
|
$dir=dirname($target); |
1040 |
|
if (! file_exists($dir."/.lock")) { |
1041 |
|
mkdir($dir."/.lock",0700); |
1042 |
|
} |
1043 |
|
$file=basename($target); |
1044 |
|
|
1045 |
|
if (file_exists("$dir/.lock/$file")) { |
1046 |
|
Logit($target,"attempt to locked allready locked file!"); |
1047 |
|
} else { |
1048 |
|
$lock=fopen("$dir/.lock/$file","w"); |
1049 |
|
fputs($lock,"$GLOBALS[gblUserName]\n"); |
1050 |
|
fclose($lock); |
1051 |
|
|
1052 |
|
Logit($target,"file locked"); |
1053 |
|
} |
1054 |
|
|
1055 |
|
} |
1056 |
|
|
1057 |
|
function CheckLock($target) { |
1058 |
|
|
1059 |
|
$dir=dirname($target); |
1060 |
|
$file=basename($target); |
1061 |
|
$msg=0; |
1062 |
|
if (file_exists($dir."/.lock/$file")) { |
1063 |
|
$lock=fopen("$dir/.lock/$file","r"); |
1064 |
|
$msg=fgets($lock,4096); |
1065 |
|
fclose($lock); |
1066 |
|
} |
1067 |
|
return chop($msg); |
1068 |
|
|
1069 |
|
} |
1070 |
|
|
1071 |
|
function Unlock($target) { |
1072 |
|
|
1073 |
|
$dir=dirname($target); |
1074 |
|
$file=basename($target); |
1075 |
|
if (file_exists($dir."/.lock/$file")) { |
1076 |
|
unlink("$dir/.lock/$file"); |
1077 |
|
Logit($target,"file unlocked"); |
1078 |
|
} else { |
1079 |
|
Logit($target,"attempt to unlocked non-locked file!"); |
1080 |
|
} |
1081 |
|
|
1082 |
|
} |
1083 |
|
|
1084 |
|
////////////////////////////////////////////////////////////////// |
1085 |
|
|
1086 |
|
function urlpath($url) { |
1087 |
|
$url=urlencode(StripSlashes("$url")); |
1088 |
|
$url=str_replace("%2F","/",$url); |
1089 |
|
$url=str_replace("+","%20",$url); |
1090 |
|
return($url); |
1091 |
|
} |
1092 |
|
|
1093 |
|
////////////////////////////////////////////////////////////////// |
1094 |
|
|
1095 |
|
function safe_rename($from,$to) { |
1096 |
|
if (file_exists($from) && is_writable(dirname($to))) { |
1097 |
|
rename($from,$to); |
1098 |
|
} |
1099 |
|
} |
1100 |
|
|
1101 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1102 |
|
|
1166 |
// TODO : should rather check for escapeshellcmds |
// TODO : should rather check for escapeshellcmds |
1167 |
// but maybe RFC 18xx asserts safe filenames .... |
// but maybe RFC 18xx asserts safe filenames .... |
1168 |
$source = $FN ; |
$source = $FN ; |
1169 |
$target = $fsDir . "/" . $FN_name ; |
if (! isset($FILENAME)) { // from update file |
1170 |
|
$target = "$fsDir/$FN_name" ; |
1171 |
|
} else { |
1172 |
|
$target = "$fsDir/$FILENAME"; |
1173 |
|
} |
1174 |
|
|
1175 |
// backup old files first |
// backup old files first |
1176 |
$dir=dirname($target); |
$dir=dirname($target); |
1182 |
} |
} |
1183 |
$file=basename($target); |
$file=basename($target); |
1184 |
for($i=$GLOBALS[gblNumBackups]-1;$i>0;$i--) { |
for($i=$GLOBALS[gblNumBackups]-1;$i>0;$i--) { |
1185 |
if (! file_exists($dir."/.bak/".$i)) { |
MoveTo("$dir/.bak/$i/$file","$dir/.bak/".($i+1)."/"); |
|
mkdir($dir."/.bak/".$i,0700); |
|
|
} |
|
|
if (file_exists($dir."/.bak/".$i."/".$file)) { |
|
|
rename($dir."/.bak/".$i."/".$file, |
|
|
$dir."/.bak/".($i+1)."/".$file); |
|
|
} |
|
|
} |
|
|
if (file_exists($target)) { |
|
|
rename($target,$dir."/.bak/1/".$file); |
|
1186 |
} |
} |
1187 |
|
MoveTo($target,$dir."/.bak/1/"); |
1188 |
|
|
1189 |
copy($source,$target) ; |
copy($source,$target) ; |
1190 |
chmod($target,$gblFilePerms) ; |
chmod($target,$gblFilePerms) ; |
1191 |
clearstatcache() ; |
clearstatcache() ; |
1192 |
Logit($target,"uploaded"); |
Logit($target,"uploaded"); |
1193 |
|
if (isset($FILENAME)) { |
1194 |
|
Unlock($target); |
1195 |
|
} |
1196 |
break ; |
break ; |
1197 |
|
|
1198 |
case "SAVE" : |
case "SAVE" : |
1218 |
$relPath = $relDir . "/" . $FN ; |
$relPath = $relDir . "/" . $FN ; |
1219 |
switch ( $T ) { |
switch ( $T ) { |
1220 |
case "D" : // create a directory |
case "D" : // create a directory |
1221 |
if ( ! @mkdir($path,$gblDirPerms) ) |
if ( ! @mkdir($path,$gblDirPerms) ) |
1222 |
Error("Mkdir failed",$relPath) ; // eg. if it exists |
Error("Mkdir failed",$relPath) ; // eg. if it exists |
1223 |
clearstatcache() ; |
clearstatcache() ; |
1224 |
break ; |
break ; |
1225 |
case "F" : // create a new file |
case "F" : // create a new file |
1226 |
// this functionality is doubled in DetailView(). |
// this functionality is doubled in DetailView(). |
1227 |
// better keep it here altogether |
// better keep it here altogether |
1228 |
// chmod perms to $gblFilePerms |
// chmod perms to $gblFilePerms |
1229 |
if ( file_exists($path) && !is_writable($path) ) |
if ( file_exists($path) && !is_writable($path) ) |
1230 |
Error("File not writable", $relPath) ; |
Error("File not writable", $relPath) ; |
1231 |
$tstr = $PHP_SELF . "?A=E&D=" . $relDir . "&F=" . $FN ; |
$fh = fopen($path, "w+") ; |
1232 |
header("Location: " . $tstr) ; |
if ($fh) { |
1233 |
exit ; |
fputs($fh,"\n"); |
1234 |
|
fclose($fh) ; |
1235 |
|
LogIt($path,"file created"); |
1236 |
|
} else { |
1237 |
|
Error("Creation of file $relPath failed -- $path"); |
1238 |
|
} |
1239 |
|
$tstr = "$PHP_SELF?A=E&D=".urlencode($relDir)."&F=".urlencode($FN) ; |
1240 |
|
header("Location: " . $tstr) ; |
1241 |
|
exit ; |
1242 |
} |
} |
1243 |
break ; |
break ; |
1244 |
|
|
1264 |
exit ; |
exit ; |
1265 |
} else { |
} else { |
1266 |
Logit($path,"file deleted"); |
Logit($path,"file deleted"); |
1267 |
if (! file_exists("$dir/.del/.log")) { |
MoveTo("$dir/.log/$file","$dir/.del/.log/"); |
1268 |
mkdir("$dir/.del/.log",0700); |
MoveTo("$dir/.note/$file","$dir/.del/.note/"); |
1269 |
} |
MoveTo("$dir/.lock/$file","$dir/.del/.lock/"); |
|
rename("$dir/.log/$file","$dir/.del/.log/$file"); |
|
1270 |
} |
} |
1271 |
} |
} |
1272 |
else { // delete directory |
else { // delete directory |
1286 |
$file=substr($FN,4,strlen($FN)-4); |
$file=substr($FN,4,strlen($FN)-4); |
1287 |
|
|
1288 |
Logit("$fsDir/.del/$file","undeleted"); |
Logit("$fsDir/.del/$file","undeleted"); |
1289 |
rename("$fsDir/.del/$file","$fsDir/$file"); |
MoveTo("$fsDir/.del/$file","$fsDir/"); |
1290 |
rename("$fsDir/.del/.log/$file","$fsDir/.log/$file"); |
MoveTo("$fsDir/.del/.log/$file","$fsDir/.log/"); |
1291 |
|
MoveTo("$fsDir/.del/.note/$file","$fsDir/.note/"); |
1292 |
|
MoveTo("$fsDir/.del/.lock/$file","$fsDir/.lock/"); |
1293 |
|
|
1294 |
break ; |
break ; |
1295 |
|
|
1297 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1298 |
|
|
1299 |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
1300 |
rename("$fsDir/$FN","$fsDir/$NEWNAME"); |
safe_rename("$fsDir/$FN","$fsDir/$NEWNAME"); |
1301 |
rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME"); |
safe_rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME"); |
1302 |
|
safe_rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME"); |
1303 |
|
safe_rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME"); |
1304 |
|
for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) { |
1305 |
|
safe_rename("$fsDir/.bak/$i/$FN","$fsDir/.bak/$i/$NEWNAME"); |
1306 |
|
} |
1307 |
|
|
1308 |
|
break ; |
1309 |
|
|
1310 |
|
case "NOTE" : |
1311 |
|
WriteNote("$fsDir/$FN","$NOTE"); |
1312 |
|
break ; |
1313 |
|
|
1314 |
|
case "UNLOCK" : |
1315 |
|
if ( $CONFIRM != "on" ) break ; |
1316 |
|
Unlock("$fsDir/$FN"); |
1317 |
break ; |
break ; |
1318 |
|
|
1319 |
default : |
default : |
1331 |
// $A=U : upload to path given in $D |
// $A=U : upload to path given in $D |
1332 |
// $A=E : display detail of file $D/$F and edit |
// $A=E : display detail of file $D/$F and edit |
1333 |
// $A=C : display code in file $D/$F |
// $A=C : display code in file $D/$F |
1334 |
|
// $A=Co : checkout file $D/$F |
1335 |
|
// $A=Ci : checkin file $D/$F |
1336 |
|
// $A=V : view file (do nothing except log) |
1337 |
// default : display directory $D |
// default : display directory $D |
1338 |
|
|
1339 |
switch ($A) { |
switch ($A) { |
1355 |
// listing of $relDir/$F |
// listing of $relDir/$F |
1356 |
DisplayCode($gblFsRoot, $relDir, $F) ; |
DisplayCode($gblFsRoot, $relDir, $F) ; |
1357 |
exit ; |
exit ; |
1358 |
|
case "Co" : |
1359 |
|
// checkout |
1360 |
|
Lock("$gblFsRoot/$relDir/$F"); |
1361 |
|
header("Content-Disposition: attachment; filename=$F" ); |
1362 |
|
Header("Location: ".urlpath("$relDir/$F")); |
1363 |
|
exit; |
1364 |
|
case "Ci" : |
1365 |
|
// upload && update to $relDir |
1366 |
|
if (!is_writeable($gblFsRoot . $relDir)) |
1367 |
|
Error("Write access denied",$relDir) ; |
1368 |
|
$text = "Use this page to update a single " ; |
1369 |
|
$text .= "file to <B>$SERVER_NAME</B>." ; |
1370 |
|
StartHTML("(Update file Page)", $text) ; |
1371 |
|
UploadPage($gblFsRoot, $relDir, $F) ; |
1372 |
|
EndHTML() ; |
1373 |
|
exit ; |
1374 |
|
case "V" : |
1375 |
|
// view |
1376 |
|
LogIt("$gblFsRoot/$relDir/$F","viewed"); |
1377 |
|
header("Content-Disposition: attachment; filename=$F" ); |
1378 |
|
Header("Location: ".urlpath("$relDir/$F")); |
1379 |
|
exit; |
1380 |
} |
} |
1381 |
|
|
1382 |
// default: display directory $relDir |
// default: display directory $relDir |