* (bug 23460) Parse action should have a section option
[lhc/web/wiklou.git] / includes / ProtectionForm.php
index f457e9a..28df01a 100644 (file)
@@ -58,7 +58,7 @@ class ProtectionForm {
                // Set instance variables.
                $this->mArticle = $article;
                $this->mTitle = $article->mTitle;
-               $this->mApplicableTypes = $this->mTitle->getProtectionTypes();
+               $this->mApplicableTypes = $this->mTitle->getRestrictionTypes();
                
                // Check if the form should be disabled.
                // If it is, the form will be available in read-only to show levels.
@@ -191,7 +191,7 @@ class ProtectionForm {
 
                list( $cascadeSources, /* $restrictions */ ) = $this->mTitle->getCascadeProtectionSources();
 
-               if ( "" != $err ) {
+               if ( $err != "" ) {
                        $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
                        $wgOut->addHTML( "<p class='error'>{$err}</p>\n" );
                }
@@ -295,7 +295,7 @@ class ProtectionForm {
                        return false;
                }
 
-               if( $wgRequest->getCheck( 'mwProtectWatch' ) ) {
+               if( $wgRequest->getCheck( 'mwProtectWatch' ) && $wgUser->isLoggedIn() ) {
                        $this->mArticle->doWatch();
                } elseif( $this->mTitle->userIsWatching() ) {
                        $this->mArticle->doUnwatch();
@@ -451,7 +451,10 @@ class ProtectionForm {
                                                Xml::input( 'mwProtect-reason', 60, $this->mReason, array( 'type' => 'text',
                                                        'id' => 'mwProtect-reason', 'maxlength' => 255 ) ) .
                                        "</td>
-                               </tr>
+                               </tr>";
+                       # Disallow watching is user is not logged in
+                       if( $wgUser->isLoggedIn() ) {
+                               $out .= "
                                <tr>
                                        <td></td>
                                        <td class='mw-input'>" .
@@ -459,7 +462,9 @@ class ProtectionForm {
                                                        'mwProtectWatch', 'mwProtectWatch',
                                                        $this->mTitle->userIsWatching() || $wgUser->getOption( 'watchdefault' ) ) .
                                        "</td>
-                               </tr>
+                               </tr>";
+                       }
+                       $out .= "
                                <tr>
                                        <td></td>
                                        <td class='mw-submit'>" .