From a1a103534a80b038750064f928262cf53372ea9c Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Thu, 8 Jul 2010 09:01:31 +0000
Subject: [PATCH] 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
---
 pandora_console/ChangeLog                     |  5 +++
 .../include/functions_filemanager.php         | 38 +++++++++++++++++--
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 9d7850802f..8dfbb66982 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -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>
 
 	* include/functions_db.php: changed in function "get_db_all_rows_filter" the
diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php
index 35a333b187..1cbdaae177 100644
--- a/pandora_console/include/functions_filemanager.php
+++ b/pandora_console/include/functions_filemanager.php
@@ -128,6 +128,9 @@ if ($upload_file) {
 	// Load global vars
 	global $config;
 	
+	$config['filemanager'] = array();
+	$config['filemanager']['correct_upload_file'] = 0;
+	
 	check_login ();
 	
 	if (! give_acl ($config['id_user'], 0, "PM")) {
@@ -152,6 +155,8 @@ if ($upload_file) {
 		if (! @copy ($_FILES['file']['tmp_name'], $nombre_archivo )) {
 			echo "<h3 class=error>".__('attach_error')."</h3>";
 		} else {
+			$config['filemanager']['correct_upload_file'] = 1;
+			
 			// Delete temporal file
 			unlink ($_FILES['file']['tmp_name']);
 		}
@@ -165,6 +170,9 @@ if ($create_text_file) {
 	// Load global vars
 	global $config;
 	
+	$config['filemanager'] = array();
+	$config['filemanager']['correct_upload_file'] = 0;
+	
 	check_login ();
 	
 	if (! give_acl ($config['id_user'], 0, "PM")) {
@@ -189,6 +197,9 @@ if ($create_text_file) {
 		if (! @touch($nombre_archivo)) {
 			echo "<h3 class=error>".__('Error create file.')."</h3>";
 		}
+		else {
+			$config['filemanager']['correct_upload_file'] = 1;
+		}
 	}
 	else {
 		echo "<h3 class=error>".__('Error create file with empty name.')."</h3>";
@@ -200,6 +211,9 @@ if ($upload_zip) {
 	// Load global vars
 	global $config;
 	
+	$config['filemanager'] = array();
+	$config['filemanager']['correct_upload_file'] = 0;
+	
 	check_login ();
 	
 	if (! give_acl ($config['id_user'], 0, "PM")) {
@@ -235,7 +249,9 @@ if ($upload_zip) {
 			if ($zip->open($nombre_archivo) === true) {
 				$zip->extractTo($pathname);
 				unlink($nombre_archivo);
-			}	
+			}
+
+			$config['filemanager']['correct_upload_file'] = 1;
 		}
 		
 	}
@@ -244,12 +260,19 @@ if ($upload_zip) {
 // CREATE DIR
 $create_dir = (bool) get_parameter ('create_dir');
 if ($create_dir) {
+	global $config;
+	
+	$config['filemanager'] = array();
+	$config['filemanager']['correct_create_dir'] = 0;
+	
 	$directory = (string) get_parameter ('directory', "/");
 	
 	$dirname = (string) get_parameter ('dirname');
 	if ($dirname != '') {
 		@mkdir ($directory.'/'.$dirname);
 		echo '<h3>'.__('Created directory %s', $dirname).'</h3>';
+		
+		$config['filemanager']['correct_create_dir'] = 1;
 	}
 	else {
 		echo "<h3 class=error>".__('Error create file with empty name.')."</h3>";
@@ -259,12 +282,19 @@ if ($create_dir) {
 //DELETE FILE OR DIR
 $delete_file = (bool) get_parameter ('delete_file');
 if ($delete_file) {
+	global $config;
+	
+	$config['filemanager'] = array();
+	$config['filemanager']['delete'] = 0;
+	
 	$filename = (string) get_parameter ('filename');
 	echo "<h3>".__('Deleting')." ".$filename."</h3>";
 	if (is_dir ($filename)) {		
 		rmdir ($filename);
+		$config['filemanager']['delete'] = 1;
 	} else {
 		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] .= 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] .= 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_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');
@@ -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 '</p>';
 	} 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][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);
@@ -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 '</p>';
 	} 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][2] = print_submit_button (__('Go'), 'go', false,
 			'class="sub next"', true);