From ef278963d73df1fdb9cda498f5d27423fd61815e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 14 Jun 2010 13:18:41 +0000 Subject: [PATCH] also remove mountpoints the user has no read access to from directory listings, eg. enabling versioning for an other user --- phpgwapi/inc/class.vfs_stream_wrapper.inc.php | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php index 6010de719f..107c5cd508 100644 --- a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php @@ -922,20 +922,24 @@ class vfs_stream_wrapper implements iface_stream_wrapper */ function dir_readdir ( ) { - if ($this->extra_dirs && count($this->extra_dirs) > $this->extra_dir_ptr) - { - $file = $this->extra_dirs[$this->extra_dir_ptr++]; - } - else - { - // only return children readable by the user, if dir is not writable - do { - $file = readdir($this->opened_dir); + // only return children readable by the user, if dir is not writable + do { + if ($this->extra_dirs && count($this->extra_dirs) > $this->extra_dir_ptr) + { + $file = $this->extra_dirs[$this->extra_dir_ptr++]; + } + else + { + // do not return files in $this->extra_dir twice + do { + $file = readdir($this->opened_dir); + } + while($file !== false && (is_array($this->extra_dirs) && in_array($file,$this->extra_dirs))); // dont return mountpoints twice } - while($file !== false && (is_array($this->extra_dirs) && in_array($file,$this->extra_dirs) || // dont return mountpoints twice - self::HIDE_UNREADABLES && !$this->opened_dir_writable && - !egw_vfs::check_access(egw_vfs::concat($this->opened_dir_url,$file),egw_vfs::READABLE))); } + while($file !== false && self::HIDE_UNREADABLES && !$this->opened_dir_writable && + !egw_vfs::check_access(egw_vfs::concat($this->opened_dir_url,$file),egw_vfs::READABLE)); + if (self::LOG_LEVEL > 1) error_log(__METHOD__."( $this->opened_dir ) = '$file'"); return $file; }