--- docman.php 2001/04/06 08:46:42 1.40
+++ docman.php 2001/06/20 10:29:19 1.43
@@ -120,6 +120,9 @@
$gblImages = array( ".jpg",".jpeg",".gif",".png",".ico",
".bmp",".xbm") ;
+ // Where are users? (by default in .htusers file)
+ $gblUsers = "htusers_file";
+
//////////////////////////////////////////////////////////////////
function StartHTML($title,$text="") {
@@ -694,12 +697,20 @@
1) {
+ $out.="s";
+ }
+ return $out;
+}
+
// output subdirs
if (sizeof($dirList) > 0) {
sort($dirList) ;
?>
-
| DIRECTORY NAME | DIRECTORY NOTE |
+ | DIRECTORY NAME (= plural("dir",sizeof($dirList)) ?>) | DIRECTORY NOTE |
| = $webRoot . $relDir ?>
|
- | DOCUMENT NAME |
+
| DOCUMENT NAME (= plural("file",sizeof($fileList)) ?>) |
= $gblIcon("blank").$gblIcon("blank") ?> |
NOTE |
LAST UPDATE | FILE SIZE |
@@ -977,7 +988,7 @@
$msg=fgets($note,4096);
fclose($note);
}
- return StripSlashes($msg);
+ return HtmlSpecialChars(StripSlashes($msg));
}
@@ -1167,38 +1178,20 @@
// creation if password not yet set.
if ($STYLE == "get") { CSS() ; exit ; }
- $htusers_file=dirname($SCRIPT_FILENAME)."/.htusers";
- if (! file_exists($htusers_file)) {
- if (is_writeable(dirname($SCRIPT_FILENAME))) {
- $htusers=fopen($htusers_file,"a+");
- fputs($htusers,"# Change owner of $htusers_file to root !!\n");
- fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n");
- fclose($htusers);
- Error("Proto user file created!","Please edit $htusers_file and set it correct permissions (not writable by web server as it is now!). You can add users using adduser.pl script!");
- exit;
- } else {
- Error("Can't create proto user file!","Please make directory ".dirname($htusers_file)." writable or create .htusers file by hand using adduser.pl script!");
- exit;
- }
+ $fsScriptDir = dirname($SCRIPT_FILENAME) ;
+ // i.e. /home/httpd/html/docman
+
+ // read user-defined configuration
+ if (file_exists("$fsScriptDir/.docman.conf")) {
+ include("$fsScriptDir/.docman.conf");
}
- $htusers=fopen($htusers_file,"r");
- while($user = fgetcsv($htusers,255,":")) {
- if ($user[0] == $GLOBALS["PHP_AUTH_USER"]) {
- $gblUserName=$user[1];
- $gblPw=$user[2];
- if (substr($gblPw,0,5) == "auth_" && file_exists("$gblIncDir/$gblPw.php")) {
- require("$gblIncDir/$gblPw.php");
- if ($gblPw($user)) {
- $gblPw=md5($PHP_AUTH_USER.$PHP_AUTH_PW);
- } else {
- $gblPw="error".md5($PHP_AUTH_USER.$PHP_AUTH_PW);
- }
- }
- $gblEmail=$user[3];
- continue ;
- }
+
+ // where do we get users from?
+ if (file_exists("$gblIncDir/$gblUsers.php")) {
+ include("$gblIncDir/$gblUsers.php");
+ } else {
+ Error("Configuration error","Can't find user handling module at $gblIncDir/$gblUsers.php ! Please fix $fsScriptDir/.docman.conf");
}
- fclose($htusers);
// authentication failure
if ( md5($PHP_AUTH_USER.$PHP_AUTH_PW) != $gblPw ||
@@ -1230,9 +1223,6 @@
$relScriptDir = dirname($SCRIPT_NAME) ;
// i.e. /docman
- $fsScriptDir = dirname($SCRIPT_FILENAME) ;
- // i.e. /home/httpd/html/docman
-
// start on server root
// $gblFsRoot = substr($fsScriptDir,0, strlen($fsScriptDir)-strlen($relScriptDir)) ;
// or on script root
@@ -1251,9 +1241,6 @@
$FN=stripSlashes($FN);
- if (file_exists("$fsScriptDir/.docman.conf")) {
- include("$fsScriptDir/.docman.conf");
- }
switch ($POSTACTION) {
case "UPLOAD" :