$wgHooks['LanguageGetMagic'][] = 'wfSimpleSecurityLanguageGetMagic'; $wgExtensionCredits['parserhook'][] = array( 'path' => __FILE__, 'name' => "SimpleSecurity", 'author' => "[http://www.organicdesign.co.nz/User:Nad User:Nad]", 'url' => "http://www.mediawiki.org/wiki/Extension:SimpleSecurity", 'version' => SIMPLESECURITY_VERSION, 'descriptionmsg' => 'security-desc', ); $wgHooks['MessagesPreLoad'][] = 'wfSimpleSecurityMessagesPreLoad'; # Instantiate the SimpleSecurity singleton now that the environment is prepared $wgSimpleSecurity = new SimpleSecurity(); # If using the DBHook, apply it now (must be done from the root scope since it creates classes) if( $wgSecurityUseDBHook ) SimpleSecurity::applyDatabaseHook(); /** * Register magic words */ function wfSimpleSecurityLanguageGetMagic( &$magicWords, $langCode = 0 ) { global $wgSecurityMagicIf, $wgSecurityMagicGroup; $magicWords[$wgSecurityMagicIf] = array( $langCode, $wgSecurityMagicIf ); $magicWords[$wgSecurityMagicGroup] = array( $langCode, $wgSecurityMagicGroup ); return true; } function wfSimpleSecurityMessagesPreLoad( $title, &$text ) { global $wgSecurityExtraActions, $wgSecurityExtraGroups; if( substr( $title, 0, 12 ) == 'Restriction-' ) {
# Extra group permissions rules $wgPageRestrictions = array(); # Enable this if you use the RecordAdmin extension and want Record template's # protection to apply to all instances of that record type $wgSecurityProtectRecords = true; # Don't use the DB hook by default since it's voodoo if (!isset($wgSecurityUseDBHook)) { $wgSecurityUseDBHook = false; } $wgExtensionCredits['parserhook'][] = array('path' => __FILE__, 'name' => "SimpleSecurity", 'author' => "[http://www.organicdesign.co.nz/User:Nad User:Nad]", 'url' => "http://www.mediawiki.org/wiki/Extension:SimpleSecurity", 'version' => SIMPLESECURITY_VERSION, 'descriptionmsg' => 'security-desc'); $wgHooks['MessagesPreLoad'][] = 'wfSimpleSecurityMessagesPreLoad'; # Instantiate the SimpleSecurity singleton now that the environment is prepared $wgSimpleSecurity = new SimpleSecurity(); # If using the DBHook, apply it now (must be done from the root scope since it creates classes) if ($wgSecurityUseDBHook) { SimpleSecurity::applyDatabaseHook(); } function wfSimpleSecurityMessagesPreLoad($title, &$text) { global $wgSecurityExtraActions, $wgSecurityExtraGroups; if (substr($title, 0, 12) == 'Restriction-') { $key = substr($title, 12); if (isset($wgSecurityExtraActions[$key])) { $text = empty($wgSecurityExtraActions[$key]) ? ucfirst($key) : $wgSecurityExtraActions[$key]; } return true; } elseif (substr($title, 0, 14) == 'Protect-level-') { $key = substr($title, 14); $type = 'level'; } elseif (substr($title, 0, 6) == 'Right-') { $key = substr($title, 6);