| version 1.14, 2002/01/24 23:50:22 |
version 1.15, 2002/02/16 20:27:36 |
|
|
| * __________________________________________________________ |
* __________________________________________________________ |
| * |
* |
| * Developed by Ondrej Jombik <nepto@pobox.sk> |
* Developed by Ondrej Jombik <nepto@pobox.sk> |
| * Copyright (c) 2001 Platon software development group |
* Copyright (c) 2001-2002 Platon software development group |
| * All rights reserved. |
* All rights reserved. |
| * |
* |
| * See README file for more informations about this software. |
* See README file for more informations about this software. |
| Line 28 include('config.inc.php'); |
|
| Line 28 include('config.inc.php'); |
|
| include('url_utils.lib.php'); |
include('url_utils.lib.php'); |
| |
|
| /* |
/* |
| |
* Language file |
| |
*/ |
| |
if (file_exists("language/lang_$phpWebFileManager_LANGUAGE.php")) |
| |
@include("language/lang_$phpWebFileManager_LANGUAGE.php"); |
| |
else |
| |
include("language/lang_english.php"); |
| |
|
| |
/* |
| * write_original_html() |
* write_original_html() |
| * |
* |
| * Create HTML code for original variables. |
* Create HTML code for original variables. |
| * User with formulars and POST method. |
* User with formulars and POST method. |
| */ |
*/ |
| function write_origvars_html($origvars) { |
function write_origvars_html($origvars) |
| |
{ |
| foreach (split("&", $origvars) as $param) { |
foreach (split("&", $origvars) as $param) { |
| if (strpos($param, '=') != false) |
if (strpos($param, '=') != false) |
| echo "<input type=hidden name=" |
echo "<input type=hidden name=" |
| Line 47 function write_origvars_html($origvars) |
|
| Line 56 function write_origvars_html($origvars) |
|
| * |
* |
| * Appends slash at the end of string if string is not empty and slash |
* Appends slash at the end of string if string is not empty and slash |
| * is not already present at the end of string. |
* is not already present at the end of string. |
| * On success returns changed string, on failure returns false; |
* On success returns changed string, on failure returns false. |
| */ |
*/ |
| function append_slash($string) { |
function append_slash($string) |
| |
{ |
| if (strlen($string) > 0) { |
if (strlen($string) > 0) { |
| if ($string[strlen($string)-1] != '/') |
if ($string[strlen($string)-1] != '/') |
| return $string . '/'; |
return $string . '/'; |
| Line 61 function append_slash($string) { |
|
| Line 70 function append_slash($string) { |
|
| return false; |
return false; |
| } |
} |
| |
|
| |
/* |
| |
* echo_message() |
| |
* |
| |
* Writes message on output. |
| |
*/ |
| |
function echo_message($message) |
| |
{ |
| |
echo "<small>$message</small>"; |
| |
} |
| |
|
| |
|
| /* |
/* |
| * Main job. |
* Main job. |
| */ |
*/ |
| |
|
| $phpWebFileManager_LINKS_PREFIX = |
$phpWebFileManager_LINKS_PREFIX = |
| append_slash($phpWebFileManager_LINKS_PREFIX); |
append_slash($phpWebFileManager_LINKS_PREFIX); |
| |
|
| $phpWebFileManager_ROOT_DIR = |
$phpWebFileManager_ROOT_DIR = |
| append_slash($phpWebFileManager_ROOT_DIR); |
append_slash($phpWebFileManager_ROOT_DIR); |
| |
|
| |
/* Striping slashes. */ |
| |
$fm_dir = stripslashes($fm_dir); |
| |
$fm_filename = stripslashes($fm_filename); |
| |
$fm_new_filename = stripslashes($fm_new_filename); |
| |
|
| |
/* Symlink detection. */ |
| |
if ($phpWebFileManager_DENY_DIR_FOLLOW_SYMLINKS) { |
| |
$fm_test_symlink = $fm_dir; |
| |
|
| |
while ($fm_test_symlink != '') { |
| |
if (is_link($fm_test_symlink) || is_link("$fm_test_symlink/")) { |
| |
$fm_dir = $phpWebFileManager_START_DIR; |
| |
break; |
| |
} |
| |
|
| |
$fm_test_symlink = substr($fm_test_symlink, |
| |
0, intval(strrpos($fm_test_symlink, '/'))); |
| |
} |
| |
} |
| |
|
| if (! isset($fm_dir) || $phpWebFileManager_DENY_DIR_ENTER) |
if (! isset($fm_dir) || $phpWebFileManager_DENY_DIR_ENTER) |
| $fm_dir = $phpWebFileManager_START_DIR; |
$fm_dir = $phpWebFileManager_START_DIR; |
| |
|
| Line 98 $fm_dir_he = htmlentities($fm_dir); |
|
| Line 138 $fm_dir_he = htmlentities($fm_dir); |
|
| $fm_dir_ue = htmlentities(rawurlencode($fm_dir)); |
$fm_dir_ue = htmlentities(rawurlencode($fm_dir)); |
| $PHP_SELF_origvars_ue = htmlentities("$PHP_SELF?" . rawurlencode($origvars)); |
$PHP_SELF_origvars_ue = htmlentities("$PHP_SELF?" . rawurlencode($origvars)); |
| |
|
| ?> |
/* |
| |
* Form |
| <tt> |
*/ |
| <form enctype="multipart/form-data" method=post action="<?php echo htmlentities($PHP_SELF);?>"> |
echo '<form enctype="multipart/form-data" method=post' |
| |
. ' action="' . htmlentities($PHP_SELF) . '">'; |
| <?php |
|
| |
|
| write_origvars_html($origvars); |
write_origvars_html($origvars); |
| |
|
| echo '<input type=hidden value="'.$fm_filename_he.'" name=fm_filename>'; |
echo '<input type=hidden value="'.$fm_filename_he.'" name=fm_filename>'; |
| echo '<input type=hidden value="'.$fm_dir_he.'" name=fm_dir>'; |
echo '<input type=hidden value="'.$fm_dir_he.'" name=fm_dir>'; |
| |
|
| /* Store the starting working directory */ |
/* Store the starting working directory. */ |
| $orig_dir = getcwd(); |
$orig_dir = getcwd(); |
| |
|
| /* Change directory to upload root */ |
/* Change to root directory. */ |
| if (@is_dir($phpWebFileManager_ROOT_DIR)) |
if (@is_dir($phpWebFileManager_ROOT_DIR)) |
| chdir($phpWebFileManager_ROOT_DIR); |
chdir($phpWebFileManager_ROOT_DIR); |
| $root_dir = getcwd(); |
$root_dir = getcwd(); |
| Line 121 $root_dir = getcwd(); |
|
| Line 160 $root_dir = getcwd(); |
|
| if (@is_dir($fm_dir)) { |
if (@is_dir($fm_dir)) { |
| chdir($fm_dir); |
chdir($fm_dir); |
| |
|
| /* |
/* On some *BSD systems with PHP version <= 4.0.6 |
| * On some systems chdir() is modifying $fm_dir variable, |
function chdir() is removing last '/' character |
| * so we must improve it. |
in $fm_dir variable, so we must improve it. */ |
| */ |
|
| $fm_dir = append_slash($fm_dir); |
$fm_dir = append_slash($fm_dir); |
| } |
} |
| else |
else |
| $fm_dir = ''; |
$fm_dir = ''; |
| |
|
| /* Write current working direcotry information */ |
/* Write current working direcotry information. */ |
| echo "<big><b>$fm_dir</b></big><br><br>"; |
echo "<big><b>$fm_dir</b></big><br><br>"; |
| |
|
| /* |
/* |
| Line 139 echo "<big><b>$fm_dir</b></big><br><br>" |
|
| Line 177 echo "<big><b>$fm_dir</b></big><br><br>" |
|
| if ($fm_action == "confirm_delete_file") { |
if ($fm_action == "confirm_delete_file") { |
| echo "<input type=hidden value=delete_file name=fm_action>"; |
echo "<input type=hidden value=delete_file name=fm_action>"; |
| |
|
| echo "Really delete file<br><br><i>$fm_filename_he</i><br><br>from "; |
echo $phpWebFileManager_LANG['really_delete'] |
| echo $fm_dir != '' ? "directory<br><br><i>$fm_dir_he</i><br><br>" |
. "<br><br><i>$fm_filename_he</i><br><br>"; |
| : "root directory?<br><br>"; |
echo $fm_dir == '' |
| echo "<input type=submit name=submit value=Delete> "; |
? $phpWebFileManager_LANG['from_root_dir'] . "?<br><br>" |
| echo "<input type=submit name=submit value=Cancel> "; |
: $phpWebFileManager_LANG['from_dir'] |
| |
. "<br><br><i>$fm_dir_he</i><br><br>"; |
| |
echo "<input type=submit name=submit value=\"" |
| |
. $phpWebFileManager_LANG['file_delete'] . "\"> " |
| |
. "<input type=submit name=submit value=\"" |
| |
. $phpWebFileManager_LANG['cancel'] . "\">"; |
| } |
} |
| |
|
| /* |
/* |
| Line 152 if ($fm_action == "confirm_delete_file") |
|
| Line 195 if ($fm_action == "confirm_delete_file") |
|
| elseif ($fm_action == "confirm_remove_directory") { |
elseif ($fm_action == "confirm_remove_directory") { |
| echo "<input type=hidden value=remove_directory name=fm_action>"; |
echo "<input type=hidden value=remove_directory name=fm_action>"; |
| |
|
| echo "Really remove directory<br><br><i>$fm_filename_he</i><br><br>"; |
echo $phpWebFileManager_LANG['really_remove'] |
| echo "This direcotry must be empty.<br><br>"; |
. "<br><br><i>$fm_filename_he</i><br><br>"; |
| echo "<input type=submit name=submit value=Remove> "; |
echo $phpWebFileManager_LANG['must_be_empty'] . "<br><br>"; |
| echo "<input type=submit name=submit value=Cancel> "; |
echo "<input type=submit name=submit value=\"" |
| |
. $phpWebFileManager_LANG['dir_remove'] . "\"> " |
| |
. "<input type=submit name=submit value=\"" |
| |
. $phpWebFileManager_LANG['cancel'] . "\">"; |
| } |
} |
| |
|
| /* |
/* |
| * confirm rename files action and confirm rename directory action |
* confirm rename files action and confirm rename directory action |
| */ |
*/ |
| elseif ($fm_action == "confirm_rename_file" |
elseif ($fm_action == "confirm_rename_file" |
| || $fm_action == "confirm_rename_directory") { |
|| $fm_action == "confirm_rename_directory") { |
| echo "<input type=hidden value="; |
echo "<input type=hidden value=\""; |
| echo $fm_action == "confirm_rename_directory" |
echo $fm_action == "confirm_rename_directory" |
| ? "rename_directory" : "rename_file"; |
? "rename_directory" : "rename_file"; |
| echo " name=fm_action>"; |
echo "\" name=fm_action>"; |
| |
|
| echo "Rename from<br><br><i>$fm_filename_he</i><br><br>to<br><br>"; |
echo $phpWebFileManager_LANG['rename_from'] |
| |
. "<br><br><i>$fm_filename_he</i><br><br>" |
| |
. $phpWebFileManager_LANG['rename_to'] |
| |
. "<br><br>"; |
| echo "<input type=text value=\"\" name=fm_new_filename><br><br>"; |
echo "<input type=text value=\"\" name=fm_new_filename><br><br>"; |
| echo "<input type=submit name=submit value=Rename> "; |
echo "<input type=submit name=submit value=\"" |
| echo "<input type=submit name=submit value=Cancel> "; |
. ($fm_action == "confirm_rename_directory" |
| |
? $phpWebFileManager_LANG['dir_rename'] |
| |
: $phpWebFileManager_LANG['file_rename']) |
| |
. "\"> " |
| |
. "<input type=submit name=submit value=\"" |
| |
. $phpWebFileManager_LANG['cancel'] . "\">"; |
| } |
} |
| |
|
| /* |
/* |
| * confirm create direcotry and confirm create file actions |
* confirm create directory and confirm create file actions |
| */ |
*/ |
| elseif ($fm_action == "confirm_create_directory" |
elseif ($fm_action == "confirm_create_directory" |
| || $fm_action == "confirm_create_file") { |
|| $fm_action == "confirm_create_file") { |
| echo "<input type=hidden value="; |
echo "<input type=hidden value="; |
| echo $fm_action == "confirm_create_directory" |
echo $fm_action == "confirm_create_directory" |
| ? "create_directory" : "create_file"; |
? "create_directory" : "create_file"; |
| echo " name=fm_action>"; |
echo " name=fm_action>"; |
| |
|
| echo "Enter the name:<br><br>"; |
echo $phpWebFileManager_LANG['enter_name'] . ":<br><br>"; |
| echo "<input type=text value=\"\" name=fm_new_filename><br><br>"; |
echo "<input type=text value=\"\" name=fm_new_filename><br><br>"; |
| echo "<input type=submit name=submit value=Create> "; |
echo "<input type=submit name=submit value=\"" |
| echo "<input type=submit name=submit value=Cancel> "; |
. ($fm_action == "confirm_create_directory" |
| |
? $phpWebFileManager_LANG['dir_create'] |
| |
: $phpWebFileManager_LANG['file_create']) |
| |
. "\"> " |
| |
. "<input type=submit name=submit value=\"" |
| |
. $phpWebFileManager_LANG['cancel'] . "\">"; |
| } |
} |
| |
|
| /* |
/* |
| Line 196 elseif ($fm_action == "confirm_create_di |
|
| Line 255 elseif ($fm_action == "confirm_create_di |
|
| elseif ($fm_action == "confirm_upload_file") { |
elseif ($fm_action == "confirm_upload_file") { |
| echo "<input type=hidden value=\"upload_file\" name=fm_action>"; |
echo "<input type=hidden value=\"upload_file\" name=fm_action>"; |
| |
|
| echo "Select a local file:<br><br>"; |
echo $phpWebFileManager_LANG['select_local'] . ":<br><br>"; |
| echo "<input type=file value=\"\" name=fm_userfile><br><br>"; |
echo "<input type=file value=\"\" name=fm_userfile><br><br>"; |
| echo "<input type=submit name=submit value=Upload> "; |
echo "<input type=submit name=submit value=\"" |
| echo "<input type=submit name=submit value=Cancel> "; |
. $phpWebFileManager_LANG['file_upload'] . "\"> " |
| |
. "<input type=submit name=submit value=\"" |
| |
. $phpWebFileManager_LANG['cancel'] . "\">"; |
| } |
} |
| |
|
| else { |
else { |
|
|
| * delete action |
* delete action |
| */ |
*/ |
| if ($fm_action == "delete_file" && ! $phpWebFileManager_DENY_FILE_DELETE) { |
if ($fm_action == "delete_file" && ! $phpWebFileManager_DENY_FILE_DELETE) { |
| if ($submit == "Delete") { |
if ($submit == $phpWebFileManager_LANG['file_delete']) { |
| if (@unlink($fm_filename) == false) |
if (@unlink($fm_filename) == false) |
| echo "<small>File removing failed." |
echo_message($phpWebFileManager_LANG['file_delete_err']); |
| . " Delete was not successful.</small>"; |
else |
| else echo "<small>File was succesfully removed.</small>"; |
echo_message($phpWebFileManager_LANG['file_delete_ok']); |
| } |
} |
| else echo "<small>Operation canceled.</small>"; |
else echo_message($phpWebFileManager_LANG['canceled']); |
| echo "<br><br>"; |
echo "<br><br>"; |
| } |
} |
| |
|
|
|
| * remove direcotry |
* remove direcotry |
| */ |
*/ |
| if ($fm_action == "remove_directory" && ! $phpWebFileManager_DENY_DIR_REMOVE) { |
if ($fm_action == "remove_directory" && ! $phpWebFileManager_DENY_DIR_REMOVE) { |
| if ($submit == "Remove") { |
if ($submit == $phpWebFileManager_LANG['dir_remove']) { |
| if (@rmdir($fm_filename) == 0) |
if (@rmdir($fm_filename) == 0) |
| echo "<small>Directory removing failed. Is it empty?</small>"; |
echo_message($phpWebFileManager_LANG['dir_remove_err']); |
| else echo "<small>Directory was succesfully removed.</small>"; |
else |
| |
echo_message($phpWebFileManager_LANG['dir_remove_ok']); |
| } |
} |
| else echo "<small>Operation canceled.</small>"; |
else echo_message($phpWebFileManager_LANG['canceled']); |
| echo "<br><br>"; |
echo "<br><br>"; |
| } |
} |
| |
|
|
|
| * rename action |
* rename action |
| */ |
*/ |
| if (($fm_action == "rename_directory" && ! $phpWebFileManager_DENY_DIR_RENAME) |
if (($fm_action == "rename_directory" && ! $phpWebFileManager_DENY_DIR_RENAME) |
| || ($fm_action == "rename_file" && ! $phpWebFileManager_DENY_FILE_RENAME)) { |
|| ($fm_action == "rename_file" && ! $phpWebFileManager_DENY_FILE_RENAME)) { |
| if ($submit == "Rename" and $fm_new_filename != "") { |
if ($fm_new_filename != "" && |
| |
(($submit == $phpWebFileManager_LANG['dir_rename'] |
| |
&& $fm_action == "rename_directory") |
| |
|| ($submit == $phpWebFileManager_LANG['file_rename'] |
| |
&& $fm_action == "rename_file") |
| |
)) { |
| if (@rename($fm_filename, $fm_new_filename) == false) |
if (@rename($fm_filename, $fm_new_filename) == false) |
| echo "<small>Filename changing failed." |
echo_message($phpWebFileManager_LANG['rename_err']); |
| . " File was not renamed.</small>"; |
else |
| else echo "<small>File was succesfully renamed.</small>"; |
echo_message($phpWebFileManager_LANG['rename_ok']); |
| } |
} |
| else echo "<small>Operation canceled.</small>"; |
else echo_message($phpWebFileManager_LANG['canceled']); |
| echo "<br><br>"; |
echo "<br><br>"; |
| } |
} |
| |
|
|
|
| * create directory and create file actions |
* create directory and create file actions |
| */ |
*/ |
| if (($fm_action == "create_directory" && ! $phpWebFileManager_DENY_DIR_CREATE) |
if (($fm_action == "create_directory" && ! $phpWebFileManager_DENY_DIR_CREATE) |
| || ($fm_action == "create_file" && ! $phpWebFileManager_DENY_FILE_CREATE)) { |
|| ($fm_action == "create_file" && ! $phpWebFileManager_DENY_FILE_CREATE)) { |
| if ($submit == "Create" and $fm_new_filename != "") { |
if ($fm_new_filename != "" && |
| |
(($submit == $phpWebFileManager_LANG['dir_create'] |
| |
&& $fm_action == "create_directory") |
| |
|| ($submit == $phpWebFileManager_LANG['file_create'] |
| |
&& $fm_action == "create_file") |
| |
)) { |
| if ($fm_action == "create_directory") { |
if ($fm_action == "create_directory") { |
| if (@mkdir($fm_new_filename, $phpWebFileManager_DIR_MODE) == false) |
if (@mkdir($fm_new_filename, $phpWebFileManager_DIR_MODE) == false) |
| echo "<small>Directory creating failed." |
echo_message($phpWebFileManager_LANG['dir_create_err']); |
| . " Already exists?</small>"; |
else |
| else echo "<small>Directory was succesfully created.</small>"; |
echo_message($phpWebFileManager_LANG['dir_create_ok']); |
| } |
} |
| else { |
else { |
| if (file_exists($fm_new_filename)) |
if (file_exists($fm_new_filename)) |
| echo "<small>Creation failed. File already exists.</small>"; |
echo_message($phpWebFileManager_LANG['file_create_err1']); |
| else { |
else { |
| if (($fh = @fopen($fm_new_filename, "w")) == false) |
if (($fh = @fopen($fm_new_filename, "w")) == false) |
| echo "<small>Creation failed." |
echo_message($phpWebFileManager_LANG['file_create_err2']); |
| . " No space left on the device?</small>"; |
|
| else { |
else { |
| fclose($fh); |
fclose($fh); |
| echo "<small>File was successfully created"; |
echo_message($phpWebFileManager_LANG['file_create_ok']); |
| |
|
| if ($phpWebFileManager_FILE_MODE != 0) { |
if ($phpWebFileManager_FILE_MODE != 0) { |
| if (@chmod($fm_new_filename, |
if (@chmod($fm_new_filename, |
| $phpWebFileManager_FILE_MODE) == false) |
$phpWebFileManager_FILE_MODE) == false) |
| echo ", but chmod() failed"; |
echo_message(' '.$phpWebFileManager_LANG['chmod_err']); |
| else echo ", chmod() OK"; |
else |
| |
echo_message(' '.$phpWebFileManager_LANG['chmod_ok']); |
| } |
} |
| echo ".</small>"; |
|
| } |
} |
| } |
} |
| } |
} |
| } |
} |
| else echo "<small>Operation canceled.</small>"; |
else echo_message($phpWebFileManager_LANG['canceled']); |
| echo "<br><br>"; |
echo "<br><br>"; |
| } |
} |
| |
|
|
|
| * file upload action |
* file upload action |
| */ |
*/ |
| if ($fm_action == "upload_file" && ! $phpWebFileManager_DENY_FILE_UPLOAD) { |
if ($fm_action == "upload_file" && ! $phpWebFileManager_DENY_FILE_UPLOAD) { |
| if ($submit == "Upload" and $fm_userfile_name != "") { |
if ($submit == $phpWebFileManager_LANG['file_upload'] && $fm_userfile_name != "") { |
| |
|
| $tmp_target_filename = $target_filename = $fm_userfile_name; |
$tmp_target_filename = $target_filename = $fm_userfile_name; |
| |
|
| $i = 2; |
$i = 2; |
| while (file_exists($tmp_target_filename)) { |
while (file_exists($tmp_target_filename)) { |
| if ($i == 2) |
if ($i == 2) { |
| echo "<small>Filename already exists." |
echo_message($phpWebFileManager_LANG['filename_changed']); |
| . " Filename changed.</small><br>"; |
echo '<br>'; |
| $tmp_target_filename = $target_filename . "-" . $i; |
} |
| |
$tmp_target_filename = $target_filename . '-' . $i; |
| $i++; |
$i++; |
| } |
} |
| |
|
|
|
| |
|
| if (@copy($fm_userfile, $target_filename)) { |
if (@copy($fm_userfile, $target_filename)) { |
| |
|
| echo "<small>File was successfully uploaded"; |
echo_message($phpWebFileManager_LANG['file_upload_ok']); |
| |
|
| if ($phpWebFileManager_FILE_MODE != 0) { |
if ($phpWebFileManager_FILE_MODE != 0) { |
| if (@chmod($target_filename, |
if (@chmod($target_filename, |
| $phpWebFileManager_FILE_MODE) == false) |
$phpWebFileManager_FILE_MODE) == false) |
| echo ", but chmod() failed"; |
echo_message(' '.$phpWebFileManager_LANG['chmod_err']); |
| else echo ", chmod() OK"; |
else |
| |
echo_message(' '.$phpWebFileManager_LANG['chmod_ok']); |
| } |
} |
| echo ".</small>"; |
|
| } |
} |
| else |
else |
| echo "<small>Transmission error." |
echo_message($phpWebFileManager_LANG['file_upload_err']); |
| . " File was not successfully uploaded.</small>"; |
|
| } |
} |
| else echo "<small>Operation canceled.</small>"; |
else echo_message($phpWebFileManager_LANG['canceled']); |
| |
|
| echo "<br><br>"; |
echo "<br><br>"; |
| } |
} |
| |
|
| |
|
| echo "<table cellpadding=2 width=60%>"; |
echo "<table cellpadding=\"2\" width=\"60%\">"; |
| |
|
| $line = 0; |
$line = 0; |
| |
|
|
|
| |
|
| echo "<td align=center>" |
echo "<td align=center>" |
| . "<a href=\"$PHP_SELF_origvars_ue" . "fm_dir=$fm_dir_ue..\">" |
. "<a href=\"$PHP_SELF_origvars_ue" . "fm_dir=$fm_dir_ue..\">" |
| . "<img alt=\"Back\" border=0 src=\"icons/back.gif\"></a>" |
. "<img alt=\"" . $phpWebFileManager_LANG['back'] |
| . "</td>"; |
. "\" border=0 src=\"icons/back.gif\"></a>" . "</td>"; |
| |
|
| echo "<td width=100% colspan=4>" |
echo "<td width=\"100%\" colspan=\"4\">" |
| . "<a href=\"$PHP_SELF_origvars_ue" . "fm_dir=$fm_dir_ue..\">" |
. "<a href=\"$PHP_SELF_origvars_ue" . "fm_dir=$fm_dir_ue..\">" |
| . "(parent directory)</a>" |
. "(" . $phpWebFileManager_LANG['parent_dir'] . ")</a>" |
| . "</td>"; |
. "</td>"; |
| |
|
| echo "</tr>\n"; |
echo "</tr>\n"; |
|
|
| while ($entry = array_shift($listing)) { |
while ($entry = array_shift($listing)) { |
| $entry_he = htmlentities($entry); |
$entry_he = htmlentities($entry); |
| $entry_ue = htmlentities(rawurlencode($entry)); |
$entry_ue = htmlentities(rawurlencode($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)))) { |
| |
|
| echo "<tr valign=middle"; |
echo "<tr valign=middle"; |
|
|
| echo "<td align=center>"; |
echo "<td align=center>"; |
| |
|
| if (is_dir($entry)) { |
if (is_dir($entry)) { |
| if (! $phpWebFileManager_DENY_DIR_ENTER) |
if (! $phpWebFileManager_DENY_DIR_ENTER |
| |
&& ! is_link($entry)) |
| echo "<a href=\"$PHP_SELF_origvars_ue" |
echo "<a href=\"$PHP_SELF_origvars_ue" |
| . "fm_dir=$fm_dir_ue$entry_ue\">"; |
. "fm_dir=$fm_dir_ue$entry_ue\">"; |
| echo "<img alt=\"Directory\" border=0" |
|
| . " src=\"icons/dir.gif\">"; |
echo (is_link($entry) |
| if (! $phpWebFileManager_DENY_DIR_ENTER) |
? '<b>~</b>' |
| |
: "<img alt=\"" . $phpWebFileManager_LANG['dir'] |
| |
. "\" border=0 src=\"icons/dir.gif\">"); |
| |
|
| |
if (! $phpWebFileManager_DENY_DIR_ENTER |
| |
&& ! is_link($entry)) |
| echo "</a>"; |
echo "</a>"; |
| |
|
| echo "</td><td width=100%>"; |
echo "</td><td width=\"100%\">"; |
| |
|
| if (! $phpWebFileManager_DENY_DIR_ENTER) |
if (! $phpWebFileManager_DENY_DIR_ENTER |
| |
&& ! ($phpWebFileManager_DENY_DIR_FOLLOW_SYMLINKS |
| |
&& is_link($entry))) |
| echo "<a href=\"$PHP_SELF_origvars_ue" |
echo "<a href=\"$PHP_SELF_origvars_ue" |
| . "fm_dir=$fm_dir_ue$entry_ue\">" |
. "fm_dir=$fm_dir_ue$entry_ue\">" |
| . $entry_he . "</a>"; |
. $entry_he . "</a>"; |
| else |
else |
| echo "$entry"; |
echo "$entry_he"; |
| |
} |
| |
else { |
| |
echo (is_link($entry) ? '<b>@</b>' : ' '); |
| |
echo "</td><td width=\"100%\">" . $entry_he; |
| } |
} |
| else echo " </td><td width=100%>$entry_he"; |
|
| |
|
| echo "</td>"; |
echo "</td>"; |
| |
|
|
|
| if (! $phpWebFileManager_DENY_FILE_RENAME) |
if (! $phpWebFileManager_DENY_FILE_RENAME) |
| echo "[<a href=\"$PHP_SELF_origvars_ue" |
echo "[<a href=\"$PHP_SELF_origvars_ue" |
| . "fm_dir=$fm_dir_ue&fm_action=confirm_rename_file" |
. "fm_dir=$fm_dir_ue&fm_action=confirm_rename_file" |
| . "&fm_filename=$entry_ue\">Rename</a>]"; |
. "&fm_filename=$entry_ue\">" |
| |
. $phpWebFileManager_LANG['file_rename'] |
| |
. "</a>]"; |
| echo "</small></td>"; |
echo "</small></td>"; |
| } |
} |
| |
|
|
|
| if (! $phpWebFileManager_DENY_FILE_DELETE) |
if (! $phpWebFileManager_DENY_FILE_DELETE) |
| echo "[<a href=\"$PHP_SELF_origvars_ue" |
echo "[<a href=\"$PHP_SELF_origvars_ue" |
| ."fm_dir=$fm_dir_ue&fm_action=confirm_delete_file" |
."fm_dir=$fm_dir_ue&fm_action=confirm_delete_file" |
| . "&fm_filename=$entry_ue\">Delete</a>]"; |
. "&fm_filename=$entry_ue\">" |
| |
. $phpWebFileManager_LANG['file_delete'] |
| |
. "</a>]"; |
| echo "</small></td>"; |
echo "</small></td>"; |
| } |
} |
| |
|
|
|
| $url['path'] = get_path_without_scriptname($url) |
$url['path'] = get_path_without_scriptname($url) |
| . (strlen($phpWebFileManager_LINKS_PREFIX) > 0 |
. (strlen($phpWebFileManager_LINKS_PREFIX) > 0 |
| ? $phpWebFileManager_LINKS_PREFIX |
? $phpWebFileManager_LINKS_PREFIX |
| : $phpWebFileManager_ROOT_DIR ) |
: $phpWebFileManager_ROOT_DIR) |
| . $fm_dir_he . $entry_he; |
. $fm_dir_he . $entry_he; |
| unset($url['query']); |
unset($url['query']); |
| unset($url['fragment']); |
unset($url['fragment']); |
|
|
| echo "<td><small>"; |
echo "<td><small>"; |
| if (! $phpWebFileManager_DENY_FILE_VIEW) |
if (! $phpWebFileManager_DENY_FILE_VIEW) |
| echo "[<a target=_blank href=\"" |
echo "[<a target=_blank href=\"" |
| . glue_url($url) . "\">View</a>]"; |
. glue_url($url) . "\">" |
| |
. $phpWebFileManager_LANG['file_view'] |
| |
. "</a>]"; |
| echo "</small></td>"; |
echo "</small></td>"; |
| } |
} |
| } |
} |
|
|
| echo "<td><small>"; |
echo "<td><small>"; |
| if (! $phpWebFileManager_DENY_DIR_RENAME) |
if (! $phpWebFileManager_DENY_DIR_RENAME) |
| echo "[<a href=\"$PHP_SELF_origvars_ue" |
echo "[<a href=\"$PHP_SELF_origvars_ue" |
| . "fm_dir=$fm_dir_ue&fm_action=confirm_rename_directory" |
. "fm_dir=$fm_dir_ue" |
| . "&fm_filename=$entry_ue\">Rename</a>]"; |
. "&fm_action=confirm_rename_directory" |
| |
. "&fm_filename=$entry_ue\">" |
| |
. $phpWebFileManager_LANG['dir_rename'] |
| |
. "</a>]"; |
| echo "</small></td>"; |
echo "</small></td>"; |
| } |
} |
| |
|
|
|
| echo "<td><small>"; |
echo "<td><small>"; |
| if (! $phpWebFileManager_DENY_DIR_REMOVE) |
if (! $phpWebFileManager_DENY_DIR_REMOVE) |
| echo "[<a href=\"$PHP_SELF_origvars_ue" |
echo "[<a href=\"$PHP_SELF_origvars_ue" |
| . "fm_dir=$fm_dir_ue&fm_action=confirm_remove_directory" |
. "fm_dir=$fm_dir_ue" |
| . "&fm_filename=$entry_ue\">Remove</a>]"; |
. "&fm_action=confirm_remove_directory" |
| |
. "&fm_filename=$entry_ue\">" |
| |
. $phpWebFileManager_LANG['dir_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 |
| |
&& ! ($phpWebFileManager_DENY_DIR_FOLLOW_SYMLINKS |
| |
&& is_link($entry))) |
| echo "[<a href=\"$PHP_SELF_origvars_ue" |
echo "[<a href=\"$PHP_SELF_origvars_ue" |
| . "fm_dir=$fm_dir_ue$entry_ue\">Enter</a>]"; |
. "fm_dir=$fm_dir_ue$entry_ue\">" |
| |
. $phpWebFileManager_LANG['dir_enter'] |
| |
."</a>]"; |
| echo "</small></td>"; |
echo "</small></td>"; |
| } |
} |
| } |
} |
|
|
| echo "<br>[<a href=$PHP_SELF_origvars_ue" |
echo "<br>[<a href=$PHP_SELF_origvars_ue" |
| . "fm_dir=$fm_dir_ue" |
. "fm_dir=$fm_dir_ue" |
| . "&fm_action=confirm_create_directory>" |
. "&fm_action=confirm_create_directory>" |
| . "Create a new directory</a>]"; |
. $phpWebFileManager_LANG['dir_create'] |
| |
. "</a>]"; |
| |
|
| if (! $phpWebFileManager_DENY_FILE_CREATE) |
if (! $phpWebFileManager_DENY_FILE_CREATE) |
| echo " [<a href=$PHP_SELF_origvars_ue" |
echo " [<a href=$PHP_SELF_origvars_ue" |
| . "fm_dir=$fm_dir_ue" |
. "fm_dir=$fm_dir_ue" |
| . "&fm_action=confirm_create_file>" |
. "&fm_action=confirm_create_file>" |
| . "Create an empty file</a>]"; |
. $phpWebFileManager_LANG['file_create'] |
| |
. "</a>]"; |
| |
|
| if (! $phpWebFileManager_DENY_FILE_UPLOAD) |
if (! $phpWebFileManager_DENY_FILE_UPLOAD) |
| echo " [<a href=$PHP_SELF_origvars_ue" |
echo " [<a href=$PHP_SELF_origvars_ue" |
| . "fm_dir=$fm_dir_ue" |
. "fm_dir=$fm_dir_ue" |
| . "&fm_action=confirm_upload_file>" |
. "&fm_action=confirm_upload_file>" |
| . "File upload</a>]"; |
. $phpWebFileManager_LANG['file_upload'] |
| |
. "</a>]"; |
| |
|
| echo "</small></td></tr>"; |
echo "</small></td></tr>"; |
| } |
} |
|
|
| /* Now return back to the initial working directory. */ |
/* Now return back to the initial working directory. */ |
| chdir($orig_dir); |
chdir($orig_dir); |
| |
|
| ?> |
echo "</form>"; |
| </form> |
|
| </tt> |
|
| |
|
| |
?> |