function wfSpecialLinkSearch( $par ) {
list( $limit, $offset ) = wfCheckLimits();
- global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode;
+ global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode, $wgLang;
$target = $GLOBALS['wgRequest']->getVal( 'target', $par );
$namespace = $GLOBALS['wgRequest']->getIntorNull( 'namespace', null );
$self = Title::makeTitle( NS_SPECIAL, 'Linksearch' );
- $wgOut->addWikiText( wfMsg( 'linksearch-text', '<nowiki>' . implode( ', ', $wgUrlProtocols) . '</nowiki>' ) );
+ $wgOut->addWikiMsg( 'linksearch-text', '<nowiki>' . $wgLang->commaList( $wgUrlProtocols ) . '</nowiki>' );
$s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) .
Xml::hidden( 'title', $self->getPrefixedDbKey() ) .
'<fieldset>' .
$s .= Xml::submitButton( wfMsg( 'linksearch-ok' ) ) .
'</fieldset>' .
Xml::closeElement( 'form' );
- $wgOut->addHtml( $s );
+ $wgOut->addHTML( $s );
if( $target != '' ) {
$searcher = new LinkSearchPage;
*/
static function mungeQuery( $query , $prot ) {
$field = 'el_index';
- $rv = LinkFilter::makeLike( $query , $prot );
+ $rv = LinkFilter::makeLikeArray( $query , $prot );
if ($rv === false) {
//makeLike doesn't handle wildcard in IP, so we'll have to munge here.
if (preg_match('/^(:?[0-9]{1,3}\.)+\*\s*$|^(:?[0-9]{1,3}\.){3}[0-9]{1,3}:[0-9]*\*\s*$/', $query)) {
- $rv = $prot . rtrim($query, " \t*") . '%';
+ $rv = array( $prot . rtrim($query, " \t*"), $dbr->anyString() );
$field = 'el_to';
}
}
/* strip everything past first wildcard, so that index-based-only lookup would be done */
list( $munged, $clause ) = self::mungeQuery( $this->mQuery, $this->mProt );
- $stripped = substr($munged,0,strpos($munged,'%')+1);
- $encSearch = $dbr->addQuotes( $stripped );
+ $stripped = LinkFilter::keepOneWildcard( $munged );
+ $like = $dbr->buildLike( $stripped );
$encSQL = '';
if ( isset ($this->mNs) && !$wgMiserMode )
$externallinks $use_index
WHERE
page_id=el_from
- AND $clause LIKE $encSearch
+ AND $clause $like
$encSQL";
}
function formatResult( $skin, $result ) {
$title = Title::makeTitle( $result->namespace, $result->title );
$url = $result->url;
- $pageLink = $skin->makeKnownLinkObj( $title );
+ $pageLink = $skin->linkKnown( $title );
$urlLink = $skin->makeExternalLink( $url, $url );
return wfMsgHtml( 'linksearch-line', $urlLink, $pageLink );
global $wgOut;
list( $this->mMungedQuery, $clause ) = LinkSearchPage::mungeQuery( $this->mQuery, $this->mProt );
if( $this->mMungedQuery === false ) {
- $wgOut->addWikiText( wfMsg( 'linksearch-error' ) );
+ $wgOut->addWikiMsg( 'linksearch-error' );
} else {
// For debugging
// Generates invalid xhtml with patterns that contain --
- //$wgOut->addHtml( "\n<!-- " . htmlspecialchars( $this->mMungedQuery ) . " -->\n" );
+ //$wgOut->addHTML( "\n<!-- " . htmlspecialchars( $this->mMungedQuery ) . " -->\n" );
parent::doQuery( $offset, $limit, $shownavigation );
}
}