Index: /sandbox/filemanager/setup/phpgw_pt-br.lang
===================================================================
--- /sandbox/filemanager/setup/phpgw_pt-br.lang	(revision 1529)
+++ /sandbox/filemanager/setup/phpgw_pt-br.lang	(revision 1533)
@@ -109,4 +109,7 @@
 users	filemanager	pt-br	Usuários
 version	filemanager	pt-br	Versão
+Impossbile to edit this file	filemanager	pt-br	Impossível editar o arquivo selecionado
+Enter with the name of new file/directory	filemanager	pt-br	Insira o nome do novo arquivo/diretório
+File extension forbidden or invalid file	filemanager	pt-br	Formato de arquivo inválido
 view documents in new window	filemanager	pt-br	Visualizar documentos em uma nova janela
 view documents on server (if available)	filemanager	pt-br	Visualizar documentos no servidor (se disponível)
Index: /sandbox/filemanager/inc/class.uifilemanager.inc.php
===================================================================
--- /sandbox/filemanager/inc/class.uifilemanager.inc.php	(revision 1529)
+++ /sandbox/filemanager/inc/class.uifilemanager.inc.php	(revision 1533)
@@ -293,5 +293,13 @@
 				$this->path = $this->cdtodir;
 			}
-*/
+ */
+			if(!$this->bo->vfs->acl_check(array(
+				'string' => $this->path,
+				'relatives' => array(RELATIVE_NONE),
+				'operation' => PHPGW_ACL_READ
+			)))
+			{
+				$this->path = $this->bo->homedir;	
+			}
 			// new method for switching to a new dir.
 			if($this->changedir=='true' && $this->cdtodir || $this->goto_x)
@@ -356,5 +364,4 @@
 				}
 			$this->readable_groups = array();
-
 			while(list($num, $account) = each($groups))
 			{
@@ -386,5 +393,4 @@
 				$this->bo->vfs->working_id = $this->bo->userinfo['username'];
 			}
-
 
 			# FIXME # comment waht happens here
@@ -1086,5 +1092,6 @@
 						}
 
-						if(!$this->rename_x && $this->can_edit)
+						if(!$this->rename_x && $this->can_edit && 
+                                                $_SESSION['phpgw_info']['user']['preferences']['filemanager']['comment'] == 1)
 						{
 							$toolbar.=$this->inputImage('edit_comments','edit_comments',lang('Edit comments'));
@@ -1183,5 +1190,5 @@
 					 $c->read_repository();
 					 $current_config = $c->config_data;
-					 $max_size = $current_config['filemanager_Max_attachment_size'];
+					 $max_size = $current_config['filemanager_Max_file_size'];
 					 if (! $max_size)
 						 $max_size = ini_get('upload_max_filesize');
@@ -1384,9 +1391,9 @@
 					{
 						$copied++;
-						$this->message .= lang('Copied %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file);
+						$this->messages[] .= lang('Copied %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file);
 					}
 					else
 					{
-						$this->message .= $GLOBALS['phpgw']->common->error_list(array(lang('Could not copy %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file)));
+						$this->messages[] .= lang('Could not copy %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file);
 					}
 				}
@@ -1599,4 +1606,31 @@
 		function edit()
 		{
+			$files = array_keys($this->fileman);
+			$this->file = $this->fileman[$files[0]];
+			if($this->file)
+			{
+				$ls_array = $this->bo->vfs->ls(array(
+					'string'        => $this->path.'/'.$this->file,
+					'relatives'     => array(RELATIVE_ALL),
+					'checksubdirs'  => False,
+					'nofiles'       => True
+				));
+
+				if($ls_array[0]['mime_type'])
+				{
+					$mime_type = $ls_array[0]['mime_type'];
+				}
+				elseif($this->prefs['viewtextplain'])
+				{
+					$mime_type = 'text/plain';
+				}
+				$viewable = array('','text/plain','text/csv','text/html','text/text');
+
+				if(!in_array($mime_type,$viewable)){
+					echo lang('Inpossbile to edit this file');
+					return False;
+				}
+			}
+
 			$this->readFilesInfo();
 
Index: /sandbox/filemanager/js/common_functions.js
===================================================================
--- /sandbox/filemanager/js/common_functions.js	(revision 1529)
+++ /sandbox/filemanager/js/common_functions.js	(revision 1533)
@@ -16,4 +16,5 @@
 			}
 			break
+		case 'edit':
 		default:
 			return true;
Index: /sandbox/filemanager/index.php
===================================================================
--- /sandbox/filemanager/index.php	(revision 1529)
+++ /sandbox/filemanager/index.php	(revision 1533)
@@ -20,6 +20,6 @@
 
 	include('../header.inc.php');
-/*	$preferences = $GLOBALS['phpgw']->preferences->read();
-$_SESSION['phpgw_info']['user']['preferences']['filemanager'] = $preferences['filemanager'];*/
+	$preferences = $GLOBALS['phpgw']->preferences->read();
+	$_SESSION['phpgw_info']['user']['preferences']['filemanager'] = $preferences['filemanager'];
 
 	Header('Location: '.$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.index'));
Index: /sandbox/filemanager/templates/default/config.tpl
===================================================================
--- /sandbox/filemanager/templates/default/config.tpl	(revision 1529)
+++ /sandbox/filemanager/templates/default/config.tpl	(revision 1533)
@@ -8,7 +8,7 @@
 <!-- BEGIN body -->
     <tr bgcolor="{row_on}"> 	 	 
-    <td>{lang_Max_attachment_size}</td> 	 	 
+    <td>{lang_Max_file_size}</td> 	 	 
     <td> 	 	 
-    <input size="1" name="newsettings[filemanager_Max_attachment_size]" value="{value_filemanager_Max_attachment_size}">&nbsp;Mb
+    <input size="1" name="newsettings[filemanager_Max_file_size]" value="{value_filemanager_Max_file_size}">&nbsp;Mb
     </td>
     </tr>
