+class SpecialSearch extends SpecialPage {
+ /**
+ * Current search profile. Search profile is just a name that identifies
+ * the active search tab on the search page (content, help, discussions...)
+ * For users tt replaces the set of enabled namespaces from the query
+ * string when applicable. Extensions can add new profiles with hooks
+ * with custom search options just for that profile.
+ * null|string
+ */
+ protected $profile;
+ function getProfile() { return $this->profile; }
+
+ /// Search engine
+ protected $searchEngine;
+
+ /// For links
+ protected $extraParams = array();
+
+ /// No idea, apparently used by some other classes
+ protected $mPrefix;
+
+ /**
+ * @var int
+ */
+ protected $limit, $offset;
+
+ /**
+ * @var array
+ */
+ protected $namespaces;
+ function getNamespaces() { return $this->namespaces; }
+
+ /**
+ * @var bool
+ */
+ protected $searchRedirects;
+
+ /**
+ * @var string
+ */
+ protected $didYouMeanHtml, $fulltext;
+
+ const NAMESPACES_CURRENT = 'sense';
+
+ public function __construct() {
+ parent::__construct( 'Search' );
+ }
+
+ /**
+ * Entry point
+ *
+ * @param $par String or null
+ */
+ public function execute( $par ) {
+ $this->setHeaders();
+ $this->outputHeader();
+ $out = $this->getOutput();
+ $out->allowClickjacking();
+ $out->addModuleStyles( 'mediawiki.special' );
+
+ // Strip underscores from title parameter; most of the time we'll want
+ // text form here. But don't strip underscores from actual text params!
+ $titleParam = str_replace( '_', ' ', $par );
+
+ $request = $this->getRequest();
+
+ // Fetch the search term
+ $search = str_replace( "\n", " ", $request->getText( 'search', $titleParam ) );
+
+ $this->load();
+
+ if ( $request->getVal( 'fulltext' )
+ || !is_null( $request->getVal( 'offset' ) )
+ || !is_null( $request->getVal( 'searchx' ) ) )
+ {
+ $this->showResults( $search );
+ } else {
+ $this->goResult( $search );
+ }
+ }