157 |
|
|
158 |
global $gblEditable, $gblImages, |
global $gblEditable, $gblImages, |
159 |
$gblDateFmt, $gblTimeFmt, |
$gblDateFmt, $gblTimeFmt, |
160 |
|
$gblPermNote, |
161 |
$webRoot, $html, |
$webRoot, $html, |
162 |
$HTTP_SERVER_VARS ; |
$HTTP_SERVER_VARS ; |
163 |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
209 |
$fstr = fread($fh,filesize($fsPath)) ; |
$fstr = fread($fh,filesize($fsPath)) ; |
210 |
fclose($fh) ; |
fclose($fh) ; |
211 |
$fstr = htmlentities( $fstr ) ; |
$fstr = htmlentities( $fstr ) ; |
|
?> |
|
212 |
|
|
213 |
<FORM ACTION="<?= $self ?>" METHOD="POST"> |
include("$html/DetailPage-edit.html"); |
|
<SPAN TITLE="Click [SAVE] to store updated contents."> |
|
|
<B>DOCUMENT CONTENTS</B> |
|
|
</SPAN><BR> |
|
|
<TEXTAREA NAME="FILEDATA" ROWS=18 COLS=70 WRAP="OFF"><?php |
|
|
echo($fstr) ; ?></TEXTAREA> |
|
|
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ; ?>"> |
|
|
<INPUT TYPE="HIDDEN" NAME="FN" VALUE="<?= $fn ; ?>"> |
|
|
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="SAVE"> |
|
|
<INPUT TYPE="HIDDEN" SIZE=48 MAXLENGTH=255 NAME="RELPATH" |
|
|
VALUE="<?= $relPath ; ?>"> |
|
|
<br> |
|
|
<INPUT TYPE="RESET" VALUE="UNDO ALL CHANGES"> |
|
|
<INPUT TYPE="SUBMIT" VALUE="SAVE"> |
|
|
</FORM> |
|
|
|
|
|
<?php |
|
214 |
} |
} |
215 |
if ( !$file_lock && $ext!="" && strstr(join(' ',$gblImages),$ext) ) { |
if ( !$file_lock && $ext!="" && strstr(join(' ',$gblImages),$ext) ) { |
216 |
$info = getimagesize($fsPath) ; |
$info = getimagesize($fsPath) ; |
217 |
$tstr = "<IMG SRC=\"$webRoot".urlpath($relPath)."\" BORDER=0 " ; |
$tstr = "<IMG SRC=\"$self?A=V&D=".urlpath(dirname($relPath))."&F=".urlpath(basename($relPath))."\" BORDER=0 " ; |
218 |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
219 |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
220 |
// echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
// echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
221 |
echo $tstr ; |
echo $tstr ; |
222 |
} |
} |
223 |
|
|
|
?> |
|
224 |
|
|
225 |
<FORM ACTION="<?= $self ; ?>" METHOD="POST"> |
print '<FORM ACTION="'.$self.'" METHOD="POST"> |
226 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ; ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="'.$relDir.'"> |
227 |
<INPUT TYPE="HIDDEN" NAME="FN" VALUE="<?= $fn ; ?>"> |
<INPUT TYPE="HIDDEN" NAME="FN" VALUE="'.$fn.'"> |
228 |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"><BR> |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"><BR> |
229 |
|
'; |
230 |
<?php |
|
231 |
|
if ($file_lock && check_perm($relDir.$fn,trperm_w)) { |
232 |
if ($file_lock) { |
include("$html/DetailPage-unlock.html"); |
|
?> |
|
|
<hr> |
|
|
<SPAN TITLE="Check OK and click UNLOCK to remove lock on file."> |
|
|
<B>OK TO FORCE LOCK REMOVAL ON "<?= $fn ; ?>" HELD BY <?= $file_lock ?>? </B></SPAN> |
|
|
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
|
|
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="UNLOCK"> |
|
|
<? |
|
233 |
} // file_lock |
} // file_lock |
234 |
|
|
235 |
if (substr($fn,0,4) == ".del") { |
if (substr($fn,0,4) == ".del") { |
241 |
} |
} |
242 |
|
|
243 |
if ($exists && $writable) { |
if ($exists && $writable) { |
244 |
?> |
include("$html/DetailPage-undelete.html"); |
245 |
|
include("$html/DetailPage-rename.html"); |
|
<HR> |
|
|
<a name="undelete"> |
|
|
<SPAN TITLE="Check OK and click [<?= $action ?>] to <?= $desc ?>."> |
|
|
<B>OK TO <?= $action ?> "<?= $fn ; ?>"? </B></SPAN> |
|
|
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
|
|
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="<?= $action ?>"> |
|
|
|
|
|
<HR> |
|
|
<a name="rename"> |
|
|
<SPAN TITLE="Check OK and click [RENAME] to rename."> |
|
|
<B>OK TO RENAME "<?= $fn ; ?>" TO |
|
|
<INPUT TYPE="TEXT" SIZE=24 MAXLENGTH=255 NAME="NEWNAME" VALUE="<?= $fn ?>"> |
|
|
? </B></SPAN> |
|
|
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
|
|
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="RENAME"> |
|
|
|
|
|
<?php |
|
|
} // exists && writable |
|
|
?> |
|
|
<HR> |
|
|
<a name="note"> |
|
|
<B>NOTE FOR "<?= $fn ; ?>": |
|
|
<INPUT TYPE="TEXT" SIZE=50 MAXLENGTH=255 NAME="NOTE" VALUE="<?= ReadNote($fsPath) ?>"> |
|
|
</B></SPAN> |
|
|
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="NOTE"> |
|
246 |
|
|
247 |
</FORM> |
} |
248 |
|
|
249 |
|
if (check_perm($relDir.$fn,$gblPermNote)) { |
250 |
|
include("$html/DetailPage-note.html"); |
251 |
|
} |
252 |
|
|
253 |
<?php |
print "</FORM>"; |
254 |
|
|
255 |
$name=basename("$fsDir/$fn"); |
$name=basename("$fsDir/$fn"); |
256 |
$logname=dirname("$fsDir/$fn")."/.log/$name"; |
$logname=dirname("$fsDir/$fn")."/.log/$name"; |
436 |
|
|
437 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
438 |
|
|
439 |
function GifIcon($txt) { |
function GifIcon($txt = "") { |
440 |
global $gblIconLocation ; |
global $gblIconLocation, $gblImages ; |
441 |
|
|
442 |
switch (strtolower($txt)) { |
switch (strtolower($txt)) { |
|
case ".bmp" : |
|
|
case ".gif" : |
|
|
case ".jpg" : |
|
|
case ".jpeg": |
|
|
case ".tif" : |
|
|
case ".tiff": |
|
|
$d = "image2.gif" ; |
|
|
break ; |
|
443 |
case ".doc" : |
case ".doc" : |
444 |
$d = "layout.gif" ; |
$d = "layout.gif" ; |
445 |
break ; |
break ; |
517 |
$d = "quill.gif"; |
$d = "quill.gif"; |
518 |
break; |
break; |
519 |
default : |
default : |
520 |
$d = "generic.gif" ; |
if (in_array(strtolower($txt),$gblImages)) { |
521 |
|
$d = "image2.gif" ; |
522 |
|
} else { |
523 |
|
$d = "generic.gif" ; |
524 |
|
} |
525 |
} |
} |
526 |
|
|
527 |
|
|
528 |
return "<IMG SRC=\"$gblIconLocation" . $d . "\" BORDER=0>" ; |
return "<IMG SRC=\"$gblIconLocation" . $d . "\" BORDER=0>" ; |
529 |
} // end function GifIcon |
} // end function GifIcon |
530 |
|
|
535 |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
536 |
$gblIgnoreUnknownFileType, $gblRepositoryDir, |
$gblIgnoreUnknownFileType, $gblRepositoryDir, |
537 |
$gblLogin, $gblUserName, $gblDateFmt, $gblTimeFmt, |
$gblLogin, $gblUserName, $gblDateFmt, $gblTimeFmt, |
538 |
|
$gblPermNote, |
539 |
$fsRealmDir, $realm, $realm_sep, |
$fsRealmDir, $realm, $realm_sep, |
540 |
$html, $realm_config, |
$html, $realm_config, |
541 |
$HTTP_GET_VARS, $HTTP_SERVER_VARS; |
$HTTP_GET_VARS, $HTTP_SERVER_VARS; |
610 |
$text .= "<br>Examine list of files <a href=\"$self?A=Ch1\">changed in last day</a> or <a href=\"$self?A=Ch\">all changes</a>."; |
$text .= "<br>Examine list of files <a href=\"$self?A=Ch1\">changed in last day</a> or <a href=\"$self?A=Ch\">all changes</a>."; |
611 |
StartHTML("(Navigate)",$text) ; |
StartHTML("(Navigate)",$text) ; |
612 |
|
|
613 |
echo "<TABLE BORDER=0 CELLPADDING=2 |
print "<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=3 WIDTH=\"100%\">" ; |
|
CELLSPACING=3 WIDTH=\"100%\">" ; |
|
614 |
|
|
615 |
// updir (parent) bar |
// updir (parent) bar |
616 |
if (chopsl($fsDir) != chopsl($fsRoot)) { |
if (chopsl($fsDir) != chopsl($fsRoot)) { |
628 |
return $out; |
return $out; |
629 |
} |
} |
630 |
|
|
631 |
if (! HTTP_GET_VAR("dsort")) $dsort = "name"; // default directory sort |
$dsort = HTTP_GET_VAR("dsort"); |
632 |
|
if (! isset($dsort)) $dsort = "name"; // default directory sort |
633 |
|
|
634 |
$dsort_arr = array( |
$dsort_arr = array( |
635 |
"name" => array ("rname", "note"), |
"name" => array ("rname", "note"), |
638 |
"rnote" => array ("name", "note") |
"rnote" => array ("name", "note") |
639 |
); |
); |
640 |
|
|
641 |
if (! HTTP_GET_VAR("fsort")) $fsort = "name"; // default directory sort |
$fsort = HTTP_GET_VAR("fsort"); |
642 |
|
if (! isset($fsort)) $fsort = "name"; // default directory sort |
643 |
|
|
644 |
$fsort_arr = array( |
$fsort_arr = array( |
645 |
"name" => array ("rname", "note", "date", "size"), |
"name" => array ("rname", "note", "date", "size"), |
701 |
} |
} |
702 |
|
|
703 |
$dir_url=$self."?D=".urlencode(chopsl($relDir)."/".$dir); |
$dir_url=$self."?D=".urlencode(chopsl($relDir)."/".$dir); |
704 |
|
if (check_perm($relDir.$dir,$gblPermNote)) { |
705 |
|
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".$dirNote[$key]; |
706 |
|
} else { |
707 |
|
$note_html=$dirNote[$key]; |
708 |
|
} |
709 |
|
|
710 |
include("$html/Navigate-dirEntry.html"); |
include("$html/Navigate-dirEntry.html"); |
711 |
|
|
712 |
} // iterate over dirs |
} // iterate over dirs |
787 |
$file_url_html .= substr($file,5,strlen($file)-5) . "</a> <a href=\"$info_url#undelete\"><SPAN CLASS=deleted TITLE=\"deleted\">deleted</span></a>"; |
$file_url_html .= substr($file,5,strlen($file)-5) . "</a> <a href=\"$info_url#undelete\"><SPAN CLASS=deleted TITLE=\"deleted\">deleted</span></a>"; |
788 |
} |
} |
789 |
|
|
790 |
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".ReadNote($path); |
if (check_perm($relDir.$file,$gblPermNote)) { |
791 |
|
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".$fileNote[$key]; |
792 |
|
} else { |
793 |
|
$note_html=$fileNote[$key]; |
794 |
|
} |
795 |
|
|
796 |
$ext = strtolower(strrchr($file,".")) ; |
$ext = strtolower(strrchr($file,".")) ; |
797 |
|
|
811 |
$file_url_html = "$file $a"; |
$file_url_html = "$file $a"; |
812 |
} |
} |
813 |
} else { |
} else { |
814 |
$b.="<A HREF=\"$self?A=Co&D=".urlencode($relDir)."&F=".urlencode($file); |
if (check_perm($relDir.$file,trperm_w)) { |
815 |
$b.="\" TITLE=\"Checkout file for edit\">" ; |
$b.="<A HREF=\"$self?A=Co&D=".urlencode($relDir)."&F=".urlencode($file); |
816 |
$b.=$gblIcon("checkout")."</A>"; |
$b.="\" TITLE=\"Checkout file for edit\">" ; |
817 |
|
$b.=$gblIcon("checkout")."</A>"; |
818 |
|
} |
819 |
|
|
820 |
if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) { |
if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) { |
821 |
$b.="<A HREF=\"$self?A=C&D=".urlencode($relDir)."&F=".urlencode($file); |
$b.="<A HREF=\"$self?A=C&D=".urlencode($relDir)."&F=".urlencode($file); |
832 |
|
|
833 |
} // iterate over files |
} // iterate over files |
834 |
} else { // end if no files |
} else { // end if no files |
835 |
?> |
include("$html/Navigate-noFiles.html"); |
|
<TR><TD></TD><TD COLSPAN=5 CLASS=LST> |
|
|
No files in this directory |
|
|
</TD></TR> |
|
|
<? |
|
836 |
} |
} |
837 |
|
|
838 |
if ($emptyDir && $relDir != "") { |
if ($emptyDir && $relDir != "") { |
839 |
?> |
include("$html/Navigate-emptyDir.html"); |
|
|
|
|
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
|
|
<TR><TD></TD><TD COLSPAN=5 CLASS=BAR> |
|
|
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
|
|
OK TO DELETE THIS EMPTY FOLDER? |
|
|
<INPUT TYPE="CHECKBOX" NAME="CONFIRM"> |
|
|
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="DELETE"> |
|
|
</TD></TR> |
|
|
</FORM> |
|
|
|
|
|
<?php |
|
840 |
} // end if emptyDir |
} // end if emptyDir |
|
?> |
|
|
|
|
|
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
|
841 |
|
|
842 |
<? |
include("$html/Navigate-hr.html"); |
843 |
|
|
844 |
if (file_exists("$fsRealmDir/$realm".$realm_sep."info.inc")) { |
if (file_exists("$fsRealmDir/$realm".$realm_sep."info.inc")) { |
845 |
print "<TR><TD></TD><TD COLSPAN=5>"; |
print "<TR><TD></TD><TD COLSPAN=5>"; |
846 |
include("$fsRealmDir/$realm".$realm_sep."info.inc"); |
include("$fsRealmDir/$realm".$realm_sep."info.inc"); |
847 |
print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
print "</TD></TR>"; |
848 |
} elseif (file_exists("$gblRepositoryDir/.info.inc")) { |
include("$html/Navigate-hr.html"); |
849 |
print "<TR><TD></TD><TD COLSPAN=5>"; |
} elseif (file_exists("$gblRepositoryDir/.info.inc")) { |
850 |
include("$gblRepositoryDir/.info.inc"); |
print "<TR><TD></TD><TD COLSPAN=5>"; |
851 |
print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
include("$gblRepositoryDir/.info.inc"); |
852 |
} |
print "</TD></TR>"; |
853 |
|
include("$html/Navigate-hr.html"); |
854 |
|
} |
855 |
|
|
856 |
|
include("$html/Navigate-createNew.html"); |
857 |
|
|
858 |
?> |
print "</TABLE>"; |
|
|
|
|
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
|
|
<TR><TD></TD><TD COLSPAN=5 CLASS=BAR>CREATE NEW |
|
|
<INPUT TYPE="RADIO" NAME="T" VALUE="D" CHECKED>DIRECTORY -OR- |
|
|
<INPUT TYPE="RADIO" NAME="T" VALUE="F">FILE : |
|
|
<NOBR>NAME <INPUT TYPE="TEXT" NAME="FN" SIZE=14> |
|
|
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE"> |
|
|
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
|
|
<INPUT TYPE="SUBMIT" VALUE="CREATE" NAME="CREATE"> |
|
|
</NOBR> |
|
|
<NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE</NOBR> |
|
|
</TD></TR> |
|
|
</FORM> |
|
|
</TABLE> |
|
859 |
|
|
|
<?php |
|
860 |
EndHTML() ; |
EndHTML() ; |
861 |
} // end function Navigate |
} // end function Navigate |
862 |
|
|
947 |
$file=basename($target); |
$file=basename($target); |
948 |
|
|
949 |
$note=fopen("$dir/.note/$file","w"); |
$note=fopen("$dir/.note/$file","w"); |
950 |
|
if (! $note) { |
951 |
|
Error("Error writing note","Can't open note file <tt>$dir/.note/$file</tt> for writing",1); |
952 |
|
} |
953 |
fputs($note,"$msg\n"); |
fputs($note,"$msg\n"); |
954 |
fclose($note); |
fclose($note); |
955 |
|
|
1640 |
// read mime.types |
// read mime.types |
1641 |
readMime(); |
readMime(); |
1642 |
|
|
1643 |
HTTP_POST_VAR("FN"); |
if (! isset($gblPermNote)) { |
1644 |
|
$gblPermNote = trperm_r; |
1645 |
|
} |
1646 |
|
|
1647 |
|
HTTP_POST_VAR("FN"); |
1648 |
|
|
1649 |
if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST") { |
if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST") { |
1650 |
// take variables from server |
// take variables from server |
1701 |
|
|
1702 |
$source = $FN_name ; |
$source = $FN_name ; |
1703 |
if (! file_exists($source)) { |
if (! file_exists($source)) { |
1704 |
Error("You must select file with browse to upload it!"); |
Error("You must select file with browse to upload it!","If file is too big, you might need to modify php configuration options <tt>post_max_size</tt> and <tt>upload_max_filesize</tt>",1); |
1705 |
} |
} |
1706 |
|
|
1707 |
if (HTTP_POST_VAR("FILENAME")) check_filename($FILENAME); |
if (HTTP_POST_VAR("FILENAME")) check_filename($FILENAME); |
1871 |
safe_rename($fsDir,$FN,$NEWNAME); |
safe_rename($fsDir,$FN,$NEWNAME); |
1872 |
break ; |
break ; |
1873 |
|
|
1874 |
case "NOTE" : |
case "NOTE" : |
1875 |
$NOTE=stripSlashes($HTTP_POST_VARS["NOTE"]); |
if (! HTTP_POST_VAR("NOTE")) |
1876 |
WriteNote("$fsDir/$FN","$NOTE"); |
Error("Can't add note to object","Can't find var <tt>\$NOTE</tt>",1); |
1877 |
|
if (! check_perm("$relDir/$FN", trperm_w)) |
1878 |
|
Error("Access denied","User <tt>$gblLogin</tt> tried to add note to <tt>$relDir/$FN</tt> without valid trustee.",1); |
1879 |
|
|
1880 |
|
WriteNote("$fsDir/$FN",$NOTE); |
1881 |
break ; |
break ; |
1882 |
|
|
1883 |
case "UNLOCK" : |
case "UNLOCK" : |
1884 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1885 |
|
if (! check_perm("$relDir/$FN", trperm_w)) |
1886 |
|
Error("Access denied","User <tt>$gblLogin</tt> tried to unlock <tt>$relDir/$FN</tt> without valid trustee.",1); |
1887 |
Unlock("$fsDir/$FN"); |
Unlock("$fsDir/$FN"); |
1888 |
break ; |
break ; |
1889 |
|
|
1897 |
header("Location: ".$tstr) ; |
header("Location: ".$tstr) ; |
1898 |
exit ; |
exit ; |
1899 |
} |
} |
1900 |
|
|
1901 |
// check for mode.. navigate, code display, upload, or detail? |
// check for mode.. navigate, code display, upload, or detail? |
1902 |
// $A=U : upload to path given in $D |
// $A=U : upload to path given in $D |
1903 |
// $A=E : display detail of file $D/$F and edit |
// $A=E : display detail of file $D/$F and edit |