/[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.33 by dpavlin, Thu Feb 15 22:14:21 2001 UTC revision 1.36 by dpavlin, Sun Mar 11 15:42:51 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 1055  function urlpath($url) { Line 1057  function urlpath($url) {
1057    
1058  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
1059    
1060  function safe_rename($from,$to) {  function safe_rename($fromdir,$fromfile,$tofile) {
1061          if (file_exists($from) && is_writable(dirname($to))) {          function try_rename($from,$to) {
1062                  rename($from,$to);                  print "$from -> $to\n";
1063                    if (file_exists($from) && is_writeable(dirname($to))) {
1064                            rename($from,$to);
1065                    }
1066            }
1067    
1068            function try_dir($todir) {
1069                    if (! file_exists($todir)) {
1070                            mkdir($todir,0700);
1071                    }
1072            }
1073    
1074            $to="$fromdir/$tofile";
1075            $todir=dirname($to);
1076            $tofile=basename($to);
1077    
1078            print "<pre>$fromdir / $fromfile -> $todir / $tofile\n\n";
1079    
1080            try_rename("$fromdir/$fromfile","$todir/$tofile");
1081            try_dir("$todir/.log");
1082            try_rename("$fromdir/.log/$fromfile","$todir/.log/$tofile");
1083            try_dir("$todir/.note");
1084            try_rename("$fromdir/.note/$fromfile","$todir/.note/$tofile");
1085            try_dir("$todir/.lock");
1086            try_rename("$fromdir/.lock/$fromfile","$todir/.lock/$tofile");
1087            try_dir("$todir/.bak");
1088            for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) {
1089                    try_rename("$fromdir/.bak/$i/$fromfile","$todir/.bak/$i/$tofile");
1090          }          }
1091  }  }
1092    
1093    
1094  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
1095    
1096  // recursivly delete directory  // recursivly delete directory
# Line 1138  function DisplayChangeLog($day) { Line 1168  function DisplayChangeLog($day) {
1168    
1169          $htusers_file=dirname($SCRIPT_FILENAME)."/.htusers";          $htusers_file=dirname($SCRIPT_FILENAME)."/.htusers";
1170          if (! file_exists($htusers_file)) {          if (! file_exists($htusers_file)) {
1171                  if (is_writable(dirname($SCRIPT_FILENAME))) {                  if (is_writeable(dirname($SCRIPT_FILENAME))) {
1172                          $htusers=fopen($htusers_file,"a+");                          $htusers=fopen($htusers_file,"a+");
1173                          fputs($htusers,"# Change owner of $htusers_file to root !!\n");                          fputs($htusers,"# Change owner of $htusers_file to root !!\n");
1174                          fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n");                          fputs($htusers,"demo:full name:[md5_hash|auth_*]:e-mail\n");
# Line 1293  function DisplayChangeLog($day) { Line 1323  function DisplayChangeLog($day) {
1323  // this functionality is doubled in DetailView().  // this functionality is doubled in DetailView().
1324  // better keep it here altogether  // better keep it here altogether
1325  // chmod perms to $gblFilePerms  // chmod perms to $gblFilePerms
1326                          if ( file_exists($path) && !is_writable($path) )                          if ( file_exists($path) && !is_writeable($path) )
1327                                  Error("File not writable", $relPath) ;                                  Error("File not writable", $relPath) ;
1328                          $fh = fopen($path, "w+") ;                          $fh = fopen($path, "w+") ;
1329                          if ($fh) {                          if ($fh) {
# Line 1365  function DisplayChangeLog($day) { Line 1395  function DisplayChangeLog($day) {
1395                  if ( $CONFIRM != "on" ) break ;                  if ( $CONFIRM != "on" ) break ;
1396    
1397                  Logit("$fsDir/$FN","renamed $FN to $NEWNAME");                  Logit("$fsDir/$FN","renamed $FN to $NEWNAME");
1398                  safe_rename("$fsDir/$FN","$fsDir/$NEWNAME");                  safe_rename($fsDir,$FN,$NEWNAME);
                 safe_rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME");  
                 safe_rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME");  
                 safe_rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME");  
                 for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) {  
                         safe_rename("$fsDir/.bak/$i/$FN","$fsDir/.bak/$i/$NEWNAME");  
                 }  
   
1399                  break ;                  break ;
1400    
1401          case "NOTE" :            case "NOTE" :  

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.26