2010-01-20 Ramon Novoa <rnovoa@artica.es>

* godmode/setup/file_manager.php: Added support for file and empty
          directory deletion.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2291 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2010-01-20 18:01:57 +00:00
parent c0a3782a05
commit 49666f0ab6
2 changed files with 24 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2010-01-20 Ramon Novoa <rnovoa@artica.es>
* godmode/setup/file_manager.php: Added support for file and empty
directory deletion.
2010-01-20 Ramon Novoa <rnovoa@artica.es> 2010-01-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_fsgraph.php: Fixed paths for Fusion Charts. * include/functions_fsgraph.php: Fixed paths for Fusion Charts.

View File

@ -51,13 +51,12 @@ if ($upload_file) {
if ($delete_file) { if ($delete_file) {
echo "<h1>".__('Deleting file')."</h1>"; echo "<h1>".__('Deleting file')."</h1>";
$file = (string) get_parameter ('filename'); $filename = (string) get_parameter ('filename');
$directory = (string) get_parameter ('directory'); echo "<h3>".__('Deleting')." ".$filename."</h3>";
if (is_dir ($filename)) {
$full_filename = $directory.'/'.$file; rmdir ($filename);
if (!is_dir ($full_filename)){ } else {
echo "<h3>".__('Deleting')." ".$full_filename."</h3>"; unlink ($filename);
unlink ($full_filename);
} }
} }
@ -146,7 +145,7 @@ $table->head[0] = '';
$table->head[1] = __('Name'); $table->head[1] = __('Name');
$table->head[2] = __('Last modification'); $table->head[2] = __('Last modification');
$table->head[3] = __('Size'); $table->head[3] = __('Size');
$table->head[4] = ''; $table->head[4] = __('Delete');
$prev_dir = split ("/", $directory); $prev_dir = split ("/", $directory);
$prev_dir_str = ""; $prev_dir_str = "";
@ -208,6 +207,18 @@ foreach ($files as $fileinfo) {
$data[3] = format_filesize ($fileinfo['size']); $data[3] = format_filesize ($fileinfo['size']);
} }
# Delete button
if (is_writable ($fileinfo['realpath']) &&
(! is_dir ($fileinfo['realpath']) || count (scandir ($fileinfo['realpath'])) < 3)) {
$data[4] = '<form method="post" action="index.php?sec=gsetup&amp;sec2=godmode/setup/file_manager">';
$data[4] .= '<input type="image" src="images/cross.png" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[4] .= print_input_hidden ('filename', $fileinfo['realpath'], true);
$data[4] .= print_input_hidden ('delete_file', 1, true);
$data[4] .= '</form>';
} else {
$data[4] = '';
}
array_push ($table->data, $data); array_push ($table->data, $data);
} }