Index: branches/2.2/filemanager/inc/class.uifilemanager.inc.php
===================================================================
--- branches/2.2/filemanager/inc/class.uifilemanager.inc.php	(revision 3873)
+++ branches/2.2/filemanager/inc/class.uifilemanager.inc.php	(revision 3879)
@@ -1,41 +1,41 @@
 <?php
-	/**************************************************************************\
-	* -------------------------------------------------------------------------*
-	* This library is free software; you can redistribute it and/or modify it  *
-	* under the terms of the GNU Lesser General Public License as published by *
-	* the Free Software Foundation; either version 2.1 of the License,         *
-	* or any later version.                                                    *
-	* This library is distributed in the hope that it will be useful, but      *
-	* WITHOUT ANY WARRANTY; without even the implied warranty of               *
-	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
-	* See the GNU Lesser General Public License for more details.              *
-	* You should have received a copy of the GNU Lesser General Public License *
-	* along with this library; if not, write to the Free Software Foundation,  *
-	* Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
-	\**************************************************************************/
-
-	/* $Id: class.uifilemanager.inc.php 17511 2004-12-12 06:35:24Z dawnlinux $ */
-
-class uifilemanager
-{
+
+/* * ************************************************************************\
+ * -------------------------------------------------------------------------*
+ * This library is free software; you can redistribute it and/or modify it  *
+ * under the terms of the GNU Lesser General Public License as published by *
+ * the Free Software Foundation; either version 2.1 of the License,         *
+ * or any later version.                                                    *
+ * This library is distributed in the hope that it will be useful, but      *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of               *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
+ * See the GNU Lesser General Public License for more details.              *
+ * You should have received a copy of the GNU Lesser General Public License *
+ * along with this library; if not, write to the Free Software Foundation,  *
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
+  \************************************************************************* */
+
+/* $Id: class.uifilemanager.inc.php 17511 2004-12-12 06:35:24Z dawnlinux $ */
+
+class uifilemanager {
+
 	var $public_functions = array(
-		'index'					=> True,
-		'help'					=> True,
-		'view'  				=> True,
-		'export'				=> True,
-		'touch' 				=> True,
-		'history' 				=> True,
-		'edit' 					=> True,
-		'fileModels'			=> True,
-		'getReturnExecuteForm'	=> True,
-		'dir_ls' 				=> True,
-		'search' 				=> True,
-		'get_folders_list' 		=> True,
-		'showUploadboxes' 		=> True,
-		'createdir' 			=> True,
-		'removedir' 			=> True,
-		'uploadModel'			=> True
+		 'index' => True,
+		 'help' => True,
+		 'view' => True,
+		 'export' => True,
+		 'touch' => True,
+		 'history' => True,
+		 'edit' => True,
+		 'fileModels' => True,
+		 'getReturnExecuteForm' => True,
+		 'dir_ls' => True,
+		 'search' => True,
+		 'get_folders_list' => True,
+		 'showUploadboxes' => True,
+		 'createdir' => True,
+		 'removedir' => True,
+		 'uploadModel' => True
 	);
-
 	//keep
 	var $bo;
@@ -49,11 +49,7 @@
 	var $numoffiles;
 	var $dispsep;
-
 	var $target;
-
-	var $prefs;//array
-
+	var $prefs; //array
 	var $groups_applications;
-
 	var $current_config;
 	var $dirs;
@@ -72,5 +68,4 @@
 	var $edit_save_done_x;
 	var $edit_cancel_x;
-
 	// this ones must be checked thorougly;
 	var $fileman = Array();
@@ -82,9 +77,7 @@
 	var $limit; //for paging (paginacao)
 	var $offset; //for paging (paginacao)
-
 	var $now;
 
-	function uifilemanager()
-	{
+	function uifilemanager() {
 		$this->messages = &$_SESSION['phpgw_info']['filemanager']['user']['messages'];
 
@@ -98,45 +91,38 @@
 
 		$this->t = $GLOBALS['phpgw']->template;
-		$c = CreateObject('phpgwapi.config','filemanager');
+		$c = CreateObject('phpgwapi.config', 'filemanager');
 		$c->read_repository();
+
 		$this->current_config = $c->config_data;
-
 
 		// here local vars are created from the HTTP vars
 		@reset($GLOBALS['HTTP_POST_VARS']);
-		while(list($name,) = @each($GLOBALS['HTTP_POST_VARS']))
-		{
+		while (list($name, ) = @each($GLOBALS['HTTP_POST_VARS'])) {
 			$this->$name = $GLOBALS['HTTP_POST_VARS'][$name];
 		}
 
 		@reset($GLOBALS['HTTP_GET_VARS']);
-		while(list($name,) = @each($GLOBALS['HTTP_GET_VARS']))
-		{
+		while (list($name, ) = @each($GLOBALS['HTTP_GET_VARS'])) {
 			$$name = $GLOBALS['HTTP_GET_VARS'][$name];
 			$this->$name = $GLOBALS['HTTP_GET_VARS'][$name];
-
 		}
 
 		$to_decode = array
-		(
-			'op'	=> array('op' => ''),
-			'path'	=> array('path' => ''),
-			'filename' => array('filename' => ''),
-			'file'	=> array('file' => ''),
-			'sortby'	=> array('sortby' => ''),
-			'messages'	=> array('messages'	=> ''),
-			'show_upload_boxes'	=> array('show_upload_boxes' => ''),
-			'from'	=>	array('from' => ''),
-			'to' => array('to' => '')
-
+			 (
+			 'op' => array('op' => ''),
+			 'path' => array('path' => ''),
+			 'filename' => array('filename' => ''),
+			 'file' => array('file' => ''),
+			 'sortby' => array('sortby' => ''),
+			 'messages' => array('messages' => ''),
+			 'show_upload_boxes' => array('show_upload_boxes' => ''),
+			 'from' => array('from' => ''),
+			 'to' => array('to' => '')
 		);
 
 		reset($to_decode);
-		while(list($var, $conditions) = each($to_decode))
-		{
-			while(list($condvar, $condvalue) = each($conditions))
-			{
-				if(isset($$condvar) && ($condvar == $var || $$condvar == $condvalue))
-				{
+		while (list($var, $conditions) = each($to_decode)) {
+			while (list($condvar, $condvalue) = each($conditions)) {
+				if (isset($$condvar) && ($condvar == $var || $$condvar == $condvalue)) {
 					$this->$var = stripslashes(base64_decode($$var));
 				}
@@ -151,12 +137,10 @@
 		$pref_array = $pref->read_repository();
 		$this->prefs = $pref_array[$this->bo->appname]; //FIXME check appname var in _debug_array
-
 		//always show name
 
-		$this->prefs[name] =1;
-
-
-		if($this->prefs['viewinnewwin'])
-		{
+		$this->prefs[name] = 1;
+
+
+		if ($this->prefs['viewinnewwin']) {
 			$this->target = '_blank';
 		}
@@ -164,53 +148,47 @@
 
 		/*
-			Check for essential directories
-			admin must be able to disable these tests
-		*/
-		
+		  Check for essential directories
+		  admin must be able to disable these tests
+		 */
+
 		// check if basedir exist 
-		$test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
-		if($test[mime_type]!='Directory')
-		{
+		$test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
+		if ($test[mime_type] != 'Directory') {
 			die('Base directory does not exist, Ask adminstrator to check the global configuration.');
 		}
 
-		$test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir.$this->bo->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
-		if($test[mime_type]!='Directory')
-		{
+		$test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir . $this->bo->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
+		if ($test[mime_type] != 'Directory') {
 			$this->bo->vfs->override_acl = 1;
 
 			$this->bo->vfs->mkdir(array(
-				'string' => $this->bo->fakebase,
-				'relatives' => array(RELATIVE_NONE)
+				 'string' => $this->bo->fakebase,
+				 'relatives' => array(RELATIVE_NONE)
 			));
-			
+
 			$this->bo->vfs->override_acl = 0;
 
 			//test one more time
-			$test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir.$this->bo->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
-
-			if($test[mime_type]!='Directory')
-			{
+			$test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir . $this->bo->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
+
+			if ($test[mime_type] != 'Directory') {
 				die('Fake Base directory does not exist and could not be created, please ask the administrator to check the global configuration.');
-			}
-			else
-			{
-				$this->messages[]= lang('Fake Base Dir did not exist, created a new one.');
-			}
-		}
-
-		$test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir.$this->bo->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
-		if($test[mime_type]!='Directory')
-		{
+			} else {
+				$this->messages[] = lang('Fake Base Dir did not exist, created a new one.');
+			}
+		}
+
+		$test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir . $this->bo->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
+		if ($test[mime_type] != 'Directory') {
 			$this->bo->vfs->override_acl = 1;
 
 			$this->bo->vfs->mkdir(array(
-				'string' => $this->bo->homedir,
-				'relatives' => array(RELATIVE_NONE)
+				 'string' => $this->bo->homedir,
+				 'relatives' => array(RELATIVE_NONE)
 			));
 			$this->bo->vfs->set_quota(array(
-				'string' => $this->bo->homedir,
-				'relatives' => array(RELATIVE_NONE),
-				'new_quota' => $this->current_config['filemanager_quota_size'] 
+				 'string' => $this->bo->homedir,
+				 'relatives' => array(RELATIVE_NONE),
+				 'new_quota' => $this->current_config['filemanager_quota_size']
 			));
 
@@ -218,119 +196,114 @@
 
 			//test one more time
-			$test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir.$this->bo->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
-
-			if($test[mime_type]!='Directory')
-			{
+			$test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir . $this->bo->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
+
+			if ($test[mime_type] != 'Directory') {
 				die('Your Home Dir does not exist and could not be created, please ask the adminstrator to check the global configuration.');
-			}
-			else
-			{
-				$this->messages[]= lang('Your Home Dir did not exist, eGroupWare created a new one.');
+			} else {
+				$this->messages[] = lang('Your Home Dir did not exist, eGroupWare created a new one.');
 				// FIXME we just created a fresh home dir so we know there nothing in it so we have to remove all existing content
 			}
-
-
-		}
-	}
-	function fileModels()
-	{
+		}
+	}
+
+	function fileModels() {
 		$GLOBALS['phpgw_info']['flags'] = array
-			(
-				'currentapp'    => 'filemanager',
-				'noheader'      => False,
-				'nonavbar' => False,
-				'nofooter'      => False,
-				'noappheader'   => False,
-				'enable_browser_class'  => True
-			);
+			 (
+			 'currentapp' => 'filemanager',
+			 'noheader' => False,
+			 'nonavbar' => False,
+			 'nofooter' => False,
+			 'noappheader' => False,
+			 'enable_browser_class' => True
+		);
 
 		$GLOBALS['phpgw']->common->phpgw_header();
 		$this->t->set_file(array('models' => 'fileModels.tpl'));
-		$this->t->set_block('models','header','header');
-		$this->t->set_block('models','body','body');
-		$this->t->set_block('models','footer','footer');
+		$this->t->set_block('models', 'header', 'header');
+		$this->t->set_block('models', 'body', 'body');
+		$this->t->set_block('models', 'footer', 'footer');
 		$this->t->set_var('url_1', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=article');
-		$this->t->set_var('model_1','article');
-		$this->t->set_var('lang_1',lang('article'));
-
-		$this->t->set_var('url_2','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=calendar');
-		$this->t->set_var('model_2','calendar');
-		$this->t->set_var('lang_2',lang('calendar'));
-
-		$this->t->set_var('url_3','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=todo');
-		$this->t->set_var('model_3','todo');
-		$this->t->set_var('lang_3',lang('todo'));
-
-		$this->t->set_var('url_4','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=slide');
-		$this->t->set_var('model_4','slide');
-		$this->t->set_var('lang_4',lang('slide'));
-
-		$this->t->set_var('url_5','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=cards');
-		$this->t->set_var('model_5','cards');
-		$this->t->set_var('lang_5',lang('cards'));
-
-		$this->t->set_var('url_6','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=resume');
-		$this->t->set_var('model_6','resume');
-		$this->t->set_var('lang_6',lang('resume'));
-
-
-		$this->t->pparse('out','models');
-
-
-	}
-	function uploadModel(){
+		$this->t->set_var('model_1', 'article');
+		$this->t->set_var('lang_1', lang('article'));
+
+		$this->t->set_var('url_2', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=calendar');
+		$this->t->set_var('model_2', 'calendar');
+		$this->t->set_var('lang_2', lang('calendar'));
+
+		$this->t->set_var('url_3', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=todo');
+		$this->t->set_var('model_3', 'todo');
+		$this->t->set_var('lang_3', lang('todo'));
+
+		$this->t->set_var('url_4', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=slide');
+		$this->t->set_var('model_4', 'slide');
+		$this->t->set_var('lang_4', lang('slide'));
+
+		$this->t->set_var('url_5', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=cards');
+		$this->t->set_var('model_5', 'cards');
+		$this->t->set_var('lang_5', lang('cards'));
+
+		$this->t->set_var('url_6', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=resume');
+		$this->t->set_var('model_6', 'resume');
+		$this->t->set_var('lang_6', lang('resume'));
+
+
+		$this->t->pparse('out', 'models');
+	}
+
+	function uploadModel() {
 		$GLOBALS['phpgw_info']['flags'] = array
-			(
-				'currentapp'    => 'filemanager',
-				'noheader'      => False,
-				'nonavbar' => False,
-				'nofooter'      => False,
-				'noappheader'   => False,
-				'enable_browser_class'  => True
-			);
+			 (
+			 'currentapp' => 'filemanager',
+			 'noheader' => False,
+			 'nonavbar' => False,
+			 'nofooter' => False,
+			 'noappheader' => False,
+			 'enable_browser_class' => True
+		);
 
 		$GLOBALS['phpgw']->common->phpgw_header();
 
-		$filename = lang('new')."_".lang($this->model).rand(0,1000).".html";
+		$filename = lang('new') . "_" . lang($this->model) . rand(0, 1000) . ".html";
 		$this->bo->vfs->cp(array(
-			'from'=> PHPGW_SERVER_ROOT . '/filemanager/templates/default/'.$this->model.'.html',
-			'to'=> $filename,
-			'relatives'     => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
+			 'from' => PHPGW_SERVER_ROOT . '/filemanager/templates/default/' . $this->model . '.html',
+			 'to' => $filename,
+			 'relatives' => array(RELATIVE_NONE | VFS_REAL, RELATIVE_ALL)
 		));
 
 		$this->bo->vfs->set_attributes(array(
-			'string'=> $filename,
-			'relatives'     => array(RELATIVE_ALL),
-			'attributes'=> array(
-				'mime_type' => "text/html",
-				'comment' => ""
-			)
+			 'string' => $filename,
+			 'relatives' => array(RELATIVE_ALL),
+			 'attributes' => array(
+				  'mime_type' => "text/html",
+				  'comment' => ""
+			 )
 		));
 		$this->filename = $filename;
 		$this->edit();
-
-	}
-	function index()
-	{
+	}
+
+	function index() {
 		$GLOBALS['phpgw_info']['flags'] = array
-		(
-			'currentapp'	=> 'filemanager',
-			'noheader'	=> False,
-			'nonavbar' => False,
-			'nofooter'	=> False,
-			'noappheader'	=> False,
-			'enable_browser_class'	=> True
+			 (
+			 'currentapp' => 'filemanager',
+			 'noheader' => False,
+			 'nonavbar' => False,
+			 'nofooter' => False,
+			 'noappheader' => False,
+			 'enable_browser_class' => True
 		);
 
 		$GLOBALS['phpgw']->common->phpgw_header();
+
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/inc/load_lang.php'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/global.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/main.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/common_functions.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/connector.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/draw_api.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/drag_area.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/handler.js'></script>";
 		
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/inc/load_lang.php'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/global.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/main.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/draw_api.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/drag_area.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/handler.js'></script>";
+		//echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/NewHandler.js'></script>";
 
 
@@ -338,30 +311,30 @@
 		$theme = "window_" . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . ".css";
 
-		if( !file_exists('filemanager/tp/expressowindow/css/'.$theme) )
+		if (!file_exists('filemanager/tp/expressowindow/css/' . $theme))
 			$theme = "window_default.css";
 
 		// Path FileManager
 		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
-		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
-	
-		if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
+		$webserver_url = (!empty($webserver_url) ) ? $webserver_url : '/';
+
+		if (strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url) - 1))
 			$webserver_url .= '/';
-	
-		$webserver_url 	= $webserver_url . 'filemanager/'; 
-		
-		$js   = "var path_filemanager	= '".$webserver_url."';";
-		$js	 .= "var my_home_filemanager	= '".trim($GLOBALS['uifilemanager']->bo->vfs->my_home)."';";
-		
-		echo "<script type='text/javascript'>".$js."</script>";
+
+		$webserver_url = $webserver_url . 'filemanager/';
+
+		$js = "var path_filemanager	= '" . $webserver_url . "';";
+		$js .= "var my_home_filemanager	= '" . trim($GLOBALS['uifilemanager']->bo->vfs->my_home) . "';";
+
+		echo "<script type='text/javascript'>" . $js . "</script>";
 
 		// Expresso Window - CSS
-		print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'tp/expressowindow/css/'.$theme.'" >';
+		print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'tp/expressowindow/css/' . $theme . '" >';
 
 		// Expresso Window - JS 
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/xtools.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/jsloader.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/makeW.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/dragdrop.js'></script>";
-		echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/show_hidden.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/xtools.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/jsloader.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/makeW.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/dragdrop.js'></script>";
+		echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/show_hidden.js'></script>";
 
 		echo "<script src='./phpgwapi/js/dftree/dftree.js'></script>";
@@ -370,21 +343,17 @@
 		# Code is fairly hackish at the beginning, but it gets better
 		# Highly suggest turning wrapping off due to long SQL queries
-
 		###
 		# Some hacks to set and display directory paths correctly
 		###
 		// new method for switching to a new dir.
-		if($this->changedir=='true' && $this->cdtodir || $this->goto_x)
-		{
+		if ($this->changedir == 'true' && $this->cdtodir || $this->goto_x) {
 			$this->path = $this->cdtodir;
 		}
 
-		if(!$this->path)
-		{
+		if (!$this->path) {
 			$this->path = $this->bo->vfs->pwd();
 
-			if(!$this->path || $this->bo->vfs->pwd(array('full' => False)) == '')
-			{
-				$this->path = $this->bo->homedir; 
+			if (!$this->path || $this->bo->vfs->pwd(array('full' => False)) == '') {
+				$this->path = $this->bo->homedir;
 			}
 		}
@@ -395,10 +364,7 @@
 		$pwd = $this->bo->vfs->pwd();
 
-		if(!$this->cwd = substr($this->path, strlen($this->bo->homedir) + 1))  
-		{
+		if (!$this->cwd = substr($this->path, strlen($this->bo->homedir) + 1)) {
 			$this->cwd = '/';
-		}
-		else
-		{
+		} else {
 			$this->cwd = substr($pwd, strrpos($pwd, '/') + 1);
 		}
@@ -407,36 +373,30 @@
 
 		/* This just prevents // in some cases */
-		if($this->path == '/')
-		{
+		if ($this->path == '/') {
 			$this->dispsep = '';
-		}
-		else
-		{
+		} else {
 			$this->dispsep = '/';
 		}
 
-		if(!($this->lesspath = substr($this->path, 0, strrpos($this->path, '/'))))
-		{
+		if (!($this->lesspath = substr($this->path, 0, strrpos($this->path, '/')))) {
 			$this->lesspath = '/';
 		}
 
-		/*Check permission*/
-		if($this->bo->vfs->acl_check(array(
-			'string' => $this->path,
-			'relatives' => array(RELATIVE_NONE),
-			'operation' => PHPGW_ACL_READ
-		)))
-		{
+		/* Check permission */
+		if ($this->bo->vfs->acl_check(array(
+						'string' => $this->path,
+						'relatives' => array(RELATIVE_NONE),
+						'operation' => PHPGW_ACL_READ
+				  ))) {
 			$this->can_read = True;
 		}
 
 
-		if ($_SESSION['phpgw_info']['user']['filemanager']['flush'] != 'flushed')
-		{
-			/*Flush journal-deleted*/
+		if ($_SESSION['phpgw_info']['user']['filemanager']['flush'] != 'flushed') {
+			/* Flush journal-deleted */
 			$this->bo->vfs->flush_journal(array(
-				'string' => $this->path,
-				'relatives' => array(RELATIVE_NONE),
-				'deleteall' => True
+				 'string' => $this->path,
+				 'relatives' => array(RELATIVE_NONE),
+				 'deleteall' => True
 			));
 			$_SESSION['phpgw_info']['user']['filemanager']['flush'] = 'flushed';
@@ -446,6 +406,5 @@
 
 		# if is different path than home and no permission allowed
-		if($this->path != $this->bo->homedir && $this->path != $this->bo->fakebase && $this->path != '/' && !$this->can_read)
-		{
+		if ($this->path != $this->bo->homedir && $this->path != $this->bo->fakebase && $this->path != '/' && !$this->can_read) {
 			$this->messages[] = lang('You do not have access to %1', $this->path);
 			$this->path = $this->homedir;
@@ -459,12 +418,10 @@
 
 		# Verify path is real
-		if($this->path != $this->bo->homedir && $this->path != '/' && $this->path != $this->bo->fakebase)
-		{
-			if(!$this->bo->vfs->file_exists(array(
-				'string' => $this->path,
-				'relatives' => array(RELATIVE_NONE)
-			)))
-			{
-				$this->messages[] = lang('Error:').lang('Directory %1 does not exist', $this->path);
+		if ($this->path != $this->bo->homedir && $this->path != '/' && $this->path != $this->bo->fakebase) {
+			if (!$this->bo->vfs->file_exists(array(
+							'string' => $this->path,
+							'relatives' => array(RELATIVE_NONE)
+					  ))) {
+				$this->messages[] = lang('Error:') . lang('Directory %1 does not exist', $this->path);
 				$this->path = $this->homedir;
 				$this->bo->vfs->cd(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
@@ -476,102 +433,84 @@
 
 		# Default is to sort by name
-		if(!$this->sortby)
-		{
+		if (!$this->sortby) {
 			$this->sortby = 'name';
 		}
-		if($this->update_x == 1){
+		if ($this->update_x == 1) {
 			$this->bo->vfs->update_real(array(
-				'string'        => $this->path,
-				'relatives'     => array(RELATIVE_NONE)
+				 'string' => $this->path,
+				 'relatives' => array(RELATIVE_NONE)
 			));
-			header('Location:'.$this->encode_href('index.php?menuaction=filemanager.uifilemanager.index','&path='.base64_encode($this->bo->homedir)));
-		}
-		elseif($this->newfile_x && $this->newfile_or_dir) // create new textfile
-		{
+			header('Location:' . $this->encode_href('index.php?menuaction=filemanager.uifilemanager.index', '&path=' . base64_encode($this->bo->homedir)));
+		} elseif ($this->newfile_x && $this->newfile_or_dir) { // create new textfile
 			$this->createfile();
-		}
-		elseif($this->edit_cancel_x)
-		{
+		} elseif ($this->edit_cancel_x) {
 			$this->readFilesInfo();
 			$this->fileListing();
-		}
-		elseif($this->edit_x || $this->edit_preview_x || $this->edit_save_x || $this->edit_save_done_x)
-		{
+		} elseif ($this->edit_x || $this->edit_preview_x || $this->edit_save_x || $this->edit_save_done_x) {
 			$this->edit();
-		}
-		else
-		{
+		} else {
 			//$this->readFilesInfo();
 			$this->fileListing();
 		}
 	}
-	function get_permissions(){
+
+	function get_permissions() {
 		/* get permissions */
-		if((preg_match('+^'.$this->bo->fakebase.'\/(.*)(\/|$)+U', $this->path, $matches)) && $matches[1] != $this->bo->userinfo['account_lid']) //FIXME matches not defined
-
-		{
-			$this->bo->vfs->working_id = $GLOBALS['phpgw']->accounts->name2id($matches[1]);//FIXME matches not defined
-
-		}
-		else
-		{
+		if ((preg_match('+^' . $this->bo->fakebase . '\/(.*)(\/|$)+U', $this->path, $matches)) && $matches[1] != $this->bo->userinfo['account_lid']) { //FIXME matches not defined
+			$this->bo->vfs->working_id = $GLOBALS['phpgw']->accounts->name2id($matches[1]); //FIXME matches not defined
+		} else {
 			$this->bo->vfs->working_id = $this->bo->userinfo['username'];
 		}
 
 		# Check available permissions for $this->path, so we can disable unusable operations in user interface
-		$path = explode('/',$this->path);
-		$owner_id = $this->bo->vfs->ownerOf($this->bo->fakebase,$path[2]);
+		$path = explode('/', $this->path);
+		$owner_id = $this->bo->vfs->ownerOf($this->bo->fakebase, $path[2]);
 		$user_id = $GLOBALS['phpgw_info']['user']['account_id'];
-		if ($owner_id == $user_id)
-		{
+		if ($owner_id == $user_id) {
 			$rights = 31;
-		}else
-		{
-			$acl = CreateObject ('phpgwapi.acl', $owner_id);
+		} else {
+			$acl = CreateObject('phpgwapi.acl', $owner_id);
 			$acl->account_id = $owner_id;
 			$acl->read_repository();
 			$rights = $acl->get_rights($user_id);
 		}
-		return $rights;	
-	}
-	function dir_ls()
-	{
+		return $rights;
+	}
+
+	function dir_ls() {
 		// change dir to this->path
 		$this->bo->vfs->cd(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
 		$return['permissions'] = $this->get_permissions();
 		$return['quota']['usedSpace'] = $this->bo->vfs->get_size(array(
-				'string'        => $this->path,
-				'relatives'     => array(RELATIVE_NONE)
-		));
+						'string' => $this->path,
+						'relatives' => array(RELATIVE_NONE)
+				  ));
 		$return['files_count'] = $this->bo->vfs->count_files(array(
-				'string'        => $this->path,
-		));
+						'string' => $this->path,
+				  ));
 		$quota = $this->bo->vfs->get_quota(array(
-			'string'        => $this->path
-		));
+						'string' => $this->path
+				  ));
 		reset($this->files_array);
 		$this->readFilesInfo();
 
-		for($i = 0; $i != $this->numoffiles; $i++)
-		{
+		for ($i = 0; $i != $this->numoffiles; $i++) {
 			$files = $this->files_array[$i];
 
-			if($files['mime_type'] == "Directory")
-			{
+			if ($files['mime_type'] == "Directory") {
 				continue;
 			}
 			/* small keys to safe bandwidth */
 			$tuple['name'] = htmlentities($files['name']);
-			if ($_SESSION['phpgw_info']['user']['preferences']['filemanager']['viewIcons'] == 1){
-				if ($files['mime_type'] == 'image/png' || 
-					$files['mime_type'] == 'image/gif' || 
-					$files['mime_type'] == 'image/jpg')
-				{
-					$filename = str_replace('=','',base64_encode($tuple['name']));
-					$pathname = str_replace('=','',base64_encode($this->path));
-					$tuple['icon'] = './index.php?menuaction=filemanager.vfs_functions.summary&file='.$filename.'&path='.$pathname;
+			if ($_SESSION['phpgw_info']['user']['preferences']['filemanager']['viewIcons'] == 1) {
+				if ($files['mime_type'] == 'image/png' ||
+						  $files['mime_type'] == 'image/gif' ||
+						  $files['mime_type'] == 'image/jpg') {
+					$filename = str_replace('=', '', base64_encode($tuple['name']));
+					$pathname = str_replace('=', '', base64_encode($this->path));
+					$tuple['icon'] = './index.php?menuaction=filemanager.vfs_functions.summary&file=' . $filename . '&path=' . $pathname;
 				}
 				else
-					$tuple['icon'] =  $this->mime_icon($files['mime_type'],64);
+					$tuple['icon'] = $this->mime_icon($files['mime_type'], 64);
 			}
 			else
@@ -584,31 +523,29 @@
 			$tuple['pub'] = $files['type'];
 			$tuple['createdby_id'] = $GLOBALS['phpgw']->accounts->id2name($files['createdby_id']);
-			$tuple['modifiedby_id'] = $files['modifiedby_id']?$GLOBALS['phpgw']->accounts->id2name($files['modifiedby_id']):'';
+			$tuple['modifiedby_id'] = $files['modifiedby_id'] ? $GLOBALS['phpgw']->accounts->id2name($files['modifiedby_id']) : '';
 			$tuple['owner'] = $GLOBALS['phpgw']->accounts->id2name($files['owner_id']);
 			$tuple['comment'] = $files['comment'];
 			$tuple['version'] = $files['version'];
 			$output[] = $tuple;
-
 		}
 		$return['files'] = $output;
-		$return['quota']['quotaSize'] = ($quota*1024*1024);
+		$return['quota']['quotaSize'] = ($quota * 1024 * 1024);
 		echo serialize($return);
 	}
-	function get_folders_list()
-	{
-		$this->update_groups();	
+
+	function get_folders_list() {
+		$this->update_groups();
 		$this->groups_applications = array();
 
 		$user_groups = $GLOBALS['phpgw']->accounts->membership();
-		foreach($user_groups as $val){
+		foreach ($user_groups as $val) {
 			$account_name = $GLOBALS['phpgw']->accounts->id2name($val['account_id']);
 			$this->readable_groups[$account_name] = array(
-				'account_id' => $val['account_id'],
-				'account_name' => $account_name
+				 'account_id' => $val['account_id'],
+				 'account_name' => $account_name
 			);
 		}
 
-		foreach ($this->readable_groups as $value)
-		{
+		foreach ($this->readable_groups as $value) {
 			$applications = CreateObject('phpgwapi.applications', $value['account_id']);
 			$this->groups_applications[$value['account_name']] = $applications->read_account_specific();
@@ -618,61 +555,58 @@
 		// selectbox for change/move/and copy to
 		$this->dirs = $this->all_other_directories();
-		foreach($this->dirs as $dir)
+		foreach ($this->dirs as $dir)
 			$return[] = $dir['directory'] . $dir['name'];
 		sort(&$return, SORT_STRING);
 		echo serialize($return);
 	}
-	function fileListing()
-	{
+
+	function fileListing() {
 		$this->t->set_file(array('filemanager_list_t' => 'main.tpl'));
-		$this->t->set_block('filemanager_list_t','filemanager_header','filemanager_header');
-		$this->t->set_block('filemanager_list_t','filemanager_footer','filemanager_footer');
-
-		if($this->numoffiles || $this->cwd)
-		{
-			$vars[path]='<input type="hidden" id="currentPath" value="'.$this->path.'">';
-			$vars[css]='<link rel="stylesheet" type="text/css" href="filemanager/templates/default/main.css">';
+		$this->t->set_block('filemanager_list_t', 'filemanager_header', 'filemanager_header');
+		$this->t->set_block('filemanager_list_t', 'filemanager_footer', 'filemanager_footer');
+
+		if ($this->numoffiles || $this->cwd) {
+			$vars[path] = '<input type="hidden" id="currentPath" value="' . $this->path . '">';
+			$vars[css] = '<link rel="stylesheet" type="text/css" href="filemanager/templates/default/main.css">';
 			$vars[css].='<link rel="stylesheet" type="text/css" href="phpgwapi/js/dftree/dftree.css">';
 			$_SESSION['phpgw_info']['user']['preferences']['filemanager']['lid'] = $GLOBALS['phpgw_info']['user']['account_lid'];
-			$vars[preferences]='<input type="hidden" id="userPreferences" value=\''.serialize($_SESSION['phpgw_info']['user']['preferences']['filemanager']).'\'>';
+			$vars[preferences] = '<input type="hidden" id="userPreferences" value=\'' . serialize($_SESSION['phpgw_info']['user']['preferences']['filemanager']) . '\'>';
 			// Used for important operations that needs security
-			for ($key = ""; strlen($key) < 150; $key .= chr(rand(48,95)));
+			for ($key = ""; strlen($key) < 150; $key .= chr(rand(48, 95)))
+				;
 			$_SESSION['phpgw_info']['filemanager']['user']['sec_key'] = $key;
-			$vars[sec_key]='<input type="hidden" id="userKey" value=\''.$key.'\'>';
-			$vars[script]='<script>initDrawApi();</script>';
-			
-			$vars[new_button]=$this->toolButton('new','createfile',lang('New...'));
+			$vars[sec_key] = '<input type="hidden" id="userKey" value=\'' . $key . '\'>';
+			$vars[script] = '<script>initDrawApi();</script>';
+
+			$vars[new_button] = $this->toolButton('new', 'createfile', lang('New...'));
 			$vars[new_button].='<input type="hidden" id="newfile_or_dir" name="newfile_or_dir" value="" />';
-			
+
 			// reload button with this url
-			$vars[refresh_button]=$this->toolButton('reload','reload',lang('reload'));
+			$vars[refresh_button] = $this->toolButton('reload', 'reload', lang('reload'));
 
 			// go up icon when we're not at the top, dont allow to go outside /home = fakebase
-			if($this->path != '/' && $this->path != $this->bo->fakebase)
-			{
-				$vars[tools_button] = $this->toolButton('tools','tools',lang('tools'));
+			if ($this->path != '/' && $this->path != $this->bo->fakebase) {
+				$vars[tools_button] = $this->toolButton('tools', 'tools', lang('tools'));
 			}
 			else
 				$vars[tools_button] = "";
 
-			$vars[toolbar1]=$toolbar;
-
-			if(count($this->messages)>0) 
-			{
-				foreach($this->messages as $msg)
-				{
-					$messages.='<span>'.$msg.'</span>';
+			$vars[toolbar1] = $toolbar;
+
+			if (count($this->messages) > 0) {
+				foreach ($this->messages as $msg) {
+					$messages.='<span>' . $msg . '</span>';
 				}
 			}
 			$this->messages = NULL;
-			
-			$vars[messages]=$messages;
+
+			$vars[messages] = $messages;
 
 			$this->t->set_var($vars);
-			$this->t->pparse('out','filemanager_header');
+			$this->t->pparse('out', 'filemanager_header');
 		}
 
 		$this->t->set_var($vars);
-		$this->t->pparse('out','filemanager_footer');
+		$this->t->pparse('out', 'filemanager_footer');
 
 		$GLOBALS['phpgw']->common->phpgw_footer();
@@ -680,26 +614,22 @@
 	}
 
-	function readFilesInfo()
-	{
+	function readFilesInfo() {
 		// start files info
-
 		# Read in file info from database to use in the rest of the script
 		# $fakebase is a special directory.  In that directory, we list the user's
 		# home directory and the directories for the groups they're in
 		$this->numoffiles = 0;
-		if($this->path == $this->bo->fakebase)
-		{
+		if ($this->path == $this->bo->fakebase) {
 			// FIXME this test can be removed
-			if(!$this->bo->vfs->file_exists(array('string' => $this->bo->homedir, 'relatives' => array(RELATIVE_NONE))))
-			{
+			if (!$this->bo->vfs->file_exists(array('string' => $this->bo->homedir, 'relatives' => array(RELATIVE_NONE)))) {
 				$this->bo->vfs->mkdir(array('string' => $this->bo->homedir, 'relatives' => array(RELATIVE_NONE)));
 			}
 
 			$ls_array = $this->bo->vfs->ls(array(
-				'string' => $this->bo->homedir,
-				'relatives' => array(RELATIVE_NONE),
-				'checksubdirs' => False,
-				'nofiles' => True
-			));
+							'string' => $this->bo->homedir,
+							'relatives' => array(RELATIVE_NONE),
+							'checksubdirs' => False,
+							'nofiles' => True
+					  ));
 
 			$this->files_array[] = $ls_array[0];
@@ -707,31 +637,29 @@
 
 			reset($this->readable_groups);
-			while(list($num, $group_array) = each($this->readable_groups))
-			{
+			while (list($num, $group_array) = each($this->readable_groups)) {
 				# If the group doesn't have access to this app, we don't show it
-				/*if(!$this->groups_applications[$group_array['account_name']][$this->bo->appname]['enabled'])
-				{
-					continue;
-				}
-				*/
-
-
-				if(!$this->bo->vfs->file_exists(array('string' => $this->bo->fakebase.'/'.$group_array['account_name'],'relatives'	=> array(RELATIVE_NONE))))
-				{
+				/* if(!$this->groups_applications[$group_array['account_name']][$this->bo->appname]['enabled'])
+				  {
+				  continue;
+				  }
+				 */
+
+
+				if (!$this->bo->vfs->file_exists(array('string' => $this->bo->fakebase . '/' . $group_array['account_name'], 'relatives' => array(RELATIVE_NONE)))) {
 					$this->bo->vfs->override_acl = 1;
 					$this->bo->vfs->mkdir(array(
-						'string' => $this->bo->fakebase.'/'.$group_array['account_name'],
-						'relatives' => array(RELATIVE_NONE)
+						 'string' => $this->bo->fakebase . '/' . $group_array['account_name'],
+						 'relatives' => array(RELATIVE_NONE)
 					));
 
 					// FIXME we just created a fresh group dir so we know there nothing in it so we have to remove all existing content
-					
-					
+
+
 					$this->bo->vfs->override_acl = 0;
 
-					$this->bo->vfs->set_attributes(array('string' => $this->bo->fakebase.'/'.$group_array['account_name'],'relatives'	=> array(RELATIVE_NONE),'attributes' => array('owner_id' => $group_array['account_id'],'createdby_id' => $group_array['account_id'])));
+					$this->bo->vfs->set_attributes(array('string' => $this->bo->fakebase . '/' . $group_array['account_name'], 'relatives' => array(RELATIVE_NONE), 'attributes' => array('owner_id' => $group_array['account_id'], 'createdby_id' => $group_array['account_id'])));
 				}
 
-				$ls_array = $this->bo->vfs->ls(array('string' => $this->bo->fakebase.'/'.$group_array['account_name'],'relatives'	=> array(RELATIVE_NONE),'checksubdirs' => False,'nofiles' => True));
+				$ls_array = $this->bo->vfs->ls(array('string' => $this->bo->fakebase . '/' . $group_array['account_name'], 'relatives' => array(RELATIVE_NONE), 'checksubdirs' => False, 'nofiles' => True));
 
 				$this->files_array[] = $ls_array[0];
@@ -739,20 +667,17 @@
 				$this->numoffiles++;
 			}
-		}
-		else
-		{
+		} else {
 			$ls_array = $this->bo->vfs->ls(array(
-				'string' => $this->path,
-				'relatives'	=> array(RELATIVE_NONE),
-				'checksubdirs' => False,
-				'nofiles'	=> False,
-				'orderby'	=> $this->criteria,
-				'otype'		=> $this->otype,
-				'limit'		=> $this->limit,
-				'offset'	=> $this->offset
-			));
-
-			while(list($num, $file_array) = each($ls_array))
-			{
+							'string' => $this->path,
+							'relatives' => array(RELATIVE_NONE),
+							'checksubdirs' => False,
+							'nofiles' => False,
+							'orderby' => $this->criteria,
+							'otype' => $this->otype,
+							'limit' => $this->limit,
+							'offset' => $this->offset
+					  ));
+
+			while (list($num, $file_array) = each($ls_array)) {
 				$this->numoffiles++;
 				$this->files_array[] = $file_array;
@@ -760,134 +685,112 @@
 		}
 
-		if(!is_array($this->files_array))
-		{
+		if (!is_array($this->files_array)) {
 			$this->files_array = array();
 		}
 		// end file count
 	}
-	
-	function removedir()
-	{
+
+	function removedir() {
 		//$toRemove = $this->path ^ $_SESSION['phpgw_info']['filemanager']['user']['sec_key'];
 		$toRemove = $this->path;
-		
-		if ( $this->bo->vfs->rm(array( 'string' => $toRemove, 'relatives' => array (RELATIVE_NONE) )) )
+
+		if ($this->bo->vfs->rm(array('string' => $toRemove, 'relatives' => array(RELATIVE_NONE))))
 			echo "True";
 		else
 			echo "False";
 	}
-	
-	function createdir()
-	{
-		if( $this->bo->badchar = $this->bo->bad_chars($this->filename, True, True) )
-		{
-			echo lang('Error:').$this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1);
+
+	function createdir() {
+		if ($this->bo->badchar = $this->bo->bad_chars($this->filename, True, True)) {
+			echo lang('Error:') . $this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1);
 			return;
 		}
 		/* TODO is this right or should it be a single $ ? */
-		if($this->filename[strlen($this->filename)-1] == ' ' || $this->filename[0] == ' ')
-		{
-			echo lang('Error:').lang('Cannot create directory because it begins or ends in a space');
-		}
-		
+		if ($this->filename[strlen($this->filename) - 1] == ' ' || $this->filename[0] == ' ') {
+			echo lang('Error:') . lang('Cannot create directory because it begins or ends in a space');
+		}
+
 		$ls_array = $this->bo->vfs->ls(array(
-			'string'	=> $this->path . '/' . $this->filename,
-			'relatives'	=> array(RELATIVE_NONE),
-			'checksubdirs'	=> False,
-			'nofiles'	=> True
-		));
+						'string' => $this->path . '/' . $this->filename,
+						'relatives' => array(RELATIVE_NONE),
+						'checksubdirs' => False,
+						'nofiles' => True
+				  ));
 
 		$fileinfo = $ls_array[0];
 
-		if($fileinfo['name'])
-		{
-			if($fileinfo['mime_type'] != 'Directory')
-			{
-				echo lang('Error:').lang('%1 already exists as a file',$fileinfo['name']);
-			}
-			else
-			{
-				echo lang('Error:').lang('Directory %1 already exists', $fileinfo['name']);
-			}
-		}
-		else
-		{
+		if ($fileinfo['name']) {
+			if ($fileinfo['mime_type'] != 'Directory') {
+				echo lang('Error:') . lang('%1 already exists as a file', $fileinfo['name']);
+			} else {
+				echo lang('Error:') . lang('Directory %1 already exists', $fileinfo['name']);
+			}
+		} else {
 			$this->bo->vfs->cd(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE), 'relative' => False));
-			
-			if( $this->bo->vfs->mkdir(array('string' => $this->filename )) )
-			{
-				echo lang('Created directory %1', $this->disppath.'/'.$this->filename);
-			}
-			else
-			{
-				echo lang('Error:').lang('Could not create %1', $this->disppath.'/'.$this->filename);
+
+			if ($this->bo->vfs->mkdir(array('string' => $this->filename))) {
+				echo lang('Created directory %1', $this->disppath . '/' . $this->filename);
+			} else {
+				echo lang('Error:') . lang('Could not create %1', $this->disppath . '/' . $this->filename);
 			}
 		}
 		echo lang('Directory created');
 	}
-	
-	function getReturnExecuteForm()
-	{
+
+	function getReturnExecuteForm() {
 		$response = $_SESSION['response'];
-		
+
 		unset($_SESSION['response']);
-		
+
 		echo $response;
 	}
-	
+
 	function showUploadboxes()
 	{
 		$notify = CreateObject('filemanager.notifications');
-		
+
 		$var = array(
-					'change_upload_boxes' 	=> lang('Show'),				
-					'form_action' 			=> $GLOBALS[phpgw]->link('/filemanager/inc/upload.php'),
-					'emails_to'				=> $notify->EmailsToSend($GLOBALS['phpgw']->preferences->values['email']),
-					'lang_file'				=> lang('File'),
-					'lang_comment'			=> lang('Comment'),
-					'lang_advanced_upload'	=> lang('Advanced Upload'),
-					'lang_upload' 			=> lang('Upload files'),
-					'max_size' 				=> lang('Note: Uploaded is limited to %1MB',( $this->current_config['filemanager_Max_file_size'])),				
-					'path'					=> $this->path
+			 'change_upload_boxes'	=> lang('Show'),
+			 'form_action'			=> $GLOBALS[phpgw]->link('/filemanager/inc/upload.php'),
+			 'emails_to'				=> $notify->EmailsToSend($GLOBALS['phpgw']->preferences->values['email']),
+			 'lang_file'				=> lang('File(s)'),
+			 'lang_comment'			=> lang('Comment(s)'),
+			 'lang_advanced_upload'	=> lang('Advanced Upload'),
+			 'lang_upload'			=> lang('Upload files'),
+			 'max_size'				=> lang('The maximum size for each file is %1MB', ($this->current_config['filemanager_Max_file_size'])),
+			 'path'					=> $this->path
 		);
-		
-		print( serialize($var) );
-		
+
+		print( serialize($var));
 	}
 
 	/* create textfile */
-	function createfile()
+	function createfile() 
 	{
-		$this->filename=$this->newfile_or_dir;
-		if($this->filename)
-		{
-			if($badchar = $this->bo->bad_chars($this->filename, True, True))
-			{
-				$this->messages[] = lang('Error:').lang('File names cannot contain "%1"',$badchar);
+		$this->filename = $this->newfile_or_dir;
+		if ($this->filename) {
+			if ($badchar = $this->bo->bad_chars($this->filename, True, True)) {
+				$this->messages[] = lang('Error:') . lang('File names cannot contain "%1"', $badchar);
 
 				$this->fileListing();
 			}
 
-			if($this->bo->vfs->file_exists(array(
-				'string'=> $this->filename,
-				'relatives'	=> array(RELATIVE_ALL)
-			)))
-			{
-				$this->messages[]= lang('Error:').lang('File %1 already exists. Please edit it or delete it first.', $this->filename);
+			if ($this->bo->vfs->file_exists(array(
+							'string' => $this->filename,
+							'relatives' => array(RELATIVE_ALL)
+					  ))) {
+				$this->messages[] = lang('Error:') . lang('File %1 already exists. Please edit it or delete it first.', $this->filename);
 				$this->fileListing();
 			}
 
-			if($this->bo->vfs->touch(array(
-				'string'	=> $this->filename,
-				'relatives'	=> array(RELATIVE_ALL)
-			)))
-			{
+			if ($this->bo->vfs->touch(array(
+							'string' => $this->filename,
+							'relatives' => array(RELATIVE_ALL)
+					  ))) {
 				$this->edit = 1;
 				$this->numoffiles++;
 				$this->edit();
-			}
-			else
-			{
-				$this->messages[]= lang('Error:').lang('File %1 could not be created.', $this->filename);
+			} else {
+				$this->messages[] = lang('Error:') . lang('File %1 could not be created.', $this->filename);
 				$this->fileListing();
 			}
@@ -896,35 +799,31 @@
 
 	# Handle Editing files
-	function edit()
-	{
-		if($this->filename)
-		{
-			if (! $this->vfs_functions->verifyLock($this->path.'/'.$this->filename,RELATIVE_NONE)){
+
+	function edit() {
+		if ($this->filename) {
+			if (!$this->vfs_functions->verifyLock($this->path . '/' . $this->filename, RELATIVE_NONE)) {
 				$GLOBALS['phpgw']->redirect('/index.php');
 			}
 			$ls_array = $this->bo->vfs->ls(array(
-				'string'        => $this->path.'/'.$this->filename,
-				'relatives'     => array(RELATIVE_NONE),
-				'checksubdirs'  => False,
-				'nofiles'       => True
+							'string' => $this->path . '/' . $this->filename,
+							'relatives' => array(RELATIVE_NONE),
+							'checksubdirs' => False,
+							'nofiles' => True
+					  ));
+			$this->bo->vfs->touch(array(
+				 'string' => $this->path . '/' . $this->filename,
+				 'relatives' => array(RELATIVE_NONE)
 			));
-			$this->bo->vfs->touch(array(
-				'string'=> $this->path.'/'.$this->filename,
-				'relatives'     => array(RELATIVE_NONE)
-			));
-
-
-			if($ls_array[0]['mime_type'])
-			{
+
+
+			if ($ls_array[0]['mime_type']) {
 				$mime_type = $ls_array[0]['mime_type'];
-			}
-			elseif($this->prefs['viewtextplain'])
-			{
+			} elseif ($this->prefs['viewtextplain']) {
 				$mime_type = 'text/plain';
 			}
-			$editable = array('','text/plain','text/csv','text/html','text/text','message/rfc822');
-
-			if(!in_array($mime_type,$editable)){
-				$this->messages[] = lang('Error:').lang('Impossible to edit this file');
+			$editable = array('', 'text/plain', 'text/csv', 'text/html', 'text/text', 'message/rfc822');
+
+			if (!in_array($mime_type, $editable)) {
+				$this->messages[] = lang('Error:') . lang('Impossible to edit this file');
 				$this->readFilesInfo();
 				$this->fileListing();
@@ -940,45 +839,37 @@
 			$this->t->set_file(array('filemanager_edit' => 'edit_file.tpl'));
 
-		$this->t->set_block('filemanager_edit','row','row');
+		$this->t->set_block('filemanager_edit', 'row', 'row');
 
 
 		$vars[refresh_script] = "<script src='filemanager/js/refresh.js'></script>";
 
-		$vars[preview_content]='';
-		if($this->edit_file)
-		{
+		$vars[preview_content] = '';
+		if ($this->edit_file) {
 			$this->edit_file_content = stripslashes($this->edit_file_content);
 		}
 
-		if($this->edit_preview_x)
-		{
+		if ($this->edit_preview_x) {
 			$content = $this->edit_file_content;
 
-			$vars[lang_preview_of]=lang('Preview of %1', $this->path.'/'.$edit_file);
-
-			$vars[preview_content]=nl2br($content);
-		}
-		elseif($this->edit_save_x || $this->edit_save_done_x)
-		{
+			$vars[lang_preview_of] = lang('Preview of %1', $this->path . '/' . $edit_file);
+
+			$vars[preview_content] = nl2br($content);
+		} elseif ($this->edit_save_x || $this->edit_save_done_x) {
 			$content = $this->edit_file_content;
 			//die( $content);
-			if($this->bo->vfs->write(array(
-				'string'	=> $this->path.'/'.$this->edit_file,
-				'relatives'	=> array(RELATIVE_NONE),
-				'content'	=> $content
-			)))
-			{
-				$this->messages[]=lang('Saved %1', $this->path.'/'.$this->edit_file);
-
-				if($this->edit_save_done_x)
-				{
+			if ($this->bo->vfs->write(array(
+							'string' => $this->path . '/' . $this->edit_file,
+							'relatives' => array(RELATIVE_NONE),
+							'content' => $content
+					  ))) {
+				$this->messages[] = lang('Saved %1', $this->path . '/' . $this->edit_file);
+
+				if ($this->edit_save_done_x) {
 					$this->readFilesInfo();
 					$this->fileListing();
 					exit;
 				}
-			}
-			else
-			{
-				$this->messages[]=lang('Could not save %1', $this->path.'/'.$this->edit_file);
+			} else {
+				$this->messages[] = lang('Could not save %1', $this->path . '/' . $this->edit_file);
 			}
 		}
@@ -986,41 +877,36 @@
 		# If we're in preview or save mode, we only show the file
 		# being previewed or saved
-		if($this->edit_file &&($this->filename != $this->edit_file))
-		{
+		if ($this->edit_file && ($this->filename != $this->edit_file)) {
 			continue;
 		}
 
-		if($this->filename && $this->bo->vfs->file_exists(array(
-			'string'	=> $this->filename,
-			'relatives'	=> array(RELATIVE_ALL)
-		)))
-		{
-			if($this->edit_file)
-			{
+		if ($this->filename && $this->bo->vfs->file_exists(array(
+						'string' => $this->filename,
+						'relatives' => array(RELATIVE_ALL)
+				  ))) {
+			if ($this->edit_file) {
 				$content = stripslashes($this->edit_file_content);
-			}
-			else
-			{
+			} else {
 				$content = $this->bo->vfs->read(array('string' => $this->filename));
 			}
-			$vars[form_action]= $GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path);
-			$vars[edit_file]=$this->filename;
+			$vars[form_action] = $GLOBALS['phpgw']->link('/index.php', 'menuaction=filemanager.uifilemanager.index', 'path=' . $this->path);
+			$vars[edit_file] = $this->filename;
 			# We need to include all of the fileman entries for each file's form,
 			# so we loop through again
-			for($i = 0; $i != $this->numoffiles; $i++)
-			{
-				if($this->filename) $value='value="'.$this->filename.'"';
-				$vars[filemans_hidden]='<input type="hidden" name="filename" '.$value.' />';
-			}
-			$vars[file_content]=$content;
-
-			$vars[buttonPreview]=$this->inputButton('edit_preview','edit_preview',lang('Preview %1', $this->bo->html_encode($this->fileman[0], 1)));
-			$vars[buttonSave]=$this->inputButton('edit_save','save',lang('Save %1', $this->bo->html_encode($this->filename, 1)));
-			$vars[buttonDone]=$this->inputButton('edit_save_done','ok',lang('Save %1, and go back to file listing ', $this->bo->html_encode($this->filename, 1)));
-			$vars[buttonCancel]=$this->inputButton('edit_cancel','cancel',lang('Cancel editing %1 without saving', $this->bo->html_encode($this->filename, 1)));
-
-			if ($mime_type == 'text/html'){
+			for ($i = 0; $i != $this->numoffiles; $i++) {
+				if ($this->filename)
+					$value = 'value="' . $this->filename . '"';
+				$vars[filemans_hidden] = '<input type="hidden" name="filename" ' . $value . ' />';
+			}
+			$vars[file_content] = $content;
+
+			$vars[buttonPreview] = $this->inputButton('edit_preview', 'edit_preview', lang('Preview %1', $this->bo->html_encode($this->fileman[0], 1)));
+			$vars[buttonSave] = $this->inputButton('edit_save', 'save', lang('Save %1', $this->bo->html_encode($this->filename, 1)));
+			$vars[buttonDone] = $this->inputButton('edit_save_done', 'ok', lang('Save %1, and go back to file listing ', $this->bo->html_encode($this->filename, 1)));
+			$vars[buttonCancel] = $this->inputButton('edit_cancel', 'cancel', lang('Cancel editing %1 without saving', $this->bo->html_encode($this->filename, 1)));
+
+			if ($mime_type == 'text/html') {
 				$vars[fck_edit] = '<script type="text/javascript" src="filemanager/tp/ckeditor/ckeditor.js"></script>
-					<textarea cols="80" id="edit_file_content" name="edit_file_content" rows="10">'.$content.'</textarea>
+					<textarea cols="80" id="edit_file_content" name="edit_file_content" rows="10">' . $content . '</textarea>
 						<script type="text/javascript"> CKEDITOR.replace( \'edit_file_content\',{
 removePlugins : \'elementspath\',
@@ -1035,27 +921,21 @@
 ["Styles","Format","Font","FontSize"]]
 				});</script>';
-
 			}
 
 
 			$this->t->set_var($vars);
-			$this->t->parse('rows','row');
-			$this->t->pparse('out','row');
-
-		}
-
-	}
-
-	function history()
-	{
-		if($this->file) // FIXME this-file is never defined
-		{
+			$this->t->parse('rows', 'row');
+			$this->t->pparse('out', 'row');
+		}
+	}
+
+	function history() {
+		if ($this->file) { // FIXME this-file is never defined
 			$journal_array = $this->bo->vfs->get_journal(array(
-				'string'	=> $this->file,//FIXME
-				'relatives'	=> array(RELATIVE_ALL)
-			));
-
-			if(is_array($journal_array))
-			{
+							'string' => $this->file, //FIXME
+							'relatives' => array(RELATIVE_ALL)
+					  ));
+
+			if (is_array($journal_array)) {
 				$this->html_table_begin();
 				$this->html_table_row_begin();
@@ -1074,6 +954,5 @@
 				$this->html_table_row_end();
 
-				while(list($num, $journal_entry) = each($journal_array))
-				{
+				while (list($num, $journal_entry) = each($journal_array)) {
 					$this->html_table_row_begin();
 					$this->html_table_col_begin();
@@ -1081,5 +960,5 @@
 					$this->html_table_col_end();
 					$this->html_table_col_begin();
-					$this->bo->html_text($journal_entry['version'] . '&nbsp;&nbsp;&nbsp;' );
+					$this->bo->html_text($journal_entry['version'] . '&nbsp;&nbsp;&nbsp;');
 					$this->html_table_col_end();
 					$this->html_table_col_begin();
@@ -1094,69 +973,56 @@
 				$GLOBALS['phpgw']->common->phpgw_footer();
 				$GLOBALS['phpgw']->common->phpgw_exit();
-			}
-			else
-			{
+			} else {
 				echo lang('No version history for this file/directory');
 			}
 		}
 	}
-	function view()
-	{
+
+	function view() {
 		if (!$this->bo->vfs->acl_check(array(
-			'string'        => $this->path,
-			'relatives'     => array(RELATIVE_NONE),
-			'operation'     => PHPGW_ACL_READ
-		)))
-		{
+						'string' => $this->path,
+						'relatives' => array(RELATIVE_NONE),
+						'operation' => PHPGW_ACL_READ
+				  ))) {
 			$this->messages[] = lang("You have no permission to access this file");
-			header('Location:'.$this->encode_href('inc/index.php?menuaction=filemanager.uifilemanager.index','&path='.base64_encode($this->bo->homedir)));
+			header('Location:' . $this->encode_href('inc/index.php?menuaction=filemanager.uifilemanager.index', '&path=' . base64_encode($this->bo->homedir)));
 
 			return;
 		}
-		if($this->file) //FIXME
-		{
+		if ($this->file) { //FIXME
 			$ls_array = $this->bo->vfs->ls(array(
-				'string'	=> $this->path.'/'.$this->file,//FIXME
-				'relatives'	=> array(RELATIVE_NONE),
-				'checksubdirs'	=> False,
-				'nofiles'	=> True
-			));
-			if($ls_array[0]['mime_type'])
-			{
+							'string' => $this->path . '/' . $this->file, //FIXME
+							'relatives' => array(RELATIVE_NONE),
+							'checksubdirs' => False,
+							'nofiles' => True
+					  ));
+			if ($ls_array[0]['mime_type']) {
 				$mime_type = $ls_array[0]['mime_type'];
-			}
-			elseif($this->prefs['viewtextplain'])
-			{
+			} elseif ($this->prefs['viewtextplain']) {
 				$mime_type = 'text/plain';
 			}
-			$viewable = array('text/plain','text/csv','text/html',
-				'text/text','image/jpeg','image/png','image/gif',
-				'audio/mpeg','video/mpeg');
-
-			if(in_array($mime_type,$viewable)) 
-			{
-				/*Note: if you put application/octet-stream you force download */
+			$viewable = array('text/plain', 'text/csv', 'text/html',
+				 'text/text', 'image/jpeg', 'image/png', 'image/gif',
+				 'audio/mpeg', 'video/mpeg');
+
+			if (in_array($mime_type, $viewable)) {
+				/* Note: if you put application/octet-stream you force download */
 				header('Content-type: ' . $mime_type);
 				header('Content-disposition: filename="' . addslashes($this->file) . '"');
 				Header("Pragma: public");
-			}
-			else
-			{
-				$GLOBALS['phpgw']->browser->content_header($this->file,$mime_type,$ls_array[0]['size']);
-			}
-			if ($ls_array[0]['size'] < 10240)
-			{
+			} else {
+				$GLOBALS['phpgw']->browser->content_header($this->file, $mime_type, $ls_array[0]['size']);
+			}
+			if ($ls_array[0]['size'] < 10240) {
 				echo $this->bo->vfs->read(array(
-					'string'    => $this->path.'/'.$this->file,//FIXME
-					'relatives'    => array(RELATIVE_NONE)
+					 'string' => $this->path . '/' . $this->file, //FIXME
+					 'relatives' => array(RELATIVE_NONE)
 				));
-			}
-			else
-			{
+			} else {
 				$this->bo->vfs->print_content(array(
-					'string' => $this->path.'/'.$this->file,
-					'relatives' => array(RELATIVE_NONE)
-				)
-			);
+					 'string' => $this->path . '/' . $this->file,
+					 'relatives' => array(RELATIVE_NONE)
+						  )
+				);
 			}
 			$GLOBALS['phpgw']->common->phpgw_exit();
@@ -1164,27 +1030,26 @@
 	}
 
-	function export(){
-		if($this->file)
-		{
+	function export() {
+		if ($this->file) {
 			$ls_array = $this->bo->vfs->ls(array(
-				'string'        => $this->path.'/'.$this->file,
-				'relatives'     => array(RELATIVE_NONE),
-				'checksubdirs'  => False,
-				'nofiles'       => True
-			));
-			/*$timestamp = $this->vfs_functions->dateString2timeStamp($ls_array[0]['modified']);
-			if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']);
-			{
-				// recently than last minute: someone is editing
-			}*/
+							'string' => $this->path . '/' . $this->file,
+							'relatives' => array(RELATIVE_NONE),
+							'checksubdirs' => False,
+							'nofiles' => True
+					  ));
+			/* $timestamp = $this->vfs_functions->dateString2timeStamp($ls_array[0]['modified']);
+			  if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']);
+			  {
+			  // recently than last minute: someone is editing
+			  } */
 			$mime_type = $ls_array[0]['mime_type'];
 			$formats = array('text/html');
-			if(!in_array($mime_type,$formats)){
+			if (!in_array($mime_type, $formats)) {
 				echo lang('Impossible to export this file');
 				return False;
 			}
-			$content = $this->bo->vfs->read(array('string' => $this->path.'/'.$this->file,
-				       'relatives'     => array(RELATIVE_NONE)
-			       ));
+			$content = $this->bo->vfs->read(array('string' => $this->path . '/' . $this->file,
+							'relatives' => array(RELATIVE_NONE)
+					  ));
 
 			include_once('filemanager/tp/dompdf/dompdf_config.inc.php');
@@ -1192,7 +1057,7 @@
 			$dompdf->load_html($content);
 			$dompdf->set_paper($this->prefs['pdf_paper_type'], $this->prefs['pdf_type']);
-			/* Would be nice to implement 'Title','Subject','Author','Creator','CreationDate'*/
+			/* Would be nice to implement 'Title','Subject','Author','Creator','CreationDate' */
 			$dompdf->render();
-			$dompdf->stream(strtok($this->file,'.').".pdf");
+			$dompdf->stream(strtok($this->file, '.') . ".pdf");
 			$GLOBALS['phpgw']->common->phpgw_exit();
 		}
@@ -1200,21 +1065,19 @@
 
 	//give back an array with all directories except current and dirs that are not accessable
-	function all_other_directories()
-	{
+	function all_other_directories() {
 		# First we get the directories in their home directory
 		$dirs = array();
 		$dirs[] = array('directory' => $this->bo->fakebase, 'name' => $this->bo->userinfo['account_lid']);
 
-		$tmp_arr=array(
-			'string'	=> $this->bo->homedir,
-			'relatives'	=> array(RELATIVE_NONE),
-			'checksubdirs'	=> True,
-			'mime_type'	=> 'Directory'
+		$tmp_arr = array(
+			 'string' => $this->bo->homedir,
+			 'relatives' => array(RELATIVE_NONE),
+			 'checksubdirs' => True,
+			 'mime_type' => 'Directory'
 		);
 
-		$ls_array = $this->bo->vfs->ls($tmp_arr,True);
-
-		while(list($num, $dir) = each($ls_array))
-		{
+		$ls_array = $this->bo->vfs->ls($tmp_arr, True);
+
+		while (list($num, $dir) = each($ls_array)) {
 			$dirs[] = $dir;
 		}
@@ -1223,11 +1086,9 @@
 		# Then we get the directories in their readable groups' home directories
 		reset($this->readable_groups);
-		while(list($num, $group_array) = each($this->readable_groups))
-		{
+		while (list($num, $group_array) = each($this->readable_groups)) {
 			// Don't list directories for groups that don't exists
-			$test=$this->bo->vfs->get_real_info(array('string' => $this->bo->fakebase.'/'.$group_array['account_name'],
-				'relatives' => array(RELATIVE_NONE), 'relative' => False));
-			if($test[mime_type]!='Directory')
-			{
+			$test = $this->bo->vfs->get_real_info(array('string' => $this->bo->fakebase . '/' . $group_array['account_name'],
+							'relatives' => array(RELATIVE_NONE), 'relative' => False));
+			if ($test[mime_type] != 'Directory') {
 				continue;
 			}
@@ -1235,28 +1096,24 @@
 			$dirs[] = array('directory' => $this->bo->fakebase, 'name' => $group_array['account_name']);
 
-			$tmp_arr=array(
-				'string'	=> $this->bo->fakebase.'/'.$group_array['account_name'],
-				'relatives'	=> array(RELATIVE_NONE),
-				'checksubdirs'	=> True,
-				'mime_type'	=> 'Directory'
+			$tmp_arr = array(
+				 'string' => $this->bo->fakebase . '/' . $group_array['account_name'],
+				 'relatives' => array(RELATIVE_NONE),
+				 'checksubdirs' => True,
+				 'mime_type' => 'Directory'
 			);
 
-			$ls_array = $this->bo->vfs->ls($tmp_arr,True);
-			while(list($num, $dir) = each($ls_array))
-			{
+			$ls_array = $this->bo->vfs->ls($tmp_arr, True);
+			while (list($num, $dir) = each($ls_array)) {
 				$dirs[] = $dir;
 			}
 		}
 		reset($dirs);
-		while(list($num, $dir) = each($dirs))
-		{
-			if(!$dir['directory'])
-			{
+		while (list($num, $dir) = each($dirs)) {
+			if (!$dir['directory']) {
 				continue;
 			}
 
 			# So we don't display //
-			if($dir['directory'] != '/')
-			{
+			if ($dir['directory'] != '/') {
 				$dir['directory'] .= '/';
 			}
@@ -1266,12 +1123,11 @@
 	}
 
-	function update_groups()
-	{
+	function update_groups() {
 		# Get their readable groups to be used throughout the script
 		$acl = array();
 		$groups = array();
-		$acl = $GLOBALS['phpgw']->acl->get_ids_for_location($GLOBALS['phpgw_info']['user']['account_id'],1,'filemanager');
+		$acl = $GLOBALS['phpgw']->acl->get_ids_for_location($GLOBALS['phpgw_info']['user']['account_id'], 1, 'filemanager');
 		if (is_array($acl))
-			foreach($acl as $key => $value){
+			foreach ($acl as $key => $value) {
 				$info = array();
 				$info = $GLOBALS['phpgw']->accounts->get_account_data($value);
@@ -1283,43 +1139,36 @@
 			}
 		$this->readable_groups = array();
-		while(list($num, $account) = each($groups))
-		{
-			if($this->bo->vfs->acl_check(array('owner_id' => $account['account_id'],'operation' => PHPGW_ACL_READ)))
-			{
+		while (list($num, $account) = each($groups)) {
+			if ($this->bo->vfs->acl_check(array('owner_id' => $account['account_id'], 'operation' => PHPGW_ACL_READ))) {
 				$this->readable_groups[$account['account_lid']] = Array('account_id' => $account['account_id'], 'account_name' => $account['account_lid']);
 			}
 		}
-
-	}
-	function search()
-	{
+	}
+
+	function search() {
 		/* TODO this is a primitive search */
 		$this->update_groups();
-   			$this->dirs = $this->all_other_directories();
+		$this->dirs = $this->all_other_directories();
 		$path = $this->path;
-		if (strlen($this->text) > 3)
-		{                                                                
+		if (strlen($this->text) > 3) {
 			$this->text = strtoupper($this->text);
-			foreach($this->dirs as $elem)
-			{
-				$this->path = $elem['directory'].$elem['name'];
+			foreach ($this->dirs as $elem) {
+				$this->path = $elem['directory'] . $elem['name'];
 				reset($this->files_array);
-	                        $this->readFilesInfo();
-				for($i = 0; $i < count($this->files_array); $i++)
-				{
+				$this->readFilesInfo();
+				for ($i = 0; $i < count($this->files_array); $i++) {
 					$comment = strtoupper($this->files_array[$i]['comment']);
 					$name = strtoupper($this->files_array[$i]['name']);
-					if (strstr($name,$this->text) ||
-					strstr($comment,$this->text) ){
-						$return[$this->files_array[$i]['directory'].$name] = $this->files_array[$i];
-						$return[$this->files_array[$i]['directory'].$name]['icon'] = $this->mime_icon($this->files_array[$i]['mime_type']);
+					if (strstr($name, $this->text) ||
+							  strstr($comment, $this->text)) {
+						$return[$this->files_array[$i]['directory'] . $name] = $this->files_array[$i];
+						$return[$this->files_array[$i]['directory'] . $name]['icon'] = $this->mime_icon($this->files_array[$i]['mime_type']);
 					}
 				}
-				if (count($return) > 50)
-				{
-					$return = array_slice($return,0,50);
+				if (count($return) > 50) {
+					$return = array_slice($return, 0, 50);
 					break;
 				}
-			}	
+			}
 		}
 		echo serialize(array_values($return));
@@ -1327,92 +1176,77 @@
 
 	/* seek icon for mimetype else return an unknown icon */
-	function mime_icon($mime_type, $size=16)
-	{
-		if(!$mime_type) $mime_type='unknown';
-
-		$mime_type=str_replace	('/','_',$mime_type);
-
-		$img=$GLOBALS['phpgw']->common->image('filemanager','mime'.$size.'_'.strtolower($mime_type));
-		if(!$img) $img=$GLOBALS['phpgw']->common->image('filemanager','mime'.$size.'_unknown');
+
+	function mime_icon($mime_type, $size=16) {
+		if (!$mime_type)
+			$mime_type = 'unknown';
+
+		$mime_type = str_replace('/', '_', $mime_type);
+
+		$img = $GLOBALS['phpgw']->common->image('filemanager', 'mime' . $size . '_' . strtolower($mime_type));
+		if (!$img)
+			$img = $GLOBALS['phpgw']->common->image('filemanager', 'mime' . $size . '_unknown');
 
 		return $img;
 	}
 
-	function toolButton($link,$img='',$description='')
-	{
-		$image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img));
-
-		if($img)
-		{
-			return '<div name="'.$link.'" class="toolButton" onclick="toolbar.control(\''.$link.'\',this);" title="'.$description.'"><img src="'.$image.'" alt="'.$description.'"/><small>'.$description.'</small></div>';
-		}
-	}
-
-	function inputButton($name,$img='',$description='')
-	{
-		$image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img));
-
-		if($img)
-		{
+	function toolButton($link, $img='', $description='') {
+		$image = $GLOBALS['phpgw']->common->image('filemanager', 'button_' . strtolower($img));
+
+		if ($img) {
+			return '<div name="' . $link . '" class="toolButton" onclick="toolbar.control(\'' . $link . '\',this);" title="' . $description . '"><img src="' . $image . '" alt="' . $description . '"/><small>' . $description . '</small></div>';
+		}
+	}
+
+	function inputButton($name, $img='', $description='') {
+		$image = $GLOBALS['phpgw']->common->image('filemanager', 'button_' . strtolower($img));
+
+		if ($img) {
 			return '<td class="" align="center" valign="middle" height="28" width="70">
-			<input title="'.$description.'" name="'.$name.'" type="image" alt="'.$name.'" src="'.$image.'" value="clicked" /><br><small>'.$description.'</small>
+			<input title="' . $description . '" name="' . $name . '" type="image" alt="' . $name . '" src="' . $image . '" value="clicked" /><br><small>' . $description . '</small>
 			</td>';
 		}
 	}
 
-
-	function html_form_input($type = NULL, $name = NULL, $value = NULL, $maxlength = NULL, $size = NULL, $checked = NULL, $string = '', $return = 1)
-	{
+	function html_form_input($type = NULL, $name = NULL, $value = NULL, $maxlength = NULL, $size = NULL, $checked = NULL, $string = '', $return = 1) {
 		$text = ' ';
-		if($type != NULL && $type)
-		{
-			if($type == 'checkbox')
-			{
+		if ($type != NULL && $type) {
+			if ($type == 'checkbox') {
 				$value = $this->bo->string_encode($value, 1);
 			}
-			$text .= 'type="'.$type.'" ';
-		}
-		if($name != NULL && $name)
-		{
-			$text .= 'name="'.$name.'" ';
-		}
-		if($value != NULL && $value)
-		{
-			$text .= 'value="'.$value.'" ';
-		}
-		if(is_int($maxlength) && $maxlength >= 0)
-		{
-			$text .= 'maxlength="'.$maxlength.'" ';
-		}
-		if(is_int($size) && $size >= 0)
-		{
-			$text .= 'size="'.$size.'" ';
-		}
-		if($checked != NULL && $checked)
-		{
+			$text .= 'type="' . $type . '" ';
+		}
+		if ($name != NULL && $name) {
+			$text .= 'name="' . $name . '" ';
+		}
+		if ($value != NULL && $value) {
+			$text .= 'value="' . $value . '" ';
+		}
+		if (is_int($maxlength) && $maxlength >= 0) {
+			$text .= 'maxlength="' . $maxlength . '" ';
+		}
+		if (is_int($size) && $size >= 0) {
+			$text .= 'size="' . $size . '" ';
+		}
+		if ($checked != NULL && $checked) {
 			$text .= 'checked ';
 		}
 
-		return '<input'.$text.$string.'>';
-	}
-
-	function html_form_option($value = NULL, $displayed = NULL, $selected = NULL, $return = 0)
-	{
+		return '<input' . $text . $string . '>';
+	}
+
+	function html_form_option($value = NULL, $displayed = NULL, $selected = NULL, $return = 0) {
 		$text = ' ';
-		if($value != NULL && $value)
-		{
-			$text .= ' value="'.$value.'" ';
-		}
-		if($selected != NULL && $selected)
-		{
+		if ($value != NULL && $value) {
+			$text .= ' value="' . $value . '" ';
+		}
+		if ($selected != NULL && $selected) {
 			$text .= ' selected';
 		}
-		return  '<option'.$text.'>'.$displayed.'</option>';
-	}
-
-	function encode_href($href = NULL, $args = NULL , $extra_args)
-	{
+		return '<option' . $text . '>' . $displayed . '</option>';
+	}
+
+	function encode_href($href = NULL, $args = NULL, $extra_args) {
 		$href = $this->bo->string_encode($href, 1);
-		$all_args = $args.'&'.$this->bo->string_encode($extra_args, 1);
+		$all_args = $args . '&' . $this->bo->string_encode($extra_args, 1);
 
 		$address = $GLOBALS['phpgw']->link($href, $all_args);
@@ -1421,16 +1255,12 @@
 	}
 
-	function html_link($href = NULL, $args = NULL , $extra_args, $text = NULL, $return = 1, $encode = 1, $linkonly = 0, $target = NULL)
-	{
+	function html_link($href = NULL, $args = NULL, $extra_args, $text = NULL, $return = 1, $encode = 1, $linkonly = 0, $target = NULL) {
 		//	unset($encode);
-		if($encode)
-		{
+		if ($encode) {
 			$href = $this->bo->string_encode($href, 1);
-			$all_args = $args.'&'.$this->bo->string_encode($extra_args, 1);
-		}
-		else
-		{
+			$all_args = $args . '&' . $this->bo->string_encode($extra_args, 1);
+		} else {
 			//				$href = $this->bo->string_encode($href, 1);
-			$all_args = $args.'&'.$extra_args;
+			$all_args = $args . '&' . $extra_args;
 		}
 		###
@@ -1441,11 +1271,8 @@
 
 		/* Auto-detect and don't disturb absolute links */
-		if(!preg_match("|^http(.{0,1})://|", $href))
-		{
+		if (!preg_match("|^http(.{0,1})://|", $href)) {
 			//Only add an extra / if there isn't already one there
-
 			// die(SEP);
-			if(!($href[0] == SEP))
-			{
+			if (!($href[0] == SEP)) {
 				$href = SEP . $href;
 			}
@@ -1455,24 +1282,18 @@
 			$address = $GLOBALS['phpgw']->link($href, $all_args);
 			//				$address = $GLOBALS['phpgw']->link($href);
-		}
-		else
-		{
+		} else {
 			$address = $href;
 		}
 
 		/* If $linkonly is set, don't add any HTML */
-		if($linkonly)
-		{
+		if ($linkonly) {
 			$rstring = $address;
-		}
-		else
-		{
-			if($target)
-			{
-				$target = 'target='.$target;
+		} else {
+			if ($target) {
+				$target = 'target=' . $target;
 			}
 
 			$text = trim($text);
-			$rstring = '<a href="'.$address.'" '.$target.'>'.$text.'</a>';
+			$rstring = '<a href="' . $address . '" ' . $target . '>' . $text . '</a>';
 		}
 
@@ -1480,24 +1301,18 @@
 	}
 
-	function html_table_begin($width = NULL, $border = NULL, $cellspacing = NULL, $cellpadding = NULL, $rules = NULL, $string = '', $return = 0)
-	{
-		if($width != NULL && $width)
-		{
+	function html_table_begin($width = NULL, $border = NULL, $cellspacing = NULL, $cellpadding = NULL, $rules = NULL, $string = '', $return = 0) {
+		if ($width != NULL && $width) {
 			$width = "width=$width";
 		}
-		if(is_int($border) && $border >= 0)
-		{
+		if (is_int($border) && $border >= 0) {
 			$border = "border=$border";
 		}
-		if(is_int($cellspacing) && $cellspacing >= 0)
-		{
+		if (is_int($cellspacing) && $cellspacing >= 0) {
 			$cellspacing = "cellspacing=$cellspacing";
 		}
-		if(is_int($cellpadding) && $cellpadding >= 0)
-		{
+		if (is_int($cellpadding) && $cellpadding >= 0) {
 			$cellpadding = "cellpadding=$cellpadding";
 		}
-		if($rules != NULL && $rules)
-		{
+		if ($rules != NULL && $rules) {
 			$rules = "rules=$rules";
 		}
@@ -1507,26 +1322,20 @@
 	}
 
-	function html_table_end($return = 0)
-	{
+	function html_table_end($return = 0) {
 		$rstring = "</table>";
 		return($this->bo->eor($rstring, $return));
 	}
 
-	function html_table_row_begin($align = NULL, $halign = NULL, $valign = NULL, $bgcolor = NULL, $string = '', $return = 0)
-	{
-		if($align != NULL && $align)
-		{
+	function html_table_row_begin($align = NULL, $halign = NULL, $valign = NULL, $bgcolor = NULL, $string = '', $return = 0) {
+		if ($align != NULL && $align) {
 			$align = "align=$align";
 		}
-		if($halign != NULL && $halign)
-		{
+		if ($halign != NULL && $halign) {
 			$halign = "halign=$halign";
 		}
-		if($valign != NULL && $valign)
-		{
+		if ($valign != NULL && $valign) {
 			$valign = "valign=$valign";
 		}
-		if($bgcolor != NULL && $bgcolor)
-		{
+		if ($bgcolor != NULL && $bgcolor) {
 			$bgcolor = "bgcolor=$bgcolor";
 		}
@@ -1535,30 +1344,23 @@
 	}
 
-	function html_table_row_end($return = 0)
-	{
+	function html_table_row_end($return = 0) {
 		$rstring = "</tr>";
 		return($this->bo->eor($rstring, $return));
 	}
 
-	function html_table_col_begin($align = NULL, $halign = NULL, $valign = NULL, $rowspan = NULL, $colspan = NULL, $string = '', $return = 0)
-	{
-		if($align != NULL && $align)
-		{
+	function html_table_col_begin($align = NULL, $halign = NULL, $valign = NULL, $rowspan = NULL, $colspan = NULL, $string = '', $return = 0) {
+		if ($align != NULL && $align) {
 			$align = "align=$align";
 		}
-		if($halign != NULL && $halign)
-		{
+		if ($halign != NULL && $halign) {
 			$halign = "halign=$halign";
 		}
-		if($valign != NULL && $valign)
-		{
+		if ($valign != NULL && $valign) {
 			$valign = "valign=$valign";
 		}
-		if(is_int($rowspan) && $rowspan >= 0)
-		{
+		if (is_int($rowspan) && $rowspan >= 0) {
 			$rowspan = "rowspan=$rowspan";
 		}
-		if(is_int($colspan) && $colspan >= 0)
-		{
+		if (is_int($colspan) && $colspan >= 0) {
 			$colspan = "colspan=$colspan";
 		}
@@ -1568,8 +1370,8 @@
 	}
 
-	function html_table_col_end($return = 0)
-	{
+	function html_table_col_end($return = 0) {
 		$rstring = "</td>";
 		return($this->bo->eor($rstring, $return));
 	}
+
 }
