| Index: trunk/extensions/LinkSearch/LinkSearch.php |
| — | — | @@ -14,6 +14,7 @@ |
| 15 | 15 | 'linksearch' => 'Search web links', |
| 16 | 16 | 'linksearch-text' => 'Wildcards such as "*.wikipedia.org" may be used.', |
| 17 | 17 | 'linksearch-line' => '$1 linked from $2', |
| | 18 | + 'linksearch-error' => 'Wildcards may appear only at the start of the hostname.' |
| 18 | 19 | ) |
| 19 | 20 | ); |
| 20 | 21 | |
| — | — | @@ -50,8 +51,7 @@ |
| 51 | 52 | $page = $dbr->tableName( 'page' ); |
| 52 | 53 | $externallinks = $dbr->tableName( 'externallinks' ); |
| 53 | 54 | |
| 54 | | - $search = self::mungeQuery( $this->mQuery ); |
| 55 | | - $encSearch = $dbr->addQuotes( $search ); |
| | 55 | + $encSearch = $dbr->addQuotes( $this->mQuery ); |
| 56 | 56 | |
| 57 | 57 | return |
| 58 | 58 | "SELECT |
| — | — | @@ -90,7 +90,7 @@ |
| 91 | 91 | $wgOut->addHtml( |
| 92 | 92 | wfOpenElement( 'form', |
| 93 | 93 | array( 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) . |
| 94 | | - wfHidden( 'title', $self->getPrefixedUrl() ) . |
| | 94 | + wfHidden( 'title', $self->getPrefixedDbKey() ) . |
| 95 | 95 | wfInput( 'target', 50, $target ) . |
| 96 | 96 | wfSubmitButton( wfMsg( 'search' ) ) . |
| 97 | 97 | wfCloseElement( 'form' ) ); |
| — | — | @@ -98,10 +98,14 @@ |
| 99 | 99 | if( $target != '' ) { |
| 100 | 100 | // For debugging |
| 101 | 101 | $search = LinkSearchPage::mungeQuery( $target ); |
| 102 | | - $wgOut->addHtml( "\n<!-- " . htmlspecialchars( $search ) . " -->\n" ); |
| 103 | | - |
| 104 | | - $searcher = new LinkSearchPage( $target ); |
| 105 | | - $searcher->doQuery( $offset, $limit ); |
| | 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 | + } |
| 106 | 110 | } |
| 107 | 111 | } |
| 108 | 112 | } |