2010-07-07 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_filemanager.php: added var global through $config to
	return status of operation. And clean messages of filemanager.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2972 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-07-08 09:01:31 +00:00
parent d8e6992254
commit a1a103534a
2 changed files with 39 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2010-07-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_filemanager.php: added var global through $config to
return status of operation. And clean messages of filemanager.
2010-07-07 Miguel de Dios <miguel.dedios@artica.es> 2010-07-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_db.php: changed in function "get_db_all_rows_filter" the * include/functions_db.php: changed in function "get_db_all_rows_filter" the

View File

@ -128,6 +128,9 @@ if ($upload_file) {
// Load global vars // Load global vars
global $config; global $config;
$config['filemanager'] = array();
$config['filemanager']['correct_upload_file'] = 0;
check_login (); check_login ();
if (! give_acl ($config['id_user'], 0, "PM")) { if (! give_acl ($config['id_user'], 0, "PM")) {
@ -152,6 +155,8 @@ if ($upload_file) {
if (! @copy ($_FILES['file']['tmp_name'], $nombre_archivo )) { if (! @copy ($_FILES['file']['tmp_name'], $nombre_archivo )) {
echo "<h3 class=error>".__('attach_error')."</h3>"; echo "<h3 class=error>".__('attach_error')."</h3>";
} else { } else {
$config['filemanager']['correct_upload_file'] = 1;
// Delete temporal file // Delete temporal file
unlink ($_FILES['file']['tmp_name']); unlink ($_FILES['file']['tmp_name']);
} }
@ -165,6 +170,9 @@ if ($create_text_file) {
// Load global vars // Load global vars
global $config; global $config;
$config['filemanager'] = array();
$config['filemanager']['correct_upload_file'] = 0;
check_login (); check_login ();
if (! give_acl ($config['id_user'], 0, "PM")) { if (! give_acl ($config['id_user'], 0, "PM")) {
@ -189,6 +197,9 @@ if ($create_text_file) {
if (! @touch($nombre_archivo)) { if (! @touch($nombre_archivo)) {
echo "<h3 class=error>".__('Error create file.')."</h3>"; echo "<h3 class=error>".__('Error create file.')."</h3>";
} }
else {
$config['filemanager']['correct_upload_file'] = 1;
}
} }
else { else {
echo "<h3 class=error>".__('Error create file with empty name.')."</h3>"; echo "<h3 class=error>".__('Error create file with empty name.')."</h3>";
@ -200,6 +211,9 @@ if ($upload_zip) {
// Load global vars // Load global vars
global $config; global $config;
$config['filemanager'] = array();
$config['filemanager']['correct_upload_file'] = 0;
check_login (); check_login ();
if (! give_acl ($config['id_user'], 0, "PM")) { if (! give_acl ($config['id_user'], 0, "PM")) {
@ -235,7 +249,9 @@ if ($upload_zip) {
if ($zip->open($nombre_archivo) === true) { if ($zip->open($nombre_archivo) === true) {
$zip->extractTo($pathname); $zip->extractTo($pathname);
unlink($nombre_archivo); unlink($nombre_archivo);
} }
$config['filemanager']['correct_upload_file'] = 1;
} }
} }
@ -244,12 +260,19 @@ if ($upload_zip) {
// CREATE DIR // CREATE DIR
$create_dir = (bool) get_parameter ('create_dir'); $create_dir = (bool) get_parameter ('create_dir');
if ($create_dir) { if ($create_dir) {
global $config;
$config['filemanager'] = array();
$config['filemanager']['correct_create_dir'] = 0;
$directory = (string) get_parameter ('directory', "/"); $directory = (string) get_parameter ('directory', "/");
$dirname = (string) get_parameter ('dirname'); $dirname = (string) get_parameter ('dirname');
if ($dirname != '') { if ($dirname != '') {
@mkdir ($directory.'/'.$dirname); @mkdir ($directory.'/'.$dirname);
echo '<h3>'.__('Created directory %s', $dirname).'</h3>'; echo '<h3>'.__('Created directory %s', $dirname).'</h3>';
$config['filemanager']['correct_create_dir'] = 1;
} }
else { else {
echo "<h3 class=error>".__('Error create file with empty name.')."</h3>"; echo "<h3 class=error>".__('Error create file with empty name.')."</h3>";
@ -259,12 +282,19 @@ if ($create_dir) {
//DELETE FILE OR DIR //DELETE FILE OR DIR
$delete_file = (bool) get_parameter ('delete_file'); $delete_file = (bool) get_parameter ('delete_file');
if ($delete_file) { if ($delete_file) {
global $config;
$config['filemanager'] = array();
$config['filemanager']['delete'] = 0;
$filename = (string) get_parameter ('filename'); $filename = (string) get_parameter ('filename');
echo "<h3>".__('Deleting')." ".$filename."</h3>"; echo "<h3>".__('Deleting')." ".$filename."</h3>";
if (is_dir ($filename)) { if (is_dir ($filename)) {
rmdir ($filename); rmdir ($filename);
$config['filemanager']['delete'] = 1;
} else { } else {
unlink ($filename); unlink ($filename);
$config['filemanager']['delete'] = 1;
} }
} }
@ -397,7 +427,7 @@ function file_explorer($real_directory, $relative_directory, $url, $father = '',
$table->data[1][1] .= '<div id="upload_file" style="display: none;">'; $table->data[1][1] .= '<div id="upload_file" style="display: none;">';
$table->data[1][1] .= print_button(__('Close'), 'close', false, 'show_main_buttons_folder();', "class='sub' style='float: left;'", true); $table->data[1][1] .= print_button(__('Close'), 'close', false, 'show_main_buttons_folder();', "class='sub' style='float: left;'", true);
$table->data[1][1] .= '<form method="post" action="' . $url . '" enctype="multipart/form-data">'; $table->data[1][1] .= '<form method="post" action="' . $url . '" enctype="multipart/form-data">';
$table->data[1][1] .= print_help_tip (__("The zip upload in this collection, easy to upload multiple files."), true); $table->data[1][1] .= print_help_tip (__("The zip upload in this dir, easy to upload multiple files."), true);
$table->data[1][1] .= print_input_file ('file', true, false); $table->data[1][1] .= print_input_file ('file', true, false);
$table->data[1][1] .= print_radio_button('zip_or_file', 'zip', '', false, true) . __('Multiple files zipped'); $table->data[1][1] .= print_radio_button('zip_or_file', 'zip', '', false, true) . __('Multiple files zipped');
$table->data[1][1] .= print_radio_button('zip_or_file', 'file', '', true, true) . __('One'); $table->data[1][1] .= print_radio_button('zip_or_file', 'file', '', true, true) . __('One');
@ -498,7 +528,7 @@ function box_upload_file_complex($real_directory, $relative_directory, $url = ''
echo __('Please check that current directory has write rights for HTTP server'); echo __('Please check that current directory has write rights for HTTP server');
echo '</p>'; echo '</p>';
} else { } else {
$table->data[1][0] = __('Upload') . print_help_tip (__("The zip upload in this collection, easy to upload multiple files."), true); $table->data[1][0] = __('Upload') . print_help_tip (__("The zip upload in this dir, easy to upload multiple files."), true);
$table->data[1][1] = print_input_file ('file', true, false); $table->data[1][1] = print_input_file ('file', true, false);
$table->data[1][2] = print_radio_button('zip_or_file', 'zip', __('Multiple files zipped'), false, true); $table->data[1][2] = print_radio_button('zip_or_file', 'zip', __('Multiple files zipped'), false, true);
$table->data[1][3] = print_radio_button('zip_or_file', 'file', __('One'), true, true); $table->data[1][3] = print_radio_button('zip_or_file', 'file', __('One'), true, true);
@ -564,7 +594,7 @@ function box_upload_zip_explorer($real_directory, $relative_directory, $url = ''
echo __('Please check that current directory has write rights for HTTP server'); echo __('Please check that current directory has write rights for HTTP server');
echo '</p>'; echo '</p>';
} else { } else {
$table->data[1][0] = __('Upload zip file: ') . print_help_tip (__("The zip upload in this collection, easy to upload multiple files."), true); $table->data[1][0] = __('Upload zip file: ') . print_help_tip (__("The zip upload in this dir, easy to upload multiple files."), true);
$table->data[1][1] = print_input_file ('file', true, false); $table->data[1][1] = print_input_file ('file', true, false);
$table->data[1][2] = print_submit_button (__('Go'), 'go', false, $table->data[1][2] = print_submit_button (__('Go'), 'go', false,
'class="sub next"', true); 'class="sub next"', true);