Index: trunk/phase3/includes/specials/SpecialSearch.php |
— | — | @@ -119,41 +119,7 @@ |
120 | 120 | wfProfileIn( __METHOD__ ); |
121 | 121 | |
122 | 122 | $sk = $wgUser->getSkin(); |
123 | | - |
124 | | - $beginSearchForm = Xml::openElement( |
125 | | - 'form', |
126 | | - array( |
127 | | - 'id' => ( $this->searchAdvanced ? 'powersearch' : 'search' ), |
128 | | - 'method' => 'get', |
129 | | - 'action' => $wgScript |
130 | | - ) |
131 | | - ); |
132 | | - $mwSearchTopTable = |
133 | | - Xml::openElement( 'table', array( 'id' => 'mw-search-top-table', 'border' => 0, 'cellpadding' => 0, 'cellspacing' => 0 ) ) . |
134 | | - Xml::openElement( 'tr' ) . |
135 | | - Xml::openElement( 'td' ) . "\n" . |
136 | | - $this->shortDialog( $term ) . |
137 | | - Xml::closeElement( 'td' ) . |
138 | | - Xml::closeElement( 'tr' ) . |
139 | | - Xml::closeElement( 'table' ); |
140 | | - |
141 | | - // moved to check for empty or null search string before running query |
142 | | - // to prevent NULL fulltext search error in SQL Server |
143 | | - $filePrefix = $wgContLang->getFormattedNsText( NS_FILE ) . ':'; |
144 | | - if ( trim( $term ) === '' || $filePrefix === trim( $term ) ) { |
145 | | - $wgOut->addHTML( $beginSearchForm ); |
146 | | - $wgOut->addHTML( $mwSearchTopTable ); |
147 | | - $wgOut->addHTML( $this->searchFocus() ); |
148 | | - $wgOut->addHTML( $this->formHeader( $term, 0, 0 ) ); |
149 | | - if ( $this->searchAdvanced ) { |
150 | | - $wgOut->addHTML( $this->powerSearchBox( $term ) ); |
151 | | - } |
152 | | - $wgOut->addHTML( Xml::closeElement( 'form' ) ); |
153 | | - // Empty query -- straight view of search form |
154 | | - wfProfileOut( __METHOD__ ); |
155 | | - return; |
156 | | - } |
157 | | - |
| 123 | + |
158 | 124 | $this->searchEngine = SearchEngine::create(); |
159 | 125 | $search =& $this->searchEngine; |
160 | 126 | $search->setLimitOffset( $this->limit, $this->offset ); |
— | — | @@ -228,10 +194,23 @@ |
229 | 195 | } |
230 | 196 | // start rendering the page |
231 | 197 | $wgOut->addHtml( |
232 | | - $beginSearchForm |
| 198 | + Xml::openElement( |
| 199 | + 'form', |
| 200 | + array( |
| 201 | + 'id' => ( $this->searchAdvanced ? 'powersearch' : 'search' ), |
| 202 | + 'method' => 'get', |
| 203 | + 'action' => $wgScript |
| 204 | + ) |
| 205 | + ) |
233 | 206 | ); |
234 | 207 | $wgOut->addHtml( |
235 | | - $mwSearchTopTable |
| 208 | + Xml::openElement( 'table', array( 'id'=>'mw-search-top-table', 'border'=>0, 'cellpadding'=>0, 'cellspacing'=>0 ) ) . |
| 209 | + Xml::openElement( 'tr' ) . |
| 210 | + Xml::openElement( 'td' ) . "\n" . |
| 211 | + $this->shortDialog( $term ) . |
| 212 | + Xml::closeElement('td') . |
| 213 | + Xml::closeElement('tr') . |
| 214 | + Xml::closeElement('table') |
236 | 215 | ); |
237 | 216 | |
238 | 217 | // Sometimes the search engine knows there are too many hits |
— | — | @@ -241,6 +220,19 @@ |
242 | 221 | return; |
243 | 222 | } |
244 | 223 | |
| 224 | + $filePrefix = $wgContLang->getFormattedNsText(NS_FILE).':'; |
| 225 | + if( trim( $term ) === '' || $filePrefix === trim( $term ) ) { |
| 226 | + $wgOut->addHTML( $this->searchFocus() ); |
| 227 | + $wgOut->addHTML( $this->formHeader($term, 0, 0)); |
| 228 | + if( $this->searchAdvanced ) { |
| 229 | + $wgOut->addHTML( $this->powerSearchBox( $term ) ); |
| 230 | + } |
| 231 | + $wgOut->addHTML( '</form>' ); |
| 232 | + // Empty query -- straight view of search form |
| 233 | + wfProfileOut( __METHOD__ ); |
| 234 | + return; |
| 235 | + } |
| 236 | + |
245 | 237 | // Get number of results |
246 | 238 | $titleMatchesNum = $titleMatches ? $titleMatches->numRows() : 0; |
247 | 239 | $textMatchesNum = $textMatches ? $textMatches->numRows() : 0; |