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

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

  ViewVC Help
Powered by ViewVC 1.1.26