Index: trunk/phase3/index.php |
— | — | @@ -46,6 +46,16 @@ |
47 | 47 | } |
48 | 48 | wfProfileOut( "main-misc-setup" ); |
49 | 49 | |
| 50 | +# If the user is not logged in, the Namespace:title of the article must be in the Read array in |
| 51 | +# order for the user to see it. |
| 52 | +if ( !$wgUser->getID() && is_array( $wgWhitelistRead ) && $wgTitle) { |
| 53 | + if ( !in_array( $wgLang->getNsText( $wgTitle->getNamespace() ) . ":" . $wgTitle->getDBkey(), $wgWhitelistRead ) ) { |
| 54 | + $wgOut->loginToUse(); |
| 55 | + $wgOut->output(); |
| 56 | + exit; |
| 57 | + } |
| 58 | +} |
| 59 | + |
50 | 60 | if ( "" != $search ) { |
51 | 61 | if( isset($_REQUEST['fulltext']) ) { |
52 | 62 | wfSearch( $search ); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -121,8 +121,8 @@ |
122 | 122 | $wgHitcounterUpdateFreq = 1; |
123 | 123 | |
124 | 124 | # User rights |
125 | | -$wgWhitelistEdit = false; |
126 | | -$wgWhitelistRead = false; |
| 125 | +$wgWhitelistEdit = false; # true = user must login to edit. |
| 126 | +$wgWhitelistRead = false; # Pages anonymous user may see, like: = array ( ":Main_Page", "Special:Userlogin", "Wikipedia:Help"); |
127 | 127 | $wgWhitelistAccount = array ( "user" => 1, "sysop" => 1, "developer" => 1 ); |
128 | 128 | $wgSysopUserBans = false; # Allow sysops to ban logged-in users |
129 | 129 | $wgSysopRangeBans = false; # Allow sysops to ban IP ranges |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -407,6 +407,26 @@ |
408 | 408 | $this->returnToMain(); |
409 | 409 | } |
410 | 410 | |
| 411 | + function loginToUse() |
| 412 | + { |
| 413 | + global $wgUser, $wgTitle, $wgLang; |
| 414 | + |
| 415 | + $this->setHTMLTitle( wfMsg( "errorpagetitle" ) ); |
| 416 | + $this->setPageTitle( wfMsg( "loginreqtitle" ) ); |
| 417 | + $this->setRobotpolicy( "noindex,nofollow" ); |
| 418 | + $this->setArticleFlag( false ); |
| 419 | + $this->mBodytext = ""; |
| 420 | + $this->addWikiText( wfMsg( "loginreqtext" ) ); |
| 421 | + |
| 422 | + # We put a comment in the .html file so a Sysop can diagnose the page the |
| 423 | + # user can't see. |
| 424 | + $this->addHTML( "\n<!--" . |
| 425 | + $wgLang->getNsText( $wgTitle->getNamespace() ) . |
| 426 | + ":" . |
| 427 | + $wgTitle->getDBkey() . "-->" ); |
| 428 | + $this->returnToMain(); # Flip back to the main page after 10 seconds. |
| 429 | + } |
| 430 | + |
411 | 431 | function databaseError( $fname, &$conn ) |
412 | 432 | { |
413 | 433 | global $wgUser, $wgCommandLineMode; |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -692,6 +692,8 @@ |
693 | 693 | "whitelistreadtext" => "You have to [[Special:Userlogin|login]] to read articles.", |
694 | 694 | "whitelistacctitle" => "You are not allowed to create an account", |
695 | 695 | "whitelistacctext" => "To be allowed to create accounts in this Wiki you have to [[Special:Userlogin|log]] in and have the appropriate permissions.", |
| 696 | +"loginreqtitle" => "Login Required", |
| 697 | +"loginreqtext" => "You must [[special:Userlogin|login]] to view other pages.", |
696 | 698 | "accmailtitle" => "Password sent.", |
697 | 699 | "accmailtext" => "The Password for '$1' has been sent to $2.", |
698 | 700 | "newarticle" => "(New)", |