/[docman]/docman.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /docman.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.48 by dpavlin, Fri Dec 14 16:58:27 2001 UTC revision 1.56 by dpavlin, Thu Jan 24 09:09:12 2002 UTC
# Line 133  TODO: Line 133  TODO:
133    
134  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
135    
136          $gblVersion = "1.8-dev";          $gblVersion = "1.9-dev";
137    
138  function StartHTML($title,$text="") {  function StartHTML($title,$text="") {
139    
# Line 174  global $gblDateFmt, $gblTimeFmt, $gblUse Line 174  global $gblDateFmt, $gblTimeFmt, $gblUse
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  &copy; 1999 by <A HREF="http://www.anyportal.com">ANYPORTAL</A>,  &copy; 1999 by <A HREF="http://www.anyportal.com">ANYPORTAL</A>,
198  &copy; 2000 by <A HREF="http://da.nger.org">d@nger.org</A>,  &copy; 2000 by <A HREF="http://da.nger.org">d@nger.org</A>,
199  &copy; 2000 by <A HREF="http://www.rot13.org/~dpavlin/">DbP</A>  &copy; 2000-2002 by <A HREF="http://www.rot13.org/~dpavlin/">DbP</A>
200  </small>  </small>
201  </P>  </P>
202  <BR>  <BR>
# Line 701  function Navigate($fsRoot,$relDir) { Line 716  function Navigate($fsRoot,$relDir) {
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  ?>  ?>
# Line 950  function NoEntry() { Line 965  function NoEntry() {
965    
966          $title = "(401 Unauthorized)" ;          $title = "(401 Unauthorized)" ;
967          $text  = "No trespassing !" ;          $text  = "No trespassing !" ;
968    
969            global $PHP_AUTH_USER,$PHP_AUTH_PW,$gblPw,$relogin;
970          StartHTML($title,$text) ;          StartHTML($title,$text) ;
971    
972          EndHTML() ;          EndHTML() ;
# Line 1158  function DisplayChangeLog($day) { Line 1175  function DisplayChangeLog($day) {
1175          $log=fopen("$gblFsRoot/.changelog","r");          $log=fopen("$gblFsRoot/.changelog","r");
1176          $logarr = array();          $logarr = array();
1177          while($line = fgetcsv($log,512,"\t")) {          while($line = fgetcsv($log,512,"\t")) {
                 $line[0] .= sizeof($line);  
1178                  while (sizeof($line) > 4) {                  while (sizeof($line) > 4) {
1179                          $tmp = array_pop($line);                          $tmp = array_pop($line);
1180                          $line.=" $tmp";                          $line.=" $tmp";
# Line 1205  function Download($path) { Line 1221  function Download($path) {
1221    
1222  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
1223    
1224    function chopsl($path) {
1225            if (substr($path,strlen($path)-1,1) == "/") $path=substr($path,0,strlen($path)-1);
1226            $path=str_replace("//","/",$path);
1227            return $path;
1228    }
1229    
1230    //////////////////////////////////////////////////////////////////
1231  // MAIN PROGRAM  // MAIN PROGRAM
1232  // ============  // ============
1233  // query parameters: capital letters  // query parameters: capital letters
# Line 1219  function Download($path) { Line 1242  function Download($path) {
1242    
1243          // forks before authentication: style sheet and hash          // forks before authentication: style sheet and hash
1244          // creation if password not yet set.          // creation if password not yet set.
1245          if ($STYLE == "get") { CSS() ; exit ; }          if (isset($STYLE) && $STYLE == "get") { CSS() ; exit ; }
1246    
1247          $fsScriptDir  = dirname($SCRIPT_FILENAME) ;              $fsScriptDir  = dirname($SCRIPT_FILENAME) ;    
1248          // i.e. /home/httpd/html/docman          // i.e. /home/httpd/html/docman
# Line 1236  function Download($path) { Line 1259  function Download($path) {
1259                  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>");
1260          }          }
1261    
1262            // if no password, or empty password logout
1263            if (
1264                    isset($PHP_AUTH_USER) && (
1265                            !isset($relogin) || (
1266                                    isset($relogin) && $relogin != md5($PHP_AUTH_USER.$PHP_AUTH_PW)
1267                            )
1268                    ) && (
1269                            $PHP_AUTH_PW == "" || !isset($PHP_AUTH_PW)
1270                    ) && !isset($force_login)
1271               ) {
1272                    StartHTML("Logout completed","Your login credentials has been erased") ;
1273                    EndHTML() ;
1274                    exit ;
1275            }
1276    
1277          // authentication failure          // authentication failure
1278          if ( md5($PHP_AUTH_USER.$PHP_AUTH_PW) != $gblPw ||          if ( md5($PHP_AUTH_USER.$PHP_AUTH_PW) != $gblPw ||
1279                  isset($relogin) && $gblPw == $relogin ) {                  isset($relogin) && $gblPw == $relogin) {
1280                  header("WWW-authenticate: basic realm=\"$HTTP_HOST\"") ;                  $realm="$HTTP_HOST";
1281                    header("WWW-authenticate: basic realm=\"$realm\"") ;
1282                  header("HTTP/1.0 401 Unauthorized") ;                  header("HTTP/1.0 401 Unauthorized") ;
1283                  NoEntry() ;                  NoEntry() ;
1284                  exit ;                  exit ;
# Line 1462  function Download($path) { Line 1501  function Download($path) {
1501          // $A=Co : checkout file $D/$F          // $A=Co : checkout file $D/$F
1502          // $A=Ci : checkin file $D/$F          // $A=Ci : checkin file $D/$F
1503          // $A=V : view file (do nothing except log)          // $A=V : view file (do nothing except log)
1504            // $A=I : include file .$F.php from $gblFsRoot
1505          // default : display directory $D          // default : display directory $D
1506    
1507          switch ($A) {          switch ($A) {
# Line 1521  function Download($path) { Line 1561  function Download($path) {
1561                  DisplayChangeLog(1);                  DisplayChangeLog(1);
1562                  EndHTML() ;                  EndHTML() ;
1563                  exit;                  exit;
1564            case "I" :
1565                    $F=stripSlashes($F);
1566                    $inc_file="${gblFsRoot}/.${F}.php";
1567                    if (!isset($F) || $F == "" || !file_exists($inc_file)) Error("Fatal error $inc_file"); // can't find file to include
1568                    if (!is_readable($inc_file))
1569                            Error("Read access to include file denied",".${F}.php");
1570                    $text  = "Your include file should define \$text variable which holds this text and \$title variable which is page title";
1571                    $title = "You should define \$title variable with page title";
1572                    include($inc_file);
1573                    StartHTML($title, $text) ;
1574                    print "<p>".GifIcon(up)." Back to <a href=$GLOBALS[PHP_SELF]>front page</a>.</p>";
1575                    EndHTML() ;
1576                    exit ;
1577          }          }
1578    
1579          // default: display directory $relDir          // default: display directory $relDir

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.56

  ViewVC Help
Powered by ViewVC 1.1.26