whitespaces
This commit is contained in:
parent
3a6485f33b
commit
278309b2d0
5 changed files with 121 additions and 127 deletions
|
|
@ -57,14 +57,14 @@ class Article {
|
|||
function setRedirectedFrom( $from ) {
|
||||
$this->mRedirectedFrom = $from;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed false, Title of in-wiki target, or string with URL
|
||||
*/
|
||||
function followRedirect() {
|
||||
$text = $this->getContent();
|
||||
$rt = Title::newFromRedirect( $text );
|
||||
|
||||
|
||||
# process if title object is valid and not special:userlogout
|
||||
if( $rt ) {
|
||||
if( $rt->getInterwiki() != '' ) {
|
||||
|
|
@ -73,7 +73,7 @@ class Article {
|
|||
//
|
||||
// This can be hard to reverse and may produce loops,
|
||||
// so they may be disabled in the site configuration.
|
||||
|
||||
|
||||
$source = $this->mTitle->getFullURL( 'redirect=no' );
|
||||
return $rt->getFullURL( 'rdfrom=' . urlencode( $source ) );
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ class Article {
|
|||
// the rest of the page we're on.
|
||||
//
|
||||
// This can be hard to reverse, so they may be disabled.
|
||||
|
||||
|
||||
if( $rt->isSpecial( 'Userlogout' ) ) {
|
||||
// rolleyes
|
||||
} else {
|
||||
|
|
@ -94,7 +94,7 @@ class Article {
|
|||
return $rt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No or invalid redirect
|
||||
return false;
|
||||
}
|
||||
|
|
@ -299,7 +299,7 @@ class Article {
|
|||
$dbr =& $this->getDB();
|
||||
$data = $this->pageDataFromId( $dbr, $this->getId() );
|
||||
}
|
||||
|
||||
|
||||
$lc =& LinkCache::singleton();
|
||||
if ( $data ) {
|
||||
$lc->addGoodLinkObj( $data->page_id, $this->mTitle );
|
||||
|
|
@ -613,7 +613,7 @@ class Article {
|
|||
|
||||
$parserCache =& ParserCache::singleton();
|
||||
$ns = $this->mTitle->getNamespace(); # shortcut
|
||||
|
||||
|
||||
# Get variables from query string
|
||||
$oldid = $this->getOldID();
|
||||
|
||||
|
|
@ -630,7 +630,7 @@ class Article {
|
|||
$diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
|
||||
|
||||
$wgOut->setArticleFlag( true );
|
||||
|
||||
|
||||
# Discourage indexing of printable versions, but encourage following
|
||||
if( $wgOut->isPrintable() ) {
|
||||
$policy = 'noindex,follow';
|
||||
|
|
@ -653,7 +653,7 @@ class Article {
|
|||
// DifferenceEngine directly fetched the revision:
|
||||
$this->mRevIdFetched = $de->mNewid;
|
||||
$de->showDiffPage( $diffOnly );
|
||||
|
||||
|
||||
// Needed to get the page's current revision
|
||||
$this->loadPageData();
|
||||
if( $diff == 0 || $diff == $this->mLatest ) {
|
||||
|
|
@ -663,7 +663,7 @@ class Article {
|
|||
wfProfileOut( __METHOD__ );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( empty( $oldid ) && $this->checkTouched() ) {
|
||||
$wgOut->setETag($parserCache->getETag($this, $wgUser));
|
||||
|
||||
|
|
@ -718,7 +718,7 @@ class Article {
|
|||
$wasRedirected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$outputDone = false;
|
||||
if ( $pcache ) {
|
||||
if ( $wgOut->tryParserCache( $this, $wgUser ) ) {
|
||||
|
|
@ -815,7 +815,7 @@ class Article {
|
|||
|
||||
# Timing hack
|
||||
if ( $time > 3 ) {
|
||||
wfDebugLog( 'slow-parse', sprintf( "%-5.2f %s", $time,
|
||||
wfDebugLog( 'slow-parse', sprintf( "%-5.2f %s", $time,
|
||||
$this->mTitle->getPrefixedDBkey()));
|
||||
}
|
||||
|
||||
|
|
@ -944,7 +944,7 @@ class Article {
|
|||
$wgOut->addHTML( $msg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform the actions of a page purging
|
||||
*/
|
||||
|
|
@ -1011,7 +1011,7 @@ class Article {
|
|||
* when different from the currently set value.
|
||||
* Giving 0 indicates the new page flag should
|
||||
* be set on.
|
||||
* @param bool $lastRevIsRedirect If given, will optimize adding and
|
||||
* @param bool $lastRevIsRedirect If given, will optimize adding and
|
||||
* removing rows in redirect table.
|
||||
* @return bool true on success, false on failure
|
||||
* @private
|
||||
|
|
@ -1021,7 +1021,7 @@ class Article {
|
|||
|
||||
$text = $revision->getText();
|
||||
$rt = Title::newFromRedirect( $text );
|
||||
|
||||
|
||||
$conditions = array( 'page_id' => $this->getId() );
|
||||
if( !is_null( $lastRevision ) ) {
|
||||
# An extra check against threads stepping on each other
|
||||
|
|
@ -1043,20 +1043,20 @@ class Article {
|
|||
|
||||
if ($result) {
|
||||
// FIXME: Should the result from updateRedirectOn() be returned instead?
|
||||
$this->updateRedirectOn( $dbw, $rt, $lastRevIsRedirect );
|
||||
$this->updateRedirectOn( $dbw, $rt, $lastRevIsRedirect );
|
||||
}
|
||||
|
||||
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add row to the redirect table if this is a redirect, remove otherwise.
|
||||
* Add row to the redirect table if this is a redirect, remove otherwise.
|
||||
*
|
||||
* @param Database $dbw
|
||||
* @param $redirectTitle a title object pointing to the redirect target,
|
||||
* or NULL if this is not a redirect
|
||||
* @param bool $lastRevIsRedirect If given, will optimize adding and
|
||||
* or NULL if this is not a redirect
|
||||
* @param bool $lastRevIsRedirect If given, will optimize adding and
|
||||
* removing rows in redirect table.
|
||||
* @return bool true on success, false on failure
|
||||
* @private
|
||||
|
|
@ -1082,7 +1082,7 @@ class Article {
|
|||
|
||||
$dbw->replace( 'redirect', array( 'rd_from' ), $set, __METHOD__ );
|
||||
} else {
|
||||
// This is not a redirect, remove row from redirect table
|
||||
// This is not a redirect, remove row from redirect table
|
||||
$where = array( 'rd_from' => $this->getId() );
|
||||
$dbw->delete( 'redirect', $where, __METHOD__);
|
||||
}
|
||||
|
|
@ -1090,7 +1090,7 @@ class Article {
|
|||
wfProfileOut( __METHOD__ );
|
||||
return ( $dbw->affectedRows() != 0 );
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1134,7 +1134,7 @@ class Article {
|
|||
*/
|
||||
function replaceSection($section, $text, $summary = '', $edittime = NULL) {
|
||||
wfProfileIn( __METHOD__ );
|
||||
|
||||
|
||||
if( $section == '' ) {
|
||||
// Whole-page edit; let the text through unmolested.
|
||||
} else {
|
||||
|
|
@ -1181,7 +1181,7 @@ class Article {
|
|||
if ( $comment && $summary != "" ) {
|
||||
$text = "== {$summary} ==\n\n".$text;
|
||||
}
|
||||
|
||||
|
||||
$this->doEdit( $text, $summary, $flags );
|
||||
|
||||
$dbw =& wfGetDB( DB_MASTER );
|
||||
|
|
@ -1234,7 +1234,7 @@ class Article {
|
|||
/**
|
||||
* Article::doEdit()
|
||||
*
|
||||
* Change an existing article or create a new article. Updates RC and all necessary caches,
|
||||
* Change an existing article or create a new article. Updates RC and all necessary caches,
|
||||
* optionally via the deferred update array.
|
||||
*
|
||||
* $wgUser must be set before calling this function.
|
||||
|
|
@ -1256,9 +1256,9 @@ class Article {
|
|||
* Defer some of the updates until the end of index.php
|
||||
* EDIT_AUTOSUMMARY
|
||||
* Fill in blank summaries with generated text where possible
|
||||
*
|
||||
* If neither EDIT_NEW nor EDIT_UPDATE is specified, the status of the article will be detected.
|
||||
* If EDIT_UPDATE is specified and the article doesn't exist, the function will return false. If
|
||||
*
|
||||
* If neither EDIT_NEW nor EDIT_UPDATE is specified, the status of the article will be detected.
|
||||
* If EDIT_UPDATE is specified and the article doesn't exist, the function will return false. If
|
||||
* EDIT_NEW is specified and the article does exist, a duplicate key error will cause an exception
|
||||
* to be thrown from the Database. These two conditions are also possible with auto-detection due
|
||||
* to MediaWiki's performance-optimised locking strategy.
|
||||
|
|
@ -1282,7 +1282,7 @@ class Article {
|
|||
|
||||
if( !wfRunHooks( 'ArticleSave', array( &$this, &$wgUser, &$text,
|
||||
&$summary, $flags & EDIT_MINOR,
|
||||
null, null, &$flags ) ) )
|
||||
null, null, &$flags ) ) )
|
||||
{
|
||||
wfDebug( __METHOD__ . ": ArticleSave hook aborted save!\n" );
|
||||
wfProfileOut( __METHOD__ );
|
||||
|
|
@ -1305,7 +1305,7 @@ class Article {
|
|||
|
||||
$dbw =& wfGetDB( DB_MASTER );
|
||||
$now = wfTimestampNow();
|
||||
|
||||
|
||||
if ( $flags & EDIT_UPDATE ) {
|
||||
# Update article, but only if changed.
|
||||
|
||||
|
|
@ -1331,7 +1331,7 @@ class Article {
|
|||
wfProfileOut( __METHOD__ );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$revision = new Revision( array(
|
||||
'page' => $this->getId(),
|
||||
'comment' => $summary,
|
||||
|
|
@ -1355,7 +1355,7 @@ class Article {
|
|||
$rcid = RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary,
|
||||
$lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
|
||||
$revisionId );
|
||||
|
||||
|
||||
# Mark as patrolled if the user can do so
|
||||
if( $GLOBALS['wgUseRCPatrol'] && $wgUser->isAllowed( 'autopatrol' ) ) {
|
||||
RecentChange::markPatrolled( $rcid );
|
||||
|
|
@ -1378,19 +1378,19 @@ class Article {
|
|||
}
|
||||
|
||||
if ( $good ) {
|
||||
# Invalidate cache of this article and all pages using this article
|
||||
# Invalidate cache of this article and all pages using this article
|
||||
# as a template. Partly deferred.
|
||||
Article::onArticleEdit( $this->mTitle );
|
||||
|
||||
|
||||
# Update links tables, site stats, etc.
|
||||
$changed = ( strcmp( $oldtext, $text ) != 0 );
|
||||
$this->editUpdates( $text, $summary, $isminor, $now, $revisionId, $changed );
|
||||
}
|
||||
} else {
|
||||
# Create new article
|
||||
|
||||
|
||||
# Set statistics members
|
||||
# We work out if it's countable after PST to avoid counter drift
|
||||
# We work out if it's countable after PST to avoid counter drift
|
||||
# when articles are created with {{subst:}}
|
||||
$this->mGoodAdjustment = (int)$this->isCountable( $text );
|
||||
$this->mTotalAdjustment = 1;
|
||||
|
|
@ -1446,7 +1446,7 @@ class Article {
|
|||
array( &$this, &$wgUser, $text,
|
||||
$summary, $flags & EDIT_MINOR,
|
||||
null, null, &$flags ) );
|
||||
|
||||
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $good;
|
||||
}
|
||||
|
|
@ -1474,7 +1474,7 @@ class Article {
|
|||
}
|
||||
$wgOut->redirect( $this->mTitle->getFullURL( $query ) . $sectionAnchor );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark this particular edit as patrolled
|
||||
*/
|
||||
|
|
@ -1487,25 +1487,25 @@ class Article {
|
|||
$wgOut->errorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Check permissions
|
||||
if( !$wgUser->isAllowed( 'patrol' ) ) {
|
||||
$wgOut->permissionRequired( 'patrol' );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# If we haven't been given an rc_id value, we can't do anything
|
||||
$rcid = $wgRequest->getVal( 'rcid' );
|
||||
if( !$rcid ) {
|
||||
$wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Handle the 'MarkPatrolled' hook
|
||||
if( !wfRunHooks( 'MarkPatrolled', array( $rcid, &$wgUser, false ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$return = SpecialPage::getTitleFor( 'Recentchanges' );
|
||||
# If it's left up to us, check that the user is allowed to patrol this edit
|
||||
# If the user has the "autopatrol" right, then we'll assume there are no
|
||||
|
|
@ -1524,12 +1524,12 @@ class Article {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Mark the edit as patrolled
|
||||
RecentChange::markPatrolled( $rcid );
|
||||
PatrolLog::record( $rcid );
|
||||
wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
|
||||
|
||||
|
||||
# Inform the user
|
||||
$wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) );
|
||||
$wgOut->addWikiText( wfMsgNoTrans( 'markedaspatrolledtext' ) );
|
||||
|
|
@ -1552,7 +1552,7 @@ class Article {
|
|||
$wgOut->readOnlyPage();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( $this->doWatch() ) {
|
||||
$wgOut->setPagetitle( wfMsg( 'addedwatch' ) );
|
||||
$wgOut->setRobotpolicy( 'noindex,nofollow' );
|
||||
|
|
@ -1564,7 +1564,7 @@ class Article {
|
|||
|
||||
$wgOut->returnToMain( true, $this->mTitle->getPrefixedText() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add this page to $wgUser's watchlist
|
||||
* @return bool true on successful watch operation
|
||||
|
|
@ -1574,13 +1574,13 @@ class Article {
|
|||
if( $wgUser->isAnon() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (wfRunHooks('WatchArticle', array(&$wgUser, &$this))) {
|
||||
$wgUser->addWatch( $this->mTitle );
|
||||
|
||||
return wfRunHooks('WatchArticleComplete', array(&$wgUser, &$this));
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1599,7 +1599,7 @@ class Article {
|
|||
$wgOut->readOnlyPage();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( $this->doUnwatch() ) {
|
||||
$wgOut->setPagetitle( wfMsg( 'removedwatch' ) );
|
||||
$wgOut->setRobotpolicy( 'noindex,nofollow' );
|
||||
|
|
@ -1611,7 +1611,7 @@ class Article {
|
|||
|
||||
$wgOut->returnToMain( true, $this->mTitle->getPrefixedText() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stop watching a page
|
||||
* @return bool true on successful unwatch
|
||||
|
|
@ -1627,7 +1627,7 @@ class Article {
|
|||
|
||||
return wfRunHooks('UnwatchArticleComplete', array(&$wgUser, &$this));
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1655,7 +1655,7 @@ class Article {
|
|||
*/
|
||||
function updateRestrictions( $limit = array(), $reason = '', $cascade = 0 ) {
|
||||
global $wgUser, $wgRestrictionTypes, $wgContLang;
|
||||
|
||||
|
||||
$id = $this->mTitle->getArticleID();
|
||||
if( !$wgUser->isAllowed( 'protect' ) || wfReadOnly() || $id == 0 ) {
|
||||
return false;
|
||||
|
|
@ -1673,17 +1673,17 @@ class Article {
|
|||
|
||||
$current = Article::flattenRestrictions( $current );
|
||||
$updated = Article::flattenRestrictions( $limit );
|
||||
|
||||
|
||||
$changed = ( $current != $updated );
|
||||
$changed = $changed || ($this->mTitle->areRestrictionsCascading() != $cascade);
|
||||
$protect = ( $updated != '' );
|
||||
|
||||
|
||||
# If nothing's changed, do nothing
|
||||
if( $changed ) {
|
||||
if( wfRunHooks( 'ArticleProtect', array( &$this, &$wgUser, $limit, $reason ) ) ) {
|
||||
|
||||
$dbw =& wfGetDB( DB_MASTER );
|
||||
|
||||
|
||||
# Prepare a null revision to be added to the history
|
||||
$comment = $wgContLang->ucfirst( wfMsgForContent( $protect ? 'protectedarticle' : 'unprotectedarticle', $this->mTitle->getPrefixedText() ) );
|
||||
if( $reason )
|
||||
|
|
@ -1716,7 +1716,7 @@ class Article {
|
|||
), 'Article::protect'
|
||||
);
|
||||
wfRunHooks( 'ArticleProtectComplete', array( &$this, &$wgUser, $limit, $reason ) );
|
||||
|
||||
|
||||
# Update the protection log
|
||||
$log = new LogPage( 'protect' );
|
||||
|
||||
|
|
@ -1731,10 +1731,10 @@ class Article {
|
|||
} else {
|
||||
$log->addEntry( 'unprotect', $this->mTitle, $reason );
|
||||
}
|
||||
|
||||
|
||||
} # End hook
|
||||
} # End "changed" check
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1787,7 +1787,7 @@ class Article {
|
|||
}
|
||||
|
||||
$wgOut->setPagetitle( wfMsg( 'confirmdelete' ) );
|
||||
|
||||
|
||||
# Better double-check that it hasn't been deleted yet!
|
||||
$dbw =& wfGetDB( DB_MASTER );
|
||||
$conds = $this->mTitle->pageCond();
|
||||
|
|
@ -1811,7 +1811,7 @@ class Article {
|
|||
# and insert a warning if it does
|
||||
$maxRevisions = 20;
|
||||
$authors = $this->getLastNAuthors( $maxRevisions, $latest );
|
||||
|
||||
|
||||
if( count( $authors ) > 1 && !$confirm ) {
|
||||
$skin=$wgUser->getSkin();
|
||||
$wgOut->addHTML( '<strong>' . wfMsg( 'historywarning' ) . ' ' . $skin->historyLink() . '</strong>' );
|
||||
|
|
@ -1924,7 +1924,7 @@ class Article {
|
|||
wfProfileOut( __METHOD__ );
|
||||
return $authors;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output deletion confirmation dialog
|
||||
*/
|
||||
|
|
@ -2234,7 +2234,7 @@ class Article {
|
|||
* Do standard deferred updates after page edit.
|
||||
* Update links tables, site stats, search index and message cache.
|
||||
* Every 1000th edit, prune the recent changes table.
|
||||
*
|
||||
*
|
||||
* @private
|
||||
* @param $text New text of the article
|
||||
* @param $summary Edit summary
|
||||
|
|
@ -2314,7 +2314,7 @@ class Article {
|
|||
|
||||
wfProfileOut( __METHOD__ );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform article updates on a special page creation.
|
||||
*
|
||||
|
|
@ -2344,8 +2344,8 @@ class Article {
|
|||
global $wgLang, $wgOut, $wgUser;
|
||||
|
||||
if ( !wfRunHooks( 'DisplayOldSubtitle', array(&$this, &$oldid) ) ) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$revision = Revision::newFromId( $oldid );
|
||||
|
||||
|
|
@ -2371,10 +2371,10 @@ class Article {
|
|||
$nextdiff = $current
|
||||
? wfMsg( 'diff' )
|
||||
: $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=next&oldid='.$oldid );
|
||||
|
||||
|
||||
$userlinks = $sk->userLink( $revision->getUser(), $revision->getUserText() )
|
||||
. $sk->userToolLinks( $revision->getUser(), $revision->getUserText() );
|
||||
|
||||
|
||||
$r = "\n\t\t\t\t<div id=\"mw-revision-info\">" . wfMsg( 'revision-info', $td, $userlinks ) . "</div>\n" .
|
||||
"\n\t\t\t\t<div id=\"mw-revision-nav\">" . wfMsg( 'revision-nav', $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff ) . "</div>\n\t\t\t";
|
||||
$wgOut->setSubtitle( $r );
|
||||
|
|
@ -2600,7 +2600,7 @@ class Article {
|
|||
|
||||
$title->touchLinks();
|
||||
$title->purgeSquid();
|
||||
|
||||
|
||||
# File cache
|
||||
if ( $wgUseFileCache ) {
|
||||
$cm = new HTMLFileCache( $title );
|
||||
|
|
@ -2753,7 +2753,7 @@ class Article {
|
|||
$dbr->freeResult( $res );
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an auto-generated summary if the text provided is a redirect.
|
||||
*
|
||||
|
|
@ -2895,10 +2895,10 @@ class Article {
|
|||
if ( count( $templates_diff ) > 0 ) {
|
||||
# Whee, link updates time.
|
||||
$u = new LinksUpdate( $this->mTitle, $parserOutput );
|
||||
|
||||
|
||||
$dbw =& wfGetDb( DB_MASTER );
|
||||
$dbw->begin();
|
||||
|
||||
|
||||
$u->doUpdate();
|
||||
|
||||
$dbw->commit();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
class WikiExporter {
|
||||
var $list_authors = false ; # Return distinct author list (when not returning full history)
|
||||
var $author_list = "" ;
|
||||
|
||||
|
||||
const FULL = 0;
|
||||
const CURRENT = 1;
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class WikiExporter {
|
|||
* main query is still running.
|
||||
*
|
||||
* @param Database $db
|
||||
* @param mixed $history one of WikiExporter::FULL or WikiExporter::CURRENT, or an
|
||||
* @param mixed $history one of WikiExporter::FULL or WikiExporter::CURRENT, or an
|
||||
* associative array:
|
||||
* offset: non-inclusive offset at which to start the query
|
||||
* limit: maximum number of rows to return
|
||||
|
|
@ -164,10 +164,10 @@ class WikiExporter {
|
|||
$page = $this->db->tableName( 'page' );
|
||||
$revision = $this->db->tableName( 'revision' );
|
||||
$text = $this->db->tableName( 'text' );
|
||||
|
||||
|
||||
$order = 'ORDER BY page_id';
|
||||
$limit = '';
|
||||
|
||||
|
||||
if( $this->history == WikiExporter::FULL ) {
|
||||
$join = 'page_id=rev_page';
|
||||
} elseif( $this->history == WikiExporter::CURRENT ) {
|
||||
|
|
@ -185,7 +185,7 @@ class WikiExporter {
|
|||
$order .= ', rev_timestamp DESC';
|
||||
}
|
||||
if ( !empty( $this->history['offset'] ) ) {
|
||||
$join .= " AND rev_timestamp $op " . $this->db->addQuotes(
|
||||
$join .= " AND rev_timestamp $op " . $this->db->addQuotes(
|
||||
$this->db->timestamp( $this->history['offset'] ) );
|
||||
}
|
||||
if ( !empty( $this->history['limit'] ) ) {
|
||||
|
|
@ -229,7 +229,7 @@ class WikiExporter {
|
|||
$result = $this->db->query( $sql, $fname );
|
||||
$wrapper = $this->db->resultObject( $result );
|
||||
$this->outputStream( $wrapper );
|
||||
|
||||
|
||||
if ( $this->list_authors ) {
|
||||
$this->outputStream( $wrapper );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class IPBlockForm {
|
|||
$this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') );
|
||||
$this->BlockOther = $wgRequest->getVal( 'wpBlockOther', '' );
|
||||
|
||||
# Unchecked checkboxes are not included in the form data at all, so having one
|
||||
# Unchecked checkboxes are not included in the form data at all, so having one
|
||||
# that is true by default is a bit tricky
|
||||
$byDefault = !$wgRequest->wasPosted();
|
||||
$this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', $byDefault );
|
||||
|
|
@ -178,7 +178,6 @@ class IPBlockForm {
|
|||
} elseif( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $this->BlockAddress ) ) {
|
||||
$this->showLogFragment( $wgOut, Title::makeTitle( NS_USER, $this->BlockAddress ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function doSubmit() {
|
||||
|
|
@ -249,13 +248,13 @@ class IPBlockForm {
|
|||
# Note: for a user block, ipb_address is only for display purposes
|
||||
|
||||
$block = new Block( $this->BlockAddress, $userId, $wgUser->getID(),
|
||||
$this->BlockReason, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
|
||||
$this->BlockReason, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
|
||||
$this->BlockCreateAccount, $this->BlockEnableAutoblock );
|
||||
|
||||
if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
|
||||
|
||||
if ( !$block->insert() ) {
|
||||
$this->showForm( wfMsg( 'ipb_already_blocked',
|
||||
$this->showForm( wfMsg( 'ipb_already_blocked',
|
||||
htmlspecialchars( $this->BlockAddress ) ) );
|
||||
return;
|
||||
}
|
||||
|
|
@ -287,7 +286,7 @@ class IPBlockForm {
|
|||
$text = wfMsg( 'blockipsuccesstext', $this->BlockAddress );
|
||||
$wgOut->addWikiText( $text );
|
||||
}
|
||||
|
||||
|
||||
function showLogFragment( $out, $title ) {
|
||||
$out->addHtml( wfElement( 'h2', NULL, LogPage::logName( 'block' ) ) );
|
||||
$request = new FauxRequest( array( 'page' => $title->getPrefixedText(), 'type' => 'block' ) );
|
||||
|
|
@ -311,7 +310,7 @@ class IPBlockForm {
|
|||
$flags[] = 'autoblock';
|
||||
return implode( ',', $flags );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builds unblock and block list links
|
||||
*
|
||||
|
|
@ -324,7 +323,7 @@ class IPBlockForm {
|
|||
$links[] = $this->getBlockListLink( $skin );
|
||||
return '<p class="mw-ipb-conveniencelinks">' . implode( ' | ', $links ) . '</p>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a convenient link to unblock the given username or IP
|
||||
* address, if available; otherwise link to a blank unblock
|
||||
|
|
@ -343,7 +342,7 @@ class IPBlockForm {
|
|||
return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-unblock' ), 'action=unblock' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a convenience link to the block list
|
||||
*
|
||||
|
|
@ -360,7 +359,5 @@ class IPBlockForm {
|
|||
return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-blocklist' ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -126,11 +126,11 @@ class UploadForm {
|
|||
$this->mOname = array_pop( explode( '/', $url ) );
|
||||
$this->mSessionKey = false;
|
||||
$this->mStashed = false;
|
||||
|
||||
|
||||
// PHP won't auto-cleanup the file
|
||||
$this->mRemoveTempFile = file_exists( $local_file );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Safe copy from URL
|
||||
* Returns true if there was an error, false otherwise
|
||||
|
|
@ -158,19 +158,19 @@ class UploadForm {
|
|||
$wgOut->errorPage( 'upload-file-error', 'upload-file-error-text');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt( $ch, CURLOPT_HTTP_VERSION, 1.0); # Probably not needed, but apparently can work around some bug
|
||||
curl_setopt( $ch, CURLOPT_TIMEOUT, 10); # 10 seconds timeout
|
||||
curl_setopt( $ch, CURLOPT_LOW_SPEED_LIMIT, 512); # 0.5KB per second minimum transfer speed
|
||||
curl_setopt( $ch, CURLOPT_URL, $url);
|
||||
curl_setopt( $ch, CURLOPT_URL, $url);
|
||||
curl_setopt( $ch, CURLOPT_WRITEFUNCTION, array( $this, 'uploadCurlCallback' ) );
|
||||
curl_exec( $ch );
|
||||
$error = curl_errno( $ch ) ? true : false;
|
||||
$errornum = curl_errno( $ch );
|
||||
// if ( $error ) print curl_error ( $ch ) ; # Debugging output
|
||||
curl_close( $ch );
|
||||
|
||||
|
||||
fclose( $this->mUploadTempFile );
|
||||
unset( $this->mUploadTempFile );
|
||||
if( $error ) {
|
||||
|
|
@ -180,10 +180,10 @@ class UploadForm {
|
|||
else
|
||||
$wgOut->errorPage( "upload-curl-error$errornum", "upload-curl-error$errornum-text" );
|
||||
}
|
||||
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callback function for CURL-based web transfer
|
||||
* Write data to file unless we've passed the length limit;
|
||||
|
|
@ -200,7 +200,7 @@ class UploadForm {
|
|||
fwrite( $this->mUploadTempFile, $data );
|
||||
return $length;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start doing stuff
|
||||
* @access public
|
||||
|
|
@ -298,7 +298,7 @@ class UploadForm {
|
|||
* only the final one for the whitelist.
|
||||
*/
|
||||
list( $partname, $ext ) = $this->splitExtensions( $basename );
|
||||
|
||||
|
||||
if( count( $ext ) ) {
|
||||
$finalExt = $ext[count( $ext ) - 1];
|
||||
} else {
|
||||
|
|
@ -481,7 +481,7 @@ class UploadForm {
|
|||
*/
|
||||
function saveUploadedFile( $saveName, $tempName, $useRename = false ) {
|
||||
global $wgOut, $wgAllowCopyUploads;
|
||||
|
||||
|
||||
if ( !$useRename AND $wgAllowCopyUploads AND $this->mSourceType == 'web' ) $useRename = true;
|
||||
|
||||
$fname= "SpecialUpload::saveUploadedFile";
|
||||
|
|
@ -490,7 +490,7 @@ class UploadForm {
|
|||
$archive = wfImageArchiveDir( $saveName );
|
||||
if ( !is_dir( $dest ) ) wfMkdirParents( $dest );
|
||||
if ( !is_dir( $archive ) ) wfMkdirParents( $archive );
|
||||
|
||||
|
||||
$this->mSavedFile = "{$dest}/{$saveName}";
|
||||
|
||||
if( is_file( $this->mSavedFile ) ) {
|
||||
|
|
@ -752,19 +752,19 @@ class UploadForm {
|
|||
|
||||
// Prepare form for upload or upload/copy
|
||||
if( $wgAllowCopyUploads && $wgUser->isAllowed( 'upload_by_url' ) ) {
|
||||
$filename_form =
|
||||
"<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked />" .
|
||||
"<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' onfocus='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" .
|
||||
$filename_form =
|
||||
"<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked />" .
|
||||
"<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' onfocus='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" .
|
||||
($this->mDestFile?"":"onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />" .
|
||||
wfMsgHTML( 'upload_source_file' ) . "<br/>" .
|
||||
"<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='web' onchange='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\")' />" .
|
||||
"<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' onfocus='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")'" .
|
||||
"<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' onfocus='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")'" .
|
||||
($this->mDestFile?"":"onchange='fillDestFilename(\"wpUploadFileURL\")' ") . "size='40' DISABLED />" .
|
||||
wfMsgHtml( 'upload_source_url' ) ;
|
||||
} else {
|
||||
$filename_form =
|
||||
"<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " .
|
||||
($this->mDestFile?"":"onchange='fillDestFilename(\"wpUploadFile\")' ") .
|
||||
$filename_form =
|
||||
"<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " .
|
||||
($this->mDestFile?"":"onchange='fillDestFilename(\"wpUploadFile\")' ") .
|
||||
"size='40' />" .
|
||||
"<input type='hidden' name='wpSourceType' value='file' />" ;
|
||||
}
|
||||
|
|
@ -816,7 +816,7 @@ class UploadForm {
|
|||
$copystatus = htmlspecialchars( $this->mUploadCopyStatus );
|
||||
$filesource = wfMsgHtml ( 'filesource' );
|
||||
$uploadsource = htmlspecialchars( $this->mUploadSource );
|
||||
|
||||
|
||||
$wgOut->addHTML( "
|
||||
<td align='right' nowrap='nowrap'><label for='wpUploadCopyStatus'>$filestatus:</label></td>
|
||||
<td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' value=\"$copystatus\" size='40' /></td>
|
||||
|
|
@ -1254,6 +1254,4 @@ class UploadForm {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -149,12 +149,12 @@ class LoginForm {
|
|||
*/
|
||||
function addNewAccount() {
|
||||
global $wgUser, $wgEmailAuthentication;
|
||||
|
||||
|
||||
# Create the account and abort if there's a problem doing so
|
||||
$u = $this->addNewAccountInternal();
|
||||
if( $u == NULL )
|
||||
return;
|
||||
|
||||
|
||||
# If we showed up language selection links, and one was in use, be
|
||||
# smart (and sensible) and save that language as the user's preference
|
||||
global $wgLoginLanguageSelector;
|
||||
|
|
@ -383,7 +383,7 @@ class LoginForm {
|
|||
if( !$u->isEmailConfirmed() ) {
|
||||
$u->confirmEmail();
|
||||
}
|
||||
|
||||
|
||||
// At this point we just return an appropriate code
|
||||
// indicating that the UI should show a password
|
||||
// reset form; bot interfaces etc will probably just
|
||||
|
|
@ -393,14 +393,14 @@ class LoginForm {
|
|||
} else {
|
||||
return '' == $this->mPassword ? self::EMPTY_PASS : self::WRONG_PASS;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
$wgAuth->updateUser( $u );
|
||||
$wgUser = $u;
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function processLogin() {
|
||||
global $wgUser, $wgAuth;
|
||||
|
||||
|
|
@ -446,7 +446,7 @@ class LoginForm {
|
|||
wfDebugDieBacktrace( "Unhandled case value" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function resetLoginForm( $error ) {
|
||||
global $wgOut;
|
||||
$wgOut->addWikiText( "<div class=\"errorbox\">$error</div>" );
|
||||
|
|
@ -459,19 +459,19 @@ class LoginForm {
|
|||
*/
|
||||
function mailPassword() {
|
||||
global $wgUser, $wgOut, $wgAuth;
|
||||
|
||||
|
||||
if( !$wgAuth->allowPasswordChange() ) {
|
||||
$this->mainLoginForm( wfMsg( 'resetpass_forbidden' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Check against blocked IPs
|
||||
# fixme -- should we not?
|
||||
if( $wgUser->isBlocked() ) {
|
||||
$this->mainLoginForm( wfMsg( 'blocked-mailpassword' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Check against the rate limiter
|
||||
if( $wgUser->pingLimiter( 'mailpassword' ) ) {
|
||||
$wgOut->rateLimited();
|
||||
|
|
@ -496,7 +496,7 @@ class LoginForm {
|
|||
if ( $u->isPasswordReminderThrottled() ) {
|
||||
global $wgPasswordReminderResendTime;
|
||||
# Round the time in hours to 3 d.p., in case someone is specifying minutes or seconds.
|
||||
$this->mainLoginForm( wfMsg( 'throttled-mailpassword',
|
||||
$this->mainLoginForm( wfMsg( 'throttled-mailpassword',
|
||||
round( $wgPasswordReminderResendTime, 3 ) ) );
|
||||
return;
|
||||
}
|
||||
|
|
@ -587,7 +587,7 @@ class LoginForm {
|
|||
# haven't bothered to log out before trying to create an account to
|
||||
# evade it, but we'll leave that to their guilty conscience to figure
|
||||
# out.
|
||||
|
||||
|
||||
$wgOut->setPageTitle( wfMsg( 'cantcreateaccounttitle' ) );
|
||||
$wgOut->setRobotpolicy( 'noindex,nofollow' );
|
||||
$wgOut->setArticleRelated( false );
|
||||
|
|
@ -642,7 +642,7 @@ class LoginForm {
|
|||
$q .= $returnto;
|
||||
$linkq .= $returnto;
|
||||
}
|
||||
|
||||
|
||||
# Pass any language selection on to the mode switch link
|
||||
if( $wgLoginLanguageSelector && $this->mLanguage )
|
||||
$linkq .= '&uselang=' . $this->mLanguage;
|
||||
|
|
@ -656,7 +656,7 @@ class LoginForm {
|
|||
$template->set( 'link', wfMsgHtml( $linkmsg, $link ) );
|
||||
else
|
||||
$template->set( 'link', '' );
|
||||
|
||||
|
||||
$template->set( 'header', '' );
|
||||
$template->set( 'name', $this->mName );
|
||||
$template->set( 'password', $this->mPassword );
|
||||
|
|
@ -673,14 +673,14 @@ class LoginForm {
|
|||
$template->set( 'useemail', $wgEnableEmail );
|
||||
$template->set( 'canreset', $wgAuth->allowPasswordChange() );
|
||||
$template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) or $this->mRemember );
|
||||
|
||||
|
||||
# Prepare language selection links as needed
|
||||
if( $wgLoginLanguageSelector ) {
|
||||
$template->set( 'languages', $this->makeLanguageSelector() );
|
||||
if( $this->mLanguage )
|
||||
$template->set( 'uselang', $this->mLanguage );
|
||||
}
|
||||
|
||||
|
||||
// Give authentication and captcha plugins a chance to modify the form
|
||||
$wgAuth->modifyUITemplate( $template );
|
||||
if ( $this->mType == 'signup' ) {
|
||||
|
|
@ -694,7 +694,7 @@ class LoginForm {
|
|||
$wgOut->setArticleRelated( false );
|
||||
$wgOut->addTemplate( $template );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
|
@ -756,7 +756,7 @@ class LoginForm {
|
|||
|
||||
$wgOut->addWikiText( wfMsg( 'acct_creation_throttle_hit', $limit ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Produce a bar of links which allow the user to select another language
|
||||
* during login/registration but retain "returnto"
|
||||
|
|
@ -778,7 +778,7 @@ class LoginForm {
|
|||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a language selector link for a particular language
|
||||
* Links back to this page preserving type and returnto
|
||||
|
|
@ -797,6 +797,5 @@ class LoginForm {
|
|||
$skin =& $wgUser->getSkin();
|
||||
return $skin->makeKnownLinkObj( $self, htmlspecialchars( $text ), implode( '&', $attr ) );
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Reference in a new issue