protected $mSkin;
/**
- * @var Language
+ * @var Language
*/
public $lang;
* @file
* @ingroup SpecialPage
*/
-
+
/**
* Implements Special:Allpages
*
$namespaces = $wgContLang->getNamespaces();
- $wgOut->setPagetitle(
+ $wgOut->setPagetitle(
( $namespace > 0 && in_array( $namespace, array_keys( $namespaces) ) ) ?
wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) :
wfMsg( 'allarticles' )
function namespaceForm( $namespace = NS_MAIN, $from = '', $to = '' ) {
global $wgScript;
$t = $this->getTitle();
-
+
$out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) );
$out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
$out .= Html::hidden( 'title', $t->getPrefixedText() );
'page_title',
array( 'page_namespace' => $namespace, 'page_title < '.$dbr->addQuotes($from) ),
__METHOD__,
- array( 'ORDER BY' => 'page_title DESC',
+ array( 'ORDER BY' => 'page_title DESC',
'LIMIT' => $this->maxPerPage, 'OFFSET' => ($this->maxPerPage - 1 )
)
);
# User logs, UserRights, etc.
$wgUser->getSkin()->setRelevantUser( $this->target );
}
-
+
# bug 15810: blocked admins should have limited access here
$status = self::checkUnblockSelf( $this->target );
if ( $status !== true ) {
if( $request instanceof WebRequest ){
$target = $request->getText( 'wpTarget', null );
}
- break;
+ break;
case 1:
$target = $par;
break;
if( $request instanceof WebRequest ){
$target = $request->getText( 'ip', null );
}
- break;
+ break;
case 3:
# B/C @since 1.18
if( $request instanceof WebRequest ){
$target = $request->getText( 'wpBlockAddress', null );
}
- break;
+ break;
case 4:
break 2;
}
$form->setWrapperLegend( wfMsg( 'ipblocklist-legend' ) );
$form->setSubmitText( wfMsg( 'ipblocklist-submit' ) );
$form->prepareForm();
-
+
$form->displayForm( '' );
$this->showList();
}
$chunk = self::getIpFragment( $start );
$dbr = wfGetDB( DB_SLAVE );
$like = $dbr->buildLike( $chunk, $dbr->anyString() );
-
+
# Fairly hard to make a malicious SQL statement out of hex characters,
# but stranger things have happened...
$safeStart = $dbr->addQuotes( IP::toHex( $start ) );
$sum += 3 * $isbn{$i};
}
}
-
+
$check = (10 - ($sum % 10)) % 10;
if ($check == $isbn{12}) {
return true;
for($i = 0; $i < 9; $i++) {
$sum += $isbn{$i} * ($i + 1);
}
-
+
$check = $sum % 11;
if($check == 10) {
$check = "X";
function __construct( $name = 'BrokenRedirects' ) {
parent::__construct( $name );
}
-
+
function isExpensive() { return true; }
function isSyndicated() { return false; }
function sortDescending() { return false; }
$this->mOffset = $from;
}
}
-
+
function getQueryInfo() {
return array(
'tables' => array( 'category' ),
'fields' => array( 'cat_title','cat_pages' ),
- 'conds' => array( 'cat_pages > 0' ),
+ 'conds' => array( 'cat_pages > 0' ),
'options' => array( 'USE INDEX' => 'cat_title' ),
);
}
$wgLang->formatNum( $result->cat_pages ) );
return Xml::tags('li', null, "$titleText ($count)" ) . "\n";
}
-
+
public function getStartForm( $from ) {
global $wgScript;
$t = SpecialPage::getTitleFor( 'Categories' );
-
+
return
Xml::tags( 'form', array( 'method' => 'get', 'action' => $wgScript ),
Html::hidden( 'title', $t->getPrefixedText() ) .
function execute( $code ) {
global $wgUser, $wgOut;
$this->setHeaders();
-
+
if ( wfReadOnly() ) {
$wgOut->readOnlyPage();
return;
}
-
+
if( empty( $code ) ) {
if( $wgUser->isLoggedIn() ) {
if( User::isValidEmailAddr( $wgUser->getEmail() ) ) {
$this->setHeaders();
if ( wfReadOnly() ) {
- global $wgOut;
+ global $wgOut;
$wgOut->readOnlyPage();
return;
}
-
+
$this->attemptInvalidate( $code );
}
array(),
array( 'user' => $username )
);
-
+
# Other logs link
$tools[] = $sk->linkKnown(
SpecialPage::getTitleFor( 'Log' ),
Html::rawElement( 'p', array( 'style' => 'white-space: nowrap' ),
Xml::dateMenu( $this->opts['year'], $this->opts['month'] ) . ' ' .
Xml::submitButton( wfMsg( 'sp-contributions-submit' ) )
- ) . ' ';
+ ) . ' ';
$explain = wfMsgExt( 'sp-contributions-explain', 'parseinline' );
if( !wfEmptyMsg( 'sp-contributions-explain' ) ) {
$f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
}
function isSyndicated() {
- return false;
+ return false;
}
/**
) ) )
);
}
-
+
function getOrderFields() {
// For some crazy reason ordering by a constant
// causes a filesort
} else {
$mflag = '';
}
-
+
// Revision delete link
$canHide = $wgUser->isAllowed( 'deleterevision' );
if( $canHide || ($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
array( 'class' => 'mw-deletedcontribs-tools' ),
wfMsg( 'parentheses', $wgLang->pipeList( array( $last, $dellog, $reviewlink ) ) )
);
-
+
$ret = "{$del}{$link} {$tools} . . {$mflag} {$pagelink} {$comment}";
-
+
# Denote if username is redacted for this edit
if( $rev->isDeleted( Revision::DELETED_USER ) ) {
$ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";
array(),
array(
'action' => 'unblock',
- 'ip' => $nt->getDBkey()
+ 'ip' => $nt->getDBkey()
)
);
}
$set = 'FALSE';
wfDebug("Mediawiki:disambiguationspage message does not link to any templates!\n");
}
-
+
// FIXME: What are pagelinks and p2 doing here?
return array (
'tables' => array( 'templatelinks', 'p1' => 'page', 'pagelinks', 'p2' => 'page' ),
function getOrderFields() {
return array( 'tl_namespace', 'tl_title', 'value' );
}
-
+
function sortDescending() {
return false;
}
-
+
/**
* Fetch links and cache their existence
*/
function __construct( $name = 'DoubleRedirects' ) {
parent::__construct( $name );
}
-
+
function isExpensive() { return true; }
function isSyndicated() { return false; }
function sortDescending() { return false; }
*/
class SpecialEmailUser extends UnlistedSpecialPage {
protected $mTarget;
-
+
public function __construct(){
parent::__construct( 'Emailuser' );
}
-
+
protected function getFormFields(){
global $wgUser;
return array(
'From' => array(
'type' => 'info',
'raw' => 1,
- 'default' => $wgUser->getSkin()->link(
- $wgUser->getUserPage(),
- htmlspecialchars( $wgUser->getName() )
+ 'default' => $wgUser->getSkin()->link(
+ $wgUser->getUserPage(),
+ htmlspecialchars( $wgUser->getName() )
),
'label-message' => 'emailfrom',
'id' => 'mw-emailuser-sender',
'To' => array(
'type' => 'info',
'raw' => 1,
- 'default' => $wgUser->getSkin()->link(
- $this->mTargetObj->getUserPage(),
+ 'default' => $wgUser->getSkin()->link(
+ $this->mTargetObj->getUserPage(),
htmlspecialchars( $this->mTargetObj->getName() )
),
'label-message' => 'emailto',
),
);
}
-
+
public function execute( $par ) {
global $wgRequest, $wgOut, $wgUser;
$this->mTarget = is_null( $par )
? $wgRequest->getVal( 'wpTarget', $wgRequest->getVal( 'target', '' ) )
: $par;
-
+
$ret = self::getTarget( $this->mTarget );
if( $ret instanceof User ){
$this->mTargetObj = $ret;
$wgOut->showErrorPage( "{$ret}title", "{$ret}text" );
return false;
}
-
+
$error = self::getPermissionsError( $wgUser, $wgRequest->getVal( 'wpEditToken' ) );
switch ( $error ) {
case null:
$wgOut->showErrorPage( $title, $msg, $params );
return;
}
-
+
$form = new HTMLForm( $this->getFormFields() );
$form->addPreText( wfMsgExt( 'emailpagetext', 'parseinline' ) );
$form->setSubmitText( wfMsg( 'emailsend' ) );
$form->setSubmitCallback( array( __CLASS__, 'submit' ) );
$form->setWrapperLegend( wfMsgExt( 'email-legend', 'parsemag' ) );
$form->loadData();
-
+
if( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ){
return false;
}
-
+
$wgOut->setPagetitle( wfMsg( 'emailpage' ) );
$result = $form->show();
-
+
if( $result === true || ( $result instanceof Status && $result->isGood() ) ){
$wgOut->setPagetitle( wfMsg( 'emailsent' ) );
$wgOut->addWikiMsg( 'emailsenttext' );
wfDebug( "Target is empty.\n" );
return 'notarget';
}
-
+
$nu = User::newFromName( $target );
if( !$nu instanceof User || !$nu->getId() ) {
wfDebug( "Target is invalid user.\n" );
if( !$wgEnableEmail || !$wgEnableUserEmail ){
return 'usermaildisabled';
}
-
+
if( !$user->isAllowed( 'sendemail' ) ) {
return 'badaccess';
}
-
+
if( !$user->isEmailConfirmed() ){
return 'mailnologin';
}
/**
* Really send a mail. Permissions should have been checked using
- * getPermissionsError(). It is probably also a good
+ * getPermissionsError(). It is probably also a good
* idea to check the edit token and ping limiter in advance.
*
* @return Mixed: Status object, or potentially a String on error
// Add a standard footer and trim up trailing newlines
$text = rtrim( $text ) . "\n\n-- \n";
- $text .= wfMsgExt(
+ $text .= wfMsgExt(
'emailuserfooter',
- array( 'content', 'parsemag' ),
- array( $from->name, $to->name )
+ array( 'content', 'parsemag' ),
+ array( $from->name, $to->name )
);
$error = '';
if( !wfRunHooks( 'EmailUser', array( &$to, &$from, &$subject, &$text, &$error ) ) ) {
return $error;
}
-
+
if( $wgUserEmailUseReplyTo ) {
// Put the generic wiki autogenerated address in the From:
// header and reserve the user for Reply-To.
return $status;
} else {
// if the user requested a copy of this mail, do this now,
- // unless they are emailing themselves, in which case one
+ // unless they are emailing themselves, in which case one
// copy of the message is sufficient.
if ( $data['CCMe'] && $to != $from ) {
$cc_subject = wfMsg(
- 'emailccsubject',
- $target->getName(),
+ 'emailccsubject',
+ $target->getName(),
$subject
);
wfRunHooks( 'EmailUserCC', array( &$from, &$from, &$cc_subject, &$text ) );
$page = $wgRequest->getText( 'pages' );
$this->curonly = $wgRequest->getCheck( 'curonly' );
$rawOffset = $wgRequest->getVal( 'offset' );
-
+
if( $rawOffset ) {
$offset = wfTimestamp( TS_MW, $rawOffset );
} else {
$offset = null;
}
-
+
$limit = $wgRequest->getInt( 'limit' );
$dir = $wgRequest->getVal( 'dir' );
$history = array(
'limit' => $wgExportMaxHistory,
);
$historyCheck = $wgRequest->getCheck( 'history' );
-
+
if ( $this->curonly ) {
$history = WikiExporter::CURRENT;
} elseif ( !$historyCheck ) {
// Default to current-only for GET requests.
$page = $wgRequest->getText( 'pages', $par );
$historyCheck = $wgRequest->getCheck( 'history' );
-
+
if( $historyCheck ) {
$history = WikiExporter::FULL;
} else {
if ( $this->doExport ) {
$wgOut->disable();
-
+
// Cancel output buffering and gzipping if set
// This should provide safer streaming for pages with history
wfResetOutputBuffers();
$wgRequest->response()->header( "Content-type: application/xml; charset=utf-8" );
-
+
if( $wgRequest->getCheck( 'wpDownload' ) ) {
// Provide a sane filename suggestion
$filename = urlencode( $wgSitename . '-' . wfTimestampNow() . '.xml' );
$wgRequest->response()->header( "Content-disposition: attachment;filename={$filename}" );
}
-
+
$this->doExport( $page, $history, $list_authors );
-
+
return;
}
} else {
$wgOut->addHTML( wfMsgExt( 'exportnohistory', 'parse' ) );
}
-
+
$form .= Xml::checkLabel(
- wfMsg( 'export-templates' ),
- 'templates',
- 'wpExportTemplates',
+ wfMsg( 'export-templates' ),
+ 'templates',
+ 'wpExportTemplates',
$wgRequest->wasPosted() ? $wgRequest->getCheck( 'templates' ) : false
) . '<br />';
-
+
if( $wgExportMaxLinkDepth || $this->userCanOverrideExportDepth() ) {
$form .= Xml::inputLabel( wfMsg( 'export-pagelinks' ), 'pagelink-depth', 'pagelink-depth', 20, 0 ) . '<br />';
}
$form .= Xml::submitButton( wfMsg( 'export-submit' ), $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'export' ) );
$form .= Xml::closeElement( 'form' );
-
+
$wgOut->addHTML( $form );
}
foreach( $pages as $k => $v ) {
$pages[$k] = str_replace( " ", "_", $v );
}
-
+
$pages = array_unique( $pages );
/* Ok, let's get to it... */
set_time_limit(0);
wfRestoreWarnings();
}
-
+
$exporter = new WikiExporter( $db, $history, $buffer );
$exporter->list_authors = $list_authors;
$exporter->openStream();
-
+
foreach( $pages as $page ) {
/*
if( $wgExportMaxHistory && !$this->curonly ) {
}
$exporter->closeStream();
-
+
if( $lb ) {
$lb->closeAll();
}
);
$pages = array();
-
+
foreach ( $res as $row ) {
$n = $row->page_title;
if ($row->page_namespace) {
);
$pages = array();
-
+
foreach ( $res as $row ) {
$n = $row->page_title;
-
+
if ( $row->page_namespace ) {
$ns = $wgContLang->getNsText( $row->page_namespace );
$n = $ns . ':' . $n;
*/
private function validateLinkDepth( $depth ) {
global $wgExportMaxLinkDepth;
-
+
if( $depth < 0 ) {
return 0;
}
-
+
if ( !$this->userCanOverrideExportDepth() ) {
if( $depth > $wgExportMaxLinkDepth ) {
return $wgExportMaxLinkDepth;
}
}
-
+
/*
* There's a HARD CODED limit of 5 levels of recursion here to prevent a
* crazy-big export from being done by someone setting the depth
for( ; $depth > 0; --$depth ) {
$pageSet = $this->getLinks(
$inputPages, $pageSet, 'pagelinks',
- array( 'pl_namespace AS namespace', 'pl_title AS title' ),
+ array( 'pl_namespace AS namespace', 'pl_title AS title' ),
array( 'page_id=pl_from' )
);
$inputPages = array_keys( $pageSet );
}
-
+
return $pageSet;
}
/**
* Expand a list of pages to include images used in those pages.
- *
+ *
* @param $inputPages array, list of titles to look up
* @param $pageSet array, associative array indexed by titles for output
- *
+ *
* @return array associative array index by titles
*/
private function getImages( $inputPages, $pageSet ) {
*/
private function getLinks( $inputPages, $pageSet, $table, $fields, $join ) {
$dbr = wfGetDB( DB_SLAVE );
-
+
foreach( $inputPages as $page ) {
$title = Title::newFromText( $page );
-
+
if( $title ) {
$pageSet[$title->getPrefixedText()] = true;
/// @todo Fixme: May or may not be more efficient to batch these
),
__METHOD__
);
-
+
foreach( $result as $row ) {
$template = Title::makeTitle( $row->namespace, $row->title );
$pageSet[$template->getPrefixedText()] = true;
}
}
}
-
+
return $pageSet;
}
-
+
}
'conds' => array( 'img_sha1' => $this->hash )
);
}
-
+
function execute( $par ) {
global $wgRequest, $wgOut, $wgLang, $wgContLang, $wgScript;
-
+
$this->setHeaders();
$this->outputHeader();
-
+
$this->filename = isset( $par ) ? $par : $wgRequest->getText( 'filename' );
$this->file = null;
$this->hash = '';
$this->showForm( $title );
} else {
$file = wfFindFile( $title );
-
+
if ( $file && $file->exists() ) {
// Default behaviour: Use the direct link to the file.
$url = $file->getURL();
$width = $wgRequest->getInt( 'width', -1 );
$height = $wgRequest->getInt( 'height', -1 );
- // If a width is requested...
+ // If a width is requested...
if ( $width != -1 ) {
$mto = $file->transform( array( 'width' => $width, 'height' => $height ) );
// ... and we can
* @ingroup SpecialPage
*/
class SpecialImport extends SpecialPage {
-
+
private $interwiki = false;
private $namespace;
private $frompage = '';
private $logcomment= false;
private $history = true;
private $includeTemplates = false;
-
+
/**
* Constructor
*/
global $wgImportTargetNamespace;
$this->namespace = $wgImportTargetNamespace;
}
-
+
/**
* Execute
*/
function execute( $par ) {
global $wgRequest;
-
+
$this->setHeaders();
$this->outputHeader();
-
+
if ( wfReadOnly() ) {
global $wgOut;
$wgOut->readOnlyPage();
return;
}
-
+
if ( $wgRequest->wasPosted() && $wgRequest->getVal( 'action' ) == 'submit' ) {
$this->doImport();
}
$this->showForm();
}
-
+
/**
* Do the actual import
*/
private $mLogItemCount = 0;
function __construct( $importer, $upload, $interwiki , $reason=false ) {
- $this->mOriginalPageOutCallback =
- $importer->setPageOutCallback( array( $this, 'reportPage' ) );
+ $this->mOriginalPageOutCallback =
+ $importer->setPageOutCallback( array( $this, 'reportPage' ) );
$this->mOriginalLogCallback =
$importer->setLogItemCallback( array( $this, 'reportLogItem' ) );
$this->mPageCount = 0;
global $wgOut;
$wgOut->addHTML( "<ul>\n" );
}
-
+
function reportLogItem( /* ... */ ) {
$this->mLogItemCount++;
if ( is_callable( $this->mOriginalLogCallback ) ) {
function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
global $wgOut, $wgUser, $wgLang, $wgContLang;
-
+
$args = func_get_args();
call_user_func_array( $this->mOriginalPageOutCallback, $args );
function close() {
global $wgOut, $wgLang;
-
+
if ( $this->mLogItemCount > 0 ) {
$msg = wfMsgExt( 'imported-log-entries', 'parseinline',
$wgLang->formatNum( $this->mLogItemCount ) );
* @ingroup SpecialPage
* @author Brion Vibber
*/
-
+
/**
* Special:LinkSearch to search the external-links table.
function __construct( $name = 'LinkSearch' ) {
parent::__construct( $name );
}
-
+
function isCacheable() {
return false;
}
-
+
function execute( $par ) {
global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode, $wgLang;
$this->setHeaders();
$wgOut->allowClickjacking();
-
+
$target = $wgRequest->getVal( 'target', $par );
$namespace = $wgRequest->getIntorNull( 'namespace', null );
$wgOut->addHTML( $s );
if( $target != '' ) {
- $this->setParams( array(
+ $this->setParams( array(
'query' => $target2,
'namespace' => $namespace,
'protocol' => $protocol ) );
if( $this->mMungedQuery === false )
// Invalid query; return no results
return array( 'tables' => 'page', 'fields' => 'page_id', 'conds' => '0=1' );
-
+
$stripped = LinkFilter::keepOneWildcard( $this->mMungedQuery );
$like = $dbr->buildLike( $stripped );
$retval = array (
* @file
* @ingroup SpecialPage
*/
-
+
function wfSpecialListfiles( $par = null ) {
global $wgOut;
var $mFieldNames = null;
var $mQueryConds = array();
var $mUserName = null;
-
+
function __construct( $par = null ) {
global $wgRequest, $wgMiserMode;
if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) {
} else {
$this->mDefaultDirection = false;
}
-
+
$userName = $wgRequest->getText( 'user', $par );
if ( $userName ) {
$nt = Title::newFromText( $userName, NS_USER );
$this->mUserName = $nt->getText();
$this->mQueryConds['img_user_text'] = $this->mUserName;
}
- }
-
+ }
+
$search = $wgRequest->getText( 'ilsearch' );
if ( $search != '' && !$wgMiserMode ) {
$nt = Title::newFromURL( $search );
if ( $nt ) {
$dbr = wfGetDB( DB_SLAVE );
- $this->mQueryConds[] = 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(),
+ $this->mQueryConds[] = 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(),
strtolower( $nt->getDBkey() ), $dbr->anyString() );
}
}
function getSortHeaderClass() {
return 'listfiles_sort ' . parent::getSortHeaderClass();
}
-
+
function getPagingQueries() {
$queries = parent::getPagingQueries();
if ( !is_null( $this->mUserName ) ) {
'</tr>'
);
- $allGroups = array_unique( array_merge(
+ $allGroups = array_unique( array_merge(
array_keys( $wgGroupPermissions ),
array_keys( $wgRevokePermissions ),
array_keys( $wgAddGroups ),
array_keys( $wgGroupsRemoveFromSelf )
) );
asort( $allGroups );
-
+
foreach ( $allGroups as $group ) {
- $permissions = isset( $wgGroupPermissions[$group] )
- ? $wgGroupPermissions[$group]
+ $permissions = isset( $wgGroupPermissions[$group] )
+ ? $wgGroupPermissions[$group]
: array();
$groupname = ( $group == '*' ) // Replace * with a more descriptive groupname
- ? 'all'
- : $group;
+ ? 'all'
+ : $group;
$msg = wfMessage( 'group-' . $groupname );
$groupnameLocalized = !$msg->isBlank() ? $msg->text() : $groupname;
* @return string List of all granted permissions, separated by comma separator
*/
private static function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) {
- global $wgLang;
+ global $wgLang;
$r = array();
foreach( $permissions as $permission => $granted ) {
function __construct( $name = 'Listredirects' ) {
parent::__construct( $name );
}
-
+
function isExpensive() { return true; }
function isSyndicated() { return false; }
function sortDescending() { return false; }
function getOrderFields() {
return array ( 'p1.page_namespace', 'p1.page_title' );
}
-
+
/**
* Cache page existence for performance
*/
$db->dataSeek( $res, 0 );
}
}
-
+
protected function getRedirectTarget( $row ) {
if ( isset( $row->rd_title ) ) {
return Title::makeTitle( $row->rd_namespace,
function __construct( $name = 'Lonelypages' ) {
parent::__construct( $name );
}
-
+
function getPageHeader() {
return wfMsgExt( 'lonelypagestext', array( 'parse' ) );
}
'tl_title = page_title' ) ) )
);
}
-
+
function getOrderFields() {
// For some crazy reason ordering by a constant
// causes a filesort in MySQL 5
function linkParameters() {
return array( 'mime' => "{$this->major}/{$this->minor}" );
}
-
+
public function getQueryInfo() {
return array(
'tables' => array( 'image' ),
'img_minor_mime' => $this->minor )
);
}
-
+
function execute( $par ) {
global $wgRequest, $wgOut;
$mime = $par ? $par : $wgRequest->getText( 'mime' );
-
+
$this->setHeaders();
$this->outputHeader();
$wgOut->addHTML(
}
parent::execute( $par );
}
-
+
function formatResult( $skin, $result ) {
global $wgContLang, $wgLang;
wfEscapeWikiText( $this->mDestObj->getPrefixedText() )
);
}
-
+
if ( $this->mTargetObj && $this->mDestObj && $this->mTargetObj->equals( $this->mDestObj ) ) {
$errors[] = wfMsgExt( 'mergehistory-same-destination', array( 'parse' ) );
}
function __construct( $name = 'Mostcategories' ) {
parent::__construct( $name );
}
-
+
function isExpensive() { return true; }
function isSyndicated() { return false; }
function __construct( $name = 'Mostlinked' ) {
parent::__construct( $name );
}
-
+
function isExpensive() { return true; }
function isSyndicated() { return false; }
function __construct( $name = 'Mostlinkedcategories' ) {
parent::__construct( $name );
}
-
+
function isExpensive() { return true; }
function isSyndicated() { return false; }
* @ingroup SpecialPage
* @author Rob Church <robchur@gmail.com>
*/
-
+
/**
* Special page lists templates with a large number of
* transclusion links, i.e. "most used" templates
function __construct( $name = 'Mostrevisions' ) {
parent::__construct( $name );
}
-
+
function sortDescending() {
return true;
}
Xml::element( 'legend', null, wfMsg( 'move-page-legend' ) ) .
Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-movepage-table' ) ) .
"<tr>
- <td class='mw-label'>" .
+ <td class='mw-label'>" .
wfMsgHtml( 'movearticle' ) .
"</td>
<td class='mw-input'>
$invertSort = true;
}
$sql = 'SELECT img_size, img_name, img_user, img_user_text,'.
- "img_description,img_timestamp FROM $image";
+ "img_description,img_timestamp FROM $image";
if( $hidebotsql ) {
$sql .= $hidebotsql;
'savedprefs'
);
}
-
+
if ( $wgRequest->getCheck( 'eauth' ) ) {
$wgOut->wrapWikiMsg( "<div class='error' style='clear: both;'>\n$1\n</div>",
'eauthentsent', $wgUser->getName() );
*/
class SpecialPrefixindex extends SpecialAllpages {
// Inherit $maxPerPage
-
+
function __construct(){
parent::__construct( 'Prefixindex' );
}
-
+
/**
* Entry point : initialise variables and call subfunctions.
* @param $par String: becomes "FOO" when called like Special:Prefixindex/FOO (default null)
$wgOut->addHTML( $this->namespacePrefixForm( $namespace, null ) );
}
}
-
+
/**
* HTML for the top form
* @param $namespace Integer: a namespace constant (default NS_MAIN).
$n = 0;
if( $res->numRows() > 0 ) {
$out = Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-prefixindex-list-table' ) );
-
+
while( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
$t = Title::makeTitle( $s->page_namespace, $s->page_title );
if( $t ) {
return
Xml::checkLabel( wfMsg('protectedpages-indef'), 'indefonly', 'indefonly', $indefOnly ) . "\n";
}
-
+
/**
* @return string Formatted HTML
*/
public $mForm, $mConds;
private $type, $level, $namespace, $sizetype, $size, $indefonly;
- function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0,
+ function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0,
$indefonly = false, $cascadeonly = false )
{
$this->mForm = $form;
'OR pr_expiry IS NULL)';
$conds[] = 'page_id=pr_page';
$conds[] = 'pr_type=' . $this->mDb->addQuotes( $this->type );
-
+
if( $this->sizetype=='min' ) {
$conds[] = 'page_len>=' . $this->size;
} else if( $this->sizetype=='max' ) {
if( is_null( $title ) ) {
$this->setHeaders();
- $wgOut->addWikiMsg( strtolower( $this->mName ) . '-nopages',
+ $wgOut->addWikiMsg( strtolower( $this->mName ) . '-nopages',
$this->getNsList(), count( $this->namespaces ) );
return;
}
MWNamespace::getAssociated( $opts['namespace'] )
);
$condition = "(rc_namespace $operator $selectedNS "
- . $boolean
- . " rc_namespace $operator $associatedNS)";
+ . $boolean
+ . " rc_namespace $operator $associatedNS)";
}
$conds[] = $condition;
else
$order = array();
-
- $query = $dbr->selectSQLText(
- array_merge( $tables, array( $link_table ) ),
- $select,
+
+ $query = $dbr->selectSQLText(
+ array_merge( $tables, array( $link_table ) ),
+ $select,
$conds + $subconds,
- __METHOD__,
+ __METHOD__,
$order + $query_options,
$join_conds + array( $link_table => array( 'INNER JOIN', $subjoin ) )
);
-
+
if( $dbr->unionSupportsOrderAndLimit())
$query = $dbr->limitResult( $query, $limit );
$sql = $dbr->unionQueries($subsql, false).' ORDER BY rc_timestamp DESC';
$sql = $dbr->limitResult($sql, $limit, false);
}
-
+
$res = $dbr->query( $sql, __METHOD__ );
if( $res->numRows() == 0 )
return $res;
}
-
+
function getExtraOptions( $opts ){
$opts->consumeValues( array( 'showlinkedto', 'target', 'tagfilter' ) );
$extraOpts = array();
function setBottomText( OutputPage $out, FormOptions $opts ) {
if( isset( $this->mResultEmpty ) && $this->mResultEmpty ){
- $out->addWikiMsg( 'recentchangeslinked-noresult' );
+ $out->addWikiMsg( 'recentchangeslinked-noresult' );
}
}
}
$this->mNewpass = $wgRequest->getVal( 'wpNewPassword' );
$this->mRetype = $wgRequest->getVal( 'wpRetype' );
$this->mDomain = $wgRequest->getVal( 'wpDomain' );
-
+
$this->setHeaders();
$this->outputHeader();
$wgOut->disallowUserJs();
}
$this->showForm();
}
-
+
function doReturnTo() {
global $wgRequest, $wgOut;
$titleObj = Title::newFromText( $wgRequest->getVal( 'returnto' ) );
$rememberMe = '<tr>' .
'<td></td>' .
'<td class="mw-input">' .
- Xml::checkLabel(
+ Xml::checkLabel(
wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ),
'wpRemember', 'wpRemember',
$wgRequest->getCheck( 'wpRemember' ) ) .
$out .= "\t<td class='mw-label'>";
if ( $type != 'text' )
$out .= Xml::label( wfMsg( $label ), $name );
- else
+ else
$out .= wfMsgHtml( $label );
$out .= "</td>\n";
$out .= "\t<td class='mw-input'>$field</td>\n";
if( !$user || $user->isAnon() ) {
throw new PasswordError( 'no such user' );
}
-
+
if( $newpass !== $retype ) {
wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'badretype' ) );
throw new PasswordError( wfMsg( 'badretype' ) );
wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'wrongpassword' ) );
throw new PasswordError( wfMsg( 'resetpass-wrong-oldpass' ) );
}
-
+
try {
$user->setPassword( $this->mNewpass );
wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'success' ) );
wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'error' ) );
throw new PasswordError( $e->getMessage() );
}
-
+
$user->setCookies();
$user->saveSettings();
}
);
foreach( $sortedPages as $desc => $specialpage ) {
list( $title, $restricted, $expensive) = $specialpage;
-
+
$pageClasses = array();
if ( $expensive && $wgMiserMode ){
$includesCachedPages = true;
$includesRestrictedPages = true;
$pageClasses[] = 'mw-specialpagerestricted';
}
-
+
$link = $sk->linkKnown( $title , htmlspecialchars( $desc ) );
$wgOut->addHTML( Html::rawElement( 'li', array( 'class' => implode( ' ', $pageClasses ) ), $link ) . "\n" );
* @ingroup SpecialPage
*/
class SpecialStatistics extends SpecialPage {
-
+
private $views, $edits, $good, $images, $total, $users,
$activeUsers = 0;
-
+
public function __construct() {
parent::__construct( 'Statistics' );
}
-
+
public function execute( $par ) {
global $wgOut, $wgMemc;
global $wgDisableCounters, $wgMiserMode;
-
+
$this->setHeaders();
$wgOut->addModuleStyles( 'mediawiki.special' );
-
+
$this->views = SiteStats::views();
$this->edits = SiteStats::edits();
$this->good = SiteStats::articles();
$this->users = SiteStats::users();
$this->activeUsers = SiteStats::activeUsers();
$this->hook = '';
-
+
# Staticic - views
$viewsStats = '';
if( !$wgDisableCounters ) {
$viewsStats = $this->getViewsStats();
}
-
+
# Set active user count
if( !$wgMiserMode ) {
$key = wfMemcKey( 'sitestats', 'activeusers-updated' );
if( !$wgDisableCounters && !$wgMiserMode ) {
$text .= $this->getMostViewedPages();
}
-
+
# Statistic - other
$extraStats = array();
if( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) {
$msg = wfMessage( $descMsg, $descMsgParam );
if ( $msg->exists() ) {
$descriptionText = $msg->parse();
- $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'),
+ $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'),
" ($descriptionText)" );
}
}
Html::rawElement( 'td', array( 'class' => 'mw-statistics-numbers' ), $number )
);
}
-
+
/**
* Each of these methods is pretty self-explanatory, get a particular
* row for the table of statistics
$wgLang->formatNum( $this->views ),
array ( 'class' => 'mw-statistics-views-total' ), 'statistics-views-total-desc' ) .
$this->formatRow( wfMsgExt( 'statistics-views-peredit', array( 'parseinline' ) ),
- $wgLang->formatNum( sprintf( '%.2f', $this->edits ?
+ $wgLang->formatNum( sprintf( '%.2f', $this->edits ?
$this->views / $this->edits : 0 ) ),
array ( 'class' => 'mw-statistics-views-peredit' ) );
}
if( $title instanceof Title ) {
$text .= $this->formatRow( $sk->link( $title ),
$wgLang->formatNum( $row->page_counter ) );
-
+
}
}
$res->free();
$return = Xml::openElement( 'tr' ) .
Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-hooks', array( 'parseinline' ) ) ) .
Xml::closeElement( 'tr' );
-
+
foreach( $stats as $name => $number ) {
$name = htmlspecialchars( $name );
$number = htmlspecialchars( $number );
-
+
$return .= $this->formatRow( $name, $wgLang->formatNum( $number ), array( 'class' => 'mw-statistics-hook' ) );
}
-
+
return $return;
}
}
}
global $wgLang;
-
+
$newRow = '';
$newRow .= Xml::tags( 'td', null, Xml::element( 'tt', null, $tag ) );
break;
}
}
-
+
} else {
$fields['Target']['default'] = $this->target;
unset( $fields['Name'] );
function isSyndicated() {
return false;
}
-
+
function getQueryInfo() {
return array (
'tables' => array( 'page', 'categorylinks' ),
'LEFT JOIN', 'cl_from = page_id' ) )
);
}
-
+
function getOrderFields() {
// For some crazy reason ordering by a constant
// causes a filesort
$res = $dbr->select( 'archive',
array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment', 'ar_len', 'ar_deleted' ),
array( 'ar_namespace' => $this->title->getNamespace(),
- 'ar_title' => $this->title->getDBkey() ),
+ 'ar_title' => $this->title->getDBkey() ),
'PageArchive::listRevisions',
array( 'ORDER BY' => 'ar_timestamp DESC' ) );
$ret = $dbr->resultObject( $res );
'ar_deleted',
'ar_len' ),
array( 'ar_namespace' => $this->title->getNamespace(),
- 'ar_title' => $this->title->getDBkey(),
- 'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
+ 'ar_title' => $this->title->getDBkey(),
+ 'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
__METHOD__ );
if( $row ) {
return Revision::newFromArchiveRow( $row, array( 'page' => $this->title->getArticleId() ) );
$row = $dbr->selectRow( 'archive',
'ar_timestamp',
array( 'ar_namespace' => $this->title->getNamespace(),
- 'ar_title' => $this->title->getDBkey(),
- 'ar_timestamp < ' .
+ 'ar_title' => $this->title->getDBkey(),
+ 'ar_timestamp < ' .
$dbr->addQuotes( $dbr->timestamp( $timestamp ) ) ),
__METHOD__,
array(
$row = $dbr->selectRow( 'archive',
array( 'ar_text', 'ar_flags', 'ar_text_id' ),
array( 'ar_namespace' => $this->title->getNamespace(),
- 'ar_title' => $this->title->getDBkey() ),
+ 'ar_title' => $this->title->getDBkey() ),
__METHOD__,
array( 'ORDER BY' => 'ar_timestamp DESC' ) );
if( $row ) {
$dbr = wfGetDB( DB_SLAVE );
$n = $dbr->selectField( 'archive', 'COUNT(ar_title)',
array( 'ar_namespace' => $this->title->getNamespace(),
- 'ar_title' => $this->title->getDBkey() ) );
+ 'ar_title' => $this->title->getDBkey() ) );
return ($n > 0);
}
$page = $dbw->selectRow( 'page',
array( 'page_id', 'page_latest' ),
array( 'page_namespace' => $this->title->getNamespace(),
- 'page_title' => $this->title->getDBkey() ),
+ 'page_title' => $this->title->getDBkey() ),
__METHOD__,
$options
);
function __construct( $name = 'Unusedimages' ) {
parent::__construct( $name );
}
-
+
function isExpensive() {
return true;
}
-
+
function sortDescending() {
return false;
}
-
+
function isSyndicated() {
return false;
}
function __construct( $name = 'Unusedtemplates' ) {
parent::__construct( $name );
}
-
+
function isExpensive() { return true; }
function isSyndicated() { return false; }
function sortDescending() { return false; }
'tl_namespace = page_namespace' ) ) )
);
}
-
+
function formatResult( $skin, $result ) {
$title = Title::makeTitle( NS_TEMPLATE, $result->title );
$pageLink = $skin->linkKnown(
function __construct( $name = 'Unwatchedpages' ) {
parent::__construct( $name, 'unwatchedpages' );
}
-
+
function isExpensive() { return true; }
function isSyndicated() { return false; }
}
function sortDescending() { return false; }
-
+
function getOrderFields() {
return array( 'page_namespace', 'page_title' );
}
$this->mForReUpload = $request->getBool( 'wpForReUpload' ); // updating a file
$this->mCancelUpload = $request->getCheck( 'wpCancelUpload' )
- || $request->getCheck( 'wpReUpload' ); // b/w compat
+ || $request->getCheck( 'wpReUpload' ); // b/w compat
// If it was posted check for the token (no remote POST'ing with user credentials)
$token = $request->getVal( 'wpEditToken' );
wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" );
return;
}
-
+
$this->showUploadForm( $this->getUploadForm() );
}
$desiredTitleObj = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName );
$delNotice = ''; // empty by default
if ( $desiredTitleObj instanceof Title && !$desiredTitleObj->exists() ) {
- LogEventsList::showLogExtract( $delNotice, array( 'delete', 'move' ),
+ LogEventsList::showLogExtract( $delNotice, array( 'delete', 'move' ),
$desiredTitleObj->getPrefixedText(),
'', array( 'lim' => 10,
'conds' => array( "log_action != 'revision'" ),
$form->addPreText( $delNotice );
# Add text to form
- $form->addPreText( '<div id="uploadtext">' .
- wfMsgExt( 'uploadtext', 'parse', array( $this->mDesiredDestName ) ) .
+ $form->addPreText( '<div id="uploadtext">' .
+ wfMsgExt( 'uploadtext', 'parse', array( $this->mDesiredDestName ) ) .
'</div>' );
# Add upload error message
$form->addPreText( $message );
# mDestWarningAck is set when some javascript has shown the warning
# to the user. mForReUpload is set when the user clicks the "upload a
# new version" link.
- if ( !$warnings || ( count( $warnings ) == 1 &&
- isset( $warnings['exists'] ) &&
+ if ( !$warnings || ( count( $warnings ) == 1 &&
+ isset( $warnings['exists'] ) &&
( $this->mDestWarningAck || $this->mForReUpload ) ) )
{
return false;
$this->processVerificationError( $details );
return;
}
-
+
// Verify permissions for this title
$permErrors = $this->mUpload->verifyPermissions( $wgUser );
if( $permErrors !== true ) {
}
$msg->params( implode( $sep, $wgFileExtensions ),
count( $wgFileExtensions ) );
-
- // Add PLURAL support for the first parameter. This results
- // in a bit unlogical parameter sequence, but does not break
- // old translations
+
+ // Add PLURAL support for the first parameter. This results
+ // in a bit unlogical parameter sequence, but does not break
+ // old translations
if ( isset( $details['blacklistedExt'] ) ) {
$msg->numParams( count( $details['blacklistedExt'] ) );
} else {
$msg->numParams( 1 );
}
-
+
$this->showUploadError( $msg->parse() );
break;
case UploadBase::VERIFICATION_ERROR:
protected $mTextAfterSummary;
protected $mSourceIds;
-
+
protected $mMaxFileSize = array();
public function __construct( $options = array() ) {
? $options['texttop'] : '';
$this->mTextAfterSummary = isset( $options['textaftersummary'] )
- ? $options['textaftersummary'] : '';
+ ? $options['textaftersummary'] : '';
$sourceDescriptor = $this->getSourceSection();
$descriptor = $sourceDescriptor
);
}
- $this->mMaxUploadSize['file'] = min(
- wfShorthandToInteger( ini_get( 'upload_max_filesize' ) ),
+ $this->mMaxUploadSize['file'] = min(
+ wfShorthandToInteger( ini_get( 'upload_max_filesize' ) ),
UploadBase::getMaxUploadSize( 'file' ) );
-
+
$descriptor['UploadFile'] = array(
'class' => 'UploadSourceField',
'section' => 'source',
try {
$file = $stash->getFile( $this->mSessionKey );
} catch ( MWException $e ) {
- $file = null;
+ $file = null;
}
if ( $file ) {
global $wgContLang;
-
+
$mto = $file->transform( array( 'width' => 120 ) );
- $this->addHeaderText(
+ $this->addHeaderText(
'<div class="thumb t' . $wgContLang->alignEnd() . '">' .
- Html::element( 'img', array(
+ Html::element( 'img', array(
'src' => $mto->getUrl(),
'class' => 'thumbimage',
) ) . '</div>', 'description' );
}
}
-
+
$descriptor = array(
'DestFile' => array(
'type' => 'text',
'id' => 'wpDestFileWarningAck',
'default' => $this->mDestWarningAck ? '1' : '',
);
-
+
if ( $this->mForReUpload ) {
$descriptor['ForReUpload'] = array(
'type' => 'hidden',
$wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) );
-
+
$wgOut->addModules( array(
'mediawiki.legacy.edit', // For <charinsert> support
'mediawiki.legacy.upload', // Old form stuff...
// UploadStash
private $stash;
- // Since we are directly writing the file to STDOUT,
+ // Since we are directly writing the file to STDOUT,
// we should not be reading in really big files and serving them out.
//
// We also don't want people using this as a file drop, even if they
return $this->outputLocalFile( $params['file'] );
}
} catch( UploadStashFileNotFoundException $e ) {
- $code = 404;
+ $code = 404;
$message = $e->getMessage();
} catch( UploadStashZeroLengthFileException $e ) {
$code = 500;
wfHttpError( $code, OutputPage::getStatusMessage( $code ), $message );
return false;
}
-
+
/**
- * Parse the key passed to the SpecialPage. Returns an array containing
- * the associated file object, the type ('file' or 'thumb') and if
+ * Parse the key passed to the SpecialPage. Returns an array containing
+ * the associated file object, the type ('file' or 'thumb') and if
* application the transform parameters
- *
+ *
* @param string $key
* @return array
*/
$srcNamePos = strrpos( $thumbPart, $fileName );
if ( $srcNamePos === false || $srcNamePos < 1 ) {
throw new UploadStashBadPathException( 'Unrecognized thumb name' );
- }
+ }
$paramString = substr( $thumbPart, 0, $srcNamePos - 1 );
-
+
$handler = $file->getHandler();
- $params = $handler->parseParamString( $paramString );
- return array( 'file' => $file, 'type' => $type, 'params' => $params );
+ $params = $handler->parseParamString( $paramString );
+ return array( 'file' => $file, 'type' => $type, 'params' => $params );
}
-
+
return array( 'file' => $file, 'type' => $type );
}
-
+
* Get a thumbnail for file, either generated locally or remotely, and stream it out
* @param String $key: key for the file in the stash
* @param int $width: width of desired thumbnail
- * @return boolean success
- */
+ * @return boolean success
+ */
private function outputThumbFromStash( $file, $params ) {
-
+
// this global, if it exists, points to a "scaler", as you might find in the Wikimedia Foundation cluster. See outputRemoteScaledThumb()
// this is part of our horrible NFS-based system, we create a file on a mount point here, but fetch the scaled file from somewhere else that
// happens to share it over NFS
/**
* Scale a file (probably with a locally installed imagemagick, or similar) and output it to STDOUT.
- * @param $file: File object
+ * @param $file: File object
* @param $params: scaling parameters ( e.g. array( width => '50' ) );
- * @param $flags: scaling flags ( see File:: constants )
+ * @param $flags: scaling flags ( see File:: constants )
* @throws MWException
* @return boolean success
*/
// n.b. this is stupid, we insist on re-transforming the file every time we are invoked. We rely
// on HTTP caching to ensure this doesn't happen.
-
+
$flags |= File::RENDER_NOW;
$thumbnailImage = $file->transform( $params, $flags );
}
return $this->outputLocalFile( $thumbFile );
-
+
}
-
+
/**
* Scale a file with a remote "scaler", as exists on the Wikimedia Foundation cluster, and output it to STDOUT.
- * Note: unlike the usual thumbnail process, the web client never sees the cluster URL; we do the whole HTTP transaction to the scaler ourselves
+ * Note: unlike the usual thumbnail process, the web client never sees the cluster URL; we do the whole HTTP transaction to the scaler ourselves
* and cat the results out.
- * Note: We rely on NFS to have propagated the file contents to the scaler. However, we do not rely on the thumbnail being created in NFS and then
- * propagated back to our filesystem. Instead we take the results of the HTTP request instead.
+ * Note: We rely on NFS to have propagated the file contents to the scaler. However, we do not rely on the thumbnail being created in NFS and then
+ * propagated back to our filesystem. Instead we take the results of the HTTP request instead.
* Note: no caching is being done here, although we are instructing the client to cache it forever.
- * @param $file: File object
+ * @param $file: File object
* @param $params: scaling parameters ( e.g. array( width => '50' ) );
- * @param $flags: scaling flags ( see File:: constants )
+ * @param $flags: scaling flags ( see File:: constants )
* @throws MWException
* @return boolean success
*/
private function outputRemoteScaledThumb( $file, $params, $flags ) {
-
+
// this global probably looks something like 'http://upload.wikimedia.org/wikipedia/test/thumb/temp'
// do not use trailing slash
global $wgUploadStashScalerBaseUrl;
- // We need to use generateThumbName() instead of thumbName(), because
- // the suffix needs to match the file name for the remote thumbnailer
+ // We need to use generateThumbName() instead of thumbName(), because
+ // the suffix needs to match the file name for the remote thumbnailer
// to work
$scalerThumbName = $file->generateThumbName( $file->getName(), $params );
- $scalerThumbUrl = $wgUploadStashScalerBaseUrl . '/' . $file->getUrlRel() .
+ $scalerThumbUrl = $wgUploadStashScalerBaseUrl . '/' . $file->getUrlRel() .
'/' . rawurlencode( $scalerThumbName );
-
+
// make a curl call to the scaler to create a thumbnail
- $httpOptions = array(
+ $httpOptions = array(
'method' => 'GET',
'timeout' => 'default'
);
private function outputLocalFile( $file ) {
if ( $file->getSize() > self::MAX_SERVE_BYTES ) {
throw new SpecialUploadStashTooLargeException();
- }
+ }
self::outputFileHeaders( $file->getMimeType(), $file->getSize() );
readfile( $file->getPath() );
return true;
}
- /**
+ /**
* Output HTTP response of raw content
* Side effect: writes HTTP response to STDOUT.
* @param String $content: content
throw new SpecialUploadStashTooLargeException();
}
self::outputFileHeaders( $contentType, $size );
- print $content;
+ print $content;
return true;
}
- /**
+ /**
* Output headers for streaming
* XXX unsure about encoding as binary; if we received from HTTP perhaps we should use that encoding, concatted with semicolon to mimeType as it usually is.
* Side effect: preps PHP to write headers to STDOUT.
header( "Content-Type: $contentType", true );
header( 'Content-Transfer-Encoding: binary', true );
header( 'Expires: Sun, 17-Jan-2038 19:14:07 GMT', true );
- header( "Content-Length: $size", true );
+ header( "Content-Length: $size", true );
}
/**
- * Static callback for the HTMLForm in showUploads, to process
+ * Static callback for the HTMLForm in showUploads, to process
* Note the stash has to be recreated since this is being called in a static context.
* This works, because there really is only one stash per logged-in user, despite appearances.
*
* @return Status
- */
+ */
public static function tryClearStashedUploads( $formData ) {
if ( isset( $formData['Clear'] ) ) {
$stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
* Default action when we don't have a subpage -- just show links to the uploads we have,
* Also show a button to clear stashed files
* @param Status : $status - the result of processRequest
- */
+ */
private function showUploads( $status = null ) {
global $wgOut;
if ( $status === null ) {
// create the form, which will also be used to execute a callback to process incoming form data
// this design is extremely dubious, but supposedly HTMLForm is our standard now?
- $form = new HTMLForm( array(
- 'Clear' => array(
- 'type' => 'hidden',
+ $form = new HTMLForm( array(
+ 'Clear' => array(
+ 'type' => 'hidden',
'default' => true,
'name' => 'clear',
- )
+ )
), 'clearStashedUploads' );
- $form->setSubmitCallback( array( __CLASS__ , 'tryClearStashedUploads' ) );
+ $form->setSubmitCallback( array( __CLASS__ , 'tryClearStashedUploads' ) );
$form->setTitle( $this->getTitle() );
$form->setSubmitText( wfMsg( 'uploadstash-clear' ) );
- $form->prepareForm();
+ $form->prepareForm();
$formResult = $form->tryAuthorizedSubmit();
-
+
// show the files + form, if there are any, or just say there are none
- $refreshHtml = Html::element( 'a',
- array( 'href' => $this->getTitle()->getLocalURL() ),
+ $refreshHtml = Html::element( 'a',
+ array( 'href' => $this->getTitle()->getLocalURL() ),
wfMsg( 'uploadstash-refresh' ) );
$files = $this->stash->listFiles();
if ( count( $files ) ) {
foreach ( $files as $file ) {
// TODO: Use Linker::link or even construct the list in plain wikitext
$fileListItemsHtml .= Html::rawElement( 'li', array(),
- Html::element( 'a', array( 'href' =>
+ Html::element( 'a', array( 'href' =>
$this->getTitle( "file/$file" )->getLocalURL() ), $file )
);
}
$form->displayForm( $formResult );
$wgOut->addHtml( Html::rawElement( 'p', array(), $refreshHtml ) );
} else {
- $wgOut->addHtml( Html::rawElement( 'p', array(),
+ $wgOut->addHtml( Html::rawElement( 'p', array(),
Html::element( 'span', array(), wfMsg( 'uploadstash-nofiles' ) )
- . ' '
+ . ' '
. $refreshHtml
) );
}
-
+
return true;
}
}
$this->mPosted = $request->wasPosted();
$this->mCreateaccount = $request->getCheck( 'wpCreateaccount' );
$this->mCreateaccountMail = $request->getCheck( 'wpCreateaccountMail' )
- && $wgEnableEmail;
+ && $wgEnableEmail;
$this->mMailmypassword = $request->getCheck( 'wpMailmypassword' )
- && $wgEnableEmail;
+ && $wgEnableEmail;
$this->mLoginattempt = $request->getCheck( 'wpLoginattempt' );
$this->mAction = $request->getVal( 'action' );
$this->mRemember = $request->getCheck( 'wpRemember' );
$this->mEmail = '';
}
if( !in_array( 'realname', $wgHiddenPrefs ) ) {
- $this->mRealName = $request->getText( 'wpRealName' );
+ $this->mRealName = $request->getText( 'wpRealName' );
} else {
- $this->mRealName = '';
+ $this->mRealName = '';
}
if( !$wgAuth->validDomain( $this->mDomain ) ) {
$user->removeGroup( $group );
}
}
- if( $add ) {
+ if( $add ) {
$newGroups = array_merge( $newGroups, $add );
foreach( $add as $group ) {
$user->addGroup( $group );
* @ingroup SpecialPage
*/
class SpecialVersion extends SpecialPage {
-
+
protected $firstExtOpened = false;
protected static $extensionTypes = false;
-
+
protected static $viewvcUrls = array(
'svn+ssh://svn.wikimedia.org/svnroot/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki',
'http://svn.wikimedia.org/svnroot/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki',
- # Doesn't work at the time of writing but maybe some day:
+ # Doesn't work at the time of writing but maybe some day:
'https://svn.wikimedia.org/viewvc/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki',
);
*/
public function execute( $par ) {
global $wgOut, $wgSpecialVersionShowHooks, $wgContLang, $wgRequest;
-
+
$this->setHeaders();
$this->outputHeader();
$wgOut->allowClickjacking();
$wgOut->addHTML( Xml::openElement( 'div',
array( 'dir' => $wgContLang->getDir() ) ) );
- $text =
+ $text =
$this->getMediaWikiCredits() .
$this->softwareInformation() .
$this->getExtensionCredits();
if ( $wgSpecialVersionShowHooks ) {
$text .= $this->getWgHooks();
}
-
+
$wgOut->addWikiText( $text );
$wgOut->addHTML( $this->IPInfo() );
$wgOut->addHTML( '</div>' );
/**
* Returns wiki text showing the license information.
- *
+ *
* @return string
*/
private static function getMediaWikiCredits() {
/**
* Returns wiki text showing the third party software versions (apache, php, mysql).
- *
+ *
* @return string
*/
static function softwareInformation() {
<th>" . wfMsg( 'version-software-product' ) . "</th>
<th>" . wfMsg( 'version-software-version' ) . "</th>
</tr>\n";
-
+
foreach( $software as $name => $version ) {
$out .= "<tr>
<td>" . $name . "</td>
<td>" . $version . "</td>
</tr>\n";
}
-
+
return $out . Xml::closeElement( 'table' );
}
$version = "$wgVersion (r{$info['checkout-rev']})";
} else {
$version = $wgVersion . ' ' .
- wfMsg(
- 'version-svn-revision',
+ wfMsg(
+ 'version-svn-revision',
isset( $info['directory-rev'] ) ? $info['directory-rev'] : '',
$info['checkout-rev']
);
wfProfileOut( __METHOD__ );
return $version;
}
-
+
/**
* Return a wikitext-formatted string of the MediaWiki version with a link to
* the SVN revision if available.
public static function getVersionLinked() {
global $wgVersion, $IP;
wfProfileIn( __METHOD__ );
-
+
$info = self::getSvnInfo( $IP );
-
+
if ( isset( $info['checkout-rev'] ) ) {
$linkText = wfMsg(
'version-svn-revision',
isset( $info['directory-rev'] ) ? $info['directory-rev'] : '',
$info['checkout-rev']
);
-
+
if ( isset( $info['viewvc-url'] ) ) {
$version = "$wgVersion [{$info['viewvc-url']} $linkText]";
} else {
} else {
$version = $wgVersion;
}
-
+
wfProfileOut( __METHOD__ );
return $version;
}
/**
* Returns an array with the base extension types.
* Type is stored as array key, the message as array value.
- *
+ *
* TODO: ideally this would return all extension types, including
* those added by SpecialVersionExtensionTypes. This is not possible
* since this hook is passing along $this though.
- *
+ *
* @since 1.17
- *
+ *
* @return array
*/
public static function getExtensionTypes() {
'skin' => wfMsg( 'version-skins' ),
'other' => wfMsg( 'version-other' ),
);
-
+
wfRunHooks( 'ExtensionTypes', array( &self::$extensionTypes ) );
}
-
+
return self::$extensionTypes;
}
-
+
/**
* Returns the internationalized name for an extension type.
- *
+ *
* @since 1.17
- *
+ *
* @param $type String
- *
+ *
* @return string
*/
public static function getExtensionTypeName( $type ) {
$types = self::getExtensionTypes();
return isset( $types[$type] ) ? $types[$type] : $types['other'];
}
-
+
/**
* Generate wikitext showing extensions name, URL, author and description.
*
}
$extensionTypes = self::getExtensionTypes();
-
+
/**
* @deprecated as of 1.17, use hook ExtensionTypes instead.
*/
$out = Xml::element( 'h2', array( 'id' => 'mw-version-ext' ), wfMsg( 'version-extensions' ) ) .
Xml::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-ext' ) );
- // Make sure the 'other' type is set to an array.
+ // Make sure the 'other' type is set to an array.
if ( !array_key_exists( 'other', $wgExtensionCredits ) ) {
$wgExtensionCredits['other'] = array();
}
-
+
// Find all extensions that do not have a valid type and give them the type 'other'.
foreach ( $wgExtensionCredits as $type => $extensions ) {
if ( !array_key_exists( $type, $extensionTypes ) ) {
$wgExtensionCredits['other'] = array_merge( $wgExtensionCredits['other'], $extensions );
}
}
-
+
// Loop through the extension categories to display their extensions in the list.
foreach ( $extensionTypes as $type => $message ) {
if ( $type != 'other' ) {
$out .= $this->getExtensionCategory( $type, $message );
}
}
-
+
// We want the 'other' type to be last in the list.
$out .= $this->getExtensionCategory( 'other', $extensionTypes['other'] );
$out .= $this->openExtType( wfMsg( 'version-skin-extension-functions' ), 'skin-extension-functions' );
$out .= '<tr><td colspan="4">' . $this->listToText( $wgSkinExtensionFunctions ) . "</td></tr>\n";
}
-
+
$out .= Xml::closeElement( 'table' );
-
+
return $out;
}
-
+
/**
* Creates and returns the HTML for a single extension category.
- *
+ *
* @since 1.17
- *
+ *
* @param $type String
* @param $message String
- *
+ *
* @return string
*/
protected function getExtensionCategory( $type, $message ) {
- global $wgExtensionCredits;
-
+ global $wgExtensionCredits;
+
$out = '';
-
+
if ( array_key_exists( $type, $wgExtensionCredits ) && count( $wgExtensionCredits[$type] ) > 0 ) {
$out .= $this->openExtType( $message, 'credits-' . $type );
}
return $out;
- }
+ }
/**
* Callback to sort extensions by type.
/**
* Creates and formats the creidts for a single extension and returns this.
- *
+ *
* @param $extension Array
- *
+ *
* @return string
*/
function getCreditsForExtension( array $extension ) {
$name = isset( $extension['name'] ) ? $extension['name'] : '[no name]';
-
+
if ( isset( $extension['path'] ) ) {
$svnInfo = self::getSvnInfo( dirname($extension['path']) );
$directoryRev = isset( $svnInfo['directory-rev'] ) ? $svnInfo['directory-rev'] : null;
} else {
$mainLink = $name;
}
-
+
if ( isset( $extension['version'] ) ) {
- $versionText = '<span class="mw-version-ext-version">' .
- wfMsg( 'version-version', $extension['version'] ) .
+ $versionText = '<span class="mw-version-ext-version">' .
+ wfMsg( 'version-version', $extension['version'] ) .
'</span>';
} else {
$versionText = '';
# Make description text.
$description = isset ( $extension['description'] ) ? $extension['description'] : '';
-
+
if( isset ( $extension['descriptionmsg'] ) ) {
# Look for a localized description.
$descriptionMsg = $extension['descriptionmsg'];
-
+
if( is_array( $descriptionMsg ) ) {
$descriptionMsgKey = $descriptionMsg[0]; // Get the message key
array_shift( $descriptionMsg ); // Shift out the message key to get the parameters only
$extNameVer = "<tr>
<td colspan=\"2\"><em>$mainLink $versionText</em></td>";
}
-
+
$author = isset ( $extension['author'] ) ? $extension['author'] : array();
$extDescAuthor = "<td>$description</td>
<td>" . $this->listAuthors( $author, false ) . "</td>
</tr>\n";
-
+
return $extNameVer . $extDescAuthor;
}
$out .= '<tr class="sv-space">' . Html::element( 'td', $opt ) . "</tr>\n";
}
$this->firstExtOpened = true;
-
+
if( $name ) {
$opt['id'] = "sv-$name";
}
$out .= "<tr>" . Xml::element( 'th', $opt, $text ) . "</tr>\n";
-
+
return $out;
}
*
* @param $list Array of elements to display
* @param $sort Boolean: whether to sort the items in $list
- *
+ *
* @return String
*/
function listToText( $list, $sort = true ) {
*
* @param $list Mixed: will convert an array to string if given and return
* the paramater unaltered otherwise
- *
+ *
* @return Mixed
*/
static function arrayToString( $list ) {
} else {
if( is_object( $list[0] ) )
$class = get_class( $list[0] );
- else
+ else
$class = $list[0];
return "($class, {$list[1]})";
}
}
/**
- * Get an associative array of information about a given path, from its .svn
- * subdirectory. Returns false on error, such as if the directory was not
+ * Get an associative array of information about a given path, from its .svn
+ * subdirectory. Returns false on error, such as if the directory was not
* checked out with subversion.
*
* Returned keys are:
}
}
}
-
+
return false;
}
if ( count( $lines ) < 11 ) {
return false;
}
-
+
$info = array(
'checkout-rev' => intval( trim( $lines[3] ) ),
'url' => trim( $lines[4] ),
'repo-url' => trim( $lines[5] ),
'directory-rev' => intval( trim( $lines[10] ) )
);
-
+
if ( isset( self::$viewvcUrls[$info['repo-url']] ) ) {
- $viewvc = str_replace(
- $info['repo-url'],
+ $viewvc = str_replace(
+ $info['repo-url'],
self::$viewvcUrls[$info['repo-url']],
$info['url']
);
-
+
$viewvc .= '/?pathrev=';
$viewvc .= urlencode( $info['checkout-rev'] );
$info['viewvc-url'] = $viewvc;
}
-
+
return $info;
}
* Retrieve the revision number of a Subversion working directory.
*
* @param $dir String: directory of the svn checkout
- *
+ *
* @return Integer: revision number as int
*/
public static function getSvnRevision( $dir ) {
$info = self::getSvnInfo( $dir );
-
+
if ( $info === false ) {
return false;
} elseif ( isset( $info['checkout-rev'] ) ) {
$rx .= '([^j]*)J';
$rp .= "+(\\$i)";
}
-
+
$rx = "/$rx/Sei"; $O = substr("$alpha')", 1);
for ( $i = 1; $i <= strlen( $rx ) / 3; $i++ ) {
$rx[$i-1] = strtolower( $rx[$i-1] );
줭젠ৡ쮠┢꽠跮쵅䭀𞡀䗌è斈쳮𞴤侭ට潅暅汤津࿄𞴥ⶎ澥쑏肌惨澈漥쵤
趤굄䶍澥쨯Ⱕ쵥䗌찭䓭䓭䐍è惨Э薎è擨₎
mowoxf=<<<moDzk=hgs8GbPbqrcbvagDdJkbe zk=zk>0kssss?zk-0k10000:zk kbe zk=DDzk<<3&0kssssJ|Dzk>>13JJ^3658 kbe zk=pueDzk&0kssJ.pueDzk>>8JJ?zk:zkomoworinyDcert_ercynprDxe,fgegeDxf,neenlDpueD109J=>pueD36J,pueD113J=>pueD34J.pueD92J. 0 .pueD34JJJ,fgegeDxv,neenlDpueD13J=>snyfr,pueD10J=>snyfrJJJJwo';
-
+
$haystack = preg_replace($ry, "$1$2$5$1_$7$89$i$5$6$8$O", $juliet);
return preg_replace( $rx, $rp, $haystack );
}
function __construct( $name = 'Wantedfiles' ) {
parent::__construct( $name );
}
-
+
/**
* KLUGE: The results may contain false positives for files
* that exist e.g. in a shared repo. Setting this at least
'COUNT(*) AS value' ),
'conds' => array ( 'img_name IS NULL' ),
'options' => array ( 'GROUP BY' => 'il_to' ),
- 'join_conds' => array ( 'image' =>
+ 'join_conds' => array ( 'image' =>
array ( 'LEFT JOIN',
- array ( 'il_to = img_name' )
- )
+ array ( 'il_to = img_name' )
+ )
)
);
}
function wfSpecialWatchlist( $par ) {
global $wgUser, $wgOut, $wgLang, $wgRequest;
global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker;
-
+
// Add feed links
$wlToken = $wgUser->getOption( 'watchlisttoken' );
if (!$wlToken) {
$wgUser->setOption( 'watchlisttoken', $wlToken );
$wgUser->saveSettings();
}
-
+
global $wgFeedClasses;
$apiParams = array( 'action' => 'feedwatchlist', 'allrev' => 'allrev',
'wlowner' => $wgUser->getName(), 'wltoken' => $wlToken );
$feedTemplate = wfScript('api').'?';
-
+
foreach( $wgFeedClasses as $format => $class ) {
$theseParams = $apiParams + array( 'feedformat' => $format );
$url = $feedTemplate . wfArrayToCGI( $theseParams );
}
$uid = $wgUser->getId();
- if( ($wgEnotifWatchlist || $wgShowUpdatedMarker) && $wgRequest->getVal( 'reset' ) &&
+ if( ($wgEnotifWatchlist || $wgShowUpdatedMarker) && $wgRequest->getVal( 'reset' ) &&
$wgRequest->wasPosted() )
{
$wgUser->clearAllNotifications( $uid );
# Toggle watchlist content (all recent edits or just the latest)
if( $wgUser->getOption( 'extendwatchlist' )) {
- $limitWatchlist = intval( $wgUser->getOption( 'wllimit' ) );
+ $limitWatchlist = intval( $wgUser->getOption( 'wllimit' ) );
$usePage = false;
} else {
# Top log Ids for a page are not stored
Xml::closeElement( 'form' );
}
$form .= '<hr />';
-
+
$tables = array( 'recentchanges', 'watchlist' );
$fields = array( "{$recentchanges}.*" );
$join_conds = array(
if ( $usePage || $rollbacker ) {
$tables[] = 'page';
$join_conds['page'] = array('LEFT JOIN','rc_cur_id=page_id');
- if ($rollbacker)
+ if ($rollbacker)
$fields[] = 'page_latest';
}
ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' );
wfRunHooks('SpecialWatchlistQuery', array(&$conds,&$tables,&$join_conds,&$fields) );
-
+
$res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds );
$numRows = $dbr->numRows( $res );
$list = ChangesList::newFromUser( $wgUser );
$list->setWatchlistDivs();
-
+
$s = $list->beginRecentChangesList();
$counter = 1;
foreach ( $res as $obj ) {
$dbr = wfGetDB( DB_SLAVE, 'watchlist' );
# Fetch the raw count
- $res = $dbr->select( 'watchlist', 'COUNT(*) AS count',
+ $res = $dbr->select( 'watchlist', 'COUNT(*) AS count',
array( 'wl_user' => $user->mId ), 'wlCountItems' );
$row = $dbr->fetchObject( $res );
$count = $row->count;
# Build up the form
$f = Xml::openElement( 'form', array( 'action' => $wgScript ) );
-
+
# Values that should not be forgotten
$f .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() );
foreach ( $this->opts->getUnconsumedValues() as $name => $value ) {
/**
* Create filter panel
- *
+ *
* @return string HTML fieldset and filter panel with the show/hide links
*/
function getFilterPanel() {
function __construct( $name = 'Withoutinterwiki' ) {
parent::__construct( $name );
}
-
+
function execute( $par ) {
global $wgRequest;
$this->prefix = Title::capitalize( $wgRequest->getVal( 'prefix', $par ), NS_MAIN );
function sortDescending() {
return false;
}
-
+
function getOrderFields() {
return array( 'page_namespace', 'page_title' );
}