Differenze tra le versioni di "Pagine speciali bloccate per i visitatori (non loggati)"

 
(Una versione intermedia di uno stesso utente non è mostrata)
Riga 11: Riga 11:
 
if( ! $wgUser->isLoggedIn() ) {
 
if( ! $wgUser->isLoggedIn() ) {
 
$list = array();
 
$list = array();
// Abilito solo la pagina di login
+
// Abilito solo la pagina di login, logout e ricerca
 
$list['Userlogin'] = "SpecialUserLogin";
 
$list['Userlogin'] = "SpecialUserLogin";
 +
$list['Userlogout'] = "SpecialUserLogout";
 +
$list['Search'] = "SpecialSearch";
 
}
 
}
 
return true;
 
return true;
Riga 21: Riga 23:
 
==== Nota Bene ====
 
==== Nota Bene ====
 
Il codice {{code|<nowiki>$list['Userlogin'] = "SpecialUserLogin";</nowiki>}} potrebbe cambiare in base alla versione di MediaWiki utilizzata.
 
Il codice {{code|<nowiki>$list['Userlogin'] = "SpecialUserLogin";</nowiki>}} potrebbe cambiare in base alla versione di MediaWiki utilizzata.
 +
 +
== Abilitazione pagine speciali singolarmente ==
 +
<pre>
 +
Array
 +
(
 +
    [BrokenRedirects] => BrokenRedirectsPage
 +
    [Deadendpages] => DeadendPagesPage
 +
    [DoubleRedirects] => DoubleRedirectsPage
 +
    [Longpages] => LongPagesPage
 +
    [Ancientpages] => AncientPagesPage
 +
    [Lonelypages] => LonelyPagesPage
 +
    [Fewestrevisions] => FewestrevisionsPage
 +
    [Withoutinterwiki] => WithoutInterwikiPage
 +
    [Protectedpages] => SpecialProtectedpages
 +
    [Protectedtitles] => SpecialProtectedtitles
 +
    [Shortpages] => ShortPagesPage
 +
    [Uncategorizedcategories] => UncategorizedCategoriesPage
 +
    [Uncategorizedimages] => UncategorizedImagesPage
 +
    [Uncategorizedpages] => UncategorizedPagesPage
 +
    [Uncategorizedtemplates] => UncategorizedTemplatesPage
 +
    [Unusedcategories] => UnusedCategoriesPage
 +
    [Unusedimages] => UnusedimagesPage
 +
    [Unusedtemplates] => UnusedtemplatesPage
 +
    [Unwatchedpages] => UnwatchedpagesPage
 +
    [Wantedcategories] => WantedCategoriesPage
 +
    [Wantedfiles] => WantedFilesPage
 +
    [Wantedpages] => WantedPagesPage
 +
    [Wantedtemplates] => WantedTemplatesPage
 +
    [Allpages] => SpecialAllPages
 +
    [Prefixindex] => SpecialPrefixindex
 +
    [Categories] => SpecialCategories
 +
    [Listredirects] => ListredirectsPage
 +
    [PagesWithProp] => SpecialPagesWithProp
 +
    [TrackingCategories] => SpecialTrackingCategories
 +
    [Userlogin] => SpecialUserLogin                        - pagina di login
 +
    [Userlogout] => SpecialUserLogout                      - pagina di logout
 +
    [CreateAccount] => SpecialCreateAccount
 +
    [LinkAccounts] => SpecialLinkAccounts
 +
    [UnlinkAccounts] => SpecialUnlinkAccounts
 +
    [ChangeCredentials] => SpecialChangeCredentials
 +
    [RemoveCredentials] => SpecialRemoveCredentials
 +
    [Activeusers] => SpecialActiveUsers
 +
    [Block] => SpecialBlock
 +
    [Unblock] => SpecialUnblock
 +
    [BlockList] => SpecialBlockList
 +
    [AutoblockList] => SpecialAutoblockList
 +
    [ChangePassword] => SpecialChangePassword
 +
    [BotPasswords] => SpecialBotPasswords
 +
    [PasswordReset] => SpecialPasswordReset
 +
    [DeletedContributions] => DeletedContributionsPage
 +
    [Preferences] => SpecialPreferences
 +
    [ResetTokens] => SpecialResetTokens
 +
    [Contributions] => SpecialContributions
 +
    [Listgrouprights] => SpecialListGroupRights
 +
    [Listgrants] => SpecialListGrants
 +
    [Listusers] => SpecialListUsers
 +
    [Listadmins] => SpecialListAdmins
 +
    [Listbots] => SpecialListBots
 +
    [Userrights] => UserrightsPage
 +
    [EditWatchlist] => SpecialEditWatchlist
 +
    [Newimages] => SpecialNewFiles
 +
    [Log] => SpecialLog
 +
    [Watchlist] => SpecialWatchlist
 +
    [Newpages] => SpecialNewpages
 +
    [Recentchanges] => SpecialRecentChanges
 +
    [Recentchangeslinked] => SpecialRecentChangesLinked
 +
    [Tags] => SpecialTags
 +
    [Listfiles] => SpecialListFiles
 +
    [Filepath] => SpecialFilepath
 +
    [MediaStatistics] => MediaStatisticsPage
 +
    [MIMEsearch] => MIMEsearchPage
 +
    [FileDuplicateSearch] => FileDuplicateSearchPage
 +
    [Upload] => SpecialUpload
 +
    [UploadStash] => SpecialUploadStash
 +
    [ListDuplicatedFiles] => ListDuplicatedFilesPage
 +
    [ApiSandbox] => SpecialApiSandbox
 +
    [Statistics] => SpecialStatistics
 +
    [Allmessages] => SpecialAllMessages
 +
    [Version] => SpecialVersion
 +
    [Lockdb] => SpecialLockdb
 +
    [Unlockdb] => SpecialUnlockdb
 +
    [LinkSearch] => LinkSearchPage
 +
    [Randompage] => RandomPage
 +
    [RandomInCategory] => SpecialRandomInCategory
 +
    [Randomredirect] => SpecialRandomredirect
 +
    [Randomrootpage] => SpecialRandomrootpage
 +
    [GoToInterwiki] => SpecialGoToInterwiki
 +
    [Mostlinkedcategories] => MostlinkedCategoriesPage
 +
    [Mostimages] => MostimagesPage
 +
    [Mostinterwikis] => MostinterwikisPage
 +
    [Mostlinked] => MostlinkedPage
 +
    [Mostlinkedtemplates] => MostlinkedTemplatesPage
 +
    [Mostcategories] => MostcategoriesPage
 +
    [Mostrevisions] => MostrevisionsPage
 +
    [ComparePages] => SpecialComparePages
 +
    [Export] => SpecialExport
 +
    [Import] => SpecialImport
 +
    [Undelete] => SpecialUndelete
 +
    [Whatlinkshere] => SpecialWhatLinksHere
 +
    [MergeHistory] => SpecialMergeHistory
 +
    [ExpandTemplates] => SpecialExpandTemplates
 +
    [Booksources] => SpecialBookSources
 +
    [ApiHelp] => SpecialApiHelp
 +
    [Blankpage] => SpecialBlankpage
 +
    [Diff] => SpecialDiff
 +
    [EditTags] => SpecialEditTags
 +
    [Emailuser] => SpecialEmailUser
 +
    [Movepage] => MovePageForm
 +
    [Mycontributions] => SpecialMycontributions
 +
    [MyLanguage] => SpecialMyLanguage
 +
    [Mypage] => SpecialMypage
 +
    [Mytalk] => SpecialMytalk
 +
    [Myuploads] => SpecialMyuploads
 +
    [AllMyUploads] => SpecialAllMyUploads
 +
    [PermanentLink] => SpecialPermanentLink
 +
    [Redirect] => SpecialRedirect
 +
    [Revisiondelete] => SpecialRevisionDelete
 +
    [RunJobs] => SpecialRunJobs
 +
    [Specialpages] => SpecialSpecialpages
 +
    [PageData] => SpecialPageData
 +
    [Search] => SpecialSearch                              - ricerca
 +
    [Confirmemail] => EmailConfirmation
 +
    [Invalidateemail] => EmailInvalidation
 +
    [ChangeEmail] => SpecialChangeEmail
 +
    [ChangeContentModel] => SpecialChangeContentModel
 +
)
 +
</pre>

Versione attuale delle 20:04, 24 apr 2020

← MediaWiki

Grazie alla guida https://www.mediawiki.org/wiki/Manual:Hooks/SpecialPage_initList

Abbiamo distillato questo codice che permette di bloccare le pagine speciali se non si è loggati.

// disabilitazione pagine speciali
function disableAllSpecialPages( &$list ) {
	global $wgUser;
	if( ! $wgUser->isLoggedIn() ) {
		$list = array();
		// Abilito solo la pagina di login, logout e ricerca
		$list['Userlogin'] = "SpecialUserLogin";
		$list['Userlogout'] = "SpecialUserLogout";
		$list['Search'] = "SpecialSearch";
	}
	return true;
}
$wgHooks['SpecialPage_initList'][] = 'disableAllSpecialPages';

Nota Bene

Il codice $list['Userlogin'] = "SpecialUserLogin"; potrebbe cambiare in base alla versione di MediaWiki utilizzata.

Abilitazione pagine speciali singolarmente

Array
(
    [BrokenRedirects] => BrokenRedirectsPage
    [Deadendpages] => DeadendPagesPage
    [DoubleRedirects] => DoubleRedirectsPage
    [Longpages] => LongPagesPage
    [Ancientpages] => AncientPagesPage
    [Lonelypages] => LonelyPagesPage
    [Fewestrevisions] => FewestrevisionsPage
    [Withoutinterwiki] => WithoutInterwikiPage
    [Protectedpages] => SpecialProtectedpages
    [Protectedtitles] => SpecialProtectedtitles
    [Shortpages] => ShortPagesPage
    [Uncategorizedcategories] => UncategorizedCategoriesPage
    [Uncategorizedimages] => UncategorizedImagesPage
    [Uncategorizedpages] => UncategorizedPagesPage
    [Uncategorizedtemplates] => UncategorizedTemplatesPage
    [Unusedcategories] => UnusedCategoriesPage
    [Unusedimages] => UnusedimagesPage
    [Unusedtemplates] => UnusedtemplatesPage
    [Unwatchedpages] => UnwatchedpagesPage
    [Wantedcategories] => WantedCategoriesPage
    [Wantedfiles] => WantedFilesPage
    [Wantedpages] => WantedPagesPage
    [Wantedtemplates] => WantedTemplatesPage
    [Allpages] => SpecialAllPages
    [Prefixindex] => SpecialPrefixindex
    [Categories] => SpecialCategories
    [Listredirects] => ListredirectsPage
    [PagesWithProp] => SpecialPagesWithProp
    [TrackingCategories] => SpecialTrackingCategories
    [Userlogin] => SpecialUserLogin                        - pagina di login
    [Userlogout] => SpecialUserLogout                      - pagina di logout
    [CreateAccount] => SpecialCreateAccount
    [LinkAccounts] => SpecialLinkAccounts
    [UnlinkAccounts] => SpecialUnlinkAccounts
    [ChangeCredentials] => SpecialChangeCredentials
    [RemoveCredentials] => SpecialRemoveCredentials
    [Activeusers] => SpecialActiveUsers
    [Block] => SpecialBlock
    [Unblock] => SpecialUnblock
    [BlockList] => SpecialBlockList
    [AutoblockList] => SpecialAutoblockList
    [ChangePassword] => SpecialChangePassword
    [BotPasswords] => SpecialBotPasswords
    [PasswordReset] => SpecialPasswordReset
    [DeletedContributions] => DeletedContributionsPage
    [Preferences] => SpecialPreferences
    [ResetTokens] => SpecialResetTokens
    [Contributions] => SpecialContributions
    [Listgrouprights] => SpecialListGroupRights
    [Listgrants] => SpecialListGrants
    [Listusers] => SpecialListUsers
    [Listadmins] => SpecialListAdmins
    [Listbots] => SpecialListBots
    [Userrights] => UserrightsPage
    [EditWatchlist] => SpecialEditWatchlist
    [Newimages] => SpecialNewFiles
    [Log] => SpecialLog
    [Watchlist] => SpecialWatchlist
    [Newpages] => SpecialNewpages
    [Recentchanges] => SpecialRecentChanges
    [Recentchangeslinked] => SpecialRecentChangesLinked
    [Tags] => SpecialTags
    [Listfiles] => SpecialListFiles
    [Filepath] => SpecialFilepath
    [MediaStatistics] => MediaStatisticsPage
    [MIMEsearch] => MIMEsearchPage
    [FileDuplicateSearch] => FileDuplicateSearchPage
    [Upload] => SpecialUpload
    [UploadStash] => SpecialUploadStash
    [ListDuplicatedFiles] => ListDuplicatedFilesPage
    [ApiSandbox] => SpecialApiSandbox
    [Statistics] => SpecialStatistics
    [Allmessages] => SpecialAllMessages
    [Version] => SpecialVersion
    [Lockdb] => SpecialLockdb
    [Unlockdb] => SpecialUnlockdb
    [LinkSearch] => LinkSearchPage
    [Randompage] => RandomPage
    [RandomInCategory] => SpecialRandomInCategory
    [Randomredirect] => SpecialRandomredirect
    [Randomrootpage] => SpecialRandomrootpage
    [GoToInterwiki] => SpecialGoToInterwiki
    [Mostlinkedcategories] => MostlinkedCategoriesPage
    [Mostimages] => MostimagesPage
    [Mostinterwikis] => MostinterwikisPage
    [Mostlinked] => MostlinkedPage
    [Mostlinkedtemplates] => MostlinkedTemplatesPage
    [Mostcategories] => MostcategoriesPage
    [Mostrevisions] => MostrevisionsPage
    [ComparePages] => SpecialComparePages
    [Export] => SpecialExport
    [Import] => SpecialImport
    [Undelete] => SpecialUndelete
    [Whatlinkshere] => SpecialWhatLinksHere
    [MergeHistory] => SpecialMergeHistory
    [ExpandTemplates] => SpecialExpandTemplates
    [Booksources] => SpecialBookSources
    [ApiHelp] => SpecialApiHelp
    [Blankpage] => SpecialBlankpage
    [Diff] => SpecialDiff
    [EditTags] => SpecialEditTags
    [Emailuser] => SpecialEmailUser
    [Movepage] => MovePageForm
    [Mycontributions] => SpecialMycontributions
    [MyLanguage] => SpecialMyLanguage
    [Mypage] => SpecialMypage
    [Mytalk] => SpecialMytalk
    [Myuploads] => SpecialMyuploads
    [AllMyUploads] => SpecialAllMyUploads
    [PermanentLink] => SpecialPermanentLink
    [Redirect] => SpecialRedirect
    [Revisiondelete] => SpecialRevisionDelete
    [RunJobs] => SpecialRunJobs
    [Specialpages] => SpecialSpecialpages
    [PageData] => SpecialPageData
    [Search] => SpecialSearch                              - ricerca
    [Confirmemail] => EmailConfirmation
    [Invalidateemail] => EmailInvalidation
    [ChangeEmail] => SpecialChangeEmail
    [ChangeContentModel] => SpecialChangeContentModel
)