Stylize
This commit is contained in:
parent
e86fff1335
commit
a1eb5c3f77
2 changed files with 71 additions and 71 deletions
|
|
@ -36,7 +36,7 @@ class MWNamespace {
|
||||||
* @return true
|
* @return true
|
||||||
*/
|
*/
|
||||||
private static function isMethodValidFor( $index, $method ) {
|
private static function isMethodValidFor( $index, $method ) {
|
||||||
if( $index < NS_MAIN ) {
|
if ( $index < NS_MAIN ) {
|
||||||
throw new MWException( "$method does not make any sense for given namespace $index" );
|
throw new MWException( "$method does not make any sense for given namespace $index" );
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -50,7 +50,7 @@ class MWNamespace {
|
||||||
*/
|
*/
|
||||||
public static function isMovable( $index ) {
|
public static function isMovable( $index ) {
|
||||||
global $wgAllowImageMoving;
|
global $wgAllowImageMoving;
|
||||||
return !( $index < NS_MAIN || ($index == NS_FILE && !$wgAllowImageMoving) || $index == NS_CATEGORY );
|
return !( $index < NS_MAIN || ( $index == NS_FILE && !$wgAllowImageMoving ) || $index == NS_CATEGORY );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -106,7 +106,7 @@ class MWNamespace {
|
||||||
*/
|
*/
|
||||||
public static function getSubject( $index ) {
|
public static function getSubject( $index ) {
|
||||||
# Handle special namespaces
|
# Handle special namespaces
|
||||||
if( $index < NS_MAIN ) {
|
if ( $index < NS_MAIN ) {
|
||||||
return $index;
|
return $index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,9 +126,9 @@ class MWNamespace {
|
||||||
public static function getAssociated( $index ) {
|
public static function getAssociated( $index ) {
|
||||||
self::isMethodValidFor( $index, __METHOD__ );
|
self::isMethodValidFor( $index, __METHOD__ );
|
||||||
|
|
||||||
if( self::isSubject( $index ) ) {
|
if ( self::isSubject( $index ) ) {
|
||||||
return self::getTalk( $index );
|
return self::getTalk( $index );
|
||||||
} elseif( self::isTalk( $index ) ) {
|
} elseif ( self::isTalk( $index ) ) {
|
||||||
return self::getSubject( $index );
|
return self::getSubject( $index );
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -209,7 +209,7 @@ class MWNamespace {
|
||||||
*/
|
*/
|
||||||
public static function getCanonicalName( $index ) {
|
public static function getCanonicalName( $index ) {
|
||||||
$nslist = self::getCanonicalNamespaces();
|
$nslist = self::getCanonicalNamespaces();
|
||||||
if( isset( $nslist[$index] ) ) {
|
if ( isset( $nslist[$index] ) ) {
|
||||||
return $nslist[$index];
|
return $nslist[$index];
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -228,7 +228,7 @@ class MWNamespace {
|
||||||
if ( $xNamespaces === false ) {
|
if ( $xNamespaces === false ) {
|
||||||
$xNamespaces = array();
|
$xNamespaces = array();
|
||||||
foreach ( self::getCanonicalNamespaces() as $i => $text ) {
|
foreach ( self::getCanonicalNamespaces() as $i => $text ) {
|
||||||
$xNamespaces[strtolower($text)] = $i;
|
$xNamespaces[strtolower( $text )] = $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( array_key_exists( $name, $xNamespaces ) ) {
|
if ( array_key_exists( $name, $xNamespaces ) ) {
|
||||||
|
|
@ -306,7 +306,7 @@ class MWNamespace {
|
||||||
*/
|
*/
|
||||||
public static function getContentNamespaces() {
|
public static function getContentNamespaces() {
|
||||||
global $wgContentNamespaces;
|
global $wgContentNamespaces;
|
||||||
if( !is_array( $wgContentNamespaces ) || $wgContentNamespaces === array() ) {
|
if ( !is_array( $wgContentNamespaces ) || $wgContentNamespaces === array() ) {
|
||||||
return NS_MAIN;
|
return NS_MAIN;
|
||||||
} elseif ( !in_array( NS_MAIN, $wgContentNamespaces ) ) {
|
} elseif ( !in_array( NS_MAIN, $wgContentNamespaces ) ) {
|
||||||
// always force NS_MAIN to be part of array (to match the algorithm used by isContent)
|
// always force NS_MAIN to be part of array (to match the algorithm used by isContent)
|
||||||
|
|
|
||||||
|
|
@ -44,17 +44,17 @@ class SpecialContributions extends SpecialPage {
|
||||||
$this->opts = array();
|
$this->opts = array();
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
if( $par == 'newbies' ) {
|
if ( $par == 'newbies' ) {
|
||||||
$target = 'newbies';
|
$target = 'newbies';
|
||||||
$this->opts['contribs'] = 'newbie';
|
$this->opts['contribs'] = 'newbie';
|
||||||
} elseif( $par !== null ) {
|
} elseif ( $par !== null ) {
|
||||||
$target = $par;
|
$target = $par;
|
||||||
} else {
|
} else {
|
||||||
$target = $request->getVal( 'target' );
|
$target = $request->getVal( 'target' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for radiobox
|
// check for radiobox
|
||||||
if( $request->getVal( 'contribs' ) == 'newbie' ) {
|
if ( $request->getVal( 'contribs' ) == 'newbie' ) {
|
||||||
$target = 'newbies';
|
$target = 'newbies';
|
||||||
$this->opts['contribs'] = 'newbie';
|
$this->opts['contribs'] = 'newbie';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -63,36 +63,36 @@ class SpecialContributions extends SpecialPage {
|
||||||
|
|
||||||
$this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
|
$this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
|
||||||
|
|
||||||
if( !strlen( $target ) ) {
|
if ( !strlen( $target ) ) {
|
||||||
$out->addHTML( $this->getForm() );
|
$out->addHTML( $this->getForm() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
$this->opts['limit'] = $request->getInt( 'limit', $user->getOption('rclimit') );
|
$this->opts['limit'] = $request->getInt( 'limit', $user->getOption( 'rclimit' ) );
|
||||||
$this->opts['target'] = $target;
|
$this->opts['target'] = $target;
|
||||||
$this->opts['topOnly'] = $request->getBool( 'topOnly' );
|
$this->opts['topOnly'] = $request->getBool( 'topOnly' );
|
||||||
|
|
||||||
$userObj = User::newFromName( $target, false );
|
$userObj = User::newFromName( $target, false );
|
||||||
if( !$userObj ) {
|
if ( !$userObj ) {
|
||||||
$out->addHTML( $this->getForm() );
|
$out->addHTML( $this->getForm() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$nt = $userObj->getUserPage();
|
$nt = $userObj->getUserPage();
|
||||||
$id = $userObj->getID();
|
$id = $userObj->getID();
|
||||||
|
|
||||||
if( $this->opts['contribs'] != 'newbie' ) {
|
if ( $this->opts['contribs'] != 'newbie' ) {
|
||||||
$target = $nt->getText();
|
$target = $nt->getText();
|
||||||
$out->addSubtitle( $this->contributionsSub( $userObj ) );
|
$out->addSubtitle( $this->contributionsSub( $userObj ) );
|
||||||
$out->setHTMLTitle( $this->msg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ), $target ) ) );
|
$out->setHTMLTitle( $this->msg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ), $target ) ) );
|
||||||
$this->getSkin()->setRelevantUser( $userObj );
|
$this->getSkin()->setRelevantUser( $userObj );
|
||||||
} else {
|
} else {
|
||||||
$out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub') );
|
$out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
|
||||||
$out->setHTMLTitle( $this->msg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) );
|
$out->setHTMLTitle( $this->msg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
|
if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
|
||||||
$this->opts['namespace'] = intval( $ns );
|
$this->opts['namespace'] = intval( $ns );
|
||||||
} else {
|
} else {
|
||||||
$this->opts['namespace'] = '';
|
$this->opts['namespace'] = '';
|
||||||
|
|
@ -106,13 +106,13 @@ class SpecialContributions extends SpecialPage {
|
||||||
|
|
||||||
// Allows reverts to have the bot flag in recent changes. It is just here to
|
// Allows reverts to have the bot flag in recent changes. It is just here to
|
||||||
// be passed in the form at the top of the page
|
// be passed in the form at the top of the page
|
||||||
if( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) {
|
if ( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) {
|
||||||
$this->opts['bot'] = '1';
|
$this->opts['bot'] = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
$skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev';
|
$skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev';
|
||||||
# Offset overrides year/month selection
|
# Offset overrides year/month selection
|
||||||
if( $skip ) {
|
if ( $skip ) {
|
||||||
$this->opts['year'] = '';
|
$this->opts['year'] = '';
|
||||||
$this->opts['month'] = '';
|
$this->opts['month'] = '';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -121,7 +121,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
$feedType = $request->getVal( 'feed' );
|
$feedType = $request->getVal( 'feed' );
|
||||||
if( $feedType ) {
|
if ( $feedType ) {
|
||||||
// Maintain some level of backwards compatability
|
// Maintain some level of backwards compatability
|
||||||
// If people request feeds using the old parameters, redirect to API
|
// If people request feeds using the old parameters, redirect to API
|
||||||
$apiParams = array(
|
$apiParams = array(
|
||||||
|
|
@ -172,12 +172,12 @@ class SpecialContributions extends SpecialPage {
|
||||||
'nsInvert' => $this->opts['nsInvert'],
|
'nsInvert' => $this->opts['nsInvert'],
|
||||||
'associated' => $this->opts['associated'],
|
'associated' => $this->opts['associated'],
|
||||||
) );
|
) );
|
||||||
if( !$pager->getNumRows() ) {
|
if ( !$pager->getNumRows() ) {
|
||||||
$out->addWikiMsg( 'nocontribs', $target );
|
$out->addWikiMsg( 'nocontribs', $target );
|
||||||
} else {
|
} else {
|
||||||
# Show a message about slave lag, if applicable
|
# Show a message about slave lag, if applicable
|
||||||
$lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
|
$lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
|
||||||
if( $lag > 0 )
|
if ( $lag > 0 )
|
||||||
$out->showLagWarning( $lag );
|
$out->showLagWarning( $lag );
|
||||||
|
|
||||||
$out->addHTML(
|
$out->addHTML(
|
||||||
|
|
@ -189,7 +189,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
$out->preventClickjacking( $pager->getPreventClickjacking() );
|
$out->preventClickjacking( $pager->getPreventClickjacking() );
|
||||||
|
|
||||||
# Show the appropriate "footer" message - WHOIS tools, etc.
|
# Show the appropriate "footer" message - WHOIS tools, etc.
|
||||||
if( $this->opts['contribs'] != 'newbie' ) {
|
if ( $this->opts['contribs'] != 'newbie' ) {
|
||||||
$message = 'sp-contributions-footer';
|
$message = 'sp-contributions-footer';
|
||||||
if ( IP::isIPAddress( $target ) ) {
|
if ( IP::isIPAddress( $target ) ) {
|
||||||
$message = 'sp-contributions-footer-anon';
|
$message = 'sp-contributions-footer-anon';
|
||||||
|
|
@ -200,7 +200,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !wfMessage( $message, $target )->isDisabled() ) {
|
if ( !wfMessage( $message, $target )->isDisabled() ) {
|
||||||
$out->wrapWikiMsg(
|
$out->wrapWikiMsg(
|
||||||
"<div class='mw-contributions-footer'>\n$1\n</div>",
|
"<div class='mw-contributions-footer'>\n$1\n</div>",
|
||||||
array( $message, $target ) );
|
array( $message, $target ) );
|
||||||
|
|
@ -223,7 +223,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
}
|
}
|
||||||
$nt = $userObj->getUserPage();
|
$nt = $userObj->getUserPage();
|
||||||
$talk = $userObj->getTalkPage();
|
$talk = $userObj->getTalkPage();
|
||||||
if( $talk ) {
|
if ( $talk ) {
|
||||||
$tools = self::getUserLinks( $nt, $talk, $userObj, $this->getUser() );
|
$tools = self::getUserLinks( $nt, $talk, $userObj, $this->getUser() );
|
||||||
$links = $this->getLanguage()->pipeList( $tools );
|
$links = $this->getLanguage()->pipeList( $tools );
|
||||||
|
|
||||||
|
|
@ -276,8 +276,8 @@ class SpecialContributions extends SpecialPage {
|
||||||
|
|
||||||
$tools[] = Linker::link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) );
|
$tools[] = Linker::link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) );
|
||||||
|
|
||||||
if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
|
if ( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
|
||||||
if( $subject->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
|
if ( $subject->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
|
||||||
if ( $target->isBlocked() ) {
|
if ( $target->isBlocked() ) {
|
||||||
$tools[] = Linker::linkKnown( # Change block link
|
$tools[] = Linker::linkKnown( # Change block link
|
||||||
SpecialPage::getTitleFor( 'Block', $username ),
|
SpecialPage::getTitleFor( 'Block', $username ),
|
||||||
|
|
@ -317,7 +317,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
);
|
);
|
||||||
|
|
||||||
# Add link to deleted user contributions for priviledged users
|
# Add link to deleted user contributions for priviledged users
|
||||||
if( $subject->isAllowed( 'deletedhistory' ) ) {
|
if ( $subject->isAllowed( 'deletedhistory' ) ) {
|
||||||
$tools[] = Linker::linkKnown(
|
$tools[] = Linker::linkKnown(
|
||||||
SpecialPage::getTitleFor( 'DeletedContributions', $username ),
|
SpecialPage::getTitleFor( 'DeletedContributions', $username ),
|
||||||
wfMsgHtml( 'sp-contributions-deleted' )
|
wfMsgHtml( 'sp-contributions-deleted' )
|
||||||
|
|
@ -327,7 +327,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
# Add a link to change user rights for privileged users
|
# Add a link to change user rights for privileged users
|
||||||
$userrightsPage = new UserrightsPage();
|
$userrightsPage = new UserrightsPage();
|
||||||
$userrightsPage->getContext()->setUser( $subject );
|
$userrightsPage->getContext()->setUser( $subject );
|
||||||
if( $id !== null && $userrightsPage->userCanChangeRights( $target ) ) {
|
if ( $id !== null && $userrightsPage->userCanChangeRights( $target ) ) {
|
||||||
$tools[] = Linker::linkKnown(
|
$tools[] = Linker::linkKnown(
|
||||||
SpecialPage::getTitleFor( 'Userrights', $username ),
|
SpecialPage::getTitleFor( 'Userrights', $username ),
|
||||||
wfMsgHtml( 'sp-contributions-userrights' )
|
wfMsgHtml( 'sp-contributions-userrights' )
|
||||||
|
|
@ -346,45 +346,45 @@ class SpecialContributions extends SpecialPage {
|
||||||
global $wgScript;
|
global $wgScript;
|
||||||
|
|
||||||
$this->opts['title'] = $this->getTitle()->getPrefixedText();
|
$this->opts['title'] = $this->getTitle()->getPrefixedText();
|
||||||
if( !isset( $this->opts['target'] ) ) {
|
if ( !isset( $this->opts['target'] ) ) {
|
||||||
$this->opts['target'] = '';
|
$this->opts['target'] = '';
|
||||||
} else {
|
} else {
|
||||||
$this->opts['target'] = str_replace( '_' , ' ' , $this->opts['target'] );
|
$this->opts['target'] = str_replace( '_' , ' ' , $this->opts['target'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isset( $this->opts['namespace'] ) ) {
|
if ( !isset( $this->opts['namespace'] ) ) {
|
||||||
$this->opts['namespace'] = '';
|
$this->opts['namespace'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isset( $this->opts['nsInvert'] ) ) {
|
if ( !isset( $this->opts['nsInvert'] ) ) {
|
||||||
$this->opts['nsInvert'] = '';
|
$this->opts['nsInvert'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isset( $this->opts['associated'] ) ) {
|
if ( !isset( $this->opts['associated'] ) ) {
|
||||||
$this->opts['associated'] = false;
|
$this->opts['associated'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isset( $this->opts['contribs'] ) ) {
|
if ( !isset( $this->opts['contribs'] ) ) {
|
||||||
$this->opts['contribs'] = 'user';
|
$this->opts['contribs'] = 'user';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isset( $this->opts['year'] ) ) {
|
if ( !isset( $this->opts['year'] ) ) {
|
||||||
$this->opts['year'] = '';
|
$this->opts['year'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isset( $this->opts['month'] ) ) {
|
if ( !isset( $this->opts['month'] ) ) {
|
||||||
$this->opts['month'] = '';
|
$this->opts['month'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $this->opts['contribs'] == 'newbie' ) {
|
if ( $this->opts['contribs'] == 'newbie' ) {
|
||||||
$this->opts['target'] = '';
|
$this->opts['target'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isset( $this->opts['tagfilter'] ) ) {
|
if ( !isset( $this->opts['tagfilter'] ) ) {
|
||||||
$this->opts['tagfilter'] = '';
|
$this->opts['tagfilter'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !isset( $this->opts['topOnly'] ) ) {
|
if ( !isset( $this->opts['topOnly'] ) ) {
|
||||||
$this->opts['topOnly'] = false;
|
$this->opts['topOnly'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -393,7 +393,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
# Add hidden params for tracking except for parameters in $skipParameters
|
# Add hidden params for tracking except for parameters in $skipParameters
|
||||||
$skipParameters = array( 'namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated' );
|
$skipParameters = array( 'namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated' );
|
||||||
foreach ( $this->opts as $name => $value ) {
|
foreach ( $this->opts as $name => $value ) {
|
||||||
if( in_array( $name, $skipParameters ) ) {
|
if ( in_array( $name, $skipParameters ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$form .= "\t" . Html::hidden( $name, $value ) . "\n";
|
$form .= "\t" . Html::hidden( $name, $value ) . "\n";
|
||||||
|
|
@ -401,7 +401,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
|
|
||||||
$tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
|
$tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
|
||||||
|
|
||||||
if ($tagFilter) {
|
if ( $tagFilter ) {
|
||||||
$filterSelection =
|
$filterSelection =
|
||||||
Xml::tags( 'td', array( 'class' => 'mw-label' ), array_shift( $tagFilter ) ) .
|
Xml::tags( 'td', array( 'class' => 'mw-label' ), array_shift( $tagFilter ) ) .
|
||||||
Xml::tags( 'td', array( 'class' => 'mw-input' ), implode( ' ', $tagFilter ) );
|
Xml::tags( 'td', array( 'class' => 'mw-input' ), implode( ' ', $tagFilter ) );
|
||||||
|
|
@ -448,7 +448,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
Xml::namespaceSelector( $this->opts['namespace'], '' ) . ' ' .
|
Xml::namespaceSelector( $this->opts['namespace'], '' ) . ' ' .
|
||||||
Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
|
Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
|
||||||
Xml::checkLabel(
|
Xml::checkLabel(
|
||||||
wfMsg('invert'),
|
wfMsg( 'invert' ),
|
||||||
'nsInvert',
|
'nsInvert',
|
||||||
'nsInvert',
|
'nsInvert',
|
||||||
$this->opts['nsInvert'],
|
$this->opts['nsInvert'],
|
||||||
|
|
@ -457,7 +457,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
) .
|
) .
|
||||||
Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
|
Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
|
||||||
Xml::checkLabel(
|
Xml::checkLabel(
|
||||||
wfMsg('namespace_association'),
|
wfMsg( 'namespace_association' ),
|
||||||
'associated',
|
'associated',
|
||||||
'associated',
|
'associated',
|
||||||
$this->opts['associated'],
|
$this->opts['associated'],
|
||||||
|
|
@ -522,7 +522,7 @@ class SpecialContributions extends SpecialPage {
|
||||||
if ( $explain->exists() ) {
|
if ( $explain->exists() ) {
|
||||||
$form .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
|
$form .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
|
||||||
}
|
}
|
||||||
$form .= Xml::closeElement('fieldset' ) .
|
$form .= Xml::closeElement( 'fieldset' ) .
|
||||||
Xml::closeElement( 'form' );
|
Xml::closeElement( 'form' );
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
@ -543,7 +543,7 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
|
|
||||||
$msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
|
$msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
|
||||||
|
|
||||||
foreach( $msgs as $msg ) {
|
foreach ( $msgs as $msg ) {
|
||||||
$this->messages[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
|
$this->messages[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -577,10 +577,10 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
$conds = array_merge( $userCond, $this->getNamespaceCond() );
|
$conds = array_merge( $userCond, $this->getNamespaceCond() );
|
||||||
|
|
||||||
// Paranoia: avoid brute force searches (bug 17342)
|
// Paranoia: avoid brute force searches (bug 17342)
|
||||||
if( !$user->isAllowed( 'deletedhistory' ) ) {
|
if ( !$user->isAllowed( 'deletedhistory' ) ) {
|
||||||
$conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0';
|
$conds[] = $this->mDb->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0';
|
||||||
} elseif( !$user->isAllowed( 'suppressrevision' ) ) {
|
} elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
|
||||||
$conds[] = $this->mDb->bitAnd('rev_deleted',Revision::SUPPRESSED_USER) .
|
$conds[] = $this->mDb->bitAnd( 'rev_deleted', Revision::SUPPRESSED_USER ) .
|
||||||
' != ' . Revision::SUPPRESSED_USER;
|
' != ' . Revision::SUPPRESSED_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -619,10 +619,10 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
$condition = array();
|
$condition = array();
|
||||||
$join_conds = array();
|
$join_conds = array();
|
||||||
$tables = array( 'revision', 'page', 'user' );
|
$tables = array( 'revision', 'page', 'user' );
|
||||||
if( $this->contribs == 'newbie' ) {
|
if ( $this->contribs == 'newbie' ) {
|
||||||
$tables[] = 'user_groups';
|
$tables[] = 'user_groups';
|
||||||
$max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
|
$max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
|
||||||
$condition[] = 'rev_user >' . (int)($max - $max / 100);
|
$condition[] = 'rev_user >' . (int)( $max - $max / 100 );
|
||||||
$condition[] = 'ug_group IS NULL';
|
$condition[] = 'ug_group IS NULL';
|
||||||
$index = 'user_timestamp';
|
$index = 'user_timestamp';
|
||||||
# @todo FIXME: Other groups may have 'bot' rights
|
# @todo FIXME: Other groups may have 'bot' rights
|
||||||
|
|
@ -636,22 +636,22 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
$index = 'user_timestamp';
|
$index = 'user_timestamp';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( $this->deletedOnly ) {
|
if ( $this->deletedOnly ) {
|
||||||
$condition[] = "rev_deleted != '0'";
|
$condition[] = "rev_deleted != '0'";
|
||||||
}
|
}
|
||||||
if( $this->topOnly ) {
|
if ( $this->topOnly ) {
|
||||||
$condition[] = "rev_id = page_latest";
|
$condition[] = "rev_id = page_latest";
|
||||||
}
|
}
|
||||||
return array( $tables, $index, $condition, $join_conds );
|
return array( $tables, $index, $condition, $join_conds );
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNamespaceCond() {
|
function getNamespaceCond() {
|
||||||
if( $this->namespace !== '' ) {
|
if ( $this->namespace !== '' ) {
|
||||||
$selectedNS = $this->mDb->addQuotes( $this->namespace );
|
$selectedNS = $this->mDb->addQuotes( $this->namespace );
|
||||||
$eq_op = $this->nsInvert ? '!=' : '=';
|
$eq_op = $this->nsInvert ? '!=' : '=';
|
||||||
$bool_op = $this->nsInvert ? 'AND' : 'OR';
|
$bool_op = $this->nsInvert ? 'AND' : 'OR';
|
||||||
|
|
||||||
if( !$this->associated ) {
|
if ( !$this->associated ) {
|
||||||
return array( "page_namespace $eq_op $selectedNS" );
|
return array( "page_namespace $eq_op $selectedNS" );
|
||||||
} else {
|
} else {
|
||||||
$associatedNS = $this->mDb->addQuotes (
|
$associatedNS = $this->mDb->addQuotes (
|
||||||
|
|
@ -709,7 +709,7 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
array( 'rev_id', 'rev_len' ),
|
array( 'rev_id', 'rev_len' ),
|
||||||
array( 'rev_id' => $revIds ),
|
array( 'rev_id' => $revIds ),
|
||||||
__METHOD__ );
|
__METHOD__ );
|
||||||
foreach( $res as $row ) {
|
foreach ( $res as $row ) {
|
||||||
$revLens[$row->rev_id] = $row->rev_len;
|
$revLens[$row->rev_id] = $row->rev_len;
|
||||||
}
|
}
|
||||||
wfProfileOut( __METHOD__ );
|
wfProfileOut( __METHOD__ );
|
||||||
|
|
@ -749,19 +749,19 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
);
|
);
|
||||||
# Mark current revisions
|
# Mark current revisions
|
||||||
$topmarktext = '';
|
$topmarktext = '';
|
||||||
if( $row->rev_id == $row->page_latest ) {
|
if ( $row->rev_id == $row->page_latest ) {
|
||||||
$topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
|
$topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
|
||||||
# Add rollback link
|
# Add rollback link
|
||||||
if( !$row->page_is_new && $page->quickUserCan( 'rollback' )
|
if ( !$row->page_is_new && $page->quickUserCan( 'rollback' )
|
||||||
&& $page->quickUserCan( 'edit' ) )
|
&& $page->quickUserCan( 'edit' ) )
|
||||||
{
|
{
|
||||||
$this->preventClickjacking();
|
$this->preventClickjacking();
|
||||||
$topmarktext .= ' '.Linker::generateRollback( $rev );
|
$topmarktext .= ' ' . Linker::generateRollback( $rev );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
# Is there a visible previous revision?
|
# Is there a visible previous revision?
|
||||||
if( $rev->userCan( Revision::DELETED_TEXT, $user ) && $rev->getParentId() !== 0 ) {
|
if ( $rev->userCan( Revision::DELETED_TEXT, $user ) && $rev->getParentId() !== 0 ) {
|
||||||
$difftext = Linker::linkKnown(
|
$difftext = Linker::linkKnown(
|
||||||
$page,
|
$page,
|
||||||
$this->messages['diff'],
|
$this->messages['diff'],
|
||||||
|
|
@ -790,23 +790,23 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
|
|
||||||
$comment = $this->getLanguage()->getDirMark() . Linker::revComment( $rev, false, true );
|
$comment = $this->getLanguage()->getDirMark() . Linker::revComment( $rev, false, true );
|
||||||
$date = $this->getLanguage()->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
|
$date = $this->getLanguage()->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
|
||||||
if( $rev->userCan( Revision::DELETED_TEXT, $user ) ) {
|
if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) {
|
||||||
$d = Linker::linkKnown(
|
$d = Linker::linkKnown(
|
||||||
$page,
|
$page,
|
||||||
htmlspecialchars($date),
|
htmlspecialchars( $date ),
|
||||||
array(),
|
array(),
|
||||||
array( 'oldid' => intval( $row->rev_id ) )
|
array( 'oldid' => intval( $row->rev_id ) )
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$d = htmlspecialchars( $date );
|
$d = htmlspecialchars( $date );
|
||||||
}
|
}
|
||||||
if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
|
if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
|
||||||
$d = '<span class="history-deleted">' . $d . '</span>';
|
$d = '<span class="history-deleted">' . $d . '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
# Show user names for /newbies as there may be different users.
|
# Show user names for /newbies as there may be different users.
|
||||||
# Note that we already excluded rows with hidden user names.
|
# Note that we already excluded rows with hidden user names.
|
||||||
if( $this->contribs == 'newbie' ) {
|
if ( $this->contribs == 'newbie' ) {
|
||||||
$userlink = ' . . ' . Linker::userLink( $rev->getUser(), $rev->getUserText() );
|
$userlink = ' . . ' . Linker::userLink( $rev->getUser(), $rev->getUserText() );
|
||||||
$userlink .= ' ' . wfMsg( 'parentheses',
|
$userlink .= ' ' . wfMsg( 'parentheses',
|
||||||
Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) ) . ' ';
|
Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) ) . ' ';
|
||||||
|
|
@ -814,13 +814,13 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
$userlink = '';
|
$userlink = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $rev->getParentId() === 0 ) {
|
if ( $rev->getParentId() === 0 ) {
|
||||||
$nflag = ChangesList::flag( 'newpage' );
|
$nflag = ChangesList::flag( 'newpage' );
|
||||||
} else {
|
} else {
|
||||||
$nflag = '';
|
$nflag = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $rev->isMinor() ) {
|
if ( $rev->isMinor() ) {
|
||||||
$mflag = ChangesList::flag( 'minor' );
|
$mflag = ChangesList::flag( 'minor' );
|
||||||
} else {
|
} else {
|
||||||
$mflag = '';
|
$mflag = '';
|
||||||
|
|
@ -828,8 +828,8 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
|
|
||||||
// Don't show useless link to people who cannot hide revisions
|
// Don't show useless link to people who cannot hide revisions
|
||||||
$canHide = $user->isAllowed( 'deleterevision' );
|
$canHide = $user->isAllowed( 'deleterevision' );
|
||||||
if( $canHide || ($rev->getVisibility() && $user->isAllowed('deletedhistory')) ) {
|
if ( $canHide || ( $rev->getVisibility() && $user->isAllowed( 'deletedhistory' ) ) ) {
|
||||||
if( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
|
if ( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
|
||||||
$del = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
|
$del = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
|
||||||
} else {
|
} else {
|
||||||
$query = array(
|
$query = array(
|
||||||
|
|
@ -849,12 +849,12 @@ class ContribsPager extends ReverseChronologicalPager {
|
||||||
$ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
|
$ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
|
||||||
|
|
||||||
# Denote if username is redacted for this edit
|
# Denote if username is redacted for this edit
|
||||||
if( $rev->isDeleted( Revision::DELETED_USER ) ) {
|
if ( $rev->isDeleted( Revision::DELETED_USER ) ) {
|
||||||
$ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";
|
$ret .= " <strong>" . wfMsgHtml( 'rev-deleted-user-contribs' ) . "</strong>";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tags, if any.
|
# Tags, if any.
|
||||||
list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'contributions' );
|
list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'contributions' );
|
||||||
$classes = array_merge( $classes, $newClasses );
|
$classes = array_merge( $classes, $newClasses );
|
||||||
$ret .= " $tagSummary";
|
$ret .= " $tagSummary";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue