From a84303521297fbcf97117424ac65a4c04ca74352 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 7 May 2006 07:26:25 +0000 Subject: [PATCH] Fix that optional error return for EditFilter hook. Didn't work at all previously, with two entire ways to prevent the value being passed along. :) --- docs/hooks.txt | 4 ++-- includes/EditPage.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 3c46368d35..2f3d8c8bca 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -300,8 +300,8 @@ $user: the user who did the block (not the one being blocked) 'EditFilter': Perform checks on an edit $editor: Edit form (see includes/EditPage.php) $text: Contents of the edit box -§ion: Section being edited -$error: Error message to return +$section: Section being edited +&$error: Error message to return Return false to halt editing; you'll need to handle error messages, etc. yourself. Alternatively, modifying $error and returning true will cause the contents of $error diff --git a/includes/EditPage.php b/includes/EditPage.php index a708dd4e92..abb5e16f8d 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -493,7 +493,7 @@ class EditPage { wfProfileOut( "$fname-checks" ); return false; } - if ( !wfRunHooks( 'EditFilter', array( &$this, $this->textbox1, $this->section, $this->hookError ) ) ) { + if ( !wfRunHooks( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError ) ) ) { # Error messages etc. could be handled within the hook... wfProfileOut( $fname ); wfProfileOut( "$fname-checks" ); @@ -778,7 +778,7 @@ class EditPage { $wgOut->addWikiText( wfMsg( 'missingsummary' ) ); } - if( !$this->hookError = '' ) { + if( !$this->hookError == '' ) { $wgOut->addWikiText( $this->hookError ); } -- 2.20.1