Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, October 14, 2026

Diff for phpWebFileManager/index.php between version 1.7 and 1.8

version 1.7, 2001/10/01 14:38:49 version 1.8, 2001/10/25 22:31:25
Line 14 
Line 14 
 /*  /*
  * Before doing anything else read config file.   * Before doing anything else read config file.
  */   */
 include("config.inc.php");  include('config.inc.php');
   
 /*  /*
  * URL manipulation utils   * URL manipulation utils
  */   */
 include("url_utils.lib.php");  include('url_utils.lib.php');
   
 /*  /*
  * write_original_html()   * write_original_html()
Line 55  function append_slash($string) {
Line 55  function append_slash($string) {
         return false;          return false;
 }  }
   
 ?>  
   
 <tt>  
 <form enctype="multipart/form-data" method=post action=<?php echo $PHP_SELF;?>>  
   
 <?php  
   
   /*
    * Main job.
    */
 $phpWebFileManager_LINKS_PREFIX =  $phpWebFileManager_LINKS_PREFIX =
         append_slash($phpWebFileManager_LINKS_PREFIX);          append_slash($phpWebFileManager_LINKS_PREFIX);
   
Line 71  $phpWebFileManager_ROOT_DIR =
Line 68  $phpWebFileManager_ROOT_DIR =
 if (! isset($dir) || $phpWebFileManager_DENY_DIR_ENTER)  if (! isset($dir) || $phpWebFileManager_DENY_DIR_ENTER)
         $dir = $phpWebFileManager_START_DIR;          $dir = $phpWebFileManager_START_DIR;
   
   /* Dirty & safe. */
 $dir = preg_replace('/\/\/+/','/', $dir . '/');  $dir = preg_replace('/\/\/+/','/', $dir . '/');
 $dir = preg_replace("/^(|.*\/)\.\.\/([^\.\/][^\.\/]|[^\/][^\.\/]|[^\/][^\.\/]|[^\/]{3,})\/(.*)$/", "\\1\\3", $dir);  $dir = preg_replace("/^(|.*\/)\.\.\/([^\.\/][^\.\/]|[^\/][^\.\/]|[^\/][^\.\/]|[^\/]{3,})\/(.*)$/", "\\1\\3", $dir);
 $dir = preg_replace("/^(|.*\/)([^\/\.][^\.\/]|[^\/][^\.\/]|[^\/][^\.\/]|[^\/]{3,})\/\.\.\/(.*)$/", "\\1\\3", $dir);  $dir = preg_replace("/^(|.*\/)([^\/\.][^\.\/]|[^\/][^\.\/]|[^\/][^\.\/]|[^\/]{3,})\/\.\.\/(.*)$/", "\\1\\3", $dir);
Line 82  while ($dir[0] == '/')
Line 80  while ($dir[0] == '/')
   
 /* Hidden parameters */  /* Hidden parameters */
 $origvars = $phpWebFileManager_ORIGINAL_VARIABLES;  $origvars = $phpWebFileManager_ORIGINAL_VARIABLES;
 if ($origvars[strlen($origvars)-1] != '&') $origvars .= '&';  if (strlen($origvars) > 0 && $origvars[strlen($origvars)-1] != '&')
           $origvars .= '&';
   
   /* Prepare HTML encode of some variables. */
   $filename_he = htmlentities($filename);
   $dir_he = htmlentities($dir);
   
   /* Prepare URL & HTML encode of some variables. */
   //$filename_ue = htmlentities(urlencode($filename));
   $dir_ue = htmlentities(urlencode($dir));
   $PHP_SELF_origvars_ue = htmlentities("$PHP_SELF?" . urlencode($origvars));
   
   ?>
   
   <tt>
   <form enctype="multipart/form-data" method=post action="<?php echo htmlentities($PHP_SELF);?>">
   
   <?php
   
 write_origvars_html($origvars);  write_origvars_html($origvars);
   
 echo "<input type=hidden value=\"$filename\" name=filename>";  echo '<input type=hidden value="'.$filename_he.'" name=filename>';
 echo "<input type=hidden value=\"$dir\" name=dir>";  echo '<input type=hidden value="'.$dir_he.'" name=dir>';
   
 /* Store the starting working directory */  /* Store the starting working directory */
 $orig_dir = getcwd();  $orig_dir = getcwd();
Line 105  if (is_dir($dir)) {
Line 120  if (is_dir($dir)) {
          * so we must improve it.           * so we must improve it.
          */           */
         $dir = append_slash($dir);          $dir = append_slash($dir);
 /*  
         if (strlen($dir) > 0 &&  
                 $dir[strlen($dir)-1] != '/')  
                         $dir .= '/';  
 */  
 }  }
 else  else
         $dir = '';          $dir = '';
Line 123  echo "<big><b>$dir</b></big><br><br>";
Line 133  echo "<big><b>$dir</b></big><br><br>";
 if ($action == "confirm_delete_file") {  if ($action == "confirm_delete_file") {
         echo "<input type=hidden value=delete_file name=action>";          echo "<input type=hidden value=delete_file name=action>";
   
         echo "Really delete file<br><br><i>$filename</i><br><br>from ";          echo "Really delete file<br><br><i>$filename_he</i><br><br>from ";
         echo $dir != '' ? "directory<br><br><i>$dir</i><br><br>"          echo $dir != '' ? "directory<br><br><i>$dir_he</i><br><br>"
                         : "root directory?<br><br>";                          : "root directory?<br><br>";
         echo "<input type=submit name=submit value=Delete>&nbsp;";          echo "<input type=submit name=submit value=Delete>&nbsp;";
         echo "<input type=submit name=submit value=Cancel>&nbsp;";          echo "<input type=submit name=submit value=Cancel>&nbsp;";
Line 136  if ($action == "confirm_delete_file") {
Line 146  if ($action == "confirm_delete_file") {
 elseif ($action == "confirm_remove_directory") {  elseif ($action == "confirm_remove_directory") {
         echo "<input type=hidden value=remove_directory name=action>";          echo "<input type=hidden value=remove_directory name=action>";
   
         echo "Really remove directory<br><br><i>$filename</i><br><br>";          echo "Really remove directory<br><br><i>$filename_he</i><br><br>";
         echo "This direcotry must be empty.<br><br>";          echo "This direcotry must be empty.<br><br>";
         echo "<input type=submit name=submit value=Remove>&nbsp;";          echo "<input type=submit name=submit value=Remove>&nbsp;";
         echo "<input type=submit name=submit value=Cancel>&nbsp;";          echo "<input type=submit name=submit value=Cancel>&nbsp;";
Line 152  elseif ($action == "confirm_rename_file"
Line 162  elseif ($action == "confirm_rename_file"
                                                 ? "rename_directory" : "rename_file";                                                  ? "rename_directory" : "rename_file";
         echo " name=action>";          echo " name=action>";
   
         echo "Rename from<br><br><i>$filename</i><br><br>to<br><br>";          echo "Rename from<br><br><i>$filename_he</i><br><br>to<br><br>";
         echo "<input type=text value=\"\" name=new_filename><br><br>";          echo "<input type=text value=\"\" name=new_filename><br><br>";
         echo "<input type=submit name=submit value=Rename>&nbsp;";          echo "<input type=submit name=submit value=Rename>&nbsp;";
         echo "<input type=submit name=submit value=Cancel>&nbsp;";          echo "<input type=submit name=submit value=Cancel>&nbsp;";
Line 321  else {
Line 331  else {
                 echo "<tr valign=middle>";                  echo "<tr valign=middle>";
   
                 echo "<td align=center>"                  echo "<td align=center>"
                                 . "<a href=\"$PHPSELF?$origvars" . "dir=$dir..\">"                                  . "<a href=\"$PHP_SELF_origvars_ue" . "dir=$dir_ue..\">"
                                 . "<img alt=\"Back\" border=0 src=\"icons/back.gif\"></a>"                                  . "<img alt=\"Back\" border=0 src=\"icons/back.gif\"></a>"
                                 . "</td>";                                  . "</td>";
   
                 echo "<td width=100% colspan=4>"                  echo "<td width=100% colspan=4>"
                                 . "<a href=\"$PHPSELF?$origvars" . "dir=$dir..\">"                                  . "<a href=\"$PHP_SELF_origvars_ue" . "dir=$dir_ue..\">"
                                 . "(parent directory)</a>"                                  . "(parent directory)</a>"
                                 . "</td>";                                  . "</td>";
   
Line 362  else {
Line 372  else {
                 sort($listing);                  sort($listing);
   
                 while ($entry = array_shift($listing)) {                  while ($entry = array_shift($listing)) {
                           $entry_he = htmlentities($entry);
                           $entry_ue = htmlentities(urlencode($entry));
                         if ($entry != "." && $entry != ".." &&                          if ($entry != "." && $entry != ".." &&
                                 (($k == 0 && is_dir($entry))||($k == 1 && ! is_dir($entry)))) {                                  (($k == 0 && is_dir($entry))||($k == 1 && ! is_dir($entry)))) {
   
Line 371  else {
Line 383  else {
   
                                 if (is_dir($entry)) {                                  if (is_dir($entry)) {
                                         if (! $phpWebFileManager_DENY_DIR_ENTER)                                          if (! $phpWebFileManager_DENY_DIR_ENTER)
                                                 echo "<a href=\"$PHPSELF?$origvars"                                                  echo "<a href=\"$PHP_SELF_origvars_ue"
                                                                 . "dir=$dir$entry\">";                                                                  . "dir=$dir_ue$entry_ue\">";
                                         echo "<img alt=\"Directory\" border=0"                                          echo "<img alt=\"Directory\" border=0"
                                                         . " src=\"icons/dir.gif\">";                                                          . " src=\"icons/dir.gif\">";
                                         if (! $phpWebFileManager_DENY_DIR_ENTER)                                          if (! $phpWebFileManager_DENY_DIR_ENTER)
Line 381  else {
Line 393  else {
                                         echo "</td><td width=100%>";                                          echo "</td><td width=100%>";
   
                                         if (! $phpWebFileManager_DENY_DIR_ENTER)                                          if (! $phpWebFileManager_DENY_DIR_ENTER)
                                                 echo "<a href=\"$PHPSELF?$origvars"                                                  echo "<a href=\"$PHP_SELF_origvars_ue"
                                                                 . "dir=$dir$entry\">"                                                                  . "dir=$dir_ue$entry_ue\">"
                                                                 . $entry .  "</a>";                                                                  . $entry_he .  "</a>";
                                         else                                          else
                                                 echo "$entry";                                                  echo "$entry";
                                 }                                  }
                                 else echo "&nbsp;</td><td width=100%>$entry";                                  else echo "&nbsp;</td><td width=100%>$entry_he";
   
                                 echo "</td>";                                  echo "</td>";
   
Line 396  else {
Line 408  else {
                                         if ($rename_column) {                                          if ($rename_column) {
                                                 echo "<td><small>";                                                  echo "<td><small>";
                                                 if (! $phpWebFileManager_DENY_FILE_RENAME)                                                  if (! $phpWebFileManager_DENY_FILE_RENAME)
                                                         echo "[<a href=\"$PHPSELF?$origvars"                                                          echo "[<a href=\"$PHP_SELF_origvars_ue"
                                                                 . "dir=$dir&action=confirm_rename_file"                                                                  . "dir=$dir_ue&action=confirm_rename_file"
                                                                 . "&filename=$entry\">Rename</a>]";                                                                  . "&filename=$entry_ue\">Rename</a>]";
                                                 echo "</small></td>";                                                  echo "</small></td>";
                                         }                                          }
   
                                         if ($delete_column) {                                          if ($delete_column) {
                                                 echo "<td><small>";                                                  echo "<td><small>";
                                                 if (! $phpWebFileManager_DENY_FILE_DELETE)                                                  if (! $phpWebFileManager_DENY_FILE_DELETE)
                                                         echo "[<a href=\"$PHPSELF?$origvars"                                                          echo "[<a href=\"$PHP_SELF_origvars_ue"
                                                                 ."dir=$dir&action=confirm_delete_file"                                                                  ."dir=$dir_ue&action=confirm_delete_file"
                                                                 . "&filename=$entry\">Delete</a>]";                                                                  . "&filename=$entry_ue\">Delete</a>]";
                                                 echo "</small></td>";                                                  echo "</small></td>";
                                         }                                          }
   
Line 416  else {
Line 428  else {
                                                 . (strlen($phpWebFileManager_LINKS_PREFIX) > 0                                                  . (strlen($phpWebFileManager_LINKS_PREFIX) > 0
                                                         ? $phpWebFileManager_LINKS_PREFIX                                                          ? $phpWebFileManager_LINKS_PREFIX
                                                         : $phpWebFileManager_ROOT_DIR )                                                          : $phpWebFileManager_ROOT_DIR )
                                                 . $dir . $entry;                                                  . $dir_he . $entry_he;
                                         unset($url['query']);                                          unset($url['query']);
                                         unset($url['fragment']);                                          unset($url['fragment']);
   
Line 433  else {
Line 445  else {
                                         if ($rename_column) {                                          if ($rename_column) {
                                                 echo "<td><small>";                                                  echo "<td><small>";
                                                 if (! $phpWebFileManager_DENY_DIR_RENAME)                                                  if (! $phpWebFileManager_DENY_DIR_RENAME)
                                                         echo "[<a href=\"$PHPSELF?$origvars"                                                          echo "[<a href=\"$PHP_SELF_origvars_ue"
                                                                         . "dir=$dir&action=confirm_rename_directory"                                                                          . "dir=$dir_ue&action=confirm_rename_directory"
                                                                         . "&filename=$entry\">Rename</a>]";                                                                          . "&filename=$entry_ue\">Rename</a>]";
                                                 echo "</small></td>";                                                  echo "</small></td>";
                                         }                                          }
   
                                         if ($delete_column) {                                          if ($delete_column) {
                                                 echo "<td><small>";                                                  echo "<td><small>";
                                                 if (! $phpWebFileManager_DENY_DIR_REMOVE)                                                  if (! $phpWebFileManager_DENY_DIR_REMOVE)
                                                         echo "[<a href=\"$PHPSELF?$origvars"                                                          echo "[<a href=\"$PHP_SELF_origvars_ue"
                                                                         . "dir=$dir&action=confirm_remove_directory"                                                                          . "dir=$dir_ue&action=confirm_remove_directory"
                                                                         . "&filename=$entry\">Remove</a>]";                                                                          . "&filename=$entry_ue\">Remove</a>]";
                                                 echo "</small></td>";                                                  echo "</small></td>";
                                         }                                          }
   
                                         if ($view_column) {                                          if ($view_column) {
                                                 echo "<td><small>";                                                  echo "<td><small>";
                                                 if (! $phpWebFileManager_DENY_DIR_ENTER)                                                  if (! $phpWebFileManager_DENY_DIR_ENTER)
                                                         echo "[<a href=\"$PHPSELF?$origvars"                                                          echo "[<a href=\"$PHP_SELF_origvars_ue"
                                                                         . "dir=$dir$entry\">Enter</a>]";                                                                          . "dir=$dir_ue$entry_ue\">Enter</a>]";
                                                 echo "</small></td>";                                                  echo "</small></td>";
                                         }                                          }
                                 }                                  }
Line 468  else {
Line 480  else {
                 echo "<tr><td colspan=5 align=center><small>";                  echo "<tr><td colspan=5 align=center><small>";
   
                 if (! $phpWebFileManager_DENY_DIR_CREATE)                  if (! $phpWebFileManager_DENY_DIR_CREATE)
                         echo "<br>[<a href=$PHP_SELF?$origvars"                          echo "<br>[<a href=$PHP_SELF_origvars_ue"
                                         . "dir=$dir"                                          . "dir=$dir_ue"
                                         . "&action=confirm_create_directory>"                                          . "&action=confirm_create_directory>"
                                         . "Create a new directory</a>]";                                          . "Create a new directory</a>]";
   
                 if (! $phpWebFileManager_DENY_FILE_CREATE)                  if (! $phpWebFileManager_DENY_FILE_CREATE)
                         echo "&nbsp;[<a href=$PHP_SELF?$origvars"                          echo "&nbsp;[<a href=$PHP_SELF_origvars_ue"
                                         . "dir=$dir"                                          . "dir=$dir_ue"
                                         . "&action=confirm_create_file>"                                          . "&action=confirm_create_file>"
                                         . "Create an empty file</a>]";                                          . "Create an empty file</a>]";
   
                 if (! $phpWebFileManager_DENY_FILE_UPLOAD)                  if (! $phpWebFileManager_DENY_FILE_UPLOAD)
                         echo "&nbsp;[<a href=$PHP_SELF?$origvars"                          echo "&nbsp;[<a href=$PHP_SELF_origvars_ue"
                                         . "dir=$dir"                                          . "dir=$dir_ue"
                                         . "&action=confirm_upload_file>"                                          . "&action=confirm_upload_file>"
                                         . "File upload</a>]";                                          . "File upload</a>]";
   

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

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top