$this->previewTextAfterContent =
$this->mPreloadText = "";
}
-
+
function getArticle() {
return $this->mArticle;
}
$undorev->getPage() == $this->mArticle->getID() &&
!$undorev->isDeleted( Revision::DELETED_TEXT ) &&
!$oldrev->isDeleted( Revision::DELETED_TEXT ) ) {
-
+
$undotext = $this->mArticle->getUndoText( $undorev, $oldrev );
if ( $undotext === false ) {
# Warn the user that something went wrong
wfProfileOut( __METHOD__ );
return $text;
}
-
+
/** Use this method before edit() to preload some text into the edit box */
public function setPreloadedText( $text ) {
$this->mPreloadText = $text;
$this->mMetaData = $s;
}
- /*
+ /*
* Check if a page was deleted while the user was editing it, before submit.
* Note that we rely on the logging table, which hasn't been always there,
* but that doesn't matter, because this only applies to brand new
}
}
}
-
+
// If they used redlink=1 and the page exists, redirect to the main article
if ( $wgRequest->getBool( 'redlink' ) && $this->mTitle->exists() ) {
$wgOut->redirect( $this->mTitle->getFullURL() );
wfProfileOut( __METHOD__."-business-end" );
wfProfileOut( __METHOD__ );
}
-
+
protected function getEditPermissionErrors() {
global $wgUser;
$permErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
# Ignore some permissions errors when a user is just previewing/viewing diffs
$remove = array();
foreach( $permErrors as $error ) {
- if ( ($this->preview || $this->diff) &&
+ if ( ($this->preview || $this->diff) &&
($error[0] == 'blockedtext' || $error[0] == 'autoblockedtext') )
{
$remove[] = $error;
$this->watchthis = $request->getCheck( 'wpWatchthis' );
# Don't force edit summaries when a user is editing their own user or talk page
- if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) &&
- $this->mTitle->getText() == $wgUser->getName() )
+ if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) &&
+ $this->mTitle->getText() == $wgUser->getName() )
{
$this->allowBlankSummary = true;
} else {
elseif ( $this->section != 'new' && $request->getVal( 'summary' ) ) {
$this->summary = $request->getText( 'summary' );
}
-
+
if ( $request->getVal( 'minor' ) ) {
$this->minoredit = true;
}
}
# Give a notice if the user is editing a deleted/moved page...
if ( !$this->mTitle->exists() ) {
- LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(),
- '', array( 'lim' => 10,
- 'conds' => array( "log_action != 'revision'" ),
- 'showIfEmpty' => false,
- 'msgKey' => array( 'recreate-moveddeleted-warn') )
+ LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(),
+ '', array( 'lim' => 10,
+ 'conds' => array( "log_action != 'revision'" ),
+ 'showIfEmpty' => false,
+ 'msgKey' => array( 'recreate-moveddeleted-warn') )
);
}
}
wfProfileOut( $fname );
return self::AS_HOOK_ERROR_EXPECTED;
}
-
+
# Handle the user preference to force summaries here. Check if it's not a redirect.
if ( !$this->allowBlankSummary && !Title::newFromRedirect( $this->textbox1 ) ) {
if ( md5( $this->summary ) == $this->autoSumm ) {
}
}
$userid = $wgUser->getId();
-
+
# Suppress edit conflict with self, except for section edits where merging is required.
if ( $this->isConflict && $this->section == '' && $this->userWasLastToEdit($userid,$this->edittime) ) {
wfDebug( "EditPage::editForm Suppressing edit conflict, same user.\n" );
}
# Handle the user preference to force summaries here, but not for null edits
- if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp($oldtext,$text)
+ if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp($oldtext,$text)
&& !Title::newFromRedirect( $text ) ) # check if it's not a redirect
{
if ( md5( $this->summary ) == $this->autoSumm ) {
# update the article here
if ( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit,
- $this->watchthis, $bot, $sectionanchor ) )
+ $this->watchthis, $bot, $sectionanchor ) )
{
wfProfileOut( $fname );
return self::AS_SUCCESS_UPDATE;
wfProfileOut( $fname );
return self::AS_END;
}
-
+
/**
* Check if no edits were made by other users since
* the time a user started editing the page. Limit to
$dbw = wfGetDB( DB_MASTER );
$res = $dbw->select( 'revision',
'rev_user',
- array(
+ array(
'rev_page' => $this->mArticle->getId(),
'rev_timestamp > '.$dbw->addQuotes( $dbw->timestamp($edittime) )
),
$regexes = (array)$wgSpamRegex;
return self::matchSpamRegexInternal( $text, $regexes );
}
-
+
/**
* Check given input text against $wgSpamRegex, and return the text of the first match.
* @return mixed -- matching string or false
$regexes = (array)$wgSummarySpamRegex;
return self::matchSpamRegexInternal( $text, $regexes );
}
-
+
protected static function matchSpamRegexInternal( $text, $regexes ) {
foreach( $regexes as $regex ) {
$matches = array();
if ( $this->formtype == 'preview' ) {
$previewOutput = $this->getPreviewText();
}
-
- wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ;
+
+ wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) );
$this->setHeaders();
$noticeMsg = 'protectedpagewarning';
$classes[] = 'mw-textarea-protected';
}
- LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
array( 'lim' => 1, 'msgKey' => array( $noticeMsg ) ) );
}
if ( $this->mTitle->isCascadeProtected() ) {
END
);
$this->showTextbox1( $classes );
-
+
$wgOut->addHTML( $this->editFormTextAfterContent );
$wgOut->wrapWikiMsg( "<div id=\"editpage-copywarn\">\n$1\n</div>", $copywarnMsg );
<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n
<input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n" );
}
-
+
protected function showTextbox1( $classes ) {
$attribs = array( 'tabindex' => 1 );
-
+
if ( $this->wasDeletedSinceLastEdit() )
$attribs['type'] = 'hidden';
if ( !empty($classes) )
$attribs['class'] = implode(' ',$classes);
-
+
$this->showTextbox( $this->textbox1, 'wpTextbox1', $attribs );
}
-
+
protected function showTextbox2() {
$this->showTextbox( $this->textbox2, 'wpTextbox2', array( 'tabindex' => 6 ) );
}
-
+
protected function showTextbox( $content, $name, $attribs = array() ) {
global $wgOut, $wgUser;
-
+
$wikitext = $this->safeUnicodeOutput( $content );
if ( $wikitext !== '' ) {
// Ensure there's a newline at the end, otherwise adding lines
// mode will show an extra newline. A bit annoying.
$wikitext .= "\n";
}
-
+
$attribs['accesskey'] = ',';
$attribs['id'] = $name;
-
+
if ( $wgUser->getOption( 'editwidth' ) )
$attribs['style'] = 'width: 100%';
-
+
$wgOut->addHTML( Xml::textarea(
$name,
$wikitext,
'log_title',
'log_comment',
'log_params',
- 'log_deleted',
+ 'log_deleted',
'user_name' ),
array( 'log_namespace' => $this->mTitle->getNamespace(),
'log_title' => $this->mTitle->getDBkey(),
wfProfileOut( __METHOD__ );
return $previewhead . $previewHTML . $this->previewTextAfterContent;
}
-
+
function getTemplates() {
if ( $this->preview || $this->section != '' ) {
$templates = array();
* Shows a bulletin board style toolbar for common editing functions.
* It can be disabled in the user preferences.
* The necessary JavaScript code can be found in skins/common/edit.js.
- *
+ *
* @return string
*/
static function getEditToolbar() {
++$tabindex; // use the same for preview and live preview
if ( $this->useLivePreview() ) {
$this->doLivePreviewScript(); // Add to output
-
+
$temp = array(
'id' => 'wpPreview',
'name' => 'wpPreview',
'title' => '',
'style' => 'display: none;',
);
-
+
$buttons['live'] = Xml::element('input', $temp, '');
} else {
$temp = array(
return false;
}
}
-
+
function getBaseRevision() {
if ( $this->mBaseRevision == false ) {
$db = wfGetDB( DB_MASTER );