Introduce "semiprotectedpagewarning" which appears when a user edits a page that...
authorRob Church <robchurch@users.mediawiki.org>
Mon, 6 Feb 2006 09:49:28 +0000 (09:49 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Mon, 6 Feb 2006 09:49:28 +0000 (09:49 +0000)
includes/EditPage.php
includes/Title.php
languages/Messages.php

index d5c4095..66bf97f 100644 (file)
@@ -726,10 +726,18 @@ class EditPage {
                        $wgOut->addWikiText( wfMsg( 'anoneditwarning' ) );
                }
                
-               if( $this->mTitle->isProtected('edit') ) {
-                       $wgOut->addWikiText( wfMsg( 'protectedpagewarning' ) );
+               if( $this->mTitle->isProtected( 'edit' ) ) {
+                       if( $this->mTitle->isSemiProtected() ) {
+                               $notice = wfMsg( 'semiprotectedpagewarning' );
+                               if( wfEmptyMsg( 'semiprotectedpagewarning', $notice ) || $notice == '-' ) {
+                                       $notice = '';
+                               }
+                       } else {
+                               $notice = wfMsg( 'protectedpagewarning' );
+                       }
+                       $wgOut->addWikiText( $notice );
                }
-
+               
                $kblength = (int)(strlen( $this->textbox1 ) / 1024);
                if( $kblength > 29 ) {
                        $wgOut->addWikiText( wfMsg( 'longpagewarning', $wgLang->formatNum( $kblength ) ) );
index 4cfce2b..2c19325 100644 (file)
@@ -866,6 +866,23 @@ class Title {
         */
        function isExternal() { return ( '' != $this->mInterwiki ); }
 
+       /**
+        * Is this page "semi-protected" - the *only* protection is autoconfirm?
+        *
+        * @param string Action to check (default: edit)
+        * @return bool
+        */
+       function isSemiProtected( $action = 'edit' ) {
+               $restrictions = $this->getRestrictions( $action );
+               # We do a full compare because this could be an array
+               foreach( $restrictions as $restriction ) {
+                       if( strtolower( $restriction ) != 'autoconfirmed' ) {
+                               return( false );
+                       }
+               }
+               return( true );
+       }
+
        /**
         * Does the title correspond to a protected article?
         * @param string $what the action the page is protected from,
index 8924eb9..1beb6a5 100644 (file)
@@ -524,6 +524,7 @@ Please consider breaking the page into smaller sections.</strong>",
 so you will not be able to save your edits right now. You may wish to cut-n-paste
 the text into a text file and save it for later.</strong>',
 'protectedpagewarning' => "<strong>WARNING:  This page has been locked so that only users with sysop privileges can edit it. Be sure you are following the [[Project:Protected_page_guidelines|protected page guidelines]].</strong>",
+'semiprotectedpagewarning' => "'''Note:''' This page has been locked so that only registered users can edit it.",
 'templatesused'        => 'Templates used on this page:',
 'edittools' => '<!-- Text here will be shown below edit and upload forms. -->',
 'nocreatetitle' => 'Page creation limited',