/[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.5 by dpavlin, Thu Aug 3 22:02:03 2000 UTC revision 1.9 by dpavlin, Fri Aug 4 10:43:23 2000 UTC
# Line 65  IMPORTANT INSTALLATION NOTE: Line 65  IMPORTANT INSTALLATION NOTE:
65  TODO:  TODO:
66          mixed file/directory output (add type to each entry,          mixed file/directory output (add type to each entry,
67                  real support for links)                  real support for links)
68          add more content-management (like cms.sourceforge.net):          retrieve old versions of files (overwritten)
                 check-out/check-in/reserve  
                 comments to files  
69  */  */
70    
71  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
# Line 184  function EndHTML() { Line 182  function EndHTML() {
182  <B><?= date($GLOBALS[gblDateFmt]) ?> -  <B><?= date($GLOBALS[gblDateFmt]) ?> -
183  <?= date($GLOBALS[gblTimeFmt]) ?> -  <?= date($GLOBALS[gblTimeFmt]) ?> -
184  <?= $GLOBALS[gblUserName] ?>  <?= $GLOBALS[gblUserName] ?>
185  <small> [<a href="<?= $PHP_SELF ?>?relogin=<?= $GLOBALS[gblPw] ?>">logout</a>]</small>  <small> [<a href="<?= $GLOBALS["PHP_SELF"] ?>?relogin=<?= $GLOBALS[gblPw] ?>">logout</a>]</small>
186  </B>  </B>
187  <BR>ANYPORTAL(php) Site Manager  <BR>ANYPORTAL(php) Site Manager
188  <br><small>  <br><small>
# Line 194  function EndHTML() { Line 192  function EndHTML() {
192  </small>  </small>
193  </P>  </P>
194  <BR>  <BR>
195  <? include(".debug.inc") ?>  <? //include(".debug.inc") ?>
196  <BR><BR></BODY></HTML>  <BR><BR></BODY></HTML>
197    
198  <?php  <?php
# Line 240  function DetailPage($fsRoot,$relDir,$fn) Line 238  function DetailPage($fsRoot,$relDir,$fn)
238          $ext      = strtolower(strrchr($relPath,".")) ;          $ext      = strtolower(strrchr($relPath,".")) ;
239          $editable = ( $ext=="" || strstr(join(" ",$gblEditable),$ext)) ;          $editable = ( $ext=="" || strstr(join(" ",$gblEditable),$ext)) ;
240          $writable = is_writeable($fsPath) ;          $writable = is_writeable($fsPath) ;
241            $file_lock = CheckLock($fsPath);
242    
243          if (!$editable && !$exists)          if (!$editable && !$exists)
244                  Error("Creation unsupported for type",$relPath) ;                  Error("Creation unsupported for type",$relPath) ;
# Line 268  function DetailPage($fsRoot,$relDir,$fn) Line 267  function DetailPage($fsRoot,$relDir,$fn)
267    
268          }          }
269    
270          if ( $editable && ($writable || !$exists) ) {          if ( $editable && ($writable || !$exists) && !$file_lock ) {
271                  $fh = fopen($fsPath,"a+") ;                  $fh = fopen($fsPath,"a+") ;
272                  rewind($fh) ;                  rewind($fh) ;
273                  $fstr = fread($fh,filesize($fsPath)) ;                  $fstr = fread($fh,filesize($fsPath)) ;
# Line 294  echo($fstr) ; ?></TEXTAREA> Line 293  echo($fstr) ; ?></TEXTAREA>
293    
294  <?php  <?php
295          }          }
296          else if ( strstr( join(" ",$gblImages), $ext ) ) {            if ( !$file_lock && strstr(join(" ",$gblImages),$ext) ) {  
297            $info  = getimagesize($fsPath) ;                  $info  = getimagesize($fsPath) ;
298            $tstr  = "<IMG SRC=\"". $relPath . "\" BORDER=0 " ;                  $tstr = "<IMG SRC=\"".urlpath($relPath)."\" BORDER=0 " ;
299            $tstr .= $info[3] . " ALT=\"" . $fn . " - " ;                  $tstr .= $info[3] . " ALT=\"" . $fn . " - " ;
300            $tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ;                  $tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ;
301            echo htmlentities($tstr) . "<BR><BR>" . $tstr ;  //              echo htmlentities($tstr) . "<BR><BR>" . $tstr ;
302                    echo $tstr ;
303          }          }
304    
305  ?>  ?>
306    
307  <FORM ACTION="<?= $self ; ?>" METHOD="POST">  <FORM ACTION="<?= $self ; ?>" METHOD="POST">
# Line 309  echo($fstr) ; ?></TEXTAREA> Line 310  echo($fstr) ; ?></TEXTAREA>
310  <INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"><BR>  <INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="CANCEL"><BR>
311    
312  <?php  <?php
313    
314            if ($file_lock) {
315    ?>
316    <hr>
317    <SPAN TITLE="Check OK and click UNLOCK to remove lock on file.">
318    <B>OK TO FORCE LOCK REMOVAL ON "<?= $fn ; ?>" HELD BY <?= $file_lock ?>? </B></SPAN>
319    <INPUT TYPE="CHECKBOX" NAME="CONFIRM">
320    <INPUT TYPE="SUBMIT" NAME="POSTACTION" VALUE="UNLOCK">
321    <?
322            } // file_lock
323    
324          if (substr($fn,0,4) == ".del") {          if (substr($fn,0,4) == ".del") {
325                  $action="UNDELETE";                  $action="UNDELETE";
326                  $desc="undelete previously deleted file";                  $desc="undelete previously deleted file";
# Line 594  function GifIcon($txt) { Line 606  function GifIcon($txt) {
606                  $d = "blank.gif" ;                  $d = "blank.gif" ;
607                  break ;                  break ;
608          case "checkout":          case "checkout":
609                  $d = "down.gif";                  $d = "box2.gif";
610                  break;                  break;
611          case "checkin":          case "checkin":
612                  $d = "up.gif";                  $d = "hand.up.gif";
613                    break;
614            case "locked":
615                    $d = "screw2.gif";
616                  break;                  break;
617          case "note":          case "note":
618                  $d = "quill.gif";                  $d = "quill.gif";
# Line 659  function Navigate($fsRoot,$relDir) { Line 674  function Navigate($fsRoot,$relDir) {
674          // start navigation page          // start navigation page
675          $text  = "Use this page to add, delete";          $text  = "Use this page to add, delete";
676          if (! isset($show_deleted)) {          if (! isset($show_deleted)) {
677                  $text .= ", <a href=".$GLOBALS[PHP_SELF]."?D=".urlencode($relDir)."&show_deleted=1>undelete</a>";                  $text .= ", <a href=$self?D=".urlencode($relDir)."&show_deleted=1>undelete</a>";
678          }          }
679          $text .= " or revise files on this web site." ;          $text .= " or revise files on this web site." ;
680          StartHTML("(Navigate)",$text) ;          StartHTML("(Navigate)",$text) ;
# Line 706  function Navigate($fsRoot,$relDir) { Line 721  function Navigate($fsRoot,$relDir) {
721  <TR><TD></TD><TD COLSPAN=5><HR><B><?= $webRoot . $relDir ?>  <TR><TD></TD><TD COLSPAN=5><HR><B><?= $webRoot . $relDir ?>
722  </B></TD></TR>  </B></TD></TR>
723  <TR><TD></TD><TD CLASS=TOP>DOCUMENT NAME</TD>  <TR><TD></TD><TD CLASS=TOP>DOCUMENT NAME</TD>
724  <TD><?= $gblIcon("blank") ?></TD>  <TD><?= $gblIcon("blank").$gblIcon("blank") ?></TD>
725  <TD CLASS=TOP>NOTE</TD>  <TD CLASS=TOP>NOTE</TD>
726  <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>
727    
# Line 733  function Navigate($fsRoot,$relDir) { Line 748  function Navigate($fsRoot,$relDir) {
748                          $a .= " than 30 days\"> * </SPAN>" ;                          $a .= " than 30 days\"> * </SPAN>" ;
749                  }                  }
750    
751                  $tstr = $webRoot . $relDir . "/" . $file ;                  $file_lock=CheckLock($path);
752                  $tstr  = "<A HREF=\"" . $tstr . "\">" ;  
753                    $file_url_html="<A HREF=\"$self?A=V&F=".urlencode($file);
754                    $file_url_html.="&D=".urlencode($relDir);
755                    $file_url_html.="\" TITLE=\"View file\">" ;
756    
757                  if (substr($file,0,5) != ".del/") {                  if (substr($file,0,5) != ".del/") {
758                          $tstr .= $file . "</A>" . $a ;                          $file_url_html .= $file . "</A>" . $a ;
759                  } else {                  } else {
760                          $tstr .= substr($file,5,strlen($file)-5) . "</a> <SPAN CLASS=RED TITLE=\"deleted\"> <a href=\"$info_url#undelete\">deleted</a> </span>";                          $file_url_html .= substr($file,5,strlen($file)-5) . "</a> <SPAN CLASS=RED TITLE=\"deleted\"> <a href=\"$info_url#undelete\">deleted</a> </span>";
761                  }                  }
762    
763  //              $b = $gblIcon("checkout");                  $note_html="<a href=\"$info_url#note\">".$gblIcon("note")."</a>".ReadNote($path);
 //              $b .= $gblIcon("checkin");  
764    
765                  $ext = strtolower(strrchr($file,".")) ;                  $ext = strtolower(strrchr($file,".")) ;
766                  if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) {    
767                          $b .= "<A HREF=\"" . $self . "?A=C&F=" ;                  if ($file_lock) {
768                          $b .= urlencode($file) . "&D=" . urlencode($relDir) ;                          if ($file_lock == $GLOBALS[gblUserName]) {
769                          $b .= "\" TITLE=\"List contents\">" ;                                  $b.="<A HREF=\"$self?A=Ci&F=".urlencode($file);
770                          $b .= $gblIcon("view") . "</A>" ;                                  $b.="&D=".urlencode($relDir);
771                                    $b.="\" TITLE=\"Checkin (update) file on server\">" ;
772                                    $file_url_html=$b;
773                                    $b.=$gblIcon("checkin")."</A>" ;
774                                    $b.= $gblIcon("blank");
775                                    $file_url_html.="$file</a> $a";
776                                    $note_html = $gblIcon("blank")."<b>Please check-in (update) this file</b>";
777                            } else {
778                                    $b = $gblIcon("locked");
779                                    $b.= $gblIcon("blank");
780                                    $note_html = $gblIcon("blank")."<b>File locked by $file_lock</b>";
781                                    $file_url_html = "$file $a";
782                            }
783                  } else {                  } else {
784                          $b .= $gblIcon("blank");                          $b.="<A HREF=\"$self?A=Co&F=".urlencode($file);
785                            $b.="&D=".urlencode($relDir);
786                            $b.="\" TITLE=\"Checkout file for edit\">" ;
787                            $b.=$gblIcon("checkout")."</A>" ;
788    
789                            if ( $ext=="" || strstr(join(" ",$gblEditable),$ext) ) {  
790                                    $b.="<A HREF=\"$self?A=C&F=".urlencode($file);
791                                    $b.="&D=".urlencode($relDir);
792                                    $b.="\" TITLE=\"List contents\">" ;
793                                    $b.=$gblIcon("view")."</A>" ;
794                            } else {
795                                    $b.= $gblIcon("blank");
796                            }
797                  }                  }
798    
799    
# Line 761  function Navigate($fsRoot,$relDir) { Line 802  function Navigate($fsRoot,$relDir) {
802  <TR><TD>  <TR><TD>
803  <A HREF="<?= $info_url ?>" TITLE="View/Edit">  <A HREF="<?= $info_url ?>" TITLE="View/Edit">
804  <?= $gblIcon($ext) ?></A></TD>  <?= $gblIcon($ext) ?></A></TD>
805  <TD CLASS=LST><?= $tstr ?></TD>  <TD CLASS=LST><?= $file_url_html ?></TD>
806  <TD CLASS=LST ALIGN=center><?= $b ?></TD>  <TD CLASS=LST ALIGN=center><?= $b ?></TD>
807  <TD CLASS=LST ALIGN=left><a href="<?= $info_url ?>#note"><?= $gblIcon("note") ?></a><?= ReadNote($path) ?></TD>  <TD CLASS=LST ALIGN=left><?= $note_html ?></TD>
808  <TD CLASS=LST><?= date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]",$mod) ?></TD>  <TD CLASS=LST><?= date("$GLOBALS[gblDateFmt] $GLOBALS[gblTimeFmt]",$mod) ?></TD>
809  <TD CLASS=LST><?= $sz ?>Bytes</TD></TR>  <TD CLASS=LST><?= $sz ?>Bytes</TD></TR>
810    
# Line 789  function Navigate($fsRoot,$relDir) { Line 830  function Navigate($fsRoot,$relDir) {
830    
831  <TR><TD></TD><TD COLSPAN=5><HR></TD></TR>  <TR><TD></TD><TD COLSPAN=5><HR></TD></TR>
832    
833    <TR><TD></TD><TD COLSPAN=5>
834    To just view file without editing, select it's filename (<b>don't edit files which are opened this way!</b>)<br>
835    To <b>edit</b> file select <?= $gblIcon("checkout") ?> to check-out
836    and edit it locally. After editing is over, select filename or <?= $gblIcon("checkin") ?> to check-in (update copy of file on server).<br>
837    <by>If you select icon left from filename, you will get detailed information
838    about file, as well as delete, rename and annotation options.
839    </TD></TR>
840    
841    <TR><TD></TD><TD COLSPAN=5><HR></TD></TR>
842    
843  <FORM METHOD="POST" ACTION="<?= $self ?>">  <FORM METHOD="POST" ACTION="<?= $self ?>">
844  <TR><TD></TD><TD COLSPAN=5 CLASS=BAR>CREATE NEW  <TR><TD></TD><TD COLSPAN=5 CLASS=BAR>CREATE NEW
845   <INPUT TYPE="RADIO" NAME="T" VALUE="D" CHECKED>DIRECTORY -OR-   <INPUT TYPE="RADIO" NAME="T" VALUE="D" CHECKED>DIRECTORY -OR-
# Line 797  function Navigate($fsRoot,$relDir) { Line 848  function Navigate($fsRoot,$relDir) {
848   <INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE">   <INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE">
849   <INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>">   <INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>">
850   <INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR>   <INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR>
851   <NOBR>OR <A HREF="<?= $self   <NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE
         ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE  
852   </NOBR>   </NOBR>
853  </TD></TR>  </TD></TR>
854  </FORM>  </FORM>
# Line 810  function Navigate($fsRoot,$relDir) { Line 860  function Navigate($fsRoot,$relDir) {
860    
861  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
862    
863  function UploadPage($fsRoot, $relDir) {  function UploadPage($fsRoot, $relDir, $filename) {
864    
865          $self = $GLOBALS["PHP_SELF"] ;          $self = $GLOBALS["PHP_SELF"] ;
866          if ($relDir == "") $relDir = "/" ;          if ($relDir == "") $relDir = "/" ;
# Line 820  function UploadPage($fsRoot, $relDir) { Line 870  function UploadPage($fsRoot, $relDir) {
870  <FORM ENCTYPE="multipart/form-data" METHOD="POST"  <FORM ENCTYPE="multipart/form-data" METHOD="POST"
871   ACTION="<?= $self ?>">   ACTION="<?= $self ?>">
872  DESTINATION DIRECTORY:<B><?= " " . $relDir ?></B>  DESTINATION DIRECTORY:<B><?= " " . $relDir ?></B>
873    <? if (isset($filename)) { ?>
874    <br>DESTINATION FILE:<B><?= " " . $filename ?></B>
875    <INPUT TYPE="HIDDEN" NAME="FILENAME" VALUE="<?= $filename ?>">
876    <? } ?>
877  <P>PATHNAME OF LOCAL FILE<BR>  <P>PATHNAME OF LOCAL FILE<BR>
878  <INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>">  <INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>">
879  <INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="UPLOAD">  <INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="UPLOAD">
# Line 947  function ReadNote($target) { Line 1001  function ReadNote($target) {
1001                  $msg=fgets($note,4096);                  $msg=fgets($note,4096);
1002                  fclose($note);                  fclose($note);
1003          }          }
1004          return $msg;          return StripSlashes($msg);
1005    
1006  }  }
1007    
# Line 966  function MoveTo($source,$folder) { Line 1020  function MoveTo($source,$folder) {
1020    
1021  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
1022    
1023    function Lock($target) {
1024    
1025            $dir=dirname($target);
1026            if (! file_exists($dir."/.lock")) {
1027                    mkdir($dir."/.lock",0700);
1028            }
1029            $file=basename($target);
1030    
1031            if (file_exists("$dir/.lock/$file")) {
1032                    Logit($target,"attempt to locked allready locked file!");
1033            } else {
1034                    $lock=fopen("$dir/.lock/$file","w");
1035                    fputs($lock,"$GLOBALS[gblUserName]\n");
1036                    fclose($lock);
1037    
1038                    Logit($target,"file locked");
1039            }
1040    
1041    }
1042    
1043    function CheckLock($target) {
1044    
1045            $dir=dirname($target);
1046            $file=basename($target);
1047            $msg=0;
1048            if (file_exists($dir."/.lock/$file")) {
1049                    $lock=fopen("$dir/.lock/$file","r");
1050                    $msg=fgets($lock,4096);
1051                    fclose($lock);
1052            }
1053            return chop($msg);
1054    
1055    }
1056    
1057    function Unlock($target) {
1058    
1059            $dir=dirname($target);
1060            $file=basename($target);
1061            if (file_exists($dir."/.lock/$file")) {
1062                    unlink("$dir/.lock/$file");
1063                    Logit($target,"file unlocked");
1064            } else {
1065                    Logit($target,"attempt to unlocked non-locked file!");
1066            }
1067    
1068    }
1069    
1070    //////////////////////////////////////////////////////////////////
1071    
1072    function urlpath($url) {
1073            $url=urlencode(StripSlashes("$url"));
1074            $url=str_replace("%2F","/",$url);
1075            $url=str_replace("+","%20",$url);
1076            return($url);
1077    }
1078    
1079    //////////////////////////////////////////////////////////////////
1080    
1081    function safe_rename($from,$to) {
1082            if (file_exists($from) && is_writable(dirname($to))) {
1083                    rename($from,$to);
1084            }
1085    }
1086    
1087    //////////////////////////////////////////////////////////////////
1088    
1089  // MAIN PROGRAM  // MAIN PROGRAM
1090  // ============  // ============
1091  // query parameters: capital letters  // query parameters: capital letters
# Line 1032  function MoveTo($source,$folder) { Line 1152  function MoveTo($source,$folder) {
1152                  // TODO : should rather check for escapeshellcmds                  // TODO : should rather check for escapeshellcmds
1153                  // but maybe RFC 18xx asserts safe filenames ....                  // but maybe RFC 18xx asserts safe filenames ....
1154                  $source = $FN ;                  $source = $FN ;
1155                  $target = $fsDir . "/" . $FN_name ;                  if (! isset($FILENAME)) {       // from update file
1156                            $target = "$fsDir/$FN_name" ;
1157                    } else {
1158                            $target = "$fsDir/$FILENAME";
1159                    }
1160    
1161                  // backup old files first                  // backup old files first
1162                  $dir=dirname($target);                  $dir=dirname($target);
# Line 1046  function MoveTo($source,$folder) { Line 1170  function MoveTo($source,$folder) {
1170                  for($i=$GLOBALS[gblNumBackups]-1;$i>0;$i--) {                  for($i=$GLOBALS[gblNumBackups]-1;$i>0;$i--) {
1171                          MoveTo("$dir/.bak/$i/$file","$dir/.bak/".($i+1)."/");                          MoveTo("$dir/.bak/$i/$file","$dir/.bak/".($i+1)."/");
1172                  }                  }
1173                  MoveTo($target,$dir."/.bak/1/".$file);                  MoveTo($target,$dir."/.bak/1/");
1174    
1175                  copy($source,$target) ;                  copy($source,$target) ;
1176                  chmod($target,$gblFilePerms) ;                  chmod($target,$gblFilePerms) ;
1177                  clearstatcache() ;                  clearstatcache() ;
1178                  Logit($target,"uploaded");                  Logit($target,"uploaded");
1179                    if (isset($FILENAME)) {
1180                            Unlock($target);
1181                    }
1182                  break ;                  break ;
1183    
1184          case "SAVE" :          case "SAVE" :
# Line 1077  function MoveTo($source,$folder) { Line 1204  function MoveTo($source,$folder) {
1204                  $relPath = $relDir . "/" . $FN ;                  $relPath = $relDir . "/" . $FN ;
1205                  switch ( $T ) {                  switch ( $T ) {
1206                  case "D" :  // create a directory                  case "D" :  // create a directory
1207                    if ( ! @mkdir($path,$gblDirPerms) )                          if ( ! @mkdir($path,$gblDirPerms) )
1208                      Error("Mkdir failed",$relPath) ; // eg. if it exists                                  Error("Mkdir failed",$relPath) ; // eg. if it exists
1209                    clearstatcache() ;                          clearstatcache() ;
1210                    break ;                          break ;
1211                  case "F" :  // create a new file                  case "F" :  // create a new file
1212  // this functionality is doubled in DetailView().  // this functionality is doubled in DetailView().
1213  // better keep it here altogether  // better keep it here altogether
1214  // chmod perms to $gblFilePerms  // chmod perms to $gblFilePerms
1215                    if ( file_exists($path) && !is_writable($path) )                          if ( file_exists($path) && !is_writable($path) )
1216                      Error("File not writable", $relPath) ;                                  Error("File not writable", $relPath) ;
1217                    $tstr = $PHP_SELF . "?A=E&D=" . $relDir . "&F=" . $FN ;                          $fh = fopen($path, "w+") ;
1218                    header("Location: " . $tstr) ;                          if ($fh) {
1219                    exit ;                                  fputs($fh,"\n");
1220                                    fclose($fh) ;
1221                                    LogIt($path,"file created");
1222                            } else {
1223                                    Error("Creation of file $relPath failed -- $path");
1224                            }
1225                            $tstr = "$PHP_SELF?A=E&D=".urlencode($relDir)."&F=".urlencode($FN) ;
1226                            header("Location: " . $tstr) ;
1227                            exit ;
1228                  }                  }
1229                  break ;                  break ;
1230    
# Line 1115  function MoveTo($source,$folder) { Line 1250  function MoveTo($source,$folder) {
1250                                  exit ;                                  exit ;
1251                          } else {                          } else {
1252                                  Logit($path,"file deleted");                                  Logit($path,"file deleted");
                                 if (! file_exists("$dir/.del/.log")) {  
                                         mkdir("$dir/.del/.log",0700);  
                                 }  
1253                                  MoveTo("$dir/.log/$file","$dir/.del/.log/");                                  MoveTo("$dir/.log/$file","$dir/.del/.log/");
1254                                  MoveTo("$dir/.note/$file","$dir/.del/.note/");                                  MoveTo("$dir/.note/$file","$dir/.del/.note/");
1255                                    MoveTo("$dir/.lock/$file","$dir/.del/.lock/");
1256                          }                          }
1257                  }                  }
1258                  else {  // delete directory                  else {  // delete directory
# Line 1142  function MoveTo($source,$folder) { Line 1275  function MoveTo($source,$folder) {
1275                  MoveTo("$fsDir/.del/$file","$fsDir/");                  MoveTo("$fsDir/.del/$file","$fsDir/");
1276                  MoveTo("$fsDir/.del/.log/$file","$fsDir/.log/");                  MoveTo("$fsDir/.del/.log/$file","$fsDir/.log/");
1277                  MoveTo("$fsDir/.del/.note/$file","$fsDir/.note/");                  MoveTo("$fsDir/.del/.note/$file","$fsDir/.note/");
1278                    MoveTo("$fsDir/.del/.lock/$file","$fsDir/.lock/");
1279    
1280                  break ;                  break ;
1281    
# Line 1149  function MoveTo($source,$folder) { Line 1283  function MoveTo($source,$folder) {
1283                  if ( $CONFIRM != "on" ) break ;                  if ( $CONFIRM != "on" ) break ;
1284    
1285                  Logit("$fsDir/$FN","renamed $FN to $NEWNAME");                  Logit("$fsDir/$FN","renamed $FN to $NEWNAME");
1286                  rename("$fsDir/$FN","$fsDir/$NEWNAME");                  safe_rename("$fsDir/$FN","$fsDir/$NEWNAME");
1287                  rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME");                  safe_rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME");
1288                    safe_rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME");
1289                    safe_rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME");
1290    
1291                  break ;                  break ;
1292    
# Line 1158  function MoveTo($source,$folder) { Line 1294  function MoveTo($source,$folder) {
1294                  WriteNote("$fsDir/$FN","$NOTE");                  WriteNote("$fsDir/$FN","$NOTE");
1295                  break ;                  break ;
1296    
1297            case "UNLOCK" :  
1298                    if ( $CONFIRM != "on" ) break ;
1299                    Unlock("$fsDir/$FN");
1300                    break ;
1301    
1302          default :          default :
1303                  // user hit "CANCEL" or undefined action                  // user hit "CANCEL" or undefined action
1304          }          }
# Line 1173  function MoveTo($source,$folder) { Line 1314  function MoveTo($source,$folder) {
1314          // $A=U : upload to path given in $D          // $A=U : upload to path given in $D
1315          // $A=E : display detail of file $D/$F and edit          // $A=E : display detail of file $D/$F and edit
1316          // $A=C : display code in file $D/$F          // $A=C : display code in file $D/$F
1317            // $A=Co : checkout file $D/$F
1318            // $A=Ci : checkin file $D/$F
1319            // $A=V : view file (do nothing except log)
1320          // default : display directory $D          // default : display directory $D
1321                    
1322          switch ($A) {          switch ($A) {
# Line 1194  function MoveTo($source,$folder) { Line 1338  function MoveTo($source,$folder) {
1338                  // listing of $relDir/$F                  // listing of $relDir/$F
1339                  DisplayCode($gblFsRoot, $relDir, $F) ;                  DisplayCode($gblFsRoot, $relDir, $F) ;
1340                  exit ;                  exit ;
1341            case "Co" :
1342                    // checkout
1343                    Lock("$gblFsRoot/$relDir/$F");
1344                    Header("Location: ".urlpath("$relDir/$F"));
1345                    exit;
1346            case "Ci" :
1347                    // upload && update to $relDir
1348                    if (!is_writeable($gblFsRoot . $relDir))
1349                            Error("Write access denied",$relDir) ;
1350                    $text  = "Use this page to update a single " ;
1351                    $text .= "file to <B>$SERVER_NAME</B>." ;
1352                    StartHTML("(Update file Page)", $text) ;
1353                    UploadPage($gblFsRoot, $relDir, $F) ;
1354                    EndHTML() ;
1355                    exit ;
1356            case "V" :
1357                    // view
1358                    LogIt("$gblFsRoot/$relDir/$F","viewed");
1359                    Header("Location: ".urlpath("$relDir/$F"));
1360                    exit;
1361          }          }
1362    
1363          // default: display directory $relDir          // default: display directory $relDir

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.26