Ignore:
Timestamp:
03/18/11 18:18:12 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #1648 - Correcao( codigo ) e melhoria( laytou/informacao ) no upload de arquivos para o servidor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/filemanager/inc/class.uifilemanager.inc.php

    r3873 r3879  
    11<?php 
    2         /**************************************************************************\ 
    3         * -------------------------------------------------------------------------* 
    4         * This library is free software; you can redistribute it and/or modify it  * 
    5         * under the terms of the GNU Lesser General Public License as published by * 
    6         * the Free Software Foundation; either version 2.1 of the License,         * 
    7         * or any later version.                                                    * 
    8         * This library is distributed in the hope that it will be useful, but      * 
    9         * WITHOUT ANY WARRANTY; without even the implied warranty of               * 
    10         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     * 
    11         * See the GNU Lesser General Public License for more details.              * 
    12         * You should have received a copy of the GNU Lesser General Public License * 
    13         * along with this library; if not, write to the Free Software Foundation,  * 
    14         * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            * 
    15         \**************************************************************************/ 
    16  
    17         /* $Id: class.uifilemanager.inc.php 17511 2004-12-12 06:35:24Z dawnlinux $ */ 
    18  
    19 class uifilemanager 
    20 { 
     2 
     3/* * ************************************************************************\ 
     4 * -------------------------------------------------------------------------* 
     5 * This library is free software; you can redistribute it and/or modify it  * 
     6 * under the terms of the GNU Lesser General Public License as published by * 
     7 * the Free Software Foundation; either version 2.1 of the License,         * 
     8 * or any later version.                                                    * 
     9 * This library is distributed in the hope that it will be useful, but      * 
     10 * WITHOUT ANY WARRANTY; without even the implied warranty of               * 
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     * 
     12 * See the GNU Lesser General Public License for more details.              * 
     13 * You should have received a copy of the GNU Lesser General Public License * 
     14 * along with this library; if not, write to the Free Software Foundation,  * 
     15 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            * 
     16  \************************************************************************* */ 
     17 
     18/* $Id: class.uifilemanager.inc.php 17511 2004-12-12 06:35:24Z dawnlinux $ */ 
     19 
     20class uifilemanager { 
     21 
    2122        var $public_functions = array( 
    22                 'index'                                 => True, 
    23                 'help'                                  => True, 
    24                 'view'                                  => True, 
    25                 'export'                                => True, 
    26                 'touch'                                 => True, 
    27                 'history'                               => True, 
    28                 'edit'                                  => True, 
    29                 'fileModels'                    => True, 
    30                 'getReturnExecuteForm'  => True, 
    31                 'dir_ls'                                => True, 
    32                 'search'                                => True, 
    33                 'get_folders_list'              => True, 
    34                 'showUploadboxes'               => True, 
    35                 'createdir'                     => True, 
    36                 'removedir'                     => True, 
    37                 'uploadModel'                   => True 
     23                 'index' => True, 
     24                 'help' => True, 
     25                 'view' => True, 
     26                 'export' => True, 
     27                 'touch' => True, 
     28                 'history' => True, 
     29                 'edit' => True, 
     30                 'fileModels' => True, 
     31                 'getReturnExecuteForm' => True, 
     32                 'dir_ls' => True, 
     33                 'search' => True, 
     34                 'get_folders_list' => True, 
     35                 'showUploadboxes' => True, 
     36                 'createdir' => True, 
     37                 'removedir' => True, 
     38                 'uploadModel' => True 
    3839        ); 
    39  
    4040        //keep 
    4141        var $bo; 
     
    4949        var $numoffiles; 
    5050        var $dispsep; 
    51  
    5251        var $target; 
    53  
    54         var $prefs;//array 
    55  
     52        var $prefs; //array 
    5653        var $groups_applications; 
    57  
    5854        var $current_config; 
    5955        var $dirs; 
     
    7268        var $edit_save_done_x; 
    7369        var $edit_cancel_x; 
    74  
    7570        // this ones must be checked thorougly; 
    7671        var $fileman = Array(); 
     
    8277        var $limit; //for paging (paginacao) 
    8378        var $offset; //for paging (paginacao) 
    84  
    8579        var $now; 
    8680 
    87         function uifilemanager() 
    88         { 
     81        function uifilemanager() { 
    8982                $this->messages = &$_SESSION['phpgw_info']['filemanager']['user']['messages']; 
    9083 
     
    9891 
    9992                $this->t = $GLOBALS['phpgw']->template; 
    100                 $c = CreateObject('phpgwapi.config','filemanager'); 
     93                $c = CreateObject('phpgwapi.config', 'filemanager'); 
    10194                $c->read_repository(); 
     95 
    10296                $this->current_config = $c->config_data; 
    103  
    10497 
    10598                // here local vars are created from the HTTP vars 
    10699                @reset($GLOBALS['HTTP_POST_VARS']); 
    107                 while(list($name,) = @each($GLOBALS['HTTP_POST_VARS'])) 
    108                 { 
     100                while (list($name, ) = @each($GLOBALS['HTTP_POST_VARS'])) { 
    109101                        $this->$name = $GLOBALS['HTTP_POST_VARS'][$name]; 
    110102                } 
    111103 
    112104                @reset($GLOBALS['HTTP_GET_VARS']); 
    113                 while(list($name,) = @each($GLOBALS['HTTP_GET_VARS'])) 
    114                 { 
     105                while (list($name, ) = @each($GLOBALS['HTTP_GET_VARS'])) { 
    115106                        $$name = $GLOBALS['HTTP_GET_VARS'][$name]; 
    116107                        $this->$name = $GLOBALS['HTTP_GET_VARS'][$name]; 
    117  
    118108                } 
    119109 
    120110                $to_decode = array 
    121                 ( 
    122                         'op'    => array('op' => ''), 
    123                         'path'  => array('path' => ''), 
    124                         'filename' => array('filename' => ''), 
    125                         'file'  => array('file' => ''), 
    126                         'sortby'        => array('sortby' => ''), 
    127                         'messages'      => array('messages'     => ''), 
    128                         'show_upload_boxes'     => array('show_upload_boxes' => ''), 
    129                         'from'  =>      array('from' => ''), 
    130                         'to' => array('to' => '') 
    131  
     111                         ( 
     112                         'op' => array('op' => ''), 
     113                         'path' => array('path' => ''), 
     114                         'filename' => array('filename' => ''), 
     115                         'file' => array('file' => ''), 
     116                         'sortby' => array('sortby' => ''), 
     117                         'messages' => array('messages' => ''), 
     118                         'show_upload_boxes' => array('show_upload_boxes' => ''), 
     119                         'from' => array('from' => ''), 
     120                         'to' => array('to' => '') 
    132121                ); 
    133122 
    134123                reset($to_decode); 
    135                 while(list($var, $conditions) = each($to_decode)) 
    136                 { 
    137                         while(list($condvar, $condvalue) = each($conditions)) 
    138                         { 
    139                                 if(isset($$condvar) && ($condvar == $var || $$condvar == $condvalue)) 
    140                                 { 
     124                while (list($var, $conditions) = each($to_decode)) { 
     125                        while (list($condvar, $condvalue) = each($conditions)) { 
     126                                if (isset($$condvar) && ($condvar == $var || $$condvar == $condvalue)) { 
    141127                                        $this->$var = stripslashes(base64_decode($$var)); 
    142128                                } 
     
    151137                $pref_array = $pref->read_repository(); 
    152138                $this->prefs = $pref_array[$this->bo->appname]; //FIXME check appname var in _debug_array 
    153  
    154139                //always show name 
    155140 
    156                 $this->prefs[name] =1; 
    157  
    158  
    159                 if($this->prefs['viewinnewwin']) 
    160                 { 
     141                $this->prefs[name] = 1; 
     142 
     143 
     144                if ($this->prefs['viewinnewwin']) { 
    161145                        $this->target = '_blank'; 
    162146                } 
     
    164148 
    165149                /* 
    166                         Check for essential directories 
    167                         admin must be able to disable these tests 
    168                 */ 
    169                  
     150                  Check for essential directories 
     151                  admin must be able to disable these tests 
     152                 */ 
     153 
    170154                // check if basedir exist  
    171                 $test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    172                 if($test[mime_type]!='Directory') 
    173                 { 
     155                $test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
     156                if ($test[mime_type] != 'Directory') { 
    174157                        die('Base directory does not exist, Ask adminstrator to check the global configuration.'); 
    175158                } 
    176159 
    177                 $test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir.$this->bo->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    178                 if($test[mime_type]!='Directory') 
    179                 { 
     160                $test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir . $this->bo->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
     161                if ($test[mime_type] != 'Directory') { 
    180162                        $this->bo->vfs->override_acl = 1; 
    181163 
    182164                        $this->bo->vfs->mkdir(array( 
    183                                 'string' => $this->bo->fakebase, 
    184                                 'relatives' => array(RELATIVE_NONE) 
     165                                 'string' => $this->bo->fakebase, 
     166                                 'relatives' => array(RELATIVE_NONE) 
    185167                        )); 
    186                          
     168 
    187169                        $this->bo->vfs->override_acl = 0; 
    188170 
    189171                        //test one more time 
    190                         $test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir.$this->bo->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    191  
    192                         if($test[mime_type]!='Directory') 
    193                         { 
     172                        $test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir . $this->bo->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
     173 
     174                        if ($test[mime_type] != 'Directory') { 
    194175                                die('Fake Base directory does not exist and could not be created, please ask the administrator to check the global configuration.'); 
    195                         } 
    196                         else 
    197                         { 
    198                                 $this->messages[]= lang('Fake Base Dir did not exist, created a new one.'); 
    199                         } 
    200                 } 
    201  
    202                 $test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir.$this->bo->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    203                 if($test[mime_type]!='Directory') 
    204                 { 
     176                        } else { 
     177                                $this->messages[] = lang('Fake Base Dir did not exist, created a new one.'); 
     178                        } 
     179                } 
     180 
     181                $test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir . $this->bo->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
     182                if ($test[mime_type] != 'Directory') { 
    205183                        $this->bo->vfs->override_acl = 1; 
    206184 
    207185                        $this->bo->vfs->mkdir(array( 
    208                                 'string' => $this->bo->homedir, 
    209                                 'relatives' => array(RELATIVE_NONE) 
     186                                 'string' => $this->bo->homedir, 
     187                                 'relatives' => array(RELATIVE_NONE) 
    210188                        )); 
    211189                        $this->bo->vfs->set_quota(array( 
    212                                 'string' => $this->bo->homedir, 
    213                                 'relatives' => array(RELATIVE_NONE), 
    214                                 'new_quota' => $this->current_config['filemanager_quota_size']  
     190                                 'string' => $this->bo->homedir, 
     191                                 'relatives' => array(RELATIVE_NONE), 
     192                                 'new_quota' => $this->current_config['filemanager_quota_size'] 
    215193                        )); 
    216194 
     
    218196 
    219197                        //test one more time 
    220                         $test=$this->bo->vfs->get_real_info(array('string' => $this->bo->basedir.$this->bo->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    221  
    222                         if($test[mime_type]!='Directory') 
    223                         { 
     198                        $test = $this->bo->vfs->get_real_info(array('string' => $this->bo->basedir . $this->bo->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
     199 
     200                        if ($test[mime_type] != 'Directory') { 
    224201                                die('Your Home Dir does not exist and could not be created, please ask the adminstrator to check the global configuration.'); 
    225                         } 
    226                         else 
    227                         { 
    228                                 $this->messages[]= lang('Your Home Dir did not exist, eGroupWare created a new one.'); 
     202                        } else { 
     203                                $this->messages[] = lang('Your Home Dir did not exist, eGroupWare created a new one.'); 
    229204                                // FIXME we just created a fresh home dir so we know there nothing in it so we have to remove all existing content 
    230205                        } 
    231  
    232  
    233                 } 
    234         } 
    235         function fileModels() 
    236         { 
     206                } 
     207        } 
     208 
     209        function fileModels() { 
    237210                $GLOBALS['phpgw_info']['flags'] = array 
    238                         ( 
    239                                 'currentapp'    => 'filemanager', 
    240                                 'noheader'      => False, 
    241                                 'nonavbar' => False, 
    242                                 'nofooter'      => False, 
    243                                 'noappheader'  => False, 
    244                                 'enable_browser_class' => True 
    245                         ); 
     211                         ( 
     212                         'currentapp' => 'filemanager', 
     213                         'noheader' => False, 
     214                         'nonavbar' => False, 
     215                         'nofooter' => False, 
     216                         'noappheader' => False, 
     217                         'enable_browser_class' => True 
     218                ); 
    246219 
    247220                $GLOBALS['phpgw']->common->phpgw_header(); 
    248221                $this->t->set_file(array('models' => 'fileModels.tpl')); 
    249                 $this->t->set_block('models','header','header'); 
    250                 $this->t->set_block('models','body','body'); 
    251                 $this->t->set_block('models','footer','footer'); 
     222                $this->t->set_block('models', 'header', 'header'); 
     223                $this->t->set_block('models', 'body', 'body'); 
     224                $this->t->set_block('models', 'footer', 'footer'); 
    252225                $this->t->set_var('url_1', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=article'); 
    253                 $this->t->set_var('model_1','article'); 
    254                 $this->t->set_var('lang_1',lang('article')); 
    255  
    256                 $this->t->set_var('url_2','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=calendar'); 
    257                 $this->t->set_var('model_2','calendar'); 
    258                 $this->t->set_var('lang_2',lang('calendar')); 
    259  
    260                 $this->t->set_var('url_3','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=todo'); 
    261                 $this->t->set_var('model_3','todo'); 
    262                 $this->t->set_var('lang_3',lang('todo')); 
    263  
    264                 $this->t->set_var('url_4','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=slide'); 
    265                 $this->t->set_var('model_4','slide'); 
    266                 $this->t->set_var('lang_4',lang('slide')); 
    267  
    268                 $this->t->set_var('url_5','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=cards'); 
    269                 $this->t->set_var('model_5','cards'); 
    270                 $this->t->set_var('lang_5',lang('cards')); 
    271  
    272                 $this->t->set_var('url_6','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=resume'); 
    273                 $this->t->set_var('model_6','resume'); 
    274                 $this->t->set_var('lang_6',lang('resume')); 
    275  
    276  
    277                 $this->t->pparse('out','models'); 
    278  
    279  
    280         } 
    281         function uploadModel(){ 
     226                $this->t->set_var('model_1', 'article'); 
     227                $this->t->set_var('lang_1', lang('article')); 
     228 
     229                $this->t->set_var('url_2', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=calendar'); 
     230                $this->t->set_var('model_2', 'calendar'); 
     231                $this->t->set_var('lang_2', lang('calendar')); 
     232 
     233                $this->t->set_var('url_3', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=todo'); 
     234                $this->t->set_var('model_3', 'todo'); 
     235                $this->t->set_var('lang_3', lang('todo')); 
     236 
     237                $this->t->set_var('url_4', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=slide'); 
     238                $this->t->set_var('model_4', 'slide'); 
     239                $this->t->set_var('lang_4', lang('slide')); 
     240 
     241                $this->t->set_var('url_5', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=cards'); 
     242                $this->t->set_var('model_5', 'cards'); 
     243                $this->t->set_var('lang_5', lang('cards')); 
     244 
     245                $this->t->set_var('url_6', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=resume'); 
     246                $this->t->set_var('model_6', 'resume'); 
     247                $this->t->set_var('lang_6', lang('resume')); 
     248 
     249 
     250                $this->t->pparse('out', 'models'); 
     251        } 
     252 
     253        function uploadModel() { 
    282254                $GLOBALS['phpgw_info']['flags'] = array 
    283                         ( 
    284                                 'currentapp'    => 'filemanager', 
    285                                 'noheader'      => False, 
    286                                 'nonavbar' => False, 
    287                                 'nofooter'      => False, 
    288                                 'noappheader'  => False, 
    289                                 'enable_browser_class' => True 
    290                         ); 
     255                         ( 
     256                         'currentapp' => 'filemanager', 
     257                         'noheader' => False, 
     258                         'nonavbar' => False, 
     259                         'nofooter' => False, 
     260                         'noappheader' => False, 
     261                         'enable_browser_class' => True 
     262                ); 
    291263 
    292264                $GLOBALS['phpgw']->common->phpgw_header(); 
    293265 
    294                 $filename = lang('new')."_".lang($this->model).rand(0,1000).".html"; 
     266                $filename = lang('new') . "_" . lang($this->model) . rand(0, 1000) . ".html"; 
    295267                $this->bo->vfs->cp(array( 
    296                         'from'=> PHPGW_SERVER_ROOT . '/filemanager/templates/default/'.$this->model.'.html', 
    297                         'to'=> $filename, 
    298                         'relatives'     => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 
     268                         'from' => PHPGW_SERVER_ROOT . '/filemanager/templates/default/' . $this->model . '.html', 
     269                         'to' => $filename, 
     270                         'relatives' => array(RELATIVE_NONE | VFS_REAL, RELATIVE_ALL) 
    299271                )); 
    300272 
    301273                $this->bo->vfs->set_attributes(array( 
    302                         'string'=> $filename, 
    303                         'relatives'    => array(RELATIVE_ALL), 
    304                         'attributes'=> array( 
    305                                 'mime_type' => "text/html", 
    306                                 'comment' => "" 
    307                         ) 
     274                         'string' => $filename, 
     275                         'relatives' => array(RELATIVE_ALL), 
     276                         'attributes' => array( 
     277                                  'mime_type' => "text/html", 
     278                                  'comment' => "" 
     279                         ) 
    308280                )); 
    309281                $this->filename = $filename; 
    310282                $this->edit(); 
    311  
    312         } 
    313         function index() 
    314         { 
     283        } 
     284 
     285        function index() { 
    315286                $GLOBALS['phpgw_info']['flags'] = array 
    316                 ( 
    317                         'currentapp'    => 'filemanager', 
    318                         'noheader'      => False, 
    319                         'nonavbar' => False, 
    320                         'nofooter'      => False, 
    321                         'noappheader'   => False, 
    322                         'enable_browser_class'  => True 
     287                         ( 
     288                         'currentapp' => 'filemanager', 
     289                         'noheader' => False, 
     290                         'nonavbar' => False, 
     291                         'nofooter' => False, 
     292                         'noappheader' => False, 
     293                         'enable_browser_class' => True 
    323294                ); 
    324295 
    325296                $GLOBALS['phpgw']->common->phpgw_header(); 
     297 
     298                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/inc/load_lang.php'></script>"; 
     299                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/global.js'></script>"; 
     300                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/main.js'></script>"; 
     301                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/common_functions.js'></script>"; 
     302                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/connector.js'></script>"; 
     303                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/draw_api.js'></script>"; 
     304                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/drag_area.js'></script>"; 
     305                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/handler.js'></script>"; 
    326306                 
    327                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/inc/load_lang.php'></script>"; 
    328                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/global.js'></script>"; 
    329                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/main.js'></script>"; 
    330                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 
    331                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 
    332                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/draw_api.js'></script>"; 
    333                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/drag_area.js'></script>"; 
    334                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/handler.js'></script>"; 
     307                //echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/js/NewHandler.js'></script>"; 
    335308 
    336309 
     
    338311                $theme = "window_" . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . ".css"; 
    339312 
    340                 if( !file_exists('filemanager/tp/expressowindow/css/'.$theme) ) 
     313                if (!file_exists('filemanager/tp/expressowindow/css/' . $theme)) 
    341314                        $theme = "window_default.css"; 
    342315 
    343316                // Path FileManager 
    344317                $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 
    345                 $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; 
    346          
    347                 if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1)) 
     318                $webserver_url = (!empty($webserver_url) ) ? $webserver_url : '/'; 
     319 
     320                if (strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url) - 1)) 
    348321                        $webserver_url .= '/'; 
    349          
    350                 $webserver_url  = $webserver_url . 'filemanager/';  
    351                  
    352                 $js   = "var path_filemanager   = '".$webserver_url."';"; 
    353                 $js      .= "var my_home_filemanager    = '".trim($GLOBALS['uifilemanager']->bo->vfs->my_home)."';"; 
    354                  
    355                 echo "<script type='text/javascript'>".$js."</script>"; 
     322 
     323                $webserver_url = $webserver_url . 'filemanager/'; 
     324 
     325                $js = "var path_filemanager     = '" . $webserver_url . "';"; 
     326                $js .= "var my_home_filemanager = '" . trim($GLOBALS['uifilemanager']->bo->vfs->my_home) . "';"; 
     327 
     328                echo "<script type='text/javascript'>" . $js . "</script>"; 
    356329 
    357330                // Expresso Window - CSS 
    358                 print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'tp/expressowindow/css/'.$theme.'" >'; 
     331                print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'tp/expressowindow/css/' . $theme . '" >'; 
    359332 
    360333                // Expresso Window - JS  
    361                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/xtools.js'></script>"; 
    362                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/jsloader.js'></script>"; 
    363                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/makeW.js'></script>"; 
    364                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/dragdrop.js'></script>"; 
    365                 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/tp/expressowindow/js/show_hidden.js'></script>"; 
     334                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/xtools.js'></script>"; 
     335                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/jsloader.js'></script>"; 
     336                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/makeW.js'></script>"; 
     337                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/dragdrop.js'></script>"; 
     338                echo "<script src='" . $GLOBALS['phpgw_info']['flags']['currentapp'] . "/tp/expressowindow/js/show_hidden.js'></script>"; 
    366339 
    367340                echo "<script src='./phpgwapi/js/dftree/dftree.js'></script>"; 
     
    370343                # Code is fairly hackish at the beginning, but it gets better 
    371344                # Highly suggest turning wrapping off due to long SQL queries 
    372  
    373345                ### 
    374346                # Some hacks to set and display directory paths correctly 
    375347                ### 
    376348                // new method for switching to a new dir. 
    377                 if($this->changedir=='true' && $this->cdtodir || $this->goto_x) 
    378                 { 
     349                if ($this->changedir == 'true' && $this->cdtodir || $this->goto_x) { 
    379350                        $this->path = $this->cdtodir; 
    380351                } 
    381352 
    382                 if(!$this->path) 
    383                 { 
     353                if (!$this->path) { 
    384354                        $this->path = $this->bo->vfs->pwd(); 
    385355 
    386                         if(!$this->path || $this->bo->vfs->pwd(array('full' => False)) == '') 
    387                         { 
    388                                 $this->path = $this->bo->homedir;  
     356                        if (!$this->path || $this->bo->vfs->pwd(array('full' => False)) == '') { 
     357                                $this->path = $this->bo->homedir; 
    389358                        } 
    390359                } 
     
    395364                $pwd = $this->bo->vfs->pwd(); 
    396365 
    397                 if(!$this->cwd = substr($this->path, strlen($this->bo->homedir) + 1))   
    398                 { 
     366                if (!$this->cwd = substr($this->path, strlen($this->bo->homedir) + 1)) { 
    399367                        $this->cwd = '/'; 
    400                 } 
    401                 else 
    402                 { 
     368                } else { 
    403369                        $this->cwd = substr($pwd, strrpos($pwd, '/') + 1); 
    404370                } 
     
    407373 
    408374                /* This just prevents // in some cases */ 
    409                 if($this->path == '/') 
    410                 { 
     375                if ($this->path == '/') { 
    411376                        $this->dispsep = ''; 
    412                 } 
    413                 else 
    414                 { 
     377                } else { 
    415378                        $this->dispsep = '/'; 
    416379                } 
    417380 
    418                 if(!($this->lesspath = substr($this->path, 0, strrpos($this->path, '/')))) 
    419                 { 
     381                if (!($this->lesspath = substr($this->path, 0, strrpos($this->path, '/')))) { 
    420382                        $this->lesspath = '/'; 
    421383                } 
    422384 
    423                 /*Check permission*/ 
    424                 if($this->bo->vfs->acl_check(array( 
    425                         'string' => $this->path, 
    426                         'relatives' => array(RELATIVE_NONE), 
    427                         'operation' => PHPGW_ACL_READ 
    428                 ))) 
    429                 { 
     385                /* Check permission */ 
     386                if ($this->bo->vfs->acl_check(array( 
     387                                                'string' => $this->path, 
     388                                                'relatives' => array(RELATIVE_NONE), 
     389                                                'operation' => PHPGW_ACL_READ 
     390                                  ))) { 
    430391                        $this->can_read = True; 
    431392                } 
    432393 
    433394 
    434                 if ($_SESSION['phpgw_info']['user']['filemanager']['flush'] != 'flushed') 
    435                 { 
    436                         /*Flush journal-deleted*/ 
     395                if ($_SESSION['phpgw_info']['user']['filemanager']['flush'] != 'flushed') { 
     396                        /* Flush journal-deleted */ 
    437397                        $this->bo->vfs->flush_journal(array( 
    438                                 'string' => $this->path, 
    439                                 'relatives' => array(RELATIVE_NONE), 
    440                                 'deleteall' => True 
     398                                 'string' => $this->path, 
     399                                 'relatives' => array(RELATIVE_NONE), 
     400                                 'deleteall' => True 
    441401                        )); 
    442402                        $_SESSION['phpgw_info']['user']['filemanager']['flush'] = 'flushed'; 
     
    446406 
    447407                # if is different path than home and no permission allowed 
    448                 if($this->path != $this->bo->homedir && $this->path != $this->bo->fakebase && $this->path != '/' && !$this->can_read) 
    449                 { 
     408                if ($this->path != $this->bo->homedir && $this->path != $this->bo->fakebase && $this->path != '/' && !$this->can_read) { 
    450409                        $this->messages[] = lang('You do not have access to %1', $this->path); 
    451410                        $this->path = $this->homedir; 
     
    459418 
    460419                # Verify path is real 
    461                 if($this->path != $this->bo->homedir && $this->path != '/' && $this->path != $this->bo->fakebase) 
    462                 { 
    463                         if(!$this->bo->vfs->file_exists(array( 
    464                                 'string' => $this->path, 
    465                                 'relatives' => array(RELATIVE_NONE) 
    466                         ))) 
    467                         { 
    468                                 $this->messages[] = lang('Error:').lang('Directory %1 does not exist', $this->path); 
     420                if ($this->path != $this->bo->homedir && $this->path != '/' && $this->path != $this->bo->fakebase) { 
     421                        if (!$this->bo->vfs->file_exists(array( 
     422                                                        'string' => $this->path, 
     423                                                        'relatives' => array(RELATIVE_NONE) 
     424                                          ))) { 
     425                                $this->messages[] = lang('Error:') . lang('Directory %1 does not exist', $this->path); 
    469426                                $this->path = $this->homedir; 
    470427                                $this->bo->vfs->cd(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
     
    476433 
    477434                # Default is to sort by name 
    478                 if(!$this->sortby) 
    479                 { 
     435                if (!$this->sortby) { 
    480436                        $this->sortby = 'name'; 
    481437                } 
    482                 if($this->update_x == 1){ 
     438                if ($this->update_x == 1) { 
    483439                        $this->bo->vfs->update_real(array( 
    484                                 'string'        => $this->path, 
    485                                 'relatives'    => array(RELATIVE_NONE) 
     440                                 'string' => $this->path, 
     441                                 'relatives' => array(RELATIVE_NONE) 
    486442                        )); 
    487                         header('Location:'.$this->encode_href('index.php?menuaction=filemanager.uifilemanager.index','&path='.base64_encode($this->bo->homedir))); 
    488                 } 
    489                 elseif($this->newfile_x && $this->newfile_or_dir) // create new textfile 
    490                 { 
     443                        header('Location:' . $this->encode_href('index.php?menuaction=filemanager.uifilemanager.index', '&path=' . base64_encode($this->bo->homedir))); 
     444                } elseif ($this->newfile_x && $this->newfile_or_dir) { // create new textfile 
    491445                        $this->createfile(); 
    492                 } 
    493                 elseif($this->edit_cancel_x) 
    494                 { 
     446                } elseif ($this->edit_cancel_x) { 
    495447                        $this->readFilesInfo(); 
    496448                        $this->fileListing(); 
    497                 } 
    498                 elseif($this->edit_x || $this->edit_preview_x || $this->edit_save_x || $this->edit_save_done_x) 
    499                 { 
     449                } elseif ($this->edit_x || $this->edit_preview_x || $this->edit_save_x || $this->edit_save_done_x) { 
    500450                        $this->edit(); 
    501                 } 
    502                 else 
    503                 { 
     451                } else { 
    504452                        //$this->readFilesInfo(); 
    505453                        $this->fileListing(); 
    506454                } 
    507455        } 
    508         function get_permissions(){ 
     456 
     457        function get_permissions() { 
    509458                /* get permissions */ 
    510                 if((preg_match('+^'.$this->bo->fakebase.'\/(.*)(\/|$)+U', $this->path, $matches)) && $matches[1] != $this->bo->userinfo['account_lid']) //FIXME matches not defined 
    511  
    512                 { 
    513                         $this->bo->vfs->working_id = $GLOBALS['phpgw']->accounts->name2id($matches[1]);//FIXME matches not defined 
    514  
    515                 } 
    516                 else 
    517                 { 
     459                if ((preg_match('+^' . $this->bo->fakebase . '\/(.*)(\/|$)+U', $this->path, $matches)) && $matches[1] != $this->bo->userinfo['account_lid']) { //FIXME matches not defined 
     460                        $this->bo->vfs->working_id = $GLOBALS['phpgw']->accounts->name2id($matches[1]); //FIXME matches not defined 
     461                } else { 
    518462                        $this->bo->vfs->working_id = $this->bo->userinfo['username']; 
    519463                } 
    520464 
    521465                # Check available permissions for $this->path, so we can disable unusable operations in user interface 
    522                 $path = explode('/',$this->path); 
    523                 $owner_id = $this->bo->vfs->ownerOf($this->bo->fakebase,$path[2]); 
     466                $path = explode('/', $this->path); 
     467                $owner_id = $this->bo->vfs->ownerOf($this->bo->fakebase, $path[2]); 
    524468                $user_id = $GLOBALS['phpgw_info']['user']['account_id']; 
    525                 if ($owner_id == $user_id) 
    526                 { 
     469                if ($owner_id == $user_id) { 
    527470                        $rights = 31; 
    528                 }else 
    529                 { 
    530                         $acl = CreateObject ('phpgwapi.acl', $owner_id); 
     471                } else { 
     472                        $acl = CreateObject('phpgwapi.acl', $owner_id); 
    531473                        $acl->account_id = $owner_id; 
    532474                        $acl->read_repository(); 
    533475                        $rights = $acl->get_rights($user_id); 
    534476                } 
    535                 return $rights;  
    536         } 
    537         function dir_ls() 
    538         { 
     477                return $rights; 
     478        } 
     479 
     480        function dir_ls() { 
    539481                // change dir to this->path 
    540482                $this->bo->vfs->cd(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    541483                $return['permissions'] = $this->get_permissions(); 
    542484                $return['quota']['usedSpace'] = $this->bo->vfs->get_size(array( 
    543                                 'string'        => $this->path, 
    544                                 'relatives'    => array(RELATIVE_NONE) 
    545                 )); 
     485                                                'string' => $this->path, 
     486                                                'relatives' => array(RELATIVE_NONE) 
     487                                  )); 
    546488                $return['files_count'] = $this->bo->vfs->count_files(array( 
    547                                 'string'        => $this->path, 
    548                 )); 
     489                                                'string' => $this->path, 
     490                                  )); 
    549491                $quota = $this->bo->vfs->get_quota(array( 
    550                         'string'        => $this->path 
    551                 )); 
     492                                                'string' => $this->path 
     493                                  )); 
    552494                reset($this->files_array); 
    553495                $this->readFilesInfo(); 
    554496 
    555                 for($i = 0; $i != $this->numoffiles; $i++) 
    556                 { 
     497                for ($i = 0; $i != $this->numoffiles; $i++) { 
    557498                        $files = $this->files_array[$i]; 
    558499 
    559                         if($files['mime_type'] == "Directory") 
    560                         { 
     500                        if ($files['mime_type'] == "Directory") { 
    561501                                continue; 
    562502                        } 
    563503                        /* small keys to safe bandwidth */ 
    564504                        $tuple['name'] = htmlentities($files['name']); 
    565                         if ($_SESSION['phpgw_info']['user']['preferences']['filemanager']['viewIcons'] == 1){ 
    566                                 if ($files['mime_type'] == 'image/png' ||  
    567                                         $files['mime_type'] == 'image/gif' ||  
    568                                         $files['mime_type'] == 'image/jpg') 
    569                                 { 
    570                                         $filename = str_replace('=','',base64_encode($tuple['name'])); 
    571                                         $pathname = str_replace('=','',base64_encode($this->path)); 
    572                                         $tuple['icon'] = './index.php?menuaction=filemanager.vfs_functions.summary&file='.$filename.'&path='.$pathname; 
     505                        if ($_SESSION['phpgw_info']['user']['preferences']['filemanager']['viewIcons'] == 1) { 
     506                                if ($files['mime_type'] == 'image/png' || 
     507                                                  $files['mime_type'] == 'image/gif' || 
     508                                                  $files['mime_type'] == 'image/jpg') { 
     509                                        $filename = str_replace('=', '', base64_encode($tuple['name'])); 
     510                                        $pathname = str_replace('=', '', base64_encode($this->path)); 
     511                                        $tuple['icon'] = './index.php?menuaction=filemanager.vfs_functions.summary&file=' . $filename . '&path=' . $pathname; 
    573512                                } 
    574513                                else 
    575                                         $tuple['icon'] =  $this->mime_icon($files['mime_type'],64); 
     514                                        $tuple['icon'] = $this->mime_icon($files['mime_type'], 64); 
    576515                        } 
    577516                        else 
     
    584523                        $tuple['pub'] = $files['type']; 
    585524                        $tuple['createdby_id'] = $GLOBALS['phpgw']->accounts->id2name($files['createdby_id']); 
    586                         $tuple['modifiedby_id'] = $files['modifiedby_id']?$GLOBALS['phpgw']->accounts->id2name($files['modifiedby_id']):''; 
     525                        $tuple['modifiedby_id'] = $files['modifiedby_id'] ? $GLOBALS['phpgw']->accounts->id2name($files['modifiedby_id']) : ''; 
    587526                        $tuple['owner'] = $GLOBALS['phpgw']->accounts->id2name($files['owner_id']); 
    588527                        $tuple['comment'] = $files['comment']; 
    589528                        $tuple['version'] = $files['version']; 
    590529                        $output[] = $tuple; 
    591  
    592530                } 
    593531                $return['files'] = $output; 
    594                 $return['quota']['quotaSize'] = ($quota*1024*1024); 
     532                $return['quota']['quotaSize'] = ($quota * 1024 * 1024); 
    595533                echo serialize($return); 
    596534        } 
    597         function get_folders_list() 
    598         { 
    599                 $this->update_groups();  
     535 
     536        function get_folders_list() { 
     537                $this->update_groups(); 
    600538                $this->groups_applications = array(); 
    601539 
    602540                $user_groups = $GLOBALS['phpgw']->accounts->membership(); 
    603                 foreach($user_groups as $val){ 
     541                foreach ($user_groups as $val) { 
    604542                        $account_name = $GLOBALS['phpgw']->accounts->id2name($val['account_id']); 
    605543                        $this->readable_groups[$account_name] = array( 
    606                                 'account_id' => $val['account_id'], 
    607                                 'account_name' => $account_name 
     544                                 'account_id' => $val['account_id'], 
     545                                 'account_name' => $account_name 
    608546                        ); 
    609547                } 
    610548 
    611                 foreach ($this->readable_groups as $value) 
    612                 { 
     549                foreach ($this->readable_groups as $value) { 
    613550                        $applications = CreateObject('phpgwapi.applications', $value['account_id']); 
    614551                        $this->groups_applications[$value['account_name']] = $applications->read_account_specific(); 
     
    618555                // selectbox for change/move/and copy to 
    619556                $this->dirs = $this->all_other_directories(); 
    620                 foreach($this->dirs as $dir) 
     557                foreach ($this->dirs as $dir) 
    621558                        $return[] = $dir['directory'] . $dir['name']; 
    622559                sort(&$return, SORT_STRING); 
    623560                echo serialize($return); 
    624561        } 
    625         function fileListing() 
    626         { 
     562 
     563        function fileListing() { 
    627564                $this->t->set_file(array('filemanager_list_t' => 'main.tpl')); 
    628                 $this->t->set_block('filemanager_list_t','filemanager_header','filemanager_header'); 
    629                 $this->t->set_block('filemanager_list_t','filemanager_footer','filemanager_footer'); 
    630  
    631                 if($this->numoffiles || $this->cwd) 
    632                 { 
    633                         $vars[path]='<input type="hidden" id="currentPath" value="'.$this->path.'">'; 
    634                         $vars[css]='<link rel="stylesheet" type="text/css" href="filemanager/templates/default/main.css">'; 
     565                $this->t->set_block('filemanager_list_t', 'filemanager_header', 'filemanager_header'); 
     566                $this->t->set_block('filemanager_list_t', 'filemanager_footer', 'filemanager_footer'); 
     567 
     568                if ($this->numoffiles || $this->cwd) { 
     569                        $vars[path] = '<input type="hidden" id="currentPath" value="' . $this->path . '">'; 
     570                        $vars[css] = '<link rel="stylesheet" type="text/css" href="filemanager/templates/default/main.css">'; 
    635571                        $vars[css].='<link rel="stylesheet" type="text/css" href="phpgwapi/js/dftree/dftree.css">'; 
    636572                        $_SESSION['phpgw_info']['user']['preferences']['filemanager']['lid'] = $GLOBALS['phpgw_info']['user']['account_lid']; 
    637                         $vars[preferences]='<input type="hidden" id="userPreferences" value=\''.serialize($_SESSION['phpgw_info']['user']['preferences']['filemanager']).'\'>'; 
     573                        $vars[preferences] = '<input type="hidden" id="userPreferences" value=\'' . serialize($_SESSION['phpgw_info']['user']['preferences']['filemanager']) . '\'>'; 
    638574                        // Used for important operations that needs security 
    639                         for ($key = ""; strlen($key) < 150; $key .= chr(rand(48,95))); 
     575                        for ($key = ""; strlen($key) < 150; $key .= chr(rand(48, 95))) 
     576                                ; 
    640577                        $_SESSION['phpgw_info']['filemanager']['user']['sec_key'] = $key; 
    641                         $vars[sec_key]='<input type="hidden" id="userKey" value=\''.$key.'\'>'; 
    642                         $vars[script]='<script>initDrawApi();</script>'; 
    643                          
    644                         $vars[new_button]=$this->toolButton('new','createfile',lang('New...')); 
     578                        $vars[sec_key] = '<input type="hidden" id="userKey" value=\'' . $key . '\'>'; 
     579                        $vars[script] = '<script>initDrawApi();</script>'; 
     580 
     581                        $vars[new_button] = $this->toolButton('new', 'createfile', lang('New...')); 
    645582                        $vars[new_button].='<input type="hidden" id="newfile_or_dir" name="newfile_or_dir" value="" />'; 
    646                          
     583 
    647584                        // reload button with this url 
    648                         $vars[refresh_button]=$this->toolButton('reload','reload',lang('reload')); 
     585                        $vars[refresh_button] = $this->toolButton('reload', 'reload', lang('reload')); 
    649586 
    650587                        // go up icon when we're not at the top, dont allow to go outside /home = fakebase 
    651                         if($this->path != '/' && $this->path != $this->bo->fakebase) 
    652                         { 
    653                                 $vars[tools_button] = $this->toolButton('tools','tools',lang('tools')); 
     588                        if ($this->path != '/' && $this->path != $this->bo->fakebase) { 
     589                                $vars[tools_button] = $this->toolButton('tools', 'tools', lang('tools')); 
    654590                        } 
    655591                        else 
    656592                                $vars[tools_button] = ""; 
    657593 
    658                         $vars[toolbar1]=$toolbar; 
    659  
    660                         if(count($this->messages)>0)  
    661                         { 
    662                                 foreach($this->messages as $msg) 
    663                                 { 
    664                                         $messages.='<span>'.$msg.'</span>'; 
     594                        $vars[toolbar1] = $toolbar; 
     595 
     596                        if (count($this->messages) > 0) { 
     597                                foreach ($this->messages as $msg) { 
     598                                        $messages.='<span>' . $msg . '</span>'; 
    665599                                } 
    666600                        } 
    667601                        $this->messages = NULL; 
    668                          
    669                         $vars[messages]=$messages; 
     602 
     603                        $vars[messages] = $messages; 
    670604 
    671605                        $this->t->set_var($vars); 
    672                         $this->t->pparse('out','filemanager_header'); 
     606                        $this->t->pparse('out', 'filemanager_header'); 
    673607                } 
    674608 
    675609                $this->t->set_var($vars); 
    676                 $this->t->pparse('out','filemanager_footer'); 
     610                $this->t->pparse('out', 'filemanager_footer'); 
    677611 
    678612                $GLOBALS['phpgw']->common->phpgw_footer(); 
     
    680614        } 
    681615 
    682         function readFilesInfo() 
    683         { 
     616        function readFilesInfo() { 
    684617                // start files info 
    685  
    686618                # Read in file info from database to use in the rest of the script 
    687619                # $fakebase is a special directory.  In that directory, we list the user's 
    688620                # home directory and the directories for the groups they're in 
    689621                $this->numoffiles = 0; 
    690                 if($this->path == $this->bo->fakebase) 
    691                 { 
     622                if ($this->path == $this->bo->fakebase) { 
    692623                        // FIXME this test can be removed 
    693                         if(!$this->bo->vfs->file_exists(array('string' => $this->bo->homedir, 'relatives' => array(RELATIVE_NONE)))) 
    694                         { 
     624                        if (!$this->bo->vfs->file_exists(array('string' => $this->bo->homedir, 'relatives' => array(RELATIVE_NONE)))) { 
    695625                                $this->bo->vfs->mkdir(array('string' => $this->bo->homedir, 'relatives' => array(RELATIVE_NONE))); 
    696626                        } 
    697627 
    698628                        $ls_array = $this->bo->vfs->ls(array( 
    699                                 'string' => $this->bo->homedir, 
    700                                 'relatives' => array(RELATIVE_NONE), 
    701                                 'checksubdirs' => False, 
    702                                 'nofiles' => True 
    703                         )); 
     629                                                        'string' => $this->bo->homedir, 
     630                                                        'relatives' => array(RELATIVE_NONE), 
     631                                                        'checksubdirs' => False, 
     632                                                        'nofiles' => True 
     633                                          )); 
    704634 
    705635                        $this->files_array[] = $ls_array[0]; 
     
    707637 
    708638                        reset($this->readable_groups); 
    709                         while(list($num, $group_array) = each($this->readable_groups)) 
    710                         { 
     639                        while (list($num, $group_array) = each($this->readable_groups)) { 
    711640                                # If the group doesn't have access to this app, we don't show it 
    712                                 /*if(!$this->groups_applications[$group_array['account_name']][$this->bo->appname]['enabled']) 
    713                                 { 
    714                                         continue; 
    715                                 } 
    716                                 */ 
    717  
    718  
    719                                 if(!$this->bo->vfs->file_exists(array('string' => $this->bo->fakebase.'/'.$group_array['account_name'],'relatives'      => array(RELATIVE_NONE)))) 
    720                                 { 
     641                                /* if(!$this->groups_applications[$group_array['account_name']][$this->bo->appname]['enabled']) 
     642                                  { 
     643                                  continue; 
     644                                  } 
     645                                 */ 
     646 
     647 
     648                                if (!$this->bo->vfs->file_exists(array('string' => $this->bo->fakebase . '/' . $group_array['account_name'], 'relatives' => array(RELATIVE_NONE)))) { 
    721649                                        $this->bo->vfs->override_acl = 1; 
    722650                                        $this->bo->vfs->mkdir(array( 
    723                                                 'string' => $this->bo->fakebase.'/'.$group_array['account_name'], 
    724                                                 'relatives' => array(RELATIVE_NONE) 
     651                                                 'string' => $this->bo->fakebase . '/' . $group_array['account_name'], 
     652                                                 'relatives' => array(RELATIVE_NONE) 
    725653                                        )); 
    726654 
    727655                                        // FIXME we just created a fresh group dir so we know there nothing in it so we have to remove all existing content 
    728                                          
    729                                          
     656 
     657 
    730658                                        $this->bo->vfs->override_acl = 0; 
    731659 
    732                                         $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']))); 
     660                                        $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']))); 
    733661                                } 
    734662 
    735                                 $ls_array = $this->bo->vfs->ls(array('string' => $this->bo->fakebase.'/'.$group_array['account_name'],'relatives'       => array(RELATIVE_NONE),'checksubdirs' => False,'nofiles' => True)); 
     663                                $ls_array = $this->bo->vfs->ls(array('string' => $this->bo->fakebase . '/' . $group_array['account_name'], 'relatives' => array(RELATIVE_NONE), 'checksubdirs' => False, 'nofiles' => True)); 
    736664 
    737665                                $this->files_array[] = $ls_array[0]; 
     
    739667                                $this->numoffiles++; 
    740668                        } 
    741                 } 
    742                 else 
    743                 { 
     669                } else { 
    744670                        $ls_array = $this->bo->vfs->ls(array( 
    745                                 'string' => $this->path, 
    746                                 'relatives'     => array(RELATIVE_NONE), 
    747                                 'checksubdirs' => False, 
    748                                 'nofiles'       => False, 
    749                                 'orderby'       => $this->criteria, 
    750                                 'otype'         => $this->otype, 
    751                                 'limit'         => $this->limit, 
    752                                 'offset'        => $this->offset 
    753                         )); 
    754  
    755                         while(list($num, $file_array) = each($ls_array)) 
    756                         { 
     671                                                        'string' => $this->path, 
     672                                                        'relatives' => array(RELATIVE_NONE), 
     673                                                        'checksubdirs' => False, 
     674                                                        'nofiles' => False, 
     675                                                        'orderby' => $this->criteria, 
     676                                                        'otype' => $this->otype, 
     677                                                        'limit' => $this->limit, 
     678                                                        'offset' => $this->offset 
     679                                          )); 
     680 
     681                        while (list($num, $file_array) = each($ls_array)) { 
    757682                                $this->numoffiles++; 
    758683                                $this->files_array[] = $file_array; 
     
    760685                } 
    761686 
    762                 if(!is_array($this->files_array)) 
    763                 { 
     687                if (!is_array($this->files_array)) { 
    764688                        $this->files_array = array(); 
    765689                } 
    766690                // end file count 
    767691        } 
    768          
    769         function removedir() 
    770         { 
     692 
     693        function removedir() { 
    771694                //$toRemove = $this->path ^ $_SESSION['phpgw_info']['filemanager']['user']['sec_key']; 
    772695                $toRemove = $this->path; 
    773                  
    774                 if ( $this->bo->vfs->rm(array( 'string' => $toRemove, 'relatives' => array (RELATIVE_NONE) )) ) 
     696 
     697                if ($this->bo->vfs->rm(array('string' => $toRemove, 'relatives' => array(RELATIVE_NONE)))) 
    775698                        echo "True"; 
    776699                else 
    777700                        echo "False"; 
    778701        } 
    779          
    780         function createdir() 
    781         { 
    782                 if( $this->bo->badchar = $this->bo->bad_chars($this->filename, True, True) ) 
    783                 { 
    784                         echo lang('Error:').$this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1); 
     702 
     703        function createdir() { 
     704                if ($this->bo->badchar = $this->bo->bad_chars($this->filename, True, True)) { 
     705                        echo lang('Error:') . $this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1); 
    785706                        return; 
    786707                } 
    787708                /* TODO is this right or should it be a single $ ? */ 
    788                 if($this->filename[strlen($this->filename)-1] == ' ' || $this->filename[0] == ' ') 
    789                 { 
    790                         echo lang('Error:').lang('Cannot create directory because it begins or ends in a space'); 
    791                 } 
    792                  
     709                if ($this->filename[strlen($this->filename) - 1] == ' ' || $this->filename[0] == ' ') { 
     710                        echo lang('Error:') . lang('Cannot create directory because it begins or ends in a space'); 
     711                } 
     712 
    793713                $ls_array = $this->bo->vfs->ls(array( 
    794                         'string'        => $this->path . '/' . $this->filename, 
    795                         'relatives'     => array(RELATIVE_NONE), 
    796                         'checksubdirs'  => False, 
    797                         'nofiles'       => True 
    798                 )); 
     714                                                'string' => $this->path . '/' . $this->filename, 
     715                                                'relatives' => array(RELATIVE_NONE), 
     716                                                'checksubdirs' => False, 
     717                                                'nofiles' => True 
     718                                  )); 
    799719 
    800720                $fileinfo = $ls_array[0]; 
    801721 
    802                 if($fileinfo['name']) 
    803                 { 
    804                         if($fileinfo['mime_type'] != 'Directory') 
    805                         { 
    806                                 echo lang('Error:').lang('%1 already exists as a file',$fileinfo['name']); 
    807                         } 
    808                         else 
    809                         { 
    810                                 echo lang('Error:').lang('Directory %1 already exists', $fileinfo['name']); 
    811                         } 
    812                 } 
    813                 else 
    814                 { 
     722                if ($fileinfo['name']) { 
     723                        if ($fileinfo['mime_type'] != 'Directory') { 
     724                                echo lang('Error:') . lang('%1 already exists as a file', $fileinfo['name']); 
     725                        } else { 
     726                                echo lang('Error:') . lang('Directory %1 already exists', $fileinfo['name']); 
     727                        } 
     728                } else { 
    815729                        $this->bo->vfs->cd(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    816                          
    817                         if( $this->bo->vfs->mkdir(array('string' => $this->filename )) ) 
    818                         { 
    819                                 echo lang('Created directory %1', $this->disppath.'/'.$this->filename); 
    820                         } 
    821                         else 
    822                         { 
    823                                 echo lang('Error:').lang('Could not create %1', $this->disppath.'/'.$this->filename); 
     730 
     731                        if ($this->bo->vfs->mkdir(array('string' => $this->filename))) { 
     732                                echo lang('Created directory %1', $this->disppath . '/' . $this->filename); 
     733                        } else { 
     734                                echo lang('Error:') . lang('Could not create %1', $this->disppath . '/' . $this->filename); 
    824735                        } 
    825736                } 
    826737                echo lang('Directory created'); 
    827738        } 
    828          
    829         function getReturnExecuteForm() 
    830         { 
     739 
     740        function getReturnExecuteForm() { 
    831741                $response = $_SESSION['response']; 
    832                  
     742 
    833743                unset($_SESSION['response']); 
    834                  
     744 
    835745                echo $response; 
    836746        } 
    837          
     747 
    838748        function showUploadboxes() 
    839749        { 
    840750                $notify = CreateObject('filemanager.notifications'); 
    841                  
     751 
    842752                $var = array( 
    843                                         'change_upload_boxes'   => lang('Show'),                                 
    844                                         'form_action'                   => $GLOBALS[phpgw]->link('/filemanager/inc/upload.php'), 
    845                                         'emails_to'                             => $notify->EmailsToSend($GLOBALS['phpgw']->preferences->values['email']), 
    846                                         'lang_file'                             => lang('File'), 
    847                                         'lang_comment'                  => lang('Comment'), 
    848                                         'lang_advanced_upload'  => lang('Advanced Upload'), 
    849                                         'lang_upload'                   => lang('Upload files'), 
    850                                         'max_size'                              => lang('Note: Uploaded is limited to %1MB',( $this->current_config['filemanager_Max_file_size'])),                              
    851                                         'path'                                  => $this->path 
     753                         'change_upload_boxes'  => lang('Show'), 
     754                         'form_action'                  => $GLOBALS[phpgw]->link('/filemanager/inc/upload.php'), 
     755                         'emails_to'                            => $notify->EmailsToSend($GLOBALS['phpgw']->preferences->values['email']), 
     756                         'lang_file'                            => lang('File(s)'), 
     757                         'lang_comment'                 => lang('Comment(s)'), 
     758                         'lang_advanced_upload' => lang('Advanced Upload'), 
     759                         'lang_upload'                  => lang('Upload files'), 
     760                         'max_size'                             => lang('The maximum size for each file is %1MB', ($this->current_config['filemanager_Max_file_size'])), 
     761                         'path'                                 => $this->path 
    852762                ); 
    853                  
    854                 print( serialize($var) ); 
    855                  
     763 
     764                print( serialize($var)); 
    856765        } 
    857766 
    858767        /* create textfile */ 
    859         function createfile() 
     768        function createfile()  
    860769        { 
    861                 $this->filename=$this->newfile_or_dir; 
    862                 if($this->filename) 
    863                 { 
    864                         if($badchar = $this->bo->bad_chars($this->filename, True, True)) 
    865                         { 
    866                                 $this->messages[] = lang('Error:').lang('File names cannot contain "%1"',$badchar); 
     770                $this->filename = $this->newfile_or_dir; 
     771                if ($this->filename) { 
     772                        if ($badchar = $this->bo->bad_chars($this->filename, True, True)) { 
     773                                $this->messages[] = lang('Error:') . lang('File names cannot contain "%1"', $badchar); 
    867774 
    868775                                $this->fileListing(); 
    869776                        } 
    870777 
    871                         if($this->bo->vfs->file_exists(array( 
    872                                 'string'=> $this->filename, 
    873                                 'relatives'     => array(RELATIVE_ALL) 
    874                         ))) 
    875                         { 
    876                                 $this->messages[]= lang('Error:').lang('File %1 already exists. Please edit it or delete it first.', $this->filename); 
     778                        if ($this->bo->vfs->file_exists(array( 
     779                                                        'string' => $this->filename, 
     780                                                        'relatives' => array(RELATIVE_ALL) 
     781                                          ))) { 
     782                                $this->messages[] = lang('Error:') . lang('File %1 already exists. Please edit it or delete it first.', $this->filename); 
    877783                                $this->fileListing(); 
    878784                        } 
    879785 
    880                         if($this->bo->vfs->touch(array( 
    881                                 'string'        => $this->filename, 
    882                                 'relatives'     => array(RELATIVE_ALL) 
    883                         ))) 
    884                         { 
     786                        if ($this->bo->vfs->touch(array( 
     787                                                        'string' => $this->filename, 
     788                                                        'relatives' => array(RELATIVE_ALL) 
     789                                          ))) { 
    885790                                $this->edit = 1; 
    886791                                $this->numoffiles++; 
    887792                                $this->edit(); 
    888                         } 
    889                         else 
    890                         { 
    891                                 $this->messages[]= lang('Error:').lang('File %1 could not be created.', $this->filename); 
     793                        } else { 
     794                                $this->messages[] = lang('Error:') . lang('File %1 could not be created.', $this->filename); 
    892795                                $this->fileListing(); 
    893796                        } 
     
    896799 
    897800        # Handle Editing files 
    898         function edit() 
    899         { 
    900                 if($this->filename) 
    901                 { 
    902                         if (! $this->vfs_functions->verifyLock($this->path.'/'.$this->filename,RELATIVE_NONE)){ 
     801 
     802        function edit() { 
     803                if ($this->filename) { 
     804                        if (!$this->vfs_functions->verifyLock($this->path . '/' . $this->filename, RELATIVE_NONE)) { 
    903805                                $GLOBALS['phpgw']->redirect('/index.php'); 
    904806                        } 
    905807                        $ls_array = $this->bo->vfs->ls(array( 
    906                                 'string'        => $this->path.'/'.$this->filename, 
    907                                 'relatives'     => array(RELATIVE_NONE), 
    908                                 'checksubdirs'  => False, 
    909                                 'nofiles'       => True 
     808                                                        'string' => $this->path . '/' . $this->filename, 
     809                                                        'relatives' => array(RELATIVE_NONE), 
     810                                                        'checksubdirs' => False, 
     811                                                        'nofiles' => True 
     812                                          )); 
     813                        $this->bo->vfs->touch(array( 
     814                                 'string' => $this->path . '/' . $this->filename, 
     815                                 'relatives' => array(RELATIVE_NONE) 
    910816                        )); 
    911                         $this->bo->vfs->touch(array( 
    912                                 'string'=> $this->path.'/'.$this->filename, 
    913                                 'relatives'     => array(RELATIVE_NONE) 
    914                         )); 
    915  
    916  
    917                         if($ls_array[0]['mime_type']) 
    918                         { 
     817 
     818 
     819                        if ($ls_array[0]['mime_type']) { 
    919820                                $mime_type = $ls_array[0]['mime_type']; 
    920                         } 
    921                         elseif($this->prefs['viewtextplain']) 
    922                         { 
     821                        } elseif ($this->prefs['viewtextplain']) { 
    923822                                $mime_type = 'text/plain'; 
    924823                        } 
    925                         $editable = array('','text/plain','text/csv','text/html','text/text','message/rfc822'); 
    926  
    927                         if(!in_array($mime_type,$editable)){ 
    928                                 $this->messages[] = lang('Error:').lang('Impossible to edit this file'); 
     824                        $editable = array('', 'text/plain', 'text/csv', 'text/html', 'text/text', 'message/rfc822'); 
     825 
     826                        if (!in_array($mime_type, $editable)) { 
     827                                $this->messages[] = lang('Error:') . lang('Impossible to edit this file'); 
    929828                                $this->readFilesInfo(); 
    930829                                $this->fileListing(); 
     
    940839                        $this->t->set_file(array('filemanager_edit' => 'edit_file.tpl')); 
    941840 
    942                 $this->t->set_block('filemanager_edit','row','row'); 
     841                $this->t->set_block('filemanager_edit', 'row', 'row'); 
    943842 
    944843 
    945844                $vars[refresh_script] = "<script src='filemanager/js/refresh.js'></script>"; 
    946845 
    947                 $vars[preview_content]=''; 
    948                 if($this->edit_file) 
    949                 { 
     846                $vars[preview_content] = ''; 
     847                if ($this->edit_file) { 
    950848                        $this->edit_file_content = stripslashes($this->edit_file_content); 
    951849                } 
    952850 
    953                 if($this->edit_preview_x) 
    954                 { 
     851                if ($this->edit_preview_x) { 
    955852                        $content = $this->edit_file_content; 
    956853 
    957                         $vars[lang_preview_of]=lang('Preview of %1', $this->path.'/'.$edit_file); 
    958  
    959                         $vars[preview_content]=nl2br($content); 
    960                 } 
    961                 elseif($this->edit_save_x || $this->edit_save_done_x) 
    962                 { 
     854                        $vars[lang_preview_of] = lang('Preview of %1', $this->path . '/' . $edit_file); 
     855 
     856                        $vars[preview_content] = nl2br($content); 
     857                } elseif ($this->edit_save_x || $this->edit_save_done_x) { 
    963858                        $content = $this->edit_file_content; 
    964859                        //die( $content); 
    965                         if($this->bo->vfs->write(array( 
    966                                 'string'        => $this->path.'/'.$this->edit_file, 
    967                                 'relatives'     => array(RELATIVE_NONE), 
    968                                 'content'       => $content 
    969                         ))) 
    970                         { 
    971                                 $this->messages[]=lang('Saved %1', $this->path.'/'.$this->edit_file); 
    972  
    973                                 if($this->edit_save_done_x) 
    974                                 { 
     860                        if ($this->bo->vfs->write(array( 
     861                                                        'string' => $this->path . '/' . $this->edit_file, 
     862                                                        'relatives' => array(RELATIVE_NONE), 
     863                                                        'content' => $content 
     864                                          ))) { 
     865                                $this->messages[] = lang('Saved %1', $this->path . '/' . $this->edit_file); 
     866 
     867                                if ($this->edit_save_done_x) { 
    975868                                        $this->readFilesInfo(); 
    976869                                        $this->fileListing(); 
    977870                                        exit; 
    978871                                } 
    979                         } 
    980                         else 
    981                         { 
    982                                 $this->messages[]=lang('Could not save %1', $this->path.'/'.$this->edit_file); 
     872                        } else { 
     873                                $this->messages[] = lang('Could not save %1', $this->path . '/' . $this->edit_file); 
    983874                        } 
    984875                } 
     
    986877                # If we're in preview or save mode, we only show the file 
    987878                # being previewed or saved 
    988                 if($this->edit_file &&($this->filename != $this->edit_file)) 
    989                 { 
     879                if ($this->edit_file && ($this->filename != $this->edit_file)) { 
    990880                        continue; 
    991881                } 
    992882 
    993                 if($this->filename && $this->bo->vfs->file_exists(array( 
    994                         'string'        => $this->filename, 
    995                         'relatives'     => array(RELATIVE_ALL) 
    996                 ))) 
    997                 { 
    998                         if($this->edit_file) 
    999                         { 
     883                if ($this->filename && $this->bo->vfs->file_exists(array( 
     884                                                'string' => $this->filename, 
     885                                                'relatives' => array(RELATIVE_ALL) 
     886                                  ))) { 
     887                        if ($this->edit_file) { 
    1000888                                $content = stripslashes($this->edit_file_content); 
    1001                         } 
    1002                         else 
    1003                         { 
     889                        } else { 
    1004890                                $content = $this->bo->vfs->read(array('string' => $this->filename)); 
    1005891                        } 
    1006                         $vars[form_action]= $GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path); 
    1007                         $vars[edit_file]=$this->filename; 
     892                        $vars[form_action] = $GLOBALS['phpgw']->link('/index.php', 'menuaction=filemanager.uifilemanager.index', 'path=' . $this->path); 
     893                        $vars[edit_file] = $this->filename; 
    1008894                        # We need to include all of the fileman entries for each file's form, 
    1009895                        # so we loop through again 
    1010                         for($i = 0; $i != $this->numoffiles; $i++) 
    1011                         { 
    1012                                 if($this->filename) $value='value="'.$this->filename.'"'; 
    1013                                 $vars[filemans_hidden]='<input type="hidden" name="filename" '.$value.' />'; 
    1014                         } 
    1015                         $vars[file_content]=$content; 
    1016  
    1017                         $vars[buttonPreview]=$this->inputButton('edit_preview','edit_preview',lang('Preview %1', $this->bo->html_encode($this->fileman[0], 1))); 
    1018                         $vars[buttonSave]=$this->inputButton('edit_save','save',lang('Save %1', $this->bo->html_encode($this->filename, 1))); 
    1019                         $vars[buttonDone]=$this->inputButton('edit_save_done','ok',lang('Save %1, and go back to file listing ', $this->bo->html_encode($this->filename, 1))); 
    1020                         $vars[buttonCancel]=$this->inputButton('edit_cancel','cancel',lang('Cancel editing %1 without saving', $this->bo->html_encode($this->filename, 1))); 
    1021  
    1022                         if ($mime_type == 'text/html'){ 
     896                        for ($i = 0; $i != $this->numoffiles; $i++) { 
     897                                if ($this->filename) 
     898                                        $value = 'value="' . $this->filename . '"'; 
     899                                $vars[filemans_hidden] = '<input type="hidden" name="filename" ' . $value . ' />'; 
     900                        } 
     901                        $vars[file_content] = $content; 
     902 
     903                        $vars[buttonPreview] = $this->inputButton('edit_preview', 'edit_preview', lang('Preview %1', $this->bo->html_encode($this->fileman[0], 1))); 
     904                        $vars[buttonSave] = $this->inputButton('edit_save', 'save', lang('Save %1', $this->bo->html_encode($this->filename, 1))); 
     905                        $vars[buttonDone] = $this->inputButton('edit_save_done', 'ok', lang('Save %1, and go back to file listing ', $this->bo->html_encode($this->filename, 1))); 
     906                        $vars[buttonCancel] = $this->inputButton('edit_cancel', 'cancel', lang('Cancel editing %1 without saving', $this->bo->html_encode($this->filename, 1))); 
     907 
     908                        if ($mime_type == 'text/html') { 
    1023909                                $vars[fck_edit] = '<script type="text/javascript" src="filemanager/tp/ckeditor/ckeditor.js"></script> 
    1024                                         <textarea cols="80" id="edit_file_content" name="edit_file_content" rows="10">'.$content.'</textarea> 
     910                                        <textarea cols="80" id="edit_file_content" name="edit_file_content" rows="10">' . $content . '</textarea> 
    1025911                                                <script type="text/javascript"> CKEDITOR.replace( \'edit_file_content\',{ 
    1026912removePlugins : \'elementspath\', 
     
    1035921["Styles","Format","Font","FontSize"]] 
    1036922                                });</script>'; 
    1037  
    1038923                        } 
    1039924 
    1040925 
    1041926                        $this->t->set_var($vars); 
    1042                         $this->t->parse('rows','row'); 
    1043                         $this->t->pparse('out','row'); 
    1044  
    1045                 } 
    1046  
    1047         } 
    1048  
    1049         function history() 
    1050         { 
    1051                 if($this->file) // FIXME this-file is never defined 
    1052                 { 
     927                        $this->t->parse('rows', 'row'); 
     928                        $this->t->pparse('out', 'row'); 
     929                } 
     930        } 
     931 
     932        function history() { 
     933                if ($this->file) { // FIXME this-file is never defined 
    1053934                        $journal_array = $this->bo->vfs->get_journal(array( 
    1054                                 'string'        => $this->file,//FIXME 
    1055                                 'relatives'     => array(RELATIVE_ALL) 
    1056                         )); 
    1057  
    1058                         if(is_array($journal_array)) 
    1059                         { 
     935                                                        'string' => $this->file, //FIXME 
     936                                                        'relatives' => array(RELATIVE_ALL) 
     937                                          )); 
     938 
     939                        if (is_array($journal_array)) { 
    1060940                                $this->html_table_begin(); 
    1061941                                $this->html_table_row_begin(); 
     
    1074954                                $this->html_table_row_end(); 
    1075955 
    1076                                 while(list($num, $journal_entry) = each($journal_array)) 
    1077                                 { 
     956                                while (list($num, $journal_entry) = each($journal_array)) { 
    1078957                                        $this->html_table_row_begin(); 
    1079958                                        $this->html_table_col_begin(); 
     
    1081960                                        $this->html_table_col_end(); 
    1082961                                        $this->html_table_col_begin(); 
    1083                                         $this->bo->html_text($journal_entry['version'] . '&nbsp;&nbsp;&nbsp;' ); 
     962                                        $this->bo->html_text($journal_entry['version'] . '&nbsp;&nbsp;&nbsp;'); 
    1084963                                        $this->html_table_col_end(); 
    1085964                                        $this->html_table_col_begin(); 
     
    1094973                                $GLOBALS['phpgw']->common->phpgw_footer(); 
    1095974                                $GLOBALS['phpgw']->common->phpgw_exit(); 
    1096                         } 
    1097                         else 
    1098                         { 
     975                        } else { 
    1099976                                echo lang('No version history for this file/directory'); 
    1100977                        } 
    1101978                } 
    1102979        } 
    1103         function view() 
    1104         { 
     980 
     981        function view() { 
    1105982                if (!$this->bo->vfs->acl_check(array( 
    1106                         'string'        => $this->path, 
    1107                         'relatives'     => array(RELATIVE_NONE), 
    1108                         'operation'     => PHPGW_ACL_READ 
    1109                 ))) 
    1110                 { 
     983                                                'string' => $this->path, 
     984                                                'relatives' => array(RELATIVE_NONE), 
     985                                                'operation' => PHPGW_ACL_READ 
     986                                  ))) { 
    1111987                        $this->messages[] = lang("You have no permission to access this file"); 
    1112                         header('Location:'.$this->encode_href('inc/index.php?menuaction=filemanager.uifilemanager.index','&path='.base64_encode($this->bo->homedir))); 
     988                        header('Location:' . $this->encode_href('inc/index.php?menuaction=filemanager.uifilemanager.index', '&path=' . base64_encode($this->bo->homedir))); 
    1113989 
    1114990                        return; 
    1115991                } 
    1116                 if($this->file) //FIXME 
    1117                 { 
     992                if ($this->file) { //FIXME 
    1118993                        $ls_array = $this->bo->vfs->ls(array( 
    1119                                 'string'        => $this->path.'/'.$this->file,//FIXME 
    1120                                 'relatives'     => array(RELATIVE_NONE), 
    1121                                 'checksubdirs'  => False, 
    1122                                 'nofiles'       => True 
    1123                         )); 
    1124                         if($ls_array[0]['mime_type']) 
    1125                         { 
     994                                                        'string' => $this->path . '/' . $this->file, //FIXME 
     995                                                        'relatives' => array(RELATIVE_NONE), 
     996                                                        'checksubdirs' => False, 
     997                                                        'nofiles' => True 
     998                                          )); 
     999                        if ($ls_array[0]['mime_type']) { 
    11261000                                $mime_type = $ls_array[0]['mime_type']; 
    1127                         } 
    1128                         elseif($this->prefs['viewtextplain']) 
    1129                         { 
     1001                        } elseif ($this->prefs['viewtextplain']) { 
    11301002                                $mime_type = 'text/plain'; 
    11311003                        } 
    1132                         $viewable = array('text/plain','text/csv','text/html', 
    1133                                 'text/text','image/jpeg','image/png','image/gif', 
    1134                                 'audio/mpeg','video/mpeg'); 
    1135  
    1136                         if(in_array($mime_type,$viewable))  
    1137                         { 
    1138                                 /*Note: if you put application/octet-stream you force download */ 
     1004                        $viewable = array('text/plain', 'text/csv', 'text/html', 
     1005                                 'text/text', 'image/jpeg', 'image/png', 'image/gif', 
     1006                                 'audio/mpeg', 'video/mpeg'); 
     1007 
     1008                        if (in_array($mime_type, $viewable)) { 
     1009                                /* Note: if you put application/octet-stream you force download */ 
    11391010                                header('Content-type: ' . $mime_type); 
    11401011                                header('Content-disposition: filename="' . addslashes($this->file) . '"'); 
    11411012                                Header("Pragma: public"); 
    1142                         } 
    1143                         else 
    1144                         { 
    1145                                 $GLOBALS['phpgw']->browser->content_header($this->file,$mime_type,$ls_array[0]['size']); 
    1146                         } 
    1147                         if ($ls_array[0]['size'] < 10240) 
    1148                         { 
     1013                        } else { 
     1014                                $GLOBALS['phpgw']->browser->content_header($this->file, $mime_type, $ls_array[0]['size']); 
     1015                        } 
     1016                        if ($ls_array[0]['size'] < 10240) { 
    11491017                                echo $this->bo->vfs->read(array( 
    1150                                         'string'    => $this->path.'/'.$this->file,//FIXME 
    1151                                         'relatives'    => array(RELATIVE_NONE) 
     1018                                         'string' => $this->path . '/' . $this->file, //FIXME 
     1019                                         'relatives' => array(RELATIVE_NONE) 
    11521020                                )); 
    1153                         } 
    1154                         else 
    1155                         { 
     1021                        } else { 
    11561022                                $this->bo->vfs->print_content(array( 
    1157                                         'string' => $this->path.'/'.$this->file, 
    1158                                         'relatives' => array(RELATIVE_NONE) 
    1159                                 ) 
    1160                         ); 
     1023                                         'string' => $this->path . '/' . $this->file, 
     1024                                         'relatives' => array(RELATIVE_NONE) 
     1025                                                  ) 
     1026                                ); 
    11611027                        } 
    11621028                        $GLOBALS['phpgw']->common->phpgw_exit(); 
     
    11641030        } 
    11651031 
    1166         function export(){ 
    1167                 if($this->file) 
    1168                 { 
     1032        function export() { 
     1033                if ($this->file) { 
    11691034                        $ls_array = $this->bo->vfs->ls(array( 
    1170                                 'string'        => $this->path.'/'.$this->file, 
    1171                                 'relatives'    => array(RELATIVE_NONE), 
    1172                                 'checksubdirs' => False, 
    1173                                 'nofiles'      => True 
    1174                         )); 
    1175                         /*$timestamp = $this->vfs_functions->dateString2timeStamp($ls_array[0]['modified']); 
    1176                         if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']); 
    1177                         { 
    1178                                 // recently than last minute: someone is editing 
    1179                         }*/ 
     1035                                                        'string' => $this->path . '/' . $this->file, 
     1036                                                        'relatives' => array(RELATIVE_NONE), 
     1037                                                        'checksubdirs' => False, 
     1038                                                        'nofiles' => True 
     1039                                          )); 
     1040                        /* $timestamp = $this->vfs_functions->dateString2timeStamp($ls_array[0]['modified']); 
     1041                          if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']); 
     1042                          { 
     1043                          // recently than last minute: someone is editing 
     1044                          } */ 
    11801045                        $mime_type = $ls_array[0]['mime_type']; 
    11811046                        $formats = array('text/html'); 
    1182                         if(!in_array($mime_type,$formats)){ 
     1047                        if (!in_array($mime_type, $formats)) { 
    11831048                                echo lang('Impossible to export this file'); 
    11841049                                return False; 
    11851050                        } 
    1186                         $content = $this->bo->vfs->read(array('string' => $this->path.'/'.$this->file, 
    1187                                        'relatives'    => array(RELATIVE_NONE) 
    1188                                )); 
     1051                        $content = $this->bo->vfs->read(array('string' => $this->path . '/' . $this->file, 
     1052                                                        'relatives' => array(RELATIVE_NONE) 
     1053                                          )); 
    11891054 
    11901055                        include_once('filemanager/tp/dompdf/dompdf_config.inc.php'); 
     
    11921057                        $dompdf->load_html($content); 
    11931058                        $dompdf->set_paper($this->prefs['pdf_paper_type'], $this->prefs['pdf_type']); 
    1194                         /* Would be nice to implement 'Title','Subject','Author','Creator','CreationDate'*/ 
     1059                        /* Would be nice to implement 'Title','Subject','Author','Creator','CreationDate' */ 
    11951060                        $dompdf->render(); 
    1196                         $dompdf->stream(strtok($this->file,'.').".pdf"); 
     1061                        $dompdf->stream(strtok($this->file, '.') . ".pdf"); 
    11971062                        $GLOBALS['phpgw']->common->phpgw_exit(); 
    11981063                } 
     
    12001065 
    12011066        //give back an array with all directories except current and dirs that are not accessable 
    1202         function all_other_directories() 
    1203         { 
     1067        function all_other_directories() { 
    12041068                # First we get the directories in their home directory 
    12051069                $dirs = array(); 
    12061070                $dirs[] = array('directory' => $this->bo->fakebase, 'name' => $this->bo->userinfo['account_lid']); 
    12071071 
    1208                 $tmp_arr=array( 
    1209                         'string'        => $this->bo->homedir, 
    1210                         'relatives'     => array(RELATIVE_NONE), 
    1211                         'checksubdirs'  => True, 
    1212                         'mime_type'     => 'Directory' 
     1072                $tmp_arr = array( 
     1073                         'string' => $this->bo->homedir, 
     1074                         'relatives' => array(RELATIVE_NONE), 
     1075                         'checksubdirs' => True, 
     1076                         'mime_type' => 'Directory' 
    12131077                ); 
    12141078 
    1215                 $ls_array = $this->bo->vfs->ls($tmp_arr,True); 
    1216  
    1217                 while(list($num, $dir) = each($ls_array)) 
    1218                 { 
     1079                $ls_array = $this->bo->vfs->ls($tmp_arr, True); 
     1080 
     1081                while (list($num, $dir) = each($ls_array)) { 
    12191082                        $dirs[] = $dir; 
    12201083                } 
     
    12231086                # Then we get the directories in their readable groups' home directories 
    12241087                reset($this->readable_groups); 
    1225                 while(list($num, $group_array) = each($this->readable_groups)) 
    1226                 { 
     1088                while (list($num, $group_array) = each($this->readable_groups)) { 
    12271089                        // Don't list directories for groups that don't exists 
    1228                         $test=$this->bo->vfs->get_real_info(array('string' => $this->bo->fakebase.'/'.$group_array['account_name'], 
    1229                                 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    1230                         if($test[mime_type]!='Directory') 
    1231                         { 
     1090                        $test = $this->bo->vfs->get_real_info(array('string' => $this->bo->fakebase . '/' . $group_array['account_name'], 
     1091                                                        'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
     1092                        if ($test[mime_type] != 'Directory') { 
    12321093                                continue; 
    12331094                        } 
     
    12351096                        $dirs[] = array('directory' => $this->bo->fakebase, 'name' => $group_array['account_name']); 
    12361097 
    1237                         $tmp_arr=array( 
    1238                                 'string'        => $this->bo->fakebase.'/'.$group_array['account_name'], 
    1239                                 'relatives'     => array(RELATIVE_NONE), 
    1240                                 'checksubdirs'  => True, 
    1241                                 'mime_type'     => 'Directory' 
     1098                        $tmp_arr = array( 
     1099                                 'string' => $this->bo->fakebase . '/' . $group_array['account_name'], 
     1100                                 'relatives' => array(RELATIVE_NONE), 
     1101                                 'checksubdirs' => True, 
     1102                                 'mime_type' => 'Directory' 
    12421103                        ); 
    12431104 
    1244                         $ls_array = $this->bo->vfs->ls($tmp_arr,True); 
    1245                         while(list($num, $dir) = each($ls_array)) 
    1246                         { 
     1105                        $ls_array = $this->bo->vfs->ls($tmp_arr, True); 
     1106                        while (list($num, $dir) = each($ls_array)) { 
    12471107                                $dirs[] = $dir; 
    12481108                        } 
    12491109                } 
    12501110                reset($dirs); 
    1251                 while(list($num, $dir) = each($dirs)) 
    1252                 { 
    1253                         if(!$dir['directory']) 
    1254                         { 
     1111                while (list($num, $dir) = each($dirs)) { 
     1112                        if (!$dir['directory']) { 
    12551113                                continue; 
    12561114                        } 
    12571115 
    12581116                        # So we don't display // 
    1259                         if($dir['directory'] != '/') 
    1260                         { 
     1117                        if ($dir['directory'] != '/') { 
    12611118                                $dir['directory'] .= '/'; 
    12621119                        } 
     
    12661123        } 
    12671124 
    1268         function update_groups() 
    1269         { 
     1125        function update_groups() { 
    12701126                # Get their readable groups to be used throughout the script 
    12711127                $acl = array(); 
    12721128                $groups = array(); 
    1273                 $acl = $GLOBALS['phpgw']->acl->get_ids_for_location($GLOBALS['phpgw_info']['user']['account_id'],1,'filemanager'); 
     1129                $acl = $GLOBALS['phpgw']->acl->get_ids_for_location($GLOBALS['phpgw_info']['user']['account_id'], 1, 'filemanager'); 
    12741130                if (is_array($acl)) 
    1275                         foreach($acl as $key => $value){ 
     1131                        foreach ($acl as $key => $value) { 
    12761132                                $info = array(); 
    12771133                                $info = $GLOBALS['phpgw']->accounts->get_account_data($value); 
     
    12831139                        } 
    12841140                $this->readable_groups = array(); 
    1285                 while(list($num, $account) = each($groups)) 
    1286                 { 
    1287                         if($this->bo->vfs->acl_check(array('owner_id' => $account['account_id'],'operation' => PHPGW_ACL_READ))) 
    1288                         { 
     1141                while (list($num, $account) = each($groups)) { 
     1142                        if ($this->bo->vfs->acl_check(array('owner_id' => $account['account_id'], 'operation' => PHPGW_ACL_READ))) { 
    12891143                                $this->readable_groups[$account['account_lid']] = Array('account_id' => $account['account_id'], 'account_name' => $account['account_lid']); 
    12901144                        } 
    12911145                } 
    1292  
    1293         } 
    1294         function search() 
    1295         { 
     1146        } 
     1147 
     1148        function search() { 
    12961149                /* TODO this is a primitive search */ 
    12971150                $this->update_groups(); 
    1298                         $this->dirs = $this->all_other_directories(); 
     1151                $this->dirs = $this->all_other_directories(); 
    12991152                $path = $this->path; 
    1300                 if (strlen($this->text) > 3) 
    1301                 {                                                                 
     1153                if (strlen($this->text) > 3) { 
    13021154                        $this->text = strtoupper($this->text); 
    1303                         foreach($this->dirs as $elem) 
    1304                         { 
    1305                                 $this->path = $elem['directory'].$elem['name']; 
     1155                        foreach ($this->dirs as $elem) { 
     1156                                $this->path = $elem['directory'] . $elem['name']; 
    13061157                                reset($this->files_array); 
    1307                                 $this->readFilesInfo(); 
    1308                                 for($i = 0; $i < count($this->files_array); $i++) 
    1309                                 { 
     1158                                $this->readFilesInfo(); 
     1159                                for ($i = 0; $i < count($this->files_array); $i++) { 
    13101160                                        $comment = strtoupper($this->files_array[$i]['comment']); 
    13111161                                        $name = strtoupper($this->files_array[$i]['name']); 
    1312                                         if (strstr($name,$this->text) || 
    1313                                         strstr($comment,$this->text) ){ 
    1314                                                 $return[$this->files_array[$i]['directory'].$name] = $this->files_array[$i]; 
    1315                                                 $return[$this->files_array[$i]['directory'].$name]['icon'] = $this->mime_icon($this->files_array[$i]['mime_type']); 
     1162                                        if (strstr($name, $this->text) || 
     1163                                                          strstr($comment, $this->text)) { 
     1164                                                $return[$this->files_array[$i]['directory'] . $name] = $this->files_array[$i]; 
     1165                                                $return[$this->files_array[$i]['directory'] . $name]['icon'] = $this->mime_icon($this->files_array[$i]['mime_type']); 
    13161166                                        } 
    13171167                                } 
    1318                                 if (count($return) > 50) 
    1319                                 { 
    1320                                         $return = array_slice($return,0,50); 
     1168                                if (count($return) > 50) { 
     1169                                        $return = array_slice($return, 0, 50); 
    13211170                                        break; 
    13221171                                } 
    1323                         }        
     1172                        } 
    13241173                } 
    13251174                echo serialize(array_values($return)); 
     
    13271176 
    13281177        /* seek icon for mimetype else return an unknown icon */ 
    1329         function mime_icon($mime_type, $size=16) 
    1330         { 
    1331                 if(!$mime_type) $mime_type='unknown'; 
    1332  
    1333                 $mime_type=str_replace  ('/','_',$mime_type); 
    1334  
    1335                 $img=$GLOBALS['phpgw']->common->image('filemanager','mime'.$size.'_'.strtolower($mime_type)); 
    1336                 if(!$img) $img=$GLOBALS['phpgw']->common->image('filemanager','mime'.$size.'_unknown'); 
     1178 
     1179        function mime_icon($mime_type, $size=16) { 
     1180                if (!$mime_type) 
     1181                        $mime_type = 'unknown'; 
     1182 
     1183                $mime_type = str_replace('/', '_', $mime_type); 
     1184 
     1185                $img = $GLOBALS['phpgw']->common->image('filemanager', 'mime' . $size . '_' . strtolower($mime_type)); 
     1186                if (!$img) 
     1187                        $img = $GLOBALS['phpgw']->common->image('filemanager', 'mime' . $size . '_unknown'); 
    13371188 
    13381189                return $img; 
    13391190        } 
    13401191 
    1341         function toolButton($link,$img='',$description='') 
    1342         { 
    1343                 $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img)); 
    1344  
    1345                 if($img) 
    1346                 { 
    1347                         return '<div name="'.$link.'" class="toolButton" onclick="toolbar.control(\''.$link.'\',this);" title="'.$description.'"><img src="'.$image.'" alt="'.$description.'"/><small>'.$description.'</small></div>'; 
    1348                 } 
    1349         } 
    1350  
    1351         function inputButton($name,$img='',$description='') 
    1352         { 
    1353                 $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img)); 
    1354  
    1355                 if($img) 
    1356                 { 
     1192        function toolButton($link, $img='', $description='') { 
     1193                $image = $GLOBALS['phpgw']->common->image('filemanager', 'button_' . strtolower($img)); 
     1194 
     1195                if ($img) { 
     1196                        return '<div name="' . $link . '" class="toolButton" onclick="toolbar.control(\'' . $link . '\',this);" title="' . $description . '"><img src="' . $image . '" alt="' . $description . '"/><small>' . $description . '</small></div>'; 
     1197                } 
     1198        } 
     1199 
     1200        function inputButton($name, $img='', $description='') { 
     1201                $image = $GLOBALS['phpgw']->common->image('filemanager', 'button_' . strtolower($img)); 
     1202 
     1203                if ($img) { 
    13571204                        return '<td class="" align="center" valign="middle" height="28" width="70"> 
    1358                         <input title="'.$description.'" name="'.$name.'" type="image" alt="'.$name.'" src="'.$image.'" value="clicked" /><br><small>'.$description.'</small> 
     1205                        <input title="' . $description . '" name="' . $name . '" type="image" alt="' . $name . '" src="' . $image . '" value="clicked" /><br><small>' . $description . '</small> 
    13591206                        </td>'; 
    13601207                } 
    13611208        } 
    13621209 
    1363  
    1364         function html_form_input($type = NULL, $name = NULL, $value = NULL, $maxlength = NULL, $size = NULL, $checked = NULL, $string = '', $return = 1) 
    1365         { 
     1210        function html_form_input($type = NULL, $name = NULL, $value = NULL, $maxlength = NULL, $size = NULL, $checked = NULL, $string = '', $return = 1) { 
    13661211                $text = ' '; 
    1367                 if($type != NULL && $type) 
    1368                 { 
    1369                         if($type == 'checkbox') 
    1370                         { 
     1212                if ($type != NULL && $type) { 
     1213                        if ($type == 'checkbox') { 
    13711214                                $value = $this->bo->string_encode($value, 1); 
    13721215                        } 
    1373                         $text .= 'type="'.$type.'" '; 
    1374                 } 
    1375                 if($name != NULL && $name) 
    1376                 { 
    1377                         $text .= 'name="'.$name.'" '; 
    1378                 } 
    1379                 if($value != NULL && $value) 
    1380                 { 
    1381                         $text .= 'value="'.$value.'" '; 
    1382                 } 
    1383                 if(is_int($maxlength) && $maxlength >= 0) 
    1384                 { 
    1385                         $text .= 'maxlength="'.$maxlength.'" '; 
    1386                 } 
    1387                 if(is_int($size) && $size >= 0) 
    1388                 { 
    1389                         $text .= 'size="'.$size.'" '; 
    1390                 } 
    1391                 if($checked != NULL && $checked) 
    1392                 { 
     1216                        $text .= 'type="' . $type . '" '; 
     1217                } 
     1218                if ($name != NULL && $name) { 
     1219                        $text .= 'name="' . $name . '" '; 
     1220                } 
     1221                if ($value != NULL && $value) { 
     1222                        $text .= 'value="' . $value . '" '; 
     1223                } 
     1224                if (is_int($maxlength) && $maxlength >= 0) { 
     1225                        $text .= 'maxlength="' . $maxlength . '" '; 
     1226                } 
     1227                if (is_int($size) && $size >= 0) { 
     1228                        $text .= 'size="' . $size . '" '; 
     1229                } 
     1230                if ($checked != NULL && $checked) { 
    13931231                        $text .= 'checked '; 
    13941232                } 
    13951233 
    1396                 return '<input'.$text.$string.'>'; 
    1397         } 
    1398  
    1399         function html_form_option($value = NULL, $displayed = NULL, $selected = NULL, $return = 0) 
    1400         { 
     1234                return '<input' . $text . $string . '>'; 
     1235        } 
     1236 
     1237        function html_form_option($value = NULL, $displayed = NULL, $selected = NULL, $return = 0) { 
    14011238                $text = ' '; 
    1402                 if($value != NULL && $value) 
    1403                 { 
    1404                         $text .= ' value="'.$value.'" '; 
    1405                 } 
    1406                 if($selected != NULL && $selected) 
    1407                 { 
     1239                if ($value != NULL && $value) { 
     1240                        $text .= ' value="' . $value . '" '; 
     1241                } 
     1242                if ($selected != NULL && $selected) { 
    14081243                        $text .= ' selected'; 
    14091244                } 
    1410                 return  '<option'.$text.'>'.$displayed.'</option>'; 
    1411         } 
    1412  
    1413         function encode_href($href = NULL, $args = NULL , $extra_args) 
    1414         { 
     1245                return '<option' . $text . '>' . $displayed . '</option>'; 
     1246        } 
     1247 
     1248        function encode_href($href = NULL, $args = NULL, $extra_args) { 
    14151249                $href = $this->bo->string_encode($href, 1); 
    1416                 $all_args = $args.'&'.$this->bo->string_encode($extra_args, 1); 
     1250                $all_args = $args . '&' . $this->bo->string_encode($extra_args, 1); 
    14171251 
    14181252                $address = $GLOBALS['phpgw']->link($href, $all_args); 
     
    14211255        } 
    14221256 
    1423         function html_link($href = NULL, $args = NULL , $extra_args, $text = NULL, $return = 1, $encode = 1, $linkonly = 0, $target = NULL) 
    1424         { 
     1257        function html_link($href = NULL, $args = NULL, $extra_args, $text = NULL, $return = 1, $encode = 1, $linkonly = 0, $target = NULL) { 
    14251258                //      unset($encode); 
    1426                 if($encode) 
    1427                 { 
     1259                if ($encode) { 
    14281260                        $href = $this->bo->string_encode($href, 1); 
    1429                         $all_args = $args.'&'.$this->bo->string_encode($extra_args, 1); 
    1430                 } 
    1431                 else 
    1432                 { 
     1261                        $all_args = $args . '&' . $this->bo->string_encode($extra_args, 1); 
     1262                } else { 
    14331263                        //                              $href = $this->bo->string_encode($href, 1); 
    1434                         $all_args = $args.'&'.$extra_args; 
     1264                        $all_args = $args . '&' . $extra_args; 
    14351265                } 
    14361266                ### 
     
    14411271 
    14421272                /* Auto-detect and don't disturb absolute links */ 
    1443                 if(!preg_match("|^http(.{0,1})://|", $href)) 
    1444                 { 
     1273                if (!preg_match("|^http(.{0,1})://|", $href)) { 
    14451274                        //Only add an extra / if there isn't already one there 
    1446  
    14471275                        // die(SEP); 
    1448                         if(!($href[0] == SEP)) 
    1449                         { 
     1276                        if (!($href[0] == SEP)) { 
    14501277                                $href = SEP . $href; 
    14511278                        } 
     
    14551282                        $address = $GLOBALS['phpgw']->link($href, $all_args); 
    14561283                        //                              $address = $GLOBALS['phpgw']->link($href); 
    1457                 } 
    1458                 else 
    1459                 { 
     1284                } else { 
    14601285                        $address = $href; 
    14611286                } 
    14621287 
    14631288                /* If $linkonly is set, don't add any HTML */ 
    1464                 if($linkonly) 
    1465                 { 
     1289                if ($linkonly) { 
    14661290                        $rstring = $address; 
    1467                 } 
    1468                 else 
    1469                 { 
    1470                         if($target) 
    1471                         { 
    1472                                 $target = 'target='.$target; 
     1291                } else { 
     1292                        if ($target) { 
     1293                                $target = 'target=' . $target; 
    14731294                        } 
    14741295 
    14751296                        $text = trim($text); 
    1476                         $rstring = '<a href="'.$address.'" '.$target.'>'.$text.'</a>'; 
     1297                        $rstring = '<a href="' . $address . '" ' . $target . '>' . $text . '</a>'; 
    14771298                } 
    14781299 
     
    14801301        } 
    14811302 
    1482         function html_table_begin($width = NULL, $border = NULL, $cellspacing = NULL, $cellpadding = NULL, $rules = NULL, $string = '', $return = 0) 
    1483         { 
    1484                 if($width != NULL && $width) 
    1485                 { 
     1303        function html_table_begin($width = NULL, $border = NULL, $cellspacing = NULL, $cellpadding = NULL, $rules = NULL, $string = '', $return = 0) { 
     1304                if ($width != NULL && $width) { 
    14861305                        $width = "width=$width"; 
    14871306                } 
    1488                 if(is_int($border) && $border >= 0) 
    1489                 { 
     1307                if (is_int($border) && $border >= 0) { 
    14901308                        $border = "border=$border"; 
    14911309                } 
    1492                 if(is_int($cellspacing) && $cellspacing >= 0) 
    1493                 { 
     1310                if (is_int($cellspacing) && $cellspacing >= 0) { 
    14941311                        $cellspacing = "cellspacing=$cellspacing"; 
    14951312                } 
    1496                 if(is_int($cellpadding) && $cellpadding >= 0) 
    1497                 { 
     1313                if (is_int($cellpadding) && $cellpadding >= 0) { 
    14981314                        $cellpadding = "cellpadding=$cellpadding"; 
    14991315                } 
    1500                 if($rules != NULL && $rules) 
    1501                 { 
     1316                if ($rules != NULL && $rules) { 
    15021317                        $rules = "rules=$rules"; 
    15031318                } 
     
    15071322        } 
    15081323 
    1509         function html_table_end($return = 0) 
    1510         { 
     1324        function html_table_end($return = 0) { 
    15111325                $rstring = "</table>"; 
    15121326                return($this->bo->eor($rstring, $return)); 
    15131327        } 
    15141328 
    1515         function html_table_row_begin($align = NULL, $halign = NULL, $valign = NULL, $bgcolor = NULL, $string = '', $return = 0) 
    1516         { 
    1517                 if($align != NULL && $align) 
    1518                 { 
     1329        function html_table_row_begin($align = NULL, $halign = NULL, $valign = NULL, $bgcolor = NULL, $string = '', $return = 0) { 
     1330                if ($align != NULL && $align) { 
    15191331                        $align = "align=$align"; 
    15201332                } 
    1521                 if($halign != NULL && $halign) 
    1522                 { 
     1333                if ($halign != NULL && $halign) { 
    15231334                        $halign = "halign=$halign"; 
    15241335                } 
    1525                 if($valign != NULL && $valign) 
    1526                 { 
     1336                if ($valign != NULL && $valign) { 
    15271337                        $valign = "valign=$valign"; 
    15281338                } 
    1529                 if($bgcolor != NULL && $bgcolor) 
    1530                 { 
     1339                if ($bgcolor != NULL && $bgcolor) { 
    15311340                        $bgcolor = "bgcolor=$bgcolor"; 
    15321341                } 
     
    15351344        } 
    15361345 
    1537         function html_table_row_end($return = 0) 
    1538         { 
     1346        function html_table_row_end($return = 0) { 
    15391347                $rstring = "</tr>"; 
    15401348                return($this->bo->eor($rstring, $return)); 
    15411349        } 
    15421350 
    1543         function html_table_col_begin($align = NULL, $halign = NULL, $valign = NULL, $rowspan = NULL, $colspan = NULL, $string = '', $return = 0) 
    1544         { 
    1545                 if($align != NULL && $align) 
    1546                 { 
     1351        function html_table_col_begin($align = NULL, $halign = NULL, $valign = NULL, $rowspan = NULL, $colspan = NULL, $string = '', $return = 0) { 
     1352                if ($align != NULL && $align) { 
    15471353                        $align = "align=$align"; 
    15481354                } 
    1549                 if($halign != NULL && $halign) 
    1550                 { 
     1355                if ($halign != NULL && $halign) { 
    15511356                        $halign = "halign=$halign"; 
    15521357                } 
    1553                 if($valign != NULL && $valign) 
    1554                 { 
     1358                if ($valign != NULL && $valign) { 
    15551359                        $valign = "valign=$valign"; 
    15561360                } 
    1557                 if(is_int($rowspan) && $rowspan >= 0) 
    1558                 { 
     1361                if (is_int($rowspan) && $rowspan >= 0) { 
    15591362                        $rowspan = "rowspan=$rowspan"; 
    15601363                } 
    1561                 if(is_int($colspan) && $colspan >= 0) 
    1562                 { 
     1364                if (is_int($colspan) && $colspan >= 0) { 
    15631365                        $colspan = "colspan=$colspan"; 
    15641366                } 
     
    15681370        } 
    15691371 
    1570         function html_table_col_end($return = 0) 
    1571         { 
     1372        function html_table_col_end($return = 0) { 
    15721373                $rstring = "</td>"; 
    15731374                return($this->bo->eor($rstring, $return)); 
    15741375        } 
     1376 
    15751377} 
Note: See TracChangeset for help on using the changeset viewer.