133 |
|
|
134 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
135 |
|
|
136 |
$gblVersion = "1.8-dev"; |
$gblVersion = "1.9-dev"; |
137 |
|
|
138 |
function StartHTML($title,$text="") { |
function StartHTML($title,$text="") { |
139 |
|
|
174 |
<B><?= date($gblDateFmt) ?> - |
<B><?= date($gblDateFmt) ?> - |
175 |
<?= date($gblTimeFmt) ?> - |
<?= date($gblTimeFmt) ?> - |
176 |
<?= $gblUserName ?> |
<?= $gblUserName ?> |
177 |
<small> [<a href="<?= $PHP_SELF ?>?relogin=<?= $gblPw ?>">logout</a>]</small> |
<?php |
178 |
|
global $PHP_AUTH_USER,$PHP_AUTH_PW; |
179 |
|
$url = $PHP_SELF."?relogin="; |
180 |
|
if (isset($gblPw) && $gblPw != "") { |
181 |
|
$url .= $gblPw; |
182 |
|
} else { |
183 |
|
$url .= md5($PHP_AUTH_USER.$PHP_AUTH_PW); |
184 |
|
} |
185 |
|
if (isset($PHP_AUTH_USER) && $PHP_AUTH_USER != "" && ($PHP_AUTH_PW == "" || !isset($PHP_AUTH_PW))) { |
186 |
|
$url_title="login"; |
187 |
|
$url .= "&force_login=1"; |
188 |
|
} else { |
189 |
|
$url_title="relogin"; |
190 |
|
} |
191 |
|
?> |
192 |
|
<small> [<a href="<?= $url ?>"><?= $url_title ?></a>]</small> |
193 |
</B> |
</B> |
194 |
<BR><small> |
<BR><small> |
195 |
Document Manager <?= $gblVersion ?>, based on ANYPORTAL(php) Site Manager |
Document Manager <?= $gblVersion ?>, based on ANYPORTAL(php) Site Manager |
196 |
<br> |
<br> |
197 |
© 1999 by <A HREF="http://www.anyportal.com">ANYPORTAL</A>, |
© 1999 by <A HREF="http://www.anyportal.com">ANYPORTAL</A>, |
198 |
© 2000 by <A HREF="http://da.nger.org">d@nger.org</A>, |
© 2000 by <A HREF="http://da.nger.org">d@nger.org</A>, |
199 |
© 2000 by <A HREF="http://www.rot13.org/~dpavlin/">DbP</A> |
© 2000-2002 by <A HREF="http://www.rot13.org/~dpavlin/">DbP</A> |
200 |
</small> |
</small> |
201 |
</P> |
</P> |
202 |
<BR> |
<BR> |
386 |
$log=fopen($logname,"r"); |
$log=fopen($logname,"r"); |
387 |
$cl1=" class=LST"; $cl2=""; |
$cl1=" class=LST"; $cl2=""; |
388 |
$logarr = array(); |
$logarr = array(); |
389 |
while($line = fgetcsv($log,255,"\t")) { |
while($line = fgetcsv($log,512,"\t")) { |
390 |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
391 |
array_unshift($logarr,array($cl,$line[0],$line[1],$line[2],$line[3])); |
array_unshift($logarr,array($cl,$line[0],$line[1],$line[2],$line[3])); |
392 |
} |
} |
716 |
CELLSPACING=3 WIDTH=\"100%\">" ; |
CELLSPACING=3 WIDTH=\"100%\">" ; |
717 |
|
|
718 |
// updir bar |
// updir bar |
719 |
if ($fsDir != $fsRoot) { |
if (chopsl($fsDir) != chopsl($fsRoot)) { |
720 |
$parent = dirname($relDir) ; |
$parent = dirname($relDir) ; |
721 |
if ($parent == "") $parent = "/" ; |
if ($parent == "") $parent = "/" ; |
722 |
?> |
?> |
900 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
901 |
<INPUT TYPE="SUBMIT" VALUE="CREATE" NAME="CREATE"> |
<INPUT TYPE="SUBMIT" VALUE="CREATE" NAME="CREATE"> |
902 |
</NOBR> |
</NOBR> |
903 |
<NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE |
<NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE</NOBR> |
|
</NOBR> |
|
904 |
</TD></TR> |
</TD></TR> |
905 |
</FORM> |
</FORM> |
906 |
</TABLE> |
</TABLE> |
964 |
|
|
965 |
$title = "(401 Unauthorized)" ; |
$title = "(401 Unauthorized)" ; |
966 |
$text = "No trespassing !" ; |
$text = "No trespassing !" ; |
967 |
|
|
968 |
|
global $PHP_AUTH_USER,$PHP_AUTH_PW,$gblPw,$relogin; |
969 |
StartHTML($title,$text) ; |
StartHTML($title,$text) ; |
970 |
|
|
971 |
EndHTML() ; |
EndHTML() ; |
1161 |
$log=fopen("$gblFsRoot/.changelog","a+"); |
$log=fopen("$gblFsRoot/.changelog","a+"); |
1162 |
if (substr($target,0,strlen($gblFsRoot)) == $gblFsRoot) |
if (substr($target,0,strlen($gblFsRoot)) == $gblFsRoot) |
1163 |
$target=substr($target,strlen($gblFsRoot),strlen($target)-strlen($gblFsRoot)); |
$target=substr($target,strlen($gblFsRoot),strlen($target)-strlen($gblFsRoot)); |
1164 |
|
$msg=str_replace("\t"," ",$msg); |
1165 |
fputs($log,time()."\t$target\t$GLOBALS[gblUserName]\t$msg\n"); |
fputs($log,time()."\t$target\t$GLOBALS[gblUserName]\t$msg\n"); |
1166 |
fclose($log); |
fclose($log); |
1167 |
|
|
1173 |
if (!file_exists("$gblFsRoot/.changelog")) return; |
if (!file_exists("$gblFsRoot/.changelog")) return; |
1174 |
$log=fopen("$gblFsRoot/.changelog","r"); |
$log=fopen("$gblFsRoot/.changelog","r"); |
1175 |
$logarr = array(); |
$logarr = array(); |
1176 |
while($line = fgetcsv($log,255,"\t")) { |
while($line = fgetcsv($log,512,"\t")) { |
1177 |
|
while (sizeof($line) > 4) { |
1178 |
|
$tmp = array_pop($line); |
1179 |
|
$line.=" $tmp"; |
1180 |
|
} |
1181 |
if ($day!=1 || ($day==1 && (time()-$line[0] < 24*60*60))) { |
if ($day!=1 || ($day==1 && (time()-$line[0] < 24*60*60))) { |
1182 |
array_unshift($logarr,array($line[0],$line[1],$line[2],$line[3])); |
array_unshift($logarr,array($line[0],$line[1],$line[2],$line[3])); |
1183 |
} |
} |
1220 |
|
|
1221 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1222 |
|
|
1223 |
|
function chopsl($path) { |
1224 |
|
if (substr($path,strlen($path)-1,1) == "/") $path=substr($path,0,strlen($path)-1); |
1225 |
|
$path=str_replace("//","/",$path); |
1226 |
|
return $path; |
1227 |
|
} |
1228 |
|
|
1229 |
|
////////////////////////////////////////////////////////////////// |
1230 |
// MAIN PROGRAM |
// MAIN PROGRAM |
1231 |
// ============ |
// ============ |
1232 |
// query parameters: capital letters |
// query parameters: capital letters |
1241 |
|
|
1242 |
// forks before authentication: style sheet and hash |
// forks before authentication: style sheet and hash |
1243 |
// creation if password not yet set. |
// creation if password not yet set. |
1244 |
if ($STYLE == "get") { CSS() ; exit ; } |
if (isset($STYLE) && $STYLE == "get") { CSS() ; exit ; } |
1245 |
|
|
1246 |
$fsScriptDir = dirname($SCRIPT_FILENAME) ; |
$fsScriptDir = dirname($SCRIPT_FILENAME) ; |
1247 |
// i.e. /home/httpd/html/docman |
// i.e. /home/httpd/html/docman |
1258 |
Error("Configuration error","Can't find user handling module at <tt>$gblIncDir/$gblUsers.php</tt> ! Please fix <tt>$fsScriptDir/.docman.conf</tt>"); |
Error("Configuration error","Can't find user handling module at <tt>$gblIncDir/$gblUsers.php</tt> ! Please fix <tt>$fsScriptDir/.docman.conf</tt>"); |
1259 |
} |
} |
1260 |
|
|
1261 |
|
// if no password, or empty password logout |
1262 |
|
if ( |
1263 |
|
isset($PHP_AUTH_USER) && ( |
1264 |
|
!isset($relogin) || ( |
1265 |
|
isset($relogin) && $relogin != md5($PHP_AUTH_USER.$PHP_AUTH_PW) |
1266 |
|
) |
1267 |
|
) && ( |
1268 |
|
$PHP_AUTH_PW == "" || !isset($PHP_AUTH_PW) |
1269 |
|
) && !isset($force_login) |
1270 |
|
) { |
1271 |
|
StartHTML("Logout completed","Your login credentials has been erased") ; |
1272 |
|
EndHTML() ; |
1273 |
|
exit ; |
1274 |
|
} |
1275 |
|
|
1276 |
// authentication failure |
// authentication failure |
1277 |
if ( md5($PHP_AUTH_USER.$PHP_AUTH_PW) != $gblPw || |
if ( md5($PHP_AUTH_USER.$PHP_AUTH_PW) != $gblPw || |
1278 |
isset($relogin) && $gblPw == $relogin ) { |
isset($relogin) && $gblPw == $relogin) { |
1279 |
header("WWW-authenticate: basic realm=\"$HTTP_HOST\"") ; |
$realm="$HTTP_HOST"; |
1280 |
|
header("WWW-authenticate: basic realm=\"$realm\"") ; |
1281 |
header("HTTP/1.0 401 Unauthorized") ; |
header("HTTP/1.0 401 Unauthorized") ; |
1282 |
NoEntry() ; |
NoEntry() ; |
1283 |
exit ; |
exit ; |
1500 |
// $A=Co : checkout file $D/$F |
// $A=Co : checkout file $D/$F |
1501 |
// $A=Ci : checkin file $D/$F |
// $A=Ci : checkin file $D/$F |
1502 |
// $A=V : view file (do nothing except log) |
// $A=V : view file (do nothing except log) |
1503 |
|
// $A=I : include file .$F.php from $gblFsRoot |
1504 |
// default : display directory $D |
// default : display directory $D |
1505 |
|
|
1506 |
switch ($A) { |
switch ($A) { |
1560 |
DisplayChangeLog(1); |
DisplayChangeLog(1); |
1561 |
EndHTML() ; |
EndHTML() ; |
1562 |
exit; |
exit; |
1563 |
|
case "I" : |
1564 |
|
$F=stripSlashes($F); |
1565 |
|
$inc_file="${gblFsRoot}/.${F}.php"; |
1566 |
|
if (!isset($F) || $F == "" || !file_exists($inc_file)) Error("Fatal error $inc_file"); // can't find file to include |
1567 |
|
if (!is_readable($inc_file)) |
1568 |
|
Error("Read access to include file denied",".${F}.php"); |
1569 |
|
$text = "Your include file should define \$text variable which holds this text and \$title variable which is page title"; |
1570 |
|
$title = "You should define \$title variable with page title"; |
1571 |
|
include($inc_file); |
1572 |
|
StartHTML($title, $text) ; |
1573 |
|
print "<p>".GifIcon(up)." Back to <a href=$GLOBALS[PHP_SELF]>front page</a>.</p>"; |
1574 |
|
EndHTML() ; |
1575 |
|
exit ; |
1576 |
} |
} |
1577 |
|
|
1578 |
// default: display directory $relDir |
// default: display directory $relDir |