summaryrefslogtreecommitdiff
path: root/inc/search.php
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-05-15 15:15:07 +0200
committerandi <andi@splitbrain.org>2005-05-15 15:15:07 +0200
commit63f2400befcdf463a6c6d34a9235e1c6e4b1e909 (patch)
tree92654208d7e3a460aa72f852ac56ad74234769e1 /inc/search.php
parent42ee9defc8cd47d809d5627779f9d9c867032238 (diff)
downloadrpg-63f2400befcdf463a6c6d34a9235e1c6e4b1e909.tar.gz
rpg-63f2400befcdf463a6c6d34a9235e1c6e4b1e909.tar.bz2
experimental AJAX quicksearch
This isn't perfect yet, but it works. It's tested in Mozilla Firefox only. Patches welcome! darcs-hash:20050515131507-9977f-5ad6c4483faec67f7ce7c980b5a2bd6d9e81012a.gz
Diffstat (limited to 'inc/search.php')
-rw-r--r--inc/search.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/inc/search.php b/inc/search.php
index 0b2e26c67..b368f6756 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -71,6 +71,38 @@ function search(&$data,$base,$func,$opts,$dir='',$lvl=1){
*/
/**
+ * Searches for pages beginning with the given query
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function search_qsearch(&$data,$base,$file,$type,$lvl,$opts){
+ $item = array();
+
+ if($type == 'd'){
+ return false; //no handling yet
+ }
+
+ //get id
+ $id = pathID($file);
+
+ //check if it matches the query
+ if(!preg_match('/^'.preg_quote($opts['query'],'/').'/u',$id)){
+ return false;
+ }
+
+ //check ACL
+ if(auth_quickaclcheck($id) < AUTH_READ){
+ return false;
+ }
+
+ $data[]=array( 'id' => $id,
+ 'type' => $type,
+ 'level' => 1,
+ 'open' => true);
+ return true;
+}
+
+/**
* Build the browsable index of pages
*
* $opts['ns'] is the current namespace