summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--feed.php25
-rw-r--r--inc/template.php6
2 files changed, 29 insertions, 2 deletions
diff --git a/feed.php b/feed.php
index db10cc3e6..ce8b26e28 100644
--- a/feed.php
+++ b/feed.php
@@ -59,6 +59,8 @@
if($opt['feed_mode'] == 'list'){
rssListNamespace($rss,$opt);
+ }elseif($opt['feed_mode'] == 'search'){
+ rssSearch($rss,$opt);
}else{
rssRecentChanges($rss,$opt);
}
@@ -88,6 +90,7 @@ function rss_parseOptions(){
$opt['namespace'] = $_REQUEST['ns'];
$opt['link_to'] = $_REQUEST['linkto'];
$opt['item_content'] = $_REQUEST['content'];
+ $opt['search_query'] = $_REQUEST['q'];
if(!$opt['feed_type']) $opt['feed_type'] = $conf['rss_type'];
if(!$opt['item_content']) $opt['item_content'] = $conf['rss_content'];
@@ -132,6 +135,11 @@ function rss_buildItems(&$rss,&$data,$opt){
global $lang;
foreach($data as $ditem){
+ if(!is_array($ditem)){
+ // not an array? then only a list of IDs was given
+ $ditem = array( 'id' => $ditem );
+ }
+
$item = new FeedItem();
$id = $ditem['id'];
$meta = p_get_metadata($id);
@@ -256,7 +264,7 @@ function rss_buildItems(&$rss,&$data,$opt){
/**
- * Add recent changed pages to a feed object
+ * Add recent changed pages to the feed object
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
@@ -273,7 +281,7 @@ function rssRecentChanges(&$rss,$opt){
}
/**
- * Add all pages of a namespace to a feedobject
+ * Add all pages of a namespace to the feed object
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
@@ -291,7 +299,20 @@ function rssListNamespace(&$rss,$opt){
rss_buildItems($rss,$data,$opt);
}
+/**
+ * Add the result of a full text search to the feed object
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function rssSearch(&$rss,$opt){
+ if(!$opt['search_query']) return;
+ require_once(DOKU_INC.'inc/fulltext.php');
+ $data = array();
+ $data = ft_pageSearch($opt['search_query'],$poswords);
+ $data = array_keys($data);
+ rss_buildItems($rss,$data,$opt);
+}
//Setup VIM: ex: et ts=4 enc=utf-8 :
?>
diff --git a/inc/template.php b/inc/template.php
index c941a64f4..c105ee258 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -181,6 +181,7 @@ function tpl_metaheaders($alt=true){
global $REV;
global $INFO;
global $ACT;
+ global $QUERY;
global $lang;
global $conf;
$it=2;
@@ -203,6 +204,11 @@ function tpl_metaheaders($alt=true){
$head['link'][] = array( 'rel'=>'alternate', 'type'=>'application/rss+xml',
'title'=>'Current Namespace',
'href'=>DOKU_BASE.'feed.php?mode=list&ns='.$INFO['namespace']);
+ if($ACT == 'search'){
+ $head['link'][] = array( 'rel'=>'alternate', 'type'=>'application/rss+xml',
+ 'title'=>'Search Result',
+ 'href'=>DOKU_BASE.'feed.php?mode=search&q='.$QUERY);
+ }
if(actionOK('export_xhtml')){
$head['link'][] = array( 'rel'=>'alternate', 'type'=>'text/html', 'title'=>'Plain HTML',