X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialDeletedContributions.php;h=3e1f7bc24002b7550254390757a84f2e6a5c0ce0;hb=55669ae0ccc26611c8c0dd8c7f0fb9d3845cdae7;hp=1fe7947d50ca79fdf8c82b67bfb634c7c51ead88;hpb=6f9d6cbcf936ee89268cd0c165cbeae70f513818;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 1fe7947d50..3e1f7bc240 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -11,7 +11,7 @@ class DeletedContribsPager extends IndexPager { function __construct( $target, $namespace = false ) { parent::__construct(); - foreach( explode( ' ', 'deletionlog undeletebtn minoreditletter diff' ) as $msg ) { + foreach( explode( ' ', 'deletionlog undeleteviewlink diff' ) as $msg ) { $this->messages[$msg] = wfMsgExt( $msg, array( 'escape') ); } $this->target = $target; @@ -30,8 +30,11 @@ class DeletedContribsPager extends IndexPager { list( $index, $userCond ) = $this->getUserCond(); $conds = array_merge( $userCond, $this->getNamespaceCond() ); // Paranoia: avoid brute force searches (bug 17792) - if( !$wgUser->isAllowed( 'suppressrevision' ) ) { - $conds[] = $this->mDb->bitAnd('ar_deleted', Revision::DELETED_USER) . ' = 0'; + if( !$wgUser->isAllowed( 'deleterevision' ) ) { + $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::DELETED_USER) . ' = 0'; + } else if( !$wgUser->isAllowed( 'suppressrevision' ) ) { + $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::SUPPRESSED_USER) . + ' != ' . Revision::SUPPRESSED_USER; } return array( 'tables' => array( 'archive' ), @@ -71,9 +74,10 @@ class DeletedContribsPager extends IndexPager { if ( isset( $this->mNavigationBar ) ) { return $this->mNavigationBar; } + $fmtLimit = $wgLang->formatNum( $this->mLimit ); $linkTexts = array( - 'prev' => wfMsgHtml( 'pager-newer-n', $this->mLimit ), - 'next' => wfMsgHtml( 'pager-older-n', $this->mLimit ), + 'prev' => wfMsgExt( 'pager-newer-n', array( 'escape', 'parsemag' ), $fmtLimit ), + 'next' => wfMsgExt( 'pager-older-n', array( 'escape', 'parsemag' ), $fmtLimit ), 'first' => wfMsgHtml( 'histlast' ), 'last' => wfMsgHtml( 'histfirst' ) ); @@ -138,39 +142,33 @@ class DeletedContribsPager extends IndexPager { $reviewlink = $sk->linkKnown( SpecialPage::getTitleFor( 'Undelete', $page->getPrefixedDBkey() ), - $this->messages['undeletebtn'] + $this->messages['undeleteviewlink'] ); - $link = $sk->linkKnown( - $undelete, - htmlspecialchars( $page->getPrefixedText() ), - array(), - array( - 'target' => $page->getPrefixedText(), - 'timestamp' => $rev->getTimestamp() - ) - ); - - $last = $sk->linkKnown( - $undelete, - $this->messages['diff'], - array(), - array( - 'target' => $page->getPrefixedText(), - 'timestamp' => $rev->getTimestamp(), - 'diff' => 'prev' - ) - ); + if( $wgUser->isAllowed('undelete') ) { + $last = $sk->linkKnown( + $undelete, + $this->messages['diff'], + array(), + array( + 'target' => $page->getPrefixedText(), + 'timestamp' => $rev->getTimestamp(), + 'diff' => 'prev' + ) + ); + } else { + $last = $this->messages['diff']; + } $comment = $sk->revComment( $rev ); - $d = htmlspecialchars( $wgLang->timeanddate( $rev->getTimestamp(), true ) ); + $date = htmlspecialchars( $wgLang->timeanddate( $rev->getTimestamp(), true ) ); - if( $rev->isDeleted( Revision::DELETED_TEXT ) ) { - $d = '' . $d . ''; + if( !$wgUser->isAllowed('undelete') || !$rev->userCan(Revision::DELETED_TEXT) ) { + $link = $date; // unusable link } else { $link = $sk->linkKnown( $undelete, - $d, + $date, array(), array( 'target' => $page->getPrefixedText(), @@ -178,11 +176,15 @@ class DeletedContribsPager extends IndexPager { ) ); } + // Style deleted items + if( $rev->isDeleted( Revision::DELETED_TEXT ) ) { + $link = '' . $link . ''; + } $pagelink = $sk->link( $page ); if( $rev->isMinor() ) { - $mflag = '' . $this->messages['minoreditletter'] . ' '; + $mflag = ChangesList::flag( 'minor' ); } else { $mflag = ''; } @@ -285,7 +287,7 @@ class DeletedContributionsPage extends SpecialPage { $pager = new DeletedContribsPager( $target, $options['namespace'] ); if ( !$pager->getNumRows() ) { - $wgOut->addWikiText( wfMsg( 'nocontribs' ) ); + $wgOut->addWikiMsg( 'nocontribs' ); return; } @@ -308,9 +310,7 @@ class DeletedContributionsPage extends SpecialPage { $text = wfMsgNoTrans( $message, $target ); if( !wfEmptyMsg( $message, $text ) && $text != '-' ) { - $wgOut->addHTML( '' ); + $wgOut->wrapWikiMsg( "", array( $message, $target ) ); } } } @@ -325,7 +325,7 @@ class DeletedContributionsPage extends SpecialPage { $sk = $wgUser->getSkin(); if ( 0 == $id ) { - $user = $nt->getText(); + $user = htmlspecialchars( $nt->getText() ); } else { $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) ); } @@ -361,7 +361,7 @@ class DeletedContributionsPage extends SpecialPage { # Link to undeleted contributions $tools[] = $sk->linkKnown( SpecialPage::getTitleFor( 'Contributions', $nt->getDBkey() ), - wfMsgHtml( 'contributions' ) + wfMsgHtml( 'sp-deletedcontributions-contribs' ) ); wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) );