summaryrefslogtreecommitdiffstats
path: root/search/ajax
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-12-02 17:31:04 +0100
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-12-10 15:51:59 +0100
commit1d490b559ce279f5c9f44b727fe9d71d3718a24b (patch)
tree5520065370f6874c80eb8a5be38e2b284d4e292f /search/ajax
parente9029f94cb6eb9b37623ea1a2faf8aac11675900 (diff)
downloadnextcloud-server-1d490b559ce279f5c9f44b727fe9d71d3718a24b.tar.gz
nextcloud-server-1d490b559ce279f5c9f44b727fe9d71d3718a24b.zip
introduce inApps[] filter for search via ajax query, make file results show up in files app only
use more flexible return type check array with !empty instead of count
Diffstat (limited to 'search/ajax')
-rw-r--r--search/ajax/search.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/search/ajax/search.php b/search/ajax/search.php
index 84a5a760cad..21e127e72b1 100644
--- a/search/ajax/search.php
+++ b/search/ajax/search.php
@@ -22,12 +22,24 @@
*/
// Check if we are a user
-OC_JSON::checkLoggedIn();
+\OC_JSON::checkLoggedIn();
\OC::$server->getSession()->close();
-$query=(isset($_GET['query']))?$_GET['query']:'';
+if (isset($_GET['query'])) {
+ $query = $_GET['query'];
+} else {
+ $query = '';
+}
+if (isset($_GET['inApps'])) {
+ $inApps = $_GET['inApps'];
+ if (is_string($inApps)) {
+ $inApps = array($inApps);
+ }
+} else {
+ $inApps = array();
+}
if($query) {
- $result = \OC::$server->getSearch()->search($query);
+ $result = \OC::$server->getSearch()->search($query, $inApps);
OC_JSON::encodedPrint($result);
}
else {