Fix retarded mistake in 57997, move break to within the if block or it defeats the...
[lhc/web/wiklou.git] / includes / ProtectionForm.php
index 8c91544..e6b7dbe 100644 (file)
@@ -274,6 +274,16 @@ class ProtectionForm {
                        throw new FatalError( "Unknown error at restriction save time." );
                }
 
+               $errorMsg = '';
+               # Give extensions a change to handle added form items
+               if( !wfRunHooks( 'ProtectionForm::save', array($this->mArticle,&$errorMsg) ) ) {
+                       throw new FatalError( "Unknown hook error at restriction save time." );
+               }
+               if( $errorMsg != '' ) {
+                       $this->show( $errorMsg );
+                       return false;
+               }
+
                if( $wgRequest->getCheck( 'mwProtectWatch' ) ) {
                        $this->mArticle->doWatch();
                } elseif( $this->mTitle->userIsWatching() ) {
@@ -375,7 +385,8 @@ class ProtectionForm {
                        }
                        # Add custom expiry field
                        $attribs = array( 'id' => "mwProtect-$action-expires",
-                               'onkeyup' => 'ProtectionForm.updateExpiry(this)' ) + $this->disabledAttrib;
+                               'onkeyup' => 'ProtectionForm.updateExpiry(this)',
+                               'onchange' => 'ProtectionForm.updateExpiry(this)' ) + $this->disabledAttrib;
                        $out .= "<table><tr>
                                        <td class='mw-label'>" .
                                                $mProtectother .
@@ -389,6 +400,8 @@ class ProtectionForm {
                        Xml::closeElement( 'fieldset' ) .
                        "</td></tr>";
                }
+               # Give extensions a chance to add items to the form
+               wfRunHooks( 'ProtectionForm::buildForm', array($this->mArticle,&$out) );
 
                $out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' );
 
@@ -553,5 +566,7 @@ class ProtectionForm {
                # Show relevant lines from the protection log:
                $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'protect' ) ) );
                LogEventsList::showLogExtract( $out, 'protect', $this->mTitle->getPrefixedText() );
+               # Let extensions add other relevant log extracts
+               wfRunHooks( 'ProtectionForm::showLogExtract', array($this->mArticle,$out) );
        }
 }