| Index: trunk/extensions/LinkSearch/LinkSearch.php |
| — | — | @@ -51,7 +51,7 @@ |
| 52 | 52 | $page = $dbr->tableName( 'page' ); |
| 53 | 53 | $externallinks = $dbr->tableName( 'externallinks' ); |
| 54 | 54 | |
| 55 | | - $encSearch = $dbr->addQuotes( $this->mQuery ); |
| | 55 | + $encSearch = $dbr->addQuotes( self::mungeQuery( $this->mQuery ) ); |
| 56 | 56 | |
| 57 | 57 | return |
| 58 | 58 | "SELECT |
| — | — | @@ -76,6 +76,21 @@ |
| 77 | 77 | |
| 78 | 78 | return wfMsgHtml( 'linksearch-line', $urlLink, $pageLink ); |
| 79 | 79 | } |
| | 80 | + |
| | 81 | + /** |
| | 82 | + * Override to check query validity. |
| | 83 | + */ |
| | 84 | + function doQuery( $offset, $limit ) { |
| | 85 | + global $wgOut; |
| | 86 | + $this->mMungedQuery = LinkSearchPage::mungeQuery( $this->mQuery ); |
| | 87 | + if( $this->mMungedQuery === false ) { |
| | 88 | + $wgOut->addWikiText( wfMsg( 'linksearch-error' ) ); |
| | 89 | + } else { |
| | 90 | + // For debugging |
| | 91 | + $wgOut->addHtml( "\n<!-- " . htmlspecialchars( $this->mMungedQuery ) . " -->\n" ); |
| | 92 | + parent::doQuery( $offset, $limit ); |
| | 93 | + } |
| | 94 | + } |
| 80 | 95 | |
| 81 | 96 | } |
| 82 | 97 | |
| — | — | @@ -96,16 +111,8 @@ |
| 97 | 112 | wfCloseElement( 'form' ) ); |
| 98 | 113 | |
| 99 | 114 | if( $target != '' ) { |
| 100 | | - // For debugging |
| 101 | | - $search = LinkSearchPage::mungeQuery( $target ); |
| 102 | | - if( $search === false ) { |
| 103 | | - $wgOut->addWikiText( wfMsg( 'linksearch-error' ) ); |
| 104 | | - } else { |
| 105 | | - $wgOut->addHtml( "\n<!-- " . htmlspecialchars( $search ) . " -->\n" ); |
| 106 | | - |
| 107 | | - $searcher = new LinkSearchPage( $search ); |
| 108 | | - $searcher->doQuery( $offset, $limit ); |
| 109 | | - } |
| | 115 | + $searcher = new LinkSearchPage( $target ); |
| | 116 | + $searcher->doQuery( $offset, $limit ); |
| 110 | 117 | } |
| 111 | 118 | } |
| 112 | 119 | } |