20 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
21 |
// CONFIGURATION OPTIONS |
// CONFIGURATION OPTIONS |
22 |
|
|
23 |
// error_reporting(4) ; // how verbose ? |
error_reporting(E_ALL) ; // how verbose ? |
24 |
|
|
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>"); |
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,$gblTitle,$HTTP_SERVER_VARS; |
113 |
|
|
114 |
$title = $gblTitle." ".$title ; |
$host = $HTTP_SERVER_VARS["HTTP_HOST"] ; |
115 |
$host = $GLOBALS["HTTP_HOST"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
|
$self = $GLOBALS["PHP_SELF"] ; |
|
116 |
|
|
117 |
if (file_exists("$fsDocumentRoot/docman.css")) { |
if (file_exists("$fsDocumentRoot/docman.css")) { |
118 |
$css=dirname($self)."/docman.css"; |
$css=dirname($self)."/docman.css"; |
119 |
} else { |
} else { |
120 |
$css=$self."?STYLE=get&css=$css"; |
$css=$self."?STYLE=get"; |
121 |
} |
} |
122 |
|
|
123 |
include("$html/head.html"); |
include("$html/head.html"); |
137 |
} else { |
} else { |
138 |
$url .= md5($gblLogin.$gblPasswd); |
$url .= md5($gblLogin.$gblPasswd); |
139 |
} |
} |
140 |
if (isset($gblLogin) && $gblLogin != "" && ($gblPasswd == "" || !isset($gblPasswd))) { |
if ( ( (isset($gblLogin) && $gblLogin != "") || |
141 |
|
(!isset($gblLogin) || $gblLogin == "") |
142 |
|
) && ($gblPasswd == "" || !isset($gblPasswd))) { |
143 |
$url_title="login"; |
$url_title="login"; |
144 |
$url .= "&force_login=1"; |
$url .= "&force_login=1"; |
145 |
} else { |
} else { |
146 |
$url_title="relogin"; |
$url_title="relogin"; |
147 |
} |
} |
148 |
include("$html/footer.html"); |
include("$html/footer.html"); |
149 |
//phpinfo(); |
|
150 |
|
global $debug; |
151 |
|
if ($debug) print $debug; |
152 |
} // end function EndHTML |
} // end function EndHTML |
153 |
|
|
154 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
155 |
|
|
156 |
function DetailPage($fsRoot,$relDir,$fn) { |
function DetailPage($fsRoot,$relDir,$fn) { |
157 |
|
|
158 |
global $gblEditable, $gblImages, $webRoot, $html ; |
global $gblEditable, $gblImages, $webRoot, $html, $HTTP_SERVER_VARS ; |
159 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
160 |
|
|
161 |
$relPath = $relDir . "/" . $fn ; |
$relPath = $relDir . "/" . $fn ; |
162 |
$fsPath = $fsRoot . $relPath ; |
$fsPath = $fsRoot . $relPath ; |
164 |
|
|
165 |
$exists = file_exists($fsPath) ; |
$exists = file_exists($fsPath) ; |
166 |
$ext = strtolower(strrchr($relPath,".")) ; |
$ext = strtolower(strrchr($relPath,".")) ; |
167 |
$editable = ( $ext=="" || strstr(join(" ",$gblEditable),$ext)) ; |
$editable = ( $ext=="" || strstr(join(" ",$gblEditable),$ext)) && |
168 |
$writable = is_writeable($fsPath) ; |
check_perm($relPath,trperm_w); |
169 |
|
$writable = is_writeable($fsPath) && check_perm($relPath,trperm_w) ; |
170 |
|
$writable_dir = is_writeable($fsDir) && check_perm($relDir,trperm_w) ; |
171 |
$file_lock = CheckLock($fsPath); |
$file_lock = CheckLock($fsPath); |
172 |
|
|
173 |
if (!$editable && !$exists) |
if (!$editable && !$exists) |
174 |
Error(_("Creation unsupported for type"),$relPath) ; |
Error("Creation denied","Can't create <tt>$relPath</tt>") ; |
175 |
if (!exists && !is_writeable($fsDir) ) |
if (!$exists && !$writable_dir ) |
176 |
Error(_("Creation denied"),$relDir) ; |
Error("Creation denied","Can't write in directory <tt>$relDir</tt> while creating <tt>$relPath</tt>for which user has permissions.",1); |
177 |
|
|
178 |
$text = _("Use this page to view, modify or ") ; |
$text = _("Use this page to view, modify or ") ; |
179 |
if (is_dir($fsPath)) { |
if (is_dir($fsPath)) { |
206 |
$fstr = htmlentities( $fstr ) ; |
$fstr = htmlentities( $fstr ) ; |
207 |
?> |
?> |
208 |
|
|
209 |
<FORM ACTION="<?= $self ; ?>" METHOD="POST"> |
<FORM ACTION="<?= $self ?>" METHOD="POST"> |
210 |
<SPAN TITLE="Click [SAVE] to store updated contents."> |
<SPAN TITLE="Click [SAVE] to store updated contents."> |
211 |
<B>DOCUMENT CONTENTS</B> |
<B>DOCUMENT CONTENTS</B> |
212 |
</SPAN><BR> |
</SPAN><BR> |
577 |
function Navigate($fsRoot,$relDir) { |
function Navigate($fsRoot,$relDir) { |
578 |
|
|
579 |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide, |
580 |
$HTTP_GET_VARS, $html; |
$gblIgnoreUnknownFileType, $gblRepositoryDir, |
581 |
|
$gblLogin, |
582 |
|
$fsRealmDir, $realm, $realm_sep, |
583 |
|
$html, $realm_config, |
584 |
|
$HTTP_GET_VARS, $HTTP_SERVER_VARS; |
585 |
|
|
586 |
|
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
587 |
|
|
588 |
$self = $GLOBALS["PHP_SELF"] ; |
$relDir = chopsl($relDir)."/"; |
589 |
|
$fsDir = $fsRoot.$relDir; // current directory |
590 |
|
|
591 |
if ($relDir == "") $relDir = "/"; |
if (!is_dir($fsDir)) Error("Dir not found","Directory <tt>$relDir<tt> not found on filesystem at <tt>$fsDir</tt>",1) ; |
592 |
|
|
593 |
$fsDir = $fsRoot.$relDir."/"; // current directory |
global $debug; |
594 |
|
$debug .= "[$gblLogin|$relDir] before >"; |
595 |
|
|
596 |
if (!is_dir($fsDir)) Error("Dir not found",$relDir) ; |
if (! check_perm($relDir,trperm_b)) |
597 |
|
Error("Access denied","User <tt>$gblLogin</tt> tried to access <tt>$relDir</tt> without valid trustee.",1); |
598 |
|
$debug .= "< afeter"; |
599 |
|
|
600 |
$hide_items=",$gblHide,"; |
$hide_items=",$gblHide,"; |
601 |
|
|
602 |
#display_all_trustee(); |
$dirList = array(); |
603 |
print "-- $fsDir --"; |
$fileList = array(); |
604 |
|
|
605 |
// read directory contents |
// read directory contents |
606 |
if ( !($dir = @opendir($fsDir)) ) |
if ( !($dir = @opendir($fsDir)) ) |
607 |
Error("Read Access denied",$relDir) ; |
Error("Read Access denied",$relDir,1) ; |
608 |
while ($item = readdir($dir)) { |
while ($item = readdir($dir)) { |
|
print "$item, "; |
|
609 |
if ( substr($item,0,1) == "." || strstr($hide_items,",$item,") ) continue ; |
if ( substr($item,0,1) == "." || strstr($hide_items,",$item,") ) continue ; |
610 |
if ((is_dir($fsDir.$item) || is_link ($fsDir.$item)) && check_perm($relDir.$item,trperm_b)) { |
if (is_dir($fsDir.$item) || is_link ($fsDir.$item)) { |
611 |
$dirList[$item] = $item ; |
if (check_perm($relDir.$item,trperm_b)) { |
612 |
$dirNote[$item] = ReadNote($fsDir.$item); |
$dirList[$item] = $item ; |
613 |
} else if ( is_file($fsDir.$item) && check_perm($relDir.$item,trperm_r) ) { |
$dirNote[$item] = ReadNote($fsDir.$item); |
614 |
$fileList[$item] = $item ; |
} |
615 |
$fileDate[$item] = filemtime($fsDir.$item) ; |
} else if (is_file($fsDir.$item)) { |
616 |
$fileSize[$item] = filesize($fsDir.$item) ; |
if (check_perm($relDir.$item,trperm_r)) { |
617 |
$fileNote[$item] = ReadNote($fsDir.$item); |
$fileList[$item] = $item ; |
618 |
|
$fileDate[$item] = filemtime($fsDir.$item) ; |
619 |
|
$fileSize[$item] = filesize($fsDir.$item) ; |
620 |
|
$fileNote[$item] = ReadNote($fsDir.$item); |
621 |
|
} |
622 |
} else { |
} else { |
623 |
// 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 ; |
|
624 |
} |
} |
625 |
} |
} |
626 |
closedir($dir) ; |
closedir($dir) ; |
627 |
|
|
628 |
// scan deleted files |
// scan deleted files |
629 |
if ( $GLOBALS[show_deleted] == 1 && ($dir = @opendir("$fsDir/.del")) ) { |
if ( HTTP_GET_VAR("show_deleted") == 1 && ($dir = @opendir("$fsDir/.del")) ) { |
630 |
while ($item = readdir($dir)) { |
while ($item = readdir($dir)) { |
631 |
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 ; |
632 |
$fileList[$item] = ".del/$item" ; |
$fileList[$item] = ".del/$item" ; |
641 |
|
|
642 |
// start navigation page |
// start navigation page |
643 |
$text = "Use this page to add, delete"; |
$text = "Use this page to add, delete"; |
644 |
if (! isset($show_deleted)) { |
if (! isset($HTTP_GET_VARS["show_deleted"])) { |
645 |
$text .= ", <a href=$self?D=".urlencode($relDir)."&show_deleted=1>undelete</a>"; |
$text .= ", <a href=$self?D=".urlencode($relDir)."&show_deleted=1>undelete</a>"; |
646 |
} |
} |
647 |
$text .= " or revise files on this web site." ; |
$text .= " or revise files on this web site." ; |
651 |
echo "<TABLE BORDER=0 CELLPADDING=2 |
echo "<TABLE BORDER=0 CELLPADDING=2 |
652 |
CELLSPACING=3 WIDTH=\"100%\">" ; |
CELLSPACING=3 WIDTH=\"100%\">" ; |
653 |
|
|
654 |
// updir bar |
// updir (parent) bar |
655 |
if (chopsl($fsDir) != chopsl($fsRoot)) { |
if (chopsl($fsDir) != chopsl($fsRoot)) { |
656 |
$parent = dirname($relDir) ; |
$parent = dirname($relDir) ; |
657 |
if ($parent == "") $parent = "/" ; |
if ($parent == "") $parent = "/" ; |
667 |
return $out; |
return $out; |
668 |
} |
} |
669 |
|
|
670 |
$dsort = $HTTP_GET_VARS[dsort]; |
if (! HTTP_GET_VAR("dsort")) $dsort = "name"; // default directory sort |
|
if (! isset($dsort)) $dsort = "name"; // default directory sort |
|
671 |
|
|
672 |
$dsort_arr = array( |
$dsort_arr = array( |
673 |
"name" => array ("rname", "note"), |
"name" => array ("rname", "note"), |
676 |
"rnote" => array ("name", "note") |
"rnote" => array ("name", "note") |
677 |
); |
); |
678 |
|
|
679 |
$fsort = $HTTP_GET_VARS[fsort]; |
if (! HTTP_GET_VAR("fsort")) $fsort = "name"; // default directory sort |
|
if (! isset($fsort)) $fsort = "name"; // default directory sort |
|
680 |
|
|
681 |
$fsort_arr = array( |
$fsort_arr = array( |
682 |
"name" => array ("rname", "note", "date", "size"), |
"name" => array ("rname", "note", "date", "size"), |
692 |
$D="D=".urlencode($relDir); |
$D="D=".urlencode($relDir); |
693 |
|
|
694 |
function self_args($arr = array()) { |
function self_args($arr = array()) { |
695 |
|
global $self; |
696 |
$arg = implode("&",$arr); |
$arg = implode("&",$arr); |
697 |
if ($arg) { |
if ($arg) { |
698 |
return $self."?".$arg; |
return $self."?".$arg; |
729 |
|
|
730 |
$dir = $dirList[$key]; |
$dir = $dirList[$key]; |
731 |
|
|
732 |
$info_url=self_args(array("A" => "A=E", "F" => "F=".urlencode($dir))); |
$info_url=self_args(array("A"=>"A=E", "F"=>"F=".urlencode($dir), "D"=>$D)); |
733 |
$dir_url=$self."?D=".urlencode($relDir.$dir); |
$dir_url=$self."?D=".urlencode(chopsl($relDir)."/".$dir); |
734 |
include("$html/Navigate-dirEntry.html"); |
include("$html/Navigate-dirEntry.html"); |
735 |
|
|
736 |
} // iterate over dirs |
} // iterate over dirs |
802 |
|
|
803 |
$file_lock=CheckLock($path); |
$file_lock=CheckLock($path); |
804 |
|
|
805 |
$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); |
|
806 |
$file_url_html.="\" TITLE=\"View file\">" ; |
$file_url_html.="\" TITLE=\"View file\">" ; |
807 |
|
|
808 |
if (substr($file,0,5) != ".del/") { |
if (substr($file,0,5) != ".del/") { |
817 |
|
|
818 |
if ($file_lock) { |
if ($file_lock) { |
819 |
if ($file_lock == $GLOBALS[gblUserName]) { |
if ($file_lock == $GLOBALS[gblUserName]) { |
820 |
$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); |
|
821 |
$b.="\" TITLE=\"Checkin (update) file on server\">" ; |
$b.="\" TITLE=\"Checkin (update) file on server\">" ; |
822 |
$file_url_html=$b; |
$file_url_html=$b; |
823 |
$b.=$gblIcon("checkin")."</A>" ; |
$b.=$gblIcon("checkin")."</A>" ; |
831 |
$file_url_html = "$file $a"; |
$file_url_html = "$file $a"; |
832 |
} |
} |
833 |
} else { |
} else { |
834 |
$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); |
|
835 |
$b.="\" TITLE=\"Checkout file for edit\">" ; |
$b.="\" TITLE=\"Checkout file for edit\">" ; |
836 |
$b.=$gblIcon("checkout")."</A>" ; |
$b.=$gblIcon("checkout")."</A>"; |
837 |
|
|
838 |
if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) { |
if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) { |
839 |
$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); |
|
840 |
$b.="\" TITLE=\"List contents\">" ; |
$b.="\" TITLE=\"List contents\">" ; |
841 |
$b.=$gblIcon("view")."</A>" ; |
$b.=$gblIcon("view")."</A>" ; |
842 |
} else { |
} else { |
876 |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
877 |
|
|
878 |
<? |
<? |
879 |
if (file_exists(".info.inc")) { |
|
880 |
|
if (file_exists("$fsRealmDir/$realm".$realm_sep."info.inc")) { |
881 |
|
print "<TR><TD></TD><TD COLSPAN=5>"; |
882 |
|
include("$fsRealmDir/$realm".$realm_sep."info.inc"); |
883 |
|
print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
884 |
|
} elseif (file_exists("$gblRepositoryDir/.info.inc")) { |
885 |
print "<TR><TD></TD><TD COLSPAN=5>"; |
print "<TR><TD></TD><TD COLSPAN=5>"; |
886 |
include(".info.inc"); |
include("$gblRepositoryDir/.info.inc"); |
887 |
print "</TD></TR> |
print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
|
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR>"; |
|
888 |
} |
} |
889 |
|
|
890 |
|
|
891 |
?> |
?> |
892 |
|
|
893 |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
912 |
|
|
913 |
function UploadPage($fsRoot, $relDir, $filename="") { |
function UploadPage($fsRoot, $relDir, $filename="") { |
914 |
|
|
915 |
$self = $GLOBALS["PHP_SELF"] ; |
global $html, $HTTP_SERVER_VARS; |
|
if ($relDir == "") $relDir = "/" ; |
|
|
?> |
|
916 |
|
|
917 |
<P><TABLE BORDER=0 CELLPADDING=5><TR><TD WIDTH=5></TD><TD CLASS=BAR> |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
918 |
<FORM ENCTYPE="multipart/form-data" METHOD="POST" |
include("$html/UploadPage.html"); |
|
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> |
|
919 |
|
|
|
<?php |
|
920 |
} // end function UploadPage |
} // end function UploadPage |
921 |
|
|
922 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
923 |
|
|
924 |
function Error($title,$text="") { |
// Error with sysadmin flag are reported to error_log or hidden from |
925 |
StartHTML("(".$title.")",$text) ; |
// users |
926 |
echo "<P ALIGN=center>Hit your Browser's Back Button.</P>" ; |
|
927 |
EndHTML() ; |
function Error($title,$text="",$sysadmin=0,$no_404=0) { |
928 |
|
global $gblSeparateAdminMessages, |
929 |
|
$gblMailAdminMessages,$realm, |
930 |
|
$HTTP_SERVER_VARS; |
931 |
|
if (! headers_sent() && ! $no_404) header("HTTP/1.0 404 Not Found"); |
932 |
|
if ($sysadmin) { |
933 |
|
if ($gblSeparateAdminMessages) { |
934 |
|
$user="Your administrator "; |
935 |
|
if ($gblMailAdminMessages) { |
936 |
|
mail($HTTP_SERVER_VARS["SERVER_ADMIN"], "docman $realm error message: $title", strip_tags($text)); |
937 |
|
$user.="<tt>".$HTTP_SERVER_VARS["SERVER_ADMIN"]."</tt> "; |
938 |
|
} |
939 |
|
$user.="has been notified about error" ; |
940 |
|
StartHTML("($title)",$user); |
941 |
|
echo "<P ALIGN=center>Hit your Browser's Back Button.</P>" ; |
942 |
|
EndHTML(); |
943 |
|
error_log("docman $realm: ".strip_tags($text)); |
944 |
|
} else { |
945 |
|
StartHTML("ADMIN: ".$title,$text) ; |
946 |
|
echo "<P ALIGN=center>Hit your Browser's Back Button.</P>" ; |
947 |
|
EndHTML(); |
948 |
|
} |
949 |
|
} else { |
950 |
|
StartHTML("(".$title.")",$text) ; |
951 |
|
echo "<P ALIGN=center>Hit your Browser's Back Button.</P>" ; |
952 |
|
EndHTML() ; |
953 |
|
} |
954 |
exit ; |
exit ; |
955 |
} // end function Error |
} // end function Error |
956 |
|
|
957 |
////////////////////////////////////////////////////////////////// |
function LogIt($target,$msg, $changelog=0) { |
|
|
|
|
function LogIt($target,$msg) { |
|
958 |
|
|
959 |
$dir=dirname($target); |
$dir=dirname($target); |
960 |
if (! file_exists($dir."/.log")) { |
if (! file_exists($dir."/.log")) { |
961 |
if (! @mkdir($dir."/.log",0700)) Error("docman installation problem","can't create log directory <tt>$dir/.log</tt>"); |
if (! @mkdir($dir."/.log",0700)) Error("docman installation problem","can't create log directory <tt>$dir/.log</tt>",1); |
962 |
} |
} |
963 |
$file=basename($target); |
$file=basename($target); |
964 |
|
|
967 |
"\t$GLOBALS[gblUserName]\t$msg\n"); |
"\t$GLOBALS[gblUserName]\t$msg\n"); |
968 |
fclose($log); |
fclose($log); |
969 |
|
|
970 |
|
if (! $changelog) return; |
971 |
|
|
972 |
|
global $gblFsRoot; |
973 |
|
$log=fopen("$gblFsRoot/.changelog","a+"); |
974 |
|
if (substr($target,0,strlen($gblFsRoot)) == $gblFsRoot) |
975 |
|
$target=substr($target,strlen($gblFsRoot),strlen($target)-strlen($gblFsRoot)); |
976 |
|
$msg=str_replace("\t"," ",$msg); |
977 |
|
fputs($log,time()."\t$target\t$GLOBALS[gblUserName]\t$msg\n"); |
978 |
|
fclose($log); |
979 |
|
|
980 |
|
// FIX: implement e-mail notification based on $changelog |
981 |
|
// permission |
982 |
} |
} |
983 |
|
|
984 |
|
|
997 |
fputs($note,"$msg\n"); |
fputs($note,"$msg\n"); |
998 |
fclose($note); |
fclose($note); |
999 |
|
|
1000 |
Logit($target,"added note $msg"); |
LogIt($target,"added note $msg"); |
1001 |
|
|
1002 |
} |
} |
1003 |
|
|
1042 |
$file=basename($target); |
$file=basename($target); |
1043 |
|
|
1044 |
if (file_exists("$dir/.lock/$file")) { |
if (file_exists("$dir/.lock/$file")) { |
1045 |
Logit($target,"attempt to locked allready locked file!"); |
LogIt($target,"attempt to locked allready locked file!"); |
1046 |
} else { |
} else { |
1047 |
$lock=fopen("$dir/.lock/$file","w"); |
$lock=fopen("$dir/.lock/$file","w"); |
1048 |
fputs($lock,"$GLOBALS[gblUserName]\n"); |
fputs($lock,"$GLOBALS[gblUserName]\n"); |
1049 |
fclose($lock); |
fclose($lock); |
1050 |
|
|
1051 |
Logit($target,"file locked"); |
LogIt($target,"file locked"); |
1052 |
} |
} |
1053 |
|
|
1054 |
} |
} |
1075 |
$file=basename($target); |
$file=basename($target); |
1076 |
if (file_exists($dir."/.lock/$file")) { |
if (file_exists($dir."/.lock/$file")) { |
1077 |
unlink("$dir/.lock/$file"); |
unlink("$dir/.lock/$file"); |
1078 |
Logit($target,"file unlocked"); |
LogIt($target,"file unlocked"); |
1079 |
} else { |
} else { |
1080 |
Logit($target,"attempt to unlocked non-locked file!"); |
LogIt($target,"attempt to unlocked non-locked file!"); |
1081 |
} |
} |
1082 |
|
|
1083 |
} |
} |
1097 |
function try_rename($from,$to) { |
function try_rename($from,$to) { |
1098 |
# print "$from -> $to\n"; |
# print "$from -> $to\n"; |
1099 |
if (file_exists($from) && is_writeable(dirname($to))) { |
if (file_exists($from) && is_writeable(dirname($to))) { |
1100 |
rename($from,$to); |
return rename($from,$to); |
1101 |
|
} else { |
1102 |
|
return 0; |
1103 |
} |
} |
1104 |
} |
} |
1105 |
|
|
1106 |
function try_dir($todir) { |
function try_dir($todir) { |
1107 |
if (! file_exists($todir)) { |
if (! file_exists($todir)) { |
1108 |
mkdir($todir,0700); |
@mkdir($todir,0700); |
1109 |
} |
} |
1110 |
} |
} |
1111 |
|
|
1115 |
|
|
1116 |
# print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n"; |
# print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n"; |
1117 |
|
|
1118 |
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); |
1119 |
try_dir("$todir/.log"); |
try_dir("$todir/.log"); |
1120 |
try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile"); |
try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile"); |
1121 |
try_dir("$todir/.note"); |
try_dir("$todir/.note"); |
1149 |
|
|
1150 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1151 |
|
|
|
function ChangeLog($target,$msg) { |
|
|
|
|
|
global $gblFsRoot; |
|
|
$log=fopen("$gblFsRoot/.changelog","a+"); |
|
|
if (substr($target,0,strlen($gblFsRoot)) == $gblFsRoot) |
|
|
$target=substr($target,strlen($gblFsRoot),strlen($target)-strlen($gblFsRoot)); |
|
|
$msg=str_replace("\t"," ",$msg); |
|
|
fputs($log,time()."\t$target\t$GLOBALS[gblUserName]\t$msg\n"); |
|
|
fclose($log); |
|
|
|
|
|
} |
|
|
|
|
1152 |
function DisplayChangeLog($day) { |
function DisplayChangeLog($day) { |
1153 |
|
|
1154 |
global $gblFsRoot; |
global $gblFsRoot,$HTTP_SERVER_VARS; |
1155 |
|
|
1156 |
if (!file_exists("$gblFsRoot/.changelog")) return; |
if (!file_exists("$gblFsRoot/.changelog")) return; |
1157 |
$log=fopen("$gblFsRoot/.changelog","r"); |
$log=fopen("$gblFsRoot/.changelog","r"); |
1158 |
$logarr = array(); |
$logarr = array(); |
1174 |
$time = date("$GLOBALS[gblTimeFmt]", $e[0]); |
$time = date("$GLOBALS[gblTimeFmt]", $e[0]); |
1175 |
$dir = dirname($e[1]); |
$dir = dirname($e[1]); |
1176 |
$file = basename($e[1]); |
$file = basename($e[1]); |
1177 |
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"; |
1178 |
} |
} |
1179 |
print "</table>"; |
print "</table>"; |
1180 |
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>"; |
1181 |
} |
} |
1182 |
|
|
1183 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1184 |
|
|
1185 |
function Download($path) { |
function Download($path,$force=0) { |
1186 |
global $HTTP_USER_AGENT; |
global $HTTP_SERVER_VARS,$mime_type; |
1187 |
$file=basename($path); |
|
1188 |
|
// default transfer-encoding |
1189 |
|
$encoding = "binary"; |
1190 |
|
|
1191 |
|
// known transfer encodings |
1192 |
|
$encoding_ext = array( |
1193 |
|
"gz" => "x-gzip", |
1194 |
|
"Z" => "x-compress", |
1195 |
|
); |
1196 |
|
|
1197 |
|
$file = basename($path); |
1198 |
$size = filesize($path); |
$size = filesize($path); |
1199 |
//header("Content-Type: application/octet-stream"); |
|
1200 |
header("Content-Type: application/force-download"); |
$ext_arr = explode(".",$file); |
1201 |
header("Content-Length: $size"); |
$ext = array_pop($ext_arr); |
1202 |
|
if ($encoding_ext[$ext]) { |
1203 |
|
$encoding = $encoding_ext[$ext]; |
1204 |
|
$ext = array_pop($ext_arr); |
1205 |
|
} |
1206 |
|
|
1207 |
|
if ($force || !isset($mime_type[$ext])) { |
1208 |
|
header("Content-Type: application/force-download"); |
1209 |
|
} else { |
1210 |
|
header("Content-Type: $mime_type[$ext]"); |
1211 |
|
} |
1212 |
|
|
1213 |
// IE5.5 just downloads index.php if we don't do this |
// IE5.5 just downloads index.php if we don't do this |
1214 |
if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT)) { |
if(preg_match("/MSIE 5.5/", $HTTP_SERVER_VARS[HTTP_USER_AGENT])) { |
1215 |
header("Content-Disposition: filename=$file"); |
header("Content-Disposition: filename=$file"); |
1216 |
} else { |
} else { |
1217 |
header("Content-Disposition: attachment; filename=$file"); |
header("Content-Disposition: attachment; filename=$file"); |
1218 |
} |
} |
1219 |
header("Content-Transfer-Encoding: binary"); |
|
1220 |
|
header("Content-Transfer-Encoding: $encoding"); |
1221 |
$fh = fopen($path, "r"); |
$fh = fopen($path, "r"); |
1222 |
fpassthru($fh); |
fpassthru($fh); |
1223 |
} |
} |
1226 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1227 |
|
|
1228 |
function chopsl($path) { |
function chopsl($path) { |
|
if (substr($path,strlen($path)-1,1) == "/") $path=substr($path,0,strlen($path)-1); |
|
1229 |
$path=str_replace("//","/",$path); |
$path=str_replace("//","/",$path); |
1230 |
|
if (substr($path,strlen($path)-1,1) == "/") $path=substr($path,0,strlen($path)-1); |
1231 |
return $path; |
return $path; |
1232 |
} |
} |
1233 |
|
|
1241 |
by Vyacheslav Zavadsky <zavadsky@braysystems.com> |
by Vyacheslav Zavadsky <zavadsky@braysystems.com> |
1242 |
*/ |
*/ |
1243 |
|
|
1244 |
define(trmask_not,1 << 0); |
define('trmask_not',1 << 0); |
1245 |
define(trmask_clear,1 << 1); |
define('trmask_clear',1 << 1); |
1246 |
define(trmask_deny,1 << 2); |
define('trmask_deny',1 << 2); |
1247 |
define(trmask_one_level,1 << 3); |
define('trmask_one_level',1 << 3); |
1248 |
define(trmask_group,1 << 4); |
define('trmask_group',1 << 4); |
1249 |
|
|
1250 |
define(trperm_r,1 << 5); |
define('trperm_r',1 << 5); |
1251 |
define(trperm_w,1 << 6); |
define('trperm_w',1 << 6); |
1252 |
define(trperm_b,1 << 7); |
define('trperm_b',1 << 7); |
1253 |
define(trperm_n,1 << 8); |
define('trperm_n',1 << 8); |
1254 |
|
|
1255 |
$trustee_a2n = array( |
$trustee_a2n = array( |
1256 |
'!' => trmask_not, |
'!' => trmask_not, |
1298 |
$error="<tt>".dirname($trustee_php)."</tt> must be writable by web server user"; |
$error="<tt>".dirname($trustee_php)."</tt> must be writable by web server user"; |
1299 |
} elseif (file_exists($trustee_php) && !is_writable($trustee_php)) { |
} elseif (file_exists($trustee_php) && !is_writable($trustee_php)) { |
1300 |
$error="trustees cache file <tt>$trustee_php</tt> exists, but is not writable by web server"; |
$error="trustees cache file <tt>$trustee_php</tt> exists, but is not writable by web server"; |
1301 |
} elseif (1 || filemtime($trustee_conf) >= filemtime($trustee_php)) { |
} elseif (@filemtime($trustee_conf) >= @filemtime($trustee_php)) { |
1302 |
$fp_php=@fopen($trustee_php,"w"); |
$fp_php=@fopen($trustee_php,"w"); |
1303 |
fputs($fp_php,"<?php // don't edit by hand!\n"); |
fputs($fp_php,"<?php // don't edit by hand!\n"); |
1304 |
|
|
1307 |
$groups_arr = array(); |
$groups_arr = array(); |
1308 |
$perm_arr = array(); |
$perm_arr = array(); |
1309 |
|
|
|
$error=0; |
|
|
|
|
1310 |
$tr_arr = array(); |
$tr_arr = array(); |
1311 |
|
|
1312 |
while (! feof($fp_conf)) { |
while (! feof($fp_conf)) { |
1334 |
$error.="trustee error in line '$l' [Unknown modifier '$ch']<br>\n"; |
$error.="trustee error in line '$l' [Unknown modifier '$ch']<br>\n"; |
1335 |
} |
} |
1336 |
} |
} |
1337 |
$tr_arr[$path][$user] |= $perm; |
if (isset($tr_arr[$path][$user])) { |
1338 |
|
$tr_arr[$path][$user] |= $perm; |
1339 |
|
} else { |
1340 |
|
$tr_arr[$path][$user] = $perm; |
1341 |
|
} |
1342 |
} |
} |
1343 |
} |
} |
1344 |
} |
} |
1377 |
fclose($fp_php); |
fclose($fp_php); |
1378 |
} |
} |
1379 |
|
|
1380 |
if ($error) { |
if (isset($error)) { |
1381 |
Error("Trustee error",$error); |
Error("Trustee error",$error,1); |
1382 |
} else { |
} else { |
1383 |
include("$trustee_php"); |
include_once("$trustee_php"); |
1384 |
} |
} |
1385 |
|
|
1386 |
return 1; |
return 1; |
1388 |
}//init_trustee |
}//init_trustee |
1389 |
|
|
1390 |
function in_group($user,$group) { |
function in_group($user,$group) { |
1391 |
return in_array($groups[$group],$user); |
global $groups; |
1392 |
|
return in_array($user,$groups[$group]); |
1393 |
} |
} |
1394 |
|
|
1395 |
// helper function |
// helper function |
1396 |
function unroll_perm($u,$t,$user,$perm) { |
function unroll_perm($u,$t,$user,$perm,$one_level) { |
1397 |
// check user |
|
1398 |
if ($t & trmask_not && ($u==$user)) continue; |
if ($t & trmask_one_level && !$one_level) return $perm; |
1399 |
if (!($t & trmask_not) && ($u!=$user)) continue; |
|
1400 |
|
// user is user whose trustee is this |
1401 |
|
if ($t & trmask_not && ($u==$user)) return $perm; |
1402 |
|
if (!($t & trmask_not) && ($u!=$user)) return $perm; |
1403 |
|
|
1404 |
if ($t & trmask_deny) { |
if ($t & trmask_deny) { |
1405 |
if ($t & trmask_clear) { |
if ($t & trmask_clear) { |
1406 |
$perm[deny] &= ~$t; |
$perm['deny'] &= ~$t; |
1407 |
} else { |
} else { |
1408 |
$perm[deny] |= $t; |
$perm['deny'] |= $t; |
1409 |
} |
} |
1410 |
} elseif ($t & trmask_clear) { |
} elseif ($t & trmask_clear) { |
1411 |
$perm[allow] &= ~$t; |
$perm['allow'] &= ~$t; |
1412 |
} else { |
} else { |
1413 |
$perm[allow] |= $t; |
$perm['allow'] |= $t; |
1414 |
} |
} |
1415 |
return $perm; |
return $perm; |
1416 |
}// end of helper function |
}// end of helper function |
1417 |
|
|
1418 |
function check_trustee($user,$path) { |
function check_trustee($user,$path) { |
1419 |
global $trustees; |
global $trustees; |
1420 |
$perm[allow] = 0; |
$perm['allow'] = 0; |
1421 |
$perm[deny] = 0; |
$perm['deny'] = 0; |
1422 |
|
|
1423 |
|
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); |
1424 |
|
|
1425 |
|
global $debug; |
1426 |
|
$debug .= "<br>check_trustee $path ... "; |
1427 |
|
|
1428 |
$path_arr=explode("/",$path); |
$path_arr=explode("/",$path); |
1429 |
$path = "/"; |
$tmppath = "/"; |
1430 |
while (count($path_arr)) { |
while (count($path_arr)) { |
1431 |
if (substr($path,strlen($path)-1,1) != "/") $path.="/"; |
$tmppath.=array_shift($path_arr); |
1432 |
$path.=array_shift($path_arr); |
$debug.= ">> $tmppath "; |
1433 |
$tr = $trustees[$path]; |
|
1434 |
|
if (! isset($trustees[$tmppath])) continue; |
1435 |
|
$tr = $trustees[$tmppath]; |
1436 |
|
|
1437 |
|
$one_level = (!count($path_arr)); |
1438 |
|
$debug.=" O($one_level) "; |
1439 |
|
|
1440 |
if (isset($tr)) { |
if (isset($tr)) { |
1441 |
// first apply trustee for all |
// first apply trustee for all |
1442 |
if (isset($tr['*'])) { |
if (isset($tr['*'])) { |
1443 |
$perm = unroll_perm($user,$tr['*'],$user, $perm); |
$perm = unroll_perm($user,$tr['*'],'*', $perm, $one_level); |
1444 |
unset($tr['*']); |
unset($tr['*']); |
1445 |
} |
} |
1446 |
// then apply group policies |
// then apply group policies |
1447 |
foreach ($tr as $u=>$t) { |
foreach ($tr as $g=>$t) { |
1448 |
if ($t & trmask_group && in_group($user,$u)) { |
if ($t & trmask_group && in_group($user,$g)) { |
1449 |
// resolv user |
// resolv user |
1450 |
$t = $t & ~trmask_group; |
$t = $t & ~trmask_group; |
1451 |
$u = $user; |
$perm = unroll_perm($user,$t,$g, $perm, $one_level); |
1452 |
$perm = unroll_perm($u,$t,$user, $perm); |
unset($tr[$g]); |
|
unset($tr[$u]); |
|
1453 |
} |
} |
1454 |
} |
} |
1455 |
// then apply use policy |
// then apply user policy |
1456 |
if (isset($tr[$user])) { |
if (isset($tr[$user])) { |
1457 |
$perm = unroll_perm($user,$tr[$user],$user, $perm); |
$perm = unroll_perm($user,$tr[$user],$user, $perm,$one_level); |
1458 |
unset($tr[$user]); |
unset($tr[$user]); |
1459 |
} |
} |
|
|
|
1460 |
} |
} |
1461 |
|
$debug.="d(".display_trustee($perm['deny']).") a(".display_trustee($perm['allow']).") "; |
1462 |
|
|
1463 |
} |
} |
1464 |
#print "<br>user: $user path: $path perm: "; |
$debug.="<br>check_trustee: user: $user path: $path==$tmppath perm: "; |
1465 |
#print "d: $perm[deny] (".display_trustee($perm[deny]).") a: $perm[allow] (".display_trustee($perm[allow]).")<Br>\n"; |
$debug.="d: ".$perm['deny']." (".display_trustee($perm['deny']).") a: ".$perm['allow']." (".display_trustee($perm['allow']).")<Br>\n"; |
1466 |
return $perm; |
return $perm; |
1467 |
} |
} |
1468 |
|
|
1470 |
|
|
1471 |
function check_perm($path,$trperm) { |
function check_perm($path,$trperm) { |
1472 |
global $gblLogin,$HAVE_TRUSTEE; |
global $gblLogin,$HAVE_TRUSTEE; |
1473 |
print "<br>check_perm: <tt>$path</tt> test perm ".display_trustee($perm)."<br>\n"; |
|
1474 |
|
global $debug; |
1475 |
|
$debug.="<br>check_perm: on <tt>$path</tt> for perm ".display_trustee($trperm)."<br>\n"; |
1476 |
|
|
1477 |
$return = ! $HAVE_TRUSTEE; |
$return = ! $HAVE_TRUSTEE; |
1478 |
if ($HAVE_TRUSTEE) { |
if ($HAVE_TRUSTEE) { |
1479 |
$perm = check_trustee($gblLogin,$path); |
$perm = check_trustee($gblLogin,$path); |
1480 |
print " d: $perm[deny] (".display_trustee($perm[deny]).") a: $perm[allow] (".display_trustee($perm[allow]).") perm: $trperm"; |
$debug.=" d: ".$perm['deny']." (".display_trustee($perm['deny']).") a: ".$perm['allow']." (".display_trustee($perm['allow']).") perm to have: $trperm (".display_trustee($trperm).")"; |
1481 |
if ($perm[deny] & $trperm) $return=0; |
if ($perm['deny'] & $trperm) $return=0; |
1482 |
elseif ($perm[allow] & $trperm) $return=1; |
elseif (($perm['allow'] & $trperm) == $trperm) $return=1; |
1483 |
} |
} |
1484 |
print " return: $return<br>\n"; |
$debug.=" return: $return<br>\n"; |
1485 |
return($return); |
return($return); |
1486 |
} |
} |
1487 |
|
|
1488 |
|
////////////////////////////////////////////////////////////////// |
1489 |
|
|
1490 |
|
function readMime() { |
1491 |
|
global $mime_type; |
1492 |
|
|
1493 |
|
if (! isset($gblMimeTypes)) { |
1494 |
|
$gblMimeTypes = "/etc/mime.types"; |
1495 |
|
} |
1496 |
|
|
1497 |
|
$mime = @fopen($gblMimeTypes,"r"); |
1498 |
|
|
1499 |
|
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>"); |
1500 |
|
|
1501 |
|
while($line = fgets($mime,80)) { |
1502 |
|
if (substr($line,0,1) == "#") continue; // skip comment |
1503 |
|
$arr = preg_split("/[\s\t]+/",$line); |
1504 |
|
$type = array_shift($arr); |
1505 |
|
while ($ext = array_shift($arr)) { |
1506 |
|
$mime_type[$ext] = $type; |
1507 |
|
} |
1508 |
|
} |
1509 |
|
|
1510 |
|
fclose($mime); |
1511 |
|
} |
1512 |
|
|
1513 |
|
////////////////////////////////////////////////////////////////// |
1514 |
|
|
1515 |
|
// check for invalid characters in filename and dirname (.. and /) |
1516 |
|
|
1517 |
|
function check_dirname($file) { |
1518 |
|
if (strstr($file,"..")) Error("Security violation","No parent dir <tt>..</tt> allowed in directory name <tt>$file</tt>",1); |
1519 |
|
} |
1520 |
|
|
1521 |
|
function check_filename($file) { |
1522 |
|
if (strstr($file,"..")) Error("Security violation","No parent dir <tt>..</tt> allowed in file name <tt>$file</tt>",1); |
1523 |
|
if (strstr($file,"/")) Error("Security violation","No slashes <tt>/</tt> allowed in file name <tt>$file</tt>",1); |
1524 |
|
} |
1525 |
|
|
1526 |
|
////////////////////////////////////////////////////////////////// |
1527 |
|
|
1528 |
|
// functions to move HTTP server variables to global namespace |
1529 |
|
// [replacement for register_globals in php.ini] |
1530 |
|
|
1531 |
|
function HTTP_GET_VAR($var) { |
1532 |
|
global $HTTP_GET_VARS, $GLOBALS; |
1533 |
|
if (isset($HTTP_GET_VARS[$var])) { |
1534 |
|
$GLOBALS[$var] = stripSlashes($HTTP_GET_VARS[$var]); |
1535 |
|
return $GLOBALS[$var]; |
1536 |
|
} |
1537 |
|
} |
1538 |
|
|
1539 |
|
function HTTP_POST_VAR($var) { |
1540 |
|
global $HTTP_GET_VARS, $GLOBALS; |
1541 |
|
if (isset($HTTP_GET_VARS[$var])) { |
1542 |
|
$GLOBALS[$var] = stripSlashes($HTTP_GET_VARS[$var]); |
1543 |
|
return $GLOBALS[$var]; |
1544 |
|
} |
1545 |
|
} |
1546 |
|
|
1547 |
|
////////////////////////////////////////////////////////////////// |
1548 |
|
|
1549 |
|
function Warn($text) { |
1550 |
|
} |
1551 |
|
|
1552 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1553 |
// MAIN PROGRAM |
// MAIN PROGRAM |
1555 |
$gblFilePerms = 0640 ; // default for new files |
$gblFilePerms = 0640 ; // default for new files |
1556 |
$gblDirPerms = 0750 ; // default for new dirs |
$gblDirPerms = 0750 ; // default for new dirs |
1557 |
|
|
1558 |
if (isset($STYLE) && $STYLE == "get") { |
if (isset($HTTP_GET_VARS["STYLE"]) && $HTTP_GET_VARS["STYLE"] == "get") { |
1559 |
include("$html/docman.css"); |
include("$html/docman.css"); |
1560 |
exit; |
exit; |
1561 |
} |
} |
1573 |
if (! isset($fsRealmDir)) { |
if (! isset($fsRealmDir)) { |
1574 |
$fsRealmDir = "$gblIncDir/realm"; |
$fsRealmDir = "$gblIncDir/realm"; |
1575 |
} |
} |
1576 |
$realm_config = "$fsRealmDir/$realm.conf"; |
|
1577 |
|
// try to add dir to script name to realm var |
1578 |
|
if (is_dir("$fsRealmDir/$realm/".dirname($HTTP_SERVER_VARS["SCRIPT_NAME"]))) { |
1579 |
|
$realm .= dirname($HTTP_SERVER_VARS["SCRIPT_NAME"]); |
1580 |
|
$realm_sep = "/"; |
1581 |
|
} else { |
1582 |
|
$realm_sep = "."; |
1583 |
|
} |
1584 |
|
|
1585 |
|
$realm_config = $fsRealmDir."/".$realm.$realm_sep."conf"; |
1586 |
|
|
1587 |
// read user-defined configuration |
// read user-defined configuration |
1588 |
if (file_exists($realm_config)) { |
if (file_exists($realm_config)) { |
1600 |
Error("Configuration error","Can't find user handling module at <tt>$gblIncDir/htusers/$gblUsers.php</tt> ! Please fix <tt>$realm_config</tt>"); |
Error("Configuration error","Can't find user handling module at <tt>$gblIncDir/htusers/$gblUsers.php</tt> ! Please fix <tt>$realm_config</tt>"); |
1601 |
} |
} |
1602 |
|
|
1603 |
|
// take additional login vars |
1604 |
|
HTTP_GET_VAR("relogin"); |
1605 |
|
HTTP_GET_VAR("force_login"); |
1606 |
|
|
1607 |
// if no password, or empty password logout |
// if no password, or empty password logout |
1608 |
if ( |
if ( |
1609 |
isset($gblLogin) && ( |
isset($gblLogin) && ( |
1619 |
exit ; |
exit ; |
1620 |
} |
} |
1621 |
|
|
1622 |
|
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); |
1623 |
|
|
1624 |
// trustee (ACL) file configuration |
// trustee (ACL) file configuration |
1625 |
$trustee_conf="$gblIncDir/realm/$realm.trustee"; |
$trustee_conf="$fsRealmDir/$realm".$realm_sep."trustee"; |
1626 |
// compiled version of trustee file |
// compiled version of trustee file |
1627 |
$trustee_php="$gblRepositoryDir/.trustee.php"; |
$trustee_php="$gblRepositoryDir/.trustee.php"; |
1628 |
// get ACL informations |
// get ACL informations |
1629 |
$HAVE_TRUSTEE = init_trustee(); |
$HAVE_TRUSTEE = init_trustee(); |
1630 |
|
|
1631 |
if (strtolower($gblLogin) == "anonymous" || !isset($gblPasswd)) { |
if (strtolower($gblLogin) == "anonymous" || !isset($gblLogin)) { |
1632 |
$perm = check_trustee($gblLogin,$path); |
$perm = check_trustee("anonymous","/"); |
1633 |
// browsing must be explicitly allowed for root directory |
// browsing must be explicitly allowed for root directory |
1634 |
// of repository for anonymous user to work! |
// of repository for anonymous user to work! |
1635 |
if ($perm[allow] & trperm_b) { |
if ($perm['allow'] & trperm_b) { |
1636 |
|
$gblLogin = $gblPasswd = "anonymous"; |
1637 |
$secHash = md5($gblLogin.$gblPasswd); |
$secHash = md5($gblLogin.$gblPasswd); |
1638 |
$gblUserName = "Anonymous user"; |
$gblUserName = "Anonymous user"; |
1639 |
} |
} |
1644 |
isset($relogin) && $secHash == $relogin) { |
isset($relogin) && $secHash == $relogin) { |
1645 |
header("WWW-authenticate: basic realm=\"$realm\"") ; |
header("WWW-authenticate: basic realm=\"$realm\"") ; |
1646 |
header("HTTP/1.0 401 Unauthorized") ; |
header("HTTP/1.0 401 Unauthorized") ; |
1647 |
Error("401 Unauthorized","No trespassing !"); |
Error("401 Unauthorized","No trespassing !",0,1); |
|
exit ; |
|
1648 |
} |
} |
1649 |
|
|
|
// get current directory relative to $gblFsRoot |
|
|
$relDir = $DIR ; // from POST |
|
|
if ($relDir == "") { // not defined in POST ? |
|
|
$relDir = urldecode($D) ; // then use GET |
|
|
} |
|
|
|
|
|
$relDir=stripSlashes($relDir); |
|
1650 |
|
|
1651 |
if ($relDir == "/") $relDir = "" ; |
// read mime.types |
1652 |
// default : website root = "" |
readMime(); |
1653 |
|
|
1654 |
if (strstr($relDir,"..")) Error("No updirs allowed"); |
if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST") { |
1655 |
|
// take variables from server |
1656 |
|
if (HTTP_POST_VAR("FN")) check_filename($FN); |
1657 |
|
if (HTTP_POST_VAR("DIR")) { |
1658 |
|
check_dirname($DIR); |
1659 |
|
$relDir = $DIR; |
1660 |
|
} else { |
1661 |
|
trigger_error("Can't get DIR",E_USER_WARNING); |
1662 |
|
} |
1663 |
|
if (HTTP_POST_VAR("RELPATH")) check_dirname($RELPATH); |
1664 |
|
HTTP_POST_VAR("T"); |
1665 |
|
HTTP_POST_VAR("CONFIRM"); |
1666 |
|
|
1667 |
// full paths contain "fs" or "Fs". Paths realitve to root of |
} else { |
1668 |
// website contain "rel" or "Rel". The script won't let you |
// get |
1669 |
// edit anything above directory equal to http://server.com |
HTTP_GET_VAR("A"); |
1670 |
// i.e. below $gblFsRoot. |
if (HTTP_GET_VAR("D")) { |
1671 |
|
check_dirname($D); |
1672 |
|
$D=urldecode($D); |
1673 |
|
$relDir = $D; |
1674 |
|
} else { |
1675 |
|
//trigger_error("Can't get D",E_USER_WARNING); |
1676 |
|
$relDir = "/"; |
1677 |
|
} |
1678 |
|
if (HTTP_GET_VAR("F")) check_filename($F); |
1679 |
|
} |
1680 |
|
|
1681 |
$relScriptDir = dirname($SCRIPT_NAME) ; |
$relScriptDir = dirname($HTTP_SERVER_VARS["SCRIPT_NAME"]) ; |
1682 |
// i.e. /docman |
// i.e. /docman |
1683 |
|
|
1684 |
// start on server root |
// start on server root |
1685 |
$gblFsRoot = $gblRepositoryDir; |
$gblFsRoot = $gblRepositoryDir; |
1686 |
// i.e. /home/httpd/html |
// i.e. /home/httpd/repository |
1687 |
|
|
1688 |
$fsDir = $gblFsRoot . $relDir ; // current directory |
$fsDir = $gblFsRoot . $relDir ; // current directory |
1689 |
if ( !is_dir($fsDir) ) Error("Dir not found",$relDir) ; |
if ( !is_dir($fsDir) ) Error("Dir not found","Can't find <tt>$relDir</tt> which points to <tt>$fsDir</tt>",1) ; |
1690 |
|
|
1691 |
if (isset($GLOBALS["HTTPS"]) && $GLOBALS["HTTPS"] == "on") { |
if ($relDir == "") $relDir="/"; |
1692 |
|
|
1693 |
|
if (isset($HTTP_SERVER_VARS["HTTPS"]) && $HTTP_SERVER_VARS["HTTPS"] == "on") { |
1694 |
$webRoot = "https://"; |
$webRoot = "https://"; |
1695 |
} else { |
} else { |
1696 |
$webRoot = "http://"; |
$webRoot = "http://"; |
1697 |
} |
} |
1698 |
$webRoot .= $GLOBALS["HTTP_HOST"] . $relScriptDir; |
$webRoot .= $HTTP_SERVER_VARS["HTTP_HOST"] . $relScriptDir; |
|
|
|
|
$FN=stripSlashes($FN); |
|
1699 |
|
|
1700 |
switch ($POSTACTION) { |
if (HTTP_POST_VAR("POSTACTION")) switch ($POSTACTION) { |
1701 |
case "UPLOAD" : |
case "UPLOAD" : |
1702 |
|
$FN_name=stripSlashes($HTTP_POST_FILES["FN"]["tmp_name"]); |
1703 |
|
$FN=stripSlashes($HTTP_POST_FILES["FN"]["name"]); |
1704 |
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ; |
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ; |
1705 |
if (strstr($FN_name,"/")) |
|
1706 |
Error("Non-conforming filename") ; |
$source = $FN_name ; |
|
// TODO : should rather check for escapeshellcmds |
|
|
// but maybe RFC 18xx asserts safe filenames .... |
|
|
$source = $FN ; |
|
1707 |
if (! file_exists($source)) { |
if (! file_exists($source)) { |
1708 |
Error("You must select file with browse to upload it!"); |
Error("You must select file with browse to upload it!"); |
1709 |
} |
} |
1710 |
|
|
1711 |
|
$FILENAME = $HTTP_POST_VARS["FILENAME"]; |
1712 |
|
check_filename($FILENAME); |
1713 |
|
|
1714 |
if (! isset($FILENAME)) { // from update file |
if (! isset($FILENAME)) { // from update file |
1715 |
$target = "$fsDir/$FN_name" ; |
$target = "$fsDir/".basename($FN); |
1716 |
} else { |
} else { |
1717 |
$target = "$fsDir/$FILENAME"; |
$target = "$fsDir/$FILENAME"; |
1718 |
} |
} |
1734 |
copy($source,$target) ; |
copy($source,$target) ; |
1735 |
chmod($target,$gblFilePerms) ; |
chmod($target,$gblFilePerms) ; |
1736 |
clearstatcache() ; |
clearstatcache() ; |
|
Logit($target,"uploaded"); |
|
1737 |
if (isset($FILENAME)) { |
if (isset($FILENAME)) { |
1738 |
|
LogIt($target,"check-in",trperm_r | trperm_w); |
1739 |
Unlock($target); |
Unlock($target); |
1740 |
|
} else { |
1741 |
|
LogIt($target,"uploaded",trperm_r | trperm_w); |
1742 |
} |
} |
|
ChangeLog($target,"updated"); |
|
1743 |
break ; |
break ; |
1744 |
|
|
1745 |
case "SAVE" : |
case "SAVE" : |
1756 |
fwrite($fh,$FILEDATA) ; |
fwrite($fh,$FILEDATA) ; |
1757 |
fclose($fh) ; |
fclose($fh) ; |
1758 |
clearstatcache() ; |
clearstatcache() ; |
1759 |
Logit($path,"saved changes"); |
LogIt($path,"saved changes",trperm_r); |
|
ChangeLog($path,"saved changes"); |
|
1760 |
break ; |
break ; |
1761 |
|
|
1762 |
case "CREATE" : |
case "CREATE" : |
1769 |
case "D" : // create a directory |
case "D" : // create a directory |
1770 |
if ( ! @mkdir($path,$gblDirPerms) ) |
if ( ! @mkdir($path,$gblDirPerms) ) |
1771 |
Error("Mkdir failed",$relPath) ; // eg. if it exists |
Error("Mkdir failed",$relPath) ; // eg. if it exists |
1772 |
|
else |
1773 |
|
LogIt($path."/","dir created",trperm_w); |
1774 |
clearstatcache() ; |
clearstatcache() ; |
1775 |
break ; |
break ; |
1776 |
case "F" : // create a new file |
case "F" : // create a new file |
1783 |
if ($fh) { |
if ($fh) { |
1784 |
fputs($fh,"\n"); |
fputs($fh,"\n"); |
1785 |
fclose($fh) ; |
fclose($fh) ; |
1786 |
LogIt($path,"file created"); |
LogIt($path,"file created",trperm_r | trperm_w); |
1787 |
} else { |
} else { |
1788 |
Error("Creation of file $relPath failed -- $path"); |
Error("Creation of file $relPath failed -- $path"); |
1789 |
} |
} |
1790 |
$tstr = "$PHP_SELF?A=E&D=".urlencode($relDir)."&F=".urlencode($FN) ; |
$tstr = "$PHP_SELF?A=E&D=".urlencode($relDir)."&F=".urlencode($FN) ; |
1791 |
header("Location: " . $tstr) ; |
header("Location: " . $tstr) ; |
|
ChangeLog($target,"created"); |
|
1792 |
exit ; |
exit ; |
1793 |
} |
} |
1794 |
break ; |
break ; |
1810 |
|
|
1811 |
// if ( ! @unlink($path) ) { |
// if ( ! @unlink($path) ) { |
1812 |
if ( ! rename($path,"$dir/.del/$file") ) { |
if ( ! rename($path,"$dir/.del/$file") ) { |
1813 |
|
LogIt($path,"file delete failed"); |
1814 |
Error("File delete failed", $tstr . $path) ; |
Error("File delete failed", $tstr . $path) ; |
|
Logit($path,"file delete failed"); |
|
|
exit ; |
|
1815 |
} else { |
} else { |
1816 |
Logit($path,"file deleted"); |
LogIt($path,"file deleted",trperm_w); |
1817 |
MoveTo("$dir/.log/$file","$dir/.del/.log/"); |
MoveTo("$dir/.log/$file","$dir/.del/.log/"); |
1818 |
MoveTo("$dir/.note/$file","$dir/.del/.note/"); |
MoveTo("$dir/.note/$file","$dir/.del/.note/"); |
1819 |
MoveTo("$dir/.lock/$file","$dir/.del/.lock/"); |
MoveTo("$dir/.lock/$file","$dir/.del/.lock/"); |
1820 |
} |
} |
1821 |
} |
} else { // delete directory |
1822 |
else { // delete directory |
if ( ! @rrmdir($fsDir) ) { |
1823 |
if ( ! @rrmdir($fsDir) ) { |
Error("Rmdir failed", $tstr . $fsDir) ; |
1824 |
Error("Rmdir failed", $tstr . $fsDir) ; |
} else { |
1825 |
} |
LogIt($path,"dir deleted",trperm_w); |
1826 |
else { |
$relDir = dirname($relDir) ; // move up |
1827 |
$relDir = dirname($relDir) ; // move up |
} |
|
} |
|
1828 |
} |
} |
1829 |
break ; |
break ; |
1830 |
|
|
1834 |
if (substr($FN,0,4) != ".del") break ; |
if (substr($FN,0,4) != ".del") break ; |
1835 |
$file=substr($FN,4,strlen($FN)-4); |
$file=substr($FN,4,strlen($FN)-4); |
1836 |
|
|
1837 |
Logit("$fsDir/.del/$file","undeleted"); |
LogIt("$fsDir/.del/$file","undeleted",trperm_w); |
1838 |
MoveTo("$fsDir/.del/$file","$fsDir/"); |
MoveTo("$fsDir/.del/$file","$fsDir/"); |
1839 |
MoveTo("$fsDir/.del/.log/$file","$fsDir/.log/"); |
MoveTo("$fsDir/.del/.log/$file","$fsDir/.log/"); |
1840 |
MoveTo("$fsDir/.del/.note/$file","$fsDir/.note/"); |
MoveTo("$fsDir/.del/.note/$file","$fsDir/.note/"); |
1845 |
case "RENAME" : |
case "RENAME" : |
1846 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1847 |
|
|
1848 |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
$NEWNAME=stripSlashes($HTTP_POST_VARS["NEWNAME"]); |
1849 |
|
LogIt("$fsDir/$FN","renamed $FN to $NEWNAME",trperm_r); |
1850 |
safe_rename($fsDir,$FN,$NEWNAME); |
safe_rename($fsDir,$FN,$NEWNAME); |
1851 |
break ; |
break ; |
1852 |
|
|
1853 |
case "NOTE" : |
case "NOTE" : |
1854 |
|
$NOTE=stripSlashes($HTTP_POST_VARS["NOTE"]); |
1855 |
WriteNote("$fsDir/$FN","$NOTE"); |
WriteNote("$fsDir/$FN","$NOTE"); |
1856 |
break ; |
break ; |
1857 |
|
|
1865 |
} |
} |
1866 |
|
|
1867 |
// common to all POSTs : redirect to directory view ($relDir) |
// common to all POSTs : redirect to directory view ($relDir) |
1868 |
if ( $POSTACTION != "" ) { |
if (isset($POSTACTION)) { |
1869 |
$tstr = $PHP_SELF . "?D=" . urlencode($relDir) ; |
$tstr = $PHP_SELF . "?D=" . urlencode($relDir) ; |
1870 |
header("Location: " . $tstr) ; |
header("Location: " . $tstr) ; |
1871 |
exit ; |
exit ; |
1878 |
// $A=Co : checkout file $D/$F |
// $A=Co : checkout file $D/$F |
1879 |
// $A=Ci : checkin file $D/$F |
// $A=Ci : checkin file $D/$F |
1880 |
// $A=V : view file (do nothing except log) |
// $A=V : view file (do nothing except log) |
1881 |
// $A=I : include file .$F.php from $gblFsRoot |
// $A=I : include file .$F.php from [$gblIncDir|realm]/include_php |
1882 |
// default : display directory $D |
// default : display directory $D |
1883 |
|
|
1884 |
switch ($A) { |
if (isset($A)) switch ($A) { |
1885 |
case "U" : |
case "U" : |
1886 |
// upload to $relDir |
// upload to $relDir |
1887 |
|
if (! check_perm($relDir, trperm_w)) |
1888 |
|
Error("Write access denied","You don't have permission to write in <tt>$relDir</tt>"); |
1889 |
if (!is_writeable($gblFsRoot . $relDir)) |
if (!is_writeable($gblFsRoot . $relDir)) |
1890 |
Error("Write access denied",$relDir) ; |
Error("Write access denied","User <tt>$gblLogin</tt> has permission on <tt>$relDir</tt>, but directory is not writable",1); |
1891 |
$text = "Use this page to upload a single " ; |
$text = "Use this page to upload a single " ; |
1892 |
$text .= "file to <B>$HTTP_HOST</B>." ; |
$text .= "file to <B>$realm</B>." ; |
1893 |
StartHTML("(Upload Page)", $text) ; |
StartHTML("(Upload Page)", $text) ; |
1894 |
UploadPage($gblFsRoot, $relDir) ; |
UploadPage($gblFsRoot, $relDir) ; |
1895 |
EndHTML() ; |
EndHTML() ; |
1896 |
exit ; |
exit ; |
1897 |
case "E" : |
case "E" : |
|
$F=stripSlashes($F); |
|
1898 |
// detail of $relDir/$F |
// detail of $relDir/$F |
1899 |
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) ; |
1900 |
exit ; |
exit ; |
1906 |
case "Co" : |
case "Co" : |
1907 |
// checkout |
// checkout |
1908 |
Lock("$gblFsRoot/$relDir/$F"); |
Lock("$gblFsRoot/$relDir/$F"); |
1909 |
Download("$gblFsRoot/$relDir/$F"); |
Download("$gblFsRoot/$relDir/$F",1); |
1910 |
exit; |
exit; |
1911 |
case "Ci" : |
case "Ci" : |
1912 |
$F=stripSlashes($F); |
$F=stripSlashes($F); |
1914 |
if (!is_writeable($gblFsRoot . $relDir)) |
if (!is_writeable($gblFsRoot . $relDir)) |
1915 |
Error("Write access denied",$relDir) ; |
Error("Write access denied",$relDir) ; |
1916 |
$text = "Use this page to update a single " ; |
$text = "Use this page to update a single " ; |
1917 |
$text .= "file to <B>$HTTP_HOST</B>." ; |
$text .= "file to <B>$realm</B>." ; |
1918 |
StartHTML("(Update file Page)", $text) ; |
StartHTML("(Update file Page)", $text) ; |
1919 |
UploadPage($gblFsRoot, $relDir, $F) ; |
UploadPage($gblFsRoot, $relDir, $F) ; |
1920 |
EndHTML() ; |
EndHTML() ; |
1922 |
case "V" : |
case "V" : |
1923 |
// view |
// view |
1924 |
LogIt("$gblFsRoot/$relDir/$F","viewed"); |
LogIt("$gblFsRoot/$relDir/$F","viewed"); |
1925 |
if ($gblForceDownload) { |
Download("$gblFsRoot/$relDir/$F",$gblForceDownload); |
|
Download("$gblFsRoot/$relDir/$F"); |
|
|
} else { |
|
|
header("Content-Disposition: attachment; filename=$F" ); |
|
|
Header("Location: $webRoot".urlpath("$relDir/$F")); |
|
|
} |
|
1926 |
exit; |
exit; |
1927 |
case "Ch" : |
case "Ch" : |
1928 |
StartHTML("(File changes)","All changes chronologicaly..."); |
StartHTML("(File changes)","All changes chronologicaly..."); |
1935 |
EndHTML() ; |
EndHTML() ; |
1936 |
exit; |
exit; |
1937 |
case "I" : |
case "I" : |
1938 |
$F=stripSlashes($F); |
if (! isset($F) || $F == "") |
1939 |
$inc_file="${gblFsRoot}/.${F}.php"; |
Error("Can't find file to include","Your request didn't specify file to include which should be in variable <tt>F</tt> like <tt>$HTTP_SERVER_VARS[REQUEST_URI]<b>&F=include_php_file</b></tt>",1); |
1940 |
if (!isset($F) || $F == "" || !file_exists($inc_file)) Error("Fatal error $inc_file"); // can't find file to include |
$inc_file="$fsRealmDir/$realm".$realm_sep.$F.".php"; |
1941 |
|
if (! file_exists($inc_file)) { |
1942 |
|
Error("Can't find file to include","Can't find include file <tt>$F.php</tt> in <tt>$fsRealmDir/$realm/</tt>. Meybe you should copy <tt>$gblIncDir/include_php/$F.php</tt> to <tt>$inc_file<tt> ?",1); |
1943 |
|
} |
1944 |
if (!is_readable($inc_file)) |
if (!is_readable($inc_file)) |
1945 |
Error("Read access to include file denied",".${F}.php"); |
Error("Read access to include file denied","Can't read PHP include file <tt>$inc_file</tt>. Fix permissions on it.",1); |
1946 |
$text = "Your include file should define \$text variable which holds this text and \$title variable which is page title"; |
$text = "Your include file should define \$text variable which holds this text and \$title variable which is page title"; |
1947 |
$title = "You should define \$title variable with page title"; |
$title = "You should define \$title variable with page title"; |
1948 |
include($inc_file); |
include($inc_file); |
1949 |
StartHTML($title, $text) ; |
StartHTML($title, $text) ; |
1950 |
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>"; |
1951 |
EndHTML() ; |
EndHTML() ; |
1952 |
exit ; |
exit ; |
1953 |
} |
} |
1956 |
Navigate($gblFsRoot,$relDir) ; |
Navigate($gblFsRoot,$relDir) ; |
1957 |
exit ; |
exit ; |
1958 |
|
|
1959 |
Error("Whooah!","By cartesian logic, this never happens") ; |
Error("Whooah!","By cartesian logic, this never happens",1) ; |
1960 |
?> |
?> |