118 |
if (file_exists("$fsDocumentRoot/docman.css")) { |
if (file_exists("$fsDocumentRoot/docman.css")) { |
119 |
$css=dirname($self)."/docman.css"; |
$css=dirname($self)."/docman.css"; |
120 |
} else { |
} else { |
121 |
$css=$self."?STYLE=get&css=$css"; |
$css=$self."?STYLE=get"; |
122 |
} |
} |
123 |
|
|
124 |
include("$html/head.html"); |
include("$html/head.html"); |
571 |
function Navigate($fsRoot,$relDir) { |
function Navigate($fsRoot,$relDir) { |
572 |
|
|
573 |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
574 |
$gblIgnoreUnknownFileType, |
$gblIgnoreUnknownFileType, $gblRepositoryDir, |
575 |
|
$fsRealmDir, $realm, $realm_sep, |
576 |
$HTTP_GET_VARS, $html, $realm_config; |
$HTTP_GET_VARS, $html, $realm_config; |
577 |
|
|
578 |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
860 |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
861 |
|
|
862 |
<? |
<? |
863 |
if (file_exists(".info.inc")) { |
|
864 |
|
if (file_exists("$fsRealmDir/$realm".$realm_sep."info.inc")) { |
865 |
|
print "<TR><TD></TD><TD COLSPAN=5>"; |
866 |
|
include("$fsRealmDir/$realm".$realm_sep."info.inc"); |
867 |
|
print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
868 |
|
} elseif (file_exists("$gblRepositoryDir/.info.inc")) { |
869 |
print "<TR><TD></TD><TD COLSPAN=5>"; |
print "<TR><TD></TD><TD COLSPAN=5>"; |
870 |
include(".info.inc"); |
include("$gblRepositoryDir/.info.inc"); |
871 |
print "</TD></TR> |
print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
|
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
|
872 |
} |
} |
873 |
|
|
874 |
|
|
875 |
?> |
?> |
876 |
|
|
877 |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
910 |
// Error with sysadmin flag are reported to error_log or hidden from |
// Error with sysadmin flag are reported to error_log or hidden from |
911 |
// users |
// users |
912 |
|
|
913 |
function Error($title,$text="",$sysadmin=0) { |
function Error($title,$text="",$sysadmin=0,$no_404=0) { |
914 |
global $gblSeparateAdminMessages, |
global $gblSeparateAdminMessages, |
915 |
$gblMailAdminMessages,$realm, |
$gblMailAdminMessages,$realm, |
916 |
$HTTP_SERVER_VARS; |
$HTTP_SERVER_VARS; |
917 |
if (! headers_sent()) header("HTTP/1.0 404 Not Found"); |
if (! headers_sent() && ! $no_404) header("HTTP/1.0 404 Not Found"); |
918 |
if ($sysadmin) { |
if ($sysadmin) { |
919 |
if ($gblSeparateAdminMessages) { |
if ($gblSeparateAdminMessages) { |
920 |
$user="Your administrator "; |
$user="Your administrator "; |
1083 |
function try_rename($from,$to) { |
function try_rename($from,$to) { |
1084 |
# print "$from -> $to\n"; |
# print "$from -> $to\n"; |
1085 |
if (file_exists($from) && is_writeable(dirname($to))) { |
if (file_exists($from) && is_writeable(dirname($to))) { |
1086 |
rename($from,$to); |
return rename($from,$to); |
1087 |
|
} else { |
1088 |
|
return 0; |
1089 |
} |
} |
1090 |
} |
} |
1091 |
|
|
1092 |
function try_dir($todir) { |
function try_dir($todir) { |
1093 |
if (! file_exists($todir)) { |
if (! file_exists($todir)) { |
1094 |
mkdir($todir,0700); |
@mkdir($todir,0700); |
1095 |
} |
} |
1096 |
} |
} |
1097 |
|
|
1101 |
|
|
1102 |
# print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n"; |
# print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n"; |
1103 |
|
|
1104 |
try_rename("$fromdir/$fromfile","$todir/$tofile"); |
if (! try_rename("$fromdir/$fromfile","$todir/$tofile")) Error("Rename error","Can't rename file <tt>$fromfile</tt> to <tt>$tofile</tt>",1); |
1105 |
try_dir("$todir/.log"); |
try_dir("$todir/.log"); |
1106 |
try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile"); |
try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile"); |
1107 |
try_dir("$todir/.note"); |
try_dir("$todir/.note"); |
1481 |
$gblFilePerms = 0640 ; // default for new files |
$gblFilePerms = 0640 ; // default for new files |
1482 |
$gblDirPerms = 0750 ; // default for new dirs |
$gblDirPerms = 0750 ; // default for new dirs |
1483 |
|
|
1484 |
|
$STYLE = $HTTP_GET_VARS[STYLE]; |
1485 |
if (isset($STYLE) && $STYLE == "get") { |
if (isset($STYLE) && $STYLE == "get") { |
1486 |
include("$html/docman.css"); |
include("$html/docman.css"); |
1487 |
exit; |
exit; |
1500 |
if (! isset($fsRealmDir)) { |
if (! isset($fsRealmDir)) { |
1501 |
$fsRealmDir = "$gblIncDir/realm"; |
$fsRealmDir = "$gblIncDir/realm"; |
1502 |
} |
} |
1503 |
$realm_config = "$fsRealmDir/$realm.conf"; |
|
1504 |
|
// try to add dir to script name to realm var |
1505 |
|
if (is_dir("$fsRealmDir/$realm/".dirname($HTTP_SERVER_VARS[SCRIPT_NAME]))) { |
1506 |
|
$realm .= "/".dirname($HTTP_SERVER_VARS[SCRIPT_NAME]); |
1507 |
|
$realm_sep = "/"; |
1508 |
|
} else { |
1509 |
|
$realm_sep = "."; |
1510 |
|
} |
1511 |
|
|
1512 |
|
$realm_config = $fsRealmDir."/".$realm.$realm_sep."conf"; |
1513 |
|
|
1514 |
// read user-defined configuration |
// read user-defined configuration |
1515 |
if (file_exists($realm_config)) { |
if (file_exists($realm_config)) { |
1545 |
if (!is_dir($gblRepositoryDir)) Error("Repository dir not found","Can't find repository directory <tt>$gblRepositoryDir</tt>. Please fix that in <tt>$realm_config</tt> variable <tt>\$gblRepositoryDir</tt>.",1); |
if (!is_dir($gblRepositoryDir)) Error("Repository dir not found","Can't find repository directory <tt>$gblRepositoryDir</tt>. Please fix that in <tt>$realm_config</tt> variable <tt>\$gblRepositoryDir</tt>.",1); |
1546 |
|
|
1547 |
// trustee (ACL) file configuration |
// trustee (ACL) file configuration |
1548 |
$trustee_conf="$gblIncDir/realm/$realm.trustee"; |
$trustee_conf="$fsRealmDir/$realm".$realm_sep."trustee"; |
1549 |
// compiled version of trustee file |
// compiled version of trustee file |
1550 |
$trustee_php="$gblRepositoryDir/.trustee.php"; |
$trustee_php="$gblRepositoryDir/.trustee.php"; |
1551 |
// get ACL informations |
// get ACL informations |
1566 |
isset($relogin) && $secHash == $relogin) { |
isset($relogin) && $secHash == $relogin) { |
1567 |
header("WWW-authenticate: basic realm=\"$realm\"") ; |
header("WWW-authenticate: basic realm=\"$realm\"") ; |
1568 |
header("HTTP/1.0 401 Unauthorized") ; |
header("HTTP/1.0 401 Unauthorized") ; |
1569 |
Error("401 Unauthorized","No trespassing !"); |
Error("401 Unauthorized","No trespassing !",0,1); |
1570 |
} |
} |
1571 |
|
|
1572 |
// read mime.types |
// read mime.types |
1637 |
if (strstr($FILENAME,"/")) |
if (strstr($FILENAME,"/")) |
1638 |
Error("Upload error","Non-conforming filename. Filename <tt>$FILENAME</tt> has slashes (<tt>/</tt>) in it.") ; |
Error("Upload error","Non-conforming filename. Filename <tt>$FILENAME</tt> has slashes (<tt>/</tt>) in it.") ; |
1639 |
if (! isset($FILENAME)) { // from update file |
if (! isset($FILENAME)) { // from update file |
1640 |
$target = "$fsDir/".basename($FN_name); |
$target = "$fsDir/".basename($FN); |
1641 |
} else { |
} else { |
1642 |
$target = "$fsDir/$FILENAME"; |
$target = "$fsDir/$FILENAME"; |
1643 |
} |
} |
1770 |
case "RENAME" : |
case "RENAME" : |
1771 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1772 |
|
|
1773 |
|
$NEWNAME=stripSlashes($HTTP_POST_VARS["NEWNAME"]); |
1774 |
LogIt("$fsDir/$FN","renamed $FN to $NEWNAME",trperm_r); |
LogIt("$fsDir/$FN","renamed $FN to $NEWNAME",trperm_r); |
1775 |
safe_rename($fsDir,$FN,$NEWNAME); |
safe_rename($fsDir,$FN,$NEWNAME); |
1776 |
break ; |
break ; |
1777 |
|
|
1778 |
case "NOTE" : |
case "NOTE" : |
1779 |
|
$NOTE=stripSlashes($HTTP_POST_VARS["NOTE"]); |
1780 |
WriteNote("$fsDir/$FN","$NOTE"); |
WriteNote("$fsDir/$FN","$NOTE"); |
1781 |
break ; |
break ; |
1782 |
|
|