| version 1.2, 2001/09/24 14:15:41 |
version 1.3, 2001/09/25 16:16:02 |
| Line 102 elseif ($action == "confirm_remove_direc |
|
| Line 102 elseif ($action == "confirm_remove_direc |
|
| } |
} |
| |
|
| /* |
/* |
| * confirm rename files action |
* confirm rename files action and confirm rename directory action |
| */ |
*/ |
| elseif ($action == "confirm_rename_file") { |
elseif ($action == "confirm_rename_file" |
| echo "<input type=hidden value=rename_file name=action>"; |
|| $action == "confirm_rename_directory") { |
| |
echo "<input type=hidden value="; |
| |
echo $action == "confirm_rename_directory" |
| |
? "rename_directory" : "rename_file"; |
| |
echo " name=action>"; |
| |
|
| echo "Rename from<br><br><i>$filename</i><br><br>to<br><br>"; |
echo "Rename from<br><br><i>$filename</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>"; |
| Line 116 elseif ($action == "confirm_rename_file" |
|
| Line 120 elseif ($action == "confirm_rename_file" |
|
| /* |
/* |
| * confirm create direcotry and confirm create file actions |
* confirm create direcotry and confirm create file actions |
| */ |
*/ |
| elseif ($action == "confirm_create_directory" || $action == "confirm_create_file") { |
elseif ($action == "confirm_create_directory" |
| echo "<input type=hidden value= "; |
|| $action == "confirm_create_file") { |
| echo $action == "confirm_create_directory" ? "create_directory" : "create_file"; |
echo "<input type=hidden value="; |
| |
echo $action == "confirm_create_directory" |
| |
? "create_directory" : "create_file"; |
| echo " name=action>"; |
echo " name=action>"; |
| |
|
| echo "Enter the name:<br><br>"; |
echo "Enter the name:<br><br>"; |
|
|
| /* |
/* |
| * delete action |
* delete action |
| */ |
*/ |
| if ($action == "delete_file") { |
if ($action == "delete_file" && ! $phpWebFileManager_DENY_FILE_DELETE) { |
| if ($submit == "Delete") { |
if ($submit == "Delete") { |
| if (@unlink($filename) == false) |
if (@unlink($filename) == false) |
| echo "<small>File removing failed. Delete was not successful.</small>"; |
echo "<small>File removing failed. Delete was not successful.</small>"; |
|
|
| /* |
/* |
| * remove direcotry |
* remove direcotry |
| */ |
*/ |
| if ($action == "remove_directory") { |
if ($action == "remove_directory" && ! $phpWebFileManager_DENY_DIR_REMOVE) { |
| if ($submit == "Remove") { |
if ($submit == "Remove") { |
| if (@rmdir($filename) == 0) |
if (@rmdir($filename) == 0) |
| echo "<small>Directory removing failed. Is it empty?</small>"; |
echo "<small>Directory removing failed. Is it empty?</small>"; |
|
|
| /* |
/* |
| * rename action |
* rename action |
| */ |
*/ |
| if ($action == "rename_file") { |
if (($action == "rename_directory" && ! $phpWebFileManager_DENY_DIR_RENAME) |
| |
|| ($action == "rename_file" && ! $phpWebFileManager_DENY_FILE_RENAME)) { |
| if ($submit == "Rename" and $new_filename != "") { |
if ($submit == "Rename" and $new_filename != "") { |
| if (@rename($filename, $new_filename) == false) |
if (@rename($filename, $new_filename) == false) |
| echo "<small>Filename changing failed. File was not renamed.</small>"; |
echo "<small>Filename changing failed. File was not renamed.</small>"; |
|
|
| /* |
/* |
| * create direcotry and create file actions |
* create direcotry and create file actions |
| */ |
*/ |
| if ($action == "create_directory" || $action == "create_file") { |
if (($action == "create_directory" && ! $phpWebFileManager_DENY_DIR_CREATE) |
| |
|| ($action == "create_file" && ! $phpWebFileManager_DENY_FILE_CREATE)) { |
| if ($submit == "Create" and $new_filename != "") { |
if ($submit == "Create" and $new_filename != "") { |
| if ($action == "create_directory") { |
if ($action == "create_directory") { |
| if (@mkdir($new_filename, $phpWebFileManager_DIR_MODE) == false) |
if (@mkdir($new_filename, $phpWebFileManager_DIR_MODE) == false) |
|
|
| else echo "<small>Directory was succesfully created.</small>"; |
else echo "<small>Directory was succesfully created.</small>"; |
| } |
} |
| else { |
else { |
| if (file_exists($new_filename)) echo "<small>Creation failed. File already exists.</small>"; |
if (file_exists($new_filename)) |
| |
echo "<small>Creation failed. File already exists.</small>"; |
| else { |
else { |
| if (($fh = @fopen($new_filename, "w")) == false) |
if (($fh = @fopen($new_filename, "w")) == false) |
| echo "<small>Creation failed. No space left on the device?</small>"; |
echo "<small>Creation failed. No space left on the device?</small>"; |
|
|
| echo "<small>File was successfully created"; |
echo "<small>File was successfully created"; |
| |
|
| if ($phpWebFileManager_FILE_MODE != 0) { |
if ($phpWebFileManager_FILE_MODE != 0) { |
| if (chmod($new_filename, $phpWebFileManager_FILE_MODE) == false) echo ", but chmod() failed"; |
if (chmod($new_filename, $phpWebFileManager_FILE_MODE) == false) |
| |
echo ", but chmod() failed"; |
| else echo ", chmod() OK"; |
else echo ", chmod() OK"; |
| } |
} |
| echo ".</small>"; |
echo ".</small>"; |
|
|
| /* |
/* |
| * file upload action |
* file upload action |
| */ |
*/ |
| if ($action == "upload_file") { |
if ($action == "upload_file" && ! $phpWebFileManager_DENY_FILE_UPLOAD) { |
| if ($submit == "Upload" and $userfile_name != "") { |
if ($submit == "Upload" and $userfile_name != "") { |
| |
|
| $tmp_target_filename = $target_filename = $userfile_name; |
$tmp_target_filename = $target_filename = $userfile_name; |
| |
|
| $i = 2; |
$i = 2; |
| while (file_exists($tmp_target_filename)) { |
while (file_exists($tmp_target_filename)) { |
| if ($i == 2) echo "<small>Filename already exists. Filename changed.</small><br>"; |
if ($i == 2) |
| |
echo "<small>Filename already exists. Filename changed.</small><br>"; |
| $tmp_target_filename = $target_filename . "-" . $i; |
$tmp_target_filename = $target_filename . "-" . $i; |
| $i++; |
$i++; |
| } |
} |
|
|
| |
|
| echo "</td>"; |
echo "</td>"; |
| |
|
| echo "<td><small>"; |
|
| echo "[<a href=\"$PHPSELF?$origvars"."dir=$dir&action=confirm_rename_file&filename=$entry\">Rename</a>]"; |
|
| echo "</small></td>"; |
|
| |
|
| if (! is_dir($entry)) { |
if (! is_dir($entry)) { |
| |
|
| |
echo "<td><small>"; |
| |
echo "[<a href=\"$PHPSELF?$origvars"."dir=$dir&action=confirm_rename_file&filename=$entry\">Rename</a>]"; |
| |
echo "</small></td>"; |
| |
|
| $url = parse_url("http://${HTTP_HOST}${REQUEST_URI}"); |
$url = parse_url("http://${HTTP_HOST}${REQUEST_URI}"); |
| $url['path'] = get_path_without_scriptname($url) . $phpWebFileManager_ROOT_DIR . $dir . $entry; |
$url['path'] = get_path_without_scriptname($url) . $phpWebFileManager_ROOT_DIR . $dir . $entry; |
| unset($url['query']); |
unset($url['query']); |
|
|
| echo "</small></td>"; |
echo "</small></td>"; |
| } |
} |
| else { |
else { |
| |
|
| |
echo "<td><small>"; |
| |
echo "[<a href=\"$PHPSELF?$origvars"."dir=$dir&action=confirm_rename_directory&filename=$entry\">Rename</a>]"; |
| |
echo "</small></td>"; |
| |
|
| echo "<td><small>"; |
echo "<td><small>"; |
| echo "[<a href=\"$PHPSELF?$origvars"."dir=$dir&action=confirm_remove_directory&filename=$entry\">Remove</a>]"; |
echo "[<a href=\"$PHPSELF?$origvars"."dir=$dir&action=confirm_remove_directory&filename=$entry\">Remove</a>]"; |
| echo "</small></td>"; |
echo "</small></td>"; |