Escaping fixes
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
index b14bafa..fed8d13 100644 (file)
@@ -39,7 +39,7 @@ class SpecialContributions extends SpecialPage {
                        return;
                }
 
-               $this->opts['limit'] = $wgRequest->getInt( 'limit', 50 );
+               $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
                $this->opts['target'] = $target;
 
                $nt = Title::makeTitleSafe( NS_USER, $target );
@@ -148,12 +148,12 @@ class SpecialContributions extends SpecialPage {
                if( 0 == $id ) {
                        $user = $nt->getText();
                } else {
-                       $user = $sk->makeLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
+                       $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
                }
                $talk = $nt->getTalkPage();
                if( $talk ) {
                        # Talk page link
-                       $tools[] = $sk->makeLinkObj( $talk, wfMsgHtml( 'talkpagelinktext' ) );
+                       $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
                        if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && IP::isIPAddress( $nt->getText() ) ) ) {
                                # Block link
                                if( $wgUser->isAllowed( 'block' ) )
@@ -170,7 +170,7 @@ class SpecialContributions extends SpecialPage {
                        # Add link to deleted user contributions for priviledged users
                        if( $wgUser->isAllowed( 'deletedhistory' ) ) {
                                $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'DeletedContributions', 
-                                       $nt->getDBkey() ), wfMsgHtml( 'deletedcontributions' ) );
+                                       $nt->getDBkey() ), wfMsgHtml( 'sp-contributions-deleted' ) );
                        }
 
                        # Add a link to change user rights for privileged users
@@ -178,7 +178,7 @@ class SpecialContributions extends SpecialPage {
                        if( 0 !== $id && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) {
                                $tools[] = $sk->makeKnownLinkObj(
                                        SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ),
-                                       wfMsgHtml( 'userrights' )
+                                       wfMsgHtml( 'sp-contributions-userrights' )
                                );
                        }
 
@@ -203,9 +203,9 @@ class SpecialContributions extends SpecialPage {
         * @param $this->opts Array: the options to be included.
         */
        protected function getForm() {
-               global $wgScript, $wgTitle;
+               global $wgScript;
        
-               $this->opts['title'] = $wgTitle->getPrefixedText();
+               $this->opts['title'] = SpecialPage::getTitleFor( 'Contributions' )->getPrefixedText();
                if( !isset( $this->opts['target'] ) ) {
                        $this->opts['target'] = '';
                } else {
@@ -251,7 +251,7 @@ class SpecialContributions extends SpecialPage {
                        Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
                        Xml::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parseinline' ) ), 
                                'contribs', 'newbie' , 'newbie', $this->opts['contribs'] == 'newbie' ? true : false ) . '<br />' .
-                       Xml::radioLabel( wfMsgExt( 'sp-contributions-username', array( 'parseinline' ) ), 
+                       Xml::radioLabel( wfMsgExt( 'sp-contributions-username', array( 'parsemag' ) ), 
                                'contribs' , 'user', 'user', $this->opts['contribs'] == 'user' ? true : false ) . ' ' .
                        Xml::input( 'target', 20, $this->opts['target']) . ' '.
                        '<span style="white-space: nowrap">' .
@@ -390,11 +390,14 @@ class ContribsPager extends ReverseChronologicalPager {
        }
 
        function getQueryInfo() {
+               global $wgUser;
                list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
                
                $conds = array_merge( $userCond, $this->getNamespaceCond() );
-               // Paranoia: avoid brute force searches (bug 17792)
-               $conds[] = 'rev_deleted & ' . Revision::DELETED_USER . ' = 0';
+               // Paranoia: avoid brute force searches (bug 17342)
+               if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
+                       $conds[] = 'rev_deleted & ' . Revision::DELETED_USER . ' = 0';
+               }
                $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' );
                
                $queryInfo = array(
@@ -409,8 +412,12 @@ class ContribsPager extends ReverseChronologicalPager {
                        'join_conds' => $join_cond
                );
                
-               ChangeTags::modifyDisplayQuery( $queryInfo['tables'], $queryInfo['fields'], $queryInfo['conds'],
-                       $queryInfo['join_conds'], $this->tagFilter );
+               ChangeTags::modifyDisplayQuery( $queryInfo['tables'],
+                                                                               $queryInfo['fields'],
+                                                                               $queryInfo['conds'],
+                                                                               $queryInfo['join_conds'],
+                                                                               $queryInfo['options'],
+                                                                               $this->tagFilter );
                
                wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) );
                return $queryInfo;
@@ -466,7 +473,7 @@ class ContribsPager extends ReverseChronologicalPager {
         * @todo This would probably look a lot nicer in a table.
         */
        function formatRow( $row ) {
-               global $wgLang, $wgUser, $wgContLang;
+               global $wgUser, $wgLang, $wgContLang;
                wfProfileIn( __METHOD__ );
 
                $sk = $this->getSkin();
@@ -475,11 +482,16 @@ class ContribsPager extends ReverseChronologicalPager {
 
                $page = Title::newFromRow( $row );
                $page->resetArticleId( $row->rev_page ); // use process cache
-               $link = $sk->makeLinkObj( $page, $page->getPrefixedText(), $page->isRedirect() ? 'redirect=no' : '' );
+               $link = $sk->link(
+                       $page,
+                       $page->getPrefixedText(),
+                       array(),
+                       $page->isRedirect() ? array( 'redirect' => 'no' ) : array()
+               );
                # Mark current revisions
                $difftext = $topmarktext = '';
                if( $row->rev_id == $row->page_latest ) {
-                       $topmarktext .= '<strong>' . $this->messages['uctop'] . '</strong>';
+                       $topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
                        if( !$row->page_is_new ) {
                                $difftext .= '(' . $sk->makeKnownLinkObj( $page, $this->messages['diff'], 'diff=0' ) . ')';
                                # Add rollback link
@@ -501,7 +513,7 @@ class ContribsPager extends ReverseChronologicalPager {
 
                $comment = $wgContLang->getDirMark() . $sk->revComment( $rev, false, true );
                $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
-               $d = $sk->makeKnownLinkObj( $page, $date, 'oldid='.intval($row->rev_id) );
+               $d = $sk->makeKnownLinkObj( $page, htmlspecialchars($date), 'oldid='.intval($row->rev_id) );
 
                if( $this->target == 'newbies' ) {
                        $userlink = ' . . ' . $sk->userLink( $row->rev_user, $row->rev_user_text );
@@ -525,8 +537,23 @@ class ContribsPager extends ReverseChronologicalPager {
                } else {
                        $mflag = '';
                }
+               
+               if( $wgUser->isAllowed( 'deleterevision' ) ) {
+                       // If revision was hidden from sysops
+                       if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
+                               $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
+                                       '(' . $this->message['rev-delundel'] . ')' ) . ' ';
+                       // Otherwise, show the link...
+                       } else {
+                               $query = array( 'target' => $page->getPrefixedDbkey(), 'oldid' => $rev->getId() );
+                               $del = $this->mSkin->revDeleteLink( $query,
+                                       $rev->isDeleted( Revision::DELETED_RESTRICTED ) ) . ' ';
+                       }
+               } else {
+                       $del = '';
+               }
 
-               $ret = "{$d} {$histlink} {$difftext} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
+               $ret = "{$del}{$d} {$histlink} {$difftext} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
                if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
                        $ret .= ' ' . wfMsgHtml( 'deletedrev' );
                }