/[docman2]/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.7 by dpavlin, Sat Jul 27 19:45:28 2002 UTC revision 1.12 by dpavlin, Sat Jul 27 22:26:30 2002 UTC
# Line 118  function StartHTML($title,$text="") { Line 118  function StartHTML($title,$text="") {
118          if (file_exists("$fsDocumentRoot/docman.css")) {          if (file_exists("$fsDocumentRoot/docman.css")) {
119                  $css=dirname($self)."/docman.css";                  $css=dirname($self)."/docman.css";
120          } else {          } else {
121                  $css=$self."?STYLE=get&css=$css";                  $css=$self."?STYLE=get";
122          }          }
123    
124          include("$html/head.html");          include("$html/head.html");
# Line 571  function GifIcon($txt) { Line 571  function GifIcon($txt) {
571  function Navigate($fsRoot,$relDir) {  function Navigate($fsRoot,$relDir) {
572    
573          global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide,          global $gblEditable, $gblIcon, $gblModDays, $webRoot, $gblHide,
574                  $gblIgnoreUnknownFileType,                  $gblIgnoreUnknownFileType, $gblRepositoryDir,
575                    $fsRealmDir, $realm, $realm_sep,
576                  $HTTP_GET_VARS, $html, $realm_config;                  $HTTP_GET_VARS, $html, $realm_config;
577    
578          $self     = $HTTP_SERVER_VARS["PHP_SELF"] ;          $self     = $HTTP_SERVER_VARS["PHP_SELF"] ;
# Line 859  function Navigate($fsRoot,$relDir) { Line 860  function Navigate($fsRoot,$relDir) {
860  <TR><TD></TD><TD COLSPAN=5><HR></TD></TR>  <TR><TD></TD><TD COLSPAN=5><HR></TD></TR>
861    
862  <?  <?
863  if (file_exists(".info.inc")) {  
864    if (file_exists("$fsRealmDir/$realm".$realm_sep."info.inc")) {
865            print "<TR><TD></TD><TD COLSPAN=5>";
866            include("$fsRealmDir/$realm".$realm_sep."info.inc");
867            print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>";
868    } elseif (file_exists("$gblRepositoryDir/.info.inc")) {
869          print "<TR><TD></TD><TD COLSPAN=5>";          print "<TR><TD></TD><TD COLSPAN=5>";
870          include(".info.inc");          include("$gblRepositoryDir/.info.inc");
871          print "</TD></TR>          print "</TD></TR><TR><TD></TD><TD COLSPAN=5><HR></TD></TR>";
         <TR><TD></TD><TD COLSPAN=5><HR></TD></TR>";  
872  }  }
873    
874    
875  ?>  ?>
876    
877  <FORM METHOD="POST" ACTION="<?= $self ?>">  <FORM METHOD="POST" ACTION="<?= $self ?>">
# Line 903  function UploadPage($fsRoot, $relDir, $f Line 910  function UploadPage($fsRoot, $relDir, $f
910  // Error with sysadmin flag are reported to error_log or hidden from  // Error with sysadmin flag are reported to error_log or hidden from
911  // users  // users
912    
913  function Error($title,$text="",$sysadmin=0) {  function Error($title,$text="",$sysadmin=0,$no_404=0) {
914          global $gblSeparateAdminMessages,          global $gblSeparateAdminMessages,
915                  $gblMailAdminMessages,$realm,                  $gblMailAdminMessages,$realm,
916                  $HTTP_SERVER_VARS;                  $HTTP_SERVER_VARS;
917          if (! headers_sent()) header("HTTP/1.0 404 Not Found");          if (! headers_sent() && ! $no_404) header("HTTP/1.0 404 Not Found");
918          if ($sysadmin) {          if ($sysadmin) {
919                  if ($gblSeparateAdminMessages) {                  if ($gblSeparateAdminMessages) {
920                          $user="Your administrator ";                          $user="Your administrator ";
# Line 1076  function safe_rename($fromdir,$fromfile, Line 1083  function safe_rename($fromdir,$fromfile,
1083          function try_rename($from,$to) {          function try_rename($from,$to) {
1084  #               print "$from -> $to\n";  #               print "$from -> $to\n";
1085                  if (file_exists($from) && is_writeable(dirname($to))) {                  if (file_exists($from) && is_writeable(dirname($to))) {
1086                          rename($from,$to);                          return rename($from,$to);
1087                    } else {
1088                            return 0;
1089                  }                  }
1090          }          }
1091    
1092          function try_dir($todir) {          function try_dir($todir) {
1093                  if (! file_exists($todir)) {                  if (! file_exists($todir)) {
1094                          mkdir($todir,0700);                          @mkdir($todir,0700);
1095                  }                  }
1096          }          }
1097    
# Line 1092  function safe_rename($fromdir,$fromfile, Line 1101  function safe_rename($fromdir,$fromfile,
1101    
1102  #       print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n";  #       print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n";
1103    
1104          try_rename("$fromdir/$fromfile","$todir/$tofile");          if (! try_rename("$fromdir/$fromfile","$todir/$tofile")) Error("Rename error","Can't rename file <tt>$fromfile</tt> to <tt>$tofile</tt>",1);
1105          try_dir("$todir/.log");          try_dir("$todir/.log");
1106          try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile");          try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile");
1107          try_dir("$todir/.note");          try_dir("$todir/.note");
# Line 1472  function readMime() { Line 1481  function readMime() {
1481          $gblFilePerms = 0640 ;         // default for new files          $gblFilePerms = 0640 ;         // default for new files
1482          $gblDirPerms  = 0750 ;          // default for new dirs          $gblDirPerms  = 0750 ;          // default for new dirs
1483    
1484            $STYLE = $HTTP_GET_VARS[STYLE];
1485          if (isset($STYLE) && $STYLE == "get") {          if (isset($STYLE) && $STYLE == "get") {
1486                  include("$html/docman.css");                  include("$html/docman.css");
1487                  exit;                  exit;
# Line 1490  function readMime() { Line 1500  function readMime() {
1500          if (! isset($fsRealmDir)) {          if (! isset($fsRealmDir)) {
1501                  $fsRealmDir = "$gblIncDir/realm";                  $fsRealmDir = "$gblIncDir/realm";
1502          }          }
1503          $realm_config = "$fsRealmDir/$realm.conf";  
1504            // try to add dir to script name to realm var
1505            if (is_dir("$fsRealmDir/$realm/".dirname($HTTP_SERVER_VARS[SCRIPT_NAME]))) {
1506                    $realm .= "/".dirname($HTTP_SERVER_VARS[SCRIPT_NAME]);
1507                    $realm_sep = "/";
1508            } else {
1509                    $realm_sep = ".";
1510            }
1511    
1512            $realm_config = $fsRealmDir."/".$realm.$realm_sep."conf";
1513    
1514          // read user-defined configuration          // read user-defined configuration
1515          if (file_exists($realm_config)) {          if (file_exists($realm_config)) {
# Line 1526  function readMime() { Line 1545  function readMime() {
1545          if (!is_dir($gblRepositoryDir)) Error("Repository dir not found","Can't find repository directory <tt>$gblRepositoryDir</tt>. Please fix that in <tt>$realm_config</tt> variable <tt>\$gblRepositoryDir</tt>.",1);          if (!is_dir($gblRepositoryDir)) Error("Repository dir not found","Can't find repository directory <tt>$gblRepositoryDir</tt>. Please fix that in <tt>$realm_config</tt> variable <tt>\$gblRepositoryDir</tt>.",1);
1546    
1547          // trustee (ACL) file configuration          // trustee (ACL) file configuration
1548          $trustee_conf="$gblIncDir/realm/$realm.trustee";          $trustee_conf="$fsRealmDir/$realm".$realm_sep."trustee";
1549          // compiled version of trustee file          // compiled version of trustee file
1550          $trustee_php="$gblRepositoryDir/.trustee.php";          $trustee_php="$gblRepositoryDir/.trustee.php";
1551          // get ACL informations          // get ACL informations
# Line 1547  function readMime() { Line 1566  function readMime() {
1566                  isset($relogin) && $secHash == $relogin) {                  isset($relogin) && $secHash == $relogin) {
1567                  header("WWW-authenticate: basic realm=\"$realm\"") ;                  header("WWW-authenticate: basic realm=\"$realm\"") ;
1568                  header("HTTP/1.0 401 Unauthorized") ;                  header("HTTP/1.0 401 Unauthorized") ;
1569                  Error("401 Unauthorized","No trespassing !");                  Error("401 Unauthorized","No trespassing !",0,1);
1570          }          }
1571    
1572          // read mime.types          // read mime.types
# Line 1618  function readMime() { Line 1637  function readMime() {
1637                  if (strstr($FILENAME,"/"))                  if (strstr($FILENAME,"/"))
1638                          Error("Upload error","Non-conforming filename. Filename <tt>$FILENAME</tt> has slashes (<tt>/</tt>) in it.") ;                          Error("Upload error","Non-conforming filename. Filename <tt>$FILENAME</tt> has slashes (<tt>/</tt>) in it.") ;
1639                  if (! isset($FILENAME)) {       // from update file                  if (! isset($FILENAME)) {       // from update file
1640                          $target = "$fsDir/".basename($FN_name);                          $target = "$fsDir/".basename($FN);
1641                  } else {                  } else {
1642                          $target = "$fsDir/$FILENAME";                          $target = "$fsDir/$FILENAME";
1643                  }                  }
# Line 1751  function readMime() { Line 1770  function readMime() {
1770          case "RENAME" :            case "RENAME" :  
1771                  if ( $CONFIRM != "on" ) break ;                  if ( $CONFIRM != "on" ) break ;
1772    
1773                    $NEWNAME=stripSlashes($HTTP_POST_VARS["NEWNAME"]);
1774                  LogIt("$fsDir/$FN","renamed $FN to $NEWNAME",trperm_r);                  LogIt("$fsDir/$FN","renamed $FN to $NEWNAME",trperm_r);
1775                  safe_rename($fsDir,$FN,$NEWNAME);                  safe_rename($fsDir,$FN,$NEWNAME);
1776                  break ;                  break ;
1777    
1778          case "NOTE" :            case "NOTE" :  
1779                    $NOTE=stripSlashes($HTTP_POST_VARS["NOTE"]);
1780                  WriteNote("$fsDir/$FN","$NOTE");                  WriteNote("$fsDir/$FN","$NOTE");
1781                  break ;                  break ;
1782    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.26