r50374 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50373‎ | r50374 | r50375 >
Date:17:35, 9 May 2009
Author:catrope
Status:deferred
Tags:
Comment:
querypage-work: Merge latest revisions from trunk
Modified paths:
  • /branches/querypage-work/phase3/includes/QueryPage.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialBlockip.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialBooksources.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialBrokenRedirects.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialCategories.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialCreatePage.php (added) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialDeletedContributions.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialDoubleRedirects.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialExport.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialFileDuplicateSearch.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialIpblocklist.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialListfiles.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialListgrouprights.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialListredirects.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialListusers.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMIMEsearch.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMergeHistory.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMostlinked.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMostlinkedcategories.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMostlinkedtemplates.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMovepage.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialNewimages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialNewpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialPreferences.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialProtectedpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialProtectedtitles.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialRandompage.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialRemoveRestrictions.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialSearch.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialShortpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUndelete.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUnusedcategories.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUserlogin.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialVersion.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialWantedcategories.php (modified) (history)

Diff [purge]

Index: branches/querypage-work/phase3/includes/QueryPage.php
@@ -658,7 +658,7 @@
659659 if( $title instanceof Title ) {
660660 if( $this->isCached() ) {
661661 $pageLink = $title->exists()
662 - ? '<s>' . $skin->makeLinkObj( $title ) . '</s>'
 662+ ? '<s>' . $skin->link( $title ) . '</s>'
663663 : $skin->makeBrokenLinkObj( $title );
664664 } else {
665665 $pageLink = $skin->makeBrokenLinkObj( $title );
Property changes on: branches/querypage-work/phase3/includes/QueryPage.php
___________________________________________________________________
Modified: svn:mergeinfo
666666 Merged /trunk/phase3/includes/QueryPage.php:r49490-50372
Index: branches/querypage-work/phase3/includes/specials/SpecialSearch.php
@@ -37,8 +37,8 @@
3838 $search = str_replace( "\n", " ", $wgRequest->getText( 'search', $titleParam ) );
3939 $class = $wgUseOldSearchUI ? 'SpecialSearchOld' : 'SpecialSearch';
4040 $searchPage = new $class( $wgRequest, $wgUser );
41 - if( $wgRequest->getVal( 'fulltext' )
42 - || !is_null( $wgRequest->getVal( 'offset' ))
 41+ if( $wgRequest->getVal( 'fulltext' )
 42+ || !is_null( $wgRequest->getVal( 'offset' ))
4343 || !is_null( $wgRequest->getVal( 'searchx' )) )
4444 {
4545 $searchPage->showResults( $search );
@@ -74,7 +74,7 @@
7575 $this->active = 'advanced';
7676 $this->sk = $user->getSkin();
7777 $this->didYouMeanHtml = ''; # html of did you mean... link
78 - $this->fulltext = $request->getVal('fulltext');
 78+ $this->fulltext = $request->getVal('fulltext');
7979 }
8080
8181 /**
@@ -116,9 +116,9 @@
117117 public function showResults( $term ) {
118118 global $wgOut, $wgUser, $wgDisableTextSearch, $wgContLang;
119119 wfProfileIn( __METHOD__ );
120 -
 120+
121121 $sk = $wgUser->getSkin();
122 -
 122+
123123 $this->searchEngine = SearchEngine::create();
124124 $search =& $this->searchEngine;
125125 $search->setLimitOffset( $this->limit, $this->offset );
@@ -126,9 +126,9 @@
127127 $search->showRedirects = $this->searchRedirects;
128128 $search->prefix = $this->mPrefix;
129129 $term = $search->transformSearchTerm($term);
130 -
 130+
131131 $this->setupPage( $term );
132 -
 132+
133133 if( $wgDisableTextSearch ) {
134134 global $wgSearchForwardUrl;
135135 if( $wgSearchForwardUrl ) {
@@ -152,10 +152,10 @@
153153 wfProfileOut( __METHOD__ );
154154 return;
155155 }
156 -
 156+
157157 $t = Title::newFromText( $term );
158 -
159 - // fetch search results
 158+
 159+ // fetch search results
160160 $rewritten = $search->replacePrefixes($term);
161161
162162 $titleMatches = $search->searchTitle( $rewritten );
@@ -168,8 +168,8 @@
169169 # mirror Go/Search behaviour of original request ..
170170 $didYouMeanParams = array( 'search' => $textMatches->getSuggestionQuery() );
171171 if($this->fulltext != NULL)
172 - $didYouMeanParams['fulltext'] = $this->fulltext;
173 - $stParams = wfArrayToCGI(
 172+ $didYouMeanParams['fulltext'] = $this->fulltext;
 173+ $stParams = wfArrayToCGI(
174174 $didYouMeanParams,
175175 $this->powerSearchOptions()
176176 );
@@ -179,9 +179,9 @@
180180
181181 $this->didYouMeanHtml = '<div class="searchdidyoumean">'.wfMsg('search-suggest',$suggestLink).'</div>';
182182 }
183 -
184 - // start rendering the page
185 - $wgOut->addHtml(
 183+
 184+ // start rendering the page
 185+ $wgOut->addHtml(
186186 Xml::openElement( 'table', array( 'border'=>0, 'cellpadding'=>0, 'cellspacing'=>0 ) ) .
187187 Xml::openElement( 'tr' ) .
188188 Xml::openElement( 'td' ) . "\n" .
@@ -190,14 +190,14 @@
191191 Xml::closeElement('tr') .
192192 Xml::closeElement('table')
193193 );
194 -
 194+
195195 // Sometimes the search engine knows there are too many hits
196196 if( $titleMatches instanceof SearchResultTooMany ) {
197197 $wgOut->addWikiText( '==' . wfMsg( 'toomanymatches' ) . "==\n" );
198198 wfProfileOut( __METHOD__ );
199199 return;
200200 }
201 -
 201+
202202 $filePrefix = $wgContLang->getFormattedNsText(NS_FILE).':';
203203 if( '' === trim( $term ) || $filePrefix === trim( $term ) ) {
204204 $wgOut->addHTML( $this->searchAdvanced ? $this->powerSearchFocus() : $this->searchFocus() );
@@ -206,54 +206,54 @@
207207 return;
208208 }
209209
210 - // show direct page/create link
211 - if( !is_null($t) ) {
212 - if( !$t->exists() ) {
213 - $wgOut->addWikiMsg( 'searchmenu-new', wfEscapeWikiText( $t->getPrefixedText() ) );
214 - } else {
215 - $wgOut->addWikiMsg( 'searchmenu-exists', wfEscapeWikiText( $t->getPrefixedText() ) );
216 - }
217 - }
218210
219211 // Get number of results
220 - $titleMatchesSQL = $titleMatches ? $titleMatches->numRows() : 0;
221 - $textMatchesSQL = $textMatches ? $textMatches->numRows() : 0;
 212+ $titleMatchesNum = $titleMatches ? $titleMatches->numRows() : 0;
 213+ $textMatchesNum = $textMatches ? $textMatches->numRows() : 0;
222214 // Total initial query matches (possible false positives)
223 - $numSQL = $titleMatchesSQL + $textMatchesSQL;
 215+ $num = $titleMatchesNum + $textMatchesNum;
 216+
224217 // Get total actual results (after second filtering, if any)
225218 $numTitleMatches = $titleMatches && !is_null( $titleMatches->getTotalHits() ) ?
226 - $titleMatches->getTotalHits() : $titleMatchesSQL;
 219+ $titleMatches->getTotalHits() : $titleMatchesNum;
227220 $numTextMatches = $textMatches && !is_null( $textMatches->getTotalHits() ) ?
228 - $textMatches->getTotalHits() : $textMatchesSQL;
229 - $totalRes = $numTitleMatches + $numTextMatches;
 221+ $textMatches->getTotalHits() : $textMatchesNum;
230222
 223+ // get total number of results if backend can calculate it
 224+ $totalRes = 0;
 225+ if($titleMatches && !is_null( $titleMatches->getTotalHits() ) )
 226+ $totalRes += $titleMatches->getTotalHits();
 227+ if($textMatches && !is_null( $textMatches->getTotalHits() ))
 228+ $totalRes += $textMatches->getTotalHits();
 229+
231230 // show number of results and current offset
232 - if( $numSQL > 0 ) {
233 - if( $numSQL > 0 ) {
234 - $top = wfMsgExt('showingresultstotal', array( 'parseinline' ),
235 - $this->offset+1, $this->offset+$numSQL, $totalRes, $numSQL );
236 - } elseif( $numSQL >= $this->limit ) {
237 - $top = wfShowingResults( $this->offset, $this->limit );
 231+ $wgOut->addHTML( $this->formHeader($term, $num, $totalRes));
 232+
 233+ $wgOut->addHtml( "<div class='searchresults'>" );
 234+
 235+ // show direct page/create link
 236+ if( !is_null($t) ) {
 237+ if( !$t->exists() ) {
 238+ $wgOut->addWikiMsg( 'searchmenu-new', wfEscapeWikiText( $t->getPrefixedText() ) );
238239 } else {
239 - $top = wfShowingResultsNum( $this->offset, $this->limit, $numSQL );
 240+ $wgOut->addWikiMsg( 'searchmenu-exists', wfEscapeWikiText( $t->getPrefixedText() ) );
240241 }
241 - $wgOut->addHTML( "<p class='mw-search-numberresults'>{$top}</p>\n" );
242242 }
243243
244244 // prev/next links
245 - if( $numSQL || $this->offset ) {
 245+ if( $num || $this->offset ) {
246246 $prevnext = wfViewPrevNext( $this->offset, $this->limit,
247247 SpecialPage::getTitleFor( 'Search' ),
248248 wfArrayToCGI( $this->powerSearchOptions(), array( 'search' => $term ) ),
249 - max( $titleMatchesSQL, $textMatchesSQL ) < $this->limit
 249+ max( $titleMatchesNum, $textMatchesNum ) < $this->limit
250250 );
251 - $wgOut->addHTML( "<p class='mw-search-pager-top'>{$prevnext}</p>\n" );
 251+ //$wgOut->addHTML( "<p class='mw-search-pager-top'>{$prevnext}</p>\n" );
252252 wfRunHooks( 'SpecialSearchResults', array( $term, &$titleMatches, &$textMatches ) );
253253 } else {
254254 wfRunHooks( 'SpecialSearchNoResults', array( $term ) );
255 - }
 255+ }
256256
257 - $wgOut->addHtml( "<div class='searchresults'>" );
 257+
258258 if( $titleMatches ) {
259259 if( $numTitleMatches > 0 ) {
260260 $wgOut->wrapWikiMsg( "==$1==\n", 'titlematches' );
@@ -265,10 +265,10 @@
266266 // output appropriate heading
267267 if( $numTextMatches > 0 && $numTitleMatches > 0 ) {
268268 // if no title matches the heading is redundant
269 - $wgOut->wrapWikiMsg( "==$1==\n", 'textmatches' );
 269+ $wgOut->wrapWikiMsg( "==$1==\n", 'textmatches' );
270270 } elseif( $totalRes == 0 ) {
271271 # Don't show the 'no text matches' if we received title matches
272 - $wgOut->wrapWikiMsg( "==$1==\n", 'notextmatches' );
 272+ # $wgOut->wrapWikiMsg( "==$1==\n", 'notextmatches' );
273273 }
274274 // show interwiki results if any
275275 if( $textMatches->hasInterwikiResults() ) {
@@ -281,20 +281,20 @@
282282
283283 $textMatches->free();
284284 }
285 - if( $totalRes === 0 ) {
 285+ if( $num === 0 ) {
286286 $wgOut->addWikiMsg( 'search-nonefound' );
287287 }
288288 $wgOut->addHtml( "</div>" );
289 - if( $totalRes === 0 ) {
 289+ if( $num === 0 ) {
290290 $wgOut->addHTML( $this->searchAdvanced ? $this->powerSearchFocus() : $this->searchFocus() );
291291 }
292292
293 - if( $numSQL || $this->offset ) {
 293+ if( $num || $this->offset ) {
294294 $wgOut->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
295295 }
296296 wfProfileOut( __METHOD__ );
297297 }
298 -
 298+
299299 /**
300300 *
301301 */
@@ -304,14 +304,14 @@
305305 $nsAllSet = array_keys( SearchEngine::searchableNamespaces() );
306306 if( $this->searchAdvanced )
307307 $this->active = 'advanced';
308 - else if( $this->namespaces === NS_FILE || $this->startsWithImage( $term ) )
 308+ else if( $this->namespaces === array(NS_FILE) || $this->startsWithImage( $term ) )
309309 $this->active = 'images';
310 - elseif( $this->namespaces === $nsAllSet )
 310+ elseif( $this->namespaces === $nsAllSet || $this->startsWithAll( $term ) )
311311 $this->active = 'all';
312312 elseif( $this->namespaces === SearchEngine::defaultNamespaces() )
313313 $this->active = 'default';
314 - elseif( $this->namespaces === SearchEngine::projectNamespaces() )
315 - $this->active = 'project';
 314+ elseif( $this->namespaces === SearchEngine::helpNamespaces() )
 315+ $this->active = 'help';
316316 else
317317 $this->active = 'advanced';
318318 # Should advanced UI be used?
@@ -319,7 +319,7 @@
320320 if( !empty( $term ) ) {
321321 $wgOut->setPageTitle( wfMsg( 'searchresults') );
322322 $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'searchresults-title', $term ) ) );
323 - }
 323+ }
324324 $wgOut->setArticleRelated( false );
325325 $wgOut->setRobotPolicy( 'noindex,nofollow' );
326326 }
@@ -358,8 +358,8 @@
359359 }
360360
361361 /**
362 - * Show whole set of results
363 - *
 362+ * Show whole set of results
 363+ *
364364 * @param SearchResultSet $matches
365365 */
366366 protected function showMatches( &$matches ) {
@@ -433,13 +433,13 @@
434434 ."</span>";
435435 $section = '';
436436 if( !is_null($sectionTitle) )
437 - $section = "<span class='searchalttitle'>"
 437+ $section = "<span class='searchalttitle'>"
438438 .wfMsg('search-section', $this->sk->makeKnownLinkObj( $sectionTitle, $sectionText))
439439 ."</span>";
440440
441441 // format text extract
442442 $extract = "<div class='searchresult'>".$result->getTextSnippet($terms)."</div>";
443 -
 443+
444444 // format score
445445 if( is_null( $result->getScore() ) ) {
446446 // Search engine doesn't report scoring info
@@ -465,7 +465,7 @@
466466 $stParams = wfArrayToCGI( $this->powerSearchOptions(),
467467 array('search' => wfMsgForContent('searchrelated').':'.$t->getPrefixedText(),
468468 'fulltext' => wfMsg('search') ));
469 -
 469+
470470 $related = ' -- ' . $sk->makeKnownLinkObj( $st,
471471 wfMsg('search-relatedarticle'), $stParams );
472472 }
@@ -508,7 +508,7 @@
509509
510510 /**
511511 * Show results from other wikis
512 - *
 512+ *
513513 * @param SearchResultSet $matches
514514 */
515515 protected function showInterwiki( &$matches, $query ) {
@@ -517,7 +517,7 @@
518518 $terms = $wgContLang->convertForSearchResult( $matches->termMatches() );
519519
520520 $out = "<div id='mw-search-interwiki'><div id='mw-search-interwiki-caption'>".
521 - wfMsg('search-interwiki-caption')."</div>\n";
 521+ wfMsg('search-interwiki-caption')."</div>\n";
522522 $off = $this->offset + 1;
523523 $out .= "<ul class='mw-search-iwresults'>\n";
524524
@@ -527,9 +527,9 @@
528528 foreach($customLines as $line) {
529529 $parts = explode(":",$line,2);
530530 if(count($parts) == 2) // validate line
531 - $customCaptions[$parts[0]] = $parts[1];
 531+ $customCaptions[$parts[0]] = $parts[1];
532532 }
533 -
 533+
534534 $prev = null;
535535 while( $result = $matches->next() ) {
536536 $out .= $this->showInterwikiHit( $result, $prev, $terms, $query, $customCaptions );
@@ -543,25 +543,25 @@
544544 wfProfileOut( __METHOD__ );
545545 return $out;
546546 }
547 -
 547+
548548 /**
549549 * Show single interwiki link
550550 *
551551 * @param SearchResult $result
552552 * @param string $lastInterwiki
553553 * @param array $terms
554 - * @param string $query
 554+ * @param string $query
555555 * @param array $customCaptions iw prefix -> caption
556556 */
557557 protected function showInterwikiHit( $result, $lastInterwiki, $terms, $query, $customCaptions) {
558558 wfProfileIn( __METHOD__ );
559559 global $wgContLang, $wgLang;
560 -
 560+
561561 if( $result->isBrokenTitle() ) {
562562 wfProfileOut( __METHOD__ );
563563 return "<!-- Broken link in search result -->\n";
564564 }
565 -
 565+
566566 $t = $result->getTitle();
567567
568568 $link = $this->sk->makeKnownLinkObj( $t, $result->getTitleSnippet($terms));
@@ -576,31 +576,31 @@
577577 ."</span>";
578578
579579 $out = "";
580 - // display project name
 580+ // display project name
581581 if(is_null($lastInterwiki) || $lastInterwiki != $t->getInterwiki()) {
582582 if( key_exists($t->getInterwiki(),$customCaptions) )
583583 // captions from 'search-interwiki-custom'
584584 $caption = $customCaptions[$t->getInterwiki()];
585585 else{
586 - // default is to show the hostname of the other wiki which might suck
 586+ // default is to show the hostname of the other wiki which might suck
587587 // if there are many wikis on one hostname
588588 $parsed = parse_url($t->getFullURL());
589 - $caption = wfMsg('search-interwiki-default', $parsed['host']);
590 - }
 589+ $caption = wfMsg('search-interwiki-default', $parsed['host']);
 590+ }
591591 // "more results" link (special page stuff could be localized, but we might not know target lang)
592 - $searchTitle = Title::newFromText($t->getInterwiki().":Special:Search");
 592+ $searchTitle = Title::newFromText($t->getInterwiki().":Special:Search");
593593 $searchLink = $this->sk->makeKnownLinkObj( $searchTitle, wfMsg('search-interwiki-more'),
594 - wfArrayToCGI(array('search' => $query, 'fulltext' => 'Search')));
 594+ wfArrayToCGI(array('search' => $query, 'fulltext' => 'Search')));
595595 $out .= "</ul><div class='mw-search-interwiki-project'><span class='mw-search-interwiki-more'>
596596 {$searchLink}</span>{$caption}</div>\n<ul>";
597597 }
598598
599 - $out .= "<li>{$link} {$redirect}</li>\n";
 599+ $out .= "<li>{$link} {$redirect}</li>\n";
600600 wfProfileOut( __METHOD__ );
601601 return $out;
602602 }
603 -
604603
 604+
605605 /**
606606 * Generates the power search box at bottom of [[Special:Search]]
607607 * @param $term string: search term
@@ -619,13 +619,13 @@
620620 array( 'type' => 'text') );
621621 $searchButton = Xml::submitButton( wfMsg( 'powersearch' ) ) . "\n";
622622 $searchTitle = SpecialPage::getTitleFor( 'Search' );
623 -
 623+
624624 $redirectText = '';
625 - // show redirects check only if backend supports it
 625+ // show redirects check only if backend supports it
626626 if( $this->searchEngine->acceptListRedirects() ) {
627627 $redirectText = "<p>". $redirect . " " . $redirectLabel ."</p>";
628628 }
629 -
 629+
630630 $out = Xml::openElement( 'form', array( 'id' => 'powersearch', 'method' => 'get', 'action' => $wgScript ) ) .
631631 Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . "\n" .
632632 "<p>" .
@@ -633,7 +633,7 @@
634634 "</p>\n" .
635635 '<input type="hidden" name="advanced" value="'.$this->searchAdvanced."\"/>\n".
636636 $tables .
637 - "<hr style=\"clear: both;\" />\n".
 637+ "<hr style=\"clear: both;\" />\n".
638638 $redirectText ."\n".
639639 "<div style=\"padding-top:2px;padding-bottom:2px;\">".
640640 $searchField .
@@ -648,10 +648,10 @@
649649 } */
650650 return Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) .
651651 Xml::element( 'legend', null, wfMsg('powersearch-legend') ) .
652 - $this->formHeader($term) . $out . $this->didYouMeanHtml .
 652+ $out . $this->didYouMeanHtml .
653653 Xml::closeElement( 'fieldset' );
654654 }
655 -
 655+
656656 protected function searchFocus() {
657657 global $wgJsMimeType;
658658 return "<script type=\"$wgJsMimeType\">" .
@@ -670,70 +670,87 @@
671671 "</script>";
672672 }
673673
674 - protected function formHeader( $term ) {
 674+ protected function formHeader( $term, $resultsShown, $totalNum ) {
675675 global $wgContLang, $wgCanonicalNamespaceNames, $wgLang;
676 -
 676+
677677 $sep = '&nbsp;&nbsp;&nbsp;';
678 - $out = Xml::openElement('div', array( 'style' => 'padding-bottom:0.5em;' ) );
 678+ $out = Xml::openElement('div', array( 'class' => 'mw-search-formheader' ) );
 679+ $out .= Xml::openElement('div');
679680
680681 $bareterm = $term;
681682 if( $this->startsWithImage( $term ) )
682683 $bareterm = substr( $term, strpos( $term, ':' ) + 1 ); // delete all/image prefix
683 -
 684+
684685 $nsAllSet = array_keys( SearchEngine::searchableNamespaces() );
685686
686687 // search profiles headers
687688 $m = wfMsg( 'searchprofile-articles' );
688 - $tt = wfMsg( 'searchprofile-articles-tooltip',
 689+ $tt = wfMsg( 'searchprofile-articles-tooltip',
689690 $wgLang->commaList( SearchEngine::namespacesAsText( SearchEngine::defaultNamespaces() ) ) );
 691+ $tt = Sanitizer::decodeCharReferences( $tt ); // need to allow entities
690692 if( $this->active == 'default' ) {
691 - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
 693+ $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
692694 } else {
693695 $out .= $this->makeSearchLink( $bareterm, SearchEngine::defaultNamespaces(), $m, $tt );
694696 }
695697 $out .= $sep;
696 -
 698+
697699 $m = wfMsg( 'searchprofile-images' );
698700 $tt = wfMsg( 'searchprofile-images-tooltip' );
699701 if( $this->active == 'images' ) {
700 - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
 702+ $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
701703 } else {
702 - $imageTextForm = $wgContLang->getFormattedNsText(NS_FILE).':'.$bareterm;
703 - $out .= $this->makeSearchLink( $imageTextForm, array( NS_FILE ) , $m, $tt );
 704+ $out .= $this->makeSearchLink( $bareterm, array( NS_FILE ) , $m, $tt );
704705 }
705706 $out .= $sep;
706707
707708 $m = wfMsg( 'searchprofile-project' );
708 - $tt = wfMsg( 'searchprofile-project-tooltip',
709 - $wgLang->commaList( SearchEngine::namespacesAsText( SearchEngine::projectNamespaces() ) ) );
710 - if( $this->active == 'project' ) {
711 - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
 709+ $tt = wfMsg( 'searchprofile-project-tooltip',
 710+ $wgLang->commaList( SearchEngine::namespacesAsText( SearchEngine::helpNamespaces() ) ) );
 711+ $tt = Sanitizer::decodeCharReferences( $tt ); // need to allow entities
 712+ if( $this->active == 'help' ) {
 713+ $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
712714 } else {
713 - $out .= $this->makeSearchLink( $bareterm, SearchEngine::projectNamespaces(), $m, $tt );
 715+ $out .= $this->makeSearchLink( $bareterm, SearchEngine::helpNamespaces(), $m, $tt );
714716 }
715717 $out .= $sep;
716 -
 718+
717719 $m = wfMsg( 'searchprofile-everything' );
718720 $tt = wfMsg( 'searchprofile-everything-tooltip' );
719721 if( $this->active == 'all' ) {
720 - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
 722+ $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
721723 } else {
722724 $out .= $this->makeSearchLink( $bareterm, $nsAllSet, $m, $tt );
723725 }
724726 $out .= $sep;
725 -
 727+
726728 $m = wfMsg( 'searchprofile-advanced' );
727729 $tt = wfMsg( 'searchprofile-advanced-tooltip' );
728730 if( $this->active == 'advanced' ) {
729 - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
 731+ $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m );
730732 } else {
731733 $out .= $this->makeSearchLink( $bareterm, $this->namespaces, $m, $tt, array( 'advanced' => '1' ) );
732734 }
733735 $out .= Xml::closeElement('div') ;
734736
 737+ if ( $resultsShown > 0 ) {
 738+ if ( $totalNum > 0 ){
 739+ $top = wfMsgExt('showingresultsheader', array( 'parseinline' ),
 740+ $this->offset+1, $this->offset+$resultsShown, $totalNum, $term, $resultsShown );
 741+ } elseif ( $resultsShown >= $this->limit ) {
 742+ $top = wfShowingResults( $this->offset, $this->limit );
 743+ } else {
 744+ $top = wfShowingResultsNum( $this->offset, $this->limit, $resultsShown );
 745+ }
 746+ $out .= "<p>{$top}</p>\n";
 747+ } else
 748+ $out .= "<p>&nbsp;</p>\n";
 749+
 750+ $out .= Xml::closeElement('div') ;
 751+
735752 return $out;
736753 }
737 -
 754+
738755 protected function shortDialog( $term ) {
739756 global $wgScript;
740757 $searchTitle = SpecialPage::getTitleFor( 'Search' );
@@ -760,19 +777,16 @@
761778 $out .= Xml::input( 'search', 50, $term, array( 'type' => 'text', 'id' => 'searchText' ) ) . "\n";
762779 $out .= Xml::hidden( 'fulltext', 'Search' );
763780 $out .= Xml::submitButton( wfMsg( 'searchbutton' ) );
764 - $out .= ' (' . wfMsgExt('searchmenu-help',array('parseinline') ) . ')';
 781+ //$out .= ' (' . wfMsgExt('searchmenu-help',array('parseinline') ) . ')';
765782 $out .= Xml::closeElement( 'form' );
766783 // Add prefix link for single-namespace searches
767784 $t = Title::newFromText( $term );
768785 /*if( $t != null && count($this->namespaces) === 1 ) {
769786 $out .= wfMsgExt( 'searchmenu-prefix', array('parseinline'), $term );
770787 }*/
771 - return Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) .
772 - Xml::element( 'legend', null, wfMsg('searchmenu-legend') ) .
773 - $this->formHeader($term) . $out . $this->didYouMeanHtml .
774 - Xml::closeElement( 'fieldset' );
 788+ return $out . $this->didYouMeanHtml;
775789 }
776 -
 790+
777791 /** Make a search link with some target namespaces */
778792 protected function makeSearchLink( $term, $namespaces, $label, $tooltip, $params=array() ) {
779793 $opt = $params;
@@ -781,18 +795,18 @@
782796 }
783797 $opt['redirs'] = $this->searchRedirects ? 1 : 0;
784798
785 - $st = SpecialPage::getTitleFor( 'Search' );
 799+ $st = SpecialPage::getTitleFor( 'Search' );
786800 $stParams = wfArrayToCGI( array( 'search' => $term, 'fulltext' => wfMsg( 'search' ) ), $opt );
787801
788 - return Xml::element( 'a',
789 - array( 'href'=> $st->getLocalURL( $stParams ), 'title' => $tooltip ),
790 - $label );
 802+ return Xml::element( 'a',
 803+ array( 'href'=> $st->getLocalURL( $stParams ), 'title' => $tooltip ),
 804+ $label );
791805 }
792 -
 806+
793807 /** Check if query starts with image: prefix */
794808 protected function startsWithImage( $term ) {
795809 global $wgContLang;
796 -
 810+
797811 $p = explode( ':', $term );
798812 if( count( $p ) > 1 ) {
799813 return $wgContLang->getNsIndex( $p[0] ) == NS_FILE;
@@ -800,6 +814,18 @@
801815 return false;
802816 }
803817
 818+ /** Check if query starts with all: prefix */
 819+ protected function startsWithAll( $term ) {
 820+
 821+ $allkeyword = wfMsgForContent('searchall');
 822+
 823+ $p = explode( ':', $term );
 824+ if( count( $p ) > 1 ) {
 825+ return $p[0] == $allkeyword;
 826+ }
 827+ return false;
 828+ }
 829+
804830 protected function namespaceTables( $namespaces, $rowsPerTable = 3 ) {
805831 global $wgContLang;
806832 // Group namespaces into rows according to subject.
@@ -861,7 +887,7 @@
862888 }
863889
864890 $this->searchRedirects = $request->getcheck( 'redirs' ) ? true : false;
865 - $this->fulltext = $request->getVal('fulltext');
 891+ $this->fulltext = $request->getVal('fulltext');
866892 }
867893
868894 /**
@@ -936,15 +962,15 @@
937963 // did you mean... suggestions
938964 if($textMatches && $textMatches->hasSuggestion()){
939965 $st = SpecialPage::getTitleFor( 'Search' );
940 -
941 - # mirror Go/Search behaviour of original request
 966+
 967+ # mirror Go/Search behaviour of original request
942968 $didYouMeanParams = array( 'search' => $textMatches->getSuggestionQuery() );
943969 if($this->fulltext != NULL)
944 - $didYouMeanParams['fulltext'] = $this->fulltext;
945 - $stParams = wfArrayToCGI(
 970+ $didYouMeanParams['fulltext'] = $this->fulltext;
 971+ $stParams = wfArrayToCGI(
946972 $didYouMeanParams,
947973 $this->powerSearchOptions()
948 - );
 974+ );
949975
950976 $suggestLink = $sk->makeKnownLinkObj( $st,
951977 $textMatches->getSuggestionSnippet(),
@@ -991,7 +1017,7 @@
9921018 return;
9931019 }
9941020
995 - $wgOut->addHTML( $this->shortDialog( $term ) );
 1021+ $wgOut->addHTML( $this->shortDialog( $term ) );
9961022
9971023 // Sometimes the search engine knows there are too many hits
9981024 if ($titleMatches instanceof SearchResultTooMany) {
@@ -1001,7 +1027,7 @@
10021028 wfProfileOut( __METHOD__ );
10031029 return;
10041030 }
1005 -
 1031+
10061032 // show number of results
10071033 $num = ( $titleMatches ? $titleMatches->numRows() : 0 )
10081034 + ( $textMatches ? $textMatches->numRows() : 0);
@@ -1012,7 +1038,7 @@
10131039 $totalNum += $textMatches->getTotalHits();
10141040 if ( $num > 0 ) {
10151041 if ( $totalNum > 0 ){
1016 - $top = wfMsgExt('showingresultstotal', array( 'parseinline' ),
 1042+ $top = wfMsgExt('showingresultstotal', array( 'parseinline' ),
10171043 $this->offset+1, $this->offset+$num, $totalNum, $num );
10181044 } elseif ( $num >= $this->limit ) {
10191045 $top = wfShowingResults( $this->offset, $this->limit );
@@ -1050,7 +1076,7 @@
10511077 if($titleMatches)
10521078 $wgOut->wrapWikiMsg( "==$1==\n", 'textmatches' );
10531079 else // if no title matches the heading is redundant
1054 - $wgOut->addHTML("<hr/>");
 1080+ $wgOut->addHTML("<hr/>");
10551081 } elseif( $num == 0 ) {
10561082 # Don't show the 'no text matches' if we received title matches
10571083 $wgOut->wrapWikiMsg( "==$1==\n", 'notextmatches' );
@@ -1077,7 +1103,7 @@
10781104
10791105 #------------------------------------------------------------------
10801106 # Private methods below this line
1081 -
 1107+
10821108 /**
10831109 *
10841110 */
@@ -1086,7 +1112,7 @@
10871113 if( !empty( $term ) ){
10881114 $wgOut->setPageTitle( wfMsg( 'searchresults') );
10891115 $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'searchresults-title', $term) ) );
1090 - }
 1116+ }
10911117 $subtitlemsg = ( Title::newFromText( $term ) ? 'searchsubtitle' : 'searchsubtitleinvalid' );
10921118 $wgOut->setSubtitle( $wgOut->parse( wfMsg( $subtitlemsg, wfEscapeWikiText($term) ) ) );
10931119 $wgOut->setArticleRelated( false );
@@ -1126,8 +1152,8 @@
11271153 }
11281154
11291155 /**
1130 - * Show whole set of results
1131 - *
 1156+ * Show whole set of results
 1157+ *
11321158 * @param SearchResultSet $matches
11331159 */
11341160 function showMatches( &$matches ) {
@@ -1137,12 +1163,12 @@
11381164 $terms = $wgContLang->convertForSearchResult( $matches->termMatches() );
11391165
11401166 $out = "";
1141 -
 1167+
11421168 $infoLine = $matches->getInfo();
11431169 if( !is_null($infoLine) )
11441170 $out .= "\n<!-- {$infoLine} -->\n";
1145 -
1146 -
 1171+
 1172+
11471173 $off = $this->offset + 1;
11481174 $out .= "<ul class='mw-search-results'>\n";
11491175
@@ -1166,12 +1192,12 @@
11671193 function showHit( $result, $terms ) {
11681194 wfProfileIn( __METHOD__ );
11691195 global $wgUser, $wgContLang, $wgLang;
1170 -
 1196+
11711197 if( $result->isBrokenTitle() ) {
11721198 wfProfileOut( __METHOD__ );
11731199 return "<!-- Broken link in search result -->\n";
11741200 }
1175 -
 1201+
11761202 $t = $result->getTitle();
11771203 $sk = $wgUser->getSkin();
11781204
@@ -1206,13 +1232,13 @@
12071233 ."</span>";
12081234 $section = '';
12091235 if( !is_null($sectionTitle) )
1210 - $section = "<span class='searchalttitle'>"
 1236+ $section = "<span class='searchalttitle'>"
12111237 .wfMsg('search-section', $sk->makeKnownLinkObj( $sectionTitle, $sectionText))
12121238 ."</span>";
12131239
12141240 // format text extract
12151241 $extract = "<div class='searchresult'>".$result->getTextSnippet($terms)."</div>";
1216 -
 1242+
12171243 // format score
12181244 if( is_null( $result->getScore() ) ) {
12191245 // Search engine doesn't report scoring info
@@ -1239,11 +1265,11 @@
12401266 $stParams = wfArrayToCGI( $this->powerSearchOptions(),
12411267 array('search' => wfMsgForContent('searchrelated').':'.$t->getPrefixedText(),
12421268 'fulltext' => wfMsg('search') ));
1243 -
 1269+
12441270 $related = ' -- ' . $sk->makeKnownLinkObj( $st,
12451271 wfMsg('search-relatedarticle'), $stParams );
12461272 }
1247 -
 1273+
12481274 // Include a thumbnail for media files...
12491275 if( $t->getNamespace() == NS_FILE ) {
12501276 $img = wfFindFile( $t );
@@ -1283,7 +1309,7 @@
12841310
12851311 /**
12861312 * Show results from other wikis
1287 - *
 1313+ *
12881314 * @param SearchResultSet $matches
12891315 */
12901316 function showInterwiki( &$matches, $query ) {
@@ -1292,7 +1318,7 @@
12931319 global $wgContLang;
12941320 $terms = $wgContLang->convertForSearchResult( $matches->termMatches() );
12951321
1296 - $out = "<div id='mw-search-interwiki'><div id='mw-search-interwiki-caption'>".wfMsg('search-interwiki-caption')."</div>\n";
 1322+ $out = "<div id='mw-search-interwiki'><div id='mw-search-interwiki-caption'>".wfMsg('search-interwiki-caption')."</div>\n";
12971323 $off = $this->offset + 1;
12981324 $out .= "<ul start='{$off}' class='mw-search-iwresults'>\n";
12991325
@@ -1302,10 +1328,10 @@
13031329 foreach($customLines as $line){
13041330 $parts = explode(":",$line,2);
13051331 if(count($parts) == 2) // validate line
1306 - $customCaptions[$parts[0]] = $parts[1];
 1332+ $customCaptions[$parts[0]] = $parts[1];
13071333 }
1308 -
1309 -
 1334+
 1335+
13101336 $prev = null;
13111337 while( $result = $matches->next() ) {
13121338 $out .= $this->showInterwikiHit( $result, $prev, $terms, $query, $customCaptions );
@@ -1320,30 +1346,30 @@
13211347 wfProfileOut( __METHOD__ );
13221348 return $out;
13231349 }
1324 -
 1350+
13251351 /**
13261352 * Show single interwiki link
13271353 *
13281354 * @param SearchResult $result
13291355 * @param string $lastInterwiki
13301356 * @param array $terms
1331 - * @param string $query
 1357+ * @param string $query
13321358 * @param array $customCaptions iw prefix -> caption
13331359 */
13341360 function showInterwikiHit( $result, $lastInterwiki, $terms, $query, $customCaptions) {
13351361 wfProfileIn( __METHOD__ );
13361362 global $wgUser, $wgContLang, $wgLang;
1337 -
 1363+
13381364 if( $result->isBrokenTitle() ) {
13391365 wfProfileOut( __METHOD__ );
13401366 return "<!-- Broken link in search result -->\n";
13411367 }
1342 -
 1368+
13431369 $t = $result->getTitle();
13441370 $sk = $wgUser->getSkin();
1345 -
 1371+
13461372 $link = $sk->makeKnownLinkObj( $t, $result->getTitleSnippet($terms));
1347 -
 1373+
13481374 // format redirect if any
13491375 $redirectTitle = $result->getRedirectTitle();
13501376 $redirectText = $result->getRedirectSnippet($terms);
@@ -1354,30 +1380,30 @@
13551381 ."</span>";
13561382
13571383 $out = "";
1358 - // display project name
 1384+ // display project name
13591385 if(is_null($lastInterwiki) || $lastInterwiki != $t->getInterwiki()){
13601386 if( key_exists($t->getInterwiki(),$customCaptions) )
13611387 // captions from 'search-interwiki-custom'
13621388 $caption = $customCaptions[$t->getInterwiki()];
13631389 else{
1364 - // default is to show the hostname of the other wiki which might suck
 1390+ // default is to show the hostname of the other wiki which might suck
13651391 // if there are many wikis on one hostname
13661392 $parsed = parse_url($t->getFullURL());
1367 - $caption = wfMsg('search-interwiki-default', $parsed['host']);
1368 - }
 1393+ $caption = wfMsg('search-interwiki-default', $parsed['host']);
 1394+ }
13691395 // "more results" link (special page stuff could be localized, but we might not know target lang)
1370 - $searchTitle = Title::newFromText($t->getInterwiki().":Special:Search");
 1396+ $searchTitle = Title::newFromText($t->getInterwiki().":Special:Search");
13711397 $searchLink = $sk->makeKnownLinkObj( $searchTitle, wfMsg('search-interwiki-more'),
1372 - wfArrayToCGI(array('search' => $query, 'fulltext' => 'Search')));
 1398+ wfArrayToCGI(array('search' => $query, 'fulltext' => 'Search')));
13731399 $out .= "</ul><div class='mw-search-interwiki-project'><span class='mw-search-interwiki-more'>{$searchLink}</span>{$caption}</div>\n<ul>";
13741400 }
13751401
1376 - $out .= "<li>{$link} {$redirect}</li>\n";
 1402+ $out .= "<li>{$link} {$redirect}</li>\n";
13771403 wfProfileOut( __METHOD__ );
13781404 return $out;
13791405 }
1380 -
13811406
 1407+
13821408 /**
13831409 * Generates the power search box at bottom of [[Special:Search]]
13841410 * @param $term string: search term
@@ -1432,9 +1458,9 @@
14331459 $searchTitle = SpecialPage::getTitleFor( 'Search' );
14341460 $searchHiddens = Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . "\n";
14351461 $searchHiddens .= Xml::hidden( 'fulltext', 'Advanced search' ) . "\n";
1436 -
 1462+
14371463 $out = Xml::openElement( 'form', array( 'id' => 'powersearch', 'method' => 'get', 'action' => $wgScript ) ) .
1438 - Xml::fieldset( wfMsg( 'powersearch-legend' ),
 1464+ Xml::fieldset( wfMsg( 'powersearch-legend' ),
14391465 "<p>" .
14401466 wfMsgExt( 'powersearch-ns', array( 'parseinline' ) ) .
14411467 "</p>\n" .
@@ -1447,7 +1473,7 @@
14481474 "&nbsp;" .
14491475 $searchField .
14501476 "&nbsp;" .
1451 - $searchHiddens .
 1477+ $searchHiddens .
14521478 $searchButton ) .
14531479 "</form>";
14541480
Index: branches/querypage-work/phase3/includes/specials/SpecialListgrouprights.php
@@ -26,6 +26,7 @@
2727 public function execute( $par ) {
2828 global $wgOut, $wgImplicitGroups, $wgMessageCache;
2929 global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups;
 30+ global $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
3031 $wgMessageCache->loadAllMessages();
3132
3233 $this->setHeaders();
@@ -76,13 +77,16 @@
7778 $addgroups = isset( $wgAddGroups[$group] ) ? $wgAddGroups[$group] : array();
7879 $removegroups = isset( $wgRemoveGroups[$group] ) ? $wgRemoveGroups[$group] : array();
7980
 81+ $addgroupsSelf = isset( $wgGroupsAddToSelf[$group] ) ? $wgGroupsAddToSelf[$group] : array();
 82+ $removegroupsSelf = isset( $wgGroupsRemoveFromSelf[$group] ) ? $wgGroupsRemoveFromSelf[$group] : array();
 83+
8084 $wgOut->addHTML(
8185 '<tr>
8286 <td>' .
8387 $grouppage . $grouplink .
8488 '</td>
8589 <td>' .
86 - self::formatPermissions( $permissions, $addgroups, $removegroups ) .
 90+ self::formatPermissions( $permissions, $addgroups, $removegroups, $addgroupsSelf, $removegroupsSelf ) .
8791 '</td>
8892 </tr>'
8993 );
@@ -98,7 +102,7 @@
99103 * @param $permissions Array of permission => bool (from $wgGroupPermissions items)
100104 * @return string List of all granted permissions, separated by comma separator
101105 */
102 - private static function formatPermissions( $permissions, $add, $remove ) {
 106+ private static function formatPermissions( $permissions, $add, $remove, $addSelf, $removeSelf ) {
103107 global $wgLang;
104108 $r = array();
105109 foreach( $permissions as $permission => $granted ) {
@@ -121,6 +125,16 @@
122126 } else if( is_array( $remove ) && count( $remove ) ) {
123127 $r[] = wfMsgExt( 'listgrouprights-removegroup', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $remove ) ), count( $remove ) );
124128 }
 129+ if( $addSelf === true ){
 130+ $r[] = wfMsgExt( 'listgrouprights-addgroup-self-all', array( 'escape' ) );
 131+ } else if( is_array( $addSelf ) && count( $addSelf ) ) {
 132+ $r[] = wfMsgExt( 'listgrouprights-addgroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $addSelf ) ), count( $addSelf ) );
 133+ }
 134+ if( $removeSelf === true ){
 135+ $r[] = wfMsgExt( 'listgrouprights-removegroup-self-all', array( 'escape' ) );
 136+ } else if( is_array( $removeSelf ) && count( $removeSelf ) ) {
 137+ $r[] = wfMsgExt( 'listgrouprights-removegroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $removeSelf ) ), count( $removeSelf ) );
 138+ }
125139 if( empty( $r ) ) {
126140 return '';
127141 } else {
Index: branches/querypage-work/phase3/includes/specials/SpecialMostlinked.php
@@ -76,7 +76,7 @@
7777 function formatResult( $skin, $result ) {
7878 global $wgLang;
7979 $title = Title::makeTitleSafe( $result->namespace, $result->title );
80 - $link = $skin->makeLinkObj( $title );
 80+ $link = $skin->link( $title );
8181 $wlh = $this->makeWlhLink( $title,
8282 wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
8383 $wgLang->formatNum( $result->value ) ), $skin );
Index: branches/querypage-work/phase3/includes/specials/SpecialProtectedpages.php
@@ -65,7 +65,7 @@
6666 $skin = $wgUser->getSkin();
6767
6868 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
69 - $link = $skin->makeLinkObj( $title );
 69+ $link = $skin->link( $title );
7070
7171 $description_items = array ();
7272
Index: branches/querypage-work/phase3/includes/specials/SpecialMIMEsearch.php
@@ -72,7 +72,7 @@
7373 $wgLang->formatNum( $result->img_size ) );
7474 $dimensions = wfMsgHtml( 'widthheight', $wgLang->formatNum( $result->img_width ),
7575 $wgLang->formatNum( $result->img_height ) );
76 - $user = $skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
 76+ $user = $skin->link( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
7777 $time = $wgLang->timeanddate( $result->img_timestamp );
7878
7979 return "($download) $plink . . $dimensions . . $bytes . . $user . . $time";
Index: branches/querypage-work/phase3/includes/specials/SpecialRandompage.php
@@ -36,8 +36,9 @@
3737 public function execute( $par ) {
3838 global $wgOut, $wgContLang;
3939
40 - if ($par)
 40+ if ($par) {
4141 $this->setNamespace( $wgContLang->getNsIndex( $par ) );
 42+ }
4243
4344 $title = $this->getRandomTitle();
4445
@@ -78,8 +79,6 @@
7980
8081 private function selectRandomPageFromDB( $randstr ) {
8182 global $wgExtraRandompageSQL;
82 - $fname = 'RandomPage::selectRandomPageFromDB';
83 -
8483 $dbr = wfGetDB( DB_SLAVE );
8584
8685 $use_index = $dbr->useIndexClause( 'page_random' );
@@ -98,7 +97,7 @@
9998 ORDER BY page_random";
10099
101100 $sql = $dbr->limitResult( $sql, 1, 0 );
102 - $res = $dbr->query( $sql, $fname );
 101+ $res = $dbr->query( $sql, __METHOD__ );
103102 return $dbr->fetchObject( $res );
104103 }
105104 }
Index: branches/querypage-work/phase3/includes/specials/SpecialBlockip.php
@@ -11,13 +11,11 @@
1212 */
1313 function wfSpecialBlockip( $par ) {
1414 global $wgUser, $wgOut, $wgRequest;
15 -
1615 # Can't block when the database is locked
1716 if( wfReadOnly() ) {
1817 $wgOut->readOnlyPage();
1918 return;
2019 }
21 -
2220 # Permission check
2321 if( !$wgUser->isAllowed( 'block' ) ) {
2422 $wgOut->permissionRequired( 'block' );
@@ -27,9 +25,9 @@
2826 $ipb = new IPBlockForm( $par );
2927
3028 $action = $wgRequest->getVal( 'action' );
31 - if ( 'success' == $action ) {
 29+ if( 'success' == $action ) {
3230 $ipb->showSuccess();
33 - } else if ( $wgRequest->wasPosted() && 'submit' == $action &&
 31+ } else if( $wgRequest->wasPosted() && 'submit' == $action &&
3432 $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
3533 $ipb->doSubmit();
3634 } else {
@@ -44,9 +42,10 @@
4543 */
4644 class IPBlockForm {
4745 var $BlockAddress, $BlockExpiry, $BlockReason;
48 -# var $BlockEmail;
 46+ // The maximum number of edits a user can have and still be hidden
 47+ const HIDEUSER_CONTRIBLIMIT = 1000;
4948
50 - function IPBlockForm( $par ) {
 49+ public function __construct( $par ) {
5150 global $wgRequest, $wgUser, $wgBlockAllowsUTEdit;
5251
5352 $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) );
@@ -70,7 +69,7 @@
7170 $this->BlockReblock = $wgRequest->getBool( 'wpChangeBlock', false );
7271 }
7372
74 - function showForm( $err ) {
 73+ public function showForm( $err ) {
7574 global $wgOut, $wgUser, $wgSysopUserBans;
7675
7776 $wgOut->setPagetitle( wfMsg( 'blockip' ) );
@@ -90,17 +89,17 @@
9190 $user = User::newFromName( $this->BlockAddress );
9291
9392 $alreadyBlocked = false;
94 - if ( $err && $err[0] != 'ipb_already_blocked' ) {
 93+ if( $err && $err[0] != 'ipb_already_blocked' ) {
9594 $key = array_shift($err);
9695 $msg = wfMsgReal($key, $err);
9796 $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
9897 $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $msg ) );
99 - } elseif ( $this->BlockAddress ) {
 98+ } elseif( $this->BlockAddress ) {
10099 $userId = 0;
101 - if ( is_object( $user ) )
 100+ if( is_object( $user ) )
102101 $userId = $user->getId();
103102 $currentBlock = Block::newFromDB( $this->BlockAddress, $userId );
104 - if ( !is_null($currentBlock) && !$currentBlock->mAuto && # The block exists and isn't an autoblock
 103+ if( !is_null($currentBlock) && !$currentBlock->mAuto && # The block exists and isn't an autoblock
105104 ( $currentBlock->mRangeStart == $currentBlock->mRangeEnd || # The block isn't a rangeblock
106105 # or if it is, the range is what we're about to block
107106 ( $currentBlock->mAddress == $this->BlockAddress ) ) ) {
@@ -125,12 +124,11 @@
126125 $scBlockExpiryOptions = wfMsgForContent( 'ipboptions' );
127126
128127 $showblockoptions = $scBlockExpiryOptions != '-';
129 - if (!$showblockoptions)
130 - $mIpbother = $mIpbexpiry;
 128+ if( !$showblockoptions ) $mIpbother = $mIpbexpiry;
131129
132130 $blockExpiryFormOptions = Xml::option( wfMsg( 'ipbotheroption' ), 'other' );
133131 foreach (explode(',', $scBlockExpiryOptions) as $option) {
134 - if ( strpos($option, ":") === false ) $option = "$option:$option";
 132+ if( strpos($option, ":") === false ) $option = "$option:$option";
135133 list($show, $value) = explode(":", $option);
136134 $show = htmlspecialchars($show);
137135 $value = htmlspecialchars($value);
@@ -162,7 +160,7 @@
163161 </tr>
164162 <tr>"
165163 );
166 - if ( $showblockoptions ) {
 164+ if( $showblockoptions ) {
167165 $wgOut->addHTML("
168166 <td class='mw-label'>
169167 {$mIpbexpiry}
@@ -233,7 +231,7 @@
234232 );
235233
236234 global $wgSysopEmailBans, $wgBlockAllowsUTEdit;
237 - if ( $wgSysopEmailBans && $wgUser->isAllowed( 'blockemail' ) ) {
 235+ if( $wgSysopEmailBans && $wgUser->isAllowed( 'blockemail' ) ) {
238236 $wgOut->addHTML("
239237 <tr id='wpEnableEmailBan'>
240238 <td>&nbsp;</td>
@@ -247,7 +245,7 @@
248246 }
249247
250248 // Allow some users to hide name from block log, blocklist and listusers
251 - if ( $wgUser->isAllowed( 'hideuser' ) ) {
 249+ if( $wgUser->isAllowed( 'hideuser' ) ) {
252250 $wgOut->addHTML("
253251 <tr id='wpEnableHideUser'>
254252 <td>&nbsp;</td>
@@ -328,12 +326,12 @@
329327 $rxIP = "($rxIP4|$rxIP6)";
330328
331329 # Check for invalid specifications
332 - if ( !preg_match( "/^$rxIP$/", $this->BlockAddress ) ) {
 330+ if( !preg_match( "/^$rxIP$/", $this->BlockAddress ) ) {
333331 $matches = array();
334 - if ( preg_match( "/^($rxIP4)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) {
 332+ if( preg_match( "/^($rxIP4)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) {
335333 # IPv4
336 - if ( $wgSysopRangeBans ) {
337 - if ( !IP::isIPv4( $this->BlockAddress ) || $matches[2] < 16 || $matches[2] > 32 ) {
 334+ if( $wgSysopRangeBans ) {
 335+ if( !IP::isIPv4( $this->BlockAddress ) || $matches[2] < 16 || $matches[2] > 32 ) {
338336 return array('ip_range_invalid');
339337 }
340338 $this->BlockAddress = Block::normaliseRange( $this->BlockAddress );
@@ -341,10 +339,10 @@
342340 # Range block illegal
343341 return array('range_block_disabled');
344342 }
345 - } else if ( preg_match( "/^($rxIP6)\\/(\\d{1,3})$/", $this->BlockAddress, $matches ) ) {
 343+ } else if( preg_match( "/^($rxIP6)\\/(\\d{1,3})$/", $this->BlockAddress, $matches ) ) {
346344 # IPv6
347 - if ( $wgSysopRangeBans ) {
348 - if ( !IP::isIPv6( $this->BlockAddress ) || $matches[2] < 64 || $matches[2] > 128 ) {
 345+ if( $wgSysopRangeBans ) {
 346+ if( !IP::isIPv6( $this->BlockAddress ) || $matches[2] < 64 || $matches[2] > 128 ) {
349347 return array('ip_range_invalid');
350348 }
351349 $this->BlockAddress = Block::normaliseRange( $this->BlockAddress );
@@ -354,7 +352,7 @@
355353 }
356354 } else {
357355 # Username block
358 - if ( $wgSysopUserBans ) {
 356+ if( $wgSysopUserBans ) {
359357 $user = User::newFromName( $this->BlockAddress );
360358 if( !is_null( $user ) && $user->getId() ) {
361359 # Use canonical name
@@ -369,15 +367,15 @@
370368 }
371369 }
372370
373 - if ( $wgUser->isBlocked() && ( $wgUser->getId() !== $userId ) ) {
 371+ if( $wgUser->isBlocked() && ( $wgUser->getId() !== $userId ) ) {
374372 return array( 'cant-block-while-blocked' );
375373 }
376374
377375 $reasonstr = $this->BlockReasonList;
378 - if ( $reasonstr != 'other' && $this->BlockReason != '' ) {
 376+ if( $reasonstr != 'other' && $this->BlockReason != '' ) {
379377 // Entry from drop down menu + additional comment
380378 $reasonstr .= wfMsgForContent( 'colon-separator' ) . $this->BlockReason;
381 - } elseif ( $reasonstr == 'other' ) {
 379+ } elseif( $reasonstr == 'other' ) {
382380 $reasonstr = $this->BlockReason;
383381 }
384382
@@ -385,11 +383,11 @@
386384 if( $expirestr == 'other' )
387385 $expirestr = $this->BlockOther;
388386
389 - if ( ( strlen( $expirestr ) == 0) || ( strlen( $expirestr ) > 50) ) {
 387+ if( ( strlen( $expirestr ) == 0) || ( strlen( $expirestr ) > 50) ) {
390388 return array('ipb_expiry_invalid');
391389 }
392390
393 - if ( false === ($expiry = Block::parseExpiryInput( $expirestr )) ) {
 391+ if( false === ($expiry = Block::parseExpiryInput( $expirestr )) ) {
394392 // Bad expiry.
395393 return array('ipb_expiry_invalid');
396394 }
@@ -397,19 +395,18 @@
398396 if( $this->BlockHideName ) {
399397 // Recheck params here...
400398 if( !$userId || !$wgUser->isAllowed('hideuser') ) {
401 - // IP users should not be hidden
402 - $this->BlockHideName = false;
 399+ $this->BlockHideName = false; // IP users should not be hidden
403400 } else if( $expiry !== 'infinity' ) {
404401 // Bad expiry.
405402 return array('ipb_expiry_temp');
406 - } else if( User::edits($userId) > 3000 ) {
 403+ } else if( User::edits($userId) > self::HIDEUSER_CONTRIBLIMIT ) {
407404 // Typically, the user should have a handful of edits.
408405 // Disallow hiding users with many edits for performance.
409406 return array('ipb_hide_invalid');
410407 }
411408 }
412409
413 - # Create block
 410+ # Create block object
414411 # Note: for a user block, ipb_address is only for display purposes
415412 $block = new Block( $this->BlockAddress, $userId, $wgUser->getId(),
416413 $reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
@@ -419,11 +416,11 @@
420417
421418 # Should this be privately logged?
422419 $suppressLog = (bool)$this->BlockHideName;
423 - if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) {
 420+ if( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) {
424421 # Try to insert block. Is there a conflicting block?
425 - if ( !$block->insert() ) {
 422+ if( !$block->insert() ) {
426423 # Show form unless the user is already aware of this...
427 - if ( !$this->BlockReblock ) {
 424+ if( !$this->BlockReblock ) {
428425 return array( 'ipb_already_blocked' );
429426 # Otherwise, try to update the block...
430427 } else {
@@ -445,7 +442,7 @@
446443 $log_action = 'reblock';
447444 # Unset _deleted fields if requested
448445 if( $currentBlock->mHideName && !$this->BlockHideName ) {
449 - $this->unsuppressUserName( $this->BlockAddress, $userId );
 446+ self::unsuppressUserName( $this->BlockAddress, $userId );
450447 }
451448 }
452449 } else {
@@ -455,13 +452,12 @@
456453
457454 # Set *_deleted fields if requested
458455 if( $this->BlockHideName ) {
459 - $this->suppressUserName( $this->BlockAddress, $userId );
 456+ self::suppressUserName( $this->BlockAddress, $userId, $reasonstr );
460457 }
461458
462 - if ( $this->BlockWatchUser &&
463 - # Only show watch link when this is no range block
464 - $block->mRangeStart == $block->mRangeEnd) {
465 - $wgUser->addWatch ( Title::makeTitle( NS_USER, $this->BlockAddress ) );
 459+ # Only show watch link when this is no range block
 460+ if( $this->BlockWatchUser && $block->mRangeStart == $block->mRangeEnd ) {
 461+ $wgUser->addWatch( Title::makeTitle( NS_USER, $this->BlockAddress ) );
466462 }
467463
468464 # Block constructor sanitizes certain block options on insert
@@ -477,7 +473,7 @@
478474 $log_type = $suppressLog ? 'suppress' : 'block';
479475 $log = new LogPage( $log_type );
480476 $log->addEntry( $log_action, Title::makeTitle( NS_USER, $this->BlockAddress ),
481 - $reasonstr, $logParams );
 477+ $reasonstr, $logParams );
482478
483479 # Report to the user
484480 return array();
@@ -486,17 +482,30 @@
487483 }
488484 }
489485
490 - private function suppressUserName( $name, $userId ) {
 486+ public static function suppressUserName( $name, $userId, $reason = '' ) {
 487+ $user = User::newFromName( $name, false );
 488+ # Delete the user pages that exists
 489+ $title = $user->getUserPage();
 490+ if( ($id = $title->getArticleID(GAID_FOR_UPDATE)) ) {
 491+ $article = new Article( $title );
 492+ $article->doDeleteArticle( $reason, true /*suppress*/, $id );
 493+ }
 494+ # Delete the user talk pages that exists
 495+ $title = $user->getTalkPage();
 496+ if( $id = $title->getArticleID(GAID_FOR_UPDATE) ) {
 497+ $article = new Article( $title );
 498+ $article->doDeleteArticle( $reason, true /*suppress*/, $id );
 499+ }
491500 $op = '|'; // bitwise OR
492 - return $this->setUsernameBitfields( $name, $userId, $op );
 501+ return self::setUsernameBitfields( $name, $userId, $op );
493502 }
494503
495 - private function unsuppressUserName( $name, $userId ) {
 504+ public static function unsuppressUserName( $name, $userId ) {
496505 $op = '&'; // bitwise AND
497 - return $this->setUsernameBitfields( $name, $userId, $op );
 506+ return self::setUsernameBitfields( $name, $userId, $op );
498507 }
499508
500 - private function setUsernameBitfields( $name, $userId, $op ) {
 509+ private static function setUsernameBitfields( $name, $userId, $op ) {
501510 if( $op !== '|' && $op !== '&' ) return false; // sanity check
502511 $dbw = wfGetDB( DB_MASTER );
503512 $delUser = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
@@ -509,14 +518,16 @@
510519 # current bitfields with the inverse of Revision::DELETED_USER. The
511520 # username bit is made to 0 (x & 0 = 0), while others are unchanged (x & 1 = x).
512521 # The same goes for the sysop-restricted *_deleted bit.
513 - if( $op == '&' ) $delUser = "~{$delUser}";
514 - if( $op == '&' ) $delAction = "~{$delAction}";
 522+ if( $op == '&' ) {
 523+ $delUser = "~{$delUser}";
 524+ $delAction = "~{$delAction}";
 525+ }
515526 # Hide name from live edits
516527 $dbw->update( 'revision', array("rev_deleted = rev_deleted $op $delUser"),
517528 array('rev_user' => $userId), __METHOD__ );
518529 # Hide name from deleted edits
519530 $dbw->update( 'archive', array("ar_deleted = ar_deleted $op $delUser"),
520 - array('ar_user_text' => $userId), __METHOD__ );
 531+ array('ar_user_text' => $name), __METHOD__ );
521532 # Hide name from logs
522533 $dbw->update( 'logging', array("log_deleted = log_deleted $op $delUser"),
523534 array('log_user' => $userId, "log_type != 'suppress'"), __METHOD__ );
@@ -543,11 +554,10 @@
544555 * UI entry point for blocking
545556 * Wraps around doBlock()
546557 */
547 - function doSubmit()
548 - {
 558+ public function doSubmit() {
549559 global $wgOut;
550560 $retval = $this->doBlock();
551 - if(empty($retval)) {
 561+ if( empty($retval) ) {
552562 $titleObj = SpecialPage::getTitleFor( 'Blockip' );
553563 $wgOut->redirect( $titleObj->getFullURL( 'action=success&ip=' .
554564 urlencode( $this->BlockAddress ) ) );
@@ -556,7 +566,7 @@
557567 $this->showForm( $retval );
558568 }
559569
560 - function showSuccess() {
 570+ public function showSuccess() {
561571 global $wgOut;
562572
563573 $wgOut->setPagetitle( wfMsg( 'blockip' ) );
@@ -565,7 +575,7 @@
566576 $wgOut->addHTML( $text );
567577 }
568578
569 - function showLogFragment( $out, $title ) {
 579+ private function showLogFragment( $out, $title ) {
570580 global $wgUser;
571581 $out->addHTML( Xml::element( 'h2', NULL, LogPage::logName( 'block' ) ) );
572582 $count = LogEventsList::showLogExtract( $out, 'block', $title->getPrefixedText(), '', 10 );
@@ -603,11 +613,11 @@
604614 if( !$this->BlockEnableAutoblock && !IP::isIPAddress( $this->BlockAddress ) )
605615 // Same as anononly, this is not displayed when blocking an IP address
606616 $flags[] = 'noautoblock';
607 - if ( $this->BlockEmail )
 617+ if( $this->BlockEmail )
608618 $flags[] = 'noemail';
609 - if ( !$this->BlockAllowUsertalk && $wgBlockAllowsUTEdit )
 619+ if( !$this->BlockAllowUsertalk && $wgBlockAllowsUTEdit )
610620 $flags[] = 'nousertalk';
611 - if ( $this->BlockHideName )
 621+ if( $this->BlockHideName )
612622 $flags[] = 'hiddenname';
613623 return implode( ',', $flags );
614624 }
Index: branches/querypage-work/phase3/includes/specials/SpecialVersion.php
@@ -80,25 +80,30 @@
8181 static function softwareInformation() {
8282 $dbr = wfGetDB( DB_SLAVE );
8383
84 - return Xml::element( 'h2', array( 'id' => 'mw-version-software' ), wfMsg( 'version-software' ) ) .
85 - Xml::openElement( 'table', array( 'id' => 'sv-software' ) ) .
 84+ // Put the software in an array of form 'name' => 'version'. All messages should
 85+ // be loaded here, so feel free to use wfMsg*() in the 'name'. Raw HTML or wikimarkup
 86+ // can be used
 87+ $software = array();
 88+ $software['[http://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
 89+ $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")";
 90+ $software[$dbr->getSoftwareLink()] = $dbr->getServerVersion();
 91+
 92+ // Allow a hook to add/remove items
 93+ wfRunHooks( 'SoftwareInfo', array( &$software ) );
 94+
 95+ $out = Xml::element( 'h2', array( 'id' => 'mw-version-software' ), wfMsg( 'version-software' ) ) .
 96+ Xml::openElement( 'table', array( 'id' => 'sv-software' ) ) .
8697 "<tr>
8798 <th>" . wfMsg( 'version-software-product' ) . "</th>
8899 <th>" . wfMsg( 'version-software-version' ) . "</th>
89 - </tr>\n
90 - <tr>
91 - <td>[http://www.mediawiki.org/ MediaWiki]</td>
92 - <td>" . self::getVersionLinked() . "</td>
93 - </tr>\n
94 - <tr>
95 - <td>[http://www.php.net/ PHP]</td>
96 - <td>" . phpversion() . " (" . php_sapi_name() . ")</td>
97 - </tr>\n
98 - <tr>
99 - <td>" . $dbr->getSoftwareLink() . "</td>
100 - <td>" . $dbr->getServerVersion() . "</td>
101 - </tr>\n" .
102 - Xml::closeElement( 'table' );
 100+ </tr>\n";
 101+ foreach( $software as $name => $version ) {
 102+ $out .= "<tr>
 103+ <td>" . $name . "</td>
 104+ <td>" . $version . "</td>
 105+ </tr>\n";
 106+ }
 107+ return $out . Xml::closeElement( 'table' );
103108 }
104109
105110 /**
@@ -106,11 +111,18 @@
107112 *
108113 * @return mixed
109114 */
110 - public static function getVersion() {
 115+ public static function getVersion( $flags = '' ) {
111116 global $wgVersion, $IP;
112117 wfProfileIn( __METHOD__ );
113 - $svn = self::getSvnRevision( $IP );
114 - $version = $svn ? "$wgVersion (r$svn)" : $wgVersion;
 118+ $svn = self::getSvnRevision( $IP, false, false , false );
 119+ $svnCo = self::getSvnRevision( $IP, true, false , false );
 120+ if ( !$svn ) {
 121+ $version = $wgVersion;
 122+ } elseif( $flags === 'nodb' ) {
 123+ $version = "$wgVersion ($svnCo)";
 124+ } else {
 125+ $version = $wgVersion . wfMsg( 'version-svn-revision', $svn, $svnCo );
 126+ }
115127 wfProfileOut( __METHOD__ );
116128 return $version;
117129 }
@@ -124,9 +136,13 @@
125137 public static function getVersionLinked() {
126138 global $wgVersion, $IP;
127139 wfProfileIn( __METHOD__ );
128 - $svn = self::getSvnRevision( $IP );
129 - $viewvc = 'http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/?pathrev=';
130 - $version = $svn ? "$wgVersion ([{$viewvc}{$svn} r$svn])" : $wgVersion;
 140+ $svn = self::getSvnRevision( $IP, false, false, false );
 141+ $svnCo = self::getSvnRevision( $IP, true, false, false );
 142+ $svnDir = self::getSvnRevision( $IP, true, false, true );
 143+ $viewvcStart = 'http://svn.wikimedia.org/viewvc/mediawiki/';
 144+ $viewvcEnd = '/?pathrev=';
 145+ $viewvc = $viewvcStart . $svnDir . $viewvcEnd;
 146+ $version = $svn ? $wgVersion . " [{$viewvc}{$svnCo} " . wfMsg( 'version-svn-revision', $svn, $svnCo ) . ']' : $wgVersion;
131147 wfProfileOut( __METHOD__ );
132148 return $version;
133149 }
@@ -158,7 +174,16 @@
159175
160176 foreach ( $wgExtensionCredits[$type] as $extension ) {
161177 $version = null;
162 - $subVersion = '';
 178+ $subVersion = null;
 179+ $subVersionCo = null;
 180+ $viewvc = null;
 181+ if ( isset( $extension['path'] ) ) {
 182+ $subVersion = self::getSvnRevision(dirname($extension['path']), false, true, false);
 183+ $subVersionCo = self::getSvnRevision(dirname($extension['path']), true, true, false);
 184+ $subVersionDir = self::getSvnRevision(dirname($extension['path']), false, true, true);
 185+ if ($subVersionDir)
 186+ $viewvc = $subVersionDir . $subVersionCo;
 187+ }
163188 if ( isset( $extension['version'] ) ) {
164189 $version = $extension['version'];
165190 }
@@ -166,6 +191,9 @@
167192 $out .= $this->formatCredits(
168193 isset ( $extension['name'] ) ? $extension['name'] : '',
169194 $version,
 195+ $subVersion,
 196+ $subVersionCo,
 197+ $viewvc,
170198 isset ( $extension['author'] ) ? $extension['author'] : '',
171199 isset ( $extension['url'] ) ? $extension['url'] : null,
172200 isset ( $extension['description'] ) ? $extension['description'] : '',
@@ -177,24 +205,24 @@
178206
179207 if ( count( $wgExtensionFunctions ) ) {
180208 $out .= $this->openExtType( wfMsg( 'version-extension-functions' ) );
181 - $out .= '<tr><td colspan="3">' . $this->listToText( $wgExtensionFunctions ) . "</td></tr>\n";
 209+ $out .= '<tr><td colspan="4">' . $this->listToText( $wgExtensionFunctions ) . "</td></tr>\n";
182210 }
183211
184212 if ( $cnt = count( $tags = $wgParser->getTags() ) ) {
185213 for ( $i = 0; $i < $cnt; ++$i )
186214 $tags[$i] = "&lt;{$tags[$i]}&gt;";
187215 $out .= $this->openExtType( wfMsg( 'version-parser-extensiontags' ) );
188 - $out .= '<tr><td colspan="3">' . $this->listToText( $tags ). "</td></tr>\n";
 216+ $out .= '<tr><td colspan="4">' . $this->listToText( $tags ). "</td></tr>\n";
189217 }
190218
191219 if( $cnt = count( $fhooks = $wgParser->getFunctionHooks() ) ) {
192220 $out .= $this->openExtType( wfMsg( 'version-parser-function-hooks' ) );
193 - $out .= '<tr><td colspan="3">' . $this->listToText( $fhooks ) . "</td></tr>\n";
 221+ $out .= '<tr><td colspan="4">' . $this->listToText( $fhooks ) . "</td></tr>\n";
194222 }
195223
196224 if ( count( $wgSkinExtensionFunctions ) ) {
197225 $out .= $this->openExtType( wfMsg( 'version-skin-extension-functions' ) );
198 - $out .= '<tr><td colspan="3">' . $this->listToText( $wgSkinExtensionFunctions ) . "</td></tr>\n";
 226+ $out .= '<tr><td colspan="4">' . $this->listToText( $wgSkinExtensionFunctions ) . "</td></tr>\n";
199227 }
200228 $out .= Xml::closeElement( 'table' );
201229 return $out;
@@ -212,9 +240,12 @@
213241 }
214242 }
215243
216 - function formatCredits( $name, $version = null, $author = null, $url = null, $description = null, $descriptionMsg = null ) {
 244+ function formatCredits( $name, $version = null, $subVersion = null, $subVersionCo = null, $subVersionURL = null, $author = null, $url = null, $description = null, $descriptionMsg = null ) {
 245+ $haveSubversion = $subVersion;
217246 $extension = isset( $url ) ? "[$url $name]" : $name;
218 - $version = isset( $version ) ? "(" . wfMsg( 'version-version' ) . " $version)" : '';
 247+ $version = isset( $version ) ? wfMsg( 'version-version', $version ) : '';
 248+ $subVersion = isset( $subVersion ) ? wfMsg( 'version-svn-revision', $subVersion, $subVersionCo ) : '';
 249+ $subVersion = isset( $subVersionURL ) ? "[$subVersionURL $subVersion]" : $subVersion;
219250
220251 # Look for a localized description
221252 if( isset( $descriptionMsg ) ) {
@@ -224,11 +255,19 @@
225256 }
226257 }
227258
228 - return "<tr>
 259+ if ( $haveSubversion ) {
 260+ $extNameVer = "<tr>
229261 <td><em>$extension $version</em></td>
230 - <td>$description</td>
231 - <td>" . $this->listToText( (array)$author ) . "</td>
232 - </tr>\n";
 262+ <td><em>$subVersion</em></td>";
 263+ } else {
 264+ $extNameVer = "<tr>
 265+ <td colspan=\"2\"><em>$extension $version</em></td>";
 266+ }
 267+ $extDescAuthor = "<td>$description</td>
 268+ <td>" . $this->listToText( (array)$author ) . "</td>
 269+ </tr>\n";
 270+ return $ret = $extNameVer . $extDescAuthor;
 271+ return $ret;
233272 }
234273
235274 /**
@@ -261,7 +300,7 @@
262301 }
263302
264303 private function openExtType($text, $name = null) {
265 - $opt = array( 'colspan' => 3 );
 304+ $opt = array( 'colspan' => 4 );
266305 $out = '';
267306
268307 if(!$this->firstExtOpened) {
@@ -329,10 +368,16 @@
330369 /**
331370 * Retrieve the revision number of a Subversion working directory.
332371 *
333 - * @param string $dir
334 - * @return mixed revision number as int, or false if not a SVN checkout
 372+ * @param String $dir Directory of the svn checkout
 373+ * @param Boolean $coRev optional to return value whether is Last Modified
 374+ * or Checkout revision number
 375+ * @param Boolean $extension optional to check the path whether is from
 376+ * Wikimedia SVN server or not
 377+ * @param Boolean $relPath optional to get the end part of the checkout path
 378+ * @return mixed revision number as int, end part of the checkout path,
 379+ * or false if not a SVN checkout
335380 */
336 - public static function getSvnRevision( $dir ) {
 381+ public static function getSvnRevision( $dir, $coRev = false, $extension = false, $relPath = false) {
337382 // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html
338383 $entries = $dir . '/.svn/entries';
339384
@@ -367,8 +412,42 @@
368413 }
369414 return false;
370415 } else {
371 - // subversion is release 1.4
372 - return intval( $content[3] );
 416+ // subversion is release 1.4 or above
 417+ if ($relPath) {
 418+ $endPath = strstr( $content[4], 'tags' );
 419+ if (!$endPath) {
 420+ $endPath = strstr( $content[4], 'branches' );
 421+ if (!$endPath) {
 422+ $endPath = strstr( $content[4], 'trunk' );
 423+ if (!$endPath)
 424+ return false;
 425+ }
 426+ }
 427+ $endPath = trim ( $endPath );
 428+ if ($extension) {
 429+ $wmSvnPath = 'svn.wikimedia.org/svnroot/mediawiki';
 430+ $isWMSvn = strstr($content[5],$wmSvnPath);
 431+ if (!strcmp($isWMSvn,null)) {
 432+ return false;
 433+ } else {
 434+ $viewvcStart = 'http://svn.wikimedia.org/viewvc/mediawiki/';
 435+ if (strstr( $content[4], 'trunk' ))
 436+ $viewvcEnd = '/?pathrev=';
 437+ else
 438+ // Avoids 404 error using pathrev when it does not found
 439+ $viewvcEnd = '/?revision=';
 440+ $viewvc = $viewvcStart . $endPath . $viewvcEnd;
 441+ return $viewvc;
 442+ }
 443+ }
 444+ return $endPath;
 445+ }
 446+ if ($coRev)
 447+ // get the directory checkout revsion number
 448+ return intval( $content[3]) ;
 449+ else
 450+ // get the directory last modified revision number
 451+ return intval( $content[10] );
373452 }
374453 }
375454
Index: branches/querypage-work/phase3/includes/specials/SpecialBooksources.php
@@ -6,7 +6,7 @@
77 *
88 * @author Rob Church <robchur@gmail.com>
99 * @todo Validate ISBNs using the standard check-digit method
10 - * @ingroup SpecialPages
 10+ * @ingroup SpecialPage
1111 */
1212 class SpecialBookSources extends SpecialPage {
1313
Index: branches/querypage-work/phase3/includes/specials/SpecialListfiles.php
@@ -140,8 +140,10 @@
141141 return "$link ($download)";
142142 case 'img_user_text':
143143 if ( $this->mCurrentRow->img_user ) {
144 - $link = $this->getSkin()->makeLinkObj( Title::makeTitle( NS_USER, $value ),
145 - htmlspecialchars( $value ) );
 144+ $link = $this->getSkin()->link(
 145+ Title::makeTitle( NS_USER, $value ),
 146+ htmlspecialchars( $value )
 147+ );
146148 } else {
147149 $link = htmlspecialchars( $value );
148150 }
Index: branches/querypage-work/phase3/includes/specials/SpecialUserlogin.php
@@ -948,8 +948,6 @@
949949 * @private
950950 */
951951 function onCookieRedirectCheck( $type ) {
952 - global $wgUser;
953 -
954952 if ( !$this->hasSessionCookie() ) {
955953 if ( $type == 'new' ) {
956954 return $this->mainLoginForm( wfMsgExt( 'nocookiesnew', array( 'parseinline' ) ) );
Index: branches/querypage-work/phase3/includes/specials/SpecialUnusedcategories.php
@@ -35,7 +35,7 @@
3636
3737 function formatResult( $skin, $result ) {
3838 $title = Title::makeTitle( NS_CATEGORY, $result->title );
39 - return $skin->makeLinkObj( $title, $title->getText() );
 39+ return $skin->link( $title, $title->getText() );
4040 }
4141 }
4242
Index: branches/querypage-work/phase3/includes/specials/SpecialDoubleRedirects.php
@@ -74,7 +74,7 @@
7575 }
7676 }
7777 if ( !$result ) {
78 - return '<s>' . $skin->makeLinkObj( $titleA, '', 'redirect=no' ) . '</s>';
 78+ return '<s>' . $skin->link( $titleA, null, array(), array( 'redirect' => 'no' ) ) . '</s>';
7979 }
8080
8181 $titleB = Title::makeTitle( $result->nsb, $result->tb );
Index: branches/querypage-work/phase3/includes/specials/SpecialExport.php
@@ -45,6 +45,7 @@
4646 $this->images = $wgRequest->getCheck( 'images' ); // Doesn't do anything yet
4747 $this->pageLinkDepth = $this->validateLinkDepth(
4848 $wgRequest->getIntOrNull( 'pagelink-depth' ) );
 49+ $nsindex = '';
4950
5051 if ( $wgRequest->getCheck( 'addcat' ) ) {
5152 $page = $wgRequest->getText( 'pages' );
@@ -352,6 +353,7 @@
353354 $pageSet = $this->getLinks( $inputPages, $pageSet, 'pagelinks',
354355 array( 'pl_namespace AS namespace', 'pl_title AS title' ),
355356 array( 'page_id=pl_from' ) );
 357+ $inputPages = array_keys( $pageSet );
356358 }
357359 return $pageSet;
358360 }
Index: branches/querypage-work/phase3/includes/specials/SpecialCategories.php
@@ -13,6 +13,7 @@
1414 $from = $par;
1515 }
1616 $cap = new CategoryPager( $from );
 17+ $cap->doQuery();
1718 $wgOut->addHTML(
1819 XML::openElement( 'div', array('class' => 'mw-spcontent') ) .
1920 wfMsgExt( 'categoriespagetext', array( 'parse' ) ) .
@@ -74,9 +75,6 @@
7576
7677 /* Override getBody to apply LinksBatch on resultset before actually outputting anything. */
7778 public function getBody() {
78 - if (!$this->mQueryDone) {
79 - $this->doQuery();
80 - }
8179 $batch = new LinkBatch;
8280
8381 $this->mResult->rewind();
@@ -92,7 +90,7 @@
9391 function formatRow($result) {
9492 global $wgLang;
9593 $title = Title::makeTitle( NS_CATEGORY, $result->cat_title );
96 - $titleText = $this->getSkin()->makeLinkObj( $title, htmlspecialchars( $title->getText() ) );
 94+ $titleText = $this->getSkin()->link( $title, htmlspecialchars( $title->getText() ) );
9795 $count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
9896 $wgLang->formatNum( $result->cat_pages ) );
9997 return Xml::tags('li', null, "$titleText ($count)" ) . "\n";
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedcategories.php
@@ -40,7 +40,7 @@
4141 $text = $wgContLang->convert( $nt->getText() );
4242
4343 $plink = $this->isCached() ?
44 - $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) :
 44+ $skin->link( $nt, htmlspecialchars( $text ) ) :
4545 $skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) );
4646
4747 $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
Index: branches/querypage-work/phase3/includes/specials/SpecialDeletedContributions.php
@@ -106,10 +106,9 @@
107107 * @todo This would probably look a lot nicer in a table.
108108 */
109109 function formatRow( $row ) {
 110+ global $wgUser, $wgLang;
110111 wfProfileIn( __METHOD__ );
111112
112 - global $wgLang, $wgUser;
113 -
114113 $sk = $this->getSkin();
115114
116115 $rev = new Revision( array(
@@ -156,7 +155,7 @@
157156 '&timestamp=' . $rev->getTimestamp() );
158157 }
159158
160 - $pagelink = $sk->makeLinkObj( $page );
 159+ $pagelink = $sk->link( $page );
161160
162161 if( $rev->isMinor() ) {
163162 $mflag = '<span class="minor">' . $this->messages['minoreditletter'] . '</span> ';
@@ -164,8 +163,23 @@
165164 $mflag = '';
166165 }
167166
 167+ if( $wgUser->isAllowed( 'deleterevision' ) ) {
 168+ // If revision was hidden from sysops
 169+ if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
 170+ $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
 171+ '(' . $this->message['rev-delundel'] . ')' ) . ' ';
 172+ // Otherwise, show the link...
 173+ } else {
 174+ $query = array( 'target' => $page->getPrefixedDbkey(),
 175+ 'artimestamp' => $rev->getTimestamp() );
 176+ $del = $this->mSkin->revDeleteLink( $query,
 177+ $rev->isDeleted( Revision::DELETED_RESTRICTED ) ) . ' ';
 178+ }
 179+ } else {
 180+ $del = '';
 181+ }
168182
169 - $ret = "{$link} ($last) ({$dellog}) ({$reviewlink}) . . {$mflag} {$pagelink} {$comment}";
 183+ $ret = "{$del}{$link} ({$last}) ({$dellog}) ({$reviewlink}) . . {$mflag} {$pagelink} {$comment}";
170184 if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
171185 $ret .= ' ' . wfMsgHtml( 'deletedrev' );
172186 }
@@ -290,12 +304,12 @@
291305 if ( 0 == $id ) {
292306 $user = $nt->getText();
293307 } else {
294 - $user = $sk->makeLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
 308+ $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
295309 }
296310 $talk = $nt->getTalkPage();
297311 if( $talk ) {
298312 # Talk page link
299 - $tools[] = $sk->makeLinkObj( $talk, wfMsgHtml( 'talkpagelinktext' ) );
 313+ $tools[] = $sk->link( $talk, wfMsgHtml( 'talkpagelinktext' ) );
300314 if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && User::isIP( $nt->getText() ) ) ) {
301315 # Block link
302316 if( $wgUser->isAllowed( 'block' ) )
Index: branches/querypage-work/phase3/includes/specials/SpecialContributions.php
@@ -148,12 +148,12 @@
149149 if( 0 == $id ) {
150150 $user = $nt->getText();
151151 } else {
152 - $user = $sk->makeLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
 152+ $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
153153 }
154154 $talk = $nt->getTalkPage();
155155 if( $talk ) {
156156 # Talk page link
157 - $tools[] = $sk->makeLinkObj( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
 157+ $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
158158 if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && IP::isIPAddress( $nt->getText() ) ) ) {
159159 # Block link
160160 if( $wgUser->isAllowed( 'block' ) )
@@ -473,7 +473,7 @@
474474 * @todo This would probably look a lot nicer in a table.
475475 */
476476 function formatRow( $row ) {
477 - global $wgLang, $wgUser, $wgContLang;
 477+ global $wgUser, $wgLang, $wgContLang;
478478 wfProfileIn( __METHOD__ );
479479
480480 $sk = $this->getSkin();
@@ -482,7 +482,12 @@
483483
484484 $page = Title::newFromRow( $row );
485485 $page->resetArticleId( $row->rev_page ); // use process cache
486 - $link = $sk->makeLinkObj( $page, $page->getPrefixedText(), $page->isRedirect() ? 'redirect=no' : '' );
 486+ $link = $sk->link(
 487+ $page,
 488+ $page->getPrefixedText(),
 489+ array(),
 490+ $page->isRedirect() ? array( 'redirect' => 'no' ) : array()
 491+ );
487492 # Mark current revisions
488493 $difftext = $topmarktext = '';
489494 if( $row->rev_id == $row->page_latest ) {
@@ -532,8 +537,23 @@
533538 } else {
534539 $mflag = '';
535540 }
 541+
 542+ if( $wgUser->isAllowed( 'deleterevision' ) ) {
 543+ // If revision was hidden from sysops
 544+ if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
 545+ $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
 546+ '(' . $this->message['rev-delundel'] . ')' ) . ' ';
 547+ // Otherwise, show the link...
 548+ } else {
 549+ $query = array( 'target' => $page->getPrefixedDbkey(), 'oldid' => $rev->getId() );
 550+ $del = $this->mSkin->revDeleteLink( $query,
 551+ $rev->isDeleted( Revision::DELETED_RESTRICTED ) ) . ' ';
 552+ }
 553+ } else {
 554+ $del = '';
 555+ }
536556
537 - $ret = "{$d} {$histlink} {$difftext} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
 557+ $ret = "{$del}{$d} {$histlink} {$difftext} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
538558 if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
539559 $ret .= ' ' . wfMsgHtml( 'deletedrev' );
540560 }
Index: branches/querypage-work/phase3/includes/specials/SpecialMovepage.php
@@ -91,7 +91,7 @@
9292
9393 $skin = $wgUser->getSkin();
9494
95 - $oldTitleLink = $skin->makeLinkObj( $this->oldTitle );
 95+ $oldTitleLink = $skin->link( $this->oldTitle );
9696
9797 $wgOut->setPagetitle( wfMsg( 'move-page', $this->oldTitle->getPrefixedText() ) );
9898 $wgOut->setSubtitle( wfMsg( 'move-page-backlink', $oldTitleLink ) );
@@ -468,7 +468,7 @@
469469 $extraOutput []= wfMsgHtml( 'movepage-page-moved', $oldLink, $newLink );
470470 } else {
471471 $oldLink = $skin->makeKnownLinkObj( $oldSubpage );
472 - $newLink = $skin->makeLinkObj( $newSubpage );
 472+ $newLink = $skin->link( $newSubpage );
473473 $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, $newLink );
474474 }
475475 }
Index: branches/querypage-work/phase3/includes/specials/SpecialRemoveRestrictions.php
@@ -46,7 +46,7 @@
4747 }
4848
4949 function wfSpecialRemoveRestrictionsProcess( $r ) {
50 - global $wgUser, $wgRequest;
 50+ global $wgRequest;
5151 $reason = $wgRequest->getVal( 'reason' );
5252 $result = $r->delete();
5353 $log = new LogPage( 'restrict' );
Index: branches/querypage-work/phase3/includes/specials/SpecialIpblocklist.php
@@ -162,7 +162,7 @@
163163 * @return array array(message key, parameters) on failure, empty array on success
164164 */
165165
166 - static function doUnblock(&$id, &$ip, &$reason, &$range = null) {
 166+ static function doUnblock(&$id, &$ip, &$reason, &$range = null, $blocker=null) {
167167 if ( $id ) {
168168 $block = Block::newFromID( $id );
169169 if ( !$block ) {
@@ -184,8 +184,7 @@
185185 if ( !$block ) {
186186 return array('ipb_cant_unblock', htmlspecialchars($id));
187187 }
188 - if( $block->mRangeStart != $block->mRangeEnd
189 - && !strstr( $ip, "/" ) ) {
 188+ if( $block->mRangeStart != $block->mRangeEnd && !strstr( $ip, "/" ) ) {
190189 /* If the specified IP is a single address, and the block is
191190 * a range block, don't unblock the range. */
192191 $range = $block->mAddress;
@@ -195,11 +194,22 @@
196195 }
197196 // Yes, this is really necessary
198197 $id = $block->mId;
 198+
 199+ # If the name was hidden and the blocking user cannot hide
 200+ # names, then don't allow any block removals...
 201+ if( $blocker && $block->mHideName && !$blocker->isAllowed('hideuser') ) {
 202+ return array('ipb_cant_unblock', htmlspecialchars($id));
 203+ }
199204
200205 # Delete block
201206 if ( !$block->delete() ) {
202207 return array('ipb_cant_unblock', htmlspecialchars($id));
203208 }
 209+
 210+ # Unset _deleted fields as needed
 211+ if( $block->mHideName ) {
 212+ IPBlockForm::unsuppressUserName( $block->mAddress, $block->mUser );
 213+ }
204214
205215 # Make log entry
206216 $log = new LogPage( 'block' );
@@ -208,10 +218,9 @@
209219 }
210220
211221 function doSubmit() {
212 - global $wgOut;
213 - $retval = self::doUnblock($this->id, $this->ip, $this->reason, $range);
214 - if(!empty($retval))
215 - {
 222+ global $wgOut, $wgUser;
 223+ $retval = self::doUnblock($this->id, $this->ip, $this->reason, $range, $wgUser);
 224+ if( !empty($retval) ) {
216225 $key = array_shift($retval);
217226 $this->showForm(wfMsgReal($key, $retval));
218227 return;
Index: branches/querypage-work/phase3/includes/specials/SpecialMostlinkedcategories.php
@@ -52,7 +52,7 @@
5353 $nt = Title::makeTitle( $result->namespace, $result->title );
5454 $text = $wgContLang->convert( $nt->getText() );
5555
56 - $plink = $skin->makeLinkObj( $nt, htmlspecialchars( $text ) );
 56+ $plink = $skin->link( $nt, htmlspecialchars( $text ) );
5757
5858 $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
5959 $wgLang->formatNum( $result->value ) );
Index: branches/querypage-work/phase3/includes/specials/SpecialMergeHistory.php
@@ -67,7 +67,7 @@
6868 }
6969
7070 function execute() {
71 - global $wgOut, $wgUser;
 71+ global $wgOut;
7272
7373 $wgOut->setPagetitle( wfMsgHtml( "mergehistory" ) );
7474
@@ -218,7 +218,7 @@
219219 }
220220
221221 function formatRevisionRow( $row ) {
222 - global $wgUser, $wgLang;
 222+ global $wgLang;
223223
224224 $rev = new Revision( $row );
225225
@@ -270,7 +270,7 @@
271271 }
272272
273273 function merge() {
274 - global $wgOut, $wgUser;
 274+ global $wgOut;
275275 # Get the titles directly from the IDs, in case the target page params
276276 # were spoofed. The queries are done based on the IDs, so it's best to
277277 # keep it consistent...
Index: branches/querypage-work/phase3/includes/specials/SpecialRevisiondelete.php
@@ -1442,8 +1442,8 @@
14431443 */
14441444 function updatePage( $title ) {
14451445 $title->invalidateCache();
 1446+ $this->dbw->commit(); // Commit the transaction before the purge is sent
14461447 $title->purgeSquid();
1447 - $title->touchLinks();
14481448 // Extensions that require referencing previous revisions may need this
14491449 wfRunHooks( 'ArticleRevisionVisiblitySet', array( &$title ) );
14501450 }
Index: branches/querypage-work/phase3/includes/specials/SpecialBrokenRedirects.php
@@ -68,7 +68,7 @@
6969
7070 // $toObj may very easily be false if the $result list is cached
7171 if ( !is_object( $toObj ) ) {
72 - return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
 72+ return '<s>' . $skin->link( $fromObj ) . '</s>';
7373 }
7474
7575 $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
Index: branches/querypage-work/phase3/includes/specials/SpecialListusers.php
@@ -117,7 +117,7 @@
118118 global $wgLang;
119119
120120 $userPage = Title::makeTitle( NS_USER, $row->user_name );
121 - $name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
 121+ $name = $this->getSkin()->link( $userPage, htmlspecialchars( $userPage->getText() ) );
122122
123123 if( $row->numgroups > 1 || ( $this->requestedGroup && $row->numgroups == 1 ) ) {
124124 $list = array();
Index: branches/querypage-work/phase3/includes/specials/SpecialFileDuplicateSearch.php
@@ -53,7 +53,7 @@
5454 $text = $wgContLang->convert( $nt->getText() );
5555 $plink = $skin->makeLink( $nt->getPrefixedText(), $text );
5656
57 - $user = $skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
 57+ $user = $skin->link( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
5858 $time = $wgLang->timeanddate( $result->img_timestamp );
5959
6060 return "$plink . . $user . . $time";
Index: branches/querypage-work/phase3/includes/specials/SpecialPreferences.php
@@ -1,1309 +1,75 @@
22 <?php
3 -/**
4 - * Hold things related to displaying and saving user preferences.
5 - * @file
6 - * @ingroup SpecialPage
7 - */
83
9 -/**
10 - * Entry point that create the "Preferences" object
11 - */
12 -function wfSpecialPreferences() {
13 - global $wgRequest;
 4+class SpecialPreferences extends SpecialPage {
 5+ function __construct() {
 6+ parent::__construct( 'Preferences' );
 7+ }
148
15 - $form = new PreferencesForm( $wgRequest );
16 - $form->execute();
17 -}
 9+ function execute( $par ) {
 10+ global $wgOut, $wgUser, $wgRequest;
1811
19 -/**
20 - * Preferences form handling
21 - * This object will show the preferences form and can save it as well.
22 - * @ingroup SpecialPage
23 - */
24 -class PreferencesForm {
25 - var $mQuickbar, $mStubs;
26 - var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick;
27 - var $mUserLanguage, $mUserVariant;
28 - var $mSearch, $mRecent, $mRecentDays, $mTimeZone, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
29 - var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
30 - var $mUnderline, $mWatchlistEdits, $mGender;
 12+ $this->setHeaders();
 13+ $this->outputHeader();
3114
32 - /**
33 - * Constructor
34 - * Load some values
35 - */
36 - function __construct( &$request ) {
37 - global $wgContLang, $wgUser, $wgAllowRealName;
 15+ $wgOut->addScriptFile( 'prefs.js' );
3816
39 - $this->mQuickbar = $request->getVal( 'wpQuickbar' );
40 - $this->mStubs = $request->getVal( 'wpStubs' );
41 - $this->mRows = $request->getVal( 'wpRows' );
42 - $this->mCols = $request->getVal( 'wpCols' );
43 - $this->mSkin = Skin::normalizeKey( $request->getVal( 'wpSkin' ) );
44 - $this->mMath = $request->getVal( 'wpMath' );
45 - $this->mDate = $request->getVal( 'wpDate' );
46 - $this->mUserEmail = $request->getVal( 'wpUserEmail' );
47 - $this->mRealName = $wgAllowRealName ? $request->getVal( 'wpRealName' ) : '';
48 - $this->mEmailFlag = $request->getCheck( 'wpEmailFlag' ) ? 0 : 1;
49 - $this->mNick = $request->getVal( 'wpNick' );
50 - $this->mUserLanguage = $request->getVal( 'wpUserLanguage' );
51 - $this->mUserVariant = $request->getVal( 'wpUserVariant' );
52 - $this->mSearch = $request->getVal( 'wpSearch' );
53 - $this->mRecent = $request->getVal( 'wpRecent' );
54 - $this->mRecentDays = $request->getVal( 'wpRecentDays' );
55 - $this->mTimeZone = $request->getVal( 'wpTimeZone' );
56 - $this->mHourDiff = $request->getVal( 'wpHourDiff' );
57 - $this->mSearchLines = $request->getVal( 'wpSearchLines' );
58 - $this->mSearchChars = $request->getVal( 'wpSearchChars' );
59 - $this->mImageSize = $request->getVal( 'wpImageSize' );
60 - $this->mThumbSize = $request->getInt( 'wpThumbSize' );
61 - $this->mUnderline = $request->getInt( 'wpOpunderline' );
62 - $this->mAction = $request->getVal( 'action' );
63 - $this->mReset = $request->getCheck( 'wpReset' );
64 - $this->mRestoreprefs = $request->getCheck( 'wpRestore' );
65 - $this->mPosted = $request->wasPosted();
66 - $this->mSuccess = $request->getCheck( 'success' );
67 - $this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' );
68 - $this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' );
69 - $this->mDisableMWSuggest = $request->getCheck( 'wpDisableMWSuggest' );
70 - $this->mGender = $request->getVal( 'wpGender' );
 17+ $wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc.
7118
72 - $this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
73 - $this->mPosted &&
74 - $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
75 -
76 - # User toggles (the big ugly unsorted list of checkboxes)
77 - $this->mToggles = array();
78 - if ( $this->mPosted ) {
79 - $togs = User::getToggles();
80 - foreach ( $togs as $tname ) {
81 - $this->mToggles[$tname] = $request->getCheck( "wpOp$tname" ) ? 1 : 0;
82 - }
83 - }
84 -
85 - $this->mUsedToggles = array();
86 -
87 - # Search namespace options
88 - # Note: namespaces don't necessarily have consecutive keys
89 - $this->mSearchNs = array();
90 - if ( $this->mPosted ) {
91 - $namespaces = $wgContLang->getNamespaces();
92 - foreach ( $namespaces as $i => $namespace ) {
93 - if ( $i >= 0 ) {
94 - $this->mSearchNs[$i] = $request->getCheck( "wpNs$i" ) ? 1 : 0;
95 - }
96 - }
97 - }
98 -
99 - # Validate language
100 - if ( !preg_match( '/^[a-z\-]*$/', $this->mUserLanguage ) ) {
101 - $this->mUserLanguage = 'nolanguage';
102 - }
103 -
104 - wfRunHooks( 'InitPreferencesForm', array( $this, $request ) );
105 - }
106 -
107 - function execute() {
108 - global $wgUser, $wgOut;
109 -
11019 if ( $wgUser->isAnon() ) {
111 - $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext',
112 - array( SpecialPage::getTitleFor( 'Preferences' )->getPrefixedDBkey() ) );
 20+ $wgOut->showErrorPage( 'prefsnologin', 'prefsnologintext', array( $this->getTitle()->getPrefixedDBkey() ) );
11321 return;
11422 }
11523 if ( wfReadOnly() ) {
11624 $wgOut->readOnlyPage();
11725 return;
11826 }
119 - if ( $this->mReset ) {
120 - $this->resetPrefs();
121 - $this->mainPrefsForm( 'reset', wfMsg( 'prefsreset' ) );
122 - } else if ( $this->mSaveprefs ) {
123 - $this->savePreferences();
124 - } else if ( $this->mRestoreprefs ) {
125 - $this->restorePreferences();
126 - } else {
127 - $this->resetPrefs();
128 - $this->mainPrefsForm( '' );
129 - }
130 - }
131 - /**
132 - * @access private
133 - */
134 - function validateInt( &$val, $min=0, $max=0x7fffffff ) {
135 - $val = intval($val);
136 - $val = min($val, $max);
137 - $val = max($val, $min);
138 - return $val;
139 - }
14027
141 - /**
142 - * @access private
143 - */
144 - function validateFloat( &$val, $min, $max=0x7fffffff ) {
145 - $val = floatval( $val );
146 - $val = min( $val, $max );
147 - $val = max( $val, $min );
148 - return( $val );
149 - }
150 -
151 - /**
152 - * @access private
153 - */
154 - function validateIntOrNull( &$val, $min=0, $max=0x7fffffff ) {
155 - $val = trim($val);
156 - if($val === '') {
157 - return null;
158 - } else {
159 - return $this->validateInt( $val, $min, $max );
160 - }
161 - }
162 -
163 - /**
164 - * @access private
165 - */
166 - function validateDate( $val ) {
167 - global $wgLang, $wgContLang;
168 - if ( $val !== false && (
169 - in_array( $val, (array)$wgLang->getDatePreferences() ) ||
170 - in_array( $val, (array)$wgContLang->getDatePreferences() ) ) )
171 - {
172 - return $val;
173 - } else {
174 - return $wgLang->getDefaultDateFormat();
175 - }
176 - }
177 -
178 - /**
179 - * Used to validate the user inputed timezone before saving it as
180 - * 'timecorrection', will return 'System' if fed bogus data.
181 - * @access private
182 - * @param string $tz the user input Zoneinfo timezone
183 - * @param string $s the user input offset string
184 - * @return string
185 - */
186 - function validateTimeZone( $tz, $s ) {
187 - $data = explode( '|', $tz, 3 );
188 - switch ( $data[0] ) {
189 - case 'ZoneInfo':
190 - case 'System':
191 - return $tz;
192 - case 'Offset':
193 - default:
194 - $data = explode( ':', $s, 2 );
195 - $minDiff = 0;
196 - if( count( $data ) == 2 ) {
197 - $data[0] = intval( $data[0] );
198 - $data[1] = intval( $data[1] );
199 - $minDiff = abs( $data[0] ) * 60 + $data[1];
200 - if ( $data[0] < 0 ) $minDiff = -$minDiff;
201 - } else {
202 - $minDiff = intval( $data[0] ) * 60;
203 - }
204 -
205 - # Max is +14:00 and min is -12:00, see:
206 - # http://en.wikipedia.org/wiki/Timezone
207 - $minDiff = min( $minDiff, 840 ); # 14:00
208 - $minDiff = max( $minDiff, -720 ); # -12:00
209 - return 'Offset|'.$minDiff;
210 - }
211 - }
212 -
213 - function validateGender( $val ) {
214 - $valid = array( 'male', 'female', 'unknown' );
215 - if ( in_array($val, $valid) ) {
216 - return $val;
217 - } else {
218 - return User::getDefaultOption( 'gender' );
219 - }
220 - }
221 -
222 - /**
223 - * @access private
224 - */
225 - function savePreferences() {
226 - global $wgUser, $wgOut, $wgParser;
227 - global $wgEnableUserEmail, $wgEnableEmail;
228 - global $wgEmailAuthentication, $wgRCMaxAge;
229 - global $wgAuth, $wgEmailConfirmToEdit;
230 -
231 - $wgUser->setRealName( $this->mRealName );
232 - $oldOptions = $wgUser->mOptions;
233 -
234 - if( $wgUser->getOption( 'language' ) !== $this->mUserLanguage ) {
235 - $needRedirect = true;
236 - } else {
237 - $needRedirect = false;
238 - }
239 -
240 - # Validate the signature and clean it up as needed
241 - global $wgMaxSigChars;
242 - if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
243 - global $wgLang;
244 - $this->mainPrefsForm( 'error',
245 - wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) );
 28+ if ( $par == 'reset' ) {
 29+ $this->showResetForm();
24630 return;
247 - } elseif( $this->mToggles['fancysig'] ) {
248 - if( $wgParser->validateSig( $this->mNick ) !== false ) {
249 - $this->mNick = $wgParser->cleanSig( $this->mNick );
250 - } else {
251 - $this->mainPrefsForm( 'error', wfMsg( 'badsig' ) );
252 - return;
253 - }
254 - } else {
255 - // When no fancy sig used, make sure ~{3,5} get removed.
256 - $this->mNick = $wgParser->cleanSigInSig( $this->mNick );
25731 }
25832
259 - $wgUser->setOption( 'language', $this->mUserLanguage );
260 - $wgUser->setOption( 'variant', $this->mUserVariant );
261 - $wgUser->setOption( 'nickname', $this->mNick );
262 - $wgUser->setOption( 'quickbar', $this->mQuickbar );
263 - global $wgAllowUserSkin;
264 - if( $wgAllowUserSkin ) {
265 - $wgUser->setOption( 'skin', $this->mSkin );
 33+ if ( $wgRequest->getCheck( 'success' ) ) {
 34+ $wgOut->wrapWikiMsg(
 35+ '<div class="successbox"><strong>$1</strong></div>',
 36+ 'savedprefs'
 37+ );
26638 }
267 - global $wgUseTeX;
268 - if( $wgUseTeX ) {
269 - $wgUser->setOption( 'math', $this->mMath );
 39+
 40+ if ( $wgRequest->getCheck( 'eauth' ) ) {
 41+ $wgOut->wrapWikiMsg( "<div class='error' style='clear: both;'>$1</div>",
 42+ 'eauthentsent', $wgUser->getName() );
27043 }
271 - $wgUser->setOption( 'date', $this->validateDate( $this->mDate ) );
272 - $wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch ) );
273 - $wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines ) );
274 - $wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars ) );
275 - $wgUser->setOption( 'rclimit', $this->validateIntOrNull( $this->mRecent ) );
276 - $wgUser->setOption( 'rcdays', $this->validateInt($this->mRecentDays, 1, ceil($wgRCMaxAge / (3600*24))));
277 - $wgUser->setOption( 'wllimit', $this->validateIntOrNull( $this->mWatchlistEdits, 0, 1000 ) );
278 - $wgUser->setOption( 'rows', $this->validateInt( $this->mRows, 4, 1000 ) );
279 - $wgUser->setOption( 'cols', $this->validateInt( $this->mCols, 4, 1000 ) );
280 - $wgUser->setOption( 'stubthreshold', $this->validateIntOrNull( $this->mStubs ) );
281 - $wgUser->setOption( 'timecorrection', $this->validateTimeZone( $this->mTimeZone, $this->mHourDiff ) );
282 - $wgUser->setOption( 'imagesize', $this->mImageSize );
283 - $wgUser->setOption( 'thumbsize', $this->mThumbSize );
284 - $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
285 - $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) );
286 - $wgUser->setOption( 'disablesuggest', $this->mDisableMWSuggest );
287 - $wgUser->setOption( 'gender', $this->validateGender( $this->mGender ) );
28844
289 - # Set search namespace options
290 - foreach( $this->mSearchNs as $i => $value ) {
291 - $wgUser->setOption( "searchNs{$i}", $value );
292 - }
 45+ $htmlForm = Preferences::getFormObject( $wgUser );
 46+ $htmlForm->setSubmitCallback( array( 'Preferences', 'tryUISubmit' ) );
29347
294 - if( $wgEnableEmail && $wgEnableUserEmail ) {
295 - $wgUser->setOption( 'disablemail', $this->mEmailFlag );
296 - }
297 -
298 - # Set user toggles
299 - foreach ( $this->mToggles as $tname => $tvalue ) {
300 - $wgUser->setOption( $tname, $tvalue );
301 - }
302 -
303 - $error = false;
304 - if( $wgEnableEmail ) {
305 - $newadr = $this->mUserEmail;
306 - $oldadr = $wgUser->getEmail();
307 - if( ($newadr != '') && ($newadr != $oldadr) ) {
308 - # the user has supplied a new email address on the login page
309 - if( $wgUser->isValidEmailAddr( $newadr ) ) {
310 - # new behaviour: set this new emailaddr from login-page into user database record
311 - $wgUser->setEmail( $newadr );
312 - # but flag as "dirty" = unauthenticated
313 - $wgUser->invalidateEmail();
314 - if ($wgEmailAuthentication) {
315 - # Mail a temporary password to the dirty address.
316 - # User can come back through the confirmation URL to re-enable email.
317 - $result = $wgUser->sendConfirmationMail();
318 - if( WikiError::isError( $result ) ) {
319 - $error = wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
320 - } else {
321 - $error = wfMsg( 'eauthentsent', $wgUser->getName() );
322 - }
323 - }
324 - } else {
325 - $error = wfMsg( 'invalidemailaddress' );
326 - }
327 - } else {
328 - if( $wgEmailConfirmToEdit && empty( $newadr ) ) {
329 - $this->mainPrefsForm( 'error', wfMsg( 'noemailtitle' ) );
330 - return;
331 - }
332 - $wgUser->setEmail( $this->mUserEmail );
333 - }
334 - if( $oldadr != $newadr ) {
335 - wfRunHooks( 'PrefsEmailAudit', array( $wgUser, $oldadr, $newadr ) );
336 - }
337 - }
338 -
339 - if( !$wgAuth->updateExternalDB( $wgUser ) ){
340 - $this->mainPrefsForm( 'error', wfMsg( 'externaldberror' ) );
341 - return;
342 - }
343 -
344 - $msg = '';
345 - if ( !wfRunHooks( 'SavePreferences', array( $this, $wgUser, &$msg, $oldOptions ) ) ) {
346 - $this->mainPrefsForm( 'error', $msg );
347 - return;
348 - }
349 -
350 - $wgUser->setCookies();
351 - $wgUser->saveSettings();
352 -
353 - if( $needRedirect && $error === false ) {
354 - $title = SpecialPage::getTitleFor( 'Preferences' );
355 - $wgOut->redirect( $title->getFullURL( 'success' ) );
356 - return;
357 - }
358 -
359 - $wgOut->parserOptions( ParserOptions::newFromUser( $wgUser ) );
360 - $this->mainPrefsForm( $error === false ? 'success' : 'error', $error);
 48+ $htmlForm->show();
36149 }
36250
363 - /**
364 - * @access private
365 - */
366 - function resetPrefs() {
367 - global $wgUser, $wgLang, $wgContLang, $wgContLanguageCode, $wgAllowRealName, $wgLocalTZoffset;
 51+ function showResetForm() {
 52+ global $wgOut;
36853
369 - $this->mUserEmail = $wgUser->getEmail();
370 - $this->mUserEmailAuthenticationtimestamp = $wgUser->getEmailAuthenticationtimestamp();
371 - $this->mRealName = ($wgAllowRealName) ? $wgUser->getRealName() : '';
 54+ $wgOut->addWikiMsg( 'prefs-reset-intro' );
37255
373 - # language value might be blank, default to content language
374 - $this->mUserLanguage = $wgUser->getOption( 'language', $wgContLanguageCode );
 56+ $htmlForm = new HTMLForm( array(), 'prefs-restore' );
37557
376 - $this->mUserVariant = $wgUser->getOption( 'variant');
377 - $this->mEmailFlag = $wgUser->getOption( 'disablemail' ) == 1 ? 1 : 0;
378 - $this->mNick = $wgUser->getOption( 'nickname' );
 58+ $htmlForm->setSubmitText( wfMsg( 'restoreprefs' ) );
 59+ $htmlForm->setTitle( $this->getTitle( 'reset' ) );
 60+ $htmlForm->setSubmitCallback( array( __CLASS__, 'submitReset' ) );
 61+ $htmlForm->suppressReset();
37962
380 - $this->mQuickbar = $wgUser->getOption( 'quickbar' );
381 - $this->mSkin = Skin::normalizeKey( $wgUser->getOption( 'skin' ) );
382 - $this->mMath = $wgUser->getOption( 'math' );
383 - $this->mDate = $wgUser->getDatePreference();
384 - $this->mRows = $wgUser->getOption( 'rows' );
385 - $this->mCols = $wgUser->getOption( 'cols' );
386 - $this->mStubs = $wgUser->getOption( 'stubthreshold' );
387 -
388 - $tz = $wgUser->getOption( 'timecorrection' );
389 - $data = explode( '|', $tz, 3 );
390 - $minDiff = null;
391 - switch ( $data[0] ) {
392 - case 'ZoneInfo':
393 - $this->mTimeZone = $tz;
394 - # Check if the specified TZ exists, and change to 'Offset' if
395 - # not.
396 - if ( !function_exists('timezone_open') || @timezone_open( $data[2] ) === false ) {
397 - $this->mTimeZone = 'Offset';
398 - $minDiff = intval( $data[1] );
399 - }
400 - break;
401 - case '':
402 - case 'System':
403 - $this->mTimeZone = 'System|'.$wgLocalTZoffset;
404 - break;
405 - case 'Offset':
406 - $this->mTimeZone = 'Offset';
407 - $minDiff = intval( $data[1] );
408 - break;
409 - default:
410 - $this->mTimeZone = 'Offset';
411 - $data = explode( ':', $tz, 2 );
412 - if( count( $data ) == 2 ) {
413 - $data[0] = intval( $data[0] );
414 - $data[1] = intval( $data[1] );
415 - $minDiff = abs( $data[0] ) * 60 + $data[1];
416 - if ( $data[0] < 0 ) $minDiff = -$minDiff;
417 - } else {
418 - $minDiff = intval( $data[0] ) * 60;
419 - }
420 - break;
421 - }
422 - if ( is_null( $minDiff ) ) {
423 - $this->mHourDiff = '';
424 - } else {
425 - $this->mHourDiff = sprintf( '%+03d:%02d', floor($minDiff/60), abs($minDiff)%60 );
426 - }
427 -
428 - $this->mSearch = $wgUser->getOption( 'searchlimit' );
429 - $this->mSearchLines = $wgUser->getOption( 'contextlines' );
430 - $this->mSearchChars = $wgUser->getOption( 'contextchars' );
431 - $this->mImageSize = $wgUser->getOption( 'imagesize' );
432 - $this->mThumbSize = $wgUser->getOption( 'thumbsize' );
433 - $this->mRecent = $wgUser->getOption( 'rclimit' );
434 - $this->mRecentDays = $wgUser->getOption( 'rcdays' );
435 - $this->mWatchlistEdits = $wgUser->getOption( 'wllimit' );
436 - $this->mUnderline = $wgUser->getOption( 'underline' );
437 - $this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' );
438 - $this->mDisableMWSuggest = $wgUser->getBoolOption( 'disablesuggest' );
439 - $this->mGender = $wgUser->getOption( 'gender' );
440 -
441 - $togs = User::getToggles();
442 - foreach ( $togs as $tname ) {
443 - $this->mToggles[$tname] = $wgUser->getOption( $tname );
444 - }
445 -
446 - $namespaces = $wgContLang->getNamespaces();
447 - foreach ( $namespaces as $i => $namespace ) {
448 - if ( $i >= NS_MAIN ) {
449 - $this->mSearchNs[$i] = $wgUser->getOption( 'searchNs'.$i );
450 - }
451 - }
452 -
453 - wfRunHooks( 'ResetPreferences', array( $this, $wgUser ) );
 63+ $htmlForm->show();
45464 }
455 -
456 - /**
457 - * @access private
458 - */
459 - function restorePreferences() {
 65+
 66+ static function submitReset( $formData ) {
46067 global $wgUser, $wgOut;
461 - $wgUser->restoreOptions();
462 - $wgUser->setCookies();
463 - $wgUser->saveSettings();
464 - $title = SpecialPage::getTitleFor( 'Preferences' );
465 - $wgOut->redirect( $title->getFullURL( 'success' ) );
466 - }
 68+ $wgUser->resetOptions();
46769
468 - /**
469 - * @access private
470 - */
471 - function namespacesCheckboxes() {
472 - global $wgContLang;
 70+ $url = SpecialPage::getTitleFor( 'Preferences' )->getFullURL( 'success' );
47371
474 - # Determine namespace checkboxes
475 - $namespaces = $wgContLang->getNamespaces();
476 - $r1 = null;
 72+ $wgOut->redirect( $url );
47773
478 - foreach ( $namespaces as $i => $name ) {
479 - if ($i < 0)
480 - continue;
481 - $checked = $this->mSearchNs[$i] ? "checked='checked'" : '';
482 - $name = str_replace( '_', ' ', $namespaces[$i] );
483 -
484 - if ( empty($name) )
485 - $name = wfMsg( 'blanknamespace' );
486 -
487 - $r1 .= "<input type='checkbox' value='1' name='wpNs$i' id='wpNs$i' {$checked}/> <label for='wpNs$i'>{$name}</label><br />\n";
488 - }
489 - return $r1;
 74+ return true;
49075 }
491 -
492 -
493 - function getToggle( $tname, $trailer = false, $disabled = false ) {
494 - global $wgUser, $wgLang;
495 -
496 - $this->mUsedToggles[$tname] = true;
497 - $ttext = $wgLang->getUserToggle( $tname );
498 -
499 - $checked = $wgUser->getOption( $tname ) == 1 ? ' checked="checked"' : '';
500 - $disabled = $disabled ? ' disabled="disabled"' : '';
501 - $trailer = $trailer ? $trailer : '';
502 - return "<div class='toggle'><input type='checkbox' value='1' id=\"$tname\" name=\"wpOp$tname\"$checked$disabled />" .
503 - " <span class='toggletext'><label for=\"$tname\">$ttext</label>$trailer</span></div>\n";
504 - }
505 -
506 - function getToggles( $items ) {
507 - $out = "";
508 - foreach( $items as $item ) {
509 - if( $item === false )
510 - continue;
511 - if( is_array( $item ) ) {
512 - list( $key, $trailer ) = $item;
513 - } else {
514 - $key = $item;
515 - $trailer = false;
516 - }
517 - $out .= $this->getToggle( $key, $trailer );
518 - }
519 - return $out;
520 - }
521 -
522 - function addRow($td1, $td2) {
523 - return "<tr><td class='mw-label'>$td1</td><td class='mw-input'>$td2</td></tr>";
524 - }
525 -
526 - /**
527 - * Helper function for user information panel
528 - * @param $td1 label for an item
529 - * @param $td2 item or null
530 - * @param $td3 optional help or null
531 - * @return xhtml block
532 - */
533 - function tableRow( $td1, $td2 = null, $td3 = null ) {
534 -
535 - if ( is_null( $td3 ) ) {
536 - $td3 = '';
537 - } else {
538 - $td3 = Xml::tags( 'tr', null,
539 - Xml::tags( 'td', array( 'class' => 'pref-label', 'colspan' => '2' ), $td3 )
540 - );
541 - }
542 -
543 - if ( is_null( $td2 ) ) {
544 - $td1 = Xml::tags( 'td', array( 'class' => 'pref-label', 'colspan' => '2' ), $td1 );
545 - $td2 = '';
546 - } else {
547 - $td1 = Xml::tags( 'td', array( 'class' => 'pref-label' ), $td1 );
548 - $td2 = Xml::tags( 'td', array( 'class' => 'pref-input' ), $td2 );
549 - }
550 -
551 - return Xml::tags( 'tr', null, $td1 . $td2 ). $td3 . "\n";
552 -
553 - }
554 -
555 - /**
556 - * @access private
557 - */
558 - function mainPrefsForm( $status , $message = '' ) {
559 - global $wgUser, $wgOut, $wgLang, $wgContLang, $wgAuth;
560 - global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
561 - global $wgDisableLangConversion, $wgDisableTitleConversion;
562 - global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
563 - global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
564 - global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
565 - global $wgContLanguageCode, $wgDefaultSkin, $wgCookieExpiration;
566 - global $wgEmailConfirmToEdit, $wgEnableMWSuggest, $wgLocalTZoffset;
567 -
568 - $wgOut->setPageTitle( wfMsg( 'preferences' ) );
569 - $wgOut->setArticleRelated( false );
570 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
571 - $wgOut->addScriptFile( 'prefs.js' );
572 -
573 - $wgOut->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc.
574 -
575 - if ( $this->mSuccess || 'success' == $status ) {
576 - $wgOut->wrapWikiMsg( '<div class="successbox"><strong>$1</strong></div>', 'savedprefs' );
577 - } else if ( 'error' == $status ) {
578 - $wgOut->addWikiText( '<div class="errorbox"><strong>' . $message . '</strong></div>' );
579 - } else if ( '' != $status ) {
580 - $wgOut->addWikiText( $message . "\n----" );
581 - }
582 -
583 - $qbs = $wgLang->getQuickbarSettings();
584 - $mathopts = $wgLang->getMathNames();
585 - $dateopts = $wgLang->getDatePreferences();
586 - $togs = User::getToggles();
587 -
588 - $titleObj = SpecialPage::getTitleFor( 'Preferences' );
589 -
590 - # Pre-expire some toggles so they won't show if disabled
591 - $this->mUsedToggles[ 'shownumberswatching' ] = true;
592 - $this->mUsedToggles[ 'showupdated' ] = true;
593 - $this->mUsedToggles[ 'enotifwatchlistpages' ] = true;
594 - $this->mUsedToggles[ 'enotifusertalkpages' ] = true;
595 - $this->mUsedToggles[ 'enotifminoredits' ] = true;
596 - $this->mUsedToggles[ 'enotifrevealaddr' ] = true;
597 - $this->mUsedToggles[ 'ccmeonemails' ] = true;
598 - $this->mUsedToggles[ 'uselivepreview' ] = true;
599 - $this->mUsedToggles[ 'noconvertlink' ] = true;
600 -
601 -
602 - if ( !$this->mEmailFlag ) { $emfc = 'checked="checked"'; }
603 - else { $emfc = ''; }
604 -
605 -
606 - if ($wgEmailAuthentication && ($this->mUserEmail != '') ) {
607 - if( $wgUser->getEmailAuthenticationTimestamp() ) {
608 - // date and time are separate parameters to facilitate localisation.
609 - // $time is kept for backward compat reasons.
610 - // 'emailauthenticated' is also used in SpecialConfirmemail.php
611 - $time = $wgLang->timeAndDate( $wgUser->getEmailAuthenticationTimestamp(), true );
612 - $d = $wgLang->date( $wgUser->getEmailAuthenticationTimestamp(), true );
613 - $t = $wgLang->time( $wgUser->getEmailAuthenticationTimestamp(), true );
614 - $emailauthenticated = wfMsg('emailauthenticated', $time, $d, $t ).'<br />';
615 - $disableEmailPrefs = false;
616 - } else {
617 - $disableEmailPrefs = true;
618 - $skin = $wgUser->getSkin();
619 - $emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
620 - $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ),
621 - wfMsg( 'emailconfirmlink' ) ) . '<br />';
622 - }
623 - } else {
624 - $emailauthenticated = '';
625 - $disableEmailPrefs = false;
626 - }
627 -
628 - if ($this->mUserEmail == '') {
629 - $emailauthenticated = wfMsg( 'noemailprefs' ) . '<br />';
630 - }
631 -
632 - $ps = $this->namespacesCheckboxes();
633 -
634 - $enotifwatchlistpages = ($wgEnotifWatchlist) ? $this->getToggle( 'enotifwatchlistpages', false, $disableEmailPrefs ) : '';
635 - $enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages', false, $disableEmailPrefs ) : '';
636 - $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits', false, $disableEmailPrefs ) : '';
637 - $enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr', false, $disableEmailPrefs ) : '';
638 -
639 - # </FIXME>
640 -
641 - $wgOut->addHTML(
642 - Xml::openElement( 'form', array(
643 - 'action' => $titleObj->getLocalUrl(),
644 - 'method' => 'post',
645 - 'id' => 'mw-preferences-form',
646 - ) ) .
647 - Xml::openElement( 'div', array( 'id' => 'preferences' ) )
648 - );
649 -
650 - # User data
651 -
652 - $wgOut->addHTML(
653 - Xml::fieldset( wfMsg('prefs-personal') ) .
654 - Xml::openElement( 'table' ) .
655 - $this->tableRow( Xml::element( 'h2', null, wfMsg( 'prefs-personal' ) ) )
656 - );
657 -
658 - # Get groups to which the user belongs
659 - $userEffectiveGroups = $wgUser->getEffectiveGroups();
660 - $userEffectiveGroupsArray = array();
661 - foreach( $userEffectiveGroups as $ueg ) {
662 - if( $ueg == '*' ) {
663 - // Skip the default * group, seems useless here
664 - continue;
665 - }
666 - $userEffectiveGroupsArray[] = User::makeGroupLinkHTML( $ueg );
667 - }
668 - asort( $userEffectiveGroupsArray );
669 -
670 - $sk = $wgUser->getSkin();
671 - $toolLinks = array();
672 - $toolLinks[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'ListGroupRights' ), wfMsg( 'listgrouprights' ) );
673 - # At the moment one tool link only but be prepared for the future...
674 - # FIXME: Add a link to Special:Userrights for users who are allowed to use it.
675 - # $wgUser->isAllowed( 'userrights' ) seems to strict in some cases
676 -
677 - $userInformationHtml =
678 - $this->tableRow( wfMsgHtml( 'username' ), htmlspecialchars( $wgUser->getName() ) ) .
679 - $this->tableRow( wfMsgHtml( 'uid' ), htmlspecialchars( $wgUser->getId() ) ) .
680 -
681 - $this->tableRow(
682 - wfMsgExt( 'prefs-memberingroups', array( 'parseinline' ), count( $userEffectiveGroupsArray ) ),
683 - $wgLang->commaList( $userEffectiveGroupsArray ) .
684 - '<br />(' . $wgLang->pipeList( $toolLinks ) . ')'
685 - ) .
686 -
687 - $this->tableRow(
688 - wfMsgHtml( 'prefs-edits' ),
689 - $wgLang->formatNum( $wgUser->getEditCount() )
690 - );
691 -
692 - if( wfRunHooks( 'PreferencesUserInformationPanel', array( $this, &$userInformationHtml ) ) ) {
693 - $wgOut->addHTML( $userInformationHtml );
694 - }
695 -
696 - if ( $wgAllowRealName ) {
697 - $wgOut->addHTML(
698 - $this->tableRow(
699 - Xml::label( wfMsg('yourrealname'), 'wpRealName' ),
700 - Xml::input( 'wpRealName', 25, $this->mRealName, array( 'id' => 'wpRealName' ) ),
701 - Xml::tags('div', array( 'class' => 'prefsectiontip' ),
702 - wfMsgExt( 'prefs-help-realname', 'parseinline' )
703 - )
704 - )
705 - );
706 - }
707 - if ( $wgEnableEmail ) {
708 - $wgOut->addHTML(
709 - $this->tableRow(
710 - Xml::label( wfMsg('youremail'), 'wpUserEmail' ),
711 - Xml::input( 'wpUserEmail', 25, $this->mUserEmail, array( 'id' => 'wpUserEmail' ) ),
712 - Xml::tags('div', array( 'class' => 'prefsectiontip' ),
713 - wfMsgExt( $wgEmailConfirmToEdit ? 'prefs-help-email-required' : 'prefs-help-email', 'parseinline' )
714 - )
715 - )
716 - );
717 - }
718 -
719 - global $wgParser, $wgMaxSigChars;
720 - if( mb_strlen( $this->mNick ) > $wgMaxSigChars ) {
721 - $invalidSig = $this->tableRow(
722 - '&nbsp;',
723 - Xml::element( 'span', array( 'class' => 'error' ),
724 - wfMsgExt( 'badsiglength', 'parsemag', $wgLang->formatNum( $wgMaxSigChars ) ) )
725 - );
726 - } elseif( !empty( $this->mToggles['fancysig'] ) &&
727 - false === $wgParser->validateSig( $this->mNick ) ) {
728 - $invalidSig = $this->tableRow(
729 - '&nbsp;',
730 - Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'badsig' ) )
731 - );
732 - } else {
733 - $invalidSig = '';
734 - }
735 -
736 - $wgOut->addHTML(
737 - $this->tableRow(
738 - Xml::label( wfMsg( 'yournick' ), 'wpNick' ),
739 - Xml::input( 'wpNick', 25, $this->mNick,
740 - array(
741 - 'id' => 'wpNick',
742 - // Note: $wgMaxSigChars is enforced in Unicode characters,
743 - // both on the backend and now in the browser.
744 - // Badly-behaved requests may still try to submit
745 - // an overlong string, however.
746 - 'maxlength' => $wgMaxSigChars ) )
747 - ) .
748 - $invalidSig .
749 - $this->tableRow( '&nbsp;', $this->getToggle( 'fancysig' ) )
750 - );
751 -
752 - $gender = new XMLSelect( 'wpGender', 'wpGender', $this->mGender );
753 - $gender->addOption( wfMsg( 'gender-unknown' ), 'unknown' );
754 - $gender->addOption( wfMsg( 'gender-male' ), 'male' );
755 - $gender->addOption( wfMsg( 'gender-female' ), 'female' );
756 -
757 - $wgOut->addHTML(
758 - $this->tableRow(
759 - Xml::label( wfMsg( 'yourgender' ), 'wpGender' ),
760 - $gender->getHTML(),
761 - Xml::tags( 'div', array( 'class' => 'prefsectiontip' ),
762 - wfMsgExt( 'prefs-help-gender', 'parseinline' )
763 - )
764 - )
765 - );
766 -
767 - list( $lsLabel, $lsSelect) = Xml::languageSelector( $this->mUserLanguage, false );
768 - $wgOut->addHTML(
769 - $this->tableRow( $lsLabel, $lsSelect )
770 - );
771 -
772 - /* see if there are multiple language variants to choose from*/
773 - if(!$wgDisableLangConversion) {
774 - $variants = $wgContLang->getVariants();
775 - $variantArray = array();
776 -
777 - $languages = Language::getLanguageNames( true );
778 - foreach($variants as $v) {
779 - $v = str_replace( '_', '-', strtolower($v));
780 - if( array_key_exists( $v, $languages ) ) {
781 - // If it doesn't have a name, we'll pretend it doesn't exist
782 - $variantArray[$v] = $languages[$v];
783 - }
784 - }
785 -
786 - $options = "\n";
787 - foreach( $variantArray as $code => $name ) {
788 - $selected = ($code == $this->mUserVariant);
789 - $options .= Xml::option( "$code - $name", $code, $selected ) . "\n";
790 - }
791 -
792 - if(count($variantArray) > 1) {
793 - $wgOut->addHTML(
794 - $this->tableRow(
795 - Xml::label( wfMsg( 'yourvariant' ), 'wpUserVariant' ),
796 - Xml::tags( 'select',
797 - array( 'name' => 'wpUserVariant', 'id' => 'wpUserVariant' ),
798 - $options
799 - )
800 - )
801 - );
802 - }
803 -
804 - if(count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) {
805 - $wgOut->addHTML(
806 - Xml::tags( 'tr', null,
807 - Xml::tags( 'td', array( 'colspan' => '2' ),
808 - $this->getToggle( "noconvertlink" )
809 - )
810 - )
811 - );
812 - }
813 - }
814 -
815 - # Password
816 - if( $wgAuth->allowPasswordChange() ) {
817 - $link = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'ResetPass' ), wfMsgHtml( 'prefs-resetpass' ),
818 - array() , array('returnto' => SpecialPage::getTitleFor( 'Preferences') ) );
819 - $wgOut->addHTML(
820 - $this->tableRow( Xml::element( 'h2', null, wfMsg( 'changepassword' ) ) ) .
821 - $this->tableRow( '<ul><li>' . $link . '</li></ul>' ) );
822 - }
823 -
824 - # <FIXME>
825 - # Enotif
826 - if ( $wgEnableEmail ) {
827 -
828 - $moreEmail = '';
829 - if ($wgEnableUserEmail) {
830 - // fixme -- the "allowemail" pseudotoggle is a hacked-together
831 - // inversion for the "disableemail" preference.
832 - $emf = wfMsg( 'allowemail' );
833 - $disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
834 - $moreEmail =
835 - "<input type='checkbox' $emfc $disabled value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>$emf</label>" .
836 - $this->getToggle( 'ccmeonemails', '', $disableEmailPrefs );
837 - }
838 -
839 -
840 - $wgOut->addHTML(
841 - $this->tableRow( Xml::element( 'h2', null, wfMsg( 'email' ) ) ) .
842 - $this->tableRow(
843 - $emailauthenticated.
844 - $enotifrevealaddr.
845 - $enotifwatchlistpages.
846 - $enotifusertalkpages.
847 - $enotifminoredits.
848 - $moreEmail
849 - )
850 - );
851 - }
852 - # </FIXME>
853 -
854 - $wgOut->addHTML(
855 - Xml::closeElement( 'table' ) .
856 - Xml::closeElement( 'fieldset' )
857 - );
858 -
859 -
860 - # Quickbar
861 - #
862 - if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') {
863 - $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg( 'qbsettings' ) . "</legend>\n" );
864 - for ( $i = 0; $i < count( $qbs ); ++$i ) {
865 - if ( $i == $this->mQuickbar ) { $checked = ' checked="checked"'; }
866 - else { $checked = ""; }
867 - $wgOut->addHTML( "<div><label><input type='radio' name='wpQuickbar' value=\"$i\"$checked />{$qbs[$i]}</label></div>\n" );
868 - }
869 - $wgOut->addHTML( "</fieldset>\n\n" );
870 - } else {
871 - # Need to output a hidden option even if the relevant skin is not in use,
872 - # otherwise the preference will get reset to 0 on submit
873 - $wgOut->addHTML( Xml::hidden( 'wpQuickbar', $this->mQuickbar ) );
874 - }
875 -
876 - # Skin
877 - #
878 - global $wgAllowUserSkin;
879 - if( $wgAllowUserSkin ) {
880 - $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg( 'skin' ) . "</legend>\n" );
881 - $mptitle = Title::newMainPage();
882 - $previewtext = wfMsg( 'skin-preview' );
883 - # Only show members of Skin::getSkinNames() rather than
884 - # $skinNames (skins is all skin names from Language.php)
885 - $validSkinNames = Skin::getUsableSkins();
886 - # Sort by UI skin name. First though need to update validSkinNames as sometimes
887 - # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
888 - foreach ( $validSkinNames as $skinkey => &$skinname ) {
889 - $msgName = "skinname-{$skinkey}";
890 - $localisedSkinName = wfMsg( $msgName );
891 - if ( !wfEmptyMsg( $msgName, $localisedSkinName ) ) {
892 - $skinname = $localisedSkinName;
893 - }
894 - }
895 - asort($validSkinNames);
896 - foreach( $validSkinNames as $skinkey => $sn ) {
897 - $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
898 - $mplink = htmlspecialchars( $mptitle->getLocalURL( "useskin=$skinkey" ) );
899 - $previewlink = "(<a target='_blank' href=\"$mplink\">$previewtext</a>)";
900 - $extraLinks = '';
901 - global $wgAllowUserCss, $wgAllowUserJs;
902 - if( $wgAllowUserCss ) {
903 - $cssPage = Title::makeTitleSafe( NS_USER, $wgUser->getName().'/'.$skinkey.'.css' );
904 - $customCSS = $sk->makeLinkObj( $cssPage, wfMsgExt('prefs-custom-css', array() ) );
905 - $extraLinks .= " ($customCSS)";
906 - }
907 - if( $wgAllowUserJs ) {
908 - $jsPage = Title::makeTitleSafe( NS_USER, $wgUser->getName().'/'.$skinkey.'.js' );
909 - $customJS = $sk->makeLinkObj( $jsPage, wfMsgHtml('prefs-custom-js') );
910 - $extraLinks .= " ($customJS)";
911 - }
912 - if( $skinkey == $wgDefaultSkin )
913 - $sn .= ' (' . wfMsg( 'default' ) . ')';
914 - $wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked />
915 - <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink{$extraLinks}<br />\n" );
916 - }
917 - $wgOut->addHTML( "</fieldset>\n\n" );
918 - }
919 -
920 - # Math
921 - #
922 - global $wgUseTeX;
923 - if( $wgUseTeX ) {
924 - $wgOut->addHTML( "<fieldset>\n<legend>" . wfMsg('math') . '</legend>' );
925 - foreach ( $mathopts as $k => $v ) {
926 - $checked = ($k == $this->mMath);
927 - $wgOut->addHTML(
928 - Xml::openElement( 'div' ) .
929 - Xml::radioLabel( wfMsg( $v ), 'wpMath', $k, "mw-sp-math-$k", $checked ) .
930 - Xml::closeElement( 'div' ) . "\n"
931 - );
932 - }
933 - $wgOut->addHTML( "</fieldset>\n\n" );
934 - }
935 -
936 - # Files
937 - #
938 - $imageLimitOptions = null;
939 - foreach ( $wgImageLimits as $index => $limits ) {
940 - $selected = ($index == $this->mImageSize);
941 - $imageLimitOptions .= Xml::option( "{$limits[0]}×{$limits[1]}" .
942 - wfMsg('unit-pixel'), $index, $selected );
943 - }
944 -
945 - $imageThumbOptions = null;
946 - foreach ( $wgThumbLimits as $index => $size ) {
947 - $selected = ($index == $this->mThumbSize);
948 - $imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index,
949 - $selected);
950 - }
951 -
952 - $imageSizeId = 'wpImageSize';
953 - $thumbSizeId = 'wpThumbSize';
954 - $wgOut->addHTML(
955 - Xml::fieldset( wfMsg( 'files' ) ) . "\n" .
956 - Xml::openElement( 'table' ) .
957 - '<tr>
958 - <td class="mw-label">' .
959 - Xml::label( wfMsg( 'imagemaxsize' ), $imageSizeId ) .
960 - '</td>
961 - <td class="mw-input">' .
962 - Xml::openElement( 'select', array( 'name' => $imageSizeId, 'id' => $imageSizeId ) ) .
963 - $imageLimitOptions .
964 - Xml::closeElement( 'select' ) .
965 - '</td>
966 - </tr><tr>
967 - <td class="mw-label">' .
968 - Xml::label( wfMsg( 'thumbsize' ), $thumbSizeId ) .
969 - '</td>
970 - <td class="mw-input">' .
971 - Xml::openElement( 'select', array( 'name' => $thumbSizeId, 'id' => $thumbSizeId ) ) .
972 - $imageThumbOptions .
973 - Xml::closeElement( 'select' ) .
974 - '</td>
975 - </tr>' .
976 - Xml::closeElement( 'table' ) .
977 - Xml::closeElement( 'fieldset' )
978 - );
979 -
980 - # Date format
981 - #
982 - # Date/Time
983 - #
984 -
985 - $wgOut->addHTML(
986 - Xml::openElement( 'fieldset' ) .
987 - Xml::element( 'legend', null, wfMsg( 'datetime' ) ) . "\n"
988 - );
989 -
990 - if ($dateopts) {
991 - $wgOut->addHTML(
992 - Xml::openElement( 'fieldset' ) .
993 - Xml::element( 'legend', null, wfMsg( 'dateformat' ) ) . "\n"
994 - );
995 - $idCnt = 0;
996 - $epoch = '20010115161234'; # Wikipedia day
997 - foreach( $dateopts as $key ) {
998 - if( $key == 'default' ) {
999 - $formatted = wfMsg( 'datedefault' );
1000 - } else {
1001 - $formatted = $wgLang->timeanddate( $epoch, false, $key );
1002 - }
1003 - $wgOut->addHTML(
1004 - Xml::tags( 'div', null,
1005 - Xml::radioLabel( $formatted, 'wpDate', $key, "wpDate$idCnt", $key == $this->mDate )
1006 - ) . "\n"
1007 - );
1008 - $idCnt++;
1009 - }
1010 - $wgOut->addHTML( Xml::closeElement( 'fieldset' ) . "\n" );
1011 - }
1012 -
1013 - $nowlocal = Xml::openElement( 'span', array( 'id' => 'wpLocalTime' ) ) .
1014 - $wgLang->time( $now = wfTimestampNow(), true ) .
1015 - Xml::closeElement( 'span' );
1016 - $nowserver = $wgLang->time( $now, false ) .
1017 - Xml::hidden( 'wpServerTime', substr( $now, 8, 2 ) * 60 + substr( $now, 10, 2 ) );
1018 -
1019 - $wgOut->addHTML(
1020 - Xml::openElement( 'fieldset' ) .
1021 - Xml::element( 'legend', null, wfMsg( 'timezonelegend' ) ) .
1022 - Xml::openElement( 'table' ) .
1023 - $this->addRow( wfMsg( 'servertime' ), $nowserver ) .
1024 - $this->addRow( wfMsg( 'localtime' ), $nowlocal )
1025 - );
1026 - $opt = Xml::openElement( 'select', array(
1027 - 'name' => 'wpTimeZone',
1028 - 'id' => 'wpTimeZone',
1029 - 'onchange' => 'javascript:updateTimezoneSelection(false)' ) );
1030 - $opt .= Xml::option( wfMsg( 'timezoneuseserverdefault' ), "System|$wgLocalTZoffset", $this->mTimeZone === "System|$wgLocalTZoffset" );
1031 - $opt .= Xml::option( wfMsg( 'timezoneuseoffset' ), 'Offset', $this->mTimeZone === 'Offset' );
1032 -
1033 - if ( function_exists( 'timezone_identifiers_list' ) ) {
1034 - # Read timezone list
1035 - $tzs = timezone_identifiers_list();
1036 - sort( $tzs );
1037 -
1038 - # Precache localized region names
1039 - $tzRegions = array();
1040 - $tzRegions['Africa'] = wfMsg( 'timezoneregion-africa' );
1041 - $tzRegions['America'] = wfMsg( 'timezoneregion-america' );
1042 - $tzRegions['Antarctica'] = wfMsg( 'timezoneregion-antarctica' );
1043 - $tzRegions['Arctic'] = wfMsg( 'timezoneregion-arctic' );
1044 - $tzRegions['Asia'] = wfMsg( 'timezoneregion-asia' );
1045 - $tzRegions['Atlantic'] = wfMsg( 'timezoneregion-atlantic' );
1046 - $tzRegions['Australia'] = wfMsg( 'timezoneregion-australia' );
1047 - $tzRegions['Europe'] = wfMsg( 'timezoneregion-europe' );
1048 - $tzRegions['Indian'] = wfMsg( 'timezoneregion-indian' );
1049 - $tzRegions['Pacific'] = wfMsg( 'timezoneregion-pacific' );
1050 - asort( $tzRegions );
1051 -
1052 - $selZone = explode( '|', $this->mTimeZone, 3 );
1053 - $selZone = ( $selZone[0] == 'ZoneInfo' ) ? $selZone[2] : null;
1054 - $now = date_create( 'now' );
1055 - $optgroup = '';
1056 -
1057 - foreach ( $tzs as $tz ) {
1058 - $z = explode( '/', $tz, 2 );
1059 -
1060 - # timezone_identifiers_list() returns a number of
1061 - # backwards-compatibility entries. This filters them out of the
1062 - # list presented to the user.
1063 - if ( count( $z ) != 2 || !array_key_exists( $z[0], $tzRegions ) )
1064 - continue;
1065 -
1066 - # Localize region
1067 - $z[0] = $tzRegions[$z[0]];
1068 -
1069 - # Create region groups
1070 - if ( $optgroup != $z[0] ) {
1071 - if ( $optgroup !== '' ) {
1072 - $opt .= Xml::closeElement( 'optgroup' );
1073 - }
1074 - $optgroup = $z[0];
1075 - $opt .= Xml::openElement( 'optgroup', array( 'label' => $z[0] ) ) . "\n";
1076 - }
1077 -
1078 - $minDiff = floor( timezone_offset_get( timezone_open( $tz ), $now ) / 60 );
1079 - $opt .= Xml::option( str_replace( '_', ' ', $z[0] . '/' . $z[1] ), "ZoneInfo|$minDiff|$tz", $selZone === $tz, array( 'label' => $z[1] ) ) . "\n";
1080 - }
1081 - if ( $optgroup !== '' ) $opt .= Xml::closeElement( 'optgroup' );
1082 - }
1083 - $opt .= Xml::closeElement( 'select' );
1084 - $wgOut->addHTML(
1085 - $this->addRow(
1086 - Xml::label( wfMsg( 'timezoneselect' ), 'wpTimeZone' ),
1087 - $opt )
1088 - );
1089 - $wgOut->addHTML(
1090 - $this->addRow(
1091 - Xml::label( wfMsg( 'timezoneoffset' ), 'wpHourDiff' ),
1092 - Xml::input( 'wpHourDiff', 6, $this->mHourDiff, array(
1093 - 'id' => 'wpHourDiff',
1094 - 'onfocus' => 'javascript:updateTimezoneSelection(true)',
1095 - 'onblur' => 'javascript:updateTimezoneSelection(false)' ) ) ) .
1096 - "<tr>
1097 - <td></td>
1098 - <td class='mw-submit'>" .
1099 - Xml::element( 'input',
1100 - array( 'type' => 'button',
1101 - 'value' => wfMsg( 'guesstimezone' ),
1102 - 'onclick' => 'javascript:guessTimezone()',
1103 - 'id' => 'guesstimezonebutton',
1104 - 'style' => 'display:none;' ) ) .
1105 - "</td>
1106 - </tr>" .
1107 - Xml::closeElement( 'table' ) .
1108 - Xml::tags( 'div', array( 'class' => 'prefsectiontip' ), wfMsgExt( 'timezonetext', 'parseinline' ) ).
1109 - Xml::closeElement( 'fieldset' ) .
1110 - Xml::closeElement( 'fieldset' ) . "\n\n"
1111 - );
1112 -
1113 - # Editing
1114 - #
1115 - global $wgLivePreview;
1116 - $wgOut->addHTML(
1117 - Xml::fieldset( wfMsg( 'textboxsize' ) ) .
1118 - wfMsgHTML( 'prefs-edit-boxsize' ) . ' ' .
1119 - Xml::inputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) . ' ' .
1120 - Xml::inputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols ) .
1121 - $this->getToggles( array(
1122 - 'editsection',
1123 - 'editsectiononrightclick',
1124 - 'editondblclick',
1125 - 'editwidth',
1126 - 'showtoolbar',
1127 - 'previewonfirst',
1128 - 'previewontop',
1129 - 'minordefault',
1130 - 'externaleditor',
1131 - 'externaldiff',
1132 - $wgLivePreview ? 'uselivepreview' : false,
1133 - 'forceeditsummary',
1134 - ) )
1135 - );
1136 -
1137 - $wgOut->addHTML( Xml::closeElement( 'fieldset' ) );
1138 -
1139 - # Recent changes
1140 - global $wgRCMaxAge, $wgUseRCPatrol;
1141 - $wgOut->addHTML(
1142 - Xml::fieldset( wfMsg( 'prefs-rc' ) ) .
1143 - Xml::openElement( 'table' ) .
1144 - '<tr>
1145 - <td class="mw-label">' .
1146 - Xml::label( wfMsg( 'recentchangesdays' ), 'wpRecentDays' ) .
1147 - '</td>
1148 - <td class="mw-input">' .
1149 - Xml::input( 'wpRecentDays', 3, $this->mRecentDays, array( 'id' => 'wpRecentDays' ) ) . ' ' .
1150 - wfMsgExt( 'recentchangesdays-max', 'parsemag',
1151 - $wgLang->formatNum( ceil( $wgRCMaxAge / ( 3600 * 24 ) ) ) ) .
1152 - '</td>
1153 - </tr><tr>
1154 - <td class="mw-label">' .
1155 - Xml::label( wfMsg( 'recentchangescount' ), 'wpRecent' ) .
1156 - '</td>
1157 - <td class="mw-input">' .
1158 - Xml::input( 'wpRecent', 3, $this->mRecent, array( 'id' => 'wpRecent' ) ) .
1159 - '</td>
1160 - </tr>' .
1161 - Xml::closeElement( 'table' ) .
1162 - '<br />'
1163 - );
1164 -
1165 - $toggles[] = 'hideminor';
1166 - if( $wgUseRCPatrol ) {
1167 - $toggles[] = 'hidepatrolled';
1168 - $toggles[] = 'newpageshidepatrolled';
1169 - }
1170 - if( $wgRCShowWatchingUsers ) $toggles[] = 'shownumberswatching';
1171 - $toggles[] = 'usenewrc';
1172 -
1173 - $wgOut->addHTML(
1174 - $this->getToggles( $toggles ) .
1175 - Xml::closeElement( 'fieldset' )
1176 - );
1177 -
1178 - # Watchlist
1179 - $watchlistToggles = array( 'watchlisthideminor', 'watchlisthidebots', 'watchlisthideown',
1180 - 'watchlisthideanons', 'watchlisthideliu' );
1181 - if( $wgUseRCPatrol ) $watchlistToggles[] = 'watchlisthidepatrolled';
1182 -
1183 - $wgOut->addHTML(
1184 - Xml::fieldset( wfMsg( 'prefs-watchlist' ) ) .
1185 - Xml::inputLabel( wfMsg( 'prefs-watchlist-days' ), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays ) . ' ' .
1186 - wfMsgHTML( 'prefs-watchlist-days-max' ) .
1187 - '<br /><br />' .
1188 - $this->getToggle( 'extendwatchlist' ) .
1189 - Xml::inputLabel( wfMsg( 'prefs-watchlist-edits' ), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits ) . ' ' .
1190 - wfMsgHTML( 'prefs-watchlist-edits-max' ) .
1191 - '<br /><br />' .
1192 - $this->getToggles( $watchlistToggles )
1193 - );
1194 -
1195 - if( $wgUser->isAllowed( 'createpage' ) || $wgUser->isAllowed( 'createtalk' ) ) {
1196 - $wgOut->addHTML( $this->getToggle( 'watchcreations' ) );
1197 - }
1198 -
1199 - foreach( array( 'edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion' ) as $action => $toggle ) {
1200 - if( $wgUser->isAllowed( $action ) )
1201 - $wgOut->addHTML( $this->getToggle( $toggle ) );
1202 - }
1203 - $this->mUsedToggles['watchcreations'] = true;
1204 - $this->mUsedToggles['watchdefault'] = true;
1205 - $this->mUsedToggles['watchmoves'] = true;
1206 - $this->mUsedToggles['watchdeletion'] = true;
1207 -
1208 - $wgOut->addHTML( Xml::closeElement( 'fieldset' ) );
1209 -
1210 - # Search
1211 - $mwsuggest = $wgEnableMWSuggest ?
1212 - $this->addRow(
1213 - Xml::label( wfMsg( 'mwsuggest-disable' ), 'wpDisableMWSuggest' ),
1214 - Xml::check( 'wpDisableMWSuggest', $this->mDisableMWSuggest, array( 'id' => 'wpDisableMWSuggest' ) )
1215 - ) : '';
1216 - $wgOut->addHTML(
1217 - // Elements for the search tab itself
1218 - Xml::openElement( 'fieldset' ) .
1219 - Xml::element( 'legend', null, wfMsg( 'searchresultshead' ) ) .
1220 - // Elements for the search options in the search tab
1221 - Xml::openElement( 'fieldset' ) .
1222 - Xml::element( 'legend', null, wfMsg( 'prefs-searchoptions' ) ) .
1223 - Xml::openElement( 'table' ) .
1224 - $this->addRow(
1225 - Xml::label( wfMsg( 'resultsperpage' ), 'wpSearch' ),
1226 - Xml::input( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) )
1227 - ) .
1228 - $this->addRow(
1229 - Xml::label( wfMsg( 'contextlines' ), 'wpSearchLines' ),
1230 - Xml::input( 'wpSearchLines', 4, $this->mSearchLines, array( 'id' => 'wpSearchLines' ) )
1231 - ) .
1232 - $this->addRow(
1233 - Xml::label( wfMsg( 'contextchars' ), 'wpSearchChars' ),
1234 - Xml::input( 'wpSearchChars', 4, $this->mSearchChars, array( 'id' => 'wpSearchChars' ) )
1235 - ) .
1236 - $mwsuggest .
1237 - Xml::closeElement( 'table' ) .
1238 - Xml::closeElement( 'fieldset' ) .
1239 - // Elements for the namespace options in the search tab
1240 - Xml::openElement( 'fieldset' ) .
1241 - Xml::element( 'legend', null, wfMsg( 'prefs-namespaces' ) ) .
1242 - wfMsgExt( 'defaultns', array( 'parse' ) ) .
1243 - $ps .
1244 - Xml::closeElement( 'fieldset' ) .
1245 - // End of the search tab
1246 - Xml::closeElement( 'fieldset' )
1247 - );
1248 -
1249 - # Misc
1250 - #
1251 - $uopt = $wgUser->getOption( 'underline' );
1252 - $wgOut->addHTML(
1253 - Xml::fieldset( wfMsg( 'prefs-misc' ) ) .
1254 - Xml::openElement( 'table' ) .
1255 - '<tr>
1256 - <td class="mw-label">' .
1257 - // Xml::label() cannot be used because 'stub-threshold' contains plain HTML
1258 - Xml::tags( 'label', array( 'for' => 'wpStubs' ), wfMsg( 'stub-threshold' ) ) .
1259 - '</td>
1260 - <td class="mw-input">' .
1261 - Xml::input( 'wpStubs', 6, $this->mStubs, array( 'id' => 'wpStubs' ) ) .
1262 - '</td>
1263 - </tr><tr>
1264 - <td class="mw-label">' .
1265 - Xml::label( wfMsg( 'tog-underline' ), 'wpOpunderline' ) .
1266 - '</td>
1267 - <td class="mw-input">' .
1268 - Xml::openElement( 'select', array( 'id' => 'wpOpunderline', 'name' => 'wpOpunderline' ) ) .
1269 - Xml::option( wfMsg ( 'underline-never' ), '0', $uopt == 0 ) .
1270 - Xml::option( wfMsg ( 'underline-always' ), '1', $uopt == 1 ) .
1271 - Xml::option( wfMsg ( 'underline-default' ), '2', $uopt == 2 ) .
1272 - Xml::closeElement( 'select' ) .
1273 - '</td>
1274 - </tr>' .
1275 - Xml::closeElement( 'table' )
1276 - );
1277 -
1278 - # And now the rest = Misc.
1279 - foreach ( $togs as $tname ) {
1280 - if( !array_key_exists( $tname, $this->mUsedToggles ) ) {
1281 - if( $tname == 'norollbackdiff' && $wgUser->isAllowed( 'rollback' ) )
1282 - $wgOut->addHTML( $this->getToggle( $tname ) );
1283 - else
1284 - $wgOut->addHTML( $this->getToggle( $tname ) );
1285 - }
1286 - }
1287 -
1288 - $wgOut->addHTML( '</fieldset>' );
1289 -
1290 - wfRunHooks( 'RenderPreferencesForm', array( $this, $wgOut ) );
1291 -
1292 - $token = htmlspecialchars( $wgUser->editToken() );
1293 - $skin = $wgUser->getSkin();
1294 - $rtl = $wgContLang->isRTL() ? 'left' : 'right';
1295 - $wgOut->addHTML( "
1296 - <table id='prefsubmit' cellpadding='0' width='100%' style='background:none;'><tr>
1297 - <td><input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) .
1298 - '"'.$skin->tooltipAndAccesskey('save')." />
1299 - <input type='submit' name='wpReset' value=\"" . wfMsgHtml( 'resetprefs' ) . "\" /></td>
1300 - <td align='$rtl'><input type='submit' name='wpRestore' value=\"" . wfMsgHtml( 'restoreprefs' ) . "\" /></td>
1301 - </tr></table>
1302 -
1303 - <input type='hidden' name='wpEditToken' value=\"{$token}\" />
1304 - </div></form>\n" );
1305 -
1306 - $wgOut->addHTML( Xml::tags( 'div', array( 'class' => "prefcache" ),
1307 - wfMsgExt( 'clearyourcache', 'parseinline' ) )
1308 - );
1309 - }
131076 }
Index: branches/querypage-work/phase3/includes/specials/SpecialUndelete.php
@@ -833,7 +833,7 @@
834834 * @return string HTML
835835 */
836836 function showDiff( $previousRev, $currentRev ) {
837 - global $wgOut, $wgUser;
 837+ global $wgOut;
838838
839839 $diffEngine = new DifferenceEngine();
840840 $diffEngine->showDiffStyle();
@@ -866,28 +866,49 @@
867867 if( $isDeleted ) {
868868 /// @fixme $rev->getTitle() is null for deleted revs...?
869869 $targetPage = SpecialPage::getTitleFor( 'Undelete' );
870 - $targetQuery = 'target=' .
871 - $this->mTargetObj->getPrefixedUrl() .
872 - '&timestamp=' .
873 - wfTimestamp( TS_MW, $rev->getTimestamp() );
 870+ $targetQuery = array(
 871+ 'target' => $this->mTargetObj->getPrefixedUrl(),
 872+ 'timestamp' => wfTimestamp( TS_MW, $rev->getTimestamp() )
 873+ );
874874 } else {
875875 /// @fixme getId() may return non-zero for deleted revs...
876876 $targetPage = $rev->getTitle();
877 - $targetQuery = 'oldid=' . $rev->getId();
 877+ $targetQuery = array( 'oldid' => $rev->getId() );
878878 }
 879+ // Add show/hide link if available
 880+ if( $wgUser->isAllowed( 'deleterevision' ) ) {
 881+ // If revision was hidden from sysops
 882+ if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
 883+ $del = ' ' . Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
 884+ '(' . wfMsgHtml('rev-delundel') . ')' );
 885+ // Otherwise, show the link...
 886+ } else {
 887+ $query = array( 'target' => $this->mTargetObj->getPrefixedDbkey(),
 888+ 'artimestamp' => $rev->getTimestamp() );
 889+ $del = ' ' . $sk->revDeleteLink( $query,
 890+ $rev->isDeleted( Revision::DELETED_RESTRICTED ) );
 891+ }
 892+ } else {
 893+ $del = '';
 894+ }
879895 return
880896 '<div id="mw-diff-'.$prefix.'title1"><strong>' .
881 - $sk->makeLinkObj( $targetPage,
882 - wfMsgHtml( 'revisionasof',
883 - $wgLang->timeanddate( $rev->getTimestamp(), true ) ),
884 - $targetQuery ) .
 897+ $sk->link(
 898+ $targetPage,
 899+ wfMsgHtml(
 900+ 'revisionasof',
 901+ $wgLang->timeanddate( $rev->getTimestamp(), true )
 902+ ),
 903+ array(),
 904+ $targetQuery
 905+ ) .
885906 ( $isDeleted ? ' ' . wfMsgHtml( 'deletedrev' ) : '' ) .
886907 '</strong></div>' .
887908 '<div id="mw-diff-'.$prefix.'title2">' .
888909 $sk->revUserTools( $rev ) . '<br/>' .
889910 '</div>' .
890911 '<div id="mw-diff-'.$prefix.'title3">' .
891 - $sk->revComment( $rev ) . '<br/>' .
 912+ $sk->revComment( $rev ) . $del . '<br/>' .
892913 '</div>';
893914 }
894915
Index: branches/querypage-work/phase3/includes/specials/SpecialNewpages.php
@@ -247,7 +247,7 @@
248248 * @return string
249249 */
250250 public function formatRow( $result ) {
251 - global $wgLang, $wgContLang, $wgUser;
 251+ global $wgLang, $wgContLang;
252252
253253 $classes = array();
254254
Index: branches/querypage-work/phase3/includes/specials/SpecialProtectedtitles.php
@@ -61,7 +61,7 @@
6262 $skin = $wgUser->getSkin();
6363
6464 $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
65 - $link = $skin->makeLinkObj( $title );
 65+ $link = $skin->link( $title );
6666
6767 $description_items = array ();
6868
Index: branches/querypage-work/phase3/includes/specials/SpecialShortpages.php
@@ -66,7 +66,7 @@
6767 }
6868 $hlink = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
6969 $plink = $this->isCached()
70 - ? $skin->makeLinkObj( $title )
 70+ ? $skin->link( $title )
7171 : $skin->makeKnownLinkObj( $title );
7272 $size = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), $wgLang->formatNum( htmlspecialchars( $result->value ) ) );
7373
Index: branches/querypage-work/phase3/includes/specials/SpecialNewimages.php
@@ -125,7 +125,7 @@
126126 $ut = $s->img_user_text;
127127
128128 $nt = Title::newFromText( $name, NS_FILE );
129 - $ul = $sk->makeLinkObj( Title::makeTitle( NS_USER, $ut ), $ut );
 129+ $ul = $sk->link( Title::makeTitle( NS_USER, $ut ), $ut );
130130
131131 $gallery->add( $nt, "$ul<br />\n<i>".$wgLang->timeanddate( $s->img_timestamp, true )."</i><br />\n" );
132132
Index: branches/querypage-work/phase3/includes/specials/SpecialListredirects.php
@@ -38,7 +38,12 @@
3939
4040 # Make a link to the redirect itself
4141 $rd_title = Title::makeTitle( $result->namespace, $result->title );
42 - $rd_link = $skin->makeLinkObj( $rd_title, '', 'redirect=no' );
 42+ $rd_link = $skin->link(
 43+ $rd_title,
 44+ null,
 45+ array(),
 46+ array( 'redirect' => 'no' )
 47+ );
4348
4449 # Find out where the redirect leads
4550 $revision = Revision::newFromTitle( $rd_title );
@@ -47,7 +52,7 @@
4853 $target = Title::newFromRedirect( $revision->getText() );
4954 if( $target ) {
5055 $arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
51 - $targetLink = $skin->makeLinkObj( $target );
 56+ $targetLink = $skin->link( $target );
5257 return "$rd_link $arr $targetLink";
5358 } else {
5459 return "<s>$rd_link</s>";
Index: branches/querypage-work/phase3/includes/specials/SpecialUpload.php
@@ -288,7 +288,7 @@
289289 * @access private
290290 */
291291 function processUpload(){
292 - global $wgUser, $wgOut, $wgFileExtensions, $wgLang;
 292+ global $wgOut, $wgFileExtensions, $wgLang;
293293 $details = null;
294294 $value = null;
295295 $value = $this->internalProcessUpload( $details );
@@ -1166,7 +1166,7 @@
11671167 else {
11681168 $wgOut->addHTML(
11691169 "<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='60'
1170 - value='{$encDestName}' onchange='toggleFilenameFiller()' $destOnkeyup />"
 1170+ value=\"{$encDestName}\" onchange='toggleFilenameFiller()' $destOnkeyup />"
11711171 );
11721172 }
11731173
Index: branches/querypage-work/phase3/includes/specials/SpecialMostlinkedtemplates.php
@@ -88,7 +88,7 @@
8989
9090 $skin->link( $title );
9191 return wfSpecialList(
92 - $skin->makeLinkObj( $title ),
 92+ $skin->link( $title ),
9393 $this->makeWlhLink( $title, $skin, $result )
9494 );
9595 }
Index: branches/querypage-work/phase3/includes/specials/SpecialCreatePage.php
@@ -0,0 +1,101 @@
 2+<?php
 3+/* This code was adapted from CreatePage.php from: Travis Derouin <travis@wikihow.com> for the Uniwiki extension CreatePage
 4+ * Originally licensed as: GNU GPL v2.0 or later
 5+ *
 6+ * This page has been copied and adapted from the Uniwiki extension CreatePage
 7+ * Originally licensed as: http://www.gnu.org/licenses/gpl-3.0.txt
 8+ *
 9+ * @license GNU GPL v3.0 http://www.gnu.org/licenses/gpl-3.0.txt
 10+ * @author Travis Derouin
 11+ * @author Merrick Schaefer
 12+ * @author Mark Johnston
 13+ * @author Evan Wheeler
 14+ * @author Adam Mckaig (at UNICEF)
 15+ * @author Siebrand Mazeland (integrated into MediaWiki core)
 16+ * @addtogroup SpecialPage
 17+ */
 18+
 19+class SpecialCreatePage extends SpecialPage {
 20+
 21+ public function __construct() {
 22+ parent::__construct( 'CreatePage', 'createpage' );
 23+ }
 24+
 25+ public function execute( $params ) {
 26+ global $wgOut, $wgRequest, $wgUser;
 27+
 28+ $this->setHeaders();
 29+
 30+ if ( !$this->userCanExecute( $wgUser ) ) {
 31+ $this->displayRestrictionError();
 32+ return;
 33+ }
 34+
 35+ $wgOut->addWikiMsg( 'createpage-summary' );
 36+
 37+ // check to see if we are trying to create a page
 38+ $target = $wgRequest->getVal ( 'target' );
 39+ $title = Title::newFromText ( $target );
 40+
 41+ // check for no title
 42+ if ( $wgRequest->wasPosted() && $target === '' ) {
 43+ $this->error( wfMsg( 'createpage-entertitle' ) );
 44+ }
 45+ // check for invalid title
 46+ elseif ( $wgRequest->wasPosted() && is_null( $title ) ) {
 47+ $this->error( wfMsg( 'createpage-badtitle', $target ) );
 48+ }
 49+ elseif ( $target != null ) {
 50+ if ( $title->getArticleID() > 0 ) {
 51+ // if the title exists then let the user know and give other options
 52+ $wgOut->addWikiText ( wfMsg ( 'createpage-titleexists', $title->getFullText() ) . "<br />" );
 53+ $skin = $wgUser->getSkin();
 54+ $editlink = $skin->makeLinkObj( $title, wfMsg ( 'createpage-editexisting' ), 'action=edit' );
 55+ $thisPage = Title::newFromText ( 'CreatePage', NS_SPECIAL );
 56+ $wgOut->addHTML ( $editlink . '<br />'
 57+ . $skin->makeLinkObj ( $thisPage, wfMsg ( 'createpage-tryagain' ) )
 58+ );
 59+ return;
 60+ } else {
 61+ /* TODO - may want to search for closely named pages and give
 62+ * other options here... */
 63+
 64+ // otherwise, redirect them to the edit page for their title
 65+ $wgOut->redirect ( $title->getEditURL() );
 66+ }
 67+ }
 68+
 69+ // if this is just a normal GET, then output the form
 70+
 71+ // prefill the input with the title, if it was passed along
 72+ $newTitle = false;
 73+ $newTitleText = $wgRequest->getVal( 'newtitle', null );
 74+ if ( $newTitleText != null ) {
 75+ $newTitle = Title::newFromURL( $newTitleText );
 76+ if ( is_null( $newTitle ) )
 77+ $newTitle = $newTitleText;
 78+ else
 79+ $newTitle = $newTitle->getText();
 80+ }
 81+
 82+ // output the form
 83+ $form = Xml::openElement( 'fieldset' ) .
 84+ Xml::element( 'legend', null, wfMsg( 'createpage' ) ) . # This should really use a different message
 85+ wfMsgWikiHtml( 'createpage-instructions' ) .
 86+ Xml::openElement( 'form', array( 'method' => 'post', 'name' => 'createpageform', 'action' => '' ) ) .
 87+ Xml::element( 'input', array( 'type' => 'text', 'name' => 'target', 'size' => 50, 'value' => $newTitle ) ) .
 88+ '<br />' .
 89+ Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsgHtml( 'createpage-submitbutton' ) ) ) .
 90+ Xml::closeElement( 'form' ) .
 91+ Xml::closeElement( 'fieldset' );
 92+ $wgOut->addHTML( $form );
 93+ }
 94+ /*
 95+ * Function to output an error message
 96+ * @param $msg String: message text or HTML
 97+ */
 98+ function error( $msg ) {
 99+ global $wgOut;
 100+ $wgOut->addHTML( Xml::element( 'p', array( 'class' => 'error' ), $msg ) );
 101+ }
 102+}
Property changes on: branches/querypage-work/phase3/includes/specials/SpecialCreatePage.php
___________________________________________________________________
Added: svn:eol-style
1103 + native
Property changes on: branches/querypage-work/phase3/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
2104 Merged /trunk/phase3/includes/specials:r49528-50372

Status & tagging log