25 |
// from where to include auth_*.php modules? |
// from where to include auth_*.php modules? |
26 |
$gblIncDir = "/data/docman2"; |
$gblIncDir = "/data/docman2"; |
27 |
|
|
28 |
// force download (so it won't open in associated application) |
// force download on view (so it won't open in associated application) |
29 |
$gblForceDownload = 1; |
$gblForceDownload = 0; |
30 |
|
|
31 |
// date format |
// date format |
32 |
$gblDateFmt="Y-m-d"; |
$gblDateFmt="Y-m-d"; |
84 |
LoadLanguage($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]); |
LoadLanguage($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]); |
85 |
|
|
86 |
// for security and configuration |
// for security and configuration |
87 |
$realm="$HTTP_HOST"; // FIX |
$realm=$HTTP_SERVER_VARS[HTTP_HOST]; |
88 |
|
|
89 |
$fsDocumentRoot = dirname($HTTP_SERVER_VARS[SCRIPT_FILENAME]); |
$fsDocumentRoot = dirname($HTTP_SERVER_VARS[SCRIPT_FILENAME]); |
90 |
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); |
91 |
|
|
92 |
// globals for later |
// globals for later |
93 |
$gblLogin = $PHP_AUTH_USER; |
$gblLogin = $HTTP_SERVER_VARS[PHP_AUTH_USER]; |
94 |
$gblPasswd = $PHP_AUTH_PW; |
$gblPasswd = $HTTP_SERVER_VARS[PHP_AUTH_PW]; |
95 |
|
|
96 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
97 |
|
|
109 |
|
|
110 |
function StartHTML($title,$text="") { |
function StartHTML($title,$text="") { |
111 |
|
|
112 |
global $html,$fsDocumentRoot; |
global $html,$fsDocumentRoot,$HTTP_SERVER_VARS; |
113 |
|
|
114 |
$title = $gblTitle." ".$title ; |
$title = $gblTitle." ".$title ; |
115 |
$host = $GLOBALS["HTTP_HOST"] ; |
$host = $HTTP_SERVER_VARS["HTTP_HOST"] ; |
116 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
117 |
|
|
118 |
if (file_exists("$fsDocumentRoot/docman.css")) { |
if (file_exists("$fsDocumentRoot/docman.css")) { |
119 |
$css=dirname($self)."/docman.css"; |
$css=dirname($self)."/docman.css"; |
145 |
$url_title="relogin"; |
$url_title="relogin"; |
146 |
} |
} |
147 |
include("$html/footer.html"); |
include("$html/footer.html"); |
|
//phpinfo(); |
|
148 |
} // end function EndHTML |
} // end function EndHTML |
149 |
|
|
150 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
151 |
|
|
152 |
function DetailPage($fsRoot,$relDir,$fn) { |
function DetailPage($fsRoot,$relDir,$fn) { |
153 |
|
|
154 |
global $gblEditable, $gblImages, $webRoot, $html ; |
global $gblEditable, $gblImages, $webRoot, $html, $HTTP_SERVER_VARS ; |
155 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
156 |
|
|
157 |
$relPath = $relDir . "/" . $fn ; |
$relPath = $relDir . "/" . $fn ; |
158 |
$fsPath = $fsRoot . $relPath ; |
$fsPath = $fsRoot . $relPath ; |
571 |
function Navigate($fsRoot,$relDir) { |
function Navigate($fsRoot,$relDir) { |
572 |
|
|
573 |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
574 |
$HTTP_GET_VARS, $html; |
$gblIgnoreUnknownFileType, |
575 |
|
$HTTP_GET_VARS, $html, $realm_config; |
576 |
|
|
577 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
578 |
|
|
579 |
if ($relDir == "") $relDir = "/"; |
if ($relDir == "") $relDir = "/"; |
580 |
|
|
584 |
|
|
585 |
$hide_items=",$gblHide,"; |
$hide_items=",$gblHide,"; |
586 |
|
|
|
#display_all_trustee(); |
|
|
print "-- $fsDir --"; |
|
|
|
|
587 |
// read directory contents |
// read directory contents |
588 |
if ( !($dir = @opendir($fsDir)) ) |
if ( !($dir = @opendir($fsDir)) ) |
589 |
Error("Read Access denied",$relDir) ; |
Error("Read Access denied",$relDir,1) ; |
590 |
while ($item = readdir($dir)) { |
while ($item = readdir($dir)) { |
|
print "$item, "; |
|
591 |
if ( substr($item,0,1) == "." || strstr($hide_items,",$item,") ) continue ; |
if ( substr($item,0,1) == "." || strstr($hide_items,",$item,") ) continue ; |
592 |
if ((is_dir($fsDir.$item) || is_link ($fsDir.$item)) && check_perm($relDir.$item,trperm_b)) { |
if (is_dir($fsDir.$item) || is_link ($fsDir.$item)) { |
593 |
$dirList[$item] = $item ; |
if (check_perm($relDir.$item,trperm_b)) { |
594 |
$dirNote[$item] = ReadNote($fsDir.$item); |
$dirList[$item] = $item ; |
595 |
} else if ( is_file($fsDir.$item) && check_perm($relDir.$item,trperm_r) ) { |
$dirNote[$item] = ReadNote($fsDir.$item); |
596 |
$fileList[$item] = $item ; |
} |
597 |
$fileDate[$item] = filemtime($fsDir.$item) ; |
} else if (is_file($fsDir.$item)) { |
598 |
$fileSize[$item] = filesize($fsDir.$item) ; |
if (check_perm($relDir.$item,trperm_r)) { |
599 |
$fileNote[$item] = ReadNote($fsDir.$item); |
$fileList[$item] = $item ; |
600 |
|
$fileDate[$item] = filemtime($fsDir.$item) ; |
601 |
|
$fileSize[$item] = filesize($fsDir.$item) ; |
602 |
|
$fileNote[$item] = ReadNote($fsDir.$item); |
603 |
|
} |
604 |
} else { |
} else { |
605 |
// unknown file type |
if (! $gblIgnoreUnknownFileType) Error("File Type Error", "Item <tt>".$fsDir.$item."</tt> is not file, directory or link. If you want to ignore errors like this, set <tt>\$gblIgnoreUnknownFileType = 1</tt> in <tt>$realm_config</tt>.",1); |
|
// $text = "Could not determine file type of " ; |
|
|
// Error("File Error", $text.$relDir."/".$item) ; |
|
|
// exit ; |
|
606 |
} |
} |
607 |
} |
} |
608 |
closedir($dir) ; |
closedir($dir) ; |
609 |
|
|
610 |
// scan deleted files |
// scan deleted files |
611 |
if ( $GLOBALS[show_deleted] == 1 && ($dir = @opendir("$fsDir/.del")) ) { |
if ( $HTTP_GET_VARS["show_deleted"] == 1 && ($dir = @opendir("$fsDir/.del")) ) { |
612 |
while ($item = readdir($dir)) { |
while ($item = readdir($dir)) { |
613 |
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 ; |
614 |
$fileList[$item] = ".del/$item" ; |
$fileList[$item] = ".del/$item" ; |
623 |
|
|
624 |
// start navigation page |
// start navigation page |
625 |
$text = "Use this page to add, delete"; |
$text = "Use this page to add, delete"; |
626 |
if (! isset($show_deleted)) { |
if (! isset($HTTP_GET_VARS[show_deleted])) { |
627 |
$text .= ", <a href=$self?D=".urlencode($relDir)."&show_deleted=1>undelete</a>"; |
$text .= ", <a href=$self?D=".urlencode($relDir)."&show_deleted=1>undelete</a>"; |
628 |
} |
} |
629 |
$text .= " or revise files on this web site." ; |
$text .= " or revise files on this web site." ; |
785 |
|
|
786 |
$file_lock=CheckLock($path); |
$file_lock=CheckLock($path); |
787 |
|
|
788 |
$file_url_html="<A HREF=\"$self?A=V&F=".urlencode($file); |
$file_url_html="<A HREF=\"$self?A=V&D=".urlencode($relDir)."&F=".urlencode($file); |
|
$file_url_html.="&D=".urlencode($relDir); |
|
789 |
$file_url_html.="\" TITLE=\"View file\">" ; |
$file_url_html.="\" TITLE=\"View file\">" ; |
790 |
|
|
791 |
if (substr($file,0,5) != ".del/") { |
if (substr($file,0,5) != ".del/") { |
800 |
|
|
801 |
if ($file_lock) { |
if ($file_lock) { |
802 |
if ($file_lock == $GLOBALS[gblUserName]) { |
if ($file_lock == $GLOBALS[gblUserName]) { |
803 |
$b.="<A HREF=\"$self?A=Ci&F=".urlencode($file); |
$b.="<A HREF=\"$self?A=Ci&D=".urlencode($relDir)."&F=".urlencode($file); |
|
$b.="&D=".urlencode($relDir); |
|
804 |
$b.="\" TITLE=\"Checkin (update) file on server\">" ; |
$b.="\" TITLE=\"Checkin (update) file on server\">" ; |
805 |
$file_url_html=$b; |
$file_url_html=$b; |
806 |
$b.=$gblIcon("checkin")."</A>" ; |
$b.=$gblIcon("checkin")."</A>" ; |
814 |
$file_url_html = "$file $a"; |
$file_url_html = "$file $a"; |
815 |
} |
} |
816 |
} else { |
} else { |
817 |
$b.="<A HREF=\"$self?A=Co&F=".urlencode($file); |
$b.="<A HREF=\"$self?A=Co&D=".urlencode($relDir)."&F=".urlencode($file); |
|
$b.="&D=".urlencode($relDir); |
|
818 |
$b.="\" TITLE=\"Checkout file for edit\">" ; |
$b.="\" TITLE=\"Checkout file for edit\">" ; |
819 |
$b.=$gblIcon("checkout")."</A>" ; |
$b.=$gblIcon("checkout")."</A>"; |
820 |
|
|
821 |
if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) { |
if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) { |
822 |
$b.="<A HREF=\"$self?A=C&F=".urlencode($file); |
$b.="<A HREF=\"$self?A=C&D=".urlencode($relDir)."&F=".urlencode($file); |
|
$b.="&D=".urlencode($relDir); |
|
823 |
$b.="\" TITLE=\"List contents\">" ; |
$b.="\" TITLE=\"List contents\">" ; |
824 |
$b.=$gblIcon("view")."</A>" ; |
$b.=$gblIcon("view")."</A>" ; |
825 |
} else { |
} else { |
889 |
|
|
890 |
function UploadPage($fsRoot, $relDir, $filename="") { |
function UploadPage($fsRoot, $relDir, $filename="") { |
891 |
|
|
892 |
$self = $GLOBALS["PHP_SELF"] ; |
global $html, $HTTP_SERVER_VARS; |
893 |
|
|
894 |
|
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
895 |
if ($relDir == "") $relDir = "/" ; |
if ($relDir == "") $relDir = "/" ; |
|
?> |
|
896 |
|
|
897 |
<P><TABLE BORDER=0 CELLPADDING=5><TR><TD WIDTH=5></TD><TD CLASS=BAR> |
include("$html/UploadPage.html"); |
|
<FORM ENCTYPE="multipart/form-data" METHOD="POST" |
|
|
ACTION="<?= $self ?>"> |
|
|
DESTINATION DIRECTORY:<B><?= " " . $relDir ?></B> |
|
|
<? if (isset($filename) && $filename!="") { ?> |
|
|
<br>DESTINATION FILE:<B><?= " " . $filename ?></B> |
|
|
<INPUT TYPE="HIDDEN" NAME="FILENAME" VALUE="<?= $filename ?>"> |
|
|
<? } ?> |
|
|
<P>PATHNAME OF LOCAL FILE<BR> |
|
|
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
|
|
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="UPLOAD"> |
|
|
<INPUT SIZE=30 TYPE="FILE" NAME="FN"></P> |
|
|
<P><INPUT TYPE="SUBMIT" VALUE="UPLOAD"></P> |
|
|
<P>If the <B>[BROWSE...]</B> button is not displayed,<BR> |
|
|
you must upgrade to an RFC1867-compliant browser.</P> |
|
|
<P>Your browser:<BR><?= $GLOBALS["HTTP_USER_AGENT"] ?></P> |
|
|
</FORM> |
|
|
</TD></TR> |
|
|
<TR><TD></TD><TD> |
|
|
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
|
|
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"><BR> |
|
|
<INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"> |
|
|
</FORM> |
|
|
</TD></TR></TABLE></P> |
|
898 |
|
|
|
<?php |
|
899 |
} // end function UploadPage |
} // end function UploadPage |
900 |
|
|
901 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
907 |
global $gblSeparateAdminMessages, |
global $gblSeparateAdminMessages, |
908 |
$gblMailAdminMessages,$realm, |
$gblMailAdminMessages,$realm, |
909 |
$HTTP_SERVER_VARS; |
$HTTP_SERVER_VARS; |
910 |
|
if (! headers_sent()) header("HTTP/1.0 404 Not Found"); |
911 |
if ($sysadmin) { |
if ($sysadmin) { |
912 |
if ($gblSeparateAdminMessages) { |
if ($gblSeparateAdminMessages) { |
913 |
$user="Your administrator "; |
$user="Your administrator "; |
1128 |
|
|
1129 |
function DisplayChangeLog($day) { |
function DisplayChangeLog($day) { |
1130 |
|
|
1131 |
global $gblFsRoot; |
global $gblFsRoot,$HTTP_SERVER_VARS; |
1132 |
|
|
1133 |
if (!file_exists("$gblFsRoot/.changelog")) return; |
if (!file_exists("$gblFsRoot/.changelog")) return; |
1134 |
$log=fopen("$gblFsRoot/.changelog","r"); |
$log=fopen("$gblFsRoot/.changelog","r"); |
1135 |
$logarr = array(); |
$logarr = array(); |
1151 |
$time = date("$GLOBALS[gblTimeFmt]", $e[0]); |
$time = date("$GLOBALS[gblTimeFmt]", $e[0]); |
1152 |
$dir = dirname($e[1]); |
$dir = dirname($e[1]); |
1153 |
$file = basename($e[1]); |
$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"; |
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"; |
1155 |
} |
} |
1156 |
print "</table>"; |
print "</table>"; |
1157 |
print "<p>".GifIcon(up)." Back to <a href=$GLOBALS[PHP_SELF]>front page</a>.</p>"; |
print "<p>".GifIcon(up)." Back to <a href=$HTTP_SERVER_VARS[PHP_SELF]>front page</a>.</p>"; |
1158 |
} |
} |
1159 |
|
|
1160 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1161 |
|
|
1162 |
function Download($path) { |
function Download($path,$force=0) { |
1163 |
global $HTTP_USER_AGENT; |
global $HTTP_SERVER_VARS,$mime_type; |
1164 |
$file=basename($path); |
|
1165 |
|
// default transfer-encoding |
1166 |
|
$encoding = "binary"; |
1167 |
|
|
1168 |
|
// known transfer encodings |
1169 |
|
$encoding_ext = array( |
1170 |
|
"gz" => "x-gzip", |
1171 |
|
"Z" => "x-compress", |
1172 |
|
); |
1173 |
|
|
1174 |
|
$file = basename($path); |
1175 |
$size = filesize($path); |
$size = filesize($path); |
1176 |
//header("Content-Type: application/octet-stream"); |
|
1177 |
header("Content-Type: application/force-download"); |
$ext_arr = explode(".",$file); |
1178 |
header("Content-Length: $size"); |
$ext = array_pop($ext_arr); |
1179 |
|
if ($encoding_ext[$ext]) { |
1180 |
|
$encoding = $encoding_ext[$ext]; |
1181 |
|
$ext = array_pop($ext_arr); |
1182 |
|
} |
1183 |
|
|
1184 |
|
if ($force || !isset($mime_type[$ext])) { |
1185 |
|
header("Content-Type: application/force-download"); |
1186 |
|
} else { |
1187 |
|
header("Content-Type: $mime_type[$ext]"); |
1188 |
|
} |
1189 |
|
|
1190 |
// IE5.5 just downloads index.php if we don't do this |
// IE5.5 just downloads index.php if we don't do this |
1191 |
if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT)) { |
if(preg_match("/MSIE 5.5/", $HTTP_SERVER_VARS[HTTP_USER_AGENT])) { |
1192 |
header("Content-Disposition: filename=$file"); |
header("Content-Disposition: filename=$file"); |
1193 |
} else { |
} else { |
1194 |
header("Content-Disposition: attachment; filename=$file"); |
header("Content-Disposition: attachment; filename=$file"); |
1195 |
} |
} |
1196 |
header("Content-Transfer-Encoding: binary"); |
|
1197 |
|
header("Content-Transfer-Encoding: $encoding"); |
1198 |
$fh = fopen($path, "r"); |
$fh = fopen($path, "r"); |
1199 |
fpassthru($fh); |
fpassthru($fh); |
1200 |
} |
} |
1441 |
return($return); |
return($return); |
1442 |
} |
} |
1443 |
|
|
1444 |
|
////////////////////////////////////////////////////////////////// |
1445 |
|
|
1446 |
|
function readMime() { |
1447 |
|
global $mime_type; |
1448 |
|
|
1449 |
|
if (! isset($gblMimeTypes)) { |
1450 |
|
$gblMimeTypes = "/etc/mime.types"; |
1451 |
|
} |
1452 |
|
|
1453 |
|
$mime = @fopen($gblMimeTypes,"r"); |
1454 |
|
|
1455 |
|
if (! $mime) Error("Can't read MIME types","<tt>$gblMimeTypes</tt> file not found. You can setup other <tt>mime.types</tt> file using <tt>\$gblMimeTypes</tt> in <tt>$realm_config</tt>"); |
1456 |
|
|
1457 |
|
while($line = fgets($mime,80)) { |
1458 |
|
if (substr($line,0,1) == "#") continue; // skip comment |
1459 |
|
$arr = preg_split("/[\s\t]+/",$line); |
1460 |
|
$type = array_shift($arr); |
1461 |
|
while ($ext = array_shift($arr)) { |
1462 |
|
$mime_type[$ext] = $type; |
1463 |
|
} |
1464 |
|
} |
1465 |
|
|
1466 |
|
fclose($mime); |
1467 |
|
} |
1468 |
|
|
1469 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1470 |
// MAIN PROGRAM |
// MAIN PROGRAM |
1548 |
header("WWW-authenticate: basic realm=\"$realm\"") ; |
header("WWW-authenticate: basic realm=\"$realm\"") ; |
1549 |
header("HTTP/1.0 401 Unauthorized") ; |
header("HTTP/1.0 401 Unauthorized") ; |
1550 |
Error("401 Unauthorized","No trespassing !"); |
Error("401 Unauthorized","No trespassing !"); |
|
exit ; |
|
1551 |
} |
} |
1552 |
|
|
1553 |
|
// read mime.types |
1554 |
|
readMime(); |
1555 |
|
|
1556 |
// get current directory relative to $gblFsRoot |
// get current directory relative to $gblFsRoot |
1557 |
$relDir = $DIR ; // from POST |
$relDir = $DIR ; // from POST |
1558 |
if ($relDir == "") { // not defined in POST ? |
if ($relDir == "") { // not defined in POST ? |
1581 |
$fsDir = $gblFsRoot . $relDir ; // current directory |
$fsDir = $gblFsRoot . $relDir ; // current directory |
1582 |
if ( !is_dir($fsDir) ) Error("Dir not found",$relDir) ; |
if ( !is_dir($fsDir) ) Error("Dir not found",$relDir) ; |
1583 |
|
|
1584 |
if (isset($GLOBALS["HTTPS"]) && $GLOBALS["HTTPS"] == "on") { |
if (isset($HTTP_SERVER_VARS["HTTPS"]) && $HTTP_SERVER_VARS["HTTPS"] == "on") { |
1585 |
$webRoot = "https://"; |
$webRoot = "https://"; |
1586 |
} else { |
} else { |
1587 |
$webRoot = "http://"; |
$webRoot = "http://"; |
1588 |
} |
} |
1589 |
$webRoot .= $GLOBALS["HTTP_HOST"] . $relScriptDir; |
$webRoot .= $HTTP_SERVER_VARS["HTTP_HOST"] . $relScriptDir; |
1590 |
|
|
1591 |
$FN=stripSlashes($FN); |
// take variables from server |
1592 |
|
$FN=stripSlashes($HTTP_POST_VARS["FN"]); |
1593 |
|
$DIR=stripSlashes($HTTP_POST_VARS["DIR"]); |
1594 |
|
$RELPATH=stripSlashes($HTTP_POST_VARS["RELPATH"]); |
1595 |
|
$T=stripSlashes($HTTP_POST_VARS["T"]); |
1596 |
|
$CONFIRM=stripSlashes($HTTP_POST_VARS["CONFIRM"]); |
1597 |
|
|
1598 |
|
// get |
1599 |
|
$A=stripSlashes($HTTP_GET_VARS["A"]); |
1600 |
|
$D=stripSlashes($HTTP_GET_VARS["D"]); |
1601 |
|
|
1602 |
|
// if (isset($F)) Error("Document manager system error","variable $F shouldn't be set here (re-check old code)",1); |
1603 |
|
// $F=stripSlashes($HTTP_SERVER_VARS["PATH_INFO"]); |
1604 |
|
$F=stripSlashes($HTTP_GET_VARS["F"]); |
1605 |
|
|
1606 |
switch ($POSTACTION) { |
switch ($HTTP_POST_VARS["POSTACTION"]) { |
1607 |
case "UPLOAD" : |
case "UPLOAD" : |
1608 |
|
$FN_name=stripSlashes($HTTP_POST_FILES["FN"]["tmp_name"]); |
1609 |
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ; |
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ; |
1610 |
if (strstr($FN_name,"/")) |
if (strstr($FN_name,"/")) |
1611 |
Error("Non-conforming filename") ; |
Error("Non-conforming filename") ; |
1612 |
// TODO : should rather check for escapeshellcmds |
// TODO : should rather check for escapeshellcmds |
1613 |
// but maybe RFC 18xx asserts safe filenames .... |
// but maybe RFC 18xx asserts safe filenames .... |
1614 |
$source = $FN ; |
$source = $FN_name ; |
1615 |
if (! file_exists($source)) { |
if (! file_exists($source)) { |
1616 |
Error("You must select file with browse to upload it!"); |
Error("You must select file with browse to upload it!"); |
1617 |
} |
} |
1618 |
|
$FILENAME = $HTTP_POST_VARS["FILENAME"]; |
1619 |
if (! isset($FILENAME)) { // from update file |
if (! isset($FILENAME)) { // from update file |
1620 |
$target = "$fsDir/$FN_name" ; |
$target = "$fsDir/$FN_name" ; |
1621 |
} else { |
} else { |
1715 |
|
|
1716 |
// if ( ! @unlink($path) ) { |
// if ( ! @unlink($path) ) { |
1717 |
if ( ! rename($path,"$dir/.del/$file") ) { |
if ( ! rename($path,"$dir/.del/$file") ) { |
|
Error("File delete failed", $tstr . $path) ; |
|
1718 |
LogIt($path,"file delete failed"); |
LogIt($path,"file delete failed"); |
1719 |
exit ; |
Error("File delete failed", $tstr . $path) ; |
1720 |
} else { |
} else { |
1721 |
LogIt($path,"file deleted",trperm_w); |
LogIt($path,"file deleted",trperm_w); |
1722 |
MoveTo("$dir/.log/$file","$dir/.del/.log/"); |
MoveTo("$dir/.log/$file","$dir/.del/.log/"); |
1790 |
if (!is_writeable($gblFsRoot . $relDir)) |
if (!is_writeable($gblFsRoot . $relDir)) |
1791 |
Error("Write access denied",$relDir) ; |
Error("Write access denied",$relDir) ; |
1792 |
$text = "Use this page to upload a single " ; |
$text = "Use this page to upload a single " ; |
1793 |
$text .= "file to <B>$HTTP_HOST</B>." ; |
$text .= "file to <B>$realm</B>." ; |
1794 |
StartHTML("(Upload Page)", $text) ; |
StartHTML("(Upload Page)", $text) ; |
1795 |
UploadPage($gblFsRoot, $relDir) ; |
UploadPage($gblFsRoot, $relDir) ; |
1796 |
EndHTML() ; |
EndHTML() ; |
1797 |
exit ; |
exit ; |
1798 |
case "E" : |
case "E" : |
|
$F=stripSlashes($F); |
|
1799 |
// detail of $relDir/$F |
// detail of $relDir/$F |
1800 |
if (is_file("$gblFsRoot/$relDir/$F") || is_dir("$gblFsRoot/$relDir/$F")) DetailPage($gblFsRoot, $relDir, $F) ; |
if (is_file("$gblFsRoot/$relDir/$F") || is_dir("$gblFsRoot/$relDir/$F")) DetailPage($gblFsRoot, $relDir, $F) ; |
1801 |
exit ; |
exit ; |
1807 |
case "Co" : |
case "Co" : |
1808 |
// checkout |
// checkout |
1809 |
Lock("$gblFsRoot/$relDir/$F"); |
Lock("$gblFsRoot/$relDir/$F"); |
1810 |
Download("$gblFsRoot/$relDir/$F"); |
Download("$gblFsRoot/$relDir/$F",1); |
1811 |
exit; |
exit; |
1812 |
case "Ci" : |
case "Ci" : |
1813 |
$F=stripSlashes($F); |
$F=stripSlashes($F); |
1815 |
if (!is_writeable($gblFsRoot . $relDir)) |
if (!is_writeable($gblFsRoot . $relDir)) |
1816 |
Error("Write access denied",$relDir) ; |
Error("Write access denied",$relDir) ; |
1817 |
$text = "Use this page to update a single " ; |
$text = "Use this page to update a single " ; |
1818 |
$text .= "file to <B>$HTTP_HOST</B>." ; |
$text .= "file to <B>$realm</B>." ; |
1819 |
StartHTML("(Update file Page)", $text) ; |
StartHTML("(Update file Page)", $text) ; |
1820 |
UploadPage($gblFsRoot, $relDir, $F) ; |
UploadPage($gblFsRoot, $relDir, $F) ; |
1821 |
EndHTML() ; |
EndHTML() ; |
1823 |
case "V" : |
case "V" : |
1824 |
// view |
// view |
1825 |
LogIt("$gblFsRoot/$relDir/$F","viewed"); |
LogIt("$gblFsRoot/$relDir/$F","viewed"); |
1826 |
if ($gblForceDownload) { |
Download("$gblFsRoot/$relDir/$F",$gblForceDownload); |
|
Download("$gblFsRoot/$relDir/$F"); |
|
|
} else { |
|
|
header("Content-Disposition: attachment; filename=$F" ); |
|
|
Header("Location: $webRoot".urlpath("$relDir/$F")); |
|
|
} |
|
1827 |
exit; |
exit; |
1828 |
case "Ch" : |
case "Ch" : |
1829 |
StartHTML("(File changes)","All changes chronologicaly..."); |
StartHTML("(File changes)","All changes chronologicaly..."); |
1845 |
$title = "You should define \$title variable with page title"; |
$title = "You should define \$title variable with page title"; |
1846 |
include($inc_file); |
include($inc_file); |
1847 |
StartHTML($title, $text) ; |
StartHTML($title, $text) ; |
1848 |
print "<p>".GifIcon(up)." Back to <a href=$GLOBALS[PHP_SELF]>front page</a>.</p>"; |
print "<p>".GifIcon(up)." Back to <a href=$HTTP_SERVER_VARS[PHP_SELF]>front page</a>.</p>"; |
1849 |
EndHTML() ; |
EndHTML() ; |
1850 |
exit ; |
exit ; |
1851 |
} |
} |