/[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.38 by dpavlin, Mon May 5 15:28:26 2003 UTC revision 1.46 by dpavlin, Sat Apr 10 21:21:37 2004 UTC
# Line 22  Line 22 
22    
23          error_reporting(E_ALL) ;                // how verbose ?          error_reporting(E_ALL) ;                // how verbose ?
24    
25          // from where to include auth_*.php modules?          // try to do some guessing about configuration
26          $gblIncDir = "/data/docman2";          $script = $HTTP_SERVER_VARS["SCRIPT_FILENAME"];
27            if (is_link($script)) $script=readlink($script);
28            $gblIncDir = dirname($script);
29            $html = $gblIncDir."/html";
30    
31            // location of master docman configuration file
32            $docman_conf = "/etc/docman.conf";
33            if (! file_exists($docman_conf)) {
34                    $error = "Can't find master configuration file <tt>$docman_conf</tt>. See <tt>docman2/doc/upgrade.html#docman_conf</tt> for more informations";
35    
36                    error_log("docman: $error");
37                    Error("docman not installed completly",$error);
38            }
39            include($docman_conf);
40    
41            if (! isset($gblIncDir)) {
42                    $error = "Can't findi <tt>\$gblIncDir</tt> in master configuration file <tt>$docman_conf</tt>. This variable should point to docman installation directory";
43    
44                    error_log("docman: $error");
45                    Error("docman not installed completly",$error);
46            }
47    
48            // location of html files
49            $html = $gblIncDir."/html";
50    
51          // force download on view (so it won't open in associated application)          // force download on view (so it won't open in associated application)
52          $gblForceDownload = 0;          $gblForceDownload = 0;
# Line 74  Line 97 
97  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
98    
99          $gblTitle = "Document Manager";          $gblTitle = "Document Manager";
100          $gblVersion = "2.0-pre3";          $gblVersion = "2.0-rc1";
101    
102          $secHash    = "";          $secHash    = "";
103    
         // location of html files  
         $html = $gblIncDir."/html";  
   
104          // load language          // load language
105          if (isset($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"])) {          if (isset($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"])) {
106                  LoadLanguage($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]);                  LoadLanguage($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]);
# Line 94  Line 114 
114          // for security and configuration          // for security and configuration
115          $realm=$HTTP_SERVER_VARS["HTTP_HOST"];          $realm=$HTTP_SERVER_VARS["HTTP_HOST"];
116    
         $fsDocumentRoot = dirname($HTTP_SERVER_VARS["SCRIPT_FILENAME"]);  
         if ($fsDocumentRoot == "") Error("Configuration error","Can't get SCRIPT_FILENAME from your web server. Please set <tt>\$fsDocumentRoot</tt> in <tt>\$</tt>",1);  
   
117          // globals for later          // globals for later
118          $gblLogin = HTTP_SERVER_VAR("PHP_AUTH_USER");          $gblLogin = HTTP_SERVER_VAR("PHP_AUTH_USER");
119          $gblPasswd = HTTP_SERVER_VAR("PHP_AUTH_PW");          $gblPasswd = HTTP_SERVER_VAR("PHP_AUTH_PW");
# Line 110  function LoadLanguage($lang) { Line 127  function LoadLanguage($lang) {
127          if (file_exists($gblIncDir."/lang/$lang.php")) {          if (file_exists($gblIncDir."/lang/$lang.php")) {
128                  include($gblIncDir."/lang/$lang.php");                  include($gblIncDir."/lang/$lang.php");
129                  $html .= "-$lang";                  $html .= "-$lang";
130          } else {          } elseif (file_exists($gblIncDir."/lang/default.php")) {
131                  include($gblIncDir."/lang/default.php");                  include($gblIncDir."/lang/default.php");
132          }          }
133  }  }
134    
135  function StartHTML($title,$text="") {  function StartHTML($title,$text="") {
136    
137          global $html,$fsDocumentRoot,$gblTitle,$HTTP_SERVER_VARS;          global $html,$gblIncDir,$gblTitle,$HTTP_SERVER_VARS;
138    
139          $host  = $HTTP_SERVER_VARS["HTTP_HOST"] ;          $host  = $HTTP_SERVER_VARS["HTTP_HOST"] ;
140          $self  = $HTTP_SERVER_VARS["PHP_SELF"] ;          $self  = $HTTP_SERVER_VARS["PHP_SELF"] ;
141    
142          if (file_exists("$fsDocumentRoot/docman.css")) {          if (file_exists("$gblIncDir/docman.css")) {
143                  $css=dirname($self)."/docman.css";                  $css = "";
144                    $d = dirname($self);
145                    if ($d != "/") $css = $d;
146                    $css .= "/docman.css";
147          } else {          } else {
148                  $css=$self."?STYLE=get";                  $css=$self."?STYLE=get";
149          }          }
   
150          include("$html/head.html");          include("$html/head.html");
151  }  }
152    
# Line 280  function DetailPage($fsRoot,$relDir,$fn) Line 299  function DetailPage($fsRoot,$relDir,$fn)
299                  print "<hr><br><b>CHANGES TO THIS $whatis</b><br><table border=0 width=100%>\n";                  print "<hr><br><b>CHANGES TO THIS $whatis</b><br><table border=0 width=100%>\n";
300                  $bakcount = 0;  // start from 0, skip fist backup (it's current)                  $bakcount = 0;  // start from 0, skip fist backup (it's current)
301                  while ($e = array_shift($logarr)) {                  while ($e = array_shift($logarr)) {
302                          if (strstr($e[4],"upload")) {                          if (stristr($e[4],"upload") || stristr($e[4],"check-in")) {
303    print "-- $e[4] -- $bakdir/$bakcount/$name --<br>\n";
304                                  if (file_exists("$bakdir/$bakcount/$name")) {                                  if (file_exists("$bakdir/$bakcount/$name")) {
305                                          $e[4]="<a href=\"$webRoot".urlpath(dirname($relPath)."/.bak/$bakcount/$name")."\">$e[4]</a>";                                          $e[4]="<a href=\"$self?A=V&D=".urlencode($relDir).urlencode(".bak/$bakcount/")."&F=".$name."\">$e[4]</a>";  
306                                  }                                  }
307                                  $bakcount++;                                  $bakcount++;
308                          }                          }
# Line 831  function Navigate($fsRoot,$relDir) { Line 851  function Navigate($fsRoot,$relDir) {
851                  } else {                  } else {
852                          if (check_perm($relDir.$file,trperm_w)) {                          if (check_perm($relDir.$file,trperm_w)) {
853                                  $b.="<A HREF=\"$self?A=Co&D=".urlencode($relDir)."&F=".urlencode($file);                                  $b.="<A HREF=\"$self?A=Co&D=".urlencode($relDir)."&F=".urlencode($file);
854                                  $b.="\" TITLE=\"Checkout file for edit\">" ;                                  $b.="\" TITLE=\"Checkout file for edit\" onClick=\"window.setTimeout('window.location.reload()',3000); return true;\">" ;
855                                  $b.=$gblIcon("checkout")."</A>";                                  $b.=$gblIcon("checkout")."</A>";
856                          }                          }
857    
# Line 1580  function isBlank($file,$what = "filename Line 1600  function isBlank($file,$what = "filename
1600          $gblDirPerms  = 0750 ;          // default for new dirs          $gblDirPerms  = 0750 ;          // default for new dirs
1601    
1602          if (isset($HTTP_GET_VARS["STYLE"]) && $HTTP_GET_VARS["STYLE"] == "get") {          if (isset($HTTP_GET_VARS["STYLE"]) && $HTTP_GET_VARS["STYLE"] == "get") {
1603                    if (! headers_sent()) {
1604                            Header("Content-type: text/css");
1605                    }
1606                  include("$html/docman.css");                  include("$html/docman.css");
1607                  exit;                  exit;
1608          }          }
1609    
1610          // location of master docman configuration file          // set fsRealmDir
         $docman_conf = "/etc/docman.conf";  
         if (! file_exists($docman_conf)) {  
                 $error = "Can't find master configuration file <tt>$docman_conf</tt>. See <tt>docman2/doc/upgrade.html#docman_conf</tt> for more informations";  
                   
                 error_log("docman: $error");  
                 Error("docman not installed completly",$error);  
         }  
         include($docman_conf);  
   
1611          if (! isset($fsRealmDir)) {          if (! isset($fsRealmDir)) {
1612                  $fsRealmDir = "$gblIncDir/realm";                  $fsRealmDir = "$gblIncDir/realm";
1613          }          }
# Line 1790  function isBlank($file,$what = "filename Line 1804  function isBlank($file,$what = "filename
1804                          Error("Write denied",$RELPATH) ;                          Error("Write denied",$RELPATH) ;
1805                  $fh = fopen($path, "w") ;                  $fh = fopen($path, "w") ;
1806                  HTTP_POST_VAR("FILEDATA");                  HTTP_POST_VAR("FILEDATA");
1807                  fwrite($fh,$FILEDATA) ;                  fwrite($fh,stripSlashes($FILEDATA)) ;
1808                  fclose($fh) ;                  fclose($fh) ;
1809                  clearstatcache() ;                  clearstatcache() ;
1810                  LogIt($path,"saved changes",trperm_r);                  LogIt($path,"saved changes",trperm_r);

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.46

  ViewVC Help
Powered by ViewVC 1.1.26