/[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.7 by dpavlin, Fri Aug 4 10:13:10 2000 UTC revision 1.11 by dpavlin, Fri Aug 4 11:25:05 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 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 294  echo($fstr) ; ?></TEXTAREA> Line 292  echo($fstr) ; ?></TEXTAREA>
292  </FORM>  </FORM>
293    
294  <?php  <?php
295          } else if ( strstr( join(" ",$gblImages), $ext ) ) {            }
296            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  ?>  ?>
# Line 362  echo($fstr) ; ?></TEXTAREA> Line 362  echo($fstr) ; ?></TEXTAREA>
362    
363  <?php  <?php
364                    
365            $name=basename("$fsDir/$fn");
366          $logname=dirname("$fsDir/$fn")."/.log/".basename("$fsDir/$fn");          $logname=dirname("$fsDir/$fn")."/.log/$name";
367            $bakdir=dirname("$fsDir/$fn")."/.bak";
368          if (file_exists($logname)) {          if (file_exists($logname)) {
                 print "<hr><br><b>CHANGES TO THIS FILE</b><br><table border=0 width=100%>\n";  
369                  $log=fopen($logname,"r");                  $log=fopen($logname,"r");
370                  $cl1=" class=lst"; $cl2="";                  $cl1=" class=lst"; $cl2="";
371                    $logarr = array();
372                  while($line = fgetcsv($log,255,"\t")) {                  while($line = fgetcsv($log,255,"\t")) {
373                          $cl=$cl1; $cl1=$cl2; $cl2=$cl;                          $cl=$cl1; $cl1=$cl2; $cl2=$cl;
374                          print "<tr><td$cl>$line[0]</td><td$cl>$line[1]</td><td$cl>$line[2]</td><td$cl>$line[3]</td></tr>\n";                          array_unshift($logarr,array($cl,$line[0],$line[1],$line[2],$line[3]));
375                  }                  }
376                  fclose($log);                  fclose($log);
377                    print "<hr><br><b>CHANGES TO THIS FILE</b><br><table border=0 width=100%>\n";
378                    $bakcount = 0;  // start from 0, skip fist backup (it's current)
379                    while ($e = array_shift($logarr)) {
380                            if (strstr($e[4],"upload")) {
381                                    if (file_exists("$bakdir/$bakcount/$name")) {
382                                            $e[4]="<a href=\"".dirname($relPath)."/.bak/$bakcount/$name\">$e[4]</a>";
383                                    }
384                                    $bakcount++;
385                            }
386                            print "<tr><td$e[0]>$e[1]</td><td$e[0]>$e[2]</td><td$e[0]>$e[3]</td><td$e[0]>$e[4]</td></tr>\n";
387                    }
388                  print "</table>";                  print "</table>";
389          }          }
390    
# Line 848  about file, as well as delete, rename an Line 860  about file, as well as delete, rename an
860   <INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE">   <INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE">
861   <INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>">   <INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>">
862   <INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR>   <INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR>
863   <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  
864   </NOBR>   </NOBR>
865  </TD></TR>  </TD></TR>
866  </FORM>  </FORM>
# Line 1070  function Unlock($target) { Line 1081  function Unlock($target) {
1081    
1082  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
1083    
1084  function redir_to_url($url) {  function urlpath($url) {
1085          $url=urlencode(StripSlashes("$relDir/$F"));          $url=urlencode(StripSlashes("$url"));
1086          $url=str_replace("%2F","/",$url);          $url=str_replace("%2F","/",$url);
1087          $url=str_replace("+","%20",$url);          $url=str_replace("+","%20",$url);
1088          Header("Location: $url");          return($url);
1089    }
1090    
1091    //////////////////////////////////////////////////////////////////
1092    
1093    function safe_rename($from,$to) {
1094            if (file_exists($from) && is_writable(dirname($to))) {
1095                    rename($from,$to);
1096            }
1097  }  }
1098    
1099  //////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////
# Line 1276  function redir_to_url($url) { Line 1295  function redir_to_url($url) {
1295                  if ( $CONFIRM != "on" ) break ;                  if ( $CONFIRM != "on" ) break ;
1296    
1297                  Logit("$fsDir/$FN","renamed $FN to $NEWNAME");                  Logit("$fsDir/$FN","renamed $FN to $NEWNAME");
1298                  rename("$fsDir/$FN","$fsDir/$NEWNAME");                  safe_rename("$fsDir/$FN","$fsDir/$NEWNAME");
1299                  rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME");                  safe_rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME");
1300                  rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME");                  safe_rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME");
1301                  rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME");                  safe_rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME");
1302                    for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) {
1303                            safe_rename("$fsDir/.bak/$i/$FN","$fsDir/.bak/$i/$NEWNAME");
1304                    }
1305    
1306                  break ;                  break ;
1307    
# Line 1334  function redir_to_url($url) { Line 1356  function redir_to_url($url) {
1356          case "Co" :          case "Co" :
1357                  // checkout                  // checkout
1358                  Lock("$gblFsRoot/$relDir/$F");                  Lock("$gblFsRoot/$relDir/$F");
1359                  redir_to_url("$relDir/$F");                  Header("Location: ".urlpath("$relDir/$F"));
1360                  exit;                  exit;
1361          case "Ci" :          case "Ci" :
1362                  // upload && update to $relDir                  // upload && update to $relDir
# Line 1348  function redir_to_url($url) { Line 1370  function redir_to_url($url) {
1370                  exit ;                  exit ;
1371          case "V" :          case "V" :
1372                  // view                  // view
1373                  Log("viewed");                  LogIt("$gblFsRoot/$relDir/$F","viewed");
1374                  redir_to_url("$relDir/$F");                  Header("Location: ".urlpath("$relDir/$F"));
1375                  exit;                  exit;
1376          }          }
1377    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.26