If the global config variable $wgWhitelistEdit is true, only
[lhc/web/wiklou.git] / includes / EditPage.php
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 );
+       }
+
+
 }
 
 ?>