* @return string $text|false the text requested
*/
function getRevisionText( $row, $prefix = 'old_' ) {
+ $fname = 'Article::getRevisionText';
+ wfProfileIn( $fname );
+
# Get data
$textField = $prefix . 'text';
$flagsField = $prefix . 'flags';
global $wgInputEncoding, $wgContLang;
$text = $wgContLang->iconv( $wgLegacyEncoding, $wgInputEncoding, $text );
}
+ wfProfileOut( $fname );
return $text;
}
}
/**
- * Load the revision (including cur_text) into this object
- */
- function loadContent( $noredir = false ) {
- global $wgOut, $wgRequest;
-
- if ( $this->mContentLoaded ) return;
-
- $dbr =& $this->getDB();
- # Query variables :P
- $oldid = $wgRequest->getVal( 'oldid' );
- $redirect = $wgRequest->getVal( 'redirect' );
-
- $fname = 'Article::loadContent';
+ * Return the oldid of the article that is to be shown.
+ * For requests with a "direction", this is not the oldid of the
+ * query
+ */
+ function getOldID() {
+ global $wgRequest, $wgOut;
+ static $lastid;
- # Pre-fill content with error message so that if something
- # fails we'll have something telling us what we intended.
+ if ( isset( $lastid ) ) {
+ return $lastid;
+ }
- $t = $this->mTitle->getPrefixedText();
+ $oldid = $wgRequest->getVal( 'oldid' );
if ( isset( $oldid ) ) {
+ $dbr =& $this->getDB();
$oldid = IntVal( $oldid );
if ( $wgRequest->getVal( 'direction' ) == 'next' ) {
$nextid = $this->mTitle->getNextRevisionID( $oldid );
# TODO
}
}
+ $lastid = $oldid;
}
+ return @$oldid; # "@" to be able to return "unset" without PHP complaining
+ }
+
+
+ /**
+ * Load the revision (including cur_text) into this object
+ */
+ function loadContent( $noredir = false ) {
+ global $wgOut, $wgRequest;
+
+ if ( $this->mContentLoaded ) return;
+
+ $dbr =& $this->getDB();
+ # Query variables :P
+ $oldid = $this->getOldID();
+ $redirect = $wgRequest->getVal( 'redirect' );
+
+ $fname = 'Article::loadContent';
+
+ # Pre-fill content with error message so that if something
+ # fails we'll have something telling us what we intended.
+
+ $t = $this->mTitle->getPrefixedText();
+
if ( isset( $oldid ) ) {
$t .= ',oldid='.$oldid;
}
$this->mCounter = $s->cur_counter;
$this->mTimestamp = wfTimestamp(TS_MW,$s->cur_timestamp);
$this->mTouched = wfTimestamp(TS_MW,$s->cur_touched);
- $this->mTitle->mRestrictions = explode( ',', trim( $s->cur_restrictions ) );
- $this->mTitle->mRestrictionsLoaded = true;
+ $this->mTitle->loadRestrictions( $s->cur_restrictions );
} else { # oldid set, retrieve historical version
$s = $dbr->selectRow( 'old', $this->getOldContentFields(), array( 'old_id' => $oldid ),
$fname, $this->getSelectOptions() );
$this->mCounter = $s->cur_counter;
$this->mTimestamp = wfTimestamp(TS_MW,$s->cur_timestamp);
$this->mTouched = wfTimestamp(TS_MW,$s->cur_touched);
- $this->mTitle->mRestrictions = explode( ',', trim( $s->cur_restrictions ) );
- $this->mTitle->mRestrictionsLoaded = true;
+ $this->mTitle->loadRestrictions( $s->cur_restrictions );
} else { # oldid set, retrieve historical version
$s = $dbr->selectRow( 'old', $this->getOldContentFields(), array( 'old_id' => $oldid ),
$fname, $this->getSelectOptions() );
* the given title.
*/
function view() {
- global $wgUser, $wgOut, $wgRequest, $wgOnlySysopsCanPatrol;
+ global $wgUser, $wgOut, $wgRequest, $wgOnlySysopsCanPatrol, $wgLang;
global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol;
$sk = $wgUser->getSkin();
$fname = 'Article::view';
wfProfileIn( $fname );
# Get variables from query string
- $oldid = $wgRequest->getVal( 'oldid' );
+ $oldid = $this->getOldID();
$diff = $wgRequest->getVal( 'diff' );
$rcid = $wgRequest->getVal( 'rcid' );
$targetUrl = $rt->escapeLocalURL();
$titleText = htmlspecialchars( $rt->getPrefixedText() );
$link = $sk->makeLinkObj( $rt );
- $wgOut->addHTML( '<img valign="center" src="'.$imageUrl.'" />' .
+
+ $wgOut->addHTML( '<img valign="center" src="'.$imageUrl.'" alt="#REDIRECT" />' .
'<span class="redirectText">'.$link.'</span>' );
+
} else if ( $pcache ) {
# Display content and save to parser cache
$wgOut->addPrimaryWikiText( $text, $this );
}
$confirm = $wgRequest->getBool( 'wpConfirmProtect' ) && $wgRequest->wasPosted();
+ $moveonly = $wgRequest->getBool( 'wpMoveOnly' );
$reason = $wgRequest->getText( 'wpReasonProtect' );
if ( $confirm ) {
+ $restrictions = "move=" . $limit;
+ if( !$moveonly ) {
+ $restrictions .= ":edit=" . $limit;
+ }
+
$dbw =& wfGetDB( DB_MASTER );
$dbw->update( 'cur',
array( /* SET */
'cur_touched' => $dbw->timestamp(),
- 'cur_restrictions' => (string)$limit
+ 'cur_restrictions' => $restrictions
), array( /* WHERE */
'cur_id' => $id
), 'Article::protect'
$check = '';
$protcom = '';
+ $moveonly = '';
if ( $limit === '' ) {
$wgOut->setPageTitle( wfMsg( 'confirmunprotect' ) );
$wgOut->setSubtitle( wfMsg( 'protectsub', $sub ) );
$wgOut->addWikiText( wfMsg( 'confirmprotecttext' ) );
$check = htmlspecialchars( wfMsg( 'confirmprotect' ) );
+ $moveonly = htmlspecialchars( wfMsg( 'protectmoveonly' ) );
$protcom = htmlspecialchars( wfMsg( 'protectcomment' ) );
$formaction = $this->mTitle->escapeLocalURL( 'action=protect' . $par );
}
<td>
<label for='wpConfirmProtect'>{$check}</label>
</td>
- </tr>
+ </tr> " );
+ if($moveonly != '') {
+ $wgOut->AddHTML( "
+ <tr>
+ <td align='right'>
+ <input type='checkbox' name='wpMoveOnly' value='1' id='wpMoveOnly' />
+ </td>
+ <td>
+ <label for='wpMoveOnly'>{$moveonly}</label>
+ </td>
+ </tr> " );
+ }
+ $wgOut->addHTML( "
<tr>
<td> </td>
<td>