# checking, etc.
if ( $this->formtype == 'initial' || $this->firsttime ) {
if ( $this->initialiseForm() === false ) {
- $out = $this->context->getOutput();
- if ( $out->getRedirect() === '' ) { // mcrundo hack redirects, don't override it
- $this->noSuchSectionPage();
- }
return;
}
* @return string|null
*/
protected function importContentFormData( &$request ) {
- return; // Don't do anything, EditPage already extracted wpTextbox1
+ return null; // Don't do anything, EditPage already extracted wpTextbox1
}
/**
$content = $this->getContentObject( false ); # TODO: track content object?!
if ( $content === false ) {
+ $out = $this->context->getOutput();
+ if ( $out->getRedirect() === '' ) { // mcrundo hack redirects, don't override it
+ $this->noSuchSectionPage();
+ }
return false;
}
+
+ if ( !$this->isSupportedContentModel( $content->getModel() ) ) {
+ $modelMsg = $this->getContext()->msg( 'content-model-' . $content->getModel() );
+ $modelName = $modelMsg->exists() ? $modelMsg->text() : $content->getModel();
+
+ $out = $this->context->getOutput();
+ $out->showErrorPage(
+ 'modeleditnotsupported-title',
+ 'modeleditnotsupported-text',
+ $modelName
+ );
+ return false;
+ }
+
$this->textbox1 = $this->toEditText( $content );
$user = $this->context->getUser();
* @since 1.21
*/
protected function getContentObject( $def_content = null ) {
+ global $wgDisableAnonTalk;
+
$content = false;
$user = $this->context->getUser();
$undo
)->inContentLanguage()->text();
} else {
+ $undoMessage = ( $undorev->getUser() === 0 && $wgDisableAnonTalk ) ?
+ 'undo-summary-anon' :
+ 'undo-summary';
$undoSummary = $this->context->msg(
- 'undo-summary',
+ $undoMessage,
$undo,
$userText
)->inContentLanguage()->text();
} elseif ( !$status->isOK() ) {
# ...or the hook could be expecting us to produce an error
// FIXME this sucks, we should just use the Status object throughout
+ if ( !$status->getErrors() ) {
+ // Provide a fallback error message if none was set
+ $status->fatal( 'hookaborted' );
+ }
$this->hookError = $this->formatStatusErrors( $status );
- $status->fatal( 'hookaborted' );
$status->value = self::AS_HOOK_ERROR_EXPECTED;
return false;
}
* - 'legacy-name' (optional): short name for backwards-compatibility
* @param array $checked Array of checkbox name (matching the 'legacy-name') => bool,
* where bool indicates the checked status of the checkbox
- * @return array
+ * @return array[]
*/
public function getCheckboxesDefinition( $checked ) {
$checkboxes = [];