<?php
/**
* Contains the EditPage class
+ * @file
*/
/**
}
$permErrors = $this->mTitle->getUserPermissionsErrors('edit', $wgUser);
+
if( !$this->mTitle->exists() ) {
$permErrors = array_merge( $permErrors,
wfArrayDiff2( $this->mTitle->getUserPermissionsErrors('create', $wgUser), $permErrors ) );
}
}
$permErrors = wfArrayDiff2( $permErrors, $remove );
-
+
if ( $permErrors ) {
wfDebug( __METHOD__.": User can't edit\n" );
- $this->readOnlyPage( $this->getContent(), true, $permErrors );
+ $this->readOnlyPage( $this->getContent(), true, $permErrors, 'edit' );
wfProfileOut( __METHOD__ );
return;
} else {
* Parameters are the same as OutputPage:readOnlyPage()
* Redirect to the article page if redlink=1
*/
- function readOnlyPage( $source = null, $protected = false, $reasons = array() ) {
+ function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
global $wgRequest, $wgOut;
if ( $wgRequest->getBool( 'redlink' ) ) {
// The edit page was reached via a red link.
// they really want a permission error.
$wgOut->redirect( $this->mTitle->getFullUrl() );
} else {
- $wgOut->readOnlyPage( $source, $protected, $reasons );
+ $wgOut->readOnlyPage( $source, $protected, $reasons, $action );
}
}
}
}
}
- $userid = $wgUser->getID();
+ $userid = $wgUser->getId();
if ( $this->isConflict) {
wfDebug( "EditPage::editForm conflict! getting section '$this->section' for time '$this->edittime' (article time '" .
}
# Handle the user preference to force summaries here, but not for null edits
- if( $this->section != 'new' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary')
- && 0 != strcmp($oldtext, $text) && !Article::getRedirectAutosummary( $text )) {
+ if( $this->section != 'new' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary') &&
+ 0 != strcmp($oldtext, $text) &&
+ !is_object( Title::newFromRedirect( $text ) ) # check if it's not a redirect
+ ) {
+
if( md5( $this->summary ) == $this->autoSumm ) {
$this->missingSummary = true;
wfProfileOut( $fname );
if( $wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage ) {
# prepare toolbar for edit buttons
- $toolbar = $this->getEditToolbar();
+ $toolbar = EditPage::getEditToolbar();
} else {
$toolbar = '';
}
/**
* 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 style/wikibits.js.
+ * The necessary JavaScript code can be found in skins/common/edit.js.
+ *
+ * @return string
*/
- function getEditToolbar() {
+ static function getEditToolbar() {
global $wgStylePath, $wgContLang, $wgJsMimeType;
/**