diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-20 12:03:03 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-20 12:03:03 -0400 |
commit | 631152fc3ec731bb173fb139f0ec8769890eb61e (patch) | |
tree | b0ed9c317a895ad4e7539ccf3ab34708888f43ee /apps/files_sharing | |
parent | c2f0fe51c427374e918b72c28c521df27e614cae (diff) | |
download | nextcloud-server-631152fc3ec731bb173fb139f0ec8769890eb61e.tar.gz nextcloud-server-631152fc3ec731bb173fb139f0ec8769890eb61e.zip |
Implement searching of files shared with you
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/sharedstorage.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index b890d9ac9fd..e2147bea492 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -526,9 +526,25 @@ class OC_Filestorage_Shared extends OC_Filestorage { } } - // TODO query all shared files? - public function search($query) { - + public function search($query) { + return $this->searchInDir($query); + } + + private function searchInDir($query, $path = ""){ + $files = array(); + if ($dh = $this->opendir($path)) { + while (($filename = readdir($dh)) !== false) { + if ($filename != "." && $filename != "..") { + if (strstr(strtolower($filename), strtolower($query))) { + $files[] = $path."/".$filename; + } + if ($this->is_dir($path."/".$filename)) { + $files = array_merge($files, $this->searchInDir($query, $path."/".$filename)); + } + } + } + } + return $files; } public function getLocalFile($path) { |