If the global config variable $wgWhitelistEdit is true, only
authorMatthias Jordan <matjordan@users.mediawiki.org>
Tue, 5 Aug 2003 11:04:02 +0000 (11:04 +0000)
committerMatthias Jordan <matjordan@users.mediawiki.org>
Tue, 5 Aug 2003 11:04:02 +0000 (11:04 +0000)
logged in users are allowed and able to edit articles.

includes/DefaultSettings.php
includes/EditPage.php
languages/Language.php

index edad2a6..f15ea34 100644 (file)
@@ -62,6 +62,9 @@ $wgSqlLogFile         = "{$wgUploadDirectory}/sqllog_mFhyRe6";
 $wgLogQueries          = false;
 $wgUseBetterLinksUpdate = true;
 
+# If wgWhitelistEdit is set to true, only logged in users
+# are allowed to edit articles.
+# $wgWhitelistEdit     = true;
 
 # Client-side caching:
 $wgCachePages       = true; # Allow client-side caching of pages
index d2ee7d8..367e068 100644 (file)
@@ -19,7 +19,7 @@ class EditPage {
 
        function edit()
        {
-               global $wgOut, $wgUser;
+               global $wgOut, $wgUser, $wgWhitelistEdit;
                global $wpTextbox1, $wpSummary, $wpSave, $wpPreview;
                global $wpMinoredit, $wpEdittime, $wpTextbox2;
 
@@ -34,6 +34,10 @@ class EditPage {
                        $this->blockedIPpage();
                        return;
                }
+               if ( !$wgUser->getID() && $wgWhitelistEdit ) {
+                       $this->userNotLoggedInPage();
+                       return;
+               }
                if ( wfReadOnly() ) {
                        if( isset( $wpSave ) or isset( $wpPreview ) ) {
                                $this->editForm( "preview" );
@@ -103,6 +107,10 @@ class EditPage {
                                $this->blockedIPpage();
                                return;
                        }
+                       if ( !$wgUser->getID() && $wgWhitelistEdit ) {
+                               $this->userNotLoggedInPage();
+                               return;
+                       }
                        if ( wfReadOnly() ) {
                                $wgOut->readOnlyPage();
                                return;
@@ -338,6 +346,20 @@ $wgLang->recodeForEdit( $wpTextbox1 ) .
        }
 
 
+
+       function userNotLoggedInPage()
+       {
+               global $wgOut, $wgUser, $wgLang;
+
+               $wgOut->setPageTitle( wfMsg( "whitelistedittitle" ) );
+               $wgOut->setRobotpolicy( "noindex,nofollow" );
+               $wgOut->setArticleFlag( false );
+
+               $wgOut->addWikiText( wfMsg( "whitelistedittext" ) );
+               $wgOut->returnToMain( false );
+       }
+
+
 }
 
 ?>
index 3ae261e..dff60df 100644 (file)
@@ -506,6 +506,8 @@ Please log in again after you receive it.",
 "blockedtext"  => "Your user name or IP address has been blocked by $1.
 The reason given is this:<br>''$2''<p>You may contact $1 or one of the other
 [[Wikipedia:administrators|administrators]] to discuss the block.",
+"whitelistedittitle" => "User not logged in",
+"whitelistedittext" => "You have to [[Spezial:Userlogin|login]] to edit articles.",
 "newarticle"   => "(New)",
 "newarticletext" =>
 "You've followed a link to a page that doesn't exist yet.