aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_sharing/sharedstorage.php22
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) {