Ticket #2386 (new Bug)
Patch for function wfSajaxSearchArticleFCKeditor
| Reported by: | tmanthey | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | Project : MediaWiki+FCKeditor | Version: | FCKeditor 2.6.2 |
| Keywords: | HasPatch Review? | Cc: |
Description
The function searches by default only the NS_MAIN namespace. It does not extract the namespace from search term and thus does not find articles that are not located in NS_MAIN.
The below code adds this functionality:
function wfSajaxSearchArticleFCKeditor( $term ) {
global $wgContLang, $wgOut,$wgExtraNamespaces;
$limit = 10;
$ns = NS_MAIN;
$term = $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) );
if (strpos($term, "Category:") === 0) {
$ns = NS_CATEGORY; $term = substr($term, 9); $prefix = "Category:";
} else if (strpos($term, ":Category:") === 0) {
$ns = NS_CATEGORY; $term = substr($term, 10); $prefix = ":Category:";
} else if (strpos($term,":")) {
$pos = strpos($term,":"); $find_ns = array_search(substr($term,0,$pos),$wgExtraNamespaces); if ($find_ns) {
$ns = $find_ns; $prefix = substr($term,0,$pos+1); $term = substr($term,$pos+1);
}
}