/[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.2 by dpavlin, Thu Jul 25 21:16:08 2002 UTC revision 1.3 by dpavlin, Sat Jul 27 14:45:30 2002 UTC
# Line 87  Line 87 
87          $realm="$HTTP_HOST";    // FIX          $realm="$HTTP_HOST";    // FIX
88    
89          $fsDocumentRoot = dirname($HTTP_SERVER_VARS[SCRIPT_FILENAME]);          $fsDocumentRoot = dirname($HTTP_SERVER_VARS[SCRIPT_FILENAME]);
90          if ($fsDocumentRoot == "") Error("Configuration error","Can't get SCRIPT_FILENAME from your web server. Please set <tt>\$fsDocumentRoot</tt> in <tt>\$</tt>");          if ($fsDocumentRoot == "") Error("Configuration error","Can't get SCRIPT_FILENAME from your web server. Please set <tt>\$fsDocumentRoot</tt> in <tt>\$</tt>",1);
91    
92          // globals for later          // globals for later
93          $gblLogin = $PHP_AUTH_USER;          $gblLogin = $PHP_AUTH_USER;
# Line 166  function DetailPage($fsRoot,$relDir,$fn) Line 166  function DetailPage($fsRoot,$relDir,$fn)
166          $file_lock = CheckLock($fsPath);          $file_lock = CheckLock($fsPath);
167    
168          if (!$editable && !$exists)          if (!$editable && !$exists)
169                  Error(_("Creation unsupported for type"),$relPath) ;                  Error("Creation unsupported for type",$relPath) ;
170          if (!exists && !is_writeable($fsDir) )          if (!exists && !is_writeable($fsDir) )
171                  Error(_("Creation denied"),$relDir) ;                  Error("Creation denied",$relDir) ;
172    
173          $text  = _("Use this page to view, modify or ") ;          $text  = _("Use this page to view, modify or ") ;
174          if (is_dir($fsPath)) {          if (is_dir($fsPath)) {
# Line 930  you must upgrade to an RFC1867-compliant Line 930  you must upgrade to an RFC1867-compliant
930    
931  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
932    
933  function Error($title,$text="") {  // Error with sysadmin flag are reported to error_log or hidden from
934          StartHTML("(".$title.")",$text) ;  // users
935          echo "<P ALIGN=center>Hit your Browser's Back Button.</P>" ;  
936          EndHTML() ;  function Error($title,$text="",$sysadmin=0) {
937            global $gblSeparateAdminMessages,
938                    $gblMailAdminMessages,$realm,
939                    $HTTP_SERVER_VARS;
940            if ($sysadmin) {
941                    if ($gblSeparateAdminMessages) {
942                            $user="Your administrator ";
943                            if ($gblMailAdminMessages) {
944                                    mail($HTTP_SERVER_VARS["SERVER_ADMIN"], "docman $realm error message: $title", strip_tags($text));
945                                    $user.="<tt>".$HTTP_SERVER_VARS["SERVER_ADMIN"]."</tt> ";
946                            }
947                            $user.="has been notified about error" ;
948                            StartHTML("($title)",$user);
949                            echo "<P ALIGN=center>Hit your Browser's Back Button.</P>" ;
950                            EndHTML();
951                            error_log("docman $realm: ".strip_tags($text));
952                    } else {
953                            StartHTML("ADMIN: ".$title,$text) ;
954                            echo "<P ALIGN=center>Hit your Browser's Back Button.</P>" ;
955                            EndHTML();
956                    }
957            } else {
958                    StartHTML("(".$title.")",$text) ;
959                    echo "<P ALIGN=center>Hit your Browser's Back Button.</P>" ;
960                    EndHTML() ;
961            }
962          exit ;          exit ;
963  } // end function Error  } // end function Error
964    
 //////////////////////////////////////////////////////////////////  
   
965  function LogIt($target,$msg, $changelog=0) {  function LogIt($target,$msg, $changelog=0) {
966    
967          $dir=dirname($target);          $dir=dirname($target);
968          if (! file_exists($dir."/.log")) {          if (! file_exists($dir."/.log")) {
969                  if (! @mkdir($dir."/.log",0700)) Error("docman installation problem","can't create log directory <tt>$dir/.log</tt>");                  if (! @mkdir($dir."/.log",0700)) Error("docman installation problem","can't create log directory <tt>$dir/.log</tt>",1);
970          }          }
971          $file=basename($target);          $file=basename($target);
972    
# Line 1267  if (! file_exists($trustee_conf)) { Line 1290  if (! file_exists($trustee_conf)) {
1290          $groups_arr = array();          $groups_arr = array();
1291          $perm_arr = array();          $perm_arr = array();
1292    
         $error=0;  
   
1293          $tr_arr = array();          $tr_arr = array();
1294    
1295          while (! feof($fp_conf)) {          while (! feof($fp_conf)) {
# Line 1336  if (! file_exists($trustee_conf)) { Line 1357  if (! file_exists($trustee_conf)) {
1357  }  }
1358    
1359  if ($error) {  if ($error) {
1360          Error("Trustee error",$error);          Error("Trustee error",$error,1);
1361  } else {  } else {
1362          include("$trustee_php");          include("$trustee_php");
1363  }  }
# Line 1484  print " return: $return<br>\n"; Line 1505  print " return: $return<br>\n";
1505                  exit ;                  exit ;
1506          }          }
1507    
1508            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);
1509    
1510          // trustee (ACL) file configuration          // trustee (ACL) file configuration
1511          $trustee_conf="$gblIncDir/realm/$realm.trustee";          $trustee_conf="$gblIncDir/realm/$realm.trustee";
1512          // compiled version of trustee file          // compiled version of trustee file
# Line 1803  print " return: $return<br>\n"; Line 1826  print " return: $return<br>\n";
1826          Navigate($gblFsRoot,$relDir) ;            Navigate($gblFsRoot,$relDir) ;  
1827          exit ;          exit ;
1828    
1829          Error("Whooah!","By cartesian logic, this never happens") ;          Error("Whooah!","By cartesian logic, this never happens",1) ;
1830  ?>  ?>

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26