From fe5eedd185b5b19aab4782b67a28558639512391 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 4 May 2004 14:36:42 +0000 Subject: [PATCH] Orphan creating feature -- go redirects to edit if the page doesn't exist, off by default --- includes/DefaultSettings.php | 5 ++++- includes/SearchEngine.php | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index cf47423c8e..d3dde9c717 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -354,5 +354,8 @@ $wgImportSources = array(); $wgMaxCredits = 0; # Text matching this regex will be recognised as spam -$wgSpamRegex = false; +$wgSpamRegex = false; + +# Go button goes straight to the edit screen if the article doesn't exist +$wgGoToEdit = false; ?> diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index da2267701f..19a081b302 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -424,19 +424,12 @@ class SearchEngine { function goResult() { - global $wgOut, $wgRequest; + global $wgOut, $wgRequest, $wgGoToEdit; global $wgDisableTextSearch; $fname = "SearchEngine::goResult"; $search = trim( $wgRequest->getText( "search" ) ); - # Entering an IP address goes to the contributions page - if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $search ) ) { - $title = Title::makeTitle( NS_SPECIAL, "Contributions" ); - $wgOut->redirect( $title->getFullUrl( "target=$search" ) ); - return; - } - # Try to go to page as entered. # $t = Title::newFromText( $search ); @@ -477,8 +470,22 @@ class SearchEngine { return; } + # Entering an IP address goes to the contributions page + if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $search ) ) { + $title = Title::makeTitle( NS_SPECIAL, "Contributions" ); + $wgOut->redirect( $title->getFullUrl( "target=$search" ) ); + return; + } + # No match, generate an edit URL $t = Title::newFromText( $this->mUsertext ); + + # If the feature is enabled, go straight to the edit page + if ( $wgGoToEdit ) { + $wgOut->redirect( $t->getFullURL( "action=edit" ) ); + return; + } + $wgOut->addHTML( "

" . wfMsg("nogomatch", $t->escapeLocalURL( "action=edit" ) ) . "

\n" ); # Try a fuzzy title search -- 2.20.1