$oldid = wfInsertID( $res );
$bot = (int)($wgUser->isBot() || $forceBot);
- RecentChange::notifyEdit( $now, $this->mTitle, $me2, $wgUser, $this->getComment(),
+ RecentChange::notifyEdit( $now, $this->mTitle, $me2, $wgUser, $summary,
$oldid, $this->getTimestamp() );
Article::onArticleEdit( $this->mTitle );
}
$wgOut->setRobotpolicy( "noindex,follow" );
$sk = $wgUser->getSkin();
- $oldUserTitle = Title::makeTitle( NS_USER, $this->mOldUser );
- $newUserTitle = Title::makeTitle( NS_USER, $this->mNewUser );
- $oldUserLink = $sk->makeLinkObj( $oldUserTitle, $this->mOldUser );
- $newUserLink = $sk->makeLinkObj( $newUserTitle, $this->mNewUser );
- $oldHeader = "<strong>{$this->mOldtitle}</strong><br>$oldUserLink";
- $newHeader = "<strong>{$this->mNewtitle}</strong><br>$newUserLink";
+ $talk = $wgLang->getNsText( NS_TALK );
+ $contribs = wfMsg( "contribslink" );
+
+ $oldUserLink = $sk->makeLinkObj( Title::makeTitle( NS_USER, $this->mOldUser ), $this->mOldUser );
+ $newUserLink = $sk->makeLinkObj( Title::makeTitle( NS_USER, $this->mNewUser ), $this->mNewUser );
+ $oldUTLink = $sk->makeLinkObj( Title::makeTitle( NS_USER_TALK, $this->mOldUser ), $talk );
+ $newUTLink = $sk->makeLinkObj( Title::makeTitle( NS_USER_TALK, $this->mNewUser ), $talk );
+ $oldContribs = $sk->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ), $contribs,
+ "target=" . urlencode($this->mOldUser) );
+ $newContribs = $sk->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ), $contribs,
+ "target=" . urlencode($this->mNewUser) );
+ if ( !$this->mNewid && $wgUser->isSysop() ) {
+ $rollback = " <strong>[" . $sk->makeKnownLinkObj( $wgTitle, wfMsg( "rollbacklink" ),
+ "action=rollback&from=" . urlencode($this->mNewUser) ) . "]</strong>";
+ } else {
+ $rollback = "";
+ }
+
+ $oldHeader = "<strong>{$this->mOldtitle}</strong><br>$oldUserLink ($oldUTLink | $oldContribs)";
+ $newHeader = "<strong>{$this->mNewtitle}</strong><br>$newUserLink ($newUTLink | $newContribs) $rollback";
DifferenceEngine::showDiff( $this->mOldtext, $this->mNewtext,
$oldHeader, $newHeader );
$wpSummary = "";
}
$wgOut->setRobotpolicy( "noindex,nofollow" );
- $wgOut->setArticleFlag( false );
+
+ # Enabled article-related sidebar, toplinks, etc.
+ $wgOut->setArticleRelated( true );
if ( $isConflict ) {
$s = wfMsg( "editconflict", $this->mTitle->getPrefixedText() );
$wgOut->setPageTitle( wfMsg( "blockedtitle" ) );
$wgOut->setRobotpolicy( "noindex,nofollow" );
- $wgOut->setArticleFlag( false );
+ $wgOut->setArticleRelated( false );
$id = $wgUser->blockedBy();
$reason = $wgUser->blockedFor();
$wgOut->setPageTitle( wfMsg( "whitelistedittitle" ) );
$wgOut->setRobotpolicy( "noindex,nofollow" );
- $wgOut->setArticleFlag( false );
+ $wgOut->setArticleRelated( false );
$wgOut->addWikiText( wfMsg( "whitelistedittext" ) );
$wgOut->returnToMain( false );
var $mOnloadHandler;
var $mDoNothing;
var $mContainsOldMagic, $mContainsNewMagic;
+ var $mIsArticleRelated;
function OutputPage()
{
$this->mLastSection = $this->mRedirect = $this->mLastModified =
$this->mSubtitle = $this->mDebugtext = $this->mRobotpolicy =
$this->mOnloadHandler = "";
- $this->mIsarticle = $this->mPrintable = true;
+ $this->mIsArticleRelated = $this->mIsarticle = $this->mPrintable = true;
$this->mSupressQuickbar = $this->mDTopen = $this->mPrintable = false;
$this->mLanguageLinks = array();
$this->mCategoryLinks = array() ;
function getPageTitle() { return $this->mPagetitle; }
function setSubtitle( $str ) { $this->mSubtitle = $str; }
function getSubtitle() { return $this->mSubtitle; }
- function setArticleFlag( $v ) { $this->mIsarticle = $v; }
function isArticle() { return $this->mIsarticle; }
function setPrintable() { $this->mPrintable = true; }
function isPrintable() { return $this->mPrintable; }
function getOnloadHandler() { return $this->mOnloadHandler; }
function disable() { $this->mDoNothing = true; }
+ function setArticleRelated( $v )
+ {
+ $this->mIsArticleRelated = $v;
+ if ( !$v ) {
+ $this->mIsarticle = false;
+ }
+ }
+ function setArticleFlag( $v ) {
+ $this->mIsarticle = $v;
+ if ( $v ) {
+ $this->mIsArticleRelated = $v;
+ }
+ }
+
+ function isArticleRelated( $v )
+ {
+ return $this->mIsArticleRelated;
+ }
+
function getLanguageLinks() {
global $wgTitle, $wgLanguageCode;
global $wgDBconnection, $wgDBname;
$this->setHTMLTitle( wfMsg( "errorpagetitle" ) );
$this->setPageTitle( wfMsg( $title ) );
$this->setRobotpolicy( "noindex,nofollow" );
- $this->setArticleFlag( false );
+ $this->setArticleRelated( false );
$this->mBodytext = "";
$this->addHTML( "<p>" . wfMsg( $msg ) . "\n" );
$this->setHTMLTitle( wfMsg( "errorpagetitle" ) );
$this->setPageTitle( wfMsg( "sysoptitle" ) );
$this->setRobotpolicy( "noindex,nofollow" );
- $this->setArticleFlag( false );
+ $this->setArticleRelated( false );
$this->mBodytext = "";
$sk = $wgUser->getSkin();
$this->setHTMLTitle( wfMsg( "errorpagetitle" ) );
$this->setPageTitle( wfMsg( "developertitle" ) );
$this->setRobotpolicy( "noindex,nofollow" );
- $this->setArticleFlag( false );
+ $this->setArticleRelated( false );
$this->mBodytext = "";
$sk = $wgUser->getSkin();
$this->setPageTitle( wfMsgNoDB( "databaseerror" ) );
$this->setRobotpolicy( "noindex,nofollow" );
- $this->setArticleFlag( false );
+ $this->setArticleRelated( false );
if ( $wgCommandLineMode ) {
$msg = wfMsgNoDB( "dberrortextcl" );
global $wgUser, $wgReadOnlyFile;
$this->setRobotpolicy( "noindex,nofollow" );
- $this->setArticleFlag( false );
+ $this->setArticleRelated( false );
if( $protected ) {
$this->setPageTitle( wfMsg( "viewsource" ) );
{
$this->setPageTitle( wfMsg( "internalerror" ) );
$this->setRobotpolicy( "noindex,nofollow" );
- $this->setArticleFlag( false );
+ $this->setArticleRelated( false );
$this->mBodytext = $message;
$this->output();
$wgOut->setPageTitle( $this->mTitle->getPRefixedText() );
$wgOut->setSubtitle( wfMsg( "revhistory" ) );
$wgOut->setArticleFlag( false );
+ $wgOut->setArticleRelated( true );
$wgOut->setRobotpolicy( "noindex,nofollow" );
if( $this->mTitle->getArticleID() == 0 ) {
return $rc;
}
+ /* static */ function newFromCurRow( $row )
+ {
+ $rc = new RecentChange;
+ $rc->loadFromCurRow( $row );
+ return $rc;
+ }
+
# Accessors
function setAttribs( $attribs )
$this->mExtra = array();
}
+ # Makes a pseudo-RC entry from a cur row, for watchlists and things
+ function loadFromCurRow( $row )
+ {
+ $this->mAttribs = array(
+ "rc_timestamp" => $row->cur_timestamp,
+ "rc_cur_time" => $row->cur_timestamp,
+ "rc_user" => $row->cur_user,
+ "rc_user_text" => $row->cur_user_text,
+ "rc_namespace" => $row->cur_namespace,
+ "rc_title" => $row->cur_title,
+ "rc_comment" => $row->cur_comment,
+ "rc_minor" => !!$row->cur_minor_edit,
+ "rc_type" => $row->cur_is_new ? RC_NEW : RC_EDIT,
+ "rc_cur_id" => $row->cur_id,
+ 'rc_this_oldid' => 0,
+ 'rc_last_oldid' => 0,
+ 'rc_bot' => 0,
+ 'rc_moved_to_ns' => 0,
+ 'rc_moved_to_title' => ''
+ );
+
+ $this->mExtra = array();
+ }
+
+
# Gets the end part of the diff URL assoicated with this object
# Blank if no diff link should be displayed
function diffLinkTrail( $forceCur )
var $secureName, $link;
var $curlink , $lastlink , $usertalklink , $versionlink ;
var $userlink, $timestamp, $watched;
+
+ function newFromParent( $rc )
+ {
+ $rc2 = new RCCacheEntry;
+ $rc2->mAttribs = $rc->mAttribs;
+ $rc2->mExtra = $rc->mExtra;
+ return $rc2;
+ }
} ;
class Skin {
$s = $this->printableLink();
if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
- if ( $wgOut->isArticle() ) {
+ if ( $wgOut->isArticleRelated() ) {
if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
$name = $wgTitle->getDBkey();
$link = wfEscapeHTML( wfImageUrl( $name ) );
#wfEscapeHTML( wfImageUrl( $name ) );
$style = $this->getExternalLinkAttributes( $link, $name );
$s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
- } }
- if ( "history" == $action || isset( $diff ) || isset( $oldid ) ) {
- $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
- wfMsg( "currentrev" ) );
- }
+ }
+ }
+ if ( "history" == $action || isset( $diff ) || isset( $oldid ) ) {
+ $s .= " | " . $this->makeKnownLink( $wgTitle->getPrefixedText(),
+ wfMsg( "currentrev" ) );
+ }
- if ( $wgUser->getNewtalk() ) {
- # do not show "You have new messages" text when we are viewing our
- # own talk page
-
- if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
- $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
- $n =$wgUser->getName();
- $tl = $this->makeKnownLink( $wgLang->getNsText(
- Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
- wfMsg("newmessageslink") );
- $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
- }
- }
- if( $wgUser->isSysop() &&
- (($wgTitle->getArticleId() == 0) || ($action == "history")) &&
- ($n = $wgTitle->isDeleted() ) ) {
- $s .= " | " . wfMsg( "thisisdeleted",
- $this->makeKnownLink(
- $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
- wfMsg( "restorelink", $n ) ) );
+ if ( $wgUser->getNewtalk() ) {
+ # do not show "You have new messages" text when we are viewing our
+ # own talk page
+
+ if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
+ $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
+ $n =$wgUser->getName();
+ $tl = $this->makeKnownLink( $wgLang->getNsText(
+ Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
+ wfMsg("newmessageslink") );
+ $s.=" | <strong>". wfMsg( "newmessages", $tl ) . "</strong>";
}
+ }
+ if( $wgUser->isSysop() &&
+ (($wgTitle->getArticleId() == 0) || ($action == "history")) &&
+ ($n = $wgTitle->isDeleted() ) ) {
+ $s .= " | " . wfMsg( "thisisdeleted",
+ $this->makeKnownLink(
+ $wgLang->SpecialPage( "Undelete/" . $wgTitle->getPrefixedDBkey() ),
+ wfMsg( "restorelink", $n ) ) );
+ }
return $s;
}
$s = $this->mainPageLink() . $sep
. $this->specialLink( "recentchanges" );
- if ( $wgOut->isArticle() ) {
+ if ( $wgOut->isArticleRelated() ) {
$s .= $sep . $this->editThisPage()
. $sep . $this->historyLink();
}
$sep = " |\n";
$s = "";
- if ( $wgOut->isArticle() ) {
+ if ( $wgOut->isArticleRelated() ) {
$s .= "<strong>" . $this->editThisPage() . "</strong>";
if ( 0 != $wgUser->getID() ) {
$s .= $sep . $this->watchThisPage();
unwatched. Therefore we do not show the "Watch this page" link in edit mode
*/
if ( 0 != $wgUser->getID() && $articleExists) {
- if($action!="edit" && $action!="history" &&
- $action != "submit" )
+ if($action!="edit" && $action != "submit" )
{
$s .= $sep . $this->watchThisPage();
}
}
$s.=$sep . $this->whatLinksHere();
- if($wgOut->isArticle()) {
+ if($wgOut->isArticleRelated()) {
$s .= $sep . $this->watchPageLinksLink();
}
{
global $wgOut, $wgTitle, $oldid, $redirect, $diff;
- if ( ! $wgOut->isArticle() || $diff ) {
+ if ( ! $wgOut->isArticleRelated() ) {
$s = wfMsg( "protectedpage" );
} else {
$n = $wgTitle->getPrefixedText();
{
global $wgUser, $wgOut, $wgTitle, $diff;
- if ( $wgOut->isArticle() && ( ! $diff ) ) {
+ if ( $wgOut->isArticleRelated() ) {
$n = $wgTitle->getPrefixedText();
if ( $wgTitle->userIsWatching() ) {
{
global $wgOut, $wgTitle, $wgLang;
- if ( ! $wgOut->isArticle() ) {
+ if ( ! $wgOut->isArticleRelated() ) {
$s = "(" . wfMsg( "notanarticle" ) . ")";
} else {
$s = $this->makeKnownLink( $wgLang->specialPage(
# Called in a loop over all displayed RC entries
# Either returns the line, or caches it for later use
- function recentChangesLine( $row, $watched = false )
+ function recentChangesLine( &$rc, $watched = false )
{
global $wgUser ;
$usenew = $wgUser->getOption( "usenewrc" );
if ( $usenew )
- $line = $this->recentChangesLineNew ( $row, $watched ) ;
+ $line = $this->recentChangesLineNew ( $rc, $watched ) ;
else
- $line = $this->recentChangesLineOld ( $row, $watched ) ;
+ $line = $this->recentChangesLineOld ( $rc, $watched ) ;
return $line ;
}
- function recentChangesLineOld( $row, $watched = false )
+ function recentChangesLineOld( &$rc, $watched = false )
{
global $wgTitle, $wgLang, $wgUser;
# Extract DB fields into local scope
- extract( get_object_vars( $row ) );
- $rc = RecentChange::newFromRow( $row );
+ extract( $rc->mAttribs );
$curIdEq = "curid=" . $rc_cur_id;
# Make date header if necessary
}
# function recentChangesLineNew( $ts, $u, $ut, $ns, $ttl, $c, $isminor, $isnew, $watched = false, $oldid = 0 , $diffid = 0 )
- function recentChangesLineNew( $row, $watched = false )
+ function recentChangesLineNew( &$baseRC, $watched = false )
{
global $wgTitle, $wgLang, $wgUser;
- # Fill $rc with all the information from the row
- $rc = new RCCacheEntry ;
- $rc->loadFromRow( $row );
+ # Create a specialised object
+ $rc = RCCacheEntry::newFromParent( $baseRC ) ;
# Extract fields from DB into the function scope (rc_xxxx variables)
extract( $rc->mAttribs );
break;
}
if ( ! ( $hideminor && $obj1->rc_minor ) ) {
- $s .= $sk->recentChangesLine( $obj1, $obj1->wl_user );
+ $rc = RecentChange::newFromRow( $obj1 );
+ $s .= $sk->recentChangesLine( $rc, $obj1->wl_user );
--$limit;
}
$obj1 = wfFetchObject( $res );
$obj = wfFetchObject( $res );
--$count;
- $ts = $obj->cur_timestamp;
- $u = $obj->cur_user;
- $ut = $obj->cur_user_text;
- $ns = $obj->cur_namespace;
- $ttl = $obj->cur_title;
- $com = $obj->cur_comment;
- $me = ( $obj->cur_minor_edit > 0 );
- $new = ( $obj->cur_is_new > 0 );
-
- $s .= $sk->recentChangesLine( $ts, $u, $ut, $ns, $ttl, $com, $me, $new );
+ $rc = RecentChange::newFromCurRow( $obj );
+ $s .= $sk->recentChangesLine( $rc );
--$limit;
}
$s .= $sk->endRecentChangesList();
$sql = "SELECT
- cur_namespace,cur_title,cur_comment,
+ cur_namespace,cur_title,cur_comment, cur_id
cur_user,cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new
FROM watchlist,cur USE INDEX ($x)
WHERE wl_user=$uid
$s = $sk->beginRecentChangesList();
while ( $obj = wfFetchObject( $res ) ) {
- $ts = $obj->cur_timestamp;
- $u = $obj->cur_user;
- $ut = $obj->cur_user_text;
- $ns = $obj->cur_namespace;
- $ttl = $obj->cur_title;
- $com = $obj->cur_comment;
- $me = ( $obj->cur_minor_edit > 0 );
- $new = ( $obj->cur_is_new > 0 );
- $watched = true;
-
- $s .= $sk->recentChangesLine( $ts, $u, $ut, $ns, $ttl, $com, $me, $new, $watched );
+ # Make fake RC entry
+ $rc = RecentChange::newFromCurRow( $obj );
+ $s .= $sk->recentChangesLine( $rc, true );
}
$s .= $sk->endRecentChangesList();