* @package MediaWiki
*/
-define('DIR_PREV', 0);
-define('DIR_NEXT', 1);
-
/**
* This class handles printing the history page for an article. In order to
* be efficient, it uses timestamps rather than offsets for paging, to avoid
*/
class PageHistory {
+ const DIR_PREV = 0;
+ const DIR_NEXT = 1;
+
var $mArticle, $mTitle, $mSkin;
var $lastdate;
var $linesonpage;
$this->linesonpage = count($revisions) - 1;
/* Un-reverse revisions */
- if ($direction == DIR_PREV)
+ if ($direction == PageHistory::DIR_PREV)
$revisions = array_reverse($revisions);
/*
function getDirection() {
global $wgRequest;
if ($wgRequest->getText("dir") == "prev")
- return DIR_PREV;
+ return PageHistory::DIR_PREV;
else
- return DIR_NEXT;
+ return PageHistory::DIR_NEXT;
}
/** @todo document */
$dbr =& wfGetDB( DB_SLAVE );
- if ($direction == DIR_PREV)
+ if ($direction == PageHistory::DIR_PREV)
list($dirs, $oper) = array("ASC", ">=");
- else /* $direction == DIR_NEXT */
+ else /* $direction == PageHistory::DIR_NEXT */
list($dirs, $oper) = array("DESC", "<=");
if ($offset)
* When we're displaying previous revisions, we need to reverse
* the array, because it's queried in reverse order.
*/
- if ($direction == DIR_PREV)
+ if ($direction == PageHistory::DIR_PREV)
$revisions = array_reverse($revisions);
/*
wfMsgForContent( 'history-feed-description' ),
$this->mTitle->getFullUrl( 'action=history' ) );
- $items = $this->fetchRevisions(10, 0, DIR_NEXT);
+ $items = $this->fetchRevisions(10, 0, PageHistory::DIR_NEXT);
$feed->outHeader();
if( $items ) {
foreach( $items as $row ) {
$oldid = $request->getVal( 'oldid' );
if( !$this->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal ||
$section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
- require_once( 'includes/EditPage.php' );
$editor = new EditPage( $article );
$editor->submit();
} elseif( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
- require_once( 'includes/ExternalEdit.php' );
$mode = $request->getVal( 'mode' );
$extedit = new ExternalEdit( $article, $mode );
$extedit->edit();
if( $_SERVER['REQUEST_URI'] == $title->getInternalURL( 'action=history' ) ) {
$output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
}
- require_once( 'includes/PageHistory.php' );
$history = new PageHistory( $article );
$history->history();
break;
case 'raw':
- require_once( 'includes/RawPage.php' );
$raw = new RawPage( $article );
$raw->view();
break;