$wgHitcounterUpdateFreq = 1;
# User rights
-$wgWhitelistEdit = false;
-$wgWhitelistRead = false;
+$wgWhitelistEdit = false; # true = user must login to edit.
+$wgWhitelistRead = false; # Pages anonymous user may see, like: = array ( ":Main_Page", "Special:Userlogin", "Wikipedia:Help");
$wgWhitelistAccount = array ( "user" => 1, "sysop" => 1, "developer" => 1 );
$wgSysopUserBans = false; # Allow sysops to ban logged-in users
$wgSysopRangeBans = false; # Allow sysops to ban IP ranges
$this->returnToMain();
}
+ function loginToUse()
+ {
+ global $wgUser, $wgTitle, $wgLang;
+
+ $this->setHTMLTitle( wfMsg( "errorpagetitle" ) );
+ $this->setPageTitle( wfMsg( "loginreqtitle" ) );
+ $this->setRobotpolicy( "noindex,nofollow" );
+ $this->setArticleFlag( false );
+ $this->mBodytext = "";
+ $this->addWikiText( wfMsg( "loginreqtext" ) );
+
+ # We put a comment in the .html file so a Sysop can diagnose the page the
+ # user can't see.
+ $this->addHTML( "\n<!--" .
+ $wgLang->getNsText( $wgTitle->getNamespace() ) .
+ ":" .
+ $wgTitle->getDBkey() . "-->" );
+ $this->returnToMain(); # Flip back to the main page after 10 seconds.
+ }
+
function databaseError( $fname, &$conn )
{
global $wgUser, $wgCommandLineMode;
}
wfProfileOut( "main-misc-setup" );
+# If the user is not logged in, the Namespace:title of the article must be in the Read array in
+# order for the user to see it.
+if ( !$wgUser->getID() && is_array( $wgWhitelistRead ) && $wgTitle) {
+ if ( !in_array( $wgLang->getNsText( $wgTitle->getNamespace() ) . ":" . $wgTitle->getDBkey(), $wgWhitelistRead ) ) {
+ $wgOut->loginToUse();
+ $wgOut->output();
+ exit;
+ }
+}
+
if ( "" != $search ) {
if( isset($_REQUEST['fulltext']) ) {
wfSearch( $search );
"whitelistreadtext" => "You have to [[Special:Userlogin|login]] to read articles.",
"whitelistacctitle" => "You are not allowed to create an account",
"whitelistacctext" => "To be allowed to create accounts in this Wiki you have to [[Special:Userlogin|log]] in and have the appropriate permissions.",
+"loginreqtitle" => "Login Required",
+"loginreqtext" => "You must [[special:Userlogin|login]] to view other pages.",
"accmailtitle" => "Password sent.",
"accmailtext" => "The Password for '$1' has been sent to $2.",
"newarticle" => "(New)",