Location: PHPKode > scripts > EXPOW > expow/src/edition.php
<?php
#
# edition.php                                               Part of Expow 0.8
# Copyright (c) 2000-2001 Rémy Lalanne.
#

#
# PROCESS RESULTS
#

/* from mkdir touch upload */
if (isset($mkdir_field))
  mkdir($c_browser->get_intern_path().$mkdir_field,0700);
if (isset($touch_field))
  touch($c_browser->get_intern_path().$touch_field);
if ((!strcmp($button,"put")) && isset($userfile) && ($userfile_name != "") )
  copy ($userfile, $c_browser->get_intern_path().basename($userfile_name));
/* from delete */
if (isset($delete))
  if (is_dir($c_browser->get_intern_path()))
    rmdir ($c_browser->get_intern_path());
  else
    unlink($c_browser->get_intern_path());
/* from url drop */
if (isset($drop_field)){
  $fd = fopen($drop_field, "r");
  $fd_dest = fopen($c_browser->get_intern_path(basename($drop_field)),"w");
  if (!$fd)
    echo "Cannot open the url to copy";
  if (!$fd_dest)
    echo "Cannot write the copy of url";
  if($fd && $fd_dest){
    while (!feof($fd))
      fwrite($fd_dest,fread($fd, 4096),4096);
    fclose($fd);
    fclose($fd_dest);
  }
}
#
# GUI
#
?>
<div class=top>
 <table cellspacing=0 class=top width=100%>
  <tr>
   <th width=100%>
    &nbsp;
   </th>
<?php if(is_writeable(dirname($c_browser->get_intern_path()))){ ?>
   <th>
    <!-- DELETE GUI START -->
    <form method=post enctype="multipart/form-data"><nobr><font color=red>!<input type=submit name=delete value="delete">!</font></nobr></form>
    <!-- DELETE GUI END -->
   </th>
<?php } ?>
<?php if(is_dir($c_browser->get_intern_path())){ ?>
   <th>
    <!-- CREATION GUI START -->
    <form method=post enctype="multipart/form-data"><input type=text name=touch_field value="new file" size=8></form>
   </th>
   <th>
    <form method=post enctype="multipart/form-data"><input type=text name=mkdir_field value="new dir" size=8></form>
    <!-- CREATION GUI END -->
   </th>
<?php } ?>
   <th>
    <nobr>
     <form method=post enctype="multipart/form-data">
      local file:
      <input name=userfile type=file size=1>
      <input type=submit name=button value=upload>
     </form>
    </nobr>
   </th>
   <th>
    <nobr>
     <form method=post enctype="multipart/form-data">
      url:
      <input name=drop_field type=text size=8>
      <input type=submit name=button value="copy">
     </form>
    </nobr>
   </th>
  </tr>
 </table>
</div>
<br>
<br>
Return current item: EXPOW