/*
Document manager handling for .htusers file
This file is included early in docman.php and it should return:
$gblUserName descriptive username
$secHash md5 hash of joint login and password
$gblEmail e-mail address of user
This module can use any back magic to find who the user
is, but I suggest $PHP_AUTH_USER and $PHP_AUTH_PW
*/
$htusers_file=$fsRealmDir."/".$realm.$realm_sep."htusers";
if (! file_exists($htusers_file)) {
Error("Can't find users file!","Please create users file $htusers_file by hand or using adduser.pl script! There is example in $gblIncDir/realm/localhost.htusers.dist.");
}
$htusers=fopen($htusers_file,"r");
while($user = fgetcsv($htusers,255,":")) {
if ($user[0] == $GLOBALS["gblLogin"]) {
$gblUserName=$user[1];
$secHash=$user[2];
if (substr($secHash,0,5) == "auth_") {
$auth_include = str_replace("auth_","auth/","$gblIncDir/$secHash.php");
if (file_exists($auth_include)) {
include_once($auth_include);
if ($secHash($user)) {
$secHash=md5($GLOBALS["gblLogin"].$GLOBALS["gblPasswd"]);
} else {
$secHash="error".md5($GLOBALS["gblLogin"].$GLOBALS["gblPasswd"]);
}
} else {
Error("Can't find authorisation file","Can't file include file $auth_include needed for authorisation. Is docman installed correctly?");
}
}
$gblEmail=$user[3];
continue ;
}
}
fclose($htusers);
?>