function get_size($data) { $size = parent::get_size($data); /*XXX Caeies : Not sure about this, but ... */ /* If the virtual size is always 4096, we don't need this ... */ /* if($data['checksubdirs']) { $query = $GLOBALS['phpgw']->db->query("SELECT size FROM phpgw_vfs WHERE directory='".$p->fake_leading_dirs_clean."' AND name='".$p->fake_name_clean."'" . $this->extra_sql(array('query_text' => VFS_SQL_SELECT))); $GLOBALS['phpgw']->db->next_record(); $size += $GLOBALS['phpgw']->db->Record[0]; } */ return $size; }
/** * constructor, sets up variables * */ function __construct() { parent::__construct(); /* File/dir attributes, each corresponding to a database field. Useful for use in loops If an attribute was added to the table, add it here and possibly add it to set_attributes () set_attributes now uses this array(). 07-Dec-01 skeeter */ // $this->attributes[] = '#NAMEHERE#'; /* Dav properties */ //First check if we are asked to use svn ... $use_svn = false; if (preg_match('/svn[s:][:\\/]\\//', $this->basedir)) { $use_svn = true; //so the 's' is kept $this->basedir = preg_replace('/^svn/', 'http', $this->basedir); } if (!$this->dav_user) { $this->dav_user = isset($GLOBALS['phpgw_info']['user']['userid']) ? (string) $GLOBALS['phpgw_info']['user']['userid'] : ''; } //FIXME pwd has to be clear text. if (!$this->dav_pwd) { $this->dav_pwd = isset($GLOBALS['phpgw_info']['user']['passwd']) ? (string) $GLOBALS['phpgw_info']['user']['passwd'] : ''; } // For testing purpose: // $this->dav_user = '******'; // $this->dav_pwd = 'xxxxxx'; $parsed_url = parse_url($this->basedir); $this->dav_host = $parsed_url['host']; $this->dav_port = isset($parsed_url['port']) ? $parsed_url['port'] : ''; $this->dav_root = $parsed_url['scheme'] . '://'; $this->dav_root .= $this->dav_host; $this->dav_root .= empty($this->dav_port) ? '' : ':' . $this->dav_port; if ($use_svn) { $this->dav_client = CreateObject('phpgwapi.http_svn_client'); $this->svn_repository_path = $parsed_url['path']; } else { $this->dav_client = CreateObject('phpgwapi.http_dav_client'); } $this->dav_client->set_credentials($this->dav_user, $this->dav_pwd); $this->dav_client->set_attributes($this->attributes, $this->vfs_property_map); $result = $this->dav_client->connect($this->dav_host, $this->dav_port, $parsed_url['scheme'] == 'https'); if (DEBUG_DAV) { echo '<b>DAV client debugging enabled!</b>'; $this->dav_client->set_debug(DBGTRACE | DBGINDATA | DBGOUTDATA | DBGSOCK | DBGLOW); } if (!$result) { echo '<h2>Cannot connect to the file repository server!</h2>'; die($this->dav_client->get_body()); } //determine the supported DAV features /* $features = $this->dav_client->dav_features($this->repository); if (!$features || ! in_array( '1', $features) ) { die("Error :: The specified file repository: $this->repository doesn't appear to support WebDAV! "); } */ register_shutdown_function(array(&$this, 'vfs_umount')); $this->debug('Constructed with debug enabled'); }