Had a bash at cleaning up the horrendous-looking deletion log on the edit page:
[lhc/web/wiklou.git] / includes / SpecialNewpages.php
index d299a6c..48037a7 100644 (file)
@@ -1,14 +1,12 @@
 <?php
 /**
  *
- * @package MediaWiki
- * @subpackage SpecialPage
+ * @addtogroup SpecialPage
  */
 
 /**
- *
- * @package MediaWiki
- * @subpackage SpecialPage
+ * implements Special:Newpages
+ * @addtogroup SpecialPage
  */
 class NewPagesPage extends QueryPage {
 
@@ -41,8 +39,8 @@ class NewPagesPage extends QueryPage {
        function getSQL() {
                global $wgUser, $wgUseRCPatrol;
                $usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
-               $dbr =& wfGetDB( DB_SLAVE );
-               extract( $dbr->tableNames( 'recentchanges', 'page', 'text' ) );
+               $dbr = wfGetDB( DB_SLAVE );
+               list( $recentchanges, $page ) = $dbr->tableNamesN( 'recentchanges', 'page' );
 
                $uwhere = $this->makeUserWhere( $dbr );
 
@@ -52,9 +50,9 @@ class NewPagesPage extends QueryPage {
                                rc_namespace AS namespace,
                                rc_title AS title,
                                rc_cur_id AS cur_id,
-                               rc_user AS user,
+                               rc_user AS \"user\",
                                rc_user_text AS user_text,
-                               rc_comment as comment,
+                               rc_comment as \"comment\",
                                rc_timestamp AS timestamp,
                                rc_timestamp AS value,
                                '{$usepatrol}' as usepatrol,
@@ -84,20 +82,21 @@ class NewPagesPage extends QueryPage {
        /**
         * Format a row, providing the timestamp, links to the page/history, size, user links, and a comment
         *
+        * @param $skin Skin to use
         * @param $result Result row
         * @return string
         */
-       function formatResult( $result ) {
+       function formatResult( $skin, $result ) {
                global $wgLang, $wgContLang;
                $dm = $wgContLang->getDirMark();
 
                $title = Title::makeTitleSafe( $result->namespace, $result->title );
                $time = $wgLang->timeAndDate( $result->timestamp, true );
-               $plink = Linker::makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rcid : '' );
-               $hist = Linker::makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
-               $length = wfMsgHtml( 'nbytes', $wgLang->formatNum( htmlspecialchars( $result->length ) ) );
-               $ulink = Linker::userLink( $result->user, $result->user_text ) . Linker::userToolLinks( $result->user, $result->user_text );
-               $comment = Linker::commentBlock( $result->comment );
+               $plink = $skin->makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rcid : '' );
+               $hist = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
+               $length = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), $wgLang->formatNum( htmlspecialchars( $result->length ) ) );
+               $ulink = $skin->userLink( $result->user, $result->user_text ) . ' ' . $skin->userToolLinks( $result->user, $result->user_text );
+               $comment = $skin->commentBlock( $result->comment );
 
                return "{$time} {$dm}{$plink} ({$hist}) {$dm}[{$length}] {$dm}{$ulink} {$comment}";
        }
@@ -132,13 +131,16 @@ class NewPagesPage extends QueryPage {
         */     
        function getPageHeader() {
                $self = SpecialPage::getTitleFor( $this->getName() );
-               $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
-               $form .= '<table><tr><td align="right">' . wfMsgHtml( 'namespace' ) . '</td>';
-               $form .= '<td>' . HtmlNamespaceSelector( $this->namespace ) . '</td><tr>';
-               $form .= '<tr><td align="right">' . wfMsgHtml( 'newpages-username' ) . '</td>';
-               $form .= '<td>' . wfInput( 'username', 30, $this->username ) . '</td></tr>';
-               $form .= '<tr><td></td><td>' . wfSubmitButton( wfMsg( 'allpagessubmit' ) ) . '</td></tr></table>';
-               $form .= wfHidden( 'offset', $this->offset ) . wfHidden( 'limit', $this->limit ) . '</form>';
+               $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
+               # Namespace selector
+               $form .= '<table><tr><td align="right">' . Xml::label( wfMsg( 'namespace' ), 'namespace' ) . '</td>';
+               $form .= '<td>' . Xml::namespaceSelector( $this->namespace ) . '</td></tr>';
+               # Username filter
+               $form .= '<tr><td align="right">' . Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) . '</td>';
+               $form .= '<td>' . Xml::input( 'username', 30, $this->username, array( 'id' => 'mw-np-username' ) ) . '</td></tr>';
+               
+               $form .= '<tr><td></td><td>' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . '</td></tr></table>';
+               $form .= Xml::hidden( 'offset', $this->offset ) . Xml::hidden( 'limit', $this->limit ) . '</form>';
                return $form;
        }
        
@@ -171,6 +173,7 @@ function wfSpecialNewpages($par, $specialPage) {
                        if ( is_numeric( $bit ) )
                                $limit = $bit;
 
+                       $m = array();
                        if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) )
                                $limit = intval($m[1]);
                        if ( preg_match( '/^offset=(\d+)$/', $bit, $m ) )