78 |
// from where to include auth_*.php modules? |
// from where to include auth_*.php modules? |
79 |
$gblIncDir = "/home/httpd/docman"; |
$gblIncDir = "/home/httpd/docman"; |
80 |
|
|
81 |
|
// do we want to force download? (default is 0 for backward |
82 |
|
// compatibility, but it's defined as 1 in docman.conf for all |
83 |
|
// future applications! |
84 |
|
$gblForceDownload = 0; |
85 |
|
|
86 |
// username/password should not be system |
// username/password should not be system |
87 |
// usernames/passwords !! |
// usernames/passwords !! |
88 |
|
|
133 |
|
|
134 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
135 |
|
|
136 |
|
$gblVersion = "1.8-dev"; |
137 |
|
|
138 |
function StartHTML($title,$text="") { |
function StartHTML($title,$text="") { |
139 |
|
|
140 |
$title = "Document Manager " . $title ; |
$title = "Document Manager " . $title ; |
145 |
<HTML> |
<HTML> |
146 |
<HEAD> |
<HEAD> |
147 |
<TITLE><?= $host . " " . $title ?></TITLE> |
<TITLE><?= $host . " " . $title ?></TITLE> |
148 |
<META NAME="description" CONTENT="PHP port of AnyPortal Site Manager"> |
<META NAME="description" CONTENT="Document Manager"> |
149 |
<META NAME="keywords" CONTENT="site manager, web site maintenance"> |
<META NAME="keywords" CONTENT="site manager, web site maintenance"> |
150 |
<META NAME="robots" CONTENT="noindex"> |
<META NAME="robots" CONTENT="noindex"> |
151 |
<META HTTP-EQUIV="expires" CONTENT="0"> |
<META HTTP-EQUIV="expires" CONTENT="0"> |
164 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
165 |
|
|
166 |
function EndHTML() { |
function EndHTML() { |
167 |
|
|
168 |
|
global $gblDateFmt, $gblTimeFmt, $gblUserName, $PHP_SELF, $gblPw, $gblVersion; |
169 |
|
|
170 |
?> |
?> |
171 |
|
|
172 |
<HR> |
<HR> |
173 |
<P CLASS=FTR> |
<P CLASS=FTR> |
174 |
<B><?= date($GLOBALS[gblDateFmt]) ?> - |
<B><?= date($gblDateFmt) ?> - |
175 |
<?= date($GLOBALS[gblTimeFmt]) ?> - |
<?= date($gblTimeFmt) ?> - |
176 |
<?= $GLOBALS[gblUserName] ?> |
<?= $gblUserName ?> |
177 |
<small> [<a href="<?= $GLOBALS["PHP_SELF"] ?>?relogin=<?= $GLOBALS[gblPw] ?>">logout</a>]</small> |
<small> [<a href="<?= $PHP_SELF ?>?relogin=<?= $gblPw ?>">logout</a>]</small> |
178 |
</B> |
</B> |
179 |
<BR>ANYPORTAL(php) Site Manager |
<BR><small> |
180 |
<br><small> |
Document Manager <?= $gblVersion ?>, based on ANYPORTAL(php) Site Manager |
181 |
|
<br> |
182 |
© 1999 by <A HREF="http://www.anyportal.com">ANYPORTAL</A>, |
© 1999 by <A HREF="http://www.anyportal.com">ANYPORTAL</A>, |
183 |
© 2000 by <A HREF="http://da.nger.org">d@nger.org</A>, |
© 2000 by <A HREF="http://da.nger.org">d@nger.org</A>, |
184 |
© 2000 by <A HREF="http://www.rot13.org/~dpavlin/">DbP</A> |
© 2000 by <A HREF="http://www.rot13.org/~dpavlin/">DbP</A> |
371 |
$log=fopen($logname,"r"); |
$log=fopen($logname,"r"); |
372 |
$cl1=" class=LST"; $cl2=""; |
$cl1=" class=LST"; $cl2=""; |
373 |
$logarr = array(); |
$logarr = array(); |
374 |
while($line = fgetcsv($log,255,"\t")) { |
while($line = fgetcsv($log,512,"\t")) { |
375 |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
376 |
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])); |
377 |
} |
} |
680 |
// scan deleted files |
// scan deleted files |
681 |
if ( $GLOBALS[show_deleted] == 1 && ($dir = @opendir("$fsDir/.del")) ) { |
if ( $GLOBALS[show_deleted] == 1 && ($dir = @opendir("$fsDir/.del")) ) { |
682 |
while ($item = readdir($dir)) { |
while ($item = readdir($dir)) { |
683 |
if ( substr($item,0,1) == "." ) continue ; |
if ( substr($item,0,1) == "." || strstr($hide_items,",$item,") ) continue ; |
684 |
$fileList[] = ".del/$item" ; |
$fileList[] = ".del/$item" ; |
685 |
} |
} |
686 |
closedir($dir) ; |
closedir($dir) ; |
701 |
CELLSPACING=3 WIDTH=\"100%\">" ; |
CELLSPACING=3 WIDTH=\"100%\">" ; |
702 |
|
|
703 |
// updir bar |
// updir bar |
704 |
if ($fsDir != $fsRoot) { |
if (chopsl($fsDir) != chopsl($fsRoot)) { |
705 |
$parent = dirname($relDir) ; |
$parent = dirname($relDir) ; |
706 |
if ($parent == "") $parent = "/" ; |
if ($parent == "") $parent = "/" ; |
707 |
?> |
?> |
849 |
<? |
<? |
850 |
} |
} |
851 |
|
|
852 |
if ($emptyDir) { |
if ($emptyDir && $relDir != "") { |
853 |
?> |
?> |
854 |
|
|
855 |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
<FORM METHOD="POST" ACTION="<?= $self ?>"> |
1145 |
$log=fopen("$gblFsRoot/.changelog","a+"); |
$log=fopen("$gblFsRoot/.changelog","a+"); |
1146 |
if (substr($target,0,strlen($gblFsRoot)) == $gblFsRoot) |
if (substr($target,0,strlen($gblFsRoot)) == $gblFsRoot) |
1147 |
$target=substr($target,strlen($gblFsRoot),strlen($target)-strlen($gblFsRoot)); |
$target=substr($target,strlen($gblFsRoot),strlen($target)-strlen($gblFsRoot)); |
1148 |
|
$msg=str_replace("\t"," ",$msg); |
1149 |
fputs($log,time()."\t$target\t$GLOBALS[gblUserName]\t$msg\n"); |
fputs($log,time()."\t$target\t$GLOBALS[gblUserName]\t$msg\n"); |
1150 |
fclose($log); |
fclose($log); |
1151 |
|
|
1157 |
if (!file_exists("$gblFsRoot/.changelog")) return; |
if (!file_exists("$gblFsRoot/.changelog")) return; |
1158 |
$log=fopen("$gblFsRoot/.changelog","r"); |
$log=fopen("$gblFsRoot/.changelog","r"); |
1159 |
$logarr = array(); |
$logarr = array(); |
1160 |
while($line = fgetcsv($log,255,"\t")) { |
while($line = fgetcsv($log,512,"\t")) { |
1161 |
|
$line[0] .= sizeof($line); |
1162 |
|
while (sizeof($line) > 4) { |
1163 |
|
$tmp = array_pop($line); |
1164 |
|
$line.=" $tmp"; |
1165 |
|
} |
1166 |
if ($day!=1 || ($day==1 && (time()-$line[0] < 24*60*60))) { |
if ($day!=1 || ($day==1 && (time()-$line[0] < 24*60*60))) { |
1167 |
array_unshift($logarr,array($line[0],$line[1],$line[2],$line[3])); |
array_unshift($logarr,array($line[0],$line[1],$line[2],$line[3])); |
1168 |
} |
} |
1184 |
|
|
1185 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1186 |
|
|
1187 |
|
function Download($path) { |
1188 |
|
global $HTTP_USER_AGENT; |
1189 |
|
$file=basename($path); |
1190 |
|
$size = filesize($path); |
1191 |
|
//header("Content-Type: application/octet-stream"); |
1192 |
|
header("Content-Type: application/force-download"); |
1193 |
|
header("Content-Length: $size"); |
1194 |
|
// IE5.5 just downloads index.php if we don't do this |
1195 |
|
if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT)) { |
1196 |
|
header("Content-Disposition: filename=$file"); |
1197 |
|
} else { |
1198 |
|
header("Content-Disposition: attachment; filename=$file"); |
1199 |
|
} |
1200 |
|
header("Content-Transfer-Encoding: binary"); |
1201 |
|
$fh = fopen($path, "r"); |
1202 |
|
fpassthru($fh); |
1203 |
|
} |
1204 |
|
|
1205 |
|
|
1206 |
|
////////////////////////////////////////////////////////////////// |
1207 |
|
|
1208 |
|
function chopsl($path) { |
1209 |
|
if (substr($path,strlen($path)-1,1) == "/") $path=substr($path,0,strlen($path)-1); |
1210 |
|
$path=str_replace("//","/",$path); |
1211 |
|
return $path; |
1212 |
|
} |
1213 |
|
|
1214 |
|
////////////////////////////////////////////////////////////////// |
1215 |
// MAIN PROGRAM |
// MAIN PROGRAM |
1216 |
// ============ |
// ============ |
1217 |
// query parameters: capital letters |
// query parameters: capital letters |
1469 |
// $A=Co : checkout file $D/$F |
// $A=Co : checkout file $D/$F |
1470 |
// $A=Ci : checkin file $D/$F |
// $A=Ci : checkin file $D/$F |
1471 |
// $A=V : view file (do nothing except log) |
// $A=V : view file (do nothing except log) |
1472 |
|
// $A=I : include file .$F.php from $gblFsRoot |
1473 |
// default : display directory $D |
// default : display directory $D |
1474 |
|
|
1475 |
switch ($A) { |
switch ($A) { |
1496 |
case "Co" : |
case "Co" : |
1497 |
// checkout |
// checkout |
1498 |
Lock("$gblFsRoot/$relDir/$F"); |
Lock("$gblFsRoot/$relDir/$F"); |
1499 |
header("Content-Disposition: attachment; filename=$F" ); |
Download("$gblFsRoot/$relDir/$F"); |
|
Header("Location: $webRoot".urlpath("$relDir/$F")); |
|
1500 |
exit; |
exit; |
1501 |
case "Ci" : |
case "Ci" : |
1502 |
$F=stripSlashes($F); |
$F=stripSlashes($F); |
1512 |
case "V" : |
case "V" : |
1513 |
// view |
// view |
1514 |
LogIt("$gblFsRoot/$relDir/$F","viewed"); |
LogIt("$gblFsRoot/$relDir/$F","viewed"); |
1515 |
header("Content-Disposition: attachment; filename=$F" ); |
if ($gblForceDownload) { |
1516 |
Header("Location: $webRoot".urlpath("$relDir/$F")); |
Download("$gblFsRoot/$relDir/$F"); |
1517 |
|
} else { |
1518 |
|
header("Content-Disposition: attachment; filename=$F" ); |
1519 |
|
Header("Location: $webRoot".urlpath("$relDir/$F")); |
1520 |
|
} |
1521 |
exit; |
exit; |
1522 |
case "Ch" : |
case "Ch" : |
1523 |
StartHTML("(File changes)","All changes chronologicaly..."); |
StartHTML("(File changes)","All changes chronologicaly..."); |
1529 |
DisplayChangeLog(1); |
DisplayChangeLog(1); |
1530 |
EndHTML() ; |
EndHTML() ; |
1531 |
exit; |
exit; |
1532 |
|
case "I" : |
1533 |
|
$F=stripSlashes($F); |
1534 |
|
$inc_file="${gblFsRoot}/.${F}.php"; |
1535 |
|
if (!isset($F) || $F == "" || !file_exists($inc_file)) Error("Fatal error $inc_file"); // can't find file to include |
1536 |
|
if (!is_readable($inc_file)) |
1537 |
|
Error("Read access to include file denied",".${F}.php"); |
1538 |
|
$text = "Your include file should define \$text variable which holds this text and \$title variable which is page title"; |
1539 |
|
$title = "You should define \$title variable with page title"; |
1540 |
|
include($inc_file); |
1541 |
|
StartHTML($title, $text) ; |
1542 |
|
print "<p>".GifIcon(up)." Back to <a href=$GLOBALS[PHP_SELF]>front page</a>.</p>"; |
1543 |
|
EndHTML() ; |
1544 |
|
exit ; |
1545 |
} |
} |
1546 |
|
|
1547 |
// default: display directory $relDir |
// default: display directory $relDir |