switch to disable page creation for anonymous users.
Jimmy requested we have this ability available.
* (bug 4162) Add $wgThumbnailEpoch timestamp to force old thumbs to
be rerendered on demand, sitewide
* (bug 4165) Correct validation for user language selection (data taint)
+* Add createpage and createtalk permission keys, allowing a quick
+ switch to disable page creation for anonymous users.
=== Caveats ===
$wgGroupPermissions['*' ]['createaccount'] = true;
$wgGroupPermissions['*' ]['read'] = true;
$wgGroupPermissions['*' ]['edit'] = true;
+$wgGroupPermissions['*' ]['createpage'] = true;
+$wgGroupPermissions['*' ]['createtalk'] = true;
$wgGroupPermissions['user' ]['move'] = true;
$wgGroupPermissions['user' ]['read'] = true;
$wgGroupPermissions['user' ]['edit'] = true;
+$wgGroupPermissions['user' ]['createpage'] = true;
+$wgGroupPermissions['user' ]['createtalk'] = true;
$wgGroupPermissions['user' ]['upload'] = true;
$wgGroupPermissions['user' ]['reupload'] = true;
$wgGroupPermissions['user' ]['reupload-shared'] = true;
return;
}
}
+ if ( !$this->mTitle->userCan( 'create' ) && !$this->mTitle->exists() ) {
+ wfDebug( "$fname: no create permission\n" );
+ $this->noCreatePermission();
+ wfProfileOut( $fname );
+ return;
+ }
if ( wfReadOnly() ) {
wfDebug( "$fname: read-only mode is engaged\n" );
if( $this->save || $this->preview ) {
# If article is new, insert it.
$aid = $this->mTitle->getArticleID( GAID_FOR_UPDATE );
if ( 0 == $aid ) {
+ // Late check for create permission, just in case *PARANOIA*
+ if ( !$this->mTitle->userCan( 'create' ) ) {
+ wfDebug( "$fname: no create permission\n" );
+ $this->noCreatePermission();
+ wfProfileOut( $fname );
+ return;
+ }
+
# Don't save a new article if it's blank.
if ( ( '' == $this->textbox1 ) ) {
$wgOut->redirect( $this->mTitle->getFullURL() );
return strtr( $result, array( "�" => "&#x" ) );
}
+ function noCreatePermission() {
+ global $wgOut;
+ $wgOut->setPageTitle( wfMsg( 'nocreatetitle' ) );
+ $wgOut->addWikiText( wfMsg( 'nocreatetext' ) );
+ }
}
wfProfileOut( $fname );
return false;
}
+
+ if( $action == 'create' ) {
+ if( ( $this->isTalkPage() && !$wgUser->isAllowed( 'createtalk' ) ) ||
+ ( !$this->isTalkPage() && !$wgUser->isAllowed( 'createpage' ) ) ) {
+ return false;
+ }
+ }
wfProfileOut( $fname );
return true;
'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>",
'templatesused' => 'Templates used on this page:',
'edittools' => '<!-- Text here will be shown below edit and upload forms. -->',
+'nocreatetitle' => 'Page creation limited',
+'nocreatetext' => 'This site has restricted the ability to create new pages.
+You can go back and edit an existing page, or [[Special:Userlogin|log in or create an account]].',
# History pages
#