35 |
/* existent address after file modifications. */ |
/* existent address after file modifications. */ |
36 |
|
|
37 |
/* |
/* |
|
2000-07-25 Dobrica Pavlinusic <dpavlin@rot13.org> |
|
38 |
|
|
39 |
nuked exec calls (unsecure) |
This project is now called Directory Manager. |
|
nuked writeable function (replaced by php is_writeable) |
|
|
added support for https (tested with apache+mod_ssl) |
|
|
added users file |
|
|
date format user-selectable |
|
|
cycle backup files in bak directory |
|
|
support links as directoryes (for now) |
|
|
support of file history logging |
|
|
undelete capabilities (delete moves to .del directory) |
|
40 |
|
|
41 |
2000-07-26 DbP |
For more info, please see web pages at |
42 |
|
http://www.rot13.org/~dpavlin/docman.html |
43 |
|
|
44 |
added more checking on entered filename (when creating file/dir) |
It's relased under GPL by |
45 |
added rename option |
Dobrica Pavlinusic <dpavlin@rot13.org> |
46 |
|
|
47 |
|
|
48 |
IMPORTANT INSTALLATION NOTE: |
IMPORTANT INSTALLATION NOTE: |
51 |
deleted files! |
deleted files! |
52 |
|
|
53 |
.htusers is in form: |
.htusers is in form: |
54 |
login:Real Name:md5(loginpassword) |
login:Real Name:[md5(loginpassword)|auth_*]:email@host.dom |
55 |
|
|
56 |
|
|
57 |
TODO: |
TODO: |
58 |
mixed file/directory output (add type to each entry, |
mixed file/directory output (add type to each entry, |
59 |
real support for links) |
real support for links) |
60 |
add more content-management (like cms.sourceforge.net): |
access controll |
61 |
check-out/check-in/reserve |
|
|
comments to files |
|
62 |
*/ |
*/ |
63 |
|
|
64 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
71 |
|
|
72 |
// GLOBAL PARAMETERS |
// GLOBAL PARAMETERS |
73 |
// ================= |
// ================= |
74 |
// Make modifications here to suit siteman to your needs |
// Make modifications here to suit docman to your needs |
75 |
|
|
76 |
// error_reporting(4) ; // how verbose ? |
// error_reporting(4) ; // how verbose ? |
77 |
|
|
78 |
|
// from where to include auth_*.php modules? |
79 |
|
$gblIncDir = "/home/httpd/docman"; |
80 |
|
|
81 |
// username/password should not be system |
// username/password should not be system |
82 |
// usernames/passwords !! |
// usernames/passwords !! |
83 |
|
|
|
// $gblPw = "hash_of_your_username_and_password" ; |
|
|
|
|
|
// $gblAuth = false ; // use builtin authentication |
|
|
$gblAuth = true ; // use builtin authentication |
|
|
$gblHash = "md5" ; // hash function to use |
|
|
|
|
84 |
$gblPw = ""; |
$gblPw = ""; |
85 |
|
|
86 |
if ($gblAuth) { |
// date format |
|
$htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; |
|
|
if (! file_exists($htusers_file)) { |
|
|
$htusers=fopen($htusers_file,"a+"); |
|
|
fputs($htusers,"# Change owner of $htusers_file to root !!\n"); |
|
|
fputs($htusers,"demo:full name:md5_hash\n"); |
|
|
fclose($htusers); |
|
|
} |
|
|
$htusers=fopen($htusers_file,"r"); |
|
|
while($user = fgetcsv($htusers,255,":")) { |
|
|
if ($user[0] == $GLOBALS["PHP_AUTH_USER"]) { |
|
|
$gblUserName=$user[1]; |
|
|
$gblPw=$user[2]; |
|
|
continue ; |
|
|
} |
|
|
} |
|
|
fclose($htusers); |
|
|
} |
|
|
|
|
87 |
// $gblDateFmt="D, F d, Y"; |
// $gblDateFmt="D, F d, Y"; |
|
// $gblTimeFmt="g:i:sA"; |
|
|
|
|
88 |
$gblDateFmt="Y-m-d"; |
$gblDateFmt="Y-m-d"; |
89 |
|
|
90 |
|
// time format |
91 |
|
// $gblTimeFmt="g:i:sA"; |
92 |
$gblTimeFmt="H:i:s"; |
$gblTimeFmt="H:i:s"; |
93 |
|
|
94 |
// Number of backup files to keep |
// Number of backup files to keep |
95 |
$gblNumBackups=5; |
$gblNumBackups=3; |
96 |
|
|
97 |
|
// show red star if newer than ... days |
98 |
|
$gblModDays=1; |
99 |
|
|
100 |
// choose GifIcon below unless you have the M$ |
// choose GifIcon below unless you have the M$ |
101 |
// WingDings font installed on your system |
// WingDings font installed on your system |
102 |
|
|
103 |
$gblIcon = "GifIcon" ; // MockIcon or GifIcon |
$gblIcon="GifIcon"; // MockIcon or GifIcon |
104 |
|
|
105 |
// the directory below should be /icons/ or /icons/small/ |
// the directory below should be /icons/ or /icons/small/ |
106 |
// on Apache; a set of icons is included in the distribution |
// on Apache; a set of icons is included in the distribution |
107 |
|
|
108 |
$gblIconLocation = "/icons/" ; |
$gblIconLocation="/icons/"; |
109 |
|
|
110 |
// files you want to be able to edit in text mode |
// files you want to be able to edit in text mode |
111 |
// and view with (primitive) syntax highlighting |
// and view with (primitive) syntax highlighting |
124 |
|
|
125 |
function StartHTML($title,$text="") { |
function StartHTML($title,$text="") { |
126 |
|
|
127 |
$title = "Site Manager " . $title ; |
$title = "Document Manager " . $title ; |
128 |
$host = $GLOBALS["HTTP_HOST"] ; |
$host = $GLOBALS["HTTP_HOST"] ; |
129 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $GLOBALS["PHP_SELF"] ; |
130 |
?> |
?> |
168 |
</small> |
</small> |
169 |
</P> |
</P> |
170 |
<BR> |
<BR> |
171 |
<? include(".debug.inc") ?> |
<? //include(".debug.inc") ?> |
172 |
<BR><BR></BODY></HTML> |
<BR><BR></BODY></HTML> |
173 |
|
|
174 |
<?php |
<?php |
203 |
|
|
204 |
function DetailPage($fsRoot,$relDir,$fn) { |
function DetailPage($fsRoot,$relDir,$fn) { |
205 |
|
|
206 |
global $gblEditable, $gblImages ; |
global $gblEditable, $gblImages, $webRoot ; |
207 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $GLOBALS["PHP_SELF"] ; |
208 |
|
|
209 |
$relPath = $relDir . "/" . $fn ; |
$relPath = $relDir . "/" . $fn ; |
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)) ; |
277 |
</FORM> |
</FORM> |
278 |
|
|
279 |
<?php |
<?php |
280 |
} else if ( strstr( join(" ",$gblImages), $ext ) ) { |
} |
281 |
|
if ( !$file_lock && $ext!="" && strstr(join(' ',$gblImages),$ext) ) { |
282 |
$info = getimagesize($fsPath) ; |
$info = getimagesize($fsPath) ; |
283 |
$tstr = "<IMG SRC=\"". $relPath . "\" BORDER=0 " ; |
$tstr = "<IMG SRC=\"$webRoot".urlpath($relPath)."\" BORDER=0 " ; |
284 |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
285 |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
286 |
echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
// echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
287 |
|
echo $tstr ; |
288 |
} |
} |
289 |
|
|
290 |
?> |
?> |
346 |
</FORM> |
</FORM> |
347 |
|
|
348 |
<?php |
<?php |
|
|
|
349 |
|
|
350 |
$logname=dirname("$fsDir/$fn")."/.log/".basename("$fsDir/$fn"); |
$name=basename("$fsDir/$fn"); |
351 |
|
$logname=dirname("$fsDir/$fn")."/.log/$name"; |
352 |
|
$bakdir=dirname("$fsDir/$fn")."/.bak"; |
353 |
if (file_exists($logname)) { |
if (file_exists($logname)) { |
|
print "<hr><br><b>CHANGES TO THIS FILE</b><br><table border=0 width=100%>\n"; |
|
354 |
$log=fopen($logname,"r"); |
$log=fopen($logname,"r"); |
355 |
$cl1=" class=lst"; $cl2=""; |
$cl1=" class=LST"; $cl2=""; |
356 |
|
$logarr = array(); |
357 |
while($line = fgetcsv($log,255,"\t")) { |
while($line = fgetcsv($log,255,"\t")) { |
358 |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
359 |
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])); |
360 |
} |
} |
361 |
fclose($log); |
fclose($log); |
362 |
|
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) |
369 |
|
while ($e = array_shift($logarr)) { |
370 |
|
if (strstr($e[4],"upload")) { |
371 |
|
if (file_exists("$bakdir/$bakcount/$name")) { |
372 |
|
$e[4]="<a href=\"$webRoot".urlpath(dirname($relPath)."/.bak/$bakcount/$name")."\">$e[4]</a>"; |
373 |
|
} |
374 |
|
$bakcount++; |
375 |
|
} |
376 |
|
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"; |
377 |
|
} |
378 |
print "</table>"; |
print "</table>"; |
379 |
} |
} |
380 |
|
|
630 |
|
|
631 |
function Navigate($fsRoot,$relDir) { |
function Navigate($fsRoot,$relDir) { |
632 |
|
|
633 |
global $gblEditable, $gblIcon ; |
global $gblEditable, $gblIcon, $gblModDays, $webRoot ; |
634 |
|
|
635 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $GLOBALS["PHP_SELF"] ; |
636 |
if (isset($GLOBALS["HTTPS"]) && $GLOBALS["HTTPS"] == "on") { |
|
637 |
$webRoot = "https://" . $GLOBALS["SERVER_NAME"] ; |
$fsDir = $fsRoot . $relDir . "/" ; // current directory |
|
} else { |
|
|
$webRoot = "http://" . $GLOBALS["SERVER_NAME"] ; |
|
|
} |
|
|
$fsDir = $fsRoot . $relDir . "/" ; // current directory |
|
638 |
|
|
639 |
if (!is_dir($fsDir)) Error("Dir not found",$relDir) ; |
if (!is_dir($fsDir)) Error("Dir not found",$relDir) ; |
640 |
|
|
675 |
$text .= ", <a href=$self?D=".urlencode($relDir)."&show_deleted=1>undelete</a>"; |
$text .= ", <a href=$self?D=".urlencode($relDir)."&show_deleted=1>undelete</a>"; |
676 |
} |
} |
677 |
$text .= " or revise files on this web site." ; |
$text .= " or revise files on this web site." ; |
678 |
|
$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>."; |
679 |
StartHTML("(Navigate)",$text) ; |
StartHTML("(Navigate)",$text) ; |
680 |
|
|
681 |
echo "<TABLE BORDER=0 CELLPADDING=2 |
echo "<TABLE BORDER=0 CELLPADDING=2 |
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> |
755 |
|
|
756 |
$info_url=$self."?A=E&F=".urlencode($file)."&D=".urlencode($relDir); |
$info_url=$self."?A=E&F=".urlencode($file)."&D=".urlencode($relDir); |
757 |
|
|
758 |
if ( ($mod + 30*86400) > time() ) { |
if ( ($mod + $gblModDays*86400) > time() ) { |
759 |
$a = "<SPAN CLASS=RED TITLE=\"Newer" ; |
$a = "<SPAN CLASS=RED TITLE=\"Newer" ; |
760 |
$a .= " than 30 days\"> * </SPAN>" ; |
$a .= " than $gblModDays days\"> * </SPAN>" ; |
761 |
} |
} |
762 |
|
|
763 |
$file_lock=CheckLock($path); |
$file_lock=CheckLock($path); |
822 |
|
|
823 |
<?php |
<?php |
824 |
} // iterate over files |
} // iterate over files |
825 |
} // end if no files |
} else { // end if no files |
826 |
|
?> |
827 |
|
<TR><TD></TD><TD COLSPAN=5 CLASS=LST> |
828 |
|
No files in this directory |
829 |
|
</TD></TR> |
830 |
|
<? |
831 |
|
} |
832 |
|
|
833 |
if ($emptyDir) { |
if ($emptyDir) { |
834 |
?> |
?> |
848 |
|
|
849 |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
850 |
|
|
851 |
<TR><TD></TD><TD COLSPAN=5> |
<? |
852 |
To just view file without editing, select it's filename (<b>don't edit files which are opened this way!</b>)<br> |
if (file_exists(".info.inc")) { |
853 |
To <b>edit</b> file select <?= $gblIcon("checkout") ?> to check-out |
print "<TR><TD></TD><TD COLSPAN=5>"; |
854 |
and edit it locally. After editing is over, select filename or <?= $gblIcon("checkin") ?> to check-in (update copy of file on server).<br> |
include(".info.inc"); |
855 |
<by>If you select icon left from filename, you will get detailed information |
print "</TD></TR> |
856 |
about file, as well as delete, rename and annotation options. |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
857 |
</TD></TR> |
} |
858 |
|
?> |
|
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
|
859 |
|
|
860 |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
861 |
<TR><TD></TD><TD COLSPAN=5 CLASS=BAR>CREATE NEW |
<TR><TD></TD><TD COLSPAN=5 CLASS=BAR>CREATE NEW |
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>OR <A HREF="<?= $self |
</NOBR> |
869 |
?>?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> |
872 |
</FORM> |
</FORM> |
878 |
|
|
879 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
880 |
|
|
881 |
function UploadPage($fsRoot, $relDir, $filename) { |
function UploadPage($fsRoot, $relDir, $filename="") { |
882 |
|
|
883 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $GLOBALS["PHP_SELF"] ; |
884 |
if ($relDir == "") $relDir = "/" ; |
if ($relDir == "") $relDir = "/" ; |
888 |
<FORM ENCTYPE="multipart/form-data" METHOD="POST" |
<FORM ENCTYPE="multipart/form-data" METHOD="POST" |
889 |
ACTION="<?= $self ?>"> |
ACTION="<?= $self ?>"> |
890 |
DESTINATION DIRECTORY:<B><?= " " . $relDir ?></B> |
DESTINATION DIRECTORY:<B><?= " " . $relDir ?></B> |
891 |
<? if (isset($filename)) { ?> |
<? if (isset($filename) && $filename!="") { ?> |
892 |
<br>DESTINATION FILE:<B><?= " " . $filename ?></B> |
<br>DESTINATION FILE:<B><?= " " . $filename ?></B> |
893 |
<INPUT TYPE="HIDDEN" NAME="FILENAME" VALUE="<?= $filename ?>"> |
<INPUT TYPE="HIDDEN" NAME="FILENAME" VALUE="<?= $filename ?>"> |
894 |
<? } ?> |
<? } ?> |
923 |
|
|
924 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
925 |
|
|
|
function CreateHash($user, $pw) { |
|
|
|
|
|
global $gblHash ; // hash function to use |
|
|
|
|
|
if ($user == "" || $pw == "") { |
|
|
$text = "either no password or no username supplied" ; |
|
|
Error("Create Hash",$text) ; |
|
|
} |
|
|
$title = "(Create Hash)" ; |
|
|
StartHTML($title) ; |
|
|
echo "<P ALIGN=center>" ; |
|
|
echo "<BLOCKQUOTE>Copy the value below and paste it " ; |
|
|
echo "into the<BR>value for \$gblPw in the source of " ; |
|
|
echo "this file<BR><BR><B>" . $gblHash($user.$pw) ; |
|
|
echo "</B><BR><BR>Hash function: " . $gblHash ; |
|
|
echo "</BLOCKQUOTE></P>" ; |
|
|
EndHTML() ; |
|
|
exit ; |
|
|
|
|
|
} // end function CreateHash |
|
|
|
|
|
////////////////////////////////////////////////////////////////// |
|
|
|
|
926 |
function NoEntry() { |
function NoEntry() { |
927 |
|
|
928 |
$user = $GLOBALS["PHP_AUTH_USER"] ; |
$user = $GLOBALS["PHP_AUTH_USER"] ; |
932 |
$title = "(401 Unauthorized)" ; |
$title = "(401 Unauthorized)" ; |
933 |
$text = "No trespassing !" ; |
$text = "No trespassing !" ; |
934 |
StartHTML($title,$text) ; |
StartHTML($title,$text) ; |
|
?> |
|
|
|
|
|
<FORM ACTION="<?= $self ?>?HASH=create" METHOD="POST"> |
|
|
<INPUT TYPE="HIDDEN" NAME="USER" VALUE="<?= $user ?>"> |
|
|
<INPUT TYPE="HIDDEN" NAME="PW" VALUE="<?= $pw ?>"> |
|
|
|
|
|
<BLOCKQUOTE><B>If you are a site administrator:</B><BR><BR> |
|
|
Click below to <B>generate a password hash</B><BR>from |
|
|
the username-password pair you just<BR>entered. Then include the hash in |
|
|
the source<BR>of this file.<BR><BR> |
|
|
<INPUT TYPE="SUBMIT" VALUE="CREATE HASH"> |
|
|
</BLOCKQUOTE></FORM> |
|
935 |
|
|
|
<?php |
|
936 |
EndHTML() ; |
EndHTML() ; |
937 |
exit ; |
exit ; |
938 |
} |
} |
939 |
|
|
940 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
941 |
|
|
942 |
function Logit($target,$msg) { |
function LogIt($target,$msg) { |
943 |
|
|
944 |
$dir=dirname($target); |
$dir=dirname($target); |
945 |
if (! file_exists($dir."/.log")) { |
if (! file_exists($dir."/.log")) { |
959 |
|
|
960 |
function WriteNote($target,$msg) { |
function WriteNote($target,$msg) { |
961 |
|
|
962 |
|
$target=stripSlashes($target); |
963 |
$dir=dirname($target); |
$dir=dirname($target); |
964 |
if (! file_exists($dir."/.note")) { |
if (! file_exists($dir."/.note")) { |
965 |
mkdir($dir."/.note",0700); |
mkdir($dir."/.note",0700); |
976 |
|
|
977 |
function ReadNote($target) { |
function ReadNote($target) { |
978 |
|
|
979 |
|
$target=stripSlashes($target); |
980 |
$dir=dirname($target); |
$dir=dirname($target); |
981 |
$file=basename($target); |
$file=basename($target); |
982 |
$msg=""; |
$msg=""; |
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 |
|
|
993 |
|
|
994 |
function MoveTo($source,$folder) { |
function MoveTo($source,$folder) { |
995 |
|
|
996 |
|
$source=stripSlashes($source); |
997 |
$file=basename($source); |
$file=basename($source); |
998 |
if (! file_exists($folder)) { |
if (! file_exists($folder)) { |
999 |
mkdir($folder,0700); |
mkdir($folder,0700); |
1007 |
|
|
1008 |
function Lock($target) { |
function Lock($target) { |
1009 |
|
|
1010 |
|
$target=stripSlashes($target); |
1011 |
$dir=dirname($target); |
$dir=dirname($target); |
1012 |
if (! file_exists($dir."/.lock")) { |
if (! file_exists($dir."/.lock")) { |
1013 |
mkdir($dir."/.lock",0700); |
mkdir($dir."/.lock",0700); |
1028 |
|
|
1029 |
function CheckLock($target) { |
function CheckLock($target) { |
1030 |
|
|
1031 |
|
$target=stripSlashes($target); |
1032 |
$dir=dirname($target); |
$dir=dirname($target); |
1033 |
$file=basename($target); |
$file=basename($target); |
1034 |
$msg=0; |
$msg=0; |
1043 |
|
|
1044 |
function Unlock($target) { |
function Unlock($target) { |
1045 |
|
|
1046 |
|
$target=stripSlashes($target); |
1047 |
$dir=dirname($target); |
$dir=dirname($target); |
1048 |
$file=basename($target); |
$file=basename($target); |
1049 |
if (file_exists($dir."/.lock/$file")) { |
if (file_exists($dir."/.lock/$file")) { |
1057 |
|
|
1058 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1059 |
|
|
1060 |
function redir_to_url($url) { |
function urlpath($url) { |
1061 |
$url=urlencode(StripSlashes("$relDir/$F")); |
$url=urlencode(StripSlashes("$url")); |
1062 |
$url=str_replace("%2F","/",$url); |
$url=str_replace("%2F","/",$url); |
1063 |
$url=str_replace("+","%20",$url); |
$url=str_replace("+","%20",$url); |
1064 |
Header("Location: $url"); |
return($url); |
1065 |
|
} |
1066 |
|
|
1067 |
|
////////////////////////////////////////////////////////////////// |
1068 |
|
|
1069 |
|
function safe_rename($fromdir,$fromfile,$tofile) { |
1070 |
|
function try_rename($from,$to) { |
1071 |
|
# 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 |
1106 |
|
|
1107 |
|
function rrmdir($dir) { |
1108 |
|
$handle=opendir($dir); |
1109 |
|
while ($file = readdir($handle)) { |
1110 |
|
if ($file != "." && $file != "..") { |
1111 |
|
if (is_dir("$dir/$file")) |
1112 |
|
rrmdir("$dir/$file"); |
1113 |
|
else |
1114 |
|
if (! @unlink("$dir/$file")) return(0); |
1115 |
|
} |
1116 |
|
} |
1117 |
|
closedir($handle); |
1118 |
|
return @rmdir($dir); |
1119 |
|
} |
1120 |
|
|
1121 |
|
////////////////////////////////////////////////////////////////// |
1122 |
|
|
1123 |
|
function ChangeLog($target,$msg) { |
1124 |
|
|
1125 |
|
global $gblFsRoot; |
1126 |
|
$log=fopen("$gblFsRoot/.changelog","a+"); |
1127 |
|
if (substr($target,0,strlen($gblFsRoot)) == $gblFsRoot) |
1128 |
|
$target=substr($target,strlen($gblFsRoot),strlen($target)-strlen($gblFsRoot)); |
1129 |
|
fputs($log,time()."\t$target\t$GLOBALS[gblUserName]\t$msg\n"); |
1130 |
|
fclose($log); |
1131 |
|
|
1132 |
|
} |
1133 |
|
|
1134 |
|
function DisplayChangeLog($day) { |
1135 |
|
|
1136 |
|
global $gblFsRoot; |
1137 |
|
if (!file_exists("$gblFsRoot/.changelog")) return; |
1138 |
|
$log=fopen("$gblFsRoot/.changelog","r"); |
1139 |
|
$logarr = array(); |
1140 |
|
while($line = fgetcsv($log,255,"\t")) { |
1141 |
|
if ($day!=1 || ($day==1 && (time()-$line[0] < 24*60*60))) { |
1142 |
|
array_unshift($logarr,array($line[0],$line[1],$line[2],$line[3])); |
1143 |
|
} |
1144 |
|
} |
1145 |
|
fclose($log); |
1146 |
|
$cl1=" class=LST"; $cl2=""; |
1147 |
|
print "<table border=0 width=100%>\n"; |
1148 |
|
while ($e = array_shift($logarr)) { |
1149 |
|
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
1150 |
|
$date = date("$GLOBALS[gblDateFmt]", $e[0]); |
1151 |
|
$time = date("$GLOBALS[gblTimeFmt]", $e[0]); |
1152 |
|
$dir = dirname($e[1]); |
1153 |
|
$file = basename($e[1]); |
1154 |
|
print "<tr><td$cl>$date</td><td$cl>$time</td><td$cl><a href=\"$GLOBALS[PHP_SELF]?D=".urlencode($dir)."\">$dir</a>/$file</td><td$cl>$e[2]</td><td$cl>$e[3]</td></tr>\n"; |
1155 |
|
} |
1156 |
|
print "</table>"; |
1157 |
|
print "<p>".GifIcon(up)." Back to <a href=$GLOBALS[PHP_SELF]>front page</a>.</p>"; |
1158 |
} |
} |
1159 |
|
|
1160 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1174 |
// forks before authentication: style sheet and hash |
// forks before authentication: style sheet and hash |
1175 |
// creation if password not yet set. |
// creation if password not yet set. |
1176 |
if ($STYLE == "get") { CSS() ; exit ; } |
if ($STYLE == "get") { CSS() ; exit ; } |
1177 |
if ($HASH != "") { |
|
1178 |
CreateHash($USER, $PW) ; |
$htusers_file=dirname($SCRIPT_FILENAME)."/.htusers"; |
1179 |
exit ; |
if (! file_exists($htusers_file)) { |
1180 |
|
if (is_writeable(dirname($SCRIPT_FILENAME))) { |
1181 |
|
$htusers=fopen($htusers_file,"a+"); |
1182 |
|
fputs($htusers,"# Change owner of $htusers_file to root !!\n"); |
1183 |
|
fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n"); |
1184 |
|
fclose($htusers); |
1185 |
|
Error("Proto user file created!","Please edit <tt>$htusers_file</tt> and set it correct permissions (<B>not writable by web server as it is now!</b>). You can add users using <tt>adduser.pl</tt> script!"); |
1186 |
|
exit; |
1187 |
|
} else { |
1188 |
|
Error("Can't create proto user file!","Please make directory <tt>".dirname($htusers_file)."</tt> writable or create <tt>.htusers</tt> file by hand using <tt>adduser.pl</tt> script!"); |
1189 |
|
exit; |
1190 |
|
} |
1191 |
|
} |
1192 |
|
$htusers=fopen($htusers_file,"r"); |
1193 |
|
while($user = fgetcsv($htusers,255,":")) { |
1194 |
|
if ($user[0] == $GLOBALS["PHP_AUTH_USER"]) { |
1195 |
|
$gblUserName=$user[1]; |
1196 |
|
$gblPw=$user[2]; |
1197 |
|
if (substr($gblPw,0,5) == "auth_" && file_exists("$gblIncDir/$gblPw.php")) { |
1198 |
|
require("$gblIncDir/$gblPw.php"); |
1199 |
|
if ($gblPw($user)) { |
1200 |
|
$gblPw=md5($PHP_AUTH_USER.$PHP_AUTH_PW); |
1201 |
|
} else { |
1202 |
|
$gblPw="error".md5($PHP_AUTH_USER.$PHP_AUTH_PW); |
1203 |
|
} |
1204 |
|
} |
1205 |
|
$gblEmail=$user[3]; |
1206 |
|
continue ; |
1207 |
|
} |
1208 |
} |
} |
1209 |
|
fclose($htusers); |
1210 |
|
|
1211 |
// authentication if $gblAuth == true |
// authentication failure |
1212 |
if ( $gblAuth && $gblHash($PHP_AUTH_USER.$PHP_AUTH_PW) != $gblPw || |
if ( md5($PHP_AUTH_USER.$PHP_AUTH_PW) != $gblPw || |
1213 |
isset($relogin) && $gblPw == $relogin ) { |
isset($relogin) && $gblPw == $relogin ) { |
1214 |
header("WWW-authenticate: basic realm=\"$SERVER_NAME\"") ; |
header("WWW-authenticate: basic realm=\"$HTTP_HOST\"") ; |
1215 |
header("HTTP/1.0 401 Unauthorized") ; |
header("HTTP/1.0 401 Unauthorized") ; |
1216 |
NoEntry() ; |
NoEntry() ; |
1217 |
exit ; |
exit ; |
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 |
|
|
1236 |
// i.e. below $gblFsRoot. |
// i.e. below $gblFsRoot. |
1237 |
|
|
1238 |
$relScriptDir = dirname($SCRIPT_NAME) ; |
$relScriptDir = dirname($SCRIPT_NAME) ; |
1239 |
// i.e. /siteman |
// i.e. /docman |
1240 |
|
|
1241 |
$fsScriptDir = dirname($SCRIPT_FILENAME) ; |
$fsScriptDir = dirname($SCRIPT_FILENAME) ; |
1242 |
// i.e. /home/httpd/html/siteman |
// i.e. /home/httpd/html/docman |
1243 |
|
|
1244 |
$gblFsRoot = substr($fsScriptDir,0, |
// start on server root |
1245 |
strlen($fsScriptDir)-strlen($relScriptDir)) ; |
// $gblFsRoot = substr($fsScriptDir,0, strlen($fsScriptDir)-strlen($relScriptDir)) ; |
1246 |
|
// or on script root |
1247 |
|
$gblFsRoot = $fsScriptDir; |
1248 |
// i.e. /home/httpd/html |
// i.e. /home/httpd/html |
1249 |
|
|
1250 |
$fsDir = $gblFsRoot . $relDir ; // current directory |
$fsDir = $gblFsRoot . $relDir ; // current directory |
1251 |
if ( !is_dir($fsDir) ) Error("Dir not found",$relDir) ; |
if ( !is_dir($fsDir) ) Error("Dir not found",$relDir) ; |
1252 |
|
|
1253 |
|
if (isset($GLOBALS["HTTPS"]) && $GLOBALS["HTTPS"] == "on") { |
1254 |
|
$webRoot = "https://"; |
1255 |
|
} else { |
1256 |
|
$webRoot = "http://"; |
1257 |
|
} |
1258 |
|
$webRoot .= $GLOBALS["HTTP_HOST"] . $relScriptDir; |
1259 |
|
|
1260 |
|
$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) ; |
1271 |
// TODO : should rather check for escapeshellcmds |
// TODO : should rather check for escapeshellcmds |
1272 |
// but maybe RFC 18xx asserts safe filenames .... |
// but maybe RFC 18xx asserts safe filenames .... |
1273 |
$source = $FN ; |
$source = $FN ; |
1274 |
|
if (! file_exists($source)) { |
1275 |
|
Error("You must select file with browse to upload it!"); |
1276 |
|
} |
1277 |
if (! isset($FILENAME)) { // from update file |
if (! isset($FILENAME)) { // from update file |
1278 |
$target = "$fsDir/$FN_name" ; |
$target = "$fsDir/$FN_name" ; |
1279 |
} else { |
} else { |
1301 |
if (isset($FILENAME)) { |
if (isset($FILENAME)) { |
1302 |
Unlock($target); |
Unlock($target); |
1303 |
} |
} |
1304 |
|
ChangeLog($target,"updated"); |
1305 |
break ; |
break ; |
1306 |
|
|
1307 |
case "SAVE" : |
case "SAVE" : |
1308 |
$path = $gblFsRoot . escapeshellcmd($RELPATH) ; |
$path = $gblFsRoot . $RELPATH ; |
1309 |
|
$path=stripSlashes($path); |
1310 |
$writable = is_writeable($path) ; |
$writable = is_writeable($path) ; |
1311 |
$legaldir = is_writeable(dirname($path)) ; |
$legaldir = is_writeable(dirname($path)) ; |
1312 |
$exists = (file_exists($path)) ? 1 : 0 ; |
$exists = (file_exists($path)) ? 1 : 0 ; |
1314 |
if (!($writable || (!$exists && $legaldir))) |
if (!($writable || (!$exists && $legaldir))) |
1315 |
Error("Write denied",$RELPATH) ; |
Error("Write denied",$RELPATH) ; |
1316 |
$fh = fopen($path, "w") ; |
$fh = fopen($path, "w") ; |
1317 |
|
$FILEDATA=stripSlashes($FILEDATA); |
1318 |
fwrite($fh,$FILEDATA) ; |
fwrite($fh,$FILEDATA) ; |
1319 |
fclose($fh) ; |
fclose($fh) ; |
1320 |
clearstatcache() ; |
clearstatcache() ; |
1321 |
Logit($path,"saved changes"); |
Logit($path,"saved changes"); |
1322 |
|
ChangeLog($path,"saved changes"); |
1323 |
break ; |
break ; |
1324 |
|
|
1325 |
case "CREATE" : |
case "CREATE" : |
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) { |
1350 |
} |
} |
1351 |
$tstr = "$PHP_SELF?A=E&D=".urlencode($relDir)."&F=".urlencode($FN) ; |
$tstr = "$PHP_SELF?A=E&D=".urlencode($relDir)."&F=".urlencode($FN) ; |
1352 |
header("Location: " . $tstr) ; |
header("Location: " . $tstr) ; |
1353 |
|
ChangeLog($target,"created"); |
1354 |
exit ; |
exit ; |
1355 |
} |
} |
1356 |
break ; |
break ; |
1383 |
} |
} |
1384 |
} |
} |
1385 |
else { // delete directory |
else { // delete directory |
1386 |
if ( ! @rmdir($fsDir) ) { |
if ( ! @rrmdir($fsDir) ) { |
1387 |
Error("Rmdir failed", $tstr . $fsDir) ; |
Error("Rmdir failed", $tstr . $fsDir) ; |
1388 |
} |
} |
1389 |
else { |
else { |
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 |
rename("$fsDir/$FN","$fsDir/$NEWNAME"); |
safe_rename($fsDir,$FN,$NEWNAME); |
|
rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME"); |
|
|
rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME"); |
|
|
rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME"); |
|
|
|
|
1414 |
break ; |
break ; |
1415 |
|
|
1416 |
case "NOTE" : |
case "NOTE" : |
1441 |
// $A=Ci : checkin file $D/$F |
// $A=Ci : checkin file $D/$F |
1442 |
// $A=V : view file (do nothing except log) |
// $A=V : view file (do nothing except log) |
1443 |
// default : display directory $D |
// default : display directory $D |
1444 |
|
|
1445 |
switch ($A) { |
switch ($A) { |
1446 |
case "U" : |
case "U" : |
1447 |
// upload to $relDir |
// upload to $relDir |
1448 |
if (!is_writeable($gblFsRoot . $relDir)) |
if (!is_writeable($gblFsRoot . $relDir)) |
1449 |
Error("Write access denied",$relDir) ; |
Error("Write access denied",$relDir) ; |
1450 |
$text = "Use this page to upload a single " ; |
$text = "Use this page to upload a single " ; |
1451 |
$text .= "file to <B>$SERVER_NAME</B>." ; |
$text .= "file to <B>$HTTP_HOST</B>." ; |
1452 |
StartHTML("(Upload Page)", $text) ; |
StartHTML("(Upload Page)", $text) ; |
1453 |
UploadPage($gblFsRoot, $relDir) ; |
UploadPage($gblFsRoot, $relDir) ; |
1454 |
EndHTML() ; |
EndHTML() ; |
1455 |
exit ; |
exit ; |
1456 |
case "E" : |
case "E" : |
1457 |
|
$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); |
1463 |
// listing of $relDir/$F |
// listing of $relDir/$F |
1464 |
DisplayCode($gblFsRoot, $relDir, $F) ; |
DisplayCode($gblFsRoot, $relDir, $F) ; |
1465 |
exit ; |
exit ; |
1466 |
case "Co" : |
case "Co" : |
1467 |
// checkout |
// checkout |
1468 |
Lock("$gblFsRoot/$relDir/$F"); |
Lock("$gblFsRoot/$relDir/$F"); |
1469 |
redir_to_url("$relDir/$F"); |
header("Content-Disposition: attachment; filename=$F" ); |
1470 |
|
Header("Location: $webRoot".urlpath("$relDir/$F")); |
1471 |
exit; |
exit; |
1472 |
case "Ci" : |
case "Ci" : |
1473 |
|
$F=stripSlashes($F); |
1474 |
// upload && update to $relDir |
// upload && update to $relDir |
1475 |
if (!is_writeable($gblFsRoot . $relDir)) |
if (!is_writeable($gblFsRoot . $relDir)) |
1476 |
Error("Write access denied",$relDir) ; |
Error("Write access denied",$relDir) ; |
1477 |
$text = "Use this page to update a single " ; |
$text = "Use this page to update a single " ; |
1478 |
$text .= "file to <B>$SERVER_NAME</B>." ; |
$text .= "file to <B>$HTTP_HOST</B>." ; |
1479 |
StartHTML("(Update file Page)", $text) ; |
StartHTML("(Update file Page)", $text) ; |
1480 |
UploadPage($gblFsRoot, $relDir, $F) ; |
UploadPage($gblFsRoot, $relDir, $F) ; |
1481 |
EndHTML() ; |
EndHTML() ; |
1482 |
exit ; |
exit ; |
1483 |
case "V" : |
case "V" : |
1484 |
// view |
// view |
1485 |
Log("viewed"); |
LogIt("$gblFsRoot/$relDir/$F","viewed"); |
1486 |
redir_to_url("$relDir/$F"); |
header("Content-Disposition: attachment; filename=$F" ); |
1487 |
|
Header("Location: $webRoot".urlpath("$relDir/$F")); |
1488 |
|
exit; |
1489 |
|
case "Ch" : |
1490 |
|
StartHTML("(File changes)","All changes chronologicaly..."); |
1491 |
|
DisplayChangeLog(0); // all |
1492 |
|
EndHTML() ; |
1493 |
|
exit; |
1494 |
|
case "Ch1" : |
1495 |
|
StartHTML("(File changes)","Changes to files in last day..."); |
1496 |
|
DisplayChangeLog(1); |
1497 |
|
EndHTML() ; |
1498 |
exit; |
exit; |
1499 |
} |
} |
1500 |
|
|