/[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.34 by dpavlin, Fri Feb 23 11:51:39 2001 UTC revision 1.42 by dpavlin, Tue Jun 19 11:08:20 2001 UTC
# Line 236  function DetailPage($fsRoot,$relDir,$fn) Line 236  function DetailPage($fsRoot,$relDir,$fn)
236                  $fsize = filesize($fsPath) ;                  $fsize = filesize($fsPath) ;
237                  $fmodified = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", filemtime($fsPath)) ;                  $fmodified = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", filemtime($fsPath)) ;
238                  $faccessed = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", fileatime($fsPath)) ;                  $faccessed = date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]", fileatime($fsPath)) ;
239                  $userinfo = posix_getpwuid(fileowner($fsPath));                  $fuid=fileowner($fsPath);
240                  $grpinfo = posix_getgrgid(filegroup($fsPath));                  $fgid=filegroup($fsPath);
241                    $userinfo = posix_getpwuid($fuid);
242                    $grpinfo = posix_getgrgid($fgid);
243                  echo "<PRE>";                  echo "<PRE>";
244                  if (!is_dir($fsPath)) echo "file size: " . $fsize . " Bytes<BR>" ;                  if (!is_dir($fsPath)) echo "    file size: " . $fsize . " Bytes<BR>" ;
245                  echo "last modified: <B>" . $fmodified . "</B><BR>" ;                  echo "last modified: <B>" . $fmodified . "</B><BR>" ;
246                  echo "last accessed: <B>" . $faccessed . "</B><BR>" ;                  echo "last accessed: <B>" . $faccessed . "</B><BR>" ;
247                  echo "        owner: <B>" . $userinfo["name"] . "</B><BR>" ;                  echo "        owner: <B>" . $userinfo["name"] . " [$fuid]</B><BR>" ;
248                  echo "        group: <B>" . $grpinfo["name"] . "</B><BR>" ;                  echo "        group: <B>" . $grpinfo["name"] . " [$fgid]</B><BR>" ;
249                  echo "  permissions: <B>" ;                  echo "  permissions: <B>" ;
250                  echo printf( "%o", fileperms($fsPath) ) . "</B>" ;                  echo printf( "%o", fileperms($fsPath) ) . "</B>" ;
251                  echo "</PRE>" ;                  echo "</PRE>" ;
# Line 692  function Navigate($fsRoot,$relDir) { Line 694  function Navigate($fsRoot,$relDir) {
694  <?php  <?php
695          }          }
696    
697    function plural($name,$count) {
698            $out="$count $name";
699            if ($count > 1) {
700                    $out.="s";
701            }
702            return $out;
703    }
704    
705          // output subdirs          // output subdirs
706          if (sizeof($dirList) > 0) {          if (sizeof($dirList) > 0) {
707                  sort($dirList) ;                  sort($dirList) ;
708  ?>  ?>
709    
710  <TR><TD></TD><TD COLSPAN=2 CLASS=TOP>DIRECTORY NAME</TD><TD COLSPAN=3 CLASS=TOP>DIRECTORY NOTE</TR>  <TR><TD></TD><TD COLSPAN=2 CLASS=TOP>DIRECTORY NAME (<?= plural("dir",sizeof($dirList)) ?>)</TD><TD COLSPAN=3 CLASS=TOP>DIRECTORY NOTE</TR>
711    
712  <?php  <?php
713                  while (list($key,$dir) = each($dirList)) {                  while (list($key,$dir) = each($dirList)) {
# Line 722  function Navigate($fsRoot,$relDir) { Line 732  function Navigate($fsRoot,$relDir) {
732    
733  <TR><TD></TD><TD COLSPAN=5><HR><B><?= $webRoot . $relDir ?>  <TR><TD></TD><TD COLSPAN=5><HR><B><?= $webRoot . $relDir ?>
734  </B></TD></TR>  </B></TD></TR>
735  <TR><TD></TD><TD CLASS=TOP>DOCUMENT NAME</TD>  <TR><TD></TD><TD CLASS=TOP>DOCUMENT NAME (<?= plural("file",sizeof($fileList)) ?>)</TD>
736  <TD><?= $gblIcon("blank").$gblIcon("blank") ?></TD>  <TD><?= $gblIcon("blank").$gblIcon("blank") ?></TD>
737  <TD CLASS=TOP>NOTE</TD>  <TD CLASS=TOP>NOTE</TD>
738  <TD CLASS=TOP>LAST UPDATE</TD><TD CLASS=TOP>FILE SIZE</TD></TR>  <TD CLASS=TOP>LAST UPDATE</TD><TD CLASS=TOP>FILE SIZE</TD></TR>
# Line 854  if (file_exists(".info.inc")) { Line 864  if (file_exists(".info.inc")) {
864   <NOBR>NAME <INPUT TYPE="TEXT" NAME="FN" SIZE=14>   <NOBR>NAME <INPUT TYPE="TEXT" NAME="FN" SIZE=14>
865   <INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE">   <INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE">
866   <INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>">   <INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>">
867   <INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR>   <INPUT TYPE="SUBMIT" VALUE="CREATE" NAME="CREATE">
868     </NOBR>
869   <NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE   <NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE
870   </NOBR>   </NOBR>
871  </TD></TR>  </TD></TR>
# Line 974  function ReadNote($target) { Line 985  function ReadNote($target) {
985                  $msg=fgets($note,4096);                  $msg=fgets($note,4096);
986                  fclose($note);                  fclose($note);
987          }          }
988          return StripSlashes($msg);          return HtmlSpecialChars(StripSlashes($msg));
989    
990  }  }
991    
# Line 1057  function urlpath($url) { Line 1068  function urlpath($url) {
1068    
1069  function safe_rename($fromdir,$fromfile,$tofile) {  function safe_rename($fromdir,$fromfile,$tofile) {
1070          function try_rename($from,$to) {          function try_rename($from,$to) {
1071                  print "$from -> $to\n";  #               print "$from -> $to\n";
1072                  if (file_exists($from) && is_writable(dirname($to))) {                  if (file_exists($from) && is_writeable(dirname($to))) {
1073                          rename($from,$to);                          rename($from,$to);
1074                  }                  }
1075          }          }
# Line 1073  function safe_rename($fromdir,$fromfile, Line 1084  function safe_rename($fromdir,$fromfile,
1084          $todir=dirname($to);          $todir=dirname($to);
1085          $tofile=basename($to);          $tofile=basename($to);
1086    
1087          print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n";  #       print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n";
1088    
1089          try_rename("$fromdir/$fromfile","$todir/$tofile");          try_rename("$fromdir/$fromfile","$todir/$tofile");
1090          try_dir("$todir/.log");          try_dir("$todir/.log");
# Line 1166  function DisplayChangeLog($day) { Line 1177  function DisplayChangeLog($day) {
1177    
1178          $htusers_file=dirname($SCRIPT_FILENAME)."/.htusers";          $htusers_file=dirname($SCRIPT_FILENAME)."/.htusers";
1179          if (! file_exists($htusers_file)) {          if (! file_exists($htusers_file)) {
1180                  if (is_writable(dirname($SCRIPT_FILENAME))) {                  if (is_writeable(dirname($SCRIPT_FILENAME))) {
1181                          $htusers=fopen($htusers_file,"a+");                          $htusers=fopen($htusers_file,"a+");
1182                          fputs($htusers,"# Change owner of $htusers_file to root !!\n");                          fputs($htusers,"# Change owner of $htusers_file to root !!\n");
1183                          fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n");                          fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n");
# Line 1212  function DisplayChangeLog($day) { Line 1223  function DisplayChangeLog($day) {
1223                  $relDir = urldecode($D) ;  // then use GET                  $relDir = urldecode($D) ;  // then use GET
1224          }                }      
1225    
1226            $relDir=stripSlashes($relDir);
1227    
1228          if ($relDir == "/") $relDir = "" ;                if ($relDir == "/") $relDir = "" ;      
1229          // default : website root = ""          // default : website root = ""
1230    
# Line 1246  function DisplayChangeLog($day) { Line 1259  function DisplayChangeLog($day) {
1259    
1260          $FN=stripSlashes($FN);          $FN=stripSlashes($FN);
1261    
1262            if (file_exists("$fsScriptDir/.docman.conf")) {
1263                    include("$fsScriptDir/.docman.conf");
1264            }
1265    
1266          switch ($POSTACTION) {          switch ($POSTACTION) {
1267          case "UPLOAD" :          case "UPLOAD" :
1268                  if (!is_writeable($fsDir)) Error("Write denied",$relDir) ;                  if (!is_writeable($fsDir)) Error("Write denied",$relDir) ;
# Line 1321  function DisplayChangeLog($day) { Line 1338  function DisplayChangeLog($day) {
1338  // this functionality is doubled in DetailView().  // this functionality is doubled in DetailView().
1339  // better keep it here altogether  // better keep it here altogether
1340  // chmod perms to $gblFilePerms  // chmod perms to $gblFilePerms
1341                          if ( file_exists($path) && !is_writable($path) )                          if ( file_exists($path) && !is_writeable($path) )
1342                                  Error("File not writable", $relPath) ;                                  Error("File not writable", $relPath) ;
1343                          $fh = fopen($path, "w+") ;                          $fh = fopen($path, "w+") ;
1344                          if ($fh) {                          if ($fh) {

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.42

  ViewVC Help
Powered by ViewVC 1.1.26