/[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.13 by dpavlin, Sun Jul 28 11:39:59 2002 UTC revision 1.16 by dpavlin, Sun Jul 28 13:57:13 2002 UTC
# Line 582  function Navigate($fsRoot,$relDir) { Line 582  function Navigate($fsRoot,$relDir) {
582                    
583          $self     = $HTTP_SERVER_VARS["PHP_SELF"] ;          $self     = $HTTP_SERVER_VARS["PHP_SELF"] ;
584    
         if ($relDir == "") $relDir = "/";  
   
585          $fsDir = $fsRoot.$relDir."/";   // current directory          $fsDir = $fsRoot.$relDir."/";   // current directory
586    
587          if (!is_dir($fsDir)) Error("Dir not found",$relDir,1) ;          if (!is_dir($fsDir)) Error("Dir not found",$relDir,1) ;
# Line 904  function UploadPage($fsRoot, $relDir, $f Line 902  function UploadPage($fsRoot, $relDir, $f
902          global $html, $HTTP_SERVER_VARS;          global $html, $HTTP_SERVER_VARS;
903    
904          $self = $HTTP_SERVER_VARS["PHP_SELF"] ;          $self = $HTTP_SERVER_VARS["PHP_SELF"] ;
         if ($relDir == "") $relDir = "/" ;  
   
905          include("$html/UploadPage.html");          include("$html/UploadPage.html");
906    
907  } // end function UploadPage  } // end function UploadPage
# Line 1375  return 1; Line 1371  return 1;
1371  }//init_trustee  }//init_trustee
1372    
1373  function in_group($user,$group) {  function in_group($user,$group) {
1374          return in_array($groups[$group],$user);          global $groups;
1375            return in_array($user,$groups[$group]);
1376  }  }
1377    
1378  // helper function  // helper function
# Line 1446  function check_perm($path,$trperm) { Line 1443  function check_perm($path,$trperm) {
1443    
1444          global $debug;          global $debug;
1445  $debug.="<br>check_perm: <tt>$path</tt> test perm ".display_trustee($perm)."<br>\n";  $debug.="<br>check_perm: <tt>$path</tt> test perm ".display_trustee($perm)."<br>\n";
1446    
1447          $return = ! $HAVE_TRUSTEE;          $return = ! $HAVE_TRUSTEE;
1448          if ($HAVE_TRUSTEE) {          if ($HAVE_TRUSTEE) {
1449                  $perm = check_trustee($gblLogin,$path);                  $perm = check_trustee($gblLogin,$path);
# Line 1523  function check_filename($file) { Line 1521  function check_filename($file) {
1521    
1522          // try to add dir to script name to realm var          // try to add dir to script name to realm var
1523          if (is_dir("$fsRealmDir/$realm/".dirname($HTTP_SERVER_VARS[SCRIPT_NAME]))) {          if (is_dir("$fsRealmDir/$realm/".dirname($HTTP_SERVER_VARS[SCRIPT_NAME]))) {
1524                  $realm .= "/".dirname($HTTP_SERVER_VARS[SCRIPT_NAME]);                  $realm .= dirname($HTTP_SERVER_VARS[SCRIPT_NAME]);
1525                  $realm_sep = "/";                  $realm_sep = "/";
1526          } else {          } else {
1527                  $realm_sep = ".";                  $realm_sep = ".";
# Line 1571  function check_filename($file) { Line 1569  function check_filename($file) {
1569          // get ACL informations          // get ACL informations
1570          $HAVE_TRUSTEE = init_trustee();          $HAVE_TRUSTEE = init_trustee();
1571    
1572            // take additional login vars
1573            $relogin = $HTTP_GET_VARS[relogin];
1574            $force_login = $HTTP_GET_VARS[force_login];
1575    
1576          if (strtolower($gblLogin) == "anonymous" || !isset($gblPasswd)) {          if (strtolower($gblLogin) == "anonymous" || !isset($gblPasswd)) {
1577                  $perm = check_trustee($gblLogin,$path);                  $perm = check_trustee("anonymous",$path);
1578                  // browsing must be explicitly allowed for root directory                  // browsing must be explicitly allowed for root directory
1579                  // of repository for anonymous user to work!                  // of repository for anonymous user to work!
1580                  if ($perm[allow] & trperm_b) {                  if ($perm[allow] & trperm_b) {
# Line 1618  function check_filename($file) { Line 1620  function check_filename($file) {
1620                  $relDir = $D;                  $relDir = $D;
1621          }          }
1622    
         if ($relDir == "/") $relDir = "" ;        
   
1623          $relScriptDir = dirname($SCRIPT_NAME) ;                  $relScriptDir = dirname($SCRIPT_NAME) ;        
1624          // i.e. /docman          // i.e. /docman
1625    
# Line 1628  function check_filename($file) { Line 1628  function check_filename($file) {
1628          // i.e. /home/httpd/repository          // i.e. /home/httpd/repository
1629    
1630          $fsDir = $gblFsRoot . $relDir ; // current directory          $fsDir = $gblFsRoot . $relDir ; // current directory
1631          if ( !is_dir($fsDir) ) Error("Dir not found",$relDir,1) ;          if ( !is_dir($fsDir) ) Error("Dir not found","Can't find <tt>$relDir</tt> which points to <tt>$fsDir</tt>",1) ;
1632    
1633          if (isset($HTTP_SERVER_VARS["HTTPS"]) && $HTTP_SERVER_VARS["HTTPS"] == "on") {          if (isset($HTTP_SERVER_VARS["HTTPS"]) && $HTTP_SERVER_VARS["HTTPS"] == "on") {
1634                  $webRoot  = "https://";                  $webRoot  = "https://";
# Line 1818  function check_filename($file) { Line 1818  function check_filename($file) {
1818          // $A=Co : checkout file $D/$F          // $A=Co : checkout file $D/$F
1819          // $A=Ci : checkin file $D/$F          // $A=Ci : checkin file $D/$F
1820          // $A=V : view file (do nothing except log)          // $A=V : view file (do nothing except log)
1821          // $A=I : include file .$F.php from $gblFsRoot          // $A=I : include file .$F.php from [$gblIncDir|realm]/include_php
1822          // default : display directory $D          // default : display directory $D
1823    
1824          switch ($A) {          switch ($A) {
1825          case "U" :          case "U" :
1826                  // upload to $relDir                  // upload to $relDir
1827                    if (! check_perm($relDir, trperm_w))
1828                            Error("Write access denied","You don't have permission to write in <tt>$relDir</tt>");
1829                  if (!is_writeable($gblFsRoot . $relDir))                  if (!is_writeable($gblFsRoot . $relDir))
1830                          Error("Write access denied",$relDir) ;                          Error("Write access denied","User <tt>$gblLogin</tt> has permission on <tt>$relDir</tt>, but directory is not writable",1);
1831                  $text  = "Use this page to upload a single " ;                  $text  = "Use this page to upload a single " ;
1832                  $text .= "file to <B>$realm</B>." ;                  $text .= "file to <B>$realm</B>." ;
1833                  StartHTML("(Upload Page)", $text) ;                  StartHTML("(Upload Page)", $text) ;
# Line 1873  function check_filename($file) { Line 1875  function check_filename($file) {
1875                  EndHTML() ;                  EndHTML() ;
1876                  exit;                  exit;
1877          case "I" :          case "I" :
1878                  $F=stripSlashes($F);                  if (! isset($F) || $F == "")
1879                  $inc_file="${gblFsRoot}/.${F}.php";                          Error("Can't find file to include","Your request didn't specify file to include which should be in variable <tt>F</tt> like <tt>$HTTP_SERVER_VARS[REQUEST_URI]<b>&F=include_php_file</b></tt>",1);
1880                  if (!isset($F) || $F == "" || !file_exists($inc_file)) Error("Fatal error $inc_file"); // can't find file to include                  $inc_file="$fsRealmDir/$realm".$realm_sep.$F.".php";
1881                    if (! file_exists($inc_file)) {
1882                            Error("Can't find file to include","Can't find include file <tt>$F.php</tt> in <tt>$fsRealmDir/$realm/</tt>. Meybe you should copy <tt>$gblIncDir/include_php/$F.php</tt> to <tt>$inc_file<tt> ?",1);
1883                    }
1884                  if (!is_readable($inc_file))                  if (!is_readable($inc_file))
1885                          Error("Read access to include file denied",".${F}.php");                          Error("Read access to include file denied","Can't read PHP include file <tt>$inc_file</tt>. Fix permissions on it.",1);
1886                  $text  = "Your include file should define \$text variable which holds this text and \$title variable which is page title";                  $text  = "Your include file should define \$text variable which holds this text and \$title variable which is page title";
1887                  $title = "You should define \$title variable with page title";                  $title = "You should define \$title variable with page title";
1888                  include($inc_file);                  include($inc_file);

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.26