Followup r82641, set default for 2nd param
[lhc/web/wiklou.git] / includes / specials / SpecialAllmessages.php
index a3ebaf9..d475d5f 100644 (file)
@@ -81,7 +81,7 @@ class SpecialAllmessages extends SpecialPage {
 
                $out  = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form' ) ) .
                        Xml::fieldset( wfMsg( 'allmessages-filter-legend' ) ) .
-                       Xml::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
+                       Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
                        Xml::openElement( 'table', array( 'class' => 'mw-allmessages-table' ) ) . "\n" .
                        '<tr>
                                <td class="mw-label">' .
@@ -100,19 +100,19 @@ class SpecialAllmessages extends SpecialPage {
                                                'filter',
                                                'unmodified',
                                                'mw-allmessages-form-filter-unmodified',
-                                               ( $this->filter == 'unmodified' ? true : false )
+                                               ( $this->filter == 'unmodified' )
                                        ) .
                                        Xml::radioLabel( wfMsg( 'allmessages-filter-all' ),
                                                'filter',
                                                'all',
                                                'mw-allmessages-form-filter-all',
-                                               ( $this->filter == 'all' ? true : false )
+                                               ( $this->filter == 'all' )
                                        ) .
                                        Xml::radioLabel( wfMsg( 'allmessages-filter-modified' ),
                                                'filter',
                                                'modified',
                                                'mw-allmessages-form-filter-modified',
-                                       ( $this->filter == 'modified' ? true : false )
+                                       ( $this->filter == 'modified' )
                                ) .
                                "</td>\n
                        </tr>
@@ -124,7 +124,7 @@ class SpecialAllmessages extends SpecialPage {
                                        Xml::openElement( 'select', array( 'id' => 'mw-allmessages-form-lang', 'name' => 'lang' ) );
 
                foreach( $languages as $lang => $name ) {
-                       $selected = $lang == $this->langCode ? true : false;
+                       $selected = $lang == $this->langCode;
                        $out .= Xml::option( $lang . ' - ' . $name, $lang, $selected ) . "\n";
                }
                $out .= Xml::closeElement( 'select' ) .
@@ -157,9 +157,6 @@ class AllmessagesTablePager extends TablePager {
                $this->mPage = $page;
                $this->mConds = $conds;
                $this->mDefaultDirection = true; // always sort ascending
-               // We want to have an option for people to view *all* the messages, 
-               // so they can use Ctrl+F to search them.  5000 is the maximum that 
-               // will get through WebRequest::getLimitOffset().
                $this->mLimitsShown = array( 20, 50, 100, 250, 500, 5000 );
 
                global $wgLang, $wgContLang, $wgRequest;
@@ -205,8 +202,8 @@ class AllmessagesTablePager extends TablePager {
 
                // Normalise message names so they look like page titles
                $messageNames = array_map( array( $this->lang, 'ucfirst' ), $messageNames );
-               wfProfileIn( __METHOD__ );
 
+               wfProfileOut( __METHOD__ );
                return $messageNames;
        }
 
@@ -230,7 +227,7 @@ class AllmessagesTablePager extends TablePager {
 
                $pageFlags = $talkFlags = array();
                
-               while( $s = $dbr->fetchObject( $res ) ) {
+               foreach ( $res as $s ) {
                        if( $s->page_namespace == NS_MEDIAWIKI ) {
                                if( $this->foreign ) {
                                        $title = explode( '/', $s->page_title );
@@ -268,10 +265,12 @@ class AllmessagesTablePager extends TablePager {
                                ( $descending && ( $key < $offset || !$offset ) || !$descending && $key > $offset ) &&
                                ( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix === false )
                        ){
+                               $actual = wfMessage( $key )->inLanguage( $this->langcode )->plain();
+                               $default = wfMessage( $key )->inLanguage( $this->langcode )->useDatabase( false )->plain();
                                $result->result[] = array(
                                        'am_title'      => $key,
-                                       'am_actual'     => wfMsgGetKey( $key, /*useDB*/true, $this->langcode, false ),
-                                       'am_default'    => wfMsgGetKey( $key, /*useDB*/false, $this->langcode, false ),
+                                       'am_actual'     => $actual,
+                                       'am_default'    => $default,
                                        'am_customised' => $customised,
                                        'am_talk_exists' => isset( $statuses['talks'][$key] )
                                );
@@ -333,7 +332,6 @@ class AllmessagesTablePager extends TablePager {
                                return $title . ' (' . $talk . ')';
 
                        case 'am_default' :
-                               return Sanitizer::escapeHtmlAllowEntities( $value, ENT_QUOTES );
                        case 'am_actual' :
                                return Sanitizer::escapeHtmlAllowEntities( $value, ENT_QUOTES );
                }