74 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
75 |
|
|
76 |
$gblTitle = "Document Manager"; |
$gblTitle = "Document Manager"; |
77 |
$gblVersion = "2.0-pre1"; |
$gblVersion = "2.0-pre2"; |
78 |
|
|
79 |
$secHash = ""; |
$secHash = ""; |
80 |
|
|
81 |
// location of html files |
// location of html files |
82 |
$html = $gblIncDir."/html"; |
$html = $gblIncDir."/html"; |
83 |
|
|
84 |
LoadLanguage($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]); |
if (isset($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"])) { |
85 |
|
LoadLanguage($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]); |
86 |
|
} |
87 |
|
|
88 |
// for security and configuration |
// for security and configuration |
89 |
$realm=$HTTP_SERVER_VARS["HTTP_HOST"]; |
$realm=$HTTP_SERVER_VARS["HTTP_HOST"]; |
92 |
if ($fsDocumentRoot == "") Error("Configuration error","Can't get SCRIPT_FILENAME from your web server. Please set <tt>\$fsDocumentRoot</tt> in <tt>\$</tt>",1); |
if ($fsDocumentRoot == "") Error("Configuration error","Can't get SCRIPT_FILENAME from your web server. Please set <tt>\$fsDocumentRoot</tt> in <tt>\$</tt>",1); |
93 |
|
|
94 |
// globals for later |
// globals for later |
95 |
$gblLogin = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$gblLogin = HTTP_SERVER_VAR("PHP_AUTH_USER"); |
96 |
$gblPasswd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
$gblPasswd = HTTP_SERVER_VAR("PHP_AUTH_PW"); |
97 |
|
|
98 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
99 |
|
|
149 |
} |
} |
150 |
include("$html/footer.html"); |
include("$html/footer.html"); |
151 |
|
|
152 |
global $debug; |
# global $debug; |
153 |
if ($debug) print $debug; |
# if ($debug) print $debug; |
154 |
} // end function EndHTML |
} // end function EndHTML |
155 |
|
|
156 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
159 |
|
|
160 |
global $gblEditable, $gblImages, |
global $gblEditable, $gblImages, |
161 |
$gblDateFmt, $gblTimeFmt, |
$gblDateFmt, $gblTimeFmt, |
162 |
|
$gblPermNote, |
163 |
$webRoot, $html, |
$webRoot, $html, |
164 |
$HTTP_SERVER_VARS ; |
$HTTP_SERVER_VARS ; |
165 |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
191 |
$title = "("._("Detail Page").")" ; |
$title = "("._("Detail Page").")" ; |
192 |
StartHTML($title, $text) ; |
StartHTML($title, $text) ; |
193 |
|
|
194 |
echo "<H3>" . $relDir . "/" . $fn . "</H3>" ; |
print "<H3>".$relDir.$fn."</H3>"; |
195 |
|
|
196 |
if ($exists) { // get file info |
if ($exists) { // get file info |
197 |
$fsize = filesize($fsPath) ; |
$fsize = filesize($fsPath) ; |
198 |
$fmodified = date("$gblDateFmt $gblTimeFmt", filemtime($fsPath)) ; |
$fmodified = date("$gblDateFmt $gblTimeFmt", filemtime($fsPath)) ; |
211 |
$fstr = fread($fh,filesize($fsPath)) ; |
$fstr = fread($fh,filesize($fsPath)) ; |
212 |
fclose($fh) ; |
fclose($fh) ; |
213 |
$fstr = htmlentities( $fstr ) ; |
$fstr = htmlentities( $fstr ) ; |
|
?> |
|
214 |
|
|
215 |
<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 |
|
216 |
} |
} |
217 |
if ( !$file_lock && $ext!="" && strstr(join(' ',$gblImages),$ext) ) { |
if ( !$file_lock && $ext!="" && strstr(join(' ',$gblImages),$ext) ) { |
218 |
$info = getimagesize($fsPath) ; |
$info = getimagesize($fsPath) ; |
219 |
$tstr = "<IMG SRC=\"$webRoot".urlpath($relPath)."\" BORDER=0 " ; |
$tstr = "<IMG SRC=\"$self?A=V&D=".urlpath(dirname($relPath))."&F=".urlpath(basename($relPath))."\" BORDER=0 " ; |
220 |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
221 |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
222 |
// echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
// echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
223 |
echo $tstr ; |
echo $tstr ; |
224 |
} |
} |
225 |
|
|
|
?> |
|
226 |
|
|
227 |
<FORM ACTION="<?= $self ; ?>" METHOD="POST"> |
print '<FORM ACTION="'.$self.'" METHOD="POST"> |
228 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ; ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="'.$relDir.'"> |
229 |
<INPUT TYPE="HIDDEN" NAME="FN" VALUE="<?= $fn ; ?>"> |
<INPUT TYPE="HIDDEN" NAME="FN" VALUE="'.$fn.'"> |
230 |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"><BR> |
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"><BR> |
231 |
|
'; |
232 |
<?php |
|
233 |
|
if ($file_lock && check_perm($relDir.$fn,trperm_w)) { |
234 |
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"> |
|
|
<? |
|
235 |
} // file_lock |
} // file_lock |
236 |
|
|
237 |
if (substr($fn,0,4) == ".del") { |
if (substr($fn,0,4) == ".del") { |
243 |
} |
} |
244 |
|
|
245 |
if ($exists && $writable) { |
if ($exists && $writable) { |
246 |
?> |
include("$html/DetailPage-undelete.html"); |
247 |
|
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"> |
|
248 |
|
|
249 |
</FORM> |
} |
250 |
|
|
251 |
|
if (check_perm($relDir.$fn,$gblPermNote)) { |
252 |
|
include("$html/DetailPage-note.html"); |
253 |
|
} |
254 |
|
|
255 |
<?php |
print "</FORM>"; |
256 |
|
|
257 |
$name=basename("$fsDir/$fn"); |
$name=basename("$fsDir/$fn"); |
258 |
$logname=dirname("$fsDir/$fn")."/.log/$name"; |
$logname=dirname("$fsDir/$fn")."/.log/$name"; |
438 |
|
|
439 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
440 |
|
|
441 |
function GifIcon($txt) { |
function GifIcon($txt = "") { |
442 |
global $gblIconLocation ; |
global $gblIconLocation, $gblImages ; |
443 |
|
|
444 |
switch (strtolower($txt)) { |
switch (strtolower($txt)) { |
|
case ".bmp" : |
|
|
case ".gif" : |
|
|
case ".jpg" : |
|
|
case ".jpeg": |
|
|
case ".tif" : |
|
|
case ".tiff": |
|
|
$d = "image2.gif" ; |
|
|
break ; |
|
445 |
case ".doc" : |
case ".doc" : |
446 |
$d = "layout.gif" ; |
$d = "layout.gif" ; |
447 |
break ; |
break ; |
519 |
$d = "quill.gif"; |
$d = "quill.gif"; |
520 |
break; |
break; |
521 |
default : |
default : |
522 |
$d = "generic.gif" ; |
if (in_array(strtolower($txt),$gblImages)) { |
523 |
|
$d = "image2.gif" ; |
524 |
|
} else { |
525 |
|
$d = "generic.gif" ; |
526 |
|
} |
527 |
} |
} |
528 |
|
|
529 |
|
|
530 |
return "<IMG SRC=\"$gblIconLocation" . $d . "\" BORDER=0>" ; |
return "<IMG SRC=\"$gblIconLocation" . $d . "\" BORDER=0>" ; |
531 |
} // end function GifIcon |
} // end function GifIcon |
532 |
|
|
536 |
|
|
537 |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
538 |
$gblIgnoreUnknownFileType, $gblRepositoryDir, |
$gblIgnoreUnknownFileType, $gblRepositoryDir, |
539 |
$gblLogin, $gblUserName, |
$gblLogin, $gblUserName, $gblDateFmt, $gblTimeFmt, |
540 |
|
$gblPermNote, |
541 |
$fsRealmDir, $realm, $realm_sep, |
$fsRealmDir, $realm, $realm_sep, |
542 |
$html, $realm_config, |
$html, $realm_config, |
543 |
$HTTP_GET_VARS, $HTTP_SERVER_VARS; |
$HTTP_GET_VARS, $HTTP_SERVER_VARS; |
588 |
if ( HTTP_GET_VAR("show_deleted") == 1 && ($dir = @opendir("$fsDir/.del")) ) { |
if ( HTTP_GET_VAR("show_deleted") == 1 && ($dir = @opendir("$fsDir/.del")) ) { |
589 |
while ($item = readdir($dir)) { |
while ($item = readdir($dir)) { |
590 |
if ( substr($item,0,1) == "." || strstr($hide_items,",$item,") || !check_perm($relDir.$item,trperm_w) ) continue ; |
if ( substr($item,0,1) == "." || strstr($hide_items,",$item,") || !check_perm($relDir.$item,trperm_w) ) continue ; |
591 |
$fileList[$item] = ".del/$item" ; |
if (is_file($fsDir.".del/$item")) { |
592 |
$fileDate[$item] = filemtime($fsDir.".del/$path") ; |
$fileList[$item] = ".del/$item" ; |
593 |
$fileSize[$item] = filesize($fsDir.".del/$path") ; |
$fileDate[$item] = filemtime($fsDir.".del/$item") ; |
594 |
$fileNote[$item] = ReadNote($fsDir.".del/$item"); |
$fileSize[$item] = filesize($fsDir.".del/$item") ; |
595 |
|
$fileNote[$item] = ReadNote($fsDir.".del/$item"); |
596 |
|
} else { |
597 |
|
$dirList[$item] = ".del/$item" ; |
598 |
|
$dirNote[$item] = ReadNote($fsDir.".del/$item"); |
599 |
|
} |
600 |
} |
} |
601 |
closedir($dir) ; |
closedir($dir) ; |
602 |
} |
} |
612 |
$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>."; |
613 |
StartHTML("(Navigate)",$text) ; |
StartHTML("(Navigate)",$text) ; |
614 |
|
|
615 |
echo "<TABLE BORDER=0 CELLPADDING=2 |
print "<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=3 WIDTH=\"100%\">" ; |
|
CELLSPACING=3 WIDTH=\"100%\">" ; |
|
616 |
|
|
617 |
// updir (parent) bar |
// updir (parent) bar |
618 |
if (chopsl($fsDir) != chopsl($fsRoot)) { |
if (chopsl($fsDir) != chopsl($fsRoot)) { |
630 |
return $out; |
return $out; |
631 |
} |
} |
632 |
|
|
633 |
if (! HTTP_GET_VAR("dsort")) $dsort = "name"; // default directory sort |
$dsort = HTTP_GET_VAR("dsort"); |
634 |
|
if (! isset($dsort)) $dsort = "name"; // default directory sort |
635 |
|
|
636 |
$dsort_arr = array( |
$dsort_arr = array( |
637 |
"name" => array ("rname", "note"), |
"name" => array ("rname", "note"), |
640 |
"rnote" => array ("name", "note") |
"rnote" => array ("name", "note") |
641 |
); |
); |
642 |
|
|
643 |
if (! HTTP_GET_VAR("fsort")) $fsort = "name"; // default directory sort |
$fsort = HTTP_GET_VAR("fsort"); |
644 |
|
if (! isset($fsort)) $fsort = "name"; // default directory sort |
645 |
|
|
646 |
$fsort_arr = array( |
$fsort_arr = array( |
647 |
"name" => array ("rname", "note", "date", "size"), |
"name" => array ("rname", "note", "date", "size"), |
695 |
$dir = $dirList[$key]; |
$dir = $dirList[$key]; |
696 |
|
|
697 |
$info_url=self_args(array("A"=>"A=E", "F"=>"F=".urlencode($dir), "D"=>$D)); |
$info_url=self_args(array("A"=>"A=E", "F"=>"F=".urlencode($dir), "D"=>$D)); |
698 |
|
if (substr($dir,0,5) == ".del/") { |
699 |
|
$dir = substr($dir,5,strlen($dir)-5); |
700 |
|
$deleted = " <a href=\"$info_url#undelete\"><SPAN CLASS=deleted TITLE=\"deleted\">deleted</span></a>"; |
701 |
|
} else { |
702 |
|
$deleted = ""; |
703 |
|
} |
704 |
|
|
705 |
$dir_url=$self."?D=".urlencode(chopsl($relDir)."/".$dir); |
$dir_url=$self."?D=".urlencode(chopsl($relDir)."/".$dir); |
706 |
|
if (check_perm($relDir.$dir,$gblPermNote)) { |
707 |
|
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".$dirNote[$key]; |
708 |
|
} else { |
709 |
|
$note_html=$dirNote[$key]; |
710 |
|
} |
711 |
|
|
712 |
|
$dir_html = isBlank($dir,"directory"); |
713 |
|
|
714 |
include("$html/Navigate-dirEntry.html"); |
include("$html/Navigate-dirEntry.html"); |
715 |
|
|
716 |
} // iterate over dirs |
} // iterate over dirs |
721 |
$uurl = self_args(array($D,"fsort=".$fsort_arr[$fsort][2])); |
$uurl = self_args(array($D,"fsort=".$fsort_arr[$fsort][2])); |
722 |
$surl = self_args(array($D,"fsort=".$fsort_arr[$fsort][3])); |
$surl = self_args(array($D,"fsort=".$fsort_arr[$fsort][3])); |
723 |
|
|
724 |
|
$html_uri = $webRoot; |
725 |
|
|
726 |
|
if (substr($relDir,0,1) == "/") { |
727 |
|
$html_uri .= substr($relDir,1,strlen($relDir)-1); |
728 |
|
} else { |
729 |
|
$html_uri .= $relDir; |
730 |
|
} |
731 |
|
|
732 |
include("$html/Navigate-fileHeader.html"); |
include("$html/Navigate-fileHeader.html"); |
733 |
|
|
734 |
if (sizeof($fileList) > 0) { |
if (sizeof($fileList) > 0) { |
794 |
$file_url_html.="\" TITLE=\"View file\">" ; |
$file_url_html.="\" TITLE=\"View file\">" ; |
795 |
|
|
796 |
if (substr($file,0,5) != ".del/") { |
if (substr($file,0,5) != ".del/") { |
797 |
$file_url_html .= $file . "</A>" . $a ; |
$file_url_html .= isBlank($file) . "</A>" . $a ; |
798 |
} else { |
} else { |
799 |
$file_url_html .= substr($file,5,strlen($file)-5) . "</a> <SPAN CLASS=RED TITLE=\"deleted\"> <a href=\"$info_url#undelete\">deleted</a> </span>"; |
$file_url_html .= isBlank(substr($file,5,strlen($file)-5)) . "</a> <a href=\"$info_url#undelete\"><SPAN CLASS=deleted TITLE=\"deleted\">deleted</span></a>"; |
800 |
} |
} |
801 |
|
|
802 |
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".ReadNote($path); |
if (check_perm($relDir.$file,$gblPermNote)) { |
803 |
|
$note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".$fileNote[$key]; |
804 |
|
} else { |
805 |
|
$note_html=$fileNote[$key]; |
806 |
|
} |
807 |
|
|
808 |
$ext = strtolower(strrchr($file,".")) ; |
$ext = strtolower(strrchr($file,".")) ; |
809 |
|
|
823 |
$file_url_html = "$file $a"; |
$file_url_html = "$file $a"; |
824 |
} |
} |
825 |
} else { |
} else { |
826 |
$b.="<A HREF=\"$self?A=Co&D=".urlencode($relDir)."&F=".urlencode($file); |
if (check_perm($relDir.$file,trperm_w)) { |
827 |
$b.="\" TITLE=\"Checkout file for edit\">" ; |
$b.="<A HREF=\"$self?A=Co&D=".urlencode($relDir)."&F=".urlencode($file); |
828 |
$b.=$gblIcon("checkout")."</A>"; |
$b.="\" TITLE=\"Checkout file for edit\">" ; |
829 |
|
$b.=$gblIcon("checkout")."</A>"; |
830 |
|
} |
831 |
|
|
832 |
if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) { |
if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) { |
833 |
$b.="<A HREF=\"$self?A=C&D=".urlencode($relDir)."&F=".urlencode($file); |
$b.="<A HREF=\"$self?A=C&D=".urlencode($relDir)."&F=".urlencode($file); |
844 |
|
|
845 |
} // iterate over files |
} // iterate over files |
846 |
} else { // end if no files |
} else { // end if no files |
847 |
?> |
include("$html/Navigate-noFiles.html"); |
|
<TR><TD></TD><TD COLSPAN=5 CLASS=LST> |
|
|
No files in this directory |
|
|
</TD></TR> |
|
|
<? |
|
848 |
} |
} |
849 |
|
|
850 |
if ($emptyDir && $relDir != "") { |
if ($emptyDir && $relDir != "") { |
851 |
?> |
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 |
|
852 |
} // end if emptyDir |
} // end if emptyDir |
|
?> |
|
|
|
|
|
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
|
853 |
|
|
854 |
<? |
include("$html/Navigate-hr.html"); |
855 |
|
|
856 |
if (file_exists("$fsRealmDir/$realm".$realm_sep."info.inc")) { |
if (file_exists("$fsRealmDir/$realm".$realm_sep."info.inc")) { |
857 |
print "<TR><TD></TD><TD COLSPAN=5>"; |
print "<TR><TD></TD><TD COLSPAN=5>"; |
858 |
include("$fsRealmDir/$realm".$realm_sep."info.inc"); |
include("$fsRealmDir/$realm".$realm_sep."info.inc"); |
859 |
print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
print "</TD></TR>"; |
860 |
} elseif (file_exists("$gblRepositoryDir/.info.inc")) { |
include("$html/Navigate-hr.html"); |
861 |
print "<TR><TD></TD><TD COLSPAN=5>"; |
} elseif (file_exists("$gblRepositoryDir/.info.inc")) { |
862 |
include("$gblRepositoryDir/.info.inc"); |
print "<TR><TD></TD><TD COLSPAN=5>"; |
863 |
print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
include("$gblRepositoryDir/.info.inc"); |
864 |
} |
print "</TD></TR>"; |
865 |
|
include("$html/Navigate-hr.html"); |
866 |
|
} |
867 |
|
|
868 |
|
include("$html/Navigate-createNew.html"); |
869 |
|
|
870 |
?> |
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> |
|
871 |
|
|
|
<?php |
|
872 |
EndHTML() ; |
EndHTML() ; |
873 |
} // end function Navigate |
} // end function Navigate |
874 |
|
|
959 |
$file=basename($target); |
$file=basename($target); |
960 |
|
|
961 |
$note=fopen("$dir/.note/$file","w"); |
$note=fopen("$dir/.note/$file","w"); |
962 |
|
if (! $note) { |
963 |
|
Error("Error writing note","Can't open note file <tt>$dir/.note/$file</tt> for writing",1); |
964 |
|
} |
965 |
fputs($note,"$msg\n"); |
fputs($note,"$msg\n"); |
966 |
fclose($note); |
fclose($note); |
967 |
|
|
1124 |
|
|
1125 |
function DisplayChangeLog($day) { |
function DisplayChangeLog($day) { |
1126 |
|
|
1127 |
global $gblFsRoot, $gblDateFmt, $gblTimeFmt; |
global $gblFsRoot, $gblDateFmt, $gblTimeFmt, |
1128 |
$HTTP_SERVER_VARS; |
$HTTP_SERVER_VARS; |
1129 |
|
|
1130 |
$self = $HTTP_SERVER_VARS["PHP_SELF"]; |
$self = $HTTP_SERVER_VARS["PHP_SELF"]; |
1153 |
print "<tr><td$cl>$date</td><td$cl>$time</td><td$cl><a href=\"$HTTP_SERVER_VARS[PHP_SELF]?D=".urlencode($dir)."\">$dir</a>/$file</td><td$cl>$e[2]</td><td$cl>$e[3]</td></tr>\n"; |
print "<tr><td$cl>$date</td><td$cl>$time</td><td$cl><a href=\"$HTTP_SERVER_VARS[PHP_SELF]?D=".urlencode($dir)."\">$dir</a>/$file</td><td$cl>$e[2]</td><td$cl>$e[3]</td></tr>\n"; |
1154 |
} |
} |
1155 |
print "</table>"; |
print "</table>"; |
1156 |
print "<p>".GifIcon(up)." Back to <a href=\"$self\">front page</a>.</p>"; |
print "<p>".GifIcon("up")." Back to <a href=\"$self\">front page</a>.</p>"; |
1157 |
} |
} |
1158 |
|
|
1159 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1175 |
|
|
1176 |
$ext_arr = explode(".",$file); |
$ext_arr = explode(".",$file); |
1177 |
$ext = array_pop($ext_arr); |
$ext = array_pop($ext_arr); |
1178 |
if ($encoding_ext[$ext]) { |
if (isset($encoding_ext[$ext])) { |
1179 |
$encoding = $encoding_ext[$ext]; |
$encoding = $encoding_ext[$ext]; |
1180 |
$ext = array_pop($ext_arr); |
$ext = array_pop($ext_arr); |
1181 |
} |
} |
1187 |
} |
} |
1188 |
|
|
1189 |
// IE5.5 just downloads index.php if we don't do this |
// IE5.5 just downloads index.php if we don't do this |
1190 |
if(preg_match("/MSIE 5.5/", $HTTP_SERVER_VARS[HTTP_USER_AGENT])) { |
if(preg_match("/MSIE 5.5/", $HTTP_SERVER_VARS["HTTP_USER_AGENT"])) { |
1191 |
header("Content-Disposition: filename=$file"); |
header("Content-Disposition: filename=$file"); |
1192 |
} else { |
} else { |
1193 |
header("Content-Disposition: attachment; filename=$file"); |
header("Content-Disposition: attachment; filename=$file"); |
1289 |
$l = trim(fgets($fp_conf,4096)); |
$l = trim(fgets($fp_conf,4096)); |
1290 |
if (substr($l,0,1) == "+") { // no comment |
if (substr($l,0,1) == "+") { // no comment |
1291 |
$arr=explode(":",$l); |
$arr=explode(":",$l); |
1292 |
$groups_arr[$arr[0]] = $arr[1] ; |
$groups_arr[$arr[0]] = str_replace(" ","",$arr[1]) ; |
1293 |
} elseif (substr($l,0,1) != "#") { |
} elseif (substr($l,0,1) != "#") { |
1294 |
$arr=explode(":",$l); |
$arr=explode(":",$l); |
1295 |
$path=array_shift($arr); |
$path=array_shift($arr); |
1369 |
} |
} |
1370 |
|
|
1371 |
// helper function |
// helper function |
1372 |
function unroll_perm($u,$t,$user,$perm,$one_level) { |
function unroll_perm($u,$t,$perm,$one_level) { |
1373 |
|
|
1374 |
if ($t & trmask_one_level && !$one_level) return $perm; |
if ($t & trmask_one_level && !$one_level) return $perm; |
1375 |
|
|
|
// user is user whose trustee is this |
|
|
if ($t & trmask_not && ($u==$user)) return $perm; |
|
|
if (!($t & trmask_not) && ($u!=$user)) return $perm; |
|
|
|
|
1376 |
if ($t & trmask_deny) { |
if ($t & trmask_deny) { |
1377 |
if ($t & trmask_clear) { |
if ($t & trmask_clear) { |
1378 |
$perm['deny'] &= ~$t; |
$perm['deny'] &= ~$t; |
1388 |
}// end of helper function |
}// end of helper function |
1389 |
|
|
1390 |
function check_trustee($user,$path) { |
function check_trustee($user,$path) { |
1391 |
global $trustees; |
global $trustees,$HAVE_TRUSTEE; |
1392 |
$perm['allow'] = 0; |
$perm['allow'] = 0; |
1393 |
$perm['deny'] = 0; |
$perm['deny'] = 0; |
1394 |
|
|
1395 |
if (! isset($trustees)) Error("Trustees not found","Can't find in-memory trustee structure \$trustees. Probably bug in code. Contact <tt>dpavlin@rot13.org</tt>",1); |
// do we use trustees? |
1396 |
|
if (! $HAVE_TRUSTEE) return $perm; |
1397 |
|
|
1398 |
|
if (! isset($trustees)) Error("Trustees not found","Can't find in-memory trustee structure <tt>\$trustees</tt>. Probably bug in code. Contact <tt>dpavlin@rot13.org</tt>",1); |
1399 |
|
|
1400 |
global $debug; |
global $debug; |
1401 |
$debug .= "<br>check_trustee $path ... "; |
$debug .= "<br>check_trustee $path ... "; |
1414 |
|
|
1415 |
if (isset($tr)) { |
if (isset($tr)) { |
1416 |
// first apply trustee for all |
// first apply trustee for all |
1417 |
if (isset($tr['*'])) { |
if (isset($tr['*']) && $user!="anonymous") { |
1418 |
$perm = unroll_perm($user,$tr['*'],'*', $perm, $one_level); |
$perm = unroll_perm($user,$tr['*'],$perm, $one_level); |
1419 |
unset($tr['*']); |
unset($tr['*']); |
1420 |
} |
} |
1421 |
// then apply group policies |
// then apply not and group policies |
1422 |
foreach ($tr as $g=>$t) { |
foreach ($tr as $g=>$t) { |
1423 |
if ($t & trmask_group && in_group($user,$g)) { |
if ($t & trmask_not && $g != $user) { |
1424 |
|
$t = $t & ~trmask_not; |
1425 |
|
$perm = unroll_perm($user,$t,$perm, $one_level); |
1426 |
|
unset($tr[$g]); |
1427 |
|
|
1428 |
|
} elseif ($t & trmask_group && in_group($user,$g)) { |
1429 |
// resolv user |
// resolv user |
1430 |
$t = $t & ~trmask_group; |
$t = $t & ~trmask_group; |
1431 |
$perm = unroll_perm($user,$t,$g, $perm, $one_level); |
$perm = unroll_perm($user,$t,$perm, $one_level); |
1432 |
unset($tr[$g]); |
unset($tr[$g]); |
1433 |
} |
} |
1434 |
} |
} |
1435 |
// then apply user policy |
// then apply user policy |
1436 |
if (isset($tr[$user])) { |
if (isset($tr[$user])) { |
1437 |
$perm = unroll_perm($user,$tr[$user],$user, $perm,$one_level); |
$perm = unroll_perm($user,$tr[$user],$perm,$one_level); |
1438 |
unset($tr[$user]); |
unset($tr[$user]); |
1439 |
} |
} |
1440 |
} |
} |
1451 |
function check_perm($path,$trperm) { |
function check_perm($path,$trperm) { |
1452 |
global $gblLogin,$HAVE_TRUSTEE; |
global $gblLogin,$HAVE_TRUSTEE; |
1453 |
|
|
1454 |
|
$path = str_replace("//","/",$path); |
1455 |
|
|
1456 |
global $debug; |
global $debug; |
1457 |
$debug.="<br>check_perm: on <tt>$path</tt> for perm ".display_trustee($trperm)."<br>\n"; |
$debug.="<br>check_perm: on <tt>$path</tt> for perm ".display_trustee($trperm)."<br>\n"; |
1458 |
|
|
1502 |
|
|
1503 |
function check_filename($file) { |
function check_filename($file) { |
1504 |
if (strstr($file,"..")) Error("Security violation","No parent dir <tt>..</tt> allowed in file name <tt>$file</tt>",1); |
if (strstr($file,"..")) Error("Security violation","No parent dir <tt>..</tt> allowed in file name <tt>$file</tt>",1); |
1505 |
|
// remove deleted directory (for undelete to work) |
1506 |
|
$file = str_replace(".del/","",$file); |
1507 |
if (strstr($file,"/")) Error("Security violation","No slashes <tt>/</tt> allowed in file name <tt>$file</tt>",1); |
if (strstr($file,"/")) Error("Security violation","No slashes <tt>/</tt> allowed in file name <tt>$file</tt>",1); |
1508 |
} |
} |
1509 |
|
|
1510 |
|
// bla/blo/../foo will return bla/foo |
1511 |
|
function remove_parent($path) { |
1512 |
|
while (preg_match(",/[^/]+/\.\./,",$path)) { |
1513 |
|
$path = preg_replace(",/[^/]+/\.\./,","",$path); |
1514 |
|
} |
1515 |
|
if (substr($path,0,1) != "/") $path = "/".$path; |
1516 |
|
return $path; |
1517 |
|
} |
1518 |
|
|
1519 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1520 |
|
|
1521 |
// functions to move HTTP server variables to global namespace |
// functions to move HTTP server variables to global namespace |
1522 |
// [replacement for register_globals in php.ini] |
// [replacement for register_globals in php.ini] |
1523 |
|
|
1524 |
function HTTP_GET_VAR($var) { |
function HTTP_GET_VAR($var) { |
1525 |
global $HTTP_GET_VARS, $GLOBALS; |
global $HTTP_GET_VARS, ${$var}; |
1526 |
if (isset($HTTP_GET_VARS[$var])) { |
if (isset($HTTP_GET_VARS[$var])) { |
1527 |
$GLOBALS[$var] = stripSlashes($HTTP_GET_VARS[$var]); |
$$var = stripSlashes($HTTP_GET_VARS[$var]); |
1528 |
return $GLOBALS[$var]; |
return $$var; |
1529 |
} |
} |
1530 |
} |
} |
1531 |
|
|
1532 |
function HTTP_POST_VAR($var) { |
function HTTP_POST_VAR($var) { |
1533 |
global $HTTP_POST_VARS, $GLOBALS; |
global $HTTP_POST_VARS, ${$var}; |
1534 |
if (isset($HTTP_POST_VARS[$var])) { |
if (isset($HTTP_POST_VARS[$var])) { |
1535 |
$GLOBALS[$var] = stripSlashes($HTTP_POST_VARS[$var]); |
$$var = $HTTP_POST_VARS[$var]; |
1536 |
return $GLOBALS[$var]; |
return $$var; |
1537 |
|
} |
1538 |
|
} |
1539 |
|
|
1540 |
|
function HTTP_SERVER_VAR($var) { |
1541 |
|
global $HTTP_SERVER_VARS, ${$var}; |
1542 |
|
if (isset($HTTP_SERVER_VARS[$var])) { |
1543 |
|
$$var = $HTTP_SERVER_VARS[$var]; |
1544 |
|
return $$var; |
1545 |
} |
} |
1546 |
} |
} |
1547 |
|
|
1551 |
} |
} |
1552 |
|
|
1553 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1554 |
|
|
1555 |
|
function isBlank($file,$what = "filename") { |
1556 |
|
if (trim($file) == "") return "<i>whitespace $what</i>"; |
1557 |
|
if ($file == "") return "<i>no $what</i>"; |
1558 |
|
return $file; |
1559 |
|
} |
1560 |
|
|
1561 |
|
////////////////////////////////////////////////////////////////// |
1562 |
// MAIN PROGRAM |
// MAIN PROGRAM |
1563 |
|
|
1564 |
$gblFilePerms = 0640 ; // default for new files |
$gblFilePerms = 0640 ; // default for new files |
1572 |
// location of master docman configuration file |
// location of master docman configuration file |
1573 |
$docman_conf = "/etc/docman.conf"; |
$docman_conf = "/etc/docman.conf"; |
1574 |
if (! file_exists($docman_conf)) { |
if (! file_exists($docman_conf)) { |
1575 |
$error = "Can't find master configuration file $docman_conf. See docman2/doc/upgrade.html#docman_conf for more informations"; |
$error = "Can't find master configuration file <tt>$docman_conf</tt>. See <tt>docman2/doc/upgrade.html#docman_conf</tt> for more informations"; |
1576 |
|
|
1577 |
error_log("docman: $error"); |
error_log("docman: $error"); |
1578 |
Error("docman not installed completly",$error); |
Error("docman not installed completly",$error); |
1660 |
// read mime.types |
// read mime.types |
1661 |
readMime(); |
readMime(); |
1662 |
|
|
1663 |
|
if (! isset($gblPermNote)) { |
1664 |
|
$gblPermNote = trperm_r; |
1665 |
|
} |
1666 |
|
|
1667 |
|
HTTP_POST_VAR("FN"); |
1668 |
|
|
1669 |
if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST") { |
if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST") { |
1670 |
// take variables from server |
// take variables from server |
1671 |
if (HTTP_POST_VAR("FN")) check_filename($FN); |
if (HTTP_POST_VAR("FN")) |
1672 |
|
check_filename($FN); |
1673 |
if (HTTP_POST_VAR("DIR")) { |
if (HTTP_POST_VAR("DIR")) { |
1674 |
check_dirname($DIR); |
check_dirname($DIR); |
1675 |
$relDir = $DIR; |
$relDir = $DIR; |
1680 |
if (HTTP_POST_VAR("RELPATH")) check_dirname($RELPATH); |
if (HTTP_POST_VAR("RELPATH")) check_dirname($RELPATH); |
1681 |
HTTP_POST_VAR("T"); |
HTTP_POST_VAR("T"); |
1682 |
HTTP_POST_VAR("CONFIRM"); |
HTTP_POST_VAR("CONFIRM"); |
|
|
|
1683 |
} else { |
} else { |
1684 |
// get |
// get |
1685 |
HTTP_GET_VAR("A"); |
HTTP_GET_VAR("A"); |
1721 |
|
|
1722 |
$source = $FN_name ; |
$source = $FN_name ; |
1723 |
if (! file_exists($source)) { |
if (! file_exists($source)) { |
1724 |
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); |
1725 |
} |
} |
1726 |
|
|
1727 |
if (HTTP_POST_VAR("FILENAME")) check_filename($FILENAME); |
if (HTTP_POST_VAR("FILENAME")) check_filename($FILENAME); |
1732 |
$target = "$fsDir/$FILENAME"; |
$target = "$fsDir/$FILENAME"; |
1733 |
} |
} |
1734 |
|
|
1735 |
|
if (! check_perm("$relDir/".basename($target), trperm_w)) |
1736 |
|
Error("Access denied","User <tt>$gblLogin</tt> tried to upload <tt>$relDir/".basename($target)."</tt> without valid trustee.",1); |
1737 |
|
|
1738 |
// backup old files first |
// backup old files first |
1739 |
$dir=dirname($target); |
$dir=dirname($target); |
1740 |
if (! file_exists($dir."/.bak")) { |
if (! file_exists($dir."/.bak")) { |
1763 |
case "SAVE" : |
case "SAVE" : |
1764 |
$path = $gblFsRoot . $RELPATH ; |
$path = $gblFsRoot . $RELPATH ; |
1765 |
$path=stripSlashes($path); |
$path=stripSlashes($path); |
1766 |
|
|
1767 |
|
if (! check_perm("$RELPATH", trperm_w)) |
1768 |
|
Error("Access denied","User <tt>$gblLogin</tt> tried to save <tt>$RELPATH</tt> without valid trustee.",1); |
1769 |
|
|
1770 |
$writable = is_writeable($path) ; |
$writable = is_writeable($path) ; |
1771 |
$legaldir = is_writeable(dirname($path)) ; |
$legaldir = is_writeable(dirname($path)) ; |
1772 |
$exists = (file_exists($path)) ? 1 : 0 ; |
$exists = (file_exists($path)) ? 1 : 0 ; |
1773 |
// check for legal extension here as well |
// FIX: more verbose error message |
1774 |
if (!($writable || (!$exists && $legaldir))) |
if (!($writable || (!$exists && $legaldir))) |
1775 |
Error("Write denied",$RELPATH) ; |
Error("Write denied",$RELPATH) ; |
1776 |
$fh = fopen($path, "w") ; |
$fh = fopen($path, "w") ; |
1777 |
$FILEDATA=stripSlashes($FILEDATA); |
HTTP_POST_VAR("FILEDATA"); |
1778 |
fwrite($fh,$FILEDATA) ; |
fwrite($fh,$FILEDATA) ; |
1779 |
fclose($fh) ; |
fclose($fh) ; |
1780 |
clearstatcache() ; |
clearstatcache() ; |
1783 |
|
|
1784 |
case "CREATE" : |
case "CREATE" : |
1785 |
// we know $fsDir exists |
// we know $fsDir exists |
1786 |
if ($FN == "") break; // no filename! |
if (! check_perm($relDir, trperm_w)) |
1787 |
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ; |
Error("Write access denied","You don't have permission to write in <tt>$relDir</tt>"); |
1788 |
$path = $fsDir . "/" . $FN ; // file or dir to create |
if ($T == "D") $type = "directory"; |
1789 |
$relPath = $relDir . "/" . $FN ; |
else $type ="file"; |
1790 |
|
if ($FN == "") Error("Can't create $type","You must enter name of $type to create it."); |
1791 |
|
if (!is_writeable($fsDir)) Error("Write denied","User <tt>$gblLogin</tt> has trustee to write in <tt>$relDir</tt> but permissions on <tt>$fsDir</tt> are wrong!", 1) ; |
1792 |
|
$path = "$fsDir/$FN"; // file or dir to create |
1793 |
|
$relPath = "$relDir/$FN"; |
1794 |
|
|
1795 |
|
if (file_exists($path)) |
1796 |
|
Error("Can't create $type","Object <tt>$relPath</tt> allready exists"); |
1797 |
|
|
1798 |
switch ( $T ) { |
switch ( $T ) { |
1799 |
case "D" : // create a directory |
case "D" : // create a directory |
1800 |
if ( ! @mkdir($path,$gblDirPerms) ) |
if ( ! @mkdir($path,$gblDirPerms) ) |
1808 |
// better keep it here altogether |
// better keep it here altogether |
1809 |
// chmod perms to $gblFilePerms |
// chmod perms to $gblFilePerms |
1810 |
if ( file_exists($path) && !is_writeable($path) ) |
if ( file_exists($path) && !is_writeable($path) ) |
1811 |
Error("File not writable", $relPath) ; |
Error("File not writable", "User <tt>$gblLogin</tt> has trustee to write in <tt>$relPath</tt> but permissions on <tt>$path</tt> are wrong!", 1) ; |
1812 |
$fh = fopen($path, "w+") ; |
$fh = fopen($path, "w+") ; |
1813 |
if ($fh) { |
if ($fh) { |
1814 |
fputs($fh,"\n"); |
fputs($fh,"\n"); |
1815 |
fclose($fh) ; |
fclose($fh) ; |
1816 |
LogIt($path,"file created",trperm_r | trperm_w); |
LogIt($path,"file created",trperm_r | trperm_w); |
1817 |
} else { |
} else { |
1818 |
Error("Creation of file $relPath failed -- $path"); |
Error("Creation of file $relPath failed", "User <tt>$gblLogin</tt> has trustee to write in <tt>$relPath</tt> but creation of <tt>$path</tt> failed!", 1) ; |
1819 |
} |
} |
1820 |
$tstr = "$PHP_SELF?A=E&D=".urlencode($relDir)."&F=".urlencode($FN) ; |
$tstr = $HTTP_SERVER_VARS["PHP_SELF"]."?A=E&D=".urlencode($relDir)."&F=".urlencode($FN) ; |
1821 |
header("Location: " . $tstr) ; |
header("Location: " . $tstr) ; |
1822 |
exit ; |
exit ; |
1823 |
} |
} |
1824 |
break ; |
break ; |
1825 |
|
|
1826 |
case "DELETE" : |
case "DELETE" : |
1827 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break; |
1828 |
|
|
1829 |
$tstr = "Attempt to delete non-existing object or " ; |
if ( isset($FN) && $FN != "") { |
1830 |
$tstr .= "insufficient privileges: " ; |
$path=$fsDir."/".$FN; |
1831 |
|
$what = "file"; |
1832 |
|
} elseif (isset($DIR)) { |
1833 |
|
$path=$gblFsRoot."/".$DIR; |
1834 |
|
$what = "directory"; |
1835 |
|
} else { |
1836 |
|
Error("Can't delete object","Can't find filename <tt>\$FN</tt> or dirname in <tt>\$DIR</tt>",1); |
1837 |
|
} |
1838 |
|
|
1839 |
if ( $FN != "") { // delete file |
if (! check_perm("$relDir/$FN", trperm_w)) |
1840 |
$path = $fsDir . "/" . $FN ; |
Error("Access denied","User <tt>$gblLogin</tt> tried to erase $what <tt>$relDir/$FN</tt> without valid trustee.",1); |
|
|
|
|
$dir=dirname($path); |
|
|
$file=basename($path); |
|
|
if (! file_exists("$dir/.del")) { |
|
|
mkdir("$dir/.del",0700); |
|
|
} |
|
1841 |
|
|
1842 |
// if ( ! @unlink($path) ) { |
$tstr = "Attempt to delete non-existing object or insufficient privileges: " ; |
1843 |
if ( ! rename($path,"$dir/.del/$file") ) { |
|
1844 |
LogIt($path,"file delete failed"); |
$dir=dirname($path); |
1845 |
Error("File delete failed", $tstr . $path) ; |
$file=basename($path); |
1846 |
} else { |
|
1847 |
LogIt($path,"file deleted",trperm_w); |
if (! file_exists("$dir/.del")) { |
1848 |
MoveTo("$dir/.log/$file","$dir/.del/.log/"); |
mkdir("$dir/.del",0700); |
1849 |
MoveTo("$dir/.note/$file","$dir/.del/.note/"); |
} |
1850 |
MoveTo("$dir/.lock/$file","$dir/.del/.lock/"); |
|
1851 |
} |
if ( ! @rename($path,"$dir/.del/$file") ) { |
1852 |
} else { // delete directory |
LogIt($path,"$what delete failed"); |
1853 |
if ( ! @rrmdir($fsDir) ) { |
Error("Can't delete $what",$tstr."<tt>".$relDir."/".$FN."</tt>") ; |
1854 |
Error("Rmdir failed", $tstr . $fsDir) ; |
} else { |
1855 |
} else { |
LogIt($path,"$what deleted",trperm_w); |
1856 |
LogIt($path,"dir deleted",trperm_w); |
MoveTo("$dir/.log/$file","$dir/.del/.log/"); |
1857 |
$relDir = dirname($relDir) ; // move up |
MoveTo("$dir/.note/$file","$dir/.del/.note/"); |
1858 |
} |
MoveTo("$dir/.lock/$file","$dir/.del/.lock/"); |
1859 |
} |
} |
1860 |
break ; |
break ; |
1861 |
|
|
1865 |
if (substr($FN,0,4) != ".del") break ; |
if (substr($FN,0,4) != ".del") break ; |
1866 |
$file=substr($FN,4,strlen($FN)-4); |
$file=substr($FN,4,strlen($FN)-4); |
1867 |
|
|
1868 |
|
if (! check_perm("$relDir/$file", trperm_w)) |
1869 |
|
Error("Access denied","User <tt>$gblLogin</tt> tried to undelete <tt>$relDir/$file</tt> without valid trustee.",1); |
1870 |
|
|
1871 |
LogIt("$fsDir/.del/$file","undeleted",trperm_w); |
LogIt("$fsDir/.del/$file","undeleted",trperm_w); |
1872 |
MoveTo("$fsDir/.del/$file","$fsDir/"); |
MoveTo("$fsDir/.del/$file","$fsDir/"); |
1873 |
MoveTo("$fsDir/.del/.log/$file","$fsDir/.log/"); |
MoveTo("$fsDir/.del/.log/$file","$fsDir/.log/"); |
1879 |
case "RENAME" : |
case "RENAME" : |
1880 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1881 |
|
|
1882 |
$NEWNAME=stripSlashes($HTTP_POST_VARS["NEWNAME"]); |
if (HTTP_POST_VAR("NEWNAME")) { |
1883 |
|
$dest = remove_parent($relDir.$NEWNAME); |
1884 |
|
if (! check_perm($relDir.$FN, trperm_w) || |
1885 |
|
! check_perm($dest, trperm_w) ) |
1886 |
|
Error("Access denied","User <tt>$gblLogin</tt> tried to rename <tt>$relDir$FN</tt> to <tt>$dest</tt> without valid trustee.",1); |
1887 |
|
} else { |
1888 |
|
Error("Rename error","Can't find new name in var <tt>\$NEWNAME</tt>",1); |
1889 |
|
} |
1890 |
LogIt("$fsDir/$FN","renamed $FN to $NEWNAME",trperm_r); |
LogIt("$fsDir/$FN","renamed $FN to $NEWNAME",trperm_r); |
1891 |
safe_rename($fsDir,$FN,$NEWNAME); |
safe_rename($fsDir,$FN,$NEWNAME); |
1892 |
break ; |
break ; |
1893 |
|
|
1894 |
case "NOTE" : |
case "NOTE" : |
1895 |
$NOTE=stripSlashes($HTTP_POST_VARS["NOTE"]); |
if (! HTTP_POST_VAR("NOTE")) |
1896 |
WriteNote("$fsDir/$FN","$NOTE"); |
Error("Can't add note to object","Can't find var <tt>\$NOTE</tt>",1); |
1897 |
|
if (! check_perm("$relDir/$FN", trperm_w)) |
1898 |
|
Error("Access denied","User <tt>$gblLogin</tt> tried to add note to <tt>$relDir/$FN</tt> without valid trustee.",1); |
1899 |
|
|
1900 |
|
WriteNote("$fsDir/$FN",$NOTE); |
1901 |
break ; |
break ; |
1902 |
|
|
1903 |
case "UNLOCK" : |
case "UNLOCK" : |
1904 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1905 |
|
if (! check_perm("$relDir/$FN", trperm_w)) |
1906 |
|
Error("Access denied","User <tt>$gblLogin</tt> tried to unlock <tt>$relDir/$FN</tt> without valid trustee.",1); |
1907 |
Unlock("$fsDir/$FN"); |
Unlock("$fsDir/$FN"); |
1908 |
break ; |
break ; |
1909 |
|
|
1917 |
header("Location: ".$tstr) ; |
header("Location: ".$tstr) ; |
1918 |
exit ; |
exit ; |
1919 |
} |
} |
1920 |
|
|
1921 |
// check for mode.. navigate, code display, upload, or detail? |
// check for mode.. navigate, code display, upload, or detail? |
1922 |
// $A=U : upload to path given in $D |
// $A=U : upload to path given in $D |
1923 |
// $A=E : display detail of file $D/$F and edit |
// $A=E : display detail of file $D/$F and edit |