phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] filemanager/inc class.uifilemanager.inc.php, 1.17 cla


From: ceb
Subject: [Phpgroupware-cvs] filemanager/inc class.uifilemanager.inc.php, 1.17 class.bofilemanager.inc.php, 1.12
Date: Thu, 24 Feb 2005 15:09:56 -0000

Update of filemanager/inc

Modified Files:
     Branch: MAIN
            class.uifilemanager.inc.php lines: +54 -146
            class.bofilemanager.inc.php lines: +109 -59

Log Message:
update

====================================================
Index: filemanager/inc/class.uifilemanager.inc.php
diff -u filemanager/inc/class.uifilemanager.inc.php:1.16 
filemanager/inc/class.uifilemanager.inc.php:1.17
--- filemanager/inc/class.uifilemanager.inc.php:1.16    Tue Jan 25 02:40:30 2005
+++ filemanager/inc/class.uifilemanager.inc.php Tue Jan 25 18:42:58 2005
@@ -78,124 +78,30 @@
                        //$this->nextmatchs             = 
CreateObject('phpgwapi.nextmatchs');
                        //$this->browser                        = 
CreateObject('phpgwapi.browser');
                        //$this->template_dir = 
$GLOBALS['phpgw']->common->get_tpl_dir($GLOBALS['phpgw_info']['flags']['currentapp']);
+
                        $this->check_access();
-                       $this->create_home_dir();
-                       $this->verify_path();
                        $this->update();
                }

                function check_access()
                {
-                       if($this->bofilemanager->path != 
$this->bofilemanager->homedir && $this->bofilemanager->path != 
$this->bofilemanager->fakebase && $this->bofilemanager->path != '/' && 
!$this->bofilemanager->vfs->acl_check(array(
+                       $error = $this->bofilemanager->create_home_dir();
+                       if(strlen($error))
+                       {
+                               $error[] = $error;
+                       }
+
+                       if($this->bofilemanager->path != 
$this->bofilemanager->homedir && $this->bofilemanager->path != 
$this->bofilemanager->fakebase
+                               && $this->bofilemanager->path != '/' && 
!$GLOBALS['phpgw']->vfs->acl_check(array(
                                'string'=>$this->bofilemanager->path,
                                'relatives' => Array(RELATIVE_NONE),
                                'operation' => PHPGW_ACL_READ)))
                        {
-                               $this->no_access_exists(lang('you do not have 
access to %1',$this->bofilemanager->path));
+                               $error[] = lang('you do not have access to 
%1',$this->bofilemanager->path);
                        }
-                       $this->bofilemanager->userinfo['working_id'] = 
$this->bofilemanager->vfs->working_id;
+                       $this->bofilemanager->userinfo['working_id'] = 
$GLOBALS['phpgw']->vfs->working_id;
                        $this->bofilemanager->userinfo['working_lid'] = 
$GLOBALS['phpgw']->accounts->id2name($this->bofilemanager->userinfo['working_id']);
-               }
-
-               /**TODO: xslt-ise this (and get rid of the hard-coded html)*/
-               function no_access_exists($error_msg)
-               {
-                       if($this->bofilemanager->debug)
-                       {
-                               echo 'DEBUG: ui.no_access_exists: you do not 
have access to this directory<br>'."\n";
-                       }
-                       $p = 
CreateObject('phpgwapi.Template',$this->template_dir);
-                       $p->set_unknowns('remove');

-                       $p->set_file(
-                               Array(
-                                       '_errors'       => 'errors.tpl'
-                               )
-                       );
-                       $p->set_block('_errors','error_page','error_page');
-                       $p->set_block('_errors','ind_error','ind_error');
-
-                       $p->set_var('error',$error_msg);
-                       $p->parse('errors','ind_error',True);
-
-                       $p->set_var('error','<br><br>Go to your <a 
href="'.$GLOBALS['phpgw']->link('/index.php',
-                                       Array(
-                                               'menuaction'    => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                                               'path'  => 
urlencode($this->bofilemanager->homedir)
-                                       )
-                               ).'">Home</a> directory'
-                       );
-                       $p->parse('errors','ind_error',True);
-                       $p->pfp('output','error_page');
-                       exit();
-               }
-
-               function create_home_dir()
-               {
-                       ###
-                       # If their home directory doesn't exist, we create it
-                       # Same for group directories
-                       ###
-
-                       if($this->bofilemanager->debug)
-                       {
-                               echo 'DEBUG: ui.create_home_dir: PATH = 
'.$this->bofilemanager->path.'<br>'."\n";
-                               echo 'DEBUG: ui.create_home_dir: PATH = 
'.urlencode($this->bofilemanager->path).'<br>'."\n";
-                       }
-
-                       if(($this->bofilemanager->path == 
$this->bofilemanager->homedir) && !$this->bofilemanager->vfs->file_exists(array(
-                                       'string' => 
$this->bofilemanager->homedir,
-                                       'relatives' => Array(RELATIVE_NONE)
-                               )))
-                       {
-                               $this->bofilemanager->vfs->override_acl = 1;
-                               if (!$this->bofilemanager->vfs->mkdir(array(
-                                       'string' => 
$this->bofilemanager->homedir,
-                                       'relatives' => Array(RELATIVE_NONE)
-                                       )))
-                               {
-//TODO: xsltise                                        echo lang('failed to 
create directory') . ' :'. $this->bofilemanager->homedir . "\n";
-                               }
-                               $this->bofilemanager->vfs->override_acl = 0;
-                       }
-                       
elseif(preg_match("|^".$this->bofilemanager->fakebase."\/(.*)$|U",$this->bofilemanager->path,$this->bofilemanager->matches))
-                       {
-                               if 
(!$this->bofilemanager->vfs->file_exists(array(
-                                       'string' => $this->bofilemanager->path,
-                                       'relatives' => Array(RELATIVE_NONE)
-                                       )))
-                               {
-                                       
//$this->bofilemanager->vfs->override_acl = 1;
-                                       if 
(!$this->bofilemanager->vfs->mkdir(array(
-                                               'string' => 
$this->bofilemanager->homedir,
-                                               'relatives' => 
Array(RELATIVE_NONE)
-                                               )))
-                                       {
-//TODO: xsltise                                echo lang('failed to create 
directory') . ' <b>'. $this->bofilemanager->homedir . '</b><br><br>';
-                                       }
-                                       
//$this->bofilemanager->vfs->override_acl = 0;
-
-                                       if($this->bofilemanager->debug)
-                                       {
-                                               echo 'DEBUG: 
ui.create_home_dir: PATH = '.$this->bofilemanager->path.'<br>'."\n";
-                                               echo 'DEBUG: 
ui.create_home_dir(): matches[1] = 
'.$this->bofilemanager->matches[1].'<br>'."\n";
-                                       }
-
-                                       $group_id = 
$GLOBALS['phpgw']->accounts->name2id($this->bofilemanager->matches[1]);
-                                       if($group_id)
-                                       {
-                                               
$this->bofilemanager->vfs->set_attributes(array(
-                                                       'string' => 
$this->bofilemanager->path,
-                                                       'relatives' => 
Array(RELATIVE_NONE),
-                                                       'attributes' => 
Array('owner_id' => $group_id, 'createdby_id' => $group_id)
-                                                       ));
-                                       }
-                               }
-                       }
-               }
-
-               function verify_path()
-               {
                        ###
                        # Verify path is real
                        ###
@@ -203,7 +109,7 @@
                        if($this->bofilemanager->debug)
                        {
                                echo 'DEBUG: ui.verify_path: PATH = 
'.$this->bofilemanager->path.'<br>'."\n";
-                               echo 'DEBUG: ui.verify_path: exists = 
'.$this->bofilemanager->vfs->file_exists(array(
+                               echo 'DEBUG: ui.verify_path: exists = 
'.$GLOBALS['phpgw']->vfs->file_exists(array(
                                        'string' => $this->bofilemanager->path,
                                        'relatives' => 
Array(RELATIVE_NONE))).'<br>'."\n";
                        }
@@ -211,12 +117,23 @@
                        if($this->bofilemanager->path != 
$this->bofilemanager->homedir &&
                                $this->bofilemanager->path != '/' &&
                                $this->bofilemanager->path != 
$this->bofilemanager->fakebase &&
-                               !$this->bofilemanager->vfs->file_exists(array(
+                               !$GLOBALS['phpgw']->vfs->file_exists(array(
                                        'string' => $this->bofilemanager->path,
                                        'relatives' => Array(RELATIVE_NONE)
                                        )))
                        {
-                               $this->no_access_exists(lang('directory %1 does 
not exist',$this->bofilemanager->path));
+                               $error[] = lang('directory %1 does not 
exist',$this->bofilemanager->path);
+                       }
+                       if(is_array($error))
+                       {
+                               if($this->bofilemanager->debug)
+                               {
+                                       foreach($error as $key => $er)
+                                       {
+                                               echo 'DEBUG: ui.check_access: ' 
. $er ."\n";
+                                       }
+                               }
+                               
//$GLOBALS['phpgw']->xslttpl->add_file('widgets');
                        }
                }

@@ -226,19 +143,15 @@
                        srand((double)microtime() * 1000000);
                        if($this->bofilemanager->update || rand(0,19) == 4)
                        {
-                               $this->bofilemanager->vfs->update_real(array(
+                               $GLOBALS['phpgw']->vfs->update_real(array(
                                        'string' => $this->bofilemanager->path,
                                        'relatives' =>Array(RELATIVE_NONE)
                                        ));
                        }
                        if($this->bofilemanager->update)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array
-                                                                               
                                        (
-                                                                               
                                                'menuaction'    => 
'filemanager.uifilemanager.index',
-                                                                               
                                                'path'  => 
urlencode($this->bofilemanager->path)
-                                                                               
                                        )
-                                                                               
                );
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' => 
'filemanager.uifilemanager.index',
+                                                                               
                                                'path' => 
urlencode($this->bofilemanager->path)));
                        }
                }

@@ -303,12 +216,6 @@
                                'download'
                        );

-                       $link_data = array
-                       (
-                               'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                               'path'                  => 
urlencode($this->bofilemanager->path)
-                       );
-
                        if (trim(strtolower($this->bofilemanager->cancel)) == 
strtolower(lang('cancel'))) {
                                $this->cancel();
                                exit();
@@ -325,15 +232,15 @@
                                        {
                                                //echo " bofunction $function ";
                                                $f_function = 'f_'.$action;
-                                               $errors = 
implode("\n",$this->bofilemanager->$f_function());
+                                               $error = 
$this->bofilemanager->$f_function();

                                                if($function == 'newfile')
                                                {
                                                        
$link_data['createfile'] = urlencode($this->bofilemanager->createfile);
                                                }
-                                               elseif(strlen($errors))
+                                               elseif(is_array($error))
                                                {
-                                                       $var['errors'] = 
$errors;
+                                                       $var['errors'] = 
implode("\n",$error);
                                                }
                                        }
                                        else
@@ -342,6 +249,12 @@
                                        }
                                }
                        }
+
+                       $link_data = array
+                       (
+                               'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+                               'path'                  => 
urlencode($this->bofilemanager->path)
+                       );
                        
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                }

@@ -472,7 +385,7 @@
                                case 'dir_menu':
                                        $var['option'][] = array
                                        (
-                                               //'selected' => True,
+                                               'selected' => True,
                                                'caption' => lang('Choose 
Directory -->')
                                        );

@@ -486,7 +399,7 @@
                                                'name' => 
$this->bofilemanager->userinfo['account_lid']
                                        );

-                                       $ls_array = 
$this->bofilemanager->vfs->ls(array(
+                                       $ls_array = 
$GLOBALS['phpgw']->vfs->ls(array(
                                        'string' => 
$this->bofilemanager->homedir,
                                        'relatives' => Array(RELATIVE_NONE),
                                        'checksubdirs'  => True,
@@ -511,7 +424,7 @@
                                                'name' => 
$group_array['account_name']
                                                );

-                                               $ls_array = 
$this->bofilemanager->vfs->ls(array(
+                                               $ls_array = 
$GLOBALS['phpgw']->vfs->ls(array(
                                                'string' => 
$this->bofilemanager->fakebase.SEP.$group_array['account_name'],
                                                'relatives' => 
Array(RELATIVE_NONE),
                                                'checksubdirs'  => True,
@@ -523,6 +436,8 @@
                                                }
                                        }

+                                       //_debug_array($dirs);
+
                                        $dir_list = array();
                                        reset($dirs);
                                        while(list($num, $dir) = each($dirs))
@@ -541,23 +456,16 @@
                                                        $dir['directory'] .= 
SEP;
                                                }

-                                               $selected = '';
-                                               if($num == 0)
-                                               {
-                                                       $selected = True;
-                                               }
-
                                                ###
                                                # No point in displaying the 
current directory, or a directory that doesn't exist
                                                ###

-                                               
if(($dir['directory'].$dir['name']) != $this->bofilemanager->path) //&& 
$this->bofilemanager->vfs->file_exists(array(
-                                               //'string' => 
$dir['directory'].$dir['name'],
-                                               //'relatives' => 
Array(RELATIVE_NONE)
-                                               //)))
+                                               
if(($dir['directory'].$dir['name']) != $this->bofilemanager->path && 
$GLOBALS['phpgw']->vfs->file_exists(array(
+                                                       'string' => 
$dir['directory'].$dir['name'],
+                                                       'relatives' => 
Array(RELATIVE_NONE)
+                                               )))
                                                {
                                                        $var['option'][] = 
array('value'=> urlencode($dir['directory'].$dir['name']),
-                                                       'selected' => $selected,
                                                        'caption' => 
$dir['directory'].$dir['name']
                                                        );
                                                }
@@ -632,7 +540,7 @@
                                
$p->parse('col_headers','column_headers_normal',False);

                                $var['td_extras']       = ' 
colspan="'.($info_columns / 2).'" align="left" width="50%"';
-                               $var['column_header'] = 
count($this->bofilemanager->vfs->ls(array(
+                               $var['column_header'] = 
count($GLOBALS['phpgw']->vfs->ls(array(
                                        'string' => $this->bofilemanager->path,
                                        'relatives' => Array(RELATIVE_NONE)
                                        )));
@@ -1021,7 +929,7 @@
                {
                        $this->load_header();
                        $file = 
$this->bofilemanager->path.$this->bofilemanager->dispsep.$this->bofilemanager->file;
-                       if($this->bofilemanager->vfs->file_exists(array(
+                       if($GLOBALS['phpgw']->vfs->file_exists(array(
                                'string' => $file,
                                'relatives' => Array(RELATIVE_NONE)
                                )))
@@ -1077,7 +985,7 @@
                                $p->parse('col_row','column_rows',True);
                                $p->set_var('col_headers','');

-                               $journal_array = 
$this->bofilemanager->vfs->get_journal(array(
+                               $journal_array = 
$GLOBALS['phpgw']->vfs->get_journal(array(
                                        'string' => $file,
                                        'relatives' => Array(RELATIVE_NONE)
                                        ));
@@ -1116,22 +1024,22 @@
                                $this->bofilemanager->file = 
$file_array['file'];
                        }
                        $file = 
$this->bofilemanager->path.SEP.$this->bofilemanager->file;
-                       if($this->bofilemanager->vfs->file_exists(array(
+                       if($GLOBALS['phpgw']->vfs->file_exists(array(
                                'string' => $file,
                                'relatives' => Array(RELATIVE_NONE)
                                )))
                        {
                                $browser = CreateObject('phpgwapi.browser');
-                               
$browser->content_header($this->bofilemanager->file,$this->bofilemanager->vfs->file_type(array(
+                               
$browser->content_header($this->bofilemanager->file,$GLOBALS['phpgw']->vfs->file_type(array(
                                                'string' => $file,
                                                'relatives' => 
Array(RELATIVE_NONE))),
-                                       
$this->bofilemanager->vfs->get_size(array(
+                                       $GLOBALS['phpgw']->vfs->get_size(array(
                                                'string' => $file,
                                                'relatives' => 
Array(RELATIVE_NONE),
                                                'checksubdirs' => True
                                                )));
 //                             
$browser->content_header($this->bofilemanager->file);
-                               echo $this->bofilemanager->vfs->read(array(
+                               echo $GLOBALS['phpgw']->vfs->read(array(
                                        'string' => $file,
                                        'relatives' => Array(RELATIVE_NONE)
                                        ));

====================================================
Index: filemanager/inc/class.bofilemanager.inc.php
diff -u filemanager/inc/class.bofilemanager.inc.php:1.11 
filemanager/inc/class.bofilemanager.inc.php:1.12
--- filemanager/inc/class.bofilemanager.inc.php:1.11    Tue Jan 25 02:40:30 2005
+++ filemanager/inc/class.bofilemanager.inc.php Tue Jan 25 18:42:58 2005
@@ -69,7 +69,10 @@

                function bofilemanager()
                {
-                       $this->vfs = CreateObject('phpgwapi.vfs');
+                       if (@!is_object($GLOBALS['phpgw']->vfs))
+                       {
+                               $GLOBALS['phpgw']->vfs = CreateObject 
('phpgwapi.vfs');
+                       }
                        $to_decode = Array(
                                /*
                                        Decode
@@ -120,8 +123,8 @@
                                $this->initialize_vars($to_decode[$i]);
                        }

-                       $this->rootdir = $this->vfs->basedir;
-                       $this->fakebase = $this->vfs->fakebase;
+                       $this->rootdir = $GLOBALS['phpgw']->vfs->basedir;
+                       $this->fakebase = $GLOBALS['phpgw']->vfs->fakebase;
                        $this->appname = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->settings = 
$GLOBALS['phpgw_info']['user']['preferences'][$this->appname];

@@ -177,25 +180,25 @@

                        if(!$this->path)
                        {
-                               $this->path = $this->vfs->pwd();
-                               if (!$this->path || $this->vfs->pwd(array(
+                               $this->path = $GLOBALS['phpgw']->vfs->pwd();
+                               if (!$this->path || 
$GLOBALS['phpgw']->vfs->pwd(array(
                                        'full' => False
                                        )) == '')
                                {
                                        $this->path = $this->homedir;
                                }
                        }
-                       $this->vfs->cd(array(
+                       $GLOBALS['phpgw']->vfs->cd(array(
                                'relative' => False,
                                'relatives'=>Array(RELATIVE_NONE)
                                ));
-                       $this->vfs->cd(array(
+                       $GLOBALS['phpgw']->vfs->cd(array(
                                'string' => $this->path,
                                'relative' => False,
                                'relatives' => Array(RELATIVE_NONE)
                                ));

-                       $this->pwd = $this->vfs->pwd();
+                       $this->pwd = $GLOBALS['phpgw']->vfs->pwd();

                        if (!$this->cwd = 
substr($this->path,strlen($this->homedir) + 1))
                        {
@@ -235,13 +238,13 @@
                                        . 'fakebase: '.$this->fakebase.'<br>'
                                        . 'homedir: '.$this->homedir.'<p>'
                                        . '<b>phpGW debug:</b><br>'
-                                       . 'real cabsolutepath: 
'.$this->vfs->getabsolutepath(array(
+                                       . 'real cabsolutepath: 
'.$GLOBALS['phpgw']->vfs->getabsolutepath(array(
                                                                        
'string' => False,
                                                                        'fake' 
=> False
                                                                        
)).'<br>'
-                                       . 'fake getabsolutepath: 
'.$this->vfs->getabsolutepath().'<br>'
+                                       . 'fake getabsolutepath: 
'.$GLOBALS['phpgw']->vfs->getabsolutepath().'<br>'
                                        . 'appsession: 
'.$GLOBALS['phpgw']->session->appsession('vfs','').'<br>'
-                                       . 'pwd: '.$this->vfs->pwd().'<br>';
+                                       . 'pwd: 
'.$GLOBALS['phpgw']->vfs->pwd().'<br>';
                        }

                        ###
@@ -272,7 +275,6 @@
                                }
                                unset($applications);
                        }
-
                        reset($groups);
                        $this->memberships = $groups;
                        //_debug_array($this->memberships);
@@ -283,11 +285,11 @@
                        ###
                        
if((preg_match('+^'.$this->fakebase.'\/(.*)(\/|$)+U',$this->path,$this->matches))
 && $this->matches[1] != $this->userinfo['account_lid'])
                        {
-                               $this->vfs->working_id = 
$GLOBALS['phpgw']->accounts->name2id($matches[1]);
+                               $GLOBALS['phpgw']->vfs->working_id = 
$GLOBALS['phpgw']->accounts->name2id($this->matches[1]);
                        }
                        else
                        {
-                               $this->vfs->working_id = 
$this->userinfo['username'];
+                               $GLOBALS['phpgw']->vfs->working_id = 
$this->userinfo['username'];
                        }
                }

@@ -340,6 +342,64 @@
                        }
                }

+               function create_home_dir()
+               {
+                       ###
+                       # If their home directory doesn't exist, we create it
+                       # Same for group directories
+                       ###
+
+                       if($this->debug)
+                       {
+                               echo 'DEBUG: bo.create_home_dir: PATH = 
'.$this->path.'<br>'."\n";
+                               echo 'DEBUG: bo.create_home_dir: PATH = 
'.urlencode($this->path).'<br>'."\n";
+                               echo 'DEBUG: bo.create_home_dir: HOMEDIR = 
'.urlencode($this->homedir).'<br>'."\n";
+                       }
+
+                       if(($this->path == $this->homedir) && 
!$GLOBALS['phpgw']->vfs->file_exists(array('string' => 
$this->homedir,'relatives' => Array(RELATIVE_NONE))))
+                       {
+                               $GLOBALS['phpgw']->vfs->override_acl = 1;
+                               if 
(!$GLOBALS['phpgw']->vfs->mkdir(array('string' => $this->homedir,'relatives' => 
array(RELATIVE_NONE))))
+                               {
+                                       $error = lang('failed to create 
directory %1',$this->homedir);
+                               }
+                               //$GLOBALS['phpgw']->vfs->override_acl = 0;
+                       }
+                       
elseif(preg_match("|^".$this->fakebase."\/(.*)$|U",$this->path,$this->matches))
+                       {
+                               if 
(!$GLOBALS['phpgw']->vfs->file_exists(array('string' => $this->path,'relatives' 
=> array(RELATIVE_NONE))))
+                               {
+                                       $group_id = 
$GLOBALS['phpgw']->accounts->name2id($this->matches[1]);
+                                       $GLOBALS['phpgw']->vfs->working_id = 
$group_id;
+                                       $GLOBALS['phpgw']->vfs->override_acl = 
1;
+
+                                       if 
(!$GLOBALS['phpgw']->vfs->mkdir(array('string' => $this->path,'relatives' => 
array(RELATIVE_NONE))))
+                                       {
+                                               $error = lang('failed to create 
directory %1',$this->homedir);
+                                       }
+                                       //$GLOBALS['phpgw']->vfs->override_acl 
= 0;
+
+                                       if($this->debug)
+                                       {
+                                               echo 'DEBUG: 
ui.create_home_dir: PATH = '.$this->bofilemanager->path.'<br>'."\n";
+                                               echo 'DEBUG: 
ui.create_home_dir(): matches[1] = 
'.$this->bofilemanager->matches[1].'<br>'."\n";
+                                       }
+
+                                       if($group_id)
+                                       {
+                                               
$GLOBALS['phpgw']->vfs->set_attributes(array(
+                                                       'string' => $this->path,
+                                                       'relatives' => 
array(RELATIVE_NONE),
+                                                       'attributes' => 
array('owner_id' => $group_id, 'createdby_id' => $group_id)));
+                                       }
+                               }
+                       }
+                       if(strlen($error))
+                       {
+                               return $error;
+                       }
+               }
+
                function load_files()
                {
                        ###
@@ -353,12 +413,12 @@
                                //echo 'path: ' . $this->path . "\n";
                                //echo 'fake: ' . $this->fakebase;

-                               if (!$this->vfs->file_exists(array('string' => 
$this->homedir,'relatives' => array(RELATIVE_NONE))))
+                               if 
(!$GLOBALS['phpgw']->vfs->file_exists(array('string' => 
$this->homedir,'relatives' => array(RELATIVE_NONE))))
                                {
-                                       $this->vfs->mkdir(array('string' => 
$this->homedir,'relatives' => array(RELATIVE_NONE)));
+                                       
$GLOBALS['phpgw']->vfs->mkdir(array('string' => $this->homedir,'relatives' => 
array(RELATIVE_NONE)));
                                }

-                               $ls_array = $this->vfs->ls(array(
+                               $ls_array = $GLOBALS['phpgw']->vfs->ls(array(
                                        'string' => $this->homedir,
                                        'relatives' =>Array(RELATIVE_NONE),
                                        'checksubdirs' => False,
@@ -369,29 +429,28 @@
                                reset ($this->memberships);
                                while(list($num, $group_array) = 
each($this->memberships))
                                {
-                                       if (!$this->vfs->file_exists(array(
+                                       if 
(!$GLOBALS['phpgw']->vfs->file_exists(array(
                                                'string' => 
$this->fakebase.'/'.$group_array['account_name'],
                                                'relatives' => 
Array(RELATIVE_NONE)
                                                )))
                                        {
-                                               $this->vfs->mkdir(array(
+                                               
$GLOBALS['phpgw']->vfs->mkdir(array(
                                                        'string' => 
$this->fakebase.'/'.$group_array['account_name'],
                                                        'relatives' => 
Array(RELATIVE_NONE)
                                                        ));
-                                               
$this->vfs->set_attributes(array(
+                                               
$GLOBALS['phpgw']->vfs->set_attributes(array(
                                                        'string' => 
$this->fakebase.'/'.$group_array['account_name'],
                                                        'relatives' => 
Array(RELATIVE_NONE),
                                                        'attributes'=> 
Array('owner_id' => $group_array['account_id'], 'createdby_id' => 
$group_array['account_id'])
                                                        ));
                                        }

-                                       $ls_array = $this->vfs->ls(array(
+                                       $ls_array = 
$GLOBALS['phpgw']->vfs->ls(array(
                                                'string' => 
$this->fakebase.'/'.$group_array['account_name'],
                                                'relatives' => 
Array(RELATIVE_NONE),
                                                'checksubdirs' => False,
                                                'nofiles' => True
                                                ));
-
                                        $this->files_array[] = $ls_array[0];
                                }
                        }
@@ -400,7 +459,7 @@
                                //echo 'path: ' . $this->path . "\n";
                                //echo 'fake: ' . $this->fakebase;

-                               $ls_array = $this->vfs->ls(array(
+                               $ls_array = $GLOBALS['phpgw']->vfs->ls(array(
                                        'string' => $this->path,
                                        'relatives' => Array(RELATIVE_NONE),
                                        'checksubdirs' => False,
@@ -448,47 +507,38 @@
                function f_go()
                {
                        $this->path = $this->todir;
+                       return True;
                }
+
                function f_apply_edit_comment()
                {
-                       $result=Array();
-                       for ($i=0; $i<count($this->fileman) ; $i++)
+                       for ($i=0;$i<count($this->fileman);$i++)
                        {
                                $file = $this->fileman[$i];
-
-                               if (!$this->vfs->set_attributes (array (
-                                       'string'        => $file,
-                                       'relatives'     => array (RELATIVE_ALL),
-                                       'attributes'    => array (
-                                                       'comment' => 
stripslashes ($this->changes[$file])
-                                               )
-                                       )
-                               ))
+                               if 
(!$GLOBALS['phpgw']->vfs->set_attributes(array('string' => $file,'relatives' => 
array (RELATIVE_ALL),
+                                                                               
                        'attributes' => array('comment' => stripslashes 
($this->changes[$file])))))
                                {
                                        $result[] = lang('error: failed to 
change comment for : %1', $file);
                                }
                        }
-
-                       return $result;
+                       return is_array($result)?$result:True;
                }
-
+
                function f_apply_edit_name()
                {
-                       $result = Array();
                        while (list ($from, $to) = each ($this->changes))
                        {
                                if ($badchar = $this->bad_chars ($to, True, 
True))
                                {
                                 $result[] = lang('file names cannot contain 
%1', $badchar);
-                                       continue;
                                }
-
+
                                if (ereg ("/", $to) || ereg ("\\\\", $to))
                                {
                                        //echo 
$GLOBALS['phpgw']->common->error_list (array ("File names cannot contain \\ or 
/"));
                                $result[] = lang('file names cannot contain \\ 
or /');
                                }
-                               elseif (!$this->vfs->mv (array (
+                               elseif (!$GLOBALS['phpgw']->vfs->mv (array (
                                                        'from'  => $from,
                                                        'to'    => $to
                                        ))
@@ -497,7 +547,7 @@
                                        //echo 
$GLOBALS['phpgw']->common->error_list (array ('Could not rename 
'.$disppath.'/'.$from.' to '.$disppath.'/'.$to));
                                $result[] = lang('could not rename %1 to %2', 
$this->path.'/'.$from, $this->path.'/'.$to);
                                }
-                               else
+                               else
                                {
                                        $result[] = lang('renamed %1 to %2', 
$this->path.'/'.$this->path.'/'.$from, $to);
                                }
@@ -513,7 +563,7 @@
                        {
                                if($this->fileman[$i])
                                {
-                                       $ls_array = $this->vfs->ls(array(
+                                       $ls_array = 
$GLOBALS['phpgw']->vfs->ls(array(
                                                'string' => 
$this->path.SEP.$this->fileman[$i],
                                                'relatives' => 
Array(RELATIVE_NONE),
                                                'checksubdirs' =>False,
@@ -530,7 +580,7 @@
                                                {
                                                        $mime_type = 'File';
                                                }
-                                               if($this->vfs->delete(array(
+                                               
if($GLOBALS['phpgw']->vfs->delete(array(
                                                        'string' => 
$this->path.SEP.$this->fileman[$i],
                                                        'relatives' => 
Array(RELATIVE_USER_NONE)
                                                        )))
@@ -559,7 +609,7 @@
                        {
                                if($this->fileman[$i])
                                {
-                                       if($this->vfs->cp(array(
+                                       if($GLOBALS['phpgw']->vfs->cp(array(
                                                'from' => 
$this->path.SEP.$this->fileman[$i],
                                                'to' => 
$this->todir.SEP.$this->fileman[$i],
                                                'relatives' => 
Array(RELATIVE_NONE,RELATIVE_NONE)
@@ -584,7 +634,7 @@
                        {
                                if($this->fileman[$i])
                                {
-                                       if($this->vfs->mv(array(
+                                       if($GLOBALS['phpgw']->vfs->mv(array(
                                                'from' => 
$this->path.SEP.$this->fileman[$i],
                                                'to' => 
$this->todir.SEP.$this->fileman[$i],
                                                'relatives' => 
Array(RELATIVE_NONE,RELATIVE_NONE)
@@ -607,7 +657,7 @@
                        $numoffiles = count($this->fileman);
                        for($i=0;$i!=$numoffiles;$i++)
                        {
-                               if($this->fileman[$i] && 
$this->vfs->file_exists(array(
+                               if($this->fileman[$i] && 
$GLOBALS['phpgw']->vfs->file_exists(array(
                                        'string' => 
$this->bo->path.SEP.$this->bo->fileman[$i],
                                        'relatives' => Array(RELATIVE_NONE)
                                        )))
@@ -645,7 +695,7 @@
                                        return $result;
                                }

-                               $ls_array = $this->vfs->ls(array(
+                               $ls_array = $GLOBALS['phpgw']->vfs->ls(array(
                                        'string' => 
$this->path.SEP.$this->createdir,
                                        'relatives' => Array(RELATIVE_NONE),
                                        'checksubdirs' => False,
@@ -666,7 +716,7 @@
                                }
                                else
                                {
-                                       if ($this->vfs->mkdir(array(
+                                       if ($GLOBALS['phpgw']->vfs->mkdir(array(
                                                'string' => 
$this->path.SEP.$this->createdir,
                                                'relatives' => 
Array(RELATIVE_NONE)
                                                )))
@@ -695,7 +745,7 @@
                                        $result[] = lang('file names cannot 
contain %1', $badchar);
                                        return $result;
                                }
-                               if($this->vfs->file_exists(array(
+                               if($GLOBALS['phpgw']->vfs->file_exists(array(
                                        'string' => $this->createfile,
                                        'relatives' => Array(RELATIVE_ALL)
                                        )))
@@ -703,7 +753,7 @@
                                        $result[] = lang('file %1 already 
exists.  Please edit it or delete it first', $this->path.SEP.$this->createfile);
                                        return $result;
                                }
-                               if(!$this->vfs->touch(array(
+                               if(!$GLOBALS['phpgw']->vfs->touch(array(
                                        'string' => $this->createfile,
                                        'relatives' => Array(RELATIVE_ALL)
                                        )))
@@ -734,7 +784,7 @@
                                # Check to see if the file exists in the 
database, and get its info at the same time
                                ###

-                               $ls_array = $this->vfs->ls (array (
+                               $ls_array = $GLOBALS['phpgw']->vfs->ls (array (
                                                'string'        => 
$this->upload_file['name'][$i],
                                                'relatives'     => array 
(RELATIVE_ALL),
                                                'checksubdirs'  => False,
@@ -758,14 +808,14 @@
                                        if ($fileinfo['name'] && 
$fileinfo['deleteable'] != 'N')
                                        {
                                                if (
-                                                               $this->vfs->cp 
(array (
+                                                               
$GLOBALS['phpgw']->vfs->cp (array (
                                                                        'from'  
=> $this->upload_file['tmp_name'][$i],
                                                                        'to'    
=> $this->upload_file['name'][$i],
                                                                        
'relatives'     => array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
                                                                )
                                                        )
                                                ) {
-                                                       
$this->vfs->set_attributes (array (
+                                                       
$GLOBALS['phpgw']->vfs->set_attributes (array (
                                                                        
'string'        => $this->upload_file['name'][$i],
                                                                        
'relatives'     => array (RELATIVE_ALL),
                                                                        
'attributes'    => array (
@@ -790,7 +840,7 @@
                                        else
                                        {
                                                if (
-                                                       $this->vfs->cp (array (
+                                                       
$GLOBALS['phpgw']->vfs->cp (array (
                                                                        'from'  
=> $this->upload_file['tmp_name'][$i],
                                                                        'to'    
=> $this->upload_file['name'][$i],
                                                                        
'relatives'     => array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
@@ -798,7 +848,7 @@
                                                        )
                                                ) {

-                                                       
$this->vfs->set_attributes (array (
+                                                       
$GLOBALS['phpgw']->vfs->set_attributes (array (
                                                                        
'string'        => $this->upload_file['name'][$i],
                                                                        
'relatives'     => array (RELATIVE_ALL),
                                                                        
'attributes'    => array (
@@ -816,13 +866,13 @@
                                }
                                elseif ($this->upload_file['name'][$i])
                                {
-                                       $this->vfs->touch (array (
+                                       $GLOBALS['phpgw']->vfs->touch (array (
                                                        'string'        => 
$this->upload_file['name'][$i],
                                                        'relatives'     => 
array (RELATIVE_ALL)
                                                )
                                        );

-                                       $this->vfs->set_attributes (array (
+                                       $GLOBALS['phpgw']->vfs->set_attributes 
(array (
                                                        'string'        => 
$this->upload_file['name'][$i],
                                                        'relatives'     => 
array (RELATIVE_ALL),
                                                        'attributes'    => 
array (






reply via email to

[Prev in Thread] Current Thread [Next in Thread]