                                                        
<?php
//-->-->-->-->-->-->-->-->-->-->-->-->
  include "c:/apache2/htdocs/RETRO-GLOBALS.php";

  include "$LIBRARYPATH/RETROVOX-CONSTANT-VARIABLES.php";
  include "$LIBRARYPATH/fnRetrovoxStartHtml.php";
  include "$LIBRARYPATH/fnDirectoryTreeHtmlSelect.php";

  $sSourceFileName = $_GET['file'];  
  $sSourceFileName = str_replace('\\', '/', $sSourceFileName);
  $sSourceFileName = preg_replace('#[/]+#', '/', $sSourceFileName);

  $sSourceFileNameEncoded = htmlspecialchars($sSourceFileName);

  if ($sSourceFileName != '')
  {
    $sDirectoryPath = dirname($sSourceFileName);
    $sDirectoryPathEncoded = htmlspecialchars($sDirectoryPath);
  }
  
  $sDirectoryTreeHtmlSelect = 
    fnDirectoryTreeHtmlSelect('c:/apache2/htdocs');

  $sTargetDirectoryTreeHtmlSelect =
    preg_replace("#name\s*=\s*'directory'#im", "name = 'target'", 
                  $sDirectoryTreeHtmlSelect); 
//--<--<--<--<--<--<--<--<--<--<--<--<  
?>

<?=fnRetrovoxStartHtml("File and Directory functions")?>
<big>Hints and instructions</big><br>
<ul>
  <li>You can type in a directory name and click copy or press enter
      and a list of files in the directory will be displayed. </li>
  <li>Even if the Webserver is a Microsoft Server you can (and probably should)
      use forward slashes "/" instead of back slashes "\" in the file paths, but
      it doesnt really matter.</li>
</ul>
  <form  action = "copy-file.php"  method = "get">
  <strong>Copy a file </strong><br>
  <input type = "text"  name = "old-name"  size = "70" 
        value = "<?=$sSourceFileNameEncoded?>"><br>
  <strong>To the new file name </strong><br>
  <input type = "text"  name = "new-name"  size = "70" 
        value = "<?=$sDirectoryPathEncoded?>"><br>
  <input type = "submit"  value = "copy">
  </form>

  <form  action = "rename-file.php"  method = "get">
  <strong>Rename a file </strong><br>
  <input type = "text"  name = "old-name"  size = "70" 
        value = "<?=$sSourceFileNameEncoded?>"><br>
  <strong>To the new file name </strong><br>
  <input type = "text"  name = "new-name"  size = "70" 
        value = "<?=$sDirectoryPathEncoded?>"><br>
  <input type = "submit"  value = "rename"> 
  </form>

  <form  action = "copy-directory.php"  method = "get">
  <strong><u>Copy all file in a directory</u></strong><br><br>
  <strong>Select the directory to copy</strong><br>
  <?= $sDirectoryTreeHtmlSelect ?><br>
  <strong>Select a directory to copy the files to</strong><br>
  <?= $sTargetDirectoryTreeHtmlSelect ?><br>
  <input type = "submit"  value = "copy files">
  </form>

  <form  action = "create-directory.php"  method = "get">
  <strong><u>Create a new directory</u></strong><br><br>
  <strong>Select a parent directory</strong><br>
  <?= $sDirectoryTreeHtmlSelect ?><br>
  <strong>Type a directory name</strong><br>
  <input type = "text"  name = "name"  size = "70" 
        value = "<?=?>"><br>
  <input type = "submit"  value = "create">
  </form>

  <!--
  <form  action = "chmod-file.php"  method = "get">
  chmod<br>
  <input type = "text"  name = "file-name"  value = "<?=$sSourceFileName?>"> to
  <input type = "text"  name = "chmod-mode"  value = "0755">
  <input type = "submit"  value = "change permissions">
  </form>
  <small>
  NOTE: the chmoding of files doesn't work very often because of
  various permissions problems</small>
  <br>
  -->
<? //phpinfo() ?>
</body>
</html>
                                                        