summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Lang <lang@cosmocode.de>2010-06-23 14:24:11 +0200
committerAdrian Lang <lang@cosmocode.de>2010-06-23 14:25:13 +0200
commitb0f6db0c1350beb85dcff044dc2770f404a1b540 (patch)
treea7675ad0f072a8a58733970b0c1a4209c183d5a7
parentbe6541cce13f8d09639459b791dbd5b20c54dbc7 (diff)
downloadrpg-b0f6db0c1350beb85dcff044dc2770f404a1b540.tar.gz
rpg-b0f6db0c1350beb85dcff044dc2770f404a1b540.tar.bz2
Support namespace selection in quicksearch
-rw-r--r--inc/fulltext.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/inc/fulltext.php b/inc/fulltext.php
index b6aac5c91..950e7f7d3 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -229,7 +229,13 @@ function ft_pageLookup($id, $not_in_ns=true, $not_in_title=true){
function _ft_pageLookup(&$data){
// split out original parameters
+
$id = $data['id'];
+ if (preg_match('/(?:^| )@(\w+)/', $id, $matches)) {
+ $ns = cleanID($matches[1]) . ':';
+ $id = str_replace($matches[0], '', $id);
+ }
+
$in_ns = !$data['not_in_ns'];
$in_title = !$data['not_in_title'];
@@ -241,8 +247,9 @@ function _ft_pageLookup(&$data){
$cleaned = cleanID($id);
$matched_pages = array();
foreach ($pages as $p_id => $p_title) {
- if ((strpos($in_ns ? $p_id : noNSorNS($p_id), $cleaned) !== false) ||
- ($in_title && stripos($p_title, $id) !== false)) {
+ if (((strpos($in_ns ? $p_id : noNSorNS($p_id), $cleaned) !== false) ||
+ ($in_title && stripos($p_title, $id) !== false)) &&
+ (!isset($ns) || strpos($p_id, $ns) === 0)) {
$matched_pages[$p_id] = $p_title;
}
}